From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:Hermes bytecode (HBC)" |
|---|
| claim | "BytecodeFileHeader (bytecode version 99, as of the cited commit; other versions have different field sets) is packed, 128 bytes: magic u64 at 0 (0x1F1903C103BC1FC6), version u32 at 8, sourceHash[20] at 12, then 20 u32 fields from fileLength (32; counts up to the end of the footer) to debugInfoOffset (108), options u8 at 112 and 15 padding bytes." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Hermes bytecode (HBC)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "BytecodeFileHeader" |
|---|
| size | 128 |
|---|
| alignment | 1 |
|---|
| endianness | "little" |
|---|
| fields | | name | "magic" |
|---|
| type | "u64" |
|---|
| offset | 0 |
|---|
|
| name | "version" |
|---|
| type | "u32" |
|---|
| offset | 8 |
|---|
|
| name | "sourceHash" |
|---|
| type | "u8[20]" |
|---|
| offset | 12 |
|---|
|
| name | "fileLength" |
|---|
| type | "u32" |
|---|
| offset | 32 |
|---|
|
| name | "globalCodeIndex" |
|---|
| type | "u32" |
|---|
| offset | 36 |
|---|
|
| name | "functionCount" |
|---|
| type | "u32" |
|---|
| offset | 40 |
|---|
|
| name | "stringKindCount" |
|---|
| type | "u32" |
|---|
| offset | 44 |
|---|
|
| name | "identifierCount" |
|---|
| type | "u32" |
|---|
| offset | 48 |
|---|
|
| name | "stringCount" |
|---|
| type | "u32" |
|---|
| offset | 52 |
|---|
|
| name | "overflowStringCount" |
|---|
| type | "u32" |
|---|
| offset | 56 |
|---|
|
| name | "stringStorageSize" |
|---|
| type | "u32" |
|---|
| offset | 60 |
|---|
|
| name | "bigIntCount" |
|---|
| type | "u32" |
|---|
| offset | 64 |
|---|
|
| name | "bigIntStorageSize" |
|---|
| type | "u32" |
|---|
| offset | 68 |
|---|
|
| name | "regExpCount" |
|---|
| type | "u32" |
|---|
| offset | 72 |
|---|
|
| name | "regExpStorageSize" |
|---|
| type | "u32" |
|---|
| offset | 76 |
|---|
|
| name | "literalValueBufferSize" |
|---|
| type | "u32" |
|---|
| offset | 80 |
|---|
|
| name | "objKeyBufferSize" |
|---|
| type | "u32" |
|---|
| offset | 84 |
|---|
|
| name | "objShapeTableCount" |
|---|
| type | "u32" |
|---|
| offset | 88 |
|---|
|
| name | "numStringSwitchImms" |
|---|
| type | "u32" |
|---|
| offset | 92 |
|---|
|
| name | "segmentID" |
|---|
| type | "u32" |
|---|
| offset | 96 |
|---|
|
| name | "cjsModuleCount" |
|---|
| type | "u32" |
|---|
| offset | 100 |
|---|
|
| name | "functionSourceCount" |
|---|
| type | "u32" |
|---|
| offset | 104 |
|---|
|
| name | "debugInfoOffset" |
|---|
| type | "u32" |
|---|
| offset | 108 |
|---|
|
| name | "options" |
|---|
| type | "u8" |
|---|
| offset | 112 |
|---|
|
| name | "padding" |
|---|
| type | "u8[15]" |
|---|
| offset | 113 |
|---|
|
|
|---|
| variant | "bytecode version 99 (BYTECODE_VERSION in BytecodeVersion.h at the cited commit); not valid for other versions" |
|---|
| notes | "magic = 0x1F1903C103BC1FC6 (MAGIC in BytecodeVersion.h); fileLength counts until the end of the BytecodeFileFooter." |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "struct BytecodeFileHeader inside LLVM_PACKED_START; offsets summed by hand (8+4+20+20*4+1+15 = 128); a static_assert at line 391 requires size % 32 == 0." |
|---|
| repo | "https://github.com/facebook/hermes" |
|---|
| commit | "17b37301da5da4a2cd55d78f9697c46c0fd96123" |
|---|
| path | "include/hermes/BCGen/HBC/BytecodeFileFormat.h" |
|---|
| lines | "74-103" |
|---|
|
| type | "source" |
|---|
| detail | "BYTECODE_VERSION = 99 and MAGIC = 0x1F1903C103BC1FC6 (line 23 and 30); struct BytecodeFileHeader fields and the 'Until the end of the BytecodeFileFooter' comment re-read in BytecodeFileFormat.h 69-103." |
|---|
| repo | "https://github.com/facebook/hermes" |
|---|
| commit | "17b37301da5da4a2cd55d78f9697c46c0fd96123" |
|---|
| path | "include/hermes/BCGen/HBC/BytecodeVersion.h" |
|---|
| lines | "23-34" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "BytecodeFileHeader layout" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T23:29:26.861Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T17:24:24.003Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read BytecodeFileFormat.h at the cited commit: 8+4+20, then 20 uint32 members from fileLength to debugInfoOffset in the stated order, options (1 byte) and padding[15] = 128 bytes; MAGIC = 0x1F1903C103BC1FC6. Byte order is not stated in this file (fields are written in host order); not independently checked." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T07:41:24.444Z" |
|---|
| summary | "Scope: this field list is the layout of bytecode version 99 only (BYTECODE_VERSION = 99 at this commit); the header has changed between bytecode versions, so it must not be applied to other versions…" |
|---|
| changed | | "claim" |
| "data" |
| "evidence" |
|
|---|
|
|
|---|