Skip to content

feat: Implement AOT Direct Calls for NativeScript iOS Runtime#366

Open
edusperoni wants to merge 4 commits intomainfrom
feat/aot-compilation
Open

feat: Implement AOT Direct Calls for NativeScript iOS Runtime#366
edusperoni wants to merge 4 commits intomainfrom
feat/aot-compilation

Conversation

@edusperoni
Copy link
Copy Markdown
Collaborator

This adds up to 5x speedup on AOT methods. Still a POC, but the idea is to allow the user to customize the aot-config with the "hottest" functions.

Also, ideally we log function calls to help determine which functions we want AOT-compiled.

Once apple give us JIT, this can be the base to our JIT compiler

edusperoni added 2 commits May 4, 2026 17:58
- Added AOTDirectCalls.h and AOTDirectCalls.mm to support direct Objective-C calls, bypassing libffi.
- Introduced aot-config.json to define methods and block patterns for AOT generation.
- Created scripts/generate-aot.py to automate the generation of AOT stubs based on the configuration.
- Updated Interop.h and Interop.mm to integrate AOT functionality.
- Modified MetadataBuilder.h and MetadataBuilder.mm to utilize AOT direct calls for method and property access.
- Adjusted project.pbxproj to include new AOT files in the build.
@edusperoni edusperoni force-pushed the feat/aot-compilation branch from 7f5d49b to 4439f99 Compare May 5, 2026 03:58
edusperoni added 2 commits May 5, 2026 01:52
- Introduced `resolve-aot-imports.py` to scan metadata and update AOT config with framework imports.
- Added `resolve-aot-returntypes.py` to update method return types in AOT config based on metadata.
- Updated `project.pbxproj` to include new NativeScript AOT header and source files.
…rated stubs

- Introduced a thread-safe mechanism for AOT stub registration using std::call_once in NativeScriptAOTBridge.mm to ensure that the registration function is called only once.
- Updated the AOT generation script (generate-aot.py) to use class_getSuperclass for obtaining the superclass of a target object instead of directly referencing the class, improving compatibility and correctness.
- Added necessary imports for objc/runtime.h in the generated AOT preamble to support the new superclass handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant