mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
compiler: implement copy directly
The compiler now implements the copy builtin directly instead of calling sliceCopy. The length is calculated with the llvm.umax.* intrinsics, and the move is performed by llvm.memmove.*. Both of these operations are easily understood by LLVM's optimization passes. The type's alignment is also provided to llvm.memmove.*, which is useful when rewriting the move. Interp no longer needs to reimplement sliceCopy. Some edge case handling was implemented by sliceCopy but not llvm.memmove.*/llvm.memcpy.*. I copied this over, so copies of external slices should work now. Volatile moves/copies are now run at runtime by interp. There is a 4-byte size increase due to some confusing length logic in sendUSBPacket. I will look at sendUSBPacket in a future PR.
This commit is contained in:
@@ -44,7 +44,7 @@ func TestBinarySize(t *testing.T) {
|
||||
// microcontrollers
|
||||
{"hifive1b", "examples/echo", 3668, 280, 0, 2244},
|
||||
{"microbit", "examples/serial", 2694, 342, 8, 2248},
|
||||
{"wioterminal", "examples/pininterrupt", 6833, 1491, 120, 6888},
|
||||
{"wioterminal", "examples/pininterrupt", 6837, 1491, 120, 6888},
|
||||
|
||||
// TODO: also check wasm. Right now this is difficult, because
|
||||
// wasm binaries are run through wasm-opt and therefore the
|
||||
|
||||
Reference in New Issue
Block a user