finish using setters

This commit is contained in:
Joshua Warner
2014-06-25 20:17:27 -06:00
committed by Joshua Warner
parent 4367867be9
commit b0490b8233
14 changed files with 146 additions and 136 deletions

View File

@ -21,6 +21,10 @@ public class ClassAddendum extends Addendum {
* extended by that class. * extended by that class.
*/ */
public int declaredMethodCount; public int declaredMethodCount;
// Either a byte[] or a Pair, apparently...
// TODO: make it monomorphic
public Object enclosingClass; public Object enclosingClass;
public Object enclosingMethod; public Object enclosingMethod;
} }

View File

@ -1539,7 +1539,7 @@ class GcJfield;
class Classpath { class Classpath {
public: public:
virtual object virtual GcJclass*
makeJclass(Thread* t, GcClass* class_) = 0; makeJclass(Thread* t, GcClass* class_) = 0;
virtual GcString* virtual GcString*
@ -1871,14 +1871,14 @@ mark(Thread* t, object o, unsigned offset)
} }
inline void inline void
set(Thread* t, object target, unsigned offset, object value) setField(Thread* t, object target, unsigned offset, object value)
{ {
fieldAtOffset<object>(target, offset) = value; fieldAtOffset<object>(target, offset) = value;
mark(t, target, offset); mark(t, target, offset);
} }
inline void inline void
set(Thread* t, GcObject* target, unsigned offset, GcObject* value) setField(Thread* t, GcObject* target, unsigned offset, GcObject* value)
{ {
fieldAtOffset<GcObject*>(target, offset) = value; fieldAtOffset<GcObject*>(target, offset) = value;
mark(t, reinterpret_cast<object>(target), offset); mark(t, reinterpret_cast<object>(target), offset);
@ -1887,7 +1887,7 @@ set(Thread* t, GcObject* target, unsigned offset, GcObject* value)
inline void inline void
setObject(Thread* t, GcObject* target, unsigned offset, GcObject* value) setObject(Thread* t, GcObject* target, unsigned offset, GcObject* value)
{ {
set(t, target, offset, value); setField(t, target, offset, value);
} }
inline void inline void
@ -3612,7 +3612,7 @@ resolveClassInObject(Thread* t, GcClassLoader* loader, object container,
if (c) { if (c) {
storeStoreMemoryBarrier(); storeStoreMemoryBarrier();
set(t, container, classOffset, reinterpret_cast<object>(c)); setField(t, container, classOffset, reinterpret_cast<object>(c));
} }
return c; return c;
@ -3894,7 +3894,7 @@ getJClass(Thread* t, GcClass* c)
jclass = cast<GcJclass>(t, getClassRuntimeData(t, c)->jclass()); jclass = cast<GcJclass>(t, getClassRuntimeData(t, c)->jclass());
if (jclass == 0) { if (jclass == 0) {
jclass = cast<GcJclass>(t, t->m->classpath->makeJclass(t, c)); jclass = t->m->classpath->makeJclass(t, c);
storeStoreMemoryBarrier(); storeStoreMemoryBarrier();

View File

@ -48,7 +48,7 @@ hashMapInsertOrReplace(Thread* t, GcHashMap* map, object key, object value,
hashMapInsert(t, map, key, value, hash); hashMapInsert(t, map, key, value, hash);
return true; return true;
} else { } else {
set(t, reinterpret_cast<object>(n), TripleSecond, value); n->setSecond(t, value);
return false; return false;
} }
} }

View File

@ -765,7 +765,7 @@ Avian_sun_misc_Unsafe_putObject
int64_t offset; memcpy(&offset, arguments + 2, 8); int64_t offset; memcpy(&offset, arguments + 2, 8);
uintptr_t value = arguments[4]; uintptr_t value = arguments[4];
set(t, o, offset, reinterpret_cast<object>(value)); setField(t, o, offset, reinterpret_cast<object>(value));
} }
extern "C" AVIAN_EXPORT void JNICALL extern "C" AVIAN_EXPORT void JNICALL
@ -777,7 +777,7 @@ Avian_sun_misc_Unsafe_putObjectVolatile
object value = reinterpret_cast<object>(arguments[4]); object value = reinterpret_cast<object>(arguments[4]);
storeStoreMemoryBarrier(); storeStoreMemoryBarrier();
set(t, o, offset, reinterpret_cast<object>(value)); setField(t, o, offset, reinterpret_cast<object>(value));
storeLoadMemoryBarrier(); storeLoadMemoryBarrier();
} }

View File

