< prev index next >

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

Print this page
*** 28,12 ***
  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.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;
--- 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.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 ***
              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);
  
--- 85,10 ---

*** 132,18 ***
          }
  
          return handle;
      }
  
!     public static UpcallHandler arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc) {
          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);
      }
  
      private static boolean isInMemoryReturn(Optional<MemoryLayout> returnLayout) {
          return returnLayout
                  .filter(GroupLayout.class::isInstance)
--- 131,18 ---
          }
  
          return handle;
      }
  
!     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, scope);
      }
  
      private static boolean isInMemoryReturn(Optional<MemoryLayout> returnLayout) {
          return returnLayout
                  .filter(GroupLayout.class::isInstance)

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