Package org.robovm.compiler.plugin
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 Summary
Constructors Constructor Description CompilerPlugin() -
Method Summary
Modifier and Type Method Description abstract voidafterClass(Config config, Clazz clazz, ModuleBuilder moduleBuilder)Called after a class has been compiled to LLVM bitcode but before it is converted into machine code.abstract voidafterClassDependenciesResolved(Config config, Clazz clazz)Called after dependencies resolved and added to the list.abstract voidafterLinker(Config config, File executable)Called just beforeLinkeris invoked.abstract voidafterMethod(Config config, Clazz clazz, soot.SootMethod method, ModuleBuilder moduleBuilder, Function function)Called after a method has been compiled to LLVM bitcode but before it is converted into machine code.abstract voidafterObjectFile(Config config, Clazz clazz, File objectFile, ObjectFile objectFileData)Called after the object file of a class has been compiled to an object file.abstract voidbeforeClass(Config config, Clazz clazz, ModuleBuilder moduleBuilder)Called just before a class is about to be compiled.abstract voidbeforeConfig(Config.Builder builder, Config config)Called before theConfigfor a compilation is built.abstract voidbeforeLinker(Config config, Linker linker, Set<Clazz> classes)Called just beforeLinkeris invoked.abstract voidbeforeMethod(Config config, Clazz clazz, soot.SootMethod method, ModuleBuilder moduleBuilder)Called just before a method is about to be compiled.voidhelloClass(Config config, Clazz clazz)Called just before a class is about to be compiled.Methods inherited from class org.robovm.compiler.plugin.Plugin
argumentValue, argumentValue, argumentValue, getArguments, parseArguments
-
Constructor Details
-
CompilerPlugin
public CompilerPlugin()
-
-
Method Details
-
beforeConfig
Called before theConfigfor a compilation is built. Allows the plugin to modify the compiler configuration. NOTE: Some properties of the passedConfigmay not have been set at the time of the call to this method.- Parameters:
builder- theConfig.Builderconfig- the not yet builtConfig. Can be used to get configuration set on theConfig.Builderso far.- Throws:
IOException
-
helloClass
Called just before a class is about to be compiled. Modifications to the underlyingSootClass(Clazz.getSootClass()) are not allowed this stage. Used to allow plugins to evaluate class before modification -
beforeClass
public abstract void beforeClass(Config config, Clazz clazz, ModuleBuilder moduleBuilder) throws IOExceptionCalled just before a class is about to be compiled. Modifications to the underlyingSootClass(Clazz.getSootClass()) should be done at this stage.- Parameters:
config- the currentConfig.clazz- theClazzbeing compiled.moduleBuilder- theModuleBuilderholding the generated bitcode.- Throws:
IOException
-
beforeMethod
public abstract void beforeMethod(Config config, Clazz clazz, soot.SootMethod method, ModuleBuilder moduleBuilder) throws IOExceptionCalled just before a method is about to be compiled. Modifications to the underlyingSootMethodshould be done at this stage.- Parameters:
config- the currentConfig.clazz- theClazzbeing compiled.method- the method being compiled.moduleBuilder- theModuleBuilderholding the generated bitcode.- Throws:
IOException
-
afterClass
public abstract void afterClass(Config config, Clazz clazz, ModuleBuilder moduleBuilder) throws IOExceptionCalled after a class has been compiled to LLVM bitcode but before it is converted into machine code.- Parameters:
config- the currentConfig.clazz- theClazzbeing compiled.moduleBuilder- theModuleBuilderholding the generated bitcode.- Throws:
IOException
-
afterMethod
public abstract void afterMethod(Config config, Clazz clazz, soot.SootMethod method, ModuleBuilder moduleBuilder, Function function) throws IOExceptionCalled after a method has been compiled to LLVM bitcode but before it is converted into machine code.- Parameters:
config- the currentConfig.clazz- theClazzbeing compiled.method- the method being compiled.moduleBuilder- theModuleBuilderholding the generated bitcode.function- the function corresponding to the method.- Throws:
IOException
-
afterClassDependenciesResolved
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 -
afterObjectFile
public abstract void afterObjectFile(Config config, Clazz clazz, File objectFile, ObjectFile objectFileData) throws IOExceptionCalled after the object file of a class has been compiled to an object file.- Parameters:
config- the currentConfigclazz- theClazzbeing compiledobjectFile- the object fileobjectFileData- LLVM read object file data- Throws:
IOException
-
beforeLinker
public abstract void beforeLinker(Config config, Linker linker, Set<Clazz> classes) throws IOExceptionCalled just beforeLinkeris invoked.- Parameters:
config- the currentConfiglinker- theLinkerinstance.classes- the classes that will be linked.- Throws:
IOException
-
afterLinker
Called just beforeLinkeris invoked.- Parameters:
config- the currentConfigexecutable- the binary- Throws:
IOException
-