Skip to content

Implement objc_msgSend function for the LoongArch CPU architecture#377

Open
basilisk-dev wants to merge 4 commits intognustep:masterfrom
basilisk-dev:loongarch64-obj_msgSend
Open

Implement objc_msgSend function for the LoongArch CPU architecture#377
basilisk-dev wants to merge 4 commits intognustep:masterfrom
basilisk-dev:loongarch64-obj_msgSend

Conversation

@basilisk-dev
Copy link
Copy Markdown

Ported objc_msgSend to the LoongArch64 architecture by adding a native assembly implementation. I basically ported the RISC-V implementation to LoongArch64 assembly. You can read more about the LoongArch architecture here if interested.

I ran the relevant tests and they all passed, and I also tested the implementation manually on LoongArch64 to verify it behaves correctly.

Please let me know if you need any additional info.

@davidchisnall
Copy link
Copy Markdown
Member

Thanks, this looks correct but I’d like to see it running in CI. I believe there is QEMU user mode support for Loongarch, can you add it to the workflow runner?

For this to be useful, we will also need a clang patch that enables the assembly message-dispatch function for message sends.

@basilisk-dev basilisk-dev force-pushed the loongarch64-obj_msgSend branch 2 times, most recently from ea36e96 to 6a5a9b5 Compare March 26, 2026 16:01
@basilisk-dev basilisk-dev force-pushed the loongarch64-obj_msgSend branch from 6a5a9b5 to f45f097 Compare March 26, 2026 16:28
@basilisk-dev
Copy link
Copy Markdown
Author

@davidchisnall I had to make a slight change to allow the implementation to compile on Clang 18 (I used Clang 22 during initial development).

I've added logic to the GitHub Actions workflow to allow the tests to run against LoongArch64 as well. Here is a test run I did: https://github.com/basilisk-dev/libobjc2/actions/runs/23605441514/job/68746795969

I had to exclude LLVM 16 and LLVM 17 on LoongArch64. ld.lld in the Ubuntu LLVM 16 and LLVM 17 packages do not support linking on LoongArch64.

A few of the tests fail because there is no LoongArch64 implementation in block_trampolines.S but I intend to fix that in a separate PR.

For this to be useful, we will also need a clang patch that enables the assembly message-dispatch function for message sends

Makes sense, I'm not familiar with Clang/LLVM internals so I didn't realize this wasn't already the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants