Prevent the profiler from hooking into stret methods

Summary:
public

In order to handle methods that returns struct in i386 and x86_64 we'd need to implement special methods (like objc_msgSend_stret),
but we'll just bail out for now, since there's very few usages.

Reviewed By: jspahrsummers

Differential Revision: D2754732

fb-gh-sync-id: d3585d244633d918770ef79a52dee9cdf87a53da
This commit is contained in:
Tadeu Zagallo 2015-12-14 06:59:39 -08:00 committed by facebook-github-bot-5
parent c8108bdbe1
commit b6fce4ad52
1 changed files with 14 additions and 1 deletions

View File

@ -232,7 +232,20 @@ void RCTProfileHookModules(RCTBridge *bridge)
for (NSUInteger i = 0; i < methodCount; i++) {
Method method = methods[i];
SEL selector = method_getName(method);
if ([NSStringFromSelector(selector) hasPrefix:@"rct"] || [NSObject instancesRespondToSelector:selector]) {
/**
* Bail out on struct returns (except arm64) - we don't use it enough
* to justify writing a stret version
*/
#ifdef __arm64__
BOOL returnsStruct = NO;
#else
const char *typeEncoding = method_getTypeEncoding(method);
// bail out on structs and unions (since they might contain structs)
BOOL returnsStruct = typeEncoding[0] == '{' || typeEncoding[0] == '(';
#endif
if ([NSStringFromSelector(selector) hasPrefix:@"rct"] || [NSObject instancesRespondToSelector:selector] || returnsStruct) {
continue;
}
const char *types = method_getTypeEncoding(method);