Interface CompilationContext

All Superinterfaces:
eu.bandm.tools.lljava.live.BlockContext<CompilationContext>, eu.bandm.tools.lljava.live.CompilationContext<CompilationContext>, eu.bandm.tools.lljava.live.EnvironmentContext<CompilationContext>, eu.bandm.tools.lljava.live.InstructionsContext<CompilationContext>, eu.bandm.tools.lljava.live.InvocationContext<CompilationContext>, eu.bandm.tools.lljava.live.LabelContext, eu.bandm.tools.lljava.live.StateContext<CompilationContext>, eu.bandm.tools.lljava.live.SubMethodsContext<CompilationContext>, eu.bandm.tools.lljava.live.TracingContext, eu.bandm.tools.lljava.live.VariableContext
All Known Implementing Classes:
LLJavaCompilationContext

public interface CompilationContext extends eu.bandm.tools.lljava.live.CompilationContext<CompilationContext>
The interface to code generation for objects of operational classes of this package.

The machine model for code generation is (a simplification of) the JVM. Classes that implement this interface may generate actual JVM bytecode, or translate to other target architectures transparently.

Code generation is strictly modular; the code generator for a particular fragment does not need to know how it is embedded in the code of a generated method; it is executed with this context object being focused to a particular block of sub-method code structure.

Every block is connected to its environment by typed input and output variables. The generated code may load data from any inputs and must store data to all outputs, respectively. It must not use non-local control flow constructs such as return instructions or catch blocks (there are no operations to explicitly emit such constructs in this API). Furthermore, it should avoid throwing exceptions.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface eu.bandm.tools.lljava.live.EnvironmentContext

    eu.bandm.tools.lljava.live.EnvironmentContext.EnvFieldInfo<T>

    Nested classes/interfaces inherited from interface eu.bandm.tools.lljava.live.LabelContext

    eu.bandm.tools.lljava.live.LabelContext.Label

    Nested classes/interfaces inherited from interface eu.bandm.tools.lljava.live.VariableContext

    eu.bandm.tools.lljava.live.VariableContext.Variable
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addInterfaceMethod(Class<?> interfaceType, Method interfaceMethod, Consumer<? super CompilationContext> generator)
     
    void
     
    <C extends CompilableDataFlow>
    void
    addMainSignalSource(Class<C> signalType, Class<?> valueType, String getterName, C source)
     
    void
    addNonLocalizedState(Class<?> type, Object owner, String name)
     
    void
     
    eu.bandm.tools.lljava.live.VariableContext.Variable
    findLocalizableState(Class<?> type, Object owner, String name)
     
    newInstance(String componentClassName)
     
    static <T> CompilationContext
    newInstance(T component)
     

    Methods inherited from interface eu.bandm.tools.lljava.live.BlockContext

    block, block, endBlock, expr, expr, exprInputs, exprInputs, getInput, getInputs, getOutput, getOutput, getOutputs, hasInputs, hasOutputs, loadInput, loadOutput, self, startBlock, storeOutput, storeOutput, storeOutput, storeOutput

    Methods inherited from interface eu.bandm.tools.lljava.live.CompilationContext

    addInterface, compileClass, eval, eval, eval, eval, getComponentClassName, getType, list, list, list, loadVarargs, loadVarargs, subtypeOracle, switchUnique, whileNonZero

    Methods inherited from interface eu.bandm.tools.lljava.live.EnvironmentContext

    createFactory, createFactory, findEnv, findEnvField, findEnvUnstored, getEnvFields, instantiate, instantiate, instantiateUpTo, instantiateUpTo, loadEnv, loadEnv, loadEnvField, loadEnvVariable

    Methods inherited from interface eu.bandm.tools.lljava.live.InstructionsContext

    add, add, and, binary, binary, branch, branchIfEq, branchIfGEq, branchIfGT, branchIfLEq, branchIfLT, branchIfNegative, branchIfNEq, branchIfNonNegative, branchIfNonNull, branchIfNonPositive, branchIfNonZero, branchIfNull, branchIfPositive, branchIfZero, cmp, cmpGT, cmpLT, constant, constant, constant, constant, constant, constantNull, convertTo, div, div, dup, get, ifElse, ifElse, ifEq, ifEq, ifEq, ifGEq, ifGEq, ifGEq, ifGT, ifGT, ifGT, ifLEq, ifLEq, ifLEq, ifLT, ifLT, ifLT, ifNegative, ifNegative, ifNEq, ifNEq, ifNEq, ifNonNegative, ifNonNegative, ifNonNull, ifNonNull, ifNonPositive, ifNonPositive, ifNonZero, ifNonZero, ifNonZero, ifNull, ifNull, ifPositive, ifPositive, ifZero, ifZero, ifZero, instanceOf, invoke, isEq, isGEq, isGT, isLEq, isLT, isNegative, isNEq, isNonNegative, isNonNull, isNonPositive, isNonZero, isNull, isPositive, isZero, lazyAnd, lazyOr, length, load, load, load, load, load, load, load, loadArray, loadNull, loadPrimitive, loadThis, move, move, move, move, move, move, move, moveNull, mul, mul, neg, newArray, newInstance, nop, not, or, pop, put, query, rem, rem, return_, serve, serving, shl, shr, store, store, storeArray, sub, sub, switchUnique, throw_, ushr, xor

    Methods inherited from interface eu.bandm.tools.lljava.live.InvocationContext

    invoke, invoke, invokeDynamic, invokeInterface, invokeSpecial, invokeStatic, invokeVirtual, newInstance, newInstance

    Methods inherited from interface eu.bandm.tools.lljava.live.LabelContext

    createLabel, insert

    Methods inherited from interface eu.bandm.tools.lljava.live.StateContext

    findState, initializeState, initializeState, initializeState, initially, initially, loadState, storeState, storeState

    Methods inherited from interface eu.bandm.tools.lljava.live.SubMethodsContext

    endMethod, invokeSubMethod, invokeSubMethod, startMethod

    Methods inherited from interface eu.bandm.tools.lljava.live.TracingContext

    isTracing, setTracing

    Methods inherited from interface eu.bandm.tools.lljava.live.VariableContext

    createLocalVariable, createVirtualVariable, getParameter
  • Method Details

    • addInterfaceMethod

      void addInterfaceMethod(Class<?> interfaceType, Method interfaceMethod, Consumer<? super CompilationContext> generator)
    • addMainSignalSource

      <C extends CompilableDataFlow> void addMainSignalSource(Class<C> signalType, Class<?> valueType, String getterName, C source)
    • addMainProcess

      void addMainProcess(Process main)
    • newInstance

      static CompilationContext newInstance(String componentClassName)
    • newInstance

      static <T> CompilationContext newInstance(T component)
    • enableLocalizedState

      void enableLocalizedState()
    • addNonLocalizedState

      void addNonLocalizedState(Class<?> type, Object owner, String name)
    • findLocalizableState

      eu.bandm.tools.lljava.live.VariableContext.Variable findLocalizableState(Class<?> type, Object owner, String name)