public void declareField(String field) { if (!clsData().fieldSet.contains(field)) { cls().visitField(ACC_PROTECTED, field, ci(Object.class), null, null); clsData().fieldSet.add(field); } }
public void pushscript(String clsName, String filename) { PrintWriter pw = new PrintWriter(System.out); writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); clsStack.push(new ClassData(clsName, writer)); cls().visit(RubyInstanceConfig.JAVA_VERSION, ACC_PUBLIC + ACC_SUPER, clsName, null, p(Object.class), null); cls().visitSource(filename, null); pw.flush(); }
public void declareField(String field) { if (!clsData().fieldSet.contains(field)) { cls().visitField(ACC_PROTECTED, field, ci(Object.class), null, null); clsData().fieldSet.add(field); } }
public void pushscript(String clsName, String filename) { PrintWriter pw = new PrintWriter(System.out); writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); clsStack.push(new ClassData(clsName, writer)); cls().visit(RubyInstanceConfig.JAVA_VERSION, ACC_PUBLIC + ACC_SUPER, clsName, null, p(Object.class), null); cls().visitSource(filename, null); pw.flush(); }
@Override public void Scope(Scope scope) { IRScope irScope = scope.getScope(); String name = JavaNameMangler.encodeScopeForBacktrace(irScope) + '$' + methodIndex++ + "_IRSCope"; if (scopeMap.get(name) == null) { scopeMap.put(name, irScope); jvm.cls().visitField(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_VOLATILE, name, ci(IRScope.class), null, null).visitEnd(); } jvmAdapter().getstatic(jvm.clsData().clsName, name, ci(IRScope.class)); jvmAdapter().invokestatic(p(Helpers.class), "getStaticScope", sig(StaticScope.class, IRScope.class)); }
public void emit(IRScriptBody script) { String clsName = jvm.scriptToClass(script.getName()); jvm.pushscript(clsName, script.getFileName()); emitScope(script, "__script__", 0); jvm.cls().visitEnd(); jvm.popclass(); }
@Override public void Scope(Scope scope) { IRScope irScope = scope.getScope(); String name = JavaNameMangler.encodeScopeForBacktrace(irScope) + '$' + methodIndex++ + "_IRSCope"; if (scopeMap.get(name) == null) { scopeMap.put(name, irScope); jvm.cls().visitField(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_VOLATILE, name, ci(IRScope.class), null, null).visitEnd(); } jvmAdapter().getstatic(jvm.clsData().clsName, name, ci(IRScope.class)); jvmAdapter().invokestatic(p(Helpers.class), "getStaticScope", sig(StaticScope.class, IRScope.class)); }
public void emit(IRScriptBody script) { String clsName = jvm.scriptToClass(script.getName()); jvm.pushscript(clsName, script.getFileName()); emitScope(script, "__script__", 0); jvm.cls().visitEnd(); jvm.popclass(); }
protected Handle emitModuleBodyJIT(IRModuleBody method) { String name = JavaNameMangler.encodeScopeForBacktrace(method) + '$' + methodIndex++; String clsName = jvm.scriptToClass(method.getFile()); jvm.pushscript(clsName, method.getFile()); Signature signature = signatureFor(method, false); emitScope(method, name, signature, false, true); Handle handle = new Handle( Opcodes.H_INVOKESTATIC, jvm.clsData().clsName, name, sig(signature.type().returnType(), signature.type().parameterArray()), false); jvm.cls().visitEnd(); jvm.popclass(); return handle; }
protected void emitMethodJIT(IRMethod method, JVMVisitorMethodContext context) { String clsName = jvm.scriptToClass(method.getFile()); String name = JavaNameMangler.encodeScopeForBacktrace(method) + '$' + methodIndex++; jvm.pushscript(clsName, method.getFile()); emitWithSignatures(method, context, name); jvm.cls().visitEnd(); jvm.popclass(); }
protected Handle emitModuleBodyJIT(IRModuleBody method) { String name = JavaNameMangler.encodeScopeForBacktrace(method) + '$' + methodIndex++; String clsName = jvm.scriptToClass(method.getFile()); jvm.pushscript(clsName, method.getFile()); Signature signature = signatureFor(method, false); emitScope(method, name, signature, false, true); Handle handle = new Handle( Opcodes.H_INVOKESTATIC, jvm.clsData().clsName, name, sig(signature.type().returnType(), signature.type().parameterArray()), false); jvm.cls().visitEnd(); jvm.popclass(); return handle; }
protected void emitMethodJIT(IRMethod method, JVMVisitorMethodContext context) { String clsName = jvm.scriptToClass(method.getFile()); String name = JavaNameMangler.encodeScopeForBacktrace(method) + '$' + methodIndex++; jvm.pushscript(clsName, method.getFile()); emitWithSignatures(method, context, name); jvm.cls().visitEnd(); jvm.popclass(); }
protected void emitScriptBody(IRScriptBody script) { // Note: no index attached because there should be at most one script body per .class String name = JavaNameMangler.encodeScopeForBacktrace(script); String clsName = jvm.scriptToClass(script.getFile()); jvm.pushscript(clsName, script.getFile()); emitScope(script, name, signatureFor(script, false), false, true); jvm.cls().visitEnd(); jvm.popclass(); }
protected void emitScriptBody(IRScriptBody script) { // Note: no index attached because there should be at most one script body per .class String name = JavaNameMangler.encodeScopeForBacktrace(script); String clsName = jvm.scriptToClass(script.getFile()); jvm.pushscript(clsName, script.getFile()); emitScope(script, name, signatureFor(script, false), false, true); jvm.cls().visitEnd(); jvm.popclass(); }
protected void emitBlockJIT(IRClosure closure, JVMVisitorMethodContext context) { String clsName = jvm.scriptToClass(closure.getFile()); String name = JavaNameMangler.encodeScopeForBacktrace(closure) + '$' + methodIndex++; jvm.pushscript(clsName, closure.getFile()); emitScope(closure, name, CLOSURE_SIGNATURE, false, true); context.setBaseName(name); context.setVariableName(name); jvm.cls().visitEnd(); jvm.popclass(); }
protected void emitBlockJIT(IRClosure closure, JVMVisitorMethodContext context) { String clsName = jvm.scriptToClass(closure.getFile()); String name = JavaNameMangler.encodeScopeForBacktrace(closure) + '$' + methodIndex++; jvm.pushscript(clsName, closure.getFile()); emitScope(closure, name, CLOSURE_SIGNATURE, false, true); context.setBaseName(name); context.setVariableName(name); jvm.cls().visitEnd(); jvm.popclass(); }
if (scopeMap.get(scopeField) == null) { scopeMap.put(scopeField, scope); jvm.cls().visitField(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_VOLATILE, scopeField, ci(IRScope.class), null, null).visitEnd();
if (scopeMap.get(scopeField) == null) { scopeMap.put(scopeField, scope); jvm.cls().visitField(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_VOLATILE, scopeField, ci(IRScope.class), null, null).visitEnd();