Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c18f040
feat(aot): add experimental native Apple ARM64 compiler
yabanana Oct 8, 2026
a2f4f36
test(aot): initialize pointer facts in integer instruction harness
yabanana Oct 8, 2026
9cbb67d
feat(aot): infer memory effects of direct native calls
yabanana Oct 9, 2026
691cf15
feat(aot): qualify native provider memory effects
yabanana Oct 9, 2026
b5b268b
Merge remote-tracking branch 'origin/main' into feature/aot-call-effects
yabanana Oct 9, 2026
6531f63
test(aot): isolate native libraries between compilations
yabanana Oct 9, 2026
e7bdd10
feat(aot): prove bounded indexed frame writes
yabanana Oct 9, 2026
9da3a54
feat(aot): infer parameter-relative write effects
yabanana Oct 9, 2026
2cb720d
fix(aot): derive memory writes from instruction semantics
yabanana Oct 9, 2026
849d3dd
feat(aot): preserve stack pointer argument origins
yabanana Oct 9, 2026
5ccec75
feat(aot): register native process images with the runtime
yabanana Oct 9, 2026
4cf60e1
feat(aot): guard declared stack object accesses natively
yabanana Oct 9, 2026
3d5178a
feat(aot): link immutable image pointers natively
yabanana Oct 9, 2026
24f9177
feat(aot): resolve null and constant stack arguments
yabanana Oct 9, 2026
2a3b8ee
test(aot): isolate native libraries between compilations
yabanana Oct 9, 2026
142a7ab
fix(aot): invalidate pointer cells on semantic memory writes
yabanana Oct 9, 2026
75330d6
chore(aot): integrate current main into native runtime branch
yabanana Oct 11, 2026
9aecccf
feat(aot): run source-built programs with a native ARM64 runtime
yabanana Oct 11, 2026
0c839fb
test(aot): exercise native runtime providers on Linux
yabanana Oct 11, 2026
2337ca1
feat(aot): validate generated programs on native Linux ARM64
yabanana Oct 11, 2026
f6c5668
feat(aot): include native runtime consumer in ARM64 proposal
yabanana Oct 11, 2026
b949b38
feat(aot): run source-built graphics on native Apple ARM64
yabanana Oct 12, 2026
18bf3e3
fix(macos): maintain the physical span index for direct memory aliases
yabanana Oct 12, 2026
8971a1f
merge: integrate upstream platform and provider updates
yabanana Oct 12, 2026
3278751
fix(aot): requalify unchanged exit provider after upstream division e…
yabanana Oct 12, 2026
cdb2a61
fix(macos): guard unavailable host direct I/O status flag
yabanana Oct 12, 2026
9533e7a
merge: align native AOT foundation with current main
yabanana Oct 12, 2026
327bcce
docs: reconcile native AOT notes with component debt index
yabanana Oct 12, 2026
c2b87b3
merge: reconcile native graphics with upstream subgroup and platform …
yabanana Oct 12, 2026
b518fff
merge: retain reconciled native AOT debt documentation
yabanana Oct 12, 2026
65e3ffb
fix(aot): requalify unchanged providers after upstream platform updates
yabanana Oct 12, 2026
33e1e29
docs: follow upstream component technical debt layout
yabanana Oct 12, 2026
34615bd
docs: follow upstream component technical debt layout
yabanana Oct 12, 2026
12fb04e
build(aot): reconcile dependency registration with main
yabanana Oct 12, 2026
d4354e4
fix(macos): reconcile graphics runtime with upstream changes
yabanana Oct 12, 2026
97581bc
fix(macos): reconcile GPU import and shader cache updates
yabanana Oct 13, 2026
67452b2
fix(relinker): parse JSON decimals with portable locale-independent s…
yabanana Oct 13, 2026
7425066
fix(relinker): retain portable JSON parsing on macOS toolchains
yabanana Oct 13, 2026
9a6b146
chore: reconcile AOT foundation with upstream main
yabanana Oct 14, 2026
bc0df0d
chore: reconcile graphics integration with upstream platform changes
yabanana Oct 14, 2026
0b41bdf
Merge branch 'feature/native-arm64-aot-compiler' into feature/aot-nat…
yabanana Oct 14, 2026
e8e9d41
fix(libc): construct condition deadlines in the host clock duration
yabanana Oct 14, 2026
b542fdc
fix(build): generate presentation shaders for native graphics
yabanana Oct 14, 2026
9b643a3
test(libkernel): verify Darwin socket read shutdown semantics
yabanana Oct 14, 2026
bf5120c
Merge commit '31bfc4e8693d86318824d83c47cfa418703a7cc8' into feature/…
yabanana Oct 14, 2026
67f94df
Merge branch 'feature/native-arm64-aot-compiler' into feature/aot-nat…
yabanana Oct 14, 2026
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
59 changes: 59 additions & 0 deletions .github/workflows/native-aot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Native ARM64 AOT

