Skip to content

Commit

Permalink
Differentiate for the fourth argument on x64 Windows and Unix
Browse files Browse the repository at this point in the history
- %r9 for Windows
- %rcx for Unix
  • Loading branch information
qmfrederik committed Nov 18, 2024
1 parent c04b080 commit 47d02a8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions objc_msgSend.x86-64.S
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# define FIRST_ARGUMENT %rcx
# define SECOND_ARGUMENT %rdx
# define THIRD_ARGUMENT %r8
# define FOURTH_ARGUMENT %r9
#else
# define START_PROC(x) .cfi_startproc
# define END_PROC(x) .cfi_endproc
Expand All @@ -15,6 +16,7 @@
# define FIRST_ARGUMENT %rdi
# define SECOND_ARGUMENT %rsi
# define THIRD_ARGUMENT %rdx
# define FOURTH_ARGUMENT %rcx
#endif

.macro MSGSEND fnname receiver, sel
Expand Down Expand Up @@ -209,7 +211,7 @@
5: # slowSend:
push %rax # We need to preserve all registers that may contain arguments:
push %rbx
push %rcx
push FOURTH_ARGUMENT
push %r8
push %r9

Expand Down Expand Up @@ -258,7 +260,7 @@

pop %r9
pop %r8
pop %rcx
pop FOURTH_ARGUMENT
pop %rbx
pop %rax
jmp 7b
Expand Down

0 comments on commit 47d02a8

Please sign in to comment.