Fix VM memory allocation optimizations by reducing what we allocate on the heap
Some checks failed
Build / build (push) Successful in 10m25s
Publish Image / publish (push) Failing after 39s
Test / build (push) Successful in 11m19s

This commit is contained in:
Charles Smith
2024-03-31 20:44:50 -04:00
parent a85dc73954
commit aebbe43999
61 changed files with 383 additions and 370 deletions

View File

@@ -17,25 +17,24 @@ func IdOf(args ...object.Object) object.Object {
arg := args[0]
if n, ok := arg.(*object.Null); ok {
return &object.String{Value: fmt.Sprintf("%p", n)}
} else if b, ok := arg.(*object.Boolean); ok {
return &object.String{Value: fmt.Sprintf("%p", b)}
} else if i, ok := arg.(*object.Integer); ok {
return &object.String{Value: fmt.Sprintf("%p", i)}
} else if s, ok := arg.(*object.String); ok {
return &object.String{Value: fmt.Sprintf("%p", s)}
if n, ok := arg.(object.Null); ok {
return object.String{Value: fmt.Sprintf("%p", &n)}
} else if b, ok := arg.(object.Boolean); ok {
return object.String{Value: fmt.Sprintf("%p", &b)}
} else if i, ok := arg.(object.Integer); ok {
return object.String{Value: fmt.Sprintf("%p", &i)}
} else if s, ok := arg.(object.String); ok {
return object.String{Value: fmt.Sprintf("%p", &s)}
} else if a, ok := arg.(*object.Array); ok {
return &object.String{Value: fmt.Sprintf("%p", a)}
return object.String{Value: fmt.Sprintf("%p", a)}
} else if h, ok := arg.(*object.Hash); ok {
return &object.String{Value: fmt.Sprintf("%p", h)}
return object.String{Value: fmt.Sprintf("%p", h)}
} else if f, ok := arg.(*object.Function); ok {
return &object.String{Value: fmt.Sprintf("%p", f)}
return object.String{Value: fmt.Sprintf("%p", f)}
} else if c, ok := arg.(*object.Closure); ok {
return &object.String{Value: fmt.Sprintf("%p", c)}
return object.String{Value: fmt.Sprintf("%p", c)}
} else if b, ok := arg.(*object.Builtin); ok {
return &object.String{Value: fmt.Sprintf("%p", b)}
return object.String{Value: fmt.Sprintf("%p", b)}
}
return nil
}