From b9fc9f3addeccf258a9529a09e0c021a666c7e62 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 22 Nov 2023 23:28:48 +0100 Subject: [PATCH 01/15] Update dependencies --- Cargo.lock | 138 +++++++++++++++------------- crates/header-translator/Cargo.toml | 2 +- crates/test-assembly/Cargo.toml | 2 +- 3 files changed, 76 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 112412047..351ede2f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,24 +4,24 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] [[package]] name = "apple-sdk" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a04f192a700686ee70008ff4e4eb76fe7d11814ab93b7ee9d48c36b9a9f0bd2a" +checksum = "4a79456f4f17ecfd5aec41ea9b6c043024aff86ced391e36399eec4a8c2543b9" [[package]] name = "arbitrary" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" [[package]] name = "atty" @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "basic-toml" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" +checksum = "2f2139706359229bfa8f19142ac1155b4b80beafb7a60471ac5dd109d4a19778" dependencies = [ "serde", ] @@ -69,18 +69,18 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" dependencies = [ "serde", ] [[package]] name = "cargo_metadata" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", @@ -198,9 +198,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" dependencies = [ "libc", ] @@ -213,9 +213,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libfuzzer-sys" @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "nu-ansi-term" @@ -322,9 +322,9 @@ checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -340,9 +340,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.4" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -352,9 +352,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -363,9 +363,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rustc-demangle" @@ -381,27 +381,27 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "semver" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.188" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -410,9 +410,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -421,18 +421,18 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "static_assertions" @@ -442,9 +442,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "2.0.29" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -453,9 +453,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -611,18 +611,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -641,20 +641,19 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -662,27 +661,38 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "nu-ansi-term", "sharded-slab", "smallvec", "thread_local", "tracing-core", - "tracing-log", + "tracing-log 0.2.0", ] [[package]] @@ -693,15 +703,15 @@ dependencies = [ "atty", "nu-ansi-term", "tracing-core", - "tracing-log", + "tracing-log 0.1.4", "tracing-subscriber", ] [[package]] name = "trybuild" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6df60d81823ed9c520ee897489573da4b1d79ffbe006b8134f46de1a1aa03555" +checksum = "196a58260a906cedb9bf6d8034b6379d0c11f552416960452f267402ceeddff1" dependencies = [ "basic-toml", "glob", @@ -714,9 +724,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "valuable" @@ -742,9 +752,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] diff --git a/crates/header-translator/Cargo.toml b/crates/header-translator/Cargo.toml index 2187f7e8c..fd60760cd 100644 --- a/crates/header-translator/Cargo.toml +++ b/crates/header-translator/Cargo.toml @@ -12,7 +12,7 @@ clang = { version = "2.0", features = ["runtime", "clang_10_0"] } clang-sys = { version = "1.4.0" } basic-toml = "0.1.2" serde = { version = "1.0.144", features = ["derive"] } -apple-sdk = { version = "0.4.0", default-features = false } +apple-sdk = { version = "0.5.1", default-features = false } tracing = { version = "0.1.37", default-features = false, features = ["std"] } tracing-subscriber = { version = "0.3.16", features = ["fmt"] } tracing-tree = { git = "https://github.com/madsmtm/tracing-tree.git" } diff --git a/crates/test-assembly/Cargo.toml b/crates/test-assembly/Cargo.toml index 99df756a7..919b20b97 100644 --- a/crates/test-assembly/Cargo.toml +++ b/crates/test-assembly/Cargo.toml @@ -10,7 +10,7 @@ license = "MIT" build = "build.rs" [dependencies] -cargo_metadata = "0.17" +cargo_metadata = "0.18" rustc-demangle = "0.1" regex = "1.6" lazy_static = "1.4.0" From 90ecad0526a0a92b2e2ab54e6e19ccc7d2d38e89 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 01:31:09 +0100 Subject: [PATCH 02/15] Update minimum required Apple versions The versions supported by Rust was updated in https://github.com/rust-lang/rust/pull/104385 to: - macOS: 10.12 Sierra - iOS: 10.0 - tvOS: 10.0 - watchOS: 5.0 Additionally, the armv7-apple-ios target was removed. Finally, since v1.0.84 of `cc` (has been yanked, but 1.0.85 will include it as well), there is much better support for specifying the deployment target for Apple targets, so I've removed the corresponding code from objc-sys. --- .github/workflows/ci.yml | 17 +- crates/block-sys/Cargo.toml | 1 - crates/block2/Cargo.toml | 1 - crates/header-translator/src/main.rs | 1 - crates/icrate/Cargo.toml | 1 - crates/icrate/README.md | 8 +- crates/objc-sys/Cargo.toml | 3 +- crates/objc-sys/README.md | 24 +- crates/objc-sys/build.rs | 128 +-- crates/objc2-encode/Cargo.toml | 1 - crates/objc2/Cargo.toml | 1 - .../expected/apple-armv7.s | 19 - .../test_declare_class/expected/apple-armv7.s | 886 ------------------ .../test_dynamic_class/expected/apple-armv7.s | 356 ------- .../test_dynamic_sel/expected/apple-armv7.s | 325 ------- .../expected/apple-armv7.s | 61 -- .../expected/apple-armv7.s | 322 ------- .../expected/apple-armv7.s | 227 ----- .../test_msg_send_id/expected/apple-armv7.s | 205 ---- .../expected/apple-armv7.s | 187 ---- .../expected/apple-armv7.s | 30 - .../test_ns_string/expected/apple-armv7.s | 122 --- .../expected/apple-armv7.s | 227 ----- .../expected/apple-armv7.s | 16 - .../test_static_class/expected/apple-armv7.s | 154 --- .../test_static_sel/expected/apple-armv7.s | 202 ---- helper-scripts/get_llvm_targets.fish | 2 +- helper-scripts/run-assembly-tests.sh | 1 - .../{test-local.fish => test-local.sh} | 15 +- 29 files changed, 55 insertions(+), 3488 deletions(-) delete mode 100644 crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_msg_send_error/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_msg_send_id/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_ns_string/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_out_parameters/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_static_class/expected/apple-armv7.s delete mode 100644 crates/test-assembly/crates/test_static_sel/expected/apple-armv7.s rename helper-scripts/{test-local.fish => test-local.sh} (58%) mode change 100755 => 100644 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 018b4b7d0..2ccf6e5c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,9 +25,11 @@ env: # Faster compilation, error on warnings and only document current crate RUSTFLAGS: "--codegen=debuginfo=0 --deny=warnings" RUSTDOCFLAGS: "--deny=warnings" - # Minimum deployment target - MACOSX_DEPLOYMENT_TARGET: 10.7 - IPHONEOS_DEPLOYMENT_TARGET: 7.0 + # Minimum deployment targets. + # Follows `rustc --target=x86_64-apple-darwin --print deployment-target` + MACOSX_DEPLOYMENT_TARGET: 10.12 + # Follows `rustc --target=x86_64-apple-ios --print deployment-target` + IPHONEOS_DEPLOYMENT_TARGET: 10.0 # We only support compiling Objective-C code with clang CC: clang CXX: clang++ @@ -102,7 +104,7 @@ jobs: --features=$INTERESTING_FEATURES --features=unstable-frameworks-macos-12 - name: iOS 32bit - target: armv7-apple-ios + target: armv7s-apple-ios build-std: true args: >- -Zbuild-std @@ -362,7 +364,7 @@ jobs: frameworks: macos-11 - name: Test macOS old SDK # Oldest macOS version we support - sdk: "10.7" + sdk: "10.12" frameworks: macos-10-7 - name: Test macOS nightly nightly: true @@ -380,11 +382,6 @@ jobs: - name: Build iOS ARM64 target: aarch64-apple-ios frameworks: ios - - name: Build iOS ARMv7 - target: armv7-apple-ios - nightly: true - build-std: true - frameworks: ios - name: Build iOS ARMv7s target: armv7s-apple-ios nightly: true diff --git a/crates/block-sys/Cargo.toml b/crates/block-sys/Cargo.toml index 3afca2de3..58d5b11f6 100644 --- a/crates/block-sys/Cargo.toml +++ b/crates/block-sys/Cargo.toml @@ -75,7 +75,6 @@ targets = [ # iOS "aarch64-apple-ios", "x86_64-apple-ios", - # "armv7-apple-ios", # "i386-apple-ios", # GNUStep "x86_64-unknown-linux-gnu", diff --git a/crates/block2/Cargo.toml b/crates/block2/Cargo.toml index 05fec97a1..09736c981 100644 --- a/crates/block2/Cargo.toml +++ b/crates/block2/Cargo.toml @@ -49,7 +49,6 @@ targets = [ # iOS "aarch64-apple-ios", "x86_64-apple-ios", - # "armv7-apple-ios", # "i386-apple-ios", # GNUStep "x86_64-unknown-linux-gnu", diff --git a/crates/header-translator/src/main.rs b/crates/header-translator/src/main.rs index 026d227b9..745dfff41 100644 --- a/crates/header-translator/src/main.rs +++ b/crates/header-translator/src/main.rs @@ -92,7 +92,6 @@ fn main() -> Result<(), BoxError> { ], Platform::IPhoneOs => &[ // "arm64-apple-ios7.0.0", - // "armv7-apple-ios7.0.0", // "armv7s-apple-ios", // "arm64-apple-ios14.0-macabi", // "x86_64-apple-ios13.0-macabi", diff --git a/crates/icrate/Cargo.toml b/crates/icrate/Cargo.toml index c6aa28141..069f91775 100644 --- a/crates/icrate/Cargo.toml +++ b/crates/icrate/Cargo.toml @@ -39,7 +39,6 @@ targets = [ # iOS "aarch64-apple-ios", "x86_64-apple-ios", - # "armv7-apple-ios", # "i386-apple-ios", # GNUStep "x86_64-unknown-linux-gnu", diff --git a/crates/icrate/README.md b/crates/icrate/README.md index ff0e4b2aa..a3db5e986 100644 --- a/crates/icrate/README.md +++ b/crates/icrate/README.md @@ -16,7 +16,7 @@ These bindings are automatically generated from the SDKs in Xcode 14.3.1 (will be periodically updated). Currently supports: -- macOS: `10.7-13.1` -- iOS/iPadOS: `7.0-16.2` (WIP) -- tvOS: `9.0-16.1` (WIP) -- watchOS: `1.0-9.1` (WIP) +- macOS: `10.12-13.1` +- iOS/iPadOS: `10.0-16.2` (WIP) +- tvOS: `10.0-16.1` (WIP) +- watchOS: `5.0-9.1` (WIP) diff --git a/crates/objc-sys/Cargo.toml b/crates/objc-sys/Cargo.toml index 4aa32da91..244401aa5 100644 --- a/crates/objc-sys/Cargo.toml +++ b/crates/objc-sys/Cargo.toml @@ -61,7 +61,7 @@ unstable-exception = ["cc"] unstable-docsrs = [] [build-dependencies] -cc = { version = "1", optional = true } +cc = { version = "1.0.80", optional = true } [package.metadata.docs.rs] default-target = "x86_64-apple-darwin" @@ -76,7 +76,6 @@ targets = [ # iOS "aarch64-apple-ios", "x86_64-apple-ios", - # "armv7-apple-ios", # "i386-apple-ios", # GNUStep "x86_64-unknown-linux-gnu", diff --git a/crates/objc-sys/README.md b/crates/objc-sys/README.md index 2b5c94d4d..99f49087d 100644 --- a/crates/objc-sys/README.md +++ b/crates/objc-sys/README.md @@ -36,22 +36,14 @@ This is used by default, and has the highest support priority (all of The supported runtime version (higher versions lets the compiler enable newer optimizations, at the cost of not supporting older operating systems) can be chosen using the standard `X_DEPLOYMENT_TARGET` environment variables: -- macOS: `MACOSX_DEPLOYMENT_TARGET` - - Default: `10.7`, `11.0` on Aarch64 - - Minimum: `10.7` -- iOS / iPadOS: `IPHONEOS_DEPLOYMENT_TARGET` - - Default: `7.0` - - Minimum: `5.0` (theoretically) -- tvOS: `TVOS_DEPLOYMENT_TARGET` - - Default: `7.0` - - Minimum: `5.0` (theoretically) -- watchOS: `WATCHOS_DEPLOYMENT_TARGET` - - Default: `5.0` - - Minimum: `1.0` (theoretically) - -The default versions are the [same as those Rust itself has][rust-apple-spec]. - -[rust-apple-spec]: https://github.com/rust-lang/rust/blob/fd815a5091eb4d49cd317f8ad272f17b7a5f550d/compiler/rustc_target/src/spec/apple_base.rs +- macOS: `MACOSX_DEPLOYMENT_TARGET`, default `10.12`, `11.0` on Aarch64. +- iOS / iPadOS: `IPHONEOS_DEPLOYMENT_TARGET`, default `10.0`. +- tvOS: `TVOS_DEPLOYMENT_TARGET`, default `10.0`. +- watchOS: `WATCHOS_DEPLOYMENT_TARGET`, default `5.0`. + +The default (and minimum) versions are the [same as those Rust itself has][rust-apple-spec]. + +[rust-apple-spec]: https://github.com/rust-lang/rust/blob/1.74.0/compiler/rustc_target/src/spec/apple_base.rs ### GNUStep's [`libobjc2`](https://github.com/gnustep/libobjc2) diff --git a/crates/objc-sys/build.rs b/crates/objc-sys/build.rs index dfc99698d..ca7755775 100644 --- a/crates/objc-sys/build.rs +++ b/crates/objc-sys/build.rs @@ -1,59 +1,13 @@ use std::{env, path::Path}; -/// TODO: Better validation of this -/// -/// The version is used for providing different behaviour when: -/// - CGException.cpp getObjCPersonality (GNUStep >= 1.7) -/// - Clang.cpp Clang::AddObjCRuntimeArgs (GNUStep >= 2.0) -/// - isLegacyDispatchDefaultForArch (macOS < 10.6, GNUStep < 1.6) -/// - hasNativeARC (macOS < 10.7, iOS < 5) -/// - shouldUseARCFunctionsForRetainRelease (macOS < 10.10, iOS < 8) -/// - shouldUseRuntimeFunctionsForAlloc (macOS < 10.10, iOS < 8) -/// - shouldUseRuntimeFunctionForCombinedAllocInit (macOS >= 10.14.4, iOS >= 12.2, watchOS >= 5.2) -/// - hasOptimizedSetter (macOS >= 10.8, iOS >= 6, GNUStep >= 1.7) -/// - hasSubscripting (macOS < 10.11, iOS < 9) -/// - hasTerminate (macOS < 10.8, iOS < 5) -/// - hasARCUnsafeClaimAutoreleasedReturnValue (macOS >= 10.11, iOS >= 9, watchOS >= 2) -/// - hasEmptyCollections (macOS >= 10.11, iOS >= 9, watchOS >= 2) -/// - ... (incomplete) -/// -/// `macosx-fragile` and `gcc` was not considered in this analysis, made on -/// clang version 13's source code: -/// https://github.com/llvm/llvm-project/blob/llvmorg-13.0.0/clang/include/clang/Basic/ObjCRuntime.h -/// -/// In short, it's not ultra important, but enables some optimizations if this -/// is specified. -type Version = String; - -// For clang "-fobjc-runtime" support -#[allow(clippy::upper_case_acronyms)] -enum AppleRuntime { - MacOS(Version), - IOS(Version), - TvOS(Version), - WatchOS(Version), - Unknown, - // BridgeOS, -} -use AppleRuntime::*; - +/// The selected runtime (and runtime version). enum Runtime { - Apple(AppleRuntime), + Apple, GNUStep(u8, u8), WinObjC, #[allow(dead_code)] ObjFW(Option), } -use Runtime::*; - -fn get_env(env: &str) -> Option { - println!("cargo:rerun-if-env-changed={env}"); - match env::var(env) { - Ok(var) => Some(var), - Err(env::VarError::NotPresent) => None, - Err(env::VarError::NotUnicode(var)) => panic!("Invalid unicode for {env}: {var:?}"), - } -} fn main() { // The script doesn't depend on our code @@ -102,39 +56,28 @@ fn main() { let runtime = match (apple, gnustep, objfw) { // Same logic as in https://github.com/rust-lang/rust/blob/1.63.0/compiler/rustc_target/src/spec/apple_base.rs - (true, false, false) => Apple(match &*target_os { - "macos" if target_arch == "aarch64" => { - MacOS(get_env("MACOSX_DEPLOYMENT_TARGET").unwrap_or_else(|| "11.0".into())) - } - "macos" => MacOS(get_env("MACOSX_DEPLOYMENT_TARGET").unwrap_or_else(|| "10.7".into())), - "ios" => IOS(get_env("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or_else(|| "7.0".into())), - "tvos" => TvOS(get_env("TVOS_DEPLOYMENT_TARGET").unwrap_or_else(|| "7.0".into())), - "watchos" => { - WatchOS(get_env("WATCHOS_DEPLOYMENT_TARGET").unwrap_or_else(|| "5.0".into())) - } - _ => Unknown, - }), + (true, false, false) => Runtime::Apple, (false, true, false) => { // Choose defaults when generating docs if cfg!(feature = "unstable-docsrs") { if "windows" == target_os { - WinObjC + Runtime::WinObjC } else { - GNUStep(1, 7) + Runtime::GNUStep(1, 7) } } else if env::var_os("CARGO_FEATURE_UNSTABLE_WINOBJC").is_some() { - WinObjC + Runtime::WinObjC } else if env::var_os("CARGO_FEATURE_GNUSTEP_2_1").is_some() { - GNUStep(2, 1) + Runtime::GNUStep(2, 1) } else if env::var_os("CARGO_FEATURE_GNUSTEP_2_0").is_some() { - GNUStep(2, 0) + Runtime::GNUStep(2, 0) } else if env::var_os("CARGO_FEATURE_GNUSTEP_1_9").is_some() { - GNUStep(1, 9) + Runtime::GNUStep(1, 9) } else if env::var_os("CARGO_FEATURE_GNUSTEP_1_8").is_some() { - GNUStep(1, 8) + Runtime::GNUStep(1, 8) } else { // CARGO_FEATURE_GNUSTEP_1_7 - GNUStep(1, 7) + Runtime::GNUStep(1, 7) } } (false, false, true) => { @@ -148,50 +91,37 @@ fn main() { // Add `#[cfg(RUNTIME)]` directive let runtime_cfg = match runtime { - Apple(_) => "apple", + Runtime::Apple => "apple", // WinObjC can be treated like GNUStep 1.8 - GNUStep(_, _) | WinObjC => "gnustep", - ObjFW(_) => "objfw", + Runtime::GNUStep(_, _) | Runtime::WinObjC => "gnustep", + Runtime::ObjFW(_) => "objfw", }; println!("cargo:rustc-cfg={runtime_cfg}"); - if let Apple(runtime) = &runtime { + if let Runtime::Apple = &runtime { // A few things are defined differently depending on the __OBJC2__ // variable, which is set for all platforms except 32-bit macOS. - if let (MacOS(_), "x86") = (runtime, &*target_arch) { + if target_os == "macos" && target_arch == "x86" { println!("cargo:rustc-cfg=apple_old"); } else { println!("cargo:rustc-cfg=apple_new"); } } - let clang_runtime = match &runtime { - Apple(runtime) => { - match (runtime, &*target_arch) { - // The fragile runtime is expected on i686-apple-darwin, see: - // https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/Driver/ToolChains/Darwin.h#L228-L231 - // https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/Driver/ToolChains/Clang.cpp#L3639-L3640 - // https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html - (MacOS(version), "x86") => format!("macosx-fragile-{version}"), - (MacOS(version), _) => format!("macosx-{version}"), - (IOS(version), _) => format!("ios-{version}"), - (WatchOS(version), _) => format!("watchos-{version}"), - // tvOS doesn't have its own -fobjc-runtime string - (TvOS(version), _) => format!("ios-{version}"), - // Choose a sensible default for other platforms that - // specified `apple`; this is likely not going to work anyhow - (Unknown, _) => "macosx".into(), - } - } + let clang_objc_runtime = match &runtime { + // Default to `clang`'s own heuristics. + // + // Note that the `cc` crate forwards the correct deployment target to clang as well. + Runtime::Apple => "".into(), // Default in clang is 1.6 // GNUStep's own default is 1.8 - GNUStep(major, minor) => format!("gnustep-{major}.{minor}"), + Runtime::GNUStep(major, minor) => format!(" -fobjc-runtime=gnustep-{major}.{minor}"), // WinObjC's libobjc2 is a fork of gnustep's from version 1.8 - WinObjC => "gnustep-1.8".into(), - ObjFW(version) => { + Runtime::WinObjC => " -fobjc-runtime=gnustep-1.8".into(), + Runtime::ObjFW(version) => { // Default in clang let version = version.as_deref().unwrap_or("0.8"); - format!("objfw-{version}") + format!(" -fobjc-runtime=objfw-{version}") } }; @@ -204,14 +134,8 @@ fn main() { // Assume the compiler is clang; if it isn't, this is probably going to // fail anyways, since we're using newer runtimes than GCC supports. // - // TODO: Should add we these, or is it someone else's responsibility? - // - `-mios-simulator-version-min={}` - // - `-miphoneos-version-min={}` - // - `-mmacosx-version-min={}` - // - ... - // // TODO: -fobjc-weak ? - let mut cc_args = format!("-fobjc-exceptions -fobjc-runtime={clang_runtime}"); + let mut cc_args = format!("-fobjc-exceptions{clang_objc_runtime}"); if let Runtime::ObjFW(_) = &runtime { // Add compability headers to make `#include ` work. diff --git a/crates/objc2-encode/Cargo.toml b/crates/objc2-encode/Cargo.toml index 91b0d646b..557fd45d2 100644 --- a/crates/objc2-encode/Cargo.toml +++ b/crates/objc2-encode/Cargo.toml @@ -37,7 +37,6 @@ targets = [ # iOS "aarch64-apple-ios", "x86_64-apple-ios", - # "armv7-apple-ios", # "i386-apple-ios", # GNUStep "x86_64-unknown-linux-gnu", diff --git a/crates/objc2/Cargo.toml b/crates/objc2/Cargo.toml index 96dc18391..fd3e781d4 100644 --- a/crates/objc2/Cargo.toml +++ b/crates/objc2/Cargo.toml @@ -125,7 +125,6 @@ targets = [ # iOS "aarch64-apple-ios", "x86_64-apple-ios", - # "armv7-apple-ios", # "i386-apple-ios", # GNUStep "x86_64-unknown-linux-gnu", diff --git a/crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7.s b/crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7.s deleted file mode 100644 index 871359113..000000000 --- a/crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7.s +++ /dev/null @@ -1,19 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _simple - .p2align 2 - .code 32 -_simple: - b _objc_autoreleaseReturnValue - - .globl _with_body - .p2align 2 - .code 32 -_with_body: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - pop {r7, lr} - b _objc_autoreleaseReturnValue - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s deleted file mode 100644 index f6138778a..000000000 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s +++ /dev/null @@ -1,886 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .p2align 2 - .code 32 -SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0): - bx lr - - .p2align 2 - .code 32 -SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0): - push {r4, r5, r7, lr} - add r7, sp, #8 - push {r8, r10, r11} - sub sp, sp, #12 - ldr r0, [r0] - mov r2, #0 - ldrb r1, [r0] - strb r2, [r0] - cmp r1, #0 - beq LBB1_5 - movw r1, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC1_0+8)) - movt r1, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC1_0+8)) - movw r0, :lower16:(l_anon.[ID].11-(LPC1_1+8)) -LPC1_0: - ldr r1, [pc, r1] - movt r0, :upper16:(l_anon.[ID].11-(LPC1_1+8)) -LPC1_1: - add r0, pc, r0 - ldr r2, [r1] - mov r1, #15 - bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) - cmp r0, #0 - beq LBB1_6 - movw r1, :lower16:(L_anon.[ID].12-(LPC1_2+8)) - add r4, sp, #8 - movt r1, :upper16:(L_anon.[ID].12-(LPC1_2+8)) - movw r3, :lower16:(l_anon.[ID].13-(LPC1_3+8)) - movt r3, :upper16:(l_anon.[ID].13-(LPC1_3+8)) -LPC1_2: - add r1, pc, r1 -LPC1_3: - add r3, pc, r3 - mov r2, #0 - str r0, [sp, #8] - mov r0, r4 - strd r2, r3, [sp] - mov r2, #4 - mov r3, #1 - bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) - movw r8, :lower16:(l_anon.[ID].2-(LPC1_4+8)) - mov r0, #2 - movt r8, :upper16:(l_anon.[ID].2-(LPC1_4+8)) - movw r1, :lower16:(L_anon.[ID].14-(LPC1_5+8)) - movt r1, :upper16:(L_anon.[ID].14-(LPC1_5+8)) -LPC1_4: - add r8, pc, r8 -LPC1_5: - add r1, pc, r1 - stm sp, {r0, r8} - mov r0, r4 - mov r2, #4 - mov r3, #4 - bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-(LPC1_6+8)) - mov r3, #0 - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-(LPC1_6+8)) - movw r10, :lower16:(l_anon.[ID].3-(LPC1_7+8)) -LPC1_6: - ldr r0, [pc, r0] - movt r10, :upper16:(l_anon.[ID].3-(LPC1_7+8)) -LPC1_7: - add r10, pc, r10 - ldr r1, [r0] - movw r11, :lower16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_8+8)) - movt r11, :upper16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_8+8)) - movw r5, :lower16:(l_anon.[ID].1-(LPC1_9+8)) - movt r5, :upper16:(l_anon.[ID].1-(LPC1_9+8)) -LPC1_8: - add r11, pc, r11 -LPC1_9: - add r5, pc, r5 - mov r0, r4 - strd r10, r11, [sp] - mov r2, r5 - bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_10+8)) - mov r2, r5 - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_10+8)) - mov r3, #0 -LPC1_10: - ldr r0, [pc, r0] - ldr r1, [r0] - movw r9, :lower16:(_init-(LPC1_11+8)) - movt r9, :upper16:(_init-(LPC1_11+8)) - mov r0, r4 -LPC1_11: - add r9, pc, r9 - strd r8, r9, [sp] - bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_d874ee9262978be2-(LPC1_12+8)) - mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_d874ee9262978be2-(LPC1_12+8)) - mov r2, r5 -LPC1_12: - ldr r1, [pc, r1] - movw r11, :lower16:(_class_method-(LPC1_13+8)) - movt r11, :upper16:(_class_method-(LPC1_13+8)) - mov r3, #0 -LPC1_13: - add r11, pc, r11 - strd r10, r11, [sp] - bl SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_4539fd1dbda0cddc-(LPC1_14+8)) - mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_4539fd1dbda0cddc-(LPC1_14+8)) - mov r2, r5 -LPC1_14: - ldr r1, [pc, r1] - movw r11, :lower16:(_method-(LPC1_15+8)) - movt r11, :upper16:(_method-(LPC1_15+8)) - mov r3, #0 -LPC1_15: - add r11, pc, r11 - strd r10, r11, [sp] - bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2b1b3a94e0ece2e5-(LPC1_16+8)) - mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2b1b3a94e0ece2e5-(LPC1_16+8)) -LPC1_16: - ldr r1, [pc, r1] - movw r3, :lower16:(_method_bool-(LPC1_17+8)) - movt r3, :upper16:(_method_bool-(LPC1_17+8)) - movw r10, :lower16:(l_anon.[ID].4-(LPC1_18+8)) - movt r10, :upper16:(l_anon.[ID].4-(LPC1_18+8)) -LPC1_17: - add r3, pc, r3 -LPC1_18: - add r10, pc, r10 - str r10, [sp] - str r3, [sp, #4] - mov r3, #1 - mov r2, r10 - bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f7f521670860b0ce-(LPC1_19+8)) - mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f7f521670860b0ce-(LPC1_19+8)) - mov r2, r5 -LPC1_19: - ldr r1, [pc, r1] - movw r9, :lower16:(_method_id-(LPC1_20+8)) - movt r9, :upper16:(_method_id-(LPC1_20+8)) - mov r3, #0 -LPC1_20: - add r9, pc, r9 - strd r8, r9, [sp] - bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_6addfcf634c6232f-(LPC1_21+8)) - mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_6addfcf634c6232f-(LPC1_21+8)) - mov r2, r10 -LPC1_21: - ldr r1, [pc, r1] - movw r9, :lower16:(_method_id_with_param-(LPC1_22+8)) - movt r9, :upper16:(_method_id_with_param-(LPC1_22+8)) - mov r3, #1 -LPC1_22: - add r9, pc, r9 - strd r8, r9, [sp] - bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r0, :lower16:(l_anon.[ID].17-(LPC1_23+8)) - mov r1, #9 - movt r0, :upper16:(l_anon.[ID].17-(LPC1_23+8)) -LPC1_23: - add r0, pc, r0 - bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) - cmp r0, #0 - beq LBB1_4 - mov r1, r0 - add r0, sp, #8 - bl SYM(objc2::declare::ClassBuilder::add_protocol::GENERATED_ID, 0) -LBB1_4: - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_4a8c690dbc9d8166-(LPC1_24+8)) - add r0, sp, #8 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_4a8c690dbc9d8166-(LPC1_24+8)) - mov r3, #1 -LPC1_24: - ldr r1, [pc, r1] - movw r2, :lower16:(l_anon.[ID].7-(LPC1_25+8)) - movt r2, :upper16:(l_anon.[ID].7-(LPC1_25+8)) - movw r9, :lower16:(_copyWithZone-(LPC1_26+8)) - movt r9, :upper16:(_copyWithZone-(LPC1_26+8)) -LPC1_25: - add r2, pc, r2 -LPC1_26: - add r9, pc, r9 - strd r8, r9, [sp] - bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - ldr r0, [sp, #8] - bl SYM(objc2::declare::ClassBuilder::register::GENERATED_ID, 0) - sub sp, r7, #20 - pop {r8, r10, r11} - pop {r4, r5, r7, pc} -LBB1_5: - movw r0, :lower16:(l_anon.[ID].8-(LPC1_27+8)) - mov r1, #43 - movt r0, :upper16:(l_anon.[ID].8-(LPC1_27+8)) - movw r2, :lower16:(l_anon.[ID].10-(LPC1_28+8)) - movt r2, :upper16:(l_anon.[ID].10-(LPC1_28+8)) -LPC1_27: - add r0, pc, r0 -LPC1_28: - add r2, pc, r2 - mov lr, pc - b SYM(core::panicking::panic::GENERATED_ID, 0) -LBB1_6: - movw r0, :lower16:(l_anon.[ID].11-(LPC1_29+8)) - mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC1_29+8)) - movw r2, :lower16:(l_anon.[ID].16-(LPC1_30+8)) - movt r2, :upper16:(l_anon.[ID].16-(LPC1_30+8)) -LPC1_29: - add r0, pc, r0 -LPC1_30: - add r2, pc, r2 - mov lr, pc - b SYM(objc2::__macro_helpers::declare_class::failed_declaring_class::GENERATED_ID, 0) - - .p2align 2 - .code 32 -SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0): - push {r7, lr} - mov r7, sp - sub sp, sp, #4 - ldr r0, [r0] - str r0, [sp] - mov r0, sp - bl SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) - mov sp, r7 - pop {r7, pc} - - .globl _get_class - .p2align 2 - .code 32 -_get_class: - push {r7, lr} - mov r7, sp - sub sp, sp, #12 - movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC3_0+8)) - movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC3_0+8)) -LPC3_0: - add r0, pc, r0 - ldr r0, [r0] - dmb ish - cmp r0, #3 - bne LBB3_3 -LBB3_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC3_4+8)) - mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC3_4+8)) -LPC3_4: - add r0, pc, r0 - bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) - cmp r0, #0 - movne sp, r7 - popne {r7, pc} -LBB3_2: - movw r0, :lower16:(l_anon.[ID].8-(LPC3_5+8)) - mov r1, #43 - movt r0, :upper16:(l_anon.[ID].8-(LPC3_5+8)) - movw r2, :lower16:(l_anon.[ID].16-(LPC3_6+8)) - movt r2, :upper16:(l_anon.[ID].16-(LPC3_6+8)) -LPC3_5: - add r0, pc, r0 -LPC3_6: - add r2, pc, r2 - mov lr, pc - b SYM(core::panicking::panic::GENERATED_ID, 0) -LBB3_3: - movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC3_1+8)) - mov r2, #1 - movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC3_1+8)) - movw r3, :lower16:(l_anon.[ID].0-(LPC3_2+8)) - movt r3, :upper16:(l_anon.[ID].0-(LPC3_2+8)) - movw r1, :lower16:(l_anon.[ID].16-(LPC3_3+8)) - movt r1, :upper16:(l_anon.[ID].16-(LPC3_3+8)) - strb r2, [r7, #-5] - sub r2, r7, #5 -LPC3_3: - add r1, pc, r1 - str r2, [r7, #-4] -LPC3_1: - add r0, pc, r0 -LPC3_2: - add r3, pc, r3 - sub r2, r7, #4 - str r1, [sp] - mov r1, #0 - bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) - b LBB3_1 - - .globl _get_obj - .p2align 2 - .code 32 -_get_obj: - push {r4, r7, lr} - add r7, sp, #4 - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC4_0+8)) - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC4_0+8)) -LPC4_0: - ldr r0, [pc, r0] - ldr r4, [r0] - bl _get_class - mov r1, r4 - pop {r4, r7, lr} - b _objc_msgSend - - .globl _access_ivars - .p2align 2 - .code 32 -_access_ivars: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - bl _get_obj - mov r4, r0 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].12-(LPC5_0+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].12-(LPC5_0+8)) - movw r3, :lower16:(l_anon.[ID].13-(LPC5_1+8)) - movt r3, :upper16:(l_anon.[ID].13-(LPC5_1+8)) -LPC5_0: - add r1, pc, r1 -LPC5_1: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - ldrb r5, [r4, r0] - mov r0, r4 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].14-(LPC5_2+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].14-(LPC5_2+8)) - movw r3, :lower16:(l_anon.[ID].2-(LPC5_3+8)) - movt r3, :upper16:(l_anon.[ID].2-(LPC5_3+8)) -LPC5_2: - add r1, pc, r1 -LPC5_3: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - ldr r6, [r4, r0] - mov r0, r4 - bl _objc_release - mov r0, r5 - mov r1, r6 - pop {r4, r5, r6, r7, pc} - - .globl SYM(::class, 0) - .p2align 2 - .code 32 -SYM(::class, 0): - push {r7, lr} - mov r7, sp - sub sp, sp, #12 - movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC6_0+8)) - movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC6_0+8)) -LPC6_0: - add r0, pc, r0 - ldr r0, [r0] - dmb ish - cmp r0, #3 - bne LBB6_3 -LBB6_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC6_4+8)) - mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC6_4+8)) -LPC6_4: - add r0, pc, r0 - bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) - cmp r0, #0 - movne sp, r7 - popne {r7, pc} -LBB6_2: - movw r0, :lower16:(l_anon.[ID].8-(LPC6_5+8)) - mov r1, #43 - movt r0, :upper16:(l_anon.[ID].8-(LPC6_5+8)) - movw r2, :lower16:(l_anon.[ID].16-(LPC6_6+8)) - movt r2, :upper16:(l_anon.[ID].16-(LPC6_6+8)) -LPC6_5: - add r0, pc, r0 -LPC6_6: - add r2, pc, r2 - mov lr, pc - b SYM(core::panicking::panic::GENERATED_ID, 0) -LBB6_3: - movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC6_1+8)) - mov r2, #1 - movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC6_1+8)) - movw r3, :lower16:(l_anon.[ID].0-(LPC6_2+8)) - movt r3, :upper16:(l_anon.[ID].0-(LPC6_2+8)) - movw r1, :lower16:(l_anon.[ID].16-(LPC6_3+8)) - movt r1, :upper16:(l_anon.[ID].16-(LPC6_3+8)) - strb r2, [r7, #-5] - sub r2, r7, #5 -LPC6_3: - add r1, pc, r1 - str r2, [r7, #-4] -LPC6_1: - add r0, pc, r0 -LPC6_2: - add r3, pc, r3 - sub r2, r7, #4 - str r1, [sp] - mov r1, #0 - bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) - b LBB6_1 - - .p2align 2 - .code 32 -SYM(::class::{closure#0}::__objc2_dealloc, 0): - push {r4, r5, r7, lr} - add r7, sp, #8 - sub sp, sp, #8 - mov r4, r1 - mov r5, r0 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].14-(LPC7_0+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].14-(LPC7_0+8)) - movw r3, :lower16:(l_anon.[ID].2-(LPC7_1+8)) - movt r3, :upper16:(l_anon.[ID].2-(LPC7_1+8)) -LPC7_0: - add r1, pc, r1 -LPC7_1: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - ldr r0, [r5, r0] - cmp r0, #0 - beq LBB7_2 - bl _objc_release -LBB7_2: - movw r0, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC7_2+8)) - mov r1, r4 - movt r0, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC7_2+8)) - str r5, [sp] -LPC7_2: - ldr r0, [pc, r0] - ldr r0, [r0] - str r0, [sp, #4] - mov r0, sp - bl _objc_msgSendSuper - sub sp, r7, #8 - pop {r4, r5, r7, pc} - - .globl _init - .p2align 2 - .code 32 -_init: - push {r4, r7, lr} - add r7, sp, #4 - sub sp, sp, #8 - movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC8_0+8)) - movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC8_0+8)) - movw r2, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC8_1+8)) -LPC8_0: - ldr r1, [pc, r1] - movt r2, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC8_1+8)) -LPC8_1: - ldr r2, [pc, r2] - ldr r1, [r1] - ldr r2, [r2] - stm sp, {r0, r2} - mov r0, sp - bl _objc_msgSendSuper - mov r4, r0 - cmp r0, #0 - beq LBB8_2 - mov r0, r4 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].12-(LPC8_2+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].12-(LPC8_2+8)) - movw r3, :lower16:(l_anon.[ID].13-(LPC8_3+8)) - movt r3, :upper16:(l_anon.[ID].13-(LPC8_3+8)) -LPC8_2: - add r1, pc, r1 -LPC8_3: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - mov r1, #42 - strb r1, [r4, r0] - mov r0, r4 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].14-(LPC8_4+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].14-(LPC8_4+8)) - movw r3, :lower16:(l_anon.[ID].2-(LPC8_5+8)) - movt r3, :upper16:(l_anon.[ID].2-(LPC8_5+8)) -LPC8_4: - add r1, pc, r1 -LPC8_5: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - mov r1, #0 - str r1, [r4, r0] -LBB8_2: - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} - - .globl _class_method - .p2align 2 - .code 32 -_class_method: - bx lr - - .globl _method - .p2align 2 - .code 32 -_method: - bx lr - - .globl _method_bool - .p2align 2 - .code 32 -_method_bool: - clz r0, r2 - lsr r0, r0, #5 - bx lr - - .globl _method_id - .p2align 2 - .code 32 -_method_id: - push {r4, r7, lr} - add r7, sp, #4 - mov r4, r0 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].14-(LPC12_0+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].14-(LPC12_0+8)) - movw r3, :lower16:(l_anon.[ID].2-(LPC12_1+8)) - movt r3, :upper16:(l_anon.[ID].2-(LPC12_1+8)) -LPC12_0: - add r1, pc, r1 -LPC12_1: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - ldr r0, [r4, r0] - cmp r0, #0 - beq LBB12_2 - bl _objc_retain - pop {r4, r7, lr} - b _objc_autoreleaseReturnValue -LBB12_2: - mov r0, #0 - pop {r4, r7, lr} - b _objc_autoreleaseReturnValue - - .globl _method_id_with_param - .p2align 2 - .code 32 -_method_id_with_param: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - mov r6, r2 - mov r5, r0 - bl SYM(objc2::runtime::nsobject::NSObject::new::GENERATED_ID, 0) - mov r4, r0 - cmp r6, #0 - beq LBB13_3 - mov r0, r5 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].14-(LPC13_0+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].14-(LPC13_0+8)) - movw r3, :lower16:(l_anon.[ID].2-(LPC13_1+8)) - movt r3, :upper16:(l_anon.[ID].2-(LPC13_1+8)) -LPC13_0: - add r1, pc, r1 -LPC13_1: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - ldr r0, [r5, r0] - cmp r0, #0 - beq LBB13_4 - bl _objc_retain - mov r5, r0 - b LBB13_5 -LBB13_3: - mov r5, r4 - mov r0, r5 - pop {r4, r5, r6, r7, lr} - b _objc_autoreleaseReturnValue -LBB13_4: - mov r5, #0 -LBB13_5: - mov r0, r4 - bl _objc_release - mov r0, r5 - pop {r4, r5, r6, r7, lr} - b _objc_autoreleaseReturnValue - - .globl _copyWithZone - .p2align 2 - .code 32 -_copyWithZone: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8, r10} - mov r5, r0 - bl _get_obj - mov r4, r0 - cmp r0, #0 - beq LBB14_5 - mov r0, r5 - bl _object_getClass - movw r10, :lower16:(L_anon.[ID].12-(LPC14_0+8)) - mov r2, #4 - movt r10, :upper16:(L_anon.[ID].12-(LPC14_0+8)) - movw r8, :lower16:(l_anon.[ID].13-(LPC14_1+8)) - movt r8, :upper16:(l_anon.[ID].13-(LPC14_1+8)) -LPC14_0: - add r10, pc, r10 -LPC14_1: - add r8, pc, r8 - mov r1, r10 - mov r3, r8 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - ldrb r6, [r5, r0] - mov r0, r4 - bl _object_getClass - mov r1, r10 - mov r2, #4 - mov r3, r8 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - strb r6, [r4, r0] - mov r0, r5 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].14-(LPC14_2+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].14-(LPC14_2+8)) - movw r3, :lower16:(l_anon.[ID].2-(LPC14_3+8)) - movt r3, :upper16:(l_anon.[ID].2-(LPC14_3+8)) -LPC14_2: - add r1, pc, r1 -LPC14_3: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - ldr r0, [r5, r0] - cmp r0, #0 - beq LBB14_3 - bl _objc_retain - mov r5, r0 - b LBB14_4 -LBB14_3: - mov r5, #0 -LBB14_4: - mov r0, r4 - bl _object_getClass - movw r1, :lower16:(L_anon.[ID].14-(LPC14_4+8)) - mov r2, #4 - movt r1, :upper16:(L_anon.[ID].14-(LPC14_4+8)) - movw r3, :lower16:(l_anon.[ID].2-(LPC14_5+8)) - movt r3, :upper16:(l_anon.[ID].2-(LPC14_5+8)) -LPC14_4: - add r1, pc, r1 -LPC14_5: - add r3, pc, r3 - bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) - str r5, [r4, r0] -LBB14_5: - mov r0, r4 - pop {r8, r10} - pop {r4, r5, r6, r7, pc} - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].0: - .long SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0) - .asciz "\004\000\000\000\004\000\000" - .long SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0) - .long SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) - - .section __TEXT,__const - .p2align 2, 0x0 -l_anon.[ID].1: - .byte 0 - - .p2align 2, 0x0 -l_anon.[ID].2: - .byte 19 - .space 19 - - .p2align 2, 0x0 -l_anon.[ID].3: - .byte 17 - .space 19 - - .p2align 2, 0x0 -l_anon.[ID].4: - .space 1 - .space 19 - -l_anon.[ID].5: - .ascii "_NSZone" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].6: - .byte 28 - .space 3 - .long l_anon.[ID].5 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 - - .p2align 2, 0x0 -l_anon.[ID].7: - .byte 25 - .space 3 - .long l_anon.[ID].6 - .space 12 - - .section __TEXT,__const -l_anon.[ID].8: - .ascii "called `Option::unwrap()` on a `None` value" - -l_anon.[ID].9: - .ascii "$RUSTC/library/std/src/sync/once.rs" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].10: - .long l_anon.[ID].9 - .asciz "p\000\000\000\225\000\000\0002\000\000" - - .section __TEXT,__const -l_anon.[ID].11: - .ascii "CustomClassName" - - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].12: - .ascii "_foo" - - .section __TEXT,__const - .p2align 2, 0x0 -l_anon.[ID].13: - .byte 5 - .space 19 - - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].14: - .ascii "_obj" - - .section __TEXT,__const -l_anon.[ID].15: - .ascii "crates/$DIR/lib.rs" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].16: - .long l_anon.[ID].15 - .asciz "5\000\000\000\f\000\000\000\001\000\000" - -.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 - .section __TEXT,__const -l_anon.[ID].17: - .ascii "NSCopying" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_d874ee9262978be2 -L_OBJC_METH_VAR_NAME_d874ee9262978be2: - .asciz "classMethod" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_d874ee9262978be2 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_d874ee9262978be2: - .long L_OBJC_METH_VAR_NAME_d874ee9262978be2 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_d874ee9262978be2 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_d874ee9262978be2: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_4539fd1dbda0cddc -L_OBJC_METH_VAR_NAME_4539fd1dbda0cddc: - .asciz "method" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_4539fd1dbda0cddc - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_4539fd1dbda0cddc: - .long L_OBJC_METH_VAR_NAME_4539fd1dbda0cddc - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_4539fd1dbda0cddc - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_4539fd1dbda0cddc: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_2b1b3a94e0ece2e5 -L_OBJC_METH_VAR_NAME_2b1b3a94e0ece2e5: - .asciz "methodBool:" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_2b1b3a94e0ece2e5 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_2b1b3a94e0ece2e5: - .long L_OBJC_METH_VAR_NAME_2b1b3a94e0ece2e5 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_2b1b3a94e0ece2e5 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_2b1b3a94e0ece2e5: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_f7f521670860b0ce -L_OBJC_METH_VAR_NAME_f7f521670860b0ce: - .asciz "methodId" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_f7f521670860b0ce - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_f7f521670860b0ce: - .long L_OBJC_METH_VAR_NAME_f7f521670860b0ce - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_f7f521670860b0ce - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_f7f521670860b0ce: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_6addfcf634c6232f -L_OBJC_METH_VAR_NAME_6addfcf634c6232f: - .asciz "methodIdWithParam:" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_6addfcf634c6232f - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_6addfcf634c6232f: - .long L_OBJC_METH_VAR_NAME_6addfcf634c6232f - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_6addfcf634c6232f - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_6addfcf634c6232f: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_4a8c690dbc9d8166 -L_OBJC_METH_VAR_NAME_4a8c690dbc9d8166: - .asciz "copyWithZone:" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_4a8c690dbc9d8166 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_4a8c690dbc9d8166: - .long L_OBJC_METH_VAR_NAME_4a8c690dbc9d8166 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_4a8c690dbc9d8166 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_4a8c690dbc9d8166: - .asciz "\000\000\000\000@\000\000" - - .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers - .p2align 2, 0x0 -LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr: - .indirect_symbol L_OBJC_CLASSLIST_REFERENCES_$_NSObject - .long 0 -LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr: - .indirect_symbol L_OBJC_SELECTOR_REFERENCES_dealloc - .long 0 -LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: - .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init - .long 0 -LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr: - .indirect_symbol L_OBJC_SELECTOR_REFERENCES_new - .long 0 - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7.s b/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7.s deleted file mode 100644 index 716bdd6d1..000000000 --- a/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7.s +++ /dev/null @@ -1,356 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _get_class - .p2align 2 - .code 32 -_get_class: - movw r0, :lower16:(__MergedGlobals-(LPC0_0+8)) - movt r0, :upper16:(__MergedGlobals-(LPC0_0+8)) -LPC0_0: - add r0, pc, r0 - ldr r0, [r0] - cmp r0, #0 - bxne lr -LBB0_1: - movw r0, :lower16:(__MergedGlobals-(LPC0_1+8)) - movt r0, :upper16:(__MergedGlobals-(LPC0_1+8)) - movw r1, :lower16:(l_anon.[ID].0-(LPC0_2+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC0_2+8)) - movw r2, :lower16:(l_anon.[ID].2-(LPC0_3+8)) - movt r2, :upper16:(l_anon.[ID].2-(LPC0_3+8)) -LPC0_1: - add r0, pc, r0 -LPC0_2: - add r1, pc, r1 -LPC0_3: - add r2, pc, r2 - b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - - .globl _get_same_class - .p2align 2 - .code 32 -_get_same_class: - movw r3, :lower16:(__MergedGlobals-(LPC1_0+8)) - movt r3, :upper16:(__MergedGlobals-(LPC1_0+8)) -LPC1_0: - add r3, pc, r3 - ldr r0, [r3, #4] - cmp r0, #0 - bxne lr -LBB1_1: - movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) - add r0, r3, #4 - movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) - movw r2, :lower16:(l_anon.[ID].3-(LPC1_2+8)) - movt r2, :upper16:(l_anon.[ID].3-(LPC1_2+8)) -LPC1_1: - add r1, pc, r1 -LPC1_2: - add r2, pc, r2 - b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - - .globl _get_different_class - .p2align 2 - .code 32 -_get_different_class: - movw r3, :lower16:(__MergedGlobals-(LPC2_0+8)) - movt r3, :upper16:(__MergedGlobals-(LPC2_0+8)) -LPC2_0: - add r3, pc, r3 - ldr r0, [r3, #8] - cmp r0, #0 - bxne lr -LBB2_1: - movw r1, :lower16:(l_anon.[ID].4-(LPC2_1+8)) - add r0, r3, #8 - movt r1, :upper16:(l_anon.[ID].4-(LPC2_1+8)) - movw r2, :lower16:(l_anon.[ID].5-(LPC2_2+8)) - movt r2, :upper16:(l_anon.[ID].5-(LPC2_2+8)) -LPC2_1: - add r1, pc, r1 -LPC2_2: - add r2, pc, r2 - b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - - .globl _unused_class - .p2align 2 - .code 32 -_unused_class: - movw r0, :lower16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_0+8)) - movt r0, :upper16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_0+8)) -LPC3_0: - add r0, pc, r0 - ldr r0, [r0] - cmp r0, #0 - bxne lr -LBB3_1: - movw r0, :lower16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_1+8)) - movt r0, :upper16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_1+8)) - movw r1, :lower16:(l_anon.[ID].6-(LPC3_2+8)) - movt r1, :upper16:(l_anon.[ID].6-(LPC3_2+8)) - movw r2, :lower16:(l_anon.[ID].7-(LPC3_3+8)) - movt r2, :upper16:(l_anon.[ID].7-(LPC3_3+8)) -LPC3_1: - add r0, pc, r0 -LPC3_2: - add r1, pc, r1 -LPC3_3: - add r2, pc, r2 - b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - - .globl _use_fns - .p2align 2 - .code 32 -_use_fns: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8, r10} - movw r10, :lower16:(__MergedGlobals-(LPC4_0+8)) - mov r4, r0 - movt r10, :upper16:(__MergedGlobals-(LPC4_0+8)) -LPC4_0: - add r10, pc, r10 - ldr r8, [r10] - cmp r8, #0 - beq LBB4_5 - ldr r6, [r10, #4] - cmp r6, #0 - beq LBB4_6 -LBB4_2: - ldr r5, [r10, #8] - cmp r5, #0 - beq LBB4_7 -LBB4_3: - ldr r0, [r10, #12] - cmp r0, #0 - beq LBB4_8 -LBB4_4: - str r8, [r4] - str r6, [r4, #4] - str r5, [r4, #8] - str r0, [r4, #12] - pop {r8, r10} - pop {r4, r5, r6, r7, pc} -LBB4_5: - movw r0, :lower16:(__MergedGlobals-(LPC4_1+8)) - movt r0, :upper16:(__MergedGlobals-(LPC4_1+8)) - movw r1, :lower16:(l_anon.[ID].0-(LPC4_2+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC4_2+8)) - movw r2, :lower16:(l_anon.[ID].2-(LPC4_3+8)) - movt r2, :upper16:(l_anon.[ID].2-(LPC4_3+8)) -LPC4_1: - add r0, pc, r0 -LPC4_2: - add r1, pc, r1 -LPC4_3: - add r2, pc, r2 - bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - mov r8, r0 - ldr r6, [r10, #4] - cmp r6, #0 - bne LBB4_2 -LBB4_6: - movw r1, :lower16:(l_anon.[ID].0-(LPC4_4+8)) - add r0, r10, #4 - movt r1, :upper16:(l_anon.[ID].0-(LPC4_4+8)) - movw r2, :lower16:(l_anon.[ID].3-(LPC4_5+8)) - movt r2, :upper16:(l_anon.[ID].3-(LPC4_5+8)) -LPC4_4: - add r1, pc, r1 -LPC4_5: - add r2, pc, r2 - bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - mov r6, r0 - ldr r5, [r10, #8] - cmp r5, #0 - bne LBB4_3 -LBB4_7: - movw r1, :lower16:(l_anon.[ID].4-(LPC4_6+8)) - add r0, r10, #8 - movt r1, :upper16:(l_anon.[ID].4-(LPC4_6+8)) - movw r2, :lower16:(l_anon.[ID].5-(LPC4_7+8)) - movt r2, :upper16:(l_anon.[ID].5-(LPC4_7+8)) -LPC4_6: - add r1, pc, r1 -LPC4_7: - add r2, pc, r2 - bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - mov r5, r0 - ldr r0, [r10, #12] - cmp r0, #0 - bne LBB4_4 -LBB4_8: - movw r1, :lower16:(l_anon.[ID].8-(LPC4_8+8)) - add r0, r10, #12 - movt r1, :upper16:(l_anon.[ID].8-(LPC4_8+8)) - movw r2, :lower16:(l_anon.[ID].9-(LPC4_9+8)) - movt r2, :upper16:(l_anon.[ID].9-(LPC4_9+8)) -LPC4_8: - add r1, pc, r1 -LPC4_9: - add r2, pc, r2 - bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - b LBB4_4 - - .globl _use_same_twice - .p2align 2 - .code 32 -_use_same_twice: - push {r4, r5, r7, lr} - add r7, sp, #8 - push {r8} - movw r5, :lower16:(__MergedGlobals-(LPC5_0+8)) - mov r4, r0 - movt r5, :upper16:(__MergedGlobals-(LPC5_0+8)) -LPC5_0: - add r5, pc, r5 - ldr r8, [r5] - cmp r8, #0 - beq LBB5_3 - ldr r9, [r5] - cmp r9, #0 - beq LBB5_4 -LBB5_2: - strd r8, r9, [r4] - pop {r8} - pop {r4, r5, r7, pc} -LBB5_3: - movw r0, :lower16:(__MergedGlobals-(LPC5_1+8)) - movt r0, :upper16:(__MergedGlobals-(LPC5_1+8)) - movw r1, :lower16:(l_anon.[ID].0-(LPC5_2+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC5_2+8)) - movw r2, :lower16:(l_anon.[ID].2-(LPC5_3+8)) - movt r2, :upper16:(l_anon.[ID].2-(LPC5_3+8)) -LPC5_1: - add r0, pc, r0 -LPC5_2: - add r1, pc, r1 -LPC5_3: - add r2, pc, r2 - bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - mov r8, r0 - ldr r9, [r5] - cmp r9, #0 - bne LBB5_2 -LBB5_4: - movw r0, :lower16:(__MergedGlobals-(LPC5_4+8)) - movt r0, :upper16:(__MergedGlobals-(LPC5_4+8)) - movw r1, :lower16:(l_anon.[ID].0-(LPC5_5+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC5_5+8)) - movw r2, :lower16:(l_anon.[ID].2-(LPC5_6+8)) - movt r2, :upper16:(l_anon.[ID].2-(LPC5_6+8)) -LPC5_4: - add r0, pc, r0 -LPC5_5: - add r1, pc, r1 -LPC5_6: - add r2, pc, r2 - bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - mov r9, r0 - strd r8, r9, [r4] - pop {r8} - pop {r4, r5, r7, pc} - - .globl _use_in_loop - .p2align 2 - .code 32 -_use_in_loop: - cmp r0, #0 - bxeq lr -LBB6_1: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8} - movw r5, :lower16:(SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)-(LPC6_0+8)) - mov r4, r0 - movt r5, :upper16:(SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)-(LPC6_0+8)) - movw r8, :lower16:(l_anon.[ID].10-(LPC6_1+8)) - movt r8, :upper16:(l_anon.[ID].10-(LPC6_1+8)) - movw r6, :lower16:(l_anon.[ID].11-(LPC6_2+8)) - movt r6, :upper16:(l_anon.[ID].11-(LPC6_2+8)) -LPC6_0: - add r5, pc, r5 -LPC6_1: - add r8, pc, r8 -LPC6_2: - add r6, pc, r6 - b LBB6_3 -LBB6_2: - subs r4, r4, #1 - beq LBB6_5 -LBB6_3: - ldr r0, [r5] - cmp r0, #0 - bne LBB6_2 - mov r0, r5 - mov r1, r8 - mov r2, r6 - bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) - b LBB6_2 -LBB6_5: - pop {r8} - pop {r4, r5, r6, r7, lr} - bx lr - - .section __TEXT,__const -l_anon.[ID].0: - .asciz "NSObject" - -l_anon.[ID].1: - .ascii "crates/$DIR/../test_static_class/lib.rs" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].2: - .long l_anon.[ID].1 - .asciz "J\000\000\000\b\000\000\000\005\000\000" - - .p2align 2, 0x0 -l_anon.[ID].3: - .long l_anon.[ID].1 - .asciz "J\000\000\000\r\000\000\000\005\000\000" - - .section __TEXT,__const -l_anon.[ID].4: - .asciz "NSString" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].5: - .long l_anon.[ID].1 - .asciz "J\000\000\000\022\000\000\000\005\000\000" - - .section __TEXT,__const -l_anon.[ID].6: - .asciz "NSData" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].7: - .long l_anon.[ID].1 - .asciz "J\000\000\000\027\000\000\000\r\000\000" - - .section __TEXT,__const -l_anon.[ID].8: - .asciz "NSException" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].9: - .long l_anon.[ID].1 - .asciz "J\000\000\000\037\000\000\000\016\000\000" - - .section __TEXT,__const -l_anon.[ID].10: - .asciz "NSLock" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].11: - .long l_anon.[ID].1 - .asciz "J\000\000\000-\000\000\000\021\000\000" - -.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0),4,2 -.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0),4,2 -.zerofill __DATA,__bss,__MergedGlobals,16,2 -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s deleted file mode 100644 index f79259864..000000000 --- a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s +++ /dev/null @@ -1,325 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _get_sel - .p2align 2 - .code 32 -_get_sel: - movw r0, :lower16:(__MergedGlobals-(LPC0_0+8)) - movt r0, :upper16:(__MergedGlobals-(LPC0_0+8)) -LPC0_0: - add r0, pc, r0 - ldr r0, [r0] - cmp r0, #0 - bxne lr -LBB0_1: - movw r0, :lower16:(__MergedGlobals-(LPC0_1+8)) - movt r0, :upper16:(__MergedGlobals-(LPC0_1+8)) - movw r1, :lower16:(l_anon.[ID].0-(LPC0_2+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC0_2+8)) -LPC0_1: - add r0, pc, r0 -LPC0_2: - add r1, pc, r1 - b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - - .globl _get_same_sel - .p2align 2 - .code 32 -_get_same_sel: - movw r2, :lower16:(__MergedGlobals-(LPC1_0+8)) - movt r2, :upper16:(__MergedGlobals-(LPC1_0+8)) -LPC1_0: - add r2, pc, r2 - ldr r0, [r2, #4] - cmp r0, #0 - bxne lr -LBB1_1: - movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) - add r0, r2, #4 - movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) -LPC1_1: - add r1, pc, r1 - b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - - .globl _get_common_twice - .p2align 2 - .code 32 -_get_common_twice: - push {r4, r5, r7, lr} - add r7, sp, #8 - movw r5, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) - movt r5, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) -LPC2_0: - ldr r5, [pc, r5] - ldr r4, [r5] - cmp r4, #0 - beq LBB2_3 - ldr r1, [r5] - cmp r1, #0 - beq LBB2_4 -LBB2_2: - mov r0, r4 - pop {r4, r5, r7, pc} -LBB2_3: - movw r0, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) - movt r0, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) - movw r1, :lower16:(l_anon.[ID].1-(LPC2_2+8)) - movt r1, :upper16:(l_anon.[ID].1-(LPC2_2+8)) -LPC2_1: - ldr r0, [pc, r0] -LPC2_2: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r4, r0 - ldr r1, [r5] - cmp r1, #0 - bne LBB2_2 -LBB2_4: - movw r0, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) - movt r0, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) - movw r1, :lower16:(l_anon.[ID].1-(LPC2_4+8)) - movt r1, :upper16:(l_anon.[ID].1-(LPC2_4+8)) -LPC2_3: - ldr r0, [pc, r0] -LPC2_4: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r1, r0 - mov r0, r4 - pop {r4, r5, r7, pc} - - .globl _get_different_sel - .p2align 2 - .code 32 -_get_different_sel: - movw r2, :lower16:(__MergedGlobals-(LPC3_0+8)) - movt r2, :upper16:(__MergedGlobals-(LPC3_0+8)) -LPC3_0: - add r2, pc, r2 - ldr r0, [r2, #8] - cmp r0, #0 - bxne lr -LBB3_1: - movw r1, :lower16:(L_anon.[ID].2-(LPC3_1+8)) - add r0, r2, #8 - movt r1, :upper16:(L_anon.[ID].2-(LPC3_1+8)) -LPC3_1: - add r1, pc, r1 - b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - - .globl _unused_sel - .p2align 2 - .code 32 -_unused_sel: - movw r0, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_0+8)) - movt r0, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_0+8)) -LPC4_0: - add r0, pc, r0 - ldr r0, [r0] - cmp r0, #0 - bxne lr -LBB4_1: - movw r0, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_1+8)) - movt r0, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_1+8)) - movw r1, :lower16:(l_anon.[ID].3-(LPC4_2+8)) - movt r1, :upper16:(l_anon.[ID].3-(LPC4_2+8)) -LPC4_1: - add r0, pc, r0 -LPC4_2: - add r1, pc, r1 - b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - - .globl _use_fns - .p2align 2 - .code 32 -_use_fns: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8, r10} - movw r10, :lower16:(__MergedGlobals-(LPC5_0+8)) - mov r4, r0 - movt r10, :upper16:(__MergedGlobals-(LPC5_0+8)) -LPC5_0: - add r10, pc, r10 - ldr r8, [r10] - cmp r8, #0 - beq LBB5_5 - ldr r6, [r10, #4] - cmp r6, #0 - beq LBB5_6 -LBB5_2: - ldr r5, [r10, #8] - cmp r5, #0 - beq LBB5_7 -LBB5_3: - ldr r0, [r10, #12] - cmp r0, #0 - beq LBB5_8 -LBB5_4: - str r8, [r4] - str r6, [r4, #4] - str r5, [r4, #8] - str r0, [r4, #12] - pop {r8, r10} - pop {r4, r5, r6, r7, pc} -LBB5_5: - movw r0, :lower16:(__MergedGlobals-(LPC5_1+8)) - movt r0, :upper16:(__MergedGlobals-(LPC5_1+8)) - movw r1, :lower16:(l_anon.[ID].0-(LPC5_2+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC5_2+8)) -LPC5_1: - add r0, pc, r0 -LPC5_2: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r8, r0 - ldr r6, [r10, #4] - cmp r6, #0 - bne LBB5_2 -LBB5_6: - movw r1, :lower16:(l_anon.[ID].0-(LPC5_3+8)) - add r0, r10, #4 - movt r1, :upper16:(l_anon.[ID].0-(LPC5_3+8)) -LPC5_3: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r6, r0 - ldr r5, [r10, #8] - cmp r5, #0 - bne LBB5_3 -LBB5_7: - movw r1, :lower16:(L_anon.[ID].2-(LPC5_4+8)) - add r0, r10, #8 - movt r1, :upper16:(L_anon.[ID].2-(LPC5_4+8)) -LPC5_4: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r5, r0 - ldr r0, [r10, #12] - cmp r0, #0 - bne LBB5_4 -LBB5_8: - movw r1, :lower16:(l_anon.[ID].4-(LPC5_5+8)) - add r0, r10, #12 - movt r1, :upper16:(l_anon.[ID].4-(LPC5_5+8)) -LPC5_5: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - b LBB5_4 - - .globl _use_same_twice - .p2align 2 - .code 32 -_use_same_twice: - push {r4, r5, r7, lr} - add r7, sp, #8 - push {r8} - movw r5, :lower16:(__MergedGlobals-(LPC6_0+8)) - mov r4, r0 - movt r5, :upper16:(__MergedGlobals-(LPC6_0+8)) -LPC6_0: - add r5, pc, r5 - ldr r8, [r5] - cmp r8, #0 - beq LBB6_3 - ldr r9, [r5] - cmp r9, #0 - beq LBB6_4 -LBB6_2: - strd r8, r9, [r4] - pop {r8} - pop {r4, r5, r7, pc} -LBB6_3: - movw r0, :lower16:(__MergedGlobals-(LPC6_1+8)) - movt r0, :upper16:(__MergedGlobals-(LPC6_1+8)) - movw r1, :lower16:(l_anon.[ID].0-(LPC6_2+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC6_2+8)) -LPC6_1: - add r0, pc, r0 -LPC6_2: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r8, r0 - ldr r9, [r5] - cmp r9, #0 - bne LBB6_2 -LBB6_4: - movw r0, :lower16:(__MergedGlobals-(LPC6_3+8)) - movt r0, :upper16:(__MergedGlobals-(LPC6_3+8)) - movw r1, :lower16:(l_anon.[ID].0-(LPC6_4+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC6_4+8)) -LPC6_3: - add r0, pc, r0 -LPC6_4: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r9, r0 - strd r8, r9, [r4] - pop {r8} - pop {r4, r5, r7, pc} - - .globl _use_in_loop - .p2align 2 - .code 32 -_use_in_loop: - cmp r0, #0 - bxeq lr -LBB7_1: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - movw r5, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)-(LPC7_0+8)) - mov r4, r0 - movt r5, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)-(LPC7_0+8)) - movw r6, :lower16:(l_anon.[ID].5-(LPC7_1+8)) - movt r6, :upper16:(l_anon.[ID].5-(LPC7_1+8)) -LPC7_0: - add r5, pc, r5 -LPC7_1: - add r6, pc, r6 - b LBB7_3 -LBB7_2: - subs r4, r4, #1 - beq LBB7_5 -LBB7_3: - ldr r0, [r5] - cmp r0, #0 - bne LBB7_2 - mov r0, r5 - mov r1, r6 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - b LBB7_2 -LBB7_5: - pop {r4, r5, r6, r7, lr} - bx lr - - .section __TEXT,__const -l_anon.[ID].0: - .asciz "simple" - -l_anon.[ID].1: - .asciz "alloc" - - .section __TEXT,__literal16,16byte_literals -L_anon.[ID].2: - .asciz "i:am:different:" - - .section __TEXT,__const -l_anon.[ID].3: - .asciz "unused" - -l_anon.[ID].4: - .asciz "fourthSel" - -l_anon.[ID].5: - .asciz "loopedSelector" - -.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0),4,2 -.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0),4,2 -.zerofill __DATA,__bss,__MergedGlobals,16,2 - .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers - .p2align 2, 0x0 -LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: - .indirect_symbol SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0) - .long 0 - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7.s b/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7.s deleted file mode 100644 index 1b23f82eb..000000000 --- a/crates/test-assembly/crates/test_extern_protocol/expected/apple-armv7.s +++ /dev/null @@ -1,61 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _get_protocol - .p2align 2 - .code 32 -_get_protocol: - movw r0, :lower16:(l_anon.[ID].0-(LPC0_0+8)) - mov r1, #10 - movt r0, :upper16:(l_anon.[ID].0-(LPC0_0+8)) -LPC0_0: - add r0, pc, r0 - b SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) - - .globl _dyn_call - .p2align 2 - .code 32 -_dyn_call: - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_17aa92881c42487f-(LPC1_0+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_17aa92881c42487f-(LPC1_0+8)) -LPC1_0: - ldr r1, [pc, r1] - b _objc_msgSend - - .globl _dyn_consume - .p2align 2 - .code 32 -_dyn_consume: - push {r4, r7, lr} - add r7, sp, #4 - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_17aa92881c42487f-(LPC2_0+8)) - mov r4, r0 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_17aa92881c42487f-(LPC2_0+8)) -LPC2_0: - ldr r1, [pc, r1] - bl _objc_msgSend - mov r0, r4 - pop {r4, r7, lr} - b _objc_release - - .section __TEXT,__const -l_anon.[ID].0: - .ascii "MyProtocol" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_17aa92881c42487f -L_OBJC_METH_VAR_NAME_17aa92881c42487f: - .asciz "aMethod" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_17aa92881c42487f - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_17aa92881c42487f: - .long L_OBJC_METH_VAR_NAME_17aa92881c42487f - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_17aa92881c42487f - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_17aa92881c42487f: - .asciz "\000\000\000\000@\000\000" - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7.s b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7.s deleted file mode 100644 index eb0a2597c..000000000 --- a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7.s +++ /dev/null @@ -1,322 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _iter_create - .p2align 2 - .code 32 -_iter_create: - vmov.i32 q8, #0x0 - mov r2, #0 - str r1, [r0] - add r1, r0, #80 - str r2, [r0, #100] - str r2, [r0, #104] - str r2, [r0, #72] - str r2, [r0, #76] - add r0, r0, #4 - vst1.32 {d16, d17}, [r0]! - vst1.32 {d16, d17}, [r0]! - vst1.32 {d16, d17}, [r0]! - vst1.32 {d16, d17}, [r1]! - vst1.32 {d16, d17}, [r0]! - str r2, [r1] - str r2, [r0] - bx lr - - .globl _iter_once - .p2align 2 - .code 32 -_iter_once: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8} - sub sp, sp, #4 - mov r4, r0 - ldrd r0, r1, [r0, #100] - cmp r0, r1 - blo LBB1_3 - ldr r6, [r4] - movw r0, :lower16:(LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) - movt r0, :upper16:(LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) - add r8, r4, #4 -LPC1_0: - ldr r0, [pc, r0] - add r5, r4, #68 - ldr r1, [r0] - cmp r1, #0 - beq LBB1_5 -LBB1_2: - mov r0, #16 - mov r2, r5 - str r0, [sp] - mov r0, r6 - mov r3, r8 - bl _objc_msgSend - mov r1, r0 - mov r0, #0 - cmp r1, #0 - strd r0, r1, [r4, #100] - beq LBB1_4 -LBB1_3: - ldr r1, [r4, #72] - add r2, r0, #1 - str r2, [r4, #100] - ldr r0, [r1, r0, lsl #2] -LBB1_4: - sub sp, r7, #16 - pop {r8} - pop {r4, r5, r6, r7, pc} -LBB1_5: - movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) - movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) -LPC1_1: - add r1, pc, r1 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r1, r0 - b LBB1_2 - - .globl _use_obj - .p2align 2 - .code 32 -_use_obj: - sub sp, sp, #4 - str r0, [sp] - mov r0, sp - @ InlineAsm Start - @ InlineAsm End - add sp, sp, #4 - bx lr - - .globl _iter - .p2align 2 - .code 32 -_iter: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8, r10, r11} - sub sp, sp, #120 - bfc sp, #0, #3 - add r1, sp, #8 - vmov.i32 q8, #0x0 - orr r4, r1, #4 - add r2, r1, #80 - mov r6, r0 - mov r0, #0 - mov r5, r4 - vst1.64 {d16, d17}, [r2]! - mov r11, #16 - mov r1, #0 - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - str r0, [r2] - str r0, [r5] - str r0, [sp, #112] - str r0, [sp, #108] - str r0, [sp, #84] - str r0, [sp, #80] - str r6, [sp, #8] - movw r8, :lower16:(LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) - movt r8, :upper16:(LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) - movw r10, :lower16:(l_anon.[ID].0-(LPC3_1+8)) - movt r10, :upper16:(l_anon.[ID].0-(LPC3_1+8)) -LPC3_0: - ldr r8, [pc, r8] -LPC3_1: - add r10, pc, r10 - b LBB3_3 -LBB3_1: - mov r0, r6 - mov r2, r5 - mov r3, r4 - str r11, [sp] - bl _objc_msgSend - mov r1, #0 - cmp r0, #0 - str r0, [sp, #112] - beq LBB3_6 -LBB3_2: - ldr r0, [sp, #80] - add r2, r1, #1 - str r2, [sp, #108] - ldr r0, [r0, r1, lsl #2] - bl _use_obj - ldr r6, [sp, #8] - ldr r1, [sp, #108] - ldr r0, [sp, #112] -LBB3_3: - cmp r1, r0 - blo LBB3_2 - ldr r1, [r8] - cmp r1, #0 - bne LBB3_1 - mov r0, r8 - mov r1, r10 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r1, r0 - b LBB3_1 -LBB3_6: - sub sp, r7, #24 - pop {r8, r10, r11} - pop {r4, r5, r6, r7, pc} - - .globl _iter_noop - .p2align 2 - .code 32 -_iter_noop: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8, r10, r11} - sub sp, sp, #120 - bfc sp, #0, #3 - add r1, sp, #8 - vmov.i32 q8, #0x0 - orr r4, r1, #4 - add r2, r1, #80 - mov r6, r0 - mov r0, #0 - mov r5, r4 - vst1.64 {d16, d17}, [r2]! - mov r11, #16 - mov r1, #0 - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - str r0, [r2] - str r0, [r5] - str r0, [sp, #112] - str r0, [sp, #108] - str r0, [sp, #84] - str r0, [sp, #80] - str r6, [sp, #8] - movw r8, :lower16:(LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) - movt r8, :upper16:(LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) - movw r10, :lower16:(l_anon.[ID].0-(LPC4_1+8)) - movt r10, :upper16:(l_anon.[ID].0-(LPC4_1+8)) -LPC4_0: - ldr r8, [pc, r8] -LPC4_1: - add r10, pc, r10 - b LBB4_2 -LBB4_1: - add r1, r1, #1 - str r1, [sp, #108] -LBB4_2: - cmp r1, r0 - blo LBB4_1 - ldr r1, [r8] - cmp r1, #0 - beq LBB4_6 -LBB4_4: - mov r0, r6 - mov r2, r5 - mov r3, r4 - str r11, [sp] - bl _objc_msgSend - cmp r0, #0 - str r0, [sp, #112] - beq LBB4_7 - ldr r6, [sp, #8] - mov r1, #0 - b LBB4_1 -LBB4_6: - mov r0, r8 - mov r1, r10 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r1, r0 - b LBB4_4 -LBB4_7: - sub sp, r7, #24 - pop {r8, r10, r11} - pop {r4, r5, r6, r7, pc} - - .globl _iter_retained - .p2align 2 - .code 32 -_iter_retained: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8, r10, r11} - sub sp, sp, #120 - bfc sp, #0, #3 - add r1, sp, #8 - vmov.i32 q8, #0x0 - orr r4, r1, #4 - add r2, r1, #80 - mov r6, r0 - mov r0, #0 - mov r5, r4 - vst1.64 {d16, d17}, [r2]! - mov r11, #16 - mov r1, #0 - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - vst1.32 {d16, d17}, [r5]! - str r0, [r2] - str r0, [r5] - str r0, [sp, #112] - str r0, [sp, #108] - str r0, [sp, #84] - str r0, [sp, #80] - str r6, [sp, #8] - movw r10, :lower16:(LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC5_0+8)) - movt r10, :upper16:(LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC5_0+8)) - movw r8, :lower16:(l_anon.[ID].0-(LPC5_1+8)) - movt r8, :upper16:(l_anon.[ID].0-(LPC5_1+8)) -LPC5_0: - ldr r10, [pc, r10] -LPC5_1: - add r8, pc, r8 - b LBB5_3 -LBB5_1: - mov r0, r6 - mov r2, r5 - mov r3, r4 - str r11, [sp] - bl _objc_msgSend - mov r1, #0 - cmp r0, #0 - str r0, [sp, #112] - beq LBB5_6 -LBB5_2: - ldr r0, [sp, #80] - add r2, r1, #1 - str r2, [sp, #108] - ldr r0, [r0, r1, lsl #2] - bl _objc_retain - mov r6, r0 - bl _use_obj - mov r0, r6 - bl _objc_release - ldr r6, [sp, #8] - ldr r1, [sp, #108] - ldr r0, [sp, #112] -LBB5_3: - cmp r1, r0 - blo LBB5_2 - ldr r1, [r10] - cmp r1, #0 - bne LBB5_1 - mov r0, r10 - mov r1, r8 - bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) - mov r1, r0 - b LBB5_1 -LBB5_6: - sub sp, r7, #24 - pop {r8, r10, r11} - pop {r4, r5, r6, r7, pc} - - .section __TEXT,__const -l_anon.[ID].0: - .asciz "countByEnumeratingWithState:objects:count:" - - .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers - .p2align 2, 0x0 -LSYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: - .indirect_symbol SYM(icrate::generated::Foundation::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0) - .long 0 - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_msg_send_error/expected/apple-armv7.s b/crates/test-assembly/crates/test_msg_send_error/expected/apple-armv7.s deleted file mode 100644 index aa80c3e62..000000000 --- a/crates/test-assembly/crates/test_msg_send_error/expected/apple-armv7.s +++ /dev/null @@ -1,227 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .p2align 2 - .code 32 -SYM(objc2[CRATE_ID]::__macro_helpers::msg_send_id::encountered_error::, 0): - push {r4, r7, lr} - add r7, sp, #4 - mov r4, r1 - bl _objc_retain - cmp r0, #0 - popne {r4, r7, pc} -LBB0_1: - movw r0, :lower16:(l_anon.[ID].0-(LPC0_0+8)) - mov r1, #56 - movt r0, :upper16:(l_anon.[ID].0-(LPC0_0+8)) - mov r2, r4 -LPC0_0: - add r0, pc, r0 - mov lr, pc - b SYM(core::option::expect_failed::GENERATED_ID, 0) - - .p2align 2 - .code 32 -SYM(objc2[CRATE_ID]::__macro_helpers::msg_send::encountered_error::, 0): - push {r7, lr} - mov r7, sp - bl _objc_retain - cmp r0, #0 - popne {r7, pc} -LBB1_1: - movw r0, :lower16:(l_anon.[ID].1-(LPC1_0+8)) - mov r1, #54 - movt r0, :upper16:(l_anon.[ID].1-(LPC1_0+8)) - movw r2, :lower16:(l_anon.[ID].3-(LPC1_1+8)) - movt r2, :upper16:(l_anon.[ID].3-(LPC1_1+8)) -LPC1_0: - add r0, pc, r0 -LPC1_1: - add r2, pc, r2 - mov lr, pc - b SYM(core::option::expect_failed::GENERATED_ID, 0) - - .globl _error_bool - .p2align 2 - .code 32 -_error_bool: - push {r4, r7, lr} - add r7, sp, #4 - sub sp, sp, #4 - mov r4, #0 - mov r3, sp - str r4, [sp] - bl _objc_msgSend - cmp r0, #0 - beq LBB2_2 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} -LBB2_2: - ldr r0, [sp] - bl SYM(objc2[CRATE_ID]::__macro_helpers::msg_send::encountered_error::, 0) - mov r4, r0 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} - - .globl _error_new - .p2align 2 - .code 32 -_error_new: - push {r4, r7, lr} - add r7, sp, #4 - sub sp, sp, #4 - mov r4, #0 - mov r2, sp - str r4, [sp] - bl _objc_msgSend - mov r1, r0 - cmp r0, #0 - beq LBB3_2 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} -LBB3_2: - ldr r0, [sp] - movw r1, :lower16:(l_anon.[ID].4-(LPC3_0+8)) - movt r1, :upper16:(l_anon.[ID].4-(LPC3_0+8)) -LPC3_0: - add r1, pc, r1 - bl SYM(objc2[CRATE_ID]::__macro_helpers::msg_send_id::encountered_error::, 0) - mov r1, r0 - mov r4, #1 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} - - .globl _error_init - .p2align 2 - .code 32 -_error_init: - push {r4, r7, lr} - add r7, sp, #4 - sub sp, sp, #4 - mov r4, #0 - mov r2, sp - str r4, [sp] - bl _objc_msgSend - mov r1, r0 - cmp r0, #0 - beq LBB4_2 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} -LBB4_2: - ldr r0, [sp] - movw r1, :lower16:(l_anon.[ID].5-(LPC4_0+8)) - movt r1, :upper16:(l_anon.[ID].5-(LPC4_0+8)) -LPC4_0: - add r1, pc, r1 - bl SYM(objc2[CRATE_ID]::__macro_helpers::msg_send_id::encountered_error::, 0) - mov r1, r0 - mov r4, #1 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} - - .globl _error_copy - .p2align 2 - .code 32 -_error_copy: - push {r4, r7, lr} - add r7, sp, #4 - sub sp, sp, #4 - mov r4, #0 - mov r2, sp - str r4, [sp] - bl _objc_msgSend - mov r1, r0 - cmp r0, #0 - beq LBB5_2 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} -LBB5_2: - ldr r0, [sp] - movw r1, :lower16:(l_anon.[ID].6-(LPC5_0+8)) - movt r1, :upper16:(l_anon.[ID].6-(LPC5_0+8)) -LPC5_0: - add r1, pc, r1 - bl SYM(objc2[CRATE_ID]::__macro_helpers::msg_send_id::encountered_error::, 0) - mov r1, r0 - mov r4, #1 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} - - .globl _error_autoreleased - .p2align 2 - .code 32 -_error_autoreleased: - push {r4, r7, lr} - add r7, sp, #4 - sub sp, sp, #4 - mov r4, #0 - mov r2, sp - str r4, [sp] - bl _objc_msgSend - @ InlineAsm Start - mov r7, r7 - @ InlineAsm End - bl _objc_retainAutoreleasedReturnValue - mov r1, r0 - cmp r0, #0 - beq LBB6_2 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} -LBB6_2: - ldr r0, [sp] - movw r1, :lower16:(l_anon.[ID].7-(LPC6_0+8)) - movt r1, :upper16:(l_anon.[ID].7-(LPC6_0+8)) -LPC6_0: - add r1, pc, r1 - bl SYM(objc2[CRATE_ID]::__macro_helpers::msg_send_id::encountered_error::, 0) - mov r1, r0 - mov r4, #1 - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} - - .section __TEXT,__const -l_anon.[ID].0: - .ascii "error parameter should be set if the method returns NULL" - -l_anon.[ID].1: - .ascii "error parameter should be set if the method returns NO" - -l_anon.[ID].2: - .ascii "crates/$DIR/lib.rs" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].3: - .long l_anon.[ID].2 - .asciz "6\000\000\000\n\000\000\000\005\000\000" - - .p2align 2, 0x0 -l_anon.[ID].4: - .long l_anon.[ID].2 - .asciz "6\000\000\000\017\000\000\000\005\000\000" - - .p2align 2, 0x0 -l_anon.[ID].5: - .long l_anon.[ID].2 - .asciz "6\000\000\000\026\000\000\000\005\000\000" - - .p2align 2, 0x0 -l_anon.[ID].6: - .long l_anon.[ID].2 - .asciz "6\000\000\000\033\000\000\000\005\000\000" - - .p2align 2, 0x0 -l_anon.[ID].7: - .long l_anon.[ID].2 - .asciz "6\000\000\000 \000\000\000\005\000\000" - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_msg_send_id/expected/apple-armv7.s b/crates/test-assembly/crates/test_msg_send_id/expected/apple-armv7.s deleted file mode 100644 index d12a29fcd..000000000 --- a/crates/test-assembly/crates/test_msg_send_id/expected/apple-armv7.s +++ /dev/null @@ -1,205 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _handle_new - .p2align 2 - .code 32 -_handle_new: - b _objc_msgSend - - .globl _handle_new_fallible - .p2align 2 - .code 32 -_handle_new_fallible: - push {r4, r5, r7, lr} - add r7, sp, #8 - mov r4, r1 - mov r5, r0 - bl _objc_msgSend - cmp r0, #0 - popne {r4, r5, r7, pc} -LBB1_1: - movw r2, :lower16:(l_anon.[ID].1-(LPC1_0+8)) - mov r0, r5 - movt r2, :upper16:(l_anon.[ID].1-(LPC1_0+8)) - mov r1, r4 -LPC1_0: - add r2, pc, r2 - mov lr, pc - b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) - - .globl _handle_alloc - .p2align 2 - .code 32 -_handle_alloc: - b _objc_msgSend - - .globl _handle_init - .p2align 2 - .code 32 -_handle_init: - b _objc_msgSend - - .globl _handle_init_fallible - .p2align 2 - .code 32 -_handle_init_fallible: - push {r4, r5, r7, lr} - add r7, sp, #8 - mov r4, r1 - mov r5, r0 - bl _objc_msgSend - cmp r0, #0 - popne {r4, r5, r7, pc} -LBB4_1: - movw r2, :lower16:(l_anon.[ID].2-(LPC4_0+8)) - mov r0, r5 - movt r2, :upper16:(l_anon.[ID].2-(LPC4_0+8)) - mov r1, r4 -LPC4_0: - add r2, pc, r2 - mov lr, pc - b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) - - .globl _handle_alloc_init - .p2align 2 - .code 32 -_handle_alloc_init: - push {r4, r7, lr} - add r7, sp, #4 - mov r4, r2 - bl _objc_msgSend - mov r1, r4 - pop {r4, r7, lr} - b _objc_msgSend - - .globl _handle_alloc_release - .p2align 2 - .code 32 -_handle_alloc_release: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - pop {r7, lr} - b _objc_release - - .globl _handle_alloc_init_release - .p2align 2 - .code 32 -_handle_alloc_init_release: - push {r4, r7, lr} - add r7, sp, #4 - mov r4, r2 - bl _objc_msgSend - mov r1, r4 - bl _objc_msgSend - pop {r4, r7, lr} - b _objc_release - - .globl _handle_copy - .p2align 2 - .code 32 -_handle_copy: - b _objc_msgSend - - .globl _handle_copy_fallible - .p2align 2 - .code 32 -_handle_copy_fallible: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - cmp r0, #0 - popne {r7, pc} -LBB9_1: - movw r0, :lower16:(l_anon.[ID].3-(LPC9_0+8)) - movt r0, :upper16:(l_anon.[ID].3-(LPC9_0+8)) -LPC9_0: - add r0, pc, r0 - mov lr, pc - b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) - - .globl _handle_autoreleased - .p2align 2 - .code 32 -_handle_autoreleased: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - @ InlineAsm Start - mov r7, r7 - @ InlineAsm End - pop {r7, lr} - b _objc_retainAutoreleasedReturnValue - - .globl _handle_autoreleased_fallible - .p2align 2 - .code 32 -_handle_autoreleased_fallible: - push {r4, r5, r7, lr} - add r7, sp, #8 - mov r4, r1 - mov r5, r0 - bl _objc_msgSend - @ InlineAsm Start - mov r7, r7 - @ InlineAsm End - bl _objc_retainAutoreleasedReturnValue - cmp r0, #0 - popne {r4, r5, r7, pc} -LBB11_1: - movw r2, :lower16:(l_anon.[ID].4-(LPC11_0+8)) - mov r0, r5 - movt r2, :upper16:(l_anon.[ID].4-(LPC11_0+8)) - mov r1, r4 -LPC11_0: - add r2, pc, r2 - mov lr, pc - b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) - - .globl _handle_with_out_param - .p2align 2 - .code 32 -_handle_with_out_param: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - mov r4, r2 - ldr r5, [r2] - bl _objc_msgSend - mov r6, r0 - ldr r0, [r4] - bl _objc_retain - mov r0, r5 - bl _objc_release - @ InlineAsm Start - mov r7, r7 - @ InlineAsm End - mov r0, r6 - pop {r4, r5, r6, r7, lr} - b _objc_retainAutoreleasedReturnValue - - .section __TEXT,__const -l_anon.[ID].0: - .ascii "crates/$DIR/lib.rs" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].1: - .long l_anon.[ID].0 - .asciz "3\000\000\000\r\000\000\000\005\000\000" - - .p2align 2, 0x0 -l_anon.[ID].2: - .long l_anon.[ID].0 - .asciz "3\000\000\000\034\000\000\000\005\000\000" - - .p2align 2, 0x0 -l_anon.[ID].3: - .long l_anon.[ID].0 - .asciz "3\000\000\0008\000\000\000\005\000\000" - - .p2align 2, 0x0 -l_anon.[ID].4: - .long l_anon.[ID].0 - .asciz "3\000\000\000B\000\000\000\005\000\000" - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7.s deleted file mode 100644 index 80a9cd68f..000000000 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7.s +++ /dev/null @@ -1,187 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _handle_with_sel - .p2align 2 - .code 32 -_handle_with_sel: - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_ad1b815073641351-(LPC0_0+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_ad1b815073641351-(LPC0_0+8)) -LPC0_0: - ldr r1, [pc, r1] - b _objc_msgSend - - .globl _handle_alloc_init - .p2align 2 - .code 32 -_handle_alloc_init: - push {r4, r5, r7, lr} - add r7, sp, #8 - movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) - movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) - movw r2, :lower16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_1+8)) - movt r2, :upper16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_1+8)) -LPC1_0: - ldr r1, [pc, r1] -LPC1_1: - ldr r2, [pc, r2] - ldr r4, [r1] - ldr r1, [r2] - bl _objc_msgSend - mov r1, r4 - mov r5, r0 - bl _objc_msgSend - cmp r0, #0 - popne {r4, r5, r7, pc} -LBB1_1: - movw r2, :lower16:(l_anon.[ID].1-(LPC1_2+8)) - mov r0, r5 - movt r2, :upper16:(l_anon.[ID].1-(LPC1_2+8)) - mov r1, r4 -LPC1_2: - add r2, pc, r2 - mov lr, pc - b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) - - .globl _use_generic - .p2align 2 - .code 32 -_use_generic: - push {r4, r7, lr} - add r7, sp, #4 - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_0+8)) - mov r4, r0 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_0+8)) -LPC2_0: - ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138-(LPC2_1+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138-(LPC2_1+8)) -LPC2_1: - ldr r1, [pc, r1] - bl _objc_msgSend - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_2+8)) - mov r0, r4 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_2+8)) -LPC2_2: - ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da-(LPC2_3+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da-(LPC2_3+8)) -LPC2_3: - ldr r1, [pc, r1] - bl _objc_msgSend - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_4+8)) - mov r0, r4 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_4+8)) -LPC2_4: - ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a-(LPC2_5+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a-(LPC2_5+8)) -LPC2_5: - ldr r1, [pc, r1] - pop {r4, r7, lr} - b _objc_msgSend - - .section __TEXT,__const -l_anon.[ID].0: - .ascii "crates/$DIR/lib.rs" - - .section __DATA,__const - .p2align 2, 0x0 -l_anon.[ID].1: - .long l_anon.[ID].0 - .asciz ";\000\000\000\016\000\000\000\005\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_ad1b815073641351 -L_OBJC_METH_VAR_NAME_ad1b815073641351: - .asciz "someSelector" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_ad1b815073641351 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_ad1b815073641351: - .long L_OBJC_METH_VAR_NAME_ad1b815073641351 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_ad1b815073641351 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_ad1b815073641351: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_5ace898e385eba05 -L_OBJC_METH_VAR_NAME_5ace898e385eba05: - .asciz "generic:selector:" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05: - .long L_OBJC_METH_VAR_NAME_5ace898e385eba05 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ace898e385eba05 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_5ace898e385eba05: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_1f1c7bd8029c3138 -L_OBJC_METH_VAR_NAME_1f1c7bd8029c3138: - .asciz "performSelector:" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138: - .long L_OBJC_METH_VAR_NAME_1f1c7bd8029c3138 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_1f1c7bd8029c3138 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_1f1c7bd8029c3138: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_eb5b4d2de37744da -L_OBJC_METH_VAR_NAME_eb5b4d2de37744da: - .asciz "performSelector:" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da: - .long L_OBJC_METH_VAR_NAME_eb5b4d2de37744da - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_eb5b4d2de37744da - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_eb5b4d2de37744da: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_c76827c00227cd8a -L_OBJC_METH_VAR_NAME_c76827c00227cd8a: - .asciz "performSelector:" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a: - .long L_OBJC_METH_VAR_NAME_c76827c00227cd8a - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_c76827c00227cd8a - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_c76827c00227cd8a: - .asciz "\000\000\000\000@\000\000" - - .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers - .p2align 2, 0x0 -LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr: - .indirect_symbol L_OBJC_SELECTOR_REFERENCES_alloc - .long 0 -LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: - .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init - .long 0 - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-armv7.s b/crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-armv7.s deleted file mode 100644 index cbaf97ee9..000000000 --- a/crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-armv7.s +++ /dev/null @@ -1,30 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _handle - .p2align 2 - .code 32 -_handle: - b _objc_msgSend - - .globl _handle_with_sel - .p2align 2 - .code 32 -_handle_with_sel: - movw r1, :lower16:(_SEL_REF-(LPC1_0+8)) - movt r1, :upper16:(_SEL_REF-(LPC1_0+8)) -LPC1_0: - ldr r1, [pc, r1] - b _objc_msgSend - - .section __TEXT,__const - .globl _SEL -_SEL: - .asciz "someSelector" - - .section __DATA,__const - .globl _SEL_REF - .p2align 2, 0x0 -_SEL_REF: - .long _SEL - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_ns_string/expected/apple-armv7.s b/crates/test-assembly/crates/test_ns_string/expected/apple-armv7.s deleted file mode 100644 index affe294c2..000000000 --- a/crates/test-assembly/crates/test_ns_string/expected/apple-armv7.s +++ /dev/null @@ -1,122 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _get_ascii - .p2align 2 - .code 32 -_get_ascii: - movw r0, :lower16:(SYM(test_ns_string[CRATE_ID]::get_ascii::CFSTRING, 0)-(LPC0_0+8)) - movt r0, :upper16:(SYM(test_ns_string[CRATE_ID]::get_ascii::CFSTRING, 0)-(LPC0_0+8)) -LPC0_0: - add r0, pc, r0 - bx lr - - .globl _get_utf16 - .p2align 2 - .code 32 -_get_utf16: - movw r0, :lower16:(SYM(test_ns_string[CRATE_ID]::get_utf16::CFSTRING, 0)-(LPC1_0+8)) - movt r0, :upper16:(SYM(test_ns_string[CRATE_ID]::get_utf16::CFSTRING, 0)-(LPC1_0+8)) -LPC1_0: - add r0, pc, r0 - bx lr - - .globl _get_with_nul - .p2align 2 - .code 32 -_get_with_nul: - movw r0, :lower16:(SYM(test_ns_string[CRATE_ID]::get_with_nul::CFSTRING, 0)-(LPC2_0+8)) - movt r0, :upper16:(SYM(test_ns_string[CRATE_ID]::get_with_nul::CFSTRING, 0)-(LPC2_0+8)) -LPC2_0: - add r0, pc, r0 - bx lr - - .section __DATA,__const - .globl _EMPTY - .p2align 2, 0x0 -_EMPTY: - .long SYM(test_ns_string[CRATE_ID]::EMPTY::CFSTRING, 0) - - .globl _XYZ - .p2align 2, 0x0 -_XYZ: - .long SYM(test_ns_string[CRATE_ID]::XYZ::CFSTRING, 0) - - .section __TEXT,__cstring,cstring_literals - .globl SYM(test_ns_string[CRATE_ID]::EMPTY::ASCII, 0) -SYM(test_ns_string[CRATE_ID]::EMPTY::ASCII, 0): - .space 1 - - .section __TEXT,__ustring - .globl SYM(test_ns_string[CRATE_ID]::EMPTY::UTF16, 0) - .p2align 1, 0x0 -SYM(test_ns_string[CRATE_ID]::EMPTY::UTF16, 0): - .space 2 - - .section __DATA,__cfstring - .globl SYM(test_ns_string[CRATE_ID]::EMPTY::CFSTRING, 0) - .p2align 2, 0x0 -SYM(test_ns_string[CRATE_ID]::EMPTY::CFSTRING, 0): - .long ___CFConstantStringClassReference - .asciz "\310\007\000" - .long SYM(test_ns_string[CRATE_ID]::EMPTY::ASCII, 0) - .space 4 - - .section __TEXT,__cstring,cstring_literals - .globl SYM(test_ns_string[CRATE_ID]::XYZ::ASCII, 0) -SYM(test_ns_string[CRATE_ID]::XYZ::ASCII, 0): - .asciz "xyz" - - .section __TEXT,__ustring - .globl SYM(test_ns_string[CRATE_ID]::XYZ::UTF16, 0) - .p2align 1, 0x0 -SYM(test_ns_string[CRATE_ID]::XYZ::UTF16, 0): - .asciz "x\000y\000z\000\000" - - .section __DATA,__cfstring - .globl SYM(test_ns_string[CRATE_ID]::XYZ::CFSTRING, 0) - .p2align 2, 0x0 -SYM(test_ns_string[CRATE_ID]::XYZ::CFSTRING, 0): - .long ___CFConstantStringClassReference - .asciz "\310\007\000" - .long SYM(test_ns_string[CRATE_ID]::XYZ::ASCII, 0) - .asciz "\003\000\000" - - .section __TEXT,__cstring,cstring_literals -SYM(test_ns_string[CRATE_ID]::get_ascii::ASCII, 0): - .asciz "abc" - - .section __DATA,__cfstring - .p2align 2, 0x0 -SYM(test_ns_string[CRATE_ID]::get_ascii::CFSTRING, 0): - .long ___CFConstantStringClassReference - .asciz "\310\007\000" - .long SYM(test_ns_string[CRATE_ID]::get_ascii::ASCII, 0) - .asciz "\003\000\000" - - .section __TEXT,__ustring - .p2align 1, 0x0 -SYM(test_ns_string[CRATE_ID]::get_utf16::UTF16, 0): - .asciz "\341\000b\000\007\001\000" - - .section __DATA,__cfstring - .p2align 2, 0x0 -SYM(test_ns_string[CRATE_ID]::get_utf16::CFSTRING, 0): - .long ___CFConstantStringClassReference - .asciz "\320\007\000" - .long SYM(test_ns_string[CRATE_ID]::get_utf16::UTF16, 0) - .asciz "\003\000\000" - - .section __TEXT,__ustring - .p2align 1, 0x0 -SYM(test_ns_string[CRATE_ID]::get_with_nul::UTF16, 0): - .asciz "a\000\000\000b\000\000\000c\000\000\000\000" - - .section __DATA,__cfstring - .p2align 2, 0x0 -SYM(test_ns_string[CRATE_ID]::get_with_nul::CFSTRING, 0): - .long ___CFConstantStringClassReference - .asciz "\320\007\000" - .long SYM(test_ns_string[CRATE_ID]::get_with_nul::UTF16, 0) - .asciz "\006\000\000" - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_out_parameters/expected/apple-armv7.s b/crates/test-assembly/crates/test_out_parameters/expected/apple-armv7.s deleted file mode 100644 index 4388893c3..000000000 --- a/crates/test-assembly/crates/test_out_parameters/expected/apple-armv7.s +++ /dev/null @@ -1,227 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _nonnull_nonnull - .p2align 2 - .code 32 -_nonnull_nonnull: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - mov r4, r2 - ldr r5, [r2] - bl _objc_msgSend - mov r6, r0 - ldr r0, [r4] - bl _objc_retain - mov r0, r5 - bl _objc_release - mov r0, r6 - pop {r4, r5, r6, r7, pc} - - .globl _null_nonnull - .p2align 2 - .code 32 -_null_nonnull: - cmp r2, #0 - beq LBB1_2 - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - mov r4, r2 - ldr r5, [r2] - bl _objc_msgSend - mov r6, r0 - ldr r0, [r4] - bl _objc_retain - mov r0, r5 - bl _objc_release - mov r0, r6 - pop {r4, r5, r6, r7, pc} -LBB1_2: - mov r2, #0 - b _objc_msgSend - - .globl _nonnull_null - .p2align 2 - .code 32 -_nonnull_null: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - mov r6, r2 - ldr r4, [r2] - bl _objc_msgSend - mov r5, r0 - ldr r0, [r6] - bl _objc_retain - cmp r4, #0 - beq LBB2_2 - mov r0, r4 - bl _objc_release -LBB2_2: - mov r0, r5 - pop {r4, r5, r6, r7, pc} - - .globl _null_null - .p2align 2 - .code 32 -_null_null: - cmp r2, #0 - beq LBB3_4 - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - mov r6, r2 - ldr r4, [r2] - bl _objc_msgSend - mov r5, r0 - ldr r0, [r6] - bl _objc_retain - cmp r4, #0 - beq LBB3_3 - mov r0, r4 - bl _objc_release -LBB3_3: - mov r0, r5 - pop {r4, r5, r6, r7, pc} -LBB3_4: - mov r2, #0 - b _objc_msgSend - - .globl _two_nonnull_nonnull - .p2align 2 - .code 32 -_two_nonnull_nonnull: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 - push {r8, r10} - mov r4, r3 - mov r5, r2 - ldr r8, [r3] - ldr r6, [r2] - bl _objc_msgSend - mov r10, r0 - ldr r0, [r5] - bl _objc_retain - mov r0, r6 - bl _objc_release - ldr r0, [r4] - bl _objc_retain - mov r0, r8 - bl _objc_release - mov r0, r10 - pop {r8, r10} - pop {r4, r5, r6, r7, pc} - - .globl _call_with_none1 - .p2align 2 - .code 32 -_call_with_none1: - mov r2, #0 - b _objc_msgSend - - .globl _call_with_none2 - .p2align 2 - .code 32 -_call_with_none2: - mov r2, #0 - b _objc_msgSend - - .globl _call_with_none3 - .p2align 2 - .code 32 -_call_with_none3: - push {r4, r7, lr} - add r7, sp, #4 - sub sp, sp, #4 - mov r2, #0 - str r2, [sp] - mov r2, sp - bl _objc_msgSend - mov r4, r0 - ldr r0, [sp] - bl _objc_retain - ldr r1, [sp] - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} - - .globl _call_with_none4 - .p2align 2 - .code 32 -_call_with_none4: - push {r4, r7, lr} - add r7, sp, #4 - sub sp, sp, #4 - mov r2, #0 - str r2, [sp] - mov r2, sp - bl _objc_msgSend - mov r4, r0 - ldr r0, [sp] - bl _objc_retain - ldr r1, [sp] - mov r0, r4 - sub sp, r7, #4 - pop {r4, r7, pc} - - .globl _call_with_some1 - .p2align 2 - .code 32 -_call_with_some1: - push {r4, r5, r7, lr} - add r7, sp, #8 - sub sp, sp, #4 - mov r4, r2 - str r2, [sp] - mov r2, sp - bl _objc_msgSend - mov r5, r0 - ldr r0, [sp] - bl _objc_retain - mov r0, r4 - bl _objc_release - ldr r1, [sp] - mov r0, r5 - sub sp, r7, #8 - pop {r4, r5, r7, pc} - - .globl _call_with_some2 - .p2align 2 - .code 32 -_call_with_some2: - push {r4, r5, r7, lr} - add r7, sp, #8 - sub sp, sp, #4 - mov r4, r2 - str r2, [sp] - mov r2, sp - bl _objc_msgSend - mov r5, r0 - ldr r0, [sp] - bl _objc_retain - mov r0, r4 - bl _objc_release - ldr r1, [sp] - mov r0, r5 - sub sp, r7, #8 - pop {r4, r5, r7, pc} - - .globl _call_with_some3 - .p2align 2 - .code 32 -_call_with_some3: - push {r4, r5, r7, lr} - add r7, sp, #8 - sub sp, sp, #4 - mov r4, r2 - str r2, [sp] - mov r2, sp - bl _objc_msgSend - mov r5, r0 - ldr r0, [sp] - bl _objc_retain - mov r0, r4 - bl _objc_release - ldr r1, [sp] - mov r0, r5 - sub sp, r7, #8 - pop {r4, r5, r7, pc} - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7.s b/crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7.s deleted file mode 100644 index c02cca05f..000000000 --- a/crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7.s +++ /dev/null @@ -1,16 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _handle - .p2align 2 - .code 32 -_handle: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - @ InlineAsm Start - mov r7, r7 - @ InlineAsm End - pop {r7, lr} - b _objc_retainAutoreleasedReturnValue - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_class/expected/apple-armv7.s b/crates/test-assembly/crates/test_static_class/expected/apple-armv7.s deleted file mode 100644 index 1e762516a..000000000 --- a/crates/test-assembly/crates/test_static_class/expected/apple-armv7.s +++ /dev/null @@ -1,154 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _get_class - .p2align 2 - .code 32 -_get_class: - movw r0, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC0_0+8)) - movt r0, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC0_0+8)) -LPC0_0: - ldr r0, [pc, r0] - bx lr - - .globl _get_same_class - .p2align 2 - .code 32 -_get_same_class: - movw r0, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-(LPC1_0+8)) - movt r0, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-(LPC1_0+8)) -LPC1_0: - ldr r0, [pc, r0] - bx lr - - .globl _get_different_class - .p2align 2 - .code 32 -_get_different_class: - movw r0, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC2_0+8)) - movt r0, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC2_0+8)) -LPC2_0: - ldr r0, [pc, r0] - bx lr - - .globl _unused_class - .p2align 2 - .code 32 -_unused_class: - bx lr - - .globl _use_fns - .p2align 2 - .code 32 -_use_fns: - movw r9, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_0+8)) - movt r9, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_0+8)) -LPC4_0: - ldr r9, [pc, r9] - movw r2, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC4_1+8)) - movt r2, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC4_1+8)) -LPC4_1: - ldr r2, [pc, r2] - movw r3, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-(LPC4_2+8)) - movt r3, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-(LPC4_2+8)) -LPC4_2: - ldr r3, [pc, r3] - movw r1, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC4_3+8)) - movt r1, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC4_3+8)) - str r2, [r0, #8] -LPC4_3: - ldr r1, [pc, r1] - str r9, [r0, #12] - stm r0, {r1, r3} - bx lr - - .globl _use_same_twice - .p2align 2 - .code 32 -_use_same_twice: - movw r1, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC5_0+8)) - movt r1, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC5_0+8)) -LPC5_0: - ldr r1, [pc, r1] - str r1, [r0] - str r1, [r0, #4] - bx lr - - .globl _use_in_loop - .p2align 2 - .code 32 -_use_in_loop: - bx lr - - .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777 - .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777: - .long _OBJC_CLASS_$_NSObject - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_928cf03fcc497777 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_928cf03fcc497777: - .asciz "\000\000\000\000@\000\000" - - .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07 - .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07: - .long _OBJC_CLASS_$_NSObject - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_2fe1990982915f07 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_2fe1990982915f07: - .asciz "\000\000\000\000@\000\000" - - .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b - .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b: - .long _OBJC_CLASS_$_NSString - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_dfff3a06c0bf722b - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_dfff3a06c0bf722b: - .asciz "\000\000\000\000@\000\000" - - .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513 - .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513: - .long _OBJC_CLASS_$_NSData - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_ea6fbcf172f7f513 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_ea6fbcf172f7f513: - .asciz "\000\000\000\000@\000\000" - - .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063 - .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063: - .long _OBJC_CLASS_$_NSException - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_97e6a8c6ed5db063 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_97e6a8c6ed5db063: - .asciz "\000\000\000\000@\000\000" - - .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d - .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d: - .long _OBJC_CLASS_$_NSLock - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_bb5b616899716c0d - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_bb5b616899716c0d: - .asciz "\000\000\000\000@\000\000" - -.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_sel/expected/apple-armv7.s b/crates/test-assembly/crates/test_static_sel/expected/apple-armv7.s deleted file mode 100644 index 80130f28f..000000000 --- a/crates/test-assembly/crates/test_static_sel/expected/apple-armv7.s +++ /dev/null @@ -1,202 +0,0 @@ - .section __TEXT,__text,regular,pure_instructions - .syntax unified - .globl _get_sel - .p2align 2 - .code 32 -_get_sel: - movw r0, :lower16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC0_0+8)) - movt r0, :upper16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC0_0+8)) -LPC0_0: - ldr r0, [pc, r0] - bx lr - - .globl _get_same_sel - .p2align 2 - .code 32 -_get_same_sel: - movw r0, :lower16:(L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83-(LPC1_0+8)) - movt r0, :upper16:(L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83-(LPC1_0+8)) -LPC1_0: - ldr r0, [pc, r0] - bx lr - - .globl _get_common_twice - .p2align 2 - .code 32 -_get_common_twice: - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC2_0+8)) - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC2_0+8)) -LPC2_0: - ldr r0, [pc, r0] - ldr r0, [r0] - mov r1, r0 - bx lr - - .globl _get_different_sel - .p2align 2 - .code 32 -_get_different_sel: - movw r0, :lower16:(L_OBJC_SELECTOR_REFERENCES_25911857653c680c-(LPC3_0+8)) - movt r0, :upper16:(L_OBJC_SELECTOR_REFERENCES_25911857653c680c-(LPC3_0+8)) -LPC3_0: - ldr r0, [pc, r0] - bx lr - - .globl _unused_sel - .p2align 2 - .code 32 -_unused_sel: - bx lr - - .globl _use_fns - .p2align 2 - .code 32 -_use_fns: - movw r9, :lower16:(L_OBJC_SELECTOR_REFERENCES_acb291d82e56f534-(LPC5_0+8)) - movt r9, :upper16:(L_OBJC_SELECTOR_REFERENCES_acb291d82e56f534-(LPC5_0+8)) -LPC5_0: - ldr r9, [pc, r9] - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_25911857653c680c-(LPC5_1+8)) - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_25911857653c680c-(LPC5_1+8)) -LPC5_1: - ldr r2, [pc, r2] - movw r3, :lower16:(L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83-(LPC5_2+8)) - movt r3, :upper16:(L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83-(LPC5_2+8)) -LPC5_2: - ldr r3, [pc, r3] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC5_3+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC5_3+8)) - str r2, [r0, #8] -LPC5_3: - ldr r1, [pc, r1] - str r9, [r0, #12] - stm r0, {r1, r3} - bx lr - - .globl _use_same_twice - .p2align 2 - .code 32 -_use_same_twice: - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC6_0+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC6_0+8)) -LPC6_0: - ldr r1, [pc, r1] - str r1, [r0] - str r1, [r0, #4] - bx lr - - .globl _use_in_loop - .p2align 2 - .code 32 -_use_in_loop: - bx lr - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_2ff5c2d33acc98c0 -L_OBJC_METH_VAR_NAME_2ff5c2d33acc98c0: - .asciz "simple" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0: - .long L_OBJC_METH_VAR_NAME_2ff5c2d33acc98c0 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_2ff5c2d33acc98c0 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_2ff5c2d33acc98c0: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_6e17eb9d3fa7fa83 -L_OBJC_METH_VAR_NAME_6e17eb9d3fa7fa83: - .asciz "simple" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83: - .long L_OBJC_METH_VAR_NAME_6e17eb9d3fa7fa83 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_6e17eb9d3fa7fa83 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_6e17eb9d3fa7fa83: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_25911857653c680c -L_OBJC_METH_VAR_NAME_25911857653c680c: - .asciz "i:am:different:" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_25911857653c680c - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_25911857653c680c: - .long L_OBJC_METH_VAR_NAME_25911857653c680c - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_25911857653c680c - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_25911857653c680c: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_baa3c09478169afc -L_OBJC_METH_VAR_NAME_baa3c09478169afc: - .asciz "unused" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_baa3c09478169afc - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_baa3c09478169afc: - .long L_OBJC_METH_VAR_NAME_baa3c09478169afc - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_baa3c09478169afc - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_baa3c09478169afc: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_acb291d82e56f534 -L_OBJC_METH_VAR_NAME_acb291d82e56f534: - .asciz "fourthSel" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_acb291d82e56f534 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_acb291d82e56f534: - .long L_OBJC_METH_VAR_NAME_acb291d82e56f534 - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_acb291d82e56f534 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_acb291d82e56f534: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_c831c01ba82dcc2e -L_OBJC_METH_VAR_NAME_c831c01ba82dcc2e: - .asciz "loopedSelector" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_c831c01ba82dcc2e - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_c831c01ba82dcc2e: - .long L_OBJC_METH_VAR_NAME_c831c01ba82dcc2e - - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_c831c01ba82dcc2e - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_c831c01ba82dcc2e: - .asciz "\000\000\000\000@\000\000" - - .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers - .p2align 2, 0x0 -LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr: - .indirect_symbol L_OBJC_SELECTOR_REFERENCES_alloc - .long 0 - -.subsections_via_symbols diff --git a/helper-scripts/get_llvm_targets.fish b/helper-scripts/get_llvm_targets.fish index 40372554f..26ae956bf 100644 --- a/helper-scripts/get_llvm_targets.fish +++ b/helper-scripts/get_llvm_targets.fish @@ -1,4 +1,4 @@ -set APPLE_TARGETS x86_64-apple-darwin aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios aarch64-apple-ios-macabi aarch64-apple-tvos aarch64-apple-watchos-sim arm64_32-apple-watchos armv7-apple-ios armv7k-apple-watchos armv7s-apple-ios i386-apple-ios i686-apple-darwin x86_64-apple-ios-macabi x86_64-apple-tvos x86_64-apple-watchos-sim +set APPLE_TARGETS x86_64-apple-darwin aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios aarch64-apple-ios-macabi aarch64-apple-tvos aarch64-apple-watchos-sim arm64_32-apple-watchos armv7k-apple-watchos armv7s-apple-ios i386-apple-ios i686-apple-darwin x86_64-apple-ios-macabi x86_64-apple-tvos x86_64-apple-watchos-sim for TARGET in $APPLE_TARGETS echo "" diff --git a/helper-scripts/run-assembly-tests.sh b/helper-scripts/run-assembly-tests.sh index a198c2339..a2cbec989 100755 --- a/helper-scripts/run-assembly-tests.sh +++ b/helper-scripts/run-assembly-tests.sh @@ -17,7 +17,6 @@ echo "Apple" $RUN x86_64-apple-darwin $RUN aarch64-apple-darwin $RUN armv7s-apple-ios -$RUN armv7-apple-ios $RUN i386-apple-ios echo "Old Apple" diff --git a/helper-scripts/test-local.fish b/helper-scripts/test-local.sh old mode 100755 new mode 100644 similarity index 58% rename from helper-scripts/test-local.fish rename to helper-scripts/test-local.sh index 934ef8b1a..dfe1c6e5c --- a/helper-scripts/test-local.fish +++ b/helper-scripts/test-local.sh @@ -1,8 +1,8 @@ -#!/opt/local/bin/fish +#!/bin/bash # A test script I use to test on my local devices -export MACOSX_DEPLOYMENT_TARGET=10.7 -export IPHONEOS_DEPLOYMENT_TARGET=7.0 +export MACOSX_DEPLOYMENT_TARGET=10.12 +export IPHONEOS_DEPLOYMENT_TARGET=10.0 export FEATURES=std,malloc,block,exception,catch-all,verify,unstable-static-class,unstable-static-sel # Start the simulator @@ -17,10 +17,11 @@ cargo dinghy --device sim test --release # Followed this guide to set it up: # https://github.com/sonos/dinghy/blob/main/docs/ios.md # -# We use build-std because the target is armv7-apple-ios -cargo +nightly dinghy --device ipad test -Zbuild-std -cargo +nightly dinghy --device ipad test -Zbuild-std --features=$FEATURES -cargo +nightly dinghy --device ipad test -Zbuild-std --release +# We use build-std and earlier nightly because the target is armv7-apple-ios, which was removed in: +# https://github.com/rust-lang/rust/pull/104385 +IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std +IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std --features=$FEATURES +IPHONEOS_DEPLOYMENT_TARGET=9.0 cargo +nightly-2023-09-23 dinghy --device ipad test -Zbuild-std --release # Test on macOS 32bit export SDKROOT=(pwd)/ideas/MacOSX10.13.sdk From 8525bfc88d02c7992368c908ba200ec2f6a6e8be Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sun, 26 Nov 2023 02:34:05 +0100 Subject: [PATCH 03/15] Add new runtime functions --- crates/objc-sys/CHANGELOG.md | 4 ++++ crates/objc-sys/src/exception.rs | 7 +++++++ crates/objc-sys/src/object.rs | 6 ++++++ crates/objc-sys/src/rc.rs | 30 ++++++++++++++++++++++++++---- helper-scripts/gen-git.fish | 6 ------ 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/crates/objc-sys/CHANGELOG.md b/crates/objc-sys/CHANGELOG.md index ad4f3e101..427a43f64 100644 --- a/crates/objc-sys/CHANGELOG.md +++ b/crates/objc-sys/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased - YYYY-MM-DD +### Added +* Added `objc_terminate`, `object_isClass`, `objc_alloc` and + `objc_allocWithZone` now that Rust's macOS deployment target is 10.12. + ## 0.3.1 - 2023-06-20 diff --git a/crates/objc-sys/src/exception.rs b/crates/objc-sys/src/exception.rs index c87dea605..1e24ea4da 100644 --- a/crates/objc-sys/src/exception.rs +++ b/crates/objc-sys/src/exception.rs @@ -44,12 +44,15 @@ extern_c_unwind! { /// See [`objc-exception.h`]. /// /// [`objc-exception.h`]: https://github.com/apple-oss-distributions/objc4/blob/objc4-818.2/runtime/objc-exception.h + #[cold] pub fn objc_exception_throw(exception: *mut objc_object) -> !; #[cfg(apple_new)] + #[cold] pub fn objc_exception_rethrow() -> !; #[cfg(gnustep)] + #[cold] pub fn objc_exception_rethrow(exc_buf: *mut c_void) -> !; } @@ -91,6 +94,10 @@ extern_c! { // // #[cfg(any(doc, gnustep))] // pub fn objc_set_apple_compatible_objcxx_exceptions(newValue: c_int) -> c_int; + + #[cold] + #[cfg(any(doc, apple_new))] + pub fn objc_terminate() -> !; } extern "C" { diff --git a/crates/objc-sys/src/object.rs b/crates/objc-sys/src/object.rs index f22a73b0e..c0faa753b 100644 --- a/crates/objc-sys/src/object.rs +++ b/crates/objc-sys/src/object.rs @@ -4,6 +4,8 @@ use std::os::raw::c_char; #[cfg(any(doc, not(objfw)))] use crate::objc_ivar; +#[cfg(any(doc, apple))] +use crate::BOOL; use crate::{objc_class, OpaqueData}; /// An opaque type that represents an object / an instance of a class. @@ -23,6 +25,8 @@ extern_c! { pub fn object_getClass(obj: *const objc_object) -> *const objc_class; pub fn object_getClassName(obj: *const objc_object) -> *const c_char; pub fn object_setClass(obj: *mut objc_object, cls: *const objc_class) -> *const objc_class; + #[cfg(any(doc, apple))] + pub fn object_isClass(obj: *const objc_object) -> BOOL; #[cfg(any(doc, not(objfw)))] pub fn object_getIndexedIvars(obj: *const objc_object) -> *const c_void; @@ -90,6 +94,8 @@ extern_c! { // atomic: BOOL, // shouldCopy: i8, // ); + // + the atomic versions + // This is generated in setters to struct properties. // pub fn objc_copyStruct( // dest: *mut c_void, diff --git a/crates/objc-sys/src/rc.rs b/crates/objc-sys/src/rc.rs index 9d06ec130..2d4f51794 100644 --- a/crates/objc-sys/src/rc.rs +++ b/crates/objc-sys/src/rc.rs @@ -1,17 +1,18 @@ //! ARC functions. //! -//! Is available in Clang's [documentation][ARC] so these are safe to rely on. -//! -//! All available since macOS `10.7`. +//! These are documented in Clang's [documentation][ARC], and available since +//! macOS `10.7` unless otherwise noted, so they are safe to rely on. //! //! Defined in: //! - Apple: `objc-internal.h` //! - GNUStep: `objc-arc.h` //! - ObjFW: `runtime/arc.m` //! -//! [ARC]: https://clang.llvm.org/docs/AutomaticReferenceCounting.html#runtime-support> +//! [ARC]: https://clang.llvm.org/docs/AutomaticReferenceCounting.html#runtime-support use core::ffi::c_void; +#[cfg(any(doc, apple_new))] +use crate::objc_class; use crate::objc_object; // All of these very rarely unwind, but may if the user defined methods @@ -60,4 +61,25 @@ extern_c_unwind! { // TODO: Decide about nonstandard extensions like these: // #[cfg(any(doc, gnustep))] // pub fn objc_delete_weak_refs(obj: *mut objc_object) -> BOOL; + + // Fast paths for certain selectors. + // + // These are not defined in the ARC documentation, but are emitted by + // `clang` and included (and intended to be included) in the final + // binary, so very likely safe to use. + // + // TODO: Unsure why these are not available in the old fragile runtime, + // the headers seem to indicate that they are. + // + // + + // Available since macOS 10.9. + #[cfg(any(doc, apple_new))] + pub fn objc_alloc(value: *const objc_class) -> *mut objc_object; + + // Available since macOS 10.9. + #[cfg(any(doc, apple_new))] + pub fn objc_allocWithZone(value: *const objc_class) -> *mut objc_object; + + // TODO: objc_alloc_init once supported } diff --git a/helper-scripts/gen-git.fish b/helper-scripts/gen-git.fish index 2af6ce627..5d83cda8d 100755 --- a/helper-scripts/gen-git.fish +++ b/helper-scripts/gen-git.fish @@ -61,12 +61,6 @@ function bty end function blocklisted - # Added in 10.8 - bfn objc_terminate - - # Added in 10.10 - bfn object_isClass - # Removed in 10.11 bfn objc_setFutureClass From 9a7c66453722f907127ed35a7da3bc2532df6896 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 02:10:13 +0100 Subject: [PATCH 04/15] Bump minimum deployment target in icrate --- .github/workflows/ci.yml | 4 +- crates/header-translator/src/main.rs | 14 +++---- crates/header-translator/src/output.rs | 17 +++++---- .../header-translator/translation-config.toml | 10 ----- crates/icrate/CHANGELOG.md | 2 + crates/icrate/Cargo.toml | 36 +++++++++--------- crates/icrate/src/fixes/AppKit/mod.rs | 37 ------------------- crates/icrate/src/generated | 2 +- crates/icrate/tests/auto_traits.rs | 1 - 9 files changed, 39 insertions(+), 84 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ccf6e5c5..9de62a452 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -365,7 +365,7 @@ jobs: - name: Test macOS old SDK # Oldest macOS version we support sdk: "10.12" - frameworks: macos-10-7 + frameworks: macos-10-12 - name: Test macOS nightly nightly: true frameworks: macos-11 @@ -475,7 +475,7 @@ jobs: # TODO: Re-enable this on all of Foundation once we do some form of # availability checking. - name: Test static class and selectors - if: ${{ !contains(matrix.frameworks, 'ios') && !contains(matrix.frameworks, 'macos-10-7') }} + if: ${{ !contains(matrix.frameworks, 'ios') && !contains(matrix.frameworks, 'macos-10-12') }} run: >- cargo test $ARGS $PUBLIC_CRATES -ptests --features=unstable-static-sel,unstable-static-class,unstable-static-nsstring diff --git a/crates/header-translator/src/main.rs b/crates/header-translator/src/main.rs index 745dfff41..53510553e 100644 --- a/crates/header-translator/src/main.rs +++ b/crates/header-translator/src/main.rs @@ -86,20 +86,20 @@ fn main() -> Result<(), BoxError> { // These are found using the `get_llvm_targets.fish` helper script let llvm_targets: &[_] = match &sdk.platform { Platform::MacOsX => &[ - "x86_64-apple-macosx10.7.0", + "x86_64-apple-macosx10.12.0", // "arm64-apple-macosx11.0.0", - // "i686-apple-macosx10.7.0", + // "i686-apple-macosx10.12.0", ], Platform::IPhoneOs => &[ - // "arm64-apple-ios7.0.0", - // "armv7s-apple-ios", + // "arm64-apple-ios10.0.0", + // "armv7s-apple-ios10.0.0", // "arm64-apple-ios14.0-macabi", // "x86_64-apple-ios13.0-macabi", ], // Platform::IPhoneSimulator => &[ - // "arm64-apple-ios7.0.0-simulator", - // "x86_64-apple-ios7.0.0-simulator", - // "i386-apple-ios7.0.0-simulator", + // "arm64-apple-ios10.0.0-simulator", + // "x86_64-apple-ios10.0.0-simulator", + // "i386-apple-ios10.0.0-simulator", // ], // Platform::AppleTvOs => &["arm64-apple-tvos", "x86_64-apple-tvos"], // Platform::WatchOs => &["arm64_32-apple-watchos", "armv7k-apple-watchos"], diff --git a/crates/header-translator/src/output.rs b/crates/header-translator/src/output.rs index 3ec5622c2..edbae9e7f 100644 --- a/crates/header-translator/src/output.rs +++ b/crates/header-translator/src/output.rs @@ -49,11 +49,12 @@ impl Output { pub fn cargo_features(&self, config: &Config) -> BTreeMap> { let mut features = BTreeMap::new(); - let mut macos_10_7_features: BTreeSet = vec!["unstable-example-basic_usage".into()] - .into_iter() - .collect(); + let mut macos_10_12_features: BTreeSet = + vec!["unstable-example-basic_usage".into()] + .into_iter() + .collect(); let mut macos_10_13_features: BTreeSet = vec![ - "unstable-frameworks-macos-10-7".into(), + "unstable-frameworks-macos-10-12".into(), "unstable-example-delegate".into(), "unstable-example-metal".into(), "unstable-example-nspasteboard".into(), @@ -88,8 +89,8 @@ impl Output { let _ = features.insert(library_name.to_string(), library_features.collect()); if let Some(version) = &library.macos { - if version.matches(&semver::Version::from_str("10.7.0").unwrap()) { - macos_10_7_features.insert(format!("{library_name}_all")); + if version.matches(&semver::Version::from_str("10.12.0").unwrap()) { + macos_10_12_features.insert(format!("{library_name}_all")); } else if version.matches(&semver::Version::from_str("10.13.0").unwrap()) { macos_10_13_features.insert(format!("{library_name}_all")); } else if version.matches(&semver::Version::from_str("11.0.0").unwrap()) { @@ -107,8 +108,8 @@ impl Output { } let _ = features.insert( - "unstable-frameworks-macos-10-7".into(), - macos_10_7_features.into_iter().collect(), + "unstable-frameworks-macos-10-12".into(), + macos_10_12_features.into_iter().collect(), ); let _ = features.insert( "unstable-frameworks-macos-10-13".into(), diff --git a/crates/header-translator/translation-config.toml b/crates/header-translator/translation-config.toml index 71388f212..8952d8830 100644 --- a/crates/header-translator/translation-config.toml +++ b/crates/header-translator/translation-config.toml @@ -1321,16 +1321,6 @@ skipped = true [enum.NSTextAlignment] skipped = true -# Different definitions depending on deployment target -[class.NSLayoutAnchor] -definition-skipped = true -[class.NSPopover] -definition-skipped = true -[class.NSPopover.methods] -appearance = { skipped = true } -setAppearance = { skipped = true } -effectiveAppearance = { skipped = true } - # I'm unsure of the ABI of the array this takes [fn.NSDrawBitmap] skipped = true diff --git a/crates/icrate/CHANGELOG.md b/crates/icrate/CHANGELOG.md index 58593e421..7c5fc1b0b 100644 --- a/crates/icrate/CHANGELOG.md +++ b/crates/icrate/CHANGELOG.md @@ -74,6 +74,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * **BREAKING**: Removed a workaround that made the `NSCopying` and `NSMutableCopying` protocols not act as regular protocols (many methods used `AnyObject` instead of the correct `ProtocolObject`). +* Update the minimum deployment target, which adds a few missing protocol + implementations and methods for `NSPopover` and `NSLayoutAnchor`. ## icrate 0.0.4 - 2023-07-31 diff --git a/crates/icrate/Cargo.toml b/crates/icrate/Cargo.toml index 069f91775..f9f1016ac 100644 --- a/crates/icrate/Cargo.toml +++ b/crates/icrate/Cargo.toml @@ -5329,39 +5329,39 @@ unstable-frameworks-gnustep = [ "AppKit_all", "Foundation_all", ] -unstable-frameworks-macos-10-13 = [ +unstable-frameworks-macos-10-12 = [ + "AppKit_all", + "Automator_all", "CloudKit_all", "Contacts_all", + "CoreAnimation_all", + "CoreData_all", "CoreLocation_all", + "CoreWLAN_all", "EventKit_all", - "ExternalAccessory_all", + "ExceptionHandling_all", + "Foundation_all", "GameController_all", "GameKit_all", + "InputMethodKit_all", "LocalAuthentication_all", "MapKit_all", - "MediaPlayer_all", "MetalKit_all", "Metal_all", + "OSAKit_all", "PhotoKit_all", + "StoreKit_all", + "WebKit_all", + "unstable-example-basic_usage", +] +unstable-frameworks-macos-10-13 = [ + "ExternalAccessory_all", + "MediaPlayer_all", "unstable-example-delegate", "unstable-example-metal", "unstable-example-nspasteboard", "unstable-example-speech_synthesis", - "unstable-frameworks-macos-10-7", -] -unstable-frameworks-macos-10-7 = [ - "AppKit_all", - "Automator_all", - "CoreAnimation_all", - "CoreData_all", - "CoreWLAN_all", - "ExceptionHandling_all", - "Foundation_all", - "InputMethodKit_all", - "OSAKit_all", - "StoreKit_all", - "WebKit_all", - "unstable-example-basic_usage", + "unstable-frameworks-macos-10-12", ] unstable-frameworks-macos-11 = [ "Accessibility_all", diff --git a/crates/icrate/src/fixes/AppKit/mod.rs b/crates/icrate/src/fixes/AppKit/mod.rs index 2d4d23259..4aef940a2 100644 --- a/crates/icrate/src/fixes/AppKit/mod.rs +++ b/crates/icrate/src/fixes/AppKit/mod.rs @@ -27,42 +27,5 @@ ns_enum!( } ); -extern_class!( - #[cfg(feature = "AppKit_NSPopover")] - #[derive(Debug, PartialEq, Eq, Hash)] - pub struct NSPopover; - - #[cfg(feature = "AppKit_NSPopover")] - unsafe impl ClassType for NSPopover { - #[inherits(NSObject)] - type Super = crate::AppKit::NSResponder; - type Mutability = MainThreadOnly; - } -); - -__inner_extern_class!( - #[cfg(feature = "AppKit_NSLayoutAnchor")] - #[derive(Debug, PartialEq, Eq, Hash)] - pub struct NSLayoutAnchor { - __superclass: NSObject, - _inner0: PhantomData<*mut AnchorType>, - notunwindsafe: PhantomData<&'static mut ()>, - } - - #[cfg(feature = "AppKit_NSLayoutAnchor")] - unsafe impl ClassType for NSLayoutAnchor { - type Super = NSObject; - type Mutability = InteriorMutable; - - fn as_super(&self) -> &Self::Super { - &self.__superclass - } - - fn as_super_mut(&mut self) -> &mut Self::Super { - &mut self.__superclass - } - } -); - #[cfg(feature = "AppKit_NSImage")] unsafe impl crate::Foundation::NSCoding for crate::AppKit::NSImage {} diff --git a/crates/icrate/src/generated b/crates/icrate/src/generated index 8b603c27e..74a2c0031 160000 --- a/crates/icrate/src/generated +++ b/crates/icrate/src/generated @@ -1 +1 @@ -Subproject commit 8b603c27ed958b521463533d1ace21df855861a4 +Subproject commit 74a2c003143aa172b2c300bf4a1cef0cc11fa217 diff --git a/crates/icrate/tests/auto_traits.rs b/crates/icrate/tests/auto_traits.rs index 262c58aa6..807f1a492 100644 --- a/crates/icrate/tests/auto_traits.rs +++ b/crates/icrate/tests/auto_traits.rs @@ -154,7 +154,6 @@ fn send_sync_unwindsafe() { assert_auto_traits::(); assert_unwindsafe::(); // Intentional assert_auto_traits::(); - #[cfg(not(macos_10_7))] assert_auto_traits::(); // assert_auto_traits::(); // Intentional assert_unwindsafe::(); // Intentional From 375d21b0be52b1e2b7931a23f68692192fd63c76 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 01:47:55 +0100 Subject: [PATCH 05/15] Update nightly rustc --- .github/workflows/ci.yml | 2 +- .../expected/apple-armv7s.s | 9 +- .../expected/apple-armv7s.s | 337 +++++++++--------- .../expected/apple-armv7s.s | 124 +++---- .../test_dynamic_sel/expected/apple-armv7s.s | 84 ++--- .../expected/apple-armv7s.s | 18 +- .../expected/apple-armv7s.s | 130 +++---- .../expected/apple-x86.s | 12 +- .../expected/apple-x86_64.s | 12 +- .../expected/gnustep-x86.s | 12 +- .../expected/gnustep-x86_64.s | 12 +- .../expected/apple-armv7s.s | 28 +- .../test_msg_send_id/expected/apple-armv7s.s | 54 ++- .../expected/apple-armv7s.s | 59 ++- .../expected/apple-armv7s.s | 10 +- .../expected/apple-armv7s.s | 48 ++- .../expected/apple-armv7s.s | 4 +- .../test_static_class/expected/apple-armv7s.s | 24 +- .../test_static_sel/expected/apple-armv7s.s | 24 +- crates/test-ui/ui/array_iter_invalid.stderr | 6 +- .../ui/autoreleasepool_not_send_sync.stderr | 2 - .../ui/declare_class_invalid_receiver.stderr | 49 ++- .../ui/declare_class_invalid_syntax.stderr | 12 +- .../ui/declare_class_invalid_type.stderr | 20 ++ .../ui/declare_class_invalid_type2.stderr | 13 +- .../declare_class_mut_self_not_mutable.stderr | 2 +- .../ui/extern_class_wrong_mutability.stderr | 1 + .../ui/extern_methods_invalid_receiver.stderr | 5 + .../ui/extern_methods_invalid_type.stderr | 5 +- .../extern_methods_not_allowed_mutable.stderr | 7 +- .../ui/invalid_option_encode_impl.stderr | 4 +- .../ui/invalid_option_encode_impl_ref.stderr | 4 +- .../ui/mainthreadmarker_from_nsobject.stderr | 4 +- .../ui/mainthreadmarker_not_send_sync.stderr | 2 - .../ui/msg_send_id_invalid_receiver.stderr | 64 ++-- .../ui/msg_send_id_invalid_return.stderr | 18 +- .../ui/msg_send_id_no_return_type.stderr | 12 +- .../test-ui/ui/msg_send_invalid_error.stderr | 20 ++ .../test-ui/ui/msg_send_missing_comma.stderr | 1 + .../test-ui/ui/msg_send_no_return_type.stderr | 12 +- .../ui/msg_send_not_allowed_mutable.stderr | 6 +- crates/test-ui/ui/msg_send_not_encode.stderr | 10 +- .../mutability_traits_unimplementable2.stderr | 4 + crates/test-ui/ui/not_writeback.stderr | 25 +- .../ui/ns_string_output_not_const.stderr | 2 +- .../ui/nsarray_bound_not_send_sync.stderr | 8 - crates/test-ui/ui/object_not_send_sync.stderr | 6 - 47 files changed, 656 insertions(+), 671 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9de62a452..413d082fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ env: --package=objc2-encode --package=objc2-proc-macros # The current nightly Rust version that our CI uses - CURRENT_NIGHTLY: nightly-2023-08-27 + CURRENT_NIGHTLY: nightly-2023-11-22 # Various features that we'd usually want to test with # # Note: The `exception` feature is not enabled here, since it requires diff --git a/crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7s.s b/crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7s.s index 5eb906fb8..871359113 100644 --- a/crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_autorelease_return/expected/apple-armv7s.s @@ -4,10 +4,7 @@ .p2align 2 .code 32 _simple: - push {r7, lr} - mov r7, sp - bl _objc_autoreleaseReturnValue - pop {r7, pc} + b _objc_autoreleaseReturnValue .globl _with_body .p2align 2 @@ -16,7 +13,7 @@ _with_body: push {r7, lr} mov r7, sp bl _objc_msgSend - bl _objc_autoreleaseReturnValue - pop {r7, pc} + pop {r7, lr} + b _objc_autoreleaseReturnValue .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s index 4d6178477..8a5d1624d 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s @@ -13,48 +13,48 @@ SYM(::call_once::<::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) LPC1_6: ldr r0, [pc, r0] + ldr r1, [r0] + movw r11, :lower16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) movt r11, :upper16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) LPC1_7: add r11, pc, r11 - ldr r1, [r0] movw r10, :lower16:(l_anon.[ID].3-(LPC1_8+8)) movt r10, :upper16:(l_anon.[ID].3-(LPC1_8+8)) - movw r5, :lower16:(l_anon.[ID].1-(LPC1_9+8)) - movt r5, :upper16:(l_anon.[ID].1-(LPC1_9+8)) LPC1_8: add r10, pc, r10 + strd r10, r11, [sp] + movw r5, :lower16:(l_anon.[ID].1-(LPC1_9+8)) + movt r5, :upper16:(l_anon.[ID].1-(LPC1_9+8)) LPC1_9: add r5, pc, r5 mov r0, r4 mov r2, r5 - strd r10, r11, [sp] + mov r3, #0 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_10+8)) - mov r2, r5 movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_10+8)) - mov r3, #0 LPC1_10: ldr r0, [pc, r0] ldr r1, [r0] movw r9, :lower16:(_init-(LPC1_11+8)) movt r9, :upper16:(_init-(LPC1_11+8)) - mov r0, r4 LPC1_11: add r9, pc, r9 strd r8, r9, [sp] - bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r11, :lower16:(_class_method-(LPC1_12+8)) mov r0, r4 - movt r11, :upper16:(_class_method-(LPC1_12+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_d874ee9262978be2-(LPC1_13+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_d874ee9262978be2-(LPC1_13+8)) + mov r2, r5 + mov r3, #0 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_d874ee9262978be2-(LPC1_12+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_d874ee9262978be2-(LPC1_12+8)) LPC1_12: - add r11, pc, r11 -LPC1_13: ldr r1, [pc, r1] + movw r11, :lower16:(_class_method-(LPC1_13+8)) + movt r11, :upper16:(_class_method-(LPC1_13+8)) +LPC1_13: + add r11, pc, r11 + strd r10, r11, [sp] + mov r0, r4 mov r2, r5 mov r3, #0 - strd r10, r11, [sp] bl SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) - movw r11, :lower16:(_method-(LPC1_14+8)) - mov r0, r4 - movt r11, :upper16:(_method-(LPC1_14+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_4539fd1dbda0cddc-(LPC1_15+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_4539fd1dbda0cddc-(LPC1_15+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_4539fd1dbda0cddc-(LPC1_14+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_4539fd1dbda0cddc-(LPC1_14+8)) LPC1_14: - add r11, pc, r11 -LPC1_15: ldr r1, [pc, r1] + movw r11, :lower16:(_method-(LPC1_15+8)) + movt r11, :upper16:(_method-(LPC1_15+8)) +LPC1_15: + add r11, pc, r11 + strd r10, r11, [sp] + mov r0, r4 mov r2, r5 mov r3, #0 - strd r10, r11, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r3, :lower16:(_method_bool-(LPC1_16+8)) - mov r0, r4 - movt r3, :upper16:(_method_bool-(LPC1_16+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2b1b3a94e0ece2e5-(LPC1_17+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2b1b3a94e0ece2e5-(LPC1_17+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2b1b3a94e0ece2e5-(LPC1_16+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2b1b3a94e0ece2e5-(LPC1_16+8)) LPC1_16: - add r3, pc, r3 -LPC1_17: ldr r1, [pc, r1] + movw r3, :lower16:(_method_bool-(LPC1_17+8)) + movt r3, :upper16:(_method_bool-(LPC1_17+8)) +LPC1_17: + add r3, pc, r3 movw r10, :lower16:(l_anon.[ID].4-(LPC1_18+8)) movt r10, :upper16:(l_anon.[ID].4-(LPC1_18+8)) LPC1_18: add r10, pc, r10 str r10, [sp] - mov r2, r10 str r3, [sp, #4] + mov r0, r4 + mov r2, r10 mov r3, #1 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r9, :lower16:(_method_id-(LPC1_19+8)) - mov r0, r4 - movt r9, :upper16:(_method_id-(LPC1_19+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f7f521670860b0ce-(LPC1_20+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f7f521670860b0ce-(LPC1_20+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f7f521670860b0ce-(LPC1_19+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f7f521670860b0ce-(LPC1_19+8)) LPC1_19: - add r9, pc, r9 -LPC1_20: ldr r1, [pc, r1] + movw r9, :lower16:(_method_id-(LPC1_20+8)) + movt r9, :upper16:(_method_id-(LPC1_20+8)) +LPC1_20: + add r9, pc, r9 + strd r8, r9, [sp] + mov r0, r4 mov r2, r5 mov r3, #0 - strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r9, :lower16:(_method_id_with_param-(LPC1_21+8)) - mov r0, r4 - movt r9, :upper16:(_method_id_with_param-(LPC1_21+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_6addfcf634c6232f-(LPC1_22+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_6addfcf634c6232f-(LPC1_22+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_6addfcf634c6232f-(LPC1_21+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_6addfcf634c6232f-(LPC1_21+8)) LPC1_21: - add r9, pc, r9 -LPC1_22: ldr r1, [pc, r1] + movw r9, :lower16:(_method_id_with_param-(LPC1_22+8)) + movt r9, :upper16:(_method_id_with_param-(LPC1_22+8)) +LPC1_22: + add r9, pc, r9 + strd r8, r9, [sp] + mov r0, r4 mov r2, r10 mov r3, #1 - strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) movw r0, :lower16:(l_anon.[ID].17-(LPC1_23+8)) - mov r1, #9 movt r0, :upper16:(l_anon.[ID].17-(LPC1_23+8)) LPC1_23: add r0, pc, r0 + mov r1, #9 bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) cmp r0, #0 beq LBB1_4 @@ -180,20 +180,20 @@ LPC1_23: bl SYM(objc2::declare::ClassBuilder::add_protocol::GENERATED_ID, 0) LBB1_4: movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_4a8c690dbc9d8166-(LPC1_24+8)) - add r0, sp, #8 movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_4a8c690dbc9d8166-(LPC1_24+8)) - mov r3, #1 LPC1_24: ldr r1, [pc, r1] - movw r2, :lower16:(l_anon.[ID].7-(LPC1_25+8)) - movt r2, :upper16:(l_anon.[ID].7-(LPC1_25+8)) - movw r9, :lower16:(_copyWithZone-(LPC1_26+8)) - movt r9, :upper16:(_copyWithZone-(LPC1_26+8)) + movw r9, :lower16:(_copyWithZone-(LPC1_25+8)) + movt r9, :upper16:(_copyWithZone-(LPC1_25+8)) LPC1_25: - add r2, pc, r2 -LPC1_26: add r9, pc, r9 strd r8, r9, [sp] + movw r2, :lower16:(l_anon.[ID].7-(LPC1_26+8)) + movt r2, :upper16:(l_anon.[ID].7-(LPC1_26+8)) +LPC1_26: + add r2, pc, r2 + add r0, sp, #8 + mov r3, #1 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) ldr r0, [sp, #8] bl SYM(objc2::declare::ClassBuilder::register::GENERATED_ID, 0) @@ -202,26 +202,26 @@ LPC1_26: pop {r4, r5, r7, pc} LBB1_5: movw r0, :lower16:(l_anon.[ID].8-(LPC1_27+8)) - mov r1, #43 movt r0, :upper16:(l_anon.[ID].8-(LPC1_27+8)) - movw r2, :lower16:(l_anon.[ID].10-(LPC1_28+8)) - movt r2, :upper16:(l_anon.[ID].10-(LPC1_28+8)) LPC1_27: add r0, pc, r0 + movw r2, :lower16:(l_anon.[ID].10-(LPC1_28+8)) + movt r2, :upper16:(l_anon.[ID].10-(LPC1_28+8)) LPC1_28: add r2, pc, r2 + mov r1, #43 mov lr, pc b SYM(core::panicking::panic::GENERATED_ID, 0) LBB1_6: movw r0, :lower16:(l_anon.[ID].11-(LPC1_29+8)) - mov r1, #15 movt r0, :upper16:(l_anon.[ID].11-(LPC1_29+8)) - movw r2, :lower16:(l_anon.[ID].16-(LPC1_30+8)) - movt r2, :upper16:(l_anon.[ID].16-(LPC1_30+8)) LPC1_29: add r0, pc, r0 + movw r2, :lower16:(l_anon.[ID].16-(LPC1_30+8)) + movt r2, :upper16:(l_anon.[ID].16-(LPC1_30+8)) LPC1_30: add r2, pc, r2 + mov r1, #15 mov lr, pc b SYM(objc2::__macro_helpers::declare_class::failed_declaring_class::GENERATED_ID, 0) @@ -255,44 +255,44 @@ LPC3_0: bne LBB3_3 LBB3_1: movw r0, :lower16:(l_anon.[ID].11-(LPC3_4+8)) - mov r1, #15 movt r0, :upper16:(l_anon.[ID].11-(LPC3_4+8)) LPC3_4: add r0, pc, r0 + mov r1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cmp r0, #0 movne sp, r7 popne {r7, pc} LBB3_2: movw r0, :lower16:(l_anon.[ID].8-(LPC3_5+8)) - mov r1, #43 movt r0, :upper16:(l_anon.[ID].8-(LPC3_5+8)) - movw r2, :lower16:(l_anon.[ID].16-(LPC3_6+8)) - movt r2, :upper16:(l_anon.[ID].16-(LPC3_6+8)) LPC3_5: add r0, pc, r0 + movw r2, :lower16:(l_anon.[ID].16-(LPC3_6+8)) + movt r2, :upper16:(l_anon.[ID].16-(LPC3_6+8)) LPC3_6: add r2, pc, r2 + mov r1, #43 mov lr, pc b SYM(core::panicking::panic::GENERATED_ID, 0) LBB3_3: - movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC3_1+8)) - mov r2, #1 - movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC3_1+8)) - movw r3, :lower16:(l_anon.[ID].0-(LPC3_2+8)) - movt r3, :upper16:(l_anon.[ID].0-(LPC3_2+8)) - movw r1, :lower16:(l_anon.[ID].16-(LPC3_3+8)) - movt r1, :upper16:(l_anon.[ID].16-(LPC3_3+8)) - strb r2, [r7, #-5] -LPC3_3: - add r1, pc, r1 - sub r2, r7, #5 - str r2, [r7, #-4] + mov r0, #1 + strb r0, [r7, #-5] + sub r0, r7, #5 + str r0, [r7, #-4] + movw r1, :lower16:(l_anon.[ID].16-(LPC3_1+8)) + movt r1, :upper16:(l_anon.[ID].16-(LPC3_1+8)) LPC3_1: - add r0, pc, r0 - str r1, [sp] + add r1, pc, r1 + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC3_2+8)) + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC3_2+8)) LPC3_2: + add r0, pc, r0 + movw r3, :lower16:(l_anon.[ID].0-(LPC3_3+8)) + movt r3, :upper16:(l_anon.[ID].0-(LPC3_3+8)) +LPC3_3: add r3, pc, r3 + str r1, [sp] sub r2, r7, #4 mov r1, #0 bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) @@ -311,8 +311,8 @@ LPC4_0: ldr r4, [r0] bl _get_class mov r1, r4 - bl _objc_msgSend - pop {r4, r7, pc} + pop {r4, r7, lr} + b _objc_msgSend .globl _access_ivars .p2align 2 @@ -324,27 +324,27 @@ _access_ivars: mov r4, r0 bl _object_getClass movw r1, :lower16:(L_anon.[ID].12-(LPC5_0+8)) - mov r2, #4 movt r1, :upper16:(L_anon.[ID].12-(LPC5_0+8)) - movw r3, :lower16:(l_anon.[ID].13-(LPC5_1+8)) - movt r3, :upper16:(l_anon.[ID].13-(LPC5_1+8)) LPC5_0: add r1, pc, r1 + movw r3, :lower16:(l_anon.[ID].13-(LPC5_1+8)) + movt r3, :upper16:(l_anon.[ID].13-(LPC5_1+8)) LPC5_1: add r3, pc, r3 + mov r2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) ldrb r5, [r4, r0] mov r0, r4 bl _object_getClass movw r1, :lower16:(L_anon.[ID].14-(LPC5_2+8)) - mov r2, #4 movt r1, :upper16:(L_anon.[ID].14-(LPC5_2+8)) - movw r3, :lower16:(l_anon.[ID].2-(LPC5_3+8)) - movt r3, :upper16:(l_anon.[ID].2-(LPC5_3+8)) LPC5_2: add r1, pc, r1 + movw r3, :lower16:(l_anon.[ID].2-(LPC5_3+8)) + movt r3, :upper16:(l_anon.[ID].2-(LPC5_3+8)) LPC5_3: add r3, pc, r3 + mov r2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) ldr r6, [r4, r0] mov r0, r4 @@ -370,44 +370,44 @@ LPC6_0: bne LBB6_3 LBB6_1: movw r0, :lower16:(l_anon.[ID].11-(LPC6_4+8)) - mov r1, #15 movt r0, :upper16:(l_anon.[ID].11-(LPC6_4+8)) LPC6_4: add r0, pc, r0 + mov r1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cmp r0, #0 movne sp, r7 popne {r7, pc} LBB6_2: movw r0, :lower16:(l_anon.[ID].8-(LPC6_5+8)) - mov r1, #43 movt r0, :upper16:(l_anon.[ID].8-(LPC6_5+8)) - movw r2, :lower16:(l_anon.[ID].16-(LPC6_6+8)) - movt r2, :upper16:(l_anon.[ID].16-(LPC6_6+8)) LPC6_5: add r0, pc, r0 + movw r2, :lower16:(l_anon.[ID].16-(LPC6_6+8)) + movt r2, :upper16:(l_anon.[ID].16-(LPC6_6+8)) LPC6_6: add r2, pc, r2 + mov r1, #43 mov lr, pc b SYM(core::panicking::panic::GENERATED_ID, 0) LBB6_3: - movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC6_1+8)) - mov r2, #1 - movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC6_1+8)) - movw r3, :lower16:(l_anon.[ID].0-(LPC6_2+8)) - movt r3, :upper16:(l_anon.[ID].0-(LPC6_2+8)) - movw r1, :lower16:(l_anon.[ID].16-(LPC6_3+8)) - movt r1, :upper16:(l_anon.[ID].16-(LPC6_3+8)) - strb r2, [r7, #-5] -LPC6_3: - add r1, pc, r1 - sub r2, r7, #5 - str r2, [r7, #-4] + mov r0, #1 + strb r0, [r7, #-5] + sub r0, r7, #5 + str r0, [r7, #-4] + movw r1, :lower16:(l_anon.[ID].16-(LPC6_1+8)) + movt r1, :upper16:(l_anon.[ID].16-(LPC6_1+8)) LPC6_1: - add r0, pc, r0 - str r1, [sp] + add r1, pc, r1 + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC6_2+8)) + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC6_2+8)) LPC6_2: + add r0, pc, r0 + movw r3, :lower16:(l_anon.[ID].0-(LPC6_3+8)) + movt r3, :upper16:(l_anon.[ID].0-(LPC6_3+8)) +LPC6_3: add r3, pc, r3 + str r1, [sp] sub r2, r7, #4 mov r1, #0 bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) @@ -423,14 +423,14 @@ SYM(, 0) @@ -102,8 +102,8 @@ _error_init: add r7, sp, #4 sub sp, sp, #4 mov r4, #0 - mov r2, sp str r4, [sp] + mov r2, sp bl _objc_msgSend mov r1, r0 cmp r0, #0 @@ -112,9 +112,9 @@ _error_init: sub sp, r7, #4 pop {r4, r7, pc} LBB4_2: + ldr r0, [sp] movw r1, :lower16:(l_anon.[ID].5-(LPC4_0+8)) movt r1, :upper16:(l_anon.[ID].5-(LPC4_0+8)) - ldr r0, [sp] LPC4_0: add r1, pc, r1 bl SYM(objc2[CRATE_ID]::__macro_helpers::msg_send_id::encountered_error::, 0) @@ -132,8 +132,8 @@ _error_copy: add r7, sp, #4 sub sp, sp, #4 mov r4, #0 - mov r2, sp str r4, [sp] + mov r2, sp bl _objc_msgSend mov r1, r0 cmp r0, #0 @@ -142,9 +142,9 @@ _error_copy: sub sp, r7, #4 pop {r4, r7, pc} LBB5_2: + ldr r0, [sp] movw r1, :lower16:(l_anon.[ID].6-(LPC5_0+8)) movt r1, :upper16:(l_anon.[ID].6-(LPC5_0+8)) - ldr r0, [sp] LPC5_0: add r1, pc, r1 bl SYM(objc2[CRATE_ID]::__macro_helpers::msg_send_id::encountered_error::, 0) @@ -162,8 +162,8 @@ _error_autoreleased: add r7, sp, #4 sub sp, sp, #4 mov r4, #0 - mov r2, sp str r4, [sp] + mov r2, sp bl _objc_msgSend @ InlineAsm Start mov r7, r7 @@ -176,9 +176,9 @@ _error_autoreleased: sub sp, r7, #4 pop {r4, r7, pc} LBB6_2: + ldr r0, [sp] movw r1, :lower16:(l_anon.[ID].7-(LPC6_0+8)) movt r1, :upper16:(l_anon.[ID].7-(LPC6_0+8)) - ldr r0, [sp] LPC6_0: add r1, pc, r1 bl SYM(objc2[CRATE_ID]::__macro_helpers::msg_send_id::encountered_error::, 0) diff --git a/crates/test-assembly/crates/test_msg_send_id/expected/apple-armv7s.s b/crates/test-assembly/crates/test_msg_send_id/expected/apple-armv7s.s index f42596025..2ce7d7c91 100644 --- a/crates/test-assembly/crates/test_msg_send_id/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_msg_send_id/expected/apple-armv7s.s @@ -4,10 +4,7 @@ .p2align 2 .code 32 _handle_new: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .globl _handle_new_fallible .p2align 2 @@ -22,11 +19,11 @@ _handle_new_fallible: popne {r4, r5, r7, pc} LBB1_1: movw r2, :lower16:(l_anon.[ID].1-(LPC1_0+8)) - mov r0, r5 movt r2, :upper16:(l_anon.[ID].1-(LPC1_0+8)) - mov r1, r4 LPC1_0: add r2, pc, r2 + mov r0, r5 + mov r1, r4 mov lr, pc b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) @@ -34,19 +31,13 @@ LPC1_0: .p2align 2 .code 32 _handle_alloc: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .globl _handle_init .p2align 2 .code 32 _handle_init: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .globl _handle_init_fallible .p2align 2 @@ -61,11 +52,11 @@ _handle_init_fallible: popne {r4, r5, r7, pc} LBB4_1: movw r2, :lower16:(l_anon.[ID].2-(LPC4_0+8)) - mov r0, r5 movt r2, :upper16:(l_anon.[ID].2-(LPC4_0+8)) - mov r1, r4 LPC4_0: add r2, pc, r2 + mov r0, r5 + mov r1, r4 mov lr, pc b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) @@ -78,8 +69,8 @@ _handle_alloc_init: mov r4, r2 bl _objc_msgSend mov r1, r4 - bl _objc_msgSend - pop {r4, r7, pc} + pop {r4, r7, lr} + b _objc_msgSend .globl _handle_alloc_release .p2align 2 @@ -88,8 +79,8 @@ _handle_alloc_release: push {r7, lr} mov r7, sp bl _objc_msgSend - bl _objc_release - pop {r7, pc} + pop {r7, lr} + b _objc_release .globl _handle_alloc_init_release .p2align 2 @@ -101,17 +92,14 @@ _handle_alloc_init_release: bl _objc_msgSend mov r1, r4 bl _objc_msgSend - bl _objc_release - pop {r4, r7, pc} + pop {r4, r7, lr} + b _objc_release .globl _handle_copy .p2align 2 .code 32 _handle_copy: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .globl _handle_copy_fallible .p2align 2 @@ -140,8 +128,8 @@ _handle_autoreleased: @ InlineAsm Start mov r7, r7 @ InlineAsm End - bl _objc_retainAutoreleasedReturnValue - pop {r7, pc} + pop {r7, lr} + b _objc_retainAutoreleasedReturnValue .globl _handle_autoreleased_fallible .p2align 2 @@ -160,11 +148,11 @@ _handle_autoreleased_fallible: popne {r4, r5, r7, pc} LBB11_1: movw r2, :lower16:(l_anon.[ID].4-(LPC11_0+8)) - mov r0, r5 movt r2, :upper16:(l_anon.[ID].4-(LPC11_0+8)) - mov r1, r4 LPC11_0: add r2, pc, r2 + mov r0, r5 + mov r1, r4 mov lr, pc b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) @@ -182,12 +170,12 @@ _handle_with_out_param: bl _objc_retain mov r0, r5 bl _objc_release - mov r0, r6 @ InlineAsm Start mov r7, r7 @ InlineAsm End - bl _objc_retainAutoreleasedReturnValue - pop {r4, r5, r6, r7, pc} + mov r0, r6 + pop {r4, r5, r6, r7, lr} + b _objc_retainAutoreleasedReturnValue .section __TEXT,__const l_anon.[ID].0: diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s index 2ee3f69cc..72dea25f3 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s @@ -4,14 +4,11 @@ .p2align 2 .code 32 _handle_with_sel: - push {r7, lr} - mov r7, sp movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_ad1b815073641351-(LPC0_0+8)) movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_ad1b815073641351-(LPC0_0+8)) LPC0_0: ldr r1, [pc, r1] - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .globl _handle_alloc_init .p2align 2 @@ -21,27 +18,27 @@ _handle_alloc_init: add r7, sp, #8 movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) - movw r2, :lower16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_1+8)) - movt r2, :upper16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_1+8)) LPC1_0: ldr r1, [pc, r1] + movw r2, :lower16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_1+8)) + movt r2, :upper16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_1+8)) LPC1_1: ldr r2, [pc, r2] ldr r4, [r1] ldr r1, [r2] bl _objc_msgSend - mov r1, r4 mov r5, r0 + mov r1, r4 bl _objc_msgSend cmp r0, #0 popne {r4, r5, r7, pc} LBB1_1: movw r2, :lower16:(l_anon.[ID].1-(LPC1_2+8)) - mov r0, r5 movt r2, :upper16:(l_anon.[ID].1-(LPC1_2+8)) - mov r1, r4 LPC1_2: add r2, pc, r2 + mov r0, r5 + mov r1, r4 mov lr, pc b SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) @@ -51,37 +48,37 @@ LPC1_2: _use_generic: push {r4, r7, lr} add r7, sp, #4 - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_0+8)) mov r4, r0 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_0+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138-(LPC2_0+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138-(LPC2_0+8)) LPC2_0: - ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138-(LPC2_1+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138-(LPC2_1+8)) -LPC2_1: ldr r1, [pc, r1] + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_1+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_1+8)) +LPC2_1: + ldr r2, [pc, r2] bl _objc_msgSend - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_2+8)) - mov r0, r4 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_2+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da-(LPC2_2+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da-(LPC2_2+8)) LPC2_2: - ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da-(LPC2_3+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da-(LPC2_3+8)) -LPC2_3: ldr r1, [pc, r1] - bl _objc_msgSend - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_4+8)) + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_3+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_3+8)) +LPC2_3: + ldr r2, [pc, r2] mov r0, r4 - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_4+8)) + bl _objc_msgSend + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a-(LPC2_4+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a-(LPC2_4+8)) LPC2_4: - ldr r2, [pc, r2] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a-(LPC2_5+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a-(LPC2_5+8)) -LPC2_5: ldr r1, [pc, r1] - bl _objc_msgSend - pop {r4, r7, pc} + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_5+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05-(LPC2_5+8)) +LPC2_5: + ldr r2, [pc, r2] + mov r0, r4 + pop {r4, r7, lr} + b _objc_msgSend .section __TEXT,__const l_anon.[ID].0: diff --git a/crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-armv7s.s b/crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-armv7s.s index d540d3873..cbaf97ee9 100644 --- a/crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_msg_send_zero_cost/expected/apple-armv7s.s @@ -4,23 +4,17 @@ .p2align 2 .code 32 _handle: - push {r7, lr} - mov r7, sp - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .globl _handle_with_sel .p2align 2 .code 32 _handle_with_sel: - push {r7, lr} - mov r7, sp movw r1, :lower16:(_SEL_REF-(LPC1_0+8)) movt r1, :upper16:(_SEL_REF-(LPC1_0+8)) LPC1_0: ldr r1, [pc, r1] - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .section __TEXT,__const .globl _SEL diff --git a/crates/test-assembly/crates/test_out_parameters/expected/apple-armv7s.s b/crates/test-assembly/crates/test_out_parameters/expected/apple-armv7s.s index 684e06419..57a10aed0 100644 --- a/crates/test-assembly/crates/test_out_parameters/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_out_parameters/expected/apple-armv7s.s @@ -21,24 +21,23 @@ _nonnull_nonnull: .p2align 2 .code 32 _null_nonnull: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 cmp r2, #0 beq LBB1_2 - mov r5, r2 - ldr r6, [r2] + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + mov r4, r2 + ldr r5, [r2] bl _objc_msgSend - mov r4, r0 - ldr r0, [r5] + mov r6, r0 + ldr r0, [r4] bl _objc_retain - mov r0, r6 + mov r0, r5 bl _objc_release - mov r0, r4 + mov r0, r6 pop {r4, r5, r6, r7, pc} LBB1_2: mov r2, #0 - bl _objc_msgSend - pop {r4, r5, r6, r7, pc} + b _objc_msgSend .globl _nonnull_null .p2align 2 @@ -64,27 +63,26 @@ LBB2_2: .p2align 2 .code 32 _null_null: - push {r4, r5, r6, r7, lr} - add r7, sp, #12 cmp r2, #0 beq LBB3_4 + push {r4, r5, r6, r7, lr} + add r7, sp, #12 mov r6, r2 - ldr r5, [r2] + ldr r4, [r2] bl _objc_msgSend - mov r4, r0 + mov r5, r0 ldr r0, [r6] bl _objc_retain - cmp r5, #0 + cmp r4, #0 beq LBB3_3 - mov r0, r5 + mov r0, r4 bl _objc_release LBB3_3: - mov r0, r4 + mov r0, r5 pop {r4, r5, r6, r7, pc} LBB3_4: mov r2, #0 - bl _objc_msgSend - pop {r4, r5, r6, r7, pc} + b _objc_msgSend .globl _two_nonnull_nonnull .p2align 2 @@ -95,8 +93,8 @@ _two_nonnull_nonnull: push {r8, r10} mov r4, r3 mov r5, r2 - ldr r8, [r3] ldr r6, [r2] + ldr r8, [r3] bl _objc_msgSend mov r10, r0 ldr r0, [r5] @@ -115,21 +113,15 @@ _two_nonnull_nonnull: .p2align 2 .code 32 _call_with_none1: - push {r7, lr} - mov r7, sp mov r2, #0 - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .globl _call_with_none2 .p2align 2 .code 32 _call_with_none2: - push {r7, lr} - mov r7, sp mov r2, #0 - bl _objc_msgSend - pop {r7, pc} + b _objc_msgSend .globl _call_with_none3 .p2align 2 diff --git a/crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7s.s b/crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7s.s index a3821d850..c02cca05f 100644 --- a/crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_retain_autoreleased/expected/apple-armv7s.s @@ -10,7 +10,7 @@ _handle: @ InlineAsm Start mov r7, r7 @ InlineAsm End - bl _objc_retainAutoreleasedReturnValue - pop {r7, pc} + pop {r7, lr} + b _objc_retainAutoreleasedReturnValue .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_class/expected/apple-armv7s.s b/crates/test-assembly/crates/test_static_class/expected/apple-armv7s.s index 1e762516a..05bbb114c 100644 --- a/crates/test-assembly/crates/test_static_class/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_static_class/expected/apple-armv7s.s @@ -40,25 +40,23 @@ _unused_class: .p2align 2 .code 32 _use_fns: - movw r9, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_0+8)) - movt r9, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_0+8)) + movw r1, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC4_0+8)) + movt r1, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC4_0+8)) LPC4_0: - ldr r9, [pc, r9] - movw r2, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC4_1+8)) - movt r2, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC4_1+8)) + ldr r1, [pc, r1] + movw r2, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-(LPC4_1+8)) + movt r2, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-(LPC4_1+8)) LPC4_1: ldr r2, [pc, r2] - movw r3, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-(LPC4_2+8)) - movt r3, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-(LPC4_2+8)) + movw r3, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC4_2+8)) + movt r3, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC4_2+8)) LPC4_2: ldr r3, [pc, r3] - movw r1, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC4_3+8)) - movt r1, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-(LPC4_3+8)) - str r2, [r0, #8] + movw r9, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_3+8)) + movt r9, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_3+8)) LPC4_3: - ldr r1, [pc, r1] - str r9, [r0, #12] - stm r0, {r1, r3} + ldr r9, [pc, r9] + stm r0, {r1, r2, r3, r9} bx lr .globl _use_same_twice diff --git a/crates/test-assembly/crates/test_static_sel/expected/apple-armv7s.s b/crates/test-assembly/crates/test_static_sel/expected/apple-armv7s.s index 80130f28f..3dda6a3b6 100644 --- a/crates/test-assembly/crates/test_static_sel/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_static_sel/expected/apple-armv7s.s @@ -52,25 +52,23 @@ _unused_sel: .p2align 2 .code 32 _use_fns: - movw r9, :lower16:(L_OBJC_SELECTOR_REFERENCES_acb291d82e56f534-(LPC5_0+8)) - movt r9, :upper16:(L_OBJC_SELECTOR_REFERENCES_acb291d82e56f534-(LPC5_0+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC5_0+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC5_0+8)) LPC5_0: - ldr r9, [pc, r9] - movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_25911857653c680c-(LPC5_1+8)) - movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_25911857653c680c-(LPC5_1+8)) + ldr r1, [pc, r1] + movw r2, :lower16:(L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83-(LPC5_1+8)) + movt r2, :upper16:(L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83-(LPC5_1+8)) LPC5_1: ldr r2, [pc, r2] - movw r3, :lower16:(L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83-(LPC5_2+8)) - movt r3, :upper16:(L_OBJC_SELECTOR_REFERENCES_6e17eb9d3fa7fa83-(LPC5_2+8)) + movw r3, :lower16:(L_OBJC_SELECTOR_REFERENCES_25911857653c680c-(LPC5_2+8)) + movt r3, :upper16:(L_OBJC_SELECTOR_REFERENCES_25911857653c680c-(LPC5_2+8)) LPC5_2: ldr r3, [pc, r3] - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC5_3+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_2ff5c2d33acc98c0-(LPC5_3+8)) - str r2, [r0, #8] + movw r9, :lower16:(L_OBJC_SELECTOR_REFERENCES_acb291d82e56f534-(LPC5_3+8)) + movt r9, :upper16:(L_OBJC_SELECTOR_REFERENCES_acb291d82e56f534-(LPC5_3+8)) LPC5_3: - ldr r1, [pc, r1] - str r9, [r0, #12] - stm r0, {r1, r3} + ldr r9, [pc, r9] + stm r0, {r1, r2, r3, r9} bx lr .globl _use_same_twice diff --git a/crates/test-ui/ui/array_iter_invalid.stderr b/crates/test-ui/ui/array_iter_invalid.stderr index b699a6203..bd744755b 100644 --- a/crates/test-ui/ui/array_iter_invalid.stderr +++ b/crates/test-ui/ui/array_iter_invalid.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `&mut Id>: IntoIterator` is not | for s in &mut arr { | ^^^^^^^^ the trait `IntoIterator` is not implemented for `&mut Id>` | - = note: `IntoIterator` is implemented for `&objc2::rc::Id>`, but not for `&mut objc2::rc::Id>` + = note: `IntoIterator` is implemented for `&Id>`, but not for `&mut Id>` help: consider removing the leading `&`-reference | 6 - for s in &mut arr { @@ -21,7 +21,7 @@ error[E0277]: the trait bound `&mut Id>: IntoIterator` Id &'a Id &'a mut Id - = note: `IntoIterator` is implemented for `&objc2::rc::Id>`, but not for `&mut objc2::rc::Id>` + = note: `IntoIterator` is implemented for `&Id>`, but not for `&mut Id>` error[E0277]: the trait bound `&mut Id>: IntoIterator` is not satisfied --> ui/array_iter_invalid.rs @@ -29,7 +29,7 @@ error[E0277]: the trait bound `&mut Id>: IntoIterator` | for s in &mut arr { | ^^^^^^^^ the trait `IntoIterator` is not implemented for `&mut Id>` | - = note: `IntoIterator` is implemented for `&objc2::rc::Id>`, but not for `&mut objc2::rc::Id>` + = note: `IntoIterator` is implemented for `&Id>`, but not for `&mut Id>` help: consider removing the leading `&`-reference | 16 - for s in &mut arr { diff --git a/crates/test-ui/ui/autoreleasepool_not_send_sync.stderr b/crates/test-ui/ui/autoreleasepool_not_send_sync.stderr index d88113230..8a825f71f 100644 --- a/crates/test-ui/ui/autoreleasepool_not_send_sync.stderr +++ b/crates/test-ui/ui/autoreleasepool_not_send_sync.stderr @@ -5,7 +5,6 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely | ^^^^^^^^^^^^^^^^^^^ `*mut c_void` cannot be shared between threads safely | = help: within `AutoreleasePool<'_>`, the trait `Sync` is not implemented for `*mut c_void` - = note: consider using `std::sync::Arc<*mut c_void>`; for more information visit note: required because it appears within the type `Pool` --> $WORKSPACE/crates/objc2/src/rc/autorelease.rs | @@ -35,7 +34,6 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely | ^^^^^^^^^^^^^^^^^^^ `*mut c_void` cannot be shared between threads safely | = help: within `objc2::rc::autorelease::Pool`, the trait `Sync` is not implemented for `*mut c_void` - = note: consider using `std::sync::Arc<*mut c_void>`; for more information visit note: required because it appears within the type `Pool` --> $WORKSPACE/crates/objc2/src/rc/autorelease.rs | diff --git a/crates/test-ui/ui/declare_class_invalid_receiver.stderr b/crates/test-ui/ui/declare_class_invalid_receiver.stderr index c9a190597..c9c72dc66 100644 --- a/crates/test-ui/ui/declare_class_invalid_receiver.stderr +++ b/crates/test-ui/ui/declare_class_invalid_receiver.stderr @@ -255,8 +255,14 @@ note: required by a bound in `ClassBuilderHelper::::add_method` error[E0277]: the trait bound `Box: MessageReceiver` is not satisfied --> ui/declare_class_invalid_receiver.rs | - | fn test_box_id(self: Box) -> Id { - | ^^^^^^^^^ the trait `MessageReceiver` is not implemented for `Box` + | / declare_class!( + | | struct CustomObject; + | | + | | unsafe impl ClassType for CustomObject { +... | + | | } + | | ); + | |_^ the trait `MessageReceiver` is not implemented for `Box` | = help: the following other types implement trait `MessageReceiver`: NonNull @@ -267,12 +273,19 @@ error[E0277]: the trait bound `Box: MessageReceiver` is not satisf &'a mut T &'a AnyClass = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied --> ui/declare_class_invalid_receiver.rs | - | fn test_id_self_id(this: Id) -> Id { - | ^^^^^^^^ the trait `MessageReceiver` is not implemented for `Id` + | / declare_class!( + | | struct CustomObject; + | | + | | unsafe impl ClassType for CustomObject { +... | + | | } + | | ); + | |_^ the trait `MessageReceiver` is not implemented for `Id` | = help: the following other types implement trait `MessageReceiver`: NonNull @@ -283,12 +296,19 @@ error[E0277]: the trait bound `Id: MessageReceiver` is not satisfi &'a mut T &'a AnyClass = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `CustomObject: MessageReceiver` is not satisfied --> ui/declare_class_invalid_receiver.rs | - | fn test_self_id(this: Self) -> Id { - | ^^^^ the trait `MessageReceiver` is not implemented for `CustomObject` + | / declare_class!( + | | struct CustomObject; + | | + | | unsafe impl ClassType for CustomObject { +... | + | | } + | | ); + | |_^ the trait `MessageReceiver` is not implemented for `CustomObject` | = help: the following other types implement trait `MessageReceiver`: NonNull @@ -299,12 +319,19 @@ error[E0277]: the trait bound `CustomObject: MessageReceiver` is not satisfied &'a mut T &'a AnyClass = note: required for `RetainSemantics<5>` to implement `MessageRecieveId>` + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Allocated: MessageReceiver` is not satisfied --> ui/declare_class_invalid_receiver.rs | - | fn test_alloc(this: Allocated) -> Id { - | ^^^^^^^^^^^^^^^ the trait `MessageReceiver` is not implemented for `Allocated` + | / declare_class!( + | | struct CustomObject; + | | + | | unsafe impl ClassType for CustomObject { +... | + | | } + | | ); + | |_^ the trait `MessageReceiver` is not implemented for `Allocated` | = help: the following other types implement trait `MessageReceiver`: NonNull @@ -315,6 +342,7 @@ error[E0277]: the trait bound `Allocated: MessageReceiver` is not &'a mut T &'a AnyClass = note: required for `RetainSemantics<5>` to implement `MessageRecieveId, Id>` + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `RetainSemantics<3>: MessageRecieveId<&CustomObject, Id>` is not satisfied --> ui/declare_class_invalid_receiver.rs @@ -328,5 +356,6 @@ error[E0277]: the trait bound `RetainSemantics<3>: MessageRecieveId<&CustomObjec | | ); | |_^ the trait `MessageRecieveId<&CustomObject, Id>` is not implemented for `RetainSemantics<3>` | - = help: the trait `MessageRecieveId, Ret>` is implemented for `RetainSemantics<3>` - = note: this error originates in the macro `$crate::__rewrite_self_param_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) + = help: the trait `MessageRecieveId, Id>` is implemented for `RetainSemantics<3>` + = help: for that trait implementation, expected `Allocated`, found `&CustomObject` + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/declare_class_invalid_syntax.stderr b/crates/test-ui/ui/declare_class_invalid_syntax.stderr index fdc940454..faa2b6cee 100644 --- a/crates/test-ui/ui/declare_class_invalid_syntax.stderr +++ b/crates/test-ui/ui/declare_class_invalid_syntax.stderr @@ -102,11 +102,17 @@ error: expected identifier, found keyword `fn` | fn fn test_fn_fn() {} | ^^ expected identifier, found keyword -error: expected one of `(` or `<`, found `test_fn_fn` +error: missing parameters for function definition --> ui/declare_class_invalid_syntax.rs | | fn fn test_fn_fn() {} - | ^^^^^^^^^^ expected one of `(` or `<` + | ^ help: add a parameter list + +error: expected one of `->`, `<`, `where`, or `{`, found `test_fn_fn` + --> ui/declare_class_invalid_syntax.rs + | + | fn fn test_fn_fn() {} + | ^^^^^^^^^^ expected one of `->`, `<`, `where`, or `{` | ::: $WORKSPACE/crates/objc2/src/macros/declare_class.rs | @@ -564,4 +570,4 @@ error[E0277]: the trait bound `RetainSemantics<2>: MessageRecieveId<&AnyClass, I as MessageRecieveId, Ret>> as MessageRecieveId> as MessageRecieveId> - = note: this error originates in the macro `$crate::__rewrite_self_param_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/declare_class_invalid_type.stderr b/crates/test-ui/ui/declare_class_invalid_type.stderr index abf822261..ecc4aa0c4 100644 --- a/crates/test-ui/ui/declare_class_invalid_type.stderr +++ b/crates/test-ui/ui/declare_class_invalid_type.stderr @@ -28,6 +28,9 @@ note: required by a bound in `ConvertReturn` | pub trait ConvertReturn: return_private::Sealed { | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ConvertReturn` = note: `ConvertReturn` is a "sealed trait", because to implement it you also need to implement `objc2::__macro_helpers::convert::return_private::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it + = help: the following types implement the trait: + bool + T = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Vec<()>: Encode` is not satisfied @@ -60,6 +63,9 @@ note: required by a bound in `ConvertReturn` | pub trait ConvertReturn: return_private::Sealed { | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ConvertReturn` = note: `ConvertReturn` is a "sealed trait", because to implement it you also need to implement `objc2::__macro_helpers::convert::return_private::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it + = help: the following types implement the trait: + bool + T = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Box: Encode` is not satisfied @@ -92,6 +98,13 @@ note: required by a bound in `ConvertArgument` | pub trait ConvertArgument: argument_private::Sealed { | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ConvertArgument` = note: `ConvertArgument` is a "sealed trait", because to implement it you also need to implement `objc2::__macro_helpers::convert::argument_private::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it + = help: the following types implement the trait: + std::option::Option<&mut objc2::rc::Id> + std::option::Option<&mut std::option::Option>> + &mut std::option::Option> + &mut objc2::rc::Id + bool + T = note: this error originates in the macro `$crate::__declare_class_rewrite_params` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `CustomObject: Encode` is not satisfied @@ -124,4 +137,11 @@ note: required by a bound in `ConvertArgument` | pub trait ConvertArgument: argument_private::Sealed { | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ConvertArgument` = note: `ConvertArgument` is a "sealed trait", because to implement it you also need to implement `objc2::__macro_helpers::convert::argument_private::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it + = help: the following types implement the trait: + std::option::Option<&mut objc2::rc::Id> + std::option::Option<&mut std::option::Option>> + &mut std::option::Option> + &mut objc2::rc::Id + bool + T = note: this error originates in the macro `$crate::__declare_class_rewrite_params` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/declare_class_invalid_type2.stderr b/crates/test-ui/ui/declare_class_invalid_type2.stderr index 8aaaff567..c40471d24 100644 --- a/crates/test-ui/ui/declare_class_invalid_type2.stderr +++ b/crates/test-ui/ui/declare_class_invalid_type2.stderr @@ -1,12 +1,19 @@ error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Option>` --> ui/declare_class_invalid_type2.rs | - | fn test_init_not_same_generics(this: Allocated) -> Id { - | ^^^^^^^^^^^^^^^ expected `Option>`, found `Option>` + | / declare_class!( + | | struct CustomObject; + | | + | | unsafe impl ClassType for CustomObject { +... | + | | } + | | ); + | |_^ expected `Option>`, found `Option>` | = note: expected enum `Option>` found enum `Option>` = note: required for `RetainSemantics<3>` to implement `MessageRecieveId, Id>` + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `i32: MaybeOptionId` is not satisfied --> ui/declare_class_invalid_type2.rs @@ -24,4 +31,4 @@ error[E0277]: the trait bound `i32: MaybeOptionId` is not satisfied Id Option> = note: required for `RetainSemantics<5>` to implement `MessageRecieveId<&CustomObject, i32>` - = note: this error originates in the macro `$crate::__rewrite_self_param_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/declare_class_mut_self_not_mutable.stderr b/crates/test-ui/ui/declare_class_mut_self_not_mutable.stderr index 34f33f2ee..587823561 100644 --- a/crates/test-ui/ui/declare_class_mut_self_not_mutable.stderr +++ b/crates/test-ui/ui/declare_class_mut_self_not_mutable.stderr @@ -114,4 +114,4 @@ error[E0277]: the trait bound `InteriorMutable: mutability::MutabilityIsAllowedM = note: required for `CustomObject` to implement `IsAllowedMutable` = note: required for `&mut CustomObject` to implement `MessageReceiver` = note: required for `RetainSemantics<5>` to implement `MessageRecieveId<&mut CustomObject, Id>` - = note: this error originates in the macro `$crate::__rewrite_self_param_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__declare_class_method_out_inner` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/extern_class_wrong_mutability.stderr b/crates/test-ui/ui/extern_class_wrong_mutability.stderr index a0c7e5494..6ba85bd22 100644 --- a/crates/test-ui/ui/extern_class_wrong_mutability.stderr +++ b/crates/test-ui/ui/extern_class_wrong_mutability.stderr @@ -11,6 +11,7 @@ error[E0277]: the trait bound `MainThreadOnly: ValidSubclassMutability` is not implemented for `MainThreadOnly` | = help: the trait `ValidSubclassMutability` is implemented for `MainThreadOnly` + = help: for that trait implementation, expected `MainThreadOnly`, found `InteriorMutable` note: required by a bound in `assert_mutability_matches_superclass_mutability` --> $WORKSPACE/crates/objc2/src/__macro_helpers/declare_class.rs | diff --git a/crates/test-ui/ui/extern_methods_invalid_receiver.stderr b/crates/test-ui/ui/extern_methods_invalid_receiver.stderr index 41c2b6814..70bc702a6 100644 --- a/crates/test-ui/ui/extern_methods_invalid_receiver.stderr +++ b/crates/test-ui/ui/extern_methods_invalid_receiver.stderr @@ -43,3 +43,8 @@ note: associated function defined here | unsafe fn send_message_id>( | ^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::__rewrite_self_param_inner` which comes from the expansion of the macro `extern_methods` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the `?` operator to extract the `Option>` value, propagating an `Option::None` value to the caller + --> $WORKSPACE/crates/objc2/src/macros/__rewrite_self_param.rs + | + | ($this?) + | + diff --git a/crates/test-ui/ui/extern_methods_invalid_type.stderr b/crates/test-ui/ui/extern_methods_invalid_type.stderr index 0c6c8b082..df045a45c 100644 --- a/crates/test-ui/ui/extern_methods_invalid_type.stderr +++ b/crates/test-ui/ui/extern_methods_invalid_type.stderr @@ -62,10 +62,7 @@ error[E0277]: the trait bound `Box: Encode` is not satisfied | | fn c(&self, arg: Box); | | } | | ); - | | ^ - | | | - | |_the trait `Encode` is not implemented for `Box` - | required by a bound introduced by this call + | |_^ the trait `Encode` is not implemented for `Box` | = help: the following other types implement trait `Encode`: isize diff --git a/crates/test-ui/ui/extern_methods_not_allowed_mutable.stderr b/crates/test-ui/ui/extern_methods_not_allowed_mutable.stderr index 416711baf..b7f781de9 100644 --- a/crates/test-ui/ui/extern_methods_not_allowed_mutable.stderr +++ b/crates/test-ui/ui/extern_methods_not_allowed_mutable.stderr @@ -31,10 +31,7 @@ error[E0277]: the trait bound `InteriorMutable: mutability::MutabilityIsAllowedM | | fn test_id(&mut self) -> Id; | | } | | ); - | | ^ - | | | - | |_the trait `mutability::MutabilityIsAllowedMutable` is not implemented for `InteriorMutable` - | required by a bound introduced by this call + | |_^ the trait `mutability::MutabilityIsAllowedMutable` is not implemented for `InteriorMutable` | = help: the following other types implement trait `mutability::MutabilityIsAllowedMutable`: Root @@ -45,4 +42,4 @@ error[E0277]: the trait bound `InteriorMutable: mutability::MutabilityIsAllowedM = note: required for `&mut MyObject` to implement `MessageReceiver` = note: required for `&mut MyObject` to implement `MsgSend` = note: required for `RetainSemantics<5>` to implement `MsgSendId<&mut MyObject, Option>>` - = note: this error originates in the macro `$crate::__rewrite_self_param_inner` which comes from the expansion of the macro `extern_methods` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__msg_send_id_helper` which comes from the expansion of the macro `extern_methods` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/invalid_option_encode_impl.stderr b/crates/test-ui/ui/invalid_option_encode_impl.stderr index 970a2850a..cee5c900a 100644 --- a/crates/test-ui/ui/invalid_option_encode_impl.stderr +++ b/crates/test-ui/ui/invalid_option_encode_impl.stderr @@ -6,13 +6,13 @@ error[E0080]: evaluation of ` as objc2::Encode>::ENC | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -note: erroneous constant used +note: erroneous constant encountered --> ui/invalid_option_encode_impl.rs | | assert_eq!(>::ENCODING, MyType::ENCODING); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> ui/invalid_option_encode_impl.rs | | assert_eq!(>::ENCODING, MyType::ENCODING); diff --git a/crates/test-ui/ui/invalid_option_encode_impl_ref.stderr b/crates/test-ui/ui/invalid_option_encode_impl_ref.stderr index 1820eab0a..d1bcd9828 100644 --- a/crates/test-ui/ui/invalid_option_encode_impl_ref.stderr +++ b/crates/test-ui/ui/invalid_option_encode_impl_ref.stderr @@ -6,13 +6,13 @@ error[E0080]: evaluation of ` as objc2::RefEncode>:: | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -note: erroneous constant used +note: erroneous constant encountered --> ui/invalid_option_encode_impl_ref.rs | | assert_eq!(>::ENCODING_REF, MyType::ENCODING_REF); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> ui/invalid_option_encode_impl_ref.rs | | assert_eq!(>::ENCODING_REF, MyType::ENCODING_REF); diff --git a/crates/test-ui/ui/mainthreadmarker_from_nsobject.stderr b/crates/test-ui/ui/mainthreadmarker_from_nsobject.stderr index 3794e3996..99e2ed300 100644 --- a/crates/test-ui/ui/mainthreadmarker_from_nsobject.stderr +++ b/crates/test-ui/ui/mainthreadmarker_from_nsobject.stderr @@ -2,9 +2,7 @@ error[E0277]: the trait bound `Root: mutability::MutabilityIsMainThreadOnly` is --> ui/mainthreadmarker_from_nsobject.rs | | let mtm = MainThreadMarker::from(&*obj); - | ---------------------- ^^^^^ the trait `mutability::MutabilityIsMainThreadOnly` is not implemented for `Root` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^ the trait `mutability::MutabilityIsMainThreadOnly` is not implemented for `Root` | = help: the trait `mutability::MutabilityIsMainThreadOnly` is implemented for `MainThreadOnly` = note: required for `NSObject` to implement `IsMainThreadOnly` diff --git a/crates/test-ui/ui/mainthreadmarker_not_send_sync.stderr b/crates/test-ui/ui/mainthreadmarker_not_send_sync.stderr index c0687d679..b17586d3d 100644 --- a/crates/test-ui/ui/mainthreadmarker_not_send_sync.stderr +++ b/crates/test-ui/ui/mainthreadmarker_not_send_sync.stderr @@ -5,7 +5,6 @@ error[E0277]: `*mut ()` cannot be shared between threads safely | ^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely | = help: within `MainThreadMarker`, the trait `Sync` is not implemented for `*mut ()` - = note: consider using `std::sync::Arc<*mut ()>`; for more information visit note: required because it appears within the type `PhantomData<*mut ()>` --> $RUST/core/src/marker.rs | @@ -29,7 +28,6 @@ error[E0277]: `*mut ()` cannot be sent between threads safely | ^^^^^^^^^^^^^^^^ `*mut ()` cannot be sent between threads safely | = help: within `MainThreadMarker`, the trait `Send` is not implemented for `*mut ()` - = note: consider using `std::sync::Arc<*mut ()>`; for more information visit note: required because it appears within the type `PhantomData<*mut ()>` --> $RUST/core/src/marker.rs | diff --git a/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr b/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr index 56bf38f65..9e7dc4606 100644 --- a/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr +++ b/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr @@ -83,34 +83,38 @@ note: associated function defined here | unsafe fn send_message_id>( | ^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `Id: MsgSend` is not satisfied - --> ui/msg_send_id_invalid_receiver.rs - | - | let _: Id = unsafe { msg_send_id![obj, new] }; - | -------------^^^------ - | | | - | | the trait `MsgSend` is not implemented for `Id` - | required by a bound introduced by this call - | - = note: required for `Id` to implement `MsgSend` - = note: required for `RetainSemantics<1>` to implement `MsgSendId, Option>>` -help: consider borrowing here - | -19 | let _: Id = unsafe { msg_send_id![&obj, new] }; - | + +error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied + --> ui/msg_send_id_invalid_receiver.rs + | + | let _: Id = unsafe { msg_send_id![obj, new] }; + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `MessageReceiver` is not implemented for `Id` + | + = help: the following other types implement trait `MessageReceiver`: + NonNull + *const AnyClass + *const T + *mut T + &'a T + &'a mut T + &'a AnyClass + = note: required for `Id` to implement `MsgSend` + = note: required for `RetainSemantics<1>` to implement `MsgSendId, Option>>` + = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `Id: MsgSend` is not satisfied - --> ui/msg_send_id_invalid_receiver.rs - | - | let _: Id = unsafe { msg_send_id![obj, copy] }; - | -------------^^^------- - | | | - | | the trait `MsgSend` is not implemented for `Id` - | required by a bound introduced by this call - | - = note: required for `Id` to implement `MsgSend` - = note: required for `RetainSemantics<4>` to implement `MsgSendId, Option>>` -help: consider borrowing here - | -21 | let _: Id = unsafe { msg_send_id![&obj, copy] }; - | + +error[E0277]: the trait bound `Id: MessageReceiver` is not satisfied + --> ui/msg_send_id_invalid_receiver.rs + | + | let _: Id = unsafe { msg_send_id![obj, copy] }; + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `MessageReceiver` is not implemented for `Id` + | + = help: the following other types implement trait `MessageReceiver`: + NonNull + *const AnyClass + *const T + *mut T + &'a T + &'a mut T + &'a AnyClass + = note: required for `Id` to implement `MsgSend` + = note: required for `RetainSemantics<4>` to implement `MsgSendId, Option>>` + = note: this error originates in the macro `$crate::__msg_send_id_helper` which comes from the expansion of the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/msg_send_id_invalid_return.stderr b/crates/test-ui/ui/msg_send_id_invalid_return.stderr index ea5e9995a..916ff8945 100644 --- a/crates/test-ui/ui/msg_send_id_invalid_return.stderr +++ b/crates/test-ui/ui/msg_send_id_invalid_return.stderr @@ -19,10 +19,7 @@ error[E0277]: the trait bound `AnyClass: Message` is not satisfied --> ui/msg_send_id_invalid_return.rs | | let _: Id = unsafe { msg_send_id![cls, new] }; - | -------------^^^------ - | | | - | | the trait `Message` is not implemented for `AnyClass` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Message` is not implemented for `AnyClass` | = help: the following other types implement trait `Message`: Exception @@ -32,15 +29,13 @@ error[E0277]: the trait bound `AnyClass: Message` is not satisfied AnyObject __RcTestObject = note: required for `RetainSemantics<1>` to implement `MsgSendId<&AnyClass, Option>>` + = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AnyClass: Message` is not satisfied --> ui/msg_send_id_invalid_return.rs | | let _: Option> = unsafe { msg_send_id![cls, new] }; - | -------------^^^------ - | | | - | | the trait `Message` is not implemented for `AnyClass` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Message` is not implemented for `AnyClass` | = help: the following other types implement trait `Message`: Exception @@ -50,6 +45,7 @@ error[E0277]: the trait bound `AnyClass: Message` is not satisfied AnyObject __RcTestObject = note: required for `RetainSemantics<1>` to implement `MsgSendId<&AnyClass, Option>>` + = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `&AnyObject: MaybeUnwrap` is not satisfied --> ui/msg_send_id_invalid_return.rs @@ -72,10 +68,7 @@ error[E0277]: the trait bound `AnyClass: Message` is not satisfied --> ui/msg_send_id_invalid_return.rs | | let _: Allocated = unsafe { msg_send_id![cls, alloc] }; - | -------------^^^-------- - | | | - | | the trait `Message` is not implemented for `AnyClass` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Message` is not implemented for `AnyClass` | = help: the following other types implement trait `Message`: Exception @@ -85,6 +78,7 @@ error[E0277]: the trait bound `AnyClass: Message` is not satisfied AnyObject __RcTestObject = note: required for `RetainSemantics<2>` to implement `MsgSendId<&AnyClass, Allocated>` + = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Allocated<_>` --> ui/msg_send_id_invalid_return.rs diff --git a/crates/test-ui/ui/msg_send_id_no_return_type.stderr b/crates/test-ui/ui/msg_send_id_no_return_type.stderr index c00e4d584..15dab7081 100644 --- a/crates/test-ui/ui/msg_send_id_no_return_type.stderr +++ b/crates/test-ui/ui/msg_send_id_no_return_type.stderr @@ -1,7 +1,17 @@ -error[E0282]: type annotations needed +error[E0283]: type annotations needed --> ui/msg_send_id_no_return_type.rs | | unsafe { msg_send_id![NSObject::class(), new] }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | + = note: cannot satisfy `_: MaybeUnwrap` + = help: the following types implement trait `MaybeUnwrap`: + Id + Allocated + Option> +note: required by a bound in `send_message_id` + --> $WORKSPACE/crates/objc2/src/__macro_helpers/msg_send_id.rs + | + | unsafe fn send_message_id>( + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `MsgSendId::send_message_id` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/msg_send_invalid_error.stderr b/crates/test-ui/ui/msg_send_invalid_error.stderr index fb5bd2c07..f3881f94a 100644 --- a/crates/test-ui/ui/msg_send_invalid_error.stderr +++ b/crates/test-ui/ui/msg_send_invalid_error.stderr @@ -7,6 +7,11 @@ error[E0308]: mismatched types = note: expected unit type `()` found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using `Result::expect` to unwrap the `Result<(), Id<_>>` value, panicking if the value is a `Result::Err` + --> $WORKSPACE/crates/objc2/src/macros/mod.rs + | + | result.expect("REASON") + | +++++++++++++++++ error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs @@ -63,6 +68,11 @@ error[E0308]: mismatched types = note: expected unit type `()` found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using `Result::expect` to unwrap the `Result<(), Id<_>>` value, panicking if the value is a `Result::Err` + --> $WORKSPACE/crates/objc2/src/macros/mod.rs + | + | result.expect("REASON") + | +++++++++++++++++ error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs @@ -73,6 +83,11 @@ error[E0308]: mismatched types = note: expected unit type `()` found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using `Result::expect` to unwrap the `Result<(), Id<_>>` value, panicking if the value is a `Result::Err` + --> $WORKSPACE/crates/objc2/src/macros/mod.rs + | + | result.expect("REASON") + | +++++++++++++++++ error[E0308]: mismatched types --> ui/msg_send_invalid_error.rs @@ -83,3 +98,8 @@ error[E0308]: mismatched types = note: expected unit type `()` found enum `Result<(), Id<_>>` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using `Result::expect` to unwrap the `Result<(), Id<_>>` value, panicking if the value is a `Result::Err` + --> $WORKSPACE/crates/objc2/src/macros/mod.rs + | + | result.expect("REASON") + | +++++++++++++++++ diff --git a/crates/test-ui/ui/msg_send_missing_comma.stderr b/crates/test-ui/ui/msg_send_missing_comma.stderr index a70e62e01..0b1c55abb 100644 --- a/crates/test-ui/ui/msg_send_missing_comma.stderr +++ b/crates/test-ui/ui/msg_send_missing_comma.stderr @@ -5,6 +5,7 @@ error: use of deprecated macro `msg_send_bool`: use a normal msg_send! instead, | ^^^^^^^^^^^^^ | = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` error: use of deprecated macro `objc2::msg_send_bool`: use a normal msg_send! instead, it will perform the conversion for you --> ui/msg_send_missing_comma.rs diff --git a/crates/test-ui/ui/msg_send_no_return_type.stderr b/crates/test-ui/ui/msg_send_no_return_type.stderr index 418ff12a8..476b6e636 100644 --- a/crates/test-ui/ui/msg_send_no_return_type.stderr +++ b/crates/test-ui/ui/msg_send_no_return_type.stderr @@ -1,7 +1,17 @@ -error[E0282]: type annotations needed +error[E0283]: type annotations needed --> ui/msg_send_no_return_type.rs | | unsafe { msg_send![cls, new] }; | ^^^^^^^^^^^^^^^^^^^ cannot infer type | + = note: cannot satisfy `_: ConvertReturn` + = help: the trait `ConvertReturn` is implemented for `bool` +note: required by a bound in `MsgSend::send_message` + --> $WORKSPACE/crates/objc2/src/__macro_helpers/msg_send.rs + | + | unsafe fn send_message(self, sel: Sel, args: A) -> R + | ------------ required by a bound in this associated function +... + | R: ConvertReturn, + | ^^^^^^^^^^^^^ required by this bound in `MsgSend::send_message` = note: this error originates in the macro `$crate::__msg_send_helper` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/msg_send_not_allowed_mutable.stderr b/crates/test-ui/ui/msg_send_not_allowed_mutable.stderr index 375d6b028..b8f61c2e2 100644 --- a/crates/test-ui/ui/msg_send_not_allowed_mutable.stderr +++ b/crates/test-ui/ui/msg_send_not_allowed_mutable.stderr @@ -20,10 +20,7 @@ error[E0277]: the trait bound `InteriorMutable: mutability::MutabilityIsAllowedM --> ui/msg_send_not_allowed_mutable.rs | | let _: Id = unsafe { msg_send_id![obj, test] }; - | -------------^^^------- - | | | - | | the trait `mutability::MutabilityIsAllowedMutable` is not implemented for `InteriorMutable` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `mutability::MutabilityIsAllowedMutable` is not implemented for `InteriorMutable` | = help: the following other types implement trait `mutability::MutabilityIsAllowedMutable`: Root @@ -34,3 +31,4 @@ error[E0277]: the trait bound `InteriorMutable: mutability::MutabilityIsAllowedM = note: required for `&mut NSThread` to implement `MessageReceiver` = note: required for `&mut NSThread` to implement `MsgSend` = note: required for `RetainSemantics<5>` to implement `MsgSendId<&mut NSThread, Option>>` + = note: this error originates in the macro `$crate::__msg_send_id_helper` which comes from the expansion of the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/msg_send_not_encode.stderr b/crates/test-ui/ui/msg_send_not_encode.stderr index 2151642e0..5663b5d1a 100644 --- a/crates/test-ui/ui/msg_send_not_encode.stderr +++ b/crates/test-ui/ui/msg_send_not_encode.stderr @@ -30,10 +30,7 @@ error[E0277]: the trait bound `Vec: Encode` is not satisfied --> ui/msg_send_not_encode.rs | | let _: () = msg_send![cls, newWith: x]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `Encode` is not implemented for `Vec` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Encode` is not implemented for `Vec` | = help: the following other types implement trait `Encode`: isize @@ -62,10 +59,7 @@ error[E0277]: the trait bound `(): Encode` is not satisfied --> ui/msg_send_not_encode.rs | | let _: () = msg_send![cls, unitAsArgument: ()]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `Encode` is not implemented for `()` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Encode` is not implemented for `()` | = help: the following other types implement trait `Encode`: isize diff --git a/crates/test-ui/ui/mutability_traits_unimplementable2.stderr b/crates/test-ui/ui/mutability_traits_unimplementable2.stderr index 20fe4da0d..c52bc087c 100644 --- a/crates/test-ui/ui/mutability_traits_unimplementable2.stderr +++ b/crates/test-ui/ui/mutability_traits_unimplementable2.stderr @@ -15,6 +15,10 @@ note: required by a bound in `IsIdCloneable` | pub unsafe trait IsIdCloneable: private_traits::Sealed {} | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `IsIdCloneable` = note: `IsIdCloneable` is a "sealed trait", because to implement it you also need to implement `objc2::mutability::private_traits::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it + = help: the following types implement the trait: + objc2::runtime::ProtocolObject

