1 /*
2  * Copyright (C) 2017 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 package com.android.ahat.heapdump;
18 
19 /**
20  * Enumeration representing object root types as defined in the binary heap
21  * dump format specification.
22  */
23 public enum RootType {
24   /**
25    * There is a JNI Global Reference for the object in question.
26    */
27   JNI_GLOBAL      (1 <<  0),
28 
29   /**
30    * There is a JNI Local Reference for the object in question.
31    */
32   JNI_LOCAL       (1 <<  1),
33 
34   /**
35    * The object in question is a parameter or local variable of a running
36    * method.
37    */
38   JAVA_FRAME      (1 <<  2),
39 
40   /**
41    * The object in question is a parameter of a running JNI method.
42    */
43   NATIVE_STACK    (1 <<  3),
44 
45   /**
46    * The object is a class object that cannot be unloaded.
47    */
48   STICKY_CLASS    (1 <<  4),
49 
50   /**
51    * The object is referenced from an active thread block.
52    */
53   THREAD_BLOCK    (1 <<  5),
54 
55   /**
56    * The object's monitor is currently in use.
57    */
58   MONITOR         (1 <<  6),
59 
60   /**
61    * The object is a running thread.
62    */
63   THREAD          (1 <<  7),
64 
65   /**
66    * The object is an interned string.
67    */
68   INTERNED_STRING (1 <<  8),
69 
70   /**
71    * The object is being used by the debugger.
72    */
73   DEBUGGER        (1 <<  9),
74 
75   /**
76    * The object is being used by the VM internally.
77    */
78   VM_INTERNAL     (1 << 10),
79 
80   /**
81    * The object has no given reason for being considered a root.
82    */
83   UNKNOWN         (1 << 11),
84 
85   /**
86    * The object's monitor is currently in use from JNI.
87    */
88   JNI_MONITOR     (1 << 12),
89 
90   /**
91    * The object is waiting to be finalized.
92    */
93   FINALIZING      (1 << 13);
94 
95   final int mask;
96 
RootType(int mask)97   RootType(int mask) {
98     this.mask = mask;
99   }
100 }
101