commit | b7ca6d0708d072a9d6b93d33e7c76ff4cba42d6c | [log] [tgz] |
---|---|---|
author | Nick Kralevich <nnk@google.com> | Mon Dec 10 13:03:02 2018 -0800 |
committer | Nick Kralevich <nnk@google.com> | Mon Dec 10 15:46:01 2018 -0800 |
tree | 4eddec836506aa00350dc072bf6e57963b38b492 | |
parent | e15432d1e8642ee277e6492e90befe78bb42fcbe [diff] |
simplify renderscript .so duplicate handling When renderscript loads a shared library, it first checks to see if the shared library is already loaded. If the library is already loaded, renderscript creates a copy of the shared library, loads it, then immediately deletes that copy. This ensures that renderscript doesn't end up aliasing global data between the various Script instances (which are supposed to be completely independent). This has a few disadvantages: 1) Copying data involves disk I/O and could be slow. 2) Copying data results in unnecessary flash wear. 3) Copying data inhibits page sharing / caching. 4) Copying data makes the code more complicated than necessary. 5) Copying data complicates security hardening. For framework code, use functionality provided by the Android dynamic linker to avoid global symbol conflicts. This avoids the excess copying while still keeping the symbols separate. We retain the original behavior for the RS support lib (RS_COMPATIBILITY_LIB is defined), as android_dlopen_ext is only available for devices with API level 21+. Testing for global symbol conflict is already present in the renderscript CTS tests. Please see: * android.renderscript.cts.ComputeTest#testInstance https://android.googlesource.com/platform/cts/+/f0916664ac55fce2c2d33de48cef87c0ab179030/tests/tests/renderscript/src/android/renderscript/cts/ComputeTest.java#781 * android.renderscript.cts.ScriptGroupTest#testScriptGroupTorture https://android.googlesource.com/platform/cts/+/f0916664ac55fce2c2d33de48cef87c0ab179030/tests/tests/renderscript/src/android/renderscript/cts/ScriptGroupTest.java#221 Test: cts-tradefed run cts -m CtsRenderscriptTestCases Bug: 112357170 Change-Id: I878756e1d9c14840f4371a8275cf2cc6e132ea78