bugMIT/GNU Scheme - Bugs: bug #65620, wrong-type-argument loading...

 
 

bug #65620: wrong-type-argument loading types.com when building runtime.com

Submitter:  Taylor R. Campbell <riastradh>
Submitted:  Sun 21 Apr 2024 02:22:18 PM UTC
   
 
Category:  runtime Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect behavior
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open
Keywords: 
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Sep 2024 04:07:42 PM UTC, comment #2: 

comment #1:

> This is happening because the stage-0 microcode is used with the stage-1 runtime.  This only happens when --cross-compile is specified.
>
> Is there a reason why this is being done as opposed to compiling stage-1 microcode and use that?
>
> In any case, I'll fix the problem by removing the runtime half of the changes, and release a 12.2 with the microcode changes.


It should be possible to run the compiler as an ordinary Scheme application that does not depend on any details of machine architecture or ABI it's running on, and use that to compile a new Scheme system.  (And, in principle, it should be possible to do that on another host, like Scheme48 or Racket or whatever, but I realize there's a lot of work that would have to happen for that.)

That was the point of, e.g., compiler/base/fasdump.scm: it is a machine-independent program that can produce output for any machine, as an ordinary Scheme application.  Any changes to the ABI, such as the x86 ABI changes I made a few years ago, type code changes like the #f/() split, scode changes, &c., require this.  That's why the 10 -> 11 build required --enable-cross-compiling.

Using the cross-compiler by default makes sure that we exercise this path so it doesn't bitrot.  Other systems like GCC and SBCL go to some trouble to make sure this path works, and produces the same output no matter what the host is.  That's why I put a lot of effort into reducing the manual difficulty of the cross-build.

(It's not perfect: we should be able to do ./configure --build=x86_64--netbsd --host=aarch64--linux-gnu CFLAGS=--sysroot=/var/obj/linux-chroot, and have it DTRT, but currently there's no way to statically link a runtime.com with build system tools, only a way to create an image at runtime on the host system and dump it.)

So I always build with --enable-cross-compiling.  And for 10 -> 11 -> 12, that worked out of the box.  But it has broken for 12 -> master.

Taylor R. Campbell <riastradh>
Group Member
Wed 08 May 2024 11:31:58 PM UTC, comment #1: 

This is happening because the stage-0 microcode is used with the stage-1 runtime.  This only happens when --cross-compile is specified.

Is there a reason why this is being done as opposed to compiling stage-1 microcode and use that?

In any case, I'll fix the problem by removing the runtime half of the changes, and release a 12.2 with the microcode changes.

Chris Hanson <cph>
Group administrator
Sun 21 Apr 2024 02:22:18 PM UTC, original submission:  

Can't build master from 12.1:

$ ./Setup.sh
...
$ ./configure --enable-cross-compiling --enable-native-code=x86-64
...
$ make -j4 cross-host
...
--- tools/runtime.com ---
echo '(disk-save "../../tools/runtime.com")'  | (cd tools/runtime &&  'mit-scheme-x86-64' --batch-mode --library ../../tools  --fasl make.`case compile in compile) echo com;; syntax) echo bin;; esac`)
packag.com loaded evaluated
runtime-unx.pkd loaded
gcdemn.com loaded evaluated
gc.com loaded evaluated
boot-seq.com loaded evaluated
primitive-data.com loaded evaluated
boot.com loaded evaluated
generator.com loaded evaluated
dispatch-low.com loaded evaluated
types.com loaded
Microcode Error: No error handlers.
Error code 0xd (wrong-type-argument-0).

** Stack Trace **

