gnu.jel
Class OPbinary
java.lang.Object
|
+--gnu.jel.OP
|
+--gnu.jel.OPfunction
|
+--gnu.jel.OPbinary
- public class OPbinary
- extends OPfunction
Field Summary |
protected static byte[][] |
promotions
|
Constructor Summary |
OPbinary(TypesStack typesStk,
java.util.Stack paramOPs,
int opcode,
OPlist list)
Constructs a new binary operation. |
Method Summary |
protected void |
compile_par(ClassFile cf,
int n)
Called to generate the code after a parameter is processed. |
protected void |
compile(ClassFile cf)
Called to generate the code implementing this OP. |
protected void |
eval(OPlist list)
Attempts to perform this operation. |
int |
getNParams()
Returns number of parameters for this function. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
promotions
protected static final byte[][] promotions
OPbinary
public OPbinary(TypesStack typesStk,
java.util.Stack paramOPs,
int opcode,
OPlist list)
throws CompilationException
- Constructs a new binary operation.
Codes are following:
0 -- addition
1 -- substraction
2 -- multiplication
3 -- division
4 -- remainder
5 -- bitwise AND
6 -- bitwise OR
7 -- bitwise and logical XOR
8 -- comparizon for equality
9 -- comparizon for non-equality
10 -- comparizon for "less" <
11 -- comparizon for "greater or equal" >=
12 -- comparizon for "greater" >
13 -- comparizon for "less or equal" <=
14 -- bitwise left shift <<
15 -- bitwise right signed shift >>
16 -- bitwise right unsigned shift >>>
17 -- logical conjunction operator (AND)
18 -- logical disjunction operator (OR)
19 -- array element access operation
20 -- reserved (used internally for sctring concatenation)
- Parameters:
typesStk
- holds current items on stackopcode
- is the operation code
getNParams
public int getNParams()
- Returns number of parameters for this function.
- Overrides:
getNParams
in class OPfunction
compile_par
protected void compile_par(ClassFile cf,
int n)
- Description copied from class:
OPfunction
- Called to generate the code after a parameter is processed.
- Overrides:
compile_par
in class OPfunction
- Following copied from class:
gnu.jel.OPfunction
- Parameters:
cf
- class file to write the code into.n
- the number of parameter (1 is first).
compile
protected void compile(ClassFile cf)
- Description copied from class:
OP
- Called to generate the code implementing this OP.
- Overrides:
compile
in class OP
- Following copied from class:
gnu.jel.OP
- Parameters:
cf
- class file to write the code into.
eval
protected void eval(OPlist list)
- Attempts to perform this operation.
- Overrides:
eval
in class OPfunction
- Parameters:
list
- is the list of OPs this one belong to,
if eval is unsuccessful this list is not modified.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object