Mercurial > hg > graal-compiler
comparison src/share/vm/oops/generateOopMap.cpp @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | 8012aa3ccede |
children | 540930dc854d 6a991dcb52bb |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
24 | 24 |
25 #include "precompiled.hpp" | 25 #include "precompiled.hpp" |
26 #include "interpreter/bytecodeStream.hpp" | 26 #include "interpreter/bytecodeStream.hpp" |
27 #include "oops/generateOopMap.hpp" | 27 #include "oops/generateOopMap.hpp" |
28 #include "oops/oop.inline.hpp" | 28 #include "oops/oop.inline.hpp" |
29 #include "oops/symbolOop.hpp" | 29 #include "oops/symbol.hpp" |
30 #include "runtime/handles.inline.hpp" | 30 #include "runtime/handles.inline.hpp" |
31 #include "runtime/java.hpp" | 31 #include "runtime/java.hpp" |
32 #include "runtime/relocator.hpp" | 32 #include "runtime/relocator.hpp" |
33 #include "utilities/bitMap.inline.hpp" | 33 #include "utilities/bitMap.inline.hpp" |
34 | 34 |
121 set(CellTypeState::value); } | 121 set(CellTypeState::value); } |
122 void do_long () { set(CellTypeState::value); | 122 void do_long () { set(CellTypeState::value); |
123 set(CellTypeState::value); } | 123 set(CellTypeState::value); } |
124 | 124 |
125 public: | 125 public: |
126 ComputeCallStack(symbolOop signature) : SignatureIterator(signature) {}; | 126 ComputeCallStack(Symbol* signature) : SignatureIterator(signature) {}; |
127 | 127 |
128 // Compute methods | 128 // Compute methods |
129 int compute_for_parameters(bool is_static, CellTypeState *effect) { | 129 int compute_for_parameters(bool is_static, CellTypeState *effect) { |
130 _idx = 0; | 130 _idx = 0; |
131 _effect = effect; | 131 _effect = effect; |
175 set(CellTypeState::value); } | 175 set(CellTypeState::value); } |
176 void do_long () { set(CellTypeState::value); | 176 void do_long () { set(CellTypeState::value); |
177 set(CellTypeState::value); } | 177 set(CellTypeState::value); } |
178 | 178 |
179 public: | 179 public: |
180 ComputeEntryStack(symbolOop signature) : SignatureIterator(signature) {}; | 180 ComputeEntryStack(Symbol* signature) : SignatureIterator(signature) {}; |
181 | 181 |
182 // Compute methods | 182 // Compute methods |
183 int compute_for_parameters(bool is_static, CellTypeState *effect) { | 183 int compute_for_parameters(bool is_static, CellTypeState *effect) { |
184 _idx = 0; | 184 _idx = 0; |
185 _effect = effect; | 185 _effect = effect; |
658 | 658 |
659 _stack_top = 0; | 659 _stack_top = 0; |
660 _monitor_top = 0; | 660 _monitor_top = 0; |
661 } | 661 } |
662 | 662 |
663 int GenerateOopMap::methodsig_to_effect(symbolOop signature, bool is_static, CellTypeState* effect) { | 663 int GenerateOopMap::methodsig_to_effect(Symbol* signature, bool is_static, CellTypeState* effect) { |
664 ComputeEntryStack ces(signature); | 664 ComputeEntryStack ces(signature); |
665 return ces.compute_for_parameters(is_static, effect); | 665 return ces.compute_for_parameters(is_static, effect); |
666 } | 666 } |
667 | 667 |
668 // Return result of merging cts1 and cts2. | 668 // Return result of merging cts1 and cts2. |
1263 case Bytecodes::_invokeinterface: | 1263 case Bytecodes::_invokeinterface: |
1264 int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache(); | 1264 int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache(); |
1265 constantPoolOop cp = method()->constants(); | 1265 constantPoolOop cp = method()->constants(); |
1266 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); | 1266 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); |
1267 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); | 1267 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); |
1268 symbolOop signature = cp->symbol_at(signatureIdx); | 1268 Symbol* signature = cp->symbol_at(signatureIdx); |
1269 os->print("%s", signature->as_C_string()); | 1269 os->print("%s", signature->as_C_string()); |
1270 } | 1270 } |
1271 os->cr(); | 1271 os->cr(); |
1272 os->print(" stack = "); | 1272 os->print(" stack = "); |
1273 print_states(os, stack(), _stack_top); | 1273 print_states(os, stack(), _stack_top); |
1295 case Bytecodes::_invokeinterface: | 1295 case Bytecodes::_invokeinterface: |
1296 int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache(); | 1296 int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache(); |
1297 constantPoolOop cp = method()->constants(); | 1297 constantPoolOop cp = method()->constants(); |
1298 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); | 1298 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); |
1299 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); | 1299 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); |
1300 symbolOop signature = cp->symbol_at(signatureIdx); | 1300 Symbol* signature = cp->symbol_at(signatureIdx); |
1301 os->print("%s", signature->as_C_string()); | 1301 os->print("%s", signature->as_C_string()); |
1302 } | 1302 } |
1303 os->cr(); | 1303 os->cr(); |
1304 } | 1304 } |
1305 } | 1305 } |
1842 BasicType bt = ldc.result_type(); | 1842 BasicType bt = ldc.result_type(); |
1843 CellTypeState cts = (bt == T_OBJECT) ? CellTypeState::make_line_ref(bci) : valCTS; | 1843 CellTypeState cts = (bt == T_OBJECT) ? CellTypeState::make_line_ref(bci) : valCTS; |
1844 // Make sure bt==T_OBJECT is the same as old code (is_pointer_entry). | 1844 // Make sure bt==T_OBJECT is the same as old code (is_pointer_entry). |
1845 // Note that CONSTANT_MethodHandle entries are u2 index pairs, not pointer-entries, | 1845 // Note that CONSTANT_MethodHandle entries are u2 index pairs, not pointer-entries, |
1846 // and they are processed by _fast_aldc and the CP cache. | 1846 // and they are processed by _fast_aldc and the CP cache. |
1847 assert((ldc.has_cache_index() || cp->is_pointer_entry(ldc.pool_index())) | 1847 assert((ldc.has_cache_index() || cp->is_object_entry(ldc.pool_index())) |
1848 ? (bt == T_OBJECT) : true, "expected object type"); | 1848 ? (bt == T_OBJECT) : true, "expected object type"); |
1849 ppush1(cts); | 1849 ppush1(cts); |
1850 } | 1850 } |
1851 | 1851 |
1852 void GenerateOopMap::do_multianewarray(int dims, int bci) { | 1852 void GenerateOopMap::do_multianewarray(int dims, int bci) { |
1882 void GenerateOopMap::do_field(int is_get, int is_static, int idx, int bci) { | 1882 void GenerateOopMap::do_field(int is_get, int is_static, int idx, int bci) { |
1883 // Dig up signature for field in constant pool | 1883 // Dig up signature for field in constant pool |
1884 constantPoolOop cp = method()->constants(); | 1884 constantPoolOop cp = method()->constants(); |
1885 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); | 1885 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); |
1886 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); | 1886 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); |
1887 symbolOop signature = cp->symbol_at(signatureIdx); | 1887 Symbol* signature = cp->symbol_at(signatureIdx); |
1888 | 1888 |
1889 // Parse signature (espcially simple for fields) | 1889 // Parse signature (espcially simple for fields) |
1890 assert(signature->utf8_length() > 0, "field signatures cannot have zero length"); | 1890 assert(signature->utf8_length() > 0, "field signatures cannot have zero length"); |
1891 // The signature is UFT8 encoded, but the first char is always ASCII for signatures. | 1891 // The signature is UFT8 encoded, but the first char is always ASCII for signatures. |
1892 char sigch = (char)*(signature->base()); | 1892 char sigch = (char)*(signature->base()); |
1910 } | 1910 } |
1911 | 1911 |
1912 void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci) { | 1912 void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci) { |
1913 // Dig up signature for field in constant pool | 1913 // Dig up signature for field in constant pool |
1914 constantPoolOop cp = _method->constants(); | 1914 constantPoolOop cp = _method->constants(); |
1915 symbolOop signature = cp->signature_ref_at(idx); | 1915 Symbol* signature = cp->signature_ref_at(idx); |
1916 | 1916 |
1917 // Parse method signature | 1917 // Parse method signature |
1918 CellTypeState out[4]; | 1918 CellTypeState out[4]; |
1919 CellTypeState in[MAXARGSIZE+1]; // Includes result | 1919 CellTypeState in[MAXARGSIZE+1]; // Includes result |
1920 ComputeCallStack cse(signature); | 1920 ComputeCallStack cse(signature); |