13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OOPS_KLASS_INLINE_HPP
26 #define SHARE_OOPS_KLASS_INLINE_HPP
27
28 #include "memory/universe.hpp"
29 #include "oops/klass.hpp"
30 #include "oops/markOop.hpp"
31
32 inline void Klass::set_prototype_header(markOop header) {
33 assert(!header->has_bias_pattern() || is_instance_klass(), "biased locking currently only supported for Java instances");
34 _prototype_header = header;
35 }
36
37 inline bool Klass::is_null(Klass* obj) { return obj == NULL; }
38 inline bool Klass::is_null(narrowKlass obj) { return obj == 0; }
39
40 // Encoding and decoding for klass field.
41
42 inline bool check_klass_alignment(Klass* obj) {
43 return (intptr_t)obj % KlassAlignmentInBytes == 0;
44 }
45
46 inline narrowKlass Klass::encode_klass_not_null(Klass* v) {
47 assert(!is_null(v), "klass value can never be zero");
48 assert(check_klass_alignment(v), "Address not aligned");
49 int shift = Universe::narrow_klass_shift();
50 uint64_t pd = (uint64_t)(pointer_delta((void*)v, Universe::narrow_klass_base(), 1));
51 assert(KlassEncodingMetaspaceMax > pd, "change encoding max if new encoding");
52 uint64_t result = pd >> shift;
53 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow klass pointer overflow");
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OOPS_KLASS_INLINE_HPP
26 #define SHARE_OOPS_KLASS_INLINE_HPP
27
28 #include "memory/universe.hpp"
29 #include "oops/klass.hpp"
30 #include "oops/markOop.hpp"
31
32 inline void Klass::set_prototype_header(markOop header) {
33 assert(!is_value() || header->is_always_locked(), "Unexpected prototype");
34 _prototype_header = header;
35 }
36
37 inline bool Klass::is_null(Klass* obj) { return obj == NULL; }
38 inline bool Klass::is_null(narrowKlass obj) { return obj == 0; }
39
40 // Encoding and decoding for klass field.
41
42 inline bool check_klass_alignment(Klass* obj) {
43 return (intptr_t)obj % KlassAlignmentInBytes == 0;
44 }
45
46 inline narrowKlass Klass::encode_klass_not_null(Klass* v) {
47 assert(!is_null(v), "klass value can never be zero");
48 assert(check_klass_alignment(v), "Address not aligned");
49 int shift = Universe::narrow_klass_shift();
50 uint64_t pd = (uint64_t)(pointer_delta((void*)v, Universe::narrow_klass_base(), 1));
51 assert(KlassEncodingMetaspaceMax > pd, "change encoding max if new encoding");
52 uint64_t result = pd >> shift;
53 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow klass pointer overflow");
|