Fpret stuff (not very tested).

main
theraven 14 years ago
parent 27452f82f0
commit 949469677e

@ -10,6 +10,12 @@ id objc_msgSend(id, SEL, ...);
typedef struct { int a,b,c,d,e; } s; typedef struct { int a,b,c,d,e; } s;
s objc_msgSend_stret(id, SEL, ...); s objc_msgSend_stret(id, SEL, ...);
@interface Fake
- (int)izero;
- (float)fzero;
- (double)dzero;
- (long double)ldzero;
@end
Class TestCls; Class TestCls;
@interface Test { id isa; }@end @interface Test { id isa; }@end
@ -70,6 +76,11 @@ int main(void)
assert(ret.c == 3); assert(ret.c == 3);
assert(ret.d == 4); assert(ret.d == 4);
assert(ret.e == 5); assert(ret.e == 5);
Fake *f = nil;
assert(0 == [f izero]);
assert(0 == [f dzero]);
assert(0 == [f ldzero]);
assert(0 == [f fzero]);
#ifdef BENCHMARK #ifdef BENCHMARK
clock_t c1, c2; clock_t c1, c2;
c1 = clock(); c1 = clock();

@ -56,7 +56,8 @@
mov SLOT_OFFSET(%eax), %eax mov SLOT_OFFSET(%eax), %eax
jmp *%eax jmp *%eax
4: # returnNil: 4: # returnNil:
xor %eax, %eax xor %eax, %eax # return 0 (int)
fldz # return 0 (float)
ret ret
5: # slowSend: 5: # slowSend:
mov \sel(%esp), %ecx mov \sel(%esp), %ecx
@ -82,6 +83,9 @@
.endm .endm
.globl objc_msgSend .globl objc_msgSend
.type objc_msgSend, @function .type objc_msgSend, @function
.globl objc_msgSend_fpret
.type objc_msgSend_fpret, @function
objc_msgSend_fpret:
objc_msgSend: objc_msgSend:
MSGSEND 4, 8 MSGSEND 4, 8
.globl objc_msgSend_stret .globl objc_msgSend_stret

@ -60,7 +60,11 @@
mov SLOT_OFFSET(%r10), %r10 mov SLOT_OFFSET(%r10), %r10
jmp *%r10 jmp *%r10
4: # returnNil: 4: # returnNil:
xor %rax, %rax # Both of the return registers are
# callee-save on x86-64, so we can
# return 0 in both in the same code:
xor %rax, %rax # Return 0 as an integer
pxor %xmm0, %xmm0 # Return 0 as a floating point value
ret ret
5: # slowSend: 5: # slowSend:
push %rax # We need to preserve all registers that may contain arguments: push %rax # We need to preserve all registers that may contain arguments:
@ -131,6 +135,9 @@
.endm .endm
.globl objc_msgSend .globl objc_msgSend
.type objc_msgSend, @function .type objc_msgSend, @function
.globl objc_msgSend_fpret
.type objc_msgSend_fpret, @function
objc_msgSend_fpret:
objc_msgSend: objc_msgSend:
MSGSEND %rdi, %rsi MSGSEND %rdi, %rsi
.globl objc_msgSend_stret .globl objc_msgSend_stret

Loading…
Cancel
Save