harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r634569 - in /harmony/enhanced/drlvm/trunk/vm: em/src/ include/open/ vmcore/include/ vmcore/src/class_support/ vmcore/src/jit/ vmcore/src/jni/ vmcore/src/jvmti/ vmcore/src/lil/em64t/ vmcore/src/lil/ia32/ vmcore/src/ncai/utils/ vmcore/src/st...
Date Fri, 07 Mar 2008 07:21:02 GMT
Author: gshimansky
Date: Thu Mar  6 23:21:00 2008
New Revision: 634569

URL: http://svn.apache.org/viewvc?rev=634569&view=rev
Log:
Moved method lookup from VM to EM to make it VM independent
Also removed unused stubs.cpp


Added:
    harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.cpp
      - copied, changed from r634357, harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp
    harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.h
      - copied, changed from r634357, harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h
Removed:
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/stubs.cpp
Modified:
    harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
    harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.h
    harmony/enhanced/drlvm/trunk/vm/em/src/em_intf.cpp
    harmony/enhanced/drlvm/trunk/vm/include/open/em_vm.h
    harmony/enhanced/drlvm/trunk/vm/include/open/types.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/compile.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_utils_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/native_stack_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/native_stack_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/ia32_em64t/signals_common.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/native_stack.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp Thu Mar  6 23:21:00 2008
@@ -102,7 +102,7 @@
 
 
 //todo!! replace inlined strings with defines!!
-DrlEMImpl::DrlEMImpl() : jh(NULL), _execute_method(NULL) {
+DrlEMImpl::DrlEMImpl() : jh(NULL), _execute_method(NULL), method_lookup_table() {
     nMethodsCompiled=0;
     nMethodsRecompiled=0;
     tick=0;
@@ -867,7 +867,6 @@
     tick++;
 }
 
-
 int DrlEMImpl::getTbsTimeout() const {
     return 100;
 }   
@@ -878,3 +877,19 @@
     //notify every profile collector about classloader unloading
 }
 
+void DrlEMImpl::registerCodeChunk(Method_Handle method_handle, void *code_addr,
+    size_t size, void *data)
+{
+    method_lookup_table.add(method_handle, code_addr, size, data);
+}
+
+Method_Handle DrlEMImpl::lookupCodeChunk(void *ip, Boolean is_ip_past,
+    void **code_addr, size_t *size, void **data)
+{
+    return method_lookup_table.find(ip, is_ip_past, code_addr, size, data);
+}
+
+Boolean DrlEMImpl::unregisterCodeChunk(void *addr)
+{
+    return method_lookup_table.remove(addr);
+}

Modified: harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.h?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.h Thu Mar  6 23:21:00 2008
@@ -24,6 +24,7 @@
 
 #include "MTable.h"
 #include "DrlProfileCollectionFramework.h"
+#include "method_lookup.h"
 #include "open/em.h"
 #include "open/vm_util.h"
 #include "open/em_profile_access.h"
@@ -92,6 +93,11 @@
     virtual void deinit();
     virtual void executeMethod(jmethodID meth, jvalue  *return_value, jvalue *args);
     virtual JIT_Result compileMethod(Method_Handle method_handle);
+    virtual void registerCodeChunk(Method_Handle method_handle, void *code_addr,
+        size_t size, void *data);
+    virtual Method_Handle lookupCodeChunk(void *addr, Boolean is_ip_past,
+        void **code_addr, size_t *size, void **data);
+    virtual Boolean unregisterCodeChunk(void *addr);
     virtual unsigned int getNumProfilerThreads() const { return tbsClients.empty() ? 0 : 1;}
 
     virtual void classloaderUnloadingCallback(ClassLoaderHandle class_handle); 
@@ -133,6 +139,8 @@
     
     hymutex_t recompilationLock;
     std::set<Method_Profile_Handle> methodsInRecompile;
+
+    Method_Lookup_Table method_lookup_table;
 };
 
 #endif

Modified: harmony/enhanced/drlvm/trunk/vm/em/src/em_intf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/em_intf.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/em/src/em_intf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/em_intf.cpp Thu Mar  6 23:21:00 2008
@@ -49,6 +49,25 @@
     return DrlEMFactory::getEMInstance()->compileMethod(method_handle);
 }
 
