RFR (S) 8216302: StackTraceElement::fill_in can use cached Class.name

Aleksey Shipilev shade at redhat.com
Tue Jan 8 16:55:53 UTC 2019


On 1/8/19 5:40 PM, coleen.phillimore at oracle.com wrote:
> http://cr.openjdk.java.net/~shade/8216302/webrev.02/src/hotspot/share/classfile/javaClasses.cpp.udiff.html
> 
> + oop class_oop = holder->java_mirror();
> 
> This is a naked oop.  You should use Handle and HandleMark in this function.

Mmm. But it is the same oop we are already handling in the old code... What's the rule here?

> 1347 oop java_lang_Class::name(oop java_class, TRAPS) {
> 
> So is this.  You should pass a Handle to this.

I don't understand the "should" part. Why should it be handle-ized? javaClasses are expected to work
properly with naked oops, because we are not expected to get to safepoint in the middle of it, no?
And we are storing oops to the heap itself, not in any VM structure.

In the same StackTraceElement::fill_in, we do e.g. this without any handles:

  oop loader = holder->class_loader();
  if (loader != NULL) {
    oop loader_name = java_lang_ClassLoader::name(loader);
    if (loader_name != NULL)
      java_lang_StackTraceElement::set_classLoaderName(element(), loader_name);
  }

-Aleksey



More information about the hotspot-dev mailing list