diff --git a/src/avian/classpath-common.h b/src/avian/classpath-common.h index 073d037dff..a2b4ce0f3f 100644 --- a/src/avian/classpath-common.h +++ b/src/avian/classpath-common.h @@ -38,7 +38,7 @@ getTrace(Thread* t, unsigned skipCount) { return true; } else { - trace = reinterpret_cast(makeTrace(t, walker)); + trace = makeTrace(t, walker); return false; } } else { @@ -54,16 +54,14 @@ getTrace(Thread* t, unsigned skipCount) t->m->processor->walkStack(t, &v); - if (v.trace == 0) v.trace = reinterpret_cast(makeObjectArray(t, 0)); + if (v.trace == 0) v.trace = makeObjectArray(t, 0); return v.trace; } bool -compatibleArrayTypes(Thread* t, object ao, object bo) +compatibleArrayTypes(Thread* t UNUSED, GcClass* a, GcClass* b) { - GcClass* a = cast(t, ao); - GcClass* b = cast(t, bo); return a->arrayElementSize() and b->arrayElementSize() and (a == b @@ -77,7 +75,7 @@ arrayCopy(Thread* t, object src, int32_t srcOffset, object dst, { if (LIKELY(src and dst)) { if (LIKELY(compatibleArrayTypes - (t, reinterpret_cast(objectClass(t, src)), reinterpret_cast(objectClass(t, dst))))) + (t, objectClass(t, src), objectClass(t, dst)))) { unsigned elementSize = objectClass(t, src)->arrayElementSize(); @@ -300,7 +298,7 @@ makeStackTraceElement(Thread* t, GcTraceElement* e) PROTECT(t, method_name); GcString* method_name_string = t->m->classpath->makeString - (t, reinterpret_cast(method_name), 0, method_name->length() - 1); + (t, method_name, 0, method_name->length() - 1); PROTECT(t, method_name_string); unsigned line = t->m->processor->lineNumber @@ -308,38 +306,38 @@ makeStackTraceElement(Thread* t, GcTraceElement* e) GcByteArray* file = method->class_()->sourceFile(); GcString* file_string = file ? t->m->classpath->makeString - (t, reinterpret_cast(file), 0, file->length() - 1) : 0; + (t, file, 0, file->length() - 1) : 0; return makeStackTraceElement(t, class_name_string, method_name_string, file_string, line); } -object +GcObject* translateInvokeResult(Thread* t, unsigned returnCode, object o) { switch (returnCode) { case ByteField: - return reinterpret_cast(makeByte(t, cast(t, o)->value())); + return makeByte(t, cast(t, o)->value()); case BooleanField: - return reinterpret_cast(makeBoolean(t, cast(t, o)->value() != 0)); + return makeBoolean(t, cast(t, o)->value() != 0); case CharField: - return reinterpret_cast(makeChar(t, cast(t, o)->value())); + return makeChar(t, cast(t, o)->value()); case ShortField: - return reinterpret_cast(makeShort(t, cast(t, o)->value())); + return makeShort(t, cast(t, o)->value()); case FloatField: - return reinterpret_cast(makeFloat(t, cast(t, o)->value())); + return makeFloat(t, cast(t, o)->value()); case IntField: case LongField: case ObjectField: case VoidField: - return o; + return reinterpret_cast(o); case DoubleField: - return reinterpret_cast(makeDouble(t, cast(t, o)->value())); + return makeDouble(t, cast(t, o)->value()); default: abort(t); @@ -400,7 +398,7 @@ resolveParameterTypes(Thread* t, GcClassLoader* loader, GcByteArray* spec, (t, loader, reinterpret_cast(&spec->body()[start]), offset - start); - list = makePair(t, reinterpret_cast(type), reinterpret_cast(list)); + list = makePair(t, type, list); ++ count; } break; @@ -424,13 +422,13 @@ resolveParameterTypes(Thread* t, GcClassLoader* loader, GcByteArray* spec, (t, loader, reinterpret_cast(&spec->body()[start]), offset - start); - list = makePair(t, reinterpret_cast(type), reinterpret_cast(list)); + list = makePair(t, type, list); ++ count; } break; default: list = makePair - (t, reinterpret_cast(primitiveClass(t, spec->body()[offset])), reinterpret_cast(list)); + (t, primitiveClass(t, spec->body()[offset]), list); ++ offset; ++ count; break; @@ -456,7 +454,7 @@ resolveParameterJTypes(Thread* t, GcClassLoader* loader, GcByteArray* spec, PROTECT(t, array); for (int i = *parameterCount - 1; i >= 0; --i) { - object c = reinterpret_cast(getJClass(t, cast(t, list->first()))); + object c = getJClass(t, cast(t, list->first())); reinterpret_cast(array)->setBodyElement(t, i, c); list = cast(t, list->second()); } @@ -489,12 +487,12 @@ resolveExceptionJTypes(Thread* t, GcClassLoader* loader, GcMethodAddendum* adden object o = singletonObject(t, addendum->pool()->as(t), index); if (objectClass(t, o) == type(t, GcReference::Type)) { - o = reinterpret_cast(resolveClass(t, loader, cast(t, o)->name())); + o = resolveClass(t, loader, cast(t, o)->name()); addendum->pool()->setBodyElement(t, index, reinterpret_cast(o)); } - o = reinterpret_cast(getJClass(t, cast(t, o))); + o = getJClass(t, cast(t, o)); reinterpret_cast(array)->setBodyElement(t, i, o); } @@ -615,7 +613,7 @@ intercept(Thread* t, GcClass* c, const char* name, const char* spec, // through the vtable. clone->flags() |= ACC_PRIVATE; - GcNativeIntercept* native = makeNativeIntercept(t, function, true, reinterpret_cast(clone)); + GcNativeIntercept* native = makeNativeIntercept(t, function, true, clone); PROTECT(t, native); @@ -691,7 +689,7 @@ getDeclaredClasses(Thread* t, GcClass* c, bool publicOnly) for (unsigned i = 0; i < table->length(); ++i) { GcInnerClassReference* reference = cast(t, table->body()[i]); GcByteArray* outer = reference->outer(); - if (outer and byteArrayEqual(t, reinterpret_cast(outer), reinterpret_cast(c->name())) + if (outer and byteArrayEqual(t, outer, c->name()) and ((not publicOnly) or (reference->flags() & ACC_PUBLIC))) { @@ -705,16 +703,16 @@ getDeclaredClasses(Thread* t, GcClass* c, bool publicOnly) for (unsigned i = 0; i < table->length(); ++i) { GcInnerClassReference* reference = cast(t, table->body()[i]); GcByteArray* outer = reference->outer(); - if (outer and byteArrayEqual(t, reinterpret_cast(outer), reinterpret_cast(c->name())) + if (outer and byteArrayEqual(t, outer, c->name()) and ((not publicOnly) or (reference->flags() & ACC_PUBLIC))) { - object inner = reinterpret_cast(getJClass( + object inner = getJClass( t, resolveClass( t, c->loader(), - reference->inner()))); + reference->inner())); -- count; reinterpret_cast(result)->setBodyElement(t, count, inner); diff --git a/src/avian/java-common.h b/src/avian/java-common.h index 86dbf20fa7..2142741200 100644 --- a/src/avian/java-common.h +++ b/src/avian/java-common.h @@ -16,9 +16,9 @@ namespace vm { class Machine; class Thread; -struct Object { }; +class GcObject;; -typedef Object* object; +typedef GcObject* object; typedef uint8_t jboolean; typedef int8_t jbyte; diff --git a/src/avian/machine.h b/src/avian/machine.h index e5e73ece62..5749a285fc 100644 --- a/src/avian/machine.h +++ b/src/avian/machine.h @@ -69,7 +69,7 @@ using namespace avian::util; private: \ object name; \ Thread::SingleProtector protector; \ - } MAKE_NAME(resource_)(t, reinterpret_cast(name)); + } MAKE_NAME(resource_)(t, name); #define THREAD_RESOURCE(t, type, name, releaseBody) \ class MAKE_NAME(Resource_): public Thread::AutoResource { \ @@ -1649,11 +1649,6 @@ objectClass(Thread*, object o) { return reinterpret_cast(maskAlignedPointer(fieldAtOffset(o, 0))); } -inline GcClass* -objectClass(Thread*, GcObject* o) -{ - return reinterpret_cast(maskAlignedPointer(fieldAtOffset(o, 0))); -} inline unsigned stackSizeInWords(Thread* t) @@ -1877,13 +1872,6 @@ setField(Thread* t, object target, unsigned offset, object value) mark(t, target, offset); } -inline void -setField(Thread* t, GcObject* target, unsigned offset, GcObject* value) -{ - fieldAtOffset(target, offset) = value; - mark(t, reinterpret_cast(target), offset); -} - inline void setObject(Thread* t, GcObject* target, unsigned offset, GcObject* value) { @@ -1937,14 +1925,14 @@ T* GcObject::as(Thread* t UNUSED) } assertT(t, t->m->unsafe - || instanceOf(t, reinterpret_cast(arrayBodyUnsafe(t, t->m->types, T::Type)), reinterpret_cast(this))); + || instanceOf(t, reinterpret_cast(arrayBodyUnsafe(t, t->m->types, T::Type)), this)); return static_cast(this); } template bool GcObject::isa(Thread* t) { - return instanceOf(t, reinterpret_cast(arrayBodyUnsafe(t, t->m->types, T::Type)), reinterpret_cast(this)); + return instanceOf(t, reinterpret_cast(arrayBodyUnsafe(t, t->m->types, T::Type)), this); } template @@ -2180,7 +2168,7 @@ type(Thread* t, Gc::Type type) inline void setType(Thread* t, Gc::Type type, GcClass* value) { - t->m->types->setBodyElement(t, type, reinterpret_cast(value)); + t->m->types->setBodyElement(t, type, value); } inline bool @@ -2436,13 +2424,12 @@ stringHash(Thread* t, object so) { GcString* s = cast(t, so); if (s->hashCode() == 0 and s->length(t)) { - object data = reinterpret_cast(s->data()); - if (objectClass(t, data) == type(t, GcByteArray::Type)) { + if (objectClass(t, s->data()) == type(t, GcByteArray::Type)) { s->hashCode() = hash - (cast(t, data)->body().subslice(s->offset(t), s->length(t))); + (cast(t, s->data())->body().subslice(s->offset(t), s->length(t))); } else { s->hashCode() = hash - (cast(t, data)->body().subslice(s->offset(t), s->length(t))); + (cast(t, s->data())->body().subslice(s->offset(t), s->length(t))); } } return s->hashCode(); @@ -2451,11 +2438,10 @@ stringHash(Thread* t, object so) inline uint16_t stringCharAt(Thread* t, GcString* s, int i) { - object data = reinterpret_cast(s->data()); - if (objectClass(t, data) == type(t, GcByteArray::Type)) { - return cast(t, data)->body()[s->offset(t) + i]; + if (objectClass(t, s->data()) == type(t, GcByteArray::Type)) { + return cast(t, s->data())->body()[s->offset(t) + i]; } else { - return cast(t, data)->body()[s->offset(t) + i]; + return cast(t, s->data())->body()[s->offset(t) + i]; } } @@ -2482,8 +2468,8 @@ inline uint32_t methodHash(Thread* t, object mo) { GcMethod* method = cast(t, mo); - return byteArrayHash(t, reinterpret_cast(method->name())) - ^ byteArrayHash(t, reinterpret_cast(method->spec())); + return byteArrayHash(t, method->name()) + ^ byteArrayHash(t, method->spec()); } inline bool @@ -2492,8 +2478,8 @@ methodEqual(Thread* t, object ao, object bo) GcMethod* a = cast(t, ao); GcMethod* b = cast(t, bo); return a == b or - (byteArrayEqual(t, reinterpret_cast(a->name()), reinterpret_cast(b->name())) and - byteArrayEqual(t, reinterpret_cast(a->spec()), reinterpret_cast(b->spec()))); + (byteArrayEqual(t, a->name(), b->name()) and + byteArrayEqual(t, a->spec(), b->spec())); } class MethodSpecIterator { @@ -2732,7 +2718,7 @@ makeThrowable GcThrowable* result = cast(t, make(t, vm::type(t, type))); result->setMessage(t, message); - result->setTrace(t, reinterpret_cast(trace)); + result->setTrace(t, trace); result->setCause(t, cause); return result; @@ -2746,7 +2732,7 @@ makeThrowableV(Thread* t, Gc::Type type, const char* format, va_list a, if (s) { GcString* message = t->m->classpath->makeString - (t, reinterpret_cast(s), 0, s->length() - 1); + (t, s, 0, s->length() - 1); return makeThrowable(t, type, message); } else { @@ -2904,7 +2890,7 @@ findInterfaceMethod(Thread* t, GcMethod* method, GcClass* class_) { assertT(t, (class_->vmFlags() & BootstrapFlag) == 0); - object interface = reinterpret_cast(method->class_()); + GcClass* interface = method->class_(); GcArray* itable = cast(t, class_->interfaceTable()); for (unsigned i = 0; i < itable->length(); i += 2) { if (itable->body()[i] == interface) { @@ -3001,12 +2987,12 @@ monitorAtomicAppendAcquire(Thread* t, GcMonitor* monitor, GcMonitorNode* node) if (tail == cast(t, monitor->acquireTail())) { if (next) { atomicCompareAndSwapObject - (t, reinterpret_cast(monitor), MonitorAcquireTail, reinterpret_cast(tail), next); + (t, monitor, MonitorAcquireTail, tail, next); } else if (atomicCompareAndSwapObject - (t, reinterpret_cast(tail), MonitorNodeNext, 0, reinterpret_cast(node))) + (t, tail, MonitorNodeNext, 0, node)) { atomicCompareAndSwapObject - (t, reinterpret_cast(monitor), MonitorAcquireTail, reinterpret_cast(tail), reinterpret_cast(node)); + (t, monitor, MonitorAcquireTail, tail, node); return; } } @@ -3033,7 +3019,7 @@ monitorAtomicPollAcquire(Thread* t, GcMonitor* monitor, bool remove) if (head == tail) { if (next) { atomicCompareAndSwapObject - (t, reinterpret_cast(monitor), MonitorAcquireTail, reinterpret_cast(tail), reinterpret_cast(next)); + (t, monitor, MonitorAcquireTail, tail, next); } else { return 0; } @@ -3041,7 +3027,7 @@ monitorAtomicPollAcquire(Thread* t, GcMonitor* monitor, bool remove) Thread* value = static_cast(next->value()); if ((not remove) or atomicCompareAndSwapObject - (t, reinterpret_cast(monitor), MonitorAcquireHead, reinterpret_cast(head), reinterpret_cast(next))) + (t, monitor, MonitorAcquireHead, head, next)) { return value; } @@ -3437,7 +3423,7 @@ exceptionMatch(Thread* t, GcClass* type, GcThrowable* exception) { return type == 0 or (exception != roots(t)->shutdownInProgress() - and instanceOf(t, type, reinterpret_cast(t->exception))); + and instanceOf(t, type, t->exception)); } object @@ -3612,7 +3598,7 @@ resolveClassInObject(Thread* t, GcClassLoader* loader, object container, if (c) { storeStoreMemoryBarrier(); - setField(t, container, classOffset, reinterpret_cast(c)); + setField(t, container, classOffset, c); } return c; @@ -3709,7 +3695,7 @@ acquireFieldForRead(Thread* t, GcField* field) and (field->code() == DoubleField or field->code() == LongField))) { - acquire(t, reinterpret_cast(field)); + acquire(t, field); } } @@ -3721,7 +3707,7 @@ releaseFieldForRead(Thread* t, GcField* field) and (field->code() == DoubleField or field->code() == LongField)) { - release(t, reinterpret_cast(field)); + release(t, field); } else { loadMemoryBarrier(); } @@ -3751,7 +3737,7 @@ acquireFieldForWrite(Thread* t, GcField* field) and (field->code() == DoubleField or field->code() == LongField)) { - acquire(t, reinterpret_cast(field)); + acquire(t, field); } else { storeStoreMemoryBarrier(); } @@ -3766,7 +3752,7 @@ releaseFieldForWrite(Thread* t, GcField* field) and (field->code() == DoubleField or field->code() == LongField)) { - release(t, reinterpret_cast(field)); + release(t, field); } else { storeLoadMemoryBarrier(); } @@ -3827,7 +3813,7 @@ getClassRuntimeData(Thread* t, GcClass* c) ACQUIRE(t, t->m->classLock); if (c->runtimeDataIndex() == 0) { - object runtimeData = reinterpret_cast(makeClassRuntimeData(t, 0, 0, 0, 0)); + GcClassRuntimeData* runtimeData = makeClassRuntimeData(t, 0, 0, 0, 0); { GcVector* v @@ -3859,7 +3845,7 @@ getMethodRuntimeData(Thread* t, GcMethod* method) ACQUIRE(t, t->m->classLock); if (method->runtimeDataIndex() == 0) { - object runtimeData = reinterpret_cast(makeMethodRuntimeData(t, 0)); + GcMethodRuntimeData* runtimeData = makeMethodRuntimeData(t, 0); { GcVector* v @@ -3898,7 +3884,7 @@ getJClass(Thread* t, GcClass* c) storeStoreMemoryBarrier(); - getClassRuntimeData(t, c)->setJclass(t, reinterpret_cast(jclass)); + getClassRuntimeData(t, c)->setJclass(t, jclass); } } diff --git a/src/builtin.cpp b/src/builtin.cpp index 1312fa53f3..6cf5d2199b 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -255,13 +255,13 @@ Avian_avian_SystemClassLoader_getPackageSource GcByteArray* key = makeByteArray(t, RUNTIME_ARRAY_BODY(chars)); GcByteArray* array = cast(t, hashMapFind - (t, roots(t)->packageMap(), reinterpret_cast(key), byteArrayHash, byteArrayEqual)); + (t, roots(t)->packageMap(), key, byteArrayHash, byteArrayEqual)); if (array) { return reinterpret_cast(makeLocalReference( t, - reinterpret_cast(t->m->classpath->makeString( - t, reinterpret_cast(array), 0, array->length())))); + t->m->classpath->makeString( + t, array, 0, array->length()))); } else { return 0; } @@ -777,7 +777,7 @@ Avian_sun_misc_Unsafe_putObjectVolatile object value = reinterpret_cast(arguments[4]); storeStoreMemoryBarrier(); - setField(t, o, offset, reinterpret_cast(value)); + setField(t, o, offset, value); storeLoadMemoryBarrier(); } @@ -866,9 +866,9 @@ Avian_sun_misc_Unsafe_getLongVolatile object lock; if (BytesPerWord < 8) { if (objectClass(t, o)->arrayDimensions()) { - lock = reinterpret_cast(objectClass(t, o)); + lock = objectClass(t, o); } else { - lock = reinterpret_cast(fieldForOffset(t, cast(t, o), offset)); + lock = fieldForOffset(t, cast(t, o), offset); } PROTECT(t, o); @@ -898,9 +898,9 @@ Avian_sun_misc_Unsafe_putLongVolatile object lock; if (BytesPerWord < 8) { if (objectClass(t, o)->arrayDimensions()) { - lock = reinterpret_cast(objectClass(t, o)); + lock = objectClass(t, o); } else { - lock = reinterpret_cast(fieldForOffset(t, cast(t, o), offset)); + lock = fieldForOffset(t, cast(t, o), offset); } PROTECT(t, o); diff --git a/src/classpath-android.cpp b/src/classpath-android.cpp index fd8f5485eb..9839d8dcfc 100644 --- a/src/classpath-android.cpp +++ b/src/classpath-android.cpp @@ -131,18 +131,18 @@ makeMethodOrConstructor(Thread* t, GcJclass* c, unsigned index) (t, method->class_()->loader(), method->addendum()); if (method->name()->body()[0] == '<') { - return reinterpret_cast(makeJconstructor - (t, 0, c, parameterTypes, exceptionTypes, 0, 0, 0, 0, index)); + return makeJconstructor + (t, 0, c, parameterTypes, exceptionTypes, 0, 0, 0, 0, index); } else { PROTECT(t, exceptionTypes); GcString* name = t->m->classpath->makeString - (t, reinterpret_cast(method->name()), 0, + (t, method->name(), 0, method->name()->length() - 1); - return reinterpret_cast(makeJmethod + return makeJmethod (t, 0, index, c, name, parameterTypes, exceptionTypes, returnType, 0, 0, - 0, 0, 0)); + 0, 0, 0); } } @@ -165,10 +165,10 @@ makeField(Thread* t, GcJclass* c, unsigned index) PROTECT(t, type); GcString* name = t->m->classpath->makeString - (t, reinterpret_cast(field->name()), 0, + (t, field->name(), 0, field->name()->length() - 1); - return reinterpret_cast(makeJfield(t, 0, c, type, 0, 0, name, index)); + return makeJfield(t, 0, c, type, 0, 0, name, index); } void initVmThread(Thread* t, GcThread* thread, unsigned offset) @@ -188,7 +188,7 @@ void initVmThread(Thread* t, GcThread* thread, unsigned offset) t->m->processor->invoke(t, constructor, instance, thread); - setField(t, reinterpret_cast(thread), offset, instance); + setField(t, thread, offset, instance); } if (thread->group() == 0) { @@ -220,7 +220,7 @@ translateStackTrace(Thread* t, object raw) for (unsigned i = 0; i < objectArrayLength(t, array); ++i) { GcStackTraceElement* e = makeStackTraceElement(t, cast(t, objectArrayBody(t, raw, i))); - setField(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast(e)); + setField(t, array, ArrayBody + (i * BytesPerWord), e); } return array; @@ -238,7 +238,7 @@ class MyClasspath : public Classpath { PROTECT(t, class_); GcJclass* c = reinterpret_cast(allocate(t, GcJclass::FixedSize, true)); - setObjectClass(t, reinterpret_cast(c), type(t, GcJclass::Type)); + setObjectClass(t, c, type(t, GcJclass::Type)); c->setVmClass(t, class_); return c; @@ -259,7 +259,7 @@ class MyClasspath : public Classpath { charArray->body()[i] = byteArray->body()[offset + i]; } - array = reinterpret_cast(charArray); + array = charArray; } else { expect(t, objectClass(t, array) == type(t, GcCharArray::Type)); } @@ -286,7 +286,7 @@ class MyClasspath : public Classpath { GcMethod* constructor = resolveMethod (t, type(t, GcThreadGroup::Type), "", "()V"); - t->m->processor->invoke(t, constructor, reinterpret_cast(group)); + t->m->processor->invoke(t, constructor, group); } resolveSystemClass @@ -301,7 +301,7 @@ class MyClasspath : public Classpath { "(Ljava/lang/ThreadGroup;Ljava/lang/String;IZ)V"); t->m->processor->invoke - (t, constructor, reinterpret_cast(thread), group, 0, NormalPriority, false); + (t, constructor, thread, group, 0, NormalPriority, false); thread->setContextClassLoader(t, roots(t)->appLoader()); @@ -315,7 +315,7 @@ class MyClasspath : public Classpath { { GcArray* table = cast(t, vmMethod->class_()->methodTable()); for (unsigned i = 0; i < table->length(); ++i) { - if (reinterpret_cast(vmMethod) == table->body()[i]) { + if (vmMethod == table->body()[i]) { return makeMethodOrConstructor (t, getJClass(t, vmMethod->class_()), i); } @@ -340,7 +340,7 @@ class MyClasspath : public Classpath { { GcArray* table = cast(t, vmField->class_()->fieldTable()); for (unsigned i = 0; i < table->length(); ++i) { - if (reinterpret_cast(vmField) == table->body()[i]) { + if (vmField == table->body()[i]) { return makeField(t, getJClass(t, vmField->class_()), i); } } @@ -366,7 +366,7 @@ class MyClasspath : public Classpath { { // force monitor creation so we don't get an OutOfMemory error // later when we try to acquire it: - objectMonitor(t, reinterpret_cast(t->javaThread), true); + objectMonitor(t, t->javaThread, true); GcField* field = resolveField( t, objectClass(t, t->javaThread), "vmThread", "Ljava/lang/VMThread;"); @@ -383,10 +383,10 @@ class MyClasspath : public Classpath { vm::release(t, vmt); } - vm::acquire(t, reinterpret_cast(t->javaThread)); + vm::acquire(t, t->javaThread); t->flags &= ~Thread::ActiveFlag; - vm::notifyAll(t, reinterpret_cast(t->javaThread)); - vm::release(t, reinterpret_cast(t->javaThread)); + vm::notifyAll(t, t->javaThread); + vm::release(t, t->javaThread); }); initVmThread(t, t->javaThread, offset); @@ -394,7 +394,7 @@ class MyClasspath : public Classpath { GcMethod* method = resolveMethod (t, roots(t)->bootLoader(), "java/lang/Thread", "run", "()V"); - t->m->processor->invoke(t, method, reinterpret_cast(t->javaThread)); + t->m->processor->invoke(t, method, t->javaThread); } virtual void @@ -512,10 +512,10 @@ class MyClasspath : public Classpath { PROTECT(t, constructor); t->m->processor->invoke - (t, constructor, reinterpret_cast(roots(t)->bootLoader()), 0, true); + (t, constructor, roots(t)->bootLoader(), 0, true); t->m->processor->invoke - (t, constructor, reinterpret_cast(roots(t)->appLoader()), + (t, constructor, roots(t)->appLoader(), roots(t)->bootLoader(), false); } @@ -725,7 +725,7 @@ getField(Thread* t, GcField* field, object instance) object target; if (field->flags() & ACC_STATIC) { - target = reinterpret_cast(field->class_()->staticTable()); + target = field->class_()->staticTable(); } else if (instanceOf(t, field->class_(), instance)){ target = instance; } else { @@ -735,28 +735,28 @@ getField(Thread* t, GcField* field, object instance) unsigned offset = field->offset(); switch (field->code()) { case ByteField: - return reinterpret_cast(makeByte(t, fieldAtOffset(target, offset))); + return makeByte(t, fieldAtOffset(target, offset)); case BooleanField: - return reinterpret_cast(makeBoolean(t, fieldAtOffset(target, offset))); + return makeBoolean(t, fieldAtOffset(target, offset)); case CharField: - return reinterpret_cast(makeChar(t, fieldAtOffset(target, offset))); + return makeChar(t, fieldAtOffset(target, offset)); case ShortField: - return reinterpret_cast(makeShort(t, fieldAtOffset(target, offset))); + return makeShort(t, fieldAtOffset(target, offset)); case IntField: - return reinterpret_cast(makeInt(t, fieldAtOffset(target, offset))); + return makeInt(t, fieldAtOffset(target, offset)); case LongField: - return reinterpret_cast(makeLong(t, fieldAtOffset(target, offset))); + return makeLong(t, fieldAtOffset(target, offset)); case FloatField: - return reinterpret_cast(makeFloat(t, fieldAtOffset(target, offset))); + return makeFloat(t, fieldAtOffset(target, offset)); case DoubleField: - return reinterpret_cast(makeDouble(t, fieldAtOffset(target, offset))); + return makeDouble(t, fieldAtOffset(target, offset)); case ObjectField: return fieldAtOffset(target, offset); @@ -778,7 +778,7 @@ setField(Thread* t, GcField* field, object instance, object value) object target; if ((field->flags() & ACC_STATIC) != 0) { - target = reinterpret_cast(field->class_()->staticTable()); + target = field->class_()->staticTable(); } else if (instanceOf(t, field->class_(), instance)){ target = instance; } else { @@ -1477,7 +1477,7 @@ Avian_java_lang_VMThread_sleep if (milliseconds <= 0) milliseconds = 1; if (t->javaThread->sleepLock() == 0) { - object lock = reinterpret_cast(makeJobject(t)); + object lock = makeJobject(t); t->javaThread->setSleepLock(t, lock); } @@ -1552,7 +1552,7 @@ Avian_dalvik_system_VMStack_getClasses assertT(t, counter - 2 < objectArrayLength(t, array)); - setField(t, array, ArrayBody + ((counter - 2) * BytesPerWord), reinterpret_cast(c)); + setField(t, array, ArrayBody + ((counter - 2) * BytesPerWord), c); return true; } @@ -2224,9 +2224,9 @@ Avian_java_lang_reflect_Field_getSignatureAnnotation PROTECT(t, array); GcString* string = t->m->classpath->makeString - (t, reinterpret_cast(signature), 0, signature->length() - 1); + (t, signature, 0, signature->length() - 1); - setField(t, array, ArrayBody, reinterpret_cast(string)); + setField(t, array, ArrayBody, string); return reinterpret_cast(array); } @@ -2296,7 +2296,7 @@ Avian_dalvik_system_VMRuntime_newNonMovableArray (t, t->m->heap, Machine::FixedAllocation, ArrayBody + arguments[2], false)); - setObjectClass(t, reinterpret_cast(array), type(t, GcByteArray::Type)); + setObjectClass(t, array, type(t, GcByteArray::Type)); array->length() = arguments[2]; return reinterpret_cast(array); diff --git a/src/classpath-avian.cpp b/src/classpath-avian.cpp index 9d79c27a1e..69a7b0b477 100644 --- a/src/classpath-avian.cpp +++ b/src/classpath-avian.cpp @@ -64,7 +64,7 @@ class MyClasspath : public Classpath { GcJmethod* jmethod = makeJmethod(t, vmMethod, false); return vmMethod->name()->body()[0] == '<' - ? reinterpret_cast(makeJconstructor(t, jmethod)) : reinterpret_cast(jmethod); + ? (object)makeJconstructor(t, jmethod) : (object)jmethod; } virtual GcMethod* @@ -78,7 +78,7 @@ class MyClasspath : public Classpath { virtual object makeJField(Thread* t, GcField* vmField) { - return reinterpret_cast(makeJfield(t, vmField, false)); + return makeJfield(t, vmField, false); } virtual GcField* @@ -232,7 +232,7 @@ enumerateThreads(Thread* t, Thread* x, GcArray* array, unsigned* index, unsigned limit) { if (*index < limit) { - array->setBodyElement(t, *index, reinterpret_cast(x->javaThread)); + array->setBodyElement(t, *index, x->javaThread); ++ (*index); if (x->peer) enumerateThreads(t, x->peer, array, index, limit); @@ -547,7 +547,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL for (unsigned i = 0; i < t->m->propertyCount; ++i) { GcString* s = makeString(t, "%s", t->m->properties[i]); - reinterpret_cast(array)->setBodyElement(t, i, reinterpret_cast(s)); + reinterpret_cast(array)->setBodyElement(t, i, s); } return reinterpret_cast(array); @@ -618,7 +618,7 @@ Avian_java_lang_Runtime_addShutdownHook ACQUIRE(t, t->m->shutdownLock); - GcPair* p = makePair(t, hook, reinterpret_cast(roots(t)->shutdownHooks())); + GcPair* p = makePair(t, hook, roots(t)->shutdownHooks()); // sequence point, for gc (don't recombine statements) roots(t)->setShutdownHooks(t, p); } @@ -644,7 +644,7 @@ Avian_java_lang_Throwable_resolveTrace for (unsigned i = 0; i < length; ++i) { GcStackTraceElement* ste = makeStackTraceElement(t, cast(t, objectArrayBody(t, trace, i))); - reinterpret_cast(array)->setBodyElement(t, i, reinterpret_cast(ste)); + reinterpret_cast(array)->setBodyElement(t, i, ste); } return reinterpret_cast(array); diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp index c44a00e9a7..87f768e911 100644 --- a/src/classpath-openjdk.cpp +++ b/src/classpath-openjdk.cpp @@ -490,7 +490,7 @@ class MyClasspath : public Classpath { PROTECT(t, name); GcJclass* c = reinterpret_cast(allocate(t, GcJclass::FixedSize, true)); - setObjectClass(t, reinterpret_cast(c), type(t, GcJclass::Type)); + setObjectClass(t, c, type(t, GcJclass::Type)); c->setName(t, name); c->setVmClass(t, class_); @@ -527,7 +527,7 @@ class MyClasspath : public Classpath { charArray->body()[i] = array->body()[offset + i]; } - oarray = reinterpret_cast(charArray); + oarray = charArray; } else { expect(t, objectClass(t, oarray) == type(t, GcCharArray::Type)); } @@ -546,14 +546,14 @@ class MyClasspath : public Classpath { group = parent->javaThread->group(); } else { group = reinterpret_cast(allocate(t, GcThreadGroup::FixedSize, true)); - setObjectClass(t, reinterpret_cast(group), type(t, GcThreadGroup::Type)); + setObjectClass(t, group, type(t, GcThreadGroup::Type)); group->maxPriority() = MaxPriority; } PROTECT(t, group); GcThread* thread = reinterpret_cast(allocate(t, GcThread::FixedSize, true)); - setObjectClass(t, reinterpret_cast(thread), type(t, GcThread::Type)); + setObjectClass(t, thread, type(t, GcThread::Type)); thread->priority() = NormalPriority; thread->setGroup(t, group); @@ -563,7 +563,7 @@ class MyClasspath : public Classpath { PROTECT(t, thread); GcJobject* blockerLock = makeJobject(t); - thread->setBlockerLock(t, reinterpret_cast(blockerLock)); + thread->setBlockerLock(t, blockerLock); const unsigned BufferSize = 256; char buffer[BufferSize]; @@ -583,8 +583,8 @@ class MyClasspath : public Classpath { PROTECT(t, vmMethod); return vmMethod->name()->body()[0] == '<' - ? reinterpret_cast(makeJconstructor(t, vmMethod)) - : reinterpret_cast(makeJmethod(t, vmMethod)); + ? makeJconstructor(t, vmMethod) + : makeJmethod(t, vmMethod); } virtual GcMethod* @@ -610,7 +610,7 @@ class MyClasspath : public Classpath { virtual object makeJField(Thread* t, GcField* vmField) { - return reinterpret_cast(makeJfield(t, vmField)); + return makeJfield(t, vmField); } virtual GcField* @@ -633,13 +633,13 @@ class MyClasspath : public Classpath { { // force monitor creation so we don't get an OutOfMemory error // later when we try to acquire it: - objectMonitor(t, reinterpret_cast(t->javaThread), true); + objectMonitor(t, t->javaThread, true); THREAD_RESOURCE0(t, { - vm::acquire(t, reinterpret_cast(t->javaThread)); + vm::acquire(t, t->javaThread); t->flags &= ~Thread::ActiveFlag; - vm::notifyAll(t, reinterpret_cast(t->javaThread)); - vm::release(t, reinterpret_cast(t->javaThread)); + vm::notifyAll(t, t->javaThread); + vm::release(t, t->javaThread); GcThrowable* e = t->exception; PROTECT(t, e); @@ -648,7 +648,7 @@ class MyClasspath : public Classpath { t->m->processor->invoke (t, cast(t, roots(t)->threadTerminated()), - reinterpret_cast(t->javaThread->group()), t->javaThread); + t->javaThread->group(), t->javaThread); t->exception = e; }); @@ -656,7 +656,7 @@ class MyClasspath : public Classpath { GcMethod* method = resolveMethod (t, roots(t)->bootLoader(), "java/lang/Thread", "run", "()V"); - t->m->processor->invoke(t, method, reinterpret_cast(t->javaThread)); + t->m->processor->invoke(t, method, t->javaThread); } virtual void @@ -708,7 +708,7 @@ class MyClasspath : public Classpath { (t, roots(t)->bootLoader(), "java/lang/ThreadGroup", "threadTerminated", "(Ljava/lang/Thread;)V"); // sequence point, for gc (don't recombine statements) - roots(t)->setThreadTerminated(t, reinterpret_cast(method)); + roots(t)->setThreadTerminated(t, method); #ifdef AVIAN_OPENJDK_SRC interceptFileOperations(t, true); @@ -750,10 +750,10 @@ class MyClasspath : public Classpath { PROTECT(t, constructor); - t->m->processor->invoke(t, constructor, reinterpret_cast(roots(t)->bootLoader()), 0); + t->m->processor->invoke(t, constructor, roots(t)->bootLoader(), 0); t->m->processor->invoke - (t, constructor, reinterpret_cast(roots(t)->appLoader()), + (t, constructor, roots(t)->appLoader(), roots(t)->bootLoader()); } @@ -1107,7 +1107,7 @@ getFileLength stringChars(t, path, RUNTIME_ARRAY_BODY(p)); replace('\\', '/', RUNTIME_ARRAY_BODY(p)); - EmbeddedFile ef(cp, RUNTIME_ARRAY_BODY(p), stringLength(t, path)); + EmbeddedFile ef(cp, RUNTIME_ARRAY_BODY(p), stringLength(t, path)); if (ef.jar) { if (ef.jarLength == 0) { return 0; @@ -2153,7 +2153,7 @@ countFields(Thread* t, GcClass* c, bool publicOnly) } return count; } else { - return objectArrayLength(t, reinterpret_cast(table)); + return objectArrayLength(t, table); } } @@ -2233,8 +2233,8 @@ makeJmethod(Thread* t, GcMethod* vmMethod, int index) PROTECT(t, vmMethod); object name = intern - (t, reinterpret_cast(t->m->classpath->makeString - (t, reinterpret_cast(vmMethod->name()), 0, vmMethod->name()->length() - 1))); + (t, t->m->classpath->makeString + (t, vmMethod->name(), 0, vmMethod->name()->length() - 1)); PROTECT(t, name); unsigned parameterCount; @@ -2265,8 +2265,8 @@ makeJmethod(Thread* t, GcMethod* vmMethod, int index) if (signature) { PROTECT(t, addendum); - signature = reinterpret_cast(t->m->classpath->makeString - (t, signature, 0, cast(t, signature)->length() - 1)); + signature = t->m->classpath->makeString + (t, signature, 0, cast(t, signature)->length() - 1); } annotationTable = addendum->annotationTable(); @@ -2290,13 +2290,13 @@ makeJmethod(Thread* t, GcMethod* vmMethod, int index) GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmMethod->class_()); runtimeData->setPool(t, - reinterpret_cast(vmMethod->addendum()->pool())); + vmMethod->addendum()->pool()); } if (index == -1) { GcArray* table = cast(t, vmMethod->class_()->methodTable()); for (unsigned i = 0; i < table->length(); ++i) { - if (reinterpret_cast(vmMethod) == table->body()[i]) { + if (vmMethod == table->body()[i]) { index = i; break; } @@ -2307,10 +2307,10 @@ makeJmethod(Thread* t, GcMethod* vmMethod, int index) GcJclass* jclass = getJClass(t, vmMethod->class_()); - return reinterpret_cast(makeJmethod + return makeJmethod (t, true, 0, jclass, index, cast(t, name), returnType, parameterTypes, exceptionTypes, vmMethod->flags(), cast(t, signature), 0, cast(t, annotationTable), - cast(t, parameterAnnotationTable), cast(t, annotationDefault), 0, 0, 0)); + cast(t, parameterAnnotationTable), cast(t, annotationDefault), 0, 0, 0); } object @@ -2339,8 +2339,8 @@ makeJconstructor(Thread* t, GcMethod* vmMethod, int index) if (signature) { PROTECT(t, addendum); - signature = reinterpret_cast(t->m->classpath->makeString - (t, signature, 0, cast(t, signature)->length() - 1)); + signature = t->m->classpath->makeString + (t, signature, 0, cast(t, signature)->length() - 1); } annotationTable = addendum->annotationTable(); @@ -2359,13 +2359,13 @@ makeJconstructor(Thread* t, GcMethod* vmMethod, int index) GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmMethod->class_()); runtimeData->setPool(t, - reinterpret_cast(vmMethod->addendum()->pool())); + vmMethod->addendum()->pool()); } if (index == -1) { GcArray* table = cast(t, vmMethod->class_()->methodTable()); for (unsigned i = 0; i < table->length(); ++i) { - if (reinterpret_cast(vmMethod) == table->body()[i]) { + if (vmMethod == table->body()[i]) { index = i; break; } @@ -2376,7 +2376,7 @@ makeJconstructor(Thread* t, GcMethod* vmMethod, int index) GcJclass* jclass = getJClass(t, vmMethod->class_()); - return reinterpret_cast( + return makeJconstructor(t, true, 0, @@ -2391,7 +2391,7 @@ makeJconstructor(Thread* t, GcMethod* vmMethod, int index) cast(t, parameterAnnotationTable), 0, 0, - 0)); + 0); } object @@ -2400,8 +2400,8 @@ makeJfield(Thread* t, GcField* vmField, int index) PROTECT(t, vmField); object name = intern - (t, reinterpret_cast(t->m->classpath->makeString - (t, reinterpret_cast(vmField->name()), 0, vmField->name()->length() - 1))); + (t, t->m->classpath->makeString + (t, vmField->name(), 0, vmField->name()->length() - 1)); PROTECT(t, name); GcClass* type = resolveClassBySpec @@ -2421,8 +2421,8 @@ makeJfield(Thread* t, GcField* vmField, int index) if (signature) { PROTECT(t, addendum); - signature = reinterpret_cast(t->m->classpath->makeString - (t, signature, 0, cast(t, signature)->length() - 1)); + signature = t->m->classpath->makeString + (t, signature, 0, cast(t, signature)->length() - 1); } annotationTable = addendum->annotationTable(); @@ -2438,13 +2438,13 @@ makeJfield(Thread* t, GcField* vmField, int index) GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmField->class_()); runtimeData->setPool(t, - reinterpret_cast(vmField->addendum()->pool())); + vmField->addendum()->pool()); } if (index == -1) { GcArray* table = cast(t, vmField->class_()->fieldTable()); for (unsigned i = 0; i < table->length(); ++i) { - if (reinterpret_cast(vmField) == table->body()[i]) { + if (vmField == table->body()[i]) { index = i; break; } @@ -2455,8 +2455,8 @@ makeJfield(Thread* t, GcField* vmField, int index) GcJclass* jclass = getJClass(t, vmField->class_()); - return reinterpret_cast(makeJfield - (t, true, 0, jclass, index, cast(t, name), jtype, vmField->flags(), cast(t, signature), 0, cast(t, annotationTable), 0, 0, 0, 0)); + return makeJfield + (t, true, 0, jclass, index, cast(t, name), jtype, vmField->flags(), cast(t, signature), 0, cast(t, annotationTable), 0, 0, 0, 0); } void @@ -3231,8 +3231,8 @@ jvmGetStackTraceElement(Thread* t, uintptr_t* arguments) return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeStackTraceElement - (t, cast(t, objectArrayBody(t, cast(t, *throwable)->trace(), index)))))); + (t, makeStackTraceElement + (t, cast(t, objectArrayBody(t, cast(t, *throwable)->trace(), index))))); } extern "C" AVIAN_EXPORT jobject JNICALL @@ -3334,7 +3334,7 @@ jvmSleep(Thread* t, uintptr_t* arguments) if (t->javaThread->sleepLock() == 0) { GcJobject* lock = makeJobject(t); - t->javaThread->setSleepLock(t, reinterpret_cast(lock)); + t->javaThread->setSleepLock(t, lock); } acquire(t, t->javaThread->sleepLock()); @@ -3358,7 +3358,7 @@ EXPORT(JVM_CurrentThread)(Thread* t, jclass) { ENTER(t, Thread::ActiveState); - return makeLocalReference(t, reinterpret_cast(t->javaThread)); + return makeLocalReference(t, t->javaThread); } extern "C" AVIAN_EXPORT jint JNICALL @@ -3447,8 +3447,8 @@ jvmDumpThreads(Thread* t, uintptr_t* arguments) PROTECT(t, array); for (unsigned traceIndex = 0; traceIndex < traceLength; ++ traceIndex) { - object ste = reinterpret_cast(makeStackTraceElement - (t, cast(t, objectArrayBody(t, trace, traceIndex)))); + object ste = makeStackTraceElement + (t, cast(t, objectArrayBody(t, trace, traceIndex))); setField(t, array, ArrayBody + (traceIndex * BytesPerWord), ste); } @@ -3490,9 +3490,9 @@ jvmGetClassContext(Thread* t, uintptr_t*) PROTECT(t, context); for (unsigned i = 0; i < objectArrayLength(t, trace); ++i) { - object c = reinterpret_cast(getJClass( + object c = getJClass( t, - cast(t, cast(t, objectArrayBody(t, trace, i))->method())->class_())); + cast(t, cast(t, objectArrayBody(t, trace, i))->method())->class_()); setField(t, context, ArrayBody + (i * BytesPerWord), c); } @@ -3522,7 +3522,7 @@ jvmGetSystemPackage(Thread* t, uintptr_t* arguments) THREAD_RUNTIME_ARRAY(t, char, chars, (*s)->length(t) + 1); stringChars(t, *s, RUNTIME_ARRAY_BODY(chars)); - object key = reinterpret_cast(makeByteArray(t, RUNTIME_ARRAY_BODY(chars))); + object key = makeByteArray(t, RUNTIME_ARRAY_BODY(chars)); GcByteArray* array = cast(t, hashMapFind (t, roots(t)->packageMap(), key, byteArrayHash, byteArrayEqual)); @@ -3530,8 +3530,8 @@ jvmGetSystemPackage(Thread* t, uintptr_t* arguments) if (array) { return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(t->m->classpath->makeString - (t, reinterpret_cast(array), 0, array->length())))); + (t, t->m->classpath->makeString + (t, array, 0, array->length()))); } else { return 0; } @@ -3604,7 +3604,7 @@ EXPORT(JVM_LatestUserDefinedLoader)(Thread* t) t->m->processor->walkStack(t, &v); - return makeLocalReference(t, reinterpret_cast(v.loader)); + return makeLocalReference(t, v.loader); } extern "C" AVIAN_EXPORT jclass JNICALL @@ -3629,35 +3629,35 @@ jvmGetArrayElement(Thread* t, uintptr_t* arguments) case 'Z': return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeBoolean(t, fieldAtOffset(*array, ArrayBody + index))))); + (t, makeBoolean(t, fieldAtOffset(*array, ArrayBody + index)))); case 'B': return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeByte(t, fieldAtOffset(*array, ArrayBody + index))))); + (t, makeByte(t, fieldAtOffset(*array, ArrayBody + index)))); case 'C': return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeChar(t, fieldAtOffset(*array, ArrayBody + (index * 2)))))); + (t, makeChar(t, fieldAtOffset(*array, ArrayBody + (index * 2))))); case 'S': return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeShort(t, fieldAtOffset(*array, ArrayBody + (index * 2)))))); + (t, makeShort(t, fieldAtOffset(*array, ArrayBody + (index * 2))))); case 'I': return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeInt(t, fieldAtOffset(*array, ArrayBody + (index * 4)))))); + (t, makeInt(t, fieldAtOffset(*array, ArrayBody + (index * 4))))); case 'F': return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeFloat(t, fieldAtOffset(*array, ArrayBody + (index * 4)))))); + (t, makeFloat(t, fieldAtOffset(*array, ArrayBody + (index * 4))))); case 'J': return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeLong(t, fieldAtOffset(*array, ArrayBody + (index * 8)))))); + (t, makeLong(t, fieldAtOffset(*array, ArrayBody + (index * 8))))); case 'D': return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(makeDouble(t, fieldAtOffset(*array, ArrayBody + (index * 8)))))); + (t, makeDouble(t, fieldAtOffset(*array, ArrayBody + (index * 8))))); case 'L': case '[': return reinterpret_cast @@ -3734,20 +3734,20 @@ makeNewArray(Thread* t, GcClass* c, unsigned length) switch (*name) { case 'b': if (name[1] == 'o') { - return reinterpret_cast(makeBooleanArray(t, length)); + return makeBooleanArray(t, length); } else { - return reinterpret_cast(makeByteArray(t, length)); + return makeByteArray(t, length); } - case 'c': return reinterpret_cast(makeCharArray(t, length)); - case 'd': return reinterpret_cast(makeDoubleArray(t, length)); - case 'f': return reinterpret_cast(makeFloatArray(t, length)); - case 'i': return reinterpret_cast(makeIntArray(t, length)); - case 'l': return reinterpret_cast(makeLongArray(t, length)); - case 's': return reinterpret_cast(makeShortArray(t, length)); + case 'c': return makeCharArray(t, length); + case 'd': return makeDoubleArray(t, length); + case 'f': return makeFloatArray(t, length); + case 'i': return makeIntArray(t, length); + case 'l': return makeLongArray(t, length); + case 's': return makeShortArray(t, length); default: abort(t); } } else { - return reinterpret_cast(makeObjectArray(t, c, length)); + return makeObjectArray(t, c, length); } } @@ -3815,7 +3815,7 @@ EXPORT(JVM_GetCallerClass)(Thread* t, int target) GcMethod* method = getCaller(t, target, true); return method ? reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, method->class_())))) : 0; + (t, getJClass(t, method->class_()))) : 0; } extern "C" AVIAN_EXPORT jclass JNICALL @@ -3827,32 +3827,32 @@ EXPORT(JVM_FindPrimitiveClass)(Thread* t, const char* name) case 'b': if (name[1] == 'o') { return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJboolean::Type))))); + (t, getJClass(t, type(t, GcJboolean::Type)))); } else { return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJbyte::Type))))); + (t, getJClass(t, type(t, GcJbyte::Type)))); } case 'c': return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJchar::Type))))); + (t, getJClass(t, type(t, GcJchar::Type)))); case 'd': return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJdouble::Type))))); + (t, getJClass(t, type(t, GcJdouble::Type)))); case 'f': return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJfloat::Type))))); + (t, getJClass(t, type(t, GcJfloat::Type)))); case 'i': return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJint::Type))))); + (t, getJClass(t, type(t, GcJint::Type)))); case 'l': return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJlong::Type))))); + (t, getJClass(t, type(t, GcJlong::Type)))); case 's': return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJshort::Type))))); + (t, getJClass(t, type(t, GcJshort::Type)))); case 'v': return reinterpret_cast(makeLocalReference - (t, reinterpret_cast(getJClass(t, type(t, GcJvoid::Type))))); + (t, getJClass(t, type(t, GcJvoid::Type)))); default: throwNew(t, GcIllegalArgumentException::Type); } @@ -3899,7 +3899,7 @@ jvmFindClassFromClassLoader(Thread* t, uintptr_t* arguments) initClass(t, c); } - return reinterpret_cast(makeLocalReference(t, reinterpret_cast(getJClass(t, c)))); + return reinterpret_cast(makeLocalReference(t, getJClass(t, c))); } extern "C" AVIAN_EXPORT jclass JNICALL @@ -3942,7 +3942,7 @@ jvmFindLoadedClass(Thread* t, uintptr_t* arguments) GcClass* c = findLoadedClass(t, cast(t, *loader), spec); return reinterpret_cast - (c ? makeLocalReference(t, reinterpret_cast(getJClass(t, c))) : 0); + (c ? makeLocalReference(t, getJClass(t, c)) : 0); } extern "C" AVIAN_EXPORT jclass JNICALL @@ -3963,7 +3963,7 @@ jvmDefineClass(Thread* t, uintptr_t* arguments) return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(getJClass(t, cast(t, defineClass(t, cast(t, *loader), data, length)))))); + (t, getJClass(t, cast(t, defineClass(t, cast(t, *loader), data, length))))); } extern "C" AVIAN_EXPORT jclass JNICALL @@ -3998,7 +3998,7 @@ EXPORT(JVM_GetClassName)(Thread* t, jclass c) { ENTER(t, Thread::ActiveState); - return reinterpret_cast(makeLocalReference(t, reinterpret_cast((*c)->name()))); + return reinterpret_cast(makeLocalReference(t, (*c)->name())); } uint64_t @@ -4017,7 +4017,7 @@ jvmGetClassInterfaces(Thread* t, uintptr_t* arguments) PROTECT(t, array); for (unsigned i = 0; i < table->length(); ++i) { - object c = reinterpret_cast(getJClass(t, cast(t, table->body()[i]))); + object c = getJClass(t, cast(t, table->body()[i])); setField(t, array, ArrayBody + (i * BytesPerWord), c); } @@ -4057,10 +4057,10 @@ EXPORT(JVM_GetClassLoader)(Thread* t, jclass c) { return 0; } else { - return makeLocalReference(t, reinterpret_cast(roots(t)->bootLoader())); + return makeLocalReference(t, roots(t)->bootLoader()); } } else { - return makeLocalReference(t, reinterpret_cast(loader)); + return makeLocalReference(t, loader); } } @@ -4161,11 +4161,11 @@ jvmGetComponentType(Thread* t, uintptr_t* arguments) uint8_t n = (*c)->vmClass()->name()->body()[1]; if (n != 'L' and n != '[') { return reinterpret_cast - (makeLocalReference(t, reinterpret_cast(getJClass(t, primitiveClass(t, n))))); + (makeLocalReference(t, getJClass(t, primitiveClass(t, n)))); } else { return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(getJClass(t, (*c)->vmClass()->arrayElementClass())))); + (t, getJClass(t, (*c)->vmClass()->arrayElementClass()))); } } else { return 0; @@ -4217,8 +4217,8 @@ jvmGetDeclaringClass(Thread* t, uintptr_t* arguments) { return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(getDeclaringClass - (t, cast(t, *reinterpret_cast(arguments[0]))->vmClass())))); + (t, getDeclaringClass + (t, cast(t, *reinterpret_cast(arguments[0]))->vmClass()))); } extern "C" AVIAN_EXPORT jclass JNICALL @@ -4240,8 +4240,8 @@ jvmGetClassSignature(Thread* t, uintptr_t* arguments) if (signature) { return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(t->m->classpath->makeString - (t, reinterpret_cast(signature), 0, signature->length() - 1)))); + (t, t->m->classpath->makeString + (t, signature, 0, signature->length() - 1))); } } return 0; @@ -4444,7 +4444,7 @@ jvmInvokeMethod(Thread* t, uintptr_t* arguments) return reinterpret_cast (makeLocalReference (t, invoke - (t, vmMethod, instance ? reinterpret_cast(*instance) : 0, args ? reinterpret_cast(*args) : 0))); + (t, vmMethod, instance ? *instance : 0, args ? reinterpret_cast(*args) : 0))); } extern "C" AVIAN_EXPORT jobject JNICALL @@ -4472,7 +4472,7 @@ jvmNewInstanceFromConstructor(Thread* t, uintptr_t* arguments) (t, cast(t, *constructor)->clazz()->vmClass()->methodTable())->body()[ cast(t, *constructor)->slot()]); - invoke(t, method, reinterpret_cast(instance), args ? reinterpret_cast(*args) : 0); + invoke(t, method, instance, args ? reinterpret_cast(*args) : 0); return reinterpret_cast(makeLocalReference(t, instance)); } @@ -4497,7 +4497,7 @@ EXPORT(JVM_GetClassConstantPool)(Thread* t, jclass c) GcClassAddendum* addendum = vmClass->addendum(); object pool; if (addendum) { - pool = reinterpret_cast(addendum->pool()); + pool = addendum->pool(); } else { pool = 0; } @@ -4506,7 +4506,7 @@ EXPORT(JVM_GetClassConstantPool)(Thread* t, jclass c) pool = getClassRuntimeData(t, vmClass)->pool(); } - return makeLocalReference(t, reinterpret_cast(makeConstantPool(t, pool))); + return makeLocalReference(t, makeConstantPool(t, pool)); } extern "C" AVIAN_EXPORT jint JNICALL @@ -4601,8 +4601,8 @@ jvmConstantPoolGetUTF8At(Thread* t, uintptr_t* arguments) return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(t->m->classpath->makeString - (t, array, 0, fieldAtOffset(array, BytesPerWord) - 1)))); + (t, t->m->classpath->makeString + (t, array, 0, fieldAtOffset(array, BytesPerWord) - 1))); } extern "C" AVIAN_EXPORT jstring JNICALL @@ -4620,9 +4620,9 @@ maybeWrap(Thread* t, bool wrapException) { if (t->exception and wrapException - and not (instanceOf(t, type(t, GcError::Type), reinterpret_cast(t->exception)) + and not (instanceOf(t, type(t, GcError::Type), t->exception) or instanceOf - (t, type(t, GcRuntimeException::Type), reinterpret_cast(t->exception)))) + (t, type(t, GcRuntimeException::Type), t->exception))) { GcThrowable* exception = t->exception; t->exception = 0; @@ -4641,7 +4641,7 @@ maybeWrap(Thread* t, bool wrapException) GcThrowable* result = cast(t, make(t, paeClass)); PROTECT(t, result); - t->m->processor->invoke(t, paeConstructor, reinterpret_cast(result), exception); + t->m->processor->invoke(t, paeConstructor, result, exception); t->exception = result; } @@ -5139,7 +5139,7 @@ getInputArgumentArray(Thread* t, uintptr_t*) for (unsigned i = 0; i < t->m->argumentCount; ++i) { GcString* argument = makeString(t, t->m->arguments[i]); - setField(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast(argument)); + setField(t, array, ArrayBody + (i * BytesPerWord), argument); } return reinterpret_cast(makeLocalReference(t, array)); @@ -5267,8 +5267,8 @@ getEnclosingMethodInfo(Thread* t, uintptr_t* arguments) object array = makeObjectArray(t, type(t, GcJobject::Type), 3); PROTECT(t, array); - enclosingClass = reinterpret_cast(getJClass - (t, resolveClass(t, class_->loader(), cast(t, enclosingClass)))); + enclosingClass = getJClass + (t, resolveClass(t, class_->loader(), cast(t, enclosingClass))); setField(t, array, ArrayBody, enclosingClass); @@ -5281,13 +5281,13 @@ getEnclosingMethodInfo(Thread* t, uintptr_t* arguments) (t, enclosingMethod->first(), 0, cast(t, enclosingMethod->first())->length() - 1); - setField(t, array, ArrayBody + BytesPerWord, reinterpret_cast(name)); + setField(t, array, ArrayBody + BytesPerWord, name); GcString* spec = t->m->classpath->makeString (t, enclosingMethod->second(), 0, cast(t, enclosingMethod->second())->length() - 1); - setField(t, array, ArrayBody + (2 * BytesPerWord), reinterpret_cast(spec)); + setField(t, array, ArrayBody + (2 * BytesPerWord), spec); } return reinterpret_cast(makeLocalReference(t, array)); @@ -5386,7 +5386,7 @@ Avian_java_util_TimeZone_getSystemTimeZoneID // implementing findJavaTZ_md ourselves from scratch, but that would // be a lot of code to implement and maintain. - object country = reinterpret_cast(arguments[1]); + object country = arguments[1]; THREAD_RUNTIME_ARRAY(t, char, countryChars, stringLength(t, country) + 1); stringChars(t, country, RUNTIME_ARRAY_BODY(countryChars)); diff --git a/src/compile.cpp b/src/compile.cpp index 3c308a4420..613e29220b 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -1375,15 +1375,15 @@ class Frame { } } - ir::Value* append(GcObject* o) + ir::Value* append(object o) { BootContext* bc = context->bootContext; if (bc) { avian::codegen::Promise* p = new (bc->zone) avian::codegen::ListenPromise(t->m->system, bc->zone); PROTECT(t, o); - object pointer = reinterpret_cast(makePointer(t, p)); - bc->constants = makeTriple(t, reinterpret_cast(o), pointer, reinterpret_cast(bc->constants)); + object pointer = makePointer(t, p); + bc->constants = makeTriple(t, o, pointer, bc->constants); return c->binaryOp( lir::Add, @@ -1393,12 +1393,12 @@ class Frame { c->promiseConstant(p, ir::Type::object())); } else { for (PoolElement* e = context->objectPool; e; e = e->next) { - if (reinterpret_cast(o) == e->target) { + if (o == e->target) { return c->address(ir::Type::object(), e); } } - context->objectPool = new(&context->zone) PoolElement(t, reinterpret_cast(o), context->objectPool); + context->objectPool = new(&context->zone) PoolElement(t, o, context->objectPool); ++ context->objectPoolCount; @@ -1994,7 +1994,7 @@ releaseLock(MyThread* t, GcMethod* method, void* stack) if (t->methodLockIsClean) { object lock; if (method->flags() & ACC_STATIC) { - lock = reinterpret_cast(method->class_()); + lock = method->class_(); } else { lock = *localObject (t, stackForFrame(t, stack, method), method, @@ -2269,7 +2269,7 @@ resolveMethod(Thread* t, GcPair* pair) PROTECT(t, reference); GcClass* class_ = resolveClassInObject - (t, cast(t, pair->first())->class_()->loader(), reinterpret_cast(reference), + (t, cast(t, pair->first())->class_()->loader(), reference, ReferenceClass); return cast(t, findInHierarchy @@ -2614,7 +2614,7 @@ makeMultidimensionalArray2(MyThread* t, GcClass* class_, uintptr_t* countStack, } } - object array = reinterpret_cast(makeArray(t, RUNTIME_ARRAY_BODY(counts)[0])); + object array = makeArray(t, RUNTIME_ARRAY_BODY(counts)[0]); setObjectClass(t, array, class_); PROTECT(t, array); @@ -2711,7 +2711,7 @@ resolveField(Thread* t, GcPair* pair) PROTECT(t, reference); GcClass* class_ = resolveClassInObject - (t, cast(t, pair->first())->class_()->loader(), reinterpret_cast(reference), + (t, cast(t, pair->first())->class_()->loader(), reference, ReferenceClass); return cast(t, findInHierarchy @@ -2757,7 +2757,7 @@ getStaticFieldValueFromReference(MyThread* t, GcPair* pair) ACQUIRE_FIELD_FOR_READ(t, field); - return getFieldValue(t, reinterpret_cast(field->class_()->staticTable()), field); + return getFieldValue(t, field->class_()->staticTable(), field); } uint64_t @@ -2813,7 +2813,7 @@ setStaticObjectFieldValueFromReference(MyThread* t, GcPair* pair, object value) ACQUIRE_FIELD_FOR_WRITE(t, field); - setField(t, reinterpret_cast(field->class_()->staticTable()), field->offset(), + setField(t, field->class_()->staticTable(), field->offset(), value); } @@ -2866,7 +2866,7 @@ setStaticFieldValueFromReference(MyThread* t, GcPair* pair, uint32_t value) ACQUIRE_FIELD_FOR_WRITE(t, field); - setFieldValue(t, reinterpret_cast(field->class_()->staticTable()), field, value); + setFieldValue(t, field->class_()->staticTable(), field, value); } void @@ -3124,8 +3124,8 @@ compileDirectInvoke(MyThread* t, Frame* frame, GcMethod* target, bool tailCall) avian::codegen::Promise* p = new(bc->zone) avian::codegen::ListenPromise(t->m->system, bc->zone); PROTECT(t, target); - object pointer = reinterpret_cast(makePointer(t, p)); - bc->calls = makeTriple(t, reinterpret_cast(target), pointer, reinterpret_cast(bc->calls)); + object pointer = makePointer(t, p); + bc->calls = makeTriple(t, target, pointer, bc->calls); compileDirectInvoke(t, frame, target, tailCall, false, p); } else { @@ -3164,7 +3164,7 @@ compileDirectReferenceInvoke(MyThread* t, Frame* frame, Thunk thunk, PROTECT(t, reference); - GcPair* pair = makePair(t, reinterpret_cast(frame->context->method), reinterpret_cast(reference)); + GcPair* pair = makePair(t, frame->context->method, reference); compileReferenceInvoke( frame, @@ -4098,10 +4098,10 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, object argument; Thunk thunk; if (LIKELY(class_)) { - argument = reinterpret_cast(class_); + argument = class_; thunk = makeBlankObjectArrayThunk; } else { - argument = reinterpret_cast(makePair(t, reinterpret_cast(context->method), reinterpret_cast(reference))); + argument = makePair(t, context->method, reference); thunk = makeBlankObjectArrayFromReferenceThunk; } @@ -4112,7 +4112,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Type::object(), 3, c->threadRegister(), - frame->append(reinterpret_cast(argument)), + frame->append(argument), length)); } break; @@ -4182,10 +4182,10 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, object argument; Thunk thunk; if (LIKELY(class_)) { - argument = reinterpret_cast(class_); + argument = class_; thunk = checkCastThunk; } else { - argument = reinterpret_cast(makePair(t, reinterpret_cast(context->method), reinterpret_cast(reference))); + argument = makePair(t, context->method, reference); thunk = checkCastFromReferenceThunk; } @@ -4197,7 +4197,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Type::void_(), 3, c->threadRegister(), - frame->append(reinterpret_cast(argument)), + frame->append(argument), instance); } break; @@ -4558,7 +4558,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, int fieldCode = vm::fieldCode (t, ref->spec()->body()[0]); - GcPair* pair = makePair(t, reinterpret_cast(context->method), reference); + GcPair* pair = makePair(t, context->method, reference); ir::Type rType = operandTypeForFieldCode(t, fieldCode); @@ -4864,10 +4864,10 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, object argument; Thunk thunk; if (LIKELY(class_)) { - argument = reinterpret_cast(class_); + argument = class_; thunk = instanceOf64Thunk; } else { - argument = reinterpret_cast(makePair(t, reinterpret_cast(context->method), reinterpret_cast(reference))); + argument = makePair(t, context->method, reference); thunk = instanceOfFromReferenceThunk; } @@ -4878,7 +4878,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Type::i4(), 3, c->threadRegister(), - frame->append(reinterpret_cast(argument)), + frame->append(argument), instance)); } break; @@ -4903,7 +4903,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, if (LIKELY(target)) { checkMethod(t, target, false); - argument = reinterpret_cast(target); + argument = target; thunk = findInterfaceMethodFromInstanceThunk; parameterFootprint = target->parameterFootprint(); returnCode = target->returnCode(); @@ -4911,7 +4911,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, } else { GcReference* ref = cast(t, reference); PROTECT(t, ref); - argument = reinterpret_cast(makePair(t, reinterpret_cast(context->method), reference)); + argument = makePair(t, context->method, reference); thunk = findInterfaceMethodFromInstanceAndReferenceThunk; parameterFootprint = methodReferenceParameterFootprint (t, ref, false); @@ -4929,7 +4929,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Type::iptr(), 3, c->threadRegister(), - frame->append(reinterpret_cast(argument)), + frame->append(argument), c->peek(1, parameterFootprint - 1)), tailCall ? Compiler::TailJump : 0, frame->trace(0, 0), @@ -5058,7 +5058,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, PROTECT(t, reference); PROTECT(t, ref); - GcPair* pair = makePair(t, reinterpret_cast(context->method), reference); + GcPair* pair = makePair(t, context->method, reference); compileReferenceInvoke( frame, @@ -5241,7 +5241,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, GcReference* reference = cast(t, v); PROTECT(t, reference); - v = reinterpret_cast(resolveClassInPool(t, context->method, index - 1, false)); + v = resolveClassInPool(t, context->method, index - 1, false); if (UNLIKELY(v == 0)) { frame->push( @@ -5254,7 +5254,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Type::object(), 2, c->threadRegister(), - frame->append(makePair(t, reinterpret_cast(context->method), reinterpret_cast(reference))))); + frame->append(makePair(t, context->method, reference)))); } } @@ -5268,9 +5268,9 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Type::object(), 2, c->threadRegister(), - frame->append(reinterpret_cast(v)))); + frame->append(v))); } else { - frame->push(ir::Type::object(), frame->append(reinterpret_cast(v))); + frame->push(ir::Type::object(), frame->append(v)); } } } else { @@ -5523,10 +5523,10 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, object argument; Thunk thunk; if (LIKELY(class_)) { - argument = reinterpret_cast(class_); + argument = class_; thunk = makeMultidimensionalArrayThunk; } else { - argument = reinterpret_cast(makePair(t, reinterpret_cast(context->method), reinterpret_cast(reference))); + argument = makePair(t, context->method, reference); thunk = makeMultidimensionalArrayFromReferenceThunk; } @@ -5542,7 +5542,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Type::object(), 4, c->threadRegister(), - frame->append(reinterpret_cast(argument)), + frame->append(argument), c->constant(dimensions, ir::Type::i4()), c->constant(offset, ir::Type::i4())); @@ -5563,15 +5563,15 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, object argument; Thunk thunk; if (LIKELY(class_)) { - argument = reinterpret_cast(class_); + argument = class_; if (class_->vmFlags() & (WeakReferenceFlag | HasFinalizerFlag)) { thunk = makeNewGeneral64Thunk; } else { thunk = makeNew64Thunk; } } else { - argument = reinterpret_cast( - makePair(t, reinterpret_cast(context->method), reference)); + argument = + makePair(t, context->method, reference); thunk = makeNewFromReferenceThunk; } @@ -5582,7 +5582,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Type::object(), 2, c->threadRegister(), - frame->append(reinterpret_cast(argument)))); + frame->append(argument))); } break; case newarray: { @@ -5644,7 +5644,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, frame->append(field->class_())); } - staticTable = reinterpret_cast(field->class_()->staticTable()); + staticTable = field->class_()->staticTable(); } else { checkField(t, field, false); @@ -5680,7 +5680,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, if (instruction == putstatic) { PROTECT(t, field); - table = frame->append(reinterpret_cast(staticTable)); + table = frame->append(staticTable); } else { table = frame->pop(ir::Type::object()); } @@ -5784,7 +5784,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, ir::Value* value = popField(t, frame, fieldCode); ir::Type rType = operandTypeForFieldCode(t, fieldCode); - GcPair* pair = makePair(t, reinterpret_cast(context->method), reference); + GcPair* pair = makePair(t, context->method, reference); switch (fieldCode) { case ByteField: @@ -6304,8 +6304,8 @@ GcArray* translateExceptionHandlerTable(MyThread* t, object type; if (exceptionHandlerCatchType(oldHandler)) { - type = reinterpret_cast(resolveClassInPool( - t, context->method, exceptionHandlerCatchType(oldHandler) - 1)); + type = resolveClassInPool( + t, context->method, exceptionHandlerCatchType(oldHandler) - 1); } else { type = 0; } @@ -6322,7 +6322,7 @@ GcArray* translateExceptionHandlerTable(MyThread* t, newTable = truncateArray(t, newTable, ni + 1); } - newTable->setBodyElement(t, 0, reinterpret_cast(newIndex)); + newTable->setBodyElement(t, 0, newIndex); return newTable; } else { @@ -6837,7 +6837,7 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context) GcCode* code = context->method->code(); code = makeCode - (t, 0, 0, reinterpret_cast(newExceptionHandlerTable), newLineNumberTable, + (t, 0, 0, newExceptionHandlerTable, newLineNumberTable, reinterpret_cast(start), codeSize, code->maxStack(), code->maxLocals(), 0); @@ -7203,7 +7203,7 @@ invokeNativeSlow(MyThread* t, GcMethod* method, void* function) if (method->flags() & ACC_SYNCHRONIZED) { if (method->flags() & ACC_STATIC) { - acquire(t, reinterpret_cast(method->class_())); + acquire(t, method->class_()); } else { acquire(t, *reinterpret_cast(RUNTIME_ARRAY_BODY(args)[1])); } @@ -7227,7 +7227,7 @@ invokeNativeSlow(MyThread* t, GcMethod* method, void* function) if (method->flags() & ACC_SYNCHRONIZED) { if (method->flags() & ACC_STATIC) { - release(t, reinterpret_cast(method->class_())); + release(t, method->class_()); } else { release(t, *reinterpret_cast(RUNTIME_ARRAY_BODY(args)[1])); } @@ -7698,7 +7698,7 @@ callContinuation(MyThread* t, GcContinuation* continuation, object result, and unwindContext->continuation()) { nextContinuation = cast(t, unwindContext->continuation()); - result = reinterpret_cast(makeUnwindResult(t, continuation, result, exception)); + result = makeUnwindResult(t, continuation, result, exception); action = Unwind; } else if (rewindContext and rewindContext->continuation()) @@ -7826,7 +7826,7 @@ dynamicWind(MyThread* t, object before, object thunk, object after) t->continuation->context(), before, after, - reinterpret_cast(t->continuation), + t->continuation, t->trace->originalMethod); t->continuation->setContext(t, newContext); @@ -8072,12 +8072,12 @@ invoke(Thread* thread, GcMethod* method, ArgumentList* arguments) case ShortField: case FloatField: case IntField: - r = reinterpret_cast(makeInt(t, result)); + r = makeInt(t, result); break; case LongField: case DoubleField: - r = reinterpret_cast(makeLong(t, result)); + r = makeLong(t, result); break; case ObjectField: @@ -8814,11 +8814,11 @@ class MyProcessor: public Processor { virtual void visitRoots(Thread* t, HeapWalker* w) { bootImage->methodTree - = w->visitRoot(reinterpret_cast(compileRoots(t)->methodTree())); + = w->visitRoot(compileRoots(t)->methodTree()); bootImage->methodTreeSentinal = w->visitRoot( - reinterpret_cast(compileRoots(t)->methodTreeSentinal())); + compileRoots(t)->methodTreeSentinal()); bootImage->virtualThunks = w->visitRoot( - reinterpret_cast(compileRoots(t)->virtualThunks())); + compileRoots(t)->virtualThunks()); } virtual void normalizeVirtualThunks(Thread* t) { @@ -8850,7 +8850,7 @@ class MyProcessor: public Processor { p->address() - reinterpret_cast(codeAllocator.memory.begin())); table[index++] = targetVW( - w->map()->find(reinterpret_cast(p->target())) + w->map()->find(p->target()) | (static_cast(p->flags()) << TargetBootShift)); } } @@ -9219,7 +9219,7 @@ resizeTable(MyThread* t, GcArray* oldTable, unsigned newLength) oldNode->flags(), cast(t, newTable->body()[index])); - newTable->setBodyElement(t, index, reinterpret_cast(newNode)); + newTable->setBodyElement(t, index, newNode); } } @@ -9247,7 +9247,7 @@ insertCallNode(MyThread* t, GcArray* table, unsigned* size, GcCallNode* node) unsigned index = static_cast(key) & (table->length() - 1); node->setNext(t, cast(t, table->body()[index])); - table->setBodyElement(t, index, reinterpret_cast(node)); + table->setBodyElement(t, index, node); return table; } @@ -9271,7 +9271,7 @@ makeClassMap(Thread* t, unsigned* table, unsigned count, for (unsigned i = 0; i < count; ++i) { GcClass* c = cast(t, bootObject(heap, table[i])); - hashMapInsert(t, map, reinterpret_cast(c->name()), reinterpret_cast(c), byteArrayHash); + hashMapInsert(t, map, c->name(), c, byteArrayHash); } return map; @@ -9285,12 +9285,12 @@ makeStaticTableArray(Thread* t, unsigned* bootTable, unsigned bootCount, for (unsigned i = 0; i < bootCount; ++i) { array->setBodyElement(t, i, - reinterpret_cast(cast(t, bootObject(heap, bootTable[i]))->staticTable())); + cast(t, bootObject(heap, bootTable[i]))->staticTable()); } for (unsigned i = 0; i < appCount; ++i) { array->setBodyElement(t, (bootCount + i), - reinterpret_cast(cast(t, bootObject(heap, appTable[i]))->staticTable())); + cast(t, bootObject(heap, appTable[i]))->staticTable()); } return array; @@ -9533,7 +9533,7 @@ boot(MyThread* t, BootImage* image, uint8_t* code) { GcHashMap* map = makeClassMap(t, bootClassTable, image->bootClassCount, heap); // sequence point, for gc (don't recombine statements) - roots(t)->bootLoader()->setMap(t, reinterpret_cast(map)); + roots(t)->bootLoader()->setMap(t, map); } roots(t)->bootLoader()->as(t)->finder() = t->m->bootFinder; @@ -9541,7 +9541,7 @@ boot(MyThread* t, BootImage* image, uint8_t* code) { GcHashMap* map = makeClassMap(t, appClassTable, image->appClassCount, heap); // sequence point, for gc (don't recombine statements) - roots(t)->appLoader()->setMap(t, reinterpret_cast(map)); + roots(t)->appLoader()->setMap(t, map); } roots(t)->appLoader()->as(t)->finder() = t->m->appFinder; @@ -9569,7 +9569,7 @@ boot(MyThread* t, BootImage* image, uint8_t* code) (t, bootClassTable, image->bootClassCount, appClassTable, image->appClassCount, heap); // sequence point, for gc (don't recombine statements) - compileRoots(t)->setStaticTableArray(t, reinterpret_cast(staticTableArray)); + compileRoots(t)->setStaticTableArray(t, staticTableArray); } findThunks(t, image, code); @@ -10048,7 +10048,7 @@ compile(MyThread* t, FixedAllocator* allocator, BootContext* bootContext, &(context.zone), compileRoots(t)->methodTree(), methodCompiled(t, clone), - reinterpret_cast(clone), + clone, compileRoots(t)->methodTreeSentinal(), compareIpToMethodBounds); // sequence point, for gc (don't recombine statements) @@ -10071,7 +10071,7 @@ compile(MyThread* t, FixedAllocator* allocator, BootContext* bootContext, treeUpdate(t, compileRoots(t)->methodTree(), methodCompiled(t, clone), - reinterpret_cast(method), + method, compileRoots(t)->methodTreeSentinal(), compareIpToMethodBounds); } diff --git a/src/interpret.cpp b/src/interpret.cpp index dbfa8a02c2..c0e3bb8bdf 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -318,7 +318,7 @@ pushFrame(Thread* t, GcMethod* method) // to release a monitor we never successfully acquired when we try // to pop the frame back off. if (method->flags() & ACC_STATIC) { - acquire(t, reinterpret_cast(method->class_())); + acquire(t, method->class_()); } else { acquire(t, peekObject(t, base)); } @@ -345,7 +345,7 @@ pushFrame(Thread* t, GcMethod* method) t->sp = frame + FrameFootprint; pokeInt(t, frame + FrameBaseOffset, base); - pokeObject(t, frame + FrameMethodOffset, reinterpret_cast(method)); + pokeObject(t, frame + FrameMethodOffset, method); pokeInt(t, t->frame + FrameIpOffset, 0); } @@ -356,7 +356,7 @@ popFrame(Thread* t) if (method->flags() & ACC_SYNCHRONIZED) { if (method->flags() & ACC_STATIC) { - release(t, reinterpret_cast(method->class_())); + release(t, method->class_()); } else { release(t, peekObject(t, frameBase(t, t->frame))); } @@ -889,7 +889,7 @@ interpret3(Thread* t, const int base) GcClass* class_ = resolveClassInPool(t, frameMethod(t, frame), index - 1); - pushObject(t, reinterpret_cast(makeObjectArray(t, class_, count))); + pushObject(t, makeObjectArray(t, class_, count)); } else { exception = makeThrowable (t, GcNegativeArraySizeException::Type, "%d", count); @@ -1498,7 +1498,7 @@ interpret3(Thread* t, const int base) ACQUIRE_FIELD_FOR_READ(t, field); - pushField(t, reinterpret_cast(field->class_()->staticTable()), field); + pushField(t, field->class_()->staticTable(), field); } goto loop; case goto_: { @@ -1948,7 +1948,7 @@ interpret3(Thread* t, const int base) pushInt(t, result); goto loop; } else { - return reinterpret_cast(makeInt(t, result)); + return makeInt(t, result); } } goto loop; @@ -2258,7 +2258,7 @@ interpret3(Thread* t, const int base) pushLong(t, result); goto loop; } else { - return reinterpret_cast(makeLong(t, result)); + return makeLong(t, result); } } goto loop; @@ -2360,7 +2360,7 @@ interpret3(Thread* t, const int base) } } - object array = reinterpret_cast(makeArray(t, RUNTIME_ARRAY_BODY(counts)[0])); + object array = makeArray(t, RUNTIME_ARRAY_BODY(counts)[0]); setObjectClass(t, array, class_); PROTECT(t, array); @@ -2390,35 +2390,35 @@ interpret3(Thread* t, const int base) switch (type) { case T_BOOLEAN: - array = reinterpret_cast(makeBooleanArray(t, count)); + array = makeBooleanArray(t, count); break; case T_CHAR: - array = reinterpret_cast(makeCharArray(t, count)); + array = makeCharArray(t, count); break; case T_FLOAT: - array = reinterpret_cast(makeFloatArray(t, count)); + array = makeFloatArray(t, count); break; case T_DOUBLE: - array = reinterpret_cast(makeDoubleArray(t, count)); + array = makeDoubleArray(t, count); break; case T_BYTE: - array = reinterpret_cast(makeByteArray(t, count)); + array = makeByteArray(t, count); break; case T_SHORT: - array = reinterpret_cast(makeShortArray(t, count)); + array = makeShortArray(t, count); break; case T_INT: - array = reinterpret_cast(makeIntArray(t, count)); + array = makeIntArray(t, count); break; case T_LONG: - array = reinterpret_cast(makeLongArray(t, count)); + array = makeLongArray(t, count); break; default: abort(t); @@ -2560,7 +2560,7 @@ interpret3(Thread* t, const int base) } break; case ObjectField: { - setField(t, reinterpret_cast(table), field->offset(), popObject(t)); + setField(t, table, field->offset(), popObject(t)); } break; default: abort(t); @@ -2756,7 +2756,7 @@ interpret3(Thread* t, const int base) if (eh) { sp = frame + FrameFootprint; ip = exceptionHandlerIp(eh); - pushObject(t, reinterpret_cast(exception)); + pushObject(t, exception); exception = 0; goto loop; } @@ -2937,12 +2937,12 @@ invoke(Thread* t, GcMethod* method) case ShortField: case FloatField: case IntField: - result = reinterpret_cast(makeInt(t, popInt(t))); + result = makeInt(t, popInt(t)); break; case LongField: case DoubleField: - result = reinterpret_cast(makeLong(t, popLong(t))); + result = makeLong(t, popLong(t)); break; case ObjectField: diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 2fa0346aec..8e5598c304 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -187,7 +187,7 @@ GetStringCritical(Thread* t, jstring s, jboolean* isCopy) *isCopy = true; } - object data = reinterpret_cast((*s)->data()); + object data = (*s)->data(); if (objectClass(t, data) == type(t, GcByteArray::Type)) { return GetStringChars(t, s, isCopy); } else { @@ -267,8 +267,8 @@ newString(Thread* t, uintptr_t* arguments) return reinterpret_cast( makeLocalReference(t, - reinterpret_cast(t->m->classpath->makeString( - t, reinterpret_cast(a), 0, size)))); + t->m->classpath->makeString( + t, a, 0, size))); } jstring JNICALL @@ -291,8 +291,8 @@ newStringUTF(Thread* t, uintptr_t* arguments) return reinterpret_cast (makeLocalReference - (t, reinterpret_cast(t->m->classpath->makeString - (t, array, 0, fieldAtOffset(array, BytesPerWord) - 1)))); + (t, t->m->classpath->makeString + (t, array, 0, fieldAtOffset(array, BytesPerWord) - 1))); } jstring JNICALL @@ -325,14 +325,14 @@ defineClass(Thread* t, uintptr_t* arguments) return reinterpret_cast(makeLocalReference( t, - reinterpret_cast(getJClass(t, + getJClass(t, cast( t, defineClass(t, loader ? cast(t, *loader) : roots(t)->bootLoader(), buffer, - length)))))); + length))))); } jclass JNICALL @@ -368,7 +368,7 @@ findClass(Thread* t, uintptr_t* arguments) initClass(t, c); } - return reinterpret_cast(makeLocalReference(t, reinterpret_cast(getJClass(t, c)))); + return reinterpret_cast(makeLocalReference(t, getJClass(t, c))); } jclass JNICALL @@ -457,7 +457,7 @@ getObjectClass(Thread* t, uintptr_t* arguments) jobject o = reinterpret_cast(arguments[0]); return reinterpret_cast(makeLocalReference( - t, reinterpret_cast(getJClass(t, objectClass(t, *o))))); + t, getJClass(t, objectClass(t, *o)))); } jclass JNICALL @@ -477,7 +477,7 @@ getSuperclass(Thread* t, uintptr_t* arguments) } else { GcClass* super = class_->super(); return super ? reinterpret_cast - (makeLocalReference(t, reinterpret_cast(getJClass(t, super)))) : 0; + (makeLocalReference(t, getJClass(t, super))) : 0; } } @@ -549,7 +549,7 @@ methodID(Thread* t, GcMethod* method) if (method->nativeID() == 0) { GcVector* v = vectorAppend( - t, roots(t)->jNIMethodTable(), reinterpret_cast(method)); + t, roots(t)->jNIMethodTable(), method); // sequence point, for gc (don't recombine statements) roots(t)->setJNIMethodTable(t, v); @@ -1503,7 +1503,7 @@ fieldID(Thread* t, GcField* field) if (field->nativeID() == 0) { GcVector* v = vectorAppend( - t, roots(t)->jNIFieldTable(), reinterpret_cast(field)); + t, roots(t)->jNIFieldTable(), field); // sequence point, for gc (don't recombine statements) roots(t)->setJNIFieldTable(t, v); @@ -2229,7 +2229,7 @@ setStaticObjectField(Thread* t, uintptr_t* arguments) PROTECT(t, field); ACQUIRE_FIELD_FOR_WRITE(t, field); - setField(t, reinterpret_cast(c->vmClass()->staticTable()), field->offset(), + setField(t, c->vmClass()->staticTable(), field->offset(), (v ? *v : 0)); return 1; @@ -2547,7 +2547,7 @@ ExceptionOccurred(Thread* t) { ENTER(t, Thread::ActiveState); - return reinterpret_cast(makeLocalReference(t, reinterpret_cast(t->exception))); + return reinterpret_cast(makeLocalReference(t, t->exception)); } void JNICALL @@ -2578,7 +2578,7 @@ newObjectArray(Thread* t, uintptr_t* arguments) for (jsize i = 0; i < length; ++i) { reinterpret_cast(a)->setBodyElement(t, i, value); } - return reinterpret_cast(makeLocalReference(t, reinterpret_cast(a))); + return reinterpret_cast(makeLocalReference(t, a)); } jobjectArray JNICALL @@ -2633,7 +2633,7 @@ NewBooleanArray(Thread* t, jsize length) object makeByteArray0(Thread* t, unsigned length) { - return reinterpret_cast(makeByteArray(t, length)); + return makeByteArray(t, length); } jbyteArray JNICALL diff --git a/src/machine.cpp b/src/machine.cpp index ce85fe1c66..5fd60b57f0 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -398,7 +398,7 @@ finalizerTargetUnreachable(Thread* t, Heap::Visitor* v, GcFinalizer** p) if (function) { // TODO: use set() here? - finalizer->next() = reinterpret_cast(t->m->finalizeQueue); + finalizer->next() = t->m->finalizeQueue; t->m->finalizeQueue = finalizer; } else { finalizer->setQueueTarget(t, finalizer->target()); @@ -500,7 +500,7 @@ void clearTargetIfFinalizable(Thread* t, GcJreference* r) { if (isFinalizable - (t, reinterpret_cast(t->m->heap->follow(r->target())))) + (t, t->m->heap->follow(r->target()))) { r->target() = 0; } @@ -550,7 +550,7 @@ postVisit(Thread* t, Heap::Visitor* v) *p = cast(t, finalizer->next()); finalizer->next() = unreachable; - unreachable = reinterpret_cast(finalizer); + unreachable = finalizer; } else { p = reinterpret_cast(&(*p)->next()); } @@ -570,7 +570,7 @@ postVisit(Thread* t, Heap::Visitor* v) GcFinalizer* finalizer = *p; *p = cast(t, finalizer->next()); - finalizer->next() = reinterpret_cast(firstNewTenuredFinalizer); + finalizer->next() = firstNewTenuredFinalizer; firstNewTenuredFinalizer = finalizer; } else { p = reinterpret_cast(&(*p)->next()); @@ -611,7 +611,7 @@ postVisit(Thread* t, Heap::Visitor* v) GcJreference* reference = (*p); *p = cast(t, reference->vmNext()); - reference->vmNext() = reinterpret_cast(firstNewTenuredWeakReference); + reference->vmNext() = firstNewTenuredWeakReference; firstNewTenuredWeakReference = reference; } else { p = reinterpret_cast(&(*p)->vmNext()); @@ -629,7 +629,7 @@ postVisit(Thread* t, Heap::Visitor* v) *p = cast(t, finalizer->next()); finalizer->next() = unreachable; - unreachable = reinterpret_cast(finalizer); + unreachable = finalizer; } else { p = reinterpret_cast(&(*p)->next()); } @@ -666,13 +666,13 @@ postVisit(Thread* t, Heap::Visitor* v) } if (lastNewTenuredFinalizer) { - lastNewTenuredFinalizer->next() = reinterpret_cast(m->tenuredFinalizers); + lastNewTenuredFinalizer->next() = m->tenuredFinalizers; m->tenuredFinalizers = firstNewTenuredFinalizer; } if (lastNewTenuredWeakReference) { lastNewTenuredWeakReference->vmNext() - = reinterpret_cast(m->tenuredWeakReferences); + = m->tenuredWeakReferences; m->tenuredWeakReferences = firstNewTenuredWeakReference; } @@ -841,7 +841,7 @@ object parseUtf8(Thread* t, AbstractStream& s, unsigned length) if (a & 0x80) { if (a & 0x20) { // 3 bytes - return reinterpret_cast(parseUtf8NonAscii(t, s, value, vi, si, a, NoByte)); + return parseUtf8NonAscii(t, s, value, vi, si, a, NoByte); } else { // 2 bytes unsigned b = s.read1(); @@ -851,7 +851,7 @@ object parseUtf8(Thread* t, AbstractStream& s, unsigned length) assertT(t, si < length); value->body()[vi++] = 0; } else { - return reinterpret_cast(parseUtf8NonAscii(t, s, value, vi, si, a, b)); + return parseUtf8NonAscii(t, s, value, vi, si, a, b); } } } else { @@ -867,7 +867,7 @@ object parseUtf8(Thread* t, AbstractStream& s, unsigned length) value = v; } - return reinterpret_cast(value); + return value; } GcByteArray* @@ -896,12 +896,12 @@ internByteArray(Thread* t, GcByteArray* array) ACQUIRE(t, t->m->referenceLock); GcTriple* n = hashMapFindNode - (t, roots(t)->byteArrayMap(), reinterpret_cast(array), byteArrayHash, byteArrayEqual); + (t, roots(t)->byteArrayMap(), array, byteArrayHash, byteArrayEqual); if (n) { return cast(t, cast(t, n->first())->target()); } else { - hashMapInsert(t, roots(t)->byteArrayMap(), reinterpret_cast(array), 0, byteArrayHash); - addFinalizer(t, reinterpret_cast(array), removeByteArray); + hashMapInsert(t, roots(t)->byteArrayMap(), array, 0, byteArrayHash); + addFinalizer(t, array, removeByteArray); return array; } } @@ -965,8 +965,8 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne parsePoolEntry(t, s, index, pool, si); object value = parseUtf8(t, cast(t, singletonObject(t, pool, si))); - value = reinterpret_cast(t->m->classpath->makeString - (t, value, 0, fieldAtOffset(value, BytesPerWord) - 1)); + value = t->m->classpath->makeString + (t, value, 0, fieldAtOffset(value, BytesPerWord) - 1); value = intern(t, value); pool->setBodyElement(t, i, reinterpret_cast(value)); @@ -986,7 +986,7 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne GcByteArray* name = cast(t, singletonObject(t, pool, ni)); GcByteArray* type = cast(t, singletonObject(t, pool, ti)); - GcPair* value = makePair(t, reinterpret_cast(name), reinterpret_cast(type)); + GcPair* value = makePair(t, name, type); pool->setBodyElement(t, i, reinterpret_cast(value)); if(DebugClassReader) { @@ -1008,12 +1008,12 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne GcByteArray* className = cast(t, singletonObject(t, pool, ci))->name(); GcPair* nameAndType = cast(t, singletonObject(t, pool, nti)); - object value = reinterpret_cast( + object value = makeReference(t, 0, className, cast(t, nameAndType->first()), - cast(t, nameAndType->second()))); + cast(t, nameAndType->second())); pool->setBodyElement(t, i, reinterpret_cast(value)); if(DebugClassReader) { @@ -1086,8 +1086,8 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne bootstrap, -1, 0, - reinterpret_cast(pool), - reinterpret_cast(template_), + pool, + template_, 0)); pool->setBodyElement(t, i, reinterpret_cast(value)); @@ -1207,8 +1207,8 @@ addInterfaces(Thread* t, GcClass* class_, GcHashMap* map) GcByteArray* name = interface->name(); hashMapInsertMaybe(t, map, - reinterpret_cast(name), - reinterpret_cast(interface), + name, + interface, byteArrayHash, byteArrayEqual); } @@ -1224,9 +1224,9 @@ getClassAddendum(Thread* t, GcClass* class_, GcSingleton* pool) addendum = makeClassAddendum(t, pool, 0, 0, 0, 0, -1, 0, 0); setField(t, - reinterpret_cast(class_), + class_, ClassAddendum, - reinterpret_cast(addendum)); + addendum); } return addendum; } @@ -1253,7 +1253,7 @@ parseInterfaceTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool, table = makeArray(t, count); GcClassAddendum* addendum = getClassAddendum(t, class_, pool); - addendum->setInterfaceTable(t, reinterpret_cast(table)); + addendum->setInterfaceTable(t, table); } for (unsigned i = 0; i < count; ++i) { @@ -1265,9 +1265,9 @@ parseInterfaceTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool, PROTECT(t, interface); - table->setBodyElement(t, i, reinterpret_cast(interface)); + table->setBodyElement(t, i, interface); - hashMapInsertMaybe(t, map, reinterpret_cast(name), reinterpret_cast(interface), byteArrayHash, byteArrayEqual); + hashMapInsertMaybe(t, map, name, interface, byteArrayHash, byteArrayEqual); addInterfaces(t, interface, map); } @@ -1285,7 +1285,7 @@ parseInterfaceTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool, for (HashMapIterator it(t, map); it.hasMore();) { GcClass* interface = cast(t, it.next()->second()); - interfaceTable->setBodyElement(t, i, reinterpret_cast(interface)); + interfaceTable->setBodyElement(t, i, interface); ++ i; if ((class_->flags() & ACC_INTERFACE) == 0) { @@ -1294,7 +1294,7 @@ parseInterfaceTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool, // we'll fill in this table in parseMethodTable(): GcArray* vtable = makeArray(t, vt->length()); - interfaceTable->setBodyElement(t, i, reinterpret_cast(vtable)); + interfaceTable->setBodyElement(t, i, vtable); } ++i; @@ -1302,7 +1302,7 @@ parseInterfaceTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool, } } - class_->setInterfaceTable(t, reinterpret_cast(interfaceTable)); + class_->setInterfaceTable(t, interfaceTable); } void @@ -1373,7 +1373,7 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) s.read(reinterpret_cast(body->body().begin()), length); - addendum->setAnnotationTable(t, reinterpret_cast(body)); + addendum->setAnnotationTable(t, body); } else { s.skip(length); } @@ -1414,10 +1414,10 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) memberOffset += size; } - fieldTable->setBodyElement(t, i, reinterpret_cast(field)); + fieldTable->setBodyElement(t, i, field); } - class_->setFieldTable(t, reinterpret_cast(fieldTable)); + class_->setFieldTable(t, fieldTable); if (staticCount) { unsigned footprint = ceilingDivide(staticOffset - (BytesPerWord * 2), @@ -1936,7 +1936,7 @@ parseCode(Thread* t, Stream& s, GcSingleton* pool) (start, end, ip, catchType); } - code->setExceptionHandlerTable(t, reinterpret_cast(eht)); + code->setExceptionHandlerTable(t, eht); } unsigned attributeCount = s.read2(); @@ -1991,7 +1991,7 @@ addInterfaceMethods(Thread* t, GcClass* class_, GcHashMap* virtualMap, method = cast(t, vtable->body()[j]); GcTriple* n = hashMapFindNode(t, virtualMap, - reinterpret_cast(method), + method, methodHash, methodEqual); if (n == 0) { @@ -2012,15 +2012,15 @@ addInterfaceMethods(Thread* t, GcClass* class_, GcHashMap* virtualMap, hashMapInsert(t, virtualMap, - reinterpret_cast(method), - reinterpret_cast(method), + method, + method, methodHash); if (makeList) { if (list == 0) { list = vm::makeList(t, 0, 0, 0); } - listAppend(t, list, reinterpret_cast(method)); + listAppend(t, list, method); } } } @@ -2115,7 +2115,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) for (unsigned i = 0; i < exceptionCount; ++i) { body->body()[i] = s.read2(); } - addendum->setExceptionTable(t, reinterpret_cast(body)); + addendum->setExceptionTable(t, body); } else if (vm::strcmp(reinterpret_cast ("AnnotationDefault"), attributeName->body().begin()) == 0) @@ -2128,7 +2128,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) s.read(reinterpret_cast(body->body().begin()), length); - addendum->setAnnotationDefault(t, reinterpret_cast(body)); + addendum->setAnnotationDefault(t, body); } else if (vm::strcmp(reinterpret_cast("Signature"), attributeName->body().begin()) == 0) { @@ -2149,7 +2149,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) s.read(reinterpret_cast(body->body().begin()), length); - addendum->setAnnotationTable(t, reinterpret_cast(body)); + addendum->setAnnotationTable(t, body); } else if (vm::strcmp(reinterpret_cast ("RuntimeVisibleParameterAnnotations"), attributeName->body().begin()) == 0) @@ -2162,7 +2162,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) s.read(reinterpret_cast(body->body().begin()), length); - addendum->setParameterAnnotationTable(t, reinterpret_cast(body)); + addendum->setParameterAnnotationTable(t, body); } else { s.skip(length); } @@ -2197,18 +2197,18 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) ++ declaredVirtualCount; GcTriple* p = hashMapFindNode - (t, virtualMap, reinterpret_cast(method), methodHash, methodEqual); + (t, virtualMap, method, methodHash, methodEqual); if (p) { method->offset() = cast(t, p->first())->offset(); - p->setSecond(t, reinterpret_cast(method)); + p->setSecond(t, method); } else { method->offset() = virtualCount++; - listAppend(t, newVirtuals, reinterpret_cast(method)); + listAppend(t, newVirtuals, method); - hashMapInsert(t, virtualMap, reinterpret_cast(method), reinterpret_cast(method), methodHash); + hashMapInsert(t, virtualMap, method, method, methodHash); } if (UNLIKELY((class_->flags() & ACC_INTERFACE) == 0 @@ -2238,10 +2238,10 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) } } - methodTable->setBodyElement(t, i, reinterpret_cast(method)); + methodTable->setBodyElement(t, i, method); } - class_->setMethodTable(t, reinterpret_cast(methodTable)); + class_->setMethodTable(t, methodTable); } @@ -2258,7 +2258,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) { if (class_->super()) { // inherit virtual table from superclass - class_->setVirtualTable(t, reinterpret_cast(superVirtualTable)); + class_->setVirtualTable(t, superVirtualTable); if (class_->super()->interfaceTable() and cast(t, class_->interfaceTable())->length() @@ -2274,7 +2274,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) // apparently, Object does not have any virtual methods. We // give it a vtable anyway so code doesn't break elsewhere. GcArray* vtable = makeArray(t, 0); - class_->setVirtualTable(t, reinterpret_cast(vtable)); + class_->setVirtualTable(t, vtable); } } else if (virtualCount) { // generate class vtable @@ -2288,7 +2288,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) for (HashMapIterator it(t, virtualMap); it.hasMore();) { GcMethod* method = cast(t, it.next()->first()); assertT(t, vtable->body()[method->offset()] == 0); - vtable->setBodyElement(t, method->offset(), reinterpret_cast(method)); + vtable->setBodyElement(t, method->offset(), method); ++ i; } } else { @@ -2331,7 +2331,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) } } - mark(t, reinterpret_cast(newMethodTable), ArrayBody, oldLength); + mark(t, newMethodTable, ArrayBody, oldLength); unsigned mti = oldLength; for (GcPair* p = cast(t, abstractVirtuals->front()); @@ -2346,12 +2346,12 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) assertT(t, newMethodTable->length() == mti); - class_->setMethodTable(t, reinterpret_cast(newMethodTable)); + class_->setMethodTable(t, newMethodTable); } assertT(t, vtable->length() == i); - class_->setVirtualTable(t, reinterpret_cast(vtable)); + class_->setVirtualTable(t, vtable); } if (populateInterfaceVtables) { @@ -2420,11 +2420,11 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) name ? cast(t, singletonObject(t, pool, name - 1)) : 0, flags); - table->setBodyElement(t, i, reinterpret_cast(reference)); + table->setBodyElement(t, i, reference); } GcClassAddendum* addendum = getClassAddendum(t, class_, pool); - addendum->setInnerClassTable(t, reinterpret_cast(table)); + addendum->setInnerClassTable(t, table); } else if (vm::strcmp(reinterpret_cast ("RuntimeVisibleAnnotations"), name->body().begin()) == 0) @@ -2434,7 +2434,7 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) s.read(reinterpret_cast(body->body().begin()), length); GcClassAddendum* addendum = getClassAddendum(t, class_, pool); - addendum->setAnnotationTable(t, reinterpret_cast(body)); + addendum->setAnnotationTable(t, body); } else if (vm::strcmp(reinterpret_cast ("EnclosingMethod"), name->body().begin()) == 0) @@ -2555,8 +2555,8 @@ makeArrayClass(Thread* t, GcClassLoader* loader, unsigned dimensions, GcByteArra spec, 0, type(t, GcJobject::Type), - reinterpret_cast(roots(t)->arrayInterfaceTable()), - reinterpret_cast(vtable), + roots(t)->arrayInterfaceTable(), + vtable, 0, 0, 0, @@ -2581,13 +2581,13 @@ saveLoadedClass(Thread* t, GcClassLoader* loader, GcClass* c) if (loader->map() == 0) { GcHashMap* map = makeHashMap(t, 0, 0); - loader->setMap(t, reinterpret_cast(map)); + loader->setMap(t, map); } hashMapInsert(t, cast(t, loader->map()), - reinterpret_cast(c->name()), - reinterpret_cast(c), + c->name(), + c, byteArrayHash); } @@ -2638,7 +2638,7 @@ makeArrayClass(Thread* t, GcClassLoader* loader, GcByteArray* spec, bool throw_, } GcClass* elementClass = cast(t, hashMapFind - (t, roots(t)->bootstrapClassMap(), reinterpret_cast(elementSpec), byteArrayHash, + (t, roots(t)->bootstrapClassMap(), elementSpec, byteArrayHash, byteArrayEqual)); if (elementClass == 0) { @@ -2672,7 +2672,7 @@ resolveArrayClass(Thread* t, GcClassLoader* loader, GcByteArray* spec, bool thro GcClass* c = cast(t, hashMapFind(t, roots(t)->bootstrapClassMap(), - reinterpret_cast(spec), + spec, byteArrayHash, byteArrayEqual)); @@ -2774,12 +2774,12 @@ bootJavaClass(Thread* t, Gc::Type type, int superType, const char* name, vtable = cast(t, vm::type(t, static_cast(superType))->virtualTable()); } - class_->setVirtualTable(t, reinterpret_cast(vtable)); + class_->setVirtualTable(t, vtable); t->m->processor->initVtable(t, class_); hashMapInsert - (t, roots(t)->bootstrapClassMap(), reinterpret_cast(n), reinterpret_cast(class_), byteArrayHash); + (t, roots(t)->bootstrapClassMap(), n, class_, byteArrayHash); } void @@ -2794,9 +2794,9 @@ makeArrayInterfaceTable(Thread* t) { GcArray* interfaceTable = makeArray(t, 4); - interfaceTable->setBodyElement(t, 0, reinterpret_cast(type(t, GcSerializable::Type))); + interfaceTable->setBodyElement(t, 0, type(t, GcSerializable::Type)); - interfaceTable->setBodyElement(t, 2, reinterpret_cast(type(t, GcCloneable::Type))); + interfaceTable->setBodyElement(t, 2, type(t, GcCloneable::Type)); roots(t)->setArrayInterfaceTable(t, interfaceTable); } @@ -2889,13 +2889,13 @@ boot(Thread* t) type(t, GcDoubleArray::Type)->setArrayElementClass(t, type(t, GcJdouble::Type)); { GcHashMap* map = makeHashMap(t, 0, 0); - roots(t)->bootLoader()->setMap(t, reinterpret_cast(map)); + roots(t)->bootLoader()->setMap(t, map); } roots(t)->bootLoader()->as(t)->finder() = m->bootFinder; { GcHashMap* map = makeHashMap(t, 0, 0); - roots(t)->appLoader()->setMap(t, reinterpret_cast(map)); + roots(t)->appLoader()->setMap(t, map); } roots(t)->appLoader()->as(t)->finder() = m->appFinder; @@ -2916,21 +2916,21 @@ boot(Thread* t) makeArrayInterfaceTable(t); - type(t, GcBooleanArray::Type)->setInterfaceTable(t, reinterpret_cast(roots(t)->arrayInterfaceTable())); - type(t, GcByteArray::Type)->setInterfaceTable(t, reinterpret_cast(roots(t)->arrayInterfaceTable())); - type(t, GcCharArray::Type)->setInterfaceTable(t, reinterpret_cast(roots(t)->arrayInterfaceTable())); - type(t, GcShortArray::Type)->setInterfaceTable(t, reinterpret_cast(roots(t)->arrayInterfaceTable())); - type(t, GcIntArray::Type)->setInterfaceTable(t, reinterpret_cast(roots(t)->arrayInterfaceTable())); - type(t, GcLongArray::Type)->setInterfaceTable(t, reinterpret_cast(roots(t)->arrayInterfaceTable())); - type(t, GcFloatArray::Type)->setInterfaceTable(t, reinterpret_cast(roots(t)->arrayInterfaceTable())); - type(t, GcDoubleArray::Type)->setInterfaceTable(t, reinterpret_cast(roots(t)->arrayInterfaceTable())); + type(t, GcBooleanArray::Type)->setInterfaceTable(t, roots(t)->arrayInterfaceTable()); + type(t, GcByteArray::Type)->setInterfaceTable(t, roots(t)->arrayInterfaceTable()); + type(t, GcCharArray::Type)->setInterfaceTable(t, roots(t)->arrayInterfaceTable()); + type(t, GcShortArray::Type)->setInterfaceTable(t, roots(t)->arrayInterfaceTable()); + type(t, GcIntArray::Type)->setInterfaceTable(t, roots(t)->arrayInterfaceTable()); + type(t, GcLongArray::Type)->setInterfaceTable(t, roots(t)->arrayInterfaceTable()); + type(t, GcFloatArray::Type)->setInterfaceTable(t, roots(t)->arrayInterfaceTable()); + type(t, GcDoubleArray::Type)->setInterfaceTable(t, roots(t)->arrayInterfaceTable()); m->processor->boot(t, 0, 0); { GcCode* bootCode = makeCode(t, 0, 0, 0, 0, 0, 0, 0, 0, 1); bootCode->body()[0] = impdep1; - object bootMethod = reinterpret_cast(makeMethod - (t, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bootCode)); + object bootMethod = makeMethod + (t, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bootCode); PROTECT(t, bootMethod); #include "type-java-initializations.cpp" @@ -3173,7 +3173,7 @@ updatePackageMap(Thread* t, GcClass* class_) PROTECT(t, key); hashMapRemove - (t, roots(t)->packageMap(), reinterpret_cast(key), byteArrayHash, + (t, roots(t)->packageMap(), key, byteArrayHash, byteArrayEqual); GcByteArray* source = class_->source(); @@ -3194,7 +3194,7 @@ updatePackageMap(Thread* t, GcClass* class_) } hashMapInsert - (t, roots(t)->packageMap(), reinterpret_cast(key), reinterpret_cast(source), byteArrayHash); + (t, roots(t)->packageMap(), key, source, byteArrayHash); } } } @@ -3911,7 +3911,7 @@ makeNewGeneral(Thread* t, GcClass* class_) if (class_->vmFlags() & WeakReferenceFlag) { ACQUIRE(t, t->m->referenceLock); - cast(t, instance)->vmNext() = reinterpret_cast(t->m->weakReferences); + cast(t, instance)->vmNext() = t->m->weakReferences; t->m->weakReferences = cast(t, instance); } @@ -3979,7 +3979,7 @@ makeString(Thread* t, const char* format, ...) va_end(a); if (s) { - return t->m->classpath->makeString(t, reinterpret_cast(s), 0, s->length() - 1); + return t->m->classpath->makeString(t, s, 0, s->length() - 1); } else { size *= 2; } @@ -3992,7 +3992,7 @@ stringUTFLength(Thread* t, GcString* string, unsigned start, unsigned length) unsigned result = 0; if (length) { - object data = reinterpret_cast(string->data()); + object data = string->data(); if (objectClass(t, data) == type(t, GcByteArray::Type)) { result = length; } else { @@ -4015,7 +4015,7 @@ stringChars(Thread* t, GcString* string, unsigned start, unsigned length, char* chars) { if (length) { - object data = reinterpret_cast(string->data()); + object data = string->data(); if (objectClass(t, data) == type(t, GcByteArray::Type)) { GcByteArray* b = cast(t, data); memcpy(chars, @@ -4036,7 +4036,7 @@ stringChars(Thread* t, GcString* string, unsigned start, unsigned length, uint16_t* chars) { if (length) { - object data = reinterpret_cast(string->data()); + object data = string->data(); if (objectClass(t, data) == type(t, GcByteArray::Type)) { GcByteArray* b = cast(t, data); for (unsigned i = 0; i < length; ++i) { @@ -4059,7 +4059,7 @@ stringUTFChars(Thread* t, GcString* string, unsigned start, unsigned length, assertT(t, static_cast (stringUTFLength(t, string, start, length)) == charsLength); - object data = reinterpret_cast(string->data()); + object data = string->data(); if (objectClass(t, data) == type(t, GcByteArray::Type)) { GcByteArray* b = cast(t, data); memcpy(chars, @@ -4120,7 +4120,7 @@ isAssignableFrom(Thread* t, GcClass* a, GcClass* b) if (itable) { unsigned stride = (b->flags() & ACC_INTERFACE) ? 1 : 2; for (unsigned i = 0; i < itable->length(); i += stride) { - if (itable->body()[i] == reinterpret_cast(a)) { + if (itable->body()[i] == a) { return true; } } @@ -4365,14 +4365,14 @@ parseClass(Thread* t, GcClassLoader* loader, const uint8_t* data, unsigned size, if (roots(t)->poolMap()) { object bootstrapClass = hashMapFind - (t, roots(t)->bootstrapClassMap(), reinterpret_cast(class_->name()), + (t, roots(t)->bootstrapClassMap(), class_->name(), byteArrayHash, byteArrayEqual); hashMapInsert( t, roots(t)->poolMap(), - bootstrapClass ? bootstrapClass : reinterpret_cast(real), - reinterpret_cast(pool), + bootstrapClass ? bootstrapClass : real, + pool, objectHash); } @@ -4400,7 +4400,7 @@ resolveSystemClass(Thread* t, GcClassLoader* loader, GcByteArray* spec, bool thr ACQUIRE(t, t->m->classLock); GcClass* class_ = cast(t, hashMapFind - (t, cast(t, loader->map()), reinterpret_cast(spec), byteArrayHash, byteArrayEqual)); + (t, cast(t, loader->map()), spec, byteArrayHash, byteArrayEqual)); if (class_ == 0) { PROTECT(t, class_); @@ -4479,7 +4479,7 @@ resolveSystemClass(Thread* t, GcClassLoader* loader, GcByteArray* spec, bool thr } GcClass* bootstrapClass = cast(t, hashMapFind - (t, roots(t)->bootstrapClassMap(), reinterpret_cast(spec), byteArrayHash, + (t, roots(t)->bootstrapClassMap(), spec, byteArrayHash, byteArrayEqual)); if (bootstrapClass) { @@ -4492,7 +4492,7 @@ resolveSystemClass(Thread* t, GcClassLoader* loader, GcByteArray* spec, bool thr } if (class_) { - hashMapInsert(t, cast(t, loader->map()), reinterpret_cast(spec), reinterpret_cast(class_), byteArrayHash); + hashMapInsert(t, cast(t, loader->map()), spec, class_, byteArrayHash); updatePackageMap(t, class_); } else if (throw_) { @@ -4512,7 +4512,7 @@ findLoadedClass(Thread* t, GcClassLoader* loader, GcByteArray* spec) ACQUIRE(t, t->m->classLock); return loader->map() ? cast(t, hashMapFind - (t, cast(t, loader->map()), reinterpret_cast(spec), byteArrayHash, byteArrayEqual)) : 0; + (t, cast(t, loader->map()), spec, byteArrayHash, byteArrayEqual)) : 0; } GcClass* @@ -4712,7 +4712,7 @@ postInitClass(Thread* t, GcClass* c) ACQUIRE(t, t->m->classLock); if (t->exception - and instanceOf(t, type(t, GcException::Type), reinterpret_cast(t->exception))) { + and instanceOf(t, type(t, GcException::Type), t->exception)) { c->vmFlags() |= NeedInitFlag | InitErrorFlag; c->vmFlags() &= ~InitFlag; @@ -4790,7 +4790,7 @@ resolveObjectArrayClass(Thread* t, GcClassLoader* loader, GcClass* elementClass) GcClass* arrayClass = resolveClass(t, loader, spec); - getClassRuntimeData(t, elementClass)->setArrayClass(t, reinterpret_cast(arrayClass)); + getClassRuntimeData(t, elementClass)->setArrayClass(t, arrayClass); return arrayClass; } @@ -4803,7 +4803,7 @@ makeObjectArray(Thread* t, GcClass* elementClass, unsigned count) PROTECT(t, arrayClass); - object array = reinterpret_cast(makeArray(t, count)); + object array = makeArray(t, count); setObjectClass(t, array, arrayClass); return array; @@ -4901,7 +4901,7 @@ addFinalizer(Thread* t, object target, void (*finalize)(Thread*, object)) GcFinalizer* f = makeFinalizer(t, 0, function, 0, 0, 0); f->target() = target; - f->next() = reinterpret_cast(t->m->finalizers); + f->next() = t->m->finalizers; t->m->finalizers = f; } @@ -4937,8 +4937,8 @@ objectMonitor(Thread* t, object o, bool createNew) return cast(t, m); } - object head = reinterpret_cast(makeMonitorNode(t, 0, 0)); - m = reinterpret_cast(makeMonitor(t, 0, 0, 0, head, head, 0)); + object head = makeMonitorNode(t, 0, 0); + m = makeMonitor(t, 0, 0, 0, head, head, 0); if (DebugMonitors) { fprintf(stderr, "made monitor %p for object %x\n", m, @@ -4967,7 +4967,7 @@ intern(Thread* t, object s) (t, roots(t)->stringMap(), s, stringHash, stringEqual); if (n) { - return reinterpret_cast(cast(t, n->first())->target()); + return cast(t, n->first())->target(); } else { hashMapInsert(t, roots(t)->stringMap(), s, 0, stringHash); addFinalizer(t, s, removeString); @@ -5097,7 +5097,7 @@ printTrace(Thread* t, GcThrowable* exception) logTrace(errorLog(t), "\n"); } - object trace = reinterpret_cast(e->trace()); + object trace = e->trace(); if (trace) { for (unsigned i = 0; i < objectArrayLength(t, trace); ++i) { GcTraceElement* e = cast(t, objectArrayBody(t, trace, i)); @@ -5143,9 +5143,9 @@ makeTrace(Thread* t, Processor::StackWalker* walker) assertT(t, trace); } - GcTraceElement* e = makeTraceElement(t, reinterpret_cast(walker->method()), walker->ip()); - assertT(t, index < objectArrayLength(t, reinterpret_cast(trace))); - reinterpret_cast(trace)->setBodyElement(t, index, reinterpret_cast(e)); + GcTraceElement* e = makeTraceElement(t, walker->method(), walker->ip()); + assertT(t, index < objectArrayLength(t, trace)); + reinterpret_cast(trace)->setBodyElement(t, index, e); ++ index; return true; } @@ -5218,7 +5218,7 @@ runFinalizeThread(Thread* t) } for (; cleanList; cleanList = cleanList->queueNext()) { - finalizeObject(t, reinterpret_cast(cleanList), "clean"); + finalizeObject(t, cleanList, "clean"); } } } @@ -5252,7 +5252,7 @@ parseUtf8(Thread* t, GcByteArray* array) } } - return reinterpret_cast(array); + return array; slow_path: class Client: public Stream::Client { @@ -5348,7 +5348,7 @@ defineClass(Thread* t, GcClassLoader* loader, const uint8_t* buffer, unsigned le { PROTECT(t, loader); - object c = reinterpret_cast(parseClass(t, loader, buffer, length)); + object c = parseClass(t, loader, buffer, length); // char name[byteArrayLength(t, className(t, c))]; // memcpy(name, &byteArrayBody(t, className(t, c), 0), @@ -5399,10 +5399,10 @@ populateMultiArray(Thread* t, object array, int32_t* counts, (t, ceilingDivide (counts[index + 1] * class_->arrayElementSize(), BytesPerWord)); a->length() = counts[index + 1]; - setObjectClass(t, reinterpret_cast(a), class_); - setField(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast(a)); + setObjectClass(t, a, class_); + setField(t, array, ArrayBody + (i * BytesPerWord), a); - populateMultiArray(t, reinterpret_cast(a), counts, index + 1, dimensions); + populateMultiArray(t, a, counts, index + 1, dimensions); } } @@ -5418,12 +5418,12 @@ interruptLock(Thread* t, GcThread* thread) ACQUIRE(t, t->m->referenceLock); if (thread->interruptLock() == 0) { - object head = reinterpret_cast(makeMonitorNode(t, 0, 0)); + object head = makeMonitorNode(t, 0, 0); GcMonitor* lock = makeMonitor(t, 0, 0, 0, head, head, 0); storeStoreMemoryBarrier(); - thread->setInterruptLock(t, reinterpret_cast(lock)); + thread->setInterruptLock(t, lock); } } diff --git a/src/tools/type-generator/main.cpp b/src/tools/type-generator/main.cpp index a20e4ab02a..a3712d1b35 100644 --- a/src/tools/type-generator/main.cpp +++ b/src/tools/type-generator/main.cpp @@ -1024,7 +1024,7 @@ void writeClassAccessors(Output* out, Module& module, Class* cl) out->write(cppFieldType(module, f)); out->write(" value) { "); if(isFieldGcMarkable(module, f)) { - out->write("setField(t, reinterpret_cast(this), "); + out->write("setField(t, this , "); out->write(capitalize(cl->name)); out->write(capitalize(f.name)); out->write(", reinterpret_cast(value));"); @@ -1105,7 +1105,7 @@ void writeClassAccessors(Output* out, Module& module, Class* cl) out->write(cppFieldType(module, f)); out->write(" value) { "); if(isFieldGcMarkable(module, f)) { - out->write("setField(t, reinterpret_cast(this), "); + out->write("setField(t, this , "); out->write(capitalize(cl->name)); out->write(capitalize(f.name)); out->write(" + index * ("); diff --git a/src/util.cpp b/src/util.cpp index 503a7c799b..00ef517e8e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -327,7 +327,7 @@ hashMapFindNode(Thread* t, GcHashMap* map, object key, for (GcTriple* n = cast(t, array->body()[index]); n; n = cast(t, n->third())) { object k = n->first(); if (weak) { - k = reinterpret_cast(cast(t, k)->target()); + k = cast(t, k)->target(); if (k == 0) { continue; } @@ -375,7 +375,7 @@ hashMapResize(Thread* t, GcHashMap* map, uint32_t (*hash)(Thread*, object), object k = p->first(); if (weak) { - k = reinterpret_cast(cast(t, k)->target()); + k = cast(t, k)->target(); if (k == 0) { continue; } @@ -384,7 +384,7 @@ hashMapResize(Thread* t, GcHashMap* map, uint32_t (*hash)(Thread*, object), unsigned index = hash(t, k) & (newLength - 1); p->setThird(t, newArray->body()[index]); - newArray->setBodyElement(t, index, reinterpret_cast(p)); + newArray->setBodyElement(t, index, p); } } } @@ -429,9 +429,9 @@ hashMapInsert(Thread* t, GcHashMap* map, object key, object value, GcWeakReference* r = makeWeakReference(t, 0, 0, 0, 0); r->setTarget(t, key); - r->setVmNext(t, reinterpret_cast(t->m->weakReferences)); + r->setVmNext(t, t->m->weakReferences); t->m->weakReferences = r->as(t); - k = reinterpret_cast(r); + k = r; array = map->array(); } @@ -443,7 +443,7 @@ hashMapInsert(Thread* t, GcHashMap* map, object key, object value, unsigned index = h & (array->length() - 1); n->setThird(t, array->body()[index]); - array->setBodyElement(t, index, reinterpret_cast(n)); + array->setBodyElement(t, index, n); if (map->size() <= array->length() / 3) { // this might happen if nodes were removed during GC in which case @@ -479,7 +479,7 @@ hashMapRemove(Thread* t, GcHashMap* map, object key, for (GcTriple* n = cast(t, array->body()[index]); n;) { object k = n->first(); if (weak) { - k = reinterpret_cast(cast(t, k)->target()); + k = cast(t, k)->target(); if (k == 0) { n = cast(t, hashMapRemoveNode(t, map, index, p, n)->third()); continue; @@ -513,7 +513,7 @@ listAppend(Thread* t, GcList* list, object value) ++ list->size(); - object p = reinterpret_cast(makePair(t, value, 0)); + object p = makePair(t, value, 0); if (list->front()) { cast(t, list->rear())->setSecond(t, p); } else {