mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 22:13:39 +00:00
reflect: use SliceHeader and StringHeader variant for internal use
These variants uses an unsafe.Pointer instead of uintptr so that the pointer/non-pointer fields match those of real slices and strings. This may be necessary in the future once we switch to a precise garbage collector.
This commit is contained in:
committed by
Ron Evans
parent
711889bc3f
commit
c8742e2b96
@@ -25,9 +25,9 @@ var arrayTypesSidetable byte
|
||||
// table.
|
||||
func readStringSidetable(table unsafe.Pointer, index uintptr) string {
|
||||
nameLen, namePtr := readVarint(unsafe.Pointer(uintptr(table) + index))
|
||||
return *(*string)(unsafe.Pointer(&StringHeader{
|
||||
Data: uintptr(namePtr),
|
||||
Len: nameLen,
|
||||
return *(*string)(unsafe.Pointer(&stringHeader{
|
||||
data: namePtr,
|
||||
len: nameLen,
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user