diff --git a/sendmsg2.c b/sendmsg2.c index 9f8501c..86cd212 100644 --- a/sendmsg2.c +++ b/sendmsg2.c @@ -346,86 +346,6 @@ struct objc_slot_v1 *objc_slot_lookup_super(struct objc_super *super, SEL select return &nil_slot_v1; } -//////////////////////////////////////////////////////////////////////////////// -// Profiling -//////////////////////////////////////////////////////////////////////////////// - -/** - * Mutex used to protect non-thread-safe parts of the profiling subsystem. - */ -static mutex_t profileLock; -/** - * File used for writing the profiling symbol table. - */ -static FILE *profileSymbols; -/** - * File used for writing the profiling data. - */ -static FILE *profileData; - -struct profile_info -{ - const char *module; - int32_t callsite; - IMP method; -}; - -static void profile_init(void) -{ - INIT_LOCK(profileLock); - profileSymbols = fopen("objc_profile.symbols", "a"); - profileData = fopen("objc_profile.data", "a"); - // Write markers indicating a new run. - fprintf(profileSymbols, "=== NEW TRACE ===\n"); - struct profile_info profile_data = { 0, 0, 0 }; - fwrite(&profile_data, sizeof(profile_data), 1, profileData); -} - -void objc_profile_write_symbols(char **symbols) -{ - if (NULL == profileData) - { - LOCK_RUNTIME_FOR_SCOPE(); - if (NULL == profileData) - { - profile_init(); - } - } - LOCK(&profileLock); - while(*symbols) - { - char *address = *(symbols++); - char *symbol = *(symbols++); - fprintf(profileSymbols, "%zx %s\n", (size_t)address, symbol); - } - UNLOCK(&profileLock); - fflush(profileSymbols); -} - -/** - * Profiling version of the slot lookup. This takes a unique ID for the module - * and the callsite as extra arguments. The type of the receiver and the - * address of the resulting function are then logged to a file. These can then - * be used to determine whether adding slot caching is worthwhile, and whether - * any of the resulting methods should be speculatively inlined. - */ -void objc_msg_profile(id receiver, IMP method, - const char *module, int32_t callsite) -{ - // Initialize the logging lazily. This prevents us from wasting any memory - // when we are not profiling. - if (NULL == profileData) - { - LOCK_RUNTIME_FOR_SCOPE(); - if (NULL == profileData) - { - profile_init(); - } - } - struct profile_info profile_data = { module, callsite, method }; - fwrite(&profile_data, sizeof(profile_data), 1, profileData); -} - /** * looks up a slot without invoking any forwarding mechanisms */