void jumpTo(final CodeAttribute ca) { if (location == null) { branchEnds.add(ca.gotoInstruction()); } else { ca.gotoInstruction(location); } }
private void tokenDone(final CodeAttribute c, final CodeLocation returnCode, final CustomStateMachine stateMachine) { stateMachine.updateParseState(c); c.gotoInstruction(returnCode); }
c.aload(BYTE_BUFFER_VAR); c.invokevirtual(ByteBuffer.class.getName(), "get", "()B"); BranchEnd cont = c.gotoInstruction(); c.branchEnd(end); c.aload(PARSE_STATE_VAR); c.pop(); c.gotoInstruction(noStateStart); c.iconst(state.soFar.length()); c.istore(STATE_POS_VAR); c.gotoInstruction(prefixStart); } else {
sc.checkcast(HTTP_STRING_CLASS); sc.putstatic(file.getName(), state.httpStringFieldName, HTTP_STRING_DESCRIPTOR); BranchEnd done = sc.gotoInstruction(); sc.branchEnd(end); sc.pop();
c.gotoInstruction(prefixLoop); BranchEnd prefixToNoState = c.gotoInstruction();
/** * 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 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); }
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); }