make runtime compatible with wasm
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
// Hashing algorithm inspired by
|
||||
// wyhash: https://github.com/wangyi-fudan/wyhash/blob/ceb019b530e2c1c14d70b79bfa2bc49de7d95bc1/Modern%20Non-Cryptographic%20Hash%20Function%20and%20Pseudorandom%20Number%20Generator.pdf
|
||||
|
||||
//go:build 386 || arm || mips || mipsle
|
||||
//go:build 386 || arm || mips || mipsle || wasm
|
||||
|
||||
package runtime
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Hashing algorithm inspired by
|
||||
// wyhash: https://github.com/wangyi-fudan/wyhash
|
||||
|
||||
//go:build amd64 || arm64 || loong64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm
|
||||
//go:build amd64 || arm64 || loong64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x
|
||||
|
||||
package runtime
|
||||
|
||||
|
||||
@@ -136,13 +136,13 @@ func printanycustomtype(i any) {
|
||||
}
|
||||
case abi.Float32:
|
||||
if isDirectIface(e._type) {
|
||||
print(typestring, "(", bitcast.ToFloat32((uintptr(e.data))), ")")
|
||||
print(typestring, "(", bitcast.ToFloat32(int32(uintptr(e.data))), ")")
|
||||
} else {
|
||||
print(typestring, "(", *(*float32)(e.data), ")")
|
||||
}
|
||||
case abi.Float64:
|
||||
if isDirectIface(e._type) {
|
||||
print(typestring, "(", bitcast.ToFloat64(uintptr(e.data)), ")")
|
||||
print(typestring, "(", bitcast.ToFloat64(int64(uintptr(e.data))), ")")
|
||||
} else {
|
||||
print(typestring, "(", *(*float64)(e.data), ")")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user