Skip to content

Conversation

NickGerleman
Copy link

@NickGerleman NickGerleman commented Oct 31, 2019

Summary

bytecodeFileName is used excusively by ChakraExecutor in react-native-windows, and diverges us from upstream. Remove the concept in favor of passing bytecodeFileName directly to the ChakraJsExecutorFactory at creation time. We currently use a single bytecode file per-instance , so we see no loss of functionality when moving to a 1:1 relationship between executor and bytecode file.

Locally validated that Android NDK libs still build. Verified we can build react-native-windows after some small changes that must be commited separately.

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native
Microsoft Reviewers: Open in CodeFlow

@msftclas
Copy link

msftclas commented Oct 31, 2019

CLA assistant check
All CLA requirements met.

@pull-bot
Copy link

pull-bot commented Oct 31, 2019

Messages
📖

📋 Missing Changelog - Can you add a Changelog? To do so, add a "## Changelog" section to your PR description. A changelog entry has the following format: [CATEGORY] [TYPE] - Message.

CATEGORY may be:
  • General
  • iOS
  • Android
  • JavaScript
  • Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

  • Added, for new features.
  • Changed, for changes in existing functionality.
  • Deprecated, for soon-to-be removed features.
  • Removed, for now removed features.
  • Fixed, for any bug fixes.
  • Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.

📖 📋 Missing Test Plan - Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.
📖 📋 Missing Summary - Can you add a Summary? To do so, add a "## Summary" section to your PR description. This is a good place to explain the motivation for making this change.

Generated by 🚫 dangerJS against e175841

bytecodeFileName is used excusively by ChakraExecutor in react-native-windows, and diverges us from upstream. Remove the concept in favor of passing bytecodeFileName directly to the ChakraJsExecutorFactory at creation time. We currently use a single bytecode file per-instance , so we see no loss of functionality when moving to a 1:1 relationship between executor and bytecode file.

Locally validated that Android NDK libs still build. Verified we can build react-native-windows after some small changes that must be commited separately.
@NickGerleman NickGerleman marked this pull request as ready for review October 31, 2019 03:29
@NickGerleman
Copy link
Author

@hansenyy is added to the review. #Closed

@NickGerleman
Copy link
Author

