< prev index next >

src/hotspot/share/oops/compressedKlass.hpp

Print this page

234   static bool is_null(Klass* v)      { return v == nullptr; }
235   static bool is_null(narrowKlass v) { return v == 0; }
236 
237   // Versions without asserts
238   static inline Klass* decode_not_null_without_asserts(narrowKlass v);
239   static inline Klass* decode_without_asserts(narrowKlass v);
240   static inline Klass* decode_not_null(narrowKlass v);
241   static inline Klass* decode(narrowKlass v);
242 
243   static inline narrowKlass encode_not_null_without_asserts(Klass* k, address narrow_base, int shift);
244   static inline narrowKlass encode_not_null(Klass* v);
245   static inline narrowKlass encode(Klass* v);
246 
247 #ifdef ASSERT
248   // Given an address, check that it can be encoded with the current encoding
249   inline static void check_encodable(const void* addr);
250   // Given a narrow Klass ID, check that it is valid according to current encoding
251   inline static void check_valid_narrow_klass_id(narrowKlass nk);
252 #endif
253 



254   // Returns whether the pointer is in the memory region used for encoding compressed
255   // class pointers.  This includes CDS.
256   static inline bool is_encodable(const void* addr) {
257     // An address can only be encoded if:
258     //
259     // 1) the address lies within the klass range.
260     // 2) It is suitably aligned to 2^encoding_shift. This only really matters for
261     //    +UseCompactObjectHeaders, since the encoding shift can be large (max 10 bits -> 1KB).
262     return (address)addr >= _klass_range_start && (address)addr < _klass_range_end &&
263         is_aligned(addr, klass_alignment_in_bytes());
264   }
265 
266   // Protect a zone a the start of the encoding range
267   static void establish_protection_zone(address addr, size_t size);
268 
269   // Returns true if address points into protection zone (for error reporting)
270   static bool is_in_protection_zone(address addr);
271 
272 #if defined(AARCH64) && !defined(ZERO)
273   // Check that with the given base, shift and range, aarch64 code can encode and decode the klass pointer.

234   static bool is_null(Klass* v)      { return v == nullptr; }
235   static bool is_null(narrowKlass v) { return v == 0; }
236 
237   // Versions without asserts
238   static inline Klass* decode_not_null_without_asserts(narrowKlass v);
239   static inline Klass* decode_without_asserts(narrowKlass v);
240   static inline Klass* decode_not_null(narrowKlass v);
241   static inline Klass* decode(narrowKlass v);
242 
243   static inline narrowKlass encode_not_null_without_asserts(Klass* k, address narrow_base, int shift);
244   static inline narrowKlass encode_not_null(Klass* v);
245   static inline narrowKlass encode(Klass* v);
246 
247 #ifdef ASSERT
248   // Given an address, check that it can be encoded with the current encoding
249   inline static void check_encodable(const void* addr);
250   // Given a narrow Klass ID, check that it is valid according to current encoding
251   inline static void check_valid_narrow_klass_id(narrowKlass nk);
252 #endif
253 
254   // Given a narrow Klass ID, returns true if it appears to be valid
255   inline static bool is_valid_narrow_klass_id(narrowKlass nk);
256 
257   // Returns whether the pointer is in the memory region used for encoding compressed
258   // class pointers.  This includes CDS.
259   static inline bool is_encodable(const void* addr) {
260     // An address can only be encoded if:
261     //
262     // 1) the address lies within the klass range.
263     // 2) It is suitably aligned to 2^encoding_shift. This only really matters for
264     //    +UseCompactObjectHeaders, since the encoding shift can be large (max 10 bits -> 1KB).
265     return (address)addr >= _klass_range_start && (address)addr < _klass_range_end &&
266         is_aligned(addr, klass_alignment_in_bytes());
267   }
268 
269   // Protect a zone a the start of the encoding range
270   static void establish_protection_zone(address addr, size_t size);
271 
272   // Returns true if address points into protection zone (for error reporting)
273   static bool is_in_protection_zone(address addr);
274 
275 #if defined(AARCH64) && !defined(ZERO)
276   // Check that with the given base, shift and range, aarch64 code can encode and decode the klass pointer.
< prev index next >