You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/08/01 21:45:41 UTC
svn commit: r427693 [1/2] - in /incubator/harmony/enhanced/drlvm/trunk:
build/make/components/extra/ vm/em/src/ vm/gc/src/ vm/include/open/
vm/interpreter/src/ vm/jitrino/src/codegenerator/ia32/ vm/jitrino/src/jet/
vm/jitrino/src/optimizer/ vm/port/src...
Author: geirm
Date: Tue Aug 1 12:45:38 2006
New Revision: 427693
URL: http://svn.apache.org/viewvc?rev=427693&view=rev
Log:
HARMONY-856
Applied each patch and tested from the "M1-patch-updated.zip"
file . Didn't apply 0029-* per comments in JIRA entry. All
except 0031 applied cleanly.
I was impressed how neatly and cleanly this was done. Thanks
for the nice patch.
Added:
incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/Fragment.java (with props)
Modified:
incubator/harmony/enhanced/drlvm/trunk/build/make/components/extra/eclipse_script.xml
incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_threads.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/include/open/bytecodes.h
incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h
incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_stack_trace.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.h
incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_ia32.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h
incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/stress/WeakHashmapTest.java
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/simplehashtable.h
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/stack_trace.h
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_field.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_method.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/FinalizerThread.java
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadGroup.java
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMStart.java
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/jarfile_support.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/mem_alloc.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_dataflow.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp
Modified: incubator/harmony/enhanced/drlvm/trunk/build/make/components/extra/eclipse_script.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/build/make/components/extra/eclipse_script.xml?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/build/make/components/extra/eclipse_script.xml (original)
+++ incubator/harmony/enhanced/drlvm/trunk/build/make/components/extra/eclipse_script.xml Tue Aug 1 12:45:38 2006
@@ -31,7 +31,7 @@
<select os="win">
<echo file="${build.dir}/_other/eclipse.bat">
@echo off
-set BUILD_HOME=${build.deploy.dir}
+set BUILD_HOME=%~dp0\..\
</echo>
<echo file="${build.dir}/_other/eclipse.bat" append="true">
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp Tue Aug 1 12:45:38 2006
@@ -59,6 +59,8 @@
void DrlEMFactory::deinitEMInstance() {
assert(emInstance!=NULL);
emInstance->deinit();
+ delete emInstance;
+ emInstance = NULL;
}
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_threads.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_threads.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_threads.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_threads.cpp Tue Aug 1 12:45:38 2006
@@ -151,6 +151,8 @@
GC_Thread::~GC_Thread()
{
+ vm_destroy_event(_gc_thread_start_work_event);
+ vm_destroy_event(_gc_thread_work_done_event);
}
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp Tue Aug 1 12:45:38 2006
@@ -165,6 +165,8 @@
STD_FREE(_gc_thread_work_finished_event_handles);
if (_live_objects_found_by_second_trace_heap)
delete _live_objects_found_by_second_trace_heap;
+ if (_live_objects_found_by_first_trace_heap)
+ delete _live_objects_found_by_first_trace_heap;
// free blocks memory
_p_block_store->init_block_iterator();
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/bytecodes.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/bytecodes.h?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/bytecodes.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/bytecodes.h Tue Aug 1 12:45:38 2006
@@ -17,6 +17,10 @@
* @author Pavel Pervov, Pavel Rebriy
* @version $Revision: 1.1.2.1.4.3 $
*/
+
+#ifndef _BYTECODES_H_
+#define _BYTECODES_H_
+
/**
* Enum of bytecode opcodes.
*/
@@ -234,3 +238,5 @@
OPCODE_FAST_GETFIELD_INT, /* 0xcc */
#endif /* FAST_BYTECODES */
};
+#endif // _BYTECODES_H_
+
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h Tue Aug 1 12:45:38 2006
@@ -223,6 +223,7 @@
StackFrame *prev;
FramePopListener *framePopListener;
ManagedObject *This;
+ ManagedObject *exception;
struct MonitorList *locked_monitors;
struct MonitorList *free_monitors;
PopFrameState jvmti_pop_frame;
@@ -253,7 +254,7 @@
void method_exit_callback_with_frame(Method *method, StackFrame& frame);
void frame_pop_callback(FramePopListener *l, Method *method, jboolean was_popped_by_exception);
void single_step_callback(StackFrame &frame);
-bool findExceptionHandler(StackFrame& frame, ManagedObject *exception, Handler **h);
+bool findExceptionHandler(StackFrame& frame, ManagedObject **exception, Handler **h);
bool load_method_handled_exceptions(Method *m);
/********* INLINE FUNCTIONS *******/
@@ -407,7 +408,6 @@
// Setup locals and stack on C stack.
#define SETUP_LOCALS_AND_STACK(frame,method) \
int max_stack = method->get_max_stack(); \
- if (max_stack == 0) max_stack = 1; \
frame.stack.init(ALLOC_FRAME( \
Stack::getStorageSize(max_stack)), max_stack); \
int max_locals = method->get_max_locals(); \
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_stack_trace.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_stack_trace.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_stack_trace.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_stack_trace.cpp Tue Aug 1 12:45:38 2006
@@ -145,15 +145,20 @@
}
Handler *h;
- if (load_method_handled_exceptions(frame->method) == false) {
- // InternalError occured resolving exception somewhere
- // too early to process it, it will be reported again.
- clear_current_thread_exception();
- } else if(findExceptionHandler(*frame, exn->object, &h)) {
+ if(findExceptionHandler(*frame, &exn->object, &h)) {
*method_ptr = frame->method;
*location_ptr = frame->ip - (uint8*)(*method_ptr)->get_byte_code_addr();
break;
}
+
+ if (frame->exception) {
+ // FIXME: needs investigation, very specific condition
+ *method_ptr = NULL;
+ *location_ptr = 0;
+ frame->exception = NULL;
+ break;
+ }
+
interp_si_goto_previous(si);
}
}
@@ -218,6 +223,12 @@
ASSERT_OBJECT(si->This);
vm_enumerate_root_reference((void**)&si->This, FALSE);
DEBUG_GC(" [THIS]: " << si->This->vt()->clss->name->bytes << endl);
+ }
+
+ if (si->exception) {
+ ASSERT_OBJECT(si->exception);
+ vm_enumerate_root_reference((void**)&si->exception, FALSE);
+ DEBUG_GC(" [EXCEPTION]: " << si->exception->vt()->clss->name->bytes << endl);
}
if (method->is_native()) {
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp Tue Aug 1 12:45:38 2006
@@ -1593,7 +1593,6 @@
Field *field = interp_resolve_static_field(clazz, fieldId, true);
if (!field) return; // exception
- // FIXME: is it possible to move the code into !cp_is_resolved condition above?
class_initialize(field->get_class());
if (exn_raised()) {
@@ -1681,7 +1680,6 @@
Field *field = interp_resolve_static_field(clazz, fieldId, false);
if (!field) return; // exception
- // FIXME: is it possible to move the code into !cp_is_resolved condition above?
class_initialize(field->get_class());
if (exn_raised()) {
@@ -2038,7 +2036,6 @@
<< method->get_name()->bytes << "/"
<< method->get_descriptor()->bytes << endl);
- // FIXME: is it possible to move the code into !cp_is_resolved condition above?
class_initialize(method->get_class());
if (exn_raised()) {
@@ -2264,7 +2261,7 @@
}
bool
-findExceptionHandler(StackFrame& frame, ManagedObject *exception, Handler **hh) {
+findExceptionHandler(StackFrame& frame, ManagedObject **exception, Handler **hh) {
assert(!exn_raised());
assert(!tmn_is_suspend_enabled());
@@ -2280,7 +2277,6 @@
DEBUG_BYTECODE("ip = " << dec << (int)ip << endl);
Class *clazz = m->get_class();
- Const_Pool *cp = clazz->const_pool;
for(uint32 i = 0; i < m->num_bc_exception_handlers(); i++) {
Handler *h = m->get_bc_exception_handler_info(i);
@@ -2299,12 +2295,16 @@
DEBUG_BYTECODE("catch type index = " << (int)catch_type_index << endl);
- assert(cp_is_class(cp, catch_type_index));
- // Class should be already loaded
- if (!cp_is_resolved(cp, catch_type_index)) continue;
+ Class *obj = interp_resolve_class(clazz, catch_type_index);
- Class *excHandler = cp[catch_type_index].CONSTANT_Class.klass;
- if (!vm_instanceof(exception, excHandler)) continue;
+ if (!obj) {
+ // possible if verifier is disabled
+ frame.exception = get_current_thread_exception();
+ clear_current_thread_exception();
+ return false;
+ }
+
+ if (!vm_instanceof(*exception, obj)) continue;
}
*hh = h;
return true;
@@ -2313,11 +2313,11 @@
}
static inline bool
-processExceptionHandler(StackFrame& frame, ManagedObject *exception) {
+processExceptionHandler(StackFrame& frame, ManagedObject **exception) {
Method *m = frame.method;
Handler *h;
if (findExceptionHandler(frame, exception, &h)){
- DEBUG_BYTECODE("Exception caught: " << exception->vt()->clss->name->bytes << endl);
+ DEBUG_BYTECODE("Exception caught: " << (*exception)->vt()->clss->name->bytes << endl);
DEBUG_BYTECODE("Found handler!\n");
frame.ip = (uint8*)m->get_byte_code_addr() + h->get_handler_pc();
return true;
@@ -2452,40 +2452,6 @@
tmn_suspend_disable();
}
-bool
-load_method_handled_exceptions(Method *m) {
- // loading exception from exception tables
- Class *clss = m->get_class();
- Const_Pool *cp = clss->const_pool;
-
- // loading will not work in exception state
- assert(!exn_raised());
-
- for(uint32 i = 0; i < m->num_bc_exception_handlers(); i++) {
- Handler *h = m->get_bc_exception_handler_info(i);
- uint32 catch_type_index = h->get_catch_type_index();
-
- if (!catch_type_index) continue;
-
- assert(cp_is_class(cp, catch_type_index));
- if (cp_is_resolved(cp, catch_type_index)) continue;
-
- Class *obj = interp_resolve_class(clss, catch_type_index);
-
- if (!obj) {
- // possible if verifier is disabled
- clear_current_thread_exception();
- continue;
-#if 0
- interp_throw_exception("java/lang/InternalError",
- "bad exception catch class");
- return false;
-#endif
- }
- }
- return true;
-}
-
void
interpreter(StackFrame &frame) {
DEBUG_TRACE_PLAIN("interpreter: "
@@ -2754,6 +2720,7 @@
new_ml = (MonitorList*) ALLOC_FRAME(sizeof(MonitorList));
}
new_ml->next = frame.locked_monitors;
+ new_ml->monitor = NULL;
frame.locked_monitors = new_ml;
Opcode_MONITORENTER(frame);
exc = get_current_thread_exception();
@@ -2935,33 +2902,19 @@
if (!exc) continue;
}
- frame.stack.clear();
- frame.stack.push();
- frame.stack.pick().cr = COMPRESS_REF(exc);
- frame.stack.ref() = FLAG_OBJECT;
+ frame.exception = exc;
clear_current_thread_exception();
- if (load_method_handled_exceptions(frame.method)) {
- // reloading exception, can be gc-moved in
- // load_method_handled_exceptions
- exc = UNCOMPRESS_REF(frame.stack.pick().cr);
- if (processExceptionHandler(frame, exc)) continue;
-
- // exception is not handled in the method, returning exception to caller
- set_current_thread_exception(exc);
- p_TLS_vmthread->ti_exception_callback_pending = false;
- } else {
- // error loading exceptions for method, the InternalError reported
- // notify jvmti
- // The code may only be executed if verifier is disabled
- assert(exn_raised());
- assert(!tmn_is_suspend_enabled());
- jvmti_interpreter_exception_event_callback_call();
- assert(!tmn_is_suspend_enabled());
-
- // exiting the method
- exc = get_current_thread_exception();
+ if (processExceptionHandler(frame, &frame.exception)) {
+ frame.stack.clear();
+ frame.stack.push();
+ frame.stack.pick().cr = COMPRESS_REF(frame.exception);
+ frame.stack.ref() = FLAG_OBJECT;
+ frame.exception = 0;
+ continue;
}
+ set_current_thread_exception(frame.exception);
+ p_TLS_vmthread->ti_exception_callback_pending = false;
if (frame.locked_monitors) {
vm_monitor_exit_wrapper(frame.locked_monitors->monitor);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.h?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.h Tue Aug 1 12:45:38 2006
@@ -126,10 +126,6 @@
:memoryManager(mm), steps(mm), error(0)
{}
- IRTransformerPath()
- :memoryManager(*new MemoryManager(0x1000, "StaticIRTransformerPath")), steps(memoryManager), error(0)
- {}
-
bool parse(const char * str);
bool parseOption(const char * str, Step& result);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp Tue Aug 1 12:45:38 2006
@@ -432,13 +432,13 @@
const uint32* gcPointImage = GCMap::findGCSafePointStart((uint32*)gcBlock, *context->p_eip);
if (gcPointImage != NULL) {
MemoryManager mm(128,"RuntimeInterface::getGCRootSet");
- GCSafePoint* gcSite = new GCSafePoint(mm, gcPointImage);
- if (gcSite->getNumOpnds() > 0) {
+ GCSafePoint gcSite(mm, gcPointImage);
+ if (gcSite.getNumOpnds() > 0) {
//this is a performance filter for empty points
// and debug filter for hardware exception point that have no stack info assigned.
StackInfo stackInfo(mm);
stackInfo.read(methodDesc, *context->p_eip, false);
- gcSite->enumerate(gcInterface, context, stackInfo);
+ gcSite.enumerate(gcInterface, context, stackInfo);
}
} else {
//NPE + GC -> nothing to enumerate for this frame;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_ia32.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_ia32.cpp Tue Aug 1 12:45:38 2006
@@ -848,26 +848,29 @@
{
jtype j0 = m_jframe->top();
jtype j1 = m_jframe->top(1);
+ // The further pop/push wipes out the correct state, as
+ // JFrame::push presumes that items go to registers, so we
+ // need make sure that both the items are indeed on registers
+ // before any action.
+ RegName r0 = vstack(0);
+ RegName r1 = vstack(1);
+
vpop(j0);
vpop(j1);
vpush(j0, false);
vpush(j1, true);
if (is_f(j0) != is_f(j1)) {
// they are on the different vstacks,
- // thus they're already on different regs.
- // nothing to do, just update the real stack
+ // thus they're already on different regs -
+ // nothing to do
}
else if (is_f(j0)) {
EncoderBase::Operand scratch = vlocal(j0, -1, false, true);
- RegName r0 = vstack(0);
- RegName r1 = vstack(1);
voper(typeInfo[j0].mov, scratch, r0);
voper(typeInfo[j0].mov, r0, r1);
voper(typeInfo[j0].mov, r1, scratch);
}
else {
- RegName r0 = vstack(0);
- RegName r1 = vstack(1);
voper(Mnemonic_XCHG, r0, r1);
}
}
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp Tue Aug 1 12:45:38 2006
@@ -64,7 +64,7 @@
LazyExceptionOpt::LazyExceptionOpt(IRManager &ir_manager, MemoryManager& mem_manager) :
irManager(ir_manager), memManager(mem_manager),
- leMemManager(*(new MemoryManager(1000,"LazyExceptionOpt::doLazyExceptionOpt"))),
+ leMemManager(1024,"LazyExceptionOpt::doLazyExceptionOpt"),
compInterface(ir_manager.getCompilationInterface()),nodeSet(NULL)
{
}
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h Tue Aug 1 12:45:38 2006
@@ -56,7 +56,7 @@
private:
IRManager &irManager;
MemoryManager &memManager;
- MemoryManager &leMemManager;
+ MemoryManager leMemManager;
CompilationInterface &compInterface;
bool isExceptionInit;
bool isArgCheckNull;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp Tue Aug 1 12:45:38 2006
@@ -30,7 +30,7 @@
#include "encoder.h"
#include "interpreter.h"
-#include "cxxlog.h"
+#include "clog.h"
#ifndef NDEBUG
#include "dump.h"
@@ -72,14 +72,13 @@
si->m2nfl = m2n_get_previous_frame(m2nfl);
- TRACE2("si", "si_unwind_from_m2n, ip = "
- << (void*)m2nfl->eip);
+ TRACE2("si", ("si_unwind_from_m2n, ip = %p",(void*)m2nfl->eip));
// Is it a normal M2nFrame or one for suspended managed code?
if ((uint32)m2nfl->p_lm2nf==1) {
// Suspended managed code, eip is at instruction, esp & registers are in regs structure
- TRACE2("si", "si_unwind_from_m2n from suspended managed code, ip = "
- << (void*)m2nfl->regs->eip);
+ TRACE2("si", ("si_unwind_from_m2n from suspended managed code, ip = %p",
+ (void*)m2nfl->regs->eip));
si->c.esp = m2nfl->regs->esp;
si->c.p_eip = &(m2nfl->regs->eip);
si->c.is_ip_past = FALSE;
@@ -241,27 +240,28 @@
{
ASSERT_NO_INTERPRETER
if (si->cci) {
- TRACE2("si", "si_goto_previous from ip = "
- << (void*)si_get_ip(si) << " ("
- << method_get_name(si->cci->get_method())
- << method_get_descriptor(si->cci->get_method()) << ")");
+ TRACE2("si", ("si_goto_previous from ip = %p (%s%s)",
+ (void*)si_get_ip(si),
+ method_get_name(si->cci->get_method()),
+ method_get_descriptor(si->cci->get_method())));
assert(si->cci->get_jit() && si->cci->get_method());
si->cci->get_jit()->unwind_stack_frame(si->cci->get_method(), si_get_jit_context(si));
si->c.is_ip_past = TRUE;
} else {
- TRACE2("si", "si_goto_previous from ip = "
- << (void*)si_get_ip(si) << " (M2N)");
+ TRACE2("si", ("si_goto_previous from ip = %p (M2N)",
+ (void*)si_get_ip(si)));
if (!si->m2nfl) return;
si_unwind_from_m2n(si);
}
si->cci = vm_methods->find(si_get_ip(si), true);
if (si->cci) {
- TRACE2("si", "si_goto_previous to ip = " << (void*)si_get_ip(si)
- << " (" << method_get_name(si->cci->get_method())
- << method_get_descriptor(si->cci->get_method()) << ")");
+ TRACE2("si", ("si_goto_previous to ip = %p (%s%s)",
+ (void*)si_get_ip(si),
+ method_get_name(si->cci->get_method()),
+ method_get_descriptor(si->cci->get_method())));
} else {
- TRACE2("si", "si_goto_previous to ip = " << (void*)si_get_ip(si)
- << " (M2N)");
+ TRACE2("si", ("si_goto_previous to ip = %p (M2N)",
+ (void*)si_get_ip(si)));
}
}
@@ -353,31 +353,30 @@
*/
void cpp_set_last_frame(M2nFrame* lm2nf)
{
- //printf("Unwinding.... lm2nf=0x%08x\n", lm2nf);
+ TRACE2("exn",("Unwinding.... lm2nf=0x%08x\n", lm2nf));
void *handler;
__asm {
mov eax, fs:[0]
mov handler, eax
}
- //printf(" handler=0x%p\n", handler);
+ TRACE2("exn",(" handler=0x%p\n", handler));
if (!(handler < lm2nf)) {
return;
}
// finding lastFrame > lm2nf, should be last
void *lastFrame = p_TLS_vmthread->lastFrame;
- //printf(" curr = 0x%p\n", lastFrame);
+ TRACE2("exn",(" curr = 0x%p\n", lastFrame));
if (!(lastFrame < lm2nf)) {
- /* _DO_ _NOT_ change into TRACE2, WARN or anything like!! */
printf("Unwinding: Lost lastFrame\n");
__asm { int 3 }
}
while(true) {
void *prevFrame = *(void**)lastFrame;
- //printf(" prev = 0x%p\n", prevFrame);
+ TRACE2("exn",(" prev = 0x%p\n", prevFrame));
if (prevFrame == 0) {
break;
}
@@ -391,18 +390,18 @@
}
if (!(handler < lastFrame)) {
- //printf("all ok\n");
+ TRACE2("exn",("all ok\n"));
return;
}
- // NO LOGGER PLEASE! doesn't work with destructive unwinding!
- fprintf(stderr, "ERROR: Destructive unwinding: C++ objects detected on stack!\n");
+ // NO CXX LOGGER PLEASE! doesn't work with destructive unwinding!
+ INFO2("exn", ("ERROR: Destructive unwinding: C++ objects detected on stack!\n"));
while(handler < lastFrame) {
- fprintf(stderr, " droping 0x%p\n", handler);
+ INFO2("exn", (" droping 0x%p\n", handler));
handler = *(int**)handler;
}
- fprintf(stderr, " setting curr 0x%p\n", handler);
+ INFO2("exn", (" setting curr 0x%p\n", handler));
__asm {
mov eax, handler
mov fs:[0], eax
@@ -415,9 +414,8 @@
void si_transfer_control(StackIterator* si)
{
-/* !!!! NO LOGGER IS ALLOWED IN THIS FUNCTION !!!
- * !!!! RELEASE BUILD WILL BE BROKEN !!!
- * !!!! NO TRACE2, INFO, WARN, ECHO, ASSERT, ...*/
+/* !!!! NO CXX LOGGER IS ALLOWED IN THIS FUNCTION !!!
+ * !!!! RELEASE BUILD WILL BE BROKEN !!!*/
// 1. Copy si to stack
StackIterator local_si;
memcpy(&local_si, si, sizeof(StackIterator));
@@ -432,10 +430,10 @@
cpp_set_last_frame(local_si.m2nfl);
#endif // _WIN32
- //TRACE2("exn", "generating control transfer stub");
+ TRACE2("exn", ("generating control transfer stub"));
// 3. Call the stub
transfer_control_stub_type tcs = gen_transfer_control_stub();
- //TRACE2("exn", "tcs");
+ TRACE2("exn", ("tcs"));
tcs(&local_si);
}
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/Fragment.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/Fragment.java?rev=427693&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/Fragment.java (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/Fragment.java Tue Aug 1 12:45:38 2006
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Salikh Zakirov
+ * @version $Revision$
+ */
+package gc;
+
+/**
+ * Fragment the heap with large allocations interspersed
+ * with medium-size allocation and then check if larger
+ * allocation works.
+ *
+ * @keyword gc XXX_not_implemented_feature
+ */
+public class Fragment {
+
+ static final int Mb = 1048576;
+ static Object o;
+
+ public static void main (String[] args) {
+ // heuristically choose the size for "large" allocation
+ int large_size = (int)(Runtime.getRuntime().freeMemory() / 2);
+ Object[] medium = new Object[200]; // usually enough
+ Object[] large = new Object[medium.length];
+ try {
+ for (int i = 0; i < medium.length; i++) {
+ // "medium" objects are 1 Mb
+ medium[i] = new byte[Mb];
+ // "large" objects are large_size-1 Mb
+ large[i] = new byte[large_size-Mb];
+ trace(".");
+ }
+ } catch (OutOfMemoryError e) {
+ System.out.println("\nheap filled with 1 Mb and "
+ + ((large_size-Mb)/Mb) + " Mb objects");
+ }
+ // release all "large" objects
+ // the "medium" objects end up distributed all over the heap
+ large = null;
+ try {
+ // try allocation of "large_size+1Mb" object
+ o = new byte[large_size+Mb];
+ System.out.println("PASSED, " + ((large_size+Mb)/Mb)
+ + " Mb allocation succeeded");
+ } catch (OutOfMemoryError e) {
+ System.out.println("FAILED, " + ((large_size+Mb)/Mb)
+ + " Mb allocation failed");
+ }
+ }
+
+ public static void trace(Object o) {
+ System.out.print(o);
+ System.out.flush();
+ }
+}
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/gc/Fragment.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/stress/WeakHashmapTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/stress/WeakHashmapTest.java?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/stress/WeakHashmapTest.java (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/stress/WeakHashmapTest.java Tue Aug 1 12:45:38 2006
@@ -22,7 +22,7 @@
import java.util.*;
/**
- * @keyword XXX_bug_6164
+ * @keyword
*/
public class WeakHashmapTest {
@@ -62,53 +62,68 @@
t1.setDaemon(true);
t1.start();
- new Thread() {
+ Thread worker1 = new Thread() {
public void run() {
- for(int j = 0; j < 50; j++) {
+ for(int j = 0; j < 10; j++) {
for(int i = 0; i < 1000; i++) {
String s = "" + i;
- map.put(new WeakHashmapTest(s), s);
+ synchronized (map) {
+ map.put(new WeakHashmapTest(s), s);
+ }
}
trace("+");
map.clear();
}
}
- }.start();
+ };
+ worker1.start();
- new Thread() {
+ Thread worker2 = new Thread() {
public void run() {
- for(int j = 0; j < 50; j++) {
+ for(int j = 0; j < 10; j++) {
for(int i = 1000; i >= 0; --i) {
String s = "" + i;
WeakHashmapTest t = new WeakHashmapTest(s);
- map.put(t, s);
+ synchronized (map) {
+ map.put(t, s);
+ }
if ((i & 3) == 0) map2.put(t, s);
}
trace("-");
}
}
- }.start();
+ };
+ worker2.start();
- new Thread() {
+ Thread worker3 = new Thread() {
public void run() {
- for(int j = 0; j < 50; j++) {
+ for(int j = 0; j < 10; j++) {
for(int i = 0; i < 1000; i++) {
- map.get(new WeakHashmapTest("" + i));
+ synchronized (map) {
+ map.get(new WeakHashmapTest("" + i));
+ }
}
trace("g");
}
}
- }.start();
+ };
+ worker3.start();
- for(int j = 0; j < 50; j++) {
+ for(int j = 0; j < 10; j++) {
for(int i = 0; i < 1000; i++) {
- map.get(new WeakHashmapTest("" + i));
+ synchronized (map) {
+ map.get(new WeakHashmapTest("" + i));
+ }
}
trace(".");
}
- System.out.println("PASSED");
+ try { worker1.join(); } catch (InterruptedException e) {}
+ try { worker2.join(); } catch (InterruptedException e) {}
+ try { worker3.join(); } catch (InterruptedException e) {}
+
+ System.out.println("\nPASSED");
}
public static void trace(Object o) {
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h Tue Aug 1 12:45:38 2006
@@ -738,11 +738,11 @@
#if (defined __cplusplus) && (defined PLATFORM_POSIX)
extern "C" {
#endif
-VMEXPORT void class_initialize_from_jni(Class *clss, bool throw_exception);
+VMEXPORT void class_initialize_from_jni(Class *clss);
#if (defined __cplusplus) && (defined PLATFORM_POSIX)
}
#endif
-VMEXPORT void class_initialize_ex(Class *clss, bool throw_exception);
+VMEXPORT void class_initialize_ex(Class *clss);
VMEXPORT void class_initialize(Class *clss);
@@ -1180,7 +1180,6 @@
enum State {
ST_NotCompiled, // initial state
ST_NotLinked = ST_NotCompiled, // native not linked to implementation
- ST_BeingCompiled, // jitting
ST_Compiled, // compiled by JIT
ST_Linked = ST_Compiled // native linked to implementation
};
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h Tue Aug 1 12:45:38 2006
@@ -255,6 +255,10 @@
static void PrintUnloadingStats();
static unsigned GetClassLoaderNumber() { return m_nextEntry; }
static ClassLoader** GetClassLoaderTable() { return m_table; }
+ static void DeleteClassLoaderTable(){
+ STD_FREE(m_table);
+ m_table = NULL;
+ }
inline void* Alloc(size_t size) {
assert(pool);
Lock();
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/simplehashtable.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/simplehashtable.h?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/simplehashtable.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/simplehashtable.h Tue Aug 1 12:45:38 2006
@@ -52,7 +52,7 @@
delete pe_tmp;
}
}
- delete buckets;
+ delete[] buckets;
}
short hash(void* key){
// For 32-bit architectures k3 & k4 will be 0 and have no effect on the hash
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/stack_trace.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/stack_trace.h?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/stack_trace.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/stack_trace.h Tue Aug 1 12:45:38 2006
@@ -68,6 +68,8 @@
// It is intended for debugging purposes.
void st_print(FILE*);
+void st_print();
+
Method_Handle get_method(StackIterator* si);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Tue Aug 1 12:45:38 2006
@@ -787,28 +787,18 @@
} //class_get_const_string_intern_addr
-const char* class_get_cp_entry_signature(Class_Handle src_class, unsigned short cp_index)
+const char* class_get_cp_entry_signature(Class_Handle src_class, unsigned short index)
{
Class* clss = (Class*)src_class;
- // TODO: check that cp_index is valid for src_class; assert for now
- assert(cp_index < clss->cp_size);
- assert(cp_is_methodref(clss->const_pool, cp_index)
- || cp_is_interfacemethodref(clss->const_pool, cp_index)
- || cp_is_fieldref(clss->const_pool, cp_index));
-
- Const_Pool* cp_item = &(clss->const_pool[cp_index]);
- if(cp_is_resolved(clss->const_pool, cp_index)) {
- Class_Member* sig_src = cp_item->CONSTANT_ref.method;
- return sig_src->get_descriptor()->bytes;
- } else {
- unsigned short next_idx = cp_item->CONSTANT_ref.name_and_type_index;
- cp_item = &(clss->const_pool[next_idx]);
- if(cp_is_resolved(clss->const_pool, next_idx)) {
- return cp_item->CONSTANT_NameAndType.descriptor->bytes;
- } else {
- return clss->const_pool[cp_item->CONSTANT_NameAndType.descriptor_index].CONSTANT_Utf8.string->bytes;
- }
- }
+ // TODO: check that index is valid for src_class; assert for now
+ assert(index < clss->cp_size);
+ assert(cp_is_methodref(clss->const_pool, index)
+ || cp_is_interfacemethodref(clss->const_pool, index)
+ || cp_is_fieldref(clss->const_pool, index));
+
+ index = clss->const_pool[index].CONSTANT_ref.name_and_type_index;
+ index = clss->const_pool[index].CONSTANT_NameAndType.descriptor_index;
+ return clss->const_pool[index].CONSTANT_Utf8.string->bytes;
} // class_get_cp_entry_signature
@@ -1025,7 +1015,7 @@
if (!ch) return NULL;
// All initialization from jni should not propagate exceptions and
// should return to calling native method.
- if(init) class_initialize_from_jni(ch, false);
+ if(init) class_initialize_from_jni(ch);
if(exn_get()) {
return 0;
@@ -1047,17 +1037,9 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.field->get_name()->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.name_and_type_index;
- if(cp_is_resolved(const_pool, index)) {
- return const_pool[index].CONSTANT_NameAndType.name->bytes;
- } else {
- index = const_pool[index].CONSTANT_NameAndType.name_index;
- return const_pool[index].CONSTANT_Utf8.string->bytes;
- }
- }
+ index = const_pool[index].CONSTANT_ref.name_and_type_index;
+ index = const_pool[index].CONSTANT_NameAndType.name_index;
+ return const_pool[index].CONSTANT_Utf8.string->bytes;
} //const_pool_get_field_name
@@ -1070,12 +1052,8 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.field->get_class()->name->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.class_index;
- return const_pool_get_class_name(cl,index);
- }
+ index = const_pool[index].CONSTANT_ref.class_index;
+ return const_pool_get_class_name(cl,index);
} //const_pool_get_field_class_name
@@ -1088,17 +1066,9 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.field->get_descriptor()->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.name_and_type_index;
- if(cp_is_resolved(const_pool, index)) {
- return const_pool[index].CONSTANT_NameAndType.descriptor->bytes;
- } else {
- index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
- return const_pool[index].CONSTANT_Utf8.string->bytes;
- }
- }
+ index = const_pool[index].CONSTANT_ref.name_and_type_index;
+ index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
+ return const_pool[index].CONSTANT_Utf8.string->bytes;
} //const_pool_get_field_descriptor
@@ -1111,17 +1081,9 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.method->get_name()->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.name_and_type_index;
- if(cp_is_resolved(const_pool, index)) {
- return const_pool[index].CONSTANT_NameAndType.name->bytes;
- } else {
- index = const_pool[index].CONSTANT_NameAndType.name_index;
- return const_pool[index].CONSTANT_Utf8.string->bytes;
- }
- }
+ index = const_pool[index].CONSTANT_ref.name_and_type_index;
+ index = const_pool[index].CONSTANT_NameAndType.name_index;
+ return const_pool[index].CONSTANT_Utf8.string->bytes;
} //const_pool_get_method_name
@@ -1134,12 +1096,8 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.method->get_class()->name->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.class_index;
- return const_pool_get_class_name(cl,index);
- }
+ index = const_pool[index].CONSTANT_ref.class_index;
+ return const_pool_get_class_name(cl,index);
} //const_pool_get_method_class_name
@@ -1152,17 +1110,9 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.method->get_name()->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.name_and_type_index;
- if(cp_is_resolved(const_pool, index)) {
- return const_pool[index].CONSTANT_NameAndType.name->bytes;
- } else {
- index = const_pool[index].CONSTANT_NameAndType.name_index;
- return const_pool[index].CONSTANT_Utf8.string->bytes;
- }
- }
+ index = const_pool[index].CONSTANT_ref.name_and_type_index;
+ index = const_pool[index].CONSTANT_NameAndType.name_index;
+ return const_pool[index].CONSTANT_Utf8.string->bytes;
} //const_pool_get_interface_method_name
@@ -1175,12 +1125,8 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.method->get_class()->name->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.class_index;
- return const_pool_get_class_name(cl,index);
- }
+ index = const_pool[index].CONSTANT_ref.class_index;
+ return const_pool_get_class_name(cl,index);
} //const_pool_get_interface_method_class_name
@@ -1193,17 +1139,9 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.method->get_descriptor()->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.name_and_type_index;
- if(cp_is_resolved(const_pool, index)) {
- return const_pool[index].CONSTANT_NameAndType.descriptor->bytes;
- } else {
- index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
- return const_pool[index].CONSTANT_Utf8.string->bytes;
- }
- }
+ index = const_pool[index].CONSTANT_ref.name_and_type_index;
+ index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
+ return const_pool[index].CONSTANT_Utf8.string->bytes;
} //const_pool_get_method_descriptor
@@ -1216,17 +1154,9 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_ref.method->get_descriptor()->bytes;
- } else {
- index = const_pool[index].CONSTANT_ref.name_and_type_index;
- if(cp_is_resolved(const_pool, index)) {
- return const_pool[index].CONSTANT_NameAndType.descriptor->bytes;
- } else {
- index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
- return const_pool[index].CONSTANT_Utf8.string->bytes;
- }
- }
+ index = const_pool[index].CONSTANT_ref.name_and_type_index;
+ index = const_pool[index].CONSTANT_NameAndType.descriptor_index;
+ return const_pool[index].CONSTANT_Utf8.string->bytes;
} //const_pool_get_interface_method_descriptor
@@ -1239,11 +1169,7 @@
ABORT("Wrong index");
return 0;
}
- if (cp_is_resolved(const_pool,index)) {
- return const_pool[index].CONSTANT_Class.klass->name->bytes;
- } else {
- return const_pool[const_pool[index].CONSTANT_Class.name_index].CONSTANT_Utf8.string->bytes;
- }
+ return const_pool[const_pool[index].CONSTANT_Class.name_index].CONSTANT_Utf8.string->bytes;
} //const_pool_get_class_name
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp Tue Aug 1 12:45:38 2006
@@ -180,20 +180,7 @@
void* Field::get_address()
{
assert(is_static());
-#ifdef _DEBUG
- Class *c = get_class();
- assert(c);
- switch(c->state) {
- case ST_Prepared:
- case ST_Initializing:
- case ST_Initialized:
- case ST_InstanceSizeComputed:
- break;
- default:
- DIE("Invalid class state " << c->state);
- break;
- }
-#endif
+ assert(is_offset_computed());
return (char *)(get_class()->static_data_block) + get_offset();
} // Field::get_address
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp Tue Aug 1 12:45:38 2006
@@ -1909,11 +1909,7 @@
}
if(!found_myself){
- String *clssname;
- if(cp_is_resolved(clss->const_pool, inner_clss_info_idx))
- clssname = (String*)clss->const_pool[inner_clss_info_idx].CONSTANT_Class.klass->name;
- else
- clssname = cp_check_class(clss->const_pool, clss->cp_size, inner_clss_info_idx);
+ String *clssname = cp_check_class(clss->const_pool, clss->cp_size, inner_clss_info_idx);
// Only handle this class
if(clss->name == clssname)
found_myself = 1;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp Tue Aug 1 12:45:38 2006
@@ -154,6 +154,7 @@
cl = ClIterator.next();
delete cltmp;
}
+ ClassLoader::DeleteClassLoaderTable();
tmn_suspend_enable();
if (TI)
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Initialize.cpp Tue Aug 1 12:45:38 2006
@@ -34,8 +34,9 @@
// Initializes a class.
-static void class_initialize1(Class *clss, bool throw_exception)
+static void class_initialize1(Class *clss)
{
+ assert(!exn_raised());
assert(!tmn_is_suspend_enabled());
// the following code implements the 11-step class initialization program
@@ -78,7 +79,6 @@
jthrowable exc = exn_get();
if (exc) {
vm_monitor_exit(struct_Class_to_java_lang_Class(clss));
- if (throw_exception) exn_throw_only(exc);
return;
}
}
@@ -103,12 +103,9 @@
vm_monitor_exit(struct_Class_to_java_lang_Class(clss));
tmn_suspend_enable();
jthrowable exn = exn_create("java/lang/NoClassDefFoundError",
- clss->name->bytes, class_get_error_cause(clss));
+ clss->name->bytes);
tmn_suspend_disable();
- if (throw_exception)
- exn_throw_only(exn);
- else
- exn_raise_only(exn);
+ exn_raise_only(exn);
return;
}
@@ -124,15 +121,9 @@
// --- step 7 ------------------------------------------------------------
if (clss->super_class) {
- class_initialize_ex(clss->super_class, throw_exception);
+ class_initialize_ex(clss->super_class);
if (clss->super_class->state == ST_Error) {
- // NOTE ivan: looks like this code is not executed on jit
- // made it interpreter specific.
- // the non-destructive exception propagaion may be used
- // in other circumstances too, e.g. in top-level class loading
- // -salikh
-
vm_monitor_enter_slow(struct_Class_to_java_lang_Class(clss));
tmn_suspend_enable();
REPORT_FAILED_CLASS_CLASS_EXN(clss->class_loader, clss,
@@ -261,13 +252,7 @@
assert(!tmn_is_suspend_enabled());
thread_object_notify_all(struct_Class_to_java_lang_Class_Handle(clss));
vm_monitor_exit(struct_Class_to_java_lang_Class(clss));
-
- if (throw_exception) {
- exn_throw_only(p_error_object);
- // may return in case of interpreter or topmost M2N frame
- } else {
- exn_raise_only(p_error_object);
- }
+ exn_raise_only(p_error_object);
}
// end of 11 step class initialization program
} //class_initialize1
@@ -278,7 +263,7 @@
#if (defined __cplusplus) && (defined PLATFORM_POSIX)
extern "C" {
#endif
-void class_initialize_from_jni(Class *clss, bool throw_exception)
+void class_initialize_from_jni(Class *clss)
{
assert(tmn_is_suspend_enabled());
@@ -294,7 +279,7 @@
tmn_suspend_disable();
if (class_needs_initialization(clss)) {
- class_initialize1(clss, throw_exception);
+ class_initialize1(clss);
}
tmn_suspend_enable();
} // class_initialize_from_jni
@@ -305,12 +290,12 @@
// VMEXPORT
void class_initialize(Class *clss)
{
- class_initialize_ex(clss, true);
+ class_initialize_ex(clss);
}
-void class_initialize_ex(Class *clss, bool throw_exception)
+void class_initialize_ex(Class *clss)
{
assert(!tmn_is_suspend_enabled());
@@ -326,6 +311,6 @@
tmn_suspend_disable();
if ( class_needs_initialization(clss)) {
- class_initialize1(clss, throw_exception);
+ class_initialize1(clss);
}
} //class_initialize
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp Tue Aug 1 12:45:38 2006
@@ -575,18 +575,16 @@
// CONSTANT_InterfaceMethodref must refer to an interface (vm spec 4.4.2)
if (cp_is_methodref(cp, cp_index) && class_is_interface(other_clss)) {
CLASS_REPORT_FAILURE(clss, cp_index, "java/lang/IncompatibleClassChangeError",
- "Can't find method "
- << other_clss->name->bytes << "." << name->bytes << desc->bytes
- << "while resolving constant pool entry " << cp_index
+ other_clss->name->bytes
+ << " while resolving constant pool entry " << cp_index
<< " in class " << clss->name->bytes);
return NULL;
}
if(cp_is_interfacemethodref(cp, cp_index) && !class_is_interface(other_clss)) {
CLASS_REPORT_FAILURE(clss, cp_index, "java/lang/IncompatibleClassChangeError",
- "Can't find method "
- << other_clss->name->bytes << "." << name->bytes << desc->bytes
- << "while resolving constant pool entry " << cp_index
+ other_clss->name->bytes
+ << " while resolving constant pool entry " << cp_index
<< " in class " << clss->name->bytes);
return NULL;
}
@@ -595,20 +593,18 @@
if (method == NULL) {
// NoSuchMethodError
CLASS_REPORT_FAILURE(clss, cp_index, "java/lang/NoSuchMethodError",
- "Can't find method "
- << other_clss->name->bytes << "." << name->bytes << desc->bytes
+ other_clss->name->bytes << "." << name->bytes << desc->bytes
<< " while resolving constant pool entry at index " << cp_index
<< " in class " << clss->name->bytes);
return NULL;
}
- if (method_is_abstract(method) && !class_is_abstract(method->get_class()) ) {
+ if(method_is_abstract(method) && !class_is_abstract(other_clss)) {
// AbstractMethodError
CLASS_REPORT_FAILURE(clss, cp_index, "java/lang/AbstractMethodError",
- "Found abstract method "
- << other_clss->name->bytes << "." << name->bytes << desc->bytes
+ other_clss->name->bytes << "." << name->bytes << desc->bytes
<< " while resolving constant pool entry at index " << cp_index
- << " in non-abstract class " << clss->name->bytes);
+ << " in class " << clss->name->bytes);
return NULL;
}
@@ -618,8 +614,7 @@
if (check_member_access(method,clss) == 0) {
// IllegalAccessError
CLASS_REPORT_FAILURE(clss, cp_index, "java/lang/IllegalAccessError",
- "Can't access method "
- << other_clss->name->bytes << "." << name->bytes << desc->bytes
+ other_clss->name->bytes << "." << name->bytes << desc->bytes
<< " while resolving constant pool entry at index " << cp_index
<< " in class " << clss->name->bytes);
return NULL;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp Tue Aug 1 12:45:38 2006
@@ -74,6 +74,9 @@
bool
class_verify_constraints(const Global_Env* env, Class* clss)
{
+ if(clss->state == ST_Error)
+ return true;
+
assert(clss->is_verified >= 1);
// fast path
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp Tue Aug 1 12:45:38 2006
@@ -153,6 +153,8 @@
}
delete GetJavaTypes();
}
+ if (m_package_table)
+ delete m_package_table;
}
bool ClassLoader::LoadingClass::CreateWaitingEvent(const String* className)
@@ -279,6 +281,7 @@
m_lock._lock();
if(m_failedClasses->Lookup(className)) {
+ FailedLoadingClass(className);
m_lock._unlock();
return NULL;
}
@@ -298,6 +301,7 @@
clss = NewClass(env, className);
if(!clss) {
+ FailedLoadingClass(className);
return NULL;
}
@@ -788,6 +792,7 @@
if(loading->IsInitiator(cur_thread) || loading->IsDefiner(cur_thread)) {
// check if one thread can load one class recursively
// at first sight, this is a circularity error condition
+ FailedLoadingClass(className);
aulock.ForceUnlock();
REPORT_FAILED_CLASS_NAME(this, className->bytes,
"java/lang/ClassCircularityError", className->bytes);
@@ -832,15 +837,15 @@
}
}
-
void ClassLoader::FailedLoadingClass(const String* className)
{
LMAutoUnlock aulock( &m_lock );
LoadingClass* lc = m_loadingClasses->Lookup(className);
- assert(lc);
- lc->SignalLoading();
- RemoveLoadingClass(className, lc);
+ if(lc) {
+ lc->SignalLoading();
+ RemoveLoadingClass(className, lc);
+ }
if(m_reportedClasses->Lookup(className)) {
m_reportedClasses->Remove(className);
}
@@ -976,6 +981,7 @@
// in class name
if ('\0' != *(baseType + 1))
{
+ FailedLoadingClass(classNameString);
REPORT_FAILED_CLASS_NAME(this, classNameString->bytes, "java/lang/NoClassDefFoundError", classNameString->bytes);
return NULL;
}
@@ -989,6 +995,7 @@
for(nameLen = 0; baseType[nameLen] != ';' &&
baseType[nameLen] != 0; nameLen++);
if(!baseType[nameLen]) {
+ FailedLoadingClass(classNameString);
REPORT_FAILED_CLASS_NAME(this, className, "java/lang/NoClassDefFoundError", className);
return NULL;
}
@@ -1002,6 +1009,7 @@
break;
default:
+ FailedLoadingClass(classNameString);
REPORT_FAILED_CLASS_NAME(this, className,
"java/lang/NoClassDefFoundError", className);
return NULL;
@@ -1034,6 +1042,7 @@
m_lock._lock();
if(m_failedClasses->Lookup(classNameString)) {
+ FailedLoadingClass(classNameString);
m_lock._unlock();
return NULL;
}
@@ -1081,7 +1090,7 @@
klass->package = elementClass->package;
// array classes implement two interfaces: Cloneable and Serializable
- klass->superinterfaces = (Class_Superinterface*) STD_MALLOC(2 * sizeof(Class_Superinterface));
+ klass->superinterfaces = (Class_Superinterface*) Alloc(2 * sizeof(Class_Superinterface));
klass->superinterfaces[0].name = env->Clonable_String;
klass->superinterfaces[1].name = env->Serializable_String;
klass->n_superinterfaces = 2;
@@ -1319,10 +1328,10 @@
int dlen = method_desc->len;
int len = clen + 1 + mlen + dlen;
char *error = (char*)STD_ALLOCA(len + 1);
- memcpy(error, class_name, clen);
+ memcpy(error, class_name->bytes, clen);
error[clen] = '.';
- memcpy(error + clen + 1, method_name, mlen);
- memcpy(error + clen + 1 + mlen, method_desc, dlen);
+ memcpy(error + clen + 1, method_name->bytes, mlen);
+ memcpy(error + clen + 1 + mlen, method_desc->bytes, dlen);
error[len] = '\0';
// trace
@@ -1511,6 +1520,15 @@
delete primitive_types[i];
primitive_types[i] = NULL;
}
+
+ for(BCPElement* bcpe = m_BCPElements.m_first;
+ bcpe != NULL; bcpe = bcpe->m_next)
+ {
+ if(bcpe->m_isJarFile) {
+ bcpe->m_jar->~JarFile();
+ bcpe->m_jar = NULL;
+ }
+ }
}
bool BootstrapClassLoader::Initialize(ManagedObject* UNREF loader)
@@ -1593,19 +1611,18 @@
// Not in the class cache: load the class or, if an array class, create it
if(className->bytes[0] == '[') {
// array classes require special handling
- return SetupAsArray(m_env, className);
+ klass = SetupAsArray(m_env, className);
} else {
// load class from file
klass = LoadFromFile(className);
}
-
return klass;
} // BootstrapClassLoader::LoadClass
Class* UserDefinedClassLoader::LoadClass(Global_Env* env, const String* className)
{
- assert( m_loader != NULL );
+ assert(m_loader != NULL);
Class* klass = StartLoadingClass(env, className);
LMAutoUnlock aulock(&m_lock);
@@ -1621,8 +1638,9 @@
char* cname = const_cast<char*>(className->bytes);
if( cname[0] == '[' ) {
- return SetupAsArray(env, className);
- }
+ klass = SetupAsArray(env, className);
+ return klass;
+ }
// Replace '/' with '.'
unsigned class_name_len = className->len + 1;
@@ -1691,15 +1709,15 @@
if(exn_raised()) {
tmn_suspend_enable();
-
+
jthrowable exn = GetClassError(className->bytes);
if(!exn) {
exn = exn_get();
// translate ClassNotFoundException to NoClassDefFoundError (if any)
Class* NotFoundExn_class = env->java_lang_ClassNotFoundException_Class;
Class *exn_class = jobject_to_struct_Class(exn);
-
- INFO("Loading of " << className->bytes << " class failed due to "
+
+ INFO("Loading of " << className->bytes << " class failed due to "
<< exn_class->name->bytes);
while(exn_class && exn_class != NotFoundExn_class) {
@@ -1721,11 +1739,11 @@
"to NoClassDefFoundError for " << className->bytes);
}
}
-
- FailedLoadingClass(className);
+
AddFailedClass(className, exn);
}
exn_clear();
+ FailedLoadingClass(className);
return NULL;
}
if(res.l == NULL)
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp Tue Aug 1 12:45:38 2006
@@ -301,6 +301,12 @@
{
assert(tmn_is_suspend_enabled());
+ Class* finalizer_thread = VM_Global_State::loader_env->finalizer_thread;
+
+ if (!finalizer_thread) {
+ return;
+ }
+
int num_objects = getLength();
if (num_objects == 0) {
@@ -317,13 +323,6 @@
jvalue args[1];
args[0].z = false;
-
- Class* finalizer_thread = VM_Global_State::loader_env->finalizer_thread;
-
- if (!finalizer_thread) {
- p_TLS_vmthread->finalize_thread_flags &= ~FINALIZER_STARTER;
- return;
- }
Method* finalize_meth = class_lookup_method_recursive(finalizer_thread,
"startFinalization", "(Z)V");
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp Tue Aug 1 12:45:38 2006
@@ -191,7 +191,11 @@
gc_wrapup();
vm_mem_dealloc();
vm_uninitialize_critical_sections();
-
+
+ // FIXME: vm_methods should be moved to Global_Env - then
+ // call ~Method_Lookup_Table() in EnvClearInternals()
+ vm_methods->~Method_Lookup_Table();
+
#ifdef DUMP_IPF_STUBS
extern FILE *ipf_stubs_out_file;
if (ipf_stubs_out_file) {
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Tue Aug 1 12:45:38 2006
@@ -394,7 +394,7 @@
env->finalizer_on_exit = (jboolean*) finalizer_on_exit_field->get_address();
assert(env->finalizer_shutdown);
assert(env->finalizer_on_exit);
- class_initialize_from_jni(env->finalizer_thread, false);
+ class_initialize_from_jni(env->finalizer_thread);
} else {
env->finalizer_thread = NULL;
}
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp Tue Aug 1 12:45:38 2006
@@ -735,10 +735,15 @@
{
assert(tmn_is_suspend_enabled());
tmn_suspend_disable();
- class_initialize_ex(method->get_class(), false);
+ class_initialize_ex(method->get_class());
tmn_suspend_enable();
- if (method->get_state() == Method::ST_Compiled) {
+ method->lock();
+ if (exn_raised()) {
+ method->unlock();
+ return JIT_FAILURE;
+ } else if (method->get_state() == Method::ST_Compiled) {
+ method->unlock();
return JIT_SUCCESS;
} else if (method->get_state()==Method::ST_NotCompiled && exn_raised()) {
return JIT_FAILURE;
@@ -746,28 +751,22 @@
return JIT_FAILURE;
}
- JIT_Result res = JIT_FAILURE;
if (method->is_native()) {
- method->lock();
- if (method->get_state() == Method::ST_NotCompiled) {
- method->set_state(Method::ST_BeingCompiled);
- res = compile_prepare_native_method(method, flags);
+ JIT_Result res = compile_prepare_native_method(method, flags);
+ if (res == JIT_SUCCESS) {
compile_flush_generated_code();
- if (res == JIT_SUCCESS) {
- method->set_state(Method::ST_Compiled);
- method->do_jit_recompiled_method_callbacks();
- method->apply_vtable_patches();
- }
- } else {
- res = JIT_SUCCESS;
+ method->set_state(Method::ST_Compiled);
+ method->do_jit_recompiled_method_callbacks();
+ method->apply_vtable_patches();
}
method->unlock();
+ return res;
} else {
// Call an execution manager to compile the method.
// An execution manager is safe to call from multiple threads.
- res = VM_Global_State::loader_env->em_interface->CompileMethod(method);
+ method->unlock();
+ return VM_Global_State::loader_env->em_interface->CompileMethod(method);
}
- return res;
}
// Make a suitable exception to throw if compilation fails.
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp Tue Aug 1 12:45:38 2006
@@ -75,6 +75,14 @@
extern bool dump_stubs;
+// macro that gets the offset of a certain field within a struct or class type
+#define OFFSET(Struct, Field) \
+ ((POINTER_SIZE_SINT) (&(((Struct *) NULL)->Field) - NULL))
+
+// macro that gets the size of a field within a struct or class
+#define SIZE(Struct, Field) \
+ (sizeof(((Struct *) NULL)->Field))
+
//////////////////////////////////////////////////////////////////////////
// Object Creation
@@ -700,6 +708,7 @@
if (!addr) {
POINTER_SIZE_INT (*p_is_inited)(Class*) = is_class_initialized;
void (*p_init)(Class*) = class_initialize;
+ void (*p_rethrow)() = rethrow_current_thread_exception;
LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:pint:void;");
assert(cs);
if (dyn_count) {
@@ -712,13 +721,21 @@
"jc r=0,not_initialized;"
"ret;"
":not_initialized;"
- "push_m2n 0, 0;"
+ "push_m2n 0, %1i;"
"m2n_save_all;"
"in2out platform:void;"
- "call %1i;"
+ "call %2i;"
+ "locals 1;"
+ "l0 = ts;"
+ "ld l0, [l0 + %3i:ref];"
+ "jc l0 != 0,_exn_raised;"
"pop_m2n;"
- "ret;",
- p_is_inited, p_init);
+ "ret;"
+ ":_exn_raised;"
+ "out platform::void;"
+ "call.noret %4i;",
+ p_is_inited, FRAME_JNI, p_init,
+ OFFSET(VM_thread, p_exception_object), p_rethrow);
assert(cs && lil_is_valid(cs));
addr = LilCodeGenerator::get_platform()->compile(cs, "rth_get_initialize_class", dump_stubs);
lil_free_code_stub(cs);
@@ -1568,7 +1585,7 @@
tmn_suspend_disable();
if (class_needs_initialization(that_class)) {
assert(!exn_raised());
- class_initialize_ex(that_class, false);
+ class_initialize_ex(that_class);
}
return ret;
}
@@ -1580,7 +1597,7 @@
tmn_suspend_disable();
if (class_needs_initialization(that_class)) {
assert(!exn_raised());
- class_initialize_ex(that_class, false);
+ class_initialize_ex(that_class);
}
return ret;
}
@@ -2057,16 +2074,6 @@
* LIL checkcast and instanceof stubs
*/
-
-// macro that gets the offset of a certain field within a struct or class type
-#define OFFSET(Struct, Field) \
- ((POINTER_SIZE_SINT) (&(((Struct *) NULL)->Field) - NULL))
-
-// macro that gets the size of a field within a struct or class
-#define SIZE(Struct, Field) \
- (sizeof(((Struct *) NULL)->Field))
-
-
// appends code that throws a ClassCastException to a LIL stub
static LilCodeStub *gen_lil_throw_ClassCastException(LilCodeStub *cs) {
// if instanceof returns false, throw an exception
@@ -2673,8 +2680,8 @@
"entry 0:stdcall:pint:pint;" // the single argument is 'void*'
"push_m2n 0, 0;" // create m2n frame
"out stdcall::void;"
- "call %0i;" // call tmn_suspen_enable()
- "in2out stdcall:pint;" // reloads input arg into output
+ "call %0i;" // call tmn_suspend_enable()
+ "in2out stdcall:pint;" // reload input arg into output
"call %1i;" // call the foo
"locals 2;" //
"l0 = r;" // save result
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_field.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_field.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_field.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_field.cpp Tue Aug 1 12:45:38 2006
@@ -40,7 +40,7 @@
{
assert(tmn_is_suspend_enabled());
if(clss->state != ST_Initialized) {
- class_initialize_from_jni(clss, false);
+ class_initialize_from_jni(clss);
if(clss->state == ST_Error) {
if (!exn_raised()) // If exception is already raised, no need to
// throw new one, just return instead
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_method.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_method.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_method.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_method.cpp Tue Aug 1 12:45:38 2006
@@ -42,7 +42,7 @@
{
assert(tmn_is_suspend_enabled());
if(clss->state != ST_Initialized) {
- class_initialize_from_jni(clss, false);
+ class_initialize_from_jni(clss);
if(clss->state == ST_Error) {
if (!exn_raised()) // If exception is already raised, no need to
// throw new one, just return instead
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp Tue Aug 1 12:45:38 2006
@@ -709,7 +709,7 @@
Class* clss =
class_load_verify_prepare_by_loader_jni(VM_Global_State::loader_env, s, loader);
if(clss) {
- class_initialize_from_jni(clss, false);
+ class_initialize_from_jni(clss);
if (exn_raised()) return NULL;
assert(tmn_is_suspend_enabled());
return struct_Class_to_jclass(clss);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp Tue Aug 1 12:45:38 2006
@@ -26,42 +26,80 @@
#include "cxxlog.h"
#include "suspend_checker.h"
#include "environment.h"
+#include "interpreter_exports.h"
-static const jvmtiCapabilities jvmti_supported_capabilities =
+static const jvmtiCapabilities jvmti_supported_interpreter_capabilities =
{
- 1, // can_tag_objects
- 1, // can_generate_field_modification_events
- 1, // can_generate_field_access_events
+ 0, // can_tag_objects
+ 0, // can_generate_field_modification_events
+ 0, // can_generate_field_access_events
1, // can_get_bytecodes
1, // can_get_synthetic_attribute
1, // can_get_owned_monitor_info
1, // can_get_current_contended_monitor
1, // can_get_monitor_info
1, // can_pop_frame
- 1, // can_redefine_classes
- 1, // can_signal_thread
+ 0, // can_redefine_classes
+ 0, // can_signal_thread
1, // can_get_source_file_name
1, // can_get_line_numbers
1, // can_get_source_debug_extension
1, // can_access_local_variables
- 1, // can_maintain_original_method_order
+ 0, // can_maintain_original_method_order
1, // can_generate_single_step_events
1, // can_generate_exception_events
1, // can_generate_frame_pop_events
1, // can_generate_breakpoint_events
1, // can_suspend
- 1, // can_redefine_any_class
- 1, // can_get_current_thread_cpu_time
- 1, // can_get_thread_cpu_time
+ 0, // can_redefine_any_class
+ 0, // can_get_current_thread_cpu_time
+ 0, // can_get_thread_cpu_time
1, // can_generate_method_entry_events
1, // can_generate_method_exit_events
1, // can_generate_all_class_hook_events
1, // can_generate_compiled_method_load_events
- 1, // can_generate_monitor_events
- 1, // can_generate_vm_object_alloc_events
- 1, // can_generate_native_method_bind_events
- 1, // can_generate_garbage_collection_events
- 1 // can_generate_object_free_events
+ 0, // can_generate_monitor_events
+ 0, // can_generate_vm_object_alloc_events
+ 0, // can_generate_native_method_bind_events
+ 0, // can_generate_garbage_collection_events
+ 0 // can_generate_object_free_events
+};
+
+static const jvmtiCapabilities jvmti_supported_jit_capabilities =
+{
+ 0, // can_tag_objects
+ 0, // can_generate_field_modification_events
+ 0, // can_generate_field_access_events
+ 1, // can_get_bytecodes
+ 1, // can_get_synthetic_attribute
+ 1, // can_get_owned_monitor_info
+ 1, // can_get_current_contended_monitor
+ 1, // can_get_monitor_info
+ 0, // can_pop_frame
+ 0, // can_redefine_classes
+ 0, // can_signal_thread
+ 1, // can_get_source_file_name
+ 1, // can_get_line_numbers
+ 1, // can_get_source_debug_extension
+ 1, // can_access_local_variables
+ 0, // can_maintain_original_method_order
+ 0, // can_generate_single_step_events
+ 1, // can_generate_exception_events
+ 1, // can_generate_frame_pop_events
+ 0, // can_generate_breakpoint_events
+ 1, // can_suspend
+ 0, // can_redefine_any_class
+ 0, // can_get_current_thread_cpu_time
+ 0, // can_get_thread_cpu_time
+ 0, // can_generate_method_entry_events
+ 0, // can_generate_method_exit_events
+ 1, // can_generate_all_class_hook_events
+ 1, // can_generate_compiled_method_load_events
+ 0, // can_generate_monitor_events
+ 0, // can_generate_vm_object_alloc_events
+ 0, // can_generate_native_method_bind_events
+ 0, // can_generate_garbage_collection_events
+ 0 // can_generate_object_free_events
};
// 1 means that corresponding capability can be enabled
@@ -77,8 +115,8 @@
1, // can_get_current_contended_monitor
1, // can_get_monitor_info
0, // can_pop_frame
- 1, // can_redefine_classes
- 1, // can_signal_thread
+ 0, // can_redefine_classes
+ 0, // can_signal_thread
1, // can_get_source_file_name
1, // can_get_line_numbers
1, // can_get_source_debug_extension
@@ -89,18 +127,18 @@
0, // can_generate_frame_pop_events
0, // can_generate_breakpoint_events
1, // can_suspend
- 1, // can_redefine_any_class
- 1, // can_get_current_thread_cpu_time
- 1, // can_get_thread_cpu_time
+ 0, // can_redefine_any_class
+ 0, // can_get_current_thread_cpu_time
+ 0, // can_get_thread_cpu_time
0, // can_generate_method_entry_events
0, // can_generate_method_exit_events
1, // can_generate_all_class_hook_events
1, // can_generate_compiled_method_load_events
0, // can_generate_monitor_events
- 1, // can_generate_vm_object_alloc_events
- 1, // can_generate_native_method_bind_events
- 1, // can_generate_garbage_collection_events
- 1 // can_generate_object_free_events
+ 0, // can_generate_vm_object_alloc_events
+ 0, // can_generate_native_method_bind_events
+ 0, // can_generate_garbage_collection_events
+ 0 // can_generate_object_free_events
};
/*
@@ -133,7 +171,8 @@
return errorCode;
if (JVMTI_PHASE_ONLOAD == phase)
- *capabilities_ptr = jvmti_supported_capabilities;
+ *capabilities_ptr = interpreter_enabled() ?
+ jvmti_supported_interpreter_capabilities : jvmti_supported_jit_capabilities;
else
{
// Add all capabilities from supported on live phase to already posessed capabilities
@@ -184,8 +223,10 @@
jvmtiCapabilities posessed = ti_env->posessed_capabilities;
const jvmtiCapabilities* available_caps =
- (phase == JVMTI_PHASE_LIVE) ? &jvmti_enable_on_live_flags
- : &jvmti_supported_capabilities;
+ (phase == JVMTI_PHASE_LIVE) ? &jvmti_enable_on_live_flags :
+ (interpreter_enabled() ?
+ &jvmti_supported_interpreter_capabilities :
+ &jvmti_supported_jit_capabilities);
unsigned char* requested = (unsigned char*)capabilities_ptr;
unsigned char* available = (unsigned char*)available_caps;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp Tue Aug 1 12:45:38 2006
@@ -867,7 +867,6 @@
JIT *jit, Method *method, NativeCodePtr native_location,
JIT *catch_jit, Method *catch_method, NativeCodePtr native_catch_location)
{
- assert(!exn_raised());
SuspendDisabledChecker sdc;
DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp Tue Aug 1 12:45:38 2006
@@ -653,6 +653,9 @@
return JVMTI_ERROR_NULL_POINTER;
}
+ if (NULL == thread)
+ thread = thread_current_thread();
+
jint state;
// check error condition: JVMTI_ERROR_INVALID_THREAD
err = jvmtiGetThreadState(env, thread, &state);
@@ -995,20 +998,24 @@
return num_active_threads;
}
-jobject thread_contends_for_lock(jthread thread){
- assert(!tmn_is_suspend_enabled());
-
- VM_thread * vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
+jobject thread_contends_for_lock(jthread thread)
+{
+ SuspendEnabledChecker sec;
+ VM_thread *vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
- //assert(vm_thread);
- if ( !vm_thread)
+ assert(vm_thread);
+
+ tmn_suspend_disable();
+ ManagedObject *p_obj = mon_enter_array[vm_thread->thread_index].p_obj;
+ if (NULL == p_obj)
{
+ tmn_suspend_enable();
return NULL;
}
- ManagedObject * p_obj = mon_enter_array[vm_thread -> thread_index].p_obj;
- ObjectHandle oh = oh_allocate_global_handle();
- oh -> object = p_obj;
+ ObjectHandle oh = oh_allocate_local_handle();
+ oh->object = p_obj;
+ tmn_suspend_enable();
return (jobject)oh;
}