@vmoroz is added to the review. #Closed

} else if (reactInstance) {
reactInstance->loadScriptFromString(std::make_unique<NSDataBigString>(script), 0,
sourceUrlStr.UTF8String, !async, ""); // TODO(OSS Candidate ISS#2710739)
reactInstance->loadScriptFromString(std::make_unique<NSDataBigString>(script), 0, // TODO(OSS Candidate ISS#2710739)
Copy link
Author

Choose a reason for hiding this comment

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

the 0 here is for bundleVersion which still differs

@acoates-ms
Copy link
Collaborator

Are you sure about this?: "We currently use a single bytecode file per-instance , so we see no loss of functionality when moving to a 1:1 relationship between executor and bytecode file."

Don't we use platform bundles in devmain? I mean, I think this should still be done through calls directly to the executor, just checking that you have all the downstream changes thought through to devmain that would be required to land this change.

@vmoroz
Copy link
Member

vmoroz commented Oct 31, 2019

This change will require a lot of downstream changes. Could you prepare them to be ready right after you submit this change?

@NickGerleman
Copy link
Author

@vmoroz @acoates-ms I have a separate change ready to go for react-native-windows, and I don't believe we should cause breakage in devmain, though I may be missing something. I can send out a separate PR for that if interested, though it cannot be merged until we publish a new npm package from here.

On the react-native-windows side, InstanceImpl seems to exclusively feed the bytecode filename from DevSettings to the ChakraExecutor. InstanceWrapper doesn't seem to expose a mechanism to set bytecodeFilename apart from DevSettings, so it seems like there's no interface changes unless something in devmain is using something at a lower level of abstraction. @hansenyy could you confirm?

Related. I noticed something weird in CWinReactImpl::InitializeThis in devmain, where we have some logic to set bytecode filename in devSettings but never actually seem to use this. Is this just NYI, or should we have a bug on this? See "/reactnativehost/ReactImpl_Win.cpp:L190" (Guessing we can't put devmain code in public comments?)

NickGerleman added a commit to NickGerleman/react-native-windows that referenced this pull request Oct 31, 2019
We currently determine bytecodeFileName when creating InstanceImpl, determined by the passed in DevSettings. This change makes it so that we pass the bytecodeFilename as an InstanceArg to the ChakraExecutorFactory instead of passing it through public JSInstance and JSExecutor APIs.

This change is dependent on microsoft/react-native-macos#183 in react-native.

Haven't tested this end-to-end yet (having issues doing it locally). Will get that sorted out before merging either PR, since we cannot rely on CI until we check in the RN change.
@vmoroz
Copy link
Member

vmoroz commented Oct 31, 2019

The devmain code you are referring to is obsolete. Instead, we call the loadApplication explicitly. Let's not discuss it in this public repo. I would expect that we change the JSExecutor to map the JS bundle to bytecode. I guess it is part of react-native-windows.


In reply to: 548503903 [](ancestors = 548503903)

Copy link
Member

@vmoroz vmoroz left a comment

Choose a reason for hiding this comment

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

:shipit:

NickGerleman added a commit to NickGerleman/react-native-windows that referenced this pull request Oct 31, 2019
We currently determine bytecodeFileName when creating InstanceImpl, determined by the passed in DevSettings. This change makes it so that we pass the bytecodeFilename as an InstanceArg to the ChakraExecutorFactory instead of passing it through public JSInstance and JSExecutor APIs.

This change is dependent on microsoft/react-native-macos#183 in react-native.

Haven't tested this end-to-end yet (having issues doing it locally). Will get that sorted out before merging either PR, since we cannot rely on CI until we check in the RN change.
Copy link

@hansenyy hansenyy left a comment

Choose a reason for hiding this comment

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

:shipit:

@NickGerleman
Copy link
Author

Going to abandon this as is and revisit with something a bit more comprehensive. There are the platform bundle concerns that were brought up which necessitate some further changes, but I don't love the story we leave here for bytecode logic in general, where we have versioning left in ms/rn but path logic in devmain. This is further complicated by JSI executors moving to PreparedScriptStore, meaning we need to be intentional in making whatever we introduce easy to rip out.

NickGerleman added a commit to NickGerleman/react-native-windows that referenced this pull request Nov 6, 2019
We currently determine bytecodeFileName when creating InstanceImpl, determined by the passed in DevSettings. This change makes it so that we pass the bytecodeFilename as an InstanceArg to the ChakraExecutorFactory instead of passing it through public JSInstance and JSExecutor APIs.

This change is dependent on microsoft/react-native-macos#183 in react-native.

Haven't tested this end-to-end yet (having issues doing it locally). Will get that sorted out before merging either PR, since we cannot rely on CI until we check in the RN change.
NickGerleman added a commit to microsoft/react-native-windows that referenced this pull request Nov 6, 2019
…#3591)

* Update to react-native@0.60.0-microsoft.16

* Change files

* Change files

* Move bytecodeFileName setting to ChakraExecutorFactory

We currently determine bytecodeFileName when creating InstanceImpl, determined by the passed in DevSettings. This change makes it so that we pass the bytecodeFilename as an InstanceArg to the ChakraExecutorFactory instead of passing it through public JSInstance and JSExecutor APIs.

This change is dependent on microsoft/react-native-macos#183 in react-native.

Haven't tested this end-to-end yet (having issues doing it locally). Will get that sorted out before merging either PR, since we cannot rely on CI until we check in the RN change.

* Move from a static bytecodeFilename in DevSettings to a newly introduced ScriptByteCodeResolver, letting us inject some logic in how to determine bytecode from URIs.

* Add ScriptMetadataMap for ChakraExecutor

We're going to move to a new design for bytecode caching/prepared scripts when moving to JSI. In the meantime, we can reuse most of the existing ChakraExecutor bytecode and script versioning logic. Pass this association in as a map to DevSettings instead of piping it through each call.

* Remove some more dead code

* Use member DevSettings in InstanceImpl instead of dead parameter

* Rename some things. Change the metadata map to be stored by value instead of pointer to avoid dual null states of empty map and actually null. This should be fine from a perf perspective since we don't have many bundles, and we avoid an extra heap allocation for the shared_ptr.

* Update lockfile

* Yarn format

* UWP Build Fixes
@NickGerleman NickGerleman deleted the bc-filename branch November 6, 2019 09:51
NickGerleman pushed a commit to NickGerleman/react-native that referenced this pull request Jul 1, 2025
Summary:
Pull Request resolved: facebook#52317

Changelog: [Internal] - Update `react-native/debugger-frontend` from d95ac13...35c4630

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](facebook/react-native-devtools-frontend@d95ac13...35c4630).

### Changelog

| Commit | Author | Date/Time | Subject |
| ------ | ------ | --------- | ------- |
| [35c4630bd](facebook/react-native-devtools-frontend@35c4630bd) | Vitali Zaidman (vzaidman@gmail.com) | 2025-06-26T09:47:45+01:00 | [track stack trace symbolication failures (microsoft#183)](facebook/react-native-devtools-frontend@35c4630bd) |
| [e4487ef2e](facebook/react-native-devtools-frontend@e4487ef2e) | Vitali Zaidman (vzaidman@gmail.com) | 2025-06-24T14:29:35+01:00 | [support symbolication with native frames (microsoft#181)](facebook/react-native-devtools-frontend@e4487ef2e) |

Reviewed By: huntie

Differential Revision: D77437936

fbshipit-source-id: 5b64195064aa5e157ae1adad01a3f2dc94045f98
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.

6 participants