Skip to content

Commit c01f811

Browse files
aykevldeadprogram
authored andcommitted
machine: avoid binary size regression after LLVM memory intrinsics
Somehow moving to LLVM memory intrinsics for calls like memcpy made the machine.sendUSBPacket get inlined. This is a problem because it is called in many different functions and it is just big enough to cause a significant file size increase. Adding //go:noinline solves this problem and gets the examples/blinky1 program below the file size it was before this change (tested: itsybitsy-m0, itsybitsy-m4, circuitplay-bluefruit).
1 parent 67c2421 commit c01f811

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/machine/machine_atsamd21.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,7 @@ func cdcSetup(setup usbSetup) bool {
17361736
return false
17371737
}
17381738

1739+
//go:noinline
17391740
func sendUSBPacket(ep uint32, data []byte) {
17401741
copy(udd_ep_in_cache_buffer[ep][:], data)
17411742

src/machine/machine_atsamd51.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,7 @@ func cdcSetup(setup usbSetup) bool {
19071907
return false
19081908
}
19091909

1910+
//go:noinline
19101911
func sendUSBPacket(ep uint32, data []byte) {
19111912
copy(udd_ep_in_cache_buffer[ep][:], data)
19121913

src/machine/usb_nrf52840.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ func cdcSetup(setup usbSetup) bool {
384384
return false
385385
}
386386

387+
//go:noinline
387388
func sendUSBPacket(ep uint32, data []byte) {
388389
count := len(data)
389390
copy(udd_ep_in_cache_buffer[ep][:], data)

0 commit comments

Comments
 (0)