[Git][cmucl/cmucl][native-image] Round up length for boxed objects and simple vector

Raymond Toy gitlab at common-lisp.net
Wed Jan 27 05:36:50 UTC 2021



Raymond Toy pushed to branch native-image at cmucl / cmucl


Commits:
f6b1c916 by Raymond Toy at 2021-01-26T21:36:17-08:00
Round up length for boxed objects and simple vector

These objects should end on a double-word boundary, so round up the
len (from the header) to a double word before printing out the
contents.  If we don't round and we don't end on a boundary, we'll
probably just print an immediate word of 0.  Harmless, I think, but
we'll add a label that wastes space.

- - - - -


1 changed file:

- src/lisp/save.c


Changes:

=====================================
src/lisp/save.c
=====================================
@@ -26,6 +26,9 @@
 #include "gencgc.h"
 #endif
 
+/* Like (ceiling x y), but y is constrained to be a power of two */
+#define CEILING(x,y) (((x) + ((y) - 1)) & (~((y) - 1)))
+
 #ifdef FEATURE_EXECUTABLE
 #include "elf.h"
 #if !(defined(DARWIN) && defined(__ppc__))
@@ -454,6 +457,7 @@ int
 asm_boxed(lispobj* ptr, lispobj object, FILE* f) 
 {
     int len = 1 + HeaderValue(object);
+    len = CEILING(len, 2);
     int k;
 
     asm_label(ptr, object, f);
@@ -464,8 +468,6 @@ asm_boxed(lispobj* ptr, lispobj object, FILE* f)
         asm_lispobj(ptr + k, ptr[k], f);
     }
 
-    asm_align(f);
-    
     return len;
 }
 
@@ -535,6 +537,7 @@ asm_simple_vector(lispobj* ptr, lispobj object, FILE* f)
 {
     int k;
     int len = ptr[1] >> 2;
+    len = CEILING(len, 2);
     lispobj* data = ptr + 2;
     
     asm_label(ptr, object, f);



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/f6b1c916b14484b0d777dd597141fe72965a1904

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/f6b1c916b14484b0d777dd597141fe72965a1904
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20210127/913b8c58/attachment-0001.html>


More information about the cmucl-cvs mailing list