| #
695fef9b |
| 18-Apr-2023 |
Kudo Chien <[email protected]> |
[core] fix build error on rn 0.72 (#22170)
# Why
after react-native 0.72, the `LongLivedObjectCollection` constructor is removed and only available for the singleton: https://github.com/facebook/
[core] fix build error on rn 0.72 (#22170)
# Why
after react-native 0.72, the `LongLivedObjectCollection` constructor is removed and only available for the singleton: https://github.com/facebook/react-native/blob/9e5c963e2dbd90dbf2d260b67c2897e924be066e/packages/react-native/ReactCommon/react/bridging/LongLivedObject.h#L41-L44
the original solution from #19699 will have a build error on react-native 0.72
# How
rather than create a dedicated `LongLivedObjectCollection`, use the singleton `LongLivedObjectCollection` and do cleanup when `~ExpoModulesHostObject()`.
note: for react-native, the only call path to `LongLivedObjectCollection::get().clear()` is from TurboModuleBinding. in old architecture mode, react-native will not cleanup the `LongLivedObjectCollection`.
# Test Plan
follow #19699 to test the reloading
show more ...
|
| #
7cfebc52 |
| 31-Mar-2023 |
Łukasz Kosmaty <[email protected]> |
[core][Android] Improve memory consumption (#21906)
# Why
Improves memory consumption.
Adds a native destructor to the shared object.
# How
- Adds a native destructor to the shared objec
[core][Android] Improve memory consumption (#21906)
# Why
Improves memory consumption.
Adds a native destructor to the shared object.
# How
- Adds a native destructor to the shared object instance.
- Patched memory leak caused by unreleased global reference inside of the MethodMetadata class.
- Adds a global registry to force deallocation of JNI objects that holds references to jsi values when the app is reloaded.
- Adds a memory inspector to check which of JNI objects are still present in the memory.
# Test Plan
- unit tests ✅
- bare-expo with JSC and Hermes ✅
show more ...
|
| #
ecb7f347 |
| 29-Mar-2023 |
Łukasz Kosmaty <[email protected]> |
[core][Android] Introduce shared object (#21855)
# Why
This's a follow-up to https://github.com/expo/expo/pull/17514.
# How
- Added a shared object registry
- Run a native constructor if
[core][Android] Introduce shared object (#21855)
# Why
This's a follow-up to https://github.com/expo/expo/pull/17514.
# How
- Added a shared object registry
- Run a native constructor if present when creating a js class
- Added a shared object with its js representation to the registry
- Added a converter for shared object
# TODO
- [ ] call native destructor when class is deallocated
- [ ] use weak refs to hold js objects in the registry
# Test Plan
- unit tests ✅
show more ...
|
| #
cf4fff55 |
| 22-Mar-2023 |
Łukasz Kosmaty <[email protected]> |
[core][Android] Add class component (#21799)
# Why
Adds class component. This's a follow-up to https://github.com/expo/expo/pull/17412.
# How
Added a class component similar to the one on i
[core][Android] Add class component (#21799)
# Why
Adds class component. This's a follow-up to https://github.com/expo/expo/pull/17412.
# How
Added a class component similar to the one on iOS. It's not finished yet - this's just the first part.
# To do
- Rename `JavaScriptModuleObject` to something more descriptive. That class is no longer used just to declare modules
- Call constructor defined in the class component
- Pass `this` to sync/async functions.
- Add shared objects
# Test Plan
- unit tests ✅
show more ...
|
| #
aaf1c10d |
| 26-Oct-2022 |
Kudo Chien <[email protected]> |
[core] Fix reload crash from accessing callback dangling pointers (#19699)
# Why
fix crash from accessing callback dangling pointers when reloading. this issue is found from sdk 47 versioned qa a
[core] Fix reload crash from accessing callback dangling pointers (#19699)
# Why
fix crash from accessing callback dangling pointers when reloading. this issue is found from sdk 47 versioned qa and possibly relates to https://github.com/expo/expo/issues/19167#issuecomment-1280747562
close ENG-6811
# How
the `RAIICallbackWrapperDestroyer` is designed to collect callbacks even they are not called. it will collect callbacks when the std::function is destroyed. from our MethodMetadata design, the std::function is collected by java GC. my hypothesis is that when reloading if js runtime is destroyed before java GC, the underlying jsi::Function will be a dangling pointer when the `RAIICallbackWrapperDestroyer` trying to collect the callback.
the pr tries to use a dedicated `LongLivedObjectCollection` for each module, and we can reset the collection when reloading.
# Test Plan
- tested on bare-expo
1. set `USE_DEV_CLIENT = true` in MainApplication
2. update App.js with [the content](https://github.com/Kudo/demo-expo-auth-session/blob/master/App.js)
3. keep reloading the app
- android unversioned expo go + NCL AsyncStorage reload
show more ...
|
| #
7ed3a4bf |
| 20-Sep-2022 |
Łukasz Kosmaty <[email protected]> |
[modules][Android] Remove temporary array when passing args to java (#19170)
# Why
Removes temporary array which was used to pass arguments from C++ to java.
By doing that I could reduce the num
[modules][Android] Remove temporary array when passing args to java (#19170)
# Why
Removes temporary array which was used to pass arguments from C++ to java.
By doing that I could reduce the number of global references that have to be created before calling the async function.
# Test Plan
- unit tests ✅
- bare-expo and NCL ✅
show more ...
|
| #
65a981dd |
| 22-Aug-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet API][Kotlin] Add frontend argument conversion (#18714)
# Why
Redesigns the argument conversions system.
# How
- Adds frontend converts (converters that work in the CPP and do the ear
[sweet API][Kotlin] Add frontend argument conversion (#18714)
# Why
Redesigns the argument conversions system.
# How
- Adds frontend converts (converters that work in the CPP and do the early conversion to the JNI types which can be passed to the Kotlin code).
- Adds a cache for frontend converters
- Adds an abstraction over the expected type to the CPP layer.
# Test Plan
- unit tests ✅
show more ...
|
| #
6f5b8a20 |
| 16-Aug-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet API][Kotlin] Pass more information about expected types to C++ (#18653)
# Why
Another step to stop using `folly` on Android.
Passes more information about expected types to C++ to make th
[sweet API][Kotlin] Pass more information about expected types to C++ (#18653)
# Why
Another step to stop using `folly` on Android.
Passes more information about expected types to C++ to make the conversion there smarter.
Note that this PR is just a first step in that direction and that information isn't used in many cases. However, I've made a simple optimization to create classes like Integer and Float directly in C++. Before, we alwayse converted numbers to Double and then we did a second conversion. As a result, we created more objects than needed.
# How
- Added a class representing information about the expected type
- Added simple Integer/Float optimization.
# Test Plan
- unit tests ✅
show more ...
|
| #
05c5e37d |
| 29-Jul-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet API][Kotlin] Implement sweet typed arrays (#18379)
# Why
A follow-up to the https://github.com/expo/expo/pull/17667.
# How
- Reused some C++ utils to deal with typed arrays
- Made c
[sweet API][Kotlin] Implement sweet typed arrays (#18379)
# Why
A follow-up to the https://github.com/expo/expo/pull/17667.
# How
- Reused some C++ utils to deal with typed arrays
- Made classes for typed arrays on both sides: native and JS
- Added new converters to obtain typed arrays as function arguments
- Added tests
# Test Plan
- unit tests ✅
show more ...
|
| #
22d99763 |
| 12-Jul-2022 |
Łukasz Kosmaty <[email protected]> |
[core][Android] Fix crashes in async functions (#18206)
# Why
Closes ENG-5686.
A follow-up to the https://github.com/expo/expo/pull/18200.
# How
`local_ref` may not be valid when we capt
[core][Android] Fix crashes in async functions (#18206)
# Why
Closes ENG-5686.
A follow-up to the https://github.com/expo/expo/pull/18200.
# How
`local_ref` may not be valid when we capture them in the lambdas. Therefore, I migrate them to `global_ref`.
Why won't copying references work here?
That solution also is open to the same problem. JNI is constructed in a way where everything is bound to the current stack frame. So when the program leaves a frame where something was allocated, is allowed to clear that. By coping references, we do not ensure that the underlying object will outlive the current scope.
# Test Plan
- NCL ✅
- unit tests ✅
show more ...
|
| #
47a022e6 |
| 29-Jun-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet][Kotlin] Add properties (#18015)
# Why
Adds support for properties.
A follow-up to the https://github.com/expo/expo/pull/17988.
# How
The code behind this future is very similar to
[sweet][Kotlin] Add properties (#18015)
# Why
Adds support for properties.
A follow-up to the https://github.com/expo/expo/pull/17988.
# How
The code behind this future is very similar to the current implementation of the sync functions. I've reused the whole calling solution from jsi functions.
# Test Plan
- unit tests ✅
show more ...
|
| #
9ebf31e6 |
| 27-Jun-2022 |
Łukasz Kosmaty <[email protected]> |
[sweet API][Kotlin] Move preliminary args conversion to Cpp (#17944)
# Why
Moves preliminary args conversion to Cpp.
Needs to work:
- https://github.com/expo/expo/pull/17938
- https://github.c
[sweet API][Kotlin] Move preliminary args conversion to Cpp (#17944)
# Why
Moves preliminary args conversion to Cpp.
Needs to work:
- https://github.com/expo/expo/pull/17938
- https://github.com/expo/expo/pull/17940
- https://github.com/expo/expo/pull/17942
- https://github.com/expo/expo/pull/17943
# How
- Created the `CachedReferencesRegistry` that stores references to often used Java classes. In the future, we may want to store also jsi object there too.
- Reduced the usage of `folly`.
- Added unit tests.
# Benefits
- You can obtain `JavaScriptValue` and `JavaScriptObject` as a function argument
# Test Plan
- unit tests (that covers sync and async functions call too) ✅
show more ...
|
| #
64f5c95f |
| 17-May-2022 |
Łukasz Kosmaty <[email protected]> |
[module-core][Kotlin] Add basic support for sync function (#16977)
# Why
Closes ENG-4608.
Adds basic support for sync function.
# How
- Created ExpoModulesHostObject that installs into the
[module-core][Kotlin] Add basic support for sync function (#16977)
# Why
Closes ENG-4608.
Adds basic support for sync function.
# How
- Created ExpoModulesHostObject that installs into the runtime as `global.ExpoModules`. A host object is an abstract object where we can define our property getter, allowing us to create JS object for each module lazily.
- Added `isAsync` property to sweet functions and `runSynchronously()` modifier - that will be changed in the future.
- Created `JavaScriptModuleObject` that represents a module in the JS world. It has a map of methods with a cached body.
- All the communication goes via two kotlin methods - `getJavaScriptModuleObject` (which returns a hybrid representation of the module) and `callMethodSync` (which is calling correct implementation). Right now, I'm not using lambdas to pass Kotlin functions into CPP, because I don't see any reason why should I.
# Test Plan
- tested with bare-expo ✅
show more ...
|