harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r574297 [2/2] - in /harmony/enhanced/drlvm/trunk: build/make/targets/ vm/gc_gen/src/common/ vm/include/open/ vm/interpreter/src/ vm/port/src/lil/em64t/pim/ vm/port/src/lil/ia32/pim/ vm/port/src/lil/ipf/pim/ vm/tests/unit/thread/ vm/tests/un...
Date Mon, 10 Sep 2007 16:25:31 GMT
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp Mon Sep 10 09:25:25 2007
@@ -115,7 +115,7 @@
             hythread_iterator_size(it) * sizeof(hythread_t));
     int size = 0;
     while(native_thread = hythread_iterator_next(&it)) {
-        vm_thread = get_vm_thread(native_thread);
+        vm_thread = jthread_get_vm_thread(native_thread);
         if (native_thread != self && vm_thread != NULL) {
             hythread_set_safepoint_callback(native_thread,
                     vm_shutdown_callback);
@@ -138,7 +138,7 @@
     // safe for killing, e.g. in malloc()
     it = hythread_iterator_create(NULL);
     while(native_thread = hythread_iterator_next(&it)) {
-        vm_thread = get_vm_thread(native_thread);
+        vm_thread = jthread_get_vm_thread(native_thread);
         // we should not cancel self and
         // non-java threads (i.e. vm_thread == NULL)
         if (native_thread != self && vm_thread != NULL) {
@@ -236,17 +236,20 @@
 }
 
 static IDATA vm_interrupt_process(void * data) {
-    hythread_t * threadBuf;
+    vm_thread_t * threadBuf;
     int i;
 
-    threadBuf = (hythread_t *)data;
+    threadBuf = (vm_thread_t *)data;
     i = 0;
     // Join all threads.
     while (threadBuf[i] != NULL) {
-        hythread_join(threadBuf[i]);
+        hythread_join((hythread_t)threadBuf[i]);
+        STD_FREE(threadBuf[i]);
         i++;
     }
 
+    STD_FREE(threadBuf);
+
     // Return 130 to be compatible with RI.
     exit(130);
 }
@@ -274,6 +277,26 @@
 }
 
 /**
+ * Release allocated resourses.
+ */
+static IDATA vm_dump_process(void * data) {
+    vm_thread_t * threadBuf;
+    int i;
+
+    threadBuf = (vm_thread_t *)data;
+    i = 0;
+    // Join all threads and release allocated resources.
+    while (threadBuf[i] != NULL) {
+        hythread_join((hythread_t)threadBuf[i]);
+        STD_FREE(threadBuf[i]);
+        i++;
+    }
+    STD_FREE(threadBuf);
+
+    return TM_ERROR_NONE;
+}
+
+/**
  * Dumps all java stacks.
  */
 static IDATA vm_dump_entry_point(void * data) {
@@ -303,7 +326,7 @@
  */
 void vm_interrupt_handler(int UNREF x) {
     JavaVM ** vmBuf;
-    hythread_t * threadBuf;
+    vm_thread_t * threadBuf;
     int nVMs;
     IDATA status;
 
@@ -318,23 +341,20 @@
     if (status != JNI_OK)
         goto cleanup;
 
-    threadBuf = (hythread_t *) STD_MALLOC((nVMs + 1) * sizeof(hythread_t));
+    threadBuf = (vm_thread_t*) STD_MALLOC((nVMs + 1) * sizeof(vm_thread_t));
     assert(threadBuf);
 
     // Create a new thread for each VM to avoid scalability and deadlock problems.
     for (int i = 0; i < nVMs; i++) {
-        threadBuf[i] = (hythread_t)STD_CALLOC(1, hythread_get_struct_size());
-        assert(threadBuf[i]);
-        status = hythread_create_with_group(threadBuf[i], NULL, 0,
-            HYTHREAD_PRIORITY_NORMAL, vm_interrupt_entry_point, (void *)vmBuf[i]);
+        threadBuf[i] = jthread_allocate_thread();
+        status = hythread_create_ex((hythread_t)threadBuf[i], NULL, 0, 0,
+            vm_interrupt_entry_point, (void *)vmBuf[i]);
         assert(status == TM_ERROR_NONE);
     }
 
     // spawn a new thread which will terminate the process.
-    threadBuf[nVMs] = (hythread_t)STD_CALLOC(1, hythread_get_struct_size());
-    assert(threadBuf[nVMs]);
-    status = hythread_create_with_group(threadBuf[nVMs], NULL, 0,
-        HYTHREAD_PRIORITY_NORMAL, vm_interrupt_process, (void *)threadBuf);
+    status = hythread_create(NULL, 0, 0, 0,
+        vm_interrupt_process, (void *)threadBuf);
     assert(status == TM_ERROR_NONE);
 
     // set a NULL terminator
@@ -349,29 +369,37 @@
  * Prints java stack traces for each VM running in the current process.
  */
 void vm_dump_handler(int UNREF x) {
-    JavaVM ** vmBuf;
     int nVMs;
-    jint status;
+    vm_thread_t *threadBuf;
 
-    status = JNI_GetCreatedJavaVMs(NULL, 0, &nVMs);
+    jint status = JNI_GetCreatedJavaVMs(NULL, 0, &nVMs);
     assert(nVMs <= 1);
     if (status != JNI_OK)
         return;
 
-    vmBuf = (JavaVM **) STD_MALLOC(nVMs * sizeof(JavaVM *));
+    JavaVM ** vmBuf = (JavaVM **) STD_MALLOC(nVMs * sizeof(JavaVM *));
     status = JNI_GetCreatedJavaVMs(vmBuf, nVMs, &nVMs);
     assert(nVMs <= 1);
-    if (status != JNI_OK)
+    if (status != JNI_OK) {
         goto cleanup;
+    }
+
+    threadBuf =
+        (vm_thread_t*)STD_MALLOC((nVMs + 1) * sizeof(vm_thread_t));
+    assert(threadBuf);
 
     // Create a new thread for each VM to avoid scalability and deadlock problems.
     for (int i = 0; i < nVMs; i++) {
-        hythread_t thread = (hythread_t)STD_CALLOC(1, hythread_get_struct_size());
-        assert(thread);
-        IDATA hy_status = hythread_create_with_group(thread, NULL, 0,
-            HYTHREAD_PRIORITY_NORMAL, vm_dump_entry_point, (void *)vmBuf[i]);
+        threadBuf[i] = jthread_allocate_thread();
+        IDATA UNUSED hy_status = hythread_create_ex((hythread_t)threadBuf[i],
+            NULL, 0, 0, vm_dump_entry_point, (void *)vmBuf[i]);
         assert(hy_status == TM_ERROR_NONE);
     }
+
+    // spawn a new thread which will release resources.
+    status = hythread_create(NULL, 0, 0, 0,
+        vm_dump_process, (void *)threadBuf);
+    assert(status == TM_ERROR_NONE);
 
 cleanup:
     STD_FREE(vmBuf);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp Mon Sep 10 09:25:25 2007
@@ -645,10 +645,6 @@
                 "vm.jvmti.compiled_method_load.inlined",
                 FALSE, VM_PROPERTIES);
 
-        // FIXME: workaround to let get_vm_thread_ptr_safe function and other JNI code
-        // to work in OnLoad phase
-        NativeObjectHandles noh;
-
         while (agent)
         {
             int result = 0;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp Mon Sep 10 09:25:25 2007
@@ -2348,9 +2348,8 @@
 
     // create TI event thread
     JNIEnv *jni_env = p_TLS_vmthread->jni_env;
-    ti->event_thread = (hythread_t)STD_CALLOC(1, hythread_get_struct_size());
-    assert(ti->event_thread);
-    IDATA status = hythread_create_with_group(ti->event_thread, NULL, 0, 0,
+    ti->event_thread = jthread_allocate_thread();
+    IDATA status = hythread_create_ex((hythread_t)ti->event_thread, NULL, 0, 0,
         jvmti_event_thread_function, jni_env);
     if( status != TM_ERROR_NONE ) {
         DIE("jvmti_create_event_thread: creating thread is failed!");

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp Mon Sep 10 09:25:25
2007
@@ -39,8 +39,6 @@
 #include "cci.h"
 #include "Class.h"
 
-#define jvmti_test_jenv (p_TLS_vmthread->jni_env)
-
 /*
  * Local Variable functions:
  *
@@ -167,11 +165,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
         // Check that this thread is not current
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             jthread_suspend(thread);
@@ -248,11 +246,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
         // Check that this thread is not current
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             jthread_suspend(thread);
@@ -316,11 +314,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
         // Check that this thread is not current
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             jthread_suspend(thread);
@@ -432,11 +430,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
         // Check that this thread is not current
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             jthread_suspend(thread);
@@ -509,11 +507,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
         // Check that this thread is not current
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             jthread_suspend(thread);
@@ -577,11 +575,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
         // Check that this thread is not current
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             jthread_suspend(thread);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp Mon Sep 10 09:25:25
2007
@@ -79,7 +79,7 @@
     }
 
     hythread_t hy_thread = jthread_get_native_thread(java_thread);
-    VM_thread* vm_thread = get_vm_thread(hy_thread);
+    vm_thread_t vm_thread = jthread_get_vm_thread(hy_thread);
 
     M2nFrame* top_frame = m2n_get_last_frame(vm_thread);
     frame_type type = m2n_get_frame_type(top_frame);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp Mon Sep 10 09:25:25 2007
@@ -369,7 +369,7 @@
     // Run through list of active threads and enumerate each one of them.
     hythread_t tm_thread = hythread_iterator_next(&iterator);
     while (tm_thread && !ti_env->iteration_state->abort) {
-        VM_thread *thread = get_vm_thread(tm_thread);
+        vm_thread_t thread = jthread_get_vm_thread(tm_thread);
         if (thread)
             ti_enumerate_thread(ti_env, thread);
         tm_thread = hythread_iterator_next(&iterator);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp Mon Sep 10 09:25:25 2007
@@ -40,8 +40,6 @@
 #include "thread_manager.h"
 #include "cci.h"
 
-#define jvmti_test_jenv (p_TLS_vmthread->jni_env)
-
 class JavaStackIterator
 {
     StackIterator* si;
@@ -293,11 +291,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
         // Check that this thread is not current
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             // to avoid suspension of each other due to race condition
@@ -489,7 +487,7 @@
 
         // FIXME: suspended thread might be resumed in other jvmti thread?
         if (info[i].state != JVMTI_THREAD_STATE_SUSPENDED) {
-            if (IsSameObject(jvmti_test_jenv, currentThread, threads[i]))
+            if (IsSameObject(p_TLS_vmthread->jni_env, currentThread, threads[i]))
                 continue;
             jthread_suspend(threads[i]);
         }
@@ -572,11 +570,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
         // Check that this thread is not current
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             jthread_suspend(thread);
@@ -656,7 +654,7 @@
 
     // check stack depth
     hythread_t hy_thread = jthread_get_native_thread(thread);
-    VM_thread* vm_thread = get_vm_thread(hy_thread);
+    vm_thread_t vm_thread = jthread_get_vm_thread(hy_thread);
 
     jint depth;
     if (interpreter_enabled()) {
@@ -741,11 +739,11 @@
 
     bool thread_suspended = false;
     // Suspend thread before getting stacks
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
     {
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
         // Check that this thread is not current
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
         if (vm_thread != p_TLS_vmthread)
         {
             jthread_suspend(thread);
@@ -760,7 +758,7 @@
         // check error condition: JVMTI_ERROR_ILLEGAL_ARGUMENT
         // check error condition: JVMTI_ERROR_NO_MORE_FRAMES
         errStack = interpreter.interpreter_ti_getFrameLocation(env,
-            get_vm_thread_ptr_safe(jvmti_test_jenv, thread),
+            jthread_get_vm_thread_ptr_safe(thread),
             depth, method_ptr, location_ptr);
     else
     {
@@ -835,9 +833,9 @@
         return JVMTI_ERROR_ILLEGAL_ARGUMENT;
     }
 
-    VM_thread *vm_thread;
+    vm_thread_t vm_thread;
     if (NULL != thread)
-        vm_thread = get_vm_thread_ptr_safe(jvmti_test_jenv, thread);
+        vm_thread = jthread_get_vm_thread_ptr_safe(thread);
     else
         vm_thread = p_TLS_vmthread;
 

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=574297&r1=574296&r2=574297&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 Mon Sep 10 09:25:25 2007
@@ -957,8 +957,7 @@
     // Set single step in all threads
     while ((ht = hythread_iterator_next(&threads_iterator)) != NULL)
     {
-        vm_thread_t vm_thread =
-            (vm_thread_t)hythread_tls_get(ht, TM_THREAD_VM_TLS_KEY);
+        vm_thread_t vm_thread = jthread_get_vm_thread(ht);
         if( !vm_thread ) {
             // Skip thread that isn't started yet.
             // SingleStep state will be enabled for it in

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
Mon Sep 10 09:25:25 2007
@@ -444,7 +444,7 @@
     unsigned size = 0;
     StackTraceFrame* frames;
 
-    VM_thread *p_thread = get_vm_thread_ptr_safe(jenv, thread);
+    vm_thread_t p_thread = jthread_get_vm_thread_ptr_safe(thread);
     if (p_thread != NULL) {
         if (p_thread == get_thread_ptr()) {
             st_get_trace(p_thread, &size, &frames);

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=574297&r1=574296&r2=574297&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 Mon Sep 10 09:25:25 2007
@@ -247,11 +247,9 @@
 
 void st_print(FILE* f, hythread_t thread)
 {
-    VM_thread * vm_thread;
-    
     assert(hythread_is_suspend_enabled());
 
-    vm_thread = get_vm_thread(thread);
+    vm_thread_t vm_thread = jthread_get_vm_thread(thread);
     
     if (vm_thread == NULL) {
         // Do not print native stack.

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp Mon Sep 10 09:25:25
2007
@@ -154,10 +154,8 @@
     // mode until current thread is not attaced to VM.
     assert(hythread_is_suspend_enabled());
 
-    vm_thread_t vm_thread = p_TLS_vmthread;
-    if (!vm_thread) {
-        vm_thread = jthread_allocate_vm_thread(hythread_self());
-    }
+    vm_thread_t vm_thread = jthread_self_vm_thread_unsafe();
+    assert(vm_thread);
 
     // if the assertion is false we cannot notify the parent thread
     // that we started and it would hang in waitloop
@@ -214,6 +212,7 @@
             (jbyte*)apr_palloc(vm_thread->pool,
                 sizeof(jbyte) * TM_JVMTI_MAX_BUFFER_SIZE);
     }
+    ((hythread_t)vm_thread)->java_status = TM_STATUS_INITIALIZED;
 
     assert(hythread_is_suspend_enabled());
     return JNI_OK;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp Mon Sep 10 09:25:25
2007
@@ -60,8 +60,7 @@
     // Association should be already done.
     hythread_t native_thread = hythread_self();
     assert(native_thread);
-    vm_thread_t vm_thread = 
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread_unsafe(native_thread);
     assert(vm_thread);
     jobject java_thread = vm_thread->java_thread;
 
@@ -126,8 +125,7 @@
     hythread_t native_thread = vm_jthread_get_tm_data(java_thread);
     assert(native_thread);
 
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread_unsafe(native_thread);
     assert(vm_thread);
     vm_thread->java_thread = jni_env->NewGlobalRef(java_thread);
 
@@ -155,7 +153,7 @@
         attrs->stacksize = default_stacksize;
     }
 
-    status = hythread_create_with_group(native_thread, NULL, attrs->stacksize,
+    status = hythread_create_ex(native_thread, NULL, attrs->stacksize,
                         attrs->priority, jthread_wrapper_proc, attrs);
 
     TRACE(("TM: Created thread: id=%d", hythread_get_id(native_thread)));
@@ -190,8 +188,7 @@
         return status;
     }
 
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     assert(vm_thread);
     vm_thread->java_thread = jni_env->NewGlobalRef(java_thread);
     vm_thread->jni_env = jni_env;
@@ -225,16 +222,15 @@
 {
     hythread_t native_thread = NULL;
     if (dead_thread) {
-        native_thread = (hythread_t) ((IDATA) dead_thread);
-        vm_thread_t vm_thread =
-            (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+        native_thread = (hythread_t)((IDATA) dead_thread);
+        vm_thread_t vm_thread = jthread_get_vm_thread_unsafe(native_thread);
+        assert(vm_thread);
         if (vm_thread->weak_ref) {
             // delete used weak reference
             env->DeleteGlobalRef(vm_thread->weak_ref);
         }
     } else {
-        native_thread = (hythread_t)STD_CALLOC(1, hythread_get_struct_size());
-        assert(native_thread);
+        native_thread = (hythread_t)jthread_allocate_thread();
     }
     
     IDATA status = hythread_struct_init(native_thread);
@@ -267,8 +263,7 @@
 
     hythread_t native_thread = jthread_get_native_thread(java_thread);
     assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     assert(vm_thread);
     JNIEnv *jni_env = vm_thread->jni_env;
 
@@ -308,13 +303,7 @@
         return TM_ERROR_NULL_POINTER;
     }
 
-    vm_thread_t vm_thread =
-        (vm_thread_t)hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
-
-    if (!vm_thread) {
-        // init VM_thread structure in native thread local
-        vm_thread = jthread_allocate_vm_thread(native_thread);
-    }
+    vm_thread_t vm_thread = jthread_get_vm_thread_unsafe(native_thread);
     assert(vm_thread);
 
     vm_thread->weak_ref = 
@@ -344,8 +333,7 @@
 {
     hythread_t native_thread = hythread_self();
     assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     assert(vm_thread);
     jobject excn = vm_thread->stop_exception;
 
@@ -381,8 +369,7 @@
     assert(java_thread);
     hythread_t native_thread = vm_jthread_get_tm_data(java_thread);
     assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     assert(vm_thread);
     JNIEnv *env = vm_thread->jni_env;
     assert(env);
@@ -406,8 +393,7 @@
     assert(java_thread);
     hythread_t native_thread = vm_jthread_get_tm_data(java_thread);
     assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     assert(vm_thread);
 
     // Install safepoint callback that would throw exception
@@ -477,8 +463,7 @@
     if (native_thread == NULL) {
         return NULL;
     }
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     if (vm_thread == NULL) {
         return NULL;
     }
@@ -513,8 +498,7 @@
     if (native_thread == NULL) {
         return NULL;
     }
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     assert(vm_thread);
     jobject java_thread = vm_thread->java_thread;
     assert(java_thread);
@@ -543,8 +527,7 @@
         TRACE(("TM: native thread is NULL"));
         return NULL;
     }
-    vm_thread_t vm_thread =
-        (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     if (vm_thread == NULL) {
         TRACE(("TM: vm_thread_t thread is NULL"));
         return NULL;
@@ -580,8 +563,7 @@
 {
     hythread_t native_thread = hythread_self();
     assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t)hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
     return hythread_wait_for_nondaemon_threads(native_thread, 
                                                (vm_thread->daemon ? 0 : 1));
 } // jthread_wait_for_all_nondaemon_threads

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_iterator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_iterator.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_iterator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_iterator.cpp Mon Sep 10
09:25:25 2007
@@ -65,8 +65,7 @@
     hythread_t native_thread = hythread_iterator_next((hythread_iterator_t *) it);
     while (native_thread != NULL) {
         if (hythread_is_alive(native_thread)) {
-            vm_thread_t vm_thread = (vm_thread_t)hythread_tls_get(native_thread,
-                                        TM_THREAD_VM_TLS_KEY);
+            vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
             if (vm_thread) {
                 return vm_thread->java_thread;
             }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp Mon Sep 10
09:25:25 2007
@@ -372,10 +372,7 @@
 
 static void jthread_add_owned_monitor(jobject monitor)
 {
-    hythread_t native_thread = hythread_self();
-    assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t)hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_self_vm_thread();
     assert(vm_thread);
     jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
 
@@ -420,10 +417,7 @@
 
 static void jthread_remove_owned_monitor(jobject monitor)
 {
-    hythread_t native_thread = hythread_self();
-    assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t)hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_self_vm_thread();
     assert(vm_thread);
     jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
 
@@ -452,10 +446,7 @@
 
 static void jthread_set_owned_monitor(jobject monitor)
 {
-    hythread_t native_thread = hythread_self();
-    assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t)hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_self_vm_thread();
     assert(vm_thread);
     jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
 
@@ -472,10 +463,7 @@
 
 static void jthread_set_wait_monitor(jobject monitor)
 {
-    hythread_t native_thread = hythread_self();
-    assert(native_thread);
-    vm_thread_t vm_thread =
-        (vm_thread_t)hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+    vm_thread_t vm_thread = jthread_self_vm_thread();
     assert(vm_thread);
     jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_manager.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_manager.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_manager.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_manager.cpp Mon Sep 10 09:25:25
2007
@@ -98,60 +98,26 @@
     // Destroy current VM_thread pool.
     apr_pool_destroy(vm_thread->pool);
 
-    // mark VM_thread structure
-    jobject weak_ref = vm_thread->weak_ref;
-    memset(vm_thread, 0, sizeof(VM_thread));
-    vm_thread->weak_ref = weak_ref;
-}
-
-vm_thread_t jthread_allocate_vm_thread(hythread_t native_thread)
-{
-    assert(native_thread);
-    vm_thread_t vm_thread;
-
-    // check current VM thread
-#ifdef _DEBUG
-    vm_thread =
-        (vm_thread_t)hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
-    assert(NULL == vm_thread);
-#endif // _DEBUG
-
-    // allocate VM thread
-    vm_thread = (vm_thread_t)STD_CALLOC(1, sizeof(VM_thread));
-    if (!vm_thread) {
-        return NULL;
-    }
+    // zero VM_thread structure
+    memset(&vm_thread->java_thread, 0,
+        sizeof(VM_thread) - offsetof(VM_thread, java_thread));
 
-    // set VM thread to thread local storage
-    IDATA status =
-        hythread_tls_set(native_thread, TM_THREAD_VM_TLS_KEY, vm_thread);
-    if (status != TM_ERROR_NONE) {
-        return NULL;
-    }
-    return vm_thread;
+    // change java_status
+    ((hythread_t)(vm_thread))->java_status = TM_STATUS_ALLOCATED;
 }
 
-VM_thread *get_vm_thread_ptr_safe(JNIEnv * jenv, jobject jThreadObj)
+vm_thread_t jthread_get_vm_thread_ptr_safe(jobject thread_obj)
 {
-    hythread_t t = jthread_get_native_thread(jThreadObj);
-    if (t == NULL) {
-        return NULL;
-    }
-    return (VM_thread *) hythread_tls_get(t, TM_THREAD_VM_TLS_KEY);
+    hythread_t native = jthread_get_native_thread(thread_obj);
+    return jthread_get_vm_thread(native);
 }
 
-VM_thread *get_thread_ptr_stub()
+vm_thread_t jthread_get_vm_thread_ptr_stub()
 {
-    return get_vm_thread(hythread_self());
+    return jthread_self_vm_thread();
 }
 
-vm_thread_accessor *get_thread_ptr = get_thread_ptr_stub;
-
-void set_TLS_data(VM_thread * thread)
-{
-    hythread_tls_set(hythread_self(), TM_THREAD_VM_TLS_KEY, thread);
-    //printf ("sett ls call %p %p\n", get_thread_ptr(), get_vm_thread(hythread_self()));
-}
+vm_thread_accessor get_thread_ptr = jthread_get_vm_thread_ptr_stub;
 
 IDATA jthread_throw_exception(char *name, char *message)
 {
@@ -179,6 +145,66 @@
 
     return 0;
 }
+
+/**
+ * Allocates VM_thread structure
+ */
+vm_thread_t jthread_allocate_thread()
+{
+    vm_thread_t vm_thread =
+            (vm_thread_t)STD_CALLOC(1, sizeof(struct VM_thread));
+    assert(vm_thread);
+    ((hythread_t)vm_thread)->java_status = TM_STATUS_ALLOCATED;
+    return vm_thread;
+} // jthread_allocate_thread
+
+/**
+ * Sets resisters to JVMTI thread
+ */
+void vm_set_jvmti_saved_exception_registers(vm_thread_t vm_thread,
+                                            Registers & regs)
+{
+    assert(vm_thread);
+    jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
+    if (!jvmti_thread->jvmti_saved_exception_registers) {
+        jvmti_thread->jvmti_saved_exception_registers =
+            (Registers*)STD_MALLOC(sizeof(Registers));
+        assert(jvmti_thread->jvmti_saved_exception_registers);
+    }
+    *(jvmti_thread->jvmti_saved_exception_registers) = regs;
+} // vm_set_jvmti_saved_exception_registers
+
+/**
+ * Sets exception registers
+ */
+void vm_set_exception_registers(vm_thread_t vm_thread, Registers & regs)
+{
+    assert(vm_thread);
+    if (!vm_thread->regs) {
+        vm_thread->regs = (Registers*)malloc(sizeof(Registers));
+        assert(vm_thread->regs);
+    }
+    *(vm_thread->regs) = regs;
+} // vm_set_exception_registers
+
+/**
+ * Gets IP from exception registers
+ */
+void *vm_get_ip_from_regs(vm_thread_t vm_thread)
+{
+    assert(vm_thread);
+    assert(vm_thread->regs);
+    return vm_thread->regs->get_ip();
+} // vm_get_ip_from_regs
+
+/**
+ * Resets IP in exception registers
+ */
+void vm_reset_ip_from_regs(vm_thread_t vm_thread)
+{
+    assert(vm_thread);
+    vm_thread->regs->reset_ip();
+} // vm_reset_ip_from_regs
 
 /**
  * This file contains the functions which eventually should become part of vmcore.

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_instr.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_instr.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_instr.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_instr.cpp Mon Sep 10 09:25:25
2007
@@ -46,8 +46,7 @@
     IDATA java_thread_count = 0;
     for (IDATA i = 0; i < count; i++) {
         hythread_t native_thread = hythread_iterator_next(&iterator);
-        vm_thread_t vm_thread =
-            (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+        vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
         if (vm_thread && vm_thread->java_thread) {
             java_thread_count++;
         }
@@ -63,8 +62,7 @@
     java_thread_count = 0;
     for (IDATA i = 0; i < count; i++) {
         hythread_t native_thread = hythread_iterator_next(&iterator);
-        vm_thread_t vm_thread =
-            (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+        vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
         if (vm_thread && vm_thread->java_thread) {
             hythread_suspend_disable();
             ObjectHandle thr = oh_allocate_local_handle();
@@ -202,8 +200,7 @@
     IDATA java_thread_count = 0;
     for (IDATA i = 0; i < count; i++) {
         hythread_t native_thread = hythread_iterator_next(&iterator);
-        vm_thread_t vm_thread =
-            (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+        vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
         if (vm_thread) {
             java_thread_count++;
         }
@@ -409,8 +406,7 @@
     if (!native_thread) {
         *lock_owner = NULL;
     } else {
-        vm_thread_t vm_thread =
-            (vm_thread_t) hythread_tls_get(native_thread, TM_THREAD_VM_TLS_KEY);
+        vm_thread_t vm_thread = jthread_get_vm_thread(native_thread);
         assert(vm_thread);
         *lock_owner = vm_thread->java_thread;
     }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp Mon Sep 10 09:25:25
2007
@@ -288,11 +288,11 @@
 static size_t common_guard_page_size;
 
 inline void* get_stack_addr() {
-    return p_TLS_vmthread->stack_addr;
+    return jthread_self_vm_thread_unsafe()->stack_addr;
 }
 
 inline size_t get_stack_size() {
-  return p_TLS_vmthread->stack_size;
+    return jthread_self_vm_thread_unsafe()->stack_size;
 }
 
 inline size_t get_guard_stack_size() {
@@ -306,10 +306,11 @@
 void set_guard_stack();
 
 void init_stack_info() {
+    vm_thread_t vm_thread = jthread_self_vm_thread_unsafe();
     char* stack_addr = (char *)find_stack_addr();
     unsigned int stack_size = hythread_get_thread_stacksize(hythread_self());
-    p_TLS_vmthread->stack_addr = stack_addr;
-    p_TLS_vmthread->stack_size = stack_size;
+    vm_thread->stack_addr = stack_addr;
+    vm_thread->stack_size = stack_size;
     common_guard_stack_size = find_guard_stack_size();
     common_guard_page_size =find_guard_page_size();
 
@@ -365,7 +366,7 @@
 
     err = sigaltstack (&sigalt, NULL);
 
-    p_TLS_vmthread->restore_guard_page = false;
+    jthread_self_vm_thread_unsafe()->restore_guard_page = false;
 }
 
 size_t get_available_stack_size() {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp Mon Sep 10 09:25:25
2007
@@ -313,11 +313,11 @@
 static size_t common_guard_page_size;
 
 inline void* get_stack_addr() {
-    return p_TLS_vmthread->stack_addr;
+    return jthread_self_vm_thread_unsafe()->stack_addr;
 }
 
 inline size_t get_stack_size() {
-    return p_TLS_vmthread->stack_size;
+    return jthread_self_vm_thread_unsafe()->stack_size;
 }
 
 inline size_t get_guard_stack_size() {
@@ -338,14 +338,16 @@
 }
 
 void init_stack_info() {
-    // fins stack parametrs
+    vm_thread_t vm_thread = jthread_self_vm_thread_unsafe();
+
+    // find stack parametrs
     char* stack_addr = (char *)find_stack_addr();
-    p_TLS_vmthread->stack_addr = stack_addr;
+    vm_thread->stack_addr = stack_addr;
     unsigned int stack_size = hythread_get_thread_stacksize(hythread_self());
     
     assert(stack_size > 0);
     
-    p_TLS_vmthread->stack_size = stack_size;
+    vm_thread->stack_size = stack_size;
 
     
     common_guard_stack_size = find_guard_stack_size();
@@ -408,7 +410,7 @@
     assert(!err);
 
     // notify that stack is OK and there are no needs to restore it
-    p_TLS_vmthread->restore_guard_page = false;
+    jthread_self_vm_thread_unsafe()->restore_guard_page = false;
 }
 
 size_t get_available_stack_size() {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp Mon Sep 10 09:25:25
2007
@@ -236,11 +236,11 @@
 static size_t common_guard_page_size;
 
 inline void* get_stack_addr() {
-    return p_TLS_vmthread->stack_addr;
+    return jthread_self_vm_thread_unsafe()->stack_addr;
 }
 
 inline size_t get_stack_size() {
-    return p_TLS_vmthread->stack_size;
+    return jthread_self_vm_thread_unsafe()->stack_size;
 }
 
 inline size_t get_guard_stack_size() {
@@ -253,8 +253,9 @@
 
 
 void init_stack_info() {
-    p_TLS_vmthread->stack_addr = find_stack_addr();
-    p_TLS_vmthread->stack_size = hythread_get_thread_stacksize(hythread_self());
+    vm_thread_t vm_thread = jthread_self_vm_thread_unsafe();
+    vm_thread->stack_addr = find_stack_addr();
+    vm_thread->stack_size = hythread_get_thread_stacksize(hythread_self());
     common_guard_stack_size = find_guard_stack_size();
     common_guard_page_size = find_guard_page_size();
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp?rev=574297&r1=574296&r2=574297&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp
Mon Sep 10 09:25:25 2007
@@ -134,11 +134,11 @@
 static size_t common_guard_page_size;
 
 inline void* get_stack_addr() {
-    return p_TLS_vmthread->stack_addr;
+    return jthread_self_vm_thread_unsafe()->stack_addr;
 }
 
 inline size_t get_stack_size() {
-  return p_TLS_vmthread->stack_size;
+  return jthread_self_vm_thread_unsafe()->stack_size;
 }
 
 inline size_t get_guard_stack_size() {
@@ -151,8 +151,9 @@
 
 
 void init_stack_info() {
-    p_TLS_vmthread->stack_addr = find_stack_addr();
-    p_TLS_vmthread->stack_size = hythread_get_thread_stacksize(hythread_self());
+    vm_thread_t vm_thread = jthread_self_vm_thread_unsafe();
+    vm_thread->stack_addr = find_stack_addr();
+    vm_thread->stack_size = hythread_get_thread_stacksize(hythread_self());
     common_guard_stack_size = find_guard_stack_size();
     common_guard_page_size = find_guard_page_size();
 
@@ -192,7 +193,7 @@
         // should be successful always
         assert(0);
     }
-    p_TLS_vmthread->restore_guard_page = false;
+    jthread_self_vm_thread_unsafe()->restore_guard_page = false;
 }
 
 void remove_guard_stack() {



Mime
View raw message