harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r532676 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H3751/ vm/jitrino/src/codegenerator/ia32/ vm/vmcore/include/ vm/vmcore/src/class_support/
Date Thu, 26 Apr 2007 09:04:51 GMT
Author: varlax
Date: Thu Apr 26 02:04:51 2007
New Revision: 532676

URL: http://svn.apache.org/viewvc?view=rev&rev=532676
Log:
Applied HARMONY-3751 [drlvm][jit][opt] GCMap verification routine fails with assertion on
write to vmmagic Address fields

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H3751/
    harmony/enhanced/drlvm/trunk/src/test/regression/H3751/Test.java
    harmony/enhanced/drlvm/trunk/src/test/regression/H3751/run.test.xml
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3751/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3751/Test.java?view=auto&rev=532676
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3751/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3751/Test.java Thu Apr 26 02:04:51 2007
@@ -0,0 +1,42 @@
+package org.apache.harmony.drlvm.tests.regression.h3751;
+
+import junit.framework.TestCase;
+import org.vmmagic.unboxed.*;
+
+public class Test extends TestCase {
+
+    //both methods caused failure in OPT
+    public static void testStatic() {
+        Foo.testStatic();
+    }
+    
+    public static void testNonStatic() {
+        new Foo().testNonStatic();
+    } 
+} 
+
+
+class Foo {
+    static long val;
+    static Address staticAddr;
+    Address nonStaticAddr;
+
+    static void testStatic() {
+        Address localAddr = Address.fromLong(val);
+        staticAddr = localAddr;
+        val = staticAddr.toLong();
+        System.gc();
+        staticAddr = localAddr;
+    }
+
+
+    void testNonStatic() {
+        Address localAddr = Address.fromLong(val);
+        nonStaticAddr = localAddr;
+        val = nonStaticAddr.toLong();
+        System.gc();
+        nonStaticAddr = localAddr;
+    }
+
+}
+

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3751/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3751/run.test.xml?view=auto&rev=532676
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3751/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3751/run.test.xml Thu Apr 26 02:04:51
2007
@@ -0,0 +1,8 @@
+<project name="RUN HARMONY-3751 Regression Test">
+  <target name="run-test">
+    <run-junit-test 
+        test="org.apache.harmony.drlvm.tests.regression.h3751.Test"
+        vmarg="-Xem:opt">
+    </run-junit-test>
+  </target>
+</project>

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp?view=diff&rev=532676&r1=532675&r2=532676
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp Thu Apr 26
02:04:51 2007
@@ -86,13 +86,40 @@
 
 static bool isManaged(Opnd* op) { return op->getType()->isObject() || op->getType()->isManagedPtr();}
 
-static void checkManaged2UnmanagedConv(IRManager& irm, Opnd* opnd) {
+static bool isUnmanagedFieldPtr(Opnd* opnd) {
+    if (opnd->getMemOpndKind()!=MemOpndKind_Heap) {
+        Log::out()<<"GCMap::isUnmanagedFieldPtr: not a heap opnd"<<std::endl;
+        return false;
+    }
+    Opnd* fieldOpnd = opnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement);
+    if (fieldOpnd==NULL) {
+        fieldOpnd = opnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Base);
+        if (fieldOpnd == NULL) {
+            Log::out()<<"GCMap::isUnmanagedFieldPtr: memopnd base/displacement not
found"<<std::endl;
+            return false;
+        }
+    }
+    Opnd::RuntimeInfo* info = fieldOpnd->getRuntimeInfo();
+    if (info==NULL) {
+        Log::out()<<"GCMap::isUnmanagedFieldPtr: runtime info not found"<<std::endl;
+        return false;
+    }
+    FieldDesc* field = NULL;
+    if (info->getKind() != Opnd::RuntimeInfo::Kind_FieldOffset && info->getKind()!=Opnd::RuntimeInfo::Kind_StaticFieldAddress)
{
+        Log::out()<<"GCMap::isUnmanagedFieldPtr: not a field kind"<<std::endl;
+        return false;
+    }
+    field = (FieldDesc*)info->getValue(0);
+    return field_is_magic(field->getFieldHandle());
+}
+
+static void checkManaged2UnmanagedConv(IRManager& irm, Opnd* opnd, Inst* skipInst) {
     const Nodes& nodes = irm.getFlowGraph()->getNodes();
     for (Nodes::const_iterator it = nodes.begin(), end = nodes.end(); it!=end; ++it) {
         Node* node = *it;
         if (node->isBlockNode()) {
             for (Inst* inst = (Inst*)node->getLastInst(); inst!=NULL; inst = inst->getPrevInst())
{
-                if (inst->getMnemonic() != Mnemonic_MOV) {
+                if (inst->getMnemonic() != Mnemonic_MOV || inst == skipInst) {
                     continue;
                 }
                 Opnd* op0 = inst->getOpnd(0);
@@ -104,8 +131,11 @@
                     continue;
                 }
                 Opnd* managedOpnd = isManaged(op0)?op0:op1;
-                //the only managed->unmanaged conversion type is allowed is for static
(non-gc) fields
-                assert(managedOpnd->isPlacedIn(OpndKind_Immediate)); 
+                bool res = isUnmanagedFieldPtr(managedOpnd);
+                if (!res) {
+                    Log::out()<<"GCMap::checkManaged2UnmanagedConv failure, managedOpnd="<<managedOpnd->getFirstId()<<std::endl;
+                    assert(0);
+                }
             }
         }
     }
@@ -135,7 +165,10 @@
     for (int i = liveOpnds.getNext(); i != -1; i = liveOpnds.getNext()) {
         Opnd* opnd = irm.getOpnd(i);
 #ifdef _DEBUG
-        if (opnd->getType()->isUnmanagedPtr()) checkManaged2UnmanagedConv(irm, opnd);
+        if (opnd->getType()->isUnmanagedPtr()) {
+            Inst* skipInst= opnd == callRes ? inst : NULL; // skip this call from the check
if opnd is the result of the call
+            checkManaged2UnmanagedConv(irm, opnd, skipInst);
+        }
 #endif
         
         if (callRes == opnd) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h?view=diff&rev=532676&r1=532675&r2=532676
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h Thu Apr 26 02:04:51 2007
@@ -200,11 +200,12 @@
         _const_value_index = fd._const_value_index;
         _field_type_desc = fd._field_type_desc;
         _is_injected = fd._is_injected;
+        _is_magic_type = fd._is_magic_type;
         _offset_computed = fd._offset_computed;
         const_value = fd.const_value;
         track_access = fd.track_access;
         track_modification = fd.track_modification;
-
+        
         return *this;
     }
     //

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp?view=diff&rev=532676&r1=532675&r2=532676
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp Thu Apr
26 02:04:51 2007
@@ -749,16 +749,18 @@
 
 static bool is_magic_type_name(const String* name) {
     static String* MAGIC_TYPE_NAMES[]={
-        VM_Global_State::loader_env->string_pool.lookup("org/vmmagic/unboxed/Address"),
-        VM_Global_State::loader_env->string_pool.lookup("org/vmmagic/unboxed/Offset"),

-        VM_Global_State::loader_env->string_pool.lookup("org/vmmagic/unboxed/Word"),
-        VM_Global_State::loader_env->string_pool.lookup("org/vmmagic/unboxed/Extent"),
+        VM_Global_State::loader_env->string_pool.lookup("Lorg/vmmagic/unboxed/Address;"),
+        VM_Global_State::loader_env->string_pool.lookup("Lorg/vmmagic/unboxed/Offset;"),

+        VM_Global_State::loader_env->string_pool.lookup("Lorg/vmmagic/unboxed/Word;"),
+        VM_Global_State::loader_env->string_pool.lookup("Lorg/vmmagic/unboxed/Extent;"),
         NULL
     };
     for (int i=0;;i++)    {
         String* magicClassName = MAGIC_TYPE_NAMES[i];
         if (magicClassName == NULL) break;
-        if (magicClassName == name) return true;
+        if (magicClassName == name) {
+            return true;
+        }
     }
     return false;
 }
@@ -843,7 +845,7 @@
     }
 
     //check if field is magic type
-     if (is_magic_type_name(clss->get_name())) {
+     if (is_magic_type_name(_descriptor)) {
          _is_magic_type = 1;
      }
 



Mime
View raw message