-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Self-host issues related to 'not' or '=' (fantom, haxe, io, nasm, powershell, r, rexx and vala) #418
Comments
Strangely, the vala issue appears to go away if you make this change:
If you remove any number from the list then the assertion errors re-appear and things don't work correctly. It appears to me that the issue appears when the number of mal memory objects allocated is below a certain threshold. @sgtatham any insight you can give on why this is happening and how to fix it? Here is what happens if you run without the addition above:
|
I noted this in #400 but I'm adding it here since this ticket is tracking the issues now: The nasm failure appears to be because the step9_try.mal file is exactly 4096 bytes. Adding or removing a character anywhere in the file fixes the issue (likewise, padding step1 to 4096 makes the problem happen there too). @bendudson can you take a look at why nasm crashes when trying to do load-file of a file that is exactly 4096 bytes?
|
The vala issue is reproducible with
Printing |
I haven't had time to debug the Vala failure properly yet, but I've at least identified the cause of the GLib assertion-failure message. That happens in In an attempt to narrow the problem down, I did a git bisect with the test input files fixed, changing only the Vala implementation itself. That pointed the finger at commit 26ced15, which moved a handful of standard functions out of the Vala source code into files in the I think my best guess would be that somewhere in the chain of calls starting at |
@sgtatham valgrind might be able to help you find it. It might at least confirm what type of thing is being leaked and maybe even where it is happening. |
The clause in eval_ast() which evaluates each element of an input vector into an output vector was holding the intermediate results in an ordinary GLib.List, and putting them all into a vector at the end of the evaluation. But that meant that nothing was preventing all those values from being garbage-collected half way through. Now we make an output Mal.Vector at the start of the process, and point a GC.Root at it to ensure it stays around until we've finished putting items in it. This fixes the vala part of kanaka#418, I think.
Unfortunately, vala is too smart to trigger valgrind errors! If the code had actually used the value after free, valgrind would have helpfully told me where it was freed. But actually the Vala / GLib runtime notices just in time, and doesn't. As it turned out, the important point was not where the value was freed, but where it was allocated, because that was where I should have added the missing |
@sgtatham Good work. Thanks. |
I'm looking at io. |
For me |
@dubek sorry, to be clear, the bugs are revealed by a prior modification to the mal implementation that never made it to master. A version was merged that worked around the problem. Here is the simple diff that should reproduce the issue:
Will trigger this behavior:
|
The following extra step4 tests find a bug in the Io implementation that eventually causes this self-hosting bug: diff --git a/tests/step4_if_fn_do.mal b/tests/step4_if_fn_do.mal
index 0237d227..2d37b57d 100644
--- a/tests/step4_if_fn_do.mal
+++ b/tests/step4_if_fn_do.mal
@@ -431,6 +431,8 @@ nil
;=>false
(= :abc ":abc")
;=>false
+(= (list :abc) (list :abc))
+;=>true
;; Testing vector truthiness
(if [] 7 8)
@@ -465,6 +467,8 @@ nil
;=>true
(= [7 8] [7 8])
;=>true
+(= [:abc] [:abc])
+;=>true
(= (list 1 2) [1 2])
;=>true
(= (list 1) []) Now I'll try to hunt it down. |
From my local tests #425 should solve the self-hosting issue in io . |
@asarhaddon had a modification to how self-hosting works (captured here:
809d74c) that triggered some issues in fantom, haxe, io, nasm, powershell, r, rexx and vala. Here is the Travis self-hosted test where the issue manifested:
https://travis-ci.org/kanaka/mal/builds/558757626
The text was updated successfully, but these errors were encountered: