harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r596218 - in /harmony/enhanced/drlvm/trunk: build/custom/msvc_2003/jitrino/ build/make/components/vm/ vm/jitrino/src/codegenerator/ vm/jitrino/src/codegenerator/ia32/ vm/jitrino/src/codegenerator/ipf/include/ vm/jitrino/src/main/ vm/jitrino...
Date Mon, 19 Nov 2007 07:57:23 GMT
Author: varlax
Date: Sun Nov 18 23:57:22 2007
New Revision: 596218

URL: http://svn.apache.org/viewvc?rev=596218&view=rev
Log:
Separated RuntimeInterface declaration and impl, got rid of extra wrapping in it's usage.
Improved documentation a bit.

Added:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.cpp   (with
props)
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.h   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/build/custom/msvc_2003/jitrino/jitrino.vcproj
    harmony/enhanced/drlvm/trunk/build/make/components/vm/jitrino.xml
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeInterface.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/JITInterface.cpp

Modified: harmony/enhanced/drlvm/trunk/build/custom/msvc_2003/jitrino/jitrino.vcproj
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/custom/msvc_2003/jitrino/jitrino.vcproj?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/custom/msvc_2003/jitrino/jitrino.vcproj (original)
+++ harmony/enhanced/drlvm/trunk/build/custom/msvc_2003/jitrino/jitrino.vcproj Sun Nov 18
23:57:22 2007
@@ -582,6 +582,12 @@
 			<File
 				RelativePath="..\..\..\..\vm\jitrino\src\codegenerator\CodeGenIntfc.h">
 			</File>
+			<File
+				RelativePath="..\..\..\..\vm\jitrino\src\codegenerator\RuntimeInterface.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\vm\jitrino\src\codegenerator\RuntimeInterface.h">
+			</File>
 			<Filter
 				Name="ia32"
 				Filter="">

Modified: harmony/enhanced/drlvm/trunk/build/make/components/vm/jitrino.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/components/vm/jitrino.xml?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/components/vm/jitrino.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/components/vm/jitrino.xml Sun Nov 18 23:57:22
2007
@@ -57,6 +57,7 @@
                 <include name="translator/*.cpp" />
                 <include name="translator/java/*.cpp" />
                 <include name="vm/*.cpp" />
+                <include name="codegenerator/*.cpp"/>
 
                 <include name="codegenerator/ipf/*.cpp" if="is.ia64"/>
                 <include name="codegenerator/ia32/*.cpp" unless="is.ia64"/>

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h Sun Nov 18 23:57:22
2007
@@ -565,78 +565,5 @@
                                             CompilationInterface& compInterface) = 0;
 };
 
-class RuntimeInterface {
-public:
-    virtual ~RuntimeInterface() {}
-    virtual void  unwindStack(MethodDesc* methodDesc, ::JitFrameContext* context, bool isFirst)
= 0;
-
-    virtual void  getGCRootSet(MethodDesc* methodDesc, GCInterface* gcInterface, 
-        const ::JitFrameContext* context, bool isFirst) = 0;
-
-    virtual bool  canEnumerate(MethodDesc* methodDesc, NativeCodePtr eip) = 0;
-
-    virtual void  fixHandlerContext(MethodDesc* methodDesc, ::JitFrameContext* context, bool
isFirst) = 0;
-
-    virtual void* getAddressOfThis(MethodDesc* methodDesc, const ::JitFrameContext* context,
bool isFirst) = 0;
-    virtual bool  isSOEArea(MethodDesc* methodDesc, const ::JitFrameContext* context, bool
isFirst) {return false;}
-
-    virtual bool getBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16
*bc_pc) = 0;
-    virtual bool getNativeLocationForBc(MethodDesc* method,  uint16 bc_pc, POINTER_SIZE_INT
*native_pc) = 0;
-
-#ifdef USE_SECURITY_OBJECT
-    virtual void* getAddressOfSecurityObject(MethodDesc* methodDesc, const ::JitFrameContext*
context) = 0;
-#endif
-
-    virtual bool  recompiledMethodEvent(MethodDesc * methodDesc, void * data) = 0;
-
-    virtual uint32          getInlineDepth(InlineInfoPtr ptr, uint32 offset) { return 0;
}
-    virtual Method_Handle   getInlinedMethod(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
{ return NULL; }
-    virtual uint16   getInlinedBc(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
 = 0;
-
-};
-
-/* serialized inline_info layout
-    nativeOffset1 -> offset to InlineInfoMap::Entry in the image with max inline depth
  (32bit + 32bit)
-    nativeOffset2 -> offset to InlineInfoMap::Entry in the image with max inline depth
-    nativeOffset3 -> offset to InlineInfoMap::Entry in the image with max inline depth
-    ...
-    0 -> 0
-    InlineInfoMap::Entry1
-    InlineInfoMap::Entry2
-    ...
-*/
-
-class InlineInfoMap {
-public:
-    //Inline info for a single call site
-    class Entry {
-    public:
-        Entry(Entry* parent, uint16 _bcOffset, Method_Handle _method) 
-            : parentEntry(parent), bcOffset(_bcOffset), method(_method){}
-        
-        Entry* parentEntry;
-        uint16  bcOffset;
-        Method_Handle method;
-
-        uint32 getInlineDepth() const { 
-            return (parentEntry == 0) ? 1 : 1 + parentEntry->getInlineDepth(); 
-        }
-    };
-
-    InlineInfoMap(MemoryManager& mm) : memManager(mm), entries(mm), entryByOffset(mm){}
-    Entry* newEntry(Entry* parent, Method_Handle mh, uint16 bcOffset);
-    void registerEntry(Entry* entry, uint32 nativeOff);
-    bool isEmpty() const { return entries.empty();}
-    uint32 getImageSize() const;
-    void write(InlineInfoPtr output);
-
-    static const Entry* getEntryWithMaxDepth(InlineInfoPtr ptr, uint32 nativeOffs);
-    static const Entry* getEntry(InlineInfoPtr ptr, uint32 nativeOffs, uint32 inlineDepth);
-private:
-    MemoryManager& memManager;
-    StlVector<Entry*> entries;
-    StlMap<uint32, Entry*> entryByOffset;
-};
-
 }
 #endif // _CODEGENINTFC_H_

