guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 02/02: Update comments in vm-engine.c


From: Andy Wingo
Subject: [Guile-commits] 02/02: Update comments in vm-engine.c
Date: Sat, 22 Sep 2018 12:49:49 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit a74b4a45fab1a78e34954bce5f031e8a9765f827
Author: Andy Wingo <address@hidden>
Date:   Sat Sep 22 18:42:27 2018 +0200

    Update comments in vm-engine.c
    
    * libguile/jit.c (compile_s64_numerically_equal): Remove as this
    instruction was removed in previous refactoring.
    (compile_atomic_scm_set_immediate), compile_atomic_scm_ref_immediate):
    Adapt to change in C name of these instructions.
    * libguile/vm-engine.c: Add comments for all instructions.
---
 libguile/jit.c       |  10 +-
 libguile/vm-engine.c | 492 ++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 453 insertions(+), 49 deletions(-)

diff --git a/libguile/jit.c b/libguile/jit.c
index 92782c9..8ef570f 100644
--- a/libguile/jit.c
+++ b/libguile/jit.c
@@ -2449,7 +2449,7 @@ compile_untag_char (scm_jit_state *j, uint16_t dst, 
uint16_t src)
 }
 
 static void
-compile_atomic_ref_scm_immediate (scm_jit_state *j, uint8_t dst, uint8_t obj, 
uint8_t offset)
+compile_atomic_scm_ref_immediate (scm_jit_state *j, uint8_t dst, uint8_t obj, 
uint8_t offset)
 {
   emit_sp_ref_scm (j, T0, obj);
 #if defined(__i386__) || defined(__x86_64__)
@@ -2467,7 +2467,7 @@ compile_atomic_ref_scm_immediate (scm_jit_state *j, 
uint8_t dst, uint8_t obj, ui
 }
 
 static void
-compile_atomic_set_scm_immediate (scm_jit_state *j, uint8_t obj, uint8_t 
offset, uint8_t val)
+compile_atomic_scm_set_immediate (scm_jit_state *j, uint8_t obj, uint8_t 
offset, uint8_t val)
 {
   emit_sp_ref_scm (j, T1, obj);
   emit_sp_ref_scm (j, T2, val);
@@ -3152,12 +3152,6 @@ compile_u64_less (scm_jit_state *j, uint16_t a, uint16_t 
b)
 }
 
 static void
-compile_s64_numerically_equal (scm_jit_state *j, uint16_t a, uint16_t b)
-{
-  compile_u64_numerically_equal (j, a, b);
-}
-
-static void
 compile_s64_less (scm_jit_state *j, uint16_t a, uint16_t b)
 {
   uint32_t *target;
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 542cac4..7230f38 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -350,7 +350,7 @@ VM_NAME (scm_thread *thread)
   /* instrument-entry _:24 data:32
    *
    * Increase execution counter for this function and potentially tier
-   * up to the next JIT level.  DATA is an offset to raw profiler,
+   * up to the next JIT level.  DATA is an offset to a structure
    * recording execution counts and the next-level JIT code
    * corresponding to this function.  Also run the apply hook.
    */
@@ -399,7 +399,7 @@ VM_NAME (scm_thread *thread)
   /* instrument-loop _:24 data:32
    *
    * Increase execution counter for this function and potentially tier
-   * up to the next JIT level.  DATA is an offset to raw profiler,
+   * up to the next JIT level.  DATA is an offset to a structure
    * recording execution counts and the next-level JIT code
    * corresponding to this function.
    */
@@ -438,7 +438,7 @@ VM_NAME (scm_thread *thread)
   /* call proc:24 _:8 nlocals:24
    *
    * Call a procedure.  PROC is the local corresponding to a procedure.
-   * The two values below PROC will be overwritten by the saved call
+   * The three values below PROC will be overwritten by the saved call
    * frame data.  The new frame will have space for NLOCALS locals: one
    * for the procedure, and the rest for the arguments which should
    * already have been pushed on.
@@ -446,7 +446,7 @@ VM_NAME (scm_thread *thread)
    * When the call returns, execution proceeds with the next
    * instruction.  There may be any number of values on the return
    * stack; the precise number can be had by subtracting the address of
-   * PROC from the post-call SP.
+   * slot PROC-1 from the post-call SP.
    */
   VM_DEFINE_OP (3, call, "call", OP2 (X8_F24, X8_C24))
     {
@@ -477,8 +477,8 @@ VM_NAME (scm_thread *thread)
    * This instruction is just like "call", except that instead of
    * dereferencing PROC to find the call target, the call target is
    * known to be at LABEL, a signed 32-bit offset in 32-bit units from
-   * the current IP.  Since PROC is not dereferenced, it may be some
-   * other representation of the closure.
+   * the current IP.  Since PROC is not used to compute the callee code,
+   * it may be some other representation of the closure.
    */
   VM_DEFINE_OP (4, call_label, "call-label", OP3 (X8_F24, X8_C24, L32))
     {
@@ -656,6 +656,12 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* arguments<=? expected:24
+   *
+   * Set the LESS_THAN, EQUAL, or NONE comparison result values if the
+   * number of arguments is respectively less than, equal to, or greater
+   * than EXPECTED.
+   */
   VM_DEFINE_OP (14, check_arguments, "arguments<=?", OP1 (X8_C24))
     {
       uint8_t compare_result;
@@ -677,6 +683,13 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* positional-arguments<=? nreq:24 _:8 expected:24
+   *
+   * Set the LESS_THAN, EQUAL, or NONE comparison result values if the
+   * number of positional arguments is less than, equal to, or greater
+   * than EXPECTED.  The first NREQ arguments are positional arguments,
+   * as are the subsequent arguments that are not keywords.
+   */
   VM_DEFINE_OP (15, check_positional_arguments, "positional-arguments<=?", OP2 
(X8_C24, X8_C24))
     {
       uint8_t compare_result;
@@ -786,9 +799,8 @@ VM_NAME (scm_thread *thread)
 
   /* alloc-frame nlocals:24
    *
-   * Ensure that there is space on the stack for NLOCALS local variables,
-   * setting them all to SCM_UNDEFINED, except those nargs values that
-   * were passed as arguments and procedure.
+   * Ensure that there is space on the stack for NLOCALS local variables.
+   * setting any new stack slots to SCM_UNDEFINED.
    */
   VM_DEFINE_OP (18, alloc_frame, "alloc-frame", OP1 (X8_C24))
     {
@@ -805,9 +817,10 @@ VM_NAME (scm_thread *thread)
 
   /* reset-frame nlocals:24
    *
-   * Like alloc-frame, but doesn't check that the stack is big enough.
-   * Used to reset the frame size to something less than the size that
-   * was previously set via alloc-frame.
+   * Like alloc-frame, but doesn't check that the stack is big enough,
+   * and doesn't reset stack slots to SCM_UNDEFINED.  Used to reset the
+   * frame size to something less than the size that was previously set
+   * via alloc-frame.
    */
   VM_DEFINE_OP (19, reset_frame, "reset-frame", OP1 (X8_C24))
     {
@@ -965,10 +978,10 @@ VM_NAME (scm_thread *thread)
 
   /* subr-call idx:24
    *
-   * Call a subr, passing all locals in this frame as arguments.  Return
-   * from the calling frame.  This instruction is part of the
-   * trampolines created in gsubr.c, and is not generated by the
-   * compiler.
+   * Call a subr, passing all locals in this frame as arguments, and
+   * storing the results on the stack, ready to be returned.  This
+   * instruction is part of the trampolines created in gsubr.c, and is
+   * not generated by the compiler.
    */
   VM_DEFINE_OP (28, subr_call, "subr-call", OP1 (X8_C24))
     {
@@ -997,10 +1010,10 @@ VM_NAME (scm_thread *thread)
   /* foreign-call cif-idx:12 ptr-idx:12
    *
    * Call a foreign function.  Fetch the CIF and foreign pointer from
-   * CIF-IDX and PTR-IDX, both free variables.  Return from the calling
-   * frame.  Arguments are taken from the stack.  This instruction is
-   * part of the trampolines created by the FFI, and is not generated by
-   * the compiler.
+   * the CIF-IDX and PTR-IDX closure slots of the callee.  Arguments are
+   * taken from the stack, and results placed on the stack, ready to be
+   * returned.  This instruction is part of the trampolines created by
+   * the FFI, and is not generated by the compiler.
    */
   VM_DEFINE_OP (29, foreign_call, "foreign-call", OP1 (X8_C12_C12))
     {
@@ -1289,7 +1302,11 @@ VM_NAME (scm_thread *thread)
       NEXT (0);
     }
 
-
+  /* call-thread _:24 IDX:32
+   *
+   * Call the void-returning instrinsic with index IDX, passing the
+   * current scm_thread* as the argument.
+   */
   VM_DEFINE_OP (41, call_thread, "call-thread", OP2 (X32, C32))
     {
       scm_t_thread_intrinsic intrinsic;
@@ -1303,6 +1320,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-thread-scm a:24 IDX:32
+   *
+   * Call the void-returning instrinsic with index IDX, passing the
+   * current scm_thread* and the SCM local A as arguments.
+   */
   VM_DEFINE_OP (42, call_thread_scm, "call-thread-scm", OP2 (X8_S24, C32))
     {
       uint32_t a;
@@ -1318,6 +1340,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-thread-scm-scm a:12 b:12 IDX:32
+   *
+   * Call the void-returning instrinsic with index IDX, passing the
+   * current scm_thread* and the SCM locals A and B as arguments.
+   */
   VM_DEFINE_OP (43, call_thread_scm_scm, "call-thread-scm-scm", OP2 
(X8_S12_S12, C32))
     {
       uint16_t a, b;
@@ -1333,6 +1360,13 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-scm-sz-u32 a:8 b:8 c:8 IDX:32
+   *
+   * Call the void-returning instrinsic with index IDX, passing the
+   * locals A, B, and C as arguments.  A is a SCM value, while B and C
+   * are raw u64 values which fit into size_t and uint32_t types,
+   * respectively.
+   */
   VM_DEFINE_OP (44, call_scm_sz_u32, "call-scm-sz-u32", OP2 (X8_S8_S8_S8, C32))
     {
       uint8_t a, b, c;
@@ -1348,6 +1382,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-thread dst:24 IDX:32
+   *
+   * Call the SCM-returning instrinsic with index IDX, passing the
+   * current scm_thread* as argument.  Place the SCM result in DST.
+   */
   VM_DEFINE_OP (45, call_scm_from_thread, "call-scm<-thread", DOP2 (X8_S24, 
C32))
     {
       uint32_t dst;
@@ -1366,6 +1405,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-s64<-scm dst:12 a:12 IDX:32
+   *
+   * Call the int64_t-returning instrinsic with index IDX, passing the
+   * SCM local A as argument.  Place the s64 result in DST.
+   */
   VM_DEFINE_OP (46, call_s64_from_scm, "call-s64<-scm", DOP2 (X8_S12_S12, C32))
     {
       uint16_t dst, src;
@@ -1391,6 +1435,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-scm<-u64 dst:12 a:12 IDX:32
+   *
+   * Call the SCM-returning instrinsic with index IDX, passing the
+   * uint64_t local A as argument.  Place the SCM result in DST.
+   */
   VM_DEFINE_OP (47, call_scm_from_u64, "call-scm<-u64", DOP2 (X8_S12_S12, C32))
     {
       uint16_t dst, src;
@@ -1415,6 +1464,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-scm<-s64 dst:12 a:12 IDX:32
+   *
+   * Call the SCM-returning instrinsic with index IDX, passing the
+   * int64_t local A as argument.  Place the SCM result in DST.
+   */
   VM_DEFINE_OP (48, call_scm_from_s64, "call-scm<-s64", DOP2 (X8_S12_S12, C32))
     {
       uint16_t dst, src;
@@ -1436,6 +1490,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-scm<-scm dst:12 a:12 IDX:32
+   *
+   * Call the SCM-returning instrinsic with index IDX, passing the SCM
+   * local A as argument.  Place the SCM result in DST.
+   */
   VM_DEFINE_OP (49, call_scm_from_scm, "call-scm<-scm", DOP2 (X8_S12_S12, C32))
     {
       uint16_t dst, src;
@@ -1453,6 +1512,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-f64<-scm dst:12 a:12 IDX:32
+   *
+   * Call the double-returning instrinsic with index IDX, passing the
+   * SCM local A as argument.  Place the f64 result in DST.
+   */
   VM_DEFINE_OP (50, call_f64_from_scm, "call-f64<-scm", DOP2 (X8_S12_S12, C32))
     {
       uint16_t dst, src;
@@ -1470,6 +1534,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-u64<-scm dst:12 a:12 IDX:32
+   *
+   * Call the uint64_t-returning instrinsic with index IDX, passing the
+   * SCM local A as argument.  Place the u64 result in DST.
+   */
   VM_DEFINE_OP (51, call_u64_from_scm, "call-u64<-scm", DOP2 (X8_S12_S12, C32))
     {
       uint16_t dst, src;
@@ -1495,6 +1564,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-scm<-scm-scm dst:8 a:8 b:8 IDX:32
+   *
+   * Call the SCM-returning instrinsic with index IDX, passing the SCM
+   * locals A and B as arguments.  Place the SCM result in DST.
+   */
   VM_DEFINE_OP (52, call_scm_from_scm_scm, "call-scm<-scm-scm", DOP2 
(X8_S8_S8_S8, C32))
     {
       uint8_t dst, a, b;
@@ -1512,6 +1586,12 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-scm<-scm-uimm dst:8 a:8 b:8 IDX:32
+   *
+   * Call the SCM-returning instrinsic with index IDX, passing the SCM
+   * local A and the uint8_t immediate B as arguments.  Place the SCM
+   * result in DST.
+   */
   VM_DEFINE_OP (53, call_scm_from_scm_uimm, "call-scm<-scm-uimm", DOP2 
(X8_S8_S8_C8, C32))
     {
       uint8_t dst, a, b;
@@ -1529,6 +1609,12 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-scm<-thread-scm dst:12 a:12 IDX:32
+   *
+   * Call the SCM-returning instrinsic with index IDX, passing the
+   * current scm_thread* and SCM local A as arguments.  Place the SCM
+   * result in DST.
+   */
   VM_DEFINE_OP (54, call_scm_from_thread_scm, "call-scm<-thread-scm", DOP2 
(X8_S12_S12, C32))
     {
       uint16_t dst, src;
@@ -1547,6 +1633,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* call-scm<-scm-u64 dst:8 a:8 b:8 IDX:32
+   *
+   * Call the SCM-returning instrinsic with index IDX, passing SCM local
+   * A and u64 local B as arguments.  Place the SCM result in DST.
+   */
   VM_DEFINE_OP (55, call_scm_from_scm_u64, "call-scm<-scm-u64", DOP2 
(X8_S8_S8_S8, C32))
     {
       uint8_t dst, a, b;
@@ -1738,6 +1829,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* allocate-words dst:12 count:12
+   *
+   * Allocate a fresh GC-traced object consisting of COUNT words and
+   * store it into DST.  COUNT is a u64 local.
+   */
   VM_DEFINE_OP (65, allocate_words, "allocate-words", DOP1 (X8_S12_S12))
     {
       uint16_t dst, size;
@@ -1749,6 +1845,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* allocate-words/immediate dst:12 count:12
+   *
+   * Allocate a fresh GC-traced object consisting of COUNT words and
+   * store it into DST.  COUNT is an immediate.
+   */
   VM_DEFINE_OP (66, allocate_words_immediate, "allocate-words/immediate", DOP1 
(X8_S12_C12))
     {
       uint16_t dst, size;
@@ -1761,6 +1862,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* scm-ref dst:8 obj:8 idx:8
+   *
+   * Load the SCM object at word offset IDX from local OBJ, and store it
+   * to DST.
+   */
   VM_DEFINE_OP (67, scm_ref, "scm-ref", DOP1 (X8_S8_S8_S8))
     {
       uint8_t dst, obj, idx;
@@ -1772,6 +1878,10 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* scm-set! obj:8 idx:8 val:8
+   *
+   * Store the SCM local VAL into object OBJ at word offset IDX.
+   */
   VM_DEFINE_OP (68, scm_set, "scm-set!", OP1 (X8_S8_S8_S8))
     {
       uint8_t obj, idx, val;
@@ -1783,6 +1893,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* scm-ref/tag dst:8 obj:8 tag:8
+   *
+   * Reference the first word of OBJ, subtract the immediate TAG, and
+   * store the resulting SCM to DST.
+   */
   VM_DEFINE_OP (69, scm_ref_tag, "scm-ref/tag", DOP1 (X8_S8_S8_C8))
     {
       uint8_t dst, obj, tag;
@@ -1794,6 +1909,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* scm-ref/tag dst:8 obj:8 tag:8
+   *
+   * Reference the first word of OBJ, subtract the immediate TAG, and
+   * store the resulting SCM to DST.
+   */
   VM_DEFINE_OP (70, scm_set_tag, "scm-set!/tag", OP1 (X8_S8_C8_S8))
     {
       uint8_t obj, tag, val;
@@ -1805,6 +1925,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* scm-ref/immediate dst:8 obj:8 idx:8
+   *
+   * Load the SCM object at word offset IDX from local OBJ, and store it
+   * to DST.  IDX is a uint8_t immediate.
+   */
   VM_DEFINE_OP (71, scm_ref_immediate, "scm-ref/immediate", DOP1 (X8_S8_S8_C8))
     {
       uint8_t dst, obj, idx;
@@ -1816,6 +1941,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* scm-set!/immediate obj:8 idx:8 val:8
+   *
+   * Store the SCM local VAL into object OBJ at word offset IDX.  IDX is
+   * a uint8_t immediate.
+   */
   VM_DEFINE_OP (72, scm_set_immediate, "scm-set!/immediate", OP1 (X8_S8_C8_S8))
     {
       uint8_t obj, idx, val;
@@ -1827,6 +1957,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* word-ref dst:8 obj:8 idx:8
+   *
+   * Load the word at offset IDX from local OBJ, and store it to u64
+   * DST.
+   */
   VM_DEFINE_OP (73, word_ref, "word-ref", DOP1 (X8_S8_S8_S8))
     {
       uint8_t dst, obj, idx;
@@ -1838,6 +1973,10 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* word-set! obj:8 idx:8 val:8
+   *
+   * Store the u64 local VAL into object OBJ at word offset IDX.
+   */
   VM_DEFINE_OP (74, word_set, "word-set!", OP1 (X8_S8_S8_S8))
     {
       uint8_t obj, idx, val;
@@ -1849,6 +1988,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* word-ref/immediate dst:8 obj:8 idx:8
+   *
+   * Load the word at offset IDX from local OBJ, and store it to u64
+   * DST.  IDX is a uint8_t immediate.
+   */
   VM_DEFINE_OP (75, word_ref_immediate, "word-ref/immediate", DOP1 
(X8_S8_S8_C8))
     {
       uint8_t dst, obj, idx;
@@ -1860,6 +2004,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* word-set!/immediate obj:8 idx:8 val:8
+   *
+   * Store the u64 local VAL into object OBJ at word offset IDX.  IDX is
+   * a uint8_t immediate.
+   */
   VM_DEFINE_OP (76, word_set_immediate, "word-set!/immediate", OP1 
(X8_S8_C8_S8))
     {
       uint8_t obj, idx, val;
@@ -1871,6 +2020,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* pointer-ref/immediate dst:8 obj:8 idx:8
+   *
+   * Load the pointer at offset IDX from local OBJ, and store it to DST.
+   * IDX is a uint8_t immediate.
+   */
   VM_DEFINE_OP (77, pointer_ref_immediate, "pointer-ref/immediate", DOP1 
(X8_S8_S8_C8))
     {
       uint8_t dst, obj, idx;
@@ -1882,6 +2036,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* pointer-set!/immediate obj:8 idx:8 val:8
+   *
+   * Store the pointer local VAL into object OBJ at offset IDX.  IDX is
+   * a uint8_t immediate.
+   */
   VM_DEFINE_OP (78, pointer_set_immediate, "pointer-set!/immediate", OP1 
(X8_S8_C8_S8))
     {
       uint8_t obj, idx, val;
@@ -1893,6 +2052,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* tail-pointer-ref/immediate dst:8 obj:8 idx:8
+   *
+   * Compute the address of word offset IDX from local OBJ, and store it
+   * to DST.  IDX is a uint8_t immediate.
+   */
   VM_DEFINE_OP (79, tail_pointer_ref_immediate, "tail-pointer-ref/immediate", 
DOP1 (X8_S8_S8_C8))
     {
       uint8_t dst, obj, idx;
@@ -1904,7 +2068,13 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
-  VM_DEFINE_OP (80, atomic_ref_scm_immediate, "atomic-scm-ref/immediate", DOP1 
(X8_S8_S8_C8))
+  /* scm-ref/immediate dst:8 obj:8 idx:8
+   *
+   * Atomically reference the SCM object at word offset IDX from local
+   * OBJ, and store it to DST, using the sequential consistency memory
+   * model.  IDX is a uint8_t immediate.
+   */
+  VM_DEFINE_OP (80, atomic_scm_ref_immediate, "atomic-scm-ref/immediate", DOP1 
(X8_S8_S8_C8))
     {
       uint8_t dst, obj, offset;
       SCM *loc;
@@ -1914,7 +2084,13 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
-  VM_DEFINE_OP (81, atomic_set_scm_immediate, "atomic-scm-set!/immediate", OP1 
(X8_S8_C8_S8))
+  /* atomic-scm-set!/immediate obj:8 idx:8 val:8
+   *
+   * Atomically store the SCM local VAL into object OBJ at word offset
+   * IDX, using the sequentially consistent memory model.  IDX is a
+   * uint8_t immediate.
+   */
+  VM_DEFINE_OP (81, atomic_scm_set_immediate, "atomic-scm-set!/immediate", OP1 
(X8_S8_C8_S8))
     {
       uint8_t obj, offset, val;
       SCM *loc;
@@ -1924,6 +2100,12 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* atomic-scm-swap!/immediate dst:24 _:8 obj:24 idx:8 val:24
+   *
+   * Atomically swap the SCM value stored in object OBJ at word offset
+   * IDX with VAL, using the sequentially consistent memory model.  IDX
+   * is a uint8_t immediate.  Return the previous value to DST.
+   */
   VM_DEFINE_OP (82, atomic_scm_swap_immediate, "atomic-scm-swap!/immediate", 
DOP3 (X8_S24, X8_S24, C8_S24))
     {
       uint32_t dst, obj, val;
@@ -1937,6 +2119,14 @@ VM_NAME (scm_thread *thread)
       NEXT (3);
     }
 
+  /* atomic-scm-compare-and-swap!/immediate dst:24 _:8 obj:24 idx:8 
expected:24 _:8 desired:24
+   *
+   * Atomically swap the SCM value stored in object OBJ at word offset
+   * IDX with DESIRED, if and only if the value that was there was
+   * EXPECTED, using the sequentially consistent memory model.  IDX is a
+   * uint8_t immediate.  Return the value that was stored at IDX from
+   * OBJ in DST.
+   */
   VM_DEFINE_OP (83, atomic_scm_compare_and_swap_immediate, 
"atomic-scm-compare-and-swap!/immediate", DOP4 (X8_S24, X8_S24, C8_S24, X8_S24))
     {
       uint32_t dst, obj, expected, desired;
@@ -2027,6 +2217,11 @@ VM_NAME (scm_thread *thread)
       NEXT (3);
     }
 
+  /* tag-char dst:12 src:12
+   *
+   * Make a SCM character whose integer value is the u64 in SRC, and
+   * store it in DST.
+   */
   VM_DEFINE_OP (87, tag_char, "tag-char", DOP1 (X8_S12_S12))
     {
       uint16_t dst, src;
@@ -2037,6 +2232,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* untag-char dst:12 src:12
+   *
+   * Extract the integer value from the SCM character SRC, and store the
+   * resulting u64 in DST.
+   */
   VM_DEFINE_OP (88, untag_char, "untag-char", DOP1 (X8_S12_S12))
     {
       uint16_t dst, src;
@@ -2045,6 +2245,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* tag-fixnum dst:12 src:12
+   *
+   * Make a SCM integer whose value is the s64 in SRC, and store it in
+   * DST.
+   */
   VM_DEFINE_OP (89, tag_fixnum, "tag-fixnum", DOP1 (X8_S12_S12))
     {
       uint16_t dst, src;
@@ -2056,6 +2261,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* untag-fixnum dst:12 src:12
+   *
+   * Extract the integer value from the SCM integer SRC, and store the
+   * resulting s64 in DST.
+   */
   VM_DEFINE_OP (90, untag_fixnum, "untag-fixnum", DOP1 (X8_S12_S12))
     {
       uint16_t dst, src;
@@ -2370,6 +2580,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* u64=? a:12 b:12
+   *
+   * Set the comparison result to EQUAL if the u64 values A and B are
+   * the same, or NONE otherwise.
+   */
   VM_DEFINE_OP (111, u64_numerically_equal, "u64=?", OP1 (X8_S12_S12))
     {
       uint16_t a, b;
@@ -2384,6 +2599,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* u64<? a:12 b:12
+   *
+   * Set the comparison result to LESS_THAN if the u64 value A is less
+   * than the u64 value B are the same, or NONE otherwise.
+   */
   VM_DEFINE_OP (112, u64_less, "u64<?", OP1 (X8_S12_S12))
     {
       uint16_t a, b;
@@ -2398,6 +2618,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* s64<? a:12 b:12
+   *
+   * Set the comparison result to LESS_THAN if the s64 value A is less
+   * than the s64 value B are the same, or NONE otherwise.
+   */
   VM_DEFINE_OP (113, s64_less, "s64<?", OP1 (X8_S12_S12))
     {
       uint16_t a, b;
@@ -2412,6 +2637,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* s64-imm=? a:12 b:12
+   *
+   * Set the comparison result to EQUAL if the s64 value A is equal to
+   * the immediate s64 value B, or NONE otherwise.
+   */
   VM_DEFINE_OP (114, s64_imm_numerically_equal, "s64-imm=?", OP1 (X8_S12_Z12))
     {
       uint16_t a;
@@ -2427,6 +2657,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* u64-imm<? a:12 b:12
+   *
+   * Set the comparison result to LESS_THAN if the u64 value A is less
+   * than the immediate u64 value B, or NONE otherwise.
+   */
   VM_DEFINE_OP (115, u64_imm_less, "u64-imm<?", OP1 (X8_S12_C12))
     {
       uint16_t a;
@@ -2440,6 +2675,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* imm-u64<? a:12 b:12
+   *
+   * Set the comparison result to LESS_THAN if the u64 immediate B is
+   * less than the u64 value A, or NONE otherwise.
+   */
   VM_DEFINE_OP (116, imm_u64_less, "imm-u64<?", OP1 (X8_S12_C12))
     {
       uint16_t a;
@@ -2453,6 +2693,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* s64-imm<? a:12 b:12
+   *
+   * Set the comparison result to LESS_THAN if the s64 value A is less
+   * than the immediate s64 value B, or NONE otherwise.
+   */
   VM_DEFINE_OP (117, s64_imm_less, "s64-imm<?", OP1 (X8_S12_Z12))
     {
       uint16_t a;
@@ -2468,6 +2713,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* imm-s64<? a:12 b:12
+   *
+   * Set the comparison result to LESS_THAN if the s64 immediate B is
+   * less than the s64 value A, or NONE otherwise.
+   */
   VM_DEFINE_OP (118, imm_s64_less, "imm-s64<?", OP1 (X8_S12_Z12))
     {
       uint16_t a;
@@ -2483,6 +2733,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* f64=? a:12 b:12
+   *
+   * Set the comparison result to EQUAL if the f64 value A is equal to
+   * the f64 value B, or NONE otherwise.
+   */
   VM_DEFINE_OP (119, f64_numerically_equal, "f64=?", OP1 (X8_S12_S12))
     {
       uint16_t a, b;
@@ -2501,6 +2756,12 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* f64<? a:12 b:12
+   *
+   * Set the comparison result to LESS_THAN if the f64 value A is less
+   * than the f64 value B, NONE if A is greater than or equal to B, or
+   * INVALID otherwise.
+   */
   VM_DEFINE_OP (120, f64_less, "f64<?", OP1 (X8_S12_S12))
     {
       uint16_t a, b;
@@ -2521,6 +2782,11 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* =? a:12 b:12
+   *
+   * Set the comparison result to EQUAL if the SCM values A and B are
+   * numerically equal, in the sense of "=".  Set to NONE otherwise.
+   */
   VM_DEFINE_OP (121, numerically_equal, "=?", OP1 (X8_S12_S12))
     {
       uint16_t a, b;
@@ -2539,6 +2805,12 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* =? a:12 b:12
+   *
+   * Set the comparison result to EQUAL if the SCM values A and B are
+   * numerically equal, in the sense of "=".  Set to NONE otherwise.  It
+   * is known that both A and B are heap numbers.
+   */
   VM_DEFINE_OP (122, heap_numbers_equal, "heap-numbers-equal?", OP1 
(X8_S12_S12))
     {
       uint16_t a, b;
@@ -2557,6 +2829,12 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* <? a:12 b:12
+   *
+   * Set the comparison result to LESS_THAN if the SCM value A is less
+   * than the SCM value B, NONE if A is greater than or equal to B, or
+   * INVALID otherwise.
+   */
   VM_DEFINE_OP (123, less, "<?", OP1 (X8_S12_S12))
     {
       uint16_t a, b;
@@ -2572,6 +2850,12 @@ VM_NAME (scm_thread *thread)
       NEXT (1);
     }
 
+  /* immediate-tag=? obj:24 mask:16 tag:16
+   *
+   * Set the comparison result to EQUAL if the result of a bitwise AND
+   * between the bits of SCM value A and the immediate MASK is TAG, or
+   * NONE otherwise.
+   */
   VM_DEFINE_OP (124, immediate_tag_equals, "immediate-tag=?", OP2 (X8_S24, 
C16_C16))
     {
       uint32_t a;
@@ -2590,6 +2874,12 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* heap-tag=? obj:24 mask:16 tag:16
+   *
+   * Set the comparison result to EQUAL if the result of a bitwise AND
+   * between the first word of SCM value A and the immediate MASK is
+   * TAG, or NONE otherwise.
+   */
   VM_DEFINE_OP (125, heap_tag_equals, "heap-tag=?", OP2 (X8_S24, C16_C16))
     {
       uint32_t a;
@@ -2608,6 +2898,11 @@ VM_NAME (scm_thread *thread)
       NEXT (2);
     }
 
+  /* eq? a:12 b:12
+   *
+   * Set the comparison result to EQUAL if the SCM values A and B are
+   * eq?, or NONE otherwise.
+   */
   VM_DEFINE_OP (126, eq, "eq?", OP1 (X8_S12_S12))
     {
       uint16_t a, b;
@@ -2639,7 +2934,7 @@ VM_NAME (scm_thread *thread)
 
   /* jl offset:24
    *
-   * If the flags register is equal to SCM_F_COMPARE_LESS_THAN, add
+   * If the last comparison result is equal to SCM_F_COMPARE_LESS_THAN, add
    * OFFSET, a signed 24-bit number, to the current instruction pointer.
    */
   VM_DEFINE_OP (128, jl, "jl", OP1 (X8_L24))
@@ -2656,8 +2951,8 @@ VM_NAME (scm_thread *thread)
 
   /* je offset:24
    *
-   * If the flags register is equal to SCM_F_COMPARE_EQUAL, add
-   * OFFSET, a signed 24-bit number, to the current instruction pointer.
+   * If the last comparison result was EQUAL, then add OFFSET, a signed
+   * 24-bit number, to the current instruction pointer.
    */
   VM_DEFINE_OP (129, je, "je", OP1 (X8_L24))
     {
@@ -2673,8 +2968,8 @@ VM_NAME (scm_thread *thread)
 
   /* jnl offset:24
    *
-   * If the flags register is not equal to SCM_F_COMPARE_LESS_THAN, add
-   * OFFSET, a signed 24-bit number, to the current instruction pointer.
+   * If the last comparison result was not LESS_THAN, then add OFFSET, a
+   * signed 24-bit number, to the current instruction pointer.
    */
   VM_DEFINE_OP (130, jnl, "jnl", OP1 (X8_L24))
     {
@@ -2690,8 +2985,8 @@ VM_NAME (scm_thread *thread)
 
   /* jne offset:24
    *
-   * If the flags register is not equal to SCM_F_COMPARE_EQUAL, add
-   * OFFSET, a signed 24-bit number, to the current instruction pointer.
+   * If the last comparison result was not EQUAL, then add OFFSET, a
+   * signed 24-bit number, to the current instruction pointer.
    */
   VM_DEFINE_OP (131, jne, "jne", OP1 (X8_L24))
     {
@@ -2707,12 +3002,13 @@ VM_NAME (scm_thread *thread)
 
   /* jge offset:24
    *
-   * If the flags register is equal to SCM_F_COMPARE_NONE, add OFFSET, a
-   * signed 24-bit number, to the current instruction pointer.  This is
-   * intended for use after a "<?" comparison, and is different from
-   * "jnl" in the way it handles not-a-number (NaN) values: "<?" sets
-   * SCM_F_COMPARE_UNORDERED instead of SCM_F_COMPARE_NONE if either
-   * value is a NaN.  For exact numbers, "jge" is the same as "jnl".
+   * If the last comparison result was NONE, then add OFFSET, a signed
+   * 24-bit number, to the current instruction pointer.
+   *
+   * This is intended for use after a "<?" comparison, and is different
+   * from "jnl" in the way it handles not-a-number (NaN) values: "<?"
+   * sets INVALID instead of NONE if either value is a NaN.  For exact
+   * numbers, "jge" is the same as "jnl".
    */
   VM_DEFINE_OP (132, jge, "jge", OP1 (X8_L24))
     {
@@ -2728,13 +3024,13 @@ VM_NAME (scm_thread *thread)
 
   /* jnge offset:24
    *
-   * If the flags register is not equal to SCM_F_COMPARE_NONE, add
-   * OFFSET, a signed 24-bit number, to the current instruction pointer.
+   * If the last comparison result was not NONE, then add OFFSET, a
+   * signed 24-bit number, to the current instruction pointer.
+   *
    * This is intended for use after a "<?" comparison, and is different
    * from "jl" in the way it handles not-a-number (NaN) values: "<?"
-   * sets SCM_F_COMPARE_UNORDERED instead of SCM_F_COMPARE_NONE if
-   * either value is a NaN.  For exact numbers, "jnge" is the same as
-   * "jl".
+   * sets INVALID instead of NONE if either value is a NaN.  For exact
+   * numbers, "jnge" is the same as "jl".
    */
   VM_DEFINE_OP (133, jnge, "jnge", OP1 (X8_L24))
     {
@@ -2776,49 +3072,163 @@ VM_NAME (scm_thread *thread)
     NEXT (1);                                                           \
   } while (0)
 
+  /* u8-ref dst:8 ptr:8 idx:8
+   *
+   * Load the u8 at byte offset IDX from pointer PTR, and store it to
+   * u64 DST.
+   */
   VM_DEFINE_OP (134, u8_ref, "u8-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (uint8_t, U64);
+
+  /* u16-ref dst:8 ptr:8 idx:8
+   *
+   * Load the u16 at byte offset IDX from pointer PTR, and store it to
+   * u64 DST.
+   */
   VM_DEFINE_OP (135, u16_ref, "u16-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (uint16_t, U64);
+
+  /* u32-ref dst:8 ptr:8 idx:8
+   *
+   * Load the u32 at byte offset IDX from pointer PTR, and store it to
+   * u64 DST.
+   */
   VM_DEFINE_OP (136, u32_ref, "u32-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (uint32_t, U64);
+
+  /* u64-ref dst:8 ptr:8 idx:8
+   *
+   * Load the u64 at byte offset IDX from pointer PTR, and store it to
+   * u64 DST.
+   */
   VM_DEFINE_OP (137, u64_ref, "u64-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (uint64_t, U64);
 
+  /* u8-set! ptr:8 idx:8 val:8
+   *
+   * Store the u64 value VAL into the u8 at byte offset IDX from pointer
+   * PTR.
+   */
   VM_DEFINE_OP (138, u8_set, "u8-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (uint8_t, U64);
+
+  /* u16-set! ptr:8 idx:8 val:8
+   *
+   * Store the u64 value VAL into the u16 at byte offset IDX from
+   * pointer PTR.
+   */
   VM_DEFINE_OP (139, u16_set, "u16-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (uint16_t, U64);
+
+  /* u32-set! ptr:8 idx:8 val:8
+   *
+   * Store the u64 value VAL into the u32 at byte offset IDX from
+   * pointer PTR.
+   */
   VM_DEFINE_OP (140, u32_set, "u32-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (uint32_t, U64);
+
+  /* u64-set! ptr:8 idx:8 val:8
+   *
+   * Store the u64 value VAL into the u64 at byte offset IDX from
+   * pointer PTR.
+   */
   VM_DEFINE_OP (141, u64_set, "u64-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (uint64_t, U64);
 
+  /* s8-ref dst:8 ptr:8 idx:8
+   *
+   * Load the s8 at byte offset IDX from pointer PTR, and store it to
+   * s64 DST.
+   */
   VM_DEFINE_OP (142, s8_ref, "s8-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (int8_t, S64);
+
+  /* s16-ref dst:8 ptr:8 idx:8
+   *
+   * Load the s16 at byte offset IDX from pointer PTR, and store it to
+   * s64 DST.
+   */
   VM_DEFINE_OP (143, s16_ref, "s16-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (int16_t, S64);
+
+  /* s32-ref dst:8 ptr:8 idx:8
+   *
+   * Load the s32 at byte offset IDX from pointer PTR, and store it to
+   * s64 DST.
+   */
   VM_DEFINE_OP (144, s32_ref, "s32-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (int32_t, S64);
+
+  /* s64-ref dst:8 ptr:8 idx:8
+   *
+   * Load the s64 at byte offset IDX from pointer PTR, and store it to
+   * s64 DST.
+   */
   VM_DEFINE_OP (145, s64_ref, "s64-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (int64_t, S64);
 
+  /* s8-set! ptr:8 idx:8 val:8
+   *
+   * Store the s64 value VAL into the s8 at byte offset IDX from pointer
+   * PTR.
+   */
   VM_DEFINE_OP (146, s8_set, "s8-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (int8_t, S64);
+
+  /* s16-set! ptr:8 idx:8 val:8
+   *
+   * Store the s64 value VAL into the s16 at byte offset IDX from
+   * pointer PTR.
+   */
   VM_DEFINE_OP (147, s16_set, "s16-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (int16_t, S64);
+
+  /* s32-set! ptr:8 idx:8 val:8
+   *
+   * Store the s64 value VAL into the s32 at byte offset IDX from
+   * pointer PTR.
+   */
   VM_DEFINE_OP (148, s32_set, "s32-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (int32_t, S64);
+
+  /* s64-set! ptr:8 idx:8 val:8
+   *
+   * Store the s64 value VAL into the s64 at byte offset IDX from
+   * pointer PTR.
+   */
   VM_DEFINE_OP (149, s64_set, "s64-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (int64_t, S64);
 
+  /* f32-ref dst:8 ptr:8 idx:8
+   *
+   * Load the f32 at byte offset IDX from pointer PTR, and store it to
+   * f64 DST.
+   */
   VM_DEFINE_OP (150, f32_ref, "f32-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (float, F64);
+
+  /* f64-ref dst:8 ptr:8 idx:8
+   *
+   * Load the f64 at byte offset IDX from pointer PTR, and store it to
+   * f64 DST.
+   */
   VM_DEFINE_OP (151, f64_ref, "f64-ref", DOP1 (X8_S8_S8_S8))
     PTR_REF (double, F64);
 
+  /* f32-set! ptr:8 idx:8 val:8
+   *
+   * Store the f64 value VAL into the f32 at byte offset IDX from
+   * pointer PTR.
+   */
   VM_DEFINE_OP (152, f32_set, "f32-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (float, F64);
+
+  /* s64-set! ptr:8 idx:8 val:8
+   *
+   * Store the f64 value VAL into the f8 at byte offset IDX from pointer
+   * PTR.
+   */
   VM_DEFINE_OP (153, f64_set, "f64-set!", OP1 (X8_S8_S8_S8))
     PTR_SET (double, F64);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]