Skip to content

Commit

Permalink
assert mutable global, correct fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Quodss committed Dec 15, 2024
1 parent 52b5af1 commit 2c5fd50
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/noun/jets/e/urwasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,12 @@ _reduce_monad(u3_noun monad, lia_state* sat)
return u3m_bail(c3__fail);
}

if (!glob->isMutable)
{
fprintf(stderr, ERR("global %s not mutable"), name_c);
return u3m_bail(c3__fail);
}

M3TaggedValue glob_value;
M3Result result = m3_GetGlobal(glob, &glob_value);
if (result)
Expand All @@ -570,12 +576,12 @@ _reduce_monad(u3_noun monad, lia_state* sat)
}
case c_m3Type_f32:
{
glob_value.value.i32 = u3r_word(0, value);
glob_value.value.f32 = u3r_word(0, value);
break;
}
case c_m3Type_f64:
{
glob_value.value.i64 = u3r_chub(0, value);
glob_value.value.f64 = u3r_chub(0, value);
break;
}
}
Expand Down

0 comments on commit 2c5fd50

Please sign in to comment.