1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ART_RUNTIME_GC_COLLECTOR_TYPE_H_ 18 #define ART_RUNTIME_GC_COLLECTOR_TYPE_H_ 19 20 #include <iosfwd> 21 22 #include "base/macros.h" 23 24 namespace art HIDDEN { 25 namespace gc { 26 27 // Which types of collections are able to be performed. 28 enum CollectorType { 29 // No collector selected. 30 kCollectorTypeNone, 31 // Non concurrent mark-sweep. 32 kCollectorTypeMS, 33 // Concurrent mark-sweep. 34 kCollectorTypeCMS, 35 // Concurrent mark-compact. 36 kCollectorTypeCMC, 37 // The background compaction of the Concurrent mark-compact GC. 38 kCollectorTypeCMCBackground, 39 // Semi-space / mark-sweep hybrid, enables compaction. 40 kCollectorTypeSS, 41 // Heap trimming collector, doesn't do any actual collecting. 42 kCollectorTypeHeapTrim, 43 // A (mostly) concurrent copying collector. 44 kCollectorTypeCC, 45 // The background compaction of the concurrent copying collector. 46 kCollectorTypeCCBackground, 47 // Instrumentation critical section fake collector. 48 kCollectorTypeInstrumentation, 49 // Fake collector for adding or removing application image spaces. 50 kCollectorTypeAddRemoveAppImageSpace, 51 // Fake collector used to implement exclusion between GC and debugger. 52 kCollectorTypeDebugger, 53 // A homogeneous space compaction collector used in background transition 54 // when both foreground and background collector are CMS. 55 kCollectorTypeHomogeneousSpaceCompact, 56 // Class linker fake collector. 57 kCollectorTypeClassLinker, 58 // JIT Code cache fake collector. 59 kCollectorTypeJitCodeCache, 60 // Hprof fake collector. 61 kCollectorTypeHprof, 62 // Fake collector for installing/removing a system-weak holder. 63 kCollectorTypeAddRemoveSystemWeakHolder, 64 // Fake collector type for GetObjectsAllocated 65 kCollectorTypeGetObjectsAllocated, 66 // Fake collector type for ScopedGCCriticalSection 67 kCollectorTypeCriticalSection, 68 }; 69 std::ostream& operator<<(std::ostream& os, CollectorType collector_type); 70 71 static constexpr CollectorType kCollectorTypeDefault = 72 #if ART_DEFAULT_GC_TYPE_IS_CMC 73 kCollectorTypeCMC 74 #elif ART_DEFAULT_GC_TYPE_IS_SS 75 kCollectorTypeSS 76 #elif ART_DEFAULT_GC_TYPE_IS_CMS 77 kCollectorTypeCMS 78 #else 79 #error "ART default GC type must be set" 80 #endif 81 ; // NOLINT [whitespace/semicolon] [5] 82 83 } // namespace gc 84 } // namespace art 85 86 #endif // ART_RUNTIME_GC_COLLECTOR_TYPE_H_ 87