From 3b5b19df66c0de4f916ba00298c6e000fc69de71 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 25 May 2020 19:26:18 -0700 Subject: 6406 - primitive 'copy-handle' --- 069allocate.subx | 23 +++++++++++++++++++++++ apps/assort | Bin 44250 -> 44275 bytes apps/braces | Bin 46121 -> 46146 bytes apps/calls | Bin 50782 -> 50807 bytes apps/crenshaw2-1 | Bin 43601 -> 43626 bytes apps/crenshaw2-1b | Bin 44148 -> 44173 bytes apps/dquotes | Bin 47872 -> 47897 bytes apps/factorial | Bin 42694 -> 42719 bytes apps/hex | Bin 46440 -> 46465 bytes apps/mu | Bin 254249 -> 254274 bytes apps/pack | Bin 56585 -> 56610 bytes apps/sigils | Bin 58506 -> 58531 bytes apps/survey | Bin 54196 -> 54221 bytes apps/tests | Bin 43022 -> 43047 bytes 14 files changed, 23 insertions(+) diff --git a/069allocate.subx b/069allocate.subx index 0c75ece0..c65a369e 100644 --- a/069allocate.subx +++ b/069allocate.subx @@ -489,6 +489,29 @@ $handle-equal?:end: 5d/pop-to-ebp c3/return +copy-handle: # src: handle, dest: (addr handle) + # . prologue + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # . save registers + 50/push-eax + 51/push-ecx + # ecx = dest + 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0x10/disp8 . # copy *(ebp+16) to ecx + # *dest = src + 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 . # copy *(ebp+8) to eax + 89/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy eax to *ecx + 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax + 89/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 . # copy eax to *(ecx+4) +$copy-handle:end: + # . restore registers + 59/pop-to-ecx + 58/pop-to-eax + # . epilogue + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + # helper: create a nested allocation descriptor (useful for tests) allocate-region: # ad: (addr allocation-descriptor), n: int, out: (addr handle allocation-descriptor) # . prologue diff --git a/apps/assort b/apps/assort index 86ac7113..bc4b2eb9 100755 Binary files a/apps/assort and b/apps/assort differ diff --git a/apps/braces b/apps/braces index 5b80b0ea..e7618b4e 100755 Binary files a/apps/braces and b/apps/braces differ diff --git a/apps/calls b/apps/calls index 26a1a287..16a1c90b 100755 Binary files a/apps/calls and b/apps/calls differ diff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1 index 5ebbb3d5..34a50dcb 100755 Binary files a/apps/crenshaw2-1 and b/apps/crenshaw2-1 differ diff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b index 39cd305d..cc00dc48 100755 Binary files a/apps/crenshaw2-1b and b/apps/crenshaw2-1b differ diff --git a/apps/dquotes b/apps/dquotes index d0ebf897..a49d897d 100755 Binary files a/apps/dquotes and b/apps/dquotes differ diff --git a/apps/factorial b/apps/factorial index c4bbc51e..92e0523a 100755 Binary files a/apps/factorial and b/apps/factorial differ diff --git a/apps/hex b/apps/hex index 398cb046..cd183977 100755 Binary files a/apps/hex and b/apps/hex differ diff --git a/apps/mu b/apps/mu index 8db63c71..700919ca 100755 Binary files a/apps/mu and b/apps/mu differ diff --git a/apps/pack b/apps/pack index 3cbb7528..22a66caf 100755 Binary files a/apps/pack and b/apps/pack differ diff --git a/apps/sigils b/apps/sigils index ea4a30f9..76becaf3 100755 Binary files a/apps/sigils and b/apps/sigils differ diff --git a/apps/survey b/apps/survey index daa6f40f..018e9fa7 100755 Binary files a/apps/survey and b/apps/survey differ diff --git a/apps/tests b/apps/tests index 38e774a3..4b1eea42 100755 Binary files a/apps/tests and b/apps/tests differ -- cgit 1.4.1-2-gfad0