jvmci return array

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue Jan 18 19:18:53 UTC 2022


CCing to Doug, JVMCI expert.

Thanks,
Vladimir K

On 1/18/22 9:55 AM, Fotios Kounelis wrote:
> Hello,
> 
> I am trying to create a new native function inside jvmciRuntime.cpp. I want this function to return an integer array. 
> While I have found on JNI a similar example with jintArray and SetIntArrayRegion() function, in the jvmci, the API is 
> different.
> 
> I was able to return an integer and read it in the GraalVM compiler but I am struggling with an array. Would the program 
> for jvmci be similar to the JNI? If yes, which is the equivalent of SetIntArrayRegion() for this API, assuming I have 
> the code below?
> 
> jintArray result;
> JRT_BLOCK_ENTRY(jintArray , JVMCIRuntime::object_hash_get(JavaThread * thread, jint * ar1))
>    JRT_BLOCK;
>      jintArray result;
>      result = oopFactory::new_intArray(valueArraySize, CHECK_0);
>      int* valueArray; //this is the array that contains the data to fill result
>      // fill result with values in the thread
>      return result;
>      JRT_BLOCK_END;
> JRT_END
> 
> 
> Otherwise, could you give me an example of how to return an int array?
> 
> Best regards,
> 
> Fotis
> 


More information about the hotspot-dev mailing list