25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "oops/compiledICHolder.hpp" |
26 #include "oops/compiledICHolder.hpp" |
27 #include "oops/klass.hpp" |
27 #include "oops/klass.hpp" |
28 #include "oops/method.hpp" |
28 #include "oops/method.hpp" |
29 #include "oops/oop.inline2.hpp" |
29 #include "oops/oop.inline2.hpp" |
|
30 #include "runtime/atomic.inline.hpp" |
30 |
31 |
31 volatile int CompiledICHolder::_live_count; |
32 volatile int CompiledICHolder::_live_count; |
32 volatile int CompiledICHolder::_live_not_claimed_count; |
33 volatile int CompiledICHolder::_live_not_claimed_count; |
33 |
34 |
|
35 |
|
36 CompiledICHolder::CompiledICHolder(Method* method, Klass* klass) |
|
37 : _holder_method(method), _holder_klass(klass) { |
|
38 #ifdef ASSERT |
|
39 Atomic::inc(&_live_count); |
|
40 Atomic::inc(&_live_not_claimed_count); |
|
41 #endif // ASSERT |
|
42 } |
|
43 |
|
44 #ifdef ASSERT |
|
45 CompiledICHolder::~CompiledICHolder() { |
|
46 assert(_live_count > 0, "underflow"); |
|
47 Atomic::dec(&_live_count); |
|
48 } |
|
49 #endif // ASSERT |
34 |
50 |
35 // Printing |
51 // Printing |
36 |
52 |
37 void CompiledICHolder::print_on(outputStream* st) const { |
53 void CompiledICHolder::print_on(outputStream* st) const { |
38 st->print("%s", internal_name()); |
54 st->print("%s", internal_name()); |
49 |
65 |
50 void CompiledICHolder::verify_on(outputStream* st) { |
66 void CompiledICHolder::verify_on(outputStream* st) { |
51 guarantee(holder_method()->is_method(), "should be method"); |
67 guarantee(holder_method()->is_method(), "should be method"); |
52 guarantee(holder_klass()->is_klass(), "should be klass"); |
68 guarantee(holder_klass()->is_klass(), "should be klass"); |
53 } |
69 } |
|
70 |
|
71 #ifdef ASSERT |
|
72 |
|
73 void CompiledICHolder::claim() { |
|
74 Atomic::dec(&_live_not_claimed_count); |
|
75 } |
|
76 |
|
77 #endif // ASSERT |