Package eu.bandm.tools.lljava.live
Class BaseCompilationContext<C extends CompilationContext<C>>
java.lang.Object
eu.bandm.tools.lljava.live.BaseCompilationContext<C>
- All Implemented Interfaces:
BlockContext<C>
,CompilationContext<C>
,EnvironmentContext<C>
,InstructionsContext<C>
,InvocationContext<C>
,LabelContext
,StateContext<C>
,SubMethodsContext<C>
,TracingContext
,VariableContext
- Direct Known Subclasses:
OptimizingVisitor.V_CompilationContext
,ParserCompilationContext
,PatternCompilationContext
public abstract class BaseCompilationContext<C extends CompilationContext<C>>
extends Object
implements CompilationContext<C>
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected class
protected class
static class
protected class
static class
protected static class
Nested classes/interfaces inherited from interface eu.bandm.tools.lljava.live.LabelContext
LabelContext.Label
Nested classes/interfaces inherited from interface eu.bandm.tools.lljava.live.VariableContext
VariableContext.Variable
-
Field Summary
Modifier and TypeFieldDescriptionprotected final LLJava.Class
protected final String
protected final LLJava.Method
protected final LLJava.Block
protected final LLJava.Block
protected final Class<?>
protected final BaseCompilationContext.Cache<VariableContext.Variable,
BaseCompilationContext.VariableInfo> -
Constructor Summary
ConstructorDescriptionBaseCompilationContext
(String componentClassName) BaseCompilationContext
(String componentClassName, Class<?> superclass) Deprecated.BaseCompilationContext
(String componentClassName, Class<?> superclass, BaseCompilationContext.SuperEnvInfo... superEnv) -
Method Summary
Modifier and TypeMethodDescriptionadd()
void
addInterface
(Class<?> iface) protected void
addStatement
(LLJava.Statement stmt) and()
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
cmp()
cmpGT()
cmpLT()
byte[]
compile()
Class<?>
Class<?>
compileClass
(ClassLoader loader) createFactory
(ClassLoader loader) createLazyFactory
(ClassLoader loader) createLocalVariable
(Class<?> type) createVirtualVariable
(Class<?> type, Runnable body) Deprecated.createVirtualVariable
(Class<?> type, Consumer<? super C> body) div()
dup()
endBlock()
protected void
endBlock
(boolean nested) void
void
findEnvUnstored
(Class<C> type, C value) protected VariableContext.Variable
findState
(Class<?> type, CheckedPair_LR<Object, String> key) protected LLJava.Block
getBlock()
Collection<? extends EnvironmentContext.EnvFieldInfo<?>>
getParameter
(Class<?> type, int index) boolean
boolean
hasOutputs
(Class<?>... types) void
void
instanceOf
(Class<?> type) instantiate
(ClassLoader loader) instantiateUpTo
(ClassLoader loader, Object hole) void
invokeDynamic
(Class<?> factoryType, String factoryName, Class<?> returnType, Runnable body, Class<?>... paramTypes) invokeInterface
(Method method) invokeSpecial
(Method method) invokeStatic
(Method method) void
Deprecated.void
invokeSubMethod
(Object owner, String name, Class<?> result, Consumer<? super C> body, Class<?>... paramTypes) invokeVirtual
(Method method) void
invokeVirtualSelf
(Class<?> returnType, String name, Class<?>... paramTypes) boolean
length()
load
(double c) load
(float c) load
(int c) load
(long c) protected Class<?>
load
(ClassLoader loader) void
loadEnvVariable
(Object var) loadNull()
loadThis()
void
mul()
neg()
newInstance
(Class<?> type) void
newInstance
(Constructor<?> constructor, Consumer<? super C> args) void
newInstance
(Constructor constructor, Runnable args) Deprecated.nop()
or()
pop()
protected void
popFrame()
protected void
protected void
pushFrame
(LLJava.Block block, List<VariableContext.Variable> inputs, List<VariableContext.Variable> outputs) protected void
pushFrame
(LLJava.Method owner, LLJava.Block block, List<VariableContext.Variable> inputs, List<VariableContext.Variable> outputs) protected LLJava.FieldReference
ref
(LLJava.Field field) protected LLJava.FieldReference
rem()
return_()
void
setTracing
(boolean enabled) shl()
shr()
void
startBlock
(LLJava.Block block) void
startBlock
(LLJava.Method owner, LLJava.Block block) startBlock
(List<VariableContext.Variable> inputs, List<VariableContext.Variable> outputs) void
void
startMethod
(int modifiers, Class<?> result, String name, Class<?>... paramTypes) protected LLJava.Method
startMethodInternal
(int modifiers, Class<?> result, String name, Class<?>... paramTypes) store
(VariableContext.Variable t, Runnable body) Deprecated.store
(VariableContext.Variable t, Consumer<? super C> body) sub()
protected boolean
subtypeOracle
(String t, String u) void
void
switchUnique
(Map<Integer, Runnable> cases, Runnable defaultCase) Deprecated.throw_()
toString()
ushr()
protected VariableContext.Variable
variable
(LLJava.Type type, LLJava.FieldReference ref) protected VariableContext.Variable
variable
(LLJava.Type type, LLJava.VariableRef ref) xor()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface eu.bandm.tools.lljava.live.BlockContext
block, block, expr, expr, exprInputs, exprInputs, getInput, getOutput, getOutput, loadInput, loadOutput, self, storeOutput, storeOutput, storeOutput, storeOutput
Methods inherited from interface eu.bandm.tools.lljava.live.CompilationContext
eval, eval, eval, eval, getType, list, list, list, loadVarargs, loadVarargs, whileNonZero
Methods inherited from interface eu.bandm.tools.lljava.live.EnvironmentContext
createFactory, findEnvField, instantiate, instantiateUpTo, loadEnv, loadEnv, loadEnvField
Methods inherited from interface eu.bandm.tools.lljava.live.InstructionsContext
add, binary, binary, constant, constant, constant, constant, constant, constantNull, div, ifElse, ifElse, ifEq, ifEq, ifEq, ifGEq, ifGEq, ifGEq, ifGT, ifGT, ifGT, ifLEq, ifLEq, ifLEq, ifLT, ifLT, ifLT, ifNegative, ifNegative, ifNEq, ifNEq, ifNEq, ifNonNegative, ifNonNull, ifNonNull, ifNonPositive, ifNonZero, ifNonZero, ifNonZero, ifNull, ifNull, ifPositive, ifPositive, ifZero, ifZero, ifZero, invoke, isEq, isGEq, isGT, isLEq, isLT, isNegative, isNEq, isNonNegative, isNonNull, isNonPositive, isNonZero, isNull, isPositive, isZero, lazyAnd, lazyOr, load, loadPrimitive, move, move, move, move, move, move, move, moveNull, mul, not, query, rem, serve, serving, sub
Methods inherited from interface eu.bandm.tools.lljava.live.InvocationContext
invoke, invoke
Methods inherited from interface eu.bandm.tools.lljava.live.StateContext
initializeState, initializeState, loadState, storeState, storeState
-
Field Details
-
componentClassName
-
component
-
constructor
-
environmentInitializer
-
stateInitializer
-
superClass
-
interfaces
-
variables
protected final BaseCompilationContext.Cache<VariableContext.Variable,BaseCompilationContext.VariableInfo> variables -
labels
protected final BaseCompilationContext.Cache<LabelContext.Label,BaseCompilationContext.LabelInfo> labels
-
-
Constructor Details
-
BaseCompilationContext
-
BaseCompilationContext
Deprecated. -
BaseCompilationContext
public BaseCompilationContext(String componentClassName, Class<?> superclass, BaseCompilationContext.SuperEnvInfo... superEnv)
-
-
Method Details
-
getComponentClassName
-
toString
-
addInterface
- Specified by:
addInterface
in interfaceCompilationContext<C extends CompilationContext<C>>
-
addStatement
-
pushFrame
protected void pushFrame(LLJava.Block block, List<VariableContext.Variable> inputs, List<VariableContext.Variable> outputs) -
pushFrame
protected void pushFrame(LLJava.Method owner, LLJava.Block block, List<VariableContext.Variable> inputs, List<VariableContext.Variable> outputs) -
popFrame
protected void popFrame() -
getBlock
-
variable
-
variable
-
getInputs
- Specified by:
getInputs
in interfaceBlockContext<C extends CompilationContext<C>>
-
getOutputs
- Specified by:
getOutputs
in interfaceBlockContext<C extends CompilationContext<C>>
-
createLocalVariable
- Specified by:
createLocalVariable
in interfaceVariableContext
-
createVirtualVariable
Deprecated.- Specified by:
createVirtualVariable
in interfaceVariableContext
-
createVirtualVariable
-
getParameter
- Specified by:
getParameter
in interfaceVariableContext
-
startBlock
-
startBlock
-
startBlock
- Specified by:
startBlock
in interfaceBlockContext<C extends CompilationContext<C>>
-
endBlock
- Specified by:
endBlock
in interfaceBlockContext<C extends CompilationContext<C>>
-
endBlock
protected void endBlock(boolean nested) -
hasInputs
- Specified by:
hasInputs
in interfaceBlockContext<C extends CompilationContext<C>>
-
hasOutputs
- Specified by:
hasOutputs
in interfaceBlockContext<C extends CompilationContext<C>>
-
createLabel
- Specified by:
createLabel
in interfaceLabelContext
-
neg
- Specified by:
neg
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
add
- Specified by:
add
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
sub
- Specified by:
sub
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
mul
- Specified by:
mul
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
div
- Specified by:
div
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
rem
- Specified by:
rem
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
and
- Specified by:
and
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
or
- Specified by:
or
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
xor
- Specified by:
xor
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
shl
- Specified by:
shl
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
shr
- Specified by:
shr
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
ushr
- Specified by:
ushr
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
cmp
- Specified by:
cmp
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
cmpLT
- Specified by:
cmpLT
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
cmpGT
- Specified by:
cmpGT
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
instanceOf
- Specified by:
instanceOf
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
convertTo
- Specified by:
convertTo
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
newInstance
- Specified by:
newInstance
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
load
- Specified by:
load
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
load
- Specified by:
load
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
load
- Specified by:
load
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
load
- Specified by:
load
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
load
- Specified by:
load
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
load
- Specified by:
load
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
newArray
- Specified by:
newArray
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
loadArray
- Specified by:
loadArray
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
storeArray
- Specified by:
storeArray
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
length
- Specified by:
length
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
dup
- Specified by:
dup
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
pop
- Specified by:
pop
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
nop
- Specified by:
nop
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
store
Deprecated.- Specified by:
store
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
store
- Specified by:
store
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
insert
- Specified by:
insert
in interfaceLabelContext
-
branch
- Specified by:
branch
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfZero
- Specified by:
branchIfZero
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfNonZero
- Specified by:
branchIfNonZero
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfNull
- Specified by:
branchIfNull
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfNonNull
- Specified by:
branchIfNonNull
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfEq
- Specified by:
branchIfEq
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfNEq
- Specified by:
branchIfNEq
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfGT
- Specified by:
branchIfGT
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfGEq
- Specified by:
branchIfGEq
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfLEq
- Specified by:
branchIfLEq
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfLT
- Specified by:
branchIfLT
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfPositive
- Specified by:
branchIfPositive
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfNonPositive
- Specified by:
branchIfNonPositive
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfNegative
- Specified by:
branchIfNegative
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
branchIfNonNegative
- Specified by:
branchIfNonNegative
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
invokeInterface
- Specified by:
invokeInterface
in interfaceInvocationContext<C extends CompilationContext<C>>
-
invokeVirtual
- Specified by:
invokeVirtual
in interfaceInvocationContext<C extends CompilationContext<C>>
-
invokeSpecial
- Specified by:
invokeSpecial
in interfaceInvocationContext<C extends CompilationContext<C>>
-
invokeStatic
- Specified by:
invokeStatic
in interfaceInvocationContext<C extends CompilationContext<C>>
-
invokeVirtualSelf
-
newInstance
Deprecated.- Specified by:
newInstance
in interfaceInvocationContext<C extends CompilationContext<C>>
-
newInstance
- Specified by:
newInstance
in interfaceInvocationContext<C extends CompilationContext<C>>
-
findEnv
- Specified by:
findEnv
in interfaceEnvironmentContext<C extends CompilationContext<C>>
-
findEnvUnstored
- Specified by:
findEnvUnstored
in interfaceEnvironmentContext<C extends CompilationContext<C>>
-
loadNull
- Specified by:
loadNull
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
loadThis
- Specified by:
loadThis
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
ref
-
findState
- Specified by:
findState
in interfaceStateContext<C extends CompilationContext<C>>
-
findState
-
invokeSubMethod
@Deprecated public void invokeSubMethod(Object owner, String name, Class<?> result, Runnable body, Class<?>... paramTypes) Deprecated.- Specified by:
invokeSubMethod
in interfaceSubMethodsContext<C extends CompilationContext<C>>
-
invokeSubMethod
public void invokeSubMethod(Object owner, String name, Class<?> result, Consumer<? super C> body, Class<?>... paramTypes) - Specified by:
invokeSubMethod
in interfaceSubMethodsContext<C extends CompilationContext<C>>
-
method
-
startMethod
- Specified by:
startMethod
in interfaceSubMethodsContext<C extends CompilationContext<C>>
-
startMethodInternal
protected LLJava.Method startMethodInternal(int modifiers, Class<?> result, String name, Class<?>... paramTypes) -
endMethod
public void endMethod()- Specified by:
endMethod
in interfaceSubMethodsContext<C extends CompilationContext<C>>
-
postprocess
protected void postprocess() -
compile
public byte[] compile() -
subtypeOracle
-
getEnvFields
- Specified by:
getEnvFields
in interfaceEnvironmentContext<C extends CompilationContext<C>>
-
getEnvValues
-
instantiate
- Specified by:
instantiate
in interfaceEnvironmentContext<C extends CompilationContext<C>>
-
createFactory
- Specified by:
createFactory
in interfaceEnvironmentContext<C extends CompilationContext<C>>
-
createLazyFactory
-
createLazyFactory
-
compileClass
-
compileClass
-
load
-
instantiateUpTo
- Specified by:
instantiateUpTo
in interfaceEnvironmentContext<C extends CompilationContext<C>>
-
initially
- Specified by:
initially
in interfaceStateContext<C extends CompilationContext<C>>
-
startInitializer
public void startInitializer() -
endInitializer
public void endInitializer() -
loadEnvVariable
- Specified by:
loadEnvVariable
in interfaceEnvironmentContext<C extends CompilationContext<C>>
-
invokeDynamic
public void invokeDynamic(Class<?> factoryType, String factoryName, Class<?> returnType, Runnable body, Class<?>... paramTypes) - Specified by:
invokeDynamic
in interfaceInvocationContext<C extends CompilationContext<C>>
-
switchUnique
Deprecated.- Specified by:
switchUnique
in interfaceCompilationContext<C extends CompilationContext<C>>
- Specified by:
switchUnique
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
switchUnique
public void switchUnique(Map<Integer, ? extends Consumer<? super C>> cases, Consumer<? super C> defaultCase) - Specified by:
switchUnique
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
throw_
- Specified by:
throw_
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
return_
- Specified by:
return_
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
get
- Specified by:
get
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
put
- Specified by:
put
in interfaceInstructionsContext<C extends CompilationContext<C>>
-
ref
-
unbox
-
box
-
isTracing
public boolean isTracing()- Specified by:
isTracing
in interfaceTracingContext
-
setTracing
public void setTracing(boolean enabled) - Specified by:
setTracing
in interfaceTracingContext
-