24 |
24 |
25 #ifndef SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP |
25 #ifndef SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP |
26 #define SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP |
26 #define SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP |
27 |
27 |
28 #include "memory/allocation.hpp" |
28 #include "memory/allocation.hpp" |
|
29 #include "utilities/chunkedList.hpp" |
29 |
30 |
30 class Metadata; |
31 class Metadata; |
|
32 |
|
33 typedef ChunkedList<Metadata*, mtInternal> MetadataOnStackBuffer; |
31 |
34 |
32 // Helper class to mark and unmark metadata used on the stack as either handles |
35 // Helper class to mark and unmark metadata used on the stack as either handles |
33 // or executing methods, so that it can't be deleted during class redefinition |
36 // or executing methods, so that it can't be deleted during class redefinition |
34 // and class unloading. |
37 // and class unloading. |
35 // This is also used for other things that can be deallocated, like class |
38 // This is also used for other things that can be deallocated, like class |
36 // metadata during parsing, relocated methods, and methods in backtraces. |
39 // metadata during parsing, relocated methods, and methods in backtraces. |
37 class MetadataOnStackMark : public StackObj { |
40 class MetadataOnStackMark : public StackObj { |
38 NOT_PRODUCT(static bool _is_active;) |
41 NOT_PRODUCT(static bool _is_active;) |
|
42 |
|
43 static volatile MetadataOnStackBuffer* _used_buffers; |
|
44 static volatile MetadataOnStackBuffer* _free_buffers; |
|
45 |
|
46 static MetadataOnStackBuffer* allocate_buffer(); |
|
47 static void retire_buffer(MetadataOnStackBuffer* buffer); |
|
48 |
39 public: |
49 public: |
40 MetadataOnStackMark(); |
50 MetadataOnStackMark(bool visit_code_cache); |
41 ~MetadataOnStackMark(); |
51 ~MetadataOnStackMark(); |
42 static void record(Metadata* m); |
52 |
|
53 static void record(Metadata* m, Thread* thread); |
|
54 static void retire_buffer_for_thread(Thread* thread); |
|
55 static bool has_buffer_for_thread(Thread* thread); |
43 }; |
56 }; |
44 |
57 |
45 #endif // SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP |
58 #endif // SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP |