Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,7 @@ jobs:
args: ${{ env.ARGS }} ${{ env.TESTARGS }} --features unstable-static-sel

- name: Run assembly tests
# Not run on GNUStep yet since a lot of function labels are mangled and
# not inlined (and hence quite hard to match on, at some point we'll
# need to find a solution to that).
if: ${{ !contains(matrix.os, 'ubuntu') }}
if: ${{ !contains(matrix.runtime, 'compiler-rt') }}
shell: bash
run:
export HOST_TARGET=$(rustc -vV | grep host | cut -f2 -d' ')
Expand Down
24 changes: 24 additions & 0 deletions helper-scripts/run-assembly-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -euxo pipefail

export HELPER="cargo run --features=run --bin=test-assembly -- --target"
export NIGHTLY_HELPER="cargo +nightly run --features=run --bin=test-assembly -- -Zbuild-std --target"

echo "Apple"
$HELPER x86_64-apple-darwin
$HELPER aarch64-apple-darwin
$NIGHTLY_HELPER armv7s-apple-ios
$NIGHTLY_HELPER armv7-apple-ios
$NIGHTLY_HELPER i386-apple-ios

echo "Old Apple"
$NIGHTLY_HELPER i686-apple-darwin

echo "GNUStep"
$HELPER x86_64-unknown-linux-gnu --no-default-features --features=std,gnustep-2-1
$HELPER i686-unknown-linux-gnu --no-default-features --features=std,gnustep-2-1

echo "Old GNUStep"
$HELPER x86_64-unknown-linux-gnu --no-default-features --features=std,gnustep-1-7
$HELPER i686-unknown-linux-gnu --no-default-features --features=std,gnustep-1-7
21 changes: 18 additions & 3 deletions objc2/src/message/gnustep.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
use core::hint;
use core::mem;

use super::conditional_try;
use crate::ffi;
use crate::runtime::{Class, Object, Sel};
use crate::runtime::{Class, Imp, Object, Sel};
use crate::{Encode, MessageArguments};

#[inline]
fn unwrap_msg_send_fn(msg_send_fn: Option<Imp>) -> Imp {
match msg_send_fn {
Some(msg_send_fn) => msg_send_fn,
None => {
// SAFETY: This will never be NULL, even if the selector is not
// found a callable function pointer will still be returned!
//
// `clang` doesn't insert a NULL check here either.
unsafe { hint::unreachable_unchecked() }
}
}
}

#[track_caller]
pub(crate) unsafe fn send_unverified<A, R>(receiver: *mut Object, sel: Sel, args: A) -> R
where
Expand All @@ -22,7 +37,7 @@ where
}

let msg_send_fn = unsafe { ffi::objc_msg_lookup(receiver.cast(), sel.as_ptr()) };
let msg_send_fn = msg_send_fn.expect("Null IMP");
let msg_send_fn = unwrap_msg_send_fn(msg_send_fn);
unsafe { conditional_try(|| A::__invoke(msg_send_fn, receiver, sel, args)) }
}

Expand All @@ -48,6 +63,6 @@ where
super_class: superclass.cast(),
};
let msg_send_fn = unsafe { ffi::objc_msg_lookup_super(&sup, sel.as_ptr()) };
let msg_send_fn = msg_send_fn.expect("Null IMP");
let msg_send_fn = unwrap_msg_send_fn(msg_send_fn);
unsafe { conditional_try(|| A::__invoke(msg_send_fn, receiver, sel, args)) }
}
110 changes: 0 additions & 110 deletions test-assembly/crates/test_msg_send_id/expected/apple-old-x86.s

This file was deleted.

Loading