summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@nil.im>2020-06-30 01:08:14 +0000
committerJonathan Schleifer <js@nil.im>2020-06-30 01:08:14 +0000
commit0b7c5274ee984d32a45aeed192bcbaaf4f383d35 (patch)
tree0f6fc2bfb0226d50dcb878dcb8151be592e54b16
parent55605e0310065a1912f7a67f0130b2823a944bd6 (diff)
Remove unnecessary PIC from x86/Win32 ASM
FossilOrigin-Name: 9ccac85bb4c8c3bbf423f8a897d8e0c4ecf8f4cfcd448aa79c939ab49607b24c
-rw-r--r--src/forwarding/forwarding-x86-win32.S77
-rw-r--r--src/runtime/lookup-asm/lookup-asm-x86-win32.S13
2 files changed, 28 insertions, 62 deletions
diff --git a/src/forwarding/forwarding-x86-win32.S b/src/forwarding/forwarding-x86-win32.S
index 391403f5..0b25a75a 100644
--- a/src/forwarding/forwarding-x86-win32.S
+++ b/src/forwarding/forwarding-x86-win32.S
@@ -28,49 +28,42 @@ _of_forward:
pushl %ebx
subl $20, %esp
- call get_eip
-0:
-
movl 8(%ebp), %eax
movl %eax, (%esp)
- leal _object_getClass-0b(%ebx), %eax
- call *%eax
+ call _object_getClass
movl %eax, (%esp)
- leal sel_forwardingTargetForSelector_-0b(%ebx), %eax
+ movl $sel_forwardingTargetForSelector_, %eax
movl %eax, 4(%esp)
- leal _class_respondsToSelector-0b(%ebx), %eax
- call *%eax
+ call _class_respondsToSelector
testl %eax, %eax
- jz 1f
+ jz 0f
movl 8(%ebp), %eax
movl %eax, (%esp)
- leal sel_forwardingTargetForSelector_-0b(%ebx), %eax
+ movl $sel_forwardingTargetForSelector_, %eax
movl %eax, 4(%esp)
- leal _objc_msg_lookup-0b(%ebx), %eax
- call *%eax
+ call _objc_msg_lookup
movl 8(%ebp), %edx
movl %edx, (%esp)
- leal sel_forwardingTargetForSelector_-0b(%ebx), %edx
+ movl $sel_forwardingTargetForSelector_, %edx
movl %edx, 4(%esp)
movl 12(%ebp), %edx
movl %edx, 8(%esp)
call *%eax
testl %eax, %eax
- jz 1f
+ jz 0f
cmpl 8(%ebp), %eax
- je 1f
+ je 0f
movl %eax, 8(%ebp)
movl %eax, (%esp)
movl 12(%ebp), %eax
movl %eax, 4(%esp)
- leal _objc_msg_lookup-0b(%ebx), %eax
- call *%eax
+ call _objc_msg_lookup
addl $20, %esp
popl %ebx
@@ -78,14 +71,12 @@ _of_forward:
jmp *%eax
-1:
- leal _of_method_not_found-0b(%ebx), %eax
-
+0:
addl $20, %esp
popl %ebx
popl %ebp
- jmp *%eax
+ jmp _of_method_not_found
_of_forward_stret:
pushl %ebp
@@ -94,49 +85,42 @@ _of_forward_stret:
pushl %ebx
subl $20, %esp
- call get_eip
-0:
-
movl 12(%ebp), %eax
movl %eax, (%esp)
- leal _object_getClass-0b(%ebx), %eax
- call *%eax
+ call _object_getClass
movl %eax, (%esp)
- leal sel_forwardingTargetForSelector_-0b(%ebx), %eax
+ movl $sel_forwardingTargetForSelector_, %eax
movl %eax, 4(%esp)
- leal _class_respondsToSelector-0b(%ebx), %eax
- call *%eax
+ call _class_respondsToSelector
testl %eax, %eax
- jz 1f
+ jz 0f
movl 12(%ebp), %eax
movl %eax, (%esp)
- leal sel_forwardingTargetForSelector_-0b(%ebx), %eax
+ movl $sel_forwardingTargetForSelector_, %eax
movl %eax, 4(%esp)
- leal _objc_msg_lookup-0b(%ebx), %eax
- call *%eax
+ call _objc_msg_lookup
movl 12(%ebp), %edx
movl %edx, (%esp)
- leal sel_forwardingTargetForSelector_-0b(%ebx), %edx
+ movl $sel_forwardingTargetForSelector_, %edx
movl %edx, 4(%esp)
movl 16(%ebp), %edx
movl %edx, 8(%esp)
call *%eax
testl %eax, %eax
- jz 1f
+ jz 0f
cmpl 12(%ebp), %eax
- je 1f
+ je 0f
movl %eax, 12(%ebp)
movl %eax, (%esp)
movl 16(%ebp), %eax
movl %eax, 4(%esp)
- leal _objc_msg_lookup_stret-0b(%ebx), %eax
- call *%eax
+ call _objc_msg_lookup_stret
addl $20, %esp
popl %ebx
@@ -144,14 +128,12 @@ _of_forward_stret:
jmp *%eax
-1:
- leal _of_method_not_found_stret-0b(%ebx), %eax
-
+0:
addl $20, %esp
popl %ebx
popl %ebp
- jmp *%eax
+ jmp _of_method_not_found_stret
init:
pushl %ebp
@@ -160,22 +142,15 @@ init:
pushl %ebx
subl $4, %esp
- call get_eip
-0:
- leal module-0b(%ebx), %eax
+ movl $module, %eax
movl %eax, (%esp)
- leal ___objc_exec_class-0b(%ebx), %eax
- call *%eax
+ call ___objc_exec_class
addl $4, %esp
popl %ebx
popl %ebp
ret
-get_eip:
- movl (%esp), %ebx
- ret
-
.section .ctors, "aw"
.long init
diff --git a/src/runtime/lookup-asm/lookup-asm-x86-win32.S b/src/runtime/lookup-asm/lookup-asm-x86-win32.S
index 2e7d9295..a3aa1caa 100644
--- a/src/runtime/lookup-asm/lookup-asm-x86-win32.S
+++ b/src/runtime/lookup-asm/lookup-asm-x86-win32.S
@@ -50,10 +50,7 @@
ret
0:
- call get_eip
-1:
- addl $\not_found-1b, %eax
- jmp *%eax
+ jmp \not_found
.endm
.macro generate_lookup_super name lookup
@@ -75,15 +72,9 @@ generate_lookup_super _objc_msg_lookup_super _objc_msg_lookup
generate_lookup_super _objc_msg_lookup_super_stret _objc_msg_lookup_stret
ret_nil:
- call get_eip
-0:
- addl $nil_method-0b, %eax
+ movl $nil_method, %eax
ret
nil_method:
xorl %eax, %eax
ret
-
-get_eip:
- movl (%esp), %eax
- ret