Skip to content

JIT executor #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 21, 2025
Merged

JIT executor #335

merged 19 commits into from
May 21, 2025

Conversation

xlc
Copy link
Member

@xlc xlc commented May 19, 2025

some setup code

xlc added 19 commits May 9, 2025 17:49
- Removed the old ExecutorBackendJIT implementation and replaced it with a new, comprehensive JIT compilation backend.
- Introduced JITCache for caching compiled functions, improving performance by avoiding redundant compilations.
- Added JITCompiler to handle the compilation of PolkaVM bytecode into native machine code.
- Created JITExecutor to manage the execution of JIT-compiled functions.
- Developed JITMemoryManager for managing the flat memory buffer used by JIT-compiled code.
- Implemented platform-specific strategies for JIT operations with JITPlatformHelper and associated classes for macOS and Linux.
- Defined custom error types in JITError for better error handling during JIT compilation and execution.
- Enhanced PvmConfig to include memory layout configurations relevant for JIT execution.
- Added extensions to Registers for safe mutable access during JIT interactions.
- Overall, this commit establishes a robust framework for Just-In-Time compilation in the PolkaVM, aiming for improved execution speed and efficiency.
- Updated comments and documentation for clarity and consistency.
- Improved error handling messages in compile functions.
- Enhanced register usage descriptions for AArch64 and x86_64 architectures.
- Removed placeholder comments and added TODOs for future implementation.
…tion, improving clarity and organization of register usage
…PolkaVM

- Added `registers.hh` for static register allocation for x86_64 and AArch64 architectures.
- Updated `x64_helper.cpp` to include new labels and structured exit paths for JIT execution.
- Modified `ExecOutcome.swift` to change exit reason conversion from Int32 to UInt64 for better handling of associated values.
- Refactored `ExecutorBackendJIT.swift` to remove unnecessary gas checks and streamline memory management.
- Enhanced `JITCache.swift` to implement a more robust caching mechanism with async support.
- Simplified `JITCompiler.swift` and `JITExecutor.swift` to prepare for future implementation of compilation and execution logic.
- Removed `JITMemoryManager.swift` as its functionality is being integrated elsewhere.
…ve JITCache, and update PvmConfig for improved architecture handling
- Updated AArch64 JIT compilation in `a64_helper.cpp` to streamline register usage and improve code structure.
- Simplified x86_64 JIT compilation in `x64_helper.cpp`, enhancing readability and maintainability.
- Enhanced error handling in `ExecutorBackendJIT.swift` to catch compilation errors specifically.
- Introduced `CompilationError` enum in `JITCompiler.swift` for better error categorization during JIT compilation.
- Removed obsolete `JITError.swift` file and integrated relevant error handling into `JITExecutor.swift`.
- Improved memory management in `VMStateJIT.swift` with lazy initialization of memory views and better error handling.
- Added detailed logging for JIT compilation and execution processes to aid in debugging.
…te with VMStateInterpreter, update InvocationContext protocol, and introduce UncheckedSendableBox for async context management.
… headers and add C++ settings for asmjit target.
Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 13.64221% with 671 lines in your changes missing coverage. Please review.

Project coverage is 84.82%. Comparing base (4d4178e) to head (d6a2fb7).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...ces/PolkaVM/Executors/JIT/ExecutorBackendJIT.swift 0.00% 222 Missing ⚠️
...aVM/Sources/PolkaVM/Executors/JIT/VMStateJIT.swift 0.00% 160 Missing ⚠️
...VM/Sources/PolkaVM/Executors/JIT/JITExecutor.swift 0.00% 109 Missing ⚠️
...VM/Sources/PolkaVM/Executors/JIT/JITCompiler.swift 0.00% 82 Missing ⚠️
PolkaVM/Sources/PolkaVM/ExecOutcome.swift 0.00% 39 Missing ⚠️
PolkaVM/Sources/PolkaVM/Registers.swift 2.85% 34 Missing ⚠️
PolkaVM/Sources/PolkaVM/VMStateInterpreter.swift 92.23% 8 Missing ⚠️
.../Blockchain/VMInvocations/HostCall/HostCalls.swift 0.00% 7 Missing ⚠️
PolkaVM/Sources/PolkaVM/PvmConfig.swift 42.85% 4 Missing ⚠️
...VM/Sources/PolkaVM/Executors/JIT/JITPlatform.swift 0.00% 3 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #335      +/-   ##
==========================================
- Coverage   86.88%   84.82%   -2.07%     
==========================================
  Files         350      362      +12     
  Lines       29954    30633     +679     
==========================================
- Hits        26025    25983      -42     
- Misses       3929     4650     +721     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xlc xlc merged commit 7de1639 into master May 21, 2025
3 of 5 checks passed
@xlc xlc deleted the jit branch May 21, 2025 03:08
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