Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@betrevisan
Copy link
Contributor

The changes proposed in this PR will enable users to explicitly specify JIT snapshots. Currently, the engine relies on the asset resolver to identify the snapshot asset locations. There have been requests for increased flexibility when determining such locations, especially in cases in which the asset resolver fails to find a valid snapshot. Additionally, this PR was conceived with the goal of making the JIT mode consistent with the existing AOT mode, which allows users to explicitly describe such asset paths.

As such, I built the FlutterEngineSetupJITSnapshots function within embedder.cc, which will set the snapshots in the embedder ProjectArgs to the user defined locations. At initialization, the engine will call the PopulateJITSnapshotMappingCallbacks function, which will set the snapshots to their corresponding mapping callbacks as defined by the user and add them to the Settings. In the cases in which no snapshots are explicitly defined, the engine will resolve the assets as before since the snapshots will be set to nullptr in the Settings.

This PR stems from the discussion raised in flutter/flutter#100640.

@flutter-dashboard flutter-dashboard bot added the embedder Related to the embedder API label Jun 23, 2022
@betrevisan betrevisan requested a review from iskakaushik June 23, 2022 01:04
@chinmaygarde
Copy link
Member

@iskakaushik All open queries seem resolved. Can we merge this please?

Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

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

This still LGTM and looks like it should solve flutter/flutter#100640. @akbiggs could you take a look and confirm?

@akbiggs
Copy link
Contributor

akbiggs commented Jul 7, 2022

Also really sorry for the slow review, I was out sick.

