Better initialization of ir2-component-constants on x86-64.
authorStas Boukarev <stassats@gmail.com>
Sun, 2 Jun 2013 16:33:54 +0000 (20:33 +0400)
committerStas Boukarev <stassats@gmail.com>
Sun, 2 Jun 2013 16:33:54 +0000 (20:33 +0400)
x86 uses the first constant for the fixup vector, x86-64 doesn't.
Don't leave empty space in ir2-component-constants.

On the C side, call gencgc_apply_code_fixups only on x86, and not on
x86_64 as well, since its body is conditionalized for x86_64 anyway.

NEWS
src/compiler/x86-64/call.lisp
src/runtime/gc-common.c
src/runtime/gencgc-internal.h
src/runtime/gencgc.c

diff --git a/NEWS b/NEWS
index 4c4f372..9b52416 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,7 @@
 ;;;; -*- coding: utf-8; fill-column: 78 -*-
 changes relative to sbcl-1.1.8:
   * enchancement: disassemble now annotates some previously missing static
-    function, like LENGTH.
+    functions, like LENGTH.
   
 changes in sbcl-1.1.8 relative to sbcl-1.1.7:
   * notice: The implementation of MAP-ALLOCATED-OBJECTS (the heart of
index efa3b5d..58538fe 100644 (file)
 ;;; additional noise in the code object header.
 (!def-vm-support-routine select-component-format (component)
   (declare (type component component))
-  ;; The 1+ here is because for the x86 the first constant is a
-  ;; pointer to a list of fixups, or NIL if the code object has none.
-  ;; (If I understand correctly, the fixups are needed at GC copy
-  ;; time because the X86 code isn't relocatable.)
-  ;;
-  ;; KLUDGE: It'd be cleaner to have the fixups entry be a named
-  ;; element of the CODE (aka component) primitive object. However,
-  ;; it's currently a large, tricky, error-prone chore to change
-  ;; the layout of any primitive object, so for the foreseeable future
-  ;; we'll just live with this ugliness. -- WHN 2002-01-02
-  (dotimes (i (1+ code-constants-offset))
+  (dotimes (i code-constants-offset)
     (vector-push-extend nil
                         (ir2-component-constants (component-info component))))
   (values))
index b601c9e..227021b 100644 (file)
@@ -322,7 +322,7 @@ trans_code(struct code *code)
 
 #endif
 
-#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
+#ifdef LISP_FEATURE_X86
     gencgc_apply_code_fixups(code, new_code);
 #endif
 
index 779c747..3cb2837 100644 (file)
@@ -116,9 +116,10 @@ extern struct page *page_table;
 
 \f
 /* forward declarations */
-
+#ifdef LISP_FEATURE_X86
 void sniff_code_object(struct code *code, os_vm_size_t displacement);
 void gencgc_apply_code_fixups(struct code *old_code, struct code *new_code);
+#endif
 
 sword_t update_dynamic_space_free_pointer(void);
 void gc_alloc_update_page_tables(int page_type_flag, struct alloc_region *alloc_region);
index 0c87faf..fce1824 100644 (file)
@@ -125,8 +125,10 @@ boolean verify_after_free_heap = 0;
  * during a heap verify? */
 boolean verify_dynamic_code_check = 0;
 
+#ifdef LISP_FEATURE_X86
 /* Should we check code objects for fixup errors after they are transported? */
 boolean check_code_fixups = 0;
+#endif
 
 /* Should we check that newly allocated regions are zero filled? */
 boolean gencgc_zero_check = 0;
@@ -1650,10 +1652,10 @@ static lispobj trans_boxed(lispobj object);
  *
  * Currently only absolute fixups to the constant vector, or to the
  * code area are checked. */
+#ifdef LISP_FEATURE_X86
 void
 sniff_code_object(struct code *code, os_vm_size_t displacement)
 {
-#ifdef LISP_FEATURE_X86
     sword_t nheader_words, ncode_words, nwords;
     os_vm_address_t constants_start_addr = NULL, constants_end_addr, p;
     os_vm_address_t code_start_addr, code_end_addr;
@@ -1822,14 +1824,13 @@ sniff_code_object(struct code *code, os_vm_size_t displacement)
                "/code start = %x, end = %x\n",
                code_start_addr, code_end_addr));
     }
-#endif
 }
+#endif
 
+#ifdef LISP_FEATURE_X86
 void
 gencgc_apply_code_fixups(struct code *old_code, struct code *new_code)
 {
-/* x86-64 uses pc-relative addressing instead of this kludge */
-#ifndef LISP_FEATURE_X86_64
     sword_t nheader_words, ncode_words, nwords;
     os_vm_address_t constants_start_addr, constants_end_addr;
     os_vm_address_t code_start_addr, code_end_addr;
@@ -1925,9 +1926,8 @@ gencgc_apply_code_fixups(struct code *old_code, struct code *new_code)
     if (check_code_fixups) {
         sniff_code_object(new_code,displacement);
     }
-#endif
 }
-
+#endif
 
 static lispobj
 trans_boxed_large(lispobj object)