diff src/share/vm/oops/instanceKlass.hpp @ 3939:f6f3bb0ee072

7088955: add C2 IR support to the SA Reviewed-by: kvn
author never
date Sun, 11 Sep 2011 14:48:24 -0700
parents e6b1331a51d2
children 04b9a2566eec 75c0a73eee98 069ab3f976d3
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.hpp	Sat Sep 10 17:29:02 2011 -0700
+++ b/src/share/vm/oops/instanceKlass.hpp	Sun Sep 11 14:48:24 2011 -0700
@@ -1012,4 +1012,36 @@
   PreviousVersionInfo* next_previous_version();
 };
 
+
+//
+// nmethodBucket is used to record dependent nmethods for
+// deoptimization.  nmethod dependencies are actually <klass, method>
+// pairs but we really only care about the klass part for purposes of
+// finding nmethods which might need to be deoptimized.  Instead of
+// recording the method, a count of how many times a particular nmethod
+// was recorded is kept.  This ensures that any recording errors are
+// noticed since an nmethod should be removed as many times are it's
+// added.
+//
+class nmethodBucket: public CHeapObj {
+  friend class VMStructs;
+ private:
+  nmethod*       _nmethod;
+  int            _count;
+  nmethodBucket* _next;
+
+ public:
+  nmethodBucket(nmethod* nmethod, nmethodBucket* next) {
+    _nmethod = nmethod;
+    _next = next;
+    _count = 1;
+  }
+  int count()                             { return _count; }
+  int increment()                         { _count += 1; return _count; }
+  int decrement()                         { _count -= 1; assert(_count >= 0, "don't underflow"); return _count; }
+  nmethodBucket* next()                   { return _next; }
+  void set_next(nmethodBucket* b)         { _next = b; }
+  nmethod* get_nmethod()                  { return _nmethod; }
+};
+
 #endif // SHARE_VM_OOPS_INSTANCEKLASS_HPP