JDK-8047362 : Add a version of CompiledIC_at that doesn't create a new RelocIterator
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-06-19
  • Updated: 2015-01-21
  • Resolved: 2014-07-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u40Fixed 9 b24Fixed
Creation of RelocIterators show up high in profiles of the remark phase, in the G1 Class Unloading project.

There's a pattern in the nmethod/codecache code to create a RelocIterator and then materialize a CompiledIC:

    RelocIterator iter(this, low_boundary);
    while(iter.next()) {
      if (iter.type() == relocInfo::virtual_call_type) {
        CompiledIC *ic = CompiledIC_at(iter.reloc());

CompiledIC_at is implemented as:
  new CompiledIC(call_site->code(), nativeCall_at(call_site->addr()));

And one of the first thing CompiledIC::CompiledIC(const nmethod* nm, NativeCall* call) does is to create a new RelocIterator:
address ic_call = call->instruction_address();
  RelocIterator iter(nm, ic_call, ic_call+1);
  bool ret = iter.next();
  assert(ret == true, "relocInfo must exist at this address");
  assert(iter.addr() == ic_call, "must find ic_call");

I would like to propose that we pass down the RelocIterator that we already have, instead of creating a new.