public static int Execute(AsyncStackInfo stackInfo, LClosure closure, int argOffset, int argSize) { //C#-Lua boundary: before. var frame = stackInfo.StackFrame; StackFrameValues values = default; values.Span = stackInfo.Thread.GetFrameValues(in frame.Data); //Set up argument type info for Lua function. var sig = new StackSignatureState(argOffset, argSize); try { //For simplicity, C#-Lua call always passes arguments in same segment. InterpreterLoop(stackInfo.Thread, closure, frame, ref sig, forceOnSameSeg: true); } catch (RecoverableException) { //TODO recover throw new NotImplementedException(); } catch (OverflowException) { //TODO check whether the last frame is Lua frame and currently executing //an int instruction. If so, deoptimize the function and recover. throw; } catch { //TODO unrolled Lua frames (deallocate, clear values). throw; } //C#-Lua boundary: after. Debug.Assert(!sig.Type.IsNull); if (sig.Type.GlobalId != (ulong)WellKnownStackSignature.EmptyV) { if (sig.Type.IsUnspecialized) { sig.VLength = sig.TotalSize; } else { sig.Type.AdjustStackToUnspecialized(in values, ref sig.VLength); } sig.Type = StackSignature.EmptyV; } return(sig.VLength); }
public StackInfo(AsyncStackInfo asyncStackInfo) { AsyncStackInfo = asyncStackInfo; Values.Span = AsyncStackInfo.GetFrameValues(); }