1 /* 2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 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 // oopDesc is the top baseclass for objects classes. The {name}Desc classes describe 26 // the format of Java objects so the fields can be accessed from C++. 27 // oopDesc is abstract. 28 // (see oopHierarchy for complete oop class hierarchy) 29 // 30 // no virtual functions allowed 31 32 // store into oop with store check 33 template <class T> inline void oop_store(T* p, oop v); 34 template <class T> inline void oop_store(volatile T* p, oop v); 35 36 // store into oop without store check 37 template <class T> inline void oop_store_without_check(T* p, oop v); 38 template <class T> inline void oop_store_without_check(volatile T* p, oop v); 39 40 extern bool always_do_update_barrier; 41 42 // Forward declarations. 43 class OopClosure; 44 class ScanClosure; 45 class FastScanClosure; 46 class FilteringClosure; 47 class BarrierSet; 48 class CMSIsAliveClosure; 49 50 class PSPromotionManager; 51 class ParCompactionManager; 52 53 class oopDesc { 54 friend class VMStructs; 55 private: 56 volatile markOop _mark; 57 union _metadata { 58 wideKlassOop _klass; 386 387 void oop_iterate_header(OopClosure* blk); 388 void oop_iterate_header(OopClosure* blk, MemRegion mr); 389 390 // identity hash; returns the identity hash key (computes it if necessary) 391 // NOTE with the introduction of UseBiasedLocking that identity_hash() might reach a 392 // safepoint if called on a biased object. Calling code must be aware of that. 393 intptr_t identity_hash(); 394 intptr_t slow_identity_hash(); 395 396 // marks are forwarded to stack when object is locked 397 bool has_displaced_mark() const; 398 markOop displaced_mark() const; 399 void set_displaced_mark(markOop m); 400 401 // for code generation 402 static int mark_offset_in_bytes() { return offset_of(oopDesc, _mark); } 403 static int klass_offset_in_bytes() { return offset_of(oopDesc, _metadata._klass); } 404 static int klass_gap_offset_in_bytes(); 405 }; | 1 /* 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 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_VM_OOPS_OOP_HPP 26 #define SHARE_VM_OOPS_OOP_HPP 27 28 #include "memory/iterator.hpp" 29 #include "memory/memRegion.hpp" 30 #include "memory/specialized_oop_closures.hpp" 31 #include "utilities/top.hpp" 32 33 // oopDesc is the top baseclass for objects classes. The {name}Desc classes describe 34 // the format of Java objects so the fields can be accessed from C++. 35 // oopDesc is abstract. 36 // (see oopHierarchy for complete oop class hierarchy) 37 // 38 // no virtual functions allowed 39 40 // store into oop with store check 41 template <class T> void oop_store(T* p, oop v); 42 template <class T> void oop_store(volatile T* p, oop v); 43 44 // store into oop without store check 45 template <class T> void oop_store_without_check(T* p, oop v); 46 template <class T> void oop_store_without_check(volatile T* p, oop v); 47 48 extern bool always_do_update_barrier; 49 50 // Forward declarations. 51 class OopClosure; 52 class ScanClosure; 53 class FastScanClosure; 54 class FilteringClosure; 55 class BarrierSet; 56 class CMSIsAliveClosure; 57 58 class PSPromotionManager; 59 class ParCompactionManager; 60 61 class oopDesc { 62 friend class VMStructs; 63 private: 64 volatile markOop _mark; 65 union _metadata { 66 wideKlassOop _klass; 394 395 void oop_iterate_header(OopClosure* blk); 396 void oop_iterate_header(OopClosure* blk, MemRegion mr); 397 398 // identity hash; returns the identity hash key (computes it if necessary) 399 // NOTE with the introduction of UseBiasedLocking that identity_hash() might reach a 400 // safepoint if called on a biased object. Calling code must be aware of that. 401 intptr_t identity_hash(); 402 intptr_t slow_identity_hash(); 403 404 // marks are forwarded to stack when object is locked 405 bool has_displaced_mark() const; 406 markOop displaced_mark() const; 407 void set_displaced_mark(markOop m); 408 409 // for code generation 410 static int mark_offset_in_bytes() { return offset_of(oopDesc, _mark); } 411 static int klass_offset_in_bytes() { return offset_of(oopDesc, _metadata._klass); } 412 static int klass_gap_offset_in_bytes(); 413 }; 414 415 #endif // SHARE_VM_OOPS_OOP_HPP |