Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2015 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b53e190efb6627e020bd to your computer and use it in GitHub Desktop.
Save anonymous/b53e190efb6627e020bd to your computer and use it in GitHub Desktop.
Modifying a struct member of a class's property
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self modifyFrameWidth:self.view];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)modifyFrameWidth:(UIView *)view {
CGRect frame = view.frame;
frame.size.width = 315;
view.frame = frame;
}
@end
SetterTestObjC`-[ViewController modifyFrameWidth:]:
0x10061aa50 <+0>: pushq %rbp
0x10061aa51 <+1>: movq %rsp, %rbp
0x10061aa54 <+4>: subq $0xb0, %rsp
0x10061aa5b <+11>: leaq -0x18(%rbp), %rax
0x10061aa5f <+15>: movq %rdi, -0x8(%rbp)
0x10061aa63 <+19>: movq %rsi, -0x10(%rbp)
0x10061aa67 <+23>: movq $0x0, -0x18(%rbp)
0x10061aa6f <+31>: movq %rax, %rdi
0x10061aa72 <+34>: movq %rdx, %rsi
0x10061aa75 <+37>: callq 0x10061aea8 ; symbol stub for: objc_storeStrong
-> 0x10061aa7a <+42>: movq -0x18(%rbp), %rax
0x10061aa7e <+46>: movq 0x2163(%rip), %rdx ; "frame"
0x10061aa85 <+53>: cmpq $0x0, %rax
0x10061aa8b <+59>: movq %rdx, -0x80(%rbp)
0x10061aa8f <+63>: movq %rax, -0x88(%rbp)
0x10061aa96 <+70>: je 0x10061aab5 ; <+101> at ViewController.m:29
0x10061aa9c <+76>: leaq -0x38(%rbp), %rdi
0x10061aaa0 <+80>: movq -0x88(%rbp), %rsi
0x10061aaa7 <+87>: movq -0x80(%rbp), %rdx
0x10061aaab <+91>: callq 0x10061ae96 ; symbol stub for: objc_msgSend_stret
0x10061aab0 <+96>: jmp 0x10061aaca ; <+122> at ViewController.m:29
0x10061aab5 <+101>: xorl %esi, %esi
0x10061aab7 <+103>: movl $0x20, %eax
0x10061aabc <+108>: movl %eax, %edx
0x10061aabe <+110>: leaq -0x38(%rbp), %rcx
0x10061aac2 <+114>: movq %rcx, %rdi
0x10061aac5 <+117>: callq 0x10061aeae ; symbol stub for: memset
0x10061aaca <+122>: leaq -0x78(%rbp), %rax
0x10061aace <+126>: movsd 0x46a(%rip), %xmm0
0x10061aad6 <+134>: movsd %xmm0, -0x28(%rbp)
0x10061aadb <+139>: movq -0x18(%rbp), %rcx
0x10061aadf <+143>: movq -0x38(%rbp), %rdx
0x10061aae3 <+147>: movq %rdx, -0x58(%rbp)
0x10061aae7 <+151>: movq -0x30(%rbp), %rdx
0x10061aaeb <+155>: movq %rdx, -0x50(%rbp)
0x10061aaef <+159>: movq -0x28(%rbp), %rdx
0x10061aaf3 <+163>: movq %rdx, -0x48(%rbp)
0x10061aaf7 <+167>: movq -0x20(%rbp), %rdx
0x10061aafb <+171>: movq %rdx, -0x40(%rbp)
0x10061aaff <+175>: movq -0x58(%rbp), %rdx
0x10061ab03 <+179>: movq %rdx, -0x78(%rbp)
0x10061ab07 <+183>: movq -0x50(%rbp), %rdx
0x10061ab0b <+187>: movq %rdx, -0x70(%rbp)
0x10061ab0f <+191>: movq -0x48(%rbp), %rdx
0x10061ab13 <+195>: movq %rdx, -0x68(%rbp)
0x10061ab17 <+199>: movq -0x40(%rbp), %rdx
0x10061ab1b <+203>: movq %rdx, -0x60(%rbp)
0x10061ab1f <+207>: movq 0x20ca(%rip), %rsi ; "setFrame:"
0x10061ab26 <+214>: movq %rcx, %rdi
0x10061ab29 <+217>: movq (%rax), %rcx
0x10061ab2c <+220>: movq %rcx, (%rsp)
0x10061ab30 <+224>: movq 0x8(%rax), %rcx
0x10061ab34 <+228>: movq %rcx, 0x8(%rsp)
0x10061ab39 <+233>: movq 0x10(%rax), %rcx
0x10061ab3d <+237>: movq %rcx, 0x10(%rsp)
0x10061ab42 <+242>: movq 0x18(%rax), %rax
0x10061ab46 <+246>: movq %rax, 0x18(%rsp)
0x10061ab4b <+251>: callq 0x10061ae8a ; symbol stub for: objc_msgSend
0x10061ab50 <+256>: xorl %r8d, %r8d
0x10061ab53 <+259>: movl %r8d, %esi
0x10061ab56 <+262>: leaq -0x18(%rbp), %rax
0x10061ab5a <+266>: movq %rax, %rdi
0x10061ab5d <+269>: callq 0x10061aea8 ; symbol stub for: objc_storeStrong
0x10061ab62 <+274>: addq $0xb0, %rsp
0x10061ab69 <+281>: popq %rbp
0x10061ab6a <+282>: retq
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
modifyFrameWidth(self.view)
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func modifyFrameWidth(view : UIView) {
view.frame.size.width = 315;
}
}
SetterTestSwift`SetterTestSwift.ViewController.modifyFrameWidth (SetterTestSwift.ViewController)(ObjectiveC.UIView) -> ():
0x10f516be0 <+0>: pushq %rbp
0x10f516be1 <+1>: movq %rsp, %rbp
0x10f516be4 <+4>: subq $0x80, %rsp
0x10f516beb <+11>: leaq -0x30(%rbp), %rax
0x10f516bef <+15>: movq %rdi, -0x8(%rbp)
0x10f516bf3 <+19>: movq %rsi, -0x10(%rbp)
-> 0x10f516bf7 <+23>: movq 0x828a(%rip), %rdx ; "frame"
0x10f516bfe <+30>: movq %rdi, %rcx
0x10f516c01 <+33>: movq %rdi, -0x58(%rbp)
0x10f516c05 <+37>: movq %rax, %rdi
0x10f516c08 <+40>: movq %rsi, -0x60(%rbp)
0x10f516c0c <+44>: movq %rcx, %rsi
0x10f516c0f <+47>: callq 0x10f51c7b6 ; symbol stub for: objc_msgSend_stret
0x10f516c14 <+52>: leaq -0x50(%rbp), %rax
0x10f516c18 <+56>: movsd 0x5da0(%rip), %xmm0
0x10f516c20 <+64>: movsd -0x30(%rbp), %xmm1
0x10f516c25 <+69>: movsd -0x28(%rbp), %xmm2
0x10f516c2a <+74>: movsd -0x18(%rbp), %xmm3
0x10f516c2f <+79>: movq 0x825a(%rip), %rsi ; "setFrame:"
0x10f516c36 <+86>: movsd %xmm1, -0x50(%rbp)
0x10f516c3b <+91>: movsd %xmm2, -0x48(%rbp)
0x10f516c40 <+96>: movsd %xmm0, -0x40(%rbp)
0x10f516c45 <+101>: movsd %xmm3, -0x38(%rbp)
0x10f516c4a <+106>: movq -0x58(%rbp), %rcx
0x10f516c4e <+110>: movq %rcx, %rdi
0x10f516c51 <+113>: movq (%rax), %rcx
0x10f516c54 <+116>: movq %rcx, (%rsp)
0x10f516c58 <+120>: movq 0x8(%rax), %rcx
0x10f516c5c <+124>: movq %rcx, 0x8(%rsp)
0x10f516c61 <+129>: movq 0x10(%rax), %rcx
0x10f516c65 <+133>: movq %rcx, 0x10(%rsp)
0x10f516c6a <+138>: movq 0x18(%rax), %rax
0x10f516c6e <+142>: movq %rax, 0x18(%rsp)
0x10f516c73 <+147>: callq 0x10f51c7aa ; symbol stub for: objc_msgSend
0x10f516c78 <+152>: movq -0x60(%rbp), %rdi
0x10f516c7c <+156>: callq 0x10f51c7bc ; symbol stub for: objc_release
0x10f516c81 <+161>: movq -0x58(%rbp), %rdi
0x10f516c85 <+165>: callq 0x10f51c7bc ; symbol stub for: objc_release
0x10f516c8a <+170>: addq $0x80, %rsp
0x10f516c91 <+177>: popq %rbp
0x10f516c92 <+178>: retq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment