27
28 #include "utilities/exceptions.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/ostream.hpp"
31
32 // This is the base class for an internal Class related metadata
33 class Metadata : public MetaspaceObj {
34 // Debugging hook to check that the metadata has not been deleted.
35 NOT_PRODUCT(int _valid;)
36 public:
37 NOT_PRODUCT(Metadata() : _valid(0) {})
38 NOT_PRODUCT(bool is_valid() const { return _valid == 0; })
39
40 int identity_hash() { return (int)(uintptr_t)this; }
41
42 virtual bool is_metadata() const { return true; }
43 virtual bool is_klass() const { return false; }
44 virtual bool is_method() const { return false; }
45 virtual bool is_methodData() const { return false; }
46 virtual bool is_constantPool() const { return false; }
47 virtual int size() const = 0;
48 virtual MetaspaceObj::Type type() const = 0;
49 virtual const char* internal_name() const = 0;
50 virtual void metaspace_pointers_do(MetaspaceClosure* iter) = 0;
51
52 void print() const;
53 void print_value() const;
54
55 static void print_value_on_maybe_null(outputStream* st, const Metadata* m) {
56 if (nullptr == m)
57 st->print("null");
58 else
59 m->print_value_on(st);
60 }
61
62 virtual void print_on(outputStream* st) const; // First level print
63 virtual void print_value_on(outputStream* st) const = 0; // Second level print
64
65 char* print_value_string() const;
66
|
27
28 #include "utilities/exceptions.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/ostream.hpp"
31
32 // This is the base class for an internal Class related metadata
33 class Metadata : public MetaspaceObj {
34 // Debugging hook to check that the metadata has not been deleted.
35 NOT_PRODUCT(int _valid;)
36 public:
37 NOT_PRODUCT(Metadata() : _valid(0) {})
38 NOT_PRODUCT(bool is_valid() const { return _valid == 0; })
39
40 int identity_hash() { return (int)(uintptr_t)this; }
41
42 virtual bool is_metadata() const { return true; }
43 virtual bool is_klass() const { return false; }
44 virtual bool is_method() const { return false; }
45 virtual bool is_methodData() const { return false; }
46 virtual bool is_constantPool() const { return false; }
47 virtual bool is_methodCounters() const { return false; }
48 virtual int size() const = 0;
49 virtual MetaspaceObj::Type type() const = 0;
50 virtual const char* internal_name() const = 0;
51 virtual void metaspace_pointers_do(MetaspaceClosure* iter) = 0;
52
53 void print() const;
54 void print_value() const;
55
56 static void print_value_on_maybe_null(outputStream* st, const Metadata* m) {
57 if (nullptr == m)
58 st->print("null");
59 else
60 m->print_value_on(st);
61 }
62
63 virtual void print_on(outputStream* st) const; // First level print
64 virtual void print_value_on(outputStream* st) const = 0; // Second level print
65
66 char* print_value_string() const;
67
|