package com.ninty.runtime;

import java.nio.ByteBuffer;

/**
 * Created by ninty on 2017/7/12.
 */
public class NiFrame {
    NiFrame prevFrame;

    LocalVars localVars;
    OperandStack operandStack;

    ByteBuffer bb;

    public NiFrame(int localVarsSize, int operandStackSize, byte[] codes) {
        localVars = new LocalVars(localVarsSize);
        operandStack = new OperandStack(operandStackSize);
        bb = ByteBuffer.wrap(codes);
    }

    public NiFrame getPrevFrame() {
        return prevFrame;
    }

    public LocalVars getLocalVars() {
        return localVars;
    }

    public OperandStack getOperandStack() {
        return operandStack;
    }

    public ByteBuffer getCode() {
        return bb;
    }

    @Override
    public String toString() {
        return "NiFrame{" +
                "localVars=" + localVars +
                ", operandStack=" + operandStack +
                '}';
    }
}

package com.ninty.runtime;

import com.ninty.runtime.heap.NiMethod;

import java.nio.ByteBuffer;

/**
 * Created by ninty on 2017/7/12.
 */
public class NiFrame {
    public NiFrame prevFrame;

    private NiMethod method;

    private LocalVars localVars;
    private OperandStack operandStack;

    private ByteBuffer bb;

    public NiFrame(NiMethod method) {
        localVars = new LocalVars(method.getMaxLocals());
        operandStack = new OperandStack(method.getMaxStack());
        bb = method.getCodes();
    }

    public NiFrame getPrevFrame() {
        return prevFrame;
    }

    public LocalVars getLocalVars() {
        return localVars;
    }

    public OperandStack getOperandStack() {
        return operandStack;
    }

    public ByteBuffer getCode() {
        return bb;
    }

    public NiMethod getMethod() {
        return method;
    }

    @Override
    public String toString() {
        return "NiFrame{" +
                "localVars=" + localVars +
                ", operandStack=" + operandStack +
                '}';
    }
}

add reference for method