Skip to content

Commit

Permalink
Ditching off IDeferSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
pachanga committed Jan 8, 2025
1 parent 5d6f054 commit 62c97d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
28 changes: 4 additions & 24 deletions src/vm/block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ public enum BlockType
DOWHILE = 10,
}

public interface IDeferSupport
{
void RegisterDefer(DeferBlock cb);
}

public struct DeferBlock
{
public VM.Frame frm;
Expand Down Expand Up @@ -82,7 +77,7 @@ public override string ToString()
}
}

public class SeqBlock : Coroutine, IDeferSupport, IInspectableCoroutine
public class SeqBlock : Coroutine, IInspectableCoroutine
{
public VM.ExecState exec = new VM.ExecState();
public List<DeferBlock> defers = new List<DeferBlock>(2);
Expand Down Expand Up @@ -136,14 +131,9 @@ public static void ExitScope(VM.Frame frm, VM.ExecState exec, List<DeferBlock> d

DeferBlock.ExitScope(defers, exec);
}

public void RegisterDefer(DeferBlock dfb)
{
defers.Add(dfb);
}
}

public class ParalBranchBlock : Coroutine, IDeferSupport, IInspectableCoroutine
public class ParalBranchBlock : Coroutine, IInspectableCoroutine
{
public int min_ip;
public int max_ip;
Expand Down Expand Up @@ -199,14 +189,9 @@ public override void Cleanup(VM.Frame frm, VM.ExecState _)
}
stack.Clear();
}

public void RegisterDefer(DeferBlock dfb)
{
defers.Add(dfb);
}
}

public class ParalBlock : Coroutine, IBranchyCoroutine, IDeferSupport, IInspectableCoroutine
public class ParalBlock : Coroutine, IBranchyCoroutine, IInspectableCoroutine
{
public int min_ip;
public int max_ip;
Expand Down Expand Up @@ -270,14 +255,9 @@ public void Attach(ICoroutine coro)
{
branches.Add((Coroutine)coro);
}

public void RegisterDefer(DeferBlock dfb)
{
defers.Add(dfb);
}
}

public class ParalAllBlock : Coroutine, IBranchyCoroutine, IDeferSupport, IInspectableCoroutine
public class ParalAllBlock : Coroutine, IBranchyCoroutine, IInspectableCoroutine
{
public int min_ip;
public int max_ip;
Expand Down
7 changes: 1 addition & 6 deletions src/vm/vm.frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace bhl {

public partial class VM : INamedResolver
{
public class Frame : IDeferSupport
public class Frame
{
public const int MAX_LOCALS = 64;
public const int MAX_STACK = 32;
Expand Down Expand Up @@ -132,11 +132,6 @@ internal void Clear()
defers.Clear();
}

public void RegisterDefer(DeferBlock dfb)
{
defers.Add(dfb);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ExitScope(VM.Frame _, ExecState exec)
{
Expand Down

0 comments on commit 62c97d0

Please sign in to comment.