Mercurial > hg > truffle
comparison src/share/vm/prims/methodComparator.cpp @ 1602:136b78722a08
6939203: JSR 292 needs method handle constants
Summary: Add new CP types CONSTANT_MethodHandle, CONSTANT_MethodType; extend 'ldc' bytecode.
Reviewed-by: twisti, never
author | jrose |
---|---|
date | Wed, 09 Jun 2010 18:50:45 -0700 |
parents | e9ff18c4ace7 |
children | 3b2dea75431e |
comparison
equal
deleted
inserted
replaced
1585:49fac4acd688 | 1602:136b78722a08 |
---|---|
161 break; | 161 break; |
162 } | 162 } |
163 | 163 |
164 case Bytecodes::_ldc : // fall through | 164 case Bytecodes::_ldc : // fall through |
165 case Bytecodes::_ldc_w : { | 165 case Bytecodes::_ldc_w : { |
166 Bytecode_loadconstant* ldc_old = Bytecode_loadconstant_at(_s_old->method()(), _s_old->bcp()); | 166 Bytecode_loadconstant* ldc_old = Bytecode_loadconstant_at(_s_old->method(), _s_old->bci()); |
167 Bytecode_loadconstant* ldc_new = Bytecode_loadconstant_at(_s_new->method()(), _s_new->bcp()); | 167 Bytecode_loadconstant* ldc_new = Bytecode_loadconstant_at(_s_new->method(), _s_new->bci()); |
168 int cpi_old = ldc_old->index(); | 168 int cpi_old = ldc_old->pool_index(); |
169 int cpi_new = ldc_new->index(); | 169 int cpi_new = ldc_new->pool_index(); |
170 constantTag tag_old = _old_cp->tag_at(cpi_old); | 170 constantTag tag_old = _old_cp->tag_at(cpi_old); |
171 constantTag tag_new = _new_cp->tag_at(cpi_new); | 171 constantTag tag_new = _new_cp->tag_at(cpi_new); |
172 if (tag_old.is_int() || tag_old.is_float()) { | 172 if (tag_old.is_int() || tag_old.is_float()) { |
173 if (tag_old.value() != tag_new.value()) | 173 if (tag_old.value() != tag_new.value()) |
174 return false; | 174 return false; |
185 if (! (tag_new.is_unresolved_string() || tag_new.is_string())) | 185 if (! (tag_new.is_unresolved_string() || tag_new.is_string())) |
186 return false; | 186 return false; |
187 if (strcmp(_old_cp->string_at_noresolve(cpi_old), | 187 if (strcmp(_old_cp->string_at_noresolve(cpi_old), |
188 _new_cp->string_at_noresolve(cpi_new)) != 0) | 188 _new_cp->string_at_noresolve(cpi_new)) != 0) |
189 return false; | 189 return false; |
190 } else { // tag_old should be klass - 4881222 | 190 } else if (tag_old.is_klass() || tag_old.is_unresolved_klass()) { |
191 // tag_old should be klass - 4881222 | |
191 if (! (tag_new.is_unresolved_klass() || tag_new.is_klass())) | 192 if (! (tag_new.is_unresolved_klass() || tag_new.is_klass())) |
192 return false; | 193 return false; |
193 if (_old_cp->klass_at_noresolve(cpi_old) != | 194 if (_old_cp->klass_at_noresolve(cpi_old) != |
194 _new_cp->klass_at_noresolve(cpi_new)) | 195 _new_cp->klass_at_noresolve(cpi_new)) |
195 return false; | 196 return false; |
197 } else if (tag_old.is_method_type() && tag_new.is_method_type()) { | |
198 int mti_old = _old_cp->method_type_index_at(cpi_old); | |
199 int mti_new = _new_cp->method_type_index_at(cpi_new); | |
200 if ((_old_cp->symbol_at(mti_old) != _new_cp->symbol_at(mti_new))) | |
201 return false; | |
202 } else if (tag_old.is_method_handle() && tag_new.is_method_handle()) { | |
203 if (_old_cp->method_handle_ref_kind_at(cpi_old) != | |
204 _new_cp->method_handle_ref_kind_at(cpi_new)) | |
205 return false; | |
206 int mhi_old = _old_cp->method_handle_index_at(cpi_old); | |
207 int mhi_new = _new_cp->method_handle_index_at(cpi_new); | |
208 if ((_old_cp->uncached_klass_ref_at_noresolve(mhi_old) != _new_cp->uncached_klass_ref_at_noresolve(mhi_new)) || | |
209 (_old_cp->uncached_name_ref_at(mhi_old) != _new_cp->uncached_name_ref_at(mhi_new)) || | |
210 (_old_cp->uncached_signature_ref_at(mhi_old) != _new_cp->uncached_signature_ref_at(mhi_new))) | |
211 return false; | |
212 } else { | |
213 return false; // unknown tag | |
196 } | 214 } |
197 break; | 215 break; |
198 } | 216 } |
199 | 217 |
200 case Bytecodes::_ldc2_w : { | 218 case Bytecodes::_ldc2_w : { |