// clone makes a copy of value, and may update string values found in value // with a cloned version of those strings. The purpose of explicitly cloning // strings is to avoid accidentally giving a large string a long lifetime. // // Note that this will clone strings in structs and arrays found in value, // and will clone value if it itself is a string. It will not, however, clone // strings if value is of interface or slice type (that is, found via an // indirection). func clone[T comparable](value T, seq *cloneSeq) T { … } var singleStringClone … type cloneSeq … // makeCloneSeq creates a cloneSeq for a type. func makeCloneSeq(typ *abi.Type) cloneSeq { … } // buildStructCloneSeq populates a cloneSeq for an abi.Type that has Kind abi.Struct. func buildStructCloneSeq(typ *abi.Type, seq *cloneSeq, baseOffset uintptr) { … } // buildArrayCloneSeq populates a cloneSeq for an abi.Type that has Kind abi.Array. func buildArrayCloneSeq(typ *abi.Type, seq *cloneSeq, baseOffset uintptr) { … }