+static void RegisterCodeChunk(Method_Handle method_handle, void *code_addr,
+    size_t size, void *data)
+{
+    return DrlEMFactory::getEMInstance()->registerCodeChunk(method_handle, code_addr,
+        size, data);
+}
+
+static Method_Handle LookupCodeChunk(void *addr, Boolean is_ip_past, void **code_addr,
+    size_t *size, void **data)
+{
+    return DrlEMFactory::getEMInstance()->lookupCodeChunk(addr, is_ip_past,
+        code_addr, size, data);
+}
+
+static Boolean UnregisterCodeChunk(void *addr)
+{
+    return DrlEMFactory::getEMInstance()->unregisterCodeChunk(addr);
+}
+
 static void
 ProfilerThreadTimeout() 
 {
@@ -178,6 +197,9 @@
     _OpenEmVm* vm_intf = (_OpenEmVm*) apr_palloc(pool, sizeof(_OpenEmVm));
     vm_intf->ExecuteMethod = ExecuteMethod;
     vm_intf->CompileMethod = CompileMethod;
+    vm_intf->RegisterCodeChunk = RegisterCodeChunk;
+    vm_intf->LookupCodeChunk = LookupCodeChunk;
+    vm_intf->UnregisterCodeChunk = UnregisterCodeChunk;
     vm_intf->ProfilerThreadTimeout = ProfilerThreadTimeout;
     vm_intf->ClassloaderUnloadingCallback = ClassloaderUnloadingCallback;
 

Copied: harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.cpp (from r634357, harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp)
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.cpp?p2=harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.cpp&p1=harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp&r1=634357&r2=634569&rev=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method_lookup.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.cpp Thu Mar  6 23:21:00 2008
@@ -38,15 +38,19 @@
 #define EIP_CACHE_SIZE 1024
 #define EIP_ALIGNMENT     4
 
+
+
 Method_Lookup_Table::Method_Lookup_Table()
 {
     _next_free_entry = 0;
     _capacity        = 0;
     _table           = 0;
-    _cache           = (CodeChunkInfo **)STD_MALLOC(EIP_CACHE_SIZE * sizeof(CodeChunkInfo *));
+    _cache           = (Method_Code **)STD_MALLOC(EIP_CACHE_SIZE *
+        sizeof(Method_Code *));
     assert (_cache);
-    memset(_cache, 0, (EIP_CACHE_SIZE * sizeof(CodeChunkInfo *)));
+    memset(_cache, 0, (EIP_CACHE_SIZE * sizeof(Method_Code *)));
     reallocate(511);
+    hymutex_create(&lock, TM_MUTEX_NESTED);
 } //Method_Lookup_Table::Method_Lookup_Table
 
 
@@ -59,17 +63,19 @@
     if (_cache != NULL) {
         STD_FREE((void*)_cache);
     }
+    hymutex_destroy(&lock);
 } //Method_Lookup_Table::~Method_Lookup_Table
 
 
 
 void Method_Lookup_Table::reallocate(unsigned new_capacity)
 {
-    CodeChunkInfo **new_table = (CodeChunkInfo **)STD_MALLOC(new_capacity * sizeof(CodeChunkInfo *));
+    Method_Code **new_table = (Method_Code **)STD_MALLOC(new_capacity *
+        sizeof(Method_Code *));
     assert(new_table != NULL);
     assert(_next_free_entry <= _capacity);
     assert(_next_free_entry < new_capacity);
-    memcpy(new_table, _table, (_next_free_entry * sizeof(CodeChunkInfo *)));
+    memcpy(new_table, _table, (_next_free_entry * sizeof(Method_Code *)));
     if (_table != NULL) {
         STD_FREE(_table);
     }
@@ -79,13 +85,11 @@
 
 
 
-void Method_Lookup_Table::add(CodeChunkInfo *m)
+void Method_Lookup_Table::add(Method_Code *m)
 {
-    Global_Env * vm_env = VM_Global_State::loader_env;
+    table_lock();
 
-    vm_env->p_meth_addr_table_lock->_lock();
-
-    void *code_block_addr = m->get_code_block_addr();
+    void *code_block_addr = m->code_addr;
 
     // If the table is full, allocate more memory.
     if (_next_free_entry >= _capacity) {
@@ -101,26 +105,24 @@
     _table[idx] = m;
     _next_free_entry++;
 
-    vm_env->p_meth_addr_table_lock->_unlock();
+    table_unlock();
 } //Method_Lookup_Table::add
 
 #define USE_METHOD_LOOKUP_CACHE
 
-void Method_Lookup_Table::remove(CodeChunkInfo *m)
+Boolean Method_Lookup_Table::remove(void *addr)
 {
-    Global_Env * vm_env = VM_Global_State::loader_env;
-
-    void* addr = m->get_code_block_addr();
     if (addr == NULL) {
-        return;
+        return FALSE;
     }
 
 #ifdef USE_METHOD_LOOKUP_CACHE
     // First remove from cache.  
     for (unsigned i = 0; i < EIP_CACHE_SIZE; i++){
         if (_cache[i]){
-            void *guess_start = _cache[i]->get_code_block_addr();
-            void *guess_end   = ((char *)_cache[i]->get_code_block_addr()) + _cache[i]->get_code_block_size();
+            void *guess_start = _cache[i]->code_addr;
+            void *guess_end   = ((char *)_cache[i]->code_addr) +
+                _cache[i]->size;
             if ((addr >= guess_start) && (addr < guess_end)) {
                 _cache[i] = NULL;
             }
@@ -128,14 +130,14 @@
     }
 #endif //USE_METHOD_LOOKUP_CACHE
 
-    vm_env->p_meth_addr_table_lock->_lock();
+    table_lock();
 
     unsigned L = 0, R = _next_free_entry;
     while (L < R) {
         unsigned M = (L + R) / 2;
-        CodeChunkInfo *m = _table[M];
-        void  *code_block_addr = m->get_code_block_addr();
-        size_t code_block_size = m->get_code_block_size();
+        Method_Code *m = _table[M];
+        void  *code_block_addr = m->code_addr;
+        size_t code_block_size = m->size;
         void  *code_end_addr   = (void *)((char *)code_block_addr + code_block_size);
 
         if (addr < code_block_addr) {
@@ -150,19 +152,20 @@
             }
             _next_free_entry--;
 
-            vm_env->p_meth_addr_table_lock->_unlock();
-            return;
+            table_unlock();
+            return TRUE;
         }
     }
 
-    vm_env->p_meth_addr_table_lock->_unlock();
+    table_unlock();
+    return FALSE;
 } //Method_Lookup_Table::remove
 
 
-void Method_Lookup_Table::append_unlocked(CodeChunkInfo *m)
+void Method_Lookup_Table::append_unlocked(Method_Code *m)
 {
-    void  *code_block_addr = m->get_code_block_addr();
-    size_t code_block_size = m->get_code_block_size();
+    void  *code_block_addr = m->code_addr;
+    size_t code_block_size = m->size;
     void  *code_end_addr   = (void *)((char *)code_block_addr + code_block_size);
 
     // If the table is full, allocate more memory.
@@ -172,9 +175,9 @@
 
     if (_next_free_entry > 0) {
         unsigned last_entry = (_next_free_entry - 1);
-        CodeChunkInfo *last = _table[last_entry];
-        void  *last_code_addr = last->get_code_block_addr();
-        size_t last_size      = last->get_code_block_size();
+        Method_Code *last = _table[last_entry];
+        void  *last_code_addr = last->code_addr;
+        size_t last_size      = last->size;
         void  *last_end_addr  = (void *)((char *)last_code_addr + last_size);
         if (code_block_addr < last_end_addr) {
             printf("Method_Lookup_Table::append_unlocked: New entry [%p..%p] is before last table entry [%p..%p]\n",
@@ -194,9 +197,9 @@
     unsigned L = 0, R = _next_free_entry;
     while (L < R) {
         unsigned M = (L + R) / 2;
-        CodeChunkInfo *m = _table[M];
-        void  *code_block_addr = m->get_code_block_addr();
-        size_t code_block_size = m->get_code_block_size();
+        Method_Code *m = _table[M];
+        void  *code_block_addr = m->code_addr;
+        size_t code_block_size = m->size;
         void  *code_end_addr   = (void *)((char *)code_block_addr + code_block_size);
         if (addr < code_block_addr) {
             R = M;
@@ -211,10 +214,8 @@
 
 
 
-CodeChunkInfo *Method_Lookup_Table::find(void *addr, bool is_ip_past)
+Method_Code *Method_Lookup_Table::find(void *addr, Boolean is_ip_past)
 {
-    Global_Env * vm_env = VM_Global_State::loader_env;
-
     if (addr == NULL) {
         return NULL;
     }
@@ -225,14 +226,14 @@
 #ifdef USE_METHOD_LOOKUP_CACHE
     // First try the cache.  There's no need for a lock.
     unsigned cache_idx = (unsigned)(((POINTER_SIZE_INT)addr / EIP_ALIGNMENT) % EIP_CACHE_SIZE);
-    CodeChunkInfo *guess = _cache[cache_idx];
+    Method_Code *guess = _cache[cache_idx];
     if (guess != NULL) {
-        void *guess_start = guess->get_code_block_addr();
-        void *guess_end   = ((char *)guess->get_code_block_addr()) + guess->get_code_block_size();
+        void *guess_start = guess->code_addr;
+        void *guess_end   = ((char *)guess->code_addr) + guess->size;
         if ((addr >= guess_start) && (addr < guess_end)) {
 #ifdef VM_STATS
             UNSAFE_REGION_START
-            VM_Statistics::get_vm_stats().num_method_lookup_cache_hit++;
+//            VM_Statistics::get_vm_stats().num_method_lookup_cache_hit++;
             UNSAFE_REGION_END
 #endif //VM_STATS
             return guess;
@@ -241,18 +242,18 @@
 #endif //USE_METHOD_LOOKUP_CACHE
 #ifdef VM_STATS
     UNSAFE_REGION_START
-    VM_Statistics::get_vm_stats().num_method_lookup_cache_miss++;
+//    VM_Statistics::get_vm_stats().num_method_lookup_cache_miss++;
     UNSAFE_REGION_END
 #endif //VM_STATS
 
-    vm_env->p_meth_addr_table_lock->_lock();
+    table_lock();
 
     unsigned L = 0, R = _next_free_entry;
     while (L < R) {
         unsigned M = (L + R) / 2;
-        CodeChunkInfo *m = _table[M];
-        void  *code_block_addr = m->get_code_block_addr();
-        size_t code_block_size = m->get_code_block_size();
+        Method_Code *m = _table[M];
+        void  *code_block_addr = m->code_addr;
+        size_t code_block_size = m->size;
         void  *code_end_addr   = (void *)((char *)code_block_addr + code_block_size);
 
         if (addr < code_block_addr) {
@@ -264,26 +265,24 @@
 #ifdef USE_METHOD_LOOKUP_CACHE
             _cache[cache_idx] = m;
 #endif //USE_METHOD_LOOKUP_CACHE
-            vm_env->p_meth_addr_table_lock->_unlock();
+            table_unlock();
             return m;
         }
     }
 
-    vm_env->p_meth_addr_table_lock->_unlock();
+    table_unlock();
     return NULL;
 } //Method_Lookup_Table::find
 
 
 
-CodeChunkInfo *Method_Lookup_Table::find_deadlock_free(void *addr)
+Method_Code *Method_Lookup_Table::find_deadlock_free(void *addr)
 {
-    Global_Env * vm_env = VM_Global_State::loader_env;
-
-    bool ok = vm_env->p_meth_addr_table_lock->_lock_or_null();             // vvv
+    bool ok = hymutex_trylock(&lock) == TM_ERROR_NONE;             // vvv
     if (ok) {
         // We acquired the lock.  Can use the fast lookup.
-        CodeChunkInfo *m = find(addr);
-        vm_env->p_meth_addr_table_lock->_unlock_or_null();                 // ^^^
+        Method_Code *m = find(addr, FALSE);
+        table_unlock();                 // ^^^
         return m;
     } else {
         // We failed to acquire the lock.  Use slow linear search.
@@ -296,9 +295,9 @@
         //    so we never lose an element in the linear search from the left.
         //    We could see the same method twice, but this is safe.
         for (unsigned i = 0;  i < _next_free_entry;  i++) {
-            CodeChunkInfo *m = _table[i];
-            void  *code_block_addr = m->get_code_block_addr();
-            size_t code_block_size = m->get_code_block_size();
+            Method_Code *m = _table[i];
+            void  *code_block_addr = m->code_addr;
+            size_t code_block_size = m->size;
             void  *code_end_addr   = (void *)((char *)code_block_addr + code_block_size);
             if ((addr >= code_block_addr) && (addr <= code_end_addr)) {
                 return m;
@@ -314,6 +313,7 @@
 {
 } //Method_Lookup_Table::unload_all
 
+#if 0
 #ifdef VM_STATS
 void Method_Lookup_Table::print_stats()
 {
@@ -447,9 +447,9 @@
     return NULL;
 } //Method_Lookup_Table::get_next_code_info
 
+#endif
 
-
-CodeChunkInfo *Method_Lookup_Table::get(unsigned i) { 
+Method_Code *Method_Lookup_Table::get(unsigned i) { 
     if (i < _next_free_entry) {
         return _table[i];
     } else {
@@ -458,51 +458,28 @@
 }   // Method_Lookup_Table::get
 
 
-
-
-CodeChunkInfo* vm_find_method(void *addr)
+void Method_Lookup_Table::add(Method_Handle method_handle, void *code_addr,
+    size_t size, void *data)
 {
-    Global_Env *env = VM_Global_State::loader_env;
-
-    if (NULL == env || NULL == env->vm_methods)
-        return NULL;
-
-    return env->vm_methods->find(addr);
-
-} //vm_identify_eip
-
-
-
-VM_Code_Type vm_identify_eip(void *addr)
-{
-    Global_Env *env = VM_Global_State::loader_env;
-    if (NULL == env || NULL == env->vm_methods)
-        return VM_TYPE_UNKNOWN;
-    CodeChunkInfo *m = env->vm_methods->find(addr);
-    if (m == NULL) {
-        return VM_TYPE_UNKNOWN;
-    }
-
-    if (m->get_method()->is_native()) {
-        return VM_TYPE_NATIVE_STUB;
-    } else {
-        return VM_TYPE_JAVA;
+    Method_Code *mc = new Method_Code(method_handle, code_addr, size, data);
+    add(mc);
+}
+
+Method_Handle Method_Lookup_Table::find(void *ip, Boolean is_ip_past,
+    void **code_addr, size_t *size, void **data)
+{
+    Method_Code *mc = find(ip, is_ip_past);
+
+    if (NULL != mc)
+    {
+        if (NULL != code_addr)
+            *code_addr = mc->code_addr;
+        if (NULL != size)
+            *size = mc->size;
+        if (NULL != data)
+            *data = mc->data;
+        return mc->method;
     }
-} //vm_identify_eip
-
-
-
-VM_Code_Type vm_identify_eip_deadlock_free(void *addr)
-{
-    Global_Env *env = VM_Global_State::loader_env;
-    CodeChunkInfo *m = env->vm_methods->find_deadlock_free(addr);
-    if (m == NULL) {
-        return VM_TYPE_UNKNOWN;
-    }
-
-    if (m->get_method()->is_native()) {
-        return VM_TYPE_NATIVE_STUB;
-    } else {
-        return VM_TYPE_JAVA;
-    }
-} //vm_identify_eip_deadlock_free
+    else
+        return NULL;
+}

Copied: harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.h (from r634357, harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h)
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.h?p2=harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.h&p1=harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h&r1=634357&r2=634569&rev=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/method_lookup.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/method_lookup.h Thu Mar  6 23:21:00 2008
@@ -23,20 +23,29 @@
 #ifndef _METHOD_LOOKUP_H_
 #define _METHOD_LOOKUP_H_
 
-#include "Class.h"
+#include "open/em.h"
+#include "open/hythread_ext.h"
 
+class Method_Lookup_Table;
 
-enum VM_Code_Type {
-    VM_TYPE_JAVA,
-    VM_TYPE_NATIVE_STUB,
-    VM_TYPE_UNKNOWN
-};
-
-
-VM_Code_Type vm_identify_eip(void *addr);
-VM_Code_Type vm_identify_eip_deadlock_free(void *addr);
-
+class Method_Code
+{
+private:
+friend class Method_Lookup_Table;
 
+    Method_Code(Method_Handle mh, void *ca, size_t s, void *d) :
+        method(mh),
+        code_addr(ca),
+        size(s),
+        data(d)
+    {
+    }
+
+    Method_Handle method;
+    void *code_addr;
+    size_t size;
+    void *data;
+};
 
 class Method_Lookup_Table
 {
@@ -44,29 +53,25 @@
     Method_Lookup_Table();
     ~Method_Lookup_Table();
 
-    unsigned       size()           { return _next_free_entry; }
+    void add(Method_Handle method_handle, void *code_addr,
+        size_t size, void *data);
+    Method_Handle find(void *ip, Boolean is_ip_past, void **code_addr, size_t *size,
+        void **data);
+    Boolean remove(void *code_addr);
 
-    CodeChunkInfo *get(unsigned i);
-    void           add(CodeChunkInfo *m);
-    void           remove(CodeChunkInfo *m);
+private:
+    void add(Method_Code *m);
+    Method_Code *find(void *addr, Boolean is_ip_past);
+
+    unsigned       size()           { return _next_free_entry; }
+    Method_Code    *get(unsigned i);
 
     // Resembles add, but appends the new entry m at the end of the table. The new entry must have a starting address above all entries
     // in the table. This method does not acquire p_meth_addr_table_lock, so insertion must be protected by another lock or scheme.
-    void           append_unlocked(CodeChunkInfo *m);
-
-    VMEXPORT CodeChunkInfo *find(void *addr, bool is_ip_past = false);
-    CodeChunkInfo *find_deadlock_free(void *addr);
+    void           append_unlocked(Method_Code *m);
 
     void           unload_all();
 
-    // An iterator for methods compiled by the specific JIT.
-    CodeChunkInfo *get_first_method_jit(JIT *jit);
-    CodeChunkInfo *get_next_method_jit(CodeChunkInfo *prev_info);
-
-    // An iterator for all methods regardless of which JIT compiled them.
-    CodeChunkInfo *get_first_code_info();
-    CodeChunkInfo *get_next_code_info(CodeChunkInfo *prev_info);
-
 #ifdef _DEBUG
     void           dump();
     void           verify();
@@ -75,15 +80,35 @@
 #ifdef VM_STATS
     void           print_stats();
 #endif
+    void table_lock()
+    {
+        UNREF UDATA r = hymutex_lock(&lock);
+        assert(TM_ERROR_NONE == r);
+    }
+
+    void table_unlock()
+    {
+        UNREF UDATA r = hymutex_unlock(&lock);
+        assert(TM_ERROR_NONE == r);
+    }
 
-private:
+    // An iterator for methods compiled by the specific JIT.
+    Method_Code *get_first_method_jit(JIT_Handle *jit);
+    Method_Code *get_next_method_jit(Method_Code *prev_info);
+
+    // An iterator for all methods regardless of which JIT compiled them.
+    Method_Code *get_first_code_info();
+    Method_Code *get_next_code_info(Method_Code *prev_info);
+
+    Method_Code *find_deadlock_free(void *addr);
     void           reallocate(unsigned new_capacity);
     unsigned       find_index(void *addr);
 
     unsigned        _capacity;
     unsigned        _next_free_entry;
-    CodeChunkInfo **_table;
-    CodeChunkInfo **_cache;
+    Method_Code **_table;
+    Method_Code **_cache;
+    hymutex_t lock;
 }; //class Method_Lookup_Table
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/em_vm.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/em_vm.h?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/em_vm.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/em_vm.h Thu Mar  6 23:21:00 2008
@@ -26,7 +26,8 @@
  * EM interface exposed to VM.
  *
  * VM uses the given interface to ask EM to execute and/or compile a method
- * or to notify EM on profiler thread events.
+ * or to notify EM on profiler thread events. Compiled methods lookup table
+ * also resides in EM.
  */
  
 #include "open/types.h"
@@ -73,6 +74,54 @@
    * @param[in] method_handle - the handle of the method to compile
    */
         JIT_Result (*CompileMethod) (Method_Handle method_handle);
+
+  /**
+   * Registers a code chunk in EM for later possible lookup by IP in code
+   *
+   * EM implements method lookup by IP. All code chunks allocated by
+   * VM as responses for JIT helper call to method_allocate_code_block
+   * helper. To register a code chunk this function is called by VM.
+   *
+   * @param[in] method_handler - the handler of the method that
+   * occupies this code chunk.
+   * @param[in] code_addr - address of the code.
+   * @param[in] size - size of the code chunk in bytes.
+   * @param[in] data - pointer to additional data associated with code chunk,
+   * may be NULL if VM is not interested in storing any data.
+   */
+        void (*RegisterCodeChunk) (Method_Handle method_handle, void *code_addr,
+            size_t size, void *data);
+
+  /**
+   * Lookup code chunk by IP
+   *
+   * Return code chunk registered by RegisterCodeChunk if <code>addr</code>
+   * pointer points inside of it.
+   *
+   * @param[in] addr - IP address to use to lookup code chunk.
+   * @param[in] is_ip_past - <code>TRUE</code> if IP points to an instruction
+   * after call, <code>FALSE</code> otherwise
+   * @param[out] code_addr - start address of found code chunk, if NULL,
+   * argument is not filled.
+   * @param[out] size - size of found code chunk in bytes, if NULL,
+   * argument is not filled.
+   * @param[out] data - additional data that was specified to store with code
+   * chunk. If NULL, argument is not filled.
+   * @return the handle of the method that occupies found code chunk. NULL if
+   * no method is found.
+   */
+        Method_Handle (*LookupCodeChunk) (void *addr, Boolean is_ip_past,
+            void **code_addr, size_t *size, void **data);
+
+  /**
+   * Removes registered code chunk from the lookup table.
+   *
+   * @param[in] addr - Any IP address that points to the code region
+   * of the method.
+   * @return <code>TRUE</code> if removal was successful, <code>FALSE</code>
+   * otherwise, e.g. if code chunk was not found.
+   */
+        Boolean (*UnregisterCodeChunk) (void *addr);
 
   /** 
    * The method is used to callback EM from the profiler thread supported

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/types.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/types.h?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/types.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/types.h Thu Mar  6 23:21:00 2008
@@ -19,6 +19,7 @@
 #define _VM_TYPES_H_
 
 #include "platform_types.h"
+#include <stddef.h>
 
 
 /**

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/compile.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/compile.h?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/compile.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/compile.h Thu Mar  6 23:21:00 2008
@@ -161,4 +161,29 @@
 void compile_add_dynamic_generated_code_chunk(const char* name, bool free_name, const void* address, size_t length);
 void compile_clear_dynamic_code_list(DynamicCode* list);
 
+
+enum VM_Code_Type {
+    VM_TYPE_JAVA,
+    VM_TYPE_UNKNOWN
+};
+
+/**
+ * Quick inline to call EM lookup and find a compiled method type
+ */
+static inline VM_Code_Type vm_identify_eip(void *addr)
+{
+    Global_Env *env = VM_Global_State::loader_env;
+    if (NULL == env || NULL == env->em_interface)
+        return VM_TYPE_UNKNOWN;
+
+    Method_Handle m = env->em_interface->LookupCodeChunk(addr, FALSE,
+        NULL, NULL, NULL);
+
+    if (m == NULL)
+        return VM_TYPE_UNKNOWN;
+    else
+        return VM_TYPE_JAVA;
+} //vm_identify_eip
+
+
 #endif

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h Thu Mar  6 23:21:00 2008
@@ -32,7 +32,6 @@
 #include "object_handles.h"
 #include "jvmti_internal.h"
 #include "ncai_internal.h"
-#include "method_lookup.h"
 
 typedef struct NSOTableItem NSOTableItem;
 typedef struct DynamicCode DynamicCode;
@@ -57,7 +56,6 @@
     PoolManager*              GlobalCodeMemoryManager;
     PoolManager*              VTableMemoryManager;
 
-    Method_Lookup_Table*      vm_methods;
     hythread_library_t        hythread_lib;
     String_Pool               string_pool;  // string table
     JavaVMInitArgs            vm_arguments;
@@ -83,7 +81,6 @@
     
     Lock_Manager *p_jit_a_method_lock;
     Lock_Manager *p_vtable_patch_lock;
-    Lock_Manager *p_meth_addr_table_lock;
     Lock_Manager *p_method_call_lock;
     Lock_Manager *p_handle_lock;
     Lock_Manager *p_dclist_lock;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Thu Mar  6 23:21:00 2008
@@ -25,7 +25,6 @@
 #include "classloader.h"
 #include "lock_manager.h"
 #include "compile.h"
-#include "method_lookup.h"
 #include "vm_arrays.h"
 #include "vm_strings.h"
 #include "properties.h"
@@ -342,7 +341,11 @@
 void method_set_relocatable(Method_Handle m, JIT_Handle j, NativeCodePtr code_address, Boolean is_relocatable)
 {
     Global_Env *env = VM_Global_State::loader_env;
-    CodeChunkInfo *cci = env->vm_methods->find(code_address);
+    CodeChunkInfo *cci;
+    Method_Handle method = env->em_interface->LookupCodeChunk(code_address, FALSE,
+        NULL, NULL, reinterpret_cast<void **>(&cci));
+    assert(method);
+    assert(method == m);
     assert(cci);
     assert(cci->get_jit() == j);
     assert(cci->get_method() == m);
@@ -535,28 +538,6 @@
     callee_method->set_inline_assumption(jit, caller_method);
 } //method_set_inline_assumption
 
-
-
-Method_Iterator method_get_first_method_jit(JIT_Handle j)
-{
-    Global_Env *env = VM_Global_State::loader_env;
-    return env->vm_methods->get_first_method_jit((JIT *)j);
-} //method_get_first_method_jit
-
-
-
-Method_Iterator method_get_next_method_jit(Method_Iterator i)
-{
-    Global_Env *env = VM_Global_State::loader_env;
-    return env->vm_methods->get_next_method_jit((CodeChunkInfo *)i);
-} //method_get_next_method_jit
-
-
-
-Method_Handle method_get_method_jit(Method_Iterator i)
-{
-    return ((CodeChunkInfo *)i)->get_method();
-} //method_get_method_jit
 
 const char* class_get_name(Class_Handle cl)
 {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp Thu Mar  6 23:21:00 2008
@@ -655,9 +655,12 @@
 {
     CodeChunkInfo *jit_info;
     for (jit_info = _jits;  jit_info;  jit_info = jit_info->_next) {
-        VM_Global_State::loader_env->vm_methods->remove(jit_info);
+        Boolean result = VM_Global_State::loader_env->em_interface->UnregisterCodeChunk(
+            jit_info->get_code_block_addr());
+        assert(TRUE == result);
         // ensure that jit_info was deleted
-        assert (!VM_Global_State::loader_env->vm_methods->find(jit_info->get_code_block_addr()));
+        assert (VM_Global_State::loader_env->em_interface->LookupCodeChunk(
+                jit_info->get_code_block_addr(), FALSE, NULL, NULL, NULL) == NULL);
 
         for(unsigned k = 0; k < jit_info->_num_target_exception_handlers; k++) {
             delete jit_info->_target_exception_handlers[k];

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp Thu Mar  6 23:21:00 2008
@@ -43,7 +43,6 @@
 portLib(NULL),
 dcList(NULL),
 assert_reg(NULL),
-vm_methods(NULL),
 string_pool(string_pool_size),
 total_loaded_class_count(0),
 unloaded_class_count(0),
@@ -153,7 +152,6 @@
     // initialize critical sections
     p_jit_a_method_lock = new Lock_Manager();
     p_vtable_patch_lock = new Lock_Manager();
-    p_meth_addr_table_lock = new Lock_Manager();
     p_handle_lock = new Lock_Manager();
     p_method_call_lock = new Lock_Manager();
     p_dclist_lock = new Lock_Manager();
@@ -218,7 +216,6 @@
 
     TI = new DebugUtilsTI; 
     NCAI = new GlobalNCAI;
-    vm_methods = new Method_Lookup_Table;
 
     nsoTable = nso_init_lookup_table(&string_pool);
 
@@ -242,9 +239,6 @@
     delete NCAI;
     NCAI = NULL;
 
-    delete vm_methods;
-    vm_methods = NULL;
-
     delete m_java_properties;
     m_java_properties = NULL;
     delete m_vm_properties;
@@ -259,7 +253,6 @@
     // uninitialize critical sections
     delete p_jit_a_method_lock;
     delete p_vtable_patch_lock;
-    delete p_meth_addr_table_lock;
     delete p_handle_lock;
     delete p_method_call_lock;
     delete p_dclist_lock;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp Thu Mar  6 23:21:00 2008
@@ -26,7 +26,6 @@
 #include "Class.h"
 #include "classloader.h"
 #include "environment.h"
-#include "method_lookup.h"
 #include "nogc.h"
 #include "open/vm_util.h"
 #include "jit_intf_cpp.h"
@@ -313,7 +312,7 @@
     unlock();
 
     Global_Env *env = VM_Global_State::loader_env;
-    env->vm_methods->add(jit_info); // Method table is thread safe
+    env->em_interface->RegisterCodeChunk(this, addr, size, jit_info); // Method table is thread safe
     return addr;
 } // Method::allocate_code_block
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp Thu Mar  6 23:21:00 2008
@@ -25,7 +25,6 @@
 #include "apr_strings.h"
 #include "lock_manager.h"
 #include "classloader.h"
-#include "method_lookup.h"
 #include "exceptions.h"
 #include "native_overrides.h"
 #include "jit_intf_cpp.h"

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?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- 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 Thu Mar  6 23:21:00 2008
@@ -48,7 +48,6 @@
 #include "lil.h"
 #include "lil_code_generator.h"
 #include "m2n.h"
-#include "method_lookup.h"
 #include "object_layout.h"
 #include "object_handles.h"
 #include "vm_arrays.h"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp Thu Mar  6 23:21:00 2008
@@ -36,7 +36,6 @@
 #include "properties.h"
 #include "environment.h"
 #include "exceptions.h"
-#include "method_lookup.h"
 #include "nogc.h"
 #include "m2n.h"
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp Thu Mar  6 23:21:00 2008
@@ -28,7 +28,6 @@
 #include "interpreter.h"
 #include "interpreter_exports.h"
 #include "jit_intf_cpp.h"
-#include "method_lookup.h"
 #include "exceptions.h"
 #include "m2n.h"
 #include "stack_iterator.h"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp Thu Mar  6 23:21:00 2008
@@ -27,7 +27,6 @@
 #include "jit_intf_cpp.h"
 #include "stack_iterator.h"
 #include "interpreter.h"
-#include "method_lookup.h"
 #include "cci.h"
 #include "open/bytecodes.h"
 #include "open/jthread.h"
@@ -527,11 +526,12 @@
     // this is method resolution or compilation stub. Nothing shold be
     // done. Breakpoint will be inserted once the method is compiled.
     NativeCodePtr ip = disasm->get_target_address_from_context(&regs);
-    CodeChunkInfo *cci = vm_env->vm_methods->find(ip);
-    if (NULL != cci)
+    Method_Handle mh = vm_env->em_interface->LookupCodeChunk(ip, FALSE,
+        NULL, NULL, NULL);
+    if (NULL != mh)
     {
         // Compiled method, set bytecode in it
-        method = cci->get_method();
+        method = reinterpret_cast<Method *>(mh);
         assert(method->get_state() == Method::ST_Compiled);
     }
     else
@@ -609,7 +609,7 @@
             method = (Method *)((POINTER_SIZE_INT)stub_op.imm);
         }
     }
-#endif
+#endif // #if 0
 
     TRACE2("jvmti.break.ss", "Removing VIRTUAL single step breakpoint: " << bp->addr);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp Thu Mar  6 23:21:00 2008
@@ -24,7 +24,6 @@
 #include "environment.h"
 #include "stack_iterator.h"
 #include "vm_threads.h"
-#include "method_lookup.h"
 #include "jit_intf_cpp.h"
 #include "encoder.h"
 #include "m2n.h"
@@ -366,7 +365,13 @@
     Global_Env *env = VM_Global_State::loader_env;
     // Setup current frame
     // It's possible that registers represent native code and res->cci==NULL
-    si->cci = env->vm_methods->find((NativeCodePtr)regs->rip, is_ip_past);
+
+    Method_Handle m = env->em_interface->LookupCodeChunk(
+        reinterpret_cast<void *>(regs->eip), is_ip_past,
+        NULL, NULL, reinterpret_cast<void **>(&si->cci));
+    if (NULL == m)
+        si->cci = NULL;
+
     init_context_from_registers(si->jit_frame_context, *regs, is_ip_past);
     
     si->m2n_frame = lm2nf;
@@ -408,7 +413,13 @@
     }
 
     Global_Env *vm_env = VM_Global_State::loader_env;
-    si->cci = vm_env->vm_methods->find(si_get_ip(si), si_get_jit_context(si)->is_ip_past);
+
+    Method_Handle m = vm_env->em_interface->LookupCodeChunk(si_get_ip(si),
+        si_get_jit_context(si)->is_ip_past, NULL, NULL,
+        reinterpret_cast<void **>(&si->cci));
+    if (NULL == m)
+        si->cci = NULL;
+
 #ifndef NDEBUG
     if (si_is_native(si)) {
         TRACE2("si", "si_goto_previous to ip = " << (void*)si_get_ip(si)

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp Thu Mar  6 23:21:00 2008
@@ -25,7 +25,6 @@
 #include "m2n.h"
 #include "m2n_ia32_internal.h"
 #include "nogc.h"
-#include "method_lookup.h"
 #include "stack_iterator.h"
 #include "vm_stats.h"
 #include "open/types.h"
@@ -296,7 +295,12 @@
     // Setup current frame
     Global_Env *env = VM_Global_State::loader_env;
     // It's possible that registers represent native code and si->cci==NULL
-    si->cci = env->vm_methods->find((NativeCodePtr)regs->eip, is_ip_past);
+    Method_Handle m = env->em_interface->LookupCodeChunk(
+        reinterpret_cast<void *>(regs->eip), is_ip_past,
+        NULL, NULL, reinterpret_cast<void **>(&si->cci));
+    if (NULL == m)
+        si->cci = NULL;
+
     si->c.esp = regs->esp;
     si->c.p_eip = &regs->eip;
     si->c.p_ebp = &regs->ebp;
@@ -345,7 +349,12 @@
         si_unwind_from_m2n(si, over_popped);
     }
     Global_Env *vm_env = VM_Global_State::loader_env;
-    si->cci = vm_env->vm_methods->find(si_get_ip(si), si_get_jit_context(si)->is_ip_past);
+    Method_Handle m = vm_env->em_interface->LookupCodeChunk(si_get_ip(si),
+        si_get_jit_context(si)->is_ip_past, NULL, NULL,
+        reinterpret_cast<void **>(&si->cci));
+    if (NULL == m)
+        si->cci = NULL;
+
     if (si->cci) {
         TRACE2("si", ("si_goto_previous to ip = %p (%s%s)",
             (void*)si_get_ip(si),

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_utils_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_utils_ia32.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_utils_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_utils_ia32.cpp Thu Mar  6 23:21:00 2008
@@ -8,7 +8,6 @@
 //#include "m2n_ia32_internal.h"
 #include <open/ncai_thread.h>
 #include "jit_export_rt.h"
-#include "method_lookup.h"
 
 #include "ncai_internal.h"
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp Thu Mar  6 23:21:00 2008
@@ -29,7 +29,6 @@
 #include "interpreter.h"
 #include "jit_intf_cpp.h"
 #include "environment.h"
-#include "method_lookup.h"
 #include "cci.h"
 #include "class_member.h"
 #include "open/hythread.h"
@@ -61,7 +60,11 @@
     POINTER_SIZE_INT callLength = 5;
 
     Global_Env * vm_env = VM_Global_State::loader_env;
-    CodeChunkInfo* cci = vm_env->vm_methods->find(ip, is_ip_past);
+
+    CodeChunkInfo* cci;
+    Method_Handle m = vm_env->em_interface->LookupCodeChunk(ip, is_ip_past,
+        NULL, NULL, reinterpret_cast<void **>(&cci));
+    assert(NULL != m);
     assert(cci);
 
     POINTER_SIZE_INT eff_ip = (POINTER_SIZE_INT)ip -

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/native_stack_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/native_stack_em64t.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/native_stack_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/native_stack_em64t.cpp Thu Mar  6 23:21:00 2008
@@ -19,7 +19,6 @@
  * @version $Revision: 1.1.2.1 $
  */
 
-#include "method_lookup.h"
 #include "dec_base.h"
 #include "native_modules.h"
 #include "native_stack.h"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp Thu Mar  6 23:21:00 2008
@@ -37,7 +37,6 @@
 #include "Class.h"
 #include "type.h"
 #include "environment.h"
-#include "method_lookup.h"
 #include "stack_iterator.h"
 #include "m2n.h"
 #include "../m2n_ia32_internal.h"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp Thu Mar  6 23:21:00 2008
@@ -44,7 +44,6 @@
 #include "ini.h"
 #include "nogc.h"
 #include "compile.h"
-#include "method_lookup.h"
 #include "exceptions.h"
 #include "exceptions_jit.h"
 #include "sync_bits.h"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/native_stack_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/native_stack_ia32.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/native_stack_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/native_stack_ia32.cpp Thu Mar  6 23:21:00 2008
@@ -19,7 +19,6 @@
  * @version $Revision: 1.1.2.1 $
  */
 
-#include "method_lookup.h"
 #include "dec_base.h"
 #include "native_modules.h"
 #include "native_stack.h"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/ia32_em64t/signals_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/ia32_em64t/signals_common.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/ia32_em64t/signals_common.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/ia32_em64t/signals_common.cpp Thu Mar  6 23:21:00 2008
@@ -43,7 +43,6 @@
 #endif
 #include <sys/time.h>
 #include "port_thread.h"
-#include "method_lookup.h"
 
 #include "Class.h"
 #include "environment.h"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/native_stack.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/native_stack.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/native_stack.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/native_stack.cpp Thu Mar  6 23:21:00 2008
@@ -21,7 +21,6 @@
 
 #include <string.h>
 #include "lock_manager.h"
-#include "method_lookup.h"
 #include "m2n.h"
 #include "stack_trace.h"
 #include "interpreter.h"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp?rev=634569&r1=634568&r2=634569&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp Thu Mar  6 23:21:00 2008
@@ -26,7 +26,6 @@
 
 #include "environment.h"
 #include "open/vm_util.h"
-#include "method_lookup.h"
 #include "jit_runtime_support.h"
 #include "simplehashtable.h"
 #include "mem_alloc.h"
@@ -584,7 +583,9 @@
         print_methods();
     }
 
-    env->vm_methods->print_stats();
+    // Gregory -
+    // Code moved to EM, no longer accessible through standard interface
+    //    env->vm_methods->print_stats();
 
     printf("%11" FMT64 "u ::::Number of native methods\n", num_native_methods);
     printf("%11" FMT64 "u ::::Number of Java methods\n",   num_java_methods);



Mime
View raw message