Discussion:
[racket] ill-formed code (unexpected graph structure) with custom #lang
Dmitry Pavlov
2015-02-07 21:56:20 UTC
Permalink
Hello,

Racket seems to have an issue with programs compiled by raco make:


$ racket test.slon
OK

$ raco make test.slon
$ racket test.slon
compiled/test_slon.zo: : read (compiled): ill-formed code (unexpected
graph structure)
context...:
standard-module-name-resolver

$ rm compiled/test_slon.zo
$ racket test.slon
OK

"slon" is a custom language implemented in Racket. I am not sure if it
matters. Anyway, as soon as I delete compiled/test_slon.zo, it starts to
work, even with the "slon/compiled" and "slon/lang/compiled" directories
left intact.

The test_slon.zo file is 3 KB, the program does nearly nothing, and I
have no idea what causes the error. Here is the compiled file (encoded
in base64):

http://pastebin.com/r1kCi5ki

I am having this trouble in Racket 6.1.1.6, and had it with prior
versions (but not all of them -- some time ago everything worked as
expected, but I forgot which version that was).

Is there anything I can do to help to track down the bug?

Best regards,

Dmitry
____________________
Racket Users list:
http://lists.racket-lang.org/users
Matthew Flatt
2015-02-09 23:56:26 UTC
Permalink
It looks like the module has associated language info that contains a
hash table, and the bytecode reader doesn't handle the hash table
properly in that context.

You can work around the problem by choosing a different representation
of language info for "slon".
Post by Dmitry Pavlov
Hello,
$ racket test.slon
OK
$ raco make test.slon
$ racket test.slon
compiled/test_slon.zo: : read (compiled): ill-formed code (unexpected
graph structure)
standard-module-name-resolver
$ rm compiled/test_slon.zo
$ racket test.slon
OK
"slon" is a custom language implemented in Racket. I am not sure if it
matters. Anyway, as soon as I delete compiled/test_slon.zo, it starts to
work, even with the "slon/compiled" and "slon/lang/compiled" directories
left intact.
The test_slon.zo file is 3 KB, the program does nearly nothing, and I
have no idea what causes the error. Here is the compiled file (encoded
http://pastebin.com/r1kCi5ki
I am having this trouble in Racket 6.1.1.6, and had it with prior
versions (but not all of them -- some time ago everything worked as
expected, but I forgot which version that was).
Is there anything I can do to help to track down the bug?
Best regards,
Dmitry
____________________
http://lists.racket-lang.org/users
____________________
Racket Users list:
http://lists.racket-lang.org/users
Dmitry Pavlov
2015-02-11 08:20:36 UTC
Permalink
Matthew,

Thanks! You were right about the hash table issue, and your patch works.

Best regards,

Dmitry
I've pushed a repair to the bytecode writer to avoid this problem in
the future.
Post by Matthew Flatt
It looks like the module has associated language info that contains a
hash table, and the bytecode reader doesn't handle the hash table
properly in that context.
You can work around the problem by choosing a different representation
of language info for "slon".
Post by Dmitry Pavlov
Hello,
$ racket test.slon
OK
$ raco make test.slon
$ racket test.slon
compiled/test_slon.zo: : read (compiled): ill-formed code (unexpected
graph structure)
standard-module-name-resolver
$ rm compiled/test_slon.zo
$ racket test.slon
OK
"slon" is a custom language implemented in Racket. I am not sure if it
matters. Anyway, as soon as I delete compiled/test_slon.zo, it starts to
work, even with the "slon/compiled" and "slon/lang/compiled" directories
left intact.
The test_slon.zo file is 3 KB, the program does nearly nothing, and I
have no idea what causes the error. Here is the compiled file (encoded
http://pastebin.com/r1kCi5ki
I am having this trouble in Racket 6.1.1.6, and had it with prior
versions (but not all of them -- some time ago everything worked as
expected, but I forgot which version that was).
Is there anything I can do to help to track down the bug?
Best regards,
Dmitry
____________________
http://lists.racket-lang.org/users
____________________
http://lists.racket-lang.org/users
____________________
Racket Users list:
http://lists.racket-lang.org/users

Loading...