Class FieldUpdater

java.lang.Object
org.glassfish.rmic.tools.tree.FieldUpdater
All Implemented Interfaces:
Constants, RuntimeConstants

class FieldUpdater extends Object implements Constants
This class encapsulates the information required to generate an update to a private field referenced from another class, e.g., an inner class. An expression denoting a reference to the object to which the field belongs is associated with getter and setter methods.

We use this class only for assignment, increment, and decrement operators, in which the old value is first retrieved and then a new value is computed and stored. Simple assignment expressions in which a value is copied without modification are handled by another mechanism. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.

  • Field Details

  • Constructor Details

  • Method Details

    • inline

      public FieldUpdater inline(Environment env, Context ctx)
      Since the object reference expression may be captured before it has been inlined, we must inline it later. A FieldUpdater is inlined essentially as if it were a child of the assignment node to which it belongs.
    • copyInline

      public FieldUpdater copyInline(Context ctx)
    • costInline

      public int costInline(int thresh, Environment env, Context ctx, boolean needGet)
    • codeDup

      private void codeDup(Assembler asm, int items, int depth)
      Duplicate items words from the top of the stack, locating them below the topmost depth words on the stack.
    • startUpdate

      public void startUpdate(Environment env, Context ctx, Assembler asm, boolean valNeeded)
      Begin a field update by an assignment, increment, or decrement operator. The current value of the field is left at the top of the stack. If valNeeded is true, we arrange for the initial value to remain on the stack after the update.
    • finishUpdate

      public void finishUpdate(Environment env, Context ctx, Assembler asm, boolean valNeeded)
      Complete a field update by an assignment, increment, or decrement operator. The original value of the field left on the stack by startUpdate must have been replaced with the updated value, with no other stack alterations. If valNeeded is true, we arrange for the updated value to remain on the stack after the update. The valNeeded argument must not be true in both startUpdate and finishUpdate.
    • startAssign

      public void startAssign(Environment env, Context ctx, Assembler asm)
      Like above, but used when assigning a new value independent of the old, as in a simple assignment expression. After 'startAssign', code must be emitted to leave one additional value on the stack without altering any others, followed by 'finishAssign'.
    • finishAssign

      public void finishAssign(Environment env, Context ctx, Assembler asm, boolean valNeeded)