jnr.ffi.provider.jffi.LocalVariableAllocator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jnr-ffi Show documentation
Show all versions of jnr-ffi Show documentation
A library for invoking native functions from java
package jnr.ffi.provider.jffi;
/**
*
*/
class LocalVariableAllocator {
private int nextIndex;
LocalVariableAllocator(SigType[] parameterTypes) {
this.nextIndex = AsmUtil.calculateLocalVariableSpace(parameterTypes) + 1;
}
LocalVariableAllocator(Class... parameterTypes) {
this.nextIndex = AsmUtil.calculateLocalVariableSpace(parameterTypes) + 1;
}
LocalVariableAllocator(int nextIndex) {
this.nextIndex = nextIndex;
}
LocalVariable allocate(Class type) {
LocalVariable var = new LocalVariable(type, nextIndex);
this.nextIndex += AsmUtil.calculateLocalVariableSpace(type);
return var;
}
int getSpaceUsed() {
return nextIndex;
}
}