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

[skrifa] tthint: instruction dispatch #774

Merged
merged 5 commits into from
Feb 8, 2024
Merged

[skrifa] tthint: instruction dispatch #774

merged 5 commits into from
Feb 8, 2024

Conversation

dfrg
Copy link
Member

@dfrg dfrg commented Feb 7, 2024

Based on #773, uses the decoder in that PR to handle dispatch to the currently implemented instructions.

No tests in this one. Will add in a later PR when more functionality has landed.

Adds an opcode definition, instruction representation and decoder for TrueType bytecode.

Also renames Args -> InlineOperands and moves the type from skrifa to read-fonts.
Based on #773, uses the decoder in that PR to handle dispatch to the currently implemented instructions.

No tests in this one. Will add in a later PR when more functionality has landed.
rsheeter
rsheeter approved these changes Feb 7, 2024
- add limit for total number of instructions executed (same as FT)
- don't return count from Engine::run()
Base automatically changed from tthint-bytecode to main February 8, 2024 02:04
- move bytecode to glyf module
- replace negation with abs()
- make DecodeError a unit-like struct

In addition, replace byte to Opcode table with a match expression. This codegens the same as transmute!
@dfrg
Copy link
Member Author

dfrg commented Feb 8, 2024

Following up here with completed changes suggested in #773:

  • move bytecode to glyf module
  • replace negation with abs()
  • make DecodeError a unit-like struct

In reference to #773 (comment), I looked at assembly for the table lookups and it turns out that bounds checks are elided, but memory accesses are not. However, replacing the body of Opcode::from_byte() with a match statement rather than a table lookup codegens exactly the same as a transmute! So I've included that change here as well.

@dfrg dfrg merged commit 9521536 into main Feb 8, 2024
9 checks passed
@dfrg dfrg deleted the tthint-dispatch branch February 8, 2024 05:11
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