harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfur...@apache.org
Subject svn commit: r548294 - in /harmony/enhanced/drlvm/trunk/vm: jitrino/src/jet/cg_meth.cpp vmcore/src/class_support/Prepare.cpp vmcore/src/jit/jit_runtime_support.cpp vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
Date Mon, 18 Jun 2007 10:41:37 GMT
Author: mfursov
Date: Mon Jun 18 03:41:19 2007
New Revision: 548294

URL: http://svn.apache.org/viewvc?view=rev&rev=548294
Log:
HARMONY-4016: Fixes in lazy resolution mode helpers


Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp?view=diff&rev=548294&r1=548293&r2=548294
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp Mon Jun 18 03:41:19 2007
@@ -756,7 +756,9 @@
         // memory access, so we can't use HW checks - have to use 
         // explicit one. Not a big loss, as the INVOKESPECIAL mostly
         // comes right after NEW which guarantees non-null.
-        gen_check_null(thiz, opcod != OPCODE_INVOKESPECIAL);
+        // in lazy resolution mode we must do manual check and provide helper with
+        // non-null results.
+        gen_check_null(thiz, opcod != OPCODE_INVOKESPECIAL && meth!=NULL);
     }
     if (meth == NULL) {
         //lazy resolution mode: get method addr and call it.

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp?view=diff&rev=548294&r1=548293&r2=548294
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp Mon Jun 18 03:41:19
2007
@@ -1454,6 +1454,9 @@
     gc_class_prepared(this, m_vtable);
     assert(m_state == ST_InstanceSizeComputed);
     m_state = ST_Prepared;
+    if (is_array()) {
+        m_state = ST_Initialized;
+    }
     TRACE2("classloader.prepare","class " << m_name->bytes << " prepared");
 
     //

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp?view=diff&rev=548294&r1=548293&r2=548294
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp Mon Jun 18 03:41:19
2007
@@ -1904,10 +1904,9 @@
 }
 
 
-static inline Class* resolveClass(Class_Handle klass, unsigned cp_idx, bool checkNew) {
+static inline Class* resolveClassNoExnCheck(Class_Handle klass, unsigned cp_idx, bool checkNew)
{
     Global_Env* env = VM_Global_State::loader_env;
     Class* objClass = NULL;
-    BEGIN_RAISE_AREA;
     assert(!hythread_is_suspend_enabled());
     hythread_suspend_enable();
     if (checkNew) {
@@ -1919,13 +1918,19 @@
     if (objClass==NULL) {
         class_throw_linking_error(klass, cp_idx, OPCODE_NEW);
     }
-    END_RAISE_AREA;
     return objClass;
 }
 
+static inline Class* resolveClass(Class_Handle klass, unsigned cp_idx, bool checkNew) {
+    Class* res = NULL;
+    BEGIN_RAISE_AREA;
+    res = resolveClassNoExnCheck(klass, cp_idx, checkNew);
+    END_RAISE_AREA;
+    return res;
+}
 
 static inline void initializeClass(Class* cls) {
-    if (cls->is_initialized() || cls->is_initializing()) {
+    if (cls->is_initialized()) {
         return;
     }
 
@@ -2090,16 +2095,25 @@
 static void *rth_invokevirtual_addr_withresolve(Class_Handle klass, unsigned cp_idx, ManagedObject*
obj) {
     ASSERT_THROW_AREA;
 
+    assert(obj!=NULL);
+
     Method* m = NULL;
 
     BEGIN_RAISE_AREA;
+    jobject obj_h = oh_allocate_local_handle(); //make object reference visible to GC
+    obj_h->object = obj;
+
     hythread_suspend_enable();
     Global_Env* env = VM_Global_State::loader_env;
     m = resolve_virtual_method_env(env, klass, cp_idx, true);
     hythread_suspend_disable();
+
+    obj = obj_h->object;
+    oh_discard_local_handle(obj_h);
     END_RAISE_AREA;
     assert(m!=NULL);
 
+
     assert(obj!=NULL);
     assert(obj->vt()!=NULL);
     Class* objClass = obj->vt()->clss;
@@ -2130,16 +2144,25 @@
 static void *rth_invokeinterface_addr_withresolve(Class_Handle klass, unsigned cp_idx, ManagedObject*
obj) {
     ASSERT_THROW_AREA;
 
+    assert(obj!=NULL);
+
     Method* m = NULL;
-    
+
     BEGIN_RAISE_AREA;
+    jobject obj_h = oh_allocate_local_handle(); //make object reference visible to GC
+    obj_h->object = obj;
+
     hythread_suspend_enable();
     Global_Env* env = VM_Global_State::loader_env;
     m = resolve_interface_method_env(env, klass, cp_idx, true);
     hythread_suspend_disable();
+
+    obj = obj_h->object;
+    oh_discard_local_handle(obj_h);
     END_RAISE_AREA;
     assert(m!=NULL);
 
+
     assert(obj!=NULL);
     assert(obj->vt()!=NULL);
     Class* objClass = obj->vt()->clss;
@@ -2229,8 +2252,20 @@
     if (obj==NULL) {
         return obj;
     }
-    Class* castClass = resolveClass(klass, cp_idx, false);
+
     Class* objClass = obj->vt()->clss;
+    Class* castClass = NULL;
+
+    BEGIN_RAISE_AREA
+    jobject obj_h = oh_allocate_local_handle(); //make object reference visible to GC
+    obj_h->object = obj;
+
+    castClass = resolveClassNoExnCheck(klass, cp_idx, false);
+
+    obj = obj_h->object;
+    oh_discard_local_handle(obj_h);
+    END_RAISE_AREA
+    
     Boolean res = class_is_subtype(objClass, castClass);
     if (!res) {
         exn_throw_by_name("java/lang/ClassCastException");
@@ -2250,7 +2285,19 @@
 //OPCODE_INSTANCEOF
 static void *rth_instanceof_withresolve(Class_Handle klass, unsigned cp_idx, ManagedObject*
obj) {
     ASSERT_THROW_AREA;
-    Class* castClass = resolveClass(klass, cp_idx, false);
+
+    Class* castClass = NULL;
+
+    BEGIN_RAISE_AREA
+    jobject obj_h = oh_allocate_local_handle(); //make object reference visible to GC
+    obj_h->object = obj;
+   
+    castClass = resolveClassNoExnCheck(klass, cp_idx, false);
+
+    obj = obj_h->object;
+    oh_discard_local_handle(obj_h);
+    END_RAISE_AREA
+
     int res = vm_instanceof(obj, castClass);
     return (void*)(POINTER_SIZE_INT)res;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp?view=diff&rev=548294&r1=548293&r2=548294
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
Mon Jun 18 03:41:19 2007
@@ -46,6 +46,7 @@
     jclass declaring_class = NULL; //unused
     bool is_static = ((Field*) field_id)->is_static();
     jvalue primitive_value;
+    primitive_value.j = 0;
 
     switch (field_sig) {
     case 'B':
@@ -102,6 +103,7 @@
     TRACE("read field value : " << field);
 
     jvalue result;
+    result.j = 0;
     if (field->get_field_type_desc()->is_primitive()) {
         char field_sig = field->get_descriptor()->bytes[0];
         result = read_primitive(jenv, (jfieldID)field, obj, field_sig);



Mime
View raw message