harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r449225 - in /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti: jvmti.cpp jvmti_locals.cpp jvmti_step.cpp
Date Sat, 23 Sep 2006 12:40:47 GMT
Author: geirm
Date: Sat Sep 23 05:40:46 2006
New Revision: 449225

URL: http://svn.apache.org/viewvc?view=rev&rev=449225
Log:
HARMONY-1534

This small patch fixed the following bugs in JVMTI

- It used to be interpreter the default mode when JVMTI is enabled because JIT functionality
was not implemented to a 
usable extent. When JVMTI was enabled on the command line interpreter was enabled automatically.
Later then it was 
required to create a special property for JIT, it was added just in the place where interpreter
property was set. But 
this isn't really correct since if -Dvm.use_interpreter property is specified explicitly on
the command line then 
JVMTI vm.jvmti_enabled property ins't set. The fix just removes check for interpreter property
because now we're 
trying to fully support JVMTI in both JIT and interpreter modes.

- Getting and setting local variables in JIT mode is fixed. The null reference case was not
handled correctly in the 
code. A reference which has a null object is not allowed in drlvm, it should be a null pointer
or a heap pointer 
which is contained inside of a reference. The ugly interface with JIT always requires a pointer,
so setting a null 
reference for it requires creating a local pointer pointing to a null :)

- When starting and stopping single step when all threads are suspended thread manager iterator
sometimes gives out 
threads with null vm_thread (VM TLS pointer). It appears that these threads are just started
ones. So there is no 
need for assertion that threads is not alive (in thread manager terms it is alive, just birthing).
So I've removed 
assertions and added comments.

Ubuntu 6, smoke and c-unit


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp?view=diff&rev=449225&r1=449224&r2=449225
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp Sat Sep 23 05:40:46
2006
@@ -272,28 +272,18 @@
 
 void DebugUtilsTI::setExecutionMode(Global_Env *p_env)
 {
-    const char *interp_property =
-        properties_get_string_property((PropertiesHandle)&p_env->properties, "vm.use_interpreter");
+    for (int i = 0; i < p_env->vm_arguments.nOptions; i++) {
+        char *option = p_env->vm_arguments.options[i].optionString;
 
-    if (NULL != interp_property)
-    {
-        TRACE2("jvmti", "Interpreter property is already set on command line to value " <<
-            interp_property);
-    }
-    else
-        for (int i = 0; i < p_env->vm_arguments.nOptions; i++) {
-            char *option = p_env->vm_arguments.options[i].optionString;
-
-            if (!strncmp(option, "-agentlib:", 10) ||
-                !strncmp(option, "-agentpath:", 11) ||
-                !strncmp(option, "-Xrun", 5))
-            {
-                TRACE2("jvmti", "Enabling EM JVMTI mode");
-                // add_pair_to_properties(p_env->properties, "vm.use_interpreter", "true");
-                add_pair_to_properties(p_env->properties, "vm.jvmti.enabled", "true");
-                break;
-            }
+        if (!strncmp(option, "-agentlib:", 10) ||
+            !strncmp(option, "-agentpath:", 11) ||
+            !strncmp(option, "-Xrun", 5))
+        {
+            TRACE2("jvmti", "Enabling EM JVMTI mode");
+            add_pair_to_properties(p_env->properties, "vm.jvmti.enabled", "true");
+            break;
         }
+    }
 }
 
 DebugUtilsTI::DebugUtilsTI() :

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp?view=diff&rev=449225&r1=449224&r2=449225
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_locals.cpp Sat Sep 23
05:40:46 2006
@@ -197,9 +197,14 @@
 
         if (result == EXE_ERROR_NONE)
         {
-            ObjectHandle oh = oh_allocate_local_handle();
-            oh->object = obj;
-            *value_ptr = oh;
+            if (NULL != obj)
+            {
+                ObjectHandle oh = oh_allocate_local_handle();
+                oh->object = obj;
+                *value_ptr = oh;
+            }
+            else
+                *value_ptr = NULL;
         }
         tmn_suspend_enable();
 
@@ -447,16 +452,17 @@
         GET_JIT_FRAME_CONTEXT;
 
         tmn_suspend_disable();
-        ObjectHandle oh;
+        OpenExeJpdaError result;
         if (NULL != value)
+            result = jit->set_local_var(method, jfc, slot,
+                VM_DATA_TYPE_MP, &value->object);
+        else
         {
-            ObjectHandle obj = value;
-            oh = oh_allocate_local_handle();
-            oh->object = obj->object;
+            ManagedObject *n = NULL;
+            result = jit->set_local_var(method, jfc, slot,
+                VM_DATA_TYPE_MP, &n);
         }
 
-        OpenExeJpdaError result = jit->set_local_var(method, jfc, slot,
-            VM_DATA_TYPE_MP, &oh);
         si_free(si);
         tmn_suspend_enable();
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp?view=diff&rev=449225&r1=449224&r2=449225
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp Sat Sep 23 05:40:46
2006
@@ -497,7 +497,9 @@
     {
         VM_thread *vm_thread = get_vm_thread(ht);
         if( !vm_thread ) {
-            assert(!hythread_is_alive(ht));
+            // Skip thread that isn't started yet. SingleStep state
+            // will be enabled for it in
+            // jvmti_send_thread_start_end_event
             continue;
         }
 
@@ -564,7 +566,8 @@
     {
         VM_thread *vm_thread = get_vm_thread(ht);
         if( !vm_thread ) {
-            assert(!hythread_is_alive(ht));
+            // Skip thread that isn't started yet. No need to disable
+            // SingleStep state for it
             continue;
         }
         jvmti_remove_single_step_breakpoints(this, vm_thread);



Mime
View raw message