static m_bool scoped_stmt(const Emitter emit, const Stmt stmt, const m_bool pop) {
++emit->env->scope->depth;
emit_push_scope(emit);
- const m_bool pure = !vector_back(&emit->info->pure);
- if(!pure)
- emit_add_instr(emit, GcIni);
+ const Instr gc = emit_add_instr(emit, NoOp);
CHECK_BB(emit_stmt(emit, stmt, pop))
- if(!pure)
+ const m_bool pure = !vector_back(&emit->info->pure);
+ if(!pure) {
+ gc->opcode = eGcIni;
emit_add_instr(emit, GcEnd);
+ }
emit_pop_scope(emit);
--emit->env->scope->depth;
return GW_OK;
#include "operator.h"
#include "import.h"
-ANN /*static*/ void free_code_instr(const Vector v, const Gwion gwion) {
+ANN void free_code_instr(const Vector v, const Gwion gwion) {
for(m_uint i = vector_size(v) + 1; --i;) {
const Instr instr = (Instr)vector_at(v, i - 1);
const f_freearg f = (f_freearg)(map_get(&gwion->data->freearg, instr->opcode) ?:
free_code_instr(v, gwion);
free_vector(gwion->mp, v);
}
+
ANN static void free_vm_code(VM_Code a, Gwion gwion) {
if(a->memoize)
memoize_end(gwion->mp, a->memoize);
if(instr->opcode < eGack)
memcpy(ptr + i*BYTECODE_SZ, instr, BYTECODE_SZ);
else {
+ if(instr->execute == NoOp)
+ continue;
*(m_bit*)(ptr + (i*BYTECODE_SZ)) = instr->opcode;
*(Instr*)(ptr + (i*BYTECODE_SZ) + SZ_INT) = instr;
*(f_instr*)(ptr + (i*BYTECODE_SZ) + SZ_INT*2) = instr->execute;