All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jnr.ffi.provider.jffi.LocalVariableAllocator Maven / Gradle / Ivy

There is a newer version: 2.2.16
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy