Skip to content

Commit 5425504

Browse files
committed
DeepCopy -> unrefCopy
1 parent f79703f commit 5425504

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

gnovm/pkg/gnolang/uverse.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func UverseNode() *PackageNode {
211211
list := make([]TypedValue, argsl)
212212
if 0 < argsl {
213213
for i := 0; i < argsl; i++ {
214-
list[i] = argsb.List[argso+i].DeepCopy(m.Alloc, m.Store)
214+
list[i] = argsb.List[argso+i].unrefCopy(m.Alloc, m.Store)
215215
}
216216
}
217217
m.PushValue(TypedValue{
@@ -296,9 +296,9 @@ func UverseNode() *PackageNode {
296296
if argsb.Data == nil {
297297
for i := 0; i < argsl; i++ {
298298
oldElem := list[xvo+xvl+i]
299-
// DeepCopy will resolve references and copy their values to prevent
300-
// reference copying rather than copying the underlying values.
301-
newElem := argsb.List[argso+i].DeepCopy(m.Alloc, m.Store)
299+
// unrefCopy will resolve references and copy their values
300+
// to copy by value rather than by reference.
301+
newElem := argsb.List[argso+i].unrefCopy(m.Alloc, m.Store)
302302
list[xvo+xvl+i] = newElem
303303

304304
m.Realm.DidUpdate(
@@ -376,7 +376,7 @@ func UverseNode() *PackageNode {
376376
if 0 < xvl {
377377
if xvb.Data == nil {
378378
for i := 0; i < xvl; i++ {
379-
list[i] = xvb.List[xvo+i].DeepCopy(m.Alloc, m.Store)
379+
list[i] = xvb.List[xvo+i].unrefCopy(m.Alloc, m.Store)
380380
}
381381
} else {
382382
panic("should not happen")
@@ -392,7 +392,7 @@ func UverseNode() *PackageNode {
392392
if 0 < argsl {
393393
if argsb.Data == nil {
394394
for i := 0; i < argsl; i++ {
395-
list[xvl+i] = argsb.List[argso+i].DeepCopy(m.Alloc, m.Store)
395+
list[xvl+i] = argsb.List[argso+i].unrefCopy(m.Alloc, m.Store)
396396
}
397397
} else {
398398
copyDataToList(
@@ -473,7 +473,7 @@ func UverseNode() *PackageNode {
473473
list := make([]TypedValue, listLen)
474474
if 0 < xvl {
475475
for i := 0; i < listLen; i++ {
476-
list[i] = xvb.List[xvo+i].DeepCopy(m.Alloc, m.Store)
476+
list[i] = xvb.List[xvo+i].unrefCopy(m.Alloc, m.Store)
477477
}
478478
}
479479
if 0 < argsl {

gnovm/pkg/gnolang/values.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,9 +1027,9 @@ func (tv TypedValue) Copy(alloc *Allocator) (cp TypedValue) {
10271027
return
10281028
}
10291029

1030-
// DeepCopy makes of copy of the underlying value in the case of reference values.
1030+
// unrefCopy makes a copy of the underlying value in the case of reference values.
10311031
// It copies other values as expected using the normal Copy method.
1032-
func (tv TypedValue) DeepCopy(alloc *Allocator, store Store) (cp TypedValue) {
1032+
func (tv TypedValue) unrefCopy(alloc *Allocator, store Store) (cp TypedValue) {
10331033
switch tv.V.(type) {
10341034
case RefValue:
10351035
cp.T = tv.T

0 commit comments

Comments
 (0)