mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 08:23:41 +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
@@ -6,6 +6,8 @@ import "unsafe"
|
||||
|
||||
const GOOS = "darwin"
|
||||
|
||||
const zeroSizeAllocPtr uintptr = 16 // part of the first protected page
|
||||
|
||||
const (
|
||||
// See https://github.com/golang/go/blob/master/src/syscall/zerrors_darwin_amd64.go
|
||||
flag_PROT_READ = 0x1
|
||||
|
||||
Reference in New Issue
Block a user