// Path: src/main/java/ocelot/JVMType.java
// public enum JVMType {
//     Z, B, S, C, I, J, F, D, A
// }
// 
// Path: src/main/java/ocelot/JVMValue.java
// public static JVMValue entry(double d) {
//     return new JVMValue(JVMType.D, Double.doubleToLongBits(d));
// }


import static ocelot.JVMType.*;
import static ocelot.JVMValue.entry;
package ocelot;


/**
 *
 * @author ben
 */
public final class InterpLocalVars {

    private final JVMValue[] vars = new JVMValue[256];

    public InterpLocalVars() {
    }

    void iinc(byte offset, byte amount) {
        JVMValue localVar = vars[offset & 0xff];
        // Type check...
        if (localVar.type != I)
            throw new IllegalStateException("Wrong type " + localVar.type + " encountered at local var: " + (offset & 0xff) + " should be I");

        // FIXME Overflow...?
// Path: src/main/java/ocelot/JVMType.java
// public enum JVMType {
//     Z, B, S, C, I, J, F, D, A
// }
// 
// Path: src/main/java/ocelot/JVMValue.java
// public static JVMValue entry(double d) {
//     return new JVMValue(JVMType.D, Double.doubleToLongBits(d));
// }


// Path: src/main/java/ocelot/InterpLocalVars.java
import static ocelot.JVMType.*;
import static ocelot.JVMValue.entry;

package ocelot;


/**
 *
 * @author ben
 */
public final class InterpLocalVars {

    private final JVMValue[] vars = new JVMValue[256];

    public InterpLocalVars() {
    }

    void iinc(byte offset, byte amount) {
        JVMValue localVar = vars[offset & 0xff];
        // Type check...
        if (localVar.type != I)
            throw new IllegalStateException("Wrong type " + localVar.type + " encountered at local var: " + (offset & 0xff) + " should be I");

        // FIXME Overflow...?
        vars[offset & 0xff] = entry(amount + (int)localVar.value);