org.jikesrvm.compilers.opt.bc2ir
Class GenerateMagic
java.lang.Object
org.jikesrvm.compilers.opt.bc2ir.GenerateMagic
- All Implemented Interfaces:
- TIBLayoutConstants
public class GenerateMagic
- extends Object
- implements TIBLayoutConstants
This class implements the non-machine-specific magics for the opt compiler.
By non-machine-specific we mean that the IR generated to implement the magic
is independent of the target-architecture.
It does not mean that the eventual MIR that implements the magic
won't differ from architecture to architecture.
Method Summary |
private static void |
cmpHelper(BC2IR bc2ir,
GenerationContext gc,
ConditionOperand cond,
Operand given_o2)
|
(package private) static boolean |
generateMagic(BC2IR bc2ir,
GenerationContext gc,
MethodReference meth)
"Semantic inlining" of methods of the Magic class. |
(package private) static boolean |
generatePolymorphicMagic(BC2IR bc2ir,
GenerationContext gc,
MethodReference meth,
Atom methodName)
|
private static Operator |
getOperator(TypeReference type,
int operatorClass)
|
private static boolean |
isLoad(Atom methodName)
|
private static boolean |
isPrefix(Atom prefix,
byte[] b)
Is string a a prefix of string
b . |
private static boolean |
isPrepare(Atom methodName)
|
private static LocationOperand |
mapToMetadata(Operand metadata)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOAD_OP
private static final int LOAD_OP
- See Also:
- Constant Field Values
PREPARE_OP
private static final int PREPARE_OP
- See Also:
- Constant Field Values
STORE_OP
private static final int STORE_OP
- See Also:
- Constant Field Values
ATTEMPT_OP
private static final int ATTEMPT_OP
- See Also:
- Constant Field Values
GenerateMagic
public GenerateMagic()
generateMagic
static boolean generateMagic(BC2IR bc2ir,
GenerationContext gc,
MethodReference meth)
throws MagicNotImplementedException
- "Semantic inlining" of methods of the Magic class.
Based on the methodName, generate a sequence of opt instructions
that implement the magic, updating the expression stack as necessary.
- Parameters:
bc2ir
- the bc2ir object that is generating the
ir containing this magicgc
- must be bc2ir.gcmeth
- the RVMMethod that is the magic method
- Throws:
MagicNotImplementedException
generatePolymorphicMagic
static boolean generatePolymorphicMagic(BC2IR bc2ir,
GenerationContext gc,
MethodReference meth,
Atom methodName)
cmpHelper
private static void cmpHelper(BC2IR bc2ir,
GenerationContext gc,
ConditionOperand cond,
Operand given_o2)
mapToMetadata
private static LocationOperand mapToMetadata(Operand metadata)
getOperator
private static Operator getOperator(TypeReference type,
int operatorClass)
throws MagicNotImplementedException
- Throws:
MagicNotImplementedException
isLoad
private static boolean isLoad(Atom methodName)
isPrepare
private static boolean isPrepare(Atom methodName)
isPrefix
private static boolean isPrefix(Atom prefix,
byte[] b)
- Is string
a
a prefix of string
b
. String b
is encoded as an ASCII byte
array.
- Parameters:
prefix
- Prefix atomb
- String which may contain prefix, encoded as an ASCII
byte array.
- Returns:
true
if a
is a prefix of
b