+ objc2::runtime::AnyObject + T error[E0277]: the trait bound `CustomStruct: ClassType` is not satisfied --> ui/mutability_traits_unimplementable2.rs diff --git a/crates/test-ui/ui/not_writeback.stderr b/crates/test-ui/ui/not_writeback.stderr index bc02b3e9c..fa5833581 100644 --- a/crates/test-ui/ui/not_writeback.stderr +++ b/crates/test-ui/ui/not_writeback.stderr @@ -31,10 +31,7 @@ error[E0277]: the trait bound `Id: Encode` is not satisfied --> ui/not_writeback.rs | | let _: () = unsafe { msg_send![obj, a: param] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `Encode` is not implemented for `Id` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Encode` is not implemented for `Id` | = help: the following other types implement trait `Encode`: isize @@ -63,10 +60,7 @@ error[E0277]: the trait bound `Id: RefEncode` is not satisfied --> ui/not_writeback.rs | | let _: () = unsafe { msg_send![obj, a: ¶m] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `RefEncode` is not implemented for `Id` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RefEncode` is not implemented for `Id` | = help: the following other types implement trait `RefEncode`: isize @@ -96,10 +90,7 @@ error[E0277]: the trait bound `Id: RefEncode` is not satisfied --> ui/not_writeback.rs | | let _: () = unsafe { msg_send![obj, a: Some(¶m)] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `RefEncode` is not implemented for `Id` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RefEncode` is not implemented for `Id` | = help: the following other types implement trait `RefEncode`: isize @@ -131,10 +122,7 @@ error[E0277]: the trait bound `Id: RefEncode` is not satisfied --> ui/not_writeback.rs | | let _: () = unsafe { msg_send![obj, a: param] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `RefEncode` is not implemented for `Id` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RefEncode` is not implemented for `Id` | = help: the following other types implement trait `RefEncode`: isize @@ -164,10 +152,7 @@ error[E0277]: the trait bound `Id: RefEncode` is not satisfied --> ui/not_writeback.rs | | let _: () = unsafe { msg_send![obj, a: param] }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `RefEncode` is not implemented for `Id` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RefEncode` is not implemented for `Id` | = help: the following other types implement trait `RefEncode`: isize diff --git a/crates/test-ui/ui/ns_string_output_not_const.stderr b/crates/test-ui/ui/ns_string_output_not_const.stderr index 5c33b7ba4..768d984de 100644 --- a/crates/test-ui/ui/ns_string_output_not_const.stderr +++ b/crates/test-ui/ui/ns_string_output_not_const.stderr @@ -1,4 +1,4 @@ -error[E0015]: cannot call non-const fn `CachedId::::get::<[closure@$WORKSPACE/crates/icrate/src/generated/Foundation/../../additions/Foundation/macros/ns_string.rs:195:29: 195:31]>` in statics +error[E0015]: cannot call non-const fn `CachedId::::get::<{closure@$WORKSPACE/crates/icrate/src/generated/Foundation/../../additions/Foundation/macros/ns_string.rs:195:29: 195:31}>` in statics --> ui/ns_string_output_not_const.rs | | static STRING: &NSString = ns_string!("abc"); diff --git a/crates/test-ui/ui/nsarray_bound_not_send_sync.stderr b/crates/test-ui/ui/nsarray_bound_not_send_sync.stderr index 7c77fbb01..7926681b9 100644 --- a/crates/test-ui/ui/nsarray_bound_not_send_sync.stderr +++ b/crates/test-ui/ui/nsarray_bound_not_send_sync.stderr @@ -5,7 +5,6 @@ error[E0277]: `*const NSObject` cannot be shared between threads safely | ^^^^^^^^^^^^^^^^^ `*const NSObject` cannot be shared between threads safely | = help: within `icrate::objc2::rc::id::private::EquivalentType`, the trait `Sync` is not implemented for `*const NSObject` - = note: consider using `std::sync::Arc<*const NSObject>`; for more information visit note: required because it appears within the type `UnknownStorage` --> $WORKSPACE/crates/objc2/src/rc/id.rs | @@ -40,7 +39,6 @@ error[E0277]: `UnsafeCell, PhantomPinned)>>` | ^^^^^^^^^^^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely | = help: within `NSObject`, the trait `Sync` is not implemented for `UnsafeCell, PhantomPinned)>>` - = note: consider using `std::sync::Arc, PhantomPinned)>>>`; for more information visit note: required because it appears within the type `objc_object` --> $WORKSPACE/crates/objc-sys/src/object.rs | @@ -80,7 +78,6 @@ error[E0277]: `*const NSObject` cannot be sent between threads safely | ^^^^^^^^^^^^^^^^^ `*const NSObject` cannot be sent between threads safely | = help: within `icrate::objc2::rc::id::private::EquivalentType`, the trait `Send` is not implemented for `*const NSObject` - = note: consider using `std::sync::Arc<*const NSObject>`; for more information visit note: required because it appears within the type `UnknownStorage` --> $WORKSPACE/crates/objc2/src/rc/id.rs | @@ -115,7 +112,6 @@ error[E0277]: `*const UnsafeCell<()>` cannot be sent between threads safely | ^^^^^^^^^^^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely | = help: within `NSObject`, the trait `Send` is not implemented for `*const UnsafeCell<()>` - = note: consider using `std::sync::Arc<*const UnsafeCell<()>>`; for more information visit = note: required because it appears within the type `(*const UnsafeCell<()>, PhantomPinned)` note: required because it appears within the type `PhantomData<(*const UnsafeCell<()>, PhantomPinned)>` --> $RUST/core/src/marker.rs @@ -166,7 +162,6 @@ error[E0277]: `*const NSObject` cannot be shared between threads safely | ^^^^^^^^^^^^^^^^^^^^^^^^ `*const NSObject` cannot be shared between threads safely | = help: within `icrate::objc2::rc::id::private::EquivalentType`, the trait `Sync` is not implemented for `*const NSObject` - = note: consider using `std::sync::Arc<*const NSObject>`; for more information visit note: required because it appears within the type `UnknownStorage` --> $WORKSPACE/crates/objc2/src/rc/id.rs | @@ -206,7 +201,6 @@ error[E0277]: `UnsafeCell, PhantomPinned)>>` | ^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely | = help: within `NSObject`, the trait `Sync` is not implemented for `UnsafeCell, PhantomPinned)>>` - = note: consider using `std::sync::Arc, PhantomPinned)>>>`; for more information visit note: required because it appears within the type `objc_object` --> $WORKSPACE/crates/objc-sys/src/object.rs | @@ -251,7 +245,6 @@ error[E0277]: `*const NSObject` cannot be sent between threads safely | ^^^^^^^^^^^^^^^^^^^^^^^^ `*const NSObject` cannot be sent between threads safely | = help: within `icrate::objc2::rc::id::private::EquivalentType`, the trait `Send` is not implemented for `*const NSObject` - = note: consider using `std::sync::Arc<*const NSObject>`; for more information visit note: required because it appears within the type `UnknownStorage` --> $WORKSPACE/crates/objc2/src/rc/id.rs | @@ -291,7 +284,6 @@ error[E0277]: `*const UnsafeCell<()>` cannot be sent between threads safely | ^^^^^^^^^^^^^^^^^^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely | = help: within `NSObject`, the trait `Send` is not implemented for `*const UnsafeCell<()>` - = note: consider using `std::sync::Arc<*const UnsafeCell<()>>`; for more information visit = note: required because it appears within the type `(*const UnsafeCell<()>, PhantomPinned)` note: required because it appears within the type `PhantomData<(*const UnsafeCell<()>, PhantomPinned)>` --> $RUST/core/src/marker.rs diff --git a/crates/test-ui/ui/object_not_send_sync.stderr b/crates/test-ui/ui/object_not_send_sync.stderr index 8b83669f7..6faae85a1 100644 --- a/crates/test-ui/ui/object_not_send_sync.stderr +++ b/crates/test-ui/ui/object_not_send_sync.stderr @@ -5,7 +5,6 @@ error[E0277]: `UnsafeCell, PhantomPinned)>>` | ^^^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely | = help: within `AnyObject`, the trait `Sync` is not implemented for `UnsafeCell, PhantomPinned)>>` - = note: consider using `std::sync::Arc, PhantomPinned)>>>`; for more information visit note: required because it appears within the type `objc_object` --> $WORKSPACE/crates/objc-sys/src/object.rs | @@ -29,7 +28,6 @@ error[E0277]: `*const UnsafeCell<()>` cannot be sent between threads safely | ^^^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely | = help: within `AnyObject`, the trait `Send` is not implemented for `*const UnsafeCell<()>` - = note: consider using `std::sync::Arc<*const UnsafeCell<()>>`; for more information visit = note: required because it appears within the type `(*const UnsafeCell<()>, PhantomPinned)` note: required because it appears within the type `PhantomData<(*const UnsafeCell<()>, PhantomPinned)>` --> $RUST/core/src/marker.rs @@ -64,7 +62,6 @@ error[E0277]: `UnsafeCell, PhantomPinned)>>` | ^^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely | = help: within `NSObject`, the trait `Sync` is not implemented for `UnsafeCell, PhantomPinned)>>` - = note: consider using `std::sync::Arc, PhantomPinned)>>>`; for more information visit note: required because it appears within the type `objc_object` --> $WORKSPACE/crates/objc-sys/src/object.rs | @@ -93,7 +90,6 @@ error[E0277]: `*const UnsafeCell<()>` cannot be sent between threads safely | ^^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely | = help: within `NSObject`, the trait `Send` is not implemented for `*const UnsafeCell<()>` - = note: consider using `std::sync::Arc<*const UnsafeCell<()>>`; for more information visit = note: required because it appears within the type `(*const UnsafeCell<()>, PhantomPinned)` note: required because it appears within the type `PhantomData<(*const UnsafeCell<()>, PhantomPinned)>` --> $RUST/core/src/marker.rs @@ -133,7 +129,6 @@ error[E0277]: `UnsafeCell, PhantomPinned)>>` | ^^^^^^^ `UnsafeCell, PhantomPinned)>>` cannot be shared between threads safely | = help: within `NSValue`, the trait `Sync` is not implemented for `UnsafeCell, PhantomPinned)>>` - = note: consider using `std::sync::Arc, PhantomPinned)>>>`; for more information visit note: required because it appears within the type `objc_object` --> $WORKSPACE/crates/objc-sys/src/object.rs | @@ -167,7 +162,6 @@ error[E0277]: `*const UnsafeCell<()>` cannot be sent between threads safely | ^^^^^^^ `*const UnsafeCell<()>` cannot be sent between threads safely | = help: within `NSValue`, the trait `Send` is not implemented for `*const UnsafeCell<()>` - = note: consider using `std::sync::Arc<*const UnsafeCell<()>>`; for more information visit = note: required because it appears within the type `(*const UnsafeCell<()>, PhantomPinned)` note: required because it appears within the type `PhantomData<(*const UnsafeCell<()>, PhantomPinned)>` --> $RUST/core/src/marker.rs From 8c23de1bea042c461c16a07bd2bad57f341f02c8 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 07:36:00 +0100 Subject: [PATCH 06/15] Add fast path for using objc_alloc --- crates/objc2/CHANGELOG.md | 2 ++ .../objc2/src/__macro_helpers/msg_send_id.rs | 25 +++++++++++++- crates/objc2/src/macros/mod.rs | 3 +- crates/objc2/src/top_level_traits.rs | 2 +- .../expected/apple-aarch64.s | 33 ++++++++----------- .../expected/apple-armv7s.s | 16 +++------ .../expected/apple-x86.s | 9 ++--- .../expected/apple-x86_64.s | 4 +-- .../ui/main_thread_only_not_allocable.stderr | 2 +- .../ui/msg_send_id_invalid_receiver.stderr | 4 +-- .../ui/msg_send_id_invalid_return.stderr | 30 +++++++++-------- 11 files changed, 68 insertions(+), 62 deletions(-) diff --git a/crates/objc2/CHANGELOG.md b/crates/objc2/CHANGELOG.md index 471f2780f..e9ccd18fd 100644 --- a/crates/objc2/CHANGELOG.md +++ b/crates/objc2/CHANGELOG.md @@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * Added new `encode` traits `EncodeReturn`, `EncodeArgument` and `EncodeArguments`. * Added methods `as_ptr` and `as_mut_ptr` to `Allocated`. +* Added optimization for converting `msg_send_id![cls, alloc]` to a call to + the faster runtime function `objc_alloc`. ### Changed * **BREAKING**: `AnyClass::verify_sel` now take more well-defined types diff --git a/crates/objc2/src/__macro_helpers/msg_send_id.rs b/crates/objc2/src/__macro_helpers/msg_send_id.rs index 85bf82e66..9cb02d96b 100644 --- a/crates/objc2/src/__macro_helpers/msg_send_id.rs +++ b/crates/objc2/src/__macro_helpers/msg_send_id.rs @@ -85,7 +85,7 @@ impl MsgSendId>> for New { } } -impl MsgSendId<&'_ AnyClass, Allocated> for Alloc { +impl MsgSendId<&'_ AnyClass, Allocated> for Alloc { #[inline] unsafe fn send_message_id>>( cls: &AnyClass, @@ -100,6 +100,29 @@ impl MsgSendId<&'_ AnyClass, Allocated> for Alloc { } } +impl Alloc { + /// Fast path optimization for `msg_send_id![cls, alloc]`. + #[inline] + pub unsafe fn send_message_id_alloc>>( + cls: &AnyClass, + ) -> R { + // Available on non-fragile Apple runtimes. + #[cfg(all(feature = "apple", not(all(target_os = "macos", target_arch = "x86"))))] + { + // SAFETY: Checked by caller + let obj: *mut T = unsafe { crate::ffi::objc_alloc(cls.as_ptr()).cast() }; + // SAFETY: The object is newly allocated, so this has +1 retain count + let obj = unsafe { Allocated::new(obj) }; + R::maybe_unwrap::(obj, ()) + } + #[cfg(not(all(feature = "apple", not(all(target_os = "macos", target_arch = "x86")))))] + { + // SAFETY: Checked by caller + unsafe { Alloc::send_message_id(cls, sel!(alloc), ()) } + } + } +} + impl MsgSendId, Option>> for Init { #[inline] unsafe fn send_message_id>>>( diff --git a/crates/objc2/src/macros/mod.rs b/crates/objc2/src/macros/mod.rs index a5adb07a9..38e0e76cb 100644 --- a/crates/objc2/src/macros/mod.rs +++ b/crates/objc2/src/macros/mod.rs @@ -1194,9 +1194,8 @@ macro_rules! msg_send_id { result }); [$obj:expr, alloc $(,)?] => ({ - let sel = $crate::sel!(alloc); let result; - result = <$crate::__macro_helpers::Alloc as $crate::__macro_helpers::MsgSendId<_, _>>::send_message_id($obj, sel, ()); + result = $crate::__macro_helpers::Alloc::send_message_id_alloc($obj); result }); [$obj:expr, init $(,)?] => ({ diff --git a/crates/objc2/src/top_level_traits.rs b/crates/objc2/src/top_level_traits.rs index 8f00b8b22..b852fb182 100644 --- a/crates/objc2/src/top_level_traits.rs +++ b/crates/objc2/src/top_level_traits.rs @@ -289,7 +289,7 @@ pub unsafe trait ClassType: Message { #[inline] fn alloc() -> Allocated where - Self: IsAllocableAnyThread, + Self: IsAllocableAnyThread + Sized, { // SAFETY: // - It is always safe to (attempt to) allocate an object. diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s index 9ce4dd858..c6a4fa600 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s @@ -21,13 +21,7 @@ Lloh3: ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGEOFF] Lloh4: ldr x19, [x8] -Lloh5: - adrp x8, L_OBJC_SELECTOR_REFERENCES_alloc@GOTPAGE -Lloh6: - ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_alloc@GOTPAGEOFF] -Lloh7: - ldr x1, [x8] - bl _objc_msgSend + bl _objc_alloc mov x20, x0 mov x1, x19 bl _objc_msgSend @@ -36,16 +30,15 @@ Lloh7: ldp x20, x19, [sp], #32 ret LBB1_2: -Lloh8: +Lloh5: adrp x2, l_anon.[ID].1@PAGE -Lloh9: +Lloh6: add x2, x2, l_anon.[ID].1@PAGEOFF mov x0, x20 mov x1, x19 bl SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) - .loh AdrpLdrGotLdr Lloh5, Lloh6, Lloh7 .loh AdrpLdrGotLdr Lloh2, Lloh3, Lloh4 - .loh AdrpAdd Lloh8, Lloh9 + .loh AdrpAdd Lloh5, Lloh6 .globl _use_generic .p2align 2 @@ -54,32 +47,32 @@ _use_generic: stp x29, x30, [sp, #16] add x29, sp, #16 mov x19, x0 -Lloh10: +Lloh7: adrp x8, L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138@PAGE -Lloh11: +Lloh8: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_1f1c7bd8029c3138@PAGEOFF] adrp x20, L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05@PAGE ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05@PAGEOFF] bl _objc_msgSend -Lloh12: +Lloh9: adrp x8, L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da@PAGE -Lloh13: +Lloh10: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_eb5b4d2de37744da@PAGEOFF] ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05@PAGEOFF] mov x0, x19 bl _objc_msgSend -Lloh14: +Lloh11: adrp x8, L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a@PAGE -Lloh15: +Lloh12: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_c76827c00227cd8a@PAGEOFF] ldr x2, [x20, L_OBJC_SELECTOR_REFERENCES_5ace898e385eba05@PAGEOFF] mov x0, x19 ldp x29, x30, [sp, #16] ldp x20, x19, [sp], #32 b _objc_msgSend - .loh AdrpLdr Lloh14, Lloh15 - .loh AdrpLdr Lloh12, Lloh13 - .loh AdrpLdr Lloh10, Lloh11 + .loh AdrpLdr Lloh11, Lloh12 + .loh AdrpLdr Lloh9, Lloh10 + .loh AdrpLdr Lloh7, Lloh8 .section __TEXT,__const l_anon.[ID].0: diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s index 72dea25f3..19afd4c34 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s @@ -20,22 +20,17 @@ _handle_alloc_init: movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) LPC1_0: ldr r1, [pc, r1] - movw r2, :lower16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_1+8)) - movt r2, :upper16:(LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-(LPC1_1+8)) -LPC1_1: - ldr r2, [pc, r2] ldr r4, [r1] - ldr r1, [r2] - bl _objc_msgSend + bl _objc_alloc mov r5, r0 mov r1, r4 bl _objc_msgSend cmp r0, #0 popne {r4, r5, r7, pc} LBB1_1: - movw r2, :lower16:(l_anon.[ID].1-(LPC1_2+8)) - movt r2, :upper16:(l_anon.[ID].1-(LPC1_2+8)) -LPC1_2: + movw r2, :lower16:(l_anon.[ID].1-(LPC1_1+8)) + movt r2, :upper16:(l_anon.[ID].1-(LPC1_1+8)) +LPC1_1: add r2, pc, r2 mov r0, r5 mov r1, r4 @@ -177,9 +172,6 @@ L_OBJC_IMAGE_INFO_c76827c00227cd8a: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers .p2align 2, 0x0 -LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr: - .indirect_symbol L_OBJC_SELECTOR_REFERENCES_alloc - .long 0 LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init .long 0 diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s index fb09d70f8..63d03fc23 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s @@ -31,11 +31,9 @@ L1$pb: pop ebx mov eax, dword ptr [ebx + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] mov edi, dword ptr [eax] - mov eax, dword ptr [ebx + LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-L1$pb] - sub esp, 8 - push dword ptr [eax] + sub esp, 12 push dword ptr [ebp + 8] - call _objc_msgSend + call _objc_alloc add esp, 16 mov esi, eax sub esp, 8 @@ -187,9 +185,6 @@ L_OBJC_IMAGE_INFO_c76827c00227cd8a: .asciz "\000\000\000\000@\000\000" .section __IMPORT,__pointers,non_lazy_symbol_pointers -LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr: - .indirect_symbol L_OBJC_SELECTOR_REFERENCES_alloc - .long 0 LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init .long 0 diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s index dc6dd9099..8175d15b3 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s @@ -18,9 +18,7 @@ _handle_alloc_init: push rbx mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_init@GOTPCREL] mov rbx, qword ptr [rax] - mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_alloc@GOTPCREL] - mov rsi, qword ptr [rax] - call _objc_msgSend + call _objc_alloc mov r14, rax mov rdi, rax mov rsi, rbx diff --git a/crates/test-ui/ui/main_thread_only_not_allocable.stderr b/crates/test-ui/ui/main_thread_only_not_allocable.stderr index 38678c297..c3e5ad24c 100644 --- a/crates/test-ui/ui/main_thread_only_not_allocable.stderr +++ b/crates/test-ui/ui/main_thread_only_not_allocable.stderr @@ -18,5 +18,5 @@ note: required by a bound in `objc2::ClassType::alloc` | fn alloc() -> Allocated | ----- required by a bound in this associated function | where - | Self: IsAllocableAnyThread, + | Self: IsAllocableAnyThread + Sized, | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `ClassType::alloc` diff --git a/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr b/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr index 9e7dc4606..91a712c18 100644 --- a/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr +++ b/crates/test-ui/ui/msg_send_id_invalid_receiver.stderr @@ -12,8 +12,8 @@ error[E0308]: mismatched types note: associated function defined here --> $WORKSPACE/crates/objc2/src/__macro_helpers/msg_send_id.rs | - | unsafe fn send_message_id>( - | ^^^^^^^^^^^^^^^ + | pub unsafe fn send_message_id_alloc>>( + | ^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> ui/msg_send_id_invalid_receiver.rs diff --git a/crates/test-ui/ui/msg_send_id_invalid_return.stderr b/crates/test-ui/ui/msg_send_id_invalid_return.stderr index 916ff8945..0fd6d0c48 100644 --- a/crates/test-ui/ui/msg_send_id_invalid_return.stderr +++ b/crates/test-ui/ui/msg_send_id_invalid_return.stderr @@ -57,11 +57,11 @@ error[E0277]: the trait bound `&AnyObject: MaybeUnwrap` is not satisfied Id Allocated Option> -note: required by a bound in `send_message_id` +note: required by a bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` --> $WORKSPACE/crates/objc2/src/__macro_helpers/msg_send_id.rs | - | unsafe fn send_message_id>( - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `MsgSendId::send_message_id` + | pub unsafe fn send_message_id_alloc>>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AnyClass: Message` is not satisfied @@ -77,7 +77,11 @@ error[E0277]: the trait bound `AnyClass: Message` is not satisfied ProtocolObject

AnyObject __RcTestObject - = note: required for `RetainSemantics<2>` to implement `MsgSendId<&AnyClass, Allocated>` +note: required by a bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` + --> $WORKSPACE/crates/objc2/src/__macro_helpers/msg_send_id.rs + | + | pub unsafe fn send_message_id_alloc>>( + | ^^^^^^^ required by this bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == Allocated<_>` @@ -88,11 +92,11 @@ error[E0271]: type mismatch resolving ` as MaybeUnwrap>::Input == | = note: expected struct `Allocated<_>` found enum `Option>` -note: required by a bound in `send_message_id` +note: required by a bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` --> $WORKSPACE/crates/objc2/src/__macro_helpers/msg_send_id.rs | - | unsafe fn send_message_id>( - | ^^^^^^^^^ required by this bound in `MsgSendId::send_message_id` + | pub unsafe fn send_message_id_alloc>>( + | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Option>: MaybeUnwrap` is not satisfied @@ -102,11 +106,11 @@ error[E0277]: the trait bound `Option>: MaybeUnwrap` is not | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MaybeUnwrap` is not implemented for `Option>` | = help: the trait `MaybeUnwrap` is implemented for `Option>` -note: required by a bound in `send_message_id` +note: required by a bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` --> $WORKSPACE/crates/objc2/src/__macro_helpers/msg_send_id.rs | - | unsafe fn send_message_id>( - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `MsgSendId::send_message_id` + | pub unsafe fn send_message_id_alloc>>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0271]: type mismatch resolving `> as MaybeUnwrap>::Input == Allocated<_>` @@ -117,11 +121,11 @@ error[E0271]: type mismatch resolving `> as MaybeUnwrap> | = note: expected struct `Allocated<_>` found enum `Option>>` -note: required by a bound in `send_message_id` +note: required by a bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` --> $WORKSPACE/crates/objc2/src/__macro_helpers/msg_send_id.rs | - | unsafe fn send_message_id>( - | ^^^^^^^^^ required by this bound in `MsgSendId::send_message_id` + | pub unsafe fn send_message_id_alloc>>( + | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `__macro_helpers::msg_send_id::>::send_message_id_alloc` = note: this error originates in the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `&AnyObject: MaybeUnwrap` is not satisfied From 2eff74f6c60b8e1bd33d7d45f5bca76d56517688 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 02:07:45 +0100 Subject: [PATCH 07/15] Slightly improve assembly for `init` and `new` message calls Previously, we were calling `sel!` before the inner expression, which increases stack pressure because the compiler doesn't know it's allowed to defer loading the selector until just before it needs it. --- crates/objc2/src/macros/mod.rs | 14 ++++++++++---- .../test_declare_class/expected/apple-aarch64.s | 13 +++++-------- .../test_declare_class/expected/apple-armv7s.s | 17 ++++++++--------- .../test_declare_class/expected/apple-old-x86.s | 7 +++---- .../test_declare_class/expected/apple-x86.s | 7 +++---- .../test_declare_class/expected/apple-x86_64.s | 9 ++------- .../expected/apple-aarch64.s | 12 ++++++------ .../expected/apple-armv7s.s | 4 ++-- .../expected/apple-old-x86.s | 16 ++++++++-------- .../expected/apple-x86.s | 14 +++++++------- .../expected/apple-x86_64.s | 14 +++++++------- 11 files changed, 61 insertions(+), 66 deletions(-) diff --git a/crates/objc2/src/macros/mod.rs b/crates/objc2/src/macros/mod.rs index 38e0e76cb..da02ac8e2 100644 --- a/crates/objc2/src/macros/mod.rs +++ b/crates/objc2/src/macros/mod.rs @@ -1188,9 +1188,12 @@ macro_rules! msg_send_bool { #[macro_export] macro_rules! msg_send_id { [$obj:expr, new $(,)?] => ({ - let sel = $crate::sel!(new); let result; - result = <$crate::__macro_helpers::New as $crate::__macro_helpers::MsgSendId<_, _>>::send_message_id($obj, sel, ()); + result = <$crate::__macro_helpers::New as $crate::__macro_helpers::MsgSendId<_, _>>::send_message_id( + $obj, + $crate::sel!(new), + (), + ); result }); [$obj:expr, alloc $(,)?] => ({ @@ -1199,9 +1202,12 @@ macro_rules! msg_send_id { result }); [$obj:expr, init $(,)?] => ({ - let sel = $crate::sel!(init); let result; - result = <$crate::__macro_helpers::Init as $crate::__macro_helpers::MsgSendId<_, _>>::send_message_id($obj, sel, ()); + result = <$crate::__macro_helpers::Init as $crate::__macro_helpers::MsgSendId<_, _>>::send_message_id( + $obj, + $crate::sel!(init), + (), + ); result }); [$obj:expr, $($selector_and_arguments:tt)+] => { diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s b/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s index f4f148721..c366c0484 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s @@ -341,19 +341,16 @@ Lloh82: .globl _get_obj .p2align 2 _get_obj: - stp x20, x19, [sp, #-32]! - stp x29, x30, [sp, #16] - add x29, sp, #16 + stp x29, x30, [sp, #-16]! + mov x29, sp + bl _get_class Lloh83: adrp x8, L_OBJC_SELECTOR_REFERENCES_new@GOTPAGE Lloh84: ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_new@GOTPAGEOFF] Lloh85: - ldr x19, [x8] - bl _get_class - mov x1, x19 - ldp x29, x30, [sp, #16] - ldp x20, x19, [sp], #32 + ldr x1, [x8] + ldp x29, x30, [sp], #16 b _objc_msgSend .loh AdrpLdrGotLdr Lloh83, Lloh84, Lloh85 diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s index 8a5d1624d..55f165c2a 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s @@ -302,16 +302,15 @@ LPC3_3: .p2align 2 .code 32 _get_obj: - push {r4, r7, lr} - add r7, sp, #4 - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC4_0+8)) - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC4_0+8)) -LPC4_0: - ldr r0, [pc, r0] - ldr r4, [r0] + push {r7, lr} + mov r7, sp bl _get_class - mov r1, r4 - pop {r4, r7, lr} + movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC4_0+8)) + movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC4_0+8)) +LPC4_0: + ldr r1, [pc, r1] + ldr r1, [r1] + pop {r7, lr} b _objc_msgSend .globl _access_ivars diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s b/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s index 5eb053e50..396066212 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s @@ -260,12 +260,11 @@ _get_obj: push eax call L4$pb L4$pb: - pop eax - mov eax, dword ptr [eax + LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-L4$pb] - mov esi, dword ptr [eax] + pop esi call _get_class + mov ecx, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-L4$pb] sub esp, 8 - push esi + push dword ptr [ecx] push eax call _objc_msgSend add esp, 20 diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s b/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s index eb1ca7988..340c9a0e3 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s @@ -260,12 +260,11 @@ _get_obj: push eax call L4$pb L4$pb: - pop eax - mov eax, dword ptr [eax + LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-L4$pb] - mov esi, dword ptr [eax] + pop esi call _get_class + mov ecx, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-L4$pb] sub esp, 8 - push esi + push dword ptr [ecx] push eax call _objc_msgSend add esp, 20 diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s b/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s index c4f05dd20..bc4820489 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s @@ -187,15 +187,10 @@ LBB3_4: _get_obj: push rbp mov rbp, rsp - push rbx - push rax - mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_new@GOTPCREL] - mov rbx, qword ptr [rax] call _get_class + mov rcx, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_new@GOTPCREL] + mov rsi, qword ptr [rcx] mov rdi, rax - mov rsi, rbx - add rsp, 8 - pop rbx pop rbp jmp _objc_msgSend diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s index c6a4fa600..c659df3f5 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-aarch64.s @@ -15,15 +15,15 @@ _handle_alloc_init: stp x20, x19, [sp, #-32]! stp x29, x30, [sp, #16] add x29, sp, #16 + bl _objc_alloc + mov x19, x0 Lloh2: adrp x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGE Lloh3: ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGEOFF] Lloh4: - ldr x19, [x8] - bl _objc_alloc - mov x20, x0 - mov x1, x19 + ldr x20, [x8] + mov x1, x20 bl _objc_msgSend cbz x0, LBB1_2 ldp x29, x30, [sp, #16] @@ -34,8 +34,8 @@ Lloh5: adrp x2, l_anon.[ID].1@PAGE Lloh6: add x2, x2, l_anon.[ID].1@PAGEOFF - mov x0, x20 - mov x1, x19 + mov x0, x19 + mov x1, x20 bl SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) .loh AdrpLdrGotLdr Lloh2, Lloh3, Lloh4 .loh AdrpAdd Lloh5, Lloh6 diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s index 19afd4c34..6feeb8c63 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-armv7s.s @@ -16,13 +16,13 @@ LPC0_0: _handle_alloc_init: push {r4, r5, r7, lr} add r7, sp, #8 + bl _objc_alloc movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_0+8)) LPC1_0: ldr r1, [pc, r1] - ldr r4, [r1] - bl _objc_alloc mov r5, r0 + ldr r4, [r1] mov r1, r4 bl _objc_msgSend cmp r0, #0 diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-old-x86.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-old-x86.s index fe8a4b9d1..990f32cb7 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-old-x86.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-old-x86.s @@ -28,19 +28,19 @@ _handle_alloc_init: sub esp, 12 call L1$pb L1$pb: - pop ebx - mov eax, dword ptr [ebx + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] - mov edi, dword ptr [eax] - mov eax, dword ptr [ebx + LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-L1$pb] + pop edi + mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_alloc$non_lazy_ptr-L1$pb] sub esp, 8 push dword ptr [eax] push dword ptr [ebp + 8] call _objc_msgSend add esp, 16 mov esi, eax + mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] + mov ebx, dword ptr [eax] sub esp, 8 - push edi - push eax + push ebx + push esi call _objc_msgSend add esp, 16 test eax, eax @@ -53,9 +53,9 @@ L1$pb: ret LBB1_2: sub esp, 4 - lea eax, [ebx + l_anon.[ID].1-L1$pb] + lea eax, [edi + l_anon.[ID].1-L1$pb] push eax - push edi + push ebx push esi call SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s index 63d03fc23..ecce1f32b 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86.s @@ -28,17 +28,17 @@ _handle_alloc_init: sub esp, 12 call L1$pb L1$pb: - pop ebx - mov eax, dword ptr [ebx + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] - mov edi, dword ptr [eax] + pop edi sub esp, 12 push dword ptr [ebp + 8] call _objc_alloc add esp, 16 mov esi, eax + mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] + mov ebx, dword ptr [eax] sub esp, 8 - push edi - push eax + push ebx + push esi call _objc_msgSend add esp, 16 test eax, eax @@ -51,9 +51,9 @@ L1$pb: ret LBB1_2: sub esp, 4 - lea eax, [ebx + l_anon.[ID].1-L1$pb] + lea eax, [edi + l_anon.[ID].1-L1$pb] push eax - push edi + push ebx push esi call SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) diff --git a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s index 8175d15b3..c18916f28 100644 --- a/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_msg_send_static_sel/expected/apple-x86_64.s @@ -16,12 +16,12 @@ _handle_alloc_init: mov rbp, rsp push r14 push rbx - mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_init@GOTPCREL] - mov rbx, qword ptr [rax] call _objc_alloc - mov r14, rax - mov rdi, rax - mov rsi, rbx + mov rbx, rax + mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_init@GOTPCREL] + mov r14, qword ptr [rax] + mov rdi, rbx + mov rsi, r14 call _objc_msgSend test rax, rax je LBB1_2 @@ -31,8 +31,8 @@ _handle_alloc_init: ret LBB1_2: lea rdx, [rip + l_anon.[ID].1] - mov rdi, r14 - mov rsi, rbx + mov rdi, rbx + mov rsi, r14 call SYM( as objc2::__macro_helpers::msg_send_id::MsgSendIdFailed>::failed::GENERATED_ID, 0) .globl _use_generic From 5345baec054063a5f5f4924c5622f507ad7fb1d0 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 06:12:07 +0100 Subject: [PATCH 08/15] Update the supported clang version for running header-translator I had to modify the struct/typedef code a bit, since clang now does those differently. --- crates/header-translator/src/library.rs | 2 +- crates/header-translator/src/main.rs | 1 + crates/header-translator/src/method.rs | 2 +- crates/header-translator/src/rust_type.rs | 82 +++++--- crates/header-translator/src/stmt.rs | 194 +++++++----------- .../header-translator/src/unexposed_attr.rs | 4 +- .../header-translator/translation-config.toml | 8 +- crates/icrate/CHANGELOG.md | 1 + crates/icrate/src/generated | 2 +- 9 files changed, 140 insertions(+), 156 deletions(-) diff --git a/crates/header-translator/src/library.rs b/crates/header-translator/src/library.rs index c222720a0..dff899ad6 100644 --- a/crates/header-translator/src/library.rs +++ b/crates/header-translator/src/library.rs @@ -135,7 +135,7 @@ impl fmt::Display for Library { // NOTE: some SDK files have '+' in the file name let name = name.replace('+', "_"); for stmt in &file.stmts { - let mut iter = stmt.declared_types(); + let mut iter = stmt.declared_types().filter(|item| !item.starts_with('_')); if let Some(item) = iter.next() { // Use a set to deduplicate features, and to have them in // a consistent order diff --git a/crates/header-translator/src/main.rs b/crates/header-translator/src/main.rs index 53510553e..9828f808c 100644 --- a/crates/header-translator/src/main.rs +++ b/crates/header-translator/src/main.rs @@ -29,6 +29,7 @@ fn main() -> Result<(), BoxError> { // metadata.is_span() && metadata.level() == &tracing::Level::INFO // })), // ) + // .with(tracing_subscriber::fmt::Layer::default().with_filter(LevelFilter::ERROR)) .with( HierarchicalLayer::new(2) .with_targets(false) diff --git a/crates/header-translator/src/method.rs b/crates/header-translator/src/method.rs index 6aad2fb51..40988f5a2 100644 --- a/crates/header-translator/src/method.rs +++ b/crates/header-translator/src/method.rs @@ -222,13 +222,13 @@ impl MemoryManagement { } } } else if let MethodModifiers { - designated_initializer: false, // TODO: Maybe we can use this to emit things with lifetime of: // `'self + 'autoreleasepool` returns_inner_pointer: _, consumes_self: false, returns_retained: false, returns_not_retained: false, + designated_initializer: false, .. } = modifiers { diff --git a/crates/header-translator/src/rust_type.rs b/crates/header-translator/src/rust_type.rs index 11e20ab37..001ed7c73 100644 --- a/crates/header-translator/src/rust_type.rs +++ b/crates/header-translator/src/rust_type.rs @@ -574,6 +574,14 @@ impl Inner { let _span = debug_span!("ty3", ?ty).entered(); + let elaborated_ty = ty; + + if let Some(true) = ty.is_elaborated() { + ty = ty.get_elaborated_type().expect("elaborated"); + } + + let _span = debug_span!("ty4", ?ty).entered(); + let get_is_const = |new: bool| { if new { if !attributed_ty.is_const_qualified() || ty.is_const_qualified() { @@ -609,6 +617,26 @@ impl Inner { ULongLong => Self::ULongLong, Float => Self::Float, Double => Self::Double, + Record => { + let declaration = ty.get_declaration().expect("record declaration"); + let name = ty + .get_display_name() + .trim_start_matches("struct ") + .to_string(); + Self::Struct { + id: ItemIdentifier::with_name(name, &declaration, context), + } + } + Enum => { + let declaration = ty.get_declaration().expect("enum declaration"); + let name = ty + .get_display_name() + .trim_start_matches("enum ") + .to_string(); + Self::Enum { + id: ItemIdentifier::with_name(name, &declaration, context), + } + } ObjCId => { let mut parser = AttributeParser::new(&attributed_name, "id"); @@ -785,13 +813,27 @@ impl Inner { drop(parser); let is_const = if is_const1 || is_const2 { - if !attributed_ty.is_const_qualified() && !ty.is_const_qualified() { - warn!(?attributed_ty, ?ty, ?typedef_name, ?is_const1, ?is_const2, attr = ?attributed_ty.is_const_qualified(), ty = ?ty.is_const_qualified(), "unnecessarily stripped const"); + if !attributed_ty.is_const_qualified() + && !elaborated_ty.is_const_qualified() + && !ty.is_const_qualified() + { + warn!( + ?attributed_ty, + ?elaborated_ty, + ?ty, + ?typedef_name, + ?is_const1, + ?is_const2, + attr = ?attributed_ty.is_const_qualified(), + elaborated = ?elaborated_ty.is_const_qualified(), + ty = ?ty.is_const_qualified(), + "typedef unnecessarily stripped const", + ); } true } else { if ty.is_const_qualified() { - warn!("type was const but that could not be stripped"); + warn!("typedef was const but that could not be stripped"); } false }; @@ -889,32 +931,6 @@ impl Inner { } } } - Elaborated => { - let ty = ty.get_elaborated_type().expect("elaborated"); - match ty.get_kind() { - TypeKind::Record => { - let declaration = ty.get_declaration().expect("record declaration"); - let name = ty - .get_display_name() - .trim_start_matches("struct ") - .to_string(); - Self::Struct { - id: ItemIdentifier::with_name(name, &declaration, context), - } - } - TypeKind::Enum => { - let declaration = ty.get_declaration().expect("enum declaration"); - let name = ty - .get_display_name() - .trim_start_matches("enum ") - .to_string(); - Self::Enum { - id: ItemIdentifier::with_name(name, &declaration, context), - } - } - _ => panic!("unknown elaborated type {ty:?}"), - } - } FunctionPrototype => { let call_conv = ty.get_calling_convention().expect("fn calling convention"); assert_eq!( @@ -1368,12 +1384,10 @@ impl Ty { match &mut ty { // Handled by Stmt::EnumDecl Inner::Enum { .. } => None, - // Handled above and in Stmt::StructDecl + // No need to output a typedef if it'll just point to the same thing. + // + // TODO: We're discarding a slight bit of availability data this way. Inner::Struct { id } if id.name == typedef_name => None, - Inner::Struct { id } if id.name != typedef_name => { - warn!(?id, "invalid struct in typedef"); - None - } // Opaque structs Inner::Pointer { pointee, .. } if matches!(&**pointee, Inner::Struct { .. }) => { **pointee = Inner::Void; diff --git a/crates/header-translator/src/stmt.rs b/crates/header-translator/src/stmt.rs index 725cdb5c6..c67c607f7 100644 --- a/crates/header-translator/src/stmt.rs +++ b/crates/header-translator/src/stmt.rs @@ -459,48 +459,6 @@ pub enum Stmt { }, } -fn parse_struct( - entity: &Entity<'_>, - context: &Context<'_>, -) -> (bool, Vec<(String, Ty)>, Option) { - let mut boxable = false; - let mut fields = Vec::new(); - let mut sendable = None; - - immediate_children(entity, |entity, span| match entity.get_kind() { - EntityKind::UnexposedAttr => { - if let Some(attr) = UnexposedAttr::parse(&entity, context) { - match attr { - UnexposedAttr::Sendable => sendable = Some(true), - UnexposedAttr::NonSendable => sendable = Some(false), - attr => error!(?attr, "unknown attribute"), - } - } - } - EntityKind::FieldDecl => { - drop(span); - let name = entity.get_name().expect("struct field name"); - let _span = debug_span!("field", name).entered(); - - let ty = entity.get_type().expect("struct field type"); - let ty = Ty::parse_struct_field(ty, context); - - if entity.is_bit_field() { - error!("unsound struct bitfield"); - } - - fields.push((name, ty)) - } - EntityKind::ObjCBoxable => { - boxable = true; - } - EntityKind::UnionDecl => error!("can't handle unions in structs yet"), - _ => error!("unknown"), - }); - - (boxable, fields, sendable) -} - fn parse_fn_param_children(entity: &Entity<'_>, context: &Context<'_>) { immediate_children(entity, |entity, _span| match entity.get_kind() { EntityKind::UnexposedAttr => { @@ -890,9 +848,6 @@ impl Stmt { EntityKind::TypedefDecl => { let id = ItemIdentifier::new(entity, context); let availability = Availability::parse(entity, context); - let mut struct_ = None; - let mut encoding_name = "?".to_string(); - let mut skip_struct = false; let mut kind = None; immediate_children(entity, |entity, _span| match entity.get_kind() { @@ -908,55 +863,14 @@ impl Stmt { } } } - EntityKind::StructDecl => { - if context - .struct_data - .get(&id.name) - .map(|data| data.skipped) - .unwrap_or_default() - { - skip_struct = true; - return; - } - - if let Some(name) = entity.get_name() { - // if the struct has a name use it - // otherwise it will be the default "?" - encoding_name = name; - } - - if encoding_name == "?" || encoding_name.starts_with('_') { - // If this struct doesn't have a name, or the - // name is private, let's parse it with the - // typedef name. - struct_ = Some(parse_struct(&entity, context)) - } else { - skip_struct = true; - } - } - EntityKind::ObjCClassRef + EntityKind::StructDecl + | EntityKind::ObjCClassRef | EntityKind::ObjCProtocolRef | EntityKind::TypeRef | EntityKind::ParmDecl => {} _ => error!("unknown"), }); - if let Some((boxable, fields, sendable)) = struct_ { - assert_eq!(kind, None, "should not have parsed a kind"); - return vec![Self::StructDecl { - id, - encoding_name: Some(encoding_name), - availability, - boxable, - fields, - sendable, - }]; - } - - if skip_struct { - return vec![]; - } - if context .typedef_data .get(&id.name) @@ -981,37 +895,76 @@ impl Stmt { } } EntityKind::StructDecl => { - if let Some(name) = entity.get_name() { - let availability = Availability::parse(entity, context); - let id = ItemIdentifier::with_name(name, entity, context); - - if context - .struct_data - .get(&id.name) - .map(|data| data.skipped) - .unwrap_or_default() - { - return vec![]; - } + let id = ItemIdentifier::new(entity, context); - // See https://github.com/rust-lang/rust-bindgen/blob/95fd17b874910184cc0fcd33b287fa4e205d9d7a/bindgen/ir/comp.rs#L1392-L1408 - if !entity.is_definition() { - return vec![]; + let availability = Availability::parse(entity, context); + + if context + .struct_data + .get(&id.name) + .map(|data| data.skipped) + .unwrap_or_default() + { + return vec![]; + } + + // See https://github.com/rust-lang/rust-bindgen/blob/95fd17b874910184cc0fcd33b287fa4e205d9d7a/bindgen/ir/comp.rs#L1392-L1408 + if !entity.is_definition() { + return vec![]; + } + + let ty = entity.get_type().unwrap(); + let enc = ty.get_objc_encoding().unwrap(); + let encoding_name = enc.strip_prefix('{').unwrap().split_once('=').unwrap().0; + let encoding_name = if encoding_name == id.name { + None + } else { + Some(encoding_name.to_string()) + }; + + let mut boxable = false; + let mut fields = Vec::new(); + let mut sendable = None; + + immediate_children(entity, |entity, span| match entity.get_kind() { + EntityKind::UnexposedAttr => { + if let Some(attr) = UnexposedAttr::parse(&entity, context) { + match attr { + UnexposedAttr::Sendable => sendable = Some(true), + UnexposedAttr::NonSendable => sendable = Some(false), + attr => error!(?attr, "unknown attribute"), + } + } } + EntityKind::FieldDecl => { + drop(span); + let name = entity.get_name().expect("struct field name"); + let _span = debug_span!("field", name).entered(); - if !id.name.starts_with('_') { - let (boxable, fields, sendable) = parse_struct(entity, context); - return vec![Self::StructDecl { - id, - encoding_name: None, - availability, - boxable, - fields, - sendable, - }]; + let ty = entity.get_type().expect("struct field type"); + let ty = Ty::parse_struct_field(ty, context); + + if entity.is_bit_field() { + error!("unsound struct bitfield"); + } + + fields.push((name, ty)) } - } - vec![] + EntityKind::ObjCBoxable => { + boxable = true; + } + EntityKind::UnionDecl => error!("can't handle unions in structs yet"), + _ => error!("unknown"), + }); + + return vec![Self::StructDecl { + id, + encoding_name, + availability, + boxable, + fields, + sendable, + }]; } EntityKind::EnumDecl => { // Enum declarations show up twice for some reason, but @@ -1020,7 +973,16 @@ impl Stmt { return vec![]; } - let id = ItemIdentifier::new_optional(entity, context); + let mut id = ItemIdentifier::new_optional(entity, context); + + if id + .name + .as_deref() + .map(|name| name.starts_with("enum (unnamed at")) + .unwrap_or(false) + { + id.name = None; + } let data = context .enum_data diff --git a/crates/header-translator/src/unexposed_attr.rs b/crates/header-translator/src/unexposed_attr.rs index d48db1933..8fb5ee514 100644 --- a/crates/header-translator/src/unexposed_attr.rs +++ b/crates/header-translator/src/unexposed_attr.rs @@ -121,8 +121,10 @@ impl UnexposedAttr { | "NS_DEPRECATED_MAC" | "NS_DEPRECATED" | "NS_ENUM_AVAILABLE" - | "NS_ENUM_DEPRECATED_IOS" + | "NS_ENUM_AVAILABLE_MAC" | "NS_ENUM_DEPRECATED" + | "NS_ENUM_DEPRECATED_IOS" + | "NS_ENUM_DEPRECATED_MAC" | "NS_EXTENSION_UNAVAILABLE" | "NS_OPENGL_CLASS_DEPRECATED" | "NS_OPENGL_DEPRECATED" diff --git a/crates/header-translator/translation-config.toml b/crates/header-translator/translation-config.toml index 8952d8830..0bb0d5a9a 100644 --- a/crates/header-translator/translation-config.toml +++ b/crates/header-translator/translation-config.toml @@ -757,7 +757,9 @@ initWithContentsOfURL_error = { skipped = true } dictionaryWithContentsOfURL_error = { skipped = true } # Custom implementation for now -[struct.NSRange] +[struct._NSRange] +skipped = true +[typedef.NSRange] skipped = true [enum.NSComparisonResult] skipped = true @@ -1408,7 +1410,9 @@ skipped = true skipped = true # Uses unions internally -[struct.MTLPackedFloat3] +[struct._MTLPackedFloat3] +skipped = true +[typedef.MTLPackedFloat3] skipped = true [fn.MTLPackedFloat3Make] skipped = true diff --git a/crates/icrate/CHANGELOG.md b/crates/icrate/CHANGELOG.md index 7c5fc1b0b..69231498d 100644 --- a/crates/icrate/CHANGELOG.md +++ b/crates/icrate/CHANGELOG.md @@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). passed to `MainThreadBound::get_on_main`. * **BREAKING**: Removed `Foundation::CopyHelper` since it is superseded by `objc2::mutability::CounterpartOrSelf`. +* Removed private `MetricKit::_MXSignpostMetricsSnapshot` function. ### Fixed * **BREAKING**: Added `Eq + Hash` requirement on most `NSDictionary` and diff --git a/crates/icrate/src/generated b/crates/icrate/src/generated index 74a2c0031..69af4e76b 160000 --- a/crates/icrate/src/generated +++ b/crates/icrate/src/generated @@ -1 +1 @@ -Subproject commit 74a2c003143aa172b2c300bf4a1cef0cc11fa217 +Subproject commit 69af4e76b949334b3ed213d5accfe20d64de7c76 From 36608a6558fb6f50dea4be39751c1884f90f3175 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 06:13:42 +0100 Subject: [PATCH 09/15] Change how enum constants are output --- crates/header-translator/src/library.rs | 24 +++++++++++++++++------- crates/header-translator/src/stmt.rs | 18 +++++++++--------- crates/icrate/src/generated | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/crates/header-translator/src/library.rs b/crates/header-translator/src/library.rs index dff899ad6..4243d3ece 100644 --- a/crates/header-translator/src/library.rs +++ b/crates/header-translator/src/library.rs @@ -131,12 +131,11 @@ impl fmt::Display for Library { writeln!(f)?; - for (name, file) in &self.files { + for (file_name, file) in &self.files { // NOTE: some SDK files have '+' in the file name - let name = name.replace('+', "_"); + let file_name = file_name.replace('+', "_"); for stmt in &file.stmts { - let mut iter = stmt.declared_types().filter(|item| !item.starts_with('_')); - if let Some(item) = iter.next() { + if let Some(name) = stmt.name() { // Use a set to deduplicate features, and to have them in // a consistent order let mut features = BTreeSet::new(); @@ -163,9 +162,20 @@ impl fmt::Display for Library { } } - writeln!(f, "pub use self::__{name}::{{{item}")?; - for item in iter { - writeln!(f, ", {item}")?; + let visibility = if name.starts_with('_') { + "pub(crate)" + } else { + "pub" + }; + + write!(f, "{visibility} use self::__{file_name}::{{{name}}};")?; + } + + let extra_declared_types = stmt.extra_declared_types(); + if !extra_declared_types.is_empty() { + write!(f, "pub use self::__{file_name}::{{")?; + for item in extra_declared_types { + writeln!(f, " {item},")?; } writeln!(f, "}};")?; } diff --git a/crates/header-translator/src/stmt.rs b/crates/header-translator/src/stmt.rs index c67c607f7..f7d431973 100644 --- a/crates/header-translator/src/stmt.rs +++ b/crates/header-translator/src/stmt.rs @@ -1260,7 +1260,7 @@ impl Stmt { } } - pub(crate) fn declared_types(&self) -> impl Iterator { + pub(crate) fn name(&self) -> Option<&str> { match self { Stmt::ClassDecl { id, skipped, .. } => { if *skipped { @@ -1280,14 +1280,14 @@ impl Stmt { Stmt::FnDecl { .. } => None, Stmt::AliasDecl { id, .. } => Some(&*id.name), } - .into_iter() - .chain({ - if let Stmt::EnumDecl { variants, .. } = self { - variants.iter().map(|(name, _, _)| &**name).collect() - } else { - vec![] - } - }) + } + + pub(crate) fn extra_declared_types(&self) -> Vec<&str> { + if let Stmt::EnumDecl { variants, .. } = self { + variants.iter().map(|(name, _, _)| &**name).collect() + } else { + vec![] + } } } diff --git a/crates/icrate/src/generated b/crates/icrate/src/generated index 69af4e76b..58c473adf 160000 --- a/crates/icrate/src/generated +++ b/crates/icrate/src/generated @@ -1 +1 @@ -Subproject commit 69af4e76b949334b3ed213d5accfe20d64de7c76 +Subproject commit 58c473adf6e081b6be43b62a6a1ba23c062d4d26 From 3d7d46e4a7bbc0fd54512bb073cb26f0a5679030 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 08:12:16 +0100 Subject: [PATCH 10/15] Update to Xcode 15.0.1 --- .github/workflows/ci.yml | 2 +- crates/header-translator/src/availability.rs | 9 + crates/header-translator/src/rust_type.rs | 3 +- .../header-translator/src/unexposed_attr.rs | 7 +- .../header-translator/translation-config.toml | 74 ++++- crates/icrate/CHANGELOG.md | 19 +- crates/icrate/Cargo.toml | 253 +++++++++++++++++- crates/icrate/README.md | 10 +- crates/icrate/examples/browser.rs | 11 +- .../icrate/src/additions/Foundation/bundle.rs | 4 - crates/icrate/src/generated | 2 +- 11 files changed, 375 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 413d082fb..27654313b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -259,7 +259,7 @@ jobs: - lint env: - DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer steps: - uses: actions/checkout@v3 diff --git a/crates/header-translator/src/availability.rs b/crates/header-translator/src/availability.rs index 264909101..c37d32092 100644 --- a/crates/header-translator/src/availability.rs +++ b/crates/header-translator/src/availability.rs @@ -14,6 +14,7 @@ struct Unavailable { maccatalyst: bool, watchos: bool, tvos: bool, + visionos: bool, } #[derive(Debug, Clone, PartialEq, Default)] @@ -25,6 +26,7 @@ struct Versions { maccatalyst: Option, watchos: Option, tvos: Option, + visionos: Option, } #[derive(Debug, Clone, PartialEq)] @@ -116,6 +118,12 @@ impl Availability { &mut introduced.tvos, &mut deprecated.tvos, ), + "xros" => set( + availability, + &mut unavailable.visionos, + &mut introduced.visionos, + &mut deprecated.visionos, + ), "swift" => { _swift = Some(availability); } @@ -144,6 +152,7 @@ impl fmt::Display for Availability { maccatalyst: None, watchos: None, tvos: None, + visionos: None, } => { // Not deprecated } diff --git a/crates/header-translator/src/rust_type.rs b/crates/header-translator/src/rust_type.rs index 001ed7c73..1f2d213cb 100644 --- a/crates/header-translator/src/rust_type.rs +++ b/crates/header-translator/src/rust_type.rs @@ -1684,7 +1684,8 @@ impl fmt::Display for Ty { } } Inner::C99Bool => { - panic!("C99's bool as Objective-C method return is unsupported") + warn!("C99's bool as Objective-C method return is ill supported"); + write!(f, "bool") } Inner::ObjcBool => write!(f, "bool"), ty => write!(f, "{ty}"), diff --git a/crates/header-translator/src/unexposed_attr.rs b/crates/header-translator/src/unexposed_attr.rs index 8fb5ee514..022691577 100644 --- a/crates/header-translator/src/unexposed_attr.rs +++ b/crates/header-translator/src/unexposed_attr.rs @@ -98,13 +98,15 @@ impl UnexposedAttr { | "__WATCHOS_AVAILABLE" | "API_AVAILABLE_BEGIN" | "API_AVAILABLE" - | "API_DEPRECATED_WITH_REPLACEMENT" | "API_DEPRECATED" + | "API_DEPRECATED_BEGIN" + | "API_DEPRECATED_WITH_REPLACEMENT" | "API_UNAVAILABLE_BEGIN" | "API_UNAVAILABLE" | "CF_SWIFT_UNAVAILABLE" | "CG_AVAILABLE_BUT_DEPRECATED" | "CG_AVAILABLE_STARTING" + | "CK_UNAVAILABLE" | "FPUI_AVAILABLE" | "MP_API" | "MP_DEPRECATED_WITH_REPLACEMENT" @@ -140,6 +142,9 @@ impl UnexposedAttr { let _ = get_arguments(); None } + // For some reason we don't need to extract the arguments for + // these, perhaps because they simply delegate to other macros. + "AS_API_AVAILABLE" | "AS_HEADER_AUDIT_BEGIN" => None, "__IOS_PROHIBITED" | "__IOS_UNAVAILABLE" | "__OSX_AVAILABLE_BUT_DEPRECATED" diff --git a/crates/header-translator/translation-config.toml b/crates/header-translator/translation-config.toml index 0bb0d5a9a..a5b4fa0c4 100644 --- a/crates/header-translator/translation-config.toml +++ b/crates/header-translator/translation-config.toml @@ -354,7 +354,7 @@ name = "metal" description = "Drawing a rotating triangle" [library.MetalFX] -imports = ["Metal"] +imports = ["Foundation", "Metal"] macos = "13.0" maccatalyst = "16.0" ios = "16.0" @@ -734,6 +734,10 @@ skipped = true skipped = true [class.NSString.methods.initWithValidatedFormat_validFormatSpecifiers_locale_arguments_error] skipped = true +[class.NSAttributedString.methods.initWithFormat_options_locale_context_arguments] +skipped = true +[class.NSMutableAttributedString.methods.initWithFormat_options_locale_context_arguments] +skipped = true [fn.NSLogv] skipped = true @@ -747,6 +751,14 @@ skipped = true [class.NSUserNotification.methods.setContentImage] skipped = true +# Uses , which is only available in CoreAnimation +[class.NSView.methods.displayLinkWithTarget_selector] +skipped = true +[class.NSWindow.methods.displayLinkWithTarget_selector] +skipped = true +[class.NSScreen.methods.displayLinkWithTarget_selector] +skipped = true + # Outlier that really should have been part of the original enum [enum.anonymous.constants.NSProprietaryStringEncoding] skipped = true @@ -907,6 +919,12 @@ skipped = true skipped = true [class.NSBezierPath.methods.appendBezierPathWithCGGlyphs_count_inFont] skipped = true +[class.NSBezierPath.methods.bezierPathWithCGPath] +skipped = true +[class.NSBezierPath.methods.CGPath] +skipped = true +[class.NSBezierPath.methods.setCGPath] +skipped = true [class.NSBitmapImageRep.methods.initWithCGImage] skipped = true [class.NSBitmapImageRep.methods.initWithCIImage] @@ -1206,6 +1224,20 @@ skipped = true skipped = true [protocol.GCDevice.methods.setHandlerQueue] skipped = true +# Needs `dispatch_queue_t` +[class.CLLocationUpdater.methods.liveUpdaterWithQueue_handler] +skipped = true +[class.CLLocationUpdater.methods.liveUpdaterWithConfiguration_queue_handler] +skipped = true +[class.CLMonitorConfiguration.methods.queue] +skipped = true +[class.CLMonitorConfiguration.methods.configWithMonitorName_queue_eventHandler] +skipped = true +# Needs `dispatch_queue_t` +[protocol.GCDevicePhysicalInput.methods.queue] +skipped = true +[protocol.GCDevicePhysicalInput.methods.setQueue] +skipped = true # Needs `CFIndex` (fixed locally for now) [typedef.GCKeyCode] skipped = true @@ -1222,11 +1254,33 @@ skipped = true skipped = true [class.SNClassificationResult.methods.timeRange] skipped = true -# NEeds `CMTime` +[class._SFSpeechAnalyzer.methods.initWithClientIdentifier_inputSequence_audioFormat_transcriberResultDelegate_endpointingResultDelegate_queue_transcriberOptions_commandRecognizerOptions_options_restrictedLogging_geoLMRegionID_contextualNamedEntities_didChangeVolatileRange] +skipped = true +[class._SFTranscriberResult.methods.range] +skipped = true +[class._SFTranscriberResult.methods.initWithRange_normalizedTranscriberMultisegmentResult_normalizedCommandRecognizerResult_contextualizedTranscriberMultisegmentResult_contextualizedCommandRecognizerResult] +skipped = true +[class._STTranscriberMultisegmentResult.methods.recognitionAudioRange] +skipped = true +[class._STTranscriberMultisegmentResult.methods.initWithSegments_transcriptions_earResultType_nBestChoices_recognitionAudioRange] +skipped = true +[class._SFEndpointingResult.methods.range] +skipped = true +[class._SFEndpointingResult.methods.initWithRange_wordCount_eosLikelihood_pauseCounts_silencePosterior] +skipped = true +# Needs `CMTime` [class.SNClassifySoundRequest.methods.setWindowDuration] skipped = true [class.SNClassifySoundRequest.methods.windowDuration] skipped = true +[class._SFSpeechAnalyzer.methods.getNextBufferStartTimeWithCompletion] +skipped = true +[class._SFSpeechAnalyzer.methods.setDidChangeVolatileRange_completion] +skipped = true +[class._SFSpeechAnalyzer.methods.finalizeThrough_completion] +skipped = true +[class._SFSpeechAnalyzer.methods.finalizeAndFinishThrough_completion] +skipped = true # Needs `SecAccessControlRef` from Security [class.LAContext.methods.evaluateAccessControl_operation_localizedReason_reply] skipped = true @@ -1251,6 +1305,11 @@ skipped = true skipped = true [class.LAPublicKey.methods.verifyData_signature_secKeyAlgorithm_completion] skipped = true +# Needs `SecKeyRef` from Security +[class.ASAuthorizationProviderExtensionLoginConfiguration.methods.loginRequestEncryptionPublicKey] +skipped = true +[class.ASAuthorizationProviderExtensionLoginConfiguration.methods.setLoginRequestEncryptionPublicKey] +skipped = true # Needs `CGImagePropertyOrientation` from `ImageIO` [class.PHLivePhotoEditingContext.methods.orientation] skipped = true @@ -1290,6 +1349,13 @@ skipped = true [protocol.ASAuthorizationWebBrowserExternallyAuthenticatableRequest.methods] authenticatedContext = { skipped = true } setAuthenticatedContext = { skipped = true } +# Needs `pid_t` +[class.MXMetaData.methods.pid] +skipped = true +# Needs `nw_proxy_config_t` +[class.WKWebsiteDataStore.methods] +proxyConfigurations = { skipped = true } +setProxyConfigurations = { skipped = true } # Uses a pointer to SEL, which doesn't implement Encode yet [protocol.NSMenuDelegate.methods] @@ -1551,6 +1617,10 @@ skipped = true [static.GCInputRightPaddle] skipped = true +# Uses GCInputButtonName +[fn.GCInputArcadeButtonName] +skipped = true + # tries to derive with `PartialEq` which fails because of `Bool` fields; manually define for now [struct.GCExtendedGamepadSnapshotData] skipped = true diff --git a/crates/icrate/CHANGELOG.md b/crates/icrate/CHANGELOG.md index 69231498d..6ff1ee68f 100644 --- a/crates/icrate/CHANGELOG.md +++ b/crates/icrate/CHANGELOG.md @@ -24,9 +24,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). be more efficient than the previous insertion methods. ### Changed +* Updated SDK from Xcode 14.2 to 15.0.1. + + View the release notes to learn more details: + - [14.3](https://developer.apple.com/documentation/xcode-release-notes/xcode-14_3-release-notes) + - [14.3.1](https://developer.apple.com/documentation/xcode-release-notes/xcode-14_3_1-release-notes) + - [15.0](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes) + - [15.0.1](https://developer.apple.com/documentation/xcode-release-notes/xcode-15_0_1-release-notes) + + Breaking changes are noted elsewhere in this changelog entry. * Moved the `ns_string!` macro to `icrate::Foundation::ns_string`. The old location in the crate root is deprecated. -* Use SDK from Xcode 14.3.1 (previously Xcode 14.2). * **BREAKING**: The following two methods on `MTLAccelerationStructureCommandEncoder` now take a nullable scratch buffer: - `refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset` @@ -54,12 +62,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). `NS[Mutable]Dictionary::from_vec`. * **BREAKING**: Renamed `NSMutableDictionary::insert` and `NSMutableSet::insert` to `insert_id`. +- **BREAKING**: `CWWiFiClient::interfaceNames` has been renamed to `CWWiFiClient::interfaceNames_class`. ### Removed * **BREAKING**: Removed the `MainThreadMarker` argument from the closure passed to `MainThreadBound::get_on_main`. * **BREAKING**: Removed `Foundation::CopyHelper` since it is superseded by `objc2::mutability::CounterpartOrSelf`. +* **BREAKING**: Removed the following APIs, as they are no longer available in macOS 14 / iOS 17: + - `NSFileProviderDomain::volumeUUID` + - `CLBeaconIdentityConstraint::UUID` + - `CLBeaconIdentityConstraint::major` + - `CLBeaconIdentityConstraint::minor` + - `ASIdentifierManager::clearAdvertisingIdentifier` * Removed private `MetricKit::_MXSignpostMetricsSnapshot` function. ### Fixed @@ -77,6 +92,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). `AnyObject` instead of the correct `ProtocolObject`). * Update the minimum deployment target, which adds a few missing protocol implementations and methods for `NSPopover` and `NSLayoutAnchor`. +- **BREAKING**: `CKSystemSharingUIObserver` and `CKLocationSortDescriptor` are no longer marked thread safe. +- **BREAKING**: `NSColor::ignoresAlpha` now requires a main thread marker. ## icrate 0.0.4 - 2023-07-31 diff --git a/crates/icrate/Cargo.toml b/crates/icrate/Cargo.toml index f9f1016ac..0371f1535 100644 --- a/crates/icrate/Cargo.toml +++ b/crates/icrate/Cargo.toml @@ -495,6 +495,7 @@ AppKit_NSMatrix = [ AppKit_NSMediaLibraryBrowserController = [] AppKit_NSMenu = [] AppKit_NSMenuItem = [] +AppKit_NSMenuItemBadge = [] AppKit_NSMenuItemCell = [ "AppKit_NSButtonCell", ] @@ -757,6 +758,9 @@ AppKit_NSTextFieldCell = [ ] AppKit_NSTextFinder = [] AppKit_NSTextInputContext = [] +AppKit_NSTextInsertionIndicator = [ + "AppKit_NSView", +] AppKit_NSTextLayoutFragment = [] AppKit_NSTextLayoutManager = [] AppKit_NSTextLineFragment = [] @@ -967,6 +971,7 @@ AppKit_all = [ "AppKit_NSMediaLibraryBrowserController", "AppKit_NSMenu", "AppKit_NSMenuItem", + "AppKit_NSMenuItemBadge", "AppKit_NSMenuItemCell", "AppKit_NSMenuToolbarItem", "AppKit_NSMovie", @@ -1089,6 +1094,7 @@ AppKit_all = [ "AppKit_NSTextFieldCell", "AppKit_NSTextFinder", "AppKit_NSTextInputContext", + "AppKit_NSTextInsertionIndicator", "AppKit_NSTextLayoutFragment", "AppKit_NSTextLayoutManager", "AppKit_NSTextLineFragment", @@ -1184,6 +1190,11 @@ AuthenticationServices_ASAuthorizationProviderExtensionAuthorizationResult = [] AuthenticationServices_ASAuthorizationProviderExtensionKerberosMapping = [] AuthenticationServices_ASAuthorizationProviderExtensionLoginConfiguration = [] AuthenticationServices_ASAuthorizationProviderExtensionLoginManager = [] +AuthenticationServices_ASAuthorizationProviderExtensionUserLoginConfiguration = [] +AuthenticationServices_ASAuthorizationPublicKeyCredentialLargeBlobAssertionInput = [] +AuthenticationServices_ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput = [] +AuthenticationServices_ASAuthorizationPublicKeyCredentialLargeBlobRegistrationInput = [] +AuthenticationServices_ASAuthorizationPublicKeyCredentialLargeBlobRegistrationOutput = [] AuthenticationServices_ASAuthorizationPublicKeyCredentialParameters = [] AuthenticationServices_ASAuthorizationRequest = [] AuthenticationServices_ASAuthorizationSecurityKeyPublicKeyCredentialAssertion = [] @@ -1212,8 +1223,16 @@ AuthenticationServices_ASCredentialProviderViewController = [ "AppKit_NSViewController", ] AuthenticationServices_ASCredentialServiceIdentifier = [] +AuthenticationServices_ASPasskeyAssertionCredential = [] +AuthenticationServices_ASPasskeyCredentialIdentity = [] +AuthenticationServices_ASPasskeyCredentialRequest = [] +AuthenticationServices_ASPasskeyCredentialRequestParameters = [] +AuthenticationServices_ASPasskeyRegistrationCredential = [] AuthenticationServices_ASPasswordCredential = [] AuthenticationServices_ASPasswordCredentialIdentity = [] +AuthenticationServices_ASPasswordCredentialRequest = [] +AuthenticationServices_ASPublicKeyCredentialClientData = [] +AuthenticationServices_ASSettingsHelper = [] AuthenticationServices_ASWebAuthenticationSession = [] AuthenticationServices_ASWebAuthenticationSessionRequest = [] AuthenticationServices_ASWebAuthenticationSessionWebBrowserSessionManager = [] @@ -1245,6 +1264,11 @@ AuthenticationServices_all = [ "AuthenticationServices_ASAuthorizationProviderExtensionKerberosMapping", "AuthenticationServices_ASAuthorizationProviderExtensionLoginConfiguration", "AuthenticationServices_ASAuthorizationProviderExtensionLoginManager", + "AuthenticationServices_ASAuthorizationProviderExtensionUserLoginConfiguration", + "AuthenticationServices_ASAuthorizationPublicKeyCredentialLargeBlobAssertionInput", + "AuthenticationServices_ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput", + "AuthenticationServices_ASAuthorizationPublicKeyCredentialLargeBlobRegistrationInput", + "AuthenticationServices_ASAuthorizationPublicKeyCredentialLargeBlobRegistrationOutput", "AuthenticationServices_ASAuthorizationPublicKeyCredentialParameters", "AuthenticationServices_ASAuthorizationRequest", "AuthenticationServices_ASAuthorizationSecurityKeyPublicKeyCredentialAssertion", @@ -1263,8 +1287,16 @@ AuthenticationServices_all = [ "AuthenticationServices_ASCredentialProviderExtensionContext", "AuthenticationServices_ASCredentialProviderViewController", "AuthenticationServices_ASCredentialServiceIdentifier", + "AuthenticationServices_ASPasskeyAssertionCredential", + "AuthenticationServices_ASPasskeyCredentialIdentity", + "AuthenticationServices_ASPasskeyCredentialRequest", + "AuthenticationServices_ASPasskeyCredentialRequestParameters", + "AuthenticationServices_ASPasskeyRegistrationCredential", "AuthenticationServices_ASPasswordCredential", "AuthenticationServices_ASPasswordCredentialIdentity", + "AuthenticationServices_ASPasswordCredentialRequest", + "AuthenticationServices_ASPublicKeyCredentialClientData", + "AuthenticationServices_ASSettingsHelper", "AuthenticationServices_ASWebAuthenticationSession", "AuthenticationServices_ASWebAuthenticationSessionRequest", "AuthenticationServices_ASWebAuthenticationSessionWebBrowserSessionManager", @@ -1342,6 +1374,12 @@ BackgroundTasks_BGAppRefreshTask = [ BackgroundTasks_BGAppRefreshTaskRequest = [ "BackgroundTasks_BGTaskRequest", ] +BackgroundTasks_BGHealthResearchTask = [ + "BackgroundTasks_BGProcessingTask", +] +BackgroundTasks_BGHealthResearchTaskRequest = [ + "BackgroundTasks_BGProcessingTaskRequest", +] BackgroundTasks_BGProcessingTask = [ "BackgroundTasks_BGTask", ] @@ -1355,6 +1393,8 @@ BackgroundTasks_all = [ "BackgroundTasks", "BackgroundTasks_BGAppRefreshTask", "BackgroundTasks_BGAppRefreshTaskRequest", + "BackgroundTasks_BGHealthResearchTask", + "BackgroundTasks_BGHealthResearchTaskRequest", "BackgroundTasks_BGProcessingTask", "BackgroundTasks_BGProcessingTaskRequest", "BackgroundTasks_BGTask", @@ -1590,6 +1630,66 @@ CloudKit_CKShare = [ CloudKit_CKShareMetadata = [] CloudKit_CKShareParticipant = [] CloudKit_CKSubscription = [] +CloudKit_CKSyncEngine = [] +CloudKit_CKSyncEngineAccountChangeEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineConfiguration = [] +CloudKit_CKSyncEngineDidFetchChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineDidFetchRecordZoneChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineDidSendChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineEvent = [] +CloudKit_CKSyncEngineFailedRecordSave = [] +CloudKit_CKSyncEngineFailedZoneSave = [] +CloudKit_CKSyncEngineFetchChangesContext = [] +CloudKit_CKSyncEngineFetchChangesOptions = [] +CloudKit_CKSyncEngineFetchChangesScope = [] +CloudKit_CKSyncEngineFetchedDatabaseChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineFetchedRecordDeletion = [] +CloudKit_CKSyncEngineFetchedRecordZoneChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineFetchedZoneDeletion = [] +CloudKit_CKSyncEnginePendingDatabaseChange = [] +CloudKit_CKSyncEnginePendingRecordZoneChange = [] +CloudKit_CKSyncEnginePendingZoneDelete = [ + "CloudKit_CKSyncEnginePendingDatabaseChange", +] +CloudKit_CKSyncEnginePendingZoneSave = [ + "CloudKit_CKSyncEnginePendingDatabaseChange", +] +CloudKit_CKSyncEngineRecordZoneChangeBatch = [] +CloudKit_CKSyncEngineSendChangesContext = [] +CloudKit_CKSyncEngineSendChangesOptions = [] +CloudKit_CKSyncEngineSendChangesScope = [] +CloudKit_CKSyncEngineSentDatabaseChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineSentRecordZoneChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineState = [] +CloudKit_CKSyncEngineStateSerialization = [] +CloudKit_CKSyncEngineStateUpdateEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineWillFetchChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineWillFetchRecordZoneChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] +CloudKit_CKSyncEngineWillSendChangesEvent = [ + "CloudKit_CKSyncEngineEvent", +] CloudKit_CKSystemSharingUIObserver = [] CloudKit_CKUserIdentity = [] CloudKit_CKUserIdentityLookupInfo = [] @@ -1646,6 +1746,38 @@ CloudKit_all = [ "CloudKit_CKShareMetadata", "CloudKit_CKShareParticipant", "CloudKit_CKSubscription", + "CloudKit_CKSyncEngine", + "CloudKit_CKSyncEngineAccountChangeEvent", + "CloudKit_CKSyncEngineConfiguration", + "CloudKit_CKSyncEngineDidFetchChangesEvent", + "CloudKit_CKSyncEngineDidFetchRecordZoneChangesEvent", + "CloudKit_CKSyncEngineDidSendChangesEvent", + "CloudKit_CKSyncEngineEvent", + "CloudKit_CKSyncEngineFailedRecordSave", + "CloudKit_CKSyncEngineFailedZoneSave", + "CloudKit_CKSyncEngineFetchChangesContext", + "CloudKit_CKSyncEngineFetchChangesOptions", + "CloudKit_CKSyncEngineFetchChangesScope", + "CloudKit_CKSyncEngineFetchedDatabaseChangesEvent", + "CloudKit_CKSyncEngineFetchedRecordDeletion", + "CloudKit_CKSyncEngineFetchedRecordZoneChangesEvent", + "CloudKit_CKSyncEngineFetchedZoneDeletion", + "CloudKit_CKSyncEnginePendingDatabaseChange", + "CloudKit_CKSyncEnginePendingRecordZoneChange", + "CloudKit_CKSyncEnginePendingZoneDelete", + "CloudKit_CKSyncEnginePendingZoneSave", + "CloudKit_CKSyncEngineRecordZoneChangeBatch", + "CloudKit_CKSyncEngineSendChangesContext", + "CloudKit_CKSyncEngineSendChangesOptions", + "CloudKit_CKSyncEngineSendChangesScope", + "CloudKit_CKSyncEngineSentDatabaseChangesEvent", + "CloudKit_CKSyncEngineSentRecordZoneChangesEvent", + "CloudKit_CKSyncEngineState", + "CloudKit_CKSyncEngineStateSerialization", + "CloudKit_CKSyncEngineStateUpdateEvent", + "CloudKit_CKSyncEngineWillFetchChangesEvent", + "CloudKit_CKSyncEngineWillFetchRecordZoneChangesEvent", + "CloudKit_CKSyncEngineWillSendChangesEvent", "CloudKit_CKSystemSharingUIObserver", "CloudKit_CKUserIdentity", "CloudKit_CKUserIdentityLookupInfo", @@ -1788,6 +1920,8 @@ CoreAnimation_CAKeyframeAnimation = [ ] CoreAnimation_CALayer = [] CoreAnimation_CAMediaTimingFunction = [] +CoreAnimation_CAMetalDisplayLink = [] +CoreAnimation_CAMetalDisplayLinkUpdate = [] CoreAnimation_CAPropertyAnimation = [ "CoreAnimation_CAAnimation", ] @@ -1835,6 +1969,8 @@ CoreAnimation_all = [ "CoreAnimation_CAKeyframeAnimation", "CoreAnimation_CALayer", "CoreAnimation_CAMediaTimingFunction", + "CoreAnimation_CAMetalDisplayLink", + "CoreAnimation_CAMetalDisplayLinkUpdate", "CoreAnimation_CAPropertyAnimation", "CoreAnimation_CARemoteLayerClient", "CoreAnimation_CARemoteLayerServer", @@ -1885,8 +2021,14 @@ CoreData_NSBatchUpdateRequest = [ CoreData_NSBatchUpdateResult = [ "CoreData_NSPersistentStoreResult", ] +CoreData_NSCompositeAttributeDescription = [ + "CoreData_NSAttributeDescription", +] CoreData_NSConstraintConflict = [] CoreData_NSCoreDataCoreSpotlightDelegate = [] +CoreData_NSCustomMigrationStage = [ + "CoreData_NSMigrationStage", +] CoreData_NSDerivedAttributeDescription = [ "CoreData_NSAttributeDescription", ] @@ -1912,14 +2054,19 @@ CoreData_NSIncrementalStore = [ "CoreData_NSPersistentStore", ] CoreData_NSIncrementalStoreNode = [] +CoreData_NSLightweightMigrationStage = [ + "CoreData_NSMigrationStage", +] CoreData_NSManagedObject = [] CoreData_NSManagedObjectContext = [] CoreData_NSManagedObjectID = [] CoreData_NSManagedObjectModel = [] +CoreData_NSManagedObjectModelReference = [] CoreData_NSMappingModel = [] CoreData_NSMergeConflict = [] CoreData_NSMergePolicy = [] CoreData_NSMigrationManager = [] +CoreData_NSMigrationStage = [] CoreData_NSPersistentCloudKitContainer = [ "CoreData_NSPersistentContainer", ] @@ -1958,6 +2105,7 @@ CoreData_NSRelationshipDescription = [ CoreData_NSSaveChangesRequest = [ "CoreData_NSPersistentStoreRequest", ] +CoreData_NSStagedMigrationManager = [] CoreData_all = [ "CoreData", "CoreData_NSAsynchronousFetchRequest", @@ -1971,8 +2119,10 @@ CoreData_all = [ "CoreData_NSBatchInsertResult", "CoreData_NSBatchUpdateRequest", "CoreData_NSBatchUpdateResult", + "CoreData_NSCompositeAttributeDescription", "CoreData_NSConstraintConflict", "CoreData_NSCoreDataCoreSpotlightDelegate", + "CoreData_NSCustomMigrationStage", "CoreData_NSDerivedAttributeDescription", "CoreData_NSEntityDescription", "CoreData_NSEntityMapping", @@ -1986,14 +2136,17 @@ CoreData_all = [ "CoreData_NSFetchedResultsController", "CoreData_NSIncrementalStore", "CoreData_NSIncrementalStoreNode", + "CoreData_NSLightweightMigrationStage", "CoreData_NSManagedObject", "CoreData_NSManagedObjectContext", "CoreData_NSManagedObjectID", "CoreData_NSManagedObjectModel", + "CoreData_NSManagedObjectModelReference", "CoreData_NSMappingModel", "CoreData_NSMergeConflict", "CoreData_NSMergePolicy", "CoreData_NSMigrationManager", + "CoreData_NSMigrationStage", "CoreData_NSPersistentCloudKitContainer", "CoreData_NSPersistentCloudKitContainerEvent", "CoreData_NSPersistentCloudKitContainerEventRequest", @@ -2016,43 +2169,70 @@ CoreData_all = [ "CoreData_NSQueryGenerationToken", "CoreData_NSRelationshipDescription", "CoreData_NSSaveChangesRequest", + "CoreData_NSStagedMigrationManager", ] CoreLocation = [ "Contacts", "Foundation", "CoreLocation_CLPlacemark", ] +CoreLocation_CLBackgroundActivitySession = [] CoreLocation_CLBeacon = [] -CoreLocation_CLBeaconIdentityConstraint = [] +CoreLocation_CLBeaconIdentityCondition = [ + "CoreLocation_CLCondition", +] +CoreLocation_CLBeaconIdentityConstraint = [ + "CoreLocation_CLBeaconIdentityCondition", +] CoreLocation_CLBeaconRegion = [ "CoreLocation_CLRegion", ] +CoreLocation_CLCircularGeographicCondition = [ + "CoreLocation_CLCondition", +] CoreLocation_CLCircularRegion = [ "CoreLocation_CLRegion", ] +CoreLocation_CLCondition = [] CoreLocation_CLFloor = [] CoreLocation_CLGeocoder = [] CoreLocation_CLHeading = [] CoreLocation_CLLocation = [] CoreLocation_CLLocationManager = [] CoreLocation_CLLocationSourceInformation = [] +CoreLocation_CLLocationUpdater = [] +CoreLocation_CLMonitor = [] +CoreLocation_CLMonitorConfiguration = [] +CoreLocation_CLMonitoringEvent = [] +CoreLocation_CLMonitoringRecord = [] CoreLocation_CLPlacemark = [] CoreLocation_CLRegion = [] +CoreLocation_CLUpdate = [] CoreLocation_CLVisit = [] CoreLocation_all = [ "CoreLocation", + "CoreLocation_CLBackgroundActivitySession", "CoreLocation_CLBeacon", + "CoreLocation_CLBeaconIdentityCondition", "CoreLocation_CLBeaconIdentityConstraint", "CoreLocation_CLBeaconRegion", + "CoreLocation_CLCircularGeographicCondition", "CoreLocation_CLCircularRegion", + "CoreLocation_CLCondition", "CoreLocation_CLFloor", "CoreLocation_CLGeocoder", "CoreLocation_CLHeading", "CoreLocation_CLLocation", "CoreLocation_CLLocationManager", "CoreLocation_CLLocationSourceInformation", + "CoreLocation_CLLocationUpdater", + "CoreLocation_CLMonitor", + "CoreLocation_CLMonitorConfiguration", + "CoreLocation_CLMonitoringEvent", + "CoreLocation_CLMonitoringRecord", "CoreLocation_CLPlacemark", "CoreLocation_CLRegion", + "CoreLocation_CLUpdate", "CoreLocation_CLVisit", ] CoreWLAN = [ @@ -2477,6 +2657,7 @@ Foundation_NSMiddleSpecifier = [ ] Foundation_NSMorphology = [] Foundation_NSMorphologyCustomPronoun = [] +Foundation_NSMorphologyPronoun = [] Foundation_NSMoveCommand = [ "Foundation_NSScriptCommand", ] @@ -2615,6 +2796,7 @@ Foundation_NSSpellServer = [] Foundation_NSStream = [] Foundation_NSString = [] Foundation_NSTask = [] +Foundation_NSTermOfAddress = [] Foundation_NSTextCheckingResult = [] Foundation_NSThread = [] Foundation_NSTimeZone = [] @@ -2888,6 +3070,7 @@ Foundation_all = [ "Foundation_NSMiddleSpecifier", "Foundation_NSMorphology", "Foundation_NSMorphologyCustomPronoun", + "Foundation_NSMorphologyPronoun", "Foundation_NSMoveCommand", "Foundation_NSMutableArray", "Foundation_NSMutableAttributedString", @@ -2962,6 +3145,7 @@ Foundation_all = [ "Foundation_NSStream", "Foundation_NSString", "Foundation_NSTask", + "Foundation_NSTermOfAddress", "Foundation_NSTextCheckingResult", "Foundation_NSThread", "Foundation_NSTimeZone", @@ -3072,6 +3256,10 @@ GameController_GCControllerDirectionPad = [ "GameController_GCControllerElement", ] GameController_GCControllerElement = [] +GameController_GCControllerInputState = [] +GameController_GCControllerLiveInput = [ + "GameController_GCControllerInputState", +] GameController_GCControllerTouchpad = [ "GameController_GCControllerElement", ] @@ -3143,6 +3331,8 @@ GameController_all = [ "GameController_GCControllerButtonInput", "GameController_GCControllerDirectionPad", "GameController_GCControllerElement", + "GameController_GCControllerInputState", + "GameController_GCControllerLiveInput", "GameController_GCControllerTouchpad", "GameController_GCDeviceBattery", "GameController_GCDeviceCursor", @@ -4085,6 +4275,7 @@ Metal = [ "Foundation", ] MetalFX = [ + "Foundation", "Metal", ] MetalFX_MTLFXSpatialScalerDescriptor = [] @@ -4121,11 +4312,17 @@ MetalKit_all = [ Metal_MTLAccelerationStructureBoundingBoxGeometryDescriptor = [ "Metal_MTLAccelerationStructureGeometryDescriptor", ] +Metal_MTLAccelerationStructureCurveGeometryDescriptor = [ + "Metal_MTLAccelerationStructureGeometryDescriptor", +] Metal_MTLAccelerationStructureDescriptor = [] Metal_MTLAccelerationStructureGeometryDescriptor = [] Metal_MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor = [ "Metal_MTLAccelerationStructureGeometryDescriptor", ] +Metal_MTLAccelerationStructureMotionCurveGeometryDescriptor = [ + "Metal_MTLAccelerationStructureGeometryDescriptor", +] Metal_MTLAccelerationStructureMotionTriangleGeometryDescriptor = [ "Metal_MTLAccelerationStructureGeometryDescriptor", ] @@ -4135,6 +4332,7 @@ Metal_MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray = [] Metal_MTLAccelerationStructureTriangleGeometryDescriptor = [ "Metal_MTLAccelerationStructureGeometryDescriptor", ] +Metal_MTLArchitecture = [] Metal_MTLArgument = [] Metal_MTLArgumentDescriptor = [] Metal_MTLArrayType = [ @@ -4170,6 +4368,9 @@ Metal_MTLFunctionStitchingInputNode = [] Metal_MTLHeapDescriptor = [] Metal_MTLIOCommandQueueDescriptor = [] Metal_MTLIndirectCommandBufferDescriptor = [] +Metal_MTLIndirectInstanceAccelerationStructureDescriptor = [ + "Metal_MTLAccelerationStructureDescriptor", +] Metal_MTLInstanceAccelerationStructureDescriptor = [ "Metal_MTLAccelerationStructureDescriptor", ] @@ -4243,14 +4444,17 @@ Metal_MTLVisibleFunctionTableDescriptor = [] Metal_all = [ "Metal", "Metal_MTLAccelerationStructureBoundingBoxGeometryDescriptor", + "Metal_MTLAccelerationStructureCurveGeometryDescriptor", "Metal_MTLAccelerationStructureDescriptor", "Metal_MTLAccelerationStructureGeometryDescriptor", "Metal_MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor", + "Metal_MTLAccelerationStructureMotionCurveGeometryDescriptor", "Metal_MTLAccelerationStructureMotionTriangleGeometryDescriptor", "Metal_MTLAccelerationStructurePassDescriptor", "Metal_MTLAccelerationStructurePassSampleBufferAttachmentDescriptor", "Metal_MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray", "Metal_MTLAccelerationStructureTriangleGeometryDescriptor", + "Metal_MTLArchitecture", "Metal_MTLArgument", "Metal_MTLArgumentDescriptor", "Metal_MTLArrayType", @@ -4284,6 +4488,7 @@ Metal_all = [ "Metal_MTLHeapDescriptor", "Metal_MTLIOCommandQueueDescriptor", "Metal_MTLIndirectCommandBufferDescriptor", + "Metal_MTLIndirectInstanceAccelerationStructureDescriptor", "Metal_MTLInstanceAccelerationStructureDescriptor", "Metal_MTLIntersectionFunctionDescriptor", "Metal_MTLIntersectionFunctionTableDescriptor", @@ -4373,6 +4578,7 @@ MetricKit_MXCellularConditionMetric = [ MetricKit_MXCrashDiagnostic = [ "MetricKit_MXDiagnostic", ] +MetricKit_MXCrashDiagnosticObjectiveCExceptionReason = [] MetricKit_MXDiagnostic = [] MetricKit_MXDiagnosticPayload = [] MetricKit_MXDiskIOMetric = [ @@ -4410,6 +4616,7 @@ MetricKit_MXSignpostIntervalData = [] MetricKit_MXSignpostMetric = [ "MetricKit_MXMetric", ] +MetricKit_MXSignpostRecord = [] MetricKit_MXUnitAveragePixelLuminance = [ "Foundation_NSDimension", ] @@ -4431,6 +4638,7 @@ MetricKit_all = [ "MetricKit_MXCallStackTree", "MetricKit_MXCellularConditionMetric", "MetricKit_MXCrashDiagnostic", + "MetricKit_MXCrashDiagnosticObjectiveCExceptionReason", "MetricKit_MXDiagnostic", "MetricKit_MXDiagnosticPayload", "MetricKit_MXDiskIOMetric", @@ -4450,6 +4658,7 @@ MetricKit_all = [ "MetricKit_MXNetworkTransferMetric", "MetricKit_MXSignpostIntervalData", "MetricKit_MXSignpostMetric", + "MetricKit_MXSignpostRecord", "MetricKit_MXUnitAveragePixelLuminance", "MetricKit_MXUnitSignalBars", ] @@ -4613,6 +4822,8 @@ Speech_SFAcousticFeature = [] Speech_SFSpeechAudioBufferRecognitionRequest = [ "Speech_SFSpeechRecognitionRequest", ] +Speech_SFSpeechLanguageModel = [] +Speech_SFSpeechLanguageModelConfiguration = [] Speech_SFSpeechRecognitionMetadata = [] Speech_SFSpeechRecognitionRequest = [] Speech_SFSpeechRecognitionResult = [] @@ -4624,10 +4835,31 @@ Speech_SFSpeechURLRecognitionRequest = [ Speech_SFTranscription = [] Speech_SFTranscriptionSegment = [] Speech_SFVoiceAnalytics = [] +Speech__SFAnalysisContext = [] +Speech__SFAnalyzerTranscriptionSegment = [] +Speech__SFCommandRecognizerArgument = [] +Speech__SFCommandRecognizerInterpretation = [] +Speech__SFContextualNamedEntity = [] +Speech__SFEndpointingResult = [] +Speech__SFInputSequencer = [] +Speech__SFModelDownloadRequest = [] +Speech__SFSpeechAnalyzer = [] +Speech__SFSpeechAnalyzerCommandRecognizerOptions = [] +Speech__SFSpeechAnalyzerOptions = [] +Speech__SFSpeechAnalyzerOptionsLoggingInfo = [] +Speech__SFSpeechAnalyzerOptionsPowerContext = [] +Speech__SFSpeechAnalyzerTranscriberOptions = [] +Speech__SFToken = [] +Speech__SFTranscriberModelOptions = [] +Speech__SFTranscriberResult = [] +Speech__STCommandRecognizerResult = [] +Speech__STTranscriberMultisegmentResult = [] Speech_all = [ "Speech", "Speech_SFAcousticFeature", "Speech_SFSpeechAudioBufferRecognitionRequest", + "Speech_SFSpeechLanguageModel", + "Speech_SFSpeechLanguageModelConfiguration", "Speech_SFSpeechRecognitionMetadata", "Speech_SFSpeechRecognitionRequest", "Speech_SFSpeechRecognitionResult", @@ -4637,6 +4869,25 @@ Speech_all = [ "Speech_SFTranscription", "Speech_SFTranscriptionSegment", "Speech_SFVoiceAnalytics", + "Speech__SFAnalysisContext", + "Speech__SFAnalyzerTranscriptionSegment", + "Speech__SFCommandRecognizerArgument", + "Speech__SFCommandRecognizerInterpretation", + "Speech__SFContextualNamedEntity", + "Speech__SFEndpointingResult", + "Speech__SFInputSequencer", + "Speech__SFModelDownloadRequest", + "Speech__SFSpeechAnalyzer", + "Speech__SFSpeechAnalyzerCommandRecognizerOptions", + "Speech__SFSpeechAnalyzerOptions", + "Speech__SFSpeechAnalyzerOptionsLoggingInfo", + "Speech__SFSpeechAnalyzerOptionsPowerContext", + "Speech__SFSpeechAnalyzerTranscriberOptions", + "Speech__SFToken", + "Speech__SFTranscriberModelOptions", + "Speech__SFTranscriberResult", + "Speech__STCommandRecognizerResult", + "Speech__STTranscriberMultisegmentResult", ] StoreKit = [ "AppKit", diff --git a/crates/icrate/README.md b/crates/icrate/README.md index a3db5e986..5f3bdf130 100644 --- a/crates/icrate/README.md +++ b/crates/icrate/README.md @@ -12,11 +12,11 @@ This README is kept intentionally small in an effort to consolidate the document ## Supported versions -These bindings are automatically generated from the SDKs in Xcode 14.3.1 (will +These bindings are automatically generated from the SDKs in Xcode 15.0.1 (will be periodically updated). Currently supports: -- macOS: `10.12-13.1` -- iOS/iPadOS: `10.0-16.2` (WIP) -- tvOS: `10.0-16.1` (WIP) -- watchOS: `5.0-9.1` (WIP) +- macOS: `10.12-14.0` +- iOS/iPadOS: `10.0-17.0` (WIP) +- tvOS: `10.0-17.0` (WIP) +- watchOS: `5.0-10.0` (WIP) diff --git a/crates/icrate/examples/browser.rs b/crates/icrate/examples/browser.rs index 1bc466863..c56c32468 100644 --- a/crates/icrate/examples/browser.rs +++ b/crates/icrate/examples/browser.rs @@ -1,6 +1,7 @@ #![deny(unsafe_op_in_unsafe_fn)] use core::{cell::OnceCell, ptr::NonNull}; +#[allow(deprecated)] use icrate::{ AppKit::{ NSApplication, NSApplicationActivationPolicyRegular, NSApplicationDelegate, @@ -139,7 +140,10 @@ declare_class!( let action = Some(sel!(goBack)); let this = unsafe { NSButton::buttonWithTitle_target_action(title, target, action, mtm) }; - unsafe { this.setBezelStyle(NSBezelStyleShadowlessSquare) }; + #[allow(deprecated)] + unsafe { + this.setBezelStyle(NSBezelStyleShadowlessSquare) + }; this }; @@ -151,7 +155,10 @@ declare_class!( let action = Some(sel!(goForward)); let this = unsafe { NSButton::buttonWithTitle_target_action(title, target, action, mtm) }; - unsafe { this.setBezelStyle(NSBezelStyleShadowlessSquare) }; + #[allow(deprecated)] + unsafe { + this.setBezelStyle(NSBezelStyleShadowlessSquare) + }; this }; diff --git a/crates/icrate/src/additions/Foundation/bundle.rs b/crates/icrate/src/additions/Foundation/bundle.rs index 58d824cc1..476f2b9e3 100644 --- a/crates/icrate/src/additions/Foundation/bundle.rs +++ b/crates/icrate/src/additions/Foundation/bundle.rs @@ -4,10 +4,6 @@ use core::panic::{RefUnwindSafe, UnwindSafe}; use crate::common::*; use crate::Foundation::{self, NSBundle}; -// SAFETY: Bundles are documented as thread-safe. -unsafe impl Sync for NSBundle {} -unsafe impl Send for NSBundle {} - impl UnwindSafe for NSBundle {} impl RefUnwindSafe for NSBundle {} diff --git a/crates/icrate/src/generated b/crates/icrate/src/generated index 58c473adf..19561a844 160000 --- a/crates/icrate/src/generated +++ b/crates/icrate/src/generated @@ -1 +1 @@ -Subproject commit 58c473adf6e081b6be43b62a6a1ba23c062d4d26 +Subproject commit 19561a8440284ee83dbc718a5d3896660b90aee9 From 34a148c01c2bf71ec55834ea0938136343873867 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 07:14:41 +0100 Subject: [PATCH 11/15] Fix framework version parsing --- .github/workflows/ci.yml | 5 ++- Cargo.lock | 20 ++++++++++ crates/header-translator/Cargo.toml | 1 + crates/header-translator/src/config.rs | 51 +++++++++++++++++++++++--- crates/header-translator/src/output.rs | 24 +++++++++--- crates/icrate/Cargo.toml | 31 +++++++++------- 6 files changed, 106 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27654313b..cd58b4996 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ env: # compiling C code, even if just running a `check`/`clippy` build. INTERESTING_FEATURES: malloc,block,verify,unstable-private UNSTABLE_FEATURES: unstable-autoreleasesafe,unstable-c-unwind - LATEST_MACOS_FEATURE: unstable-frameworks-macos-13 + LATEST_MACOS_FEATURE: unstable-frameworks-macos-14 # Required when we want to use a different runtime than the default `apple` OTHER_RUNTIME: --no-default-features --features=std # https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci @@ -356,6 +356,9 @@ jobs: fail-fast: true matrix: include: + - name: Test macOS 13 + os: macos-13 + frameworks: macos-13 - name: Test macOS 11 os: macos-11 frameworks: macos-11 diff --git a/Cargo.lock b/Cargo.lock index 351ede2f8..f1968698e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -148,6 +148,7 @@ dependencies = [ "clang", "clang-sys", "heck", + "lenient_semver_parser", "proc-macro2", "semver", "serde", @@ -211,6 +212,25 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lenient_semver_parser" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f650c1d024ddc26b4bb79c3076b30030f2cf2b18292af698c81f7337a64d7d6" +dependencies = [ + "lenient_semver_version_builder", + "semver", +] + +[[package]] +name = "lenient_semver_version_builder" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9049f8ff49f75b946f95557148e70230499c8a642bf2d6528246afc7d0282d17" +dependencies = [ + "semver", +] + [[package]] name = "libc" version = "0.2.150" diff --git a/crates/header-translator/Cargo.toml b/crates/header-translator/Cargo.toml index fd60760cd..108190af1 100644 --- a/crates/header-translator/Cargo.toml +++ b/crates/header-translator/Cargo.toml @@ -20,3 +20,4 @@ proc-macro2 = "1.0.66" syn = { version = "2.0", features = ["parsing"] } heck = "0.4" semver = { version = "1.0", features = ["serde"] } +lenient_semver_parser = "0.4" diff --git a/crates/header-translator/src/config.rs b/crates/header-translator/src/config.rs index 703da63de..618845819 100644 --- a/crates/header-translator/src/config.rs +++ b/crates/header-translator/src/config.rs @@ -1,8 +1,10 @@ use std::collections::{HashMap, HashSet}; use std::error::Error; +use std::fmt; use std::fs; use std::path::Path; +use semver::Version; use serde::Deserialize; use crate::data; @@ -60,6 +62,40 @@ impl Config { } } +fn get_version<'de, D: serde::Deserializer<'de>>( + deserializer: D, +) -> Result, D::Error> { + use serde::de; + + struct VersionVisitor; + + impl de::Visitor<'_> for VersionVisitor { + type Value = Option; + + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { + formatter.write_str("a version string") + } + + fn visit_none(self) -> Result + where + E: de::Error, + { + Ok(None) + } + + fn visit_borrowed_str(self, v: &str) -> Result + where + E: de::Error, + { + Ok(Some( + lenient_semver_parser::parse::(v).map_err(de::Error::custom)?, + )) + } + } + + deserializer.deserialize_str(VersionVisitor) +} + #[derive(Deserialize, Debug, Default, Clone, PartialEq, Eq)] #[serde(deny_unknown_fields)] pub struct LibraryData { @@ -82,15 +118,20 @@ pub struct LibraryData { #[serde(default)] pub extra_features: Vec, #[serde(default)] - pub macos: Option, + #[serde(deserialize_with = "get_version")] + pub macos: Option, #[serde(default)] - pub maccatalyst: Option, + #[serde(deserialize_with = "get_version")] + pub maccatalyst: Option, #[serde(default)] - pub ios: Option, + #[serde(deserialize_with = "get_version")] + pub ios: Option, #[serde(default)] - pub tvos: Option, + #[serde(deserialize_with = "get_version")] + pub tvos: Option, #[serde(default)] - pub watchos: Option, + #[serde(deserialize_with = "get_version")] + pub watchos: Option, #[serde(default)] pub examples: Vec, } diff --git a/crates/header-translator/src/output.rs b/crates/header-translator/src/output.rs index edbae9e7f..dea32494f 100644 --- a/crates/header-translator/src/output.rs +++ b/crates/header-translator/src/output.rs @@ -2,12 +2,13 @@ use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::fmt::{self, Write}; use std::fs; use std::path::Path; -use std::str::FromStr; use crate::config::{Config, LibraryData}; use crate::library::Library; use crate::stmt::Stmt; +use semver::VersionReq; + #[derive(Debug, PartialEq)] pub struct Output { pub libraries: BTreeMap, @@ -75,6 +76,9 @@ impl Output { ] .into_iter() .collect(); + let mut macos_14_features: BTreeSet = vec!["unstable-frameworks-macos-13".into()] + .into_iter() + .collect(); let mut gnustep_features: BTreeSet = vec![].into_iter().collect(); for (mut library_name, library) in &config.libraries { @@ -89,16 +93,20 @@ impl Output { let _ = features.insert(library_name.to_string(), library_features.collect()); if let Some(version) = &library.macos { - if version.matches(&semver::Version::from_str("10.12.0").unwrap()) { + if VersionReq::parse("<=10.12").unwrap().matches(version) { macos_10_12_features.insert(format!("{library_name}_all")); - } else if version.matches(&semver::Version::from_str("10.13.0").unwrap()) { + } else if VersionReq::parse("<=10.13").unwrap().matches(version) { macos_10_13_features.insert(format!("{library_name}_all")); - } else if version.matches(&semver::Version::from_str("11.0.0").unwrap()) { + } else if VersionReq::parse("<=11.0").unwrap().matches(version) { macos_11_features.insert(format!("{library_name}_all")); - } else if version.matches(&semver::Version::from_str("12.0.0").unwrap()) { + } else if VersionReq::parse("<=12.0").unwrap().matches(version) { macos_12_features.insert(format!("{library_name}_all")); - } else { + } else if VersionReq::parse("<=13.0").unwrap().matches(version) { macos_13_features.insert(format!("{library_name}_all")); + } else if VersionReq::parse("<=14.0").unwrap().matches(version) { + macos_14_features.insert(format!("{library_name}_all")); + } else { + error!(?library_name, "has library that does not fit any version"); } } @@ -127,6 +135,10 @@ impl Output { "unstable-frameworks-macos-13".into(), macos_13_features.into_iter().collect(), ); + let _ = features.insert( + "unstable-frameworks-macos-14".into(), + macos_14_features.into_iter().collect(), + ); let _ = features.insert( "unstable-frameworks-gnustep".into(), gnustep_features.into_iter().collect(), diff --git a/crates/icrate/Cargo.toml b/crates/icrate/Cargo.toml index 0371f1535..8f9d64438 100644 --- a/crates/icrate/Cargo.toml +++ b/crates/icrate/Cargo.toml @@ -5597,6 +5597,7 @@ unstable-frameworks-macos-10-12 = [ "InputMethodKit_all", "LocalAuthentication_all", "MapKit_all", + "MediaPlayer_all", "MetalKit_all", "Metal_all", "OSAKit_all", @@ -5607,7 +5608,6 @@ unstable-frameworks-macos-10-12 = [ ] unstable-frameworks-macos-10-13 = [ "ExternalAccessory_all", - "MediaPlayer_all", "unstable-example-delegate", "unstable-example-metal", "unstable-example-nspasteboard", @@ -5616,11 +5616,24 @@ unstable-frameworks-macos-10-13 = [ ] unstable-frameworks-macos-11 = [ "Accessibility_all", + "AdSupport_all", + "AuthenticationServices_all", + "AutomaticAssessmentConfiguration_all", + "BusinessChat_all", "ClassKit_all", + "DeviceCheck_all", + "FileProviderUI_all", + "FileProvider_all", + "IdentityLookup_all", + "LinkPresentation_all", + "SoundAnalysis_all", + "Speech_all", "UniformTypeIdentifiers_all", + "UserNotifications_all", "unstable-frameworks-macos-10-13", ] unstable-frameworks-macos-12 = [ + "AdServices_all", "DataDetection_all", "LocalAuthenticationEmbeddedUI_all", "MailKit_all", @@ -5628,24 +5641,14 @@ unstable-frameworks-macos-12 = [ "unstable-frameworks-macos-11", ] unstable-frameworks-macos-13 = [ - "AdServices_all", - "AdSupport_all", - "AuthenticationServices_all", - "AutomaticAssessmentConfiguration_all", "BackgroundAssets_all", - "BusinessChat_all", "CallKit_all", - "DeviceCheck_all", "ExtensionKit_all", - "FileProviderUI_all", - "FileProvider_all", "HealthKit_all", - "IdentityLookup_all", - "LinkPresentation_all", "MetalFX_all", - "SoundAnalysis_all", - "Speech_all", - "UserNotifications_all", "unstable-example-browser", "unstable-frameworks-macos-12", ] +unstable-frameworks-macos-14 = [ + "unstable-frameworks-macos-13", +] From 19c17af2539c20ded6f1e4560bce621a834a2cb1 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 07:20:33 +0100 Subject: [PATCH 12/15] Appease clippy --- crates/header-translator/src/stmt.rs | 9 +++++---- crates/header-translator/src/unexposed_attr.rs | 2 +- crates/objc2/src/runtime/mod.rs | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/header-translator/src/stmt.rs b/crates/header-translator/src/stmt.rs index f7d431973..e427e6360 100644 --- a/crates/header-translator/src/stmt.rs +++ b/crates/header-translator/src/stmt.rs @@ -957,14 +957,14 @@ impl Stmt { _ => error!("unknown"), }); - return vec![Self::StructDecl { + vec![Self::StructDecl { id, encoding_name, availability, boxable, fields, sendable, - }]; + }] } EntityKind::EnumDecl => { // Enum declarations show up twice for some reason, but @@ -1373,8 +1373,9 @@ impl fmt::Display for Stmt { }; let (superclass, superclasses_rest) = superclasses.split_at(1); - let (superclass, superclass_generics) = - superclass.get(0).expect("must have a least one superclass"); + let (superclass, superclass_generics) = superclass + .first() + .expect("must have a least one superclass"); writeln!(f, "{macro_name}!(")?; writeln!(f, " {derives}")?; diff --git a/crates/header-translator/src/unexposed_attr.rs b/crates/header-translator/src/unexposed_attr.rs index 022691577..24f4f5327 100644 --- a/crates/header-translator/src/unexposed_attr.rs +++ b/crates/header-translator/src/unexposed_attr.rs @@ -240,7 +240,7 @@ fn get_argument_tokens<'a>(entity: &Entity<'a>) -> Vec> { // Remove the macro name from the full macro tokens let name_ranges = entity.get_name_ranges(); assert_eq!(name_ranges.len(), 1, "macro name ranges"); - let name_range = name_ranges.get(0).unwrap(); + let name_range = name_ranges.first().unwrap(); let range = entity.get_range().expect("macro range"); let mut tokens = SourceRange::new(name_range.get_end(), range.get_end()).tokenize(); diff --git a/crates/objc2/src/runtime/mod.rs b/crates/objc2/src/runtime/mod.rs index f30f3b496..b8cfd823b 100644 --- a/crates/objc2/src/runtime/mod.rs +++ b/crates/objc2/src/runtime/mod.rs @@ -12,6 +12,7 @@ //! ``` #![doc = include_str!("../../examples/introspection.rs")] //! ``` +#![allow(clippy::missing_panics_doc)] #[cfg(feature = "malloc")] use alloc::vec::Vec; From 60e597da2bed01dc4359e28d54596446fe8b9e20 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 09:10:30 +0100 Subject: [PATCH 13/15] Fix UI ordering differing between local mac and the once that runs CI --- crates/test-ui/ui/declare_class_invalid_type.stderr | 8 ++++---- .../test-ui/ui/mutability_traits_unimplementable2.stderr | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/test-ui/ui/declare_class_invalid_type.stderr b/crates/test-ui/ui/declare_class_invalid_type.stderr index ecc4aa0c4..5ffa70b3a 100644 --- a/crates/test-ui/ui/declare_class_invalid_type.stderr +++ b/crates/test-ui/ui/declare_class_invalid_type.stderr @@ -99,10 +99,10 @@ note: required by a bound in `ConvertArgument` | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ConvertArgument` = note: `ConvertArgument` is a "sealed trait", because to implement it you also need to implement `objc2::__macro_helpers::convert::argument_private::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it = help: the following types implement the trait: - std::option::Option<&mut objc2::rc::Id> - std::option::Option<&mut std::option::Option>> &mut std::option::Option> &mut objc2::rc::Id + std::option::Option<&mut objc2::rc::Id> + std::option::Option<&mut std::option::Option>> bool T = note: this error originates in the macro `$crate::__declare_class_rewrite_params` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -138,10 +138,10 @@ note: required by a bound in `ConvertArgument` | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ConvertArgument` = note: `ConvertArgument` is a "sealed trait", because to implement it you also need to implement `objc2::__macro_helpers::convert::argument_private::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it = help: the following types implement the trait: - std::option::Option<&mut objc2::rc::Id> - std::option::Option<&mut std::option::Option>> &mut std::option::Option> &mut objc2::rc::Id + std::option::Option<&mut objc2::rc::Id> + std::option::Option<&mut std::option::Option>> bool T = note: this error originates in the macro `$crate::__declare_class_rewrite_params` which comes from the expansion of the macro `declare_class` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/test-ui/ui/mutability_traits_unimplementable2.stderr b/crates/test-ui/ui/mutability_traits_unimplementable2.stderr index c52bc087c..efb5e7cf3 100644 --- a/crates/test-ui/ui/mutability_traits_unimplementable2.stderr +++ b/crates/test-ui/ui/mutability_traits_unimplementable2.stderr @@ -16,8 +16,8 @@ note: required by a bound in `IsIdCloneable` | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `IsIdCloneable` = note: `IsIdCloneable` is a "sealed trait", because to implement it you also need to implement `objc2::mutability::private_traits::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it = help: the following types implement the trait: - objc2::runtime::ProtocolObject

objc2::runtime::AnyObject + objc2::runtime::ProtocolObject

T error[E0277]: the trait bound `CustomStruct: ClassType` is not satisfied From bf0325e0c08730e71a9a9c6e6a84b5d24d0fb23c Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 09:12:03 +0100 Subject: [PATCH 14/15] Fix flaky GNUStep test for now And make it more visible in the future --- .github/workflows/ci.yml | 2 ++ crates/icrate/tests/mutable_array.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd58b4996..23db090e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -545,6 +545,8 @@ jobs: - lint strategy: + # GNUStep tests are currently flaky, this makes it easier to see + fail-fast: false matrix: include: - name: Test GNUStep with libobjc2 v1.9 diff --git a/crates/icrate/tests/mutable_array.rs b/crates/icrate/tests/mutable_array.rs index ddb09028e..a6597ed0b 100644 --- a/crates/icrate/tests/mutable_array.rs +++ b/crates/icrate/tests/mutable_array.rs @@ -158,6 +158,10 @@ fn test_remove() { #[test] #[cfg(feature = "Foundation_NSString")] +#[cfg_attr( + feature = "gnustep-1-7", + ignore = "thread safety issues regarding initialization" +)] fn test_into_vec() { let array = NSMutableArray::from_id_slice(&[Foundation::NSString::new()]); From c0257226426f1ed23abea818bc0f7c093f105fc4 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sat, 25 Nov 2023 16:14:13 +0100 Subject: [PATCH 15/15] Fix warning on nightly 2023-11-22 --- crates/icrate/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/icrate/src/lib.rs b/crates/icrate/src/lib.rs index e4e6444a3..c76955190 100644 --- a/crates/icrate/src/lib.rs +++ b/crates/icrate/src/lib.rs @@ -138,7 +138,7 @@ mod macros; #[allow(deprecated)] mod generated; -#[allow(unreachable_pub)] +#[allow(unreachable_pub, unused_imports)] pub use self::generated::*; /// Deprecated alias of [`Foundation::ns_string`].