|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.comp.ConstFold
class ConstFold
Helper class for constant folding, used by the attribution phase. This class is marked strictfp as mandated by JLS 15.4.
This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Field Summary | |
|---|---|
protected static Context.Key<ConstFold> |
constFoldKey
|
(package private) static java.lang.Integer |
minusOne
|
(package private) static java.lang.Integer |
one
|
private Symtab |
syms
|
(package private) static java.lang.Integer |
zero
|
| Constructor Summary | |
|---|---|
private |
ConstFold(Context context)
|
| Method Summary | |
|---|---|
private static java.lang.Integer |
b2i(boolean b)
Convert boolean to integer (true = 1, false = 0). |
(package private) Type |
coerce(Type etype,
Type ttype)
Coerce constant type to target type. |
private static double |
doubleValue(java.lang.Object x)
|
private static float |
floatValue(java.lang.Object x)
|
(package private) Type |
fold(int opcode,
List<Type> argtypes)
Fold binary or unary operation, returning constant type reflecting the operations result. |
(package private) Type |
fold1(int opcode,
Type operand)
Fold unary operation. |
(package private) Type |
fold2(int opcode,
Type left,
Type right)
Fold binary operation. |
static ConstFold |
instance(Context context)
|
private static int |
intValue(java.lang.Object x)
|
private static long |
longValue(java.lang.Object x)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Context.Key<ConstFold> constFoldKey
private Symtab syms
static java.lang.Integer minusOne
static java.lang.Integer zero
static java.lang.Integer one
| Constructor Detail |
|---|
private ConstFold(Context context)
| Method Detail |
|---|
public static ConstFold instance(Context context)
private static java.lang.Integer b2i(boolean b)
private static int intValue(java.lang.Object x)
private static long longValue(java.lang.Object x)
private static float floatValue(java.lang.Object x)
private static double doubleValue(java.lang.Object x)
Type fold(int opcode,
List<Type> argtypes)
opcode - The operation's opcode instruction (usually a byte code),
as entered by class Symtab.argtypes - The operation's argument types (a list of length 1 or 2).
Argument types are assumed to have non-null constValue's.
Type fold1(int opcode,
Type operand)
opcode - The operation's opcode instruction (usually a byte code),
as entered by class Symtab.
opcode's ifeq to ifge are for postprocessing
xcmp; ifxx pairs of instructions.operand - The operation's operand type.
Argument types are assumed to have non-null constValue's.
Type fold2(int opcode,
Type left,
Type right)
opcode - The operation's opcode instruction (usually a byte code),
as entered by class Symtab.
opcode's ifeq to ifge are for postprocessing
xcmp; ifxx pairs of instructions.left - The type of the operation's left operand.right - The type of the operation's right operand.
Type coerce(Type etype,
Type ttype)
etype - The source type of the coercion,
which is assumed to be a constant type compatble with
ttype.ttype - The target type of the coercion.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||