Skip to content

Commit

Permalink
partial resolution to issue #40
Browse files Browse the repository at this point in the history
  • Loading branch information
soundandform committed Jan 14, 2020
1 parent c710d04 commit 4783048
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions source/m3_compile.c
Expand Up @@ -655,11 +655,21 @@ M3Result IsLocalReferencedWithCurrentBlock (IM3Compilation o, u16 * o_preserve
{
M3Result result = m3Err_none;

// printf ("IsLocalReferenced: %d --> %d\n", o->block.initStackIndex, o->stackIndex);

IM3CompilationScope scope = & o->block;
i16 startIndex = scope->initStackIndex;

while (scope->opcode == c_waOp_block)
{
scope = scope->outer;
if (not scope)
break;

startIndex = scope->initStackIndex;
}

* o_preservedStackIndex = (u16) i_localIndex;

for (u32 i = o->block.initStackIndex; i < o->stackIndex; ++i)
for (u32 i = startIndex; i < o->stackIndex; ++i)
{
if (o->wasmStack [i] == i_localIndex)
{
Expand Down

0 comments on commit 4783048

Please sign in to comment.