@ -232,7 +232,7 @@ class MyClasspath : public Classpath {
: allocator(allocator), tzdata(0), mayInitClasses_(false) : allocator(allocator), tzdata(0), mayInitClasses_(false)
{ } { }
virtual object virtual GcJclass*
makeJclass(Thread* t, GcClass* class_) makeJclass(Thread* t, GcClass* class_)
{ {
PROTECT(t, class_); PROTECT(t, class_);
@ -241,7 +241,7 @@ class MyClasspath : public Classpath {
setObjectClass(t, reinterpret_cast<object>(c), type(t, GcJclass::Type)); setObjectClass(t, reinterpret_cast<object>(c), type(t, GcJclass::Type));
c->setVmClass(t, class_); c->setVmClass(t, class_);
return reinterpret_cast<object>(c); return c;
} }
virtual GcString* virtual GcString*

View File

@ -26,10 +26,10 @@ class MyClasspath : public Classpath {
allocator(allocator) allocator(allocator)
{ } { }
virtual object virtual GcJclass*
makeJclass(Thread* t, GcClass* class_) makeJclass(Thread* t, GcClass* class_)
{ {
return reinterpret_cast<object>(vm::makeJclass(t, class_)); return vm::makeJclass(t, class_);
} }
virtual GcString* virtual GcString*
@ -228,11 +228,11 @@ class MyClasspath : public Classpath {
}; };
void void
enumerateThreads(Thread* t, Thread* x, object array, unsigned* index, enumerateThreads(Thread* t, Thread* x, GcArray* array, unsigned* index,
unsigned limit) unsigned limit)
{ {
if (*index < limit) { if (*index < limit) {
set(t, array, ArrayBody + (*index * BytesPerWord), reinterpret_cast<object>(x->javaThread)); array->setBodyElement(t, *index, reinterpret_cast<object>(x->javaThread));
++ (*index); ++ (*index);
if (x->peer) enumerateThreads(t, x->peer, array, index, limit); if (x->peer) enumerateThreads(t, x->peer, array, index, limit);
@ -427,7 +427,7 @@ Avian_java_lang_reflect_Field_setObject
int offset = arguments[1]; int offset = arguments[1];
object value = reinterpret_cast<object>(arguments[2]); object value = reinterpret_cast<object>(arguments[2]);
set(t, instance, offset, value); setField(t, instance, offset, value);
} }
extern "C" AVIAN_EXPORT int64_t JNICALL extern "C" AVIAN_EXPORT int64_t JNICALL
@ -547,7 +547,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
for (unsigned i = 0; i < t->m->propertyCount; ++i) { for (unsigned i = 0; i < t->m->propertyCount; ++i) {
GcString* s = makeString(t, "%s", t->m->properties[i]); GcString* s = makeString(t, "%s", t->m->properties[i]);
set(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(s)); reinterpret_cast<GcArray*>(array)->setBodyElement(t, i, reinterpret_cast<object>(s));
} }
return reinterpret_cast<int64_t>(array); return reinterpret_cast<int64_t>(array);
@ -619,7 +619,8 @@ Avian_java_lang_Runtime_addShutdownHook
ACQUIRE(t, t->m->shutdownLock); ACQUIRE(t, t->m->shutdownLock);
GcPair* p = makePair(t, hook, reinterpret_cast<object>(roots(t)->shutdownHooks())); GcPair* p = makePair(t, hook, reinterpret_cast<object>(roots(t)->shutdownHooks()));
set(t, roots(t), RootsShutdownHooks, p); // sequence point, for gc (don't recombine statements)
roots(t)->setShutdownHooks(t, p);
} }
extern "C" AVIAN_EXPORT int64_t JNICALL extern "C" AVIAN_EXPORT int64_t JNICALL
@ -643,7 +644,7 @@ Avian_java_lang_Throwable_resolveTrace
for (unsigned i = 0; i < length; ++i) { for (unsigned i = 0; i < length; ++i) {
GcStackTraceElement* ste = makeStackTraceElement(t, cast<GcTraceElement>(t, objectArrayBody(t, trace, i))); GcStackTraceElement* ste = makeStackTraceElement(t, cast<GcTraceElement>(t, objectArrayBody(t, trace, i)));
set(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(ste)); reinterpret_cast<GcArray*>(array)->setBodyElement(t, i, reinterpret_cast<object>(ste));
} }
return reinterpret_cast<int64_t>(array); return reinterpret_cast<int64_t>(array);
@ -714,7 +715,7 @@ Avian_java_lang_Thread_enumerate
unsigned count = min(t->m->liveCount, objectArrayLength(t, reinterpret_cast<object>(array))); unsigned count = min(t->m->liveCount, objectArrayLength(t, reinterpret_cast<object>(array)));
unsigned index = 0; unsigned index = 0;
local::enumerateThreads(t, t->m->rootThread, reinterpret_cast<object>(array), &index, count); local::enumerateThreads(t, t->m->rootThread, array, &index, count);
return count; return count;
} }

View File

@ -325,7 +325,7 @@ getClassName(Thread* t, GcClass* c)
GcByteArray* name = makeByteArray(t, primitiveName(t, c)); GcByteArray* name = makeByteArray(t, primitiveName(t, c));
set(t, c, ClassName, name); c->setName(t, name);
} else { } else {
abort(t); abort(t);
} }
@ -481,7 +481,7 @@ class MyClasspath : public Classpath {
this->bufferSize = sb.bufferSize; this->bufferSize = sb.bufferSize;
} }
virtual object virtual GcJclass*
makeJclass(Thread* t, GcClass* class_) makeJclass(Thread* t, GcClass* class_)
{ {
PROTECT(t, class_); PROTECT(t, class_);
@ -489,10 +489,10 @@ class MyClasspath : public Classpath {
GcString* name = makeClassNameString(t, getClassName(t, class_)); GcString* name = makeClassNameString(t, getClassName(t, class_));
PROTECT(t, name); PROTECT(t, name);
object c = allocate(t, GcJclass::FixedSize, true); GcJclass* c = reinterpret_cast<GcJclass*>(allocate(t, GcJclass::FixedSize, true));
setObjectClass(t, c, type(t, GcJclass::Type)); setObjectClass(t, reinterpret_cast<object>(c), type(t, GcJclass::Type));
set(t, c, JclassName, reinterpret_cast<object>(name)); c->setName(t, name);
set(t, c, JclassVmClass, reinterpret_cast<object>(class_)); c->setVmClass(t, class_);
return c; return c;
} }
@ -556,16 +556,14 @@ class MyClasspath : public Classpath {
setObjectClass(t, reinterpret_cast<object>(thread), type(t, GcThread::Type)); setObjectClass(t, reinterpret_cast<object>(thread), type(t, GcThread::Type));
thread->priority() = NormalPriority; thread->priority() = NormalPriority;
// TODO: use set / write barrier? thread->setGroup(t, group);
thread->group() = group;
// TODO: use set / write barrier? thread->setContextClassLoader(t, roots(t)->appLoader());
thread->contextClassLoader() = roots(t)->appLoader();
PROTECT(t, thread); PROTECT(t, thread);
GcJobject* blockerLock = makeJobject(t); GcJobject* blockerLock = makeJobject(t);
set(t, thread, ThreadBlockerLock, blockerLock); thread->setBlockerLock(t, reinterpret_cast<object>(blockerLock));
const unsigned BufferSize = 256; const unsigned BufferSize = 256;
char buffer[BufferSize]; char buffer[BufferSize];
@ -574,7 +572,7 @@ class MyClasspath : public Classpath {
for (unsigned i = 0; i < length; ++i) { for (unsigned i = 0; i < length; ++i) {
name->body()[i] = buffer[i]; name->body()[i] = buffer[i];
} }
set(t, thread, ThreadName, name); thread->setName(t, name);
return thread; return thread;
} }
@ -710,7 +708,7 @@ class MyClasspath : public Classpath {
(t, roots(t)->bootLoader(), "java/lang/ThreadGroup", (t, roots(t)->bootLoader(), "java/lang/ThreadGroup",
"threadTerminated", "(Ljava/lang/Thread;)V"); "threadTerminated", "(Ljava/lang/Thread;)V");
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsThreadTerminated, method); roots(t)->setThreadTerminated(t, reinterpret_cast<object>(method));
#ifdef AVIAN_OPENJDK_SRC #ifdef AVIAN_OPENJDK_SRC
interceptFileOperations(t, true); interceptFileOperations(t, true);
@ -723,7 +721,7 @@ class MyClasspath : public Classpath {
(t, type(t, GcClassLoader::Type), "assertionLock", (t, type(t, GcClassLoader::Type), "assertionLock",
"Ljava/lang/Object;"); "Ljava/lang/Object;");
set(t, roots(t)->bootLoader(), assertionLock->offset(), setField(t, roots(t)->bootLoader(), assertionLock->offset(),
roots(t)->bootLoader()); roots(t)->bootLoader());
} }
@ -768,7 +766,7 @@ class MyClasspath : public Classpath {
GcField* sclSet = resolveField GcField* sclSet = resolveField
(t, type(t, GcClassLoader::Type), "sclSet", "Z"); (t, type(t, GcClassLoader::Type), "sclSet", "Z");
set(t, type(t, GcClassLoader::Type)->staticTable(), setField(t, type(t, GcClassLoader::Type)->staticTable(),
scl->offset(), roots(t)->appLoader()); scl->offset(), roots(t)->appLoader());
fieldAtOffset<uint8_t>(type(t, GcClassLoader::Type)->staticTable(), fieldAtOffset<uint8_t>(type(t, GcClassLoader::Type)->staticTable(),
@ -783,8 +781,7 @@ class MyClasspath : public Classpath {
(t, roots(t)->bootLoader(), "sun/misc/Launcher", (t, roots(t)->bootLoader(), "sun/misc/Launcher",
"getLauncher", "()Lsun/misc/Launcher;", 0); "getLauncher", "()Lsun/misc/Launcher;", 0);
set(t, t->javaThread, ThreadContextClassLoader, t->javaThread->setContextClassLoader(t, roots(t)->appLoader());
roots(t)->appLoader());
} }
virtual const char* virtual const char*
@ -2292,8 +2289,8 @@ makeJmethod(Thread* t, GcMethod* vmMethod, int index)
if (annotationTable or parameterAnnotationTable or annotationDefault) { if (annotationTable or parameterAnnotationTable or annotationDefault) {
GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmMethod->class_()); GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmMethod->class_());
set(t, runtimeData, ClassRuntimeDataPool, runtimeData->setPool(t,
vmMethod->addendum()->pool()); reinterpret_cast<object>(vmMethod->addendum()->pool()));
} }
if (index == -1) { if (index == -1) {
@ -2361,8 +2358,8 @@ makeJconstructor(Thread* t, GcMethod* vmMethod, int index)
if (annotationTable or parameterAnnotationTable) { if (annotationTable or parameterAnnotationTable) {
GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmMethod->class_()); GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmMethod->class_());
set(t, runtimeData, ClassRuntimeDataPool, runtimeData->setPool(t,
vmMethod->addendum()->pool()); reinterpret_cast<object>(vmMethod->addendum()->pool()));
} }
if (index == -1) { if (index == -1) {
@ -2440,8 +2437,8 @@ makeJfield(Thread* t, GcField* vmField, int index)
if (annotationTable) { if (annotationTable) {
GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmField->class_()); GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmField->class_());
set(t, runtimeData, ClassRuntimeDataPool, runtimeData->setPool(t,
vmField->addendum()->pool()); reinterpret_cast<object>(vmField->addendum()->pool()));
} }
if (index == -1) { if (index == -1) {
@ -3199,10 +3196,10 @@ EXPORT(JVM_IsNaN)(jdouble) { abort(); }
uint64_t uint64_t
jvmFillInStackTrace(Thread* t, uintptr_t* arguments) jvmFillInStackTrace(Thread* t, uintptr_t* arguments)
{ {
jobject throwable = reinterpret_cast<jobject>(arguments[0]); GcThrowable* throwable = cast<GcThrowable>(t, *reinterpret_cast<jobject>(arguments[0]));
object trace = getTrace(t, 2); object trace = getTrace(t, 2);
set(t, *throwable, ThrowableTrace, trace); throwable->setTrace(t, trace);
return 1; return 1;
} }
@ -3337,7 +3334,7 @@ jvmSleep(Thread* t, uintptr_t* arguments)
if (t->javaThread->sleepLock() == 0) { if (t->javaThread->sleepLock() == 0) {
GcJobject* lock = makeJobject(t); GcJobject* lock = makeJobject(t);
set(t, t->javaThread, ThreadSleepLock, lock); t->javaThread->setSleepLock(t, reinterpret_cast<object>(lock));
} }
acquire(t, t->javaThread->sleepLock()); acquire(t, t->javaThread->sleepLock());
@ -3452,10 +3449,10 @@ jvmDumpThreads(Thread* t, uintptr_t* arguments)
for (unsigned traceIndex = 0; traceIndex < traceLength; ++ traceIndex) { for (unsigned traceIndex = 0; traceIndex < traceLength; ++ traceIndex) {
object ste = reinterpret_cast<object>(makeStackTraceElement object ste = reinterpret_cast<object>(makeStackTraceElement
(t, cast<GcTraceElement>(t, objectArrayBody(t, trace, traceIndex)))); (t, cast<GcTraceElement>(t, objectArrayBody(t, trace, traceIndex))));
set(t, array, ArrayBody + (traceIndex * BytesPerWord), ste); setField(t, array, ArrayBody + (traceIndex * BytesPerWord), ste);
} }
set(t, result, ArrayBody + (threadsIndex * BytesPerWord), array); setField(t, result, ArrayBody + (threadsIndex * BytesPerWord), array);
} }
} }
@ -3497,7 +3494,7 @@ jvmGetClassContext(Thread* t, uintptr_t*)
t, 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_()));
set(t, context, ArrayBody + (i * BytesPerWord), c); setField(t, context, ArrayBody + (i * BytesPerWord), c);
} }
return reinterpret_cast<uint64_t>(makeLocalReference(t, context)); return reinterpret_cast<uint64_t>(makeLocalReference(t, context));
@ -3716,7 +3713,7 @@ EXPORT(JVM_SetArrayElement)(Thread* t, jobject array, jint index,
break; break;
case 'L': case 'L':
case '[': case '[':
set(t, *array, ArrayBody + (index * BytesPerWord), (value ? *value : 0)); setField(t, *array, ArrayBody + (index * BytesPerWord), (value ? *value : 0));
break; break;
default: default:
abort(t); abort(t);
@ -4021,7 +4018,7 @@ jvmGetClassInterfaces(Thread* t, uintptr_t* arguments)
for (unsigned i = 0; i < table->length(); ++i) { for (unsigned i = 0; i < table->length(); ++i) {
object c = reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, table->body()[i]))); object c = reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, table->body()[i])));
set(t, array, ArrayBody + (i * BytesPerWord), c); setField(t, array, ArrayBody + (i * BytesPerWord), c);
} }
return reinterpret_cast<uint64_t>(makeLocalReference(t, array)); return reinterpret_cast<uint64_t>(makeLocalReference(t, array));
@ -4111,7 +4108,7 @@ EXPORT(JVM_SetClassSigners)(Thread* t, jclass c, jobjectArray signers)
GcClassRuntimeData* runtimeData = getClassRuntimeData(t, (*c)->vmClass()); GcClassRuntimeData* runtimeData = getClassRuntimeData(t, (*c)->vmClass());
set(t, reinterpret_cast<object>(runtimeData), ClassRuntimeDataSigners, reinterpret_cast<object>(*signers)); runtimeData->setSigners(t, reinterpret_cast<object>(*signers));
} }
uint64_t uint64_t
@ -4297,7 +4294,7 @@ jvmGetClassDeclaredMethods(Thread* t, uintptr_t* arguments)
assertT(t, ai < objectArrayLength(t, array)); assertT(t, ai < objectArrayLength(t, array));
set(t, array, ArrayBody + ((ai++) * BytesPerWord), method); setField(t, array, ArrayBody + ((ai++) * BytesPerWord), method);
} }
} }
@ -4342,7 +4339,7 @@ jvmGetClassDeclaredFields(Thread* t, uintptr_t* arguments)
assertT(t, ai < objectArrayLength(t, array)); assertT(t, ai < objectArrayLength(t, array));
set(t, array, ArrayBody + ((ai++) * BytesPerWord), field); setField(t, array, ArrayBody + ((ai++) * BytesPerWord), field);
} }
} }
assertT(t, ai == objectArrayLength(t, array)); assertT(t, ai == objectArrayLength(t, array));
@ -4395,7 +4392,7 @@ jvmGetClassDeclaredConstructors(Thread* t, uintptr_t* arguments)
assertT(t, ai < objectArrayLength(t, array)); assertT(t, ai < objectArrayLength(t, array));
set(t, array, ArrayBody + ((ai++) * BytesPerWord), method); setField(t, array, ArrayBody + ((ai++) * BytesPerWord), method);
} }
} }
@ -5142,7 +5139,7 @@ getInputArgumentArray(Thread* t, uintptr_t*)
for (unsigned i = 0; i < t->m->argumentCount; ++i) { for (unsigned i = 0; i < t->m->argumentCount; ++i) {
GcString* argument = makeString(t, t->m->arguments[i]); GcString* argument = makeString(t, t->m->arguments[i]);
set(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(argument)); setField(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(argument));
} }
return reinterpret_cast<uintptr_t>(makeLocalReference(t, array)); return reinterpret_cast<uintptr_t>(makeLocalReference(t, array));
@ -5273,7 +5270,7 @@ getEnclosingMethodInfo(Thread* t, uintptr_t* arguments)
enclosingClass = reinterpret_cast<object>(getJClass enclosingClass = reinterpret_cast<object>(getJClass
(t, resolveClass(t, class_->loader(), cast<GcByteArray>(t, enclosingClass)))); (t, resolveClass(t, class_->loader(), cast<GcByteArray>(t, enclosingClass))));
set(t, array, ArrayBody, enclosingClass); setField(t, array, ArrayBody, enclosingClass);
GcPair* enclosingMethod = cast<GcPair>(t, addendum->enclosingMethod()); GcPair* enclosingMethod = cast<GcPair>(t, addendum->enclosingMethod());
@ -5284,13 +5281,13 @@ getEnclosingMethodInfo(Thread* t, uintptr_t* arguments)
(t, enclosingMethod->first(), 0, (t, enclosingMethod->first(), 0,
cast<GcByteArray>(t, enclosingMethod->first())->length() - 1); cast<GcByteArray>(t, enclosingMethod->first())->length() - 1);
set(t, array, ArrayBody + BytesPerWord, reinterpret_cast<object>(name)); setField(t, array, ArrayBody + BytesPerWord, reinterpret_cast<object>(name));
GcString* spec = t->m->classpath->makeString GcString* spec = t->m->classpath->makeString
(t, enclosingMethod->second(), 0, (t, enclosingMethod->second(), 0,
cast<GcByteArray>(t, enclosingMethod->second())->length() - 1); cast<GcByteArray>(t, enclosingMethod->second())->length() - 1);
set(t, array, ArrayBody + (2 * BytesPerWord), reinterpret_cast<object>(spec)); setField(t, array, ArrayBody + (2 * BytesPerWord), reinterpret_cast<object>(spec));
} }
return reinterpret_cast<uintptr_t>(makeLocalReference(t, array)); return reinterpret_cast<uintptr_t>(makeLocalReference(t, array));

View File

@ -2560,7 +2560,7 @@ void
setMaybeNull(MyThread* t, object o, unsigned offset, object value) setMaybeNull(MyThread* t, object o, unsigned offset, object value)
{ {
if (LIKELY(o)) { if (LIKELY(o)) {
set(t, o, offset, value); setField(t, o, offset, value);
} else { } else {
throwNew(t, GcNullPointerException::Type); throwNew(t, GcNullPointerException::Type);
} }
@ -2813,7 +2813,7 @@ setStaticObjectFieldValueFromReference(MyThread* t, GcPair* pair, object value)
ACQUIRE_FIELD_FOR_WRITE(t, field); ACQUIRE_FIELD_FOR_WRITE(t, field);
set(t, reinterpret_cast<object>(field->class_()->staticTable()), field->offset(), setField(t, reinterpret_cast<object>(field->class_()->staticTable()), field->offset(),
value); value);
} }
@ -2829,7 +2829,7 @@ setObjectFieldValueFromReference(MyThread* t, GcPair* pair, object instance,
ACQUIRE_FIELD_FOR_WRITE(t, field); ACQUIRE_FIELD_FOR_WRITE(t, field);
set(t, instance, field->offset(), value); setField(t, instance, field->offset(), value);
} }
void void
@ -6800,7 +6800,7 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
initArray(t, reinterpret_cast<GcArray*>(pool), context->objectPoolCount + 1); initArray(t, reinterpret_cast<GcArray*>(pool), context->objectPoolCount + 1);
mark(t, pool, 0); mark(t, pool, 0);
set(t, pool, ArrayBody, compileRoots(t)->objectPools()); setField(t, pool, ArrayBody, compileRoots(t)->objectPools());
compileRoots(t)->setObjectPools(t, pool); compileRoots(t)->setObjectPools(t, pool);
unsigned i = 1; unsigned i = 1;
@ -6809,7 +6809,7 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
p->address = reinterpret_cast<uintptr_t>(pool) + offset; p->address = reinterpret_cast<uintptr_t>(pool) + offset;
set(t, pool, offset, p->target); setField(t, pool, offset, p->target);
} }
} }
@ -8097,7 +8097,7 @@ invoke(Thread* thread, GcMethod* method, ArgumentList* arguments)
class SignalHandler: public SignalRegistrar::Handler { class SignalHandler: public SignalRegistrar::Handler {
public: public:
typedef GcThrowable*& (GcRoots::*ExceptionGetter)(); typedef GcThrowable* (GcRoots::*ExceptionGetter)();
SignalHandler(Gc::Type type, ExceptionGetter exc, unsigned fixedSize): SignalHandler(Gc::Type type, ExceptionGetter exc, unsigned fixedSize):
m(0), type(type), exc(exc), fixedSize(fixedSize) { } m(0), type(type), exc(exc), fixedSize(fixedSize) { }

View File

@ -844,7 +844,7 @@ interpret3(Thread* t, const int base)
if (LIKELY(index >= 0 and if (LIKELY(index >= 0 and
static_cast<uintptr_t>(index) < objectArrayLength(t, array))) static_cast<uintptr_t>(index) < objectArrayLength(t, array)))
{ {
set(t, array, ArrayBody + (index * BytesPerWord), value); setField(t, array, ArrayBody + (index * BytesPerWord), value);
} else { } else {
exception = makeThrowable exception = makeThrowable
(t, GcArrayIndexOutOfBoundsException::Type, "%d not in [0,%d)", (t, GcArrayIndexOutOfBoundsException::Type, "%d not in [0,%d)",
@ -2498,7 +2498,7 @@ interpret3(Thread* t, const int base)
object value = popObject(t); object value = popObject(t);
object o = popObject(t); object o = popObject(t);
if (LIKELY(o)) { if (LIKELY(o)) {
set(t, o, field->offset(), value); setField(t, o, field->offset(), value);
} else { } else {
exception = makeThrowable(t, GcNullPointerException::Type); exception = makeThrowable(t, GcNullPointerException::Type);
} }
@ -2560,7 +2560,7 @@ interpret3(Thread* t, const int base)
} break; } break;
case ObjectField: { case ObjectField: {
set(t, reinterpret_cast<object>(table), field->offset(), popObject(t)); setField(t, reinterpret_cast<object>(table), field->offset(), popObject(t));
} break; } break;
default: abort(t); default: abort(t);

View File

@ -396,8 +396,8 @@ throwNew(Thread* t, uintptr_t* arguments)
PROTECT(t, trace); PROTECT(t, trace);
t->exception = cast<GcThrowable>(t, make(t, (*c)->vmClass())); t->exception = cast<GcThrowable>(t, make(t, (*c)->vmClass()));
set(t, t->exception, ThrowableMessage, m); t->exception->setMessage(t, m);
set(t, reinterpret_cast<object>(t->exception), ThrowableTrace, trace); t->exception->setTrace(t, trace);
return 1; return 1;
} }
@ -551,7 +551,7 @@ methodID(Thread* t, GcMethod* method)
GcVector* v = vectorAppend( GcVector* v = vectorAppend(
t, roots(t)->jNIMethodTable(), reinterpret_cast<object>(method)); t, roots(t)->jNIMethodTable(), reinterpret_cast<object>(method));
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsJNIMethodTable, v); roots(t)->setJNIMethodTable(t, v);
storeStoreMemoryBarrier(); storeStoreMemoryBarrier();
@ -1505,7 +1505,7 @@ fieldID(Thread* t, GcField* field)
GcVector* v = vectorAppend( GcVector* v = vectorAppend(
t, roots(t)->jNIFieldTable(), reinterpret_cast<object>(field)); t, roots(t)->jNIFieldTable(), reinterpret_cast<object>(field));
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsJNIFieldTable, v); roots(t)->setJNIFieldTable(t, v);
storeStoreMemoryBarrier(); storeStoreMemoryBarrier();
@ -1758,7 +1758,7 @@ setObjectField(Thread* t, uintptr_t* arguments)
PROTECT(t, field); PROTECT(t, field);
ACQUIRE_FIELD_FOR_WRITE(t, field); ACQUIRE_FIELD_FOR_WRITE(t, field);
set(t, *o, field->offset(), (v ? *v : 0)); setField(t, *o, field->offset(), (v ? *v : 0));
return 1; return 1;
} }
@ -2229,7 +2229,7 @@ setStaticObjectField(Thread* t, uintptr_t* arguments)
PROTECT(t, field); PROTECT(t, field);
ACQUIRE_FIELD_FOR_WRITE(t, field); ACQUIRE_FIELD_FOR_WRITE(t, field);
set(t, reinterpret_cast<object>(c->vmClass()->staticTable()), field->offset(), setField(t, reinterpret_cast<object>(c->vmClass()->staticTable()), field->offset(),
(v ? *v : 0)); (v ? *v : 0));
return 1; return 1;
@ -2576,7 +2576,7 @@ newObjectArray(Thread* t, uintptr_t* arguments)
object a = makeObjectArray(t, (*class_)->vmClass(), length); object a = makeObjectArray(t, (*class_)->vmClass(), length);
object value = (init ? *init : 0); object value = (init ? *init : 0);
for (jsize i = 0; i < length; ++i) { for (jsize i = 0; i < length; ++i) {
set(t, reinterpret_cast<object>(a), ArrayBody + (i * BytesPerWord), value); 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, reinterpret_cast<object>(a)));
} }
@ -2605,7 +2605,7 @@ SetObjectArrayElement(Thread* t, jobjectArray array, jsize index,
{ {
ENTER(t, Thread::ActiveState); ENTER(t, Thread::ActiveState);
set(t, reinterpret_cast<object>(*array), ArrayBody + (index * BytesPerWord), (value ? *value : 0)); setField(t, reinterpret_cast<object>(*array), ArrayBody + (index * BytesPerWord), (value ? *value : 0));
} }
uint64_t uint64_t
@ -3541,23 +3541,23 @@ boot(Thread* t, uintptr_t*)
{ {
GcThrowable* throwable = makeThrowable(t, GcNullPointerException::Type); GcThrowable* throwable = makeThrowable(t, GcNullPointerException::Type);
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsNullPointerException, throwable); roots(t)->setNullPointerException(t, throwable);
throwable = makeThrowable(t, GcArithmeticException::Type); throwable = makeThrowable(t, GcArithmeticException::Type);
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsArithmeticException, throwable); roots(t)->setArithmeticException(t, throwable);
throwable = makeThrowable(t, GcArrayIndexOutOfBoundsException::Type); throwable = makeThrowable(t, GcArrayIndexOutOfBoundsException::Type);
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsArrayIndexOutOfBoundsException, throwable); roots(t)->setArrayIndexOutOfBoundsException(t, throwable);
throwable = makeThrowable(t, GcOutOfMemoryError::Type); throwable = makeThrowable(t, GcOutOfMemoryError::Type);
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsOutOfMemoryError, throwable); roots(t)->setOutOfMemoryError(t, throwable);
throwable = makeThrowable(t, GcThrowable::Type); throwable = makeThrowable(t, GcThrowable::Type);
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsShutdownInProgress, throwable); roots(t)->setShutdownInProgress(t, throwable);
t->m->classpath->preBoot(t); t->m->classpath->preBoot(t);
@ -3567,7 +3567,7 @@ boot(Thread* t, uintptr_t*)
GcThread* jthread = t->m->classpath->makeThread(t, t); GcThread* jthread = t->m->classpath->makeThread(t, t);
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsFinalizerThread, jthread); roots(t)->setFinalizerThread(t, jthread);
roots(t)->finalizerThread()->daemon() = true; roots(t)->finalizerThread()->daemon() = true;

View File

@ -1223,7 +1223,7 @@ getClassAddendum(Thread* t, GcClass* class_, GcSingleton* pool)
PROTECT(t, class_); PROTECT(t, class_);
addendum = makeClassAddendum(t, pool, 0, 0, 0, 0, -1, 0, 0); addendum = makeClassAddendum(t, pool, 0, 0, 0, 0, -1, 0, 0);
set(t, setField(t,
reinterpret_cast<object>(class_), reinterpret_cast<object>(class_),
ClassAddendum, ClassAddendum,
reinterpret_cast<object>(addendum)); reinterpret_cast<object>(addendum));
@ -2824,23 +2824,23 @@ boot(Thread* t)
#include "type-initializations.cpp" #include "type-initializations.cpp"
GcClass* arrayClass = type(t, GcArray::Type); GcClass* arrayClass = type(t, GcArray::Type);
set(t, m->types, 0, arrayClass); setField(t, m->types, 0, arrayClass);
GcClass* rootsClass = type(t, GcRoots::Type); GcClass* rootsClass = type(t, GcRoots::Type);
set(t, m->roots, 0, rootsClass); setField(t, m->roots, 0, rootsClass);
GcClass* loaderClass = type(t, GcSystemClassLoader::Type); GcClass* loaderClass = type(t, GcSystemClassLoader::Type);
set(t, roots(t)->bootLoader(), 0, loaderClass); setField(t, roots(t)->bootLoader(), 0, loaderClass);
set(t, roots(t)->appLoader(), 0, loaderClass); setField(t, roots(t)->appLoader(), 0, loaderClass);
GcClass* objectClass = type(t, GcJobject::Type); GcClass* objectClass = type(t, GcJobject::Type);
GcClass* classClass = type(t, GcClass::Type); GcClass* classClass = type(t, GcClass::Type);
set(t, classClass, 0, classClass); setField(t, classClass, 0, classClass);
classClass->setSuper(t, objectClass); classClass->setSuper(t, objectClass);
GcClass* intArrayClass = type(t, GcIntArray::Type); GcClass* intArrayClass = type(t, GcIntArray::Type);
set(t, intArrayClass, 0, classClass); setField(t, intArrayClass, 0, classClass);
intArrayClass->setSuper(t, objectClass); intArrayClass->setSuper(t, objectClass);
m->unsafe = false; m->unsafe = false;
@ -4810,19 +4810,19 @@ makeObjectArray(Thread* t, GcClass* elementClass, unsigned count)
} }
static GcByteArray* getFieldName(Thread* t, object obj) { static GcByteArray* getFieldName(Thread* t, object obj) {
return reinterpret_cast<GcByteArray*&>(cast<GcField>(t, obj)->name()); return reinterpret_cast<GcByteArray*>(cast<GcField>(t, obj)->name());
} }
static GcByteArray* getFieldSpec(Thread* t, object obj) { static GcByteArray* getFieldSpec(Thread* t, object obj) {
return reinterpret_cast<GcByteArray*&>(cast<GcField>(t, obj)->spec()); return reinterpret_cast<GcByteArray*>(cast<GcField>(t, obj)->spec());
} }
static GcByteArray* getMethodName(Thread* t, object obj) { static GcByteArray* getMethodName(Thread* t, object obj) {
return reinterpret_cast<GcByteArray*&>(cast<GcMethod>(t, obj)->name()); return reinterpret_cast<GcByteArray*>(cast<GcMethod>(t, obj)->name());
} }
static GcByteArray* getMethodSpec(Thread* t, object obj) { static GcByteArray* getMethodSpec(Thread* t, object obj) {
return reinterpret_cast<GcByteArray*&>(cast<GcMethod>(t, obj)->spec()); return reinterpret_cast<GcByteArray*>(cast<GcMethod>(t, obj)->spec());
} }
object object
@ -5400,7 +5400,7 @@ populateMultiArray(Thread* t, object array, int32_t* counts,
(counts[index + 1] * class_->arrayElementSize(), BytesPerWord)); (counts[index + 1] * class_->arrayElementSize(), BytesPerWord));
a->length() = counts[index + 1]; a->length() = counts[index + 1];
setObjectClass(t, reinterpret_cast<object>(a), class_); setObjectClass(t, reinterpret_cast<object>(a), class_);
set(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(a)); setField(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(a));
populateMultiArray(t, reinterpret_cast<object>(a), counts, index + 1, dimensions); populateMultiArray(t, reinterpret_cast<object>(a), counts, index + 1, dimensions);
} }

View File

@ -205,17 +205,17 @@ resolveNativeMethod(Thread* t, GcMethod* method, const char* prefix,
return 0; return 0;
} }
object GcNative*
resolveNativeMethod(Thread* t, GcMethod* method) resolveNativeMethod(Thread* t, GcMethod* method)
{ {
void* p = resolveNativeMethod(t, method, "Avian_", 6, 3); void* p = resolveNativeMethod(t, method, "Avian_", 6, 3);
if (p) { if (p) {
return reinterpret_cast<object>(makeNative(t, p, true)); return makeNative(t, p, true);
} }
p = resolveNativeMethod(t, method, "Java_", 5, -1); p = resolveNativeMethod(t, method, "Java_", 5, -1);
if (p) { if (p) {
return reinterpret_cast<object>(makeNative(t, p, false)); return makeNative(t, p, false);
} }
return 0; return 0;
@ -235,7 +235,7 @@ resolveNative(Thread* t, GcMethod* method)
initClass(t, method->class_()); initClass(t, method->class_());
if (getMethodRuntimeData(t, method)->native() == 0) { if (getMethodRuntimeData(t, method)->native() == 0) {
object native = resolveNativeMethod(t, method); GcNative* native = resolveNativeMethod(t, method);
if (UNLIKELY(native == 0)) { if (UNLIKELY(native == 0)) {
throwNew(t, GcUnsatisfiedLinkError::Type, "%s.%s%s", throwNew(t, GcUnsatisfiedLinkError::Type, "%s.%s%s",
method->class_()->name()->body().begin(), method->class_()->name()->body().begin(),
@ -251,7 +251,7 @@ resolveNative(Thread* t, GcMethod* method)
// populated once the object it points to has been populated: // populated once the object it points to has been populated:
storeStoreMemoryBarrier(); storeStoreMemoryBarrier();
set(t, reinterpret_cast<object>(runtimeData), MethodRuntimeDataNative, native); runtimeData->setNative(t, native);
} }
} }

View File

@ -659,8 +659,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
o = reinterpret_cast<object>(resolveClass o = reinterpret_cast<object>(resolveClass
(t, roots(t)->bootLoader(), cast<GcReference>(t, o)->name())); (t, roots(t)->bootLoader(), cast<GcReference>(t, o)->name()));
set(t, reinterpret_cast<object>(addendum->pool()), addendum->pool()->setBodyElement(t, index, reinterpret_cast<uintptr_t>(o));
SingletonBody + (index * BytesPerWord), o);
} }
} }
} }
@ -1290,7 +1289,7 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
{ {
GcThrowable* throwable = cast<GcThrowable>(t, make(t, type(t, GcOutOfMemoryError::Type))); GcThrowable* throwable = cast<GcThrowable>(t, make(t, type(t, GcOutOfMemoryError::Type)));
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsOutOfMemoryError, throwable); roots(t)->setOutOfMemoryError(t, throwable);
Zone zone(t->m->system, t->m->heap, 64 * 1024); Zone zone(t->m->system, t->m->heap, 64 * 1024);
@ -1332,7 +1331,7 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
{ classPoolMap = makeHashMap(t, 0, 0); { classPoolMap = makeHashMap(t, 0, 0);
PROTECT(t, classPoolMap); PROTECT(t, classPoolMap);
set(t, roots(t), RootsPoolMap, classPoolMap); roots(t)->setPoolMap(t, classPoolMap);
typeMaps = makeHashMap(t, 0, 0); typeMaps = makeHashMap(t, 0, 0);
PROTECT(t, typeMaps); PROTECT(t, typeMaps);
@ -1494,40 +1493,49 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
// these roots will not be used when the bootimage is loaded, so // these roots will not be used when the bootimage is loaded, so
// there's no need to preserve them: // there's no need to preserve them:
set(t, roots(t), RootsPoolMap, 0); roots(t)->setPoolMap(t, 0);
GcWeakHashMap* map = makeWeakHashMap(t, 0, 0); GcWeakHashMap* map = makeWeakHashMap(t, 0, 0);
// sequence point, for gc (don't recombine statements) // sequence point, for gc (don't recombine statements)
set(t, roots(t), RootsByteArrayMap, map); roots(t)->setByteArrayMap(t, map->as<GcHashMap>(t));
// name all primitive classes so we don't try to update immutable // name all primitive classes so we don't try to update immutable
// references at runtime: // references at runtime:
{ object name = reinterpret_cast<object>(makeByteArray(t, "void")); { GcByteArray* name = makeByteArray(t, "void");
set(t, reinterpret_cast<object>(type(t, GcJvoid::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJvoid::Type)->setName(t, name);
name = reinterpret_cast<object>(makeByteArray(t, "boolean")); name = makeByteArray(t, "boolean");
set(t, reinterpret_cast<object>(type(t, GcJboolean::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJboolean::Type)->setName(t, name);
name = reinterpret_cast<object>(makeByteArray(t, "byte")); name = makeByteArray(t, "byte");
set(t, reinterpret_cast<object>(type(t, GcJbyte::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJbyte::Type)->setName(t, name);
name = reinterpret_cast<object>(makeByteArray(t, "short")); name = makeByteArray(t, "short");
set(t, reinterpret_cast<object>(type(t, GcJshort::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJshort::Type)->setName(t, name);
name = reinterpret_cast<object>(makeByteArray(t, "char")); name = makeByteArray(t, "char");
set(t, reinterpret_cast<object>(type(t, GcJchar::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJchar::Type)->setName(t, name);
name = reinterpret_cast<object>(makeByteArray(t, "int")); name = makeByteArray(t, "int");
set(t, reinterpret_cast<object>(type(t, GcJint::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJint::Type)->setName(t, name);
name = reinterpret_cast<object>(makeByteArray(t, "float")); name = makeByteArray(t, "float");
set(t, reinterpret_cast<object>(type(t, GcJfloat::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJfloat::Type)->setName(t, name);
name = reinterpret_cast<object>(makeByteArray(t, "long")); name = makeByteArray(t, "long");
set(t, reinterpret_cast<object>(type(t, GcJlong::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJlong::Type)->setName(t, name);
name = reinterpret_cast<object>(makeByteArray(t, "double")); name = makeByteArray(t, "double");
set(t, reinterpret_cast<object>(type(t, GcJdouble::Type)), ClassName, name); // sequence point, for gc (don't recombine statements)
type(t, GcJdouble::Type)->setName(t, name);
} }
// resolve primitive array classes in case they are needed at // resolve primitive array classes in case they are needed at

View File

@ -1024,7 +1024,7 @@ void writeClassAccessors(Output* out, Module& module, Class* cl)
out->write(cppFieldType(module, f)); out->write(cppFieldType(module, f));
out->write(" value) { "); out->write(" value) { ");
if(isFieldGcMarkable(module, f)) { if(isFieldGcMarkable(module, f)) {
out->write("set(t, reinterpret_cast<object>(this), "); out->write("setField(t, reinterpret_cast<object>(this), ");
out->write(capitalize(cl->name)); out->write(capitalize(cl->name));
out->write(capitalize(f.name)); out->write(capitalize(f.name));
out->write(", reinterpret_cast<object>(value));"); out->write(", reinterpret_cast<object>(value));");
@ -1052,7 +1052,7 @@ void writeClassAccessors(Output* out, Module& module, Class* cl)
out->write(" "); out->write(" ");
out->write(cppFieldType(module, f)); out->write(cppFieldType(module, f));
if(!f.polyfill) { if(!f.polyfill && !isFieldGcMarkable(module, f)) {
out->write("&"); out->write("&");
} }
out->write(" "); out->write(" ");
@ -1076,21 +1076,21 @@ void writeClassAccessors(Output* out, Module& module, Class* cl)
if(cl->arrayField) { if(cl->arrayField) {
Field& f = *cl->arrayField; Field& f = *cl->arrayField;
out->write(" avian::util::Slice<"); out->write(" avian::util::Slice<");
// if(f.typeName != "maybe_object" && isFieldGcMarkable(module, f)) { if(isFieldGcVisible(module, f)) {
// out->write("const "); out->write("const ");
// } }
out->write(cppFieldType(module, f)); out->write(cppFieldType(module, f));
out->write("> "); out->write("> ");
out->write(obfuscate(f.name)); out->write(obfuscate(f.name));
out->write("() { return avian::util::Slice<"); out->write("() { return avian::util::Slice<");
// if(f.typeName != "maybe_object" && isFieldGcMarkable(module, f)) { if(isFieldGcVisible(module, f)) {
// out->write("const "); out->write("const ");
// } }
out->write(cppFieldType(module, f)); out->write(cppFieldType(module, f));
out->write("> (&field_at<"); out->write("> (&field_at<");
// if(f.typeName != "maybe_object" && isFieldGcMarkable(module, f)) { if(isFieldGcVisible(module, f)) {
// out->write("const "); out->write("const ");
// } }
out->write(cppFieldType(module, f)); out->write(cppFieldType(module, f));
out->write(">("); out->write(">(");
out->write(capitalize(cl->name)); out->write(capitalize(cl->name));
@ -1105,7 +1105,7 @@ void writeClassAccessors(Output* out, Module& module, Class* cl)
out->write(cppFieldType(module, f)); out->write(cppFieldType(module, f));
out->write(" value) { "); out->write(" value) { ");
if(isFieldGcMarkable(module, f)) { if(isFieldGcMarkable(module, f)) {
out->write("set(t, reinterpret_cast<object>(this), "); out->write("setField(t, reinterpret_cast<object>(this), ");
out->write(capitalize(cl->name)); out->write(capitalize(cl->name));
out->write(capitalize(f.name)); out->write(capitalize(f.name));
out->write(" + index * ("); out->write(" + index * (");