Java Reference
In-Depth Information
The dup duplicates the r-value for y on top of the stack so there are two copies. Each of the
istore operations pops a value and stores it in the appropriate variable.
In parsing, when an expression is used as a statement, Parser 's statementExpression
() method sets a ag isStatementExpression in the expression node to true . The code
generation phase can make use of this flag in deciding when code must be produced for
duplicating r-values on the run-time stack.
Additional Assignment-Like Operations
The most important property of the assignment is its side effect. One uses the assignment
operation for its side eect, overwriting a variable's r-value with another. There are other
Java (and j--) operations having the same sort of side effect. For example,
x--
++x
x+=6
are all expressions that have side effects. But they also denote values. The context in which
they are used determines whether or not we want the value left on the stack, or we simply
want the side effect.
5.5.2 Comparing Left-Hand Sides and Operations
The table below compares the various operations (labeled down the left) with an assortment
of left-hand sides (labeled across the top). We do not deal with string concatenation here,
but leave that to a later section.
 
Search WWH ::




Custom Search