118 |
118 |
119 // Implementation of Bytecode_invoke |
119 // Implementation of Bytecode_invoke |
120 |
120 |
121 void Bytecode_invoke::verify() const { |
121 void Bytecode_invoke::verify() const { |
122 assert(is_valid(), "check invoke"); |
122 assert(is_valid(), "check invoke"); |
123 assert(method()->constants()->cache() != NULL, "do not call this from verifier or rewriter"); |
123 assert(cpcache() != NULL, "do not call this from verifier or rewriter"); |
|
124 } |
|
125 |
|
126 |
|
127 Symbol* Bytecode_member_ref::klass() const { |
|
128 return constants()->klass_ref_at_noresolve(index()); |
|
129 } |
|
130 |
|
131 |
|
132 Symbol* Bytecode_member_ref::name() const { |
|
133 return constants()->name_ref_at(index()); |
124 } |
134 } |
125 |
135 |
126 |
136 |
127 Symbol* Bytecode_member_ref::signature() const { |
137 Symbol* Bytecode_member_ref::signature() const { |
128 constantPoolOop constants = method()->constants(); |
138 return constants()->signature_ref_at(index()); |
129 return constants->signature_ref_at(index()); |
|
130 } |
|
131 |
|
132 |
|
133 Symbol* Bytecode_member_ref::name() const { |
|
134 constantPoolOop constants = method()->constants(); |
|
135 return constants->name_ref_at(index()); |
|
136 } |
139 } |
137 |
140 |
138 |
141 |
139 BasicType Bytecode_member_ref::result_type() const { |
142 BasicType Bytecode_member_ref::result_type() const { |
140 ResultTypeFinder rts(signature()); |
143 ResultTypeFinder rts(signature()); |
144 |
147 |
145 |
148 |
146 methodHandle Bytecode_invoke::static_target(TRAPS) { |
149 methodHandle Bytecode_invoke::static_target(TRAPS) { |
147 methodHandle m; |
150 methodHandle m; |
148 KlassHandle resolved_klass; |
151 KlassHandle resolved_klass; |
149 constantPoolHandle constants(THREAD, _method->constants()); |
152 constantPoolHandle constants(THREAD, this->constants()); |
150 |
153 |
151 if (java_code() == Bytecodes::_invokedynamic) { |
154 Bytecodes::Code bc = invoke_code(); |
152 LinkResolver::resolve_dynamic_method(m, resolved_klass, constants, index(), CHECK_(methodHandle())); |
155 LinkResolver::resolve_method_statically(m, resolved_klass, bc, constants, index(), CHECK_(methodHandle())); |
153 } else if (java_code() != Bytecodes::_invokeinterface) { |
|
154 LinkResolver::resolve_method(m, resolved_klass, constants, index(), CHECK_(methodHandle())); |
|
155 } else { |
|
156 LinkResolver::resolve_interface_method(m, resolved_klass, constants, index(), CHECK_(methodHandle())); |
|
157 } |
|
158 return m; |
156 return m; |
159 } |
157 } |
160 |
158 |
|
159 Handle Bytecode_invoke::appendix(TRAPS) { |
|
160 ConstantPoolCacheEntry* cpce = cpcache_entry(); |
|
161 if (cpce->has_appendix()) |
|
162 return Handle(THREAD, cpce->f1_appendix()); |
|
163 return Handle(); // usual case |
|
164 } |
161 |
165 |
162 int Bytecode_member_ref::index() const { |
166 int Bytecode_member_ref::index() const { |
163 // Note: Rewriter::rewrite changes the Java_u2 of an invokedynamic to a native_u4, |
167 // Note: Rewriter::rewrite changes the Java_u2 of an invokedynamic to a native_u4, |
164 // at the same time it allocates per-call-site CP cache entries. |
168 // at the same time it allocates per-call-site CP cache entries. |
165 Bytecodes::Code rawc = code(); |
169 Bytecodes::Code rawc = code(); |
168 else |
172 else |
169 return get_index_u2_cpcache(rawc); |
173 return get_index_u2_cpcache(rawc); |
170 } |
174 } |
171 |
175 |
172 int Bytecode_member_ref::pool_index() const { |
176 int Bytecode_member_ref::pool_index() const { |
|
177 return cpcache_entry()->constant_pool_index(); |
|
178 } |
|
179 |
|
180 ConstantPoolCacheEntry* Bytecode_member_ref::cpcache_entry() const { |
173 int index = this->index(); |
181 int index = this->index(); |
174 DEBUG_ONLY({ |
182 DEBUG_ONLY({ |
175 if (!has_index_u4(code())) |
183 if (!has_index_u4(code())) |
176 index -= constantPoolOopDesc::CPCACHE_INDEX_TAG; |
184 index = constantPoolOopDesc::get_cpcache_index(index); |
177 }); |
185 }); |
178 return _method->constants()->cache()->entry_at(index)->constant_pool_index(); |
186 return cpcache()->entry_at(index); |
179 } |
187 } |
180 |
188 |
181 // Implementation of Bytecode_field |
189 // Implementation of Bytecode_field |
182 |
190 |
183 void Bytecode_field::verify() const { |
191 void Bytecode_field::verify() const { |