mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-12 15:39:31 +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
@@ -9,6 +9,8 @@ const GOARCH = "arm" // avr pretends to be arm
|
||||
// The bitness of the CPU (e.g. 8, 32, 64).
|
||||
const TargetBits = 8
|
||||
|
||||
const zeroSizeAllocPtr uintptr = 16 // points into the register file or I/O sapce (which is memory mapped but shouldn't be accessed directly)
|
||||
|
||||
const deferExtraRegs = 1 // the frame pointer (Y register) also needs to be stored
|
||||
|
||||
const callInstSize = 2 // "call" is 4 bytes, "rcall" is 2 bytes
|
||||
|
||||
Reference in New Issue
Block a user