[HN Gopher] Apple's A15 chip will ship with an objc_msgSend bran...
       ___________________________________________________________________
        
       Apple's A15 chip will ship with an objc_msgSend branch predictor
        
       Author : cjv
       Score  : 21 points
       Date   : 2021-05-30 18:37 UTC (4 hours ago)
        
 (HTM) web link (twitter.com)
 (TXT) w3m dump (twitter.com)
        
       | glandium wrote:
       | "see Apple ISA Extensions to ARMv8: version H14, chapter 23". If
       | only it were available outside Apple...
        
       | Dutchie2020 wrote:
       | Can someone please ELI5 this for me? What is the significance of
       | speeding up objc_msgSend for Objective C?
        
         | mucholove wrote:
         | Pretty much every method call, unless it is optimized--will go
         | through `objc_msgSend`. The runtime looks up the code for a
         | particular object using `objc_msgSend.` The function signature
         | varies depending on how many parameters the method has but it
         | always has at least 2 arguments--the instantiated object and
         | the method name. Objc calls this the selector. :)
        
         | diebeforei485 wrote:
         | It is a codepath that is used a lot, in system frameworks that
         | many apps use. So, speeding it up can yield a systemwide
         | performance improvement for all sorts of apps.
        
       | chmaynard wrote:
       | This probably means that a significant number of important apps
       | are still coded in Objective-C, which would not be a big
       | surprise. Is the momentum of Swift language adoption slowing
       | down? If so, perhaps Apple is also hedging their bets.
        
         | pjmlp wrote:
         | Metal is a mix of Objective-C and C++14 subset as shading
         | language.
         | 
         | Same applies to many system Frameworks written before Swift
         | happened.
         | 
         | I bet they aren't running X rewritten in Swift blog posts
         | inside Apple.
        
         | geoffpado wrote:
         | It's not so much the apps as the system frameworks they're
         | built upon, which are still almost universally Obj-C (or some
         | other C-family language). Even if every third-party or user-
         | facing first-party app was 100% Swift, there'd still be massive
         | wins from speeding up objc_msgSend.
         | 
         | (Not to mention that even pure-Swift apps use a lot of Obj-C-
         | isms when touching said system frameworks, like the
         | target/selector setup for most UI controls).
        
       | kristianp wrote:
       | Not just branch predictor, but "Software Assisted Branch
       | Prediction". See the source at:
       | https://opensource.apple.com/source/objc4/objc4-824/runtime/...
       | 
       | Comment near start says:
       | 
       | /// Code for setting up the H14 ObjC branch prediction control
       | registers.
        
         | btown wrote:
         | Does this mean that the compiler can embed smart hints for
         | branch prediction directly in the bytecode, by way of setting
         | very specific dedicated registers?
        
       | miohtama wrote:
       | Does this actually apply only for Objective C or can other
       | programming languages benefit as well?
        
       ___________________________________________________________________
       (page generated 2021-05-30 23:02 UTC)