on:
push:
branches: ['feature/aot-native-runtime']
pull_request:
paths:
- 'core/aot/**'
- 'core/libs/native/**'
- 'core/libs/prx/libc/**'
- 'core/libs/prx/libkernel/Time/**'
- 'core/libs/prx/libkernel/System/src/Notification.cpp'
- 'core/libs/tests/NativeAot*'
- '3rdparty/ps5link-sdk'
- 'CMakeLists.txt'
- '.gitmodules'
- '3rdparty/capstone'
- '3rdparty/pyelftools'
- '.github/workflows/native-aot.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: native-aot-${{ github.ref }}
cancel-in-progress: true

jobs:
native-aot:
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
example: 'ON'
- os: ubuntu-latest
example: 'ON'
- os: ubuntu-24.04-arm
example: 'ON'
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- run: git submodule update --init 3rdparty/capstone 3rdparty/pyelftools
- run: git submodule update --init 3rdparty/ps5link-sdk
- if: runner.os == 'macOS'
run: test "$(uname -m)" = arm64
- if: runner.os == 'macOS'
run: /usr/bin/arch -x86_64 /usr/bin/true
- run: cmake -S . -B build-aot -G Ninja -DCMAKE_BUILD_TYPE=Release -DANYPS5_RELINKER_ONLY=ON -DANYPS5_NATIVE_AOT=ON -DBUILD_TESTING=ON -DANYPS5_NATIVE_AOT_EXAMPLE=${{ matrix.example }}
- if: matrix.os != 'ubuntu-24.04-arm'
run: cmake --build build-aot --parallel 3
- if: matrix.os == 'ubuntu-24.04-arm'
run: cmake --build build-aot --target native_aot aot_ps5link anyps5_native_runtime native_aot_image_tests native_aot_runtime_tests native_aot_readonly_tests native_aot_graphics_layout_tests --parallel 3
- if: matrix.os != 'ubuntu-24.04-arm'
run: ctest --test-dir build-aot --output-on-failure --parallel 2
- if: matrix.os == 'ubuntu-24.04-arm'
run: ctest --test-dir build-aot --output-on-failure --parallel 2 -R '^native_aot_'
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@
[submodule "3rdparty/libusb-cmake"]
path = 3rdparty/libusb-cmake
url = https://github.com/libusb/libusb-cmake.git
[submodule "3rdparty/capstone"]
path = 3rdparty/capstone
url = https://github.com/capstone-engine/capstone.git
[submodule "3rdparty/pyelftools"]
path = 3rdparty/pyelftools
url = https://github.com/eliben/pyelftools.git
[submodule "3rdparty/ps5link-sdk"]
path = 3rdparty/ps5link-sdk
url = https://github.com/Rufidj/ps5link-sdk.git
1 change: 1 addition & 0 deletions 3rdparty/capstone
Submodule capstone added at accf4d
1 change: 1 addition & 0 deletions 3rdparty/ps5link-sdk
Submodule ps5link-sdk added at ea771e
1 change: 1 addition & 0 deletions 3rdparty/pyelftools
Submodule pyelftools added at d4ea35
39 changes: 31 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.20)
if(CMAKE_HOST_APPLE AND NOT ANYPS5_RELINKER_ONLY)
if(CMAKE_HOST_APPLE AND NOT ANYPS5_RELINKER_ONLY AND NOT ANYPS5_NATIVE_GRAPHICS)
set(CMAKE_APPLE_SILICON_PROCESSOR x86_64 CACHE STRING "Host processor CMake reports on Apple silicon")
set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING "Architectures built on macOS")
endif()
Expand All @@ -14,6 +14,14 @@ endfunction()

