1 /* |
1 /* |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
38 |
38 |
39 public class HeapRegionType extends VMObject { |
39 public class HeapRegionType extends VMObject { |
40 |
40 |
41 private static int freeTag; |
41 private static int freeTag; |
42 private static int youngMask; |
42 private static int youngMask; |
|
43 private static int edenTag; |
|
44 private static int survTag; |
43 private static int humongousMask; |
45 private static int humongousMask; |
|
46 private static int startsHumongousTag; |
|
47 private static int continuesHumongousTag; |
44 private static int pinnedMask; |
48 private static int pinnedMask; |
|
49 private static int archiveMask; |
45 private static int oldMask; |
50 private static int oldMask; |
46 private static CIntegerField tagField; |
51 private static CIntegerField tagField; |
47 private int tag; |
52 private int tag; |
48 |
53 |
49 static { |
54 static { |
59 |
64 |
60 tagField = type.getCIntegerField("_tag"); |
65 tagField = type.getCIntegerField("_tag"); |
61 |
66 |
62 freeTag = db.lookupIntConstant("HeapRegionType::FreeTag"); |
67 freeTag = db.lookupIntConstant("HeapRegionType::FreeTag"); |
63 youngMask = db.lookupIntConstant("HeapRegionType::YoungMask"); |
68 youngMask = db.lookupIntConstant("HeapRegionType::YoungMask"); |
|
69 edenTag = db.lookupIntConstant("HeapRegionType::EdenTag"); |
|
70 survTag = db.lookupIntConstant("HeapRegionType::SurvTag"); |
|
71 startsHumongousTag = db.lookupIntConstant("HeapRegionType::StartsHumongousTag"); |
|
72 continuesHumongousTag = db.lookupIntConstant("HeapRegionType::ContinuesHumongousTag"); |
|
73 archiveMask = db.lookupIntConstant("HeapRegionType::ArchiveMask"); |
64 humongousMask = db.lookupIntConstant("HeapRegionType::HumongousMask"); |
74 humongousMask = db.lookupIntConstant("HeapRegionType::HumongousMask"); |
65 pinnedMask = db.lookupIntConstant("HeapRegionType::PinnedMask"); |
75 pinnedMask = db.lookupIntConstant("HeapRegionType::PinnedMask"); |
66 oldMask = db.lookupIntConstant("HeapRegionType::OldMask"); |
76 oldMask = db.lookupIntConstant("HeapRegionType::OldMask"); |
67 } |
77 } |
68 |
78 |
69 public boolean isFree() { |
79 public boolean isFree() { |
70 return tagField.getValue(addr) == freeTag; |
80 return tagField.getValue(addr) == freeTag; |
71 } |
81 } |
72 |
82 |
|
83 public boolean isEden() { |
|
84 return tagField.getValue(addr) == edenTag; |
|
85 } |
|
86 |
|
87 public boolean isSurvivor() { |
|
88 return tagField.getValue(addr) == survTag; |
|
89 } |
|
90 |
73 public boolean isYoung() { |
91 public boolean isYoung() { |
74 return (tagField.getValue(addr) & youngMask) != 0; |
92 return (tagField.getValue(addr) & youngMask) != 0; |
75 } |
93 } |
76 |
94 |
77 public boolean isHumongous() { |
95 public boolean isHumongous() { |
78 return (tagField.getValue(addr) & humongousMask) != 0; |
96 return (tagField.getValue(addr) & humongousMask) != 0; |
|
97 } |
|
98 |
|
99 public boolean isStartsHumongous() { |
|
100 return tagField.getValue(addr) == startsHumongousTag; |
|
101 } |
|
102 |
|
103 public boolean isContinuesHumongous() { |
|
104 return tagField.getValue(addr) == continuesHumongousTag; |
|
105 } |
|
106 |
|
107 public boolean isArchive() { |
|
108 return (tagField.getValue(addr) & archiveMask) != 0; |
79 } |
109 } |
80 |
110 |
81 public boolean isPinned() { |
111 public boolean isPinned() { |
82 return (tagField.getValue(addr) & pinnedMask) != 0; |
112 return (tagField.getValue(addr) & pinnedMask) != 0; |
83 } |
113 } |