jvmci return array

Fotios Kounelis foths.kounelhs at gmail.com
Tue Jan 18 22:31:47 UTC 2022


Hi Tom,

Thank you for your reply. My bad example was an attempt to use jni in 
the HotSpot internals. What I am trying to do is: a function returning 
an int[] array, filled with values of another existing array.

So, my function 1) needs to return void 2) have an oop obj initialized 
with new_intArray 3) fill the values using int_at_put(0...size-1, 
arrayWithValues[0...size-1]) and 4) use the set_vm_result() to return my 
array.

I am not sure what you meant by "proper unpacking logic by a stub 
caller" for the set_vm_result, as in the same file the common use is 
something like "thread->set_vm_resutl(obj)", initializing just the oop 
obj properly with a new_typeArray.

I would appreciate a quick example in case the above is not how it 
should work.

Thank you for your time!

I couldn't find (or maybe I didn't understand) the set*ArrayRegion 
initialization in the jni.cpp with the macros, that is why I didn't 
mention it above.

Best regards,

Fotis

On 18/01/2022 21:15, Tom Rodriguez wrote:
> proper unpacking logic by a stub caller


More information about the hotspot-dev mailing list