You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2007/04/03 13:25:09 UTC

svn commit: r525137 - in /harmony/enhanced/drlvm/trunk/vm: gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/ jitrino/src/codegenerator/ia32/ jitrino/src/optimizer/ jitrino/src/translator/java/

Author: varlax
Date: Tue Apr  3 04:25:08 2007
New Revision: 525137

URL: http://svn.apache.org/viewvc?view=rev&rev=525137
Log:
Applied HARMONY-3460 [drlvm][em64t][jit] allocation and monitors helpers inlining on EM64T platform

Modified:
    harmony/enhanced/drlvm/trunk/vm/gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/GCHelper.java
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/GCHelper.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/GCHelper.java?view=diff&rev=525137&r1=525136&r2=525137
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/GCHelper.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/GCHelper.java Tue Apr  3 04:25:08 2007
@@ -33,7 +33,8 @@
 
 
     private static final int ARRAY_LEN_OFFSET = 8;
-    private static final int GC_OBJECT_ALIGNMENT = 4; //TODO: EM64 or IPF could have 8!
+    private static final int GC_OBJECT_ALIGNMENT = VMHelper.POINTER_TYPE_SIZE; //4 for 32bit and 8 for 64bit
+    private static final int GC_ARRAY_MIN_FIRST_ELEM_FROM_LEN_OFFSET = VMHelper.POINTER_TYPE_SIZE; //4 for 32bit and 8 for 64bit
 
 
     @Inline
@@ -61,7 +62,7 @@
     @Inline   
     public static Address allocArray(int arrayLen, int elemSize, int allocationHandle) {
         if (arrayLen >= 0) {
-            int firstElementOffset = ARRAY_LEN_OFFSET + (elemSize==8?8:4);
+            int firstElementOffset = ARRAY_LEN_OFFSET + (elemSize==8?8:GC_ARRAY_MIN_FIRST_ELEM_FROM_LEN_OFFSET);
             int size = firstElementOffset + elemSize*arrayLen;
             size = (((size + (GC_OBJECT_ALIGNMENT - 1)) & (~(GC_OBJECT_ALIGNMENT - 1))));
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp?view=diff&rev=525137&r1=525136&r2=525137
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp Tue Apr  3 04:25:08 2007
@@ -2878,7 +2878,7 @@
     {
         assert(numArgs == 0);
         Opnd * tlsBaseReg = irManager.newOpnd(typeManager.getUnmanagedPtrType(typeManager.getInt8Type()));
-#ifdef PLATFORM_POSIX
+#if defined(PLATFORM_POSIX) || defined (_EM64T_)
         TypeManager& tm =irManager.getTypeManager();
         Opnd * callAddrOpnd =irManager.newImmOpnd(tm.getUnmanagedPtrType(tm.getIntPtrType()),
             Opnd::RuntimeInfo::Kind_HelperAddress, (void*)CompilationInterface::Helper_GetTLSBase);

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?view=diff&rev=525137&r1=525136&r2=525137
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp Tue Apr  3 04:25:08 2007
@@ -361,7 +361,7 @@
 
 
 void NewObjHelperInliner::doInline() {
-#if defined  (_EM64T_) || defined (_IPF_)
+#if defined (_IPF_)
     return;
 #else
     assert(inst->getOpcode() == Op_NewObj);
@@ -377,8 +377,12 @@
     }
     //replace newObj with call to a method
 
+
+#ifdef _EM64T_
+    assert(VMInterface::areReferencesCompressed());
+#endif
     //the method signature is (int objSize, int allocationHandle)
-    int allocationHandle= (int)objType->getAllocationHandle();
+    int allocationHandle= (int)(POINTER_SIZE_INT)objType->getAllocationHandle();
     int objSize=objType->getObjectSize();
 
     Opnd* tauSafeOpnd = opndManager->createSsaTmpOpnd(typeManager->getTauType());
@@ -412,7 +416,7 @@
 }
 
 void NewArrayHelperInliner::doInline() {
-#if defined  (_EM64T_) || defined (_IPF_)
+#if defined (_IPF_)
     return;
 #else
     assert(inst->getOpcode() == Op_NewArray);
@@ -420,9 +424,12 @@
     //the method signature is (int objSize, int allocationHandle)
     Opnd* dstOpnd = inst->getDst();
     ArrayType* arrayType = dstOpnd->getType()->asArrayType();
-    int allocationHandle = (int)arrayType->getAllocationHandle();
+#ifdef _EM64T_
+    assert(VMInterface::areReferencesCompressed());
+#endif
+    int allocationHandle = (int)(POINTER_SIZE_INT)arrayType->getAllocationHandle();
     Type* elemType = arrayType->getElementType();
-    int elemSize = 4; //TODO: EM64T references!
+    int elemSize = 4; //TODO: check if references are compressed!
     if (elemType->isDouble() || elemType->isInt8()) {
         elemSize = 8;
     } else if (elemType->isInt2() || elemType->isChar()) {
@@ -461,7 +468,7 @@
 
 
 void ObjMonitorEnterHelperInliner::doInline() {
-#if defined  (_EM64T_) || defined (_IPF_)
+#if defined (_IPF_)
     return;
 #else
     assert(inst->getOpcode() == Op_TauMonitorEnter);
@@ -484,11 +491,9 @@
     //every call must have exception edge -> add it
     if (call->getNode()->getExceptionEdge() == NULL) {
         Node* node = call->getNode();
-        Node* dispatchNode = node->getUnconditionalEdgeTarget()->getExceptionEdgeTarget();
-        if (dispatchNode == NULL) {
-            dispatchNode = cfg->getUnwindNode();
-            assert(dispatchNode != NULL); //method with monitors must have unwind, so no additional checks is done
-        }
+        //this is fake dispatch edge -> monenter must never throw exceptions
+        Node* dispatchNode = cfg->getUnwindNode(); 
+        assert(dispatchNode != NULL); //method with monitors must have unwind, so no additional checks is done
         cfg->addEdge(node, dispatchNode);
     }
     
@@ -497,7 +502,7 @@
 }
 
 void ObjMonitorExitHelperInliner::doInline() {
-#if defined  (_EM64T_) || defined (_IPF_)
+#if defined (_IPF_)
     return;
 #else
     assert(inst->getOpcode() == Op_TauMonitorExit);

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?view=diff&rev=525137&r1=525136&r2=525137
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp Tue Apr  3 04:25:08 2007
@@ -90,7 +90,7 @@
 //vm helpers support
 
 bool isVMHelperClass(NamedType* type) {
-#ifdef _EM64T_
+#ifdef _IPF_
     return false;//natives are not tested on EM64T.
 #else
     static const char vmhelperPackage[] = "org/apache/harmony/drlvm/VMHelper";
@@ -2695,7 +2695,7 @@
     if (isMagicMethod(methodDesc)) {
         genMagic(methodDesc, numArgs, srcOpnds, returnType);    
         return;
-    } else if (isVMHelperMethod(methodDesc)) {
+    } else if (isVMHelperMethod(methodDesc) && !methodDesc->isNative()) {
         genVMHelper(methodDesc, numArgs, srcOpnds, returnType);
         return;
     }