Clean up generated operator<<(os, enum).
Pass enums by value instead of const reference.
Do not generate operator<< sources for headers that have no
enums or no declarations of operator<<. Do not define the
operator<< for flag enums; these were unused anyway.
Add generated operator<< for some enums in nodes.h . Change
the operator<< for ComparisonBias so that the graph
visualizer can use it but do not use the generated
operator<< yet as that would require changing checker tests.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: Ifd4c455c2fa921a9668c966a13068d43b9c6e173
diff --git a/compiler/Android.bp b/compiler/Android.bp
index bd4cfce..513394e 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -181,9 +181,9 @@
cmd: "$(location generate_operator_out) art/compiler $(in) > $(out)",
tools: ["generate_operator_out"],
srcs: [
- "driver/compiler_options.h",
"linker/linker_patch.h",
"optimizing/locations.h",
+ "optimizing/nodes.h",
"optimizing/optimizing_compiler_stats.h",
"utils/arm/constants_arm.h",
diff --git a/compiler/linker/linker_patch.h b/compiler/linker/linker_patch.h
index 1c523de..7fedf2e 100644
--- a/compiler/linker/linker_patch.h
+++ b/compiler/linker/linker_patch.h
@@ -287,7 +287,7 @@
friend bool operator==(const LinkerPatch& lhs, const LinkerPatch& rhs);
friend bool operator<(const LinkerPatch& lhs, const LinkerPatch& rhs);
};
-std::ostream& operator<<(std::ostream& os, const LinkerPatch::Type& type);
+std::ostream& operator<<(std::ostream& os, LinkerPatch::Type type);
inline bool operator==(const LinkerPatch& lhs, const LinkerPatch& rhs) {
return lhs.literal_offset_ == rhs.literal_offset_ &&
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index d94c1fa..23b93fc 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -449,10 +449,7 @@
}
void VisitCompare(HCompare* compare) override {
- ComparisonBias bias = compare->GetBias();
- StartAttributeStream("bias") << (bias == ComparisonBias::kGtBias
- ? "gt"
- : (bias == ComparisonBias::kLtBias ? "lt" : "none"));
+ StartAttributeStream("bias") << compare->GetBias();
}
void VisitInvoke(HInvoke* invoke) override {
diff --git a/compiler/optimizing/locations.h b/compiler/optimizing/locations.h
index 5e7e74b..8f5eed7 100644
--- a/compiler/optimizing/locations.h
+++ b/compiler/optimizing/locations.h
@@ -440,8 +440,8 @@
// way that none of them can be interpreted as a kConstant tag.
uintptr_t value_;
};
-std::ostream& operator<<(std::ostream& os, const Location::Kind& rhs);
-std::ostream& operator<<(std::ostream& os, const Location::Policy& rhs);
+std::ostream& operator<<(std::ostream& os, Location::Kind rhs);
+std::ostream& operator<<(std::ostream& os, Location::Policy rhs);
class RegisterSet : public ValueObject {
public:
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 3ea13b6..ec4b79e 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1702,14 +1702,15 @@
}
}
-std::ostream& operator<<(std::ostream& os, const ComparisonBias& rhs) {
+std::ostream& operator<<(std::ostream& os, ComparisonBias rhs) {
+ // TODO: Replace with auto-generated operator<<.
switch (rhs) {
case ComparisonBias::kNoBias:
- return os << "no_bias";
+ return os << "none";
case ComparisonBias::kGtBias:
- return os << "gt_bias";
+ return os << "gt";
case ComparisonBias::kLtBias:
- return os << "lt_bias";
+ return os << "lt";
default:
LOG(FATAL) << "Unknown ComparisonBias: " << static_cast<int>(rhs);
UNREACHABLE();
@@ -1735,7 +1736,7 @@
return true;
}
-std::ostream& operator<<(std::ostream& os, const HInstruction::InstructionKind& rhs) {
+std::ostream& operator<<(std::ostream& os, HInstruction::InstructionKind rhs) {
#define DECLARE_CASE(type, super) case HInstruction::k##type: os << #type; break;
switch (rhs) {
FOR_EACH_CONCRETE_INSTRUCTION(DECLARE_CASE)
@@ -2933,28 +2934,6 @@
return !opt.GetDoesNotNeedDexCache();
}
-std::ostream& operator<<(std::ostream& os, HInvokeStaticOrDirect::MethodLoadKind rhs) {
- switch (rhs) {
- case HInvokeStaticOrDirect::MethodLoadKind::kStringInit:
- return os << "StringInit";
- case HInvokeStaticOrDirect::MethodLoadKind::kRecursive:
- return os << "Recursive";
- case HInvokeStaticOrDirect::MethodLoadKind::kBootImageLinkTimePcRelative:
- return os << "BootImageLinkTimePcRelative";
- case HInvokeStaticOrDirect::MethodLoadKind::kBootImageRelRo:
- return os << "BootImageRelRo";
- case HInvokeStaticOrDirect::MethodLoadKind::kBssEntry:
- return os << "BssEntry";
- case HInvokeStaticOrDirect::MethodLoadKind::kJitDirectAddress:
- return os << "JitDirectAddress";
- case HInvokeStaticOrDirect::MethodLoadKind::kRuntimeCall:
- return os << "RuntimeCall";
- default:
- LOG(FATAL) << "Unknown MethodLoadKind: " << static_cast<int>(rhs);
- UNREACHABLE();
- }
-}
-
std::ostream& operator<<(std::ostream& os, HInvokeStaticOrDirect::ClinitCheckRequirement rhs) {
switch (rhs) {
case HInvokeStaticOrDirect::ClinitCheckRequirement::kExplicit:
@@ -2990,28 +2969,6 @@
}
}
-std::ostream& operator<<(std::ostream& os, HLoadClass::LoadKind rhs) {
- switch (rhs) {
- case HLoadClass::LoadKind::kReferrersClass:
- return os << "ReferrersClass";
- case HLoadClass::LoadKind::kBootImageLinkTimePcRelative:
- return os << "BootImageLinkTimePcRelative";
- case HLoadClass::LoadKind::kBootImageRelRo:
- return os << "BootImageRelRo";
- case HLoadClass::LoadKind::kBssEntry:
- return os << "BssEntry";
- case HLoadClass::LoadKind::kJitBootImageAddress:
- return os << "JitBootImageAddress";
- case HLoadClass::LoadKind::kJitTableAddress:
- return os << "JitTableAddress";
- case HLoadClass::LoadKind::kRuntimeCall:
- return os << "RuntimeCall";
- default:
- LOG(FATAL) << "Unknown HLoadClass::LoadKind: " << static_cast<int>(rhs);
- UNREACHABLE();
- }
-}
-
bool HLoadString::InstructionDataEquals(const HInstruction* other) const {
const HLoadString* other_load_string = other->AsLoadString();
// TODO: To allow GVN for HLoadString from different dex files, we should compare the strings
@@ -3032,26 +2989,6 @@
}
}
-std::ostream& operator<<(std::ostream& os, HLoadString::LoadKind rhs) {
- switch (rhs) {
- case HLoadString::LoadKind::kBootImageLinkTimePcRelative:
- return os << "BootImageLinkTimePcRelative";
- case HLoadString::LoadKind::kBootImageRelRo:
- return os << "BootImageRelRo";
- case HLoadString::LoadKind::kBssEntry:
- return os << "BssEntry";
- case HLoadString::LoadKind::kJitBootImageAddress:
- return os << "JitBootImageAddress";
- case HLoadString::LoadKind::kJitTableAddress:
- return os << "JitTableAddress";
- case HLoadString::LoadKind::kRuntimeCall:
- return os << "RuntimeCall";
- default:
- LOG(FATAL) << "Unknown HLoadString::LoadKind: " << static_cast<int>(rhs);
- UNREACHABLE();
- }
-}
-
void HInstruction::RemoveEnvironmentUsers() {
for (const HUseListNode<HEnvironment*>& use : GetEnvUses()) {
HEnvironment* user = use.GetUser();
@@ -3163,25 +3100,6 @@
}
}
-std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind) {
- switch (kind) {
- case MemBarrierKind::kAnyStore:
- return os << "AnyStore";
- case MemBarrierKind::kLoadAny:
- return os << "LoadAny";
- case MemBarrierKind::kStoreStore:
- return os << "StoreStore";
- case MemBarrierKind::kAnyAny:
- return os << "AnyAny";
- case MemBarrierKind::kNTStoreStore:
- return os << "NTStoreStore";
-
- default:
- LOG(FATAL) << "Unknown MemBarrierKind: " << static_cast<int>(kind);
- UNREACHABLE();
- }
-}
-
// Check that intrinsic enum values fit within space set aside in ArtMethod modifier flags.
#define CHECK_INTRINSICS_ENUM_VALUES(Name, InvokeType, _, SideEffects, Exceptions, ...) \
static_assert( \
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 00dc50c..a7ea371 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -2090,7 +2090,7 @@
class HInstruction : public ArenaObject<kArenaAllocInstruction> {
public:
#define DECLARE_KIND(type, super) k##type,
- enum InstructionKind {
+ enum InstructionKind { // private marker to avoid generate-operator-out.py from processing.
FOR_EACH_CONCRETE_INSTRUCTION(DECLARE_KIND)
kLastInstructionKind
};
@@ -2648,7 +2648,7 @@
friend class HGraph;
friend class HInstructionList;
};
-std::ostream& operator<<(std::ostream& os, const HInstruction::InstructionKind& rhs);
+std::ostream& operator<<(std::ostream& os, HInstruction::InstructionKind rhs);
// Iterates over the instructions, while preserving the next instruction
// in case the current instruction gets removed from the list by the user
@@ -3673,14 +3673,14 @@
// The comparison bias applies for floating point operations and indicates how NaN
// comparisons are treated:
-enum class ComparisonBias {
+enum class ComparisonBias { // private marker to avoid generate-operator-out.py from processing.
kNoBias, // bias is not applicable (i.e. for long operation)
kGtBias, // return 1 for NaN comparisons
kLtBias, // return -1 for NaN comparisons
kLast = kLtBias
};
-std::ostream& operator<<(std::ostream& os, const ComparisonBias& rhs);
+std::ostream& operator<<(std::ostream& os, ComparisonBias rhs);
class HCondition : public HBinaryOperation {
public:
@@ -4565,7 +4565,7 @@
public:
// Requirements of this method call regarding the class
// initialization (clinit) check of its declaring class.
- enum class ClinitCheckRequirement {
+ enum class ClinitCheckRequirement { // private marker to avoid generate-operator-out.py from processing.
kNone, // Class already initialized.
kExplicit, // Static call having explicit clinit check as last input.
kImplicit, // Static call implicitly requiring a clinit check.
@@ -7200,7 +7200,7 @@
* Implementation strategies for the code generator of a HInstanceOf
* or `HCheckCast`.
*/
-enum class TypeCheckKind {
+enum class TypeCheckKind { // private marker to avoid generate-operator-out.py from processing.
kUnresolvedCheck, // Check against an unresolved type.
kExactCheck, // Can do a single class compare.
kClassHierarchyCheck, // Can just walk the super class chain.
@@ -7474,7 +7474,7 @@
kNTStoreStore,
kLastBarrierKind = kNTStoreStore
};
-std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind);
+std::ostream& operator<<(std::ostream& os, MemBarrierKind kind);
class HMemoryBarrier final : public HExpression<0> {
public:
diff --git a/compiler/optimizing/optimizing_compiler_stats.h b/compiler/optimizing/optimizing_compiler_stats.h
index 621e863..475c532 100644
--- a/compiler/optimizing/optimizing_compiler_stats.h
+++ b/compiler/optimizing/optimizing_compiler_stats.h
@@ -110,7 +110,7 @@
kJitOutOfMemoryForCommit,
kLastStat
};
-std::ostream& operator<<(std::ostream& os, const MethodCompilationStat& rhs);
+std::ostream& operator<<(std::ostream& os, MethodCompilationStat rhs);
class OptimizingCompilerStats {
public:
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index e3394fc..1248f23 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -82,7 +82,6 @@
tools: ["generate_operator_out"],
srcs: [
"dex/dex_to_dex_compiler.h",
- "driver/compiler_driver.h",
"linker/image_writer.h",
],
output_extension: "operator_out.cc",
diff --git a/dex2oat/dex/dex_to_dex_compiler.h b/dex2oat/dex/dex_to_dex_compiler.h
index 06e16e4..16030bd 100644
--- a/dex2oat/dex/dex_to_dex_compiler.h
+++ b/dex2oat/dex/dex_to_dex_compiler.h
@@ -117,7 +117,7 @@
size_t num_code_items_ GUARDED_BY(lock_) = 0u;
};
-std::ostream& operator<<(std::ostream& os, const DexToDexCompiler::CompilationLevel& rhs);
+std::ostream& operator<<(std::ostream& os, DexToDexCompiler::CompilationLevel rhs);
} // namespace optimizer
diff --git a/dex2oat/linker/image_writer.h b/dex2oat/linker/image_writer.h
index 769f2ff..84ca88e 100644
--- a/dex2oat/linker/image_writer.h
+++ b/dex2oat/linker/image_writer.h
@@ -216,7 +216,7 @@
// Number of bins which are for mirror objects.
kMirrorCount = kArtField,
};
- friend std::ostream& operator<<(std::ostream& stream, const Bin& bin);
+ friend std::ostream& operator<<(std::ostream& stream, Bin bin);
enum class NativeObjectRelocationType {
kArtField,
@@ -231,7 +231,7 @@
kIMTConflictTable,
kDexCacheArray,
};
- friend std::ostream& operator<<(std::ostream& stream, const NativeObjectRelocationType& type);
+ friend std::ostream& operator<<(std::ostream& stream, NativeObjectRelocationType type);
enum class StubType {
kJNIDlsymLookupTrampoline,
@@ -242,7 +242,7 @@
kQuickToInterpreterBridge,
kLast = kQuickToInterpreterBridge,
};
- friend std::ostream& operator<<(std::ostream& stream, const StubType& stub_type);
+ friend std::ostream& operator<<(std::ostream& stream, StubType stub_type);
static constexpr size_t kBinBits =
MinimumBitsToStore<uint32_t>(static_cast<size_t>(Bin::kMirrorCount) - 1);
@@ -747,6 +747,10 @@
DISALLOW_COPY_AND_ASSIGN(ImageWriter);
};
+std::ostream& operator<<(std::ostream& stream, ImageWriter::Bin bin);
+std::ostream& operator<<(std::ostream& stream, ImageWriter::NativeObjectRelocationType type);
+std::ostream& operator<<(std::ostream& stream, ImageWriter::StubType stub_type);
+
} // namespace linker
} // namespace art
diff --git a/libartbase/arch/instruction_set.h b/libartbase/arch/instruction_set.h
index 6f0cf52..2fd8773 100644
--- a/libartbase/arch/instruction_set.h
+++ b/libartbase/arch/instruction_set.h
@@ -34,7 +34,7 @@
kX86_64,
kLast = kX86_64
};
-std::ostream& operator<<(std::ostream& os, const InstructionSet& rhs);
+std::ostream& operator<<(std::ostream& os, InstructionSet rhs);
#if defined(__arm__)
static constexpr InstructionSet kRuntimeISA = InstructionSet::kArm;
diff --git a/libartbase/base/allocator.h b/libartbase/base/allocator.h
index 5eb6ea6..2f85286 100644
--- a/libartbase/base/allocator.h
+++ b/libartbase/base/allocator.h
@@ -67,7 +67,7 @@
kAllocatorTagRosAlloc,
kAllocatorTagCount, // Must always be last element.
};
-std::ostream& operator<<(std::ostream& os, const AllocatorTag& tag);
+std::ostream& operator<<(std::ostream& os, AllocatorTag tag);
namespace TrackedAllocators {
diff --git a/libartbase/base/unix_file/fd_file.h b/libartbase/base/unix_file/fd_file.h
index f5aa2a5..4926e4e 100644
--- a/libartbase/base/unix_file/fd_file.h
+++ b/libartbase/base/unix_file/fd_file.h
@@ -162,7 +162,7 @@
DISALLOW_COPY_AND_ASSIGN(FdFile);
};
-std::ostream& operator<<(std::ostream& os, const FdFile::GuardState& kind);
+std::ostream& operator<<(std::ostream& os, FdFile::GuardState kind);
} // namespace unix_file
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index 1f1f75b..5a8cdb3 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -141,7 +141,6 @@
"dex/dex_instruction.h",
"dex/dex_instruction_utils.h",
"dex/invoke_type.h",
- "dex/method_reference.h",
],
output_extension: "operator_out.cc",
}
diff --git a/libdexfile/dex/dex_file.h b/libdexfile/dex/dex_file.h
index ca95e0e..649ee0c 100644
--- a/libdexfile/dex/dex_file.h
+++ b/libdexfile/dex/dex_file.h
@@ -963,7 +963,7 @@
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(EncodedArrayValueIterator);
};
-std::ostream& operator<<(std::ostream& os, const EncodedArrayValueIterator::ValueType& code);
+std::ostream& operator<<(std::ostream& os, EncodedArrayValueIterator::ValueType code);
class EncodedStaticFieldValueIterator : public EncodedArrayValueIterator {
public:
@@ -976,7 +976,6 @@
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(EncodedStaticFieldValueIterator);
};
-std::ostream& operator<<(std::ostream& os, const EncodedStaticFieldValueIterator::ValueType& code);
class CallSiteArrayValueIterator : public EncodedArrayValueIterator {
public:
@@ -991,7 +990,6 @@
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(CallSiteArrayValueIterator);
};
-std::ostream& operator<<(std::ostream& os, const CallSiteArrayValueIterator::ValueType& code);
} // namespace art
diff --git a/libdexfile/dex/dex_file_layout.h b/libdexfile/dex/dex_file_layout.h
index 183aefa..8ee91ff 100644
--- a/libdexfile/dex/dex_file_layout.h
+++ b/libdexfile/dex/dex_file_layout.h
@@ -45,7 +45,7 @@
// Unused value, just the number of elements in the enum.
kLayoutTypeCount,
};
-std::ostream& operator<<(std::ostream& os, const LayoutType& collector_type);
+std::ostream& operator<<(std::ostream& os, LayoutType collector_type);
// Return the "best" layout option if the same item has multiple different layouts.
static inline LayoutType MergeLayoutType(LayoutType a, LayoutType b) {
@@ -60,7 +60,7 @@
// Trim by madvising code that is unlikely to be too important in the future.
kMadviseStateFinishedTrim,
};
-std::ostream& operator<<(std::ostream& os, const MadviseState& collector_type);
+std::ostream& operator<<(std::ostream& os, MadviseState collector_type);
// A dex layout section such as code items or strings. Each section is composed of subsections
// that are laid out adjacently to each other such as (hot, unused, startup, etc...).
@@ -118,7 +118,7 @@
DexLayoutSection sections_[static_cast<size_t>(SectionType::kSectionCount)];
};
-std::ostream& operator<<(std::ostream& os, const DexLayoutSections::SectionType& collector_type);
+std::ostream& operator<<(std::ostream& os, DexLayoutSections::SectionType collector_type);
std::ostream& operator<<(std::ostream& os, const DexLayoutSection& section);
std::ostream& operator<<(std::ostream& os, const DexLayoutSections& sections);
diff --git a/libdexfile/dex/dex_instruction.cc b/libdexfile/dex/dex_instruction.cc
index 37fc455..93270cd 100644
--- a/libdexfile/dex/dex_instruction.cc
+++ b/libdexfile/dex/dex_instruction.cc
@@ -547,7 +547,7 @@
#undef EXPERIMENTAL_CHECK
};
-std::ostream& operator<<(std::ostream& os, const Instruction::Code& code) {
+std::ostream& operator<<(std::ostream& os, Instruction::Code code) {
return os << Instruction::Name(code);
}
diff --git a/libdexfile/dex/dex_instruction.h b/libdexfile/dex/dex_instruction.h
index c15fa43..7e43f75 100644
--- a/libdexfile/dex/dex_instruction.h
+++ b/libdexfile/dex/dex_instruction.h
@@ -141,7 +141,7 @@
kIndexProtoRef, // prototype reference index
};
- enum Flags : uint8_t {
+ enum Flags : uint8_t { // private marker to avoid generate-operator-out.py from processing.
kBranch = 0x01, // conditional or unconditional branch
kContinue = 0x02, // flow can continue to next statement
kSwitch = 0x04, // switch statement
@@ -173,7 +173,7 @@
kRegBFieldOrConstant = 0x0800000, // is the second virtual register a field or literal constant (vB)
};
- enum VerifyFlag : uint32_t {
+ enum VerifyFlag : uint32_t { // private marker to avoid generate-operator-out.py from processing.
kVerifyNothing = 0x0000000,
kVerifyRegA = 0x0000001,
kVerifyRegAWide = 0x0000002,
@@ -692,10 +692,8 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction);
};
-std::ostream& operator<<(std::ostream& os, const Instruction::Code& code);
-std::ostream& operator<<(std::ostream& os, const Instruction::Format& format);
-std::ostream& operator<<(std::ostream& os, const Instruction::Flags& flags);
-std::ostream& operator<<(std::ostream& os, const Instruction::VerifyFlag& vflags);
+std::ostream& operator<<(std::ostream& os, Instruction::Code code);
+std::ostream& operator<<(std::ostream& os, Instruction::Format format);
// Base class for accessing instruction operands. Unifies operand
// access for instructions that have range and varargs forms
diff --git a/libdexfile/dex/dex_instruction_utils.h b/libdexfile/dex/dex_instruction_utils.h
index e7614ad..49179be 100644
--- a/libdexfile/dex/dex_instruction_utils.h
+++ b/libdexfile/dex/dex_instruction_utils.h
@@ -45,7 +45,7 @@
kDexMemAccessTypeCount
};
-std::ostream& operator<<(std::ostream& os, const DexMemAccessType& type);
+std::ostream& operator<<(std::ostream& os, DexMemAccessType type);
// NOTE: The following functions disregard quickened instructions.
diff --git a/libdexfile/dex/invoke_type.h b/libdexfile/dex/invoke_type.h
index 1740c07..448d75a 100644
--- a/libdexfile/dex/invoke_type.h
+++ b/libdexfile/dex/invoke_type.h
@@ -32,7 +32,7 @@
kMaxInvokeType = kCustom
};
-std::ostream& operator<<(std::ostream& os, const InvokeType& rhs);
+std::ostream& operator<<(std::ostream& os, InvokeType rhs);
} // namespace art
diff --git a/perfetto_hprof/perfetto_hprof.h b/perfetto_hprof/perfetto_hprof.h
index 1713286..f02ef59 100644
--- a/perfetto_hprof/perfetto_hprof.h
+++ b/perfetto_hprof/perfetto_hprof.h
@@ -35,7 +35,7 @@
kEnd,
};
-std::ostream& operator<<(std::ostream&, const State&);
+std::ostream& operator<<(std::ostream& os, State state);
} // namespace perfetto_hprof
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 31e92d9..3cf255c 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -484,15 +484,12 @@
srcs: [
"base/callee_save_type.h",
"base/locks.h",
- "class_loader_context.h",
"class_status.h",
- "debugger.h",
"gc_root.h",
"gc/allocator_type.h",
"gc/allocator/rosalloc.h",
"gc/collector_type.h",
"gc/collector/gc_type.h",
- "gc/heap.h",
"gc/space/region_space.h",
"gc/space/space.h",
"gc/weak_root_state.h",
@@ -503,14 +500,12 @@
"jni_id_type.h",
"lock_word.h",
"oat_file.h",
- "object_callbacks.h",
"process_state.h",
"reflective_value_visitor.h",
"stack.h",
"suspend_reason.h",
"thread.h",
"thread_state.h",
- "ti/agent.h",
"trace.h",
"verifier/verifier_enums.h",
],
diff --git a/runtime/base/callee_save_type.h b/runtime/base/callee_save_type.h
index e7cc7e6..fcafe9c 100644
--- a/runtime/base/callee_save_type.h
+++ b/runtime/base/callee_save_type.h
@@ -32,7 +32,7 @@
kSaveEverythingForSuspendCheck, // Special kSaveEverything for suspend check.
kLastCalleeSaveType // Value used for iteration.
};
-std::ostream& operator<<(std::ostream& os, const CalleeSaveType& rhs);
+std::ostream& operator<<(std::ostream& os, CalleeSaveType rhs);
static inline constexpr CalleeSaveType GetCanonicalCalleeSaveType(CalleeSaveType type) {
if (type == CalleeSaveType::kSaveEverythingForClinit ||
diff --git a/runtime/base/locks.h b/runtime/base/locks.h
index c1667f3..7008539 100644
--- a/runtime/base/locks.h
+++ b/runtime/base/locks.h
@@ -150,7 +150,7 @@
kLockLevelCount // Must come last.
};
-std::ostream& operator<<(std::ostream& os, const LockLevel& rhs);
+std::ostream& operator<<(std::ostream& os, LockLevel rhs);
// For StartNoThreadSuspension and EndNoThreadSuspension.
class CAPABILITY("role") Role {
diff --git a/runtime/class_status.h b/runtime/class_status.h
index b194ffa..6c686a4 100644
--- a/runtime/class_status.h
+++ b/runtime/class_status.h
@@ -99,7 +99,7 @@
kLast = kVisiblyInitialized
};
-std::ostream& operator<<(std::ostream& os, const ClassStatus& rhs);
+std::ostream& operator<<(std::ostream& os, ClassStatus rhs);
} // namespace art
diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h
index c4bc76f..48e3576 100644
--- a/runtime/gc/allocator/rosalloc.h
+++ b/runtime/gc/allocator/rosalloc.h
@@ -936,11 +936,11 @@
REQUIRES(Locks::mutator_lock_) REQUIRES(!lock_) REQUIRES(!bulk_free_lock_);
private:
- friend std::ostream& operator<<(std::ostream& os, const RosAlloc::PageMapKind& rhs);
+ friend std::ostream& operator<<(std::ostream& os, RosAlloc::PageMapKind rhs);
DISALLOW_COPY_AND_ASSIGN(RosAlloc);
};
-std::ostream& operator<<(std::ostream& os, const RosAlloc::PageMapKind& rhs);
+std::ostream& operator<<(std::ostream& os, RosAlloc::PageMapKind rhs);
// Callback from rosalloc when it needs to increase the footprint. Must be implemented somewhere
// else (currently rosalloc_space.cc).
diff --git a/runtime/gc/allocator_type.h b/runtime/gc/allocator_type.h
index cd9f5d4..fb29837 100644
--- a/runtime/gc/allocator_type.h
+++ b/runtime/gc/allocator_type.h
@@ -37,7 +37,7 @@
kAllocatorTypeRegion, // Use CAS-based contiguous bump-pointer allocation within a region. (*)
kAllocatorTypeRegionTLAB, // Use region pieces as TLABs. Default for most small objects. (*)
};
-std::ostream& operator<<(std::ostream& os, const AllocatorType& rhs);
+std::ostream& operator<<(std::ostream& os, AllocatorType rhs);
inline constexpr bool IsTLABAllocator(AllocatorType allocator) {
return allocator == kAllocatorTypeTLAB || allocator == kAllocatorTypeRegionTLAB;
diff --git a/runtime/gc/collector/gc_type.h b/runtime/gc/collector/gc_type.h
index 401444a..f03ba1f 100644
--- a/runtime/gc/collector/gc_type.h
+++ b/runtime/gc/collector/gc_type.h
@@ -37,7 +37,7 @@
// Number of different GC types.
kGcTypeMax,
};
-std::ostream& operator<<(std::ostream& os, const GcType& policy);
+std::ostream& operator<<(std::ostream& os, GcType policy);
} // namespace collector
} // namespace gc
diff --git a/runtime/gc/collector_type.h b/runtime/gc/collector_type.h
index 62527e2..9c99964 100644
--- a/runtime/gc/collector_type.h
+++ b/runtime/gc/collector_type.h
@@ -60,7 +60,7 @@
// Fake collector type for ScopedGCCriticalSection
kCollectorTypeCriticalSection,
};
-std::ostream& operator<<(std::ostream& os, const CollectorType& collector_type);
+std::ostream& operator<<(std::ostream& os, CollectorType collector_type);
static constexpr CollectorType kCollectorTypeDefault =
#if ART_DEFAULT_GC_TYPE_IS_CMS
diff --git a/runtime/gc/space/region_space.h b/runtime/gc/space/region_space.h
index 9a3ce94..3da303d 100644
--- a/runtime/gc/space/region_space.h
+++ b/runtime/gc/space/region_space.h
@@ -782,8 +782,8 @@
DISALLOW_COPY_AND_ASSIGN(RegionSpace);
};
-std::ostream& operator<<(std::ostream& os, const RegionSpace::RegionState& value);
-std::ostream& operator<<(std::ostream& os, const RegionSpace::RegionType& value);
+std::ostream& operator<<(std::ostream& os, RegionSpace::RegionState value);
+std::ostream& operator<<(std::ostream& os, RegionSpace::RegionType value);
} // namespace space
} // namespace gc
diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h
index 3b7e3b7..5ea97eb 100644
--- a/runtime/gc/space/space.h
+++ b/runtime/gc/space/space.h
@@ -64,7 +64,7 @@
// collections won't scan these areas such as the Zygote.
kGcRetentionPolicyFullCollect,
};
-std::ostream& operator<<(std::ostream& os, const GcRetentionPolicy& policy);
+std::ostream& operator<<(std::ostream& os, GcRetentionPolicy policy);
enum SpaceType {
kSpaceTypeImageSpace,
@@ -74,7 +74,7 @@
kSpaceTypeLargeObjectSpace,
kSpaceTypeRegionSpace,
};
-std::ostream& operator<<(std::ostream& os, const SpaceType& space_type);
+std::ostream& operator<<(std::ostream& os, SpaceType space_type);
// A space contains memory allocated for managed objects.
class Space {
diff --git a/runtime/gc/weak_root_state.h b/runtime/gc/weak_root_state.h
index e3cefc4..0784d3c 100644
--- a/runtime/gc/weak_root_state.h
+++ b/runtime/gc/weak_root_state.h
@@ -33,7 +33,7 @@
kWeakRootStateMarkNewRoots,
};
-std::ostream& operator<<(std::ostream& os, const WeakRootState&);
+std::ostream& operator<<(std::ostream& os, WeakRootState weak_root_state);
} // namespace gc
} // namespace art
diff --git a/runtime/gc_root.h b/runtime/gc_root.h
index 8d8c32c..553f3d6 100644
--- a/runtime/gc_root.h
+++ b/runtime/gc_root.h
@@ -54,7 +54,7 @@
kRootVMInternal,
kRootJNIMonitor,
};
-std::ostream& operator<<(std::ostream& os, const RootType& root_type);
+std::ostream& operator<<(std::ostream& os, RootType root_type);
// Only used by hprof. thread_id_ and type_ are only used by hprof.
class RootInfo {
diff --git a/runtime/image.h b/runtime/image.h
index 637bf1c..ca585e7 100644
--- a/runtime/image.h
+++ b/runtime/image.h
@@ -579,11 +579,12 @@
return val & ~3u;
}
-std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageMethod& method);
-std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageRoot& root);
-std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageSections& section);
+std::ostream& operator<<(std::ostream& os, ImageHeader::ImageMethod method);
+std::ostream& operator<<(std::ostream& os, ImageHeader::ImageRoot root);
+std::ostream& operator<<(std::ostream& os, ImageHeader::ImageSections section);
+std::ostream& operator<<(std::ostream& os, ImageHeader::StorageMode mode);
+
std::ostream& operator<<(std::ostream& os, const ImageSection& section);
-std::ostream& operator<<(std::ostream& os, const ImageHeader::StorageMode& mode);
} // namespace art
diff --git a/runtime/indirect_reference_table.h b/runtime/indirect_reference_table.h
index eb07035..b46435d 100644
--- a/runtime/indirect_reference_table.h
+++ b/runtime/indirect_reference_table.h
@@ -97,7 +97,7 @@
kWeakGlobal = 3, // <<weak global reference>>
kLastKind = kWeakGlobal
};
-std::ostream& operator<<(std::ostream& os, const IndirectRefKind& rhs);
+std::ostream& operator<<(std::ostream& os, IndirectRefKind rhs);
const char* GetIndirectRefKindString(const IndirectRefKind& kind);
// Table definition.
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index e30fc9a..6c08333 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -763,8 +763,8 @@
DISALLOW_COPY_AND_ASSIGN(Instrumentation);
};
-std::ostream& operator<<(std::ostream& os, const Instrumentation::InstrumentationEvent& rhs);
-std::ostream& operator<<(std::ostream& os, const Instrumentation::InstrumentationLevel& rhs);
+std::ostream& operator<<(std::ostream& os, Instrumentation::InstrumentationEvent rhs);
+std::ostream& operator<<(std::ostream& os, Instrumentation::InstrumentationLevel rhs);
// An element in the instrumentation side stack maintained in art::Thread.
struct InstrumentationStackFrame {
diff --git a/runtime/jdwp_provider.h b/runtime/jdwp_provider.h
index 9cd3145..c7711ec 100644
--- a/runtime/jdwp_provider.h
+++ b/runtime/jdwp_provider.h
@@ -51,7 +51,7 @@
return JdwpProvider::kUnsetNonDebuggable;
}
-std::ostream& operator<<(std::ostream& os, const JdwpProvider& rhs);
+std::ostream& operator<<(std::ostream& os, JdwpProvider rhs);
} // namespace art
#endif // ART_RUNTIME_JDWP_PROVIDER_H_
diff --git a/runtime/jni_id_type.h b/runtime/jni_id_type.h
index 3f952b6..a8908fc 100644
--- a/runtime/jni_id_type.h
+++ b/runtime/jni_id_type.h
@@ -35,7 +35,7 @@
kDefault = kPointer,
};
-std::ostream& operator<<(std::ostream& os, const JniIdType& rhs);
+std::ostream& operator<<(std::ostream& os, JniIdType rhs);
} // namespace art
#endif // ART_RUNTIME_JNI_ID_TYPE_H_
diff --git a/runtime/lock_word.h b/runtime/lock_word.h
index 30559a0..84f45c2 100644
--- a/runtime/lock_word.h
+++ b/runtime/lock_word.h
@@ -316,7 +316,7 @@
// The encoded value holding all the state.
uint32_t value_;
};
-std::ostream& operator<<(std::ostream& os, const LockWord::LockState& code);
+std::ostream& operator<<(std::ostream& os, LockWord::LockState code);
} // namespace art
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index ee5aede..c1f15dd 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -70,7 +70,7 @@
kOatClassMax = 3,
};
-std::ostream& operator<<(std::ostream& os, const OatClassType& rhs);
+std::ostream& operator<<(std::ostream& os, OatClassType rhs);
class PACKED(4) OatMethodOffsets {
public:
diff --git a/runtime/process_state.h b/runtime/process_state.h
index e8797d6..aee200a 100644
--- a/runtime/process_state.h
+++ b/runtime/process_state.h
@@ -26,7 +26,7 @@
kProcessStateJankImperceptible = 1,
};
-std::ostream& operator<<(std::ostream& os, const ProcessState& process_state);
+std::ostream& operator<<(std::ostream& os, ProcessState process_state);
} // namespace art
diff --git a/runtime/reflective_value_visitor.h b/runtime/reflective_value_visitor.h
index 3a72760..87c5fe7 100644
--- a/runtime/reflective_value_visitor.h
+++ b/runtime/reflective_value_visitor.h
@@ -98,7 +98,7 @@
kSourceDexCacheResolvedField,
kSourceMiscInternal,
};
-std::ostream& operator<<(std::ostream& os, const ReflectionSourceType& type);
+std::ostream& operator<<(std::ostream& os, ReflectionSourceType type);
class ReflectionSourceInfo : public ValueObject {
public:
diff --git a/runtime/stack.h b/runtime/stack.h
index af33e6c..a7d9d53 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -54,7 +54,7 @@
kImpreciseConstant,
kUndefined,
};
-std::ostream& operator<<(std::ostream& os, const VRegKind& rhs);
+std::ostream& operator<<(std::ostream& os, VRegKind rhs);
// Size in bytes of the should_deoptimize flag on stack.
// We just need 4 bytes for our purpose regardless of the architecture. Frame size
diff --git a/runtime/suspend_reason.h b/runtime/suspend_reason.h
index 7f377d5..f45505a 100644
--- a/runtime/suspend_reason.h
+++ b/runtime/suspend_reason.h
@@ -30,7 +30,7 @@
kForUserCode,
};
-std::ostream& operator<<(std::ostream& os, const SuspendReason& thread);
+std::ostream& operator<<(std::ostream& os, SuspendReason thread);
} // namespace art
diff --git a/runtime/thread.h b/runtime/thread.h
index 5742689..d2833b0 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -2027,7 +2027,7 @@
};
std::ostream& operator<<(std::ostream& os, const Thread& thread);
-std::ostream& operator<<(std::ostream& os, const StackedShadowFrameType& thread);
+std::ostream& operator<<(std::ostream& os, StackedShadowFrameType thread);
} // namespace art
diff --git a/runtime/thread_state.h b/runtime/thread_state.h
index f36bc80..69b5b5d 100644
--- a/runtime/thread_state.h
+++ b/runtime/thread_state.h
@@ -57,7 +57,7 @@
kNative, // RUNNABLE TS_RUNNING running in a JNI native method
kSuspended, // RUNNABLE TS_RUNNING suspended by GC or debugger
};
-std::ostream& operator<<(std::ostream& os, const ThreadState& rhs);
+std::ostream& operator<<(std::ostream& os, ThreadState rhs);
} // namespace art
diff --git a/runtime/trace.h b/runtime/trace.h
index eccf157..25bff51 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -57,7 +57,7 @@
kMethodTracingActive, // Trace activity synchronous with method progress.
kSampleProfilingActive, // Trace activity captured by sampling thread.
};
-std::ostream& operator<<(std::ostream& os, const TracingMode& rhs);
+std::ostream& operator<<(std::ostream& os, TracingMode rhs);
// File format:
// header
diff --git a/runtime/verifier/verifier_enums.h b/runtime/verifier/verifier_enums.h
index 33eca4d..e3420f0 100644
--- a/runtime/verifier/verifier_enums.h
+++ b/runtime/verifier/verifier_enums.h
@@ -36,7 +36,7 @@
kSoftFailure,
kHardFailure,
};
-std::ostream& operator<<(std::ostream& os, const FailureKind& rhs);
+std::ostream& operator<<(std::ostream& os, FailureKind rhs);
// How to log hard failures during verification.
enum class HardFailLogMode {
@@ -62,7 +62,7 @@
METHOD_INTERFACE, // interface
METHOD_POLYMORPHIC // polymorphic
};
-std::ostream& operator<<(std::ostream& os, const MethodType& rhs);
+std::ostream& operator<<(std::ostream& os, MethodType rhs);
/*
* An enumeration of problems that can turn up during verification.
@@ -101,7 +101,7 @@
// code. May be removed once the compiler handles
// unreachable code correctly.
};
-std::ostream& operator<<(std::ostream& os, const VerifyError& rhs);
+std::ostream& operator<<(std::ostream& os, VerifyError rhs);
} // namespace verifier
} // namespace art
diff --git a/tools/generate_operator_out.py b/tools/generate_operator_out.py
index 921ae68..91e1caf 100755
--- a/tools/generate_operator_out.py
+++ b/tools/generate_operator_out.py
@@ -206,7 +206,7 @@
print('namespace %s {' % namespace)
print(
- 'std::ostream& operator<<(std::ostream& os, const %s& rhs) {' % enum_name)
+ 'std::ostream& operator<<(std::ostream& os, %s rhs) {' % enum_name)
print(' switch (rhs) {')
for (enum_value, enum_text) in _ENUMS[enum_name]:
print(' case %s: os << "%s"; break;' % (enum_value, enum_text))