Skip to content
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

Refactor - vm interface of BuiltinFunctions #535

Merged
merged 7 commits into from
Oct 1, 2023
Merged

Conversation

Lichtso
Copy link

@Lichtso Lichtso commented Sep 30, 2023

This drastically simplifies the vm interface of BuiltinFunctions so that it becomes a lot closer to the vm internal call interface:

  • Instead of passing ContextObject, MemoryMapping and ProgramResult the encrypted pointer to the entire EbpfVm is passed, which is then decrypted and decomposed inside declare_builtin_function(). Thanks to Refactor - Optimize JIT registers #534, this does not even require swapping of argument registers.
  • The instruction metering around syscalls from the interpreter and JIT was moved into declare_builtin_function(), which does not only deduplicate the logic, but also allows LLVM to optimize the register allocation, spilling and perform inlining, effectively reducing the cost of a syscall from three context switches between the VM and Rust ABI, down to one.

Unfortunately, encrypt_runtime_environment is now no longer optional as we can not read the config of the VM without dereferencing the potentially encrypted VM pointer.

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2023

Codecov Report

Merging #535 (b4391ac) into main (b1b50f7) will decrease coverage by 0.16%.
The diff coverage is 95.08%.

@@            Coverage Diff             @@
##             main     #535      +/-   ##
==========================================
- Coverage   89.70%   89.55%   -0.16%     
==========================================
  Files          24       24              
  Lines       10213    10094     -119     
==========================================
- Hits         9162     9040     -122     
- Misses       1051     1054       +3     
Files Coverage Δ
src/interpreter.rs 98.81% <100.00%> (-0.03%) ⬇️
src/jit.rs 91.49% <100.00%> (-0.49%) ⬇️
src/vm.rs 85.90% <100.00%> (+0.06%) ⬆️
src/program.rs 80.58% <90.90%> (+2.50%) ⬆️

... and 1 file with indirect coverage changes

@Lichtso Lichtso merged commit ae16614 into main Oct 1, 2023
12 checks passed
@Lichtso Lichtso deleted the refactor/builtin_function branch October 1, 2023 13:06
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.

2 participants