< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/AdviceAdapter.java

Print this page




 372             final String name, final String desc) {
 373         mv.visitFieldInsn(opcode, owner, name, desc);
 374         if (constructor) {
 375             char c = desc.charAt(0);
 376             boolean longOrDouble = c == 'J' || c == 'D';
 377             switch (opcode) {
 378             case GETSTATIC:
 379                 pushValue(OTHER);
 380                 if (longOrDouble) {
 381                     pushValue(OTHER);
 382                 }
 383                 break;
 384             case PUTSTATIC:
 385                 popValue();
 386                 if (longOrDouble) {
 387                     popValue();
 388                 }
 389                 break;
 390             case PUTFIELD:
 391                 popValue();

 392                 if (longOrDouble) {
 393                     popValue();
 394                     popValue();
 395                 }
 396                 break;
 397             // case GETFIELD:
 398             default:
 399                 if (longOrDouble) {
 400                     pushValue(OTHER);
 401                 }
 402             }
 403         }
 404     }
 405 
 406     @Override
 407     public void visitIntInsn(final int opcode, final int operand) {
 408         mv.visitIntInsn(opcode, operand);
 409         if (constructor && opcode != NEWARRAY) {
 410             pushValue(OTHER);
 411         }
 412     }
 413 
 414     @Override


 602     private void addBranch(final Label label) {
 603         if (branches.containsKey(label)) {
 604             return;
 605         }
 606         branches.put(label, new ArrayList<Object>(stackFrame));
 607     }
 608 
 609     private Object popValue() {
 610         return stackFrame.remove(stackFrame.size() - 1);
 611     }
 612 
 613     private Object peekValue() {
 614         return stackFrame.get(stackFrame.size() - 1);
 615     }
 616 
 617     private void pushValue(final Object o) {
 618         stackFrame.add(o);
 619     }
 620 
 621     /**
 622      * Called at the beginning of the method or after super class class call in
 623      * the constructor. <br>
 624      * <br>
 625      *
 626      * <i>Custom code can use or change all the local variables, but should not
 627      * change state of the stack.</i>
 628      */
 629     protected void onMethodEnter() {
 630     }
 631 
 632     /**
 633      * Called before explicit exit from the method using either return or throw.
 634      * Top element on the stack contains the return value or exception instance.
 635      * For example:
 636      *
 637      * <pre>
 638      *   public void onMethodExit(int opcode) {
 639      *     if(opcode==RETURN) {
 640      *         visitInsn(ACONST_NULL);
 641      *     } else if(opcode==ARETURN || opcode==ATHROW) {
 642      *         dup();




 372             final String name, final String desc) {
 373         mv.visitFieldInsn(opcode, owner, name, desc);
 374         if (constructor) {
 375             char c = desc.charAt(0);
 376             boolean longOrDouble = c == 'J' || c == 'D';
 377             switch (opcode) {
 378             case GETSTATIC:
 379                 pushValue(OTHER);
 380                 if (longOrDouble) {
 381                     pushValue(OTHER);
 382                 }
 383                 break;
 384             case PUTSTATIC:
 385                 popValue();
 386                 if (longOrDouble) {
 387                     popValue();
 388                 }
 389                 break;
 390             case PUTFIELD:
 391                 popValue();
 392                 popValue();
 393                 if (longOrDouble) {
 394                     popValue();

 395                 }
 396                 break;
 397             // case GETFIELD:
 398             default:
 399                 if (longOrDouble) {
 400                     pushValue(OTHER);
 401                 }
 402             }
 403         }
 404     }
 405 
 406     @Override
 407     public void visitIntInsn(final int opcode, final int operand) {
 408         mv.visitIntInsn(opcode, operand);
 409         if (constructor && opcode != NEWARRAY) {
 410             pushValue(OTHER);
 411         }
 412     }
 413 
 414     @Override


 602     private void addBranch(final Label label) {
 603         if (branches.containsKey(label)) {
 604             return;
 605         }
 606         branches.put(label, new ArrayList<Object>(stackFrame));
 607     }
 608 
 609     private Object popValue() {
 610         return stackFrame.remove(stackFrame.size() - 1);
 611     }
 612 
 613     private Object peekValue() {
 614         return stackFrame.get(stackFrame.size() - 1);
 615     }
 616 
 617     private void pushValue(final Object o) {
 618         stackFrame.add(o);
 619     }
 620 
 621     /**
 622      * Called at the beginning of the method or after super class call in
 623      * the constructor. <br>
 624      * <br>
 625      *
 626      * <i>Custom code can use or change all the local variables, but should not
 627      * change state of the stack.</i>
 628      */
 629     protected void onMethodEnter() {
 630     }
 631 
 632     /**
 633      * Called before explicit exit from the method using either return or throw.
 634      * Top element on the stack contains the return value or exception instance.
 635      * For example:
 636      *
 637      * <pre>
 638      *   public void onMethodExit(int opcode) {
 639      *     if(opcode==RETURN) {
 640      *         visitInsn(ACONST_NULL);
 641      *     } else if(opcode==ARETURN || opcode==ATHROW) {
 642      *         dup();


< prev index next >