painless: Some cleanups

This commit is contained in:
Uwe Schindler 2016-05-14 17:23:29 +02:00
parent 6e467a1bd2
commit 7211017813
4 changed files with 8 additions and 9 deletions

View File

@ -37,9 +37,10 @@ import java.util.Map;
public final class WriterConstants { public final class WriterConstants {
public final static String BASE_CLASS_NAME = Executable.class.getName(); public final static String BASE_CLASS_NAME = Executable.class.getName();
public final static String CLASS_NAME = BASE_CLASS_NAME + "$Script";
public final static Type BASE_CLASS_TYPE = Type.getType(Executable.class); public final static Type BASE_CLASS_TYPE = Type.getType(Executable.class);
public final static Type CLASS_TYPE = Type.getType("L" + CLASS_NAME.replace(".", "/") + ";");
public final static String CLASS_NAME = BASE_CLASS_NAME + "$Script";
public final static Type CLASS_TYPE = Type.getObjectType(CLASS_NAME.replace('.', '/'));
public final static Method CONSTRUCTOR = getAsmMethod(void.class, "<init>", String.class, String.class); public final static Method CONSTRUCTOR = getAsmMethod(void.class, "<init>", String.class, String.class);
public final static Method EXECUTE = public final static Method EXECUTE =

View File

@ -61,15 +61,13 @@ final class LDefArray extends ALink {
@Override @Override
void load(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { void load(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) {
final String desc = Type.getMethodDescriptor(after.type, definition.defType.type, index.actual.type); final String desc = Type.getMethodDescriptor(after.type, definition.defType.type, index.actual.type);
adapter.visitInvokeDynamicInsn( adapter.visitInvokeDynamicInsn("arrayLoad", desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.ARRAY_LOAD);
"arrayLoad", desc, DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.ARRAY_LOAD });
} }
@Override @Override
void store(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { void store(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) {
final String desc = Type.getMethodDescriptor(definition.voidType.type, definition.defType.type, final String desc = Type.getMethodDescriptor(definition.voidType.type, definition.defType.type,
index.actual.type, definition.defType.type); index.actual.type, definition.defType.type);
adapter.visitInvokeDynamicInsn( adapter.visitInvokeDynamicInsn("arrayStore", desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.ARRAY_STORE);
"arrayStore", desc, DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.ARRAY_STORE });
} }
} }

View File

@ -84,7 +84,7 @@ final class LDefCall extends ALink {
// return value // return value
signature.append(after.type.getDescriptor()); signature.append(after.type.getDescriptor());
adapter.visitInvokeDynamicInsn(name, signature.toString(), DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.METHOD_CALL }); adapter.visitInvokeDynamicInsn(name, signature.toString(), DEF_BOOTSTRAP_HANDLE, DefBootstrap.METHOD_CALL);
} }
@Override @Override

View File

@ -57,12 +57,12 @@ final class LDefField extends ALink {
@Override @Override
void load(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { void load(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) {
final String desc = Type.getMethodDescriptor(after.type, definition.defType.type); final String desc = Type.getMethodDescriptor(after.type, definition.defType.type);
adapter.visitInvokeDynamicInsn(value, desc, DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.LOAD }); adapter.visitInvokeDynamicInsn(value, desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.LOAD);
} }
@Override @Override
void store(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { void store(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) {
final String desc = Type.getMethodDescriptor(definition.voidType.type, definition.defType.type, definition.defType.type); final String desc = Type.getMethodDescriptor(definition.voidType.type, definition.defType.type, definition.defType.type);
adapter.visitInvokeDynamicInsn(value, desc, DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.STORE }); adapter.visitInvokeDynamicInsn(value, desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.STORE);
} }
} }