make runtime compatible with wasm

This commit is contained in:
Li Jie
2025-04-08 16:50:47 +08:00
parent 7c81d9293b
commit be4737461a
183 changed files with 14122 additions and 647 deletions

View File

@@ -22,8 +22,7 @@ import (
c "github.com/goplus/llgo/runtime/internal/clite"
"github.com/goplus/llgo/runtime/internal/clite/debug"
"github.com/goplus/llgo/runtime/internal/clite/pthread"
"github.com/goplus/llgo/runtime/internal/clite/signal"
"github.com/goplus/llgo/runtime/internal/clite/syscall"
"github.com/goplus/llgo/runtime/internal/clite/setjmp"
)
// -----------------------------------------------------------------------------
@@ -137,16 +136,22 @@ const MaxZero = 1024
var ZeroVal [MaxZero]byte
func init() {
signal.Signal(c.Int(syscall.SIGSEGV), func(v c.Int) {
switch syscall.Signal(v) {
case syscall.SIGSEGV:
panic(errorString("invalid memory address or nil pointer dereference"))
default:
var buf [20]byte
panic(errorString("unexpected signal value: " + string(itoa(buf[:], uint64(v)))))
}
})
// func init() {
// signal.Signal(c.Int(syscall.SIGSEGV), func(v c.Int) {
// switch syscall.Signal(v) {
// case syscall.SIGSEGV:
// panic(errorString("invalid memory address or nil pointer dereference"))
// default:
// var buf [20]byte
// panic(errorString("unexpected signal value: " + string(itoa(buf[:], uint64(v)))))
// }
// })
// }
// -----------------------------------------------------------------------------
type SigjmpBuf struct {
Unused [setjmp.SigjmpBufSize]byte
}
// -----------------------------------------------------------------------------