[External] : Re: jvmci return array
Fotios Kounelis
foths.kounelhs at gmail.com
Wed Jan 19 12:57:11 UTC 2022
Hello,
Please find the pull request in the following link:
https://github.com/fotiskoun/jdk11u-dev/pulls
As you can see in the commit tab, this pull request contains only the
hash_get function, as the rest of my logic is already in the master tab.
To quickly describe what my general changes in jvmciRuntime.cpp do: I
want to create two native functions, a hash_put and a hash_get. The
arguments of hash_put() are 2 int[] arrays and their sizes and the
behavior is to add these arrays in a local hash map. Respectively, the
hash_get() has an int[] array as argument and by searching the map,
using the argument as key, returns an array from the map.
You could also have a look at hash_put for more and let me know if there
is something wrong about it, too.
Best regards,
Fotis
On 18/01/2022 22:40, Douglas Simon wrote:
> I think we’re going to be able to better help if you put up a PR on GitHub (preferably a PR on your personal fork of https://github.com/openjdk/jdk). That way, there’s no need to guess at missing details of your problem.
>
> -Doug
>
>> On 19 Jan 2022, at 08:31, Fotios Kounelis <foths.kounelhs at gmail.com> wrote:
>>
>> 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