Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8266967: debug.cpp utility find() should print Java Object fields.
Reviewed-by: mdoerr
Backport-of: 5e557d8
  • Loading branch information
GoeLin committed Oct 18, 2022
1 parent b092d77 commit b919240
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
8 changes: 0 additions & 8 deletions src/hotspot/share/oops/instanceKlass.cpp
Expand Up @@ -3120,8 +3120,6 @@ nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_le
// -----------------------------------------------------------------------------------------------------
// Printing

#ifndef PRODUCT

#define BULLET " - "

static const char* state_names[] = {
Expand Down Expand Up @@ -3263,16 +3261,12 @@ void InstanceKlass::print_on(outputStream* st) const {
st->cr();
}

#endif //PRODUCT

void InstanceKlass::print_value_on(outputStream* st) const {
assert(is_klass(), "must be klass");
if (Verbose || WizardMode) access_flags().print_on(st);
name()->print_value_on(st);
}

#ifndef PRODUCT

void FieldPrinter::do_field(fieldDescriptor* fd) {
_st->print(BULLET);
if (_obj == NULL) {
Expand Down Expand Up @@ -3330,8 +3324,6 @@ void InstanceKlass::oop_print_on(oop obj, outputStream* st) {
}
}

#endif //PRODUCT

void InstanceKlass::oop_print_value_on(oop obj, outputStream* st) {
st->print("a ");
name()->print_value_on(st);
Expand Down
6 changes: 1 addition & 5 deletions src/hotspot/share/oops/instanceKlass.hpp
Expand Up @@ -77,7 +77,6 @@ class FieldClosure: public StackObj {
virtual void do_field(fieldDescriptor* fd) = 0;
};

#ifndef PRODUCT
// Print fields.
// If "obj" argument to constructor is NULL, prints static fields, otherwise prints non-static fields.
class FieldPrinter: public FieldClosure {
Expand All @@ -87,7 +86,6 @@ class FieldPrinter: public FieldClosure {
FieldPrinter(outputStream* st, oop obj = NULL) : _obj(obj), _st(st) {}
void do_field(fieldDescriptor* fd);
};
#endif // !PRODUCT

// Describes where oops are located in instances of this klass.
class OopMapBlock {
Expand Down Expand Up @@ -1338,16 +1336,14 @@ class InstanceKlass: public Klass {

public:
// Printing
#ifndef PRODUCT
void print_on(outputStream* st) const;
#endif
void print_value_on(outputStream* st) const;

void oop_print_value_on(oop obj, outputStream* st);

#ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);

#ifndef PRODUCT
void print_dependent_nmethods(bool verbose = false);
bool is_dependent_nmethod(nmethod* nm);
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/runtime/fieldDescriptor.cpp
Expand Up @@ -124,6 +124,8 @@ void fieldDescriptor::verify() const {
}
}

#endif /* PRODUCT */

void fieldDescriptor::print_on(outputStream* st) const {
access_flags().print_on(st);
name()->print_value_on(st);
Expand Down Expand Up @@ -214,4 +216,3 @@ void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
}
}

#endif /* PRODUCT */
6 changes: 3 additions & 3 deletions src/hotspot/share/runtime/fieldDescriptor.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -111,8 +111,8 @@ class fieldDescriptor {

// Print
void print() { print_on(tty); }
void print_on(outputStream* st) const PRODUCT_RETURN;
void print_on_for(outputStream* st, oop obj) PRODUCT_RETURN;
void print_on(outputStream* st) const;
void print_on_for(outputStream* st, oop obj);
void verify() const PRODUCT_RETURN;
};

Expand Down

1 comment on commit b919240

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.