[foreign-abi] RFR: 8247937: Specialize downcall binding recipes using MethodHandle combinators [v2]

Jorn Vernee jvernee at openjdk.java.net
Tue Jun 23 11:35:02 UTC 2020


On Mon, 22 Jun 2020 11:46:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev
>> excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since
>> the last revision:
>>  - - Replace Binding interpreter, verification, and specialization switches with virtual calls to method on Binding.
>>    - Expand CallOverhead benchmark
>>  - Fix whitespace errors
>>  - Implement binding recipe specialization with MethodHandles
>
> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java line 99:
> 
>> 98:                     methodType(MemorySegment.class, MemorySegment.class, long.class, long.class,
>> NativeAllocationScope.class)); 99:             MH_MAKE_ALLOCATOR = lookup.findStatic(NativeAllocationScope.class,
>> "boundedScope", 100:                     methodType(NativeAllocationScope.class, long.class));
> 
> This class has references to `NativeAllocationScope` which has been renamed to `NativeScope`

Thanks, fixed.

> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java line 186:
> 
>> 185:
>> 186:     private MethodHandle specialize(MethodHandle intrinsicHandle) {
>> 187:         MethodType type = callingSequence.methodType();
> 
> I think some renaming of variables would be helpful here - e.g. the parameter is a movesHandle, or a leafHandle - then
> we can use some other name, like specializedHandle for the thing we're building - intrinsics is a bit vague and is used
> to refer to two very different handles.

Good suggestion, I renamed them leafHandle and specializedHandle

> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java line 388:
> 
>> 387:                                 Map<VMStorage, Integer> retIndexMap) throws Throwable {
>> 388:         List<MemorySegment> tempBuffers = new ArrayList<>();
>> 389:         try {
> 
> Should this also be expressed in terms of NativeScope?

Done.

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/212


More information about the panama-dev mailing list