Skip to main content

Whats going on at a JNI call?

2 replies [Last post]
linuxhippy
Offline
Joined: 2004-01-07
Points: 0

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

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ikrylov
Offline
Joined: 2007-10-25
Points: 0

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
Offline
Joined: 2004-01-07
Points: 0

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