[Git][cmucl/cmucl][native-image] More updates

Raymond Toy gitlab at common-lisp.net
Sun Jan 24 17:02:58 UTC 2021



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


Commits:
8dc1b098 by Raymond Toy at 2021-01-24T09:02:12-08:00
More updates

Add asm_ni as the default to dump out one object with a comment that
this is not yet implemented.

Fix bug in asm_list_pointer to print just one object.  The car and cdr
that follow can be handled as more lisp pointers or NIL.

asm_function_pointer should just print one object since it's just a
pointer and not a function itself.

asm_other_pointer should do the same as asm_function_pointer.

Add asm_instance_pointer which prints out just the pointer (with
label).

Add asm_simple_vector which prints out the simple vector header and
length followed by all of the lispobjs in the array.

Add asm_closure_header which is a simple boxed object containing only
lispobjs.

Add asm_complex_vector for complex vectors.  But just call asm_ni for
now for debugging.

Update init_asmtab appropriately for the new printers.

- - - - -


1 changed file:

- src/lisp/save.c


Changes:

=====================================
src/lisp/save.c
=====================================
@@ -438,6 +438,15 @@ asm_header_word(lispobj* ptr, lispobj object, FILE* f)
 }
 
     
+int
+asm_ni(lispobj* ptr, lispobj object, FILE* f)
+{
+    asm_label(ptr, object, f);
+    fprintf(f, "\t.4byte\t0x%lx\t# NOT IMPLEMENTED\n",
+            object);
+    return 1;
+}
+
 /*
  * Handles all objects that consists of only of lispobjs
  */
@@ -476,51 +485,35 @@ asm_list_pointer(lispobj* ptr, lispobj object, FILE* f)
     asm_label(ptr, object, f);
 
     asm_lispobj(ptr, object, f);
-    asm_lispobj(ptr + 1, ptr[1], f);
 
-    return 2;
+    return 1;
 }
 
 int
 asm_function_pointer(lispobj* ptr, lispobj object, FILE* f)
 {
-    int k;
-    int len = HeaderValue(object);
+    printf("function pointer 0x%lx\n", object);
     
     asm_label(ptr, object, f);
-    for (k = 0; k < 6; ++k) {
-        asm_lispobj(ptr, *ptr, f);
-        ++ptr;
-    }
-    fprintf(f, "# function code\n");
-
-    unsigned char *c = (unsigned char*) ptr;
-    
-    for (k = 0; k < len - 5*4; ++k) {
-        fprintf(f, "\t.byte\t0x%x\n", *c++);
-    }
-
-    return len + 1;
+    asm_lispobj(ptr, object, f);
+    return 1;
 }
 
 
 int
 asm_other_pointer(lispobj* ptr, lispobj object, FILE* f)
 {
-    int len;
-    
     asm_label(ptr, object, f);
     asm_lispobj(ptr, object, f);
-    len = asmtab[TypeOf(ptr[1])](ptr + 1, ptr[1], f);
-    return len + 1;
+    return 1;
 }
 
 int
 asm_fdefn(lispobj* ptr, lispobj object, FILE* f)
 {
-    asm_label(ptr, *ptr, f);
+    asm_label(ptr, object, f);
     
-    asm_header_word(ptr, *ptr, f);
+    asm_header_word(ptr, object, f);
     asm_lispobj(ptr + 1, ptr[1], f);
     asm_lispobj(ptr + 2, ptr[2], f);
 
@@ -529,6 +522,43 @@ asm_fdefn(lispobj* ptr, lispobj object, FILE* f)
     return 4;
 }
 
+int
+asm_instance_pointer(lispobj* ptr, lispobj object, FILE* f)
+{
+    asm_label(ptr, object, f);
+    asm_lispobj(ptr, object, f);
+    return 1;
+}
+
+int
+asm_simple_vector(lispobj* ptr, lispobj object, FILE* f)
+{
+    int k;
+    int len = ptr[1] >> 2;
+    lispobj* data = ptr + 2;
+    
+    asm_label(ptr, object, f);
+    asm_header_word(ptr, object, f);
+    asm_lispobj(ptr + 1, ptr[1], f);
+
+    for (k = 0; k < len; ++k) {
+        asm_lispobj(data + k,  data[k], f);
+    }
+    
+    return len + 2;
+}
+
+int
+asm_closure_header(lispobj* ptr, lispobj object, FILE* f)
+{
+    return asm_boxed(ptr, object, f);
+}
+
+int
+asm_complex_vector(lispobj* ptr, lispobj object, FILE* f)
+{
+    return asm_ni(ptr, object, f);
+}
 
 #if 0
 int
@@ -627,24 +657,26 @@ init_asmtab()
     int k = 0;
 
     for (k = 0; k < 256; ++k) {
-        asmtab[k] = asm_boxed;
+        asmtab[k] = asm_ni;
     }
 
     for (k = 0; k < 32; ++k) {
         asmtab[type_EvenFixnum | (k << 3)] = asm_immediate;
         asmtab[type_FunctionPointer | (k << 3)] = asm_function_pointer;
-	/* OtherImmediate0 */
+        asmtab[type_OtherImmediate0 | (k << 3)] = asm_ni;
         asmtab[type_ListPointer | (k << 3)] = asm_list_pointer;
         asmtab[type_OddFixnum | (k << 3)] = asm_immediate;
-#if 0
         asmtab[type_InstancePointer | (k << 3)] = asm_instance_pointer;
-#endif        
-	/* OtherImmediate1 */
+        asmtab[type_OtherImmediate1 | (k << 3) ] = asm_ni;
         asmtab[type_OtherPointer | (k << 3)] = asm_other_pointer;
     }
     
     asmtab[type_SymbolHeader] = asm_boxed;
     asmtab[type_Fdefn] = asm_fdefn;
+    asmtab[type_InstanceHeader] = asm_boxed;
+    asmtab[type_SimpleVector] = asm_simple_vector;
+    asmtab[type_FuncallableInstanceHeader] = asm_closure_header;
+    asmtab[type_ComplexVector] = asm_boxed;
 }
     
 void



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

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/8dc1b098315486424544033f146b560eacb012d9
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/20210124/475b393d/attachment-0001.html>


More information about the cmucl-cvs mailing list