harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li" <xiaofeng...@gmail.com>
Subject Re: problem about System.loadLibrary and object's address
Date Sun, 29 Apr 2007 03:06:43 GMT
Tingpeng, can you post your program if there is no legal issue? (e.g.,
open a JIRA issue and attach your code there).

For your second question, itis pretty the core part of JVM native
interface design. Yes, the handle is used to access Java object
indirectly. The idea is to support object movement during GC, then the
real new address of the same object can be stored to the handle. It's
not supposed to be used everywhere in the JVM, because that may break
the protocol of JNI, causing GC to fail to update the object new
address, e.g., if it is put into a register by your C compiler. You
can access it in two ways: either always use JNI interface, or
guarantee there is GC happening when you access it.


On 4/29/07, 吴廷鹏 <wutingpeng@gmail.com> wrote:
> Hi, all,
> when I use drlvm to execute my program, I found that when program has System.loadLibrary
call, there is always an error which reports "java.lang.outofmemoryerror <no stack trace
available>". The same program can run on Hotspot. Why this happens and how to solve it?
> Another question, I read the implementation code of Object.clone method in Object_generic.cpp.
> jobject object_clone(JNIEnv *jenv, jobject jobj)
> {
>     ObjectHandle h = (ObjectHandle) jobj;
>     //aquire the target address and assign it to variable named result
>     memcpy(result, h->object, size);
> }
> According to my comprehension, h->object is the address of java object. Is it ture?
Does this means I can use the same way to get the address of object in vmcore's other place
provided the necessary head file is included?
> Thanks,
> tingpeng

View raw message