< prev index next >

src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/x64/sysv/CallArranger.java

Print this page
@@ -28,12 +28,13 @@
  import jdk.incubator.foreign.FunctionDescriptor;
  import jdk.incubator.foreign.GroupLayout;
  import jdk.incubator.foreign.MemoryAddress;
  import jdk.incubator.foreign.MemoryLayout;
  import jdk.incubator.foreign.MemorySegment;
+ import jdk.incubator.foreign.NativeSymbol;
+ import jdk.incubator.foreign.ResourceScope;
  import jdk.internal.foreign.abi.CallingSequenceBuilder;
- import jdk.internal.foreign.abi.UpcallHandler;
  import jdk.internal.foreign.abi.ABIDescriptor;
  import jdk.internal.foreign.abi.Binding;
  import jdk.internal.foreign.abi.CallingSequence;
  import jdk.internal.foreign.abi.ProgrammableInvoker;
  import jdk.internal.foreign.abi.ProgrammableUpcallHandler;

@@ -84,12 +85,10 @@
              this.nVectorArgs = nVectorArgs;
          }
      }
  
      public static Bindings getBindings(MethodType mt, FunctionDescriptor cDesc, boolean forUpcall) {
-         SharedUtils.checkFunctionTypes(mt, cDesc, SysVx64Linker.ADDRESS_SIZE);
- 
          CallingSequenceBuilder csb = new CallingSequenceBuilder(forUpcall);
  
          BindingCalculator argCalc = forUpcall ? new BoxBindingCalculator(true) : new UnboxBindingCalculator(true);
          BindingCalculator retCalc = forUpcall ? new UnboxBindingCalculator(false) : new BoxBindingCalculator(false);
  

@@ -132,18 +131,18 @@
          }
  
          return handle;
      }
  
-     public static UpcallHandler arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc) {
+     public static NativeSymbol arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, ResourceScope scope) {
          Bindings bindings = getBindings(mt, cDesc, true);
  
          if (bindings.isInMemoryReturn) {
              target = SharedUtils.adaptUpcallForIMR(target, true /* drop return, since we don't have bindings for it */);
          }
  
-         return ProgrammableUpcallHandler.make(CSysV, target, bindings.callingSequence);
+         return ProgrammableUpcallHandler.make(CSysV, target, bindings.callingSequence, scope);
      }
  
      private static boolean isInMemoryReturn(Optional<MemoryLayout> returnLayout) {
          return returnLayout
                  .filter(GroupLayout.class::isInstance)

@@ -278,11 +277,11 @@
                          offset += copy;
                      }
                      break;
                  }
                  case POINTER: {
-                     bindings.unboxAddress();
+                     bindings.unboxAddress(carrier);
                      VMStorage storage = storageCalculator.nextStorage(StorageClasses.INTEGER);
                      bindings.vmStore(storage, long.class);
                      break;
                  }
                  case INTEGER: {
< prev index next >