8197999: Accessors in typeArrayOopDesc should use new Access API
Reviewed-by: eosterlund, pliden
This commit is contained in:
parent
b962c75f25
commit
6be7841937
@ -30,7 +30,7 @@
|
||||
#include "ci/ciUtilities.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
|
||||
// ciArray
|
||||
//
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "ci/ciTypeArray.hpp"
|
||||
#include "ci/ciUtilities.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
|
||||
// ciTypeArray
|
||||
//
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "memory/oopFactory.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
|
||||
bool JavaAssertions::_userDefault = false;
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/symbol.hpp"
|
||||
#include "oops/typeArrayOop.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "prims/resolvedMethodTable.hpp"
|
||||
#include "runtime/fieldDescriptor.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "jvmci/jvmciRuntime.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/safepointMechanism.inline.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "oops/fieldStreams.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "runtime/fieldDescriptor.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "jvmci/jvmciRuntime.hpp"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "memory/oopFactory.hpp"
|
||||
#include "oops/annotations.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
|
||||
// Allocate annotations in metadata area
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "runtime/fieldType.hpp"
|
||||
#include "runtime/init.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
|
@ -34,6 +34,12 @@
|
||||
#include <limits.h>
|
||||
|
||||
class typeArrayOopDesc : public arrayOopDesc {
|
||||
private:
|
||||
template <class T>
|
||||
static ptrdiff_t element_offset(BasicType bt, int index) {
|
||||
return arrayOopDesc::base_offset_in_bytes(bt) + sizeof(T) * index;
|
||||
}
|
||||
|
||||
protected:
|
||||
jchar* char_base() const { return (jchar*) base(T_CHAR); }
|
||||
jboolean* bool_base() const { return (jboolean*)base(T_BOOLEAN); }
|
||||
@ -92,52 +98,38 @@ class typeArrayOopDesc : public arrayOopDesc {
|
||||
return &double_base()[which];
|
||||
}
|
||||
|
||||
jbyte byte_at(int which) const { return *byte_at_addr(which); }
|
||||
void byte_at_put(int which, jbyte contents) { *byte_at_addr(which) = contents; }
|
||||
jbyte byte_at(int which) const;
|
||||
void byte_at_put(int which, jbyte contents);
|
||||
|
||||
jboolean bool_at(int which) const { return *bool_at_addr(which); }
|
||||
void bool_at_put(int which, jboolean contents) { *bool_at_addr(which) = (((jint)contents) & 1); }
|
||||
jboolean bool_at(int which) const;
|
||||
void bool_at_put(int which, jboolean contents);
|
||||
|
||||
jchar char_at(int which) const { return *char_at_addr(which); }
|
||||
void char_at_put(int which, jchar contents) { *char_at_addr(which) = contents; }
|
||||
jchar char_at(int which) const;
|
||||
void char_at_put(int which, jchar contents);
|
||||
|
||||
jint int_at(int which) const { return *int_at_addr(which); }
|
||||
void int_at_put(int which, jint contents) { *int_at_addr(which) = contents; }
|
||||
jint int_at(int which) const;
|
||||
void int_at_put(int which, jint contents);
|
||||
|
||||
jshort short_at(int which) const { return *short_at_addr(which); }
|
||||
void short_at_put(int which, jshort contents) { *short_at_addr(which) = contents; }
|
||||
jshort short_at(int which) const;
|
||||
void short_at_put(int which, jshort contents);
|
||||
|
||||
jushort ushort_at(int which) const { return *ushort_at_addr(which); }
|
||||
void ushort_at_put(int which, jushort contents) { *ushort_at_addr(which) = contents; }
|
||||
jushort ushort_at(int which) const;
|
||||
void ushort_at_put(int which, jushort contents);
|
||||
|
||||
jlong long_at(int which) const { return *long_at_addr(which); }
|
||||
void long_at_put(int which, jlong contents) { *long_at_addr(which) = contents; }
|
||||
jlong long_at(int which) const;
|
||||
void long_at_put(int which, jlong contents);
|
||||
|
||||
jfloat float_at(int which) const { return *float_at_addr(which); }
|
||||
void float_at_put(int which, jfloat contents) { *float_at_addr(which) = contents; }
|
||||
jfloat float_at(int which) const;
|
||||
void float_at_put(int which, jfloat contents);
|
||||
|
||||
jdouble double_at(int which) const { return *double_at_addr(which); }
|
||||
void double_at_put(int which, jdouble contents) { *double_at_addr(which) = contents; }
|
||||
jdouble double_at(int which) const;
|
||||
void double_at_put(int which, jdouble contents);
|
||||
|
||||
jbyte byte_at_acquire(int which) const { return OrderAccess::load_acquire(byte_at_addr(which)); }
|
||||
void release_byte_at_put(int which, jbyte contents) { OrderAccess::release_store(byte_at_addr(which), contents); }
|
||||
jbyte byte_at_acquire(int which) const;
|
||||
void release_byte_at_put(int which, jbyte contents);
|
||||
|
||||
// Java thinks Symbol arrays are just arrays of either long or int, since
|
||||
// there doesn't seem to be T_ADDRESS, so this is a bit of unfortunate
|
||||
// casting
|
||||
#ifdef _LP64
|
||||
Symbol* symbol_at(int which) const {
|
||||
return (Symbol*)*long_at_addr(which); }
|
||||
void symbol_at_put(int which, Symbol* contents) {
|
||||
*long_at_addr(which) = (jlong)contents;
|
||||
}
|
||||
#else
|
||||
Symbol* symbol_at(int which) const {
|
||||
return (Symbol*)*int_at_addr(which); }
|
||||
void symbol_at_put(int which, Symbol* contents) {
|
||||
*int_at_addr(which) = (int)contents;
|
||||
}
|
||||
#endif // _LP64
|
||||
Symbol* symbol_at(int which) const;
|
||||
void symbol_at_put(int which, Symbol* contents);
|
||||
|
||||
// Sizing
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#ifndef SHARE_VM_OOPS_TYPEARRAYOOP_INLINE_HPP
|
||||
#define SHARE_VM_OOPS_TYPEARRAYOOP_INLINE_HPP
|
||||
|
||||
#include "oops/access.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.hpp"
|
||||
|
||||
@ -33,4 +34,118 @@ int typeArrayOopDesc::object_size() {
|
||||
return object_size(tk->layout_helper(), length());
|
||||
}
|
||||
|
||||
inline jbyte typeArrayOopDesc::byte_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jbyte>(T_BYTE, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::byte_at_put(int which, jbyte contents) {
|
||||
ptrdiff_t offset = element_offset<jbyte>(T_BYTE, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
inline jboolean typeArrayOopDesc::bool_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jboolean>(T_BOOLEAN, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::bool_at_put(int which, jboolean contents) {
|
||||
ptrdiff_t offset = element_offset<jboolean>(T_BOOLEAN, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, ((jint)contents) & 1);
|
||||
}
|
||||
|
||||
inline jchar typeArrayOopDesc::char_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jchar>(T_CHAR, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::char_at_put(int which, jchar contents) {
|
||||
ptrdiff_t offset = element_offset<jchar>(T_CHAR, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
inline jint typeArrayOopDesc::int_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jint>(T_INT, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::int_at_put(int which, jint contents) {
|
||||
ptrdiff_t offset = element_offset<jint>(T_INT, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
inline jshort typeArrayOopDesc::short_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jshort>(T_SHORT, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::short_at_put(int which, jshort contents) {
|
||||
ptrdiff_t offset = element_offset<jshort>(T_BOOLEAN, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
inline jushort typeArrayOopDesc::ushort_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jushort>(T_SHORT, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::ushort_at_put(int which, jushort contents) {
|
||||
ptrdiff_t offset = element_offset<jushort>(T_SHORT, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
inline jlong typeArrayOopDesc::long_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jlong>(T_LONG, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::long_at_put(int which, jlong contents) {
|
||||
ptrdiff_t offset = element_offset<jlong>(T_LONG, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
inline jfloat typeArrayOopDesc::float_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jfloat>(T_FLOAT, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::float_at_put(int which, jfloat contents) {
|
||||
ptrdiff_t offset = element_offset<jfloat>(T_FLOAT, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
inline jdouble typeArrayOopDesc::double_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jdouble>(T_DOUBLE, which);
|
||||
return HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::double_at_put(int which, jdouble contents) {
|
||||
ptrdiff_t offset = element_offset<jdouble>(T_DOUBLE, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
inline jbyte typeArrayOopDesc::byte_at_acquire(int which) const {
|
||||
ptrdiff_t offset = element_offset<jbyte>(T_BYTE, which);
|
||||
return HeapAccess<MO_ACQUIRE | IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::release_byte_at_put(int which, jbyte contents) {
|
||||
ptrdiff_t offset = element_offset<jbyte>(T_BYTE, which);
|
||||
HeapAccess<MO_RELEASE | IN_HEAP_ARRAY>::store_at(as_oop(), offset, contents);
|
||||
}
|
||||
|
||||
// Java thinks Symbol arrays are just arrays of either long or int, since
|
||||
// there doesn't seem to be T_ADDRESS, so this is a bit of unfortunate
|
||||
// casting
|
||||
#ifdef _LP64
|
||||
inline Symbol* typeArrayOopDesc::symbol_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jlong>(T_LONG, which);
|
||||
return (Symbol*)(jlong) HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::symbol_at_put(int which, Symbol* contents) {
|
||||
ptrdiff_t offset = element_offset<jlong>(T_LONG, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, (jlong)contents);
|
||||
}
|
||||
#else
|
||||
inline Symbol* typeArrayOopDesc::symbol_at(int which) const {
|
||||
ptrdiff_t offset = element_offset<jint>(T_INT, which);
|
||||
return (Symbol*)(jint) HeapAccess<IN_HEAP_ARRAY>::load_at(as_oop(), offset);
|
||||
}
|
||||
inline void typeArrayOopDesc::symbol_at_put(int which, Symbol* contents) {
|
||||
ptrdiff_t offset = element_offset<jint>(T_INT, which);
|
||||
HeapAccess<IN_HEAP_ARRAY>::store_at(as_oop(), offset, (jint)contents);
|
||||
}
|
||||
#endif // _LP64
|
||||
|
||||
|
||||
#endif // SHARE_VM_OOPS_TYPEARRAYOOP_INLINE_HPP
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/symbol.hpp"
|
||||
#include "oops/typeArrayKlass.hpp"
|
||||
#include "oops/typeArrayOop.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "prims/jniCheck.hpp"
|
||||
#include "prims/jniExport.hpp"
|
||||
#include "prims/jniFastGetField.hpp"
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "prims/jvmtiEventController.hpp"
|
||||
#include "prims/jvmtiEventController.inline.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "runtime/compilationPolicy.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "oops/fieldStreams.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "prims/unsafe.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "prims/wbtestmethods/parserTests.hpp"
|
||||
#include "prims/whitebox.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/fieldStreams.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "oops/verifyOopClosure.hpp"
|
||||
#include "prims/jvmtiThreadState.hpp"
|
||||
#include "runtime/biasedLocking.hpp"
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "oops/objArrayOop.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/symbol.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "oops/verifyOopClosure.hpp"
|
||||
#include "prims/jvm_misc.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/jniHandles.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/typeArrayOop.inline.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user