Skip to content

Commit

Permalink
Storing last active fiber in VM for tracing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
pachanga committed Mar 16, 2022
1 parent 981c7dc commit f5e6fb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/storage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ static public Val New(VM vm)
Val dv;
if(vm.vals_pool.stack.Count == 0)
{
//for debug
//if(vm.vals_pool.miss > 200)
//{
// if(vm.last_fiber != null)
// Util.Debug(vm.last_fiber.GetStackTrace());
//}

++vm.vals_pool.miss;
dv = new Val(vm);
#if DEBUG_REFS
Expand Down
3 changes: 3 additions & 0 deletions src/vm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ public struct ModuleAddr

int fibers_ids = 0;
List<Fiber> fibers = new List<Fiber>();
public Fiber last_fiber = null;

IModuleLoader loader;

Expand Down Expand Up @@ -1940,6 +1941,8 @@ public bool Tick(Fiber fb)

try
{
last_fiber = fb;

++fb.tick;
fb.status = Execute(
ref fb.ip, fb.ctx_frames,
Expand Down

0 comments on commit f5e6fb3

Please sign in to comment.