< prev index next >

src/share/vm/classfile/javaClasses.hpp

Print this page

        

@@ -892,11 +892,11 @@
  public:
   enum {
    hc_referent_offset   = 0,
    hc_queue_offset      = 1,
    hc_next_offset       = 2,
-   hc_discovered_offset = 3  // Is not last, see SoftRefs.
+   hc_discovered_offset = 3  // If not last, see SoftReference and Ephemeron.
   };
   enum {
    hc_static_lock_offset    = 0,
    hc_static_pending_offset = 1
   };

@@ -953,10 +953,36 @@
   static HeapWord*  pending_list_lock_addr();
   static HeapWord*  pending_list_addr();
 };
 
 
+// Interface to java.lang.ref.Ephemeron objects
+
+class java_lang_ref_Ephemeron : public java_lang_ref_Reference {
+ public:
+  enum {
+    hc_value_offset = hc_discovered_offset + 1
+  };
+   
+  static int value_offset;
+
+  // Accessors
+  static oop value(oop ref) {
+    return ref->obj_field(value_offset);
+  }
+  static void set_value(oop ref, oop value) {
+    ref->obj_field_put(value_offset, value);
+  }
+  static void set_value_raw(oop ref, oop value) {
+    ref->obj_field_put_raw(value_offset, value);
+  }
+  static HeapWord* value_addr(oop ref) {
+    return ref->obj_field_addr<HeapWord>(value_offset);
+  }    
+};
+
+
 // Interface to java.lang.ref.SoftReference objects
 
 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
  public:
   enum {
< prev index next >