use of st.gravel.support.compiler.jvm.JVMInstruction in project gravel by gravel-st.
the class JVMMethodCompiler method newSubFrame_.
public Frame newSubFrame_(final st.gravel.support.jvm.Block0<Object> _aBlock) {
final JVMStack _oldStack;
final List<JVMInstruction> _oldInstructions;
final Frame _frame;
final Map<String, JVMLocalDeclaration> _oldLocals;
_oldStack = _stack;
_oldInstructions = _instructions;
_oldLocals = _locals;
_locals = st.gravel.support.jvm.DictionaryExtensions.copy(_oldLocals);
_instructions = new java.util.ArrayList();
_stack = _oldStack.copy();
_aBlock.value();
_frame = Frame.factory.instructions_endStack_(_instructions.toArray(new JVMInstruction[_instructions.size()]), _stack);
_stack = _oldStack;
_instructions = _oldInstructions;
_locals = _oldLocals;
return _frame;
}
use of st.gravel.support.compiler.jvm.JVMInstruction in project gravel by gravel-st.
the class JVMMethodCompiler method localStore_.
public JVMMethodCompiler localStore_(final String _localName) {
final JVMLocalDeclaration _local;
_local = _locals.get(_localName);
this.ensureCast_(_local.type());
this.emit_(((JVMInstruction) Store.factory.local_(_local)));
return this;
}
use of st.gravel.support.compiler.jvm.JVMInstruction in project gravel by gravel-st.
the class ASMMethodWriter method write.
public void write(JVMMethod method) {
mv = cw.visitMethod(ACC_PUBLIC + (method.isStatic() ? ACC_STATIC : 0), method.name(), method.signature().descriptorString(), null, null);
mv.visitCode();
// logToErr("Method: " + method);
Label startLabel = new Label();
mv.visitLabel(startLabel);
for (JVMInstruction inst : method.instructions()) {
inst.accept_(this);
}
produceLocalVariableInfo(startLabel, method.locals());
mv.visitMaxs(0, 0);
mv.visitEnd();
}
Aggregations