Duplicated lines in src/share/vm/interpreter/linkResolver.cpp

Peter B. Kessler Peter.B.Kessler at Oracle.COM
Mon Dec 19 14:58:47 PST 2011


I was reading src/share/vm/interpreter/linkResolver.cpp, and noticed

       789 void LinkResolver::runtime_resolve_virtual_method(CallInfo& result,
       790                                                   methodHandle resolved_method,
       791                                                   KlassHandle resolved_klass,
       792                                                   Handle recv,
       793                                                   KlassHandle recv_klass,
       794                                                   bool check_null_and_abstract,
       795                                                   TRAPS) {
       ....
       808   // Virtual methods cannot be resolved before its klass has been linked, for otherwise the methodOop's
       809   // has not been rewritten, and the vtable initialized.
       810   assert(instanceKlass::cast(resolved_method->method_holder())->is_linked(), "must be linked");
       811
       812   // Virtual methods cannot be resolved before its klass has been linked, for otherwise the methodOop's
       813   // has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since
       814   // a missing receiver might result in a bogus lookup.
       815   assert(instanceKlass::cast(resolved_method->method_holder())->is_linked(), "must be linked");

The comments are different, but the asserts are the same.  Nothing happens between them that could change the value of the predicate, so one assert is enough.  (I don't actually see the nullcheck that the second comment refers to, but maybe I just missed it.)

Fixing this is really low priority, but if someone found themselves in this code they could clean it up.

			... peter


More information about the hotspot-runtime-dev mailing list