Comments (6)
Now janet can pass all tests on test files 1,2,3,5.
Huge progress.
For failed tests on suite[0,4].janet I will open new issue.
from janet.
pulled latest. recompiled.
Notes:
- All 112 tests passed from suite2.janet
- Bus error from suite3.janet, I cut related code:
(var num-tests-passed 0)
(var numchecks 0)
(var num-tests-run 0)
(defn assert [x e]
(++ num-tests-run)
(when x (++ num-tests-passed))
(if x
(do
(when (= numchecks 25)
(set numchecks 0)
(print))
(++ numchecks)
(file/write stdout "\e[32m?\e[0m"))
(do
(file/write stdout "\n\e[31m?\e[0m ")
(set numchecks 0)
(print e)))
x)
(defn check-deep
[pat text what]
(def result (peg/match pat text))
(assert (deep= result what) text))
(def csv
'{:field (+
(* `"` (% (any (+ (<- (if-not `"` 1)) (* (constant `"`) `""`)))) `"`)
(<- (any (if-not (set ",\n") 1))))
:main (* :field (any (* "," :field)) (+ "\n" -1))})
(defn check-csv
[str res]
(check-deep csv str res))
(check-csv "1,\"2\",3" @["1" "2" "3"])
New core print:
core 'core' of 7053: ./build/janet tt.janet
0000000100037e24 peg_rule (1001a36dc, 1001ad8f8, 1001a36dc, 1000253e8, 100037600, ffffffff7ffff4a0) + 650
0000000100037bbc peg_rule (1001ad8f0, 1001ad8f4, 1001a36dc, 1000253e8, 100037600, ffffffff7ffff4a0) + 3e8
0000000100037d20 peg_rule (1001a36dc, 1001ad8b8, 1001a36dc, ffffffff, 1, ffffffff7ffff4a0) + 54c
0000000100038170 peg_rule (ffffffff7ffff4a0, 1001ad89c, 1001a36db, 1, 0, ffffffff7ffff4a0) + 99c
0000000100037bbc peg_rule (1001ad888, 1001ad88c, 1001a36db, 1000253e8, 100037600, ffffffff7ffff4a0) + 3e8
0000000100037b00 peg_rule (2, 1001ad878, 1001a36da, 1000253e8, 100037600, ffffffff7ffff4a0) + 32c
0000000100037d20 peg_rule (1001a36d9, 1001ad96c, 1001a36d9, ffffffff, 0, ffffffff7ffff4a0) + 54c
0000000100037bbc peg_rule (1001ad864, 1001ad868, 1001a36d9, 1000253e8, 100037600, ffffffff7ffff4a0) + 3e8
0000000100039cd0 cfun_peg_match (2, 1001ac9e8, 1001a36d8, 1001ad840, 7, 1001a36df) + cc
0000000100044ddc run_vm (1001ac8e0, ffffffff7f5c2a6c, ffffffff7f5c2a70, 100043178, 2, 1001ab61c) + 1790
000000010004362c janet_continue (1, ffffffff7f5c2aa8, ffffffff7ffff810, fffffffffffffff0, ffffffffffffffe0, ffffffffffffffe8) + 2fc
0000000100043e54 run_vm (1001a7690, ffffffff7f5c2a6c, ffffffff7f5c2a70, 100043178, 1001aa7d0, 10016f104) + 808
000000010004362c janet_continue (1, ffffffff7f5c2aa8, ffffffff7ffffa38, fffffffffffffff0, ffffffffffffffe0, ffffffffffffffe8) + 2fc
000000010003b9f0 janet_dobytes (100150e20, 1001a7690, bbb, 100025fd8, ffffffff7ffffa68, 0) + e8
0000000100046d30 main (2, ffffffff7ffffc48, 100150e20, 100178a60, 100046b9c, 100025fd0) + f8
0000000100026064 _start (0, 0, 0, 0, 0, 0) + 64
from janet.
Ok, so that's an improvement. Maybe add the -g
flag to the Makefile CFLAGS so we can see which exact line is the issue (although I'm not sure if SPARC will provide that info). peg_rule
is the function that interprets peg grammars at runtime, so is basically a big switch case. It would be helpful to know which rule caused the issue.
I also believe that the cause of the crash either has to do with alignment issues from pointer arithmetic that assumed too much, and less likely assuming little-endian.
from janet.
the same with -g:
# pstack ./core
core './core' of 15772: ./build/janet tt.janet
0000000100037e24 peg_rule (1001a36dc, 1001ad8f8, 1001a36dc, 100025360, 100037600, ffffffff7ffff3e0) + 650 (peg.c:298)
0000000100037bbc peg_rule (1001ad8f0, 1001ad8f4, 1001a36dc, 100025360, 100037600, ffffffff7ffff3e0) + 3e8 (peg.c:212)
0000000100037d20 peg_rule (1001a36dc, 1001ad8b8, 1001a36dc, ffffffff, 1, ffffffff7ffff3e0) + 54c (peg.c:255)
0000000100038170 peg_rule (ffffffff7ffff3e0, 1001ad89c, 1001a36db, 1, 0, ffffffff7ffff3e0) + 99c (peg.c:332)
0000000100037bbc peg_rule (1001ad888, 1001ad88c, 1001a36db, 100025360, 100037600, ffffffff7ffff3e0) + 3e8 (peg.c:212)
0000000100037b00 peg_rule (2, 1001ad878, 1001a36da, 100025360, 100037600, ffffffff7ffff3e0) + 32c (peg.c:194)
0000000100037d20 peg_rule (1001a36d9, 1001ad96c, 1001a36d9, ffffffff, 0, ffffffff7ffff3e0) + 54c (peg.c:255)
0000000100037bbc peg_rule (1001ad864, 1001ad868, 1001a36d9, 100025360, 100037600, ffffffff7ffff3e0) + 3e8 (peg.c:212)
0000000100039cd0 cfun_peg_match (2, 1001ac9e8, 1001a36d8, 1001ad840, 7, 1001a36df) + cc (peg.c:1061)
0000000100044ddc run_vm (1001ac8e0, ffffffff7f5c2a6c, ffffffff7f5c2a70, 100043178, 2, 1001ab61c) + 1790 (vm.c:578)
000000010004362c janet_continue (1, ffffffff7f5c2aa8, ffffffff7ffff750, fffffffffffffff0, ffffffffffffffe0, ffffffffffffffe8) + 2fc (vm.c:832)
0000000100043e54 run_vm (1001a7690, ffffffff7f5c2a6c, ffffffff7f5c2a70, 100043178, 1001aa7d0, 10016f104) + 808 (vm.c:636)
000000010004362c janet_continue (1, ffffffff7f5c2aa8, ffffffff7ffff978, fffffffffffffff0, ffffffffffffffe0, ffffffffffffffe8) + 2fc (vm.c:832)
000000010003b9f0 janet_dobytes (100150e20, 1001a7690, bbb, 100025a60, ffffffff7ffff9a8, 0) + e8 (run.c:50)
0000000100046d30 main (2, ffffffff7ffffb98, 100150e20, 100178a60, 100046b9c, 100025fe0) + f8 (main.c:50)
0000000100026064 _start (0, 0, 0, 0, 0, 0) + 64
from janet.
Ah, I think I can guess the culprit - probably the make_peg
function that is doing pointer arithmetic to pack multiple arrays into one malloc (the peg->constants
array was, I guess, not correctly aligned). Some changes in 9495be3 should fix the bus error (hopefully).
from janet.
I will try again in 7days, im on vacation now. Sorry for delay.
from janet.
Related Issues (20)
- The case for a context object HOT 2
- The default meson option `epoll=false` causes a busy loop and segmentation fault. HOT 10
- Proposal: Terse Chained Indices HOT 19
- Reimplement `slurp` with `os/open`. HOT 28
- A way to read standard input in the background without `file/read` in a thread. HOT 4
- `each` macro improper behavior? HOT 8
- `if-let` breaks tail call optimization. HOT 6
- false branch of `if-let` doesn't report the correct call stack information. HOT 4
- `ev/select` should not resume a dead task. HOT 4
- `try` and `defer` break tail call optimization. HOT 4
- `(= @"update" @"update")` is `false`. HOT 3
- `ev/select` still revives fibers.... HOT 2
- option to unbundle docstrings and potential consequences HOT 8
- splicing into structs/tables HOT 2
- Disasm/asm doesn't round-trip for function with unused argument HOT 1
- eventloop/networking gets stuck on musl HOT 11
- Consider making `module/paths` a dynamic variable HOT 4
- Can it run on iOS? Thank you. HOT 3
- `os/strftime` doesn't respect environment variables.
- Re-integrate jpm into janet HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from janet.