solana-labs / rbpf

Rust virtual machine and JIT compiler for eBPF programs
Apache License 2.0
277 stars 169 forks source link

Refactor - Error handling #527

Closed Lichtso closed 1 year ago

Lichtso commented 1 year ago

Stops heap allocating errors for efficiency and removes fields from runtime errors for layout stability. The fields of these errors are mostly redundant and can be retrieved by other means anyway. Sometimes they are completely pointless such as the pc field for AccessViolation which syscalls always set to 0. The address where the exception occurred can now be read from the VM (see #529). Also, we have much better debugging support now, so we don't need to rely on these fields for diagnosis anymore.

codecov-commenter commented 1 year ago

Codecov Report

Merging #527 (c9c5a3e) into main (5b77958) will decrease coverage by 0.09%. The diff coverage is 95.29%.

@@            Coverage Diff             @@
##             main     #527      +/-   ##
==========================================
- Coverage   89.68%   89.59%   -0.09%     
==========================================
  Files          24       24              
  Lines       10317    10220      -97     
==========================================
- Hits         9253     9157      -96     
+ Misses       1064     1063       -1     
Files Coverage Δ
src/error.rs 100.00% <ø> (ø)
src/syscalls.rs 98.42% <100.00%> (-0.08%) :arrow_down:
src/vm.rs 81.25% <100.00%> (ø)
src/jit.rs 92.05% <89.47%> (-0.15%) :arrow_down:
src/interpreter.rs 98.35% <93.75%> (-0.07%) :arrow_down:
src/memory_region.rs 94.10% <96.90%> (-0.16%) :arrow_down: