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/10/06 20:08:12 UTC
svn commit: r453719 - in /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore:
include/mon_enter_exit.h src/exception/exceptions_jit.cpp
src/jvmti/jvmti_pop_frame.cpp src/jvmti/jvmti_step.cpp
src/thread/mon_enter_exit.cpp
Author: geirm
Date: Fri Oct 6 11:08:11 2006
New Revision: 453719
URL: http://svn.apache.org/viewvc?view=rev&rev=453719
Log:
HARMONY-1736
PopFrame crashes VM while popping synchronized method. It tries to release method monitor and fails.
The cause is in wrong exception RAISE state. Do PopFrame function executed in one state but release monitor function
expects another.
Ubuntu 6 - smoke, c-unit, ~kernel
Modified:
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/mon_enter_exit.h
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/mon_enter_exit.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/mon_enter_exit.h?view=diff&rev=453719&r1=453718&r2=453719
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/mon_enter_exit.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/mon_enter_exit.h Fri Oct 6 11:08:11 2006
@@ -39,6 +39,11 @@
// and after arguments are parsed. It should set function pointers
// to the appropriate values.
void vm_monitor_init();
+
+// monitor exit from synchronized method
+struct StackIterator;
+void vm_monitor_exit_synchronized_method(StackIterator *si);
+
// Does a monitorexit operation.
extern void (*vm_monitor_exit)(ManagedObject *p_obj);
extern void (*vm_monitor_enter)(ManagedObject *p_obj);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp?view=diff&rev=453719&r1=453718&r2=453719
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp Fri Oct 6 11:08:11 2006
@@ -317,24 +317,7 @@
}
// No appropriate handler found, undo synchronization
- if (method->is_synchronized()) {
- bool unwindable = set_unwindable(false);
- if (method->is_static()) {
- assert(!hythread_is_suspend_enabled());
- TRACE2("tm.locks", ("unlock staic sync methods... %x", exn_obj));
- vm_monitor_exit(struct_Class_to_java_lang_Class(method->
- get_class()));
- }
- else {
- void **p_this =
- (void **) jit->get_address_of_this(method,
- si_get_jit_context(si));
- TRACE2("tm.locks", ("unlock sync methods...%x" , *p_this));
- vm_monitor_exit((ManagedObject *) * p_this);
- }
- exn_clear();
- set_unwindable(unwindable);
- }
+ vm_monitor_exit_synchronized_method(si);
BEGIN_RAISE_AREA;
jvalue ret_val = {(jlong)0};
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp?view=diff&rev=453719&r1=453718&r2=453719
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp Fri Oct 6 11:08:11 2006
@@ -184,22 +184,7 @@
unlocked by VM, so JIT has to store information about these monitors
somewhere.
*/
- if (method->is_synchronized()) {
- if (is_method_static) {
- assert(!hythread_is_suspend_enabled());
- TRACE2("tm.locks", ("unlock staic sync methods... "));
- vm_monitor_exit(struct_Class_to_java_lang_Class(method->
- get_class()));
- exn_clear();
- } else {
- JIT *jit = cci->get_jit();
- void **p_this =
- (void **) jit->get_address_of_this(method, jitContext);
- TRACE2("tm.locks", ("unlock sync methods...%x" , *p_this));
- vm_monitor_exit((ManagedObject *) * p_this);
- exn_clear();
- }
- }
+ vm_monitor_exit_synchronized_method(si);
// pop java frame
si_goto_previous(si);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp?view=diff&rev=453719&r1=453718&r2=453719
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp Fri Oct 6 11:08:11 2006
@@ -91,6 +91,9 @@
NativeCodePtr call_ip = NULL;
do
{
+ if (disasm.get_type() == InstructionDisassembler::INDIRECT_CALL)
+ call_ip = ip;
+
ip = (NativeCodePtr)((POINTER_SIZE_INT)ip + disasm.get_length_with_prefix());
// Another thread could have instrumented this location for
@@ -105,9 +108,6 @@
}
else
disasm = ip;
-
- if (disasm.get_type() == InstructionDisassembler::INDIRECT_CALL)
- call_ip = ip;
}
while (ip < next_ip);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp?view=diff&rev=453719&r1=453718&r2=453719
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp Fri Oct 6 11:08:11 2006
@@ -37,6 +37,9 @@
#include "vm_threads.h"
#include "jit_runtime_support.h"
#include "exceptions.h"
+#include "stack_iterator.h"
+#include "Class.h"
+#include "jit_intf_cpp.h"
#include "mon_enter_exit.h"
#include "thread_generic.h"
@@ -72,6 +75,35 @@
vm_monitor_try_enter = vm_monitor_try_enter_default;
vm_monitor_exit = vm_monitor_exit_default;
vm_monitor_try_exit = vm_monitor_try_exit_default;
+}
+
+void vm_monitor_exit_synchronized_method(StackIterator *si)
+{
+ assert(!si_is_native(si));
+ CodeChunkInfo *cci = si_get_code_chunk_info(si);
+ assert(cci);
+ Method *method = cci->get_method();
+
+ if (method->is_synchronized()) {
+ bool unwindable = set_unwindable(false);
+ if (method->is_static()) {
+ assert(!hythread_is_suspend_enabled());
+ TRACE2("tm.locks", ("unlock static sync methods...%x",
+ struct_Class_to_java_lang_Class(method->get_class())));
+ vm_monitor_exit(struct_Class_to_java_lang_Class(method->
+ get_class()));
+ }
+ else {
+ JIT *jit = cci->get_jit();
+ void **p_this =
+ (void **) jit->get_address_of_this(method,
+ si_get_jit_context(si));
+ TRACE2("tm.locks", ("unlock sync methods...%x" , *p_this));
+ vm_monitor_exit((ManagedObject *) * p_this);
+ }
+ exn_clear();
+ set_unwindable(unwindable);
+ }
}
static void vm_monitor_enter_default(ManagedObject *p_obj)