Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement "tickleJS" for Hermes #39289

Closed
wants to merge 1 commit into from

Conversation

luluwu2032
Copy link
Contributor

Summary:
"tickleJS" is a function in RN Hermes Debugger, we need to implement it for Bridgeless for feature correctness and keep parity with Bridge.

Changelog:
[General][Changed] - Implement "tickleJS" for Hermes

Differential Revision: D48952581

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Sep 5, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48952581

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48952581

luluwu2032 pushed a commit to luluwu2032/react-native that referenced this pull request Sep 5, 2023
Summary:
Pull Request resolved: facebook#39289

"tickleJS" is a function in RN Hermes Debugger, we need to implement it for Bridgeless for feature correctness and keep parity with Bridge.

Changelog:
[General][Changed] -  Implement "tickleJS" for Hermes

Differential Revision: D48952581

fbshipit-source-id: ce83dfd81c8b1258f462c7325998db7586073f31
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48952581

luluwu2032 pushed a commit to luluwu2032/react-native that referenced this pull request Sep 5, 2023
Summary:
Pull Request resolved: facebook#39289

"tickleJS" is a function in RN Hermes Debugger, we need to implement it for Bridgeless for feature correctness and keep parity with Bridge.

Changelog:
[General][Changed] -  Implement "tickleJS" for Hermes

Differential Revision: D48952581

fbshipit-source-id: 321855443381761ec0dc709c6f5ff64d49369bda
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48952581

luluwu2032 added a commit to luluwu2032/react-native that referenced this pull request Sep 13, 2023
Summary:

"tickleJS" is a function in RN Hermes Debugger, we need to implement it for Bridgeless for feature correctness and keep parity with Bridge.

Changelog:
[Internal] -  Implement "tickleJS" for Hermes in Bridgeless mode

### Summary of discussion:

**Goal of this diff**:
Implement tickleJS for Hermes debugger with Bridgeless, here is Bridge's implementation
https://www.internalfb.com/code/fbsource/[7058fb4dae4f]/xplat/ReactNative/react/jsi/HermesExecutorFactory.cpp?lines=45-57

**The key problem to solve:**
As you can see from Bridge's implementation, we need to dispatch the js call of "__tickleJs" to dedicated JS thread queue for thread safety, and it did cause a crash for me locally without dispatching to JS thread queue (see P818439922).

For Bridgeless passing the JS message queue directly works, but then we would naturally want ask if RuntimeExecutor/RuntimeScheduler is a better choice because: 1, It should also work 2, It's the common way to run js code in native with Bridgeless 3, Can avoid potential race condition caused by dispatching to JS message queue directly 4, We're planning to expose RuntimeExecutor/RuntimeScheduler or a similar abstraction anyway. So the argument here is which solution should we take?

**Why we decide to move forward with the JS msq solution?**
- Time constraint: we need to ship this before 0.73
- After discussion there hasn't been any major concern over dispatching to JS msq directly so far
- How to expose RuntimeExecutor/RuntimeScheduler is a bigger topic which need further research, we don't want to hold this diff for it

For detailed discussion see the post https://fb.workplace.com/groups/react.technologies.discussions/permalink/3615044702060575/

Reviewed By: javache

Differential Revision: D48952581
@analysis-bot
Copy link

analysis-bot commented Sep 13, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,970,413 +122
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 9,562,848 +117
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 5a926c5
Branch: main

Summary:

"tickleJS" is a function in RN Hermes Debugger, we need to implement it for Bridgeless for feature correctness and keep parity with Bridge.

Changelog:
[Internal] -  Implement "tickleJS" for Hermes in Bridgeless mode

### Summary of discussion:

**Goal of this diff**:
Implement tickleJS for Hermes debugger with Bridgeless, here is Bridge's implementation
https://www.internalfb.com/code/fbsource/[7058fb4dae4f]/xplat/ReactNative/react/jsi/HermesExecutorFactory.cpp?lines=45-57

**The key problem to solve:**
As you can see from Bridge's implementation, we need to dispatch the js call of "__tickleJs" to dedicated JS thread queue for thread safety, and it did cause a crash for me locally without dispatching to JS thread queue (see P818439922).

For Bridgeless passing the JS message queue directly works, but then we would naturally want ask if RuntimeExecutor/RuntimeScheduler is a better choice because: 1, It should also work 2, It's the common way to run js code in native with Bridgeless 3, Can avoid potential race condition caused by dispatching to JS message queue directly 4, We're planning to expose RuntimeExecutor/RuntimeScheduler or a similar abstraction anyway. So the argument here is which solution should we take?

**Why we decide to move forward with the JS msq solution?**
- Time constraint: we need to ship this before 0.73
- After discussion there hasn't been any major concern over dispatching to JS msq directly so far
- How to expose RuntimeExecutor/RuntimeScheduler is a bigger topic which need further research, we don't want to hold this diff for it

For detailed discussion see the post https://fb.workplace.com/groups/react.technologies.discussions/permalink/3615044702060575/

Reviewed By: javache

Differential Revision: D48952581
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48952581

@github-actions
Copy link

This pull request was successfully merged by Lulu Wu in fe4dab9.

When will my fix make it into a release? | Upcoming Releases

@github-actions github-actions bot added the Merged This PR has been merged. label Sep 13, 2023
adamaveray added a commit to adamaveray/react-native that referenced this pull request Sep 13, 2023
* main: (1012 commits)
  Add simple constructor for JSError (facebook#39415)
  Breaking: per-node pointScaleFactor (facebook#39403)
  Implement "tickleJS" for Hermes (facebook#39289)
  Add thread idle indicator (facebook#39206)
  Unblock `yarn android` on main (facebook#39413)
  Remove Codegen buck-oss scripts as they're unused (facebook#39422)
  Immediately dispatch events to the shared C++ infrastructure to support interruptability (facebook#39380)
  Fix race condition in Binding::reportMount (facebook#39420)
  Clone free state progression (facebook#39357)
  fix: return the correct default trait collection (facebook#38214)
  Read the React Native version and set the new arch flag properly (facebook#39388)
  Deprecate default_flags in Podfile (facebook#39389)
  Create Helper to read the package.json from Cocoapods (facebook#39390)
  Create helper to enforce the New Arch enabled for double released (facebook#39387)
  Remove layoutContext Drilling (facebook#39401)
  Remove JNI Binding usage of layoutContext (facebook#39402)
  Extract isBaselineLayout() (facebook#39400)
  Refactor and separate layout affected nodes react marker (facebook#39249)
  Bump AGP to 8.1.1 (facebook#39392)
  Fix broken Gradle Sync when opening the project with Android Studio (facebook#39412)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants