harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfur...@apache.org
Subject svn commit: r599712 - in /harmony/enhanced/drlvm/trunk/vm: jitrino/src/optimizer/ jitrino/src/translator/java/ vmcore/src/jit/ vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/
Date Fri, 30 Nov 2007 07:28:25 GMT
Author: mfursov
Date: Thu Nov 29 23:28:24 2007
New Revision: 599712

URL: http://svn.apache.org/viewvc?rev=599712&view=rev
Log:
Fix of regression introduced by HARMONY-5189 "[drlvm][jit] VMMagic package refactoring" commit

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelperFastPath.java

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp?rev=599712&r1=599711&r2=599712&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp Thu Nov 29 23:28:24
2007
@@ -241,6 +241,12 @@
     Opnd* instResOpnd = inst->getDst();
     Type* helperRetType = method->getReturnType();
     Type* instResType = instResOpnd->getType();
+    bool resIsTau = instResType && Type::isTau(instResType->tag);
+    if (resIsTau) {
+        assert(helperRetType->isVoid());
+        instResType = NULL;
+        instResOpnd = opndManager->getNullOpnd();
+    }
     bool needResConv = instResType && instResType->isObject() && helperRetType->isObject()
&& VMMagicUtils::isVMMagicClass(helperRetType->asObjectType()->getName());
     Opnd* helperResOpnd = !needResConv ? instResOpnd : opndManager->createSsaTmpOpnd(typeManager->getUnmanagedPtrType(typeManager->getInt8Type()));
     
@@ -255,16 +261,25 @@
 
     finalizeCall(call); //make call last inst in a block
 
