Repository navigation
Adds bytecode constants and utilities - #1097
Conversation
3ecc6dc to
b53576b
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## ion11 #1097 +/- ##
========================================
Coverage ? 68.01%
Complexity ? 5635
========================================
Files ? 167
Lines ? 23482
Branches ? 4184
========================================
Hits ? 15971
Misses ? 6216
Partials ? 1295 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| * | ||
| * See `com/amazon/ion/bytecode/ir/instruction_reference.md` for more details about the instruction set. | ||
| */ | ||
| internal object InstructionKind { |
There was a problem hiding this comment.
Maybe this should be called OperationKind instead. If it would be more logical that way (or with any other name you can think of), please say so.
| @@ -0,0 +1,83 @@ | |||
| # Bytecode Reference Table | |||
|
|
|||
| View the rendered version [on GitHub](https://github.com/amazon-ion/ion-java/tree/master/src/main/java/com/amazon/ion/bytecode/ir/instruction_reference.md). | |||
There was a problem hiding this comment.
This link will only work after the PR is merged.
| | DIRECTIVE_MODULE | `0x8D` | `10001` | `101` | `00` | - | - | Must have END_CONTAINER instruction to delimit end of directive | | ||
| | DIRECTIVE_ENCODING | `0x8E` | `10001` | `110` | `00` | - | - | Must have END_CONTAINER instruction to delimit end of directive | | ||
| | PLACEHOLDER | `0x90` | `10010` | `000` | `00` | - | - | Required, tagged parameter. | | ||
| | PLACEHOLDER_OPT | `0x91` | `10010` | `001` | `00` | bytecode_length (u22) | - | Optional tagged macro parameter.[^0x91] | |
There was a problem hiding this comment.
This footnote syntax is part of GitHub Flavored MarkDown (GFMD). You can't have newlines inside the source of a markdown table, so I chose to use footnotes to avoid having some lines with 400+ characters because I wanted this to also be readable as plain text.
| L0 STRING_CP 0 <Hello World> | ||
| L1 INT_CP 1 <12345> |
There was a problem hiding this comment.
Nice to have: column alignment for the constant pool values. Obviously not a blocker.
There was a problem hiding this comment.
Yes. That would be nice to have. I'm going to leave it for now, though.
Issue #, if available:
None
Description of changes:
This is the first step of production-izing the design that I prototyped in https://github.com/popematt/ion-java/tree/bytecode-generator-experiment.
This PR adds constants and utilities to define the intermediate representation bytecode. It looks like a huge PR, but it's 90% comments and constants.
I'm not certain that this the most logical way to set up the package structure, and I'm open to suggestions. For now, I was just going to do something like this to keep it separate from the many and varied existing reader/writer implementations.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.