RFR 8062116: JVMTI GetClassMethods is Slow

Jeremy Manson jeremymanson at google.com
Wed Nov 5 23:13:45 UTC 2014


On Tue, Nov 4, 2014 at 8:56 PM, serguei.spitsyn at oracle.com <
serguei.spitsyn at oracle.com> wrote:

>  The fix looks good in general.
>
> src/share/vm/oops/method.cpp
>
> 1785   bool contains(Method** m) {1786     if (m == NULL) return false;1787     for (JNIMethodBlockNode* b = &_head; b != NULL; b = b->_next) {1788       if (b->_methods <= m && m < b->_methods + b->_number_of_methods) {*1789         ptrdiff_t idx = m - b->_methods;**1790         if (b->_methods + idx == m) {**
> 1791           return true;
> 1792         }*
> 1793       }
> 1794     }
> 1795     return false;  // not found
> 1796   }
>
>
> Just noticed that the lines 1789-1792 can be replaced with one liner:
>  *         return true;*
>

Ah, you have found our crappy workaround for wild pointers to non-aligned
places in the middle of _methods.



> It is because the condition * (b->_methods + idx == m)* is always true.
>   :)
>
> Also, should we check the condition:  **m != _free_method* ?
> What about the following ?:
>  *         return (***m != _free_method);*
>

I don't mind adding this, if Coleen thinks those are the semantics this
needs.  It wasn't there before, of course.

Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20141105/eed50d95/attachment-0001.html>


More information about the serviceability-dev mailing list