/** * Makes and returns a mutable copy of this instance. The copy * contains copies of the locals and stack (that is, it doesn't * share them with the original). * * @return {@code non-null;} the copy */ public Frame copy() { return new Frame(locals.copy(), stack.copy(), subroutines); }
/** * Makes and returns a mutable copy of this instance. The copy * contains copies of the locals and stack (that is, it doesn't * share them with the original). * * @return {@code non-null;} the copy */ public Frame copy() { return new Frame(locals.copy(), stack.copy(), subroutines); }
/** * Makes and returns a mutable copy of this instance. The copy * contains copies of the locals and stack (that is, it doesn't * share them with the original). * * @return {@code non-null;} the copy */ public Frame copy() { return new Frame(locals.copy(), stack.copy(), subroutines); }
/** * Makes and returns a mutable copy of this instance. The copy * contains copies of the locals and stack (that is, it doesn't * share them with the original). * * @return {@code non-null;} the copy */ public Frame copy() { return new Frame(locals.copy(), stack.copy(), subroutines); }
/** * Makes and returns a mutable copy of this instance. The copy * contains copies of the locals and stack (that is, it doesn't * share them with the original). * * @return {@code non-null;} the copy */ public Frame copy() { return new Frame(locals.copy(), stack.copy(), subroutines); }
/** * Makes and returns a mutable copy of this instance. The copy * contains copies of the locals and stack (that is, it doesn't * share them with the original). * * @return {@code non-null;} the copy */ public Frame copy() { return new Frame(locals.copy(), stack.copy(), subroutines); }
/** * Makes a new frame for an exception handler block invoked from this * frame. * * @param exceptionClass exception that the handler block will handle * @return new frame */ public Frame makeExceptionHandlerStartFrame(CstType exceptionClass) { ExecutionStack newStack = getStack().copy(); newStack.clear(); newStack.push(exceptionClass); return new Frame(getLocals(), newStack, subroutines); }
/** * Makes a new frame for an exception handler block invoked from this * frame. * * @param exceptionClass exception that the handler block will handle * @return new frame */ public Frame makeExceptionHandlerStartFrame(CstType exceptionClass) { ExecutionStack newStack = getStack().copy(); newStack.clear(); newStack.push(exceptionClass); return new Frame(getLocals(), newStack, subroutines); }
/** * Makes a new frame for an exception handler block invoked from this * frame. * * @param exceptionClass exception that the handler block will handle * @return new frame */ public Frame makeExceptionHandlerStartFrame(CstType exceptionClass) { ExecutionStack newStack = getStack().copy(); newStack.clear(); newStack.push(exceptionClass); return new Frame(getLocals(), newStack, subroutines); }
/** * Makes a new frame for an exception handler block invoked from this * frame. * * @param exceptionClass exception that the handler block will handle * @return new frame */ public Frame makeExceptionHandlerStartFrame(CstType exceptionClass) { ExecutionStack newStack = getStack().copy(); newStack.clear(); newStack.push(exceptionClass); return new Frame(getLocals(), newStack, subroutines); }
/** * Makes a new frame for an exception handler block invoked from this * frame. * * @param exceptionClass exception that the handler block will handle * @return new frame */ public Frame makeExceptionHandlerStartFrame(CstType exceptionClass) { ExecutionStack newStack = getStack().copy(); newStack.clear(); newStack.push(exceptionClass); return new Frame(getLocals(), newStack, subroutines); }
/** * Makes a new frame for an exception handler block invoked from this * frame. * * @param exceptionClass exception that the handler block will handle * @return new frame */ public Frame makeExceptionHandlerStartFrame(CstType exceptionClass) { ExecutionStack newStack = getStack().copy(); newStack.clear(); newStack.push(exceptionClass); return new Frame(getLocals(), newStack, subroutines); }
/** * Makes a frame for a subroutine start block, given that this is the * ending frame of one of the subroutine's calling blocks. Subroutine * calls may be nested and thus may have nested locals state, so we * start with an initial state as seen by the subroutine, but keep track * of the individual locals states that will be expected when the individual * subroutine calls return. * * @param subLabel label of subroutine start block * @param callerLabel {@code >=0;} label of the caller block where this frame * came from. * @return a new instance to begin a called subroutine. */ public Frame makeNewSubroutineStartFrame(int subLabel, int callerLabel) { IntList newSubroutines = subroutines.mutableCopy(); newSubroutines.add(subLabel); Frame newFrame = new Frame(locals.getPrimary(), stack, IntList.makeImmutable(subLabel)); return newFrame.mergeWithSubroutineCaller(this, subLabel, callerLabel); }
/** * Makes a frame for a subroutine start block, given that this is the * ending frame of one of the subroutine's calling blocks. Subroutine * calls may be nested and thus may have nested locals state, so we * start with an initial state as seen by the subroutine, but keep track * of the individual locals states that will be expected when the individual * subroutine calls return. * * @param subLabel label of subroutine start block * @param callerLabel {@code >=0;} label of the caller block where this frame * came from. * @return a new instance to begin a called subroutine. */ public Frame makeNewSubroutineStartFrame(int subLabel, int callerLabel) { IntList newSubroutines = subroutines.mutableCopy(); newSubroutines.add(subLabel); Frame newFrame = new Frame(locals.getPrimary(), stack, IntList.makeImmutable(subLabel)); return newFrame.mergeWithSubroutineCaller(this, subLabel, callerLabel); }
/** * Makes a frame for a subroutine start block, given that this is the * ending frame of one of the subroutine's calling blocks. Subroutine * calls may be nested and thus may have nested locals state, so we * start with an initial state as seen by the subroutine, but keep track * of the individual locals states that will be expected when the individual * subroutine calls return. * * @param subLabel label of subroutine start block * @param callerLabel {@code >=0;} label of the caller block where this frame * came from. * @return a new instance to begin a called subroutine. */ public Frame makeNewSubroutineStartFrame(int subLabel, int callerLabel) { IntList newSubroutines = subroutines.mutableCopy(); newSubroutines.add(subLabel); Frame newFrame = new Frame(locals.getPrimary(), stack, IntList.makeImmutable(subLabel)); return newFrame.mergeWithSubroutineCaller(this, subLabel, callerLabel); }
/** * Makes a frame for a subroutine start block, given that this is the * ending frame of one of the subroutine's calling blocks. Subroutine * calls may be nested and thus may have nested locals state, so we * start with an initial state as seen by the subroutine, but keep track * of the individual locals states that will be expected when the individual * subroutine calls return. * * @param subLabel label of subroutine start block * @param callerLabel {@code >=0;} label of the caller block where this frame * came from. * @return a new instance to begin a called subroutine. */ public Frame makeNewSubroutineStartFrame(int subLabel, int callerLabel) { IntList newSubroutines = subroutines.mutableCopy(); newSubroutines.add(subLabel); Frame newFrame = new Frame(locals.getPrimary(), stack, IntList.makeImmutable(subLabel)); return newFrame.mergeWithSubroutineCaller(this, subLabel, callerLabel); }
/** * Makes a frame for a subroutine start block, given that this is the * ending frame of one of the subroutine's calling blocks. Subroutine * calls may be nested and thus may have nested locals state, so we * start with an initial state as seen by the subroutine, but keep track * of the individual locals states that will be expected when the individual * subroutine calls return. * * @param subLabel label of subroutine start block * @param callerLabel {@code >=0;} label of the caller block where this frame * came from. * @return a new instance to begin a called subroutine. */ public Frame makeNewSubroutineStartFrame(int subLabel, int callerLabel) { IntList newSubroutines = subroutines.mutableCopy(); newSubroutines.add(subLabel); Frame newFrame = new Frame(locals.getPrimary(), stack, IntList.makeImmutable(subLabel)); return newFrame.mergeWithSubroutineCaller(this, subLabel, callerLabel); }
/** * Makes a frame for a subroutine start block, given that this is the * ending frame of one of the subroutine's calling blocks. Subroutine * calls may be nested and thus may have nested locals state, so we * start with an initial state as seen by the subroutine, but keep track * of the individual locals states that will be expected when the individual * subroutine calls return. * * @param subLabel label of subroutine start block * @param callerLabel {@code >=0;} label of the caller block where this frame * came from. * @return a new instance to begin a called subroutine. */ public Frame makeNewSubroutineStartFrame(int subLabel, int callerLabel) { IntList newSubroutines = subroutines.mutableCopy(); newSubroutines.add(subLabel); Frame newFrame = new Frame(locals.getPrimary(), stack, IntList.makeImmutable(subLabel)); return newFrame.mergeWithSubroutineCaller(this, subLabel, callerLabel); }
/** * Merges two frames. If the merged result is the same as this frame, * then this instance is returned. * * @param other {@code non-null;} another frame * @return {@code non-null;} the result of merging the two frames */ public Frame mergeWith(Frame other) { LocalsArray resultLocals; ExecutionStack resultStack; IntList resultSubroutines; resultLocals = getLocals().merge(other.getLocals()); resultStack = getStack().merge(other.getStack()); resultSubroutines = mergeSubroutineLists(other.subroutines); resultLocals = adjustLocalsForSubroutines( resultLocals, resultSubroutines); if ((resultLocals == getLocals()) && (resultStack == getStack()) && subroutines == resultSubroutines) { return this; } return new Frame(resultLocals, resultStack, resultSubroutines); }
/** * Merges two frames. If the merged result is the same as this frame, * then this instance is returned. * * @param other {@code non-null;} another frame * @return {@code non-null;} the result of merging the two frames */ public Frame mergeWith(Frame other) { LocalsArray resultLocals; ExecutionStack resultStack; IntList resultSubroutines; resultLocals = getLocals().merge(other.getLocals()); resultStack = getStack().merge(other.getStack()); resultSubroutines = mergeSubroutineLists(other.subroutines); resultLocals = adjustLocalsForSubroutines( resultLocals, resultSubroutines); if ((resultLocals == getLocals()) && (resultStack == getStack()) && subroutines == resultSubroutines) { return this; } return new Frame(resultLocals, resultStack, resultSubroutines); }