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

chore: remove All nativeType and nativeValues #3677

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/gno.land/p/demo/flow/io_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"time"

ios_test "os_test"
ios_test "os"
)

// XXX ugh, I can't even sleep milliseconds.
Expand All @@ -30,7 +30,7 @@ func nextStatus(m *Monitor) Status {
if s := m.Status(); s.Samples != samples {
return s
}
ios_test.Sleep(5 * time.Millisecond)
ios_test.Sleep(int64(5 * time.Millisecond))
}
return m.Status()
}
Expand Down Expand Up @@ -70,7 +70,7 @@ func TestReader(t *testing.T) {

// 2nd read of 10 bytes blocks until the next sample
// r.SetBlocking(true)
ios_test.Sleep(100 * time.Millisecond)
ios_test.Sleep(int64(100 * time.Millisecond))
if n, err := r.Read(b[10:]); n != 10 {
t.Fatalf("r.Read(b[10:]) expected 10 (<nil>); got %v", n)
} else if err != nil {
Expand Down Expand Up @@ -137,7 +137,7 @@ func _TestWriter(t *testing.T) {
// XXX and it returns ErrLimit after 20. What we want is to keep waiting until 80 is returned,
// XXX but blocking isn't supported. Sleeping 800 shouldn't be sufficient either (its a burst).
// XXX This limits the usage of Limiter and m.Limit().
ios_test.Sleep(800 * time.Millisecond)
ios_test.Sleep(int64(800 * time.Millisecond))
if n, err := w.Write(b[20:]); n < 80 {
} else if n != 80 || err != nil {
t.Fatalf("w.Write(b[20:]) expected 80 (<nil>); got %v (%v)", n, err.Error())
Expand Down
10 changes: 5 additions & 5 deletions examples/gno.land/p/demo/tamagotchi/z0_filetest.gno
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"os_test"
"os"
"time"

"gno.land/p/demo/tamagotchi"
Expand All @@ -14,7 +14,7 @@ func main() {
println(t.Markdown())

println("\n-- WAIT 20 minutes\n")
os_test.Sleep(20 * time.Minute)
os.Sleep(20 * time.Minute)
println(t.Markdown())

println("\n-- FEEDx3, PLAYx2, HEALx4\n")
Expand All @@ -30,15 +30,15 @@ func main() {
println(t.Markdown())

println("\n-- WAIT 20 minutes\n")
os_test.Sleep(20 * time.Minute)
os.Sleep(20 * time.Minute)
println(t.Markdown())

println("\n-- WAIT 20 hours\n")
os_test.Sleep(20 * time.Hour)
os.Sleep(20 * time.Hour)
println(t.Markdown())

println("\n-- WAIT 20 hours\n")
os_test.Sleep(20 * time.Hour)
os.Sleep(20 * time.Hour)
println(t.Markdown())
}

Expand Down
2 changes: 1 addition & 1 deletion examples/no_cycles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

// XXX: move this into `gno lint`

var injectedTestingLibs = []string{"encoding/json", "fmt", "os", "os_test"}
var injectedTestingLibs = []string{"encoding/json", "fmt", "os"}

// TestNoCycles checks that there is no import cycles in stdlibs and non-draft examples
func TestNoCycles(t *testing.T) {
Expand Down
9 changes: 0 additions & 9 deletions gnovm/pkg/gnolang/alloc.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package gnolang

import "reflect"

// Keeps track of in-memory allocations.
// In the future, allocations within realm boundaries will be
// (optionally?) condensed (objects to be GC'd will be discarded),
Expand Down Expand Up @@ -299,13 +297,6 @@ func (alloc *Allocator) NewBlock(source BlockNode, parent *Block) *Block {
return NewBlock(source, parent)
}

func (alloc *Allocator) NewNative(rv reflect.Value) *NativeValue {
alloc.AllocateNative()
return &NativeValue{
Value: rv,
}
}

func (alloc *Allocator) NewType(t Type) Type {
alloc.AllocateType()
return t
Expand Down
1 change: 0 additions & 1 deletion gnovm/pkg/gnolang/alloc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func TestAllocSizes(t *testing.T) {
println("MapValue{}", unsafe.Sizeof(MapValue{}))
println("BoundMethodValue{}", unsafe.Sizeof(BoundMethodValue{}))
println("Block{}", unsafe.Sizeof(Block{}))
println("NativeValue{}", unsafe.Sizeof(NativeValue{}))
println("TypeValue{}", unsafe.Sizeof(TypeValue{}))
println("TypedValue{}", unsafe.Sizeof(TypedValue{}))
println("ObjectInfo{}", unsafe.Sizeof(ObjectInfo{}))
Expand Down
17 changes: 1 addition & 16 deletions gnovm/pkg/gnolang/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type Frame struct {

// call frame
Func *FuncValue // function value
GoFunc *NativeValue // go function value
Receiver TypedValue // if bound method
NumArgs int // number of arguments in call
IsVarg bool // is form fncall(???, vargs...)
Expand All @@ -47,16 +46,6 @@ func (fr Frame) String() string {
fr.NumBlocks,
fr.LastPackage.PkgPath,
fr.LastRealm)
} else if fr.GoFunc != nil {
return fmt.Sprintf("[FRAME GOFUNC:%v RECV:%s (%d args) %d/%d/%d/%d/%d]",
fr.GoFunc.Value,
fr.Receiver,
fr.NumArgs,
fr.NumOps,
fr.NumValues,
fr.NumExprs,
fr.NumStmts,
fr.NumBlocks)
} else {
return fmt.Sprintf("[FRAME LABEL: %s %d/%d/%d/%d/%d]",
fr.Label,
Expand All @@ -69,7 +58,7 @@ func (fr Frame) String() string {
}

func (fr *Frame) IsCall() bool {
return fr.Func != nil || fr.GoFunc != nil
return fr.Func != nil
}

func (fr *Frame) PushDefer(dfr Defer) {
Expand All @@ -90,7 +79,6 @@ func (fr *Frame) PopDefer() (res Defer, ok bool) {

type Defer struct {
Func *FuncValue // function value
GoFunc *NativeValue // go function value
Args []TypedValue // arguments
Source *DeferStmt // source
Parent *Block
Expand Down Expand Up @@ -127,9 +115,6 @@ func (s Stacktrace) String() string {
case call.Frame.Func != nil:
fmt.Fprintf(&builder, "%s\n", toExprTrace(cx))
fmt.Fprintf(&builder, " %s/%s:%d\n", call.Frame.Func.PkgPath, call.Frame.Func.FileName, call.Stmt.GetLine())
case call.Frame.GoFunc != nil:
fmt.Fprintf(&builder, "%s\n", toExprTrace(cx))
fmt.Fprintf(&builder, " gofunction:%s\n", call.Frame.GoFunc.Value.Type())
default:
panic("StacktraceCall has a non-call Frame")
}
Expand Down
Loading
Loading