comparison src/share/vm/oops/oop.inline.hpp @ 8124:5fc51c1ecdeb

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 05 Mar 2013 23:44:54 +0100
parents e522a00b91aa 3c9bc17b9403
children 58fc8e2b7b6d
comparison
equal deleted inserted replaced
7943:a413bcd552a4 8124:5fc51c1ecdeb
1 /* 1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
38 #include "oops/klass.hpp" 38 #include "oops/klass.hpp"
39 #include "oops/markOop.inline.hpp" 39 #include "oops/markOop.inline.hpp"
40 #include "oops/oop.hpp" 40 #include "oops/oop.hpp"
41 #include "runtime/atomic.hpp" 41 #include "runtime/atomic.hpp"
42 #include "runtime/os.hpp" 42 #include "runtime/os.hpp"
43 #include "utilities/macros.hpp"
43 #ifdef TARGET_ARCH_x86 44 #ifdef TARGET_ARCH_x86
44 # include "bytes_x86.hpp" 45 # include "bytes_x86.hpp"
45 #endif 46 #endif
46 #ifdef TARGET_ARCH_sparc 47 #ifdef TARGET_ARCH_sparc
47 # include "bytes_sparc.hpp" 48 # include "bytes_sparc.hpp"
225 226
226 // Encoding and decoding for klass field. It is copied code, but someday 227 // Encoding and decoding for klass field. It is copied code, but someday
227 // might not be the same as oop. 228 // might not be the same as oop.
228 229
229 inline narrowOop oopDesc::encode_klass_not_null(Klass* v) { 230 inline narrowOop oopDesc::encode_klass_not_null(Klass* v) {
230 assert(!is_null(v), "oop value can never be zero"); 231 assert(!is_null(v), "klass value can never be zero");
231 assert(check_klass_alignment(v), "Address not aligned"); 232 assert(check_klass_alignment(v), "Address not aligned");
232 address base = Universe::narrow_klass_base(); 233 address base = Universe::narrow_klass_base();
233 int shift = Universe::narrow_klass_shift(); 234 int shift = Universe::narrow_klass_shift();
234 uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base, 1)); 235 uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base, 1));
235 assert(OopEncodingHeapMax > pd, "change encoding max if new encoding"); 236 assert(KlassEncodingMetaspaceMax > pd, "change encoding max if new encoding");
236 uint64_t result = pd >> shift; 237 uint64_t result = pd >> shift;
237 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow klass pointer overflow"); 238 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow klass pointer overflow");
238 assert(decode_klass(result) == v, "reversibility"); 239 assert(decode_klass(result) == v, "reversibility");
239 return (narrowOop)result; 240 return (narrowOop)result;
240 } 241 }
758 } 759 }
759 760
760 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DEFN) 761 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DEFN)
761 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_DEFN) 762 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_DEFN)
762 763
763 #ifndef SERIALGC 764 #if INCLUDE_ALL_GCS
764 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ 765 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
765 \ 766 \
766 inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) { \ 767 inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) { \
767 SpecializationStats::record_call(); \ 768 SpecializationStats::record_call(); \
768 return klass()->oop_oop_iterate_backwards##nv_suffix(this, blk); \ 769 return klass()->oop_oop_iterate_backwards##nv_suffix(this, blk); \
769 } 770 }
770 771
771 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DEFN) 772 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DEFN)
772 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DEFN) 773 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DEFN)
773 #endif // !SERIALGC 774 #endif // INCLUDE_ALL_GCS
774 775
775 #endif // SHARE_VM_OOPS_OOP_INLINE_HPP 776 #endif // SHARE_VM_OOPS_OOP_INLINE_HPP