/** * Creates a new instance of <tt>Function</tt> with default calling convention. * * @param address The native address of the function to invoke. */ public Function(long address, CallContext callContext) { this.functionAddress = address; this.callContext = callContext; this.contextAddress = callContext.getAddress(); }
/** * Creates a new instance of <tt>Function</tt> with default calling convention. * * @param address The native address of the function to invoke. */ public Function(long address, CallContext callContext) { this.functionAddress = address; this.callContext = callContext; this.contextAddress = callContext.getAddress(); }
/** * Creates a new instance of <tt>Function</tt> with default calling convention. * * @param address The native address of the function to invoke. */ public Function(long address, CallContext callContext) { this.functionAddress = address; this.callContext = callContext; this.contextAddress = callContext.getAddress(); }
/** * Creates a new instance of <tt>Function</tt>. * * @param address The native address of the function to invoke. * @param returnType The return type of the native function. * @param paramTypes The parameter types the function accepts. * @param convention The calling convention of the function. * @param saveErrno Whether the errno should be saved or not */ public Function(long address, Type returnType, Type[] paramTypes, CallingConvention convention, boolean saveErrno) { this.functionAddress = address; this.callContext = CallContext.getCallContext(returnType, paramTypes, convention, saveErrno); this.contextAddress = callContext.getAddress(); }
/** * Creates a new instance of <tt>Function</tt>. * * @param address The native address of the function to invoke. * @param returnType The return type of the native function. * @param paramTypes The parameter types the function accepts. * @param convention The calling convention of the function. * @param saveErrno Whether the errno should be saved or not */ public Function(long address, Type returnType, Type[] paramTypes, CallingConvention convention, boolean saveErrno) { this.functionAddress = address; this.callContext = CallContext.getCallContext(returnType, paramTypes, convention, saveErrno); this.contextAddress = callContext.getAddress(); }
/** * Creates a new instance of <tt>Function</tt>. * * @param address The native address of the function to invoke. * @param returnType The return type of the native function. * @param paramTypes The parameter types the function accepts. * @param convention The calling convention of the function. * @param saveErrno Whether the errno should be saved or not */ public Function(long address, Type returnType, Type[] paramTypes, CallingConvention convention, boolean saveErrno) { this.functionAddress = address; this.callContext = CallContext.getCallContext(returnType, paramTypes, convention, saveErrno); this.contextAddress = callContext.getAddress(); }
public ClosureMagazine newClosureMagazine(CallContext callContext, Method method) { Foreign foreign = Foreign.getInstance(); Class[] methodParameterTypes = method.getParameterTypes(); boolean callWithPrimitiveArgs = methodParameterTypes.length < 1 || !Closure.Buffer.class.isAssignableFrom(method.getParameterTypes()[0]); long magazine = foreign.newClosureMagazine(callContext.getAddress(), method, callWithPrimitiveArgs); if (magazine == 0L) { throw new RuntimeException("could not allocate new closure magazine"); } return new ClosureMagazine(foreign, callContext, magazine); } }
public ClosureMagazine newClosureMagazine(CallContext callContext, Method method) { Foreign foreign = Foreign.getInstance(); Class[] methodParameterTypes = method.getParameterTypes(); boolean callWithPrimitiveArgs = methodParameterTypes.length < 1 || !Closure.Buffer.class.isAssignableFrom(method.getParameterTypes()[0]); long magazine = foreign.newClosureMagazine(callContext.getAddress(), method, callWithPrimitiveArgs); if (magazine == 0L) { throw new RuntimeException("could not allocate new closure magazine"); } return new ClosureMagazine(foreign, callContext, magazine); } }
public ClosureMagazine newClosureMagazine(CallContext callContext, Method method) { Foreign foreign = Foreign.getInstance(); Class[] methodParameterTypes = method.getParameterTypes(); boolean callWithPrimitiveArgs = methodParameterTypes.length < 1 || !Closure.Buffer.class.isAssignableFrom(method.getParameterTypes()[0]); long magazine = foreign.newClosureMagazine(callContext.getAddress(), method, callWithPrimitiveArgs); if (magazine == 0L) { throw new RuntimeException("could not allocate new closure magazine"); } return new ClosureMagazine(foreign, callContext, magazine); } }
public final long invokeN1O1(CallContext ctx, long fn, long n1, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return foreign.invokeN1O1(ctx.getAddress(), fn, n1, o1, o1flags.asObjectInfo(), o1off, o1len); }
public final long invokeN1O1(CallContext ctx, long fn, long n1, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return foreign.invokeN1O1(ctx.getAddress(), fn, n1, o1, o1flags.asObjectInfo(), o1off, o1len); }
public final long invokeN1O1(CallContext ctx, long fn, long n1, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return foreign.invokeN1O1(ctx.getAddress(), fn, n1, o1, o1flags.asObjectInfo(), o1off, o1len); }
Magazine(CallContext ctx) { this.ctx = ctx; this.magazine = foreign.newClosureMagazine(ctx.getAddress(), Proxy.METHOD, false); ArrayList<Slot> slots = new ArrayList<Slot>(); for (;;) { long h; Proxy proxy = new Proxy(ctx); if ((h = foreign.closureMagazineGet(magazine, proxy)) == 0) { break; } Slot s = new Slot(h, proxy); slots.add(s); } this.slots = new Slot[slots.size()]; slots.toArray(this.slots); next = 0; freeCount = this.slots.length; }
Magazine(CallContext ctx) { this.ctx = ctx; this.magazine = foreign.newClosureMagazine(ctx.getAddress(), Proxy.METHOD, false); ArrayList<Slot> slots = new ArrayList<Slot>(); for (;;) { long h; Proxy proxy = new Proxy(ctx); if ((h = foreign.closureMagazineGet(magazine, proxy)) == 0) { break; } Slot s = new Slot(h, proxy); slots.add(s); } this.slots = new Slot[slots.size()]; slots.toArray(this.slots); next = 0; freeCount = this.slots.length; }
/** * Invokes a function with two numeric arguments, and returns a numeric value. * * @param function The <tt>Function</tt> to invoke. * @param n1 first numeric argument. * @param n2 The second numeric argument. * @param o1 array or buffer, to be passed as a pointer for the first numeric parameter. * @param o1off offset from the start of the array or buffer. * @param o1len length of the array to use. * @param o1flags object flags (type, direction, parameter index). */ public final long invokeN2O1(CallContext ctx, long function, long n1, long n2, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return foreign.invokeN2O1(ctx.getAddress(), function, n1, n2, o1, o1flags.asObjectInfo(), o1off, o1len); }
Magazine(CallContext ctx) { this.ctx = ctx; this.magazine = foreign.newClosureMagazine(ctx.getAddress(), Proxy.METHOD, false); ArrayList<Slot> slots = new ArrayList<Slot>(); for (;;) { long h; Proxy proxy = new Proxy(ctx); if ((h = foreign.closureMagazineGet(magazine, proxy)) == 0) { break; } Slot s = new Slot(h, proxy); slots.add(s); } this.slots = new Slot[slots.size()]; slots.toArray(this.slots); next = 0; freeCount = this.slots.length; }
/** * Invokes a function with two numeric arguments, and returns a numeric value. * * @param function The <tt>Function</tt> to invoke. * @param n1 first numeric argument. * @param n2 The second numeric argument. * @param o1 array or buffer, to be passed as a pointer for the first numeric parameter. * @param o1off offset from the start of the array or buffer. * @param o1len length of the array to use. * @param o1flags object flags (type, direction, parameter index). */ public final long invokeN2O1(CallContext ctx, long function, long n1, long n2, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return foreign.invokeN2O1(ctx.getAddress(), function, n1, n2, o1, o1flags.asObjectInfo(), o1off, o1len); }
/** * Invokes a function with two numeric arguments, and returns a numeric value. * * @param function The <tt>Function</tt> to invoke. * @param n1 first numeric argument. * @param n2 The second numeric argument. * @param o1 array or buffer, to be passed as a pointer for the first numeric parameter. * @param o1off offset from the start of the array or buffer. * @param o1len length of the array to use. * @param o1flags object flags (type, direction, parameter index). */ public final long invokeN2O1(CallContext ctx, long function, long n1, long n2, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return foreign.invokeN2O1(ctx.getAddress(), function, n1, n2, o1, o1flags.asObjectInfo(), o1off, o1len); }
Method method = Foreign.class.getDeclaredMethod(methodName, params); JSR292 jsr292 = JSR292.INSTANCE; Object methodHandle = jsr292.insertArguments(jsr292.unreflect(method), 0, callContext.getAddress(), function);
Method method = Foreign.class.getDeclaredMethod(methodName, params); JSR292 jsr292 = JSR292.INSTANCE; Object methodHandle = jsr292.insertArguments(jsr292.unreflect(method), 0, callContext.getAddress(), function);