feat: Add HBC versions 90, 94, 96 support#50
Open
devsphere-apps wants to merge 2 commits into
Open
Conversation
- Add hbc90: BigInt support (LoadConstBigInt, LoadConstBigIntLongIndex), segmentID (renamed from cjsModuleOffset), bigIntCount, bigIntStorageSize, functionSourceCount header fields, BigInt table/storage parsing, FunctionSource table parsing, padding reduced 31→19 bytes - Add hbc94: BytecodeOptions refinements (same binary layout as v90) - Add hbc96: hasAsync flag in BytecodeOptions - Update hbctool/hbc/__init__.py to register versions 90, 94, 96 - Bump version to 0.2.0 in metadata.py and pyproject.toml - Update Python requirement to ^3.8, add classifiers for 3.8–3.12 - Update README.md with supported version table, changelog, troubleshooting - Add CONTRIBUTING.md with guide for adding new HBC versions - Add VERSION_HISTORY.md documenting format changes per version - Add test_new_versions.py validation tests Fixes bongtrop#39 (v90) Fixes bongtrop#40 (v94) Fixes bongtrop#47 (v96) Fixes bongtrop#48 (v96) Fixes bongtrop#41 (v85 - already existed) Made-with: Cursor
Regenerate data/opcode.json from facebook/hermes main BytecodeList.def via the updated opcode_generator (includes HERMES_RUN_WASM block for real React Native bundles). Strip :B and :F operand suffixes in translators before operand_type lookup; accept UInt16:B/UInt32:B in tests. Developer experience: lazy-import docopt in main(); add hbctool/__main__.py for python -m hbctool; add repo-root test.py runner for legacy unittests. Docs: README venv/Pip install, externally-managed-environment, disasm outputs (instruction.hasm); CONTRIBUTING test commands; VERSION_HISTORY opcode regeneration note; gitignore kapanya_output and hermes_out-style paths. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for Hermes Bytecode 90, 94, and 96: updated file header layout, parser segments (BigInt table/storage, function source table,
segmentID, etc.), and registeredHBC90/HBC94/HBC96.Opcode tables for v90+ are aligned with facebook/hermes
BytecodeList.def(including theHERMES_RUN_WASMblock) so real-worldindex.android.bundlefiles from current React Native / Hermes builds disassemble successfully.Changes
bigIntCount,bigIntStorageSize,segmentID(replacescjsModuleOffset),functionSourceCount, padding 31→19; BigInt + function-source segments; updated opcodes.hasAsyncinBytecodeOptions(single-byte options field, per Hermes).data/opcode.jsonfrom upstreamBytecodeList.def; v90/v94/v96 translators handle operand suffixes (:S,:B,:F).pyproject.toml,metadata.py).CONTRIBUTING.md,VERSION_HISTORY.md.test_new_versions.py(12 tests); roottest.pyruns 23 legacy unittests from the repo root.docoptimport;python -m hbctoolvia__main__.py.Fixes
Fixes #39
Fixes #40
Fixes #47
Fixes #48
How to test
Result: all 12
test_new_versionstests passed; legacy suite 23 tests passed (OK).