option(BUILD_TESTING "Build and register relinker tests" OFF)
option(ANYPS5_RELINKER_ONLY "Build the relinker without system libraries or third-party dependencies" OFF)
option(ANYPS5_NATIVE_GRAPHICS "Build the native Apple ARM64 graphics runtime" OFF)
if(ANYPS5_NATIVE_GRAPHICS)
if(NOT ANYPS5_NATIVE_AOT OR ANYPS5_RELINKER_ONLY OR ANYPS5_NATIVE_AOT_EXAMPLE OR BUILD_TESTING)
message(FATAL_ERROR "Native graphics requires NATIVE_AOT=ON, RELINKER_ONLY=OFF, NATIVE_AOT_EXAMPLE=OFF and BUILD_TESTING=OFF")
endif()
enable_testing()
endif()
option(ANYPS5_NATIVE_AOT "Build the experimental offline Apple ARM64 compiler" OFF)
option(ANYPS5_BUILD_WASM "Build the browser relinker" OFF)
if(ANYPS5_BUILD_WASM)
if(NOT EMSCRIPTEN)
Expand Down Expand Up @@ -63,9 +71,7 @@ if(ANYPS5_ENABLE_ASAN)
add_compile_definitions(ANYPS5_ENABLE_ASAN=1)
elseif(NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++")
endif()

if(APPLE AND NOT ANYPS5_RELINKER_ONLY)
else()
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fexperimental-library>)
add_link_options(-fexperimental-library)
endif()
Expand Down Expand Up @@ -119,6 +125,10 @@ if(BUILD_TESTING)
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_skips.py)
add_test(NAME stubgen COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_stubgen.py)
if(UNIX)
add_test(NAME package_macos_app COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_package_macos_app.py)
endif()
add_test(NAME debt_split COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_debt_split.py)
add_test(NAME stubgen_stdout_newlines COMMAND ${Python3_EXECUTABLE}
Expand Down Expand Up @@ -147,12 +157,16 @@ if(BUILD_TESTING)
endif()
endif()

if(ANYPS5_NATIVE_AOT)
add_subdirectory(core/aot)
endif()

if(ANYPS5_RELINKER_ONLY)
add_subdirectory(core/relinker)
return()
endif()

if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
if(APPLE AND NOT ANYPS5_NATIVE_GRAPHICS AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
message(FATAL_ERROR "The full build on macOS is x86-64 only; configure without CMAKE_OSX_ARCHITECTURES or set it to x86_64")
endif()

Expand Down Expand Up @@ -193,7 +207,11 @@ if(NOT ANYPS5_USE_SYSTEM_DEPS)
endif()
endif()
endif()
set(ARCHITECTURE x86_64)
if(ANYPS5_NATIVE_GRAPHICS)
set(ARCHITECTURE arm64)
else()
set(ARCHITECTURE x86_64)
endif()
add_subdirectory(3rdparty/ffmpeg-core)
if(MINGW)
target_link_libraries(ffmpeg INTERFACE bcrypt ole32 user32 ws2_32)
Expand Down Expand Up @@ -232,5 +250,10 @@ set_target_properties(usb-1.0 PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_subdirectory(core/shader/recompiler)
add_subdirectory(core/Decoder/Jpeg)
add_subdirectory(core/Decoder/Png)
add_subdirectory(core/libs)
add_subdirectory(core/relinker)
if(ANYPS5_NATIVE_GRAPHICS)
add_subdirectory(core/libs EXCLUDE_FROM_ALL)
add_subdirectory(core/libs/native)
else()
add_subdirectory(core/libs)
add_subdirectory(core/relinker)
endif()
155 changes: 155 additions & 0 deletions core/aot/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
if(NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "The native AOT compiler supports Apple ARM64 execution or Linux cross-compilation")
endif()
if(APPLE AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
message(FATAL_ERROR "Native AOT execution tests require an Apple ARM64 host")
endif()
if(CMAKE_OSX_ARCHITECTURES AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
message(FATAL_ERROR "The experimental native AOT tool requires an arm64 build")
endif()

set(aotNativeExecution OFF)
if(APPLE OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$")
set(aotNativeExecution ON)
endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
if(NOT APPLE)
set(aotClang clang CACHE STRING "Clang executable for Apple ARM64 cross-compilation")
execute_process(COMMAND ${aotClang} --version RESULT_VARIABLE aotClangStatus OUTPUT_QUIET ERROR_QUIET)
if(NOT aotClangStatus EQUAL 0)
message(FATAL_ERROR "Set aotClang to a Clang executable with the AArch64 backend")
endif()
set(aotClangEnvironment "ANYPS5_AOT_CLANG=${aotClang}")
endif()
enable_language(C)
set(BUILD_SHARED_LIBS ON)
set(BUILD_STATIC_LIBS OFF)
set(CAPSTONE_ARCHITECTURE_DEFAULT OFF)
set(CAPSTONE_X86_SUPPORT ON)
set(CAPSTONE_BUILD_MACOS_THIN ON)
set(CAPSTONE_BUILD_TESTS OFF)
set(CAPSTONE_BUILD_CSTOOL OFF)
set(CAPSTONE_BUILD_CSTEST OFF)
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty/capstone ${CMAKE_CURRENT_BINARY_DIR}/capstone EXCLUDE_FROM_ALL)

set(aotPythonPath "${CMAKE_SOURCE_DIR}/3rdparty/capstone/bindings/python:${CMAKE_SOURCE_DIR}/3rdparty/pyelftools:${CMAKE_CURRENT_SOURCE_DIR}")
configure_file(launcher.py.in native_aot.py @ONLY)
add_custom_target(native_aot ALL DEPENDS capstone_shared)
add_library(anyps5_native_image STATIC "${CMAKE_SOURCE_DIR}/core/libs/native/NativeAotImage.cpp"
"${CMAKE_SOURCE_DIR}/core/libs/native/NativeAotPointer.cpp")
if(APPLE)
target_sources(anyps5_native_image PRIVATE "${CMAKE_SOURCE_DIR}/core/libs/native/NativeAotReadonly.cpp")
else()
target_sources(anyps5_native_image PRIVATE "${CMAKE_SOURCE_DIR}/core/libs/native/NativeAotReadonlyLinux.cpp")
endif()
target_include_directories(anyps5_native_image PUBLIC "${CMAKE_SOURCE_DIR}/core/libs")
set_target_properties(anyps5_native_image PROPERTIES CXX_EXTENSIONS OFF)

if(BUILD_TESTING)
add_test_executable(native_aot_graphics_layout_tests "${CMAKE_SOURCE_DIR}/core/libs/tests/NativeAotGraphicsLayouts.cpp")
target_include_directories(native_aot_graphics_layout_tests PRIVATE "${CMAKE_SOURCE_DIR}/core/libs")
add_test(NAME native_aot_graphics_layouts COMMAND native_aot_graphics_layout_tests)
set_tests_properties(native_aot_graphics_layouts PROPERTIES TIMEOUT 30)
add_test_executable(native_aot_readonly_tests "${CMAKE_SOURCE_DIR}/core/libs/tests/NativeAotReadonly.cpp")
target_link_libraries(native_aot_readonly_tests PRIVATE anyps5_native_image)
add_test(NAME native_aot_readonly COMMAND native_aot_readonly_tests)
set_tests_properties(native_aot_readonly PROPERTIES TIMEOUT 30)
add_test_executable(native_aot_image_tests "${CMAKE_SOURCE_DIR}/core/libs/tests/NativeAotImage.cpp")
target_link_libraries(native_aot_image_tests PRIVATE anyps5_native_image)
add_test(NAME native_aot_image COMMAND native_aot_image_tests)
set_tests_properties(native_aot_image PROPERTIES TIMEOUT 30)
if(APPLE)
file(GLOB testSources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_*.py")
else()
set(testSources "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_portable.py")
endif()
foreach(testSource IN LISTS testSources)
get_filename_component(suite "${testSource}" NAME_WE)
string(REGEX REPLACE "^test_" "" suite "${suite}")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${testSource}")
execute_process(COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/tests/list_cases.py" "${testSource}"
OUTPUT_VARIABLE cases OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
string(REPLACE "\n" ";" cases "${cases}")
foreach(case IN LISTS cases)
add_test(NAME native_aot_${suite}.${case}
COMMAND ${CMAKE_COMMAND} -E env ${aotClangEnvironment}
"LIBCAPSTONE_PATH=$<TARGET_FILE_DIR:capstone_shared>"
"PYTHONPATH=${aotPythonPath}"
${Python3_EXECUTABLE} "${testSource}" "${case}")
set_tests_properties(native_aot_${suite}.${case} PROPERTIES TIMEOUT 30)
endforeach()
endforeach()
endif()

option(ANYPS5_NATIVE_AOT_EXAMPLE "Build the source-based native runtime example" OFF)
if(ANYPS5_NATIVE_AOT_EXAMPLE)
set(ps5linkSource "${CMAKE_SOURCE_DIR}/3rdparty/ps5link-sdk/linker")
if(NOT EXISTS "${ps5linkSource}/link_real.c")
message(FATAL_ERROR "Initialize the pinned 3rdparty/ps5link-sdk source submodule")
endif()
add_executable(aot_ps5link
${ps5linkSource}/link_real.c ${ps5linkSource}/elf_object.c
${ps5linkSource}/linker.c ${ps5linkSource}/dynwriter.c
${ps5linkSource}/catalog.c ${ps5linkSource}/catalog_extra.c
${ps5linkSource}/catalog_lookup.c ${ps5linkSource}/nid.c ${ps5linkSource}/sha1.c)
add_library(anyps5_native_runtime STATIC
../libs/prx/libc/src/LocaleSupport.cpp
../libs/prx/libc/src/ApplicationHeap.cpp
../libs/prx/libc/src/GuestHeap.cpp
../libs/prx/libc/src/GuestArena.cpp
../libs/prx/libc/src/GuestAllocations.cpp
../libs/prx/libkernel/Time/TimedWait.cpp
../libs/prx/libkernel/System/src/Notification.cpp
../libs/native/NativeAotTime.cpp)
target_include_directories(anyps5_native_runtime PUBLIC "${CMAKE_SOURCE_DIR}/core/libs")
target_compile_options(anyps5_native_runtime PRIVATE -ffunction-sections -fdata-sections)
target_link_libraries(anyps5_native_runtime PUBLIC anyps5_native_image)
if(aotNativeExecution)
target_sources(anyps5_native_runtime PRIVATE ../libs/native/NativeAotMain.cpp)
endif()
if(BUILD_TESTING)
add_test_executable(native_aot_runtime_tests "${CMAKE_SOURCE_DIR}/core/libs/tests/NativeAotRuntime.cpp")
target_link_libraries(native_aot_runtime_tests PRIVATE anyps5_native_runtime)
if(APPLE)
target_link_options(native_aot_runtime_tests PRIVATE -Wl,-dead_strip)
else()
target_link_options(native_aot_runtime_tests PRIVATE -Wl,--gc-sections)
endif()
add_test(NAME native_aot_runtime COMMAND native_aot_runtime_tests)
set_tests_properties(native_aot_runtime PROPERTIES TIMEOUT 30)
endif()
set(aotExampleCommand ${CMAKE_COMMAND} -E env ${aotClangEnvironment}
"LIBCAPSTONE_PATH=$<TARGET_FILE_DIR:capstone_shared>"
"PYTHONPATH=${aotPythonPath}"
${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/examples/hello_notify.py"
--sdk "${CMAKE_SOURCE_DIR}/3rdparty/ps5link-sdk"
--linker $<TARGET_FILE:aot_ps5link>
--output "${CMAKE_CURRENT_BINARY_DIR}/hello-notify")
if(aotNativeExecution)
list(APPEND aotExampleCommand --runtime $<TARGET_FILE:anyps5_native_runtime>
--image-runtime $<TARGET_FILE:anyps5_native_image>)
if(NOT APPLE)
list(APPEND aotExampleCommand --target linux-arm64)
endif()
add_custom_target(native_aot_hello_notify
COMMAND ${aotExampleCommand} --run
DEPENDS aot_ps5link anyps5_native_runtime capstone_shared
USES_TERMINAL)
add_custom_target(native_aot_hello_notify_original
COMMAND ${aotExampleCommand} --original-delay --run
DEPENDS aot_ps5link anyps5_native_runtime capstone_shared
USES_TERMINAL)
if(BUILD_TESTING)
add_test(NAME native_aot_hello_notify COMMAND ${aotExampleCommand} --run)
set_tests_properties(native_aot_hello_notify PROPERTIES TIMEOUT 30)
endif()
else()
add_custom_target(native_aot_hello_notify
COMMAND ${aotExampleCommand} --compile-only
DEPENDS aot_ps5link capstone_shared USES_TERMINAL)
if(BUILD_TESTING)
add_test(NAME native_aot_hello_notify_compile COMMAND ${aotExampleCommand} --compile-only)
set_tests_properties(native_aot_hello_notify_compile PROPERTIES TIMEOUT 30)
endif()
endif()
endif()
Loading
Loading