Package jadex.bytecode
Class SASM
- java.lang.Object
- 
- jadex.bytecode.SASM
 
- 
 public class SASM extends java.lang.ObjectStatic ASM helper methods.
- 
- 
Field SummaryFields Modifier and Type Field Description protected static WeakKeyValueMap<java.lang.ClassLoader,IByteCodeClassLoader>SHARED_CLASSLOADERSShared ClassLoader cache.static booleanSHARED_LOADERS_MODEEnables the shared bytecode classloader mode.
 - 
Constructor SummaryConstructors Constructor Description SASM()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static IByteCodeClassLoadercreateByteCodeClassLoader(java.lang.ClassLoader... parents)Creates a byte code ClassLoader.static IByteCodeClassLoadergetByteCodeClassLoader(java.lang.ClassLoader parent)Generates a ByteCodeClassLoader for loading a generated class.static IByteCodeClassLoadergetByteCodeClassLoader(java.lang.ClassLoader parent, boolean sharedloaders)Generates a ByteCodeClassLoader for loading a generated class.static org.objectweb.asm.tree.ClassNodegetClassNode(java.lang.Class<?> clazz, java.lang.ClassLoader classloader)Get a class node for a class.static voidmakeBasicType(org.objectweb.asm.tree.InsnList nl, org.objectweb.asm.Type type)Make a value a basic type.static voidmakeObject(org.objectweb.asm.tree.InsnList nl, org.objectweb.asm.Type type)Make a value to an object.static intmakeObject(org.objectweb.asm.tree.InsnList nl, org.objectweb.asm.Type arg, int pos)Make a value to an object.static voidmakeReturn(org.objectweb.asm.tree.InsnList nl, org.objectweb.asm.Type type)Make a suitable return statement.static voidpushImmediate(org.objectweb.asm.tree.InsnList nl, int immediate)Push an immediate (constant) integer value onto the stack with the best set of instructions.static voidpushImmediate(org.objectweb.asm.tree.InsnList nl, long immediate)Push an immediate (constant) long value onto the stack with the best set of instructions.static java.lang.Class<?>toClass(java.lang.String name, byte[] data, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)Transform byte Array into Class and define it in classloader.
 
- 
- 
- 
Field Detail- 
SHARED_LOADERS_MODEpublic static boolean SHARED_LOADERS_MODE Enables the shared bytecode classloader mode. If false, a new classloader is generated for each generated class for easier unloading, but potentially wastes more memory.
 - 
SHARED_CLASSLOADERSprotected static final WeakKeyValueMap<java.lang.ClassLoader,IByteCodeClassLoader> SHARED_CLASSLOADERS Shared ClassLoader cache.
 
- 
 - 
Method Detail- 
pushImmediatepublic static void pushImmediate(org.objectweb.asm.tree.InsnList nl, int immediate)Push an immediate (constant) integer value onto the stack with the best set of instructions.- Parameters:
- nl- The instruction list.
- immediate- The immediate value.
 
 - 
pushImmediatepublic static void pushImmediate(org.objectweb.asm.tree.InsnList nl, long immediate)Push an immediate (constant) long value onto the stack with the best set of instructions.- Parameters:
- nl- The instruction list.
- immediate- The immediate value.
 
 - 
makeObjectpublic static void makeObject(org.objectweb.asm.tree.InsnList nl, org.objectweb.asm.Type type)Make a value to an object.- Parameters:
- nl- The instruction list.
- type- The value type.
 
 - 
makeObjectpublic static int makeObject(org.objectweb.asm.tree.InsnList nl, org.objectweb.asm.Type arg, int pos)Make a value to an object.- Parameters:
- nl- The instruction list.
- type- The value type.
- pos- The position of the value on the registers (default=1, 0 is this).
- Returns:
- The updated position value.
 
 - 
makeBasicTypepublic static void makeBasicType(org.objectweb.asm.tree.InsnList nl, org.objectweb.asm.Type type)Make a value a basic type.- Parameters:
- nl- The instruction list.
- type- The value type.
 
 - 
makeReturnpublic static void makeReturn(org.objectweb.asm.tree.InsnList nl, org.objectweb.asm.Type type)Make a suitable return statement.- Parameters:
- nl- The instruction list.
- type- The value type.
 
 - 
toClasspublic static java.lang.Class<?> toClass(java.lang.String name, byte[] data, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)Transform byte Array into Class and define it in classloader.- Returns:
- the loaded class or null, if the class is not valid, such as Map.entry "inner Classes".
 
 - 
getClassNodepublic static org.objectweb.asm.tree.ClassNode getClassNode(java.lang.Class<?> clazz, java.lang.ClassLoader classloader)Get a class node for a class.- Parameters:
- clazz- The clazz.
- Returns:
- The class node.
 
 - 
getByteCodeClassLoaderpublic static IByteCodeClassLoader getByteCodeClassLoader(java.lang.ClassLoader parent) Generates a ByteCodeClassLoader for loading a generated class.- Parameters:
- parent- Parent ClassLoader.
- sharedloader- Set true, to use shared loaders.
- Returns:
- The ByteCodeClassLoader.
 
 - 
getByteCodeClassLoaderpublic static IByteCodeClassLoader getByteCodeClassLoader(java.lang.ClassLoader parent, boolean sharedloaders) Generates a ByteCodeClassLoader for loading a generated class.- Parameters:
- parent- Parent ClassLoader.
- sharedloader- Set true, to use shared loaders.
- Returns:
- The ByteCodeClassLoader.
 
 - 
createByteCodeClassLoaderpublic static final IByteCodeClassLoader createByteCodeClassLoader(java.lang.ClassLoader... parents) Creates a byte code ClassLoader.- Parameters:
- parents- ClassLoader parents, first parameters is the getParent() ClassLoader.
- Returns:
- The loader.
 
 
- 
 
-