mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 11:13:27 +00:00
internal/gclayout: make gclayout values constants
The previous versions calculated at init() prevented `interp` from running in many cases, increasing compile times due to the increased need to revert the partially interpreted results and also increasing binary runtime because fewer optimizations had happened during interp.
This commit is contained in:
@@ -708,16 +708,16 @@ func (r *RawType) gcLayout() unsafe.Pointer {
|
||||
kind := r.Kind()
|
||||
|
||||
if kind < String {
|
||||
return gclayout.NoPtrs
|
||||
return gclayout.NoPtrs.AsPtr()
|
||||
}
|
||||
|
||||
switch kind {
|
||||
case Pointer, UnsafePointer, Chan, Map:
|
||||
return gclayout.Pointer
|
||||
return gclayout.Pointer.AsPtr()
|
||||
case String:
|
||||
return gclayout.String
|
||||
return gclayout.String.AsPtr()
|
||||
case Slice:
|
||||
return gclayout.Slice
|
||||
return gclayout.Slice.AsPtr()
|
||||
}
|
||||
|
||||
// Unknown (for now); let the conservative pointer scanning handle it
|
||||
|
||||
Reference in New Issue
Block a user