Coder Social home page Coder Social logo

Comments (6)

yury avatar yury commented on June 11, 2024 2

Not sure about 86_64.

from cidre.

madsmtm avatar madsmtm commented on June 11, 2024 2

I've implemented parts of this in madsmtm/objc2#462, the message sending changes will take a bit more to do.

from cidre.

yury avatar yury commented on June 11, 2024

Starting with Xcode 14 Apple changed how they generate code for selectors. More info at WWDC video 3:10.

I noticed that change, tested and rewrote my old msg_send to new one.

// clang -ObjC -S test.h
#import <Foundation/Foundation.h>

void test(void) {
  NSNumber * num = [NSNumber numberWithBool:YES];
}
        .section        __TEXT,__text,regular,pure_instructions
        .build_version macos, 13, 0     sdk_version 13, 3
        .globl  _test                           ; -- Begin function test
        .p2align        2
_test:                                  ; @test
        .cfi_startproc
; %bb.0:
        sub     sp, sp, #32
        .cfi_def_cfa_offset 32
        stp     x29, x30, [sp, #16]             ; 16-byte Folded Spill
        add     x29, sp, #16
        .cfi_def_cfa w29, 16
        .cfi_offset w30, -8
        .cfi_offset w29, -16
                                        ; implicit-def: $x1
        adrp    x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGE
        ldr     x0, [x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGEOFF]
        mov     w8, #1
        and     w2, w8, #0x1
        bl      "_objc_msgSend$numberWithBool:"
        str     x0, [sp, #8]
        ldp     x29, x30, [sp, #16]             ; 16-byte Folded Reload
        add     sp, sp, #32
        ret
        .cfi_endproc
                                        ; -- End function
        .section        __DATA,__objc_classrefs,regular,no_dead_strip
        .p2align        3                               ; @"OBJC_CLASSLIST_REFERENCES_$_"
_OBJC_CLASSLIST_REFERENCES_$_:
        .quad   _OBJC_CLASS_$_NSNumber

        .section        __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
        .long   0
        .long   64

.subsections_via_symbols

One downside - they turn it as optimization. So I have to add opt-level = 1

Another - this is very platform specific, but I'm ok with that if we get zero cost.

from cidre.

yury avatar yury commented on June 11, 2024

Also implement objc_release optimization.

from cidre.

madsmtm avatar madsmtm commented on June 11, 2024

Oh that's very, very cool! Thanks for the video link, I'll probably incorporate something similar into objc2 soon, behind an experimental feature-flag.

Do you know if it only works on Aarch64, or are these also available for x86_64?

from cidre.

yury avatar yury commented on June 11, 2024

Closing this issue. Feel free to reopen if needed.

from cidre.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.