Mercurial > hg > graal-compiler
diff src/share/vm/ci/ciObjectFactory.cpp @ 4001:5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
Reviewed-by: jrose, never
author | twisti |
---|---|
date | Wed, 12 Oct 2011 21:00:13 -0700 |
parents | c7f3d0b4570f |
children | 04b9a2566eec d2a62e0f25eb |
line wrap: on
line diff
--- a/src/share/vm/ci/ciObjectFactory.cpp Tue Oct 11 02:19:37 2011 -0700 +++ b/src/share/vm/ci/ciObjectFactory.cpp Wed Oct 12 21:00:13 2011 -0700 @@ -374,20 +374,32 @@ // unloaded method. This may need to change. ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder, ciSymbol* name, - ciSymbol* signature) { - for (int i=0; i<_unloaded_methods->length(); i++) { + ciSymbol* signature, + ciInstanceKlass* accessor) { + ciSignature* that = NULL; + for (int i = 0; i < _unloaded_methods->length(); i++) { ciMethod* entry = _unloaded_methods->at(i); if (entry->holder()->equals(holder) && entry->name()->equals(name) && entry->signature()->as_symbol()->equals(signature)) { - // We've found a match. - return entry; + // Short-circuit slow resolve. + if (entry->signature()->accessing_klass() == accessor) { + // We've found a match. + return entry; + } else { + // Lazily create ciSignature + if (that == NULL) that = new (arena()) ciSignature(accessor, constantPoolHandle(), signature); + if (entry->signature()->equals(that)) { + // We've found a match. + return entry; + } + } } } // This is a new unloaded method. Create it and stick it in // the cache. - ciMethod* new_method = new (arena()) ciMethod(holder, name, signature); + ciMethod* new_method = new (arena()) ciMethod(holder, name, signature, accessor); init_ident_of(new_method); _unloaded_methods->append(new_method);