Closed arthurmaciel closed 3 years ago
Interesting, on master I am getting intermittent behavior between the error you noted above and the crash from issue #448
Well, sorry about all this. Let me spend some time getting this sorted out and stabilized...
@justinethier, I had the exact same code working with v0.26
recently. git bisect
tells me here it might be the commit:
[c82e69a997dd3bb02ad2e59515937428ba9379ae] Added import-shared-object
Looks like an issue with a compiler optimization that was recently re-enabled by patching the compiler to call record?
instead of vector?
to test for AST objects. Anyway -
Here is the default behavior, the compiler crashes every time:
justin@justin-OptiPlex-790 ~/Documents/cyclone $ cyclone issue-449.scm
gc_move: bad tag obj=0x7fffd9b5f6c0 obj.tag=176
justin@justin-OptiPlex-790 ~/Documents/cyclone $ cyclone issue-449.scm
gc_move: bad tag obj=0x7fffae714b40 obj.tag=238
justin@justin-OptiPlex-790 ~/Documents/cyclone $ cyclone issue-449.scm
gc_move: bad tag obj=0x7ffc5e3eafa0 obj.tag=73
justin@justin-OptiPlex-790 ~/Documents/cyclone $ cyclone issue-449.scm
gc_move: bad tag obj=0x7ffdac77ad70 obj.tag=139
On the other hand when we explicitly disable the optimization everything works fine:
justin@justin-OptiPlex-790 ~/Documents/cyclone $ cyclone -no-memoization-optimizations issue-449.scm
justin@justin-OptiPlex-790 ~/Documents/cyclone $ ./issue-449
6765justin@justin-OptiPlex-790 ~/Documents/cyclone $ cyclone -no-memoization-optimizations issue-449.scm
justin@justin-OptiPlex-790 ~/Documents/cyclone $ ./issue-449
6765justin@justin-OptiPlex-790 ~/Documents/cyclone $
The next step is to dig into that optimization and figure out how the compiler is broken so bad to both introduce a runtime GC failure as well as the C compilation error.
Selectively disable optimizations that are not compatible with top-level define-c forms.
The reason why c-define
still works even without the import is due to cyclone.scm
importing the cgen module, which in turn imports (cyclone foreign)
. So the macro is compiled into the executable. I believe we can remove those dependencies, though, let me take a look...
OK, compilation breaks without that dependency:
cyclone -A . scheme/cyclone/cgen.sld
Error: Unbound variable(s):
(c->scm)
For now at least the cyclone foreign
macros will be available at compile time even without the import. We may want to revisit this behavior in the future.
That aside, these compilation issues should now be resolved on master
.
Thanks, @justinethier! It is working perfectly now.
With regard to (cyclone foreign)
being available at compile time, maybe in the future we could rename all of its procedures and marcos with low-level names and the (cyclone foreign)
itself could be just a re-exporting of them with the current names.
@justinethier, could you please check if you also get this error with
master
?On
v0.25
:On
v0.26
: