void CompiledMethodDesc::update_relative_offsets(int delta) {
  // Create a fake handle (only used during GC).
  // Note that this temporary handle will not be visited by GC.
  CompiledMethodDesc* cm_desc = this;
  CompiledMethod* cm = (CompiledMethod*) &cm_desc;
  // Iterate over all relative offsets to static code in generated code
  for (RelocationReader stream(cm); !stream.at_end(); stream.advance()) {
    if (stream.is_compiler_stub()) {
      // Relocate relative jump/call to static code.
      int* offset = (int*)(cm->entry() + stream.code_offset());
#ifdef AZZERT
      OopDesc* target =
          (OopDesc*)(*offset + (stream.code_offset() + (int)cm->entry()));
      GUARANTEE(!ObjectHeap::contains_moveable(target), "Insanity check");
#endif
      *offset = *offset - delta;
    }
  }
}