Skip to content
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

panic: variable cons not bound #41

Closed
lbuczkow opened this issue Nov 11, 2022 · 4 comments
Closed

panic: variable cons not bound #41

lbuczkow opened this issue Nov 11, 2022 · 4 comments

Comments

@lbuczkow
Copy link

A fresh build on mac (Ventura) does not work:

~/shen % git clone https://github.com/tiancaiamao/shen-go.git
Cloning into 'shen-go'...
remote: Enumerating objects: 2422, done.
remote: Counting objects: 100% (161/161), done.
remote: Compressing objects: 100% (105/105), done.
remote: Total 2422 (delta 83), reused 108 (delta 55), pack-reused 2261
Receiving objects: 100% (2422/2422), 5.09 MiB | 1.12 MiB/s, done.
Resolving deltas: 100% (1455/1455), done.

~/shen % cd shen-go

~/shen/shen-go % go version
go version go1.19.3 darwin/amd64

~/shen/shen-go % make all
go install github.com/tiancaiamao/shen-go/cmd/kl
go build -o shen github.com/tiancaiamao/shen-go/cmd/shen

~/shen/shen-go % ./shen
panic: variable cons not bound

goroutine 1 [running]:
github.com/tiancaiamao/shen-go/klambda.PrimNS1Value(0xc0003c3940?)
/Users/lb/shen/shen-go/klambda/primitives.go:761 +0xa8
main.glob..func3(0xc000065240)
/Users/lb/shen/shen-go/cmd/shen/kl.go:5029 +0x508
github.com/tiancaiamao/shen-go/klambda.myCall(0xc000065240)
/Users/lb/shen/shen-go/klambda/inst.go:287 +0xd6
github.com/tiancaiamao/shen-go/klambda.(*ControlFlow).Call(0xc000065240, 0xc000064000?, {0x0, 0x0, 0x100714780?})
/Users/lb/shen/shen-go/klambda/inst.go:263 +0x1d3
github.com/tiancaiamao/shen-go/klambda.Call(...)
/Users/lb/shen/shen-go/klambda/inst.go:252
main.regist(0x1007899a1?)
/Users/lb/shen/shen-go/cmd/shen/main.go:40 +0x151
main.main()
/Users/lb/shen/shen-go/cmd/shen/main.go:74 +0x1f2

@tiancaiamao
Copy link
Owner

You can try a release version, such as

git checkout v1.0
make all

master is not stable.

@lbuczkow
Copy link
Author

It did not build out of the box (go version go1.19.3 darwin/amd64):

cora/types.go:277:11: undefined: syscall.MAP_ANONYMOUS

Built successfully after changing the line 277 to:

syscall.MAP_ANON|syscall.MAP_PRIVATE /flags int/)

I am looking forward to shen-go hopefully updated to kernel 33.

@tiancaiamao
Copy link
Owner

It did not build out of the box (go version go1.19.3 darwin/amd64):

cora/types.go:277:11: undefined: syscall.MAP_ANONYMOUS

Built successfully after changing the line 277 to:

syscall.MAP_ANON|syscall.MAP_PRIVATE /flags int/)

Oops ... the syscall syscall.MAP_ANONYMOUS is not defined in darwin/amd64, I use linux

syscall.MAP_ANONYMOUS is a kind of trick I played in to past to avoid integer allocation.
That is, use a virtial address range [fixnumBaseAddr, fixnumEndAddr) to represent fixnum.
A unsafe pointer could be a fixnum, or a heap allocated Obj, depend on whether it locates in the [fixnumBaseAddr, fixnumEndAddr) range. That virtual address range does not need a physical mem mapping, so I use the mmap to play the trick.

I realized that use mmap is not necessary, because the OS already use virtual memory address
var mem [1<<20]byte does not make physical allocation if the data is not touched.

Try the latest master, I fix the build now.

I am looking forward to shen-go hopefully updated to kernel 33.

I'll do it later. @lbuczkow

@tiancaiamao
Copy link
Owner

I've created another issue for the upgrade #45, so this one can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants