guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 09/13: Fix some aspects of instruction mcode addresses


From: Andy Wingo
Subject: [Guile-commits] 09/13: Fix some aspects of instruction mcode addresses
Date: Thu, 4 Apr 2019 06:11:43 -0400 (EDT)

wingo pushed a commit to branch lightening
in repository guile.

commit f8fa1156a9a0f951dd48f41b6b810a629962b528
Author: Andy Wingo <address@hidden>
Date:   Thu Apr 4 11:42:33 2019 +0200

    Fix some aspects of instruction mcode addresses
    
    * libguile/jit.c (struct scm_jit_state): Remove entry_mcode member.
    (add_inter_instruction_patch): Fix off-by-one.
    (compile): Reset reloc_idx when restarting a compile.  All instructions
    record their addresses.
---
 libguile/jit.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libguile/jit.c b/libguile/jit.c
index 6bd92ba..a5fe6ee 100644
--- a/libguile/jit.c
+++ b/libguile/jit.c
@@ -177,7 +177,6 @@ struct scm_jit_state {
   uint32_t *next_ip;
   const uint32_t *end;
   uint32_t *entry;
-  void *entry_mcode;
   uint8_t *op_attrs;
   struct pending_reloc *relocs;
   size_t reloc_idx;
@@ -1486,7 +1485,7 @@ add_inter_instruction_patch (scm_jit_state *j, 
jit_reloc_t reloc,
         }
     }
 
-  ASSERT (j->reloc_idx <= j->reloc_count);
+  ASSERT (j->reloc_idx < j->reloc_count);
   j->relocs[j->reloc_idx].reloc = reloc;
   j->relocs[j->reloc_idx].target_vcode_offset = offset;
   j->reloc_idx++;
@@ -4702,6 +4701,7 @@ compile (scm_jit_state *j)
 {
   analyze (j);
 
+  j->reloc_idx = 0;
   j->ip = (uint32_t *) j->start;
   set_register_state (j, SP_IN_REGISTER | FP_IN_REGISTER);
 
@@ -4709,16 +4709,14 @@ compile (scm_jit_state *j)
     {
       ptrdiff_t offset = j->ip - j->start;
       uint8_t attrs = j->op_attrs[offset];
+      j->labels[offset] = jit_address (j->jit);
       if (attrs & OP_ATTR_BLOCK)
         {
           uint32_t state = SP_IN_REGISTER;
           if (attrs & OP_ATTR_ENTRY)
             state |= FP_IN_REGISTER;
           j->register_state = state;
-          j->labels[offset] = jit_address (j->jit);
         }
-      if (j->ip == j->entry)
-        j->entry_mcode = jit_address (j->jit);
       compile1 (j);
     }
 



reply via email to

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