mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 07:23:39 +00:00
compiler, runtime: optimize zero-sized allocations
Instead of referring to an unused global, use a constant value. This is safe even when using `-gc=none` (since no actual memory gets allocated) which wasn't the case before. It should also reduce binary size by a few bytes for most programs.
This commit is contained in:
committed by
Ron Evans
parent
221ea6a54c
commit
134de98ba5
@@ -4,6 +4,11 @@ package runtime
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Not sure whether there is anything on this location, but it doesn't look like
|
||||
// it according to the memory map:
|
||||
// https://switchbrew.org/wiki/Memory_layout
|
||||
const zeroSizeAllocPtr uintptr = 16
|
||||
|
||||
const (
|
||||
// Handles
|
||||
infoTypeTotalMemorySize = 6 // Total amount of memory available for process.
|
||||
|
||||
Reference in New Issue
Block a user