Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/oops/Method.java @ 3945:8ed53447f690
Merge
author | iveresov |
---|---|
date | Thu, 15 Sep 2011 12:44:09 -0700 |
parents | f6f3bb0ee072 |
children | 2fe087c3e814 |
comparison
equal
deleted
inserted
replaced
3929:f94227b6117b | 3945:8ed53447f690 |
---|---|
47 | 47 |
48 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { | 48 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { |
49 Type type = db.lookupType("methodOopDesc"); | 49 Type type = db.lookupType("methodOopDesc"); |
50 constMethod = new OopField(type.getOopField("_constMethod"), 0); | 50 constMethod = new OopField(type.getOopField("_constMethod"), 0); |
51 constants = new OopField(type.getOopField("_constants"), 0); | 51 constants = new OopField(type.getOopField("_constants"), 0); |
52 methodData = new OopField(type.getOopField("_method_data"), 0); | |
52 methodSize = new CIntField(type.getCIntegerField("_method_size"), 0); | 53 methodSize = new CIntField(type.getCIntegerField("_method_size"), 0); |
53 maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0); | 54 maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0); |
54 maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0); | 55 maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0); |
55 sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0); | 56 sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0); |
56 accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); | 57 accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); |
57 code = type.getAddressField("_code"); | 58 code = type.getAddressField("_code"); |
58 vtableIndex = new CIntField(type.getCIntegerField("_vtable_index"), 0); | 59 vtableIndex = new CIntField(type.getCIntegerField("_vtable_index"), 0); |
59 if (!VM.getVM().isCore()) { | 60 if (!VM.getVM().isCore()) { |
60 invocationCounter = new CIntField(type.getCIntegerField("_invocation_counter"), 0); | 61 invocationCounter = new CIntField(type.getCIntegerField("_invocation_counter"), 0); |
62 backedgeCounter = new CIntField(type.getCIntegerField("_backedge_counter"), 0); | |
61 } | 63 } |
62 bytecodeOffset = type.getSize(); | 64 bytecodeOffset = type.getSize(); |
65 | |
66 interpreterThrowoutCountField = new CIntField(type.getCIntegerField("_interpreter_throwout_count"), 0); | |
67 interpreterInvocationCountField = new CIntField(type.getCIntegerField("_interpreter_invocation_count"), 0); | |
63 | 68 |
64 /* | 69 /* |
65 interpreterEntry = type.getAddressField("_interpreter_entry"); | 70 interpreterEntry = type.getAddressField("_interpreter_entry"); |
66 fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point"); | 71 fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point"); |
67 | 72 |
77 public boolean isMethod() { return true; } | 82 public boolean isMethod() { return true; } |
78 | 83 |
79 // Fields | 84 // Fields |
80 private static OopField constMethod; | 85 private static OopField constMethod; |
81 private static OopField constants; | 86 private static OopField constants; |
87 private static OopField methodData; | |
82 private static CIntField methodSize; | 88 private static CIntField methodSize; |
83 private static CIntField maxStack; | 89 private static CIntField maxStack; |
84 private static CIntField maxLocals; | 90 private static CIntField maxLocals; |
85 private static CIntField sizeOfParameters; | 91 private static CIntField sizeOfParameters; |
86 private static CIntField accessFlags; | 92 private static CIntField accessFlags; |
87 private static CIntField vtableIndex; | 93 private static CIntField vtableIndex; |
88 private static CIntField invocationCounter; | 94 private static CIntField invocationCounter; |
95 private static CIntField backedgeCounter; | |
89 private static long bytecodeOffset; | 96 private static long bytecodeOffset; |
90 | 97 |
91 private static AddressField code; | 98 private static AddressField code; |
99 | |
100 private static CIntField interpreterThrowoutCountField; | |
101 private static CIntField interpreterInvocationCountField; | |
92 | 102 |
93 // constant method names - <init>, <clinit> | 103 // constant method names - <init>, <clinit> |
94 // Initialized lazily to avoid initialization ordering dependencies between Method and SymbolTable | 104 // Initialized lazily to avoid initialization ordering dependencies between Method and SymbolTable |
95 private static Symbol objectInitializerName; | 105 private static Symbol objectInitializerName; |
96 private static Symbol classInitializerName; | 106 private static Symbol classInitializerName; |
114 */ | 124 */ |
115 | 125 |
116 // Accessors for declared fields | 126 // Accessors for declared fields |
117 public ConstMethod getConstMethod() { return (ConstMethod) constMethod.getValue(this); } | 127 public ConstMethod getConstMethod() { return (ConstMethod) constMethod.getValue(this); } |
118 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } | 128 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } |
129 public MethodData getMethodData() { return (MethodData) methodData.getValue(this); } | |
119 public TypeArray getExceptionTable() { return getConstMethod().getExceptionTable(); } | 130 public TypeArray getExceptionTable() { return getConstMethod().getExceptionTable(); } |
120 /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */ | 131 /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */ |
121 public long getMethodSize() { return methodSize.getValue(this); } | 132 public long getMethodSize() { return methodSize.getValue(this); } |
122 public long getMaxStack() { return maxStack.getValue(this); } | 133 public long getMaxStack() { return maxStack.getValue(this); } |
123 public long getMaxLocals() { return maxLocals.getValue(this); } | 134 public long getMaxLocals() { return maxLocals.getValue(this); } |
132 if (Assert.ASSERTS_ENABLED) { | 143 if (Assert.ASSERTS_ENABLED) { |
133 Assert.that(!VM.getVM().isCore(), "must not be used in core build"); | 144 Assert.that(!VM.getVM().isCore(), "must not be used in core build"); |
134 } | 145 } |
135 return invocationCounter.getValue(this); | 146 return invocationCounter.getValue(this); |
136 } | 147 } |
148 public long getBackedgeCounter() { | |
149 if (Assert.ASSERTS_ENABLED) { | |
150 Assert.that(!VM.getVM().isCore(), "must not be used in core build"); | |
151 } | |
152 return backedgeCounter.getValue(this); | |
153 } | |
137 | 154 |
138 // get associated compiled native method, if available, else return null. | 155 // get associated compiled native method, if available, else return null. |
139 public NMethod getNativeMethod() { | 156 public NMethod getNativeMethod() { |
140 Address addr = code.getValue(getHandle()); | 157 Address addr = code.getValue(getHandle()); |
141 return (NMethod) VMObjectFactory.newObject(NMethod.class, addr); | 158 return (NMethod) VMObjectFactory.newObject(NMethod.class, addr); |
331 buf.append("("); | 348 buf.append("("); |
332 new SignatureConverter(getSignature(), buf).iterateParameters(); | 349 new SignatureConverter(getSignature(), buf).iterateParameters(); |
333 buf.append(")"); | 350 buf.append(")"); |
334 return buf.toString().replace('/', '.'); | 351 return buf.toString().replace('/', '.'); |
335 } | 352 } |
353 public int interpreterThrowoutCount() { | |
354 return (int) interpreterThrowoutCountField.getValue(getHandle()); | |
355 } | |
356 | |
357 public int interpreterInvocationCount() { | |
358 return (int) interpreterInvocationCountField.getValue(getHandle()); | |
359 } | |
336 } | 360 } |