The Source for Java Technology Collaboration

Home » java.net Forums » Performance » General Performance Discussion

Thread: Whats going on at a JNI call?

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 2 - Last Post: Nov 28, 2008 3:15 PM by: linuxhippy Threads: [ Previous | Next ]
linuxhippy

Posts: 646
Whats going on at a JNI call?
Posted: Jul 18, 2008 5:14 AM
  Click to reply to this thread Reply

Hi there,

I did some benchmarking of JNI calls on x86 and I would be really interested whats going on when a native method is called.

On my C2D I see about 35cycles call-overhead ... I would be really curious what is goind on at a JNI call, which instructions are used and what they are actually doing.

Has anybody had a look at the instructions generated by hotspot?

Thank you in advance, lg Clemens

ikrylov

Posts: 1
Re: Whats going on at a JNI call?
Posted: Nov 27, 2008 12:34 AM   in response to: linuxhippy
  Click to reply to this thread Reply

Hi,

How did you measure this and what version of JDK did you use and what platform?

After all, 35 cycles per call is not that bad. I believe that the main overheads are arguments marshaling and checks on the rerun path (safepoint check).

Thanks,

Ivan

linuxhippy

Posts: 646
Re: Whats going on at a JNI call?
Posted: Nov 28, 2008 3:15 PM   in response to: ikrylov
  Click to reply to this thread Reply

It was with hotspot server, I figured it out by simply benchmarking it on a Core2Duo.
Well an additional argument adds about 1-2 cycles, I guess the safepoint-checking also costs about 2-3 cycles.

The native method only incremented an integer, so maybe 5-6 cycles.

I would be interested what else is going on ;)

- Clemens




 XML java.net RSS