harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r556704 [5/5] - in /harmony/enhanced/drlvm/trunk: build/make/ build/make/components/vm/ build/make/targets/ vm/include/ 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/te...
Date Mon, 16 Jul 2007 19:32:52 GMT
Copied: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp (from r556643,
harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_timing.c)
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp?view=diff&rev=556704&p1=harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_timing.c&r1=556643&p2=harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp&r2=556704
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_timing.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp Mon Jul 16 12:32:35
2007
@@ -23,7 +23,8 @@
 #include <open/ti_thread.h>
 #include <open/hythread_ext.h>
 #include <open/jthread.h>
-#include "thread_private.h"
+#include <open/thread_externals.h>
+#include "vm_threads.h"
 #include "apr_thread_ext.h"
 
 #define THREAD_CPU_TIME_SUPPORTED 1
@@ -39,19 +40,18 @@
  * @param[in] java_thread
  * @param[out] nanos_ptr CPU time in nanoseconds
  */
-IDATA VMCALL jthread_get_thread_blocked_time(jthread java_thread, jlong *nanos_ptr) {
-
-    jvmti_thread_t tm_java_thread;
-    hythread_t tm_native_thread;
-
+IDATA VMCALL
+jthread_get_thread_blocked_time(jthread java_thread, jlong * nanos_ptr)
+{
     assert(java_thread);
     assert(nanos_ptr);
-    tm_native_thread = vm_jthread_get_tm_data(java_thread);
-    tm_java_thread = hythread_get_private_data(tm_native_thread);
-    *nanos_ptr = tm_java_thread->blocked_time;
-
+    hythread_t native_thread = vm_jthread_get_tm_data(java_thread);
+    assert(native_thread);
+    jvmti_thread_t jvmti_thread = jthread_get_jvmti_thread(native_thread);
+    assert(jvmti_thread);
+    *nanos_ptr = jvmti_thread->blocked_time;
     return TM_ERROR_NONE;
-}
+} // jthread_get_thread_blocked_time
 
 /**
  * Returns time utilized by given thread.
@@ -59,29 +59,28 @@
  * @param[in] java_thread
  * @param[out] nanos_ptr CPU time in nanoseconds
  */
-IDATA VMCALL jthread_get_thread_cpu_time(jthread java_thread, jlong *nanos_ptr) {
-
-    hythread_t tm_native_thread;
+IDATA VMCALL
+jthread_get_thread_cpu_time(jthread java_thread, jlong * nanos_ptr)
+{
     int64 kernel_time;
-    assert(nanos_ptr);
 
-    if (NULL == java_thread) {
-        tm_native_thread = hythread_self();
-    } else {
-        tm_native_thread = vm_jthread_get_tm_data(java_thread);
-    }
-
-    return hythread_get_thread_times(tm_native_thread, &kernel_time, nanos_ptr);
-}
+    assert(nanos_ptr);
+    hythread_t native_thread = java_thread
+        ? hythread_self() : vm_jthread_get_tm_data(java_thread);
+    assert(native_thread);
+    return hythread_get_thread_times(native_thread, &kernel_time,
+                                     nanos_ptr);
+} // jthread_get_thread_cpu_time
 
 /**
  * Returns information about the system timer.
  *
  * @param[out] info_ptr timer info
  */
-IDATA VMCALL jthread_get_thread_cpu_timer_info(jvmtiTimerInfo* info_ptr) {
+IDATA VMCALL jthread_get_thread_cpu_timer_info(jvmtiTimerInfo * info_ptr)
+{
     return TM_ERROR_NONE;
-}
+} // jthread_get_thread_cpu_timer_info
 
 /**
  * Returns time utilized by the given thread in user mode.
@@ -89,20 +88,22 @@
  * @param[in] java_thread 
  * @param[out] nanos_ptr CPU time in nanoseconds
  */
-IDATA VMCALL jthread_get_thread_user_cpu_time(jthread java_thread, jlong *nanos_ptr) {
+IDATA VMCALL
+jthread_get_thread_user_cpu_time(jthread java_thread, jlong * nanos_ptr)
+{
+    assert(nanos_ptr);
+    assert(java_thread);
+    hythread_t native_thread = vm_jthread_get_tm_data(java_thread);
+    assert(native_thread);
 
-    hythread_t tm_native_thread;
     int64 kernel_time;
     int64 user_time;
-
-    assert(java_thread);
-    assert(nanos_ptr);
-    tm_native_thread = vm_jthread_get_tm_data(java_thread);
-    hythread_get_thread_times(tm_native_thread, &kernel_time, &user_time);
+    IDATA status = hythread_get_thread_times(native_thread,
+                        &kernel_time, &user_time);
+    assert(status != TM_ERROR_NONE);
     *nanos_ptr = user_time;
-
     return TM_ERROR_NONE;
-}
+} // jthread_get_thread_user_cpu_time
 
 /**
  * Returns time spent by the specific thread while waiting for monitors.
@@ -110,19 +111,19 @@
  * @param[in] java_thread 
  * @param[out] nanos_ptr CPU time in nanoseconds
  */
-IDATA VMCALL jthread_get_thread_waited_time(jthread java_thread, jlong *nanos_ptr) {
-
-    jvmti_thread_t tm_java_thread;
-    hythread_t tm_native_thread;
-
+IDATA VMCALL
+jthread_get_thread_waited_time(jthread java_thread, jlong * nanos_ptr)
+{
     assert(java_thread);
     assert(nanos_ptr);
-    tm_native_thread = vm_jthread_get_tm_data(java_thread);
-    tm_java_thread = hythread_get_private_data(tm_native_thread);
-    *nanos_ptr = tm_java_thread->waited_time;
+    hythread_t native_thread = vm_jthread_get_tm_data(java_thread);
+    assert(native_thread);
+    jvmti_thread_t jvmti_thread = jthread_get_jvmti_thread(native_thread);
+    assert(jvmti_thread);
+    *nanos_ptr = jvmti_thread->waited_time;
 
     return TM_ERROR_NONE;
-}
+} // jthread_get_thread_waited_time
 
 /**
  * Returns number of times the specific thread contending for monitors.
@@ -130,13 +131,15 @@
  * @param[in] java_thread
  * @return number of times the specific thread contending for monitors
  */
-jlong VMCALL jthread_get_thread_blocked_times_count(jthread java_thread) {
-    
-    hythread_t tm_native_thread = jthread_get_native_thread(java_thread); 
-    jvmti_thread_t tm_java_thread = hythread_get_private_data(tm_native_thread);
-
-    return tm_java_thread->blocked_count;
-}
+jlong VMCALL jthread_get_thread_blocked_times_count(jthread java_thread)
+{
+    assert(java_thread);
+    hythread_t native_thread = jthread_get_native_thread(java_thread);
+    assert(native_thread);
+    jvmti_thread_t jvmti_thread = jthread_get_jvmti_thread(native_thread);
+    assert(jvmti_thread);
+    return jvmti_thread->blocked_count;
+} // jthread_get_thread_blocked_times_count
 
 /**
  * Returns number of times the specific thread waiting on monitors for notification.
@@ -144,31 +147,35 @@
  * @param[in] java_thread
  * @return number of times the specific thread waiting on monitors for notification
  */
-jlong VMCALL jthread_get_thread_waited_times_count(jthread java_thread) {
-    
-    hythread_t tm_native_thread = jthread_get_native_thread(java_thread); 
-    jvmti_thread_t tm_java_thread = hythread_get_private_data(tm_native_thread);
+jlong VMCALL jthread_get_thread_waited_times_count(jthread java_thread)
+{
 
-    return tm_java_thread->waited_count;
-}
+    hythread_t native_thread = jthread_get_native_thread(java_thread);
+    assert(native_thread);
+    jvmti_thread_t jvmti_thread = jthread_get_jvmti_thread(native_thread);
+    assert(jvmti_thread);
+    return jvmti_thread->waited_count;
+} // jthread_get_thread_waited_times_count
 
 /**
  * Returns true if VM supports current thread CPU and USER time requests
  *
  * @return true if current thread CPU and USER time requests are supported, false otherwise;
  */
-jboolean jthread_is_current_thread_cpu_time_supported(){
+jboolean jthread_is_current_thread_cpu_time_supported()
+{
     return THREAD_CPU_TIME_SUPPORTED;
-}
+} // jthread_is_current_thread_cpu_time_supported
 
 /**
  * Returns true if VM supports thread CPU and USER time requests
  *
  * @return true if thread CPU and USER time requests are supported, false otherwise;
  */
-jboolean jthread_is_thread_cpu_time_supported(){
+jboolean jthread_is_thread_cpu_time_supported()
+{
     return THREAD_CPU_TIME_SUPPORTED;
-}
+} // jthread_is_thread_cpu_time_supported
 
 /**
  * Returns true if VM supports (current) thread CPU and USER time requests and 
@@ -176,15 +183,17 @@
  *
  * @return true if thread CPU and USER time requests are enabled, false otherwise;
  */