-    if (needResConv) {
+    if (needResConv || resIsTau) {
         //convert address type to managed object type
-        Edge* fallEdge= call->getNode()->getUnconditionalEdge();
+        Edge* fallEdge = call->getNode()->getUnconditionalEdge();
         assert(fallEdge && fallEdge->getTargetNode()->isBlockNode());
         Node* fallNode = fallEdge->getTargetNode();
         if (fallNode->getInDegree()>1) {
             fallNode = irm->getFlowGraph().spliceBlockOnEdge(fallEdge, instFactory->makeLabel());
         }
-        Modifier mod = Modifier(Overflow_None)|Modifier(Exception_Never)|Modifier(Strict_No);
-        fallNode->prependInst(instFactory->makeConvUnmanaged(mod, Type::Object, instResOpnd,
helperResOpnd));
+        if (needResConv) {
+            Modifier mod = Modifier(Overflow_None)|Modifier(Exception_Never)|Modifier(Strict_No);
+            fallNode->prependInst(instFactory->makeConvUnmanaged(mod, Type::Object,
instResOpnd, helperResOpnd));
+        } else {
+            assert(resIsTau);
+            Opnd* tauSafeOpnd2 = opndManager->createSsaTmpOpnd(typeManager->getTauType());
+            Inst* makeTau = instFactory->makeTauSafe(tauSafeOpnd2);
+            fallNode->prependInst(makeTau);
+            instFactory->makeCopy(inst->getDst(), tauSafeOpnd2)->insertAfter(makeTau);
+            
+        }
     }
 
     //Inline the call

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp?rev=599712&r1=599711&r2=599712&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
Thu Nov 29 23:28:24 2007
@@ -3588,8 +3588,7 @@
 
     if (!strcmp(mname,"checkCast")) {
         assert(numArgs == 2);
-        Opnd* res = irBuilder.genVMHelperCall(VM_RT_CHECKCAST, resType, numArgs, srcOpnds);
-        pushOpnd(res);
+        irBuilder.genVMHelperCall(VM_RT_CHECKCAST, resType, numArgs, srcOpnds);
         return true;
     }
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp?rev=599712&r1=599711&r2=599712&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp Thu Nov 29 23:28:24
2007
@@ -113,7 +113,7 @@
     {VM_RT_CHECKCAST,                          "VM_RT_CHECKCAST",
             INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
             "org/apache/harmony/drlvm/VMHelperFastPath",   "checkCast",
-            "(Lorg/vmmagic/unboxed/Address;Ljava/lang/Object;)Ljava/lang/Object;",   NULL},
+            "(Lorg/vmmagic/unboxed/Address;Ljava/lang/Object;)V",   NULL},
 
     {VM_RT_INSTANCEOF,                         "VM_RT_INSTANCEOF",
             INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java?rev=599712&r1=599711&r2=599712&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java
Thu Nov 29 23:28:24 2007
@@ -20,7 +20,9 @@
 
 package org.apache.harmony.drlvm;
 
-import org.vmmagic.unboxed.Address;
+import org.vmmagic.unboxed.*;
+import org.vmmagic.pragma.*;
+
 /**
     Core class for DRLVM's vmmagic based helpers.
     Resolved and initilized during VM startup
@@ -45,6 +47,12 @@
 
     public static final long COMPRESSED_REFS_OBJ_BASE_OFFSET  = getCompressedModeObjectBaseOffset();
 
+    public static final int OBJ_VTABLE_OFFSET = 0;
+
+    public static final int VTABLE_GCPRIVATE_OFFSET = 0;
+
+    public static final int OBJ_INFO_OFFSET = 4;
+
 
 
 
@@ -65,12 +73,13 @@
 
     public static Address getInterfaceVTable(Object obj, Address intfTypePtr) {fail(); return
null;}
  
-    public static Object checkCast(Object obj, Address castTypePtr) {fail(); return null;}
+    public static void checkCast(Object obj, Address castTypePtr) {fail();}
  
     public static boolean instanceOf(Object obj, Address castTypePtr) {fail(); return false;}
 
 
 
+
     //utility magics supported by JIT
 
     public static Address getTlsBaseAddress() {fail(); return null;}
@@ -91,10 +100,23 @@
 
     public static int getFastTypeCheckDepth(Address classHandle) {VMHelper.fail(); return
0;}
 
+    protected static void fail() {throw new RuntimeException("Not supported!");}
 
 
-    protected static void fail() {throw new RuntimeException("Not supported!");}
 
+
+
+    //helpers implemented with magics
+
+    @Inline
+    public static Address getVTable(Object obj) {
+        Address objAddr = ObjectReference.fromObject(obj).toAddress();
+        if (COMPRESSED_VTABLE_MODE) {
+            int compressedAddr = objAddr.loadInt(Offset.fromIntZeroExtend(OBJ_VTABLE_OFFSET));
+            return Address.fromLong(compressedAddr + COMPRESSED_VTABLE_BASE_OFFSET);
+        } 
+        return objAddr.loadAddress(Offset.fromIntZeroExtend(OBJ_VTABLE_OFFSET));
+    }
 
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelperFastPath.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelperFastPath.java?rev=599712&r1=599711&r2=599712&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelperFastPath.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelperFastPath.java
Thu Nov 29 23:28:24 2007
@@ -135,29 +135,29 @@
     }
 
     @Inline
-    public static Object checkCast(Address castType, Object obj) {
+    public static void checkCast(Address castType, Object obj) {
         if (obj == null) {
-            return obj;
+            return;
         }
         if (VMHelper.isInterface(castType)) {
             Address vtableAddr = getVTableAddress(obj);
 
             Address inf0Type = vtableAddr.loadAddress(Offset.fromIntZeroExtend(CLASS_INF_TYPE_0_OFFSET));
             if (inf0Type.EQ(castType)) {
-                return obj;
+                return;
             }
     
             Address inf1Type = vtableAddr.loadAddress(Offset.fromIntZeroExtend(CLASS_INF_TYPE_1_OFFSET));
             if (inf1Type.EQ(castType)) {
-                return obj;
+                return;
             }
         } else if (!VMHelper.isArray(castType)) {
             int fastCheckDepth=VMHelper.getFastTypeCheckDepth(castType);
             if (fastCheckDepth!=0 && fastClassInstanceOf(obj, castType, fastCheckDepth))
{
-                return obj;
+                return;
             }
         } 
-        return VMHelper.checkCast(obj, castType);
+        VMHelper.checkCast(obj, castType);
     }
 
     @Inline



Mime
View raw message