Author: gshimansky
Date: Thu Mar 15 06:37:35 2007
New Revision: 518625
URL: http://svn.apache.org/viewvc?view=rev&rev=518625
Log:
Apply the fix for HARMONY-3376 [drlvm][winx64] debug drlvm returns 128 when running from any
shell
The problem appears to be in recursive exception handler invocation. When VM shutdowns it
frees and zeroes a pointer to vm_methods table which contains all compiled java methods information.
This table is used by exception handler to determine whether an exception has occurred in
java code or in any other code.
So after VM zeroed a pointer to vm_methods, when exception handler tried to determine where
an exception has occurred, it got another exception because it used an incorrect pointer.
This lead to an infinite recursion of exception handler and eventual process termination with
an error code 128.
The reason why exception handler was called after VM shutdown seems to be the MSVC runtime.
Somewhere after main function of the java.exe launcher has finished, MSVC runtime generated
an exception with code 0x406D1388. This exception happens both on windows x86 and x86_64 if
the program is compiled with MSVC 2005 and linked with msvcr80.dll.
The fix to this problem is that if the pointer to vm_method table is zero, no lookup should
be performed in it. If this pointer is zero, then it means that exception didn't occur in
java because java cannot be executed in such condition.
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp?view=diff&rev=518625&r1=518624&r2=518625
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp Thu Mar 15
06:37:35 2007
@@ -459,6 +459,8 @@
VM_Code_Type vm_identify_eip(void *addr)
{
Global_Env *env = VM_Global_State::loader_env;
+ if (NULL == env || NULL == env->vm_methods)
+ return VM_TYPE_UNKNOWN;
CodeChunkInfo *m = env->vm_methods->find(addr);
if (m == NULL) {
return VM_TYPE_UNKNOWN;