Skip to content

Commit

Permalink
8266967: debug.cpp utility find() should print Java Object fields.
Browse files Browse the repository at this point in the history
Reviewed-by: sspitsyn, coleenp
  • Loading branch information
kevinjwalls committed Jun 7, 2021
1 parent c7c77fd commit 5e557d8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
8 changes: 2 additions & 6 deletions src/hotspot/share/oops/instanceKlass.cpp
Expand Up @@ -3306,8 +3306,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 @@ -3457,16 +3455,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 @@ -3524,6 +3518,8 @@ void InstanceKlass::oop_print_on(oop obj, outputStream* st) {
}
}

#ifndef PRODUCT

bool InstanceKlass::verify_itable_index(int i) {
int method_count = klassItable::method_count_for_interface(this);
assert(i >= 0 && i < method_count, "index out of bounds");
Expand Down
6 changes: 1 addition & 5 deletions src/hotspot/share/oops/instanceKlass.hpp
Expand Up @@ -76,7 +76,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 @@ -86,7 +85,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 @@ -1240,16 +1238,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);
bool verify_itable_index(int index);
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/runtime/fieldDescriptor.cpp
Expand Up @@ -129,6 +129,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 @@ -229,4 +231,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, 2020, 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 @@ -113,8 +113,8 @@ class fieldDescriptor {

// Print
void print() const;
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

0 comments on commit 5e557d8

Please sign in to comment.