public static int GetSize(StackOpd so) { switch (so) { case StackOpd.i32: case StackOpd.f32: return(4); case StackOpd.i64: case StackOpd.f64: return(8); } throw new System.Exception("Cannot get variable stack size of unknown type."); }
public StackOpd PopOpd(bool ending = false) { if (ending == false) { if (this.opds.Count == this.ctrls.Peek().height&& this.ctrls.Peek().unreachable == true) { return(StackOpd.Unknown); } if (this.opds.Count == this.ctrls.Peek().height) { this.EmitValidationError("Operation stack mismatch."); } } StackOpd ret = this.opds[this.opds.Count - 1]; this.opds.RemoveAt(this.opds.Count - 1); return(ret); }
public StackOpd PopOpd(StackOpd expect, bool ending = false) { StackOpd actual = this.PopOpd(ending); if (actual == StackOpd.Unknown) { return(expect); } if (expect == StackOpd.Unknown) { return(actual); } if (actual != expect) { this.EmitValidationError($"Incorrect type {actual} when expecting {expect}."); } return(actual); }
public StackOpd PopOpd(Bin.TypeID expect) { StackOpd soexp = ConvertToStackType(expect); return(this.PopOpd(soexp)); }
public void PushOpd(Bin.TypeID ty) { StackOpd so = ConvertToStackType(ty); this.PushOpd(so); }
public void PushOpd(StackOpd so) { this.opds.Add(so); }