Added: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.cpp?rev=596218&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.cpp Sun Nov
18 23:57:22 2007
@@ -0,0 +1,137 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#include "RuntimeInterface.h"
+
+namespace Jitrino {
+
+InlineInfoMap::Entry* InlineInfoMap::newEntry(Entry* parent, Method_Handle mh, uint16 bcOffset)
{
+    Entry* e = new (memManager) Entry(parent, bcOffset, mh);
+    return e;
+}
+
+void InlineInfoMap::registerEntry(Entry* e, uint32 nativeOffs) {
+    entryByOffset[nativeOffs] = e;
+    for (Entry* current = e; current!=NULL; current = current->parentEntry) {
+        if (std::find(entries.begin(), entries.end(), current)!=entries.end()) {
+            assert(current!=e); //possible if inlined method has multiple entries, skip this
method marker.
+        } else {
+            entries.push_back(current);
+        }
+    }
+}
+
+static uint32 getIndexSize(size_t nEntriesInIndex) {
+    return (uint32)(2 * nEntriesInIndex * sizeof(uint32) + sizeof(uint32)); //zero ending
list of [nativeOffset, entryOffsetInImage] pairs
+}
+
+uint32
+InlineInfoMap::getImageSize() const {
+    if (isEmpty()) {
+        return sizeof(uint32);
+    }
+    return getIndexSize(entryByOffset.size())   //index size
+          + (uint32)(entries.size() * sizeof(Entry)); //all entries size;
+}
+
+
+/* serialized inline_info layout
+nativeOffset1 -> offset to InlineInfoMap::Entry in the image with max inline depth   (32bit
+ 32bit)
+nativeOffset2 -> offset to InlineInfoMap::Entry in the image with max inline depth
+nativeOffset3 -> offset to InlineInfoMap::Entry in the image with max inline depth
+...
+0 -> 0
+InlineInfoMap::Entry1
+InlineInfoMap::Entry2
+...
+*/
+void
+InlineInfoMap::write(InlineInfoPtr image)
+{
+    if (isEmpty()) {
+        *(uint32*)image=0;
+        return;
+    }
+
+    //write all entries first;
+    Entry*  entriesInImage = (Entry*)((char*)image + getIndexSize(entryByOffset.size()));
+    Entry*  entriesPtr = entriesInImage; 
+    for (StlVector<Entry*>::iterator it = entries.begin(), end = entries.end(); it
!= end; it++) {
+        Entry* e = *it;
+        *entriesPtr = *e;
+        entriesPtr++;
+    }
+    assert(((char*)entriesPtr) == ((char*)image) + getImageSize());
+
+    //now update parentEntry reference to written entries
+    for (uint32 i=0; i < entries.size(); i++) {
+        Entry* imageChild = entriesInImage + i;
+        Entry* compileTimeParent = imageChild->parentEntry;
+        if (compileTimeParent!=NULL) {
+            size_t parentIdx = std::find(entries.begin(), entries.end(), compileTimeParent)
- entries.begin();
+            assert(parentIdx<entries.size());
+            Entry* imageParent = entriesInImage + parentIdx;
+            imageChild->parentEntry = imageParent;
+        }
+    }
+
+    //now write index header
+    uint32* header = (uint32*)image;
+    for (StlMap<uint32, Entry*>::iterator it = entryByOffset.begin(), end = entryByOffset.end();
it!=end; it++) {
+        uint32 nativeOffset = it->first;
+        Entry* compileTimeEntry = it->second;
+        size_t entryIdx = std::find(entries.begin(), entries.end(), compileTimeEntry) - entries.begin();
+        assert(entryIdx<entries.size());
+        Entry* imageEntry = entriesInImage + entryIdx;
+        *header = nativeOffset;
+        header++;
+        *header = (uint32)((char*)imageEntry - (char*)image);
+        header++;
+    }
+    *header = 0;
+    header++;
+    assert((char*)header == (char*)entriesInImage);
+}
+
+
+const InlineInfoMap::Entry* InlineInfoMap::getEntryWithMaxDepth(InlineInfoPtr ptr, uint32
nativeOffs) {
+    uint32* header = (uint32*)ptr;
+    while (*header!=0) {
+        uint32 nativeOffset = *header;
+        header++;
+        uint32 entryOffset = *header;
+        header++;
+        if (nativeOffset == nativeOffs) {
+            Entry* e = (Entry*)((char*)ptr + entryOffset);
+            return e;
+        }
+    }
+    return NULL;
+}
+
+const InlineInfoMap::Entry* InlineInfoMap::getEntry(InlineInfoPtr ptr, uint32 nativeOffs,
uint32 inlineDepth) {
+    const Entry* e = getEntryWithMaxDepth(ptr, nativeOffs);
+    while (e!=NULL) {
+        if (e->getInlineDepth() == inlineDepth) {
+            return e;
+        }
+        e = e->parentEntry;
+    }
+    return NULL;
+}
+
+} //namespace Jitrino 

