RFR: 8266746: C1: Replace UnsafeGetRaw with UnsafeGetObject when setting up OSR entry block [v4]

Yi Yang yyang at openjdk.java.net
Wed Jun 30 06:42:06 UTC 2021


On Tue, 29 Jun 2021 14:03:32 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

> Thanks for taking care of PPC64. I haven't seen errors with this version. But I have some remarks:
> 
> * I think the name UnsafeGetObject is confusing, now. It's no longer used for objects only.
> * The "unaligned" parameter is unused on all platforms, now. Note that PPC64 and s390 support unaligned accesses, too. I believe it was used by SPARC which has been removed.

1. Yes, I agree, how about changing Unsafe{Get,Put}Object to Unsafe{Get,Put}: 


void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_return) {
  vmIntrinsics::ID id = callee->intrinsic_id();
  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");

  // Some intrinsics need special IR nodes.
  switch(id) {
  case vmIntrinsics::_getReference       : append_unsafe_get_obj(callee, T_OBJECT,  false); return;
  case vmIntrinsics::_getBoolean         : append_unsafe_get_obj(callee, T_BOOLEAN, false); return;
  case vmIntrinsics::_getByte            : append_unsafe_get_obj(callee, T_BYTE,    false); return;
  case vmIntrinsics::_getShort           : append_unsafe_get_obj(callee, T_SHORT,   false); return;
  case vmIntrinsics::_getChar            : append_unsafe_get_obj(callee, T_CHAR,    false); return;
  case vmIntrinsics::_getInt             : append_unsafe_get_obj(callee, T_INT,     false); return;
  case vmIntrinsics::_getLong            : append_unsafe_get_obj(callee, T_LONG,    false); return;
  case vmIntrinsics::_getFloat           : append_unsafe_get_obj(callee, T_FLOAT,   false); return;
  
  ...
}


void GraphBuilder::append_unsafe_get_obj(ciMethod* callee, BasicType t, bool is_volatile) {
  Values* args = state()->pop_arguments(callee->arg_size());
  null_check(args->at(0));
  Instruction* offset = args->at(2);
#ifndef _LP64
  offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
#endif
  Instruction* op = append(new UnsafeGetObject(t, args->at(1), offset, is_volatile));
  push(op->type(), op);
  compilation()->set_has_unsafe_access(true);
}

I don't see any reason that we need the "Object" suffix.

2. Maybe we can file a follow-up issue to investigate if it's indeed unnecessary now.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3917



More information about the hotspot-gc-dev mailing list