[aarch64-port-dev ] RFR(s): 8171449" [aarch64] store_klass needs to use store release

Andrew Haley aph at redhat.com
Tue Dec 20 08:43:05 UTC 2016


On 19/12/16 21:22, White, Derek wrote:
> As the "FIXME" noted, aarch64 really does need to use a store release in the "store_klass" macro, at least when a concurrent GC is in effect.
> 
> BUG: https://bugs.openjdk.java.net/browse/JDK-8171449
> 
> Webrev: http://cr.openjdk.java.net/~drwhite/8171449/webrev.01/index.html
> 
> BTW, PPC is likely to need a similar fix...
> 
> Thanks,
> 
> 
> -        Derek
> 

I'm a bit baffled by the reasoning behind all of this.  If a Java
thread isn't finished initializing an array then it's not reachable
from another thread.  At least, I don't think it is.  Maybe I should
turn that into a question: how is this newly-allocated array reachable
from another thread before that array has been initialized?

The patch is OK.  It could be simpler, though:

void MacroAssembler::store_klass(Register dst, Register src, Register tmp) {
  // concurrent gcs assume klass length is valid if klass field is not null.
  bool is_concurrentGC = UseG1GC || UseConcMarkSweepGC;

  Address klass_field = Address(dst, oopDesc::klass_offset_in_bytes();
  if (is_concurrentGC) {
    lea(tmp, klass_field);
    if (UseCompressedClassPointers) {
      encode_klass_not_null(src);
      stlrw(src, tmp);
    } else {
      stlr(src, tmp);
    }
  } else {
    if (UseCompressedClassPointers) {
      encode_klass_not_null(src);
      strw(src, klass_field));
    } else {
      str(src, klass_field));
    }
  }
}

Andrew.


More information about the aarch64-port-dev mailing list