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

Disassembler for inspecting compiled Risor code #202

Merged
merged 4 commits into from
Mar 10, 2024
Merged

Disassembler for inspecting compiled Risor code #202

merged 4 commits into from
Mar 10, 2024

Conversation

myzie
Copy link
Collaborator

@myzie myzie commented Mar 10, 2024

Adds a disassembler package and Risor CLI command to inspect compiled Risor code.

For example:

risor dis -c "1 + 2"
+--------+------------+----------+------+
| OFFSET |   OPCODE   | OPERANDS | INFO |
+--------+------------+----------+------+
|      0 | LOAD_CONST |        0 | 1    |
|      2 | LOAD_CONST |        1 | 2    |
|      4 | BINARY_OP  |        1 | +    |
+--------+------------+----------+------+

Other supporting changes:

  • Minor reorganization of cmd/risor package to clean things up
  • Make opcode integers fixed rather than using iota
  • make tidy

Copy link

codecov bot commented Mar 10, 2024

Codecov Report

Attention: Patch coverage is 29.83294% with 294 lines in your changes are missing coverage. Please review.

Project coverage is 31.44%. Comparing base (a897b5c) to head (29f05fc).

Files Patch % Lines
cmd/risor/util.go 0.86% 112 Missing and 2 partials ⚠️
dis/dis.go 55.85% 45 Missing and 4 partials ⚠️
op/op.go 9.80% 46 Missing ⚠️
cmd/risor/options.go 50.87% 18 Missing and 10 partials ⚠️
cmd/risor/root.go 18.51% 22 Missing ⚠️
cmd/risor/dis.go 41.66% 16 Missing and 5 partials ⚠️
cmd/risor/version.go 38.09% 13 Missing ⚠️
cmd/risor/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
- Coverage   31.52%   31.44%   -0.09%     
==========================================
  Files         113      121       +8     
  Lines       14461    15103     +642     
==========================================
+ Hits         4559     4749     +190     
- Misses       9331     9763     +432     
- Partials      571      591      +20     

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

@myzie myzie merged commit c295a8d into main Mar 10, 2024
5 checks passed
@myzie myzie deleted the dis branch March 10, 2024 15: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.

1 participant