mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
retypedef object to GcObject*, remove (almost?) all unnecessary reinterpret_casts
This commit is contained in:
parent
b0490b8233
commit
cbad6931af
@ -38,7 +38,7 @@ getTrace(Thread* t, unsigned skipCount)
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
trace = reinterpret_cast<object>(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<object>(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<GcClass>(t, ao);
|
||||
GcClass* b = cast<GcClass>(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<object>(objectClass(t, src)), reinterpret_cast<object>(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<object>(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<object>(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<object>(makeByte(t, cast<GcInt>(t, o)->value()));
|
||||
return makeByte(t, cast<GcInt>(t, o)->value());
|
||||
|
||||
case BooleanField:
|
||||
return reinterpret_cast<object>(makeBoolean(t, cast<GcInt>(t, o)->value() != 0));
|
||||
return makeBoolean(t, cast<GcInt>(t, o)->value() != 0);
|
||||
|
||||
case CharField:
|
||||
return reinterpret_cast<object>(makeChar(t, cast<GcInt>(t, o)->value()));
|
||||
return makeChar(t, cast<GcInt>(t, o)->value());
|
||||
|
||||
case ShortField:
|
||||
return reinterpret_cast<object>(makeShort(t, cast<GcInt>(t, o)->value()));
|
||||
return makeShort(t, cast<GcInt>(t, o)->value());
|
||||
|
||||
case FloatField:
|
||||
return reinterpret_cast<object>(makeFloat(t, cast<GcInt>(t, o)->value()));
|
||||
return makeFloat(t, cast<GcInt>(t, o)->value());
|
||||
|
||||
case IntField:
|
||||
case LongField:
|
||||
case ObjectField:
|
||||
case VoidField:
|
||||
return o;
|
||||
return reinterpret_cast<GcObject*>(o);
|
||||
|
||||
case DoubleField:
|
||||
return reinterpret_cast<object>(makeDouble(t, cast<GcLong>(t, o)->value()));
|
||||
return makeDouble(t, cast<GcLong>(t, o)->value());
|
||||
|
||||
default:
|
||||
abort(t);
|
||||
@ -400,7 +398,7 @@ resolveParameterTypes(Thread* t, GcClassLoader* loader, GcByteArray* spec,
|
||||
(t, loader, reinterpret_cast<char*>(&spec->body()[start]),
|
||||
offset - start);
|
||||
|
||||
list = makePair(t, reinterpret_cast<object>(type), reinterpret_cast<object>(list));
|
||||
list = makePair(t, type, list);
|
||||
|
||||
++ count;
|
||||
} break;
|
||||
@ -424,13 +422,13 @@ resolveParameterTypes(Thread* t, GcClassLoader* loader, GcByteArray* spec,
|
||||
(t, loader, reinterpret_cast<char*>(&spec->body()[start]),
|
||||
offset - start);
|
||||
|
||||
list = makePair(t, reinterpret_cast<object>(type), reinterpret_cast<object>(list));
|
||||
list = makePair(t, type, list);
|
||||
++ count;
|
||||
} break;
|
||||
|
||||
default:
|
||||
list = makePair
|
||||
(t, reinterpret_cast<object>(primitiveClass(t, spec->body()[offset])), reinterpret_cast<object>(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<object>(getJClass(t, cast<GcClass>(t, list->first())));
|
||||
object c = getJClass(t, cast<GcClass>(t, list->first()));
|
||||
reinterpret_cast<GcArray*>(array)->setBodyElement(t, i, c);
|
||||
list = cast<GcPair>(t, list->second());
|
||||
}
|
||||
@ -489,12 +487,12 @@ resolveExceptionJTypes(Thread* t, GcClassLoader* loader, GcMethodAddendum* adden
|
||||
object o = singletonObject(t, addendum->pool()->as<GcSingleton>(t), index);
|
||||
|
||||
if (objectClass(t, o) == type(t, GcReference::Type)) {
|
||||
o = reinterpret_cast<object>(resolveClass(t, loader, cast<GcReference>(t, o)->name()));
|
||||
o = resolveClass(t, loader, cast<GcReference>(t, o)->name());
|
||||
|
||||
addendum->pool()->setBodyElement(t, index, reinterpret_cast<uintptr_t>(o));
|
||||
}
|
||||
|
||||
o = reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, o)));
|
||||
o = getJClass(t, cast<GcClass>(t, o));
|
||||
|
||||
reinterpret_cast<GcArray*>(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<object>(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<GcInnerClassReference>(t, table->body()[i]);
|
||||
GcByteArray* outer = reference->outer();
|
||||
if (outer and byteArrayEqual(t, reinterpret_cast<object>(outer), reinterpret_cast<object>(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<GcInnerClassReference>(t, table->body()[i]);
|
||||
GcByteArray* outer = reference->outer();
|
||||
if (outer and byteArrayEqual(t, reinterpret_cast<object>(outer), reinterpret_cast<object>(c->name()))
|
||||
if (outer and byteArrayEqual(t, outer, c->name())
|
||||
and ((not publicOnly)
|
||||
or (reference->flags() & ACC_PUBLIC)))
|
||||
{
|
||||
object inner = reinterpret_cast<object>(getJClass(
|
||||
object inner = getJClass(
|
||||
t,
|
||||
resolveClass(
|
||||
t,
|
||||
c->loader(),
|
||||
reference->inner())));
|
||||
reference->inner()));
|
||||
|
||||
-- count;
|
||||
reinterpret_cast<GcArray*>(result)->setBodyElement(t, count, inner);
|
||||
|
@ -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;
|
||||
|
@ -69,7 +69,7 @@ using namespace avian::util;
|
||||
private: \
|
||||
object name; \
|
||||
Thread::SingleProtector protector; \
|
||||
} MAKE_NAME(resource_)(t, reinterpret_cast<object>(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<GcClass*>(maskAlignedPointer(fieldAtOffset<object>(o, 0)));
|
||||
}
|
||||
inline GcClass*
|
||||
objectClass(Thread*, GcObject* o)
|
||||
{
|
||||
return reinterpret_cast<GcClass*>(maskAlignedPointer(fieldAtOffset<object>(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<GcObject*>(target, offset) = value;
|
||||
mark(t, reinterpret_cast<object>(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<GcClass*>(arrayBodyUnsafe(t, t->m->types, T::Type)), reinterpret_cast<object>(this)));
|
||||
|| instanceOf(t, reinterpret_cast<GcClass*>(arrayBodyUnsafe(t, t->m->types, T::Type)), this));
|
||||
return static_cast<T*>(this);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool GcObject::isa(Thread* t)
|
||||
{
|
||||
return instanceOf(t, reinterpret_cast<GcClass*>(arrayBodyUnsafe(t, t->m->types, T::Type)), reinterpret_cast<object>(this));
|
||||
return instanceOf(t, reinterpret_cast<GcClass*>(arrayBodyUnsafe(t, t->m->types, T::Type)), this);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@ -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<object>(value));
|
||||
t->m->types->setBodyElement(t, type, value);
|
||||
}
|
||||
|
||||
inline bool
|
||||
@ -2436,13 +2424,12 @@ stringHash(Thread* t, object so)
|
||||
{
|
||||
GcString* s = cast<GcString>(t, so);
|
||||
if (s->hashCode() == 0 and s->length(t)) {
|
||||
object data = reinterpret_cast<object>(s->data());
|
||||
if (objectClass(t, data) == type(t, GcByteArray::Type)) {
|
||||
if (objectClass(t, s->data()) == type(t, GcByteArray::Type)) {
|
||||
s->hashCode() = hash
|
||||
(cast<GcByteArray>(t, data)->body().subslice(s->offset(t), s->length(t)));
|
||||
(cast<GcByteArray>(t, s->data())->body().subslice(s->offset(t), s->length(t)));
|
||||
} else {
|
||||
s->hashCode() = hash
|
||||
(cast<GcCharArray>(t, data)->body().subslice(s->offset(t), s->length(t)));
|
||||
(cast<GcCharArray>(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<object>(s->data());
|
||||
if (objectClass(t, data) == type(t, GcByteArray::Type)) {
|
||||
return cast<GcByteArray>(t, data)->body()[s->offset(t) + i];
|
||||
if (objectClass(t, s->data()) == type(t, GcByteArray::Type)) {
|
||||
return cast<GcByteArray>(t, s->data())->body()[s->offset(t) + i];
|
||||
} else {
|
||||
return cast<GcCharArray>(t, data)->body()[s->offset(t) + i];
|
||||
return cast<GcCharArray>(t, s->data())->body()[s->offset(t) + i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -2482,8 +2468,8 @@ inline uint32_t
|
||||
methodHash(Thread* t, object mo)
|
||||
{
|
||||
GcMethod* method = cast<GcMethod>(t, mo);
|
||||
return byteArrayHash(t, reinterpret_cast<object>(method->name()))
|
||||
^ byteArrayHash(t, reinterpret_cast<object>(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<GcMethod>(t, ao);
|
||||
GcMethod* b = cast<GcMethod>(t, bo);
|
||||
return a == b or
|
||||
(byteArrayEqual(t, reinterpret_cast<object>(a->name()), reinterpret_cast<object>(b->name())) and
|
||||
byteArrayEqual(t, reinterpret_cast<object>(a->spec()), reinterpret_cast<object>(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<GcThrowable>(t, make(t, vm::type(t, type)));
|
||||
|
||||
result->setMessage(t, message);
|
||||
result->setTrace(t, reinterpret_cast<object>(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<object>(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<object>(method->class_());
|
||||
GcClass* interface = method->class_();
|
||||
GcArray* itable = cast<GcArray>(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<GcMonitorNode>(t, monitor->acquireTail())) {
|
||||
if (next) {
|
||||
atomicCompareAndSwapObject
|
||||
(t, reinterpret_cast<object>(monitor), MonitorAcquireTail, reinterpret_cast<object>(tail), next);
|
||||
(t, monitor, MonitorAcquireTail, tail, next);
|
||||
} else if (atomicCompareAndSwapObject
|
||||
(t, reinterpret_cast<object>(tail), MonitorNodeNext, 0, reinterpret_cast<object>(node)))
|
||||
(t, tail, MonitorNodeNext, 0, node))
|
||||
{
|
||||
atomicCompareAndSwapObject
|
||||
(t, reinterpret_cast<object>(monitor), MonitorAcquireTail, reinterpret_cast<object>(tail), reinterpret_cast<object>(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<object>(monitor), MonitorAcquireTail, reinterpret_cast<object>(tail), reinterpret_cast<object>(next));
|
||||
(t, monitor, MonitorAcquireTail, tail, next);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -3041,7 +3027,7 @@ monitorAtomicPollAcquire(Thread* t, GcMonitor* monitor, bool remove)
|
||||
Thread* value = static_cast<Thread*>(next->value());
|
||||
if ((not remove)
|
||||
or atomicCompareAndSwapObject
|
||||
(t, reinterpret_cast<object>(monitor), MonitorAcquireHead, reinterpret_cast<object>(head), reinterpret_cast<object>(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<object>(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<object>(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<object>(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<object>(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<object>(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<object>(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<object>(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<object>(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<object>(jclass));
|
||||
getClassRuntimeData(t, c)->setJclass(t, jclass);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,13 +255,13 @@ Avian_avian_SystemClassLoader_getPackageSource
|
||||
GcByteArray* key = makeByteArray(t, RUNTIME_ARRAY_BODY(chars));
|
||||
|
||||
GcByteArray* array = cast<GcByteArray>(t, hashMapFind
|
||||
(t, roots(t)->packageMap(), reinterpret_cast<object>(key), byteArrayHash, byteArrayEqual));
|
||||
(t, roots(t)->packageMap(), key, byteArrayHash, byteArrayEqual));
|
||||
|
||||
if (array) {
|
||||
return reinterpret_cast<uintptr_t>(makeLocalReference(
|
||||
t,
|
||||
reinterpret_cast<object>(t->m->classpath->makeString(
|
||||
t, reinterpret_cast<object>(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<object>(arguments[4]);
|
||||
|
||||
storeStoreMemoryBarrier();
|
||||
setField(t, o, offset, reinterpret_cast<object>(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<object>(objectClass(t, o));
|
||||
lock = objectClass(t, o);
|
||||
} else {
|
||||
lock = reinterpret_cast<object>(fieldForOffset(t, cast<GcSingleton>(t, o), offset));
|
||||
lock = fieldForOffset(t, cast<GcSingleton>(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<object>(objectClass(t, o));
|
||||
lock = objectClass(t, o);
|
||||
} else {
|
||||
lock = reinterpret_cast<object>(fieldForOffset(t, cast<GcSingleton>(t, o), offset));
|
||||
lock = fieldForOffset(t, cast<GcSingleton>(t, o), offset);
|
||||
}
|
||||
|
||||
PROTECT(t, o);
|
||||
|
@ -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<object>(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<object>(method->name()), 0,
|
||||
(t, method->name(), 0,
|
||||
method->name()->length() - 1);
|
||||
|
||||
return reinterpret_cast<object>(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<object>(field->name()), 0,
|
||||
(t, field->name(), 0,
|
||||
field->name()->length() - 1);
|
||||
|
||||
return reinterpret_cast<object>(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<object>(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<GcTraceElement>(t, objectArrayBody(t, raw, i)));
|
||||
|
||||
setField(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(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<GcJclass*>(allocate(t, GcJclass::FixedSize, true));
|
||||
setObjectClass(t, reinterpret_cast<object>(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<object>(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), "<init>", "()V");
|
||||
|
||||
t->m->processor->invoke(t, constructor, reinterpret_cast<object>(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<object>(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<GcArray>(t, vmMethod->class_()->methodTable());
|
||||
for (unsigned i = 0; i < table->length(); ++i) {
|
||||
if (reinterpret_cast<object>(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<GcArray>(t, vmField->class_()->fieldTable());
|
||||
for (unsigned i = 0; i < table->length(); ++i) {
|
||||
if (reinterpret_cast<object>(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<object>(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<object>(t->javaThread));
|
||||
vm::acquire(t, t->javaThread);
|
||||
t->flags &= ~Thread::ActiveFlag;
|
||||
vm::notifyAll(t, reinterpret_cast<object>(t->javaThread));
|
||||
vm::release(t, reinterpret_cast<object>(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<object>(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<object>(roots(t)->bootLoader()), 0, true);
|
||||
(t, constructor, roots(t)->bootLoader(), 0, true);
|
||||
|
||||
t->m->processor->invoke
|
||||
(t, constructor, reinterpret_cast<object>(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<object>(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<object>(makeByte(t, fieldAtOffset<int8_t>(target, offset)));
|
||||
return makeByte(t, fieldAtOffset<int8_t>(target, offset));
|
||||
|
||||
case BooleanField:
|
||||
return reinterpret_cast<object>(makeBoolean(t, fieldAtOffset<int8_t>(target, offset)));
|
||||
return makeBoolean(t, fieldAtOffset<int8_t>(target, offset));
|
||||
|
||||
case CharField:
|
||||
return reinterpret_cast<object>(makeChar(t, fieldAtOffset<int16_t>(target, offset)));
|
||||
return makeChar(t, fieldAtOffset<int16_t>(target, offset));
|
||||
|
||||
case ShortField:
|
||||
return reinterpret_cast<object>(makeShort(t, fieldAtOffset<int16_t>(target, offset)));
|
||||
return makeShort(t, fieldAtOffset<int16_t>(target, offset));
|
||||
|
||||
case IntField:
|
||||
return reinterpret_cast<object>(makeInt(t, fieldAtOffset<int32_t>(target, offset)));
|
||||
return makeInt(t, fieldAtOffset<int32_t>(target, offset));
|
||||
|
||||
case LongField:
|
||||
return reinterpret_cast<object>(makeLong(t, fieldAtOffset<int64_t>(target, offset)));
|
||||
return makeLong(t, fieldAtOffset<int64_t>(target, offset));
|
||||
|
||||
case FloatField:
|
||||
return reinterpret_cast<object>(makeFloat(t, fieldAtOffset<int32_t>(target, offset)));
|
||||
return makeFloat(t, fieldAtOffset<int32_t>(target, offset));
|
||||
|
||||
case DoubleField:
|
||||
return reinterpret_cast<object>(makeDouble(t, fieldAtOffset<int64_t>(target, offset)));
|
||||
return makeDouble(t, fieldAtOffset<int64_t>(target, offset));
|
||||
|
||||
case ObjectField:
|
||||
return fieldAtOffset<object>(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<object>(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<object>(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<object>(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<object>(signature), 0, signature->length() - 1);
|
||||
(t, signature, 0, signature->length() - 1);
|
||||
|
||||
setField(t, array, ArrayBody, reinterpret_cast<object>(string));
|
||||
setField(t, array, ArrayBody, string);
|
||||
|
||||
return reinterpret_cast<uintptr_t>(array);
|
||||
}
|
||||
@ -2296,7 +2296,7 @@ Avian_dalvik_system_VMRuntime_newNonMovableArray
|
||||
(t, t->m->heap, Machine::FixedAllocation,
|
||||
ArrayBody + arguments[2], false));
|
||||
|
||||
setObjectClass(t, reinterpret_cast<object>(array), type(t, GcByteArray::Type));
|
||||
setObjectClass(t, array, type(t, GcByteArray::Type));
|
||||
array->length() = arguments[2];
|
||||
|
||||
return reinterpret_cast<intptr_t>(array);
|
||||
|
@ -64,7 +64,7 @@ class MyClasspath : public Classpath {
|
||||
GcJmethod* jmethod = makeJmethod(t, vmMethod, false);
|
||||
|
||||
return vmMethod->name()->body()[0] == '<'
|
||||
? reinterpret_cast<object>(makeJconstructor(t, jmethod)) : reinterpret_cast<object>(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<object>(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<object>(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<GcArray*>(array)->setBodyElement(t, i, reinterpret_cast<object>(s));
|
||||
reinterpret_cast<GcArray*>(array)->setBodyElement(t, i, s);
|
||||
}
|
||||
|
||||
return reinterpret_cast<int64_t>(array);
|
||||
@ -618,7 +618,7 @@ Avian_java_lang_Runtime_addShutdownHook
|
||||
|
||||
ACQUIRE(t, t->m->shutdownLock);
|
||||
|
||||
GcPair* p = makePair(t, hook, reinterpret_cast<object>(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<GcTraceElement>(t, objectArrayBody(t, trace, i)));
|
||||
reinterpret_cast<GcArray*>(array)->setBodyElement(t, i, reinterpret_cast<object>(ste));
|
||||
reinterpret_cast<GcArray*>(array)->setBodyElement(t, i, ste);
|
||||
}
|
||||
|
||||
return reinterpret_cast<int64_t>(array);
|
||||
|
@ -490,7 +490,7 @@ class MyClasspath : public Classpath {
|
||||
PROTECT(t, name);
|
||||
|
||||
GcJclass* c = reinterpret_cast<GcJclass*>(allocate(t, GcJclass::FixedSize, true));
|
||||
setObjectClass(t, reinterpret_cast<object>(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<object>(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<GcThreadGroup*>(allocate(t, GcThreadGroup::FixedSize, true));
|
||||
setObjectClass(t, reinterpret_cast<object>(group), type(t, GcThreadGroup::Type));
|
||||
setObjectClass(t, group, type(t, GcThreadGroup::Type));
|
||||
group->maxPriority() = MaxPriority;
|
||||
}
|
||||
|
||||
PROTECT(t, group);
|
||||
|
||||
GcThread* thread = reinterpret_cast<GcThread*>(allocate(t, GcThread::FixedSize, true));
|
||||
setObjectClass(t, reinterpret_cast<object>(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<object>(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<object>(makeJconstructor(t, vmMethod))
|
||||
: reinterpret_cast<object>(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<object>(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<object>(t->javaThread), true);
|
||||
objectMonitor(t, t->javaThread, true);
|
||||
|
||||
THREAD_RESOURCE0(t, {
|
||||
vm::acquire(t, reinterpret_cast<object>(t->javaThread));
|
||||
vm::acquire(t, t->javaThread);
|
||||
t->flags &= ~Thread::ActiveFlag;
|
||||
vm::notifyAll(t, reinterpret_cast<object>(t->javaThread));
|
||||
vm::release(t, reinterpret_cast<object>(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<GcMethod>(t, roots(t)->threadTerminated()),
|
||||
reinterpret_cast<object>(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<object>(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<object>(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<object>(roots(t)->bootLoader()), 0);
|
||||
t->m->processor->invoke(t, constructor, roots(t)->bootLoader(), 0);
|
||||
|
||||
t->m->processor->invoke
|
||||
(t, constructor, reinterpret_cast<object>(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<object>(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<object>(t->m->classpath->makeString
|
||||
(t, reinterpret_cast<object>(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<object>(t->m->classpath->makeString
|
||||
(t, signature, 0, cast<GcByteArray>(t, signature)->length() - 1));
|
||||
signature = t->m->classpath->makeString
|
||||
(t, signature, 0, cast<GcByteArray>(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<object>(vmMethod->addendum()->pool()));
|
||||
vmMethod->addendum()->pool());
|
||||
}
|
||||
|
||||
if (index == -1) {
|
||||
GcArray* table = cast<GcArray>(t, vmMethod->class_()->methodTable());
|
||||
for (unsigned i = 0; i < table->length(); ++i) {
|
||||
if (reinterpret_cast<object>(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<object>(makeJmethod
|
||||
return makeJmethod
|
||||
(t, true, 0, jclass, index, cast<GcString>(t, name), returnType, parameterTypes,
|
||||
exceptionTypes, vmMethod->flags(), cast<GcString>(t, signature), 0, cast<GcByteArray>(t, annotationTable),
|
||||
cast<GcByteArray>(t, parameterAnnotationTable), cast<GcByteArray>(t, annotationDefault), 0, 0, 0));
|
||||
cast<GcByteArray>(t, parameterAnnotationTable), cast<GcByteArray>(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<object>(t->m->classpath->makeString
|
||||
(t, signature, 0, cast<GcByteArray>(t, signature)->length() - 1));
|
||||
signature = t->m->classpath->makeString
|
||||
(t, signature, 0, cast<GcByteArray>(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<object>(vmMethod->addendum()->pool()));
|
||||
vmMethod->addendum()->pool());
|
||||
}
|
||||
|
||||
if (index == -1) {
|
||||
GcArray* table = cast<GcArray>(t, vmMethod->class_()->methodTable());
|
||||
for (unsigned i = 0; i < table->length(); ++i) {
|
||||
if (reinterpret_cast<object>(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<object>(
|
||||
return
|
||||
makeJconstructor(t,
|
||||
true,
|
||||
0,
|
||||
@ -2391,7 +2391,7 @@ makeJconstructor(Thread* t, GcMethod* vmMethod, int index)
|
||||
cast<GcByteArray>(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<object>(t->m->classpath->makeString
|
||||
(t, reinterpret_cast<object>(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<object>(t->m->classpath->makeString
|
||||
(t, signature, 0, cast<GcByteArray>(t, signature)->length() - 1));
|
||||
signature = t->m->classpath->makeString
|
||||
(t, signature, 0, cast<GcByteArray>(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<object>(vmField->addendum()->pool()));
|
||||
vmField->addendum()->pool());
|
||||
}
|
||||
|
||||
if (index == -1) {
|
||||
GcArray* table = cast<GcArray>(t, vmField->class_()->fieldTable());
|
||||
for (unsigned i = 0; i < table->length(); ++i) {
|
||||
if (reinterpret_cast<object>(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<object>(makeJfield
|
||||
(t, true, 0, jclass, index, cast<GcString>(t, name), jtype, vmField->flags(), cast<GcString>(t, signature), 0, cast<GcByteArray>(t, annotationTable), 0, 0, 0, 0));
|
||||
return makeJfield
|
||||
(t, true, 0, jclass, index, cast<GcString>(t, name), jtype, vmField->flags(), cast<GcString>(t, signature), 0, cast<GcByteArray>(t, annotationTable), 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -3231,8 +3231,8 @@ jvmGetStackTraceElement(Thread* t, uintptr_t* arguments)
|
||||
|
||||
return reinterpret_cast<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeStackTraceElement
|
||||
(t, cast<GcTraceElement>(t, objectArrayBody(t, cast<GcThrowable>(t, *throwable)->trace(), index))))));
|
||||
(t, makeStackTraceElement
|
||||
(t, cast<GcTraceElement>(t, objectArrayBody(t, cast<GcThrowable>(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<object>(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<object>(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<object>(makeStackTraceElement
|
||||
(t, cast<GcTraceElement>(t, objectArrayBody(t, trace, traceIndex))));
|
||||
object ste = makeStackTraceElement
|
||||
(t, cast<GcTraceElement>(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<object>(getJClass(
|
||||
object c = getJClass(
|
||||
t,
|
||||
cast<GcMethod>(t, cast<GcTraceElement>(t, objectArrayBody(t, trace, i))->method())->class_()));
|
||||
cast<GcMethod>(t, cast<GcTraceElement>(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<object>(makeByteArray(t, RUNTIME_ARRAY_BODY(chars)));
|
||||
object key = makeByteArray(t, RUNTIME_ARRAY_BODY(chars));
|
||||
|
||||
GcByteArray* array = cast<GcByteArray>(t, hashMapFind
|
||||
(t, roots(t)->packageMap(), key, byteArrayHash, byteArrayEqual));
|
||||
@ -3530,8 +3530,8 @@ jvmGetSystemPackage(Thread* t, uintptr_t* arguments)
|
||||
if (array) {
|
||||
return reinterpret_cast<uintptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(t->m->classpath->makeString
|
||||
(t, reinterpret_cast<object>(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<object>(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<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeBoolean(t, fieldAtOffset<int8_t>(*array, ArrayBody + index)))));
|
||||
(t, makeBoolean(t, fieldAtOffset<int8_t>(*array, ArrayBody + index))));
|
||||
case 'B':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeByte(t, fieldAtOffset<int8_t>(*array, ArrayBody + index)))));
|
||||
(t, makeByte(t, fieldAtOffset<int8_t>(*array, ArrayBody + index))));
|
||||
case 'C':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeChar(t, fieldAtOffset<int16_t>(*array, ArrayBody + (index * 2))))));
|
||||
(t, makeChar(t, fieldAtOffset<int16_t>(*array, ArrayBody + (index * 2)))));
|
||||
case 'S':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeShort(t, fieldAtOffset<int16_t>(*array, ArrayBody + (index * 2))))));
|
||||
(t, makeShort(t, fieldAtOffset<int16_t>(*array, ArrayBody + (index * 2)))));
|
||||
case 'I':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeInt(t, fieldAtOffset<int32_t>(*array, ArrayBody + (index * 4))))));
|
||||
(t, makeInt(t, fieldAtOffset<int32_t>(*array, ArrayBody + (index * 4)))));
|
||||
case 'F':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeFloat(t, fieldAtOffset<int32_t>(*array, ArrayBody + (index * 4))))));
|
||||
(t, makeFloat(t, fieldAtOffset<int32_t>(*array, ArrayBody + (index * 4)))));
|
||||
case 'J':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeLong(t, fieldAtOffset<int64_t>(*array, ArrayBody + (index * 8))))));
|
||||
(t, makeLong(t, fieldAtOffset<int64_t>(*array, ArrayBody + (index * 8)))));
|
||||
case 'D':
|
||||
return reinterpret_cast<intptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(makeDouble(t, fieldAtOffset<int64_t>(*array, ArrayBody + (index * 8))))));
|
||||
(t, makeDouble(t, fieldAtOffset<int64_t>(*array, ArrayBody + (index * 8)))));
|
||||
case 'L':
|
||||
case '[':
|
||||
return reinterpret_cast<intptr_t>
|
||||
@ -3734,20 +3734,20 @@ makeNewArray(Thread* t, GcClass* c, unsigned length)
|
||||
switch (*name) {
|
||||
case 'b':
|
||||
if (name[1] == 'o') {
|
||||
return reinterpret_cast<object>(makeBooleanArray(t, length));
|
||||
return makeBooleanArray(t, length);
|
||||
} else {
|
||||
return reinterpret_cast<object>(makeByteArray(t, length));
|
||||
return makeByteArray(t, length);
|
||||
}
|
||||
case 'c': return reinterpret_cast<object>(makeCharArray(t, length));
|
||||
case 'd': return reinterpret_cast<object>(makeDoubleArray(t, length));
|
||||
case 'f': return reinterpret_cast<object>(makeFloatArray(t, length));
|
||||
case 'i': return reinterpret_cast<object>(makeIntArray(t, length));
|
||||
case 'l': return reinterpret_cast<object>(makeLongArray(t, length));
|
||||
case 's': return reinterpret_cast<object>(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<object>(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<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(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<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJboolean::Type)))));
|
||||
(t, getJClass(t, type(t, GcJboolean::Type))));
|
||||
} else {
|
||||
return reinterpret_cast<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJbyte::Type)))));
|
||||
(t, getJClass(t, type(t, GcJbyte::Type))));
|
||||
}
|
||||
case 'c':
|
||||
return reinterpret_cast<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJchar::Type)))));
|
||||
(t, getJClass(t, type(t, GcJchar::Type))));
|
||||
case 'd':
|
||||
return reinterpret_cast<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJdouble::Type)))));
|
||||
(t, getJClass(t, type(t, GcJdouble::Type))));
|
||||
case 'f':
|
||||
return reinterpret_cast<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJfloat::Type)))));
|
||||
(t, getJClass(t, type(t, GcJfloat::Type))));
|
||||
case 'i':
|
||||
return reinterpret_cast<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJint::Type)))));
|
||||
(t, getJClass(t, type(t, GcJint::Type))));
|
||||
case 'l':
|
||||
return reinterpret_cast<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJlong::Type)))));
|
||||
(t, getJClass(t, type(t, GcJlong::Type))));
|
||||
case 's':
|
||||
return reinterpret_cast<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJshort::Type)))));
|
||||
(t, getJClass(t, type(t, GcJshort::Type))));
|
||||
case 'v':
|
||||
return reinterpret_cast<jclass>(makeLocalReference
|
||||
(t, reinterpret_cast<object>(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<uint64_t>(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, c))));
|
||||
return reinterpret_cast<uint64_t>(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<GcClassLoader>(t, *loader), spec);
|
||||
|
||||
return reinterpret_cast<uint64_t>
|
||||
(c ? makeLocalReference(t, reinterpret_cast<object>(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<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, defineClass(t, cast<GcClassLoader>(t, *loader), data, length))))));
|
||||
(t, getJClass(t, cast<GcClass>(t, defineClass(t, cast<GcClassLoader>(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<jstring>(makeLocalReference(t, reinterpret_cast<object>((*c)->name())));
|
||||
return reinterpret_cast<jstring>(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<object>(getJClass(t, cast<GcClass>(t, table->body()[i])));
|
||||
object c = getJClass(t, cast<GcClass>(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<object>(roots(t)->bootLoader()));
|
||||
return makeLocalReference(t, roots(t)->bootLoader());
|
||||
}
|
||||
} else {
|
||||
return makeLocalReference(t, reinterpret_cast<object>(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<uintptr_t>
|
||||
(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, primitiveClass(t, n)))));
|
||||
(makeLocalReference(t, getJClass(t, primitiveClass(t, n))));
|
||||
} else {
|
||||
return reinterpret_cast<uintptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(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<uintptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(getDeclaringClass
|
||||
(t, cast<GcJclass>(t, *reinterpret_cast<jobject>(arguments[0]))->vmClass()))));
|
||||
(t, getDeclaringClass
|
||||
(t, cast<GcJclass>(t, *reinterpret_cast<jobject>(arguments[0]))->vmClass())));
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||
@ -4240,8 +4240,8 @@ jvmGetClassSignature(Thread* t, uintptr_t* arguments)
|
||||
if (signature) {
|
||||
return reinterpret_cast<uintptr_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(t->m->classpath->makeString
|
||||
(t, reinterpret_cast<object>(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<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, invoke
|
||||
(t, vmMethod, instance ? reinterpret_cast<object>(*instance) : 0, args ? reinterpret_cast<object>(*args) : 0)));
|
||||
(t, vmMethod, instance ? *instance : 0, args ? reinterpret_cast<object>(*args) : 0)));
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT jobject JNICALL
|
||||
@ -4472,7 +4472,7 @@ jvmNewInstanceFromConstructor(Thread* t, uintptr_t* arguments)
|
||||
(t, cast<GcJconstructor>(t, *constructor)->clazz()->vmClass()->methodTable())->body()[
|
||||
cast<GcJconstructor>(t, *constructor)->slot()]);
|
||||
|
||||
invoke(t, method, reinterpret_cast<object>(instance), args ? reinterpret_cast<object>(*args) : 0);
|
||||
invoke(t, method, instance, args ? reinterpret_cast<object>(*args) : 0);
|
||||
|
||||
return reinterpret_cast<uint64_t>(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<object>(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<object>(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<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(t->m->classpath->makeString
|
||||
(t, array, 0, fieldAtOffset<uintptr_t>(array, BytesPerWord) - 1))));
|
||||
(t, t->m->classpath->makeString
|
||||
(t, array, 0, fieldAtOffset<uintptr_t>(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<object>(t->exception))
|
||||
and not (instanceOf(t, type(t, GcError::Type), t->exception)
|
||||
or instanceOf
|
||||
(t, type(t, GcRuntimeException::Type), reinterpret_cast<object>(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<GcThrowable>(t, make(t, paeClass));
|
||||
PROTECT(t, result);
|
||||
|
||||
t->m->processor->invoke(t, paeConstructor, reinterpret_cast<object>(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<object>(argument));
|
||||
setField(t, array, ArrayBody + (i * BytesPerWord), argument);
|
||||
}
|
||||
|
||||
return reinterpret_cast<uintptr_t>(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<object>(getJClass
|
||||
(t, resolveClass(t, class_->loader(), cast<GcByteArray>(t, enclosingClass))));
|
||||
enclosingClass = getJClass
|
||||
(t, resolveClass(t, class_->loader(), cast<GcByteArray>(t, enclosingClass)));
|
||||
|
||||
setField(t, array, ArrayBody, enclosingClass);
|
||||
|
||||
@ -5281,13 +5281,13 @@ getEnclosingMethodInfo(Thread* t, uintptr_t* arguments)
|
||||
(t, enclosingMethod->first(), 0,
|
||||
cast<GcByteArray>(t, enclosingMethod->first())->length() - 1);
|
||||
|
||||
setField(t, array, ArrayBody + BytesPerWord, reinterpret_cast<object>(name));
|
||||
setField(t, array, ArrayBody + BytesPerWord, name);
|
||||
|
||||
GcString* spec = t->m->classpath->makeString
|
||||
(t, enclosingMethod->second(), 0,
|
||||
cast<GcByteArray>(t, enclosingMethod->second())->length() - 1);
|
||||
|
||||
setField(t, array, ArrayBody + (2 * BytesPerWord), reinterpret_cast<object>(spec));
|
||||
setField(t, array, ArrayBody + (2 * BytesPerWord), spec);
|
||||
}
|
||||
|
||||
return reinterpret_cast<uintptr_t>(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<object>(arguments[1]);
|
||||
object country = arguments[1];
|
||||
|
||||
THREAD_RUNTIME_ARRAY(t, char, countryChars, stringLength(t, country) + 1);
|
||||
stringChars(t, country, RUNTIME_ARRAY_BODY(countryChars));
|
||||
|
134
src/compile.cpp
134
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<object>(makePointer(t, p));
|
||||
bc->constants = makeTriple(t, reinterpret_cast<object>(o), pointer, reinterpret_cast<object>(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<object>(o) == e->target) {
|
||||
if (o == e->target) {
|
||||
return c->address(ir::Type::object(), e);
|
||||
}
|
||||
}
|
||||
|
||||
context->objectPool = new(&context->zone) PoolElement(t, reinterpret_cast<object>(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<object>(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<GcMethod>(t, pair->first())->class_()->loader(), reinterpret_cast<object>(reference),
|
||||
(t, cast<GcMethod>(t, pair->first())->class_()->loader(), reference,
|
||||
ReferenceClass);
|
||||
|
||||
return cast<GcMethod>(t, findInHierarchy
|
||||
@ -2614,7 +2614,7 @@ makeMultidimensionalArray2(MyThread* t, GcClass* class_, uintptr_t* countStack,
|
||||
}
|
||||
}
|
||||
|
||||
object array = reinterpret_cast<object>(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<GcMethod>(t, pair->first())->class_()->loader(), reinterpret_cast<object>(reference),
|
||||
(t, cast<GcMethod>(t, pair->first())->class_()->loader(), reference,
|
||||
ReferenceClass);
|
||||
|
||||
return cast<GcField>(t, findInHierarchy
|
||||
@ -2757,7 +2757,7 @@ getStaticFieldValueFromReference(MyThread* t, GcPair* pair)
|
||||
|
||||
ACQUIRE_FIELD_FOR_READ(t, field);
|
||||
|
||||
return getFieldValue(t, reinterpret_cast<object>(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<object>(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<object>(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<object>(makePointer(t, p));
|
||||
bc->calls = makeTriple(t, reinterpret_cast<object>(target), pointer, reinterpret_cast<object>(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<object>(frame->context->method), reinterpret_cast<object>(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<object>(class_);
|
||||
argument = class_;
|
||||
thunk = makeBlankObjectArrayThunk;
|
||||
} else {
|
||||
argument = reinterpret_cast<object>(makePair(t, reinterpret_cast<object>(context->method), reinterpret_cast<object>(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<GcObject*>(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<object>(class_);
|
||||
argument = class_;
|
||||
thunk = checkCastThunk;
|
||||
} else {
|
||||
argument = reinterpret_cast<object>(makePair(t, reinterpret_cast<object>(context->method), reinterpret_cast<object>(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<GcObject*>(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<object>(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<object>(class_);
|
||||
argument = class_;
|
||||
thunk = instanceOf64Thunk;
|
||||
} else {
|
||||
argument = reinterpret_cast<object>(makePair(t, reinterpret_cast<object>(context->method), reinterpret_cast<object>(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<GcObject*>(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<object>(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<GcReference>(t, reference);
|
||||
PROTECT(t, ref);
|
||||
argument = reinterpret_cast<object>(makePair(t, reinterpret_cast<object>(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<GcObject*>(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<object>(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<GcReference>(t, v);
|
||||
PROTECT(t, reference);
|
||||
|
||||
v = reinterpret_cast<object>(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<object>(context->method), reinterpret_cast<object>(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<GcObject*>(v))));
|
||||
frame->append(v)));
|
||||
} else {
|
||||
frame->push(ir::Type::object(), frame->append(reinterpret_cast<GcObject*>(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<object>(class_);
|
||||
argument = class_;
|
||||
thunk = makeMultidimensionalArrayThunk;
|
||||
} else {
|
||||
argument = reinterpret_cast<object>(makePair(t, reinterpret_cast<object>(context->method), reinterpret_cast<object>(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<GcObject*>(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<object>(class_);
|
||||
argument = class_;
|
||||
if (class_->vmFlags() & (WeakReferenceFlag | HasFinalizerFlag)) {
|
||||
thunk = makeNewGeneral64Thunk;
|
||||
} else {
|
||||
thunk = makeNew64Thunk;
|
||||
}
|
||||
} else {
|
||||
argument = reinterpret_cast<object>(
|
||||
makePair(t, reinterpret_cast<object>(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<GcObject*>(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<object>(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<GcObject*>(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<object>(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<object>(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<object>(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<object>(newExceptionHandlerTable), newLineNumberTable,
|
||||
(t, 0, 0, newExceptionHandlerTable, newLineNumberTable,
|
||||
reinterpret_cast<uintptr_t>(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<object>(method->class_()));
|
||||
acquire(t, method->class_());
|
||||
} else {
|
||||
acquire(t, *reinterpret_cast<object*>(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<object>(method->class_()));
|
||||
release(t, method->class_());
|
||||
} else {
|
||||
release(t, *reinterpret_cast<object*>(RUNTIME_ARRAY_BODY(args)[1]));
|
||||
}
|
||||
@ -7698,7 +7698,7 @@ callContinuation(MyThread* t, GcContinuation* continuation, object result,
|
||||
and unwindContext->continuation())
|
||||
{
|
||||
nextContinuation = cast<GcContinuation>(t, unwindContext->continuation());
|
||||
result = reinterpret_cast<object>(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<object>(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<object>(makeInt(t, result));
|
||||
r = makeInt(t, result);
|
||||
break;
|
||||
|
||||
case LongField:
|
||||
case DoubleField:
|
||||
r = reinterpret_cast<object>(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<object>(compileRoots(t)->methodTree()));
|
||||
= w->visitRoot(compileRoots(t)->methodTree());
|
||||
bootImage->methodTreeSentinal = w->visitRoot(
|
||||
reinterpret_cast<object>(compileRoots(t)->methodTreeSentinal()));
|
||||
compileRoots(t)->methodTreeSentinal());
|
||||
bootImage->virtualThunks = w->visitRoot(
|
||||
reinterpret_cast<object>(compileRoots(t)->virtualThunks()));
|
||||
compileRoots(t)->virtualThunks());
|
||||
}
|
||||
|
||||
virtual void normalizeVirtualThunks(Thread* t) {
|
||||
@ -8850,7 +8850,7 @@ class MyProcessor: public Processor {
|
||||
p->address()
|
||||
- reinterpret_cast<uintptr_t>(codeAllocator.memory.begin()));
|
||||
table[index++] = targetVW(
|
||||
w->map()->find(reinterpret_cast<object>(p->target()))
|
||||
w->map()->find(p->target())
|
||||
| (static_cast<unsigned>(p->flags()) << TargetBootShift));
|
||||
}
|
||||
}
|
||||
@ -9219,7 +9219,7 @@ resizeTable(MyThread* t, GcArray* oldTable, unsigned newLength)
|
||||
oldNode->flags(),
|
||||
cast<GcCallNode>(t, newTable->body()[index]));
|
||||
|
||||
newTable->setBodyElement(t, index, reinterpret_cast<object>(newNode));
|
||||
newTable->setBodyElement(t, index, newNode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9247,7 +9247,7 @@ insertCallNode(MyThread* t, GcArray* table, unsigned* size, GcCallNode* node)
|
||||
unsigned index = static_cast<uintptr_t>(key) & (table->length() - 1);
|
||||
|
||||
node->setNext(t, cast<GcCallNode>(t, table->body()[index]));
|
||||
table->setBodyElement(t, index, reinterpret_cast<object>(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<GcClass>(t, bootObject(heap, table[i]));
|
||||
hashMapInsert(t, map, reinterpret_cast<object>(c->name()), reinterpret_cast<object>(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<object>(cast<GcClass>(t, bootObject(heap, bootTable[i]))->staticTable()));
|
||||
cast<GcClass>(t, bootObject(heap, bootTable[i]))->staticTable());
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < appCount; ++i) {
|
||||
array->setBodyElement(t, (bootCount + i),
|
||||
reinterpret_cast<object>(cast<GcClass>(t, bootObject(heap, appTable[i]))->staticTable()));
|
||||
cast<GcClass>(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<object>(map));
|
||||
roots(t)->bootLoader()->setMap(t, map);
|
||||
}
|
||||
|
||||
roots(t)->bootLoader()->as<GcSystemClassLoader>(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<object>(map));
|
||||
roots(t)->appLoader()->setMap(t, map);
|
||||
}
|
||||
|
||||
roots(t)->appLoader()->as<GcSystemClassLoader>(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<object>(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<object>(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<object>(method),
|
||||
method,
|
||||
compileRoots(t)->methodTreeSentinal(),
|
||||
compareIpToMethodBounds);
|
||||
}
|
||||
|
@ -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<object>(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<object>(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<object>(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<object>(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<object>(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<object>(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<object>(makeLong(t, result));
|
||||
return makeLong(t, result);
|
||||
}
|
||||
} goto loop;
|
||||
|
||||
@ -2360,7 +2360,7 @@ interpret3(Thread* t, const int base)
|
||||
}
|
||||
}
|
||||
|
||||
object array = reinterpret_cast<object>(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<object>(makeBooleanArray(t, count));
|
||||
array = makeBooleanArray(t, count);
|
||||
break;
|
||||
|
||||
case T_CHAR:
|
||||
array = reinterpret_cast<object>(makeCharArray(t, count));
|
||||
array = makeCharArray(t, count);
|
||||
break;
|
||||
|
||||
case T_FLOAT:
|
||||
array = reinterpret_cast<object>(makeFloatArray(t, count));
|
||||
array = makeFloatArray(t, count);
|
||||
break;
|
||||
|
||||
case T_DOUBLE:
|
||||
array = reinterpret_cast<object>(makeDoubleArray(t, count));
|
||||
array = makeDoubleArray(t, count);
|
||||
break;
|
||||
|
||||
case T_BYTE:
|
||||
array = reinterpret_cast<object>(makeByteArray(t, count));
|
||||
array = makeByteArray(t, count);
|
||||
break;
|
||||
|
||||
case T_SHORT:
|
||||
array = reinterpret_cast<object>(makeShortArray(t, count));
|
||||
array = makeShortArray(t, count);
|
||||
break;
|
||||
|
||||
case T_INT:
|
||||
array = reinterpret_cast<object>(makeIntArray(t, count));
|
||||
array = makeIntArray(t, count);
|
||||
break;
|
||||
|
||||
case T_LONG:
|
||||
array = reinterpret_cast<object>(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<object>(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<object>(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<object>(makeInt(t, popInt(t)));
|
||||
result = makeInt(t, popInt(t));
|
||||
break;
|
||||
|
||||
case LongField:
|
||||
case DoubleField:
|
||||
result = reinterpret_cast<object>(makeLong(t, popLong(t)));
|
||||
result = makeLong(t, popLong(t));
|
||||
break;
|
||||
|
||||
case ObjectField:
|
||||
|
@ -187,7 +187,7 @@ GetStringCritical(Thread* t, jstring s, jboolean* isCopy)
|
||||
*isCopy = true;
|
||||
}
|
||||
|
||||
object data = reinterpret_cast<object>((*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<uint64_t>(
|
||||
makeLocalReference(t,
|
||||
reinterpret_cast<object>(t->m->classpath->makeString(
|
||||
t, reinterpret_cast<object>(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<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, reinterpret_cast<object>(t->m->classpath->makeString
|
||||
(t, array, 0, fieldAtOffset<uintptr_t>(array, BytesPerWord) - 1))));
|
||||
(t, t->m->classpath->makeString
|
||||
(t, array, 0, fieldAtOffset<uintptr_t>(array, BytesPerWord) - 1)));
|
||||
}
|
||||
|
||||
jstring JNICALL
|
||||
@ -325,14 +325,14 @@ defineClass(Thread* t, uintptr_t* arguments)
|
||||
|
||||
return reinterpret_cast<uint64_t>(makeLocalReference(
|
||||
t,
|
||||
reinterpret_cast<object>(getJClass(t,
|
||||
getJClass(t,
|
||||
cast<GcClass>(
|
||||
t,
|
||||
defineClass(t,
|
||||
loader ? cast<GcClassLoader>(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<uint64_t>(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, c))));
|
||||
return reinterpret_cast<uint64_t>(makeLocalReference(t, getJClass(t, c)));
|
||||
}
|
||||
|
||||
jclass JNICALL
|
||||
@ -457,7 +457,7 @@ getObjectClass(Thread* t, uintptr_t* arguments)
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
|
||||
return reinterpret_cast<uint64_t>(makeLocalReference(
|
||||
t, reinterpret_cast<object>(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<uint64_t>
|
||||
(makeLocalReference(t, reinterpret_cast<object>(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<object>(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<object>(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<object>(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<jthrowable>(makeLocalReference(t, reinterpret_cast<object>(t->exception)));
|
||||
return reinterpret_cast<jthrowable>(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<GcArray*>(a)->setBodyElement(t, i, value);
|
||||
}
|
||||
return reinterpret_cast<uint64_t>(makeLocalReference(t, reinterpret_cast<object>(a)));
|
||||
return reinterpret_cast<uint64_t>(makeLocalReference(t, a));
|
||||
}
|
||||
|
||||
jobjectArray JNICALL
|
||||
@ -2633,7 +2633,7 @@ NewBooleanArray(Thread* t, jsize length)
|
||||
object
|
||||
makeByteArray0(Thread* t, unsigned length)
|
||||
{
|
||||
return reinterpret_cast<object>(makeByteArray(t, length));
|
||||
return makeByteArray(t, length);
|
||||
}
|
||||
|
||||
jbyteArray JNICALL
|
||||
|
232
src/machine.cpp
232
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<object>(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<object>(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<GcFinalizer>(t, finalizer->next());
|
||||
|
||||
finalizer->next() = unreachable;
|
||||
unreachable = reinterpret_cast<object>(finalizer);
|
||||
unreachable = finalizer;
|
||||
} else {
|
||||
p = reinterpret_cast<GcFinalizer**>(&(*p)->next());
|
||||
}
|
||||
@ -570,7 +570,7 @@ postVisit(Thread* t, Heap::Visitor* v)
|
||||
|
||||
GcFinalizer* finalizer = *p;
|
||||
*p = cast<GcFinalizer>(t, finalizer->next());
|
||||
finalizer->next() = reinterpret_cast<object>(firstNewTenuredFinalizer);
|
||||
finalizer->next() = firstNewTenuredFinalizer;
|
||||
firstNewTenuredFinalizer = finalizer;
|
||||
} else {
|
||||
p = reinterpret_cast<GcFinalizer**>(&(*p)->next());
|
||||
@ -611,7 +611,7 @@ postVisit(Thread* t, Heap::Visitor* v)
|
||||
|
||||
GcJreference* reference = (*p);
|
||||
*p = cast<GcJreference>(t, reference->vmNext());
|
||||
reference->vmNext() = reinterpret_cast<object>(firstNewTenuredWeakReference);
|
||||
reference->vmNext() = firstNewTenuredWeakReference;
|
||||
firstNewTenuredWeakReference = reference;
|
||||
} else {
|
||||
p = reinterpret_cast<GcJreference**>(&(*p)->vmNext());
|
||||
@ -629,7 +629,7 @@ postVisit(Thread* t, Heap::Visitor* v)
|
||||
*p = cast<GcFinalizer>(t, finalizer->next());
|
||||
|
||||
finalizer->next() = unreachable;
|
||||
unreachable = reinterpret_cast<object>(finalizer);
|
||||
unreachable = finalizer;
|
||||
} else {
|
||||
p = reinterpret_cast<GcFinalizer**>(&(*p)->next());
|
||||
}
|
||||
@ -666,13 +666,13 @@ postVisit(Thread* t, Heap::Visitor* v)
|
||||
}
|
||||
|
||||
if (lastNewTenuredFinalizer) {
|
||||
lastNewTenuredFinalizer->next() = reinterpret_cast<object>(m->tenuredFinalizers);
|
||||
lastNewTenuredFinalizer->next() = m->tenuredFinalizers;
|
||||
m->tenuredFinalizers = firstNewTenuredFinalizer;
|
||||
}
|
||||
|
||||
if (lastNewTenuredWeakReference) {
|
||||
lastNewTenuredWeakReference->vmNext()
|
||||
= reinterpret_cast<object>(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<object>(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<object>(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<object>(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<object>(array), byteArrayHash, byteArrayEqual);
|
||||
(t, roots(t)->byteArrayMap(), array, byteArrayHash, byteArrayEqual);
|
||||
if (n) {
|
||||
return cast<GcByteArray>(t, cast<GcJreference>(t, n->first())->target());
|
||||
} else {
|
||||
hashMapInsert(t, roots(t)->byteArrayMap(), reinterpret_cast<object>(array), 0, byteArrayHash);
|
||||
addFinalizer(t, reinterpret_cast<object>(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<GcByteArray>(t, singletonObject(t, pool, si)));
|
||||
value = reinterpret_cast<object>(t->m->classpath->makeString
|
||||
(t, value, 0, fieldAtOffset<uintptr_t>(value, BytesPerWord) - 1));
|
||||
value = t->m->classpath->makeString
|
||||
(t, value, 0, fieldAtOffset<uintptr_t>(value, BytesPerWord) - 1);
|
||||
value = intern(t, value);
|
||||
pool->setBodyElement(t, i, reinterpret_cast<uintptr_t>(value));
|
||||
|
||||
@ -986,7 +986,7 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
|
||||
|
||||
GcByteArray* name = cast<GcByteArray>(t, singletonObject(t, pool, ni));
|
||||
GcByteArray* type = cast<GcByteArray>(t, singletonObject(t, pool, ti));
|
||||
GcPair* value = makePair(t, reinterpret_cast<object>(name), reinterpret_cast<object>(type));
|
||||
GcPair* value = makePair(t, name, type);
|
||||
pool->setBodyElement(t, i, reinterpret_cast<uintptr_t>(value));
|
||||
|
||||
if(DebugClassReader) {
|
||||
@ -1008,12 +1008,12 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
|
||||
GcByteArray* className = cast<GcReference>(t, singletonObject(t, pool, ci))->name();
|
||||
GcPair* nameAndType = cast<GcPair>(t, singletonObject(t, pool, nti));
|
||||
|
||||
object value = reinterpret_cast<object>(
|
||||
object value =
|
||||
makeReference(t,
|
||||
0,
|
||||
className,
|
||||
cast<GcByteArray>(t, nameAndType->first()),
|
||||
cast<GcByteArray>(t, nameAndType->second())));
|
||||
cast<GcByteArray>(t, nameAndType->second()));
|
||||
pool->setBodyElement(t, i, reinterpret_cast<uintptr_t>(value));
|
||||
|
||||
if(DebugClassReader) {
|
||||
@ -1086,8 +1086,8 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
|
||||
bootstrap,
|
||||
-1,
|
||||
0,
|
||||
reinterpret_cast<object>(pool),
|
||||
reinterpret_cast<object>(template_),
|
||||
pool,
|
||||
template_,
|
||||
0));
|
||||
|
||||
pool->setBodyElement(t, i, reinterpret_cast<uintptr_t>(value));
|
||||
@ -1207,8 +1207,8 @@ addInterfaces(Thread* t, GcClass* class_, GcHashMap* map)
|
||||
GcByteArray* name = interface->name();
|
||||
hashMapInsertMaybe(t,
|
||||
map,
|
||||
reinterpret_cast<object>(name),
|
||||
reinterpret_cast<object>(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<object>(class_),
|
||||
class_,
|
||||
ClassAddendum,
|
||||
reinterpret_cast<object>(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<object>(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<object>(interface));
|
||||
table->setBodyElement(t, i, interface);
|
||||
|
||||
hashMapInsertMaybe(t, map, reinterpret_cast<object>(name), reinterpret_cast<object>(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<GcClass>(t, it.next()->second());
|
||||
|
||||
interfaceTable->setBodyElement(t, i, reinterpret_cast<object>(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<object>(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<object>(interfaceTable));
|
||||
class_->setInterfaceTable(t, interfaceTable);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1373,7 +1373,7 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
|
||||
s.read(reinterpret_cast<uint8_t*>(body->body().begin()),
|
||||
length);
|
||||
|
||||
addendum->setAnnotationTable(t, reinterpret_cast<object>(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<object>(field));
|
||||
fieldTable->setBodyElement(t, i, field);
|
||||
}
|
||||
|
||||
class_->setFieldTable(t, reinterpret_cast<object>(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<object>(eht));
|
||||
code->setExceptionHandlerTable(t, eht);
|
||||
}
|
||||
|
||||
unsigned attributeCount = s.read2();
|
||||
@ -1991,7 +1991,7 @@ addInterfaceMethods(Thread* t, GcClass* class_, GcHashMap* virtualMap,
|
||||
method = cast<GcMethod>(t, vtable->body()[j]);
|
||||
GcTriple* n = hashMapFindNode(t,
|
||||
virtualMap,
|
||||
reinterpret_cast<object>(method),
|
||||
method,
|
||||
methodHash,
|
||||
methodEqual);
|
||||
if (n == 0) {
|
||||
@ -2012,15 +2012,15 @@ addInterfaceMethods(Thread* t, GcClass* class_, GcHashMap* virtualMap,
|
||||
|
||||
hashMapInsert(t,
|
||||
virtualMap,
|
||||
reinterpret_cast<object>(method),
|
||||
reinterpret_cast<object>(method),
|
||||
method,
|
||||
method,
|
||||
methodHash);
|
||||
|
||||
if (makeList) {
|
||||
if (list == 0) {
|
||||
list = vm::makeList(t, 0, 0, 0);
|
||||
}
|
||||
listAppend(t, list, reinterpret_cast<object>(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<object>(body));
|
||||
addendum->setExceptionTable(t, body);
|
||||
} else if (vm::strcmp(reinterpret_cast<const int8_t*>
|
||||
("AnnotationDefault"),
|
||||
attributeName->body().begin()) == 0)
|
||||
@ -2128,7 +2128,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
|
||||
s.read(reinterpret_cast<uint8_t*>(body->body().begin()),
|
||||
length);
|
||||
|
||||
addendum->setAnnotationDefault(t, reinterpret_cast<object>(body));
|
||||
addendum->setAnnotationDefault(t, body);
|
||||
} else if (vm::strcmp(reinterpret_cast<const int8_t*>("Signature"),
|
||||
attributeName->body().begin()) == 0)
|
||||
{
|
||||
@ -2149,7 +2149,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
|
||||
s.read(reinterpret_cast<uint8_t*>(body->body().begin()),
|
||||
length);
|
||||
|
||||
addendum->setAnnotationTable(t, reinterpret_cast<object>(body));
|
||||
addendum->setAnnotationTable(t, body);
|
||||
} else if (vm::strcmp(reinterpret_cast<const int8_t*>
|
||||
("RuntimeVisibleParameterAnnotations"),
|
||||
attributeName->body().begin()) == 0)
|
||||
@ -2162,7 +2162,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
|
||||
s.read(reinterpret_cast<uint8_t*>(body->body().begin()),
|
||||
length);
|
||||
|
||||
addendum->setParameterAnnotationTable(t, reinterpret_cast<object>(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<object>(method), methodHash, methodEqual);
|
||||
(t, virtualMap, method, methodHash, methodEqual);
|
||||
|
||||
if (p) {
|
||||
method->offset() = cast<GcMethod>(t, p->first())->offset();
|
||||
|
||||
p->setSecond(t, reinterpret_cast<object>(method));
|
||||
p->setSecond(t, method);
|
||||
} else {
|
||||
method->offset() = virtualCount++;
|
||||
|
||||
listAppend(t, newVirtuals, reinterpret_cast<object>(method));
|
||||
listAppend(t, newVirtuals, method);
|
||||
|
||||
hashMapInsert(t, virtualMap, reinterpret_cast<object>(method), reinterpret_cast<object>(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<object>(method));
|
||||
methodTable->setBodyElement(t, i, method);
|
||||
}
|
||||
|
||||
class_->setMethodTable(t, reinterpret_cast<object>(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<object>(superVirtualTable));
|
||||
class_->setVirtualTable(t, superVirtualTable);
|
||||
|
||||
if (class_->super()->interfaceTable()
|
||||
and cast<GcArray>(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<object>(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<GcMethod>(t, it.next()->first());
|
||||
assertT(t, vtable->body()[method->offset()] == 0);
|
||||
vtable->setBodyElement(t, method->offset(), reinterpret_cast<object>(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<object>(newMethodTable), ArrayBody, oldLength);
|
||||
mark(t, newMethodTable, ArrayBody, oldLength);
|
||||
|
||||
unsigned mti = oldLength;
|
||||
for (GcPair* p = cast<GcPair>(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<object>(newMethodTable));
|
||||
class_->setMethodTable(t, newMethodTable);
|
||||
}
|
||||
|
||||
assertT(t, vtable->length() == i);
|
||||
|
||||
class_->setVirtualTable(t, reinterpret_cast<object>(vtable));
|
||||
class_->setVirtualTable(t, vtable);
|
||||
}
|
||||
|
||||
if (populateInterfaceVtables) {
|
||||
@ -2420,11 +2420,11 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
|
||||
name ? cast<GcByteArray>(t, singletonObject(t, pool, name - 1)) : 0,
|
||||
flags);
|
||||
|
||||
table->setBodyElement(t, i, reinterpret_cast<object>(reference));
|
||||
table->setBodyElement(t, i, reference);
|
||||
}
|
||||
|
||||
GcClassAddendum* addendum = getClassAddendum(t, class_, pool);
|
||||
addendum->setInnerClassTable(t, reinterpret_cast<object>(table));
|
||||
addendum->setInnerClassTable(t, table);
|
||||
} else if (vm::strcmp(reinterpret_cast<const int8_t*>
|
||||
("RuntimeVisibleAnnotations"),
|
||||
name->body().begin()) == 0)
|
||||
@ -2434,7 +2434,7 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
|
||||
s.read(reinterpret_cast<uint8_t*>(body->body().begin()), length);
|
||||
|
||||
GcClassAddendum* addendum = getClassAddendum(t, class_, pool);
|
||||
addendum->setAnnotationTable(t, reinterpret_cast<object>(body));
|
||||
addendum->setAnnotationTable(t, body);
|
||||
} else if (vm::strcmp(reinterpret_cast<const int8_t*>
|
||||
("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<object>(roots(t)->arrayInterfaceTable()),
|
||||
reinterpret_cast<object>(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<object>(map));
|
||||
loader->setMap(t, map);
|
||||
}
|
||||
|
||||
hashMapInsert(t,
|
||||
cast<GcHashMap>(t, loader->map()),
|
||||
reinterpret_cast<object>(c->name()),
|
||||
reinterpret_cast<object>(c),
|
||||
c->name(),
|
||||
c,
|
||||
byteArrayHash);
|
||||
}
|
||||
|
||||
@ -2638,7 +2638,7 @@ makeArrayClass(Thread* t, GcClassLoader* loader, GcByteArray* spec, bool throw_,
|
||||
}
|
||||
|
||||
GcClass* elementClass = cast<GcClass>(t, hashMapFind
|
||||
(t, roots(t)->bootstrapClassMap(), reinterpret_cast<object>(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<GcClass>(t,
|
||||
hashMapFind(t,
|
||||
roots(t)->bootstrapClassMap(),
|
||||
reinterpret_cast<object>(spec),
|
||||
spec,
|
||||
byteArrayHash,
|
||||
byteArrayEqual));
|
||||
|
||||
@ -2774,12 +2774,12 @@ bootJavaClass(Thread* t, Gc::Type type, int superType, const char* name,
|
||||
vtable = cast<GcArray>(t, vm::type(t, static_cast<Gc::Type>(superType))->virtualTable());
|
||||
}
|
||||
|
||||
class_->setVirtualTable(t, reinterpret_cast<object>(vtable));
|
||||
class_->setVirtualTable(t, vtable);
|
||||
|
||||
t->m->processor->initVtable(t, class_);
|
||||
|
||||
hashMapInsert
|
||||
(t, roots(t)->bootstrapClassMap(), reinterpret_cast<object>(n), reinterpret_cast<object>(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<object>(type(t, GcSerializable::Type)));
|
||||
interfaceTable->setBodyElement(t, 0, type(t, GcSerializable::Type));
|
||||
|
||||
interfaceTable->setBodyElement(t, 2, reinterpret_cast<object>(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<object>(map));
|
||||
roots(t)->bootLoader()->setMap(t, map);
|
||||
}
|
||||
|
||||
roots(t)->bootLoader()->as<GcSystemClassLoader>(t)->finder() = m->bootFinder;
|
||||
|
||||
{ GcHashMap* map = makeHashMap(t, 0, 0);
|
||||
roots(t)->appLoader()->setMap(t, reinterpret_cast<object>(map));
|
||||
roots(t)->appLoader()->setMap(t, map);
|
||||
}
|
||||
|
||||
roots(t)->appLoader()->as<GcSystemClassLoader>(t)->finder() = m->appFinder;
|
||||
@ -2916,21 +2916,21 @@ boot(Thread* t)
|
||||
|
||||
makeArrayInterfaceTable(t);
|
||||
|
||||
type(t, GcBooleanArray::Type)->setInterfaceTable(t, reinterpret_cast<object>(roots(t)->arrayInterfaceTable()));
|
||||
type(t, GcByteArray::Type)->setInterfaceTable(t, reinterpret_cast<object>(roots(t)->arrayInterfaceTable()));
|
||||
type(t, GcCharArray::Type)->setInterfaceTable(t, reinterpret_cast<object>(roots(t)->arrayInterfaceTable()));
|
||||
type(t, GcShortArray::Type)->setInterfaceTable(t, reinterpret_cast<object>(roots(t)->arrayInterfaceTable()));
|
||||
type(t, GcIntArray::Type)->setInterfaceTable(t, reinterpret_cast<object>(roots(t)->arrayInterfaceTable()));
|
||||
type(t, GcLongArray::Type)->setInterfaceTable(t, reinterpret_cast<object>(roots(t)->arrayInterfaceTable()));
|
||||
type(t, GcFloatArray::Type)->setInterfaceTable(t, reinterpret_cast<object>(roots(t)->arrayInterfaceTable()));
|
||||
type(t, GcDoubleArray::Type)->setInterfaceTable(t, reinterpret_cast<object>(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<object>(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<object>(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<object>(key), reinterpret_cast<object>(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<GcJreference>(t, instance)->vmNext() = reinterpret_cast<object>(t->m->weakReferences);
|
||||
cast<GcJreference>(t, instance)->vmNext() = t->m->weakReferences;
|
||||
t->m->weakReferences = cast<GcJreference>(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<object>(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<object>(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<object>(string->data());
|
||||
object data = string->data();
|
||||
if (objectClass(t, data) == type(t, GcByteArray::Type)) {
|
||||
GcByteArray* b = cast<GcByteArray>(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<object>(string->data());
|
||||
object data = string->data();
|
||||
if (objectClass(t, data) == type(t, GcByteArray::Type)) {
|
||||
GcByteArray* b = cast<GcByteArray>(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<unsigned>
|
||||
(stringUTFLength(t, string, start, length)) == charsLength);
|
||||
|
||||
object data = reinterpret_cast<object>(string->data());
|
||||
object data = string->data();
|
||||
if (objectClass(t, data) == type(t, GcByteArray::Type)) {
|
||||
GcByteArray* b = cast<GcByteArray>(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<object>(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<object>(class_->name()),
|
||||
(t, roots(t)->bootstrapClassMap(), class_->name(),
|
||||
byteArrayHash, byteArrayEqual);
|
||||
|
||||
hashMapInsert(
|
||||
t,
|
||||
roots(t)->poolMap(),
|
||||
bootstrapClass ? bootstrapClass : reinterpret_cast<object>(real),
|
||||
reinterpret_cast<object>(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<GcClass>(t, hashMapFind
|
||||
(t, cast<GcHashMap>(t, loader->map()), reinterpret_cast<object>(spec), byteArrayHash, byteArrayEqual));
|
||||
(t, cast<GcHashMap>(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<GcClass>(t, hashMapFind
|
||||
(t, roots(t)->bootstrapClassMap(), reinterpret_cast<object>(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<GcHashMap>(t, loader->map()), reinterpret_cast<object>(spec), reinterpret_cast<object>(class_), byteArrayHash);
|
||||
hashMapInsert(t, cast<GcHashMap>(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<GcClass>(t, hashMapFind
|
||||
(t, cast<GcHashMap>(t, loader->map()), reinterpret_cast<object>(spec), byteArrayHash, byteArrayEqual)) : 0;
|
||||
(t, cast<GcHashMap>(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<object>(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<object>(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<object>(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<object>(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<GcMonitor>(t, m);
|
||||
}
|
||||
|
||||
object head = reinterpret_cast<object>(makeMonitorNode(t, 0, 0));
|
||||
m = reinterpret_cast<object>(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<object>(cast<GcJreference>(t, n->first())->target());
|
||||
return cast<GcJreference>(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<object>(e->trace());
|
||||
object trace = e->trace();
|
||||
if (trace) {
|
||||
for (unsigned i = 0; i < objectArrayLength(t, trace); ++i) {
|
||||
GcTraceElement* e = cast<GcTraceElement>(t, objectArrayBody(t, trace, i));
|
||||
@ -5143,9 +5143,9 @@ makeTrace(Thread* t, Processor::StackWalker* walker)
|
||||
assertT(t, trace);
|
||||
}
|
||||
|
||||
GcTraceElement* e = makeTraceElement(t, reinterpret_cast<object>(walker->method()), walker->ip());
|
||||
assertT(t, index < objectArrayLength(t, reinterpret_cast<object>(trace)));
|
||||
reinterpret_cast<GcArray*>(trace)->setBodyElement(t, index, reinterpret_cast<object>(e));
|
||||
GcTraceElement* e = makeTraceElement(t, walker->method(), walker->ip());
|
||||
assertT(t, index < objectArrayLength(t, trace));
|
||||
reinterpret_cast<GcArray*>(trace)->setBodyElement(t, index, e);
|
||||
++ index;
|
||||
return true;
|
||||
}
|
||||
@ -5218,7 +5218,7 @@ runFinalizeThread(Thread* t)
|
||||
}
|
||||
|
||||
for (; cleanList; cleanList = cleanList->queueNext()) {
|
||||
finalizeObject(t, reinterpret_cast<object>(cleanList), "clean");
|
||||
finalizeObject(t, cleanList, "clean");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5252,7 +5252,7 @@ parseUtf8(Thread* t, GcByteArray* array)
|
||||
}
|
||||
}
|
||||
|
||||
return reinterpret_cast<object>(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<object>(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<object>(a), class_);
|
||||
setField(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(a));
|
||||
setObjectClass(t, a, class_);
|
||||
setField(t, array, ArrayBody + (i * BytesPerWord), a);
|
||||
|
||||
populateMultiArray(t, reinterpret_cast<object>(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<object>(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<object>(lock));
|
||||
thread->setInterruptLock(t, lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<object>(this), ");
|
||||
out->write("setField(t, this , ");
|
||||
out->write(capitalize(cl->name));
|
||||
out->write(capitalize(f.name));
|
||||
out->write(", reinterpret_cast<object>(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<object>(this), ");
|
||||
out->write("setField(t, this , ");
|
||||
out->write(capitalize(cl->name));
|
||||
out->write(capitalize(f.name));
|
||||
out->write(" + index * (");
|
||||
|
16
src/util.cpp
16
src/util.cpp
@ -327,7 +327,7 @@ hashMapFindNode(Thread* t, GcHashMap* map, object key,
|
||||
for (GcTriple* n = cast<GcTriple>(t, array->body()[index]); n; n = cast<GcTriple>(t, n->third())) {
|
||||
object k = n->first();
|
||||
if (weak) {
|
||||
k = reinterpret_cast<object>(cast<GcJreference>(t, k)->target());
|
||||
k = cast<GcJreference>(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<object>(cast<GcJreference>(t, k)->target());
|
||||
k = cast<GcJreference>(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<object>(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<object>(t->m->weakReferences));
|
||||
r->setVmNext(t, t->m->weakReferences);
|
||||
t->m->weakReferences = r->as<GcJreference>(t);
|
||||
k = reinterpret_cast<object>(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<object>(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<GcTriple>(t, array->body()[index]); n;) {
|
||||
object k = n->first();
|
||||
if (weak) {
|
||||
k = reinterpret_cast<object>(cast<GcJreference>(t, k)->target());
|
||||
k = cast<GcJreference>(t, k)->target();
|
||||
if (k == 0) {
|
||||
n = cast<GcTriple>(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<object>(makePair(t, value, 0));
|
||||
object p = makePair(t, value, 0);
|
||||
if (list->front()) {
|
||||
cast<GcPair>(t, list->rear())->setSecond(t, p);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user