2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2019-01-10 15:13:51 -05:00
|
|
|
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#ifndef SHARE_OOPS_OBJARRAYOOP_INLINE_HPP
|
|
|
|
#define SHARE_OOPS_OBJARRAYOOP_INLINE_HPP
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2017-11-20 13:07:44 +01:00
|
|
|
#include "oops/access.inline.hpp"
|
2018-02-22 10:39:42 +01:00
|
|
|
#include "oops/arrayOop.inline.hpp"
|
2015-02-13 14:37:35 +01:00
|
|
|
#include "oops/objArrayOop.hpp"
|
|
|
|
#include "oops/oop.inline.hpp"
|
|
|
|
#include "runtime/globals.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2018-02-22 10:39:42 +01:00
|
|
|
inline HeapWord* objArrayOopDesc::base() const { return (HeapWord*) arrayOopDesc::base(T_OBJECT); }
|
|
|
|
inline HeapWord* objArrayOopDesc::base_raw() const { return (HeapWord*) arrayOopDesc::base_raw(T_OBJECT); }
|
|
|
|
|
|
|
|
template <class T> T* objArrayOopDesc::obj_at_addr(int index) const {
|
2020-08-02 16:58:14 +02:00
|
|
|
assert(is_within_bounds(index), "index %d out of bounds %d", index, length());
|
2018-02-22 10:39:42 +01:00
|
|
|
return &((T*)base())[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T> T* objArrayOopDesc::obj_at_addr_raw(int index) const {
|
2020-08-02 16:58:14 +02:00
|
|
|
assert(is_within_bounds(index), "index %d out of bounds %d", index, length());
|
2018-02-22 10:39:42 +01:00
|
|
|
return &((T*)base_raw())[index];
|
|
|
|
}
|
|
|
|
|
2015-02-13 14:37:35 +01:00
|
|
|
inline oop objArrayOopDesc::obj_at(int index) const {
|
2020-08-02 16:58:14 +02:00
|
|
|
assert(is_within_bounds(index), "index %d out of bounds %d", index, length());
|
2017-11-20 13:07:44 +01:00
|
|
|
ptrdiff_t offset = UseCompressedOops ? obj_at_offset<narrowOop>(index) : obj_at_offset<oop>(index);
|
2018-06-22 17:46:58 -04:00
|
|
|
return HeapAccess<IS_ARRAY>::oop_load_at(as_oop(), offset);
|
2009-09-15 21:53:47 -07:00
|
|
|
}
|
2015-02-13 14:37:35 +01:00
|
|
|
|
2017-11-20 13:07:44 +01:00
|
|
|
inline void objArrayOopDesc::obj_at_put(int index, oop value) {
|
2020-08-02 16:58:14 +02:00
|
|
|
assert(is_within_bounds(index), "index %d out of bounds %d", index, length());
|
2017-11-20 13:07:44 +01:00
|
|
|
ptrdiff_t offset = UseCompressedOops ? obj_at_offset<narrowOop>(index) : obj_at_offset<oop>(index);
|
2018-06-22 17:46:58 -04:00
|
|
|
HeapAccess<IS_ARRAY>::oop_store_at(as_oop(), offset, value);
|
2016-01-04 15:41:05 +01:00
|
|
|
}
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_OOPS_OBJARRAYOOP_INLINE_HPP
|