< prev index next >

src/share/vm/oops/objArrayOop.hpp

Print this page
rev 9803 : 8146401: Clean up oop.hpp: add inline directives and fix header files
   1 /*
   2  * Copyright (c) 1997, 2015, 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  *


  64     } else {
  65       old_res = align_size_up((uint)length, OopsPerHeapWord)/OopsPerHeapWord;
  66     }
  67     assert(res == old_res, "Inconsistency between old and new.");
  68 #endif  // ASSERT
  69     return res;
  70   }
  71 
  72  public:
  73   // Returns the offset of the first element.
  74   static int base_offset_in_bytes() {
  75     return arrayOopDesc::base_offset_in_bytes(T_OBJECT);
  76   }
  77 
  78   // base is the address following the header.
  79   HeapWord* base() const      { return (HeapWord*) arrayOopDesc::base(T_OBJECT); }
  80 
  81   // Accessing
  82   oop obj_at(int index) const;
  83 
  84   void obj_at_put(int index, oop value) {
  85     if (UseCompressedOops) {
  86       oop_store(obj_at_addr<narrowOop>(index), value);
  87     } else {
  88       oop_store(obj_at_addr<oop>(index), value);
  89     }
  90   }
  91 
  92   oop atomic_compare_exchange_oop(int index, oop exchange_value, oop compare_value);
  93 
  94   // Sizing
  95   static int header_size()    { return arrayOopDesc::header_size(T_OBJECT); }
  96   int object_size()           { return object_size(length()); }
  97 
  98   static int object_size(int length) {
  99     // This returns the object size in HeapWords.
 100     uint asz = array_size(length);
 101     uint osz = align_object_size(header_size() + asz);
 102     assert(osz >= asz,   "no overflow");
 103     assert((int)osz > 0, "no overflow");
 104     return (int)osz;
 105   }
 106 
 107   // special iterators for index ranges, returns size of object
 108 #define ObjArrayOop_OOP_ITERATE_DECL(OopClosureType, nv_suffix)     \
 109   void oop_iterate_range(OopClosureType* blk, int start, int end);
 110 
   1 /*
   2  * Copyright (c) 1997, 2016, 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  *


  64     } else {
  65       old_res = align_size_up((uint)length, OopsPerHeapWord)/OopsPerHeapWord;
  66     }
  67     assert(res == old_res, "Inconsistency between old and new.");
  68 #endif  // ASSERT
  69     return res;
  70   }
  71 
  72  public:
  73   // Returns the offset of the first element.
  74   static int base_offset_in_bytes() {
  75     return arrayOopDesc::base_offset_in_bytes(T_OBJECT);
  76   }
  77 
  78   // base is the address following the header.
  79   HeapWord* base() const      { return (HeapWord*) arrayOopDesc::base(T_OBJECT); }
  80 
  81   // Accessing
  82   oop obj_at(int index) const;
  83 
  84   void /*inline*/ obj_at_put(int index, oop value);






  85 
  86   oop atomic_compare_exchange_oop(int index, oop exchange_value, oop compare_value);
  87 
  88   // Sizing
  89   static int header_size()    { return arrayOopDesc::header_size(T_OBJECT); }
  90   int object_size()           { return object_size(length()); }
  91 
  92   static int object_size(int length) {
  93     // This returns the object size in HeapWords.
  94     uint asz = array_size(length);
  95     uint osz = align_object_size(header_size() + asz);
  96     assert(osz >= asz,   "no overflow");
  97     assert((int)osz > 0, "no overflow");
  98     return (int)osz;
  99   }
 100 
 101   // special iterators for index ranges, returns size of object
 102 #define ObjArrayOop_OOP_ITERATE_DECL(OopClosureType, nv_suffix)     \
 103   void oop_iterate_range(OopClosureType* blk, int start, int end);
 104 
< prev index next >