30 |
30 |
31 volatile int CompiledICHolder::_live_count; |
31 volatile int CompiledICHolder::_live_count; |
32 volatile int CompiledICHolder::_live_not_claimed_count; |
32 volatile int CompiledICHolder::_live_not_claimed_count; |
33 |
33 |
34 |
34 |
35 CompiledICHolder::CompiledICHolder(Method* method, Klass* klass) |
35 CompiledICHolder::CompiledICHolder(Metadata* metadata, Klass* klass) |
36 : _holder_method(method), _holder_klass(klass) { |
36 : _holder_metadata(metadata), _holder_klass(klass) { |
37 #ifdef ASSERT |
37 #ifdef ASSERT |
38 Atomic::inc(&_live_count); |
38 Atomic::inc(&_live_count); |
39 Atomic::inc(&_live_not_claimed_count); |
39 Atomic::inc(&_live_not_claimed_count); |
40 #endif // ASSERT |
40 #endif // ASSERT |
41 } |
41 } |
45 assert(_live_count > 0, "underflow"); |
45 assert(_live_count > 0, "underflow"); |
46 Atomic::dec(&_live_count); |
46 Atomic::dec(&_live_count); |
47 } |
47 } |
48 #endif // ASSERT |
48 #endif // ASSERT |
49 |
49 |
|
50 bool CompiledICHolder::is_loader_alive(BoolObjectClosure* is_alive) { |
|
51 if (_holder_metadata->is_method()) { |
|
52 if (!((Method*)_holder_metadata)->method_holder()->is_loader_alive(is_alive)) { |
|
53 return false; |
|
54 } |
|
55 } else if (_holder_metadata->is_klass()) { |
|
56 if (!((Klass*)_holder_metadata)->is_loader_alive(is_alive)) { |
|
57 return false; |
|
58 } |
|
59 } |
|
60 if (!_holder_klass->is_loader_alive(is_alive)) { |
|
61 return false; |
|
62 } |
|
63 return true; |
|
64 } |
|
65 |
50 // Printing |
66 // Printing |
51 |
67 |
52 void CompiledICHolder::print_on(outputStream* st) const { |
68 void CompiledICHolder::print_on(outputStream* st) const { |
53 st->print("%s", internal_name()); |
69 st->print("%s", internal_name()); |
54 st->print(" - method: "); holder_method()->print_value_on(st); st->cr(); |
70 st->print(" - metadata: "); holder_metadata()->print_value_on(st); st->cr(); |
55 st->print(" - klass: "); holder_klass()->print_value_on(st); st->cr(); |
71 st->print(" - klass: "); holder_klass()->print_value_on(st); st->cr(); |
56 } |
72 } |
57 |
73 |
58 void CompiledICHolder::print_value_on(outputStream* st) const { |
74 void CompiledICHolder::print_value_on(outputStream* st) const { |
59 st->print("%s", internal_name()); |
75 st->print("%s", internal_name()); |
60 } |
76 } |
61 |
77 |
62 |
78 |
63 // Verification |
79 // Verification |
64 |
80 |
65 void CompiledICHolder::verify_on(outputStream* st) { |
81 void CompiledICHolder::verify_on(outputStream* st) { |
66 guarantee(holder_method()->is_method(), "should be method"); |
82 guarantee(holder_metadata()->is_method() || holder_metadata()->is_klass(), "should be method or klass"); |
67 guarantee(holder_klass()->is_klass(), "should be klass"); |
83 guarantee(holder_klass()->is_klass(), "should be klass"); |
68 } |
84 } |
69 |
85 |
70 #ifdef ASSERT |
86 #ifdef ASSERT |
71 |
87 |