< prev index next >

src/share/vm/classfile/javaClasses.hpp

Print this page




 877 
 878   static int value_offset_in_bytes(BasicType type) {
 879     return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset :
 880                                                     value_offset;
 881   }
 882 
 883   // Debugging
 884   friend class JavaClasses;
 885 };
 886 
 887 
 888 
 889 // Interface to java.lang.ref.Reference objects
 890 
 891 class java_lang_ref_Reference: AllStatic {
 892  public:
 893   enum {
 894    hc_referent_offset   = 0,
 895    hc_queue_offset      = 1,
 896    hc_next_offset       = 2,
 897    hc_discovered_offset = 3  // Is not last, see SoftRefs.
 898   };
 899   enum {
 900    hc_static_lock_offset    = 0,
 901    hc_static_pending_offset = 1
 902   };
 903 
 904   static int referent_offset;
 905   static int queue_offset;
 906   static int next_offset;
 907   static int discovered_offset;
 908   static int static_lock_offset;
 909   static int static_pending_offset;
 910   static int number_of_fake_oop_fields;
 911 
 912   // Accessors
 913   static oop referent(oop ref) {
 914     return ref->obj_field(referent_offset);
 915   }
 916   static void set_referent(oop ref, oop value) {
 917     ref->obj_field_put(referent_offset, value);


 935     return ref->obj_field_addr<HeapWord>(next_offset);
 936   }
 937   static oop discovered(oop ref) {
 938     return ref->obj_field(discovered_offset);
 939   }
 940   static void set_discovered(oop ref, oop value) {
 941     ref->obj_field_put(discovered_offset, value);
 942   }
 943   static void set_discovered_raw(oop ref, oop value) {
 944     ref->obj_field_put_raw(discovered_offset, value);
 945   }
 946   static HeapWord* discovered_addr(oop ref) {
 947     return ref->obj_field_addr<HeapWord>(discovered_offset);
 948   }
 949   // Accessors for statics
 950   static oop  pending_list_lock();
 951   static oop  pending_list();
 952 
 953   static HeapWord*  pending_list_lock_addr();
 954   static HeapWord*  pending_list_addr();
































 955 };
 956 
 957 
 958 // Interface to java.lang.ref.SoftReference objects
 959 
 960 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
 961  public:
 962   enum {
 963    // The timestamp is a long field and may need to be adjusted for alignment.
 964    hc_timestamp_offset  = hc_discovered_offset + 1
 965   };
 966   enum {
 967    hc_static_clock_offset = 0
 968   };
 969 
 970   static int timestamp_offset;
 971   static int static_clock_offset;
 972 
 973   // Accessors
 974   static jlong timestamp(oop ref);




 877 
 878   static int value_offset_in_bytes(BasicType type) {
 879     return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset :
 880                                                     value_offset;
 881   }
 882 
 883   // Debugging
 884   friend class JavaClasses;
 885 };
 886 
 887 
 888 
 889 // Interface to java.lang.ref.Reference objects
 890 
 891 class java_lang_ref_Reference: AllStatic {
 892  public:
 893   enum {
 894    hc_referent_offset   = 0,
 895    hc_queue_offset      = 1,
 896    hc_next_offset       = 2,
 897    hc_discovered_offset = 3  // If not last, see SoftReference and Ephemeron.
 898   };
 899   enum {
 900    hc_static_lock_offset    = 0,
 901    hc_static_pending_offset = 1
 902   };
 903 
 904   static int referent_offset;
 905   static int queue_offset;
 906   static int next_offset;
 907   static int discovered_offset;
 908   static int static_lock_offset;
 909   static int static_pending_offset;
 910   static int number_of_fake_oop_fields;
 911 
 912   // Accessors
 913   static oop referent(oop ref) {
 914     return ref->obj_field(referent_offset);
 915   }
 916   static void set_referent(oop ref, oop value) {
 917     ref->obj_field_put(referent_offset, value);


 935     return ref->obj_field_addr<HeapWord>(next_offset);
 936   }
 937   static oop discovered(oop ref) {
 938     return ref->obj_field(discovered_offset);
 939   }
 940   static void set_discovered(oop ref, oop value) {
 941     ref->obj_field_put(discovered_offset, value);
 942   }
 943   static void set_discovered_raw(oop ref, oop value) {
 944     ref->obj_field_put_raw(discovered_offset, value);
 945   }
 946   static HeapWord* discovered_addr(oop ref) {
 947     return ref->obj_field_addr<HeapWord>(discovered_offset);
 948   }
 949   // Accessors for statics
 950   static oop  pending_list_lock();
 951   static oop  pending_list();
 952 
 953   static HeapWord*  pending_list_lock_addr();
 954   static HeapWord*  pending_list_addr();
 955 };
 956 
 957 
 958 // Interface to java.lang.ref.WeakReference objects
 959 
 960 class java_lang_ref_WeakReference: public java_lang_ref_Reference {
 961 };
 962 
 963 
 964 // Interface to java.lang.ref.Ephemeron objects
 965 
 966 class java_lang_ref_Ephemeron : public java_lang_ref_WeakReference {
 967  public:
 968   enum {
 969     hc_value_offset = hc_discovered_offset + 1
 970   };
 971    
 972   static int value_offset;
 973 
 974   // Accessors
 975   static oop value(oop ref) {
 976     return ref->obj_field(value_offset);
 977   }
 978   static void set_value(oop ref, oop value) {
 979     ref->obj_field_put(value_offset, value);
 980   }
 981   static void set_value_raw(oop ref, oop value) {
 982     ref->obj_field_put_raw(value_offset, value);
 983   }
 984   static HeapWord* value_addr(oop ref) {
 985     return ref->obj_field_addr<HeapWord>(value_offset);
 986   }    
 987 };
 988 
 989 
 990 // Interface to java.lang.ref.SoftReference objects
 991 
 992 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
 993  public:
 994   enum {
 995    // The timestamp is a long field and may need to be adjusted for alignment.
 996    hc_timestamp_offset  = hc_discovered_offset + 1
 997   };
 998   enum {
 999    hc_static_clock_offset = 0
1000   };
1001 
1002   static int timestamp_offset;
1003   static int static_clock_offset;
1004 
1005   // Accessors
1006   static jlong timestamp(oop ref);


< prev index next >