[Git][cmucl/cmucl][native-image] 8 commits: ldb prints out Unicode characters

Raymond Toy gitlab at common-lisp.net
Thu Feb 4 04:49:21 UTC 2021



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


Commits:
19f274f0 by Raymond Toy at 2021-01-29T17:30:03-08:00
ldb prints out Unicode characters

When printing out a base-char, only the low 8 bits of the code were
used.  But with Unicode support, we need to take all the bits and
print them out.  For control codes we use the form "#\^x".  (Was
#\C-x, which isn't a valid supported character form.)  Ascii is
printed as normal "#\a", and everything else use uses "#\u+<hex>".

While we're at it, we also added special cases like #\Vt that are
listed in
https://cmucl.org/docs/cmu-user/html/Characters.html#Characters.

With this, we can print out all unicode characters in a form that can
be pasted back into lisp.

- - - - -
832e116a by Raymond Toy at 2021-01-30T01:54:08+00:00
Merge branch 'issue-100-ldb-base-char-printing' into 'master'

ldb prints out Unicode characters

See merge request cmucl/cmucl!67
- - - - -
e349bf1d by Raymond Toy at 2021-01-30T09:51:59-08:00
Update notes in preparation for snapshot.

Just updated based on the issues that were closed.

- - - - -
74b0de87 by Raymond Toy at 2021-02-03T17:04:16-08:00
Add test for overflow in expt that shouldn't happen

We shouldn't get an overflow, but we do because clang 10 miscompiles
e_pow.c and causes an overflow.

Addresses #101

- - - - -
23d1a1d1 by Raymond Toy at 2021-02-04T01:28:29+00:00
Merge branch 'issue-101-add-test' into 'master'

Add test for overflow in expt that shouldn't happen

See merge request cmucl/cmucl!68
- - - - -
bfbd0527 by Raymond Toy at 2021-02-03T20:19:53-08:00
Merge branch 'master' into native-image

- - - - -
6887f2de by Raymond Toy at 2021-02-03T20:27:35-08:00
Support type_Ratio

Ratios contain only boxed objects so asm_boxed works.

Also fixed a gcc warning about init_asmtab; make the arg `void`.

- - - - -
02da0955 by Raymond Toy at 2021-02-03T20:49:05-08:00
Support type_Complex and type_SimpleArray

With these changes, static space has no unimplemented objects.

- - - - -


4 changed files:

- src/general-info/release-21e.md
- src/lisp/print.c
- src/lisp/save.c
- tests/issues.lisp


Changes:

=====================================
src/general-info/release-21e.md
=====================================
@@ -19,8 +19,6 @@ public domain.
 
 ## New in this release:
   * Known issues:
-    * Building with gcc8 or later doesn't work with the default -O option. Use -O1 instead.  This shouldn't really impact overall speed much.
-    * Added simple support to compile with clang instead, which works. (Use x86_linux_clang).
   * Feature enhancements
   * Changes
     * Update to ASDF 3.3.4
@@ -35,6 +33,12 @@ public domain.
     * ~~#80~~ Use ASDF to load contribs.  cmu-contribs still exists but does nothing.  The contrib names are the same, except it's best to use a keyword instead of a string.  So, `:contrib-demos` instead of `"contrib-demos"`.
     * ~~#81~~ Added contribs from Eric Marsden
     * ~~#82~~ Replace bc with expr in GNUMakefile
+    * ~~#86~~ Building with gcc 8 and later works when using -O2 optimization
+    * ~~#90~~ Some static symbols have been removed.  This probably makes the fasl files incompatible with older versions.
+    * ~~#91~~ Loop destructuring no longer incorrectly signals an error
+    * ~~#95~~ Disassembler syntax of x86 je and movzx is incorrect
+    * ~~#98~~ fstpd is not an Intel instruction; disassemble as `fstp dword ptr [addr]`
+    * ~~#100~~ ldb prints out unicode base-chars correctly instead of just the low 8 bits.
   * Other changes:
   * Improvements to the PCL implementation of CLOS:
   * Changes to building procedure:


=====================================
src/lisp/print.c
=====================================
@@ -212,12 +212,15 @@ static void
 brief_otherimm(lispobj obj)
 {
     int type, c, idx;
-    char buffer[10];
 
     type = TypeOf(obj);
     switch (type) {
       case type_BaseChar:
-	  c = (obj >> 8) & 0xff;
+          /*
+           * A base-char should only be 16 bits long now.  But
+           * sometimes it uses all 24.  So just grab all the bits.
+           */
+	  c = (obj >> 8) & 0xfffff;
 	  switch (c) {
 	    case '\0':
 		printf("#\\Null");
@@ -228,20 +231,35 @@ brief_otherimm(lispobj obj)
 	    case '\b':
 		printf("#\\Backspace");
 		break;
+            case '\11':
+                printf("#\\Tab");
+                break;
+            case '\13':
+                printf("#\\Vt");
+                break;
+            case '\15':
+                printf("#\\Return");
+                break;
+            case '\33':
+                printf("#\\Escape");
+                break;
+            case '\40':
+                printf("#\\Space");
+                break;
 	    case '\177':
 		printf("#\\Delete");
 		break;
 	    default:
-		strcpy(buffer, "#\\");
 		if (c >= 128) {
-		    strcat(buffer, "m-");
-		    c -= 128;
-		}
-		if (c < 32) {
-		    strcat(buffer, "c-");
-		    c += '@';
-		}
-		printf("%s%c", buffer, c);
+                    /* Just print out the code value */
+		    printf("#\\u+%04X", c);
+		} else if (c < 32) {
+                    /* Print it out as a control character */
+                    printf("#\\^%c", c + '@');
+		} else {
+                    /* Plain ASCII character */
+                    printf("#\\%c", c);
+                }
 		break;
 	  }
 	  break;


=====================================
src/lisp/save.c
=====================================
@@ -655,7 +655,7 @@ asm_complex_double_float(lispobj* ptr, lispobj object, FILE* f)
 #endif
 
 void
-init_asmtab()
+init_asmtab(void)
 {
     int k = 0;
 
@@ -674,6 +674,9 @@ init_asmtab()
         asmtab[type_OtherPointer | (k << 3)] = asm_other_pointer;
     }
     
+    asmtab[type_Ratio] = asm_boxed;
+    asmtab[type_Complex] = asm_boxed;
+    asmtab[type_SimpleArray] = asm_boxed;
     asmtab[type_SymbolHeader] = asm_boxed;
     asmtab[type_Fdefn] = asm_fdefn;
     asmtab[type_InstanceHeader] = asm_boxed;
@@ -683,6 +686,7 @@ init_asmtab()
     asmtab[type_BaseChar] = asm_immediate;
     /* Just use asm_boxed or have a special version for a value cell? */
     asmtab[type_ValueCellHeader] = asm_boxed;
+    
 }
     
 void


=====================================
tests/issues.lisp
=====================================
@@ -544,3 +544,15 @@
   ;; the correct value.
   (assert-false
    (funcall (compile nil '(lambda () (array-displacement "aaaaaaaa"))))))
+
+(define-test issue.101
+    (:tag :issues)
+  ;; Verifies that we don't get unexpected overflow.  The actual value
+  ;; is not really important.  The important part is no overflow is
+  ;; signaled.
+  ;;
+  ;; See https://gitlab.common-lisp.net/cmucl/cmucl/-/issues/101 for
+  ;; more details.
+  (assert-equalp
+   3.0380154777955097d205
+   (expt 1.7976931348623157d308 0.6666)))



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/9f71e8eb109c45a709c03c1044c089701ea80192...02da09556ab426077f726251ada0feca07b059a2

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/9f71e8eb109c45a709c03c1044c089701ea80192...02da09556ab426077f726251ada0feca07b059a2
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/20210204/026501ed/attachment-0001.html>


More information about the cmucl-cvs mailing list