TEST_F(EmbedderTest, CanSuccessfullySpecifyJITSnapshotLocations) {
#if defined(OS_FUCHSIA)
GTEST_SKIP() << "Inconsistent paths in Fuchsia.";
#endif // OS_FUCHSIA
Copy link
Contributor

Choose a reason for hiding this comment

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

Please resolve this comment before submission (either by fixing or filing a bug) - I'm curious to know more about this issue.

@iskakaushik iskakaushik added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 7, 2022
@auto-submit auto-submit bot merged commit f3dd927 into flutter:main Jul 7, 2022
jason-simmons added a commit to jason-simmons/flutter_engine that referenced this pull request Jul 7, 2022
@a-siva
Copy link
Contributor

a-siva commented Jul 8, 2022

This appears to have broken some Dart/Flutter HHH benchmarking builds, see

[7599/7695] CXX obj/flutter/shell/platform/embedder/tests/embedder_unittests.embedder_unittests.o
FAILED: obj/flutter/shell/platform/embedder/tests/embedder_unittests.embedder_unittests.o
../../buildtools/linux-x64/clang/bin/clang++ -MD -MF obj/flutter/shell/platform/embedder/tests/embedder_unittests.embedder_unittests.o.d -DUSE_OPENSSL=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_LIBCPP_DISABLE_AVAILABILITY=1 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DSHELL_ENABLE_SOFTWARE -DSHELL_ENABLE_GL -DSHELL_ENABLE_VULKAN -DSK_GL -DSK_VULKAN -DSK_SUPPORT_GPU=1 -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_CODEC_DECODES_PNG -DSK_ENCODE_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_WEBP -DSK_HAS_WUFFS_LIBRARY -DFLUTTER_RUNTIME_MODE_DEBUG=1 -DFLUTTER_RUNTIME_MODE_PROFILE=2 -DFLUTTER_RUNTIME_MODE_RELEASE=3 -DFLUTTER_RUNTIME_MODE_JIT_RELEASE=4 -DDART_LEGACY_API=\[\[deprecated\]\] -DFLUTTER_RUNTIME_MODE=1 -DFLUTTER_JIT_RUNTIME=1 -DVULKAN_HPP_NO_EXCEPTIONS=1 -DSK_R32_SHIFT=16 -DSK_ENABLE_DUMP_GPU -DSK_DISABLE_AAA -DSK_PARAGRAPH_LIBTXT_SPACES_RESOLUTION -DSK_LEGACY_INNER_JOINS -DSK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER -DSK_DISABLE_LEGACY_SHADERCONTEXT -DSK_DISABLE_LOWP_RASTER_PIPELINE -DSK_FORCE_RASTER_PIPELINE_BLITTER -DSK_DISABLE_EFFECT_DESERIALIZATION -DSK_ENABLE_SKSL -DSK_ENABLE_PRECOMPILE -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DRAPIDJSON_HAS_STDSTRING -DRAPIDJSON_HAS_CXX11_RANGE_FOR -DRAPIDJSON_HAS_CXX11_RVALUE_REFS -DRAPIDJSON_HAS_CXX11_TYPETRAITS -DRAPIDJSON_HAS_CXX11_NOEXCEPT -DIMPELLER_SUPPORTS_PLATFORM=1 -DIMPELLER_SUPPORTS_RENDERING=1 -DIMPELLER_ENABLE_OPENGLES=1 -I../../flutter/shell/platform/embedder -I../.. -Igen -I../../third_party/libcxx/include -I../../third_party/libcxxabi/include -I../../third_party/vulkan_memory_allocator/include -I../../third_party/vulkan-deps/vulkan-headers/src/include -I../../third_party/skia -I../../flutter/third_party -I../../flutter -I../../third_party/dart/runtime -I../../third_party/dart/runtime/include -I../../flutter/third_party/txt/src -I../../third_party/harfbuzz/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/rapidjson -I../../third_party/rapidjson/include -Igen/flutter -I../../third_party/angle/include -I../../third_party/googletest/googlemock/include -I../../third_party/googletest/googletest/include -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=4 -m64 -march=x86-64 -fPIC -pipe -pthread -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-deprecated-copy -Wno-psabi -Wno-unqualified-std-cast-call -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -fvisibility=hidden --sysroot=/tmp/build/src/build/linux/debian_sid_amd64-sysroot -Wstring-conversion -Wnewline-eof -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -fvisibility-inlines-hidden -std=c++17 -fno-rtti -nostdinc++ -nostdinc++ -fvisibility=hidden -fno-exceptions -Wno-inconsistent-missing-override -c ../../flutter/shell/platform/embedder/tests/embedder_unittests.cc -o obj/flutter/shell/platform/embedder/tests/embedder_unittests.embedder_unittests.o
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1328:40: error: use of undeclared identifier 'TEST_VM_SNAPSHOT_DATA'
fml::paths::JoinPaths({src_path, TEST_VM_SNAPSHOT_DATA});
^
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1330:40: error: use of undeclared identifier 'TEST_VM_SNAPSHOT_INSTRUCTIONS'
fml::paths::JoinPaths({src_path, TEST_VM_SNAPSHOT_INSTRUCTIONS});
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1332:40: error: use of undeclared identifier 'TEST_ISOLATE_SNAPSHOT_DATA'
fml::paths::JoinPaths({src_path, TEST_ISOLATE_SNAPSHOT_DATA});
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1334:40: error: use of undeclared identifier 'TEST_ISOLATE_SNAPSHOT_INSTRUCTIONS'
fml::paths::JoinPaths({src_path, TEST_ISOLATE_SNAPSHOT_INSTRUCTIONS});
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1418:40: error: use of undeclared identifier 'TEST_VM_SNAPSHOT_DATA'
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1420:40: error: use of undeclared identifier 'TEST_VM_SNAPSHOT_INSTRUCTIONS'
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1422:40: error: use of undeclared identifier 'TEST_ISOLATE_SNAPSHOT_DATA'
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1424:40: error: use of undeclared identifier 'TEST_ISOLATE_SNAPSHOT_INSTRUCTIONS'
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1458:40: error: use of undeclared identifier 'TEST_VM_SNAPSHOT_DATA'
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:1460:40: error: use of undeclared identifier 'TEST_VM_SNAPSHOT_INSTRUCTIONS'
10 errors generated.

@akbiggs
Copy link
Contributor

akbiggs commented Jul 8, 2022

Reverted in 177d1ad.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App embedder Related to the embedder API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants