TimingLogger timings("compiler", false, false);
- Dex2Oat dex2oat(&timings);
+ // Allocate `dex2oat` on the heap instead of on the stack, as Clang
+ // might produce a stack frame too large for this function or for
+ // functions inlining it (such as main), that would not fit the
+ // requirements of the `-Wframe-larger-than` option.
+ std::unique_ptr<Dex2Oat> dex2oat = MakeUnique<Dex2Oat>(&timings);
// Parse arguments. Argument mistakes will lead to exit(EXIT_FAILURE) in UsageError.
- dex2oat.ParseArgs(argc, argv);
+ dex2oat->ParseArgs(argc, argv);
- // Process profile information and assess if we need to do a profile guided compilation.
+ // If needed, process profile information for profile guided compilation.
// This operation involves I/O.
- if (dex2oat.UseProfileGuidedCompilation()) {
- if (!dex2oat.LoadProfile()) {
+ if (dex2oat->UseProfileGuidedCompilation()) {
- if (dex2oat->LoadProfile()) {
- if (!dex2oat->ShouldCompileBasedOnProfiles()) {
- LOG(INFO) << "Skipped compilation because of insignificant profile delta";
- return EXIT_SUCCESS;
- }
- } else {
- LOG(WARNING) << "Failed to process profile files";
++ if (!dex2oat->LoadProfile()) {
+ LOG(ERROR) << "Failed to process profile file";
return EXIT_FAILURE;
}
}