Class PythonBytecodeToJavaBytecodeTranslator

java.lang.Object
ai.timefold.jpyinterpreter.PythonBytecodeToJavaBytecodeTranslator

public class PythonBytecodeToJavaBytecodeTranslator extends Object
  • Field Details

  • Constructor Details

    • PythonBytecodeToJavaBytecodeTranslator

      public PythonBytecodeToJavaBytecodeTranslator()
  • Method Details

    • writeClassOutput

      public static void writeClassOutput(Map<String,byte[]> classNameToBytecode, String className, byte[] classByteCode)
    • getFunctionalInterfaceMethod

      public static Method getFunctionalInterfaceMethod(Class<?> interfaceClass)
    • createInstance

      public static <T> T createInstance(Class<T> functionClass, PythonInterpreter pythonInterpreter)
    • translatePythonBytecode

      public static <T> T translatePythonBytecode(PythonCompiledFunction pythonCompiledFunction, Class<T> javaFunctionalInterfaceType)
    • translatePythonBytecode

      public static <T> T translatePythonBytecode(PythonCompiledFunction pythonCompiledFunction, Class<T> javaFunctionalInterfaceType, List<Class<?>> genericTypeArgumentList)
    • forceTranslatePythonBytecodeToGenerator

      public static <T> T forceTranslatePythonBytecodeToGenerator(PythonCompiledFunction pythonCompiledFunction, Class<T> javaFunctionalInterfaceType)
    • translatePythonBytecodeToClass

      public static <T> Class<T> translatePythonBytecodeToClass(PythonCompiledFunction pythonCompiledFunction, Class<T> javaFunctionalInterfaceType)
    • translatePythonBytecodeToClass

      public static <T> Class<T> translatePythonBytecodeToClass(PythonCompiledFunction pythonCompiledFunction, Class<T> javaFunctionalInterfaceType, List<Class<?>> genericTypeArgumentList)
    • translatePythonBytecodeToClass

      public static <T> Class<T> translatePythonBytecodeToClass(PythonCompiledFunction pythonCompiledFunction, MethodDescriptor methodDescriptor)
    • translatePythonBytecodeToInstance

      public static <T> T translatePythonBytecodeToInstance(PythonCompiledFunction pythonCompiledFunction, MethodDescriptor methodDescriptor)
    • translatePythonBytecodeToInstance

      public static <T> T translatePythonBytecodeToInstance(PythonCompiledFunction pythonCompiledFunction, MethodDescriptor methodDescriptor, boolean isVirtual)
    • translatePythonBytecodeToClass

      public static <T> Class<T> translatePythonBytecodeToClass(PythonCompiledFunction pythonCompiledFunction, MethodDescriptor methodDescriptor, boolean isVirtual)
    • translatePythonBytecodeToClass

      public static <T> Class<T> translatePythonBytecodeToClass(PythonCompiledFunction pythonCompiledFunction, MethodDescriptor methodDescriptor, Method methodWithoutGenerics, boolean isVirtual)
    • translatePythonBytecodeToPythonWrapperClass

      public static <T> Class<T> translatePythonBytecodeToPythonWrapperClass(PythonCompiledFunction pythonCompiledFunction, OpaquePythonReference codeReference)
    • forceTranslatePythonBytecodeToGeneratorClass

      public static <T> Class<T> forceTranslatePythonBytecodeToGeneratorClass(PythonCompiledFunction pythonCompiledFunction, MethodDescriptor methodDescriptor, Method methodWithoutGenerics, boolean isVirtual)
      Used for testing; force translate the python to a generator, even if it is not a generator
    • createFields

      public static void createFields(org.objectweb.asm.ClassWriter classWriter)
    • getOpcodeList

      public static List<Opcode> getOpcodeList(PythonCompiledFunction pythonCompiledFunction)
    • getInitialStackMetadata

      public static StackMetadata getInitialStackMetadata(LocalVariableHelper localVariableHelper, MethodDescriptor method, boolean isVirtual)
    • getFunctionType

      public static PythonFunctionType getFunctionType(PythonCompiledFunction pythonCompiledFunction)
    • writeInstructionsForOpcodes

      public static void writeInstructionsForOpcodes(FunctionMetadata functionMetadata, List<StackMetadata> stackMetadataForOpcodeIndex, List<Opcode> opcodeList)
    • writeInstructionsForOpcodes

      public static void writeInstructionsForOpcodes(FunctionMetadata functionMetadata, List<StackMetadata> stackMetadataForOpcodeIndex, List<Opcode> opcodeList, Consumer<PythonBytecodeInstruction> runAfterLabelAndBeforeArgumentors)
    • print

      public static void print(org.objectweb.asm.MethodVisitor methodVisitor)
      Used for debugging; prints TOS
    • printStack

      public static void printStack(FunctionMetadata functionMetadata, StackMetadata stackMetadata)
      Used for debugging; prints the entire stack
    • getPythonBytecodeListing

      public static String getPythonBytecodeListing(PythonCompiledFunction pythonCompiledFunction)
    • visitGeneratedLineNumber

      public static void visitGeneratedLineNumber(org.objectweb.asm.MethodVisitor methodVisitor)