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 volatile { return _valid == 0; })
39
40 int identity_hash() { return (int)(uintptr_t)this; }
41
42 // Rehashing support for tables containing pointers to this
43 unsigned int new_hash(juint seed) { ShouldNotReachHere(); return 0; }
44
45 virtual bool is_metadata() const volatile { return true; }
46 virtual bool is_klass() const volatile { return false; }
47 virtual bool is_method() const volatile { return false; }
48 virtual bool is_methodData() const volatile { return false; }
49 virtual bool is_constantPool() const volatile { return false; }
50 virtual bool is_methodCounters() const volatile { return false; }
51
52 virtual const char* internal_name() const = 0;
53
54 void print() const { print_on(tty); }
55 void print_value() const { print_value_on(tty); }
56
57 void print_maybe_null() const { print_on_maybe_null(tty); }
58 void print_on_maybe_null(outputStream* st) const {
59 if (this == NULL)
60 st->print("NULL");
61 else
62 print_on(st);
63 }
64 void print_value_on_maybe_null(outputStream* st) const {
65 if (this == NULL)
66 st->print("NULL");
67 else
68 print_value_on(st);
69 }
70
71 virtual void print_on(outputStream* st) const; // First level print
72 virtual void print_value_on(outputStream* st) const = 0; // Second level print
|
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 volatile { return _valid == 0; })
39
40 int identity_hash() { return (int)(uintptr_t)this; }
41
42 // Rehashing support for tables containing pointers to this
43 unsigned int new_hash(juint seed) { ShouldNotReachHere(); return 0; }
44
45 virtual bool is_metadata() const volatile { return true; }
46 virtual bool is_klass() const volatile { return false; }
47 virtual bool is_method() const volatile { return false; }
48 virtual bool is_methodData() const volatile { return false; }
49 virtual bool is_constantPool() const volatile { return false; }
50 virtual bool is_methodCounters() const volatile { return false; }
51 virtual int size() const = 0;
52 virtual MetaspaceObj::Type type() const = 0;
53 virtual const char* internal_name() const = 0;
54 virtual void metaspace_pointers_do(MetaspaceClosure* iter) {}
55
56 void print() const { print_on(tty); }
57 void print_value() const { print_value_on(tty); }
58
59 void print_maybe_null() const { print_on_maybe_null(tty); }
60 void print_on_maybe_null(outputStream* st) const {
61 if (this == NULL)
62 st->print("NULL");
63 else
64 print_on(st);
65 }
66 void print_value_on_maybe_null(outputStream* st) const {
67 if (this == NULL)
68 st->print("NULL");
69 else
70 print_value_on(st);
71 }
72
73 virtual void print_on(outputStream* st) const; // First level print
74 virtual void print_value_on(outputStream* st) const = 0; // Second level print
|