runtime: testing runtime
This commit is contained in:
5
runtime/internal/lib/runtime/debug/debug.go
Normal file
5
runtime/internal/lib/runtime/debug/debug.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package debug
|
||||
|
||||
func SetTraceback(level string) {
|
||||
panic("todo: runtime/debug.SetTraceback")
|
||||
}
|
||||
@@ -7,3 +7,7 @@ package runtime
|
||||
func Caller(skip int) (pc uintptr, file string, line int, ok bool) {
|
||||
panic("todo: runtime.Caller")
|
||||
}
|
||||
|
||||
func Callers(skip int, pc []uintptr) int {
|
||||
panic("todo: runtime.Callers")
|
||||
}
|
||||
|
||||
6
runtime/internal/lib/runtime/internal/syscall/syscall.go
Normal file
6
runtime/internal/lib/runtime/internal/syscall/syscall.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package syscall
|
||||
|
||||
import _ "unsafe"
|
||||
|
||||
// llgo:skipall
|
||||
type _syscall6 struct{}
|
||||
24
runtime/internal/lib/runtime/pprof/pprof.go
Normal file
24
runtime/internal/lib/runtime/pprof/pprof.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package pprof
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// llgo:skipall
|
||||
type Profile struct{}
|
||||
|
||||
func (p *Profile) WriteTo(w io.Writer, verbose bool) (int, error) {
|
||||
panic("WriteTo not implemented")
|
||||
}
|
||||
|
||||
func StartCPUProfile(w io.Writer) error {
|
||||
panic("StartCPUProfile not implemented")
|
||||
}
|
||||
|
||||
func StopCPUProfile() {
|
||||
panic("StopCPUProfile not implemented")
|
||||
}
|
||||
|
||||
func Lookup(name string) *Profile {
|
||||
panic("Lookup not implemented")
|
||||
}
|
||||
@@ -16,8 +16,22 @@
|
||||
|
||||
package runtime
|
||||
|
||||
/*
|
||||
#include <unistd.h>
|
||||
|
||||
int llgo_maxprocs() {
|
||||
#ifdef _SC_NPROCESSORS_ONLN
|
||||
return (int)sysconf(_SC_NPROCESSORS_ONLN);
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
_ "unsafe"
|
||||
"unsafe"
|
||||
|
||||
"github.com/goplus/llgo/runtime/internal/clite/pthread"
|
||||
)
|
||||
|
||||
// llgo:skipall
|
||||
@@ -27,12 +41,23 @@ type _runtime struct{}
|
||||
// GOROOT environment variable, if set at process start,
|
||||
// or else the root used during the Go build.
|
||||
func GOROOT() string {
|
||||
/*
|
||||
s := gogetenv("GOROOT")
|
||||
if s != "" {
|
||||
return s
|
||||
}
|
||||
return defaultGOROOT
|
||||
*/
|
||||
panic("todo: GOROOT")
|
||||
return ""
|
||||
}
|
||||
|
||||
//go:linkname c_maxprocs C.llgo_maxprocs
|
||||
func c_maxprocs() int32
|
||||
|
||||
func GOMAXPROCS(n int) int {
|
||||
return int(c_maxprocs())
|
||||
}
|
||||
|
||||
func Goexit() {
|
||||
pthread.Exit(nil)
|
||||
}
|
||||
|
||||
func KeepAlive(x any) {
|
||||
}
|
||||
|
||||
func write(fd uintptr, p unsafe.Pointer, n int32) int32 {
|
||||
return int32(C.write(C.int(fd), p, C.size_t(n)))
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Layout of in-memory per-function information prepared by linker
|
||||
// See https://golang.org/s/go12symtab.
|
||||
// Keep in sync with linker (../cmd/link/internal/ld/pcln.go:/pclntab)
|
||||
@@ -11,3 +15,33 @@ package runtime
|
||||
type _func struct {
|
||||
unused [8]byte
|
||||
}
|
||||
|
||||
func Stack(buf []byte, all bool) int {
|
||||
panic("todo: runtime.Stack")
|
||||
}
|
||||
|
||||
func StartTrace() error {
|
||||
panic("todo: runtime.StartTrace")
|
||||
}
|
||||
|
||||
func ReadTrace() []byte {
|
||||
panic("todo: runtime.ReadTrace")
|
||||
}
|
||||
|
||||
func StopTrace() {
|
||||
panic("todo: runtime.StopTrace")
|
||||
}
|
||||
|
||||
func ReadMemStats(m *runtime.MemStats) {
|
||||
panic("todo: runtime.ReadMemStats")
|
||||
}
|
||||
|
||||
func SetMutexProfileFraction(rate int) int {
|
||||
panic("todo: runtime.SetMutexProfileFraction")
|
||||
}
|
||||
|
||||
func SetBlockProfileRate(rate int) {
|
||||
panic("todo: runtime.SetBlockProfileRate")
|
||||
}
|
||||
|
||||
var MemProfileRate int = 512 * 1024
|
||||
|
||||
9
runtime/internal/lib/runtime/runtime_gc.go
Normal file
9
runtime/internal/lib/runtime/runtime_gc.go
Normal file
@@ -0,0 +1,9 @@
|
||||
//go:build !nogc
|
||||
|
||||
package runtime
|
||||
|
||||
import "github.com/goplus/llgo/runtime/internal/clite/bdwgc"
|
||||
|
||||
func GC() {
|
||||
bdwgc.Gcollect()
|
||||
}
|
||||
7
runtime/internal/lib/runtime/runtime_nogc.go
Normal file
7
runtime/internal/lib/runtime/runtime_nogc.go
Normal file
@@ -0,0 +1,7 @@
|
||||
//go:build nogc
|
||||
|
||||
package runtime
|
||||
|
||||
func GC() {
|
||||
|
||||
}
|
||||
5
runtime/internal/lib/runtime/trace/trace.go
Normal file
5
runtime/internal/lib/runtime/trace/trace.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package trace
|
||||
|
||||
func userTaskEnd(id uint64) {
|
||||
panic("todo: runtime/trace.userTaskEnd")
|
||||
}
|
||||
Reference in New Issue
Block a user