Skip to content

Commit c7aa454

Browse files
committed
wip
1 parent 2a5c9c0 commit c7aa454

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved.
2+
* Copyright (c) 2018, 2025, Red Hat, Inc. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -60,10 +60,7 @@ void ShenandoahAsserts::print_obj(ShenandoahMessageBuffer& msg, oop obj) {
6060

6161
ResourceMark rm;
6262
stringStream ss;
63-
r->print_on(&ss);
64-
65-
stringStream mw_ss;
66-
obj->mark().print_on(&mw_ss);
63+
StreamIndentor si(&ss);
6764

6865
ShenandoahMarkingContext* const ctx = heap->marking_context();
6966

@@ -77,21 +74,34 @@ void ShenandoahAsserts::print_obj(ShenandoahMessageBuffer& msg, oop obj) {
7774
klass_text = obj_klass->external_name();
7875
}
7976

80-
msg.append(" " PTR_FORMAT " - nk %u klass " PTR_FORMAT " %s\n", p2i(obj), nk, p2i(obj_klass), klass_text);
81-
msg.append(" %3s allocated after mark start\n", ctx->allocated_after_mark_start(obj) ? "" : "not");
82-
msg.append(" %3s after update watermark\n", cast_from_oop<HeapWord*>(obj) >= r->get_update_watermark() ? "" : "not");
83-
msg.append(" %3s marked strong\n", ctx->is_marked_strong(obj) ? "" : "not");
84-
msg.append(" %3s marked weak\n", ctx->is_marked_weak(obj) ? "" : "not");
85-
msg.append(" %3s in collection set\n", heap->in_collection_set(obj) ? "" : "not");
86-
if (heap->mode()->is_generational() && !obj->is_forwarded()) {
87-
msg.append(" age: %d\n", obj->age());
88-
}
89-
msg.append(" mark:%s\n", mw_ss.freeze());
90-
msg.append(" region: %s", ss.freeze());
91-
if (obj_klass == vmClasses::Class_klass()) {
92-
msg.append(" mirrored klass: " PTR_FORMAT "\n", p2i(obj->metadata_field(java_lang_Class::klass_offset())));
93-
msg.append(" mirrored array klass: " PTR_FORMAT "\n", p2i(obj->metadata_field(java_lang_Class::array_klass_offset())));
77+
ss.print_cr(PTR_FORMAT " - nk %u klass " PTR_FORMAT " %s\n", p2i(obj), nk, p2i(obj_klass), klass_text);
78+
{
79+
StreamIndentor si(&ss);
80+
ss.print_cr("%3s allocated after mark start", ctx->allocated_after_mark_start(obj) ? "" : "not");
81+
ss.print_cr("%3s after update watermark", cast_from_oop<HeapWord*>(obj) >= r->get_update_watermark() ? "" : "not");
82+
ss.print_cr("%3s marked strong", ctx->is_marked_strong(obj) ? "" : "not");
83+
ss.print_cr("%3s marked weak", ctx->is_marked_weak(obj) ? "" : "not");
84+
ss.print_cr("%3s in collection set", heap->in_collection_set(obj) ? "" : "not");
85+
if (heap->mode()->is_generational() && !obj->is_forwarded()) {
86+
ss.print_cr("age: %d", obj->age());
87+
}
88+
ss.print_raw("mark: ");
89+
obj->mark().print_on(&ss);
90+
ss.cr();
91+
ss.print_raw("region: ");
92+
r->print_on(&ss);
93+
ss.cr();
94+
if (obj_klass == vmClasses::Class_klass()) {
95+
ss.print_cr("mirrored klass: " PTR_FORMAT, p2i(obj->metadata_field(java_lang_Class::klass_offset())));
96+
ss.print_cr("mirrored array klass: " PTR_FORMAT, p2i(obj->metadata_field(java_lang_Class::array_klass_offset())));
97+
}
9498
}
99+
100+
static constexpr int num_bytes = 64;
101+
const_address loc = cast_from_oop<const_address>(obj);
102+
os::print_hex_dump(&ss, loc, loc + num_bytes, 8, true, 32, loc);
103+
104+
msg.append("%s", ss.base());
95105
}
96106

97107
void ShenandoahAsserts::print_non_obj(ShenandoahMessageBuffer& msg, void* loc) {

src/hotspot/share/gc/shenandoah/shenandoahAsserts.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
2+
* Copyright (c) 2018, 2025, Red Hat, Inc. All rights reserved.
33
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*

src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved.
2+
* Copyright (c) 2017, 2025, Red Hat, Inc. All rights reserved.
33
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
44
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
55
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

src/hotspot/share/utilities/ostream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class StreamIndentor {
182182
NONCOPYABLE(StreamIndentor);
183183

184184
public:
185-
StreamIndentor(outputStream* os, int indentation) :
185+
StreamIndentor(outputStream* os, int indentation = 2) :
186186
_stream(os),
187187
_indentation(indentation),
188188
_old_autoindent(_stream->set_autoindent(true)) {

test/hotspot/gtest/oops/test_compressedKlass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, Red Hat, Inc. All rights reserved.
2+
* Copyright (c) 2024, 2025, Red Hat, Inc. All rights reserved.
33
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*

0 commit comments

Comments
 (0)