blob: 6289d8a22c3b8e58f89b7a5446a1af8374a8f556 [file] [log] [blame]
* Copyright (C) 2016 The Android Open Source Project
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.
#include <ostream>
#include <string>
#include <vector>
#include "base/macros.h"
namespace art {
class CompilerFilter FINAL {
// Note: Order here matters. Later filter choices are considered "as good
// as" earlier filter choices.
enum Filter {
kVerifyNone, // Skip verification and compile nothing except JNI stubs.
kVerifyAtRuntime, // Only compile JNI stubs and verify at runtime.
kVerifyProfile, // Verify only the classes in the profile.
kInterpretOnly, // Verify, and compile only JNI stubs.
kTime, // Compile methods, but minimize compilation time.
kSpaceProfile, // Maximize space savings based on profile.
kSpace, // Maximize space savings.
kBalanced, // Good performance return on compilation investment.
kSpeedProfile, // Maximize runtime performance based on profile.
kSpeed, // Maximize runtime performance.
kEverythingProfile, // Compile everything capable of being compiled based on profile.
kEverything, // Compile everything capable of being compiled.
// Returns true if an oat file with this compiler filter contains
// compiled executable code.
static bool IsCompilationEnabled(Filter filter);
// Returns true if this compiler filter requires running verification.
static bool IsVerificationEnabled(Filter filter);
// Returns true if an oat file with this compiler filter depends on the
// boot image checksum.
static bool DependsOnImageChecksum(Filter filter);
// Returns true if an oat file with this compiler filter depends on a
// profile.
static bool DependsOnProfile(Filter filter);
// Returns a non-profile-guided version of the given filter.
static Filter GetNonProfileDependentFilterFrom(Filter filter);
// Returns true if the 'current' compiler filter is considered at least as
// good as the 'target' compilation type.
// For example: kSpeed is as good as kInterpretOnly, but kInterpretOnly is
// not as good as kSpeed.
static bool IsAsGoodAs(Filter current, Filter target);
// Return the flag name of the given filter.
// For example: given kVerifyAtRuntime, returns "verify-at-runtime".
// The name returned corresponds to the name accepted by
// ParseCompilerFilter.
static std::string NameOfFilter(Filter filter);
// Parse the compiler filter from the given name.
// Returns true and sets filter to the parsed value if name refers to a
// valid filter. Returns false if no filter matches that name.
// 'filter' must be non-null.
static bool ParseCompilerFilter(const char* name, /*out*/Filter* filter);
std::ostream& operator<<(std::ostream& os, const CompilerFilter::Filter& rhs);
} // namespace art