[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-commits
Subject:    [Sbcl-commits] master: Improve closure scavenging a tiny bit.
From:       "Douglas Katzman" <snuglas () users ! sourceforge ! net>
Date:       2017-03-30 20:44:04
Message-ID: 1490906644.599480.5688 () sfp-scm-4 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

The branch "master" has been updated in SBCL:
       via  2c35f14d267cd2fafaeffb18b4db4a765c680137 (commit)
      from  d3268488f0060e855af6572398a1affeed945ac1 (commit)

- Log -----------------------------------------------------------------
commit 2c35f14d267cd2fafaeffb18b4db4a765c680137
Author: Douglas Katzman <dougk@google.com>
Date:   Thu Mar 30 16:40:11 2017 -0400

    Improve closure scavenging a tiny bit.
    
    Examining the whole object with scavenge() is faster
    than letting heap_scavenge() do the rest of the job.
    
    Also rename scav_closure_header -> scav_closure.
---
 src/compiler/generic/late-objdef.lisp |  3 +--
 src/runtime/gc-common.c               | 25 ++++++++++++++-----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/compiler/generic/late-objdef.lisp b/src/compiler/generic/late-objdef.lisp
index c525f82..e66a472 100644
--- a/src/compiler/generic/late-objdef.lisp
+++ b/src/compiler/generic/late-objdef.lisp
@@ -47,8 +47,7 @@
     ;; The scavenge function for fun-header is basically "lose",
     ;; but it's only defined on non-x86 platforms for some reason.
     (simple-fun-header ,(or #!+(or x86 x86-64) "lose" "fun_header") "fun_header" "lose")
-    (closure-header ,(or #!+(or x86 x86-64) "closure_header" "short_boxed")
-                    "short_boxed")
+    (closure-header ,(or #!+(or x86 x86-64) "closure" "short_boxed") "short_boxed")
     (funcallable-instance-header ,(or #!+compact-instance-header "funinstance" "short_boxed")
                                  "short_boxed")
     ;; These have a scav and trans function, but no size function.
diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c
index 81eb4a7..3ca1cc0 100644
--- a/src/runtime/gc-common.c
+++ b/src/runtime/gc-common.c
@@ -65,6 +65,15 @@ struct weak_pointer *weak_pointers;
 
 os_vm_size_t bytes_consed_between_gcs = 12*1024*1024;
 
+/// These sizing macros return the number of *payload* words,
+/// exclusive of the object header word. Payload length is always
+/// an odd number so that total word count is an even number.
+#define BOXED_NWORDS(obj) (HeaderValue(obj) | 1)
+// Payload count expressed in 15 bits
+#define SHORT_BOXED_NWORDS(obj) ((HeaderValue(obj) & SHORT_HEADER_MAX_WORDS) | 1)
+// Payload count expressed in 8 bits
+#define TINY_BOXED_NWORDS(obj) ((HeaderValue(obj) & 0xFF) | 1)
+
 /*
  * copying objects
  */
@@ -351,9 +360,10 @@ trans_return_pc_header(lispobj object)
 
 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
 static sword_t
-scav_closure_header(lispobj *where, lispobj object)
+scav_closure(lispobj *where, lispobj header)
 {
     struct closure *closure = (struct closure *)where;
+    int payload_words = SHORT_BOXED_NWORDS(header);
     lispobj fun = closure->fun - FUN_RAW_ADDR_OFFSET;
     scavenge(&fun, 1);
 #ifdef LISP_FEATURE_GENCGC
@@ -362,7 +372,9 @@ scav_closure_header(lispobj *where, lispobj object)
     if (closure->fun != fun + FUN_RAW_ADDR_OFFSET)
         closure->fun = fun + FUN_RAW_ADDR_OFFSET;
 #endif
-    return 2;
+    // Payload includes 'fun' which was just looked at, so subtract it.
+    scavenge(closure->info, payload_words - 1);
+    return 1 + payload_words;
 }
 #endif
 
@@ -719,15 +731,6 @@ scav_funinstance(lispobj *where, lispobj header)
 
 //// Boxed object scav/trans/size functions
 
-/// These sizing macros return the number of *payload* words,
-/// exclusive of the object header word. Payload length is always
-/// an odd number so that total word count is an even number.
-#define BOXED_NWORDS(obj) (HeaderValue(obj) | 1)
-// Payload count expressed in 15 bits
-#define SHORT_BOXED_NWORDS(obj) ((HeaderValue(obj) & SHORT_HEADER_MAX_WORDS) | 1)
-// Payload count expressed in 8 bits
-#define TINY_BOXED_NWORDS(obj) ((HeaderValue(obj) & 0xFF) | 1)
-
 #define DEF_SCAV_BOXED(suffix, sizer) \
   static sword_t __attribute__((unused)) \
   scav_##suffix(lispobj *where, lispobj header) { \

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sbcl-commits mailing list
Sbcl-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic