the connection between JVM buffer and java heap?
Peter Helfer
peter.helfer.java at gmail.com
Sat Jan 12 01:43:04 PST 2008
Hi Jackie
I guess you need to clarify which buffer you mean - from your words, it
looks like you mean the java.io.* / java.nio.* subsystem.
I assume you have access to the source code, check
openjdk/j2se/src/share/classes/java/(n)io/*.java and their respective native
methods in openjdk/j2se/src/share/native/java/(n)io/*.c.
Now afai can tell, every call from Java into C (~= native function), even
from the Hotspot itself has to be handled, and the objects need to be
unmarshalled, so the native code can work on them safely. The generator for
a native method is at openjdk/hotspot/src/share/vm/runtime/sharedRuntime.cpp
in function AdapterHandlerLibrary::create_native_wrapper(...) and in your
architecture-dependent file
openjdk/hotspot/src/cpu/<arch>/vm/sharedRuntime_<arch>.cpp in function
SharedRuntime::generate_native_wrapper(...)
Now for type T_OBJECT and T_ARRAY, a function is called object_move(....),
now on inspection, I don't see any copying of a buffer, it is only a
reworking of the reference to the data. So my conclusion would be that the
buffer remains the same. However, I'm not a JVM professional, so you might
have to wait till Monday 9am PST, before anyone is having a look into your
question.
hth, Peter
2008/1/12, zhang Jackie <jackieict at gmail.com>:
>
> hi
> are these two the same,or different? When sending data from Java , the
> data is copied from java heap to JVM buffer and then give it to OS . is this
> right?
>
> Thanks
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20080112/115ed719/attachment.html
More information about the hotspot-runtime-dev
mailing list