comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotMethodResolved.java @ 2055:99ad52189524

Refactorings to get towards less CRI overhead.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Thu, 13 Jan 2011 17:45:17 +0100
parents 3c0a889a176b
children e5ba25730d9b
comparison
equal deleted inserted replaced
2054:3c0a889a176b 2055:99ad52189524
28 /** 28 /**
29 * Implementation of RiMethod for resolved HotSpot methods. 29 * Implementation of RiMethod for resolved HotSpot methods.
30 * 30 *
31 * @author Thomas Wuerthinger, Lukas Stadler 31 * @author Thomas Wuerthinger, Lukas Stadler
32 */ 32 */
33 public class HotSpotMethodResolved extends CompilerObject implements HotSpotMethod { 33 public final class HotSpotMethodResolved extends HotSpotMethod {
34 34
35 private final long vmId; 35 private final long vmId;
36 private final String name;
37 36
38 // cached values 37 // cached values
39 private byte[] code; 38 private byte[] code;
40 private int accessFlags = -1; 39 private int accessFlags = -1;
41 private int maxLocals = -1; 40 private int maxLocals = -1;
42 private int maxStackSize = -1; 41 private int maxStackSize = -1;
43 private RiExceptionHandler[] exceptionHandlers; 42 private RiExceptionHandler[] exceptionHandlers;
44 private RiSignature signature; 43 private RiSignature signature;
45 private RiType holder;
46 private Boolean hasBalancedMonitors; 44 private Boolean hasBalancedMonitors;
47 45
48 public HotSpotMethodResolved(long vmId, String name) { 46 public HotSpotMethodResolved(long vmId, String name) {
49 this.vmId = vmId; 47 this.vmId = vmId;
50 this.name = name; 48 this.name = name;
49 this.holder = Compiler.getVMEntries().RiMethod_holder(vmId);
51 } 50 }
52 51
53 @Override 52 @Override
54 public int accessFlags() { 53 public int accessFlags() {
55 if (accessFlags == -1) { 54 if (accessFlags == -1) {
83 public boolean hasBalancedMonitors() { 82 public boolean hasBalancedMonitors() {
84 if (hasBalancedMonitors == null) { 83 if (hasBalancedMonitors == null) {
85 hasBalancedMonitors = Compiler.getVMEntries().RiMethod_hasBalancedMonitors(vmId); 84 hasBalancedMonitors = Compiler.getVMEntries().RiMethod_hasBalancedMonitors(vmId);
86 } 85 }
87 return hasBalancedMonitors; 86 return hasBalancedMonitors;
88 }
89
90 @Override
91 public RiType holder() {
92 if (holder == null) {
93 holder = Compiler.getVMEntries().RiMethod_holder(vmId);
94 }
95 return holder;
96 } 87 }
97 88
98 @Override 89 @Override
99 public boolean isClassInitializer() { 90 public boolean isClassInitializer() {
100 return "<clinit>".equals(name); 91 return "<clinit>".equals(name);
149 public RiMethodProfile methodData() { 140 public RiMethodProfile methodData() {
150 return null; 141 return null;
151 } 142 }
152 143
153 @Override 144 @Override
154 public String name() {
155 return name;
156 }
157
158 @Override
159 public StackTraceElement toStackTraceElement(int bci) { 145 public StackTraceElement toStackTraceElement(int bci) {
160 return CiUtil.toStackTraceElement(this, bci); 146 return CiUtil.toStackTraceElement(this, bci);
161 } 147 }
162 148
163 @Override 149 @Override