From d80689e3e4fee846465fa5c3c7e2f9e4e9ebcbc4 Mon Sep 17 00:00:00 2001 From: theraven Date: Fri, 12 Apr 2013 10:35:51 +0000 Subject: [PATCH] Remove the test for whether the uninstalled dtable is present from objc_msgSend(). If the class does have the uninstalled dtable, then every method will be the nil slot and so, after navigating the dtable we will discover that it is nil and go into the slow path. The cost of this change is a slight slowdown in the first message sent to every class. The benefit is that every subsequent message send needs one fewer memory access and one fewer conditional jump. --- objc_msgSend.x86-32.S | 2 -- objc_msgSend.x86-64.S | 2 -- 2 files changed, 4 deletions(-) diff --git a/objc_msgSend.x86-32.S b/objc_msgSend.x86-32.S index 452cc75..8e9f8f6 100644 --- a/objc_msgSend.x86-32.S +++ b/objc_msgSend.x86-32.S @@ -15,8 +15,6 @@ 1: # classLoaded movl \sel(%esp), %ecx mov DTABLE_OFFSET(%eax), %eax # Load the dtable from the class - cmpl uninstalled_dtable, %eax # If this is not (yet) a valid dtable - je 5f # Do a slow lookup mov (%ecx), %ecx # Load the selector index diff --git a/objc_msgSend.x86-64.S b/objc_msgSend.x86-64.S index 62d78da..6d70df4 100644 --- a/objc_msgSend.x86-64.S +++ b/objc_msgSend.x86-64.S @@ -20,8 +20,6 @@ mov (\receiver), %r10 # Load the dtable from the class 1: # classLoaded mov DTABLE_OFFSET(%r10), %r10 # Load the dtable from the class - cmpq uninstalled_dtable(%rip), %r10 # If this is not (yet) a valid dtable - je 5f # Do a slow lookup push %r12 push %r13