Skip to content

Commit 7b51a2b

Browse files
stefankpron
authored andcommittedMar 25, 2022
Deduplicate relativize_frame
1 parent e8598bb commit 7b51a2b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed
 

‎src/hotspot/share/oops/instanceStackChunkKlass.cpp

+12-8
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,15 @@ void InstanceStackChunkKlass::do_barriers(stackChunkOop chunk) {
351351
iterate_stack(chunk, &closure);
352352
}
353353

354+
template <chunk_frames frame_kind, typename RegisterMapT>
355+
static void relativize_frame(const StackChunkFrameStream<frame_kind>& f, const RegisterMapT* map) {
356+
bool has_derived = f.is_compiled() && f.oopmap()->has_derived_oops();
357+
if (has_derived) {
358+
RelativizeDerivedPointers derived_closure;
359+
f.iterate_derived_pointers(&derived_closure, map);
360+
}
361+
}
362+
354363
class RelativizeStackClosure {
355364
const stackChunkOop _chunk;
356365

@@ -359,11 +368,7 @@ class RelativizeStackClosure {
359368

360369
template <chunk_frames frame_kind, typename RegisterMapT>
361370
bool do_frame(const StackChunkFrameStream<frame_kind>& f, const RegisterMapT* map) {
362-
bool has_derived = f.is_compiled() && f.oopmap()->has_derived_oops();
363-
if (has_derived) {
364-
RelativizeDerivedPointers derived_closure;
365-
f.iterate_derived_pointers(&derived_closure, map);
366-
}
371+
relativize_frame(f, map);
367372
return true;
368373
}
369374
};
@@ -451,9 +456,8 @@ class BuildBitmapStackClosure {
451456

452457
template <chunk_frames frame_kind, typename RegisterMapT>
453458
bool do_frame(const StackChunkFrameStream<frame_kind>& f, const RegisterMapT* map) {
454-
if (!_chunk->is_gc_mode() && f.is_compiled() && f.oopmap()->has_derived_oops()) {
455-
RelativizeDerivedPointers derived_oops_closure;
456-
f.iterate_derived_pointers(&derived_oops_closure, map);
459+
if (!_chunk->is_gc_mode()) {
460+
relativize_frame(f, map);
457461
}
458462

459463
if (UseChunkBitmaps) {

0 commit comments

Comments
 (0)
Please sign in to comment.