Class CompilerPlugin

java.lang.Object
org.robovm.compiler.plugin.Plugin
org.robovm.compiler.plugin.CompilerPlugin
Direct Known Subclasses:
AbstractCompilerPlugin

public abstract class CompilerPlugin
extends Plugin
Plugin interface which makes it possible to hook into the compilation process and modify classes and methods during the compilation.
  • Constructor Details

    • CompilerPlugin

      public CompilerPlugin()
  • Method Details

    • beforeConfig

      public abstract void beforeConfig​(Config.Builder builder, Config config) throws IOException
      Called before the Config for a compilation is built. Allows the plugin to modify the compiler configuration. NOTE: Some properties of the passed Config may not have been set at the time of the call to this method.
      Parameters:
      builder - the Config.Builder
      config - the not yet built Config. Can be used to get configuration set on the Config.Builder so far.
      Throws:
      IOException
    • helloClass

      public void helloClass​(Config config, Clazz clazz)
      Called just before a class is about to be compiled. Modifications to the underlying SootClass (Clazz.getSootClass()) are not allowed this stage. Used to allow plugins to evaluate class before modification
      Parameters:
      config - the current Config.
      clazz - the Clazz being compiled.
    • beforeClass

      public abstract void beforeClass​(Config config, Clazz clazz, ModuleBuilder moduleBuilder) throws IOException
      Called just before a class is about to be compiled. Modifications to the underlying SootClass (Clazz.getSootClass()) should be done at this stage.
      Parameters:
      config - the current Config.
      clazz - the Clazz being compiled.
      moduleBuilder - the ModuleBuilder holding the generated bitcode.
      Throws:
      IOException
    • beforeMethod

      public abstract void beforeMethod​(Config config, Clazz clazz, soot.SootMethod method, ModuleBuilder moduleBuilder) throws IOException
      Called just before a method is about to be compiled. Modifications to the underlying SootMethod should be done at this stage.
      Parameters:
      config - the current Config.
      clazz - the Clazz being compiled.
      method - the method being compiled.
      moduleBuilder - the ModuleBuilder holding the generated bitcode.
      Throws:
      IOException
    • afterClass

      public abstract void afterClass​(Config config, Clazz clazz, ModuleBuilder moduleBuilder) throws IOException
      Called after a class has been compiled to LLVM bitcode but before it is converted into machine code.
      Parameters:
      config - the current Config.
      clazz - the Clazz being compiled.
      moduleBuilder - the ModuleBuilder holding the generated bitcode.
      Throws:
      IOException
    • afterMethod

      public abstract void afterMethod​(Config config, Clazz clazz, soot.SootMethod method, ModuleBuilder moduleBuilder, Function function) throws IOException
      Called after a method has been compiled to LLVM bitcode but before it is converted into machine code.
      Parameters:
      config - the current Config.
      clazz - the Clazz being compiled.
      method - the method being compiled.
      moduleBuilder - the ModuleBuilder holding the generated bitcode.
      function - the function corresponding to the method.
      Throws:
      IOException
    • afterClassDependenciesResolved

      public abstract void afterClassDependenciesResolved​(Config config, Clazz clazz)
      Called after dependencies resolved and added to the list. It is the moment when all work with clazz is finished (machine code generation pending) and all associated resources might be released
      Parameters:
      config - the current Config
      clazz - the Clazz being compiled
    • afterObjectFile

      public abstract void afterObjectFile​(Config config, Clazz clazz, File objectFile, ObjectFile objectFileData) throws IOException
      Called after the object file of a class has been compiled to an object file.
      Parameters:
      config - the current Config
      clazz - the Clazz being compiled
      objectFile - the object file
      objectFileData - LLVM read object file data
      Throws:
      IOException
    • beforeLinker

      public abstract void beforeLinker​(Config config, Linker linker, Set<Clazz> classes) throws IOException
      Called just before Linker is invoked.
      Parameters:
      config - the current Config
      linker - the Linker instance.
      classes - the classes that will be linked.
      Throws:
      IOException
    • afterLinker

      public abstract void afterLinker​(Config config, File executable) throws IOException
      Called just before Linker is invoked.
      Parameters:
      config - the current Config
      executable - the binary
      Throws:
      IOException