]> Nishi Git Mirror - gwion.git/commitdiff
Update
authorJérémie Astor <fennecdjay@gmail.com>
Tue, 18 May 2021 19:41:51 +0000 (21:41 +0200)
committerJérémie Astor <fennecdjay@gmail.com>
Tue, 18 May 2021 19:41:51 +0000 (21:41 +0200)
scripts/nanorc.sh
src/emit/emit.c
src/vm/vm.c
util

index 909cc3e96d3694678ae4967651f35e60fc2626e4..4f8f08747d6d0bb1a005e63c2f0b219fd71cc65c 100644 (file)
@@ -125,7 +125,7 @@ color italic,green "\<(protected|private)\>"
 color bold,green "\<(var|late|const)\>"
 color bold,italic,green "\<(const)\>"
 
-color bold,yellow "\<(for|until|if|while|do|else|match|case|when|where|defer)\>"
+color bold,yellow "\<(for|foreach|repeat|until|if|while|do|else|match|case|when|where|defer)\>"
 color magenta "\<(goto|continue|break|return)\>"
 
 ## Comment highlighting
index 80f2dc7cde39d3f9625175f8a6bf1c88b2d27e7b..5e3ed476054037c12f0d930ac838f71182d87856 100644 (file)
@@ -1789,18 +1789,18 @@ ANN static inline m_bool unroll_run(const Emitter emit, const struct Looper *loo
 }
 
 ANN static m_bool unroll(const Emitter emit, const struct Looper *loop) {
+  const Instr gc = scoped_ini(emit);
   const Instr unroll = emit_add_instr(emit, Unroll);
   unroll->m_val = loop->offset;
   const m_uint start = emit_code_size(emit);
-  const Instr gc = scoped_ini(emit);
   CHECK_BB(unroll_run(emit, loop));
   const m_uint end = emit_code_size(emit);
   for(m_uint i = 1; i < loop->n; ++i)
     CHECK_BB(unroll_run(emit, loop));
   unroll->m_val2 = end - start;
-  scoped_end(emit, gc);
   const Instr unroll2 = emit_add_instr(emit, Unroll2);
   unroll2->m_val = (m_uint)unroll;
+  scoped_end(emit, gc);
   return GW_OK;
 }
 
@@ -1884,9 +1884,8 @@ ANN static m_bool _emit_stmt_loop(const Emitter emit, const Stmt_Loop stmt, m_ui
     emit_local(emit, emit->gwion->type[et_int]);
   CHECK_BB(emit_exp_pop_next(emit, stmt->cond));
   regpop(emit, SZ_INT);
-// set mem
   const Instr tomem = emit_add_instr(emit, Reg2Mem);
-  tomem->m_val = offset + !stmt->idx ? 0 : SZ_INT;
+  tomem->m_val = offset + (!stmt->idx ? 0 : SZ_INT);
   *index = emit_code_size(emit);
   struct Looper loop = { .stmt=stmt->body, .offset=offset, .n=n,
     .roll= !stmt->idx ? stmt_loop_roll : stmt_loop_roll_idx};
index 06f4cd8b6d9beb80cfb91ea97e4dc5dae7c62f4a..902013ace73ed414e4e8990eb876954741e8f430 100644 (file)
@@ -806,7 +806,7 @@ unroll:
        DISPATCH()
     }
     *(m_uint*)(mem + VAL) = 0;
-    PC_DISPATCH(PC + VAL2*(idx));
+    PC_DISPATCH(PC + VAL2*(idx+1));
   }
   PC_DISPATCH(PC + VAL2 *n + 1);
 }
diff --git a/util b/util
index c51704848c29ab1934021f94ee2ece981e6e8468..7f657c4d12c8a4362d26b1976ddca5de2324d60a 160000 (submodule)
--- a/util
+++ b/util
@@ -1 +1 @@
-Subproject commit c51704848c29ab1934021f94ee2ece981e6e8468
+Subproject commit 7f657c4d12c8a4362d26b1976ddca5de2324d60a