Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for loading and executing Hermes bytecode files in the test-app runtime.
Key changes:
- Implementation of
js_run_cached_scriptfunction to load and execute bytecode - Addition of
napi_run_bytecodeAPI declaration for Hermes - Updated Hermes native libraries (libjsi.so) for both x86_64 and armeabi-v7a architectures
Reviewed Changes
Copilot reviewed 2 out of 14 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test-app/runtime/src/main/cpp/napi/hermes/jsr.cpp | Implements bytecode loading functionality using File::ReadBinary and napi_run_bytecode |
| test-app/runtime/src/main/cpp/napi/hermes/include_shermes/hermes/hermes_node_api.h | Adds napi_run_bytecode API declaration for running bytecode |
| test-app/runtime/src/main/libs/shermes/x86_64/libjsi.so | Updated Hermes native library for x86_64 architecture |
| test-app/runtime/src/main/libs/shermes/armeabi-v7a/libjsi.so | Updated Hermes native library for armeabi-v7a architecture |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return napi_cannot_run_js; | ||
| } | ||
|
|
||
| return napi_run_bytecode(env, data, length, file, result); |
There was a problem hiding this comment.
Memory leak: The data allocated by tns::File::ReadBinary is not freed after calling napi_run_bytecode. According to the File::ReadBinary implementation, it allocates memory with new uint8_t[length] which needs to be deleted by the caller. Either delete the data after the bytecode execution, or ensure napi_run_bytecode takes ownership of the buffer.
Suggested change
| return napi_run_bytecode(env, data, length, file, result); | |
| napi_status status = napi_run_bytecode(env, data, length, file, result); | |
| delete[] data; | |
| return status; |
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.
No description provided.