ghewgill/neon-lang

Using bin/neon to execute precompiled bytecode fails

gitlarryf opened this issue · 2 comments

The following code illustrates an issue where using bin/neon to execute a pre-compiled neonx file will result in the stack not being empty during application shutdown.

IMPORT textio

TRY
    VAR s: String := ""
    VAR f: textio.TextFile := textio.open("tmp/io-test.tmp", textio.Mode.write)
    textio.close(f)
    print("\(textio.readLine(f, OUT s))")
TRAP textio.TextioException AS e DO
    print("\(e.toString())")
END TRY 

Once that code is compiled with bin/neonc, execute the compiled .neonx file with bin/neon. It is also interesting to note that calling this code with bin/neon on the /source code/ file results in correct stack behaviour/handling. Calling bin/neon on the pre-compiled bytecode file results in different behavior.

Unable to reproduce.

greg:~/neon-lang$ bin/neon test.neon
<ExceptionType:TextioException.InvalidFile,,0,24>
greg:~/neon-lang$ bin/neonc test.neon
Compiling test.neon...
greg:~/neon-lang$ bin/neonx test.neonx
<ExceptionType:TextioException.InvalidFile,,0,24>
greg:~/neon-lang$ bin/neon test.neonx
<ExceptionType:TextioException.InvalidFile,,0,24>
greg:~/neon-lang$

Reopening due to root cause identification. The neon binary was opening the neonx bytecode file in text mode, which failed on Windows.