equal
deleted
inserted
replaced
37 // the GC cycle. The runtime structures that reference the oop must test |
37 // the GC cycle. The runtime structures that reference the oop must test |
38 // if the value is NULL. If it is NULL, it has been cleaned out by GC. |
38 // if the value is NULL. If it is NULL, it has been cleaned out by GC. |
39 // This is the vm version of jweak but has different GC lifetimes and policies, |
39 // This is the vm version of jweak but has different GC lifetimes and policies, |
40 // depending on the type. |
40 // depending on the type. |
41 |
41 |
42 enum WeakHandleType { vm_class_loader_data, vm_string }; |
42 enum WeakHandleType { vm_class_loader_data, vm_string, vm_string_table_data }; |
43 |
43 |
44 template <WeakHandleType T> |
44 template <WeakHandleType T> |
45 class WeakHandle { |
45 class WeakHandle { |
46 public: |
46 public: |
47 |
|
48 private: |
47 private: |
49 oop* _obj; |
48 oop* _obj; |
50 |
49 |
51 WeakHandle(oop* w) : _obj(w) {} |
50 WeakHandle(oop* w) : _obj(w) {} |
52 static OopStorage* get_storage(); |
51 static OopStorage* get_storage(); |
57 inline oop resolve() const; |
56 inline oop resolve() const; |
58 inline oop peek() const; |
57 inline oop peek() const; |
59 void release() const; |
58 void release() const; |
60 bool is_null() const { return _obj == NULL; } |
59 bool is_null() const { return _obj == NULL; } |
61 |
60 |
|
61 void replace(oop with_obj); |
|
62 |
62 void print() const; |
63 void print() const; |
63 void print_on(outputStream* st) const; |
64 void print_on(outputStream* st) const; |
64 }; |
65 }; |
65 |
66 |
66 typedef WeakHandle<vm_class_loader_data> ClassLoaderWeakHandle; |
67 typedef WeakHandle<vm_class_loader_data> ClassLoaderWeakHandle; |