diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-07-08 00:09:28 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-07-08 00:09:28 -0700 |
commit | 761833aa9285edf5f919f4da3a94afbd4a7f657c (patch) | |
tree | 011929b107ed408c285d812e81b31f595c4d2374 /subx/apps | |
parent | 7ba3337baee629f4490a292b6f74286a52ecda4e (diff) | |
download | mu-761833aa9285edf5f919f4da3a94afbd4a7f657c.tar.gz |
.
DRY out compute-width and compute-width-from-slice.
Diffstat (limited to 'subx/apps')
-rw-r--r-- | subx/apps/subx-common.subx | 47 | ||||
-rwxr-xr-x | subx/apps/survey | bin | 34421 -> 34274 bytes |
2 files changed, 5 insertions, 42 deletions
diff --git a/subx/apps/subx-common.subx b/subx/apps/subx-common.subx index d4b8d0d4..0e155515 100644 --- a/subx/apps/subx-common.subx +++ b/subx/apps/subx-common.subx @@ -1153,50 +1153,13 @@ compute-width: # word : (address array byte) -> EAX : int 51/push-ECX 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX - # if has-metadata?(word, "imm32") or has-metadata?(word, "disp32"): return 4 - # . has-metadata?(word, "imm32") - 68/push "imm32"/imm32 - 51/push-ECX - e8/call has-metadata?/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # . if EAX: return 4 - 3d/compare-EAX-and 1/imm32 - b8/copy-to-EAX 4/imm32 # ZF is set, so we can overwrite EAX now - 74/jump-if-equal $compute-width:end/disp8 - # . has-metadata?(word, "disp32") - 68/push "disp32"/imm32 - 51/push-ECX - e8/call has-metadata?/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # . if EAX: return 4 - 3d/compare-EAX-and 1/imm32 - b8/copy-to-EAX 4/imm32 # ZF is set, so we can overwrite EAX now - 74/jump-if-equal $compute-width:end/disp8 - # if has-metadata?(word, "imm16") or has-metadata?(word, "disp16"): return 2 - # . has-metadata?(word, "imm16") - 68/push "imm16"/imm32 - 51/push-ECX - e8/call has-metadata?/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # . if EAX: return 2 - 3d/compare-EAX-and 1/imm32 - b8/copy-to-EAX 2/imm32 # ZF is set, so we can overwrite EAX now - 74/jump-if-equal $compute-width:end/disp8 - # . has-metadata?(word, "disp16") - 68/push "disp16"/imm32 + # return compute-width-of-slice(ECX) + # . . push args 51/push-ECX - e8/call has-metadata?/disp32 + # . . call + e8/call compute-width-of-slice/disp32 # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # . if EAX: return 2 - 3d/compare-EAX-and 1/imm32 - b8/copy-to-EAX 2/imm32 # ZF is set, so we can overwrite EAX now - 74/jump-if-equal $compute-width:end/disp8 - # else: return 1 - b8/copy-to-EAX 1/imm32 + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP $compute-width:end: # . reclaim locals 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP diff --git a/subx/apps/survey b/subx/apps/survey index 1794174b..1963710f 100755 --- a/subx/apps/survey +++ b/subx/apps/survey Binary files differ |