27 |
27 |
28 #include "oops/oop.hpp" |
28 #include "oops/oop.hpp" |
29 #include "utilities/macros.hpp" |
29 #include "utilities/macros.hpp" |
30 |
30 |
31 // A CompiledICHolder* is a helper object for the inline cache implementation. |
31 // A CompiledICHolder* is a helper object for the inline cache implementation. |
32 // It holds an intermediate value (method+klass pair) used when converting from |
32 // It holds: |
33 // compiled to an interpreted call. |
33 // (1) (method+klass pair) when converting from compiled to an interpreted call |
|
34 // (2) (klass+klass pair) when calling itable stub from megamorphic compiled call |
34 // |
35 // |
35 // These are always allocated in the C heap and are freed during a |
36 // These are always allocated in the C heap and are freed during a |
36 // safepoint by the ICBuffer logic. It's unsafe to free them earlier |
37 // safepoint by the ICBuffer logic. It's unsafe to free them earlier |
37 // since they might be in use. |
38 // since they might be in use. |
38 // |
39 // |
43 private: |
44 private: |
44 static volatile int _live_count; // allocated |
45 static volatile int _live_count; // allocated |
45 static volatile int _live_not_claimed_count; // allocated but not yet in use so not |
46 static volatile int _live_not_claimed_count; // allocated but not yet in use so not |
46 // reachable by iterating over nmethods |
47 // reachable by iterating over nmethods |
47 |
48 |
48 Method* _holder_method; |
49 Metadata* _holder_metadata; |
49 Klass* _holder_klass; // to avoid name conflict with oopDesc::_klass |
50 Klass* _holder_klass; // to avoid name conflict with oopDesc::_klass |
50 CompiledICHolder* _next; |
51 CompiledICHolder* _next; |
51 |
52 |
52 public: |
53 public: |
53 // Constructor |
54 // Constructor |
54 CompiledICHolder(Method* method, Klass* klass); |
55 CompiledICHolder(Metadata* metadata, Klass* klass); |
55 ~CompiledICHolder() NOT_DEBUG_RETURN; |
56 ~CompiledICHolder() NOT_DEBUG_RETURN; |
56 |
57 |
57 static int live_count() { return _live_count; } |
58 static int live_count() { return _live_count; } |
58 static int live_not_claimed_count() { return _live_not_claimed_count; } |
59 static int live_not_claimed_count() { return _live_not_claimed_count; } |
59 |
60 |
60 // accessors |
61 // accessors |
61 Method* holder_method() const { return _holder_method; } |
|
62 Klass* holder_klass() const { return _holder_klass; } |
62 Klass* holder_klass() const { return _holder_klass; } |
|
63 Metadata* holder_metadata() const { return _holder_metadata; } |
63 |
64 |
64 void set_holder_method(Method* m) { _holder_method = m; } |
65 void set_holder_metadata(Metadata* m) { _holder_metadata = m; } |
65 void set_holder_klass(Klass* k) { _holder_klass = k; } |
66 void set_holder_klass(Klass* k) { _holder_klass = k; } |
66 |
67 |
67 // interpreter support (offsets in bytes) |
68 static int holder_metadata_offset() { return offset_of(CompiledICHolder, _holder_metadata); } |
68 static int holder_method_offset() { return offset_of(CompiledICHolder, _holder_method); } |
|
69 static int holder_klass_offset() { return offset_of(CompiledICHolder, _holder_klass); } |
69 static int holder_klass_offset() { return offset_of(CompiledICHolder, _holder_klass); } |
70 |
70 |
71 CompiledICHolder* next() { return _next; } |
71 CompiledICHolder* next() { return _next; } |
72 void set_next(CompiledICHolder* n) { _next = n; } |
72 void set_next(CompiledICHolder* n) { _next = n; } |
|
73 |
|
74 bool is_loader_alive(BoolObjectClosure* is_alive); |
73 |
75 |
74 // Verify |
76 // Verify |
75 void verify_on(outputStream* st); |
77 void verify_on(outputStream* st); |
76 |
78 |
77 // Printing |
79 // Printing |