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 namespace art { 23 namespace gc { 24 25 // Which types of collections are able to be performed. 26 enum CollectorType { 27 // No collector selected. 28 kCollectorTypeNone, 29 // Non concurrent mark-sweep. 30 kCollectorTypeMS, 31 // Concurrent mark-sweep. 32 kCollectorTypeCMS, 33 // Semi-space / mark-sweep hybrid, enables compaction. 34 kCollectorTypeSS, 35 // A generational variant of kCollectorTypeSS. 36 kCollectorTypeGSS, 37 // Mark compact collector. 38 kCollectorTypeMC, 39 // Heap trimming collector, doesn't do any actual collecting. 40 kCollectorTypeHeapTrim, 41 // A (mostly) concurrent copying collector. 42 kCollectorTypeCC, 43 // The background compaction of the concurrent copying collector. 44 kCollectorTypeCCBackground, 45 // Instrumentation critical section fake collector. 46 kCollectorTypeInstrumentation, 47 // Fake collector for adding or removing application image spaces. 48 kCollectorTypeAddRemoveAppImageSpace, 49 // Fake collector used to implement exclusion between GC and debugger. 50 kCollectorTypeDebugger, 51 // A homogeneous space compaction collector used in background transition 52 // when both foreground and background collector are CMS. 53 kCollectorTypeHomogeneousSpaceCompact, 54 // Class linker fake collector. 55 kCollectorTypeClassLinker, 56 // JIT Code cache fake collector. 57 kCollectorTypeJitCodeCache, 58 // Hprof fake collector. 59 kCollectorTypeHprof, 60 // Fake collector for installing/removing a system-weak holder. 61 kCollectorTypeAddRemoveSystemWeakHolder, 62 // Fake collector type for GetObjectsAllocated 63 kCollectorTypeGetObjectsAllocated, 64 // Fake collector type for ScopedGCCriticalSection 65 kCollectorTypeCriticalSection, 66 }; 67 std::ostream& operator<<(std::ostream& os, const CollectorType& collector_type); 68 69 static constexpr CollectorType kCollectorTypeDefault = 70 #if ART_DEFAULT_GC_TYPE_IS_CMS 71 kCollectorTypeCMS 72 #elif ART_DEFAULT_GC_TYPE_IS_SS 73 kCollectorTypeSS 74 #elif ART_DEFAULT_GC_TYPE_IS_GSS 75 kCollectorTypeGSS 76 #else 77 kCollectorTypeCMS 78 #error "ART default GC type must be set" 79 #endif 80 ; // NOLINT [whitespace/semicolon] [5] 81 82 } // namespace gc 83 } // namespace art 84 85 #endif // ART_RUNTIME_GC_COLLECTOR_TYPE_H_ 86