{0xeb8e58}
    Return code: [return-code pop-return-error]
    Expression: #f
{0xeb8e68}
    Return code: [return-code internal-apply]
    Expression: #f
{0xeb8e78}  ...: [false 0x3]
{0xeb8e80}  ...: [primitive SYSTEM-PAIR-SET-CDR!]
{0xeb8e88}  ...: [0x7 0x1153a50]
{0xeb8e90}  ...: [record 0x1153b50]
{0xeb8e98}
    Return code: [return-code reenter-compiled-code]
    Expression: 41
{0xeb8ea8}  ...: [compiled-return-address offset: 0xe6 entry: 0x1148586]
{0xeb8eb0}  ...: [0x7 0x1153a50]
{0xeb8eb8}  ...: apply-hook
{0xeb8ec0}  ...: #f
{0xeb8ec8}  ...: [compiled-procedure offset: 0x1c entry: 0x1140bc4]
{0xeb8ed0}  ...: #!default
{0xeb8ed8}  ...: [compiled-return-address offset: 0x57 entry: 0x1144d5f]
{0xeb8ee0}  ...: apply-hook
{0xeb8ee8}  ...: [compiled-procedure offset: 0x1c entry: 0x1140bc4]
{0xeb8ef0}  ...: [compiled-return-address offset: 0x276 entry: 0x1139776]
{0xeb8ef8}  ...: [compiled-return-address offset: 0x29c entry: 0x113979c]
{0xeb8f00}  ...: [environment from #([environment from #(#f [procedure [named-lambda (dummy-procedure boot-sequencer all-boot-sequencers seq:after-conditions seq:after-files-loaded seq:after-microcode-tables seq:after-pretty-printer seq:after-printer seq:after-predicate seq:after-record seq:after-thread-low seq:set-predicate-tag! initialize-after-sequencers! package-sequencer package-name->sequencer add-boot-init! add-boot-deps! conjoin-boot-deps %add-boot-deps! current-package-sequencer with-current-package current-package in-cold-load? cold-load-finished!) 0x1038a18] 0x1038a28] 381 ( (package) package-name-tag . [record 0x1038a38]) (binary-port-input-channel . [reference-trap tag: 14 extra: [triple 0x10ab4c0] 0x10ab4d8]) (binary-port-output-channel . [reference-trap tag: 14 extra: [triple 0x10ab510] 0x10ab528]) (binary-port-sink . [reference-trap tag: 14 extra: [triple 0x10ab560] 0x10ab578]) (binary-port-source . [reference-trap tag: 14 extra: [triple 0x10ab5b0] 0x10ab5c8]) (input-source-channel . [reference-trap tag: 14 extra: [triple 0x10ab600] 0x10ab618]) (input-source-custom-length . [reference-trap tag: 14 extra: [triple 0x10ab650] 0x10ab668])...[505 more]) 0x1038950] [procedure [named-lambda (dummy-procedure unicode-string? system-vector-type-code? system-triple-type-code? system-quadruple-type-code? system-pair-type-code? system-cell-type-code? simple-type simple-procedure? set-type<=! scode-simple-lambda? scode-lexpr? scode-extended-lambda? recnum? ratnum? pointer-type-code? non-pointer-type-code? manifest-nm-vector? legacy-string? hunk3-b? hunk3-a? gc-pointer? gc-pointer-type-code? gc-non-pointer? gc-non-pointer-type-code? misc-false? extended-procedure? delayed? control-point? misc-constant? broken-heart? bignum? %record-subtype weak-pair? vector? uninterned-symbol? uniform-string-type uniform-list-type type? type<= type-test type-supersets type-subsets type-refinement type-name type-dispatch-tag type-derivation tagged-vector-subtype tagged-list-subtype system-vector? system-triple? system-quadruple? system-pair? system-cell? symbol? stack-address? scode-variable? scode-the-environment? scode-sequence? scode-quotation? scode-disjunction? scode-delay? scode-definition? scode-conditional? scode-comment? scode-combination? scode-assignment? scode-access? refine-type primitive-procedure? pair-type object->type no-object? interpreter-return-address? interned-symbol? ic-environment? gc-reclaimed-object? ephemeron? eof-object? entity? dispatch-tag? dispatch-metatag? disjoin-types differ-types conjoin-types complement-type compiled-return-address? compiled-entry-address? compiled-code-block? char? cell? bytevector? bit-string? apply-hook? any-object? all-types all-simple-types %tagged-object? %record? $pair? flonum? fixnum? $default-object? %type-metatag %type-tag? make-type %type-dispatch-tag %type-test %type-supersets %type-subsets %type-derivation %type-refinement %type-printer-name %refine-type simple-types primitive-type-bindings after-cold-load:type<= %type<= after-cold-load:set-type<=! deferred-relations type<=-cache primitive-types initialize-package! code->gct-name name->gct-code names->gct-mask name->gct-index gct-code->index gct-index->code gct-names gc-pointer-mask match-gct-mask) 0x109fa58] 0x109fa68] 10 ( (package) package-name-tag . [record 0x109fa78]) (apply-hook-type-code . [reference-trap tag: 14 extra: [triple 0x10df540] 0x10df558]) (record-type-proxy-datum? . [reference-trap tag: 14 extra: [triple 0x10e3dd0] 0x10e3de8]) (record-type-proxy? . [reference-trap tag: 14 extra: [triple 0x10e3e20] 0x10e3e38]) (%dispatch-metatag? . [reference-trap tag: 14 extra: [triple 0x10f7bd0] 0x10f7be8]) (%dispatch-tag-subsets . [reference-trap tag: 14 extra: [triple 0x10f7c20] 0x10f7c38]) (%dispatch-tag-supersets . [reference-trap tag: 14 extra: [triple 0x10f7c70] 0x10f7c88])...[9 more]) 0x109f630]
{0xeb8f08}  ...: [compiled-return-address offset: 0x1fb6 entry: 0xf02bd6]
{0xeb8f10}  ...: [compiled-closure offset: 0x1f75 entry: 0xf02b95 address: 0xf0a288]
{0xeb8f18}  ...: [comment 0x11394f0]
{0xeb8f20}  ...: [environment from #([environment from #(#f [procedure [named-lambda (dummy-procedure boot-sequencer all-boot-sequencers seq:after-conditions seq:after-files-loaded seq:after-microcode-tables seq:after-pretty-printer seq:after-printer seq:after-predicate seq:after-record seq:after-thread-low seq:set-predicate-tag! initialize-after-sequencers! package-sequencer package-name->sequencer add-boot-init! add-boot-deps! conjoin-boot-deps %add-boot-deps! current-package-sequencer with-current-package current-package in-cold-load? cold-load-finished!) 0x1038a18] 0x1038a28] 381 ( (package) package-name-tag . [record 0x1038a38]) (binary-port-input-channel . [reference-trap tag: 14 extra: [triple 0x10ab4c0] 0x10ab4d8]) (binary-port-output-channel . [reference-trap tag: 14 extra: [triple 0x10ab510] 0x10ab528]) (binary-port-sink . [reference-trap tag: 14 extra: [triple 0x10ab560] 0x10ab578]) (binary-port-source . [reference-trap tag: 14 extra: [triple 0x10ab5b0] 0x10ab5c8]) (input-source-channel . [reference-trap tag: 14 extra: [triple 0x10ab600] 0x10ab618]) (input-source-custom-length . [reference-trap tag: 14 extra: [triple 0x10ab650] 0x10ab668])...[505 more]) 0x1038950] [procedure [named-lambda (dummy-procedure unicode-string? system-vector-type-code? system-triple-type-code? system-quadruple-type-code? system-pair-type-code? system-cell-type-code? simple-type simple-procedure? set-type<=! scode-simple-lambda? scode-lexpr? scode-extended-lambda? recnum? ratnum? pointer-type-code? non-pointer-type-code? manifest-nm-vector? legacy-string? hunk3-b? hunk3-a? gc-pointer? gc-pointer-type-code? gc-non-pointer? gc-non-pointer-type-code? misc-false? extended-procedure? delayed? control-point? misc-constant? broken-heart? bignum? %record-subtype weak-pair? vector? uninterned-symbol? uniform-string-type uniform-list-type type? type<= type-test type-supersets type-subsets type-refinement type-name type-dispatch-tag type-derivation tagged-vector-subtype tagged-list-subtype system-vector? system-triple? system-quadruple? system-pair? system-cell? symbol? stack-address? scode-variable? scode-the-environment? scode-sequence? scode-quotation? scode-disjunction? scode-delay? scode-definition? scode-conditional? scode-comment? scode-combination? scode-assignment? scode-access? refine-type primitive-procedure? pair-type object->type no-object? interpreter-return-address? interned-symbol? ic-environment? gc-reclaimed-object? ephemeron? eof-object? entity? dispatch-tag? dispatch-metatag? disjoin-types differ-types conjoin-types complement-type compiled-return-address? compiled-entry-address? compiled-code-block? char? cell? bytevector? bit-string? apply-hook? any-object? all-types all-simple-types %tagged-object? %record? $pair? flonum? fixnum? $default-object? %type-metatag %type-tag? make-type %type-dispatch-tag %type-test %type-supersets %type-subsets %type-derivation %type-refinement %type-printer-name %refine-type simple-types primitive-type-bindings after-cold-load:type<= %type<= after-cold-load:set-type<=! deferred-relations type<=-cache primitive-types initialize-package! code->gct-name name->gct-code names->gct-mask name->gct-index gct-code->index gct-index->code gct-names gc-pointer-mask match-gct-mask) 0x109fa58] 0x109fa68] 10 ( (package) package-name-tag . [record 0x109fa78]) (apply-hook-type-code . [reference-trap tag: 14 extra: [triple 0x10df540] 0x10df558]) (record-type-proxy-datum? . [reference-trap tag: 14 extra: [triple 0x10e3dd0] 0x10e3de8]) (record-type-proxy? . [reference-trap tag: 14 extra: [triple 0x10e3e20] 0x10e3e38]) (%dispatch-metatag? . [reference-trap tag: 14 extra: [triple 0x10f7bd0] 0x10f7be8]) (%dispatch-tag-subsets . [reference-trap tag: 14 extra: [triple 0x10f7c20] 0x10f7c38]) (%dispatch-tag-supersets . [reference-trap tag: 14 extra: [triple 0x10f7c70] 0x10f7c88])...[9 more]) 0x109f630]
{0xeb8f28}  ...: [compiled-return-address offset: 0x2c04 entry: 0xf03824]
{0xeb8f30}  ...: #f
{0xeb8f38}  ...: (("types" runtime types) ("dispatch-tag" runtime tagged-dispatch) ("queue" runtime simple-queue) ("equals" runtime equality) ("vector" runtime vector) ("procedure" runtime procedure) ("list" runtime list) ("weak-pair" runtime weak-pair) ("primitive-arithmetic" runtime primitive-arithmetic) ("srfi-1" runtime srfi-1) ...)
{0xeb8f40}  ...: [compiled-closure offset: 0x31c4 entry: 0xf03de4 address: 0x1104780]
{0xeb8f48}  ...: [cell 0x1104760]
{0xeb8f50}  ...: [cell 0x1104758]
{0xeb8f58}  ...: [compiled-return-address offset: 0x133e entry: 0xf01f5e]
{0xeb8f60}  ...: [compiled-closure offset: 0x1865 entry: 0xf02485 address: 0xf0a3c8]
{0xeb8f68}  ...: [compiled-closure offset: 0x18ea entry: 0xf0250a address: 0xf0a3a0]
{0xeb8f70}  ...: [compiled-closure offset: 0x19b5 entry: 0xf025d5 address: 0xf0a378]
{0xeb8f78}  ...: [compiled-closure offset: 0x1a69 entry: 0xf02689 address: 0xf0a350]
{0xeb8f80}  ...: [compiled-closure offset: 0x1af7 entry: 0xf02717 address: 0xf0a328]
{0xeb8f88}  ...: [compiled-closure offset: 0x1b5c entry: 0xf0277c address: 0xf0a2f8]
{0xeb8f90}  ...: [compiled-closure offset: 0x1c5c entry: 0xf0287c address: 0xf0a2b0]
{0xeb8f98}  ...: [compiled-closure offset: 0x1f75 entry: 0xf02b95 address: 0xf0a288]
{0xeb8fa0}  ...: [cell 0xf0a268]
{0xeb8fa8}  ...: [cell 0xf0a260]
{0xeb8fb0}  ...: [cell 0xf0a258]
{0xeb8fb8}  ...: [cell 0xf0a250]
{0xeb8fc0}  ...: [cell 0xf0a248]
{0xeb8fc8}  ...: [cell 0xf0a240]
{0xeb8fd0}  ...: [environment from #(#f [procedure [lambda ()  0xf0a200] 0xf0a210] 82 (null-environment . [reference-trap tag: 14 extra: [triple 0xf1c150] 0xf1c168]) (object-datum . [compiled-procedure offset: 0x1c entry: 0xf13bec]) (object-new-type . [compiled-procedure offset: 0x1c entry: 0xf13b94]) (object-type . [compiled-procedure offset: 0x1c entry: 0xf13b44]) (system-pair-cons . [compiled-procedure offset: 0x1c entry: 0xf13aec]) (vector-cons . [compiled-procedure offset: 0x1c entry: 0xf13a94]) (package-tag . [reference-trap tag: 14 extra: [triple 0xf1c210] 0xf1c228])...[121 more]) 0xf0a230]
{0xeb8fd8}  ...: [compiled-return-address offset: 0xfe3 entry: 0xf01c03]
{0xeb8fe0}  ...: #f
{0xeb8fe8}  ...: [return-to-interpreter]
{0xeb8ff0}
    Return code: [return-code non-existent-continuation]
    Expression: #f

No error handler.
* [tools/runtime.com] Error code 1

make[2]: stopped in /home/riastradh/scheme/mit/master/src
1 error

make[2]: stopped in /home/riastradh/scheme/mit/master/src
* [toolchain] Error code 2

make[1]: stopped in /home/riastradh/scheme/mit/master/src
1 error

make[1]: stopped in /home/riastradh/scheme/mit/master/src
* [stamp_toolchain] Error code 2

make: stopped in /home/riastradh/scheme/mit/master/src
1 error

make: stopped in /home/riastradh/scheme/mit/master/src

Taylor R. Campbell <riastradh>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cph (Posted a comment)
  • -email is unavailable- added by riastradh (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.14-9aa3.
    Corresponding source code