about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-05-22 22:26:02 -0700
committerKartik Agaram <vc@akkartik.com>2019-05-22 22:33:42 -0700
commitd1fa22f7b45378ddb6ce4eaf04f36f6c0bf0203c (patch)
tree3ef25991f53b7990a6bf954efdabe89f2d8850bc /subx
parent40077d0d2b39ca5bed1f316e186b8f23b7148dc8 (diff)
downloadmu-d1fa22f7b45378ddb6ce4eaf04f36f6c0bf0203c.tar.gz
5221
Explore using a second register for pointer dereferencing.
Diffstat (limited to 'subx')
-rw-r--r--subx/apps/handle.subx11
1 files changed, 11 insertions, 0 deletions
diff --git a/subx/apps/handle.subx b/subx/apps/handle.subx
index 60b4021a..97a6c622 100644
--- a/subx/apps/handle.subx
+++ b/subx/apps/handle.subx
@@ -231,6 +231,17 @@ lookup:  # h : (handle T) -> EAX : (address T)
     # add 4
     05/add-to-EAX  4/imm32
     # - }
+    # - alternative consuming a second register {
+#?     # ECX = handle->alloc_id
+#?     8b/copy                         0/mod/indirect  0/rm32/EAX    .           .             .           1/r32/ECX   .               .                 # copy *EAX to ECX
+#?     # EAX = handle->address (payload)
+#?     8b/copy                         1/mod/*+disp8   0/rm32/EAX    .           .             .           0/r32/EAX   4/disp8         .                 # copy *(EAX+4) to EAX
+#?     # if (ECX != *EAX) abort
+#?     39/compare                      0/mod/indirect  0/rm32/EAX    .           .             .           1/r32/ECX   .               .                 # compare *EAX and ECX
+#?     75/jump-if-not-equal  $lookup:abort/disp8
+#?     # add 4 to EAX
+#?     05/add-to-EAX  4/imm32
+    # - }
     # . epilog
     89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
     5d/pop-to-EBP