Propchange: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.h?rev=596218&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.h Sun Nov 18
23:57:22 2007
@@ -0,0 +1,123 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#ifndef _RTINTFC_H_
+#define _RTINTFC_H_
+
+#include "open/types.h"
+#include "Type.h"
+#include "Jitrino.h"
+#include "VMInterface.h"
+#include "Stl.h"
+
+namespace Jitrino
+{
+
+/**
+ * Class responsible for runtime operations the JIT (CG in particular) performs:
+ * stack unwinding, root set enumeration, and code patching.
+ */
+class RuntimeInterface {
+public:
+    virtual ~RuntimeInterface() {}
+    virtual void  unwindStack(MethodDesc* methodDesc, ::JitFrameContext* context, bool isFirst)
= 0;
+
+    virtual void  getGCRootSet(MethodDesc* methodDesc, GCInterface* gcInterface, 
+        const ::JitFrameContext* context, bool isFirst) = 0;
+
+    virtual bool  canEnumerate(MethodDesc* methodDesc, NativeCodePtr eip) = 0;
+
+    virtual void  fixHandlerContext(MethodDesc* methodDesc, ::JitFrameContext* context, bool
isFirst) = 0;
+
+    virtual void* getAddressOfThis(MethodDesc* methodDesc, const ::JitFrameContext* context,
bool isFirst) = 0;
+    virtual bool  isSOEArea(MethodDesc* methodDesc, const ::JitFrameContext* context, bool
isFirst) {return false;}
+
+    virtual bool getBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16
*bc_pc) = 0;
+    virtual bool getNativeLocationForBc(MethodDesc* method,  uint16 bc_pc, POINTER_SIZE_INT
*native_pc) = 0;
+
+#ifdef USE_SECURITY_OBJECT
+    virtual void* getAddressOfSecurityObject(MethodDesc* methodDesc, const ::JitFrameContext*
context) = 0;
+#endif
+
+    virtual bool  recompiledMethodEvent(MethodDesc * methodDesc, void * data) = 0;
+
+    virtual uint32          getInlineDepth(InlineInfoPtr ptr, uint32 offset) { return 0;
}
+    virtual Method_Handle   getInlinedMethod(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
{ return NULL; }
+    virtual uint16   getInlinedBc(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
 = 0;
+
+};
+
+/**
+ * Registry of bytecode<->native mapping for inlined methods within a compiled method.
+ * Allows to record the mapping at compile time and extract/query it at runtime.
+ */
+class InlineInfoMap {
+public:
+    /*
+     * Inline info for a single call site or instruction,
+     * linked to a chain of inlined calls.
+     */
+    class Entry {
+    public:
+        Entry(Entry* parent, uint16 _bcOffset, Method_Handle _method) 
+            : parentEntry(parent), bcOffset(_bcOffset), method(_method){}
+        
+        Entry* parentEntry;
+        uint16  bcOffset;
+        Method_Handle method;
+
+        /**
+         * Counts number of inlined calls in the chain, including this.
+         */
+        uint32 getInlineDepth() const { 
+            return (parentEntry == 0) ? 1 : 1 + parentEntry->getInlineDepth(); 
+        }
+    };
+
+    InlineInfoMap(MemoryManager& mm) : memManager(mm), entries(mm), entryByOffset(mm){}
+
+    /**
+     * Creates a loose entry, not registered at the map.
+     */
+    Entry* newEntry(Entry* parent, Method_Handle mh, uint16 bcOffset);
+
+    /**
+     * Records unique mapping of a top-level entry to the specified native offset.
+     * Parent entries are added to a common list for future references.
+     */
+    void registerEntry(Entry* entry, uint32 nativeOff);
+
+    bool isEmpty() const { return entries.empty();}
+    uint32 getImageSize() const;
+    void write(InlineInfoPtr output);
+
+    static const Entry* getEntryWithMaxDepth(InlineInfoPtr ptr, uint32 nativeOffs);
+    static const Entry* getEntry(InlineInfoPtr ptr, uint32 nativeOffs, uint32 inlineDepth);
+private:
+    MemoryManager& memManager;
+    /** 
+     * List of all entries w/o duplicates 
+     */
+    StlVector<Entry*> entries;
+    /**
+     * Unique mapping of native offset -> top-level entry
+     */
+    StlMap<uint32, Entry*> entryByOffset;
+};
+
+}
+#endif // _RTINTFC_H_

Propchange: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/RuntimeInterface.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h
Sun Nov 18 23:57:22 2007
@@ -22,7 +22,7 @@
 #ifndef _IA32RUNTIMEINTERFACE_H_
 #define _IA32RUNTIMEINTERFACE_H_
 
-#include "CodeGenIntfc.h"
+#include "RuntimeInterface.h"
 namespace Jitrino
 {
 namespace Ia32{

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeInterface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeInterface.h?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeInterface.h
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeInterface.h
Sun Nov 18 23:57:22 2007
@@ -23,7 +23,7 @@
 #ifndef IPFRUNTIMEINTERFACE_H_
 #define IPFRUNTIMEINTERFACE_H_
 
-#include "CodeGenIntfc.h"
+#include "RuntimeInterface.h"
 
 namespace Jitrino {
 namespace IPF {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp Sun Nov 18 23:57:22 2007
@@ -21,12 +21,8 @@
  *
  */
 #include "Jitrino.h"
-#include "optimizer.h"
-#include "IRBuilder.h"
 #include "irmanager.h"
 #include "FlowGraph.h"
-#include "TranslatorIntfc.h"
-#include "CodeGenIntfc.h"
 #include "Log.h"
 #include "CountWriters.h"
 #include "XTimer.h"
@@ -262,83 +258,6 @@
         success = compileMethod(cc);
     }
     return success;
-}
-
-void
-Jitrino::UnwindStack(MethodDesc* methodDesc, ::JitFrameContext* context, bool isFirst)
-{
-    runtimeInterface->unwindStack(methodDesc, context, isFirst);
-}
-
-void 
-Jitrino::GetGCRootSet(MethodDesc* methodDesc, GCInterface* gcInterface, 
-                      const ::JitFrameContext* context, bool isFirst)
-{
-    runtimeInterface->getGCRootSet(methodDesc, gcInterface, context, isFirst);
-}
-
-uint32
-Jitrino::GetInlineDepth(InlineInfoPtr ptr, uint32 offset)
-{
-    return runtimeInterface->getInlineDepth(ptr, offset);
-}
-
-Method_Handle
-Jitrino::GetInlinedMethod(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
-{
-    return runtimeInterface->getInlinedMethod(ptr, offset, inline_depth);
-}
-
-uint16
-Jitrino::GetInlinedBc(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
-{
-    return runtimeInterface->getInlinedBc(ptr, offset, inline_depth);
-}
-
-bool
-Jitrino::CanEnumerate(MethodDesc* methodDesc, NativeCodePtr eip)
-{
-    return runtimeInterface->canEnumerate(methodDesc, eip);
-}
-
-void
-Jitrino::FixHandlerContext(MethodDesc* methodDesc, ::JitFrameContext* context, bool isFirst)
-{
-    runtimeInterface->fixHandlerContext(methodDesc, context, isFirst);
-}
-
-void *
-Jitrino::GetAddressOfThis(MethodDesc* methodDesc, const ::JitFrameContext* context, bool
isFirst) {
-    return runtimeInterface->getAddressOfThis(methodDesc, context, isFirst);
-}
-
-bool
-Jitrino::IsSOEArea(MethodDesc* methodDesc, const ::JitFrameContext* context, bool isFirst)
{
-    return runtimeInterface->isSOEArea(methodDesc, context, isFirst);
-}
-
-
-#ifdef USE_SECURITY_OBJECT
-void *
-Jitrino::GetAddressOfSecurityObject(MethodDesc* methodDesc, const ::JitFrameContext* context)
{
-    return runtimeInterface->getAddressOfSecurityObject(methodDesc, context);
-}
-#endif
-
-bool  
-Jitrino::RecompiledMethodEvent(MethodDesc *               recompiledMethodDesc, 
-                               void *                     data) {
-    return runtimeInterface->recompiledMethodEvent(recompiledMethodDesc, data);
-}
-
-bool 
-Jitrino::GetBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16 *bc_pc)
{ 
-    return runtimeInterface->getBcLocationForNative(method, native_pc, bc_pc);
-}
-
-bool
-Jitrino::GetNativeLocationForBc(MethodDesc* method, uint16 bc_pc, POINTER_SIZE_INT *native_pc)
{ 
-    return runtimeInterface->getNativeLocationForBc(method, bc_pc, native_pc);
 }
 
 JITInstanceContext* Jitrino::getJITInstanceContext(JIT_Handle jitHandle) {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h Sun Nov 18 23:57:22 2007
@@ -48,24 +48,8 @@
     static bool Init(JIT_Handle jit, const char* name);
     static void DeInit(JIT_Handle jit);
     static bool  CompileMethod(CompilationContext* compilationContext);
-    static void  UnwindStack(MethodDesc* methodDesc, ::JitFrameContext* context, bool isFirst);
-    static void  GetGCRootSet(MethodDesc* methodDesc, GCInterface* gcInterface, const ::JitFrameContext*
context, bool isFirst);
-    static bool  CanEnumerate(MethodDesc* methodDesc, NativeCodePtr eip);
-    static void  FixHandlerContext(MethodDesc* methodDesc, ::JitFrameContext* context, bool
isFirst);
-    static void* GetAddressOfThis(MethodDesc* methodDesc, const ::JitFrameContext* context,
bool isFirst);
-    static bool  IsSOEArea(MethodDesc* methodDesc, const ::JitFrameContext* context, bool
isFirst);
-#ifdef USE_SECURITY_OBJECT
-    static void* GetAddressOfSecurityObject(MethodDesc* methodDesc, const ::JitFrameContext*
context);
-#endif
-    static bool  RecompiledMethodEvent(MethodDesc * recompiledMethodDesc, void * data);
+    static RuntimeInterface* getRuntimeInterface() {return runtimeInterface;}
     static MemoryManager& getGlobalMM() { return *global_mm; }
-
-    static bool GetBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16
*bc_pc);
-    static bool GetNativeLocationForBc(MethodDesc* method, uint16 bc_pc, POINTER_SIZE_INT
*native_pc);
-
-    static uint32 GetInlineDepth(InlineInfoPtr ptr, uint32 offset);
-    static Method_Handle GetInlinedMethod(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth);
-    static uint16 GetInlinedBc(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth);
 
     enum Backend {
         CG_IPF,

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp Sun Nov 18 23:57:22
2007
@@ -56,113 +56,4 @@
 #endif
 }
 
-
-
-InlineInfoMap::Entry* InlineInfoMap::newEntry(Entry* parent, Method_Handle mh, uint16 bcOffset)
{
-    Entry* e = new (memManager) Entry(parent, bcOffset, mh);
-    return e;
-}
-
-void InlineInfoMap::registerEntry(Entry* e, uint32 nativeOffs) {
-    entryByOffset[nativeOffs] = e;
-    for (Entry* current = e; current!=NULL; current = current->parentEntry) {
-        if (std::find(entries.begin(), entries.end(), current)!=entries.end()) {
-            assert(current!=e); //possible if inlined method has multiple entries, skip this
method marker.
-        } else {
-            entries.push_back(current);
-        }
-    }
-}
-
-
-static uint32 getIndexSize(size_t nEntriesInIndex) {
-    return (uint32)(2 * nEntriesInIndex * sizeof(uint32) + sizeof(uint32)); //zero ending
list of [nativeOffset, entryOffsetInImage] pairs
-}
-
-uint32
-InlineInfoMap::getImageSize() const {
-    if (isEmpty()) {
-        return sizeof(uint32);
-    }
-    return getIndexSize(entryByOffset.size())   //index size
-          + (uint32)(entries.size() * sizeof(Entry)); //all entries size;
-}
-
-void
-InlineInfoMap::write(InlineInfoPtr image)
-{
-    if (isEmpty()) {
-        *(uint32*)image=0;
-        return;
-    }
-
-    //write all entries first;
-    Entry*  entriesInImage = (Entry*)((char*)image + getIndexSize(entryByOffset.size()));
-    Entry*  entriesPtr = entriesInImage; 
-    for (StlVector<Entry*>::iterator it = entries.begin(), end = entries.end(); it
!= end; it++) {
-        Entry* e = *it;
-        *entriesPtr = *e;
-        entriesPtr++;
-    }
-    assert(((char*)entriesPtr) == ((char*)image) + getImageSize());
-
-    //now update parentEntry reference to written entries
-    for (uint32 i=0; i < entries.size(); i++) {
-        Entry* imageChild = entriesInImage + i;
-        Entry* compileTimeParent = imageChild->parentEntry;
-        if (compileTimeParent!=NULL) {
-            size_t parentIdx = std::find(entries.begin(), entries.end(), compileTimeParent)
- entries.begin();
-            assert(parentIdx<entries.size());
-            Entry* imageParent = entriesInImage + parentIdx;
-            imageChild->parentEntry = imageParent;
-        }
-    }
-
-    //now write index header
-    uint32* header = (uint32*)image;
-    for (StlMap<uint32, Entry*>::iterator it = entryByOffset.begin(), end = entryByOffset.end();
it!=end; it++) {
-        uint32 nativeOffset = it->first;
-        Entry* compileTimeEntry = it->second;
-        size_t entryIdx = std::find(entries.begin(), entries.end(), compileTimeEntry) - entries.begin();
-        assert(entryIdx<entries.size());
-        Entry* imageEntry = entriesInImage + entryIdx;
-        *header = nativeOffset;
-        header++;
-        *header = (uint32)((char*)imageEntry - (char*)image);
-        header++;
-    }
-    *header = 0;
-    header++;
-    assert((char*)header == (char*)entriesInImage);
-}
-
-
-const InlineInfoMap::Entry* InlineInfoMap::getEntryWithMaxDepth(InlineInfoPtr ptr, uint32
nativeOffs) {
-    uint32* header = (uint32*)ptr;
-    while (*header!=0) {
-        uint32 nativeOffset = *header;
-        header++;
-        uint32 entryOffset = *header;
-        header++;
-        if (nativeOffset == nativeOffs) {
-            Entry* e = (Entry*)((char*)ptr + entryOffset);
-            assert(e->getInlineDepth() > 1);
-            return e;
-        }
-    }
-    return NULL;
-}
-
-const InlineInfoMap::Entry* InlineInfoMap::getEntry(InlineInfoPtr ptr, uint32 nativeOffs,
uint32 inlineDepth) {
-    const Entry* e = getEntryWithMaxDepth(ptr, nativeOffs);
-    while (e!=NULL) {
-        if (e->getInlineDepth() == inlineDepth) {
-            return e;
-        }
-        e = e->parentEntry;
-    }
-    return NULL;
-}
-
-
 } //namespace Jitrino 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/JITInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/JITInterface.cpp?rev=596218&r1=596217&r2=596218&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/JITInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/JITInterface.cpp Sun Nov 18 23:57:22 2007
@@ -33,6 +33,7 @@
 #include "PMF.h"
 #include "CompilationContext.h"
 #include "JITInstanceContext.h"
+#include "RuntimeInterface.h"
 
 #include "jit_export.h"
 #include "jit_export_jpda.h"
@@ -213,7 +214,7 @@
                                void *callback_data)
 {
     MethodDesc methodDesc(recompiled_method, NULL);
-    bool res = Jitrino::RecompiledMethodEvent(&methodDesc,callback_data);
+    bool res = Jitrino::getRuntimeInterface()->recompiledMethodEvent(&methodDesc,callback_data);
     return (res ? TRUE : FALSE);
 }
 
@@ -372,7 +373,7 @@
     }
 #endif
     MethodDesc methodDesc(method, jit);
-    Jitrino::UnwindStack(&methodDesc, context, context->is_ip_past == FALSE);
+    Jitrino::getRuntimeInterface()->unwindStack(&methodDesc, context, context->is_ip_past
== FALSE);
 }
 
 extern "C"
