48 //
49 // class GrowableCache, GrowableElement
50 // Used by : JvmtiBreakpointCache
51 // Used by JVMTI methods: none directly.
52 //
53 // GrowableCache is a permanent CHeap growable array of <GrowableElement *>
54 //
55 // In addition, the GrowableCache maintains a NULL terminated cache array of type address
56 // that's created from the element array using the function:
57 // address GrowableElement::getCacheValue().
58 //
59 // Whenever the GrowableArray changes size, the cache array gets recomputed into a new C_HEAP allocated
60 // block of memory. Additionally, every time the cache changes its position in memory, the
61 // void (*_listener_fun)(void *this_obj, address* cache)
62 // gets called with the cache's new address. This gives the user of the GrowableCache a callback
63 // to update its pointer to the address cache.
64 //
65
66 class GrowableElement : public CHeapObj<mtInternal> {
67 public:
68 virtual address getCacheValue() =0;
69 virtual bool equals(GrowableElement* e) =0;
70 virtual bool lessThan(GrowableElement *e)=0;
71 virtual GrowableElement *clone() =0;
72 virtual void oops_do(OopClosure* f) =0;
73 virtual void metadata_do(void f(Metadata*)) =0;
74 };
75
76 class GrowableCache VALUE_OBJ_CLASS_SPEC {
77
78 private:
79 // Object pointer passed into cache & listener functions.
80 void *_this_obj;
81
82 // Array of elements in the collection
83 GrowableArray<GrowableElement *> *_elements;
84
85 // Parallel array of cached values
86 address *_cache;
87
|
48 //
49 // class GrowableCache, GrowableElement
50 // Used by : JvmtiBreakpointCache
51 // Used by JVMTI methods: none directly.
52 //
53 // GrowableCache is a permanent CHeap growable array of <GrowableElement *>
54 //
55 // In addition, the GrowableCache maintains a NULL terminated cache array of type address
56 // that's created from the element array using the function:
57 // address GrowableElement::getCacheValue().
58 //
59 // Whenever the GrowableArray changes size, the cache array gets recomputed into a new C_HEAP allocated
60 // block of memory. Additionally, every time the cache changes its position in memory, the
61 // void (*_listener_fun)(void *this_obj, address* cache)
62 // gets called with the cache's new address. This gives the user of the GrowableCache a callback
63 // to update its pointer to the address cache.
64 //
65
66 class GrowableElement : public CHeapObj<mtInternal> {
67 public:
68 virtual ~GrowableElement() {}
69 virtual address getCacheValue() =0;
70 virtual bool equals(GrowableElement* e) =0;
71 virtual bool lessThan(GrowableElement *e)=0;
72 virtual GrowableElement *clone() =0;
73 virtual void oops_do(OopClosure* f) =0;
74 virtual void metadata_do(void f(Metadata*)) =0;
75 };
76
77 class GrowableCache VALUE_OBJ_CLASS_SPEC {
78
79 private:
80 // Object pointer passed into cache & listener functions.
81 void *_this_obj;
82
83 // Array of elements in the collection
84 GrowableArray<GrowableElement *> *_elements;
85
86 // Parallel array of cached values
87 address *_cache;
88
|