Temporarily remove frame cache from Shark
Gary Benson
gbenson at redhat.com
Wed Jun 17 06:42:02 PDT 2009
Hi all,
This commit removes the frame cache from Shark. I'm working on a big
refactor that'll make Shark a lot cleaner and easier to hack on, and
will open the door to some new optimizations. The frame cache is
totally in the way of this, so I thought I'd blow it away temporarily.
Shark will be slightly slower for a while.
Cheers,
Gary
--
http://gbenson.net/
-------------- next part --------------
diff -r e6350d5249d3 -r 4a617634d81c ChangeLog
--- a/ChangeLog Tue Jun 16 10:58:00 2009 -0400
+++ b/ChangeLog Wed Jun 17 14:37:31 2009 +0100
@@ -1,3 +1,41 @@
+2009-06-17 Gary Benson <gbenson at redhat.com>
+
+ * ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp
+ (SharkCacherDecacher::SharkCacherDecacher): Remove frame cache code.
+ (SharkCacherDecacher::_frame_cache): Removed.
+ (SharkCacherDecacher::frame_cache): Likewise.
+ (SharkDecacher::SharkDecacher): Removed frame cache code.
+ (SharkJavaCallDecacher::SharkJavaCallDecacher): Likewise.
+ (SharkVMCallDecacher::SharkVMCallDecacher): Likewise.
+ (SharkTrapDecacher::SharkTrapDecacher): Likewise.
+ (SharkCacher::SharkCacher): Likewise.
+ (SharkJavaCallCacher::SharkJavaCallCcacher): Likewise.
+ (SharkVMCallCacher::SharkVMCallCacher): Likewise.
+ (SharkFunctionEntryCacher::SharkFunctionEntryCacher): Likewise.
+ * ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp
+ (SharkDecacher::write_value_to_frame): Remove frame cache code.
+ (SharkDecacher::read_value_from_frame): Likewise.
+
+ * ports/hotspot/src/share/vm/shark/sharkState.hpp
+ (SharkState::_frame_cache): Removed.
+ (SharkState::frame_cache): Likewise.
+ * ports/hotspot/src/share/vm/shark/sharkState.cpp
+ (SharkState::SharkState): Remove frame cache code.
+ (SharkState::initialize): Likewise.
+ (SharkState::equal_to): Likewise.
+ (SharkState::merge): Likewise.
+ (SharkState::decache_for_Java_call): Likewise.
+ (SharkState::cache_after_Java_call): Likewise.
+ (SharkState::decache_for_VM_call): Likewise.
+ (SharkState::cache_after_VM_call): Likewise.
+ (SharkState::decache_for_trap): Likewise.
+ (SharkEntryState::SharkEntryState): Likewise.
+
+ * ports/hotspot/src/share/vm/shark/sharkFrameCache.hpp: Removed.
+ * ports/hotspot/src/share/vm/shark/sharkFrameCache.cpp: Likewise.
+
+ * ports/hotspot/src/share/vm/includeDB_shark: Updated.
+
2009-06-16 Omair Majid <omajid at redhat.com>
* rt/javax/jnlp/SingleInstanceListener.java: New file.
diff -r e6350d5249d3 -r 4a617634d81c ports/hotspot/src/share/vm/includeDB_shark
--- a/ports/hotspot/src/share/vm/includeDB_shark Tue Jun 16 10:58:00 2009 -0400
+++ b/ports/hotspot/src/share/vm/includeDB_shark Wed Jun 17 14:37:31 2009 +0100
@@ -120,14 +120,12 @@
sharkCacheDecache.cpp llvmValue.hpp
sharkCacheDecache.cpp sharkBuilder.hpp
sharkCacheDecache.cpp sharkCacheDecache.hpp
-sharkCacheDecache.cpp sharkFrameCache.hpp
sharkCacheDecache.cpp sharkFunction.hpp
sharkCacheDecache.cpp sharkState.inline.hpp
sharkCacheDecache.hpp ciMethod.hpp
sharkCacheDecache.hpp debugInfoRec.hpp
sharkCacheDecache.hpp sharkBuilder.hpp
-sharkCacheDecache.hpp sharkFrameCache.hpp
sharkCacheDecache.hpp sharkFunction.hpp
sharkCacheDecache.hpp sharkStateScanner.hpp
@@ -174,15 +172,6 @@
sharkEntry.hpp llvmHeaders.hpp
-sharkFrameCache.cpp allocation.hpp
-sharkFrameCache.cpp llvmHeaders.hpp
-sharkFrameCache.cpp sharkFrameCache.hpp
-sharkFrameCache.cpp sharkFunction.hpp
-
-sharkFrameCache.hpp allocation.hpp
-sharkFrameCache.hpp llvmHeaders.hpp
-sharkFrameCache.hpp sharkFunction.hpp
-
sharkFunction.cpp allocation.hpp
sharkFunction.cpp ciTypeFlow.hpp
sharkFunction.cpp debug.hpp
@@ -260,7 +249,6 @@
sharkState.cpp ciTypeFlow.hpp
sharkState.cpp sharkBuilder.hpp
sharkState.cpp sharkCacheDecache.hpp
-sharkState.cpp sharkFrameCache.hpp
sharkState.cpp sharkState.inline.hpp
sharkState.cpp sharkTopLevelBlock.hpp
sharkState.cpp sharkType.hpp
@@ -270,11 +258,11 @@
sharkState.hpp ciMethod.hpp
sharkState.hpp llvmHeaders.hpp
sharkState.hpp sharkBuilder.hpp
-sharkState.hpp sharkFrameCache.hpp
sharkState.hpp sharkValue.hpp
sharkState.inline.hpp sharkBlock.hpp
sharkState.inline.hpp sharkBuilder.hpp
+sharkState.inline.hpp sharkFunction.hpp
sharkState.inline.hpp sharkState.hpp
sharkStateScanner.cpp sharkState.inline.hpp
diff -r e6350d5249d3 -r 4a617634d81c ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp Tue Jun 16 10:58:00 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp Wed Jun 17 14:37:31 2009 +0100
@@ -225,17 +225,12 @@
Value* value,
int offset)
{
- if (frame_cache()->value(offset) != value) {
- builder()->CreateStore(
- value,
- function()->CreateAddressOfFrameEntry(offset, type));
- }
+ builder()->CreateStore(
+ value, function()->CreateAddressOfFrameEntry(offset, type));
}
Value* SharkCacher::read_value_from_frame(const Type* type, int offset)
{
- Value *result = builder()->CreateLoad(
+ return builder()->CreateLoad(
function()->CreateAddressOfFrameEntry(offset, type));
- frame_cache()->set_value(offset, result);
- return result;
}
diff -r e6350d5249d3 -r 4a617634d81c ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp Tue Jun 16 10:58:00 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp Wed Jun 17 14:37:31 2009 +0100
@@ -37,17 +37,8 @@
class SharkCacherDecacher : public SharkStateScanner {
protected:
- SharkCacherDecacher(SharkFunction* function, SharkFrameCache* frame_cache)
- : SharkStateScanner(function), _frame_cache(frame_cache) {}
-
- private:
- SharkFrameCache* _frame_cache;
-
- protected:
- SharkFrameCache* frame_cache() const
- {
- return _frame_cache;
- }
+ SharkCacherDecacher(SharkFunction* function)
+ : SharkStateScanner(function) {}
protected:
SharkBuilder* builder() const
@@ -67,8 +58,8 @@
class SharkDecacher : public SharkCacherDecacher {
protected:
- SharkDecacher(SharkFunction* function, SharkFrameCache* frame_cache, int bci)
- : SharkCacherDecacher(function, frame_cache), _bci(bci) {}
+ SharkDecacher(SharkFunction* function, int bci)
+ : SharkCacherDecacher(function), _bci(bci) {}
private:
int _bci;
@@ -223,11 +214,8 @@
class SharkJavaCallDecacher : public SharkDecacher {
public:
- SharkJavaCallDecacher(SharkFunction* function,
- SharkFrameCache* frame_cache,
- int bci,
- ciMethod* callee)
- : SharkDecacher(function, frame_cache, bci), _callee(callee) {}
+ SharkJavaCallDecacher(SharkFunction* function, int bci, ciMethod* callee)
+ : SharkDecacher(function, bci), _callee(callee) {}
private:
ciMethod* _callee;
@@ -271,10 +259,8 @@
class SharkVMCallDecacher : public SharkDecacher {
public:
- SharkVMCallDecacher(SharkFunction* function,
- SharkFrameCache* frame_cache,
- int bci)
- : SharkDecacher(function, frame_cache, bci) {}
+ SharkVMCallDecacher(SharkFunction* function, int bci)
+ : SharkDecacher(function, bci) {}
// Stack slot helpers
protected:
@@ -309,10 +295,8 @@
class SharkTrapDecacher : public SharkDecacher {
public:
- SharkTrapDecacher(SharkFunction* function,
- SharkFrameCache* frame_cache,
- int bci)
- : SharkDecacher(function, frame_cache, bci) {}
+ SharkTrapDecacher(SharkFunction* function, int bci)
+ : SharkDecacher(function, bci) {}
// Stack slot helpers
protected:
@@ -347,8 +331,8 @@
class SharkCacher : public SharkCacherDecacher {
protected:
- SharkCacher(SharkFunction* function, SharkFrameCache* frame_cache)
- : SharkCacherDecacher(function, frame_cache) {}
+ SharkCacher(SharkFunction* function)
+ : SharkCacherDecacher(function) {}
// Callbacks
protected:
@@ -377,10 +361,8 @@
class SharkJavaCallCacher : public SharkCacher {
public:
- SharkJavaCallCacher(SharkFunction* function,
- SharkFrameCache* frame_cache,
- ciMethod* callee)
- : SharkCacher(function, frame_cache), _callee(callee) {}
+ SharkJavaCallCacher(SharkFunction* function, ciMethod* callee)
+ : SharkCacher(function), _callee(callee) {}
private:
ciMethod* _callee;
@@ -402,8 +384,8 @@
class SharkVMCallCacher : public SharkCacher {
public:
- SharkVMCallCacher(SharkFunction* function, SharkFrameCache* frame_cache)
- : SharkCacher(function, frame_cache) {}
+ SharkVMCallCacher(SharkFunction* function)
+ : SharkCacher(function) {}
// Stack slot helper
protected:
@@ -415,10 +397,8 @@
class SharkFunctionEntryCacher : public SharkCacher {
public:
- SharkFunctionEntryCacher(SharkFunction* function,
- SharkFrameCache* frame_cache,
- llvm::Value* method)
- : SharkCacher(function, frame_cache), _method(method) {}
+ SharkFunctionEntryCacher(SharkFunction* function, llvm::Value* method)
+ : SharkCacher(function), _method(method) {}
private:
llvm::Value* _method;
diff -r e6350d5249d3 -r 4a617634d81c ports/hotspot/src/share/vm/shark/sharkFrameCache.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkFrameCache.cpp Tue Jun 16 10:58:00 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkFrameCache.cpp.incl"
-
-using namespace llvm;
-
-SharkFrameCache::SharkFrameCache(SharkFunction *function)
- : _frame_size(function->extended_frame_size())
-{
- _values = NEW_RESOURCE_ARRAY(Value*, frame_size());
- memset(_values, 0, frame_size() * sizeof(Value *));
-}
-
-SharkFrameCache::SharkFrameCache(const SharkFrameCache* cache)
- : _frame_size(cache->frame_size())
-{
- _values = NEW_RESOURCE_ARRAY(Value*, frame_size());
- memcpy(_values, cache->_values, frame_size() * sizeof(Value *));
-}
-
-bool SharkFrameCache::equal_to(SharkFrameCache* other)
-{
- if (frame_size() != other->frame_size())
- return false;
-
- for (int i = 0; i < frame_size(); i++) {
- if (value(i) != other->value(i))
- return false;
- }
-
- return true;
-}
-
-void SharkFrameCache::merge(SharkFrameCache* other)
-{
- assert(frame_size() == other->frame_size(), "should be");
-
- for (int i = 0; i < frame_size(); i++) {
- if (value(i) != other->value(i))
- set_value(i, NULL);
- }
-}
diff -r e6350d5249d3 -r 4a617634d81c ports/hotspot/src/share/vm/shark/sharkFrameCache.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkFrameCache.hpp Tue Jun 16 10:58:00 2009 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkFrameCache : public ResourceObj {
- public:
- SharkFrameCache(SharkFunction* function);
-
- protected:
- SharkFrameCache(const SharkFrameCache* cache);
-
- private:
- int _frame_size;
- llvm::Value** _values;
-
- private:
- int frame_size() const
- {
- return _frame_size;
- }
-
- public:
- llvm::Value* value(int slot)
- {
- assert(slot >= 0 && slot < frame_size(), "bad index");
- return _values[slot];
- }
- void set_value(int slot, llvm::Value* value)
- {
- assert(slot >= 0 && slot < frame_size(), "bad index");
- _values[slot] = value;
- }
-
- // Comparison
- public:
- bool equal_to(SharkFrameCache* other);
-
- // Copy and merge
- public:
- SharkFrameCache *copy() const
- {
- return new SharkFrameCache(this);
- }
- void merge(SharkFrameCache* other);
-};
diff -r e6350d5249d3 -r 4a617634d81c ports/hotspot/src/share/vm/shark/sharkState.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkState.cpp Tue Jun 16 10:58:00 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkState.cpp Wed Jun 17 14:37:31 2009 +0100
@@ -33,7 +33,6 @@
_function(function),
_method(NULL),
_oop_tmp(NULL),
- _frame_cache(NULL),
_has_safepointed(false)
{
initialize(NULL);
@@ -44,7 +43,6 @@
_function(state->function()),
_method(state->method()),
_oop_tmp(state->oop_tmp()),
- _frame_cache(NULL),
_has_safepointed(state->has_safepointed())
{
initialize(state);
@@ -73,13 +71,7 @@
value = value->clone();
push(value);
}
-
- if (state->frame_cache())
- _frame_cache = state->frame_cache()->copy();
}
- else if (function()) {
- _frame_cache = new SharkFrameCache(function());
- }
set_num_monitors(state ? state->num_monitors() : 0);
}
@@ -146,19 +138,6 @@
}
}
- // Frame cache
- if (frame_cache() == NULL) {
- if (other->frame_cache() != NULL)
- return false;
- }
- else {
- if (other->frame_cache() == NULL)
- return false;
-
- if (!frame_cache()->equal_to(other->frame_cache()))
- return false;
- }
-
return true;
}
@@ -218,9 +197,6 @@
}
}
- // Frame cache
- frame_cache()->merge(other->frame_cache());
-
// Safepointed status
set_has_safepointed(this->has_safepointed() && other->has_safepointed());
}
@@ -243,8 +219,7 @@
void SharkState::decache_for_Java_call(ciMethod* callee)
{
assert(function() && method(), "you cannot decache here");
- SharkJavaCallDecacher(
- function(), frame_cache(), block()->bci(), callee).scan(this);
+ SharkJavaCallDecacher(function(), block()->bci(), callee).scan(this);
pop(callee->arg_size());
}
@@ -269,25 +244,25 @@
if (type->is_two_word())
push(NULL);
}
- SharkJavaCallCacher(function(), frame_cache(), callee).scan(this);
+ SharkJavaCallCacher(function(), callee).scan(this);
}
void SharkState::decache_for_VM_call()
{
assert(function() && method(), "you cannot decache here");
- SharkVMCallDecacher(function(), frame_cache(), block()->bci()).scan(this);
+ SharkVMCallDecacher(function(), block()->bci()).scan(this);
}
void SharkState::cache_after_VM_call()
{
assert(function() && method(), "you cannot cache here");
- SharkVMCallCacher(function(), frame_cache()).scan(this);
+ SharkVMCallCacher(function()).scan(this);
}
void SharkState::decache_for_trap()
{
assert(function() && method(), "you cannot decache here");
- SharkTrapDecacher(function(), frame_cache(), block()->bci()).scan(this);
+ SharkTrapDecacher(function(), block()->bci()).scan(this);
}
SharkEntryState::SharkEntryState(SharkTopLevelBlock* block, Value* method)
@@ -326,7 +301,7 @@
}
set_local(i, value);
}
- SharkFunctionEntryCacher(function(), frame_cache(), method).scan(this);
+ SharkFunctionEntryCacher(function(), method).scan(this);
}
SharkPHIState::SharkPHIState(SharkTopLevelBlock* block)
diff -r e6350d5249d3 -r 4a617634d81c ports/hotspot/src/share/vm/shark/sharkState.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkState.hpp Tue Jun 16 10:58:00 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkState.hpp Wed Jun 17 14:37:31 2009 +0100
@@ -39,7 +39,6 @@
SharkBlock* _block;
SharkFunction* _function;
llvm::Value* _method;
- SharkFrameCache* _frame_cache;
SharkValue** _locals;
SharkValue** _stack;
SharkValue** _sp;
@@ -56,10 +55,6 @@
{
return _function;
}
- SharkFrameCache *frame_cache() const
- {
- return _frame_cache;
- }
public:
inline SharkBuilder* builder() const;
More information about the distro-pkg-dev
mailing list