use of org.mvel2.asm.ClassWriter in project drools by kiegroup.
the class ClassGenerator method createClassWriter.
public static ClassWriter createClassWriter(ClassLoader classLoader, int access, String name, String signature, String superName, String[] interfaces) {
ClassWriter cw = new InternalClassWriter(classLoader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
cw.visit(ClassLevel.getJavaVersion(classLoader), access, name, signature, superName, interfaces);
return cw;
}
use of org.mvel2.asm.ClassWriter in project mvel by mvel.
the class ModuleHashesAttribute method write.
@Override
protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
ByteVector v = new ByteVector();
int index = cw.newUTF8(algorithm);
v.putShort(index);
int count = (modules == null) ? 0 : modules.size();
v.putShort(count);
for (int i = 0; i < count; i++) {
String module = modules.get(i);
v.putShort(cw.newModule(module));
byte[] hash = hashes.get(i);
v.putShort(hash.length);
for (byte b : hash) {
v.putByte(b);
}
}
return v;
}
use of org.mvel2.asm.ClassWriter in project mvel by mvel.
the class ModuleResolutionAttribute method write.
@Override
protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
ByteVector v = new ByteVector();
v.putShort(resolution);
return v;
}
use of org.mvel2.asm.ClassWriter in project mvel by mvel.
the class ModuleTargetAttribute method write.
@Override
protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) {
ByteVector v = new ByteVector();
int index = (platform == null) ? 0 : cw.newUTF8(platform);
v.putShort(index);
return v;
}
use of org.mvel2.asm.ClassWriter in project mvel by mvel.
the class ASMAccessorOptimizer method _initJIT.
/**
* Does all the boilerplate for initiating the JIT.
*/
private void _initJIT() {
if (isAdvancedDebugging()) {
buildLog = new StringAppender();
}
cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
synchronized (Runtime.getRuntime()) {
cw.visit(OPCODES_VERSION, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, className = "ASMAccessorImpl_" + valueOf(cw.hashCode()).replaceAll("\\-", "_") + (System.currentTimeMillis() / 10) + ((int) (Math.random() * 100)), null, "java/lang/Object", new String[] { NAMESPACE + "compiler/Accessor" });
}
MethodVisitor m = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
m.visitCode();
m.visitVarInsn(Opcodes.ALOAD, 0);
m.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
m.visitInsn(RETURN);
m.visitMaxs(1, 1);
m.visitEnd();
(mv = cw.visitMethod(ACC_PUBLIC, "getValue", "(Ljava/lang/Object;Ljava/lang/Object;L" + NAMESPACE + "integration/VariableResolverFactory;)Ljava/lang/Object;", null, null)).visitCode();
}
Aggregations