Skip to content

Conversation

@ammarahm-ed
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings November 12, 2025 17:03
@ammarahm-ed ammarahm-ed merged commit fce8e68 into main Nov 12, 2025
5 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_script function to load and execute bytecode
  • Addition of napi_run_bytecode API 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);
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copilot uses AI. Check for mistakes.
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