-jboolean jthread_is_thread_cpu_time_enabled(){
+jboolean jthread_is_thread_cpu_time_enabled()
+{
     return thread_cpu_time_enabled;
-}
+} // jthread_is_thread_cpu_time_enabled
 
 /**
  * Enabled or diabled thread CPU and USER time requests
  *
  * @param[in] true or false to enable or disable the feature
  */
-void jthread_set_thread_cpu_time_enabled(jboolean flag){
-     thread_cpu_time_enabled = THREAD_CPU_TIME_SUPPORTED ? flag : 0;
-}
+void jthread_set_thread_cpu_time_enabled(jboolean flag)
+{
+    thread_cpu_time_enabled = THREAD_CPU_TIME_SUPPORTED ? flag : 0;
+} // jthread_set_thread_cpu_time_enabled

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?view=diff&rev=556704&r1=556703&r2=556704
==============================================================================
--- 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 Mon
Jul 16 12:32:35 2007
@@ -182,9 +182,12 @@
     return true;
 }
 
-void native_unwind_interrupted_frame(VM_thread* pthread, void** p_ip, void** p_bp, void**
p_sp)
+void native_unwind_interrupted_frame(jvmti_thread_t thread, void** p_ip, void** p_bp, void**
p_sp)
 {
-    Registers* pregs = &pthread->jvmti_saved_exception_registers;
+    if (!thread) {
+        return;
+    }
+    Registers* pregs = (Registers*)(thread->jvmti_saved_exception_registers);
     *p_ip = (void*)pregs->rip;
     *p_bp = (void*)pregs->rbp;
     *p_sp = (void*)pregs->rsp;

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?view=diff&rev=556704&r1=556703&r2=556704
==============================================================================
--- 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 Mon Jul
16 12:32:35 2007
@@ -183,9 +183,12 @@
     return true;
 }
 
-void native_unwind_interrupted_frame(VM_thread* pthread, void** p_ip, void** p_bp, void**
p_sp)
+void native_unwind_interrupted_frame(jvmti_thread_t thread, void** p_ip, void** p_bp, void**
p_sp)
 {
-    Registers* pregs = &pthread->jvmti_saved_exception_registers;
+    if (!thread) {
+        return;
+    }
+    Registers* pregs = (Registers*)(thread->jvmti_saved_exception_registers);
     *p_ip = (void*)pregs->eip;
     *p_bp = (void*)pregs->ebp;
     *p_sp = (void*)pregs->esp;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp?view=diff&rev=556704&r1=556703&r2=556704
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp Mon Jul 16 12:32:35
2007
@@ -254,7 +254,7 @@
         void *thread_pointer, uint64 tid) = (uint64 (__cdecl * )(void *entry_point, int nargs,
uint64 args[],
         double *double_result_addr, int double_nargs, double double_args[], 
         void *thread_pointer, uint64 tid))&fptr;
-    IDATA id = hythread_get_id(hythread_self());
+    IDATA id = hythread_get_self_id();
     uint64 int_result = (uint64)fpp_exec(entry_point, nargs, arg_words, &double_result,
         double_nargs, double_args, p_TLS_vmthread, id);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/native_stack_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/native_stack_ipf.cpp?view=diff&rev=556704&r1=556703&r2=556704
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/native_stack_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/native_stack_ipf.cpp Mon Jul
16 12:32:35 2007
@@ -61,7 +61,7 @@
     return false; // Not implemented
 }
 
