use of st.gravel.support.compiler.jvm.JVMLocalDeclaration in project gravel by gravel-st.
the class JVMClassCompiler method compileClinit.
public JVMClassCompiler compileClinit() {
final List<JVMInstruction>[] _instructions;
_instructions = new List[1];
_instructions[0] = new java.util.ArrayList();
for (final JVMMethodConstant _each : _constants) {
st.gravel.support.jvm.OrderedCollectionExtensions.addAll_(_instructions[0], _each.clinitInstructions());
_fields.add(_each.fieldDefinition());
}
_instructions[0].add(Return.factory.basicNew());
_jvmMethods.add(JVMMethod.factory.name_locals_instructions_isStatic_signature_("<clinit>", new JVMLocalDeclaration[] {}, _instructions[0].toArray(new JVMInstruction[_instructions[0].size()]), true, JVMMethodType.factory.r_void()));
return this;
}
use of st.gravel.support.compiler.jvm.JVMLocalDeclaration in project gravel by gravel-st.
the class JVMClassCompiler method compileAstInit.
public JVMClassCompiler compileAstInit() {
final List<JVMInstruction>[] _instructions;
final int[] _i;
_i = new int[1];
_instructions = new List[1];
_instructions[0] = new java.util.ArrayList();
_i[0] = 0;
for (final BlockSendArgument _each : _astConstants) {
final JVMType _type;
_type = JVMDynamicObjectType.factory.basicNew();
_instructions[0].add(ALoad.factory.index_type_(_i[0], _type));
_instructions[0].add(PutStatic.factory.ownerType_name_type_(_ownerType, _each.name(), _type));
_i[0] = ((_i[0]) + 1);
_fields.add(JVMField.factory.ownerType_varName_type_isStatic_(_ownerType, _each.name(), _type, true));
}
_instructions[0].add(Return.factory.basicNew());
_jvmMethods.add(JVMMethod.factory.name_locals_instructions_isStatic_signature_("_astinit", new JVMLocalDeclaration[] {}, _instructions[0].toArray(new JVMInstruction[_instructions[0].size()]), true, JVMMethodType.factory.voidDynamic_(_astConstants.size())));
return this;
}
use of st.gravel.support.compiler.jvm.JVMLocalDeclaration in project gravel by gravel-st.
the class JVMMethodCompiler method newFrame_.
public Frame newFrame_(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;
this.reset();
_locals = st.gravel.support.jvm.DictionaryExtensions.copy(_oldLocals);
_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.JVMLocalDeclaration in project gravel by gravel-st.
the class JVMMethodCompiler method localOrCopiedAt_.
public JVMVariable localOrCopiedAt_(final String _varName) {
final JVMLocalDeclaration _local;
JVMLocalDeclaration _temp1 = _locals.get(_varName);
_local = ((JVMLocalDeclaration) _temp1);
if (_local != null) {
return _local;
}
return _copiedVariables.get(_varName);
}
use of st.gravel.support.compiler.jvm.JVMLocalDeclaration in project gravel by gravel-st.
the class JVMMethodCompiler method reset.
public JVMMethodCompiler reset() {
_locals = new java.util.HashMap<String, JVMLocalDeclaration>();
_stack = JVMStack.factory.basicNew();
_instructions = new java.util.ArrayList();
return this;
}
Aggregations