harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r486222 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src: class_support/Class.cpp jni/jni.cpp
Date Tue, 12 Dec 2006 16:38:20 GMT
Author: gshimansky
Date: Tue Dec 12 08:38:19 2006
New Revision: 486222

URL: http://svn.apache.org/viewvc?view=rev&rev=486222
Log:
Applied HARMONY-2200 [drlvm][jvmti] VM crashes running classes instrumented by JVMTI profiler

Tests passed on Ubuntu6 x86, windows 2003 server and SuSE9 x86_64


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp?view=diff&rev=486222&r1=486221&r2=486222
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp Tue Dec 12 08:38:19
2006
@@ -38,6 +38,7 @@
 #include "jit_intf_cpp.h"
 #include "type.h"
 #include "cci.h"
+#include "interpreter.h"
 
 #ifdef _IPF_
 #include "vm_ipf.h"
@@ -1025,13 +1026,33 @@
 
                 // Calling callback for NativeMethodBind event
                 NativeCodePtr native_addr = methods[index].fnPtr;
+
                 jvmti_process_native_method_bind_event( (jmethodID) class_method, native_addr,
&native_addr);
 
-                // lock class
-                klass->lock();
-                class_method->set_code_addr( native_addr );
-                class_method->set_registered( true );
-                klass->unlock();
+                if (interpreter_enabled()) {
+                    //lock class
+                    klass->lock();
+                    class_method->set_code_addr( native_addr );
+                    class_method->set_registered( true );
+                    klass->unlock();
+                } else {
+                    NativeCodePtr stub = compile_create_lil_jni_stub(class_method, native_addr,
NULL);
+                    if (!stub)
+                        return true;
+
+                    class_method->lock();
+                    class_method->set_code_addr(stub);
+                    class_method->unlock();
+
+                    // the following lines were copy-pasted from compile_do_compilation()
function
+                    // it is not obvious that they should be here.
+                    //compile_flush_generated_code();
+                    //class_method->set_state(Method::ST_Compiled);
+                    //class_method->do_jit_recompiled_method_callbacks();
+
+                    class_method->apply_vtable_patches();
+                }
+
                 break;
             }
         }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp?view=diff&rev=486222&r1=486221&r2=486222
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp Tue Dec 12 08:38:19 2006
@@ -1209,7 +1209,6 @@
     TRACE2("jni", "RegisterNatives called");
     assert(hythread_is_suspend_enabled());
     Class_Handle clss = jclass_to_struct_Class(clazz);
-    class_register_methods(clss, methods, nMethods);
     return class_register_methods(clss, methods, nMethods) ? -1 : 0;
 } //RegisterNatives
 



Mime
View raw message