-void native_unwind_interrupted_frame(VM_thread* pthread, void** p_ip, void** p_bp, void**
p_sp)
+void native_unwind_interrupted_frame(jvmti_thread_t thread, void** p_ip, void** p_bp, void**
p_sp)
 { // Not implemented yet
     *p_ip = NULL;
     *p_bp = NULL;

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?view=diff&rev=556704&r1=556703&r2=556704
==============================================================================
--- 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 Jul 16 12:32:35
2007
@@ -754,15 +754,16 @@
     // instrumented by breakpoint, the actual exception address will reside
     // in jvmti_jit_breakpoints_handling_buffer
     // We should replace exception address with saved address of instruction
-    uint32 break_buf = (uint32)p_TLS_vmthread->jvmti_jit_breakpoints_handling_buffer;
+    uint32 break_buf =
+        (uint32)p_TLS_vmthread->jvmti_thread.jvmti_jit_breakpoints_handling_buffer;
     if (saved_eip >= break_buf &&
-        saved_eip < break_buf + 50)
+        saved_eip < break_buf + TM_JVMTI_MAX_BUFFER_SIZE)
     {
         // Breakpoints should not occur in breakpoint buffer
         assert(signum != SIGTRAP);
 
         replaced = true;
-        new_eip = p_TLS_vmthread->jvmti_saved_exception_registers.eip;
+        new_eip = (uint32)vm_get_ip_from_regs(p_TLS_vmthread);
         uc->uc_mcontext.gregs[REG_EIP] = (greg_t)new_eip;
     }
 

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?view=diff&rev=556704&r1=556703&r2=556704
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/native_stack.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/native_stack.cpp Mon Jul 16 12:32:35 2007
@@ -265,7 +265,7 @@
 
                 if (native_is_ip_in_breakpoint_handler(tmp_ip))
                 {
-                    native_unwind_interrupted_frame(pthread, &ip, &bp, &sp);
+                    native_unwind_interrupted_frame(&pthread->jvmti_thread, &ip,
&bp, &sp);
                     flag_breakpoint = true;
                 }
                 else

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?view=diff&rev=556704&r1=556703&r2=556704
==============================================================================
--- 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 Jul 16 12:32:35 2007
@@ -217,7 +217,10 @@
 
 // exception catch support for JVMTI
 void __cdecl jvmti_exception_catch_callback_wrapper(){
-    Registers regs = p_TLS_vmthread->regs;
+	Registers regs = {0};
+	if (p_TLS_vmthread->regs) {
+		regs = *(Registers*)p_TLS_vmthread->regs;
+	}
     jvmti_exception_catch_callback(&regs);
 }
 
@@ -235,19 +238,19 @@
 
     bool in_java = false;
 
-    if (vmthread)
+    if (vmthread && (&vmthread->jvmti_thread))
     {
         // If exception is occured in processor instruction previously
         // instrumented by breakpoint, the actual exception address will reside
         // in jvmti_jit_breakpoints_handling_buffer
         // We should replace exception address with saved address of instruction
         POINTER_SIZE_INT break_buf =
-            (POINTER_SIZE_INT)vmthread->jvmti_jit_breakpoints_handling_buffer;
+            (POINTER_SIZE_INT)vmthread->jvmti_thread.jvmti_jit_breakpoints_handling_buffer;
         if (saved_eip >= break_buf &&
-            saved_eip < break_buf + 50)
+            saved_eip < break_buf + TM_JVMTI_MAX_BUFFER_SIZE)
         {
             flag_replaced = true;
-            regs.set_ip(vmthread->jvmti_saved_exception_registers.get_ip());
+            regs.set_ip(vm_get_ip_from_regs(vmthread));
             vm_to_nt_context(&regs, context);
         }
 
@@ -370,7 +373,7 @@
 
     // save register context of hardware exception site
     // into thread-local registers snapshot
-    vmthread->regs = regs;
+    vm_set_exception_registers(vmthread, regs);
 
     // __cdecl <=> push parameters in the reversed order
     // push in_java argument onto stack
@@ -396,7 +399,12 @@
     // this exception handler is executed *after* NT exception handler returned
     DebugUtilsTI* ti = VM_Global_State::loader_env->TI;
     // Create local copy for registers because registers in TLS can be changed
-    Registers regs = p_TLS_vmthread->regs;
+    Registers regs = {0};
+    VM_thread *thread = p_TLS_vmthread;
+    assert(thread);
+    if (thread->regs) {
+        regs = *(Registers*)thread->regs;
+    }
 
     M2nFrame* prev_m2n = m2n_get_last_frame();
     M2nFrame* m2n = NULL;
@@ -412,7 +420,7 @@
         regs_push_return_address(&regs, regs.get_ip());
         // Set IP to callback address
         regs.set_ip(asm_jvmti_exception_catch_callback);
-    } else if (p_TLS_vmthread->restore_guard_page) {
+    } else if (thread->restore_guard_page) {
         // Set return address to current IP
         regs_push_return_address(&regs, regs.get_ip());
         // Set IP to callback address
@@ -425,7 +433,7 @@
     if (m2n)
         STD_FREE(m2n);
 
-    p_TLS_vmthread->regs = regs;
+    vm_set_exception_registers(thread, regs);
     si_transfer_control(si);
     assert(!"si_transfer_control should not return");
 }



Mime
View raw message