Fixed crash when using self in imp_implementationWithBlock on armv7a

main
Rupert Daniel 6 years ago committed by David Chisnall
parent 7166a41999
commit 710b2368cc

@ -26,6 +26,7 @@ int main(void)
{
__block int b = 0;
void* blk = ^(id self, int a) {
assert([self class] == [Foo class]);
b += a;
return b; };
blk = Block_copy(blk);
@ -45,6 +46,7 @@ int main(void)
assert(imp_getBlock(imp) != (blk));
blk = ^(id self) {
assert([self class] == [Foo class]);
struct big b = {1, 2, 3, 4, 5};
return b;
};

@ -126,7 +126,7 @@
.thumb
.macro trampoline arg0, arg1
sub r12, pc, #4095
mov \arg0, \arg1 // Move self over _cmd
mov \arg1, \arg0 // Move self over _cmd
ldr \arg0, [r12, #-5] // Load the block pointer over self
ldr r12, [r12, #-1] // Jump to the block function
bx r12
@ -134,7 +134,7 @@
# else
.macro trampoline arg0, arg1
sub r12, pc, #4096
mov \arg0, \arg1 // Move self over _cmd
mov \arg1, \arg0 // Move self over _cmd
ldr \arg0, [r12, #-8] // Load the block pointer over self
ldr pc, [r12, #-4] // Jump to the block function
.endm

Loading…
Cancel
Save