void mark(final CodeAttribute ca) { location = ca.mark(); for (BranchEnd br : branchEnds) { ca.branchEnd(br); } }
/** * Throws an exception when an invalid state is hit in a tableswitch */ private static void stateNotFound(final CodeAttribute c, final TableSwitchBuilder builder) { c.branchEnd(builder.getDefaultBranchEnd().get()); c.newInstruction(RuntimeException.class); c.dup(); c.ldc("Invalid character"); c.invokespecial(RuntimeException.class.getName(), "<init>", "(Ljava/lang/String;)V"); c.athrow(); }
c.invokevirtual(ByteBuffer.class.getName(), "get", "()B"); BranchEnd cont = c.gotoInstruction(); c.branchEnd(end); c.aload(PARSE_STATE_VAR); c.iconst(0); c.putfield(parseStateClass, "leftOver", "B"); c.branchEnd(cont); c.branchEnd(b); c.branchEnd(tokenEnd); c.branchEnd(e.getValue()); c.pop(); final State state = e.getKey(); c.branchEnd(parseDone);
c.branchEnd(nonZero); c.branchEnd(prefixMatch.get()); c.branchEnd(overrun); //overrun and not match use the same code path c.branchEnd(noMatch); //the current character did not match c.iconst(NO_STATE); c.istore(CURRENT_STATE_VAR); c.branchEnd(b); c.branchEnd(b); c.branchEnd(correctLength); c.branchEnd(noState.get()); c.branchEnd(prefixToNoState); CodeLocation noStateLoop = c.mark(); c.branchEnd(b); c.branchEnd(b); c.branchEnd(optimizationEnd); c.pop(); c.iconst(0); c.branchEnd(ends.get(initial).get()); invokeState(className, file, c, initial, initial, noStateLoop, prefixLoop, returnIncompleteCode, returnCompleteCode, stateMachine, expectNewline);
/** * Ends interception context if it was previously stated. This is indicated by a local variable with index 0. */ void endIfStarted(CodeAttribute b, ClassMethod method) { b.aload(getLocalVariableIndex(0)); b.dup(); final BranchEnd ifnotnull = b.ifnull(); b.checkcast(Stack.class); b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR); BranchEnd ifnull = b.gotoInstruction(); b.branchEnd(ifnotnull); b.pop(); // remove null Stack b.branchEnd(ifnull); }
/** * Ends interception context if it was previously stated. This is indicated by a local variable with index 0. */ void endIfStarted(CodeAttribute b, ClassMethod method) { b.aload(getLocalVariableIndex(0)); b.dup(); final BranchEnd ifnotnull = b.ifnull(); b.checkcast(Stack.class); b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR); BranchEnd ifnull = b.gotoInstruction(); b.branchEnd(ifnotnull); b.pop(); // remove null Stack b.branchEnd(ifnull); }
/** * Ends interception context if it was previously stated. This is indicated by a local variable with index 0. */ void endIfStarted(CodeAttribute b, ClassMethod method) { b.aload(getLocalVariableIndex(0)); b.dup(); final BranchEnd ifnotnull = b.ifnull(); b.checkcast(Stack.class); b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR); BranchEnd ifnull = b.gotoInstruction(); b.branchEnd(ifnotnull); b.pop(); // remove null Stack b.branchEnd(ifnull); }
/** * Ends interception context if it was previously stated. This is indicated by a local variable with index 0. */ void endIfStarted(CodeAttribute b, ClassMethod method) { b.aload(getLocalVariableIndex(0)); b.dup(); final BranchEnd ifnotnull = b.ifnull(); b.checkcast(Stack.class); b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR); BranchEnd ifnull = b.gotoInstruction(); b.branchEnd(ifnotnull); b.pop(); // remove null Stack b.branchEnd(ifnull); }
/** * Ends interception context if it was previously stated. This is indicated by a local variable with index 0. */ void endIfStarted(CodeAttribute b, ClassMethod method) { b.aload(getLocalVariableIndex(0)); b.dup(); final BranchEnd ifnotnull = b.ifnull(); b.checkcast(Stack.class); b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR); BranchEnd ifnull = b.gotoInstruction(); b.branchEnd(ifnotnull); b.pop(); // remove null Stack b.branchEnd(ifnull); }
/** * Ends interception context if it was previously stated. This is indicated by a local variable with index 0. */ void endIfStarted(CodeAttribute b, ClassMethod method) { b.aload(getLocalVariableIndex(0)); b.dup(); final BranchEnd ifnotnull = b.ifnull(); b.checkcast(Stack.class); b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR); BranchEnd ifnull = b.gotoInstruction(); b.branchEnd(ifnotnull); b.pop(); // remove null Stack b.branchEnd(ifnull); }
void startIfNotOnTop(CodeAttribute b, ClassMethod method) { b.aload(0); factory.getMethodHandlerField(method.getClassFile(), b); b.dup(); // if handler != null (may happen inside constructor calls) final BranchEnd handlerNull = b.ifnull(); b.invokestatic(INTERCEPTION_DECORATION_CONTEXT_CLASS_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_SIGNATURE); final BranchEnd endOfIfStatement = b.gotoInstruction(); b.branchEnd(handlerNull); // else started = false // keeping null handler on top of stack b.branchEnd(endOfIfStatement); storeToLocalVariable(0); }
void startIfNotOnTop(CodeAttribute b, ClassMethod method) { b.aload(0); factory.getMethodHandlerField(method.getClassFile(), b); b.dup(); // if handler != null (may happen inside constructor calls) final BranchEnd handlerNull = b.ifnull(); b.invokestatic(INTERCEPTION_DECORATION_CONTEXT_CLASS_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_SIGNATURE); final BranchEnd endOfIfStatement = b.gotoInstruction(); b.branchEnd(handlerNull); // else started = false // keeping null handler on top of stack b.branchEnd(endOfIfStatement); storeToLocalVariable(0); }
void startIfNotOnTop(CodeAttribute b, ClassMethod method) { b.aload(0); factory.getMethodHandlerField(method.getClassFile(), b); b.dup(); // if handler != null (may happen inside constructor calls) final BranchEnd handlerNull = b.ifnull(); b.invokestatic(INTERCEPTION_DECORATION_CONTEXT_CLASS_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_SIGNATURE); final BranchEnd endOfIfStatement = b.gotoInstruction(); b.branchEnd(handlerNull); // else started = false // keeping null handler on top of stack b.branchEnd(endOfIfStatement); storeToLocalVariable(0); }
void startIfNotOnTop(CodeAttribute b, ClassMethod method) { b.aload(0); factory.getMethodHandlerField(method.getClassFile(), b); b.dup(); // if handler != null (may happen inside constructor calls) final BranchEnd handlerNull = b.ifnull(); b.invokestatic(INTERCEPTION_DECORATION_CONTEXT_CLASS_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_SIGNATURE); final BranchEnd endOfIfStatement = b.gotoInstruction(); b.branchEnd(handlerNull); // else started = false // keeping null handler on top of stack b.branchEnd(endOfIfStatement); storeToLocalVariable(0); }
void startIfNotOnTop(CodeAttribute b, ClassMethod method) { b.aload(0); factory.getMethodHandlerField(method.getClassFile(), b); b.dup(); // if handler != null (may happen inside constructor calls) final BranchEnd handlerNull = b.ifnull(); b.invokestatic(INTERCEPTION_DECORATION_CONTEXT_CLASS_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_SIGNATURE); final BranchEnd endOfIfStatement = b.gotoInstruction(); b.branchEnd(handlerNull); // else started = false // keeping null handler on top of stack b.branchEnd(endOfIfStatement); storeToLocalVariable(0); }
void startIfNotOnTop(CodeAttribute b, ClassMethod method) { b.aload(0); factory.getMethodHandlerField(method.getClassFile(), b); b.dup(); // if handler != null (may happen inside constructor calls) final BranchEnd handlerNull = b.ifnull(); b.invokestatic(INTERCEPTION_DECORATION_CONTEXT_CLASS_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_NAME, START_INTERCEPTOR_CONTEXT_IF_NOT_ON_TOP_METHOD_SIGNATURE); final BranchEnd endOfIfStatement = b.gotoInstruction(); b.branchEnd(handlerNull); // else started = false // keeping null handler on top of stack b.branchEnd(endOfIfStatement); storeToLocalVariable(0); }
void withinCatchBlock(CodeAttribute b, ClassMethod method) { final ExceptionHandler start = b.exceptionBlockStart(Throwable.class.getName()); doWork(b, method); // end the interceptor context, everything was fine endIfStarted(b, method); // jump over the catch block BranchEnd gotoEnd = b.gotoInstruction(); // create catch block b.exceptionBlockEnd(start); b.exceptionHandlerStart(start); // end the interceptor context if there was an exception endIfStarted(b, method); b.athrow(); // update the correct address to jump over the catch block b.branchEnd(gotoEnd); doReturn(b, method); }
void withinCatchBlock(CodeAttribute b, ClassMethod method) { final ExceptionHandler start = b.exceptionBlockStart(Throwable.class.getName()); doWork(b, method); // end the interceptor context, everything was fine endIfStarted(b, method); // jump over the catch block BranchEnd gotoEnd = b.gotoInstruction(); // create catch block b.exceptionBlockEnd(start); b.exceptionHandlerStart(start); // end the interceptor context if there was an exception endIfStarted(b, method); b.athrow(); // update the correct address to jump over the catch block b.branchEnd(gotoEnd); doReturn(b, method); }
void withinCatchBlock(CodeAttribute b, ClassMethod method) { final ExceptionHandler start = b.exceptionBlockStart(Throwable.class.getName()); doWork(b, method); // end the interceptor context, everything was fine endIfStarted(b, method); // jump over the catch block BranchEnd gotoEnd = b.gotoInstruction(); // create catch block b.exceptionBlockEnd(start); b.exceptionHandlerStart(start); // end the interceptor context if there was an exception endIfStarted(b, method); b.athrow(); // update the correct address to jump over the catch block b.branchEnd(gotoEnd); doReturn(b, method); }