mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
rename cast -> fieldAtOffset
This commit is contained in:
parent
2a1834e48a
commit
5dd770d7ea
@ -740,7 +740,7 @@ targetSize(Thread* t, object typeMaps, object p)
|
||||
if (map->targetArrayElementSizeInBytes) {
|
||||
return map->targetFixedSizeInWords
|
||||
+ ceilingDivide(map->targetArrayElementSizeInBytes
|
||||
* cast<uintptr_t>
|
||||
* fieldAtOffset<uintptr_t>
|
||||
(p, (map->buildFixedSizeInWords - 1) * BytesPerWord),
|
||||
TargetBytesPerWord);
|
||||
} else {
|
||||
@ -888,7 +888,7 @@ nonObjectsEqual(TypeMap* map, uint8_t* src, uint8_t* dst)
|
||||
|
||||
if (map->targetArrayElementSizeInBytes) {
|
||||
unsigned fixedSize = map->buildFixedSizeInWords * BytesPerWord;
|
||||
unsigned count = cast<uintptr_t>(src, fixedSize - BytesPerWord);
|
||||
unsigned count = fieldAtOffset<uintptr_t>(src, fixedSize - BytesPerWord);
|
||||
|
||||
for (unsigned i = 0; i < count; ++i) {
|
||||
if (not nonObjectsEqual
|
||||
@ -919,7 +919,7 @@ copy(Thread* t, object typeMaps, object p, uint8_t* dst)
|
||||
|
||||
if (map->targetArrayElementSizeInBytes) {
|
||||
unsigned fixedSize = map->buildFixedSizeInWords * BytesPerWord;
|
||||
unsigned count = cast<uintptr_t>(p, fixedSize - BytesPerWord);
|
||||
unsigned count = fieldAtOffset<uintptr_t>(p, fixedSize - BytesPerWord);
|
||||
|
||||
for (unsigned i = 0; i < count; ++i) {
|
||||
copy(t, src + fixedSize + (i * map->buildArrayElementSizeInBytes),
|
||||
|
@ -365,7 +365,7 @@ Avian_sun_misc_Unsafe_setMemory
|
||||
ACQUIRE(t, t->m->referenceLock);
|
||||
|
||||
if (base) {
|
||||
memset(&cast<int8_t>(base, offset), value, count);
|
||||
memset(&fieldAtOffset<int8_t>(base, offset), value, count);
|
||||
} else {
|
||||
memset(reinterpret_cast<int8_t*>(offset), value, count);
|
||||
}
|
||||
@ -528,11 +528,11 @@ Avian_sun_misc_Unsafe_copyMemory
|
||||
ACQUIRE(t, t->m->referenceLock);
|
||||
|
||||
void* src = srcBase
|
||||
? &cast<uint8_t>(srcBase, srcOffset)
|
||||
? &fieldAtOffset<uint8_t>(srcBase, srcOffset)
|
||||
: reinterpret_cast<uint8_t*>(srcOffset);
|
||||
|
||||
void* dst = dstBase
|
||||
? &cast<uint8_t>(dstBase, dstOffset)
|
||||
? &fieldAtOffset<uint8_t>(dstBase, dstOffset)
|
||||
: reinterpret_cast<uint8_t*>(dstOffset);
|
||||
|
||||
memcpy(dst, src, count);
|
||||
|
@ -250,21 +250,21 @@ Avian_java_lang_reflect_Field_getPrimitive
|
||||
|
||||
switch (code) {
|
||||
case ByteField:
|
||||
return cast<int8_t>(instance, offset);
|
||||
return fieldAtOffset<int8_t>(instance, offset);
|
||||
case BooleanField:
|
||||
return cast<uint8_t>(instance, offset);
|
||||
return fieldAtOffset<uint8_t>(instance, offset);
|
||||
case CharField:
|
||||
return cast<uint16_t>(instance, offset);
|
||||
return fieldAtOffset<uint16_t>(instance, offset);
|
||||
case ShortField:
|
||||
return cast<int16_t>(instance, offset);
|
||||
return fieldAtOffset<int16_t>(instance, offset);
|
||||
case IntField:
|
||||
return cast<int32_t>(instance, offset);
|
||||
return fieldAtOffset<int32_t>(instance, offset);
|
||||
case LongField:
|
||||
return cast<int64_t>(instance, offset);
|
||||
return fieldAtOffset<int64_t>(instance, offset);
|
||||
case FloatField:
|
||||
return cast<uint32_t>(instance, offset);
|
||||
return fieldAtOffset<uint32_t>(instance, offset);
|
||||
case DoubleField:
|
||||
return cast<uint64_t>(instance, offset);
|
||||
return fieldAtOffset<uint64_t>(instance, offset);
|
||||
default:
|
||||
abort(t);
|
||||
}
|
||||
@ -277,7 +277,7 @@ Avian_java_lang_reflect_Field_getObject
|
||||
object instance = reinterpret_cast<object>(arguments[0]);
|
||||
int offset = arguments[1];
|
||||
|
||||
return reinterpret_cast<int64_t>(cast<object>(instance, offset));
|
||||
return reinterpret_cast<int64_t>(fieldAtOffset<object>(instance, offset));
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
@ -291,28 +291,28 @@ Avian_java_lang_reflect_Field_setPrimitive
|
||||
|
||||
switch (code) {
|
||||
case ByteField:
|
||||
cast<int8_t>(instance, offset) = static_cast<int8_t>(value);
|
||||
fieldAtOffset<int8_t>(instance, offset) = static_cast<int8_t>(value);
|
||||
break;
|
||||
case BooleanField:
|
||||
cast<uint8_t>(instance, offset) = static_cast<uint8_t>(value);
|
||||
fieldAtOffset<uint8_t>(instance, offset) = static_cast<uint8_t>(value);
|
||||
break;
|
||||
case CharField:
|
||||
cast<uint16_t>(instance, offset) = static_cast<uint16_t>(value);
|
||||
fieldAtOffset<uint16_t>(instance, offset) = static_cast<uint16_t>(value);
|
||||
break;
|
||||
case ShortField:
|
||||
cast<int16_t>(instance, offset) = static_cast<int16_t>(value);
|
||||
fieldAtOffset<int16_t>(instance, offset) = static_cast<int16_t>(value);
|
||||
break;
|
||||
case IntField:
|
||||
cast<int32_t>(instance, offset) = static_cast<int32_t>(value);
|
||||
fieldAtOffset<int32_t>(instance, offset) = static_cast<int32_t>(value);
|
||||
break;
|
||||
case LongField:
|
||||
cast<int64_t>(instance, offset) = static_cast<int64_t>(value);
|
||||
fieldAtOffset<int64_t>(instance, offset) = static_cast<int64_t>(value);
|
||||
break;
|
||||
case FloatField:
|
||||
cast<uint32_t>(instance, offset) = static_cast<uint32_t>(value);
|
||||
fieldAtOffset<uint32_t>(instance, offset) = static_cast<uint32_t>(value);
|
||||
break;
|
||||
case DoubleField:
|
||||
cast<uint64_t>(instance, offset) = static_cast<uint64_t>(value);
|
||||
fieldAtOffset<uint64_t>(instance, offset) = static_cast<uint64_t>(value);
|
||||
break;
|
||||
default:
|
||||
abort(t);
|
||||
@ -379,7 +379,7 @@ Avian_java_lang_reflect_Array_getLength
|
||||
unsigned elementSize = classArrayElementSize(t, objectClass(t, array));
|
||||
|
||||
if (LIKELY(elementSize)) {
|
||||
return cast<uintptr_t>(array, BytesPerWord);
|
||||
return fieldAtOffset<uintptr_t>(array, BytesPerWord);
|
||||
} else {
|
||||
throwNew(t, Machine::IllegalArgumentExceptionType);
|
||||
}
|
||||
@ -666,7 +666,7 @@ Avian_avian_Atomic_compareAndSwapObject
|
||||
uintptr_t update = arguments[4];
|
||||
|
||||
bool success = atomicCompareAndSwap
|
||||
(&cast<uintptr_t>(target, offset), expect, update);
|
||||
(&fieldAtOffset<uintptr_t>(target, offset), expect, update);
|
||||
|
||||
if (success) {
|
||||
mark(t, target, offset);
|
||||
|
@ -77,14 +77,14 @@ arrayCopy(Thread* t, object src, int32_t srcOffset, object dst,
|
||||
unsigned elementSize = classArrayElementSize(t, objectClass(t, src));
|
||||
|
||||
if (LIKELY(elementSize)) {
|
||||
intptr_t sl = cast<uintptr_t>(src, BytesPerWord);
|
||||
intptr_t dl = cast<uintptr_t>(dst, BytesPerWord);
|
||||
intptr_t sl = fieldAtOffset<uintptr_t>(src, BytesPerWord);
|
||||
intptr_t dl = fieldAtOffset<uintptr_t>(dst, BytesPerWord);
|
||||
if (LIKELY(length > 0)) {
|
||||
if (LIKELY(srcOffset >= 0 and srcOffset + length <= sl and
|
||||
dstOffset >= 0 and dstOffset + length <= dl))
|
||||
{
|
||||
uint8_t* sbody = &cast<uint8_t>(src, ArrayBody);
|
||||
uint8_t* dbody = &cast<uint8_t>(dst, ArrayBody);
|
||||
uint8_t* sbody = &fieldAtOffset<uint8_t>(src, ArrayBody);
|
||||
uint8_t* dbody = &fieldAtOffset<uint8_t>(dst, ArrayBody);
|
||||
if (src == dst) {
|
||||
memmove(dbody + (dstOffset * elementSize),
|
||||
sbody + (srcOffset * elementSize),
|
||||
|
@ -709,7 +709,7 @@ class MyClasspath : public Classpath {
|
||||
set(t, classStaticTable(t, type(t, Machine::ClassLoaderType)),
|
||||
fieldOffset(t, scl), root(t, Machine::AppLoader));
|
||||
|
||||
cast<uint8_t>(classStaticTable(t, type(t, Machine::ClassLoaderType)),
|
||||
fieldAtOffset<uint8_t>(classStaticTable(t, type(t, Machine::ClassLoaderType)),
|
||||
fieldOffset(t, sclSet)) = true;
|
||||
}
|
||||
|
||||
@ -950,7 +950,7 @@ getFileAttributes
|
||||
MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);
|
||||
|
||||
object file = reinterpret_cast<object>(arguments[1]);
|
||||
object path = cast<object>(file, cp->filePathField);
|
||||
object path = fieldAtOffset<object>(file, cp->filePathField);
|
||||
|
||||
THREAD_RUNTIME_ARRAY(t, char, p, stringLength(t, path) + 1);
|
||||
stringChars(t, path, RUNTIME_ARRAY_BODY(p));
|
||||
@ -999,7 +999,7 @@ checkFileAccess
|
||||
|
||||
object file = reinterpret_cast<object>(arguments[1]);
|
||||
unsigned mask = arguments[2];
|
||||
object path = cast<object>(file, cp->filePathField);
|
||||
object path = fieldAtOffset<object>(file, cp->filePathField);
|
||||
|
||||
THREAD_RUNTIME_ARRAY(t, char, p, stringLength(t, path) + 1);
|
||||
stringChars(t, path, RUNTIME_ARRAY_BODY(p));
|
||||
@ -1045,7 +1045,7 @@ getFileLength
|
||||
MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);
|
||||
|
||||
object file = reinterpret_cast<object>(arguments[1]);
|
||||
object path = cast<object>(file, cp->filePathField);
|
||||
object path = fieldAtOffset<object>(file, cp->filePathField);
|
||||
|
||||
THREAD_RUNTIME_ARRAY(t, char, p, stringLength(t, path) + 1);
|
||||
stringChars(t, path, RUNTIME_ARRAY_BODY(p));
|
||||
@ -1131,8 +1131,8 @@ openFile(Thread* t, object method, uintptr_t* arguments)
|
||||
set(t, root(t, Machine::VirtualFiles), ArrayBody + (index * BytesPerWord),
|
||||
region);
|
||||
|
||||
cast<int32_t>
|
||||
(cast<object>
|
||||
fieldAtOffset<int32_t>
|
||||
(fieldAtOffset<object>
|
||||
(this_, cp->fileInputStreamFdField), cp->fileDescriptorFdField)
|
||||
= index + VirtualFileBase;
|
||||
} else {
|
||||
@ -1150,8 +1150,8 @@ readByteFromFile(Thread* t, object method, uintptr_t* arguments)
|
||||
|
||||
MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);
|
||||
|
||||
int fd = cast<int32_t>
|
||||
(cast<object>
|
||||
int fd = fieldAtOffset<int32_t>
|
||||
(fieldAtOffset<object>
|
||||
(this_, cp->fileInputStreamFdField), cp->fileDescriptorFdField);
|
||||
|
||||
if (fd >= VirtualFileBase) {
|
||||
@ -1191,8 +1191,8 @@ readBytesFromFile(Thread* t, object method, uintptr_t* arguments)
|
||||
|
||||
MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);
|
||||
|
||||
int fd = cast<int32_t>
|
||||
(cast<object>
|
||||
int fd = fieldAtOffset<int32_t>
|
||||
(fieldAtOffset<object>
|
||||
(this_, cp->fileInputStreamFdField), cp->fileDescriptorFdField);
|
||||
|
||||
if (fd >= VirtualFileBase) {
|
||||
@ -1243,8 +1243,8 @@ skipBytesInFile(Thread* t, object method, uintptr_t* arguments)
|
||||
|
||||
MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);
|
||||
|
||||
int fd = cast<int32_t>
|
||||
(cast<object>
|
||||
int fd = fieldAtOffset<int32_t>
|
||||
(fieldAtOffset<object>
|
||||
(this_, cp->fileInputStreamFdField), cp->fileDescriptorFdField);
|
||||
|
||||
if (fd >= VirtualFileBase) {
|
||||
@ -1284,8 +1284,8 @@ availableBytesInFile(Thread* t, object method, uintptr_t* arguments)
|
||||
|
||||
MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);
|
||||
|
||||
int fd = cast<int32_t>
|
||||
(cast<object>
|
||||
int fd = fieldAtOffset<int32_t>
|
||||
(fieldAtOffset<object>
|
||||
(this_, cp->fileInputStreamFdField), cp->fileDescriptorFdField);
|
||||
|
||||
if (fd >= VirtualFileBase) {
|
||||
@ -1317,8 +1317,8 @@ closeFile(Thread* t, object method, uintptr_t* arguments)
|
||||
|
||||
MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);
|
||||
|
||||
int fd = cast<int32_t>
|
||||
(cast<object>
|
||||
int fd = fieldAtOffset<int32_t>
|
||||
(fieldAtOffset<object>
|
||||
(this_, cp->fileInputStreamFdField), cp->fileDescriptorFdField);
|
||||
|
||||
if (fd >= VirtualFileBase) {
|
||||
@ -1623,15 +1623,15 @@ initializeZipEntryFields(Thread* t, object method, uintptr_t* arguments)
|
||||
|
||||
set(t, this_, cp->zipEntryNameField, name);
|
||||
|
||||
cast<int64_t>(this_, cp->zipEntryTimeField)
|
||||
fieldAtOffset<int64_t>(this_, cp->zipEntryTimeField)
|
||||
= fileTime(entry->start);
|
||||
cast<int64_t>(this_, cp->zipEntryCrcField)
|
||||
fieldAtOffset<int64_t>(this_, cp->zipEntryCrcField)
|
||||
= fileCRC(entry->start);
|
||||
cast<int64_t>(this_, cp->zipEntrySizeField)
|
||||
fieldAtOffset<int64_t>(this_, cp->zipEntrySizeField)
|
||||
= uncompressedSize(entry->start);
|
||||
cast<int64_t>(this_, cp->zipEntryCsizeField)
|
||||
fieldAtOffset<int64_t>(this_, cp->zipEntryCsizeField)
|
||||
= compressedSize(entry->start);
|
||||
cast<int64_t>(this_, cp->zipEntryMethodField)
|
||||
fieldAtOffset<int64_t>(this_, cp->zipEntryMethodField)
|
||||
= compressionMethod(entry->start);
|
||||
} else {
|
||||
t->m->processor->invoke
|
||||
@ -1771,7 +1771,7 @@ getJarFileMetaInfEntryNames(Thread* t, object method, uintptr_t* arguments)
|
||||
|
||||
MyClasspath* cp = static_cast<MyClasspath*>(t->m->classpath);
|
||||
|
||||
int64_t peer = cast<int64_t>(this_, cp->zipFileJzfileField);
|
||||
int64_t peer = fieldAtOffset<int64_t>(this_, cp->zipFileJzfileField);
|
||||
ZipFile* file = reinterpret_cast<ZipFile*>(peer);
|
||||
if (file->region) {
|
||||
return 0;
|
||||
@ -2839,7 +2839,7 @@ Avian_sun_misc_Unsafe_getObject
|
||||
object o = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
|
||||
return cast<uintptr_t>(o, offset);
|
||||
return fieldAtOffset<uintptr_t>(o, offset);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
@ -2860,7 +2860,7 @@ Avian_sun_misc_Unsafe_getShort__Ljava_lang_Object_2J
|
||||
object o = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
|
||||
return cast<int16_t>(o, offset);
|
||||
return fieldAtOffset<int16_t>(o, offset);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -2870,7 +2870,7 @@ Avian_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J
|
||||
object o = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
|
||||
return cast<int32_t>(o, offset);
|
||||
return fieldAtOffset<int32_t>(o, offset);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -2880,7 +2880,7 @@ Avian_sun_misc_Unsafe_getFloat__Ljava_lang_Object_2J
|
||||
object o = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
|
||||
return cast<int32_t>(o, offset);
|
||||
return fieldAtOffset<int32_t>(o, offset);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -2890,7 +2890,7 @@ Avian_sun_misc_Unsafe_getIntVolatile
|
||||
object o = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
|
||||
int32_t result = cast<int32_t>(o, offset);
|
||||
int32_t result = fieldAtOffset<int32_t>(o, offset);
|
||||
loadMemoryBarrier();
|
||||
return result;
|
||||
}
|
||||
@ -2902,7 +2902,7 @@ Avian_sun_misc_Unsafe_getLong__Ljava_lang_Object_2J
|
||||
object o = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
|
||||
return cast<int64_t>(o, offset);
|
||||
return fieldAtOffset<int64_t>(o, offset);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -2928,7 +2928,7 @@ Avian_sun_misc_Unsafe_getLongVolatile
|
||||
acquire(t, field);
|
||||
}
|
||||
|
||||
int64_t result = cast<int64_t>(o, offset);
|
||||
int64_t result = fieldAtOffset<int64_t>(o, offset);
|
||||
|
||||
if (BytesPerWord < 8) {
|
||||
release(t, field);
|
||||
@ -2947,7 +2947,7 @@ Avian_sun_misc_Unsafe_putByte__Ljava_lang_Object_2JB
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
int8_t value = arguments[4];
|
||||
|
||||
cast<int8_t>(o, offset) = value;
|
||||
fieldAtOffset<int8_t>(o, offset) = value;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
@ -2958,7 +2958,7 @@ Avian_sun_misc_Unsafe_putShort__Ljava_lang_Object_2JS
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
int16_t value = arguments[4];
|
||||
|
||||
cast<int16_t>(o, offset) = value;
|
||||
fieldAtOffset<int16_t>(o, offset) = value;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
@ -2969,7 +2969,7 @@ Avian_sun_misc_Unsafe_putInt__Ljava_lang_Object_2JI
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
int32_t value = arguments[4];
|
||||
|
||||
cast<int32_t>(o, offset) = value;
|
||||
fieldAtOffset<int32_t>(o, offset) = value;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
@ -2980,7 +2980,7 @@ Avian_sun_misc_Unsafe_putFloat__Ljava_lang_Object_2JF
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
int32_t value = arguments[4];
|
||||
|
||||
cast<int32_t>(o, offset) = value;
|
||||
fieldAtOffset<int32_t>(o, offset) = value;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -2990,7 +2990,7 @@ Avian_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J
|
||||
object o = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
|
||||
return cast<int8_t>(o, offset);
|
||||
return fieldAtOffset<int8_t>(o, offset);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -3009,7 +3009,7 @@ Avian_sun_misc_Unsafe_putBoolean__Ljava_lang_Object_2JZ
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
uint8_t value = arguments[4];
|
||||
|
||||
cast<uint8_t>(o, offset) = value;
|
||||
fieldAtOffset<uint8_t>(o, offset) = value;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
@ -3020,7 +3020,7 @@ Avian_sun_misc_Unsafe_putLong__Ljava_lang_Object_2JJ
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
int64_t value; memcpy(&value, arguments + 4, 8);
|
||||
|
||||
cast<int64_t>(o, offset) = value;
|
||||
fieldAtOffset<int64_t>(o, offset) = value;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -3030,7 +3030,7 @@ Avian_sun_misc_Unsafe_getObjectVolatile
|
||||
object o = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
|
||||
uintptr_t value = cast<uintptr_t>(o, offset);
|
||||
uintptr_t value = fieldAtOffset<uintptr_t>(o, offset);
|
||||
loadMemoryBarrier();
|
||||
return value;
|
||||
}
|
||||
@ -3065,7 +3065,7 @@ Avian_sun_misc_Unsafe_compareAndSwapInt
|
||||
uint32_t update = arguments[5];
|
||||
|
||||
return atomicCompareAndSwap32
|
||||
(&cast<uint32_t>(target, offset), expect, update);
|
||||
(&fieldAtOffset<uint32_t>(target, offset), expect, update);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -3078,7 +3078,7 @@ Avian_sun_misc_Unsafe_compareAndSwapObject
|
||||
uintptr_t update = arguments[5];
|
||||
|
||||
bool success = atomicCompareAndSwap
|
||||
(&cast<uintptr_t>(target, offset), expect, update);
|
||||
(&fieldAtOffset<uintptr_t>(target, offset), expect, update);
|
||||
|
||||
if (success) {
|
||||
mark(t, target, offset);
|
||||
@ -3098,11 +3098,11 @@ Avian_sun_misc_Unsafe_compareAndSwapLong
|
||||
|
||||
#ifdef AVIAN_HAS_CAS64
|
||||
return atomicCompareAndSwap64
|
||||
(&cast<uint64_t>(target, offset), expect, update);
|
||||
(&fieldAtOffset<uint64_t>(target, offset), expect, update);
|
||||
#else
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, local::fieldForOffset(t, target, offset));
|
||||
if (cast<uint64_t>(target, offset) == expect) {
|
||||
cast<uint64_t>(target, offset) = update;
|
||||
if (fieldAtOffset<uint64_t>(target, offset) == expect) {
|
||||
fieldAtOffset<uint64_t>(target, offset) = update;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -3999,7 +3999,7 @@ EXPORT(JVM_GetArrayLength)(Thread* t, jobject array)
|
||||
{
|
||||
ENTER(t, Thread::ActiveState);
|
||||
|
||||
return cast<uintptr_t>(*array, BytesPerWord);
|
||||
return fieldAtOffset<uintptr_t>(*array, BytesPerWord);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
@ -4012,40 +4012,40 @@ jvmGetArrayElement(Thread* t, uintptr_t* arguments)
|
||||
case 'Z':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, makeBoolean(t, cast<int8_t>(*array, ArrayBody + index))));
|
||||
(t, makeBoolean(t, fieldAtOffset<int8_t>(*array, ArrayBody + index))));
|
||||
case 'B':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, makeByte(t, cast<int8_t>(*array, ArrayBody + index))));
|
||||
(t, makeByte(t, fieldAtOffset<int8_t>(*array, ArrayBody + index))));
|
||||
case 'C':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, makeChar(t, cast<int16_t>(*array, ArrayBody + (index * 2)))));
|
||||
(t, makeChar(t, fieldAtOffset<int16_t>(*array, ArrayBody + (index * 2)))));
|
||||
case 'S':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, makeShort(t, cast<int16_t>(*array, ArrayBody + (index * 2)))));
|
||||
(t, makeShort(t, fieldAtOffset<int16_t>(*array, ArrayBody + (index * 2)))));
|
||||
case 'I':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, makeInt(t, cast<int32_t>(*array, ArrayBody + (index * 4)))));
|
||||
(t, makeInt(t, fieldAtOffset<int32_t>(*array, ArrayBody + (index * 4)))));
|
||||
case 'F':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, makeFloat(t, cast<int32_t>(*array, ArrayBody + (index * 4)))));
|
||||
(t, makeFloat(t, fieldAtOffset<int32_t>(*array, ArrayBody + (index * 4)))));
|
||||
case 'J':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, makeLong(t, cast<int64_t>(*array, ArrayBody + (index * 8)))));
|
||||
(t, makeLong(t, fieldAtOffset<int64_t>(*array, ArrayBody + (index * 8)))));
|
||||
case 'D':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, makeDouble(t, cast<int64_t>(*array, ArrayBody + (index * 8)))));
|
||||
(t, makeDouble(t, fieldAtOffset<int64_t>(*array, ArrayBody + (index * 8)))));
|
||||
case 'L':
|
||||
case '[':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, cast<object>(*array, ArrayBody + (index * BytesPerWord))));
|
||||
(t, fieldAtOffset<object>(*array, ArrayBody + (index * BytesPerWord))));
|
||||
default:
|
||||
abort(t);
|
||||
}
|
||||
@ -4071,28 +4071,28 @@ EXPORT(JVM_SetArrayElement)(Thread* t, jobject array, jint index,
|
||||
|
||||
switch (byteArrayBody(t, className(t, objectClass(t, *array)), 1)) {
|
||||
case 'Z':
|
||||
cast<int8_t>(*array, ArrayBody + index) = booleanValue(t, *value);
|
||||
fieldAtOffset<int8_t>(*array, ArrayBody + index) = booleanValue(t, *value);
|
||||
break;
|
||||
case 'B':
|
||||
cast<int8_t>(*array, ArrayBody + index) = byteValue(t, *value);
|
||||
fieldAtOffset<int8_t>(*array, ArrayBody + index) = byteValue(t, *value);
|
||||
break;
|
||||
case 'C':
|
||||
cast<int16_t>(*array, ArrayBody + (index * 2)) = charValue(t, *value);
|
||||
fieldAtOffset<int16_t>(*array, ArrayBody + (index * 2)) = charValue(t, *value);
|
||||
break;
|
||||
case 'S':
|
||||
cast<int16_t>(*array, ArrayBody + (index * 2)) = shortValue(t, *value);
|
||||
fieldAtOffset<int16_t>(*array, ArrayBody + (index * 2)) = shortValue(t, *value);
|
||||
break;
|
||||
case 'I':
|
||||
cast<int32_t>(*array, ArrayBody + (index * 4)) = intValue(t, *value);
|
||||
fieldAtOffset<int32_t>(*array, ArrayBody + (index * 4)) = intValue(t, *value);
|
||||
break;
|
||||
case 'F':
|
||||
cast<int32_t>(*array, ArrayBody + (index * 4)) = floatValue(t, *value);
|
||||
fieldAtOffset<int32_t>(*array, ArrayBody + (index * 4)) = floatValue(t, *value);
|
||||
break;
|
||||
case 'J':
|
||||
cast<int64_t>(*array, ArrayBody + (index * 8)) = longValue(t, *value);
|
||||
fieldAtOffset<int64_t>(*array, ArrayBody + (index * 8)) = longValue(t, *value);
|
||||
break;
|
||||
case 'D':
|
||||
cast<int64_t>(*array, ArrayBody + (index * 8)) = doubleValue(t, *value);
|
||||
fieldAtOffset<int64_t>(*array, ArrayBody + (index * 8)) = doubleValue(t, *value);
|
||||
break;
|
||||
case 'L':
|
||||
case '[':
|
||||
@ -5059,7 +5059,7 @@ jvmConstantPoolGetUTF8At(Thread* t, uintptr_t* arguments)
|
||||
return reinterpret_cast<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, t->m->classpath->makeString
|
||||
(t, array, 0, cast<uintptr_t>(array, BytesPerWord) - 1)));
|
||||
(t, array, 0, fieldAtOffset<uintptr_t>(array, BytesPerWord) - 1)));
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jstring JNICALL
|
||||
|
@ -476,7 +476,7 @@ getBits(T* map, unsigned bitsPerRecord, unsigned index)
|
||||
|
||||
template <class T>
|
||||
inline T&
|
||||
cast(void* p, unsigned offset)
|
||||
fieldAtOffset(void* p, unsigned offset)
|
||||
{
|
||||
return *reinterpret_cast<T*>(static_cast<uint8_t*>(p) + offset);
|
||||
}
|
||||
|
@ -3047,22 +3047,22 @@ getFieldValue(Thread* t, object target, object field)
|
||||
switch (fieldCode(t, field)) {
|
||||
case ByteField:
|
||||
case BooleanField:
|
||||
return cast<int8_t>(target, fieldOffset(t, field));
|
||||
return fieldAtOffset<int8_t>(target, fieldOffset(t, field));
|
||||
|
||||
case CharField:
|
||||
case ShortField:
|
||||
return cast<int16_t>(target, fieldOffset(t, field));
|
||||
return fieldAtOffset<int16_t>(target, fieldOffset(t, field));
|
||||
|
||||
case FloatField:
|
||||
case IntField:
|
||||
return cast<int32_t>(target, fieldOffset(t, field));
|
||||
return fieldAtOffset<int32_t>(target, fieldOffset(t, field));
|
||||
|
||||
case DoubleField:
|
||||
case LongField:
|
||||
return cast<int64_t>(target, fieldOffset(t, field));
|
||||
return fieldAtOffset<int64_t>(target, fieldOffset(t, field));
|
||||
|
||||
case ObjectField:
|
||||
return cast<intptr_t>(target, fieldOffset(t, field));
|
||||
return fieldAtOffset<intptr_t>(target, fieldOffset(t, field));
|
||||
|
||||
default:
|
||||
abort(t);
|
||||
@ -3105,7 +3105,7 @@ setStaticLongFieldValueFromReference(MyThread* t, object pair, uint64_t value)
|
||||
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<int64_t>
|
||||
fieldAtOffset<int64_t>
|
||||
(classStaticTable(t, fieldClass(t, field)), fieldOffset(t, field)) = value;
|
||||
}
|
||||
|
||||
@ -3120,7 +3120,7 @@ setLongFieldValueFromReference(MyThread* t, object pair, object instance,
|
||||
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<int64_t>(instance, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int64_t>(instance, fieldOffset(t, field)) = value;
|
||||
}
|
||||
|
||||
void
|
||||
@ -3160,17 +3160,17 @@ setFieldValue(MyThread* t, object target, object field, uint32_t value)
|
||||
switch (fieldCode(t, field)) {
|
||||
case ByteField:
|
||||
case BooleanField:
|
||||
cast<int8_t>(target, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int8_t>(target, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
|
||||
case CharField:
|
||||
case ShortField:
|
||||
cast<int16_t>(target, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int16_t>(target, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
|
||||
case FloatField:
|
||||
case IntField:
|
||||
cast<int32_t>(target, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int32_t>(target, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -8498,11 +8498,11 @@ class ArgumentList {
|
||||
|
||||
case 'J':
|
||||
case 'D':
|
||||
addLong(cast<int64_t>(objectArrayBody(t, arguments, index++), 8));
|
||||
addLong(fieldAtOffset<int64_t>(objectArrayBody(t, arguments, index++), 8));
|
||||
break;
|
||||
|
||||
default:
|
||||
addInt(cast<int32_t>(objectArrayBody(t, arguments, index++),
|
||||
addInt(fieldAtOffset<int32_t>(objectArrayBody(t, arguments, index++),
|
||||
BytesPerWord));
|
||||
break;
|
||||
}
|
||||
|
12
src/heap.cpp
12
src/heap.cpp
@ -80,13 +80,13 @@ markBitAtomic(uintptr_t* map, unsigned i)
|
||||
inline void*
|
||||
get(void* o, unsigned offsetInWords)
|
||||
{
|
||||
return maskAlignedPointer(cast<void*>(o, offsetInWords * BytesPerWord));
|
||||
return maskAlignedPointer(fieldAtOffset<void*>(o, offsetInWords * BytesPerWord));
|
||||
}
|
||||
|
||||
inline void**
|
||||
getp(void* o, unsigned offsetInWords)
|
||||
{
|
||||
return &cast<void*>(o, offsetInWords * BytesPerWord);
|
||||
return &fieldAtOffset<void*>(o, offsetInWords * BytesPerWord);
|
||||
}
|
||||
|
||||
inline void
|
||||
@ -862,21 +862,21 @@ inline void*
|
||||
follow(Context* c UNUSED, void* o)
|
||||
{
|
||||
assert(c, wasCollected(c, o));
|
||||
return cast<void*>(o, 0);
|
||||
return fieldAtOffset<void*>(o, 0);
|
||||
}
|
||||
|
||||
inline void*&
|
||||
parent(Context* c UNUSED, void* o)
|
||||
{
|
||||
assert(c, wasCollected(c, o));
|
||||
return cast<void*>(o, BytesPerWord);
|
||||
return fieldAtOffset<void*>(o, BytesPerWord);
|
||||
}
|
||||
|
||||
inline uintptr_t*
|
||||
bitset(Context* c UNUSED, void* o)
|
||||
{
|
||||
assert(c, wasCollected(c, o));
|
||||
return &cast<uintptr_t>(o, BytesPerWord * 2);
|
||||
return &fieldAtOffset<uintptr_t>(o, BytesPerWord * 2);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1059,7 +1059,7 @@ copy(Context* c, void* o)
|
||||
}
|
||||
|
||||
// leave a pointer to the copy in the original
|
||||
cast<void*>(o, 0) = r;
|
||||
fieldAtOffset<void*>(o, 0) = r;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ inline object
|
||||
get(object o, unsigned offsetInWords)
|
||||
{
|
||||
return static_cast<object>
|
||||
(mask(cast<void*>(o, offsetInWords * BytesPerWord)));
|
||||
(mask(fieldAtOffset<void*>(o, offsetInWords * BytesPerWord)));
|
||||
}
|
||||
|
||||
unsigned
|
||||
|
@ -733,26 +733,26 @@ pushField(Thread* t, object target, object field)
|
||||
switch (fieldCode(t, field)) {
|
||||
case ByteField:
|
||||
case BooleanField:
|
||||
pushInt(t, cast<int8_t>(target, fieldOffset(t, field)));
|
||||
pushInt(t, fieldAtOffset<int8_t>(target, fieldOffset(t, field)));
|
||||
break;
|
||||
|
||||
case CharField:
|
||||
case ShortField:
|
||||
pushInt(t, cast<int16_t>(target, fieldOffset(t, field)));
|
||||
pushInt(t, fieldAtOffset<int16_t>(target, fieldOffset(t, field)));
|
||||
break;
|
||||
|
||||
case FloatField:
|
||||
case IntField:
|
||||
pushInt(t, cast<int32_t>(target, fieldOffset(t, field)));
|
||||
pushInt(t, fieldAtOffset<int32_t>(target, fieldOffset(t, field)));
|
||||
break;
|
||||
|
||||
case DoubleField:
|
||||
case LongField:
|
||||
pushLong(t, cast<int64_t>(target, fieldOffset(t, field)));
|
||||
pushLong(t, fieldAtOffset<int64_t>(target, fieldOffset(t, field)));
|
||||
break;
|
||||
|
||||
case ObjectField:
|
||||
pushObject(t, cast<object>(target, fieldOffset(t, field)));
|
||||
pushObject(t, fieldAtOffset<object>(target, fieldOffset(t, field)));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -902,7 +902,7 @@ interpret3(Thread* t, const int base)
|
||||
case arraylength: {
|
||||
object array = popObject(t);
|
||||
if (LIKELY(array)) {
|
||||
pushInt(t, cast<uintptr_t>(array, BytesPerWord));
|
||||
pushInt(t, fieldAtOffset<uintptr_t>(array, BytesPerWord));
|
||||
} else {
|
||||
exception = makeThrowable(t, Machine::NullPointerExceptionType);
|
||||
goto throw_;
|
||||
@ -2436,17 +2436,17 @@ interpret3(Thread* t, const int base)
|
||||
switch (fieldCode(t, field)) {
|
||||
case ByteField:
|
||||
case BooleanField:
|
||||
cast<int8_t>(o, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int8_t>(o, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
|
||||
case CharField:
|
||||
case ShortField:
|
||||
cast<int16_t>(o, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int16_t>(o, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
|
||||
case FloatField:
|
||||
case IntField:
|
||||
cast<int32_t>(o, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int32_t>(o, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -2459,7 +2459,7 @@ interpret3(Thread* t, const int base)
|
||||
int64_t value = popLong(t);
|
||||
object o = popObject(t);
|
||||
if (LIKELY(o)) {
|
||||
cast<int64_t>(o, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int64_t>(o, fieldOffset(t, field)) = value;
|
||||
} else {
|
||||
exception = makeThrowable(t, Machine::NullPointerExceptionType);
|
||||
}
|
||||
@ -2510,24 +2510,24 @@ interpret3(Thread* t, const int base)
|
||||
switch (fieldCode(t, field)) {
|
||||
case ByteField:
|
||||
case BooleanField:
|
||||
cast<int8_t>(table, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int8_t>(table, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
|
||||
case CharField:
|
||||
case ShortField:
|
||||
cast<int16_t>(table, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int16_t>(table, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
|
||||
case FloatField:
|
||||
case IntField:
|
||||
cast<int32_t>(table, fieldOffset(t, field)) = value;
|
||||
fieldAtOffset<int32_t>(table, fieldOffset(t, field)) = value;
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
|
||||
case DoubleField:
|
||||
case LongField: {
|
||||
cast<int64_t>(table, fieldOffset(t, field)) = popLong(t);
|
||||
fieldAtOffset<int64_t>(table, fieldOffset(t, field)) = popLong(t);
|
||||
} break;
|
||||
|
||||
case ObjectField: {
|
||||
@ -2850,11 +2850,11 @@ pushArguments(Thread* t, object this_, const char* spec, object a)
|
||||
|
||||
case 'J':
|
||||
case 'D':
|
||||
pushLong(t, cast<int64_t>(objectArrayBody(t, a, index++), 8));
|
||||
pushLong(t, fieldAtOffset<int64_t>(objectArrayBody(t, a, index++), 8));
|
||||
break;
|
||||
|
||||
default:
|
||||
pushInt(t, cast<int32_t>(objectArrayBody(t, a, index++),
|
||||
pushInt(t, fieldAtOffset<int32_t>(objectArrayBody(t, a, index++),
|
||||
BytesPerWord));
|
||||
break;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ GetArrayLength(Thread* t, jarray array)
|
||||
{
|
||||
ENTER(t, Thread::ActiveState);
|
||||
|
||||
return cast<uintptr_t>(*array, BytesPerWord);
|
||||
return fieldAtOffset<uintptr_t>(*array, BytesPerWord);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
@ -271,7 +271,7 @@ newStringUTF(Thread* t, uintptr_t* arguments)
|
||||
return reinterpret_cast<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, t->m->classpath->makeString
|
||||
(t, array, 0, cast<uintptr_t>(array, BytesPerWord) - 1)));
|
||||
(t, array, 0, fieldAtOffset<uintptr_t>(array, BytesPerWord) - 1)));
|
||||
}
|
||||
|
||||
jstring JNICALL
|
||||
@ -1532,7 +1532,7 @@ getObjectField(Thread* t, uintptr_t* arguments)
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return reinterpret_cast<uintptr_t>
|
||||
(makeLocalReference(t, cast<object>(*o, fieldOffset(t, field))));
|
||||
(makeLocalReference(t, fieldAtOffset<object>(*o, fieldOffset(t, field))));
|
||||
}
|
||||
|
||||
jobject JNICALL
|
||||
@ -1553,7 +1553,7 @@ getBooleanField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jboolean>(*o, fieldOffset(t, field));
|
||||
return fieldAtOffset<jboolean>(*o, fieldOffset(t, field));
|
||||
}
|
||||
|
||||
jboolean JNICALL
|
||||
@ -1574,7 +1574,7 @@ getByteField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jbyte>(*o, fieldOffset(t, field));
|
||||
return fieldAtOffset<jbyte>(*o, fieldOffset(t, field));
|
||||
}
|
||||
|
||||
jbyte JNICALL
|
||||
@ -1595,7 +1595,7 @@ getCharField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jchar>(*o, fieldOffset(t, field));
|
||||
return fieldAtOffset<jchar>(*o, fieldOffset(t, field));
|
||||
}
|
||||
|
||||
jchar JNICALL
|
||||
@ -1616,7 +1616,7 @@ getShortField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jshort>(*o, fieldOffset(t, field));
|
||||
return fieldAtOffset<jshort>(*o, fieldOffset(t, field));
|
||||
}
|
||||
|
||||
jshort JNICALL
|
||||
@ -1637,7 +1637,7 @@ getIntField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jint>(*o, fieldOffset(t, field));
|
||||
return fieldAtOffset<jint>(*o, fieldOffset(t, field));
|
||||
}
|
||||
|
||||
jint JNICALL
|
||||
@ -1658,7 +1658,7 @@ getLongField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jlong>(*o, fieldOffset(t, field));
|
||||
return fieldAtOffset<jlong>(*o, fieldOffset(t, field));
|
||||
}
|
||||
|
||||
jlong JNICALL
|
||||
@ -1679,7 +1679,7 @@ getFloatField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return floatToBits(cast<jfloat>(*o, fieldOffset(t, field)));
|
||||
return floatToBits(fieldAtOffset<jfloat>(*o, fieldOffset(t, field)));
|
||||
}
|
||||
|
||||
jfloat JNICALL
|
||||
@ -1700,7 +1700,7 @@ getDoubleField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return doubleToBits(cast<jdouble>(*o, fieldOffset(t, field)));
|
||||
return doubleToBits(fieldAtOffset<jdouble>(*o, fieldOffset(t, field)));
|
||||
}
|
||||
|
||||
jdouble JNICALL
|
||||
@ -1747,7 +1747,7 @@ setBooleanField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jboolean>(*o, fieldOffset(t, field)) = v;
|
||||
fieldAtOffset<jboolean>(*o, fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1772,7 +1772,7 @@ setByteField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jbyte>(*o, fieldOffset(t, field)) = v;
|
||||
fieldAtOffset<jbyte>(*o, fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1797,7 +1797,7 @@ setCharField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jchar>(*o, fieldOffset(t, field)) = v;
|
||||
fieldAtOffset<jchar>(*o, fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1822,7 +1822,7 @@ setShortField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jshort>(*o, fieldOffset(t, field)) = v;
|
||||
fieldAtOffset<jshort>(*o, fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1847,7 +1847,7 @@ setIntField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jint>(*o, fieldOffset(t, field)) = v;
|
||||
fieldAtOffset<jint>(*o, fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1872,7 +1872,7 @@ setLongField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jlong>(*o, fieldOffset(t, field)) = v;
|
||||
fieldAtOffset<jlong>(*o, fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1898,7 +1898,7 @@ setFloatField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jfloat>(*o, fieldOffset(t, field)) = v;
|
||||
fieldAtOffset<jfloat>(*o, fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1923,7 +1923,7 @@ setDoubleField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jdouble>(*o, fieldOffset(t, field)) = v;
|
||||
fieldAtOffset<jdouble>(*o, fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1965,7 +1965,7 @@ getStaticObjectField(Thread* t, uintptr_t* arguments)
|
||||
|
||||
return reinterpret_cast<uintptr_t>
|
||||
(makeLocalReference
|
||||
(t, cast<object>
|
||||
(t, fieldAtOffset<object>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field))));
|
||||
}
|
||||
|
||||
@ -1990,7 +1990,7 @@ getStaticBooleanField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jboolean>
|
||||
return fieldAtOffset<jboolean>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field));
|
||||
}
|
||||
|
||||
@ -2015,7 +2015,7 @@ getStaticByteField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jbyte>
|
||||
return fieldAtOffset<jbyte>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field));
|
||||
}
|
||||
|
||||
@ -2040,7 +2040,7 @@ getStaticCharField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jchar>
|
||||
return fieldAtOffset<jchar>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field));
|
||||
}
|
||||
|
||||
@ -2065,7 +2065,7 @@ getStaticShortField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jshort>
|
||||
return fieldAtOffset<jshort>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field));
|
||||
}
|
||||
|
||||
@ -2090,7 +2090,7 @@ getStaticIntField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jint>
|
||||
return fieldAtOffset<jint>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field));
|
||||
}
|
||||
|
||||
@ -2115,7 +2115,7 @@ getStaticLongField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return cast<jlong>
|
||||
return fieldAtOffset<jlong>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field));
|
||||
}
|
||||
|
||||
@ -2141,7 +2141,7 @@ getStaticFloatField(Thread* t, uintptr_t* arguments)
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return floatToBits
|
||||
(cast<jfloat>
|
||||
(fieldAtOffset<jfloat>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)));
|
||||
}
|
||||
|
||||
@ -2167,7 +2167,7 @@ getStaticDoubleField(Thread* t, uintptr_t* arguments)
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return doubleToBits
|
||||
(cast<jdouble>
|
||||
(fieldAtOffset<jdouble>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)));
|
||||
}
|
||||
|
||||
@ -2222,7 +2222,7 @@ setStaticBooleanField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jboolean>
|
||||
fieldAtOffset<jboolean>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
@ -2251,7 +2251,7 @@ setStaticByteField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jbyte>
|
||||
fieldAtOffset<jbyte>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
@ -2280,7 +2280,7 @@ setStaticCharField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jchar>
|
||||
fieldAtOffset<jchar>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
@ -2309,7 +2309,7 @@ setStaticShortField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jshort>
|
||||
fieldAtOffset<jshort>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
@ -2338,7 +2338,7 @@ setStaticIntField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jint>
|
||||
fieldAtOffset<jint>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
@ -2367,7 +2367,7 @@ setStaticLongField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jlong>
|
||||
fieldAtOffset<jlong>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
@ -2397,7 +2397,7 @@ setStaticFloatField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jfloat>
|
||||
fieldAtOffset<jfloat>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
@ -2426,7 +2426,7 @@ setStaticDoubleField(Thread* t, uintptr_t* arguments)
|
||||
PROTECT(t, field);
|
||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||
|
||||
cast<jdouble>
|
||||
fieldAtOffset<jdouble>
|
||||
(classStaticTable(t, jclassVmClass(t, *c)), fieldOffset(t, field)) = v;
|
||||
|
||||
return 1;
|
||||
|
@ -924,7 +924,7 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, object pool, unsigned i)
|
||||
|
||||
object value = parseUtf8(t, singletonObject(t, pool, si));
|
||||
value = t->m->classpath->makeString
|
||||
(t, value, 0, cast<uintptr_t>(value, BytesPerWord) - 1);
|
||||
(t, value, 0, fieldAtOffset<uintptr_t>(value, BytesPerWord) - 1);
|
||||
value = intern(t, value);
|
||||
set(t, pool, SingletonBody + (i * BytesPerWord), value);
|
||||
|
||||
@ -3466,7 +3466,7 @@ allocate3(Thread* t, Allocator* allocator, Machine::AllocationType type,
|
||||
|
||||
object o = reinterpret_cast<object>(t->backupHeap + t->backupHeapIndex);
|
||||
t->backupHeapIndex += ceilingDivide(sizeInBytes, BytesPerWord);
|
||||
cast<object>(o, 0) = 0;
|
||||
fieldAtOffset<object>(o, 0) = 0;
|
||||
return o;
|
||||
} else if (UNLIKELY(t->flags & Thread::TracingFlag)) {
|
||||
expect(t, t->heapIndex + ceilingDivide(sizeInBytes, BytesPerWord)
|
||||
@ -4670,7 +4670,7 @@ walk(Thread* t, Heap::Walker* w, object o, unsigned start)
|
||||
unsigned arrayElementSize = classArrayElementSize(t, class_);
|
||||
unsigned arrayLength
|
||||
= (arrayElementSize ?
|
||||
cast<uintptr_t>(o, fixedSize - BytesPerWord) : 0);
|
||||
fieldAtOffset<uintptr_t>(o, fixedSize - BytesPerWord) : 0);
|
||||
|
||||
THREAD_RUNTIME_ARRAY(t, uint32_t, mask, intArrayLength(t, objectMask));
|
||||
memcpy(RUNTIME_ARRAY_BODY(mask), &intArrayBody(t, objectMask, 0),
|
||||
|
@ -1611,7 +1611,7 @@ typedef uint64_t (JNICALL *FastNativeFunction)(Thread*, object, uintptr_t*);
|
||||
inline object
|
||||
objectClass(Thread*, object o)
|
||||
{
|
||||
return maskAlignedPointer(cast<object>(o, 0));
|
||||
return maskAlignedPointer(fieldAtOffset<object>(o, 0));
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
@ -1883,18 +1883,18 @@ mark(Thread* t, object o, unsigned offset)
|
||||
inline void
|
||||
set(Thread* t, object target, unsigned offset, object value)
|
||||
{
|
||||
cast<object>(target, offset) = value;
|
||||
fieldAtOffset<object>(target, offset) = value;
|
||||
mark(t, target, offset);
|
||||
}
|
||||
|
||||
inline void
|
||||
setObjectClass(Thread*, object o, object value)
|
||||
{
|
||||
cast<object>(o, 0)
|
||||
fieldAtOffset<object>(o, 0)
|
||||
= reinterpret_cast<object>
|
||||
(reinterpret_cast<intptr_alias_t>(value)
|
||||
| (reinterpret_cast<intptr_alias_t>
|
||||
(cast<object>(o, 0)) & (~PointerMask)));
|
||||
(fieldAtOffset<object>(o, 0)) & (~PointerMask)));
|
||||
}
|
||||
|
||||
inline const char*
|
||||
@ -2151,7 +2151,7 @@ baseSize(Thread* t, object o, object class_)
|
||||
|
||||
return ceilingDivide(classFixedSize(t, class_), BytesPerWord)
|
||||
+ ceilingDivide(classArrayElementSize(t, class_)
|
||||
* cast<uintptr_t>(o, classFixedSize(t, class_) - BytesPerWord),
|
||||
* fieldAtOffset<uintptr_t>(o, classFixedSize(t, class_) - BytesPerWord),
|
||||
BytesPerWord);
|
||||
}
|
||||
|
||||
@ -2290,7 +2290,7 @@ inline uintptr_t&
|
||||
extendedWord(Thread* t UNUSED, object o, unsigned baseSize)
|
||||
{
|
||||
assert(t, objectExtended(t, o));
|
||||
return cast<uintptr_t>(o, baseSize * BytesPerWord);
|
||||
return fieldAtOffset<uintptr_t>(o, baseSize * BytesPerWord);
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
@ -2792,7 +2792,7 @@ objectArrayLength(Thread* t UNUSED, object array)
|
||||
{
|
||||
assert(t, classFixedSize(t, objectClass(t, array)) == BytesPerWord * 2);
|
||||
assert(t, classArrayElementSize(t, objectClass(t, array)) == BytesPerWord);
|
||||
return cast<uintptr_t>(array, BytesPerWord);
|
||||
return fieldAtOffset<uintptr_t>(array, BytesPerWord);
|
||||
}
|
||||
|
||||
inline object&
|
||||
@ -2803,7 +2803,7 @@ objectArrayBody(Thread* t UNUSED, object array, unsigned index)
|
||||
assert(t, classObjectMask(t, objectClass(t, array))
|
||||
== classObjectMask(t, arrayBody
|
||||
(t, t->m->types, Machine::ArrayType)));
|
||||
return cast<object>(array, ArrayBody + (index * BytesPerWord));
|
||||
return fieldAtOffset<object>(array, ArrayBody + (index * BytesPerWord));
|
||||
}
|
||||
|
||||
unsigned
|
||||
@ -2839,7 +2839,7 @@ inline bool
|
||||
atomicCompareAndSwapObject(Thread* t, object target, unsigned offset,
|
||||
object old, object new_)
|
||||
{
|
||||
if (atomicCompareAndSwap(&cast<uintptr_t>(target, offset),
|
||||
if (atomicCompareAndSwap(&fieldAtOffset<uintptr_t>(target, offset),
|
||||
reinterpret_cast<uintptr_t>(old),
|
||||
reinterpret_cast<uintptr_t>(new_)))
|
||||
{
|
||||
@ -3473,7 +3473,7 @@ inline object
|
||||
resolveClassInObject(Thread* t, object loader, object container,
|
||||
unsigned classOffset, bool throw_ = true)
|
||||
{
|
||||
object o = cast<object>(container, classOffset);
|
||||
object o = fieldAtOffset<object>(container, classOffset);
|
||||
|
||||
loadMemoryBarrier();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user