jsc-android-buildscripts icon indicating copy to clipboard operation
jsc-android-buildscripts copied to clipboard

Upgrade JSC past 260345

Open jzxchiang1 opened this issue 2 years ago • 19 comments

Issue Description

Unfortunately, many crypto apps rely on BigInt in JS. But WebKit didn't enable BigInt support until this changeset, which is almost a year after the currently released JSC version (i.e. 250230) was initially released.

The current version WebKitGTK 2.26.1 is from 2019. Is it possible to upgrade JSC to a more recent version?

I spoke with @Kudo and apparently he tried to update it to WebKitGTK 2.30.5, which was released in early 2021. That didn't work because:

"there was a breaking change that jsc removed the Intl toggle. so we probably would have to ship only the Intl variant and increase apk size."

Is there a way to get this to work, or alternatively to use an earlier version of WebKitGTK that doesn't have this breaking change, e.g. late 2020? Not sure when that change was introduced.

Thank you! This would be huge for the crypto space.

Version, config, any additional info

jzxchiang1 avatar Oct 17 '21 18:10 jzxchiang1

Bump, I'm wondering if this is possible, thanks!

jzxchiang1 avatar Nov 11 '21 08:11 jzxchiang1

Bump

jzxchiang1 avatar Jan 19 '22 07:01 jzxchiang1

Have you considered using Hermes instead? Would that address your specific problem?

cortinico avatar Jan 19 '22 11:01 cortinico

It looks like Hermes doesn't support BigInt yet either. https://github.com/facebook/hermes/issues/510

ls-andrew-goodale avatar Jan 19 '22 13:01 ls-andrew-goodale

It looks like Hermes doesn't support BigInt yet either. facebook/hermes#510

I see your point. I guess your best bet would be to reach out to someone at Expo and try to prioritize the whole BigInt support.

cortinico avatar Jan 19 '22 15:01 cortinico

The ICU library has a build tool to reduce the size of the ICU data file, and make smaller libraries for embedded use cases. https://unicode-org.github.io/icu/userguide/icu_data/buildtool.html#overview-what-is-in-the-icu-data-file Maybe this can be added to this project to make a smaller library for the "non-intl" build of JSC? @Kudo what do you think?

ls-andrew-goodale avatar Jan 19 '22 15:01 ls-andrew-goodale

https://unicode-org.github.io/icu/userguide/icu_data/buildtool.html#overview-what-is-in-the-icu-data-file

Yeah I would use Hermes if it supported:

  • BigInt
  • WebAssembly

That's my only blocker. Can you explain why Expo would need to prioritize BigInt support? I thought Facebook was maintaining the Hermes engine. Thanks.

jzxchiang1 avatar Jan 20 '22 01:01 jzxchiang1

The ICU library has a build tool to reduce the size of the ICU data file, and make smaller libraries for embedded use cases. https://unicode-org.github.io/icu/userguide/icu_data/buildtool.html#overview-what-is-in-the-icu-data-file Maybe this can be added to this project to make a smaller library for the "non-intl" build of JSC? @Kudo what do you think?

@ls-andrew-goodale there're still some difference in the non-intl variant, e.g. typeof(Intl) === 'undefined'. i still think about to ship intl variant only. maybe we can do that after hermes be the default vm in react-native.

Kudo avatar Jan 21 '22 13:01 Kudo

An updated jsc runtime would be very much appreciated by current rn/expo web3 developers, given that jsc/hermes are hardcoded in some important deps, which makes it really difficult to adopt the juicy v8

sunnylqm avatar Jun 05 '22 15:06 sunnylqm

What about releasing it as a pre-release or simply not bump the dependency in React Native? Hermes is missing some pretty basic JS features like block scoping and classes and Meta is consistently rejecting those as valid use cases, making it a non-viable option for us. It would be great to make use of the latest improvements to JSC on an opt-in basis.

oblador avatar Jun 12 '22 15:06 oblador

i can publish a new release on npm, just not to bump the version in react-native.

@sunnylqm i've seen you have a version already. do you mind to send us a pr?

Kudo avatar Jun 13 '22 12:06 Kudo

@Kudo I tried with webkitgtk version 2.27, 2.28 with some patches commented out, but unfortunately there are some crash seen in production app.

sunnylqm avatar Jun 13 '22 12:06 sunnylqm

With almost zero knowledge on c/c++, i am not capable and lucky enough to build version above 2.28.4 😂

sunnylqm avatar Jun 13 '22 12:06 sunnylqm

well, i can try to do the upgrade. no promise yet because i'm super busy these two months.

Kudo avatar Jun 13 '22 13:06 Kudo

https://github.com/react-native-community/jsc-android-buildscripts/pull/168
enable bigint support for the current jsc. it kinda works if you do not require much features.

sunnylqm avatar Jun 15 '22 15:06 sunnylqm

close via #169. jsc-android@next, please note that there're some breaking changes from this version. let me know whether it works for you. thanks!

Kudo avatar Jul 13 '22 08:07 Kudo

Was #169 supposed to add support for bigint? @Kudo

antondalgren avatar Apr 27 '23 09:04 antondalgren

I tried with a fresh install of react-native 0.69.10 and setting following resolution to my package.json.

  "resolutions": {
    "jsc-android": "294992.0.0"
  },

But the android version still doesn't work with bigint for me.

antondalgren avatar Apr 27 '23 10:04 antondalgren

Stumbled upon this comment, https://github.com/facebook/react-native/issues/35504#issuecomment-1331803148 and it made it work for me.

antondalgren avatar Apr 27 '23 11:04 antondalgren