public override void Compile(Execution.VM.ByteCode bc) { Instruction meta = bc.Emit_FuncMeta("<chunk-root>"); int metaip = bc.GetJumpPointForLastInstruction(); bc.Emit_BeginFn(m_StackFrame); bc.Emit_Args(m_VarArgs); bc.Emit_Literal(DynValue.NewTable(m_GlobalEnv)); bc.Emit_Store(m_Env, 0, 0); bc.Emit_Pop(); m_Block.Compile(bc); bc.Emit_Ret(0); meta.NumVal = bc.GetJumpPointForLastInstruction() - metaip; }
public override void Compile(Execution.VM.ByteCode bc) { Instruction meta = bc.Emit_Meta("<chunk-root>", OpCodeMetadataType.ChunkEntrypoint); int metaip = bc.GetJumpPointForLastInstruction(); bc.Emit_BeginFn(m_StackFrame); bc.Emit_Args(m_VarArgs); bc.Emit_Load(SymbolRef.Upvalue(WellKnownSymbols.ENV, 0)); bc.Emit_Store(m_Env, 0, 0); bc.Emit_Pop(); m_Block.Compile(bc); bc.Emit_Ret(0); meta.NumVal = bc.GetJumpPointForLastInstruction() - metaip; }
public override void Compile(Execution.VM.ByteCode bc) { var envVal = DynValue.NewTable(m_GlobalEnv); Instruction meta = bc.Emit_Meta("<chunk-root>", OpCodeMetadataType.ChunkEntrypoint, envVal); int metaip = bc.GetJumpPointForLastInstruction(); bc.Emit_BeginFn(m_StackFrame); bc.Emit_Args(m_VarArgs); bc.Emit_Literal(envVal); bc.Emit_Store(m_Env, 0, 0); bc.Emit_Pop(); m_Block.Compile(bc); bc.Emit_Ret(0); meta.NumVal = bc.GetJumpPointForLastInstruction() - metaip; }
public void CompileAssignment(Execution.VM.ByteCode bc, int stackofs, int tupleidx) { bc.Emit_Store(m_Ref, stackofs, tupleidx); }
public override void Compile(Execution.VM.ByteCode bc) { using (bc.EnterSource(m_SourceRef)) { if (m_Local) { bc.Emit_Literal(DynValue.Nil); bc.Emit_Store(m_FuncSymbol, 0, 0); m_FuncDef.Compile(bc, () => SetFunction(bc, 2), m_FriendlyName); } else if (m_MethodName == null) { m_FuncDef.Compile(bc, () => SetFunction(bc, 1), m_FriendlyName); } else { m_FuncDef.Compile(bc, () => SetMethod(bc), m_FriendlyName); } } }
private int SetFunction(Execution.VM.ByteCode bc, int numPop) { int num = bc.Emit_Store(m_FuncSymbol, 0, 0); bc.Emit_Pop(numPop); return num + 1; }