Mercurial > hg > truffle
comparison src/share/vm/ci/ciField.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 | f95d63e2154a |
children | d25d4ca69222 1957c1478794 |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
77 | 77 |
78 _cp_index = index; | 78 _cp_index = index; |
79 constantPoolHandle cpool(thread, klass->get_instanceKlass()->constants()); | 79 constantPoolHandle cpool(thread, klass->get_instanceKlass()->constants()); |
80 | 80 |
81 // Get the field's name, signature, and type. | 81 // Get the field's name, signature, and type. |
82 symbolHandle name (thread, cpool->name_ref_at(index)); | 82 Symbol* name = cpool->name_ref_at(index); |
83 _name = ciEnv::current(thread)->get_object(name())->as_symbol(); | 83 _name = ciEnv::current(thread)->get_symbol(name); |
84 | 84 |
85 int nt_index = cpool->name_and_type_ref_index_at(index); | 85 int nt_index = cpool->name_and_type_ref_index_at(index); |
86 int sig_index = cpool->signature_ref_index_at(nt_index); | 86 int sig_index = cpool->signature_ref_index_at(nt_index); |
87 symbolHandle signature (thread, cpool->symbol_at(sig_index)); | 87 Symbol* signature = cpool->symbol_at(sig_index); |
88 _signature = ciEnv::current(thread)->get_object(signature())->as_symbol(); | 88 _signature = ciEnv::current(thread)->get_symbol(signature); |
89 | 89 |
90 BasicType field_type = FieldType::basic_type(signature()); | 90 BasicType field_type = FieldType::basic_type(signature); |
91 | 91 |
92 // If the field is a pointer type, get the klass of the | 92 // If the field is a pointer type, get the klass of the |
93 // field. | 93 // field. |
94 if (field_type == T_OBJECT || field_type == T_ARRAY) { | 94 if (field_type == T_OBJECT || field_type == T_ARRAY) { |
95 bool ignore; | 95 bool ignore; |
98 _type = ciEnv::current(thread)->get_klass_by_index(cpool, sig_index, ignore, klass); | 98 _type = ciEnv::current(thread)->get_klass_by_index(cpool, sig_index, ignore, klass); |
99 } else { | 99 } else { |
100 _type = ciType::make(field_type); | 100 _type = ciType::make(field_type); |
101 } | 101 } |
102 | 102 |
103 _name = (ciSymbol*)ciEnv::current(thread)->get_object(name()); | 103 _name = (ciSymbol*)ciEnv::current(thread)->get_symbol(name); |
104 | 104 |
105 // Get the field's declared holder. | 105 // Get the field's declared holder. |
106 // | 106 // |
107 // Note: we actually create a ciInstanceKlass for this klass, | 107 // Note: we actually create a ciInstanceKlass for this klass, |
108 // even though we may not need to. | 108 // even though we may not need to. |
128 instanceKlass* loaded_decl_holder = declared_holder->get_instanceKlass(); | 128 instanceKlass* loaded_decl_holder = declared_holder->get_instanceKlass(); |
129 | 129 |
130 // Perform the field lookup. | 130 // Perform the field lookup. |
131 fieldDescriptor field_desc; | 131 fieldDescriptor field_desc; |
132 klassOop canonical_holder = | 132 klassOop canonical_holder = |
133 loaded_decl_holder->find_field(name(), signature(), &field_desc); | 133 loaded_decl_holder->find_field(name, signature, &field_desc); |
134 if (canonical_holder == NULL) { | 134 if (canonical_holder == NULL) { |
135 // Field lookup failed. Will be detected by will_link. | 135 // Field lookup failed. Will be detected by will_link. |
136 _holder = declared_holder; | 136 _holder = declared_holder; |
137 _offset = -1; | 137 _offset = -1; |
138 _is_constant = false; | 138 _is_constant = false; |
148 | 148 |
149 _cp_index = -1; | 149 _cp_index = -1; |
150 | 150 |
151 // Get the field's name, signature, and type. | 151 // Get the field's name, signature, and type. |
152 ciEnv* env = CURRENT_ENV; | 152 ciEnv* env = CURRENT_ENV; |
153 _name = env->get_object(fd->name())->as_symbol(); | 153 _name = env->get_symbol(fd->name()); |
154 _signature = env->get_object(fd->signature())->as_symbol(); | 154 _signature = env->get_symbol(fd->signature()); |
155 | 155 |
156 BasicType field_type = fd->field_type(); | 156 BasicType field_type = fd->field_type(); |
157 | 157 |
158 // If the field is a pointer type, get the klass of the | 158 // If the field is a pointer type, get the klass of the |
159 // field. | 159 // field. |