View Issue Details

IDProjectCategoryView StatusLast Update
0000096fileGeneralpublic2019-08-05 13:10
Reporterkoala_man Assigned Tochristos  
PrioritylowSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.37 
Fixed in Version5.38 
Summary0000096: Add support for Hermes compiled JavaScript bytecode
DescriptionHi! I am one of the developers of Hermes, a new JavaScript engine for mobile that pre-compiles JavaScript into bytecode. For your consideration, here is magic that can recognize our bytecode files (64bit magic + 32bit integer version, little-endian):

    0 lequad 0x1F1903C103BC1FC6 Hermes compiled JavaScript bytecode,
    >8 lelong x version %d

I think there is a case for upstreaming this because: 1. the use of a 64bit magic number minimizes the risk of false positives, 2. it's convenient for mobile JS to be able to determine a file's bytecode version to check compatibility, and 3. there are already hundreds of millions of mobile devices carrying files in this format.

Please let me know what you think.
Steps To ReproduceI have attached `hello.hbc`, a simple `print("Hello World");` compiled into Hermes bytecode using `hermes -O -emit-binary -out hello.hbc hello.js`

Without the suggested magic, file's guess is `data`. With the magic, it says:

    hello.hbc: Hermes compiled JavaScript bytecode, version 60
Additional InformationHermes is developed by Facebook and was open sourced in July 2019: https://hermesengine.dev/

The bytecode header and magic numbers can be found in: https://github.com/facebook/hermes/blob/a09052e901f4b8dc925e6d4bd0cc47171b90db5e/include/hermes/BCGen/HBC/BytecodeFileFormat.h#L24
Tagsmagic

Activities

koala_man

2019-08-02 20:34

reporter  

hello.hbc (284 bytes)

christos

2019-08-05 13:10

manager   ~0003282

Fixed, thanks!

Issue History

Date Modified Username Field Change
2019-08-02 20:34 koala_man New Issue
2019-08-02 20:34 koala_man File Added: hello.hbc
2019-08-02 20:34 koala_man Tag Attached: magic
2019-08-05 13:09 christos Assigned To => christos
2019-08-05 13:09 christos Status new => assigned
2019-08-05 13:10 christos Status assigned => resolved
2019-08-05 13:10 christos Resolution open => fixed
2019-08-05 13:10 christos Fixed in Version => 5.38
2019-08-05 13:10 christos Note Added: 0003282