@@ -397,7 +398,7 @@
 
     MethodDesc methodDesc(method, jit);
     GCInterface gcInterface(enum_handle);
-    Jitrino::GetGCRootSet(&methodDesc, &gcInterface, context,
+    Jitrino::getRuntimeInterface()->getGCRootSet(&methodDesc, &gcInterface, context,
                           context->is_ip_past == FALSE);
 }
 
@@ -408,7 +409,7 @@
     if (Log::cat_rt()->isEnabled()) {
         Log::cat_rt()->out() << "GET_INLINE_DEPTH()" << ::std::endl;
     }
-    return Jitrino::GetInlineDepth(ptr, offset);
+    return Jitrino::getRuntimeInterface()->getInlineDepth(ptr, offset);
 }
 
 extern "C"
@@ -423,7 +424,7 @@
         assert(0 && "misused inline_depth, must be [1..max_depth]");
         return 0;
     }
-    return Jitrino::GetInlinedMethod(ptr, offset, inline_depth);
+    return Jitrino::getRuntimeInterface()->getInlinedMethod(ptr, offset, inline_depth);
 }
 
 extern "C"
@@ -437,7 +438,7 @@
         assert(0 && "misused inline_depth, must be [1..max_depth]");
         return 0;
     }
-    return Jitrino::GetInlinedBc(ptr, offset, inline_depth);
+    return Jitrino::getRuntimeInterface()->getInlinedBc(ptr, offset, inline_depth);
 }
 
 extern "C"
