From a9350bf016802f12a08199b652782aa573509f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20IRMAK?= Date: Wed, 28 May 2025 10:32:52 +0300 Subject: [PATCH 1/3] reflect: Chan related stubs --- src/reflect/type.go | 4 ++++ src/reflect/value.go | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/reflect/type.go b/src/reflect/type.go index 7c74aa8e1a..828cf12e27 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -529,3 +529,7 @@ func FuncOf(in, out []Type, variadic bool) Type { return toType(reflectlite.FuncOf(rawIn, rawOut, variadic)) } + +func ChanOf(dir ChanDir, t Type) Type { + panic("unimplemented: reflect.ChanOf") +} diff --git a/src/reflect/value.go b/src/reflect/value.go index 5d8c25f2d1..cf186c2ce1 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -178,6 +178,10 @@ func (v Value) Send(x Value) { panic("unimplemented: reflect.Value.Send()") } +func (v Value) TrySend(x Value) bool { + panic("unimplemented: reflect.Value.TrySend()") +} + func (v Value) Close() { panic("unimplemented: reflect.Value.Close()") } @@ -217,6 +221,10 @@ func (v Value) Recv() (x Value, ok bool) { panic("unimplemented: (reflect.Value).Recv()") } +func (v Value) TryRecv() (x Value, ok bool) { + panic("unimplemented: (reflect.Value).TryRecv()") +} + func NewAt(typ Type, p unsafe.Pointer) Value { panic("unimplemented: reflect.New()") } From aded3805f22dcd8a23f4479c8441b5e08cb04f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20IRMAK?= Date: Wed, 28 May 2025 10:33:03 +0300 Subject: [PATCH 2/3] metrics: flesh out some of the metric types --- src/runtime/metrics/metrics.go | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/runtime/metrics/metrics.go b/src/runtime/metrics/metrics.go index 00108f84d5..2b46524c1d 100644 --- a/src/runtime/metrics/metrics.go +++ b/src/runtime/metrics/metrics.go @@ -2,15 +2,26 @@ package metrics -type Description struct{} +type Description struct { + Name string + Description string + Kind ValueKind + Cumulative bool +} func All() []Description { return nil } -type Float64Histogram struct{} +type Float64Histogram struct { + Counts []uint64 + Buckets []float64 +} -type Sample struct{} +type Sample struct { + Name string + Value Value +} func Read(m []Sample) {} @@ -23,10 +34,17 @@ func (v Value) Float64Histogram() *Float64Histogram { return nil } func (v Value) Kind() ValueKind { - return ValueKind{} + return KindBad } func (v Value) Uint64() uint64 { return 0 } -type ValueKind struct{} +type ValueKind int + +const ( + KindBad ValueKind = iota + KindUint64 + KindFloat64 + KindFloat64Histogram +) From 4890e661eed8868d0dc5d89d6db3b14372918b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20IRMAK?= Date: Wed, 28 May 2025 10:35:09 +0300 Subject: [PATCH 3/3] runtime/debug: add GC related stubs --- src/runtime/debug/garbage.go | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/runtime/debug/garbage.go diff --git a/src/runtime/debug/garbage.go b/src/runtime/debug/garbage.go new file mode 100644 index 0000000000..cf6cac0493 --- /dev/null +++ b/src/runtime/debug/garbage.go @@ -0,0 +1,37 @@ +// Package debug is a very partially implemented package to allow compilation. +package debug + +import ( + "time" +) + +type GCStats struct { + LastGC time.Time + NumGC int64 + PauseTotal time.Duration + Pause []time.Duration + PauseEnd []time.Time + PauseQuantiles []time.Duration +} + +func ReadGCStats(stats *GCStats) { +} + +func FreeOSMemory() { +} + +func SetMaxThreads(threads int) int { + return threads +} + +func SetPanicOnFault(enabled bool) bool { + return enabled +} + +func WriteHeapDump(fd uintptr) + +func SetTraceback(level string) + +func SetMemoryLimit(limit int64) int64 { + return limit +}