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

Adds read/write support for system eexps, placeholders for remaining system macros #862

Open
wants to merge 5 commits into
base: deny-old-idioms
Choose a base branch
from

Conversation

zslayton
Copy link
Contributor

Builds on PR #861.

  • MacroTable now implements Send, allowing instances to be shared across threads. This made it possible for the system symbol table to be a singleton for all readers. To achieve this:
    • Rc references to other Macro instances are now Arc. This incurs higher overhead for new macro definitions at compile time, but no overhead at usage time. Reader and Writer instantiation benefit by not having to create a new system macro table instance.
    • Rc<str> instances have been replaced by CompactString, which doesn't allocate for strings that are <=24 bytes long.
  • Text read/write support for $ion::<addr> and $ion::<name> e-expressions.
  • Binary read/write support for 0xEF system e-expressions.
  • Stubs out macros for all of the yet-to-be-implemented system macros, so all macros now have the expected address.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

* Macros now impleement `Send`, allowing them to be shared across
  threads. This makes it possible for all readers and writers to
  share the same system macro table instance instead of allocating
  their own copy.
* Adds a `SystemMacroAddress` type that is range-checked at creation.
* Adds a `SystemAddress` variant to the `MacroIdRef` enum.
* Adds `Opcode::from_byte` support for `SystemEExpression`.
* `Parameter` and `Macro` now use `CompactString` to store their names,
  skipping all heap allocations in the common case.
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 90.22222% with 44 lines in your changes missing coverage. Please review.

Project coverage is 77.94%. Comparing base (482e1d9) to head (5c8002a).

Files with missing lines Patch % Lines
src/lazy/text/buffer.rs 58.06% 12 Missing and 1 partial ⚠️
src/lazy/encoder/text/v1_1/writer.rs 33.33% 0 Missing and 10 partials ⚠️
src/lazy/text/raw/v1_1/reader.rs 68.42% 6 Missing ⚠️
src/lazy/encoder/binary/v1_1/value_writer.rs 79.16% 0 Missing and 5 partials ⚠️
src/lazy/expanded/macro_table.rs 98.70% 4 Missing ⚠️
src/lazy/expanded/compiler.rs 94.44% 2 Missing ⚠️
src/lazy/binary/raw/v1_1/type_descriptor.rs 0.00% 1 Missing ⚠️
src/lazy/encoder/text/v1_1/value_writer.rs 85.71% 1 Missing ⚠️
src/lazy/expanded/e_expression.rs 0.00% 1 Missing ⚠️
src/lazy/expanded/template.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           deny-old-idioms     #862      +/-   ##
===================================================
+ Coverage            77.83%   77.94%   +0.11%     
===================================================
  Files                  136      136              
  Lines                34021    34382     +361     
  Branches             34021    34382     +361     
===================================================
+ Hits                 26479    26800     +321     
- Misses                5602     5626      +24     
- Partials              1940     1956      +16     

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

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