harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Shimansky <gshiman...@gmail.com>
Subject Re: [drlvm][threading] H3289 -- some JVMTI questions
Date Fri, 16 Mar 2007 13:00:21 GMT
Weldon Washburn wrote:
> All,
> I thought it would be good to discuss H3289 on dev list instead of buried
> inside of the JIRA.  Gregory mentioned in the JIRA that JVMTI needs to be
> able to grab the "Lock" instance in Thread.java, do some work, then release
> the instance of "Lock".  I think this would require native JVMTI code to
> upcall to java code that would do something like:
> 
> //java code
> void synchronized upcall (int command)  {
>    downcall_into_native_C_code_to_do some_JVMTI(command);
> }
> 
> The above is rather convoluted.  Maybe a simpler approach would be to use
> java.util.concurrent.locks.  The code would look something like:
> 
> //native code
> 
> upcall java code ---->>    java.util.concurrent.locks.Lock();
> 
> ----  normal JVMTI C code ----
> 
> upcall java code ---->>    java.util.concurrent.locks.Unlock();
> 
> Comments on the above?

JVMTI is the API which is called by a user agent and in most cases 
specification allows the agent to call any kind of functions in any 
conditions in the live phase of VM. The calls to agent are done on 
events [1] which this agent is subscribed to. We cannot guard all of 
such events by locking a thread lock, such code may very easily lead to 
deadlocks too.

[1] http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html#EventIndex

> On another topic, do we really have to use Thread.stop() in the
> implementation of vm_shutdown_stop_java_threads() ?  This seems way
> too hard.   All we really want to do is give back all the OS resources.  We
> could simply call OS kill on each specific thread, return all memory via
> "free()", return all file handles, etc.  Note if there was no need to allow
> multiple JVMs in a single address space to come and go, we could simplify
> the above and basically just call process exit().

-- 
Gregory


Mime
View raw message