@@ -445,7 +446,7 @@
 JIT_can_enumerate(JIT_Handle jit, Method_Handle method, NativeCodePtr eip)
 {
     MethodDesc methodDesc(method, jit);
-    bool result = Jitrino::CanEnumerate(&methodDesc, eip);
+    bool result = Jitrino::getRuntimeInterface()->canEnumerate(&methodDesc, eip);
     return (result ? TRUE : FALSE);
 }
 
@@ -486,7 +487,7 @@
 #endif
 
     MethodDesc methodDesc(method, jit);
-    Jitrino::FixHandlerContext(&methodDesc, context,
+    Jitrino::getRuntimeInterface()->fixHandlerContext(&methodDesc, context,
                                context->is_ip_past == FALSE);
 }
 
@@ -502,7 +503,7 @@
     }
 #endif
     MethodDesc methodDesc(method, jit);
-    return Jitrino::IsSOEArea(&methodDesc, context, context->is_ip_past == FALSE);
+    return Jitrino::getRuntimeInterface()->isSOEArea(&methodDesc, context, context->is_ip_past
== FALSE);
 }
 
 
@@ -517,7 +518,7 @@
     }
 #endif
     MethodDesc methodDesc(method, jit);
-    return Jitrino::GetAddressOfThis(&methodDesc, context,
+    return Jitrino::getRuntimeInterface()->getAddressOfThis(&methodDesc, context,
                                      context->is_ip_past == FALSE);
 }
 
@@ -585,7 +586,7 @@
     }
     MethodDesc methodDesc(method, jit);
     ThreadDumpEnumerator gcInterface;
-    Jitrino::GetGCRootSet(&methodDesc, &gcInterface, context,
+    Jitrino::getRuntimeInterface()->getGCRootSet(&methodDesc, &gcInterface, context,
                           context->is_ip_past == FALSE);
 }
 
@@ -609,7 +610,7 @@
     MethodDesc methDesc(method, jit);
     POINTER_SIZE_INT* ncAddr = (POINTER_SIZE_INT*) native_pc;
 
-    if (Jitrino::GetNativeLocationForBc(&methDesc, bc_pc, ncAddr)) {
+    if (Jitrino::getRuntimeInterface()->getNativeLocationForBc(&methDesc, bc_pc, ncAddr))
{
         return EXE_ERROR_NONE;
     }
     return EXE_ERROR_UNSUPPORTED;
@@ -629,7 +630,7 @@
 
     MethodDesc methDesc(method, jit);
     POINTER_SIZE_INT ncAddr = (POINTER_SIZE_INT) native_pc;
-    if (Jitrino::GetBcLocationForNative(&methDesc, ncAddr, bc_pc)) {
+    if (Jitrino::getRuntimeInterface()->getBcLocationForNative(&methDesc, ncAddr,
bc_pc)) {
         return EXE_ERROR_NONE;
     }
     return EXE_ERROR_INVALID_LOCATION;



Mime
View raw message