Proposal Details
Add a GOEXPERIMENT 2pointers-closures which changes unsafe.Sizeof(func(){}) from unsafe.Sizeof(uintptr(0)) to unsafe.Sizeof(uintptr(0)) * 2.
This is an ABI breaking change I want to try targeted at optimizing the the typescript compiler.
It would transform closure := ptr.method from a heap allocation at worst.
To an LEAQ and a MOV.
basically use a representation for closures that is nearly identical to a single method interface
so the above pseudo code would compile to:
closure := abi.closure{&type.method.descriptor, ptr}
where type.method.descriptor is a .rodata objecting contains the method's PC and all of reflect's required info.
Proposal Details
Add a
GOEXPERIMENT2pointers-closureswhich changesunsafe.Sizeof(func(){})fromunsafe.Sizeof(uintptr(0))tounsafe.Sizeof(uintptr(0)) * 2.This is an ABI breaking change I want to try targeted at optimizing the the typescript compiler.
It would transform
closure := ptr.methodfrom a heap allocation at worst.To an
LEAQand aMOV.basically use a representation for closures that is nearly identical to a single method interface
so the above pseudo code would compile to:
where
type.method.descriptoris a.rodataobjecting contains the method's PC and all of reflect's required info.