generate better typed accessors from type-generator (and switch to using standard library there)

This commit is contained in:
Joshua Warner 2014-06-20 22:16:33 -06:00 committed by Joshua Warner
parent 263e349cae
commit 9b36dca846
17 changed files with 1198 additions and 1701 deletions

View File

@ -443,6 +443,7 @@ asm-format = S
as = $(cc)
ld = $(cc)
build-ld = $(build-cc)
build-ld-cpp = $(build-cxx)
default-remote-test-host = localhost
default-remote-test-port = 22
@ -1984,7 +1985,7 @@ endif
$(generator): $(generator-objects) $(generator-lzma-objects)
@echo "linking $(@)"
$(build-ld) $(^) $(build-lflags) -o $(@)
$(build-ld-cpp) $(^) $(build-lflags) -o $(@)
$(openjdk-objects): $(build)/openjdk/%-openjdk.o: $(openjdk-src)/%.c \
$(openjdk-headers-dep)

View File

@ -31,9 +31,9 @@ getTrace(Thread* t, unsigned skipCount)
if (skipCount == 0) {
GcMethod* method = walker->method();
if (isAssignableFrom
(t, type(t, GcThrowable::Type), cast<GcClass>(t, method->class_()))
(t, type(t, GcThrowable::Type), method->class_())
and vm::strcmp(reinterpret_cast<const int8_t*>("<init>"),
&byteArrayBody(t, method->name(), 0))
method->name()->body().begin())
== 0)
{
return true;
@ -266,7 +266,7 @@ clone(Thread* t, object o)
reinterpret_cast<void**>(o) + 1,
size - BytesPerWord);
} else {
object classNameSlash = objectClass(t, o)->name();
object classNameSlash = reinterpret_cast<object>(objectClass(t, o)->name());
THREAD_RUNTIME_ARRAY(t, char, classNameDot, byteArrayLength(t, classNameSlash));
replace('/', '.', RUNTIME_ARRAY_BODY(classNameDot),
reinterpret_cast<char*>(&byteArrayBody(t, classNameSlash, 0)));
@ -285,7 +285,7 @@ makeStackTraceElement(Thread* t, object e)
GcMethod* method = cast<GcMethod>(t, traceElementMethod(t, e));
PROTECT(t, method);
object class_name = className(t, method->class_());
object class_name = reinterpret_cast<object>(method->class_()->name());
PROTECT(t, class_name);
THREAD_RUNTIME_ARRAY(t, char, s, byteArrayLength(t, class_name));
@ -293,7 +293,7 @@ makeStackTraceElement(Thread* t, object e)
reinterpret_cast<char*>(&byteArrayBody(t, class_name, 0)));
class_name = makeString(t, "%s", RUNTIME_ARRAY_BODY(s));
object method_name = method->name();
object method_name = reinterpret_cast<object>(method->name());
PROTECT(t, method_name);
method_name = t->m->classpath->makeString
@ -302,11 +302,11 @@ makeStackTraceElement(Thread* t, object e)
unsigned line = t->m->processor->lineNumber
(t, method, traceElementIp(t, e));
object file = classSourceFile(t, method->class_());
object file = reinterpret_cast<object>(method->class_()->sourceFile());
file = file ? t->m->classpath->makeString
(t, file, 0, byteArrayLength(t, file) - 1) : 0;
return reinterpret_cast<object>(makeStackTraceElement(t, class_name, method_name, file, line));
return reinterpret_cast<object>(makeStackTraceElement(t, cast<GcString>(t, class_name), cast<GcString>(t, method_name), cast<GcString>(t, file), line));
}
object
@ -366,7 +366,7 @@ resolveClassBySpec(Thread* t, object loader, const char* spec,
}
}
object
GcJclass*
resolveJType(Thread* t, object loader, const char* spec, unsigned specLength)
{
return getJClass(t, resolveClassBySpec(t, loader, spec, specLength));
@ -452,7 +452,7 @@ resolveParameterJTypes(Thread* t, object loader, object spec,
PROTECT(t, array);
for (int i = *parameterCount - 1; i >= 0; --i) {
object c = getJClass(t, cast<GcClass>(t, pairFirst(t, list)));
object c = reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, pairFirst(t, list))));
set(t, array, ArrayBody + (i * BytesPerWord), c);
list = pairSecond(t, list);
}
@ -490,7 +490,7 @@ resolveExceptionJTypes(Thread* t, object loader, object addendum)
o);
}
o = getJClass(t, cast<GcClass>(t, o));
o = reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, o)));
set(t, array, ArrayBody + (i * BytesPerWord), o);
}
@ -516,10 +516,10 @@ invoke(Thread* t, GcMethod* method, object instance, object args)
}
if (method->parameterCount()) {
unsigned specLength = byteArrayLength(t, method->spec());
unsigned specLength = method->spec()->length();
THREAD_RUNTIME_ARRAY(t, char, spec, specLength);
memcpy(RUNTIME_ARRAY_BODY(spec),
&byteArrayBody(t, method->spec(), 0), specLength);
method->spec()->body().begin(), specLength);
unsigned i = 0;
for (MethodSpecIterator it(t, RUNTIME_ARRAY_BODY(spec)); it.hasNext();) {
GcClass* type;
@ -549,7 +549,7 @@ invoke(Thread* t, GcMethod* method, object instance, object args)
memcpy(RUNTIME_ARRAY_BODY(name), p, nameLength - 1);
RUNTIME_ARRAY_BODY(name)[nameLength - 1] = 0;
type = resolveClass
(t, classLoader(t, method->class_()),
(t, reinterpret_cast<object>(method->class_()->loader()),
RUNTIME_ARRAY_BODY(name));
} break;
@ -568,7 +568,7 @@ invoke(Thread* t, GcMethod* method, object instance, object args)
}
}
initClass(t, cast<GcClass>(t, method->class_()));
initClass(t, method->class_());
unsigned returnCode = method->returnCode();
@ -706,12 +706,12 @@ getDeclaredClasses(Thread* t, object c, bool publicOnly)
and ((not publicOnly)
or (innerClassReferenceFlags(t, reference) & ACC_PUBLIC)))
{
object inner = getJClass(
object inner = reinterpret_cast<object>(getJClass(
t,
resolveClass(
t,
classLoader(t, c),
innerClassReferenceInner(t, arrayBody(t, table, i))));
innerClassReferenceInner(t, arrayBody(t, table, i)))));
-- count;
set(t, result, ArrayBody + (count * BytesPerWord), inner);
@ -725,7 +725,7 @@ getDeclaredClasses(Thread* t, object c, bool publicOnly)
return makeObjectArray(t, type(t, GcJclass::Type), 0);
}
object
GcJclass*
getDeclaringClass(Thread* t, object c)
{
object addendum = classAddendum(t, c);

View File

@ -1207,6 +1207,7 @@ class GcObject {
};
class GcFinalizer;
class GcClassLoader;
class Machine {
public:
@ -1447,7 +1448,7 @@ class Thread {
class LibraryLoadStack: public AutoResource {
public:
LibraryLoadStack(Thread* t, object classLoader)
LibraryLoadStack(Thread* t, GcClassLoader* classLoader)
: AutoResource(t),
next(t->libraryLoadStack),
classLoader(classLoader),
@ -1465,7 +1466,7 @@ class Thread {
}
LibraryLoadStack* next;
object classLoader;
GcClassLoader* classLoader;
SingleProtector protector;
};
@ -1634,7 +1635,7 @@ class Classpath {
canTailCall(Thread* t, GcMethod* caller, object calleeClassName,
object calleeMethodName, object calleeMethodSpec) = 0;
virtual object libraryClassLoader(Thread* t, GcMethod* caller) = 0;
virtual GcClassLoader* libraryClassLoader(Thread* t, GcMethod* caller) = 0;
virtual void
shutDown(Thread* t) = 0;
@ -1985,6 +1986,12 @@ T* cast(Thread* t UNUSED, object o)
#include "type-declarations.cpp"
inline object&
arrayBodyUnsafe(Thread*, object a, unsigned index)
{
return reinterpret_cast<GcArray*>(a)->body()[index];
}
inline uint64_t
runRaw(Thread* t,
uint64_t (*function)(Thread*, uintptr_t*), uintptr_t* arguments)
@ -2433,7 +2440,7 @@ inline uint32_t
stringHash(Thread* t, object s)
{
if (stringHashCode(t, s) == 0 and stringLength(t, s)) {
object data = stringData(t, s);
object data = reinterpret_cast<object>(stringData(t, s));
if (objectClass(t, data) == type(t, GcByteArray::Type)) {
stringHashCode(t, s) = hash
(&byteArrayBody(t, data, stringOffset(t, s)), stringLength(t, s));
@ -2448,7 +2455,7 @@ stringHash(Thread* t, object s)
inline uint16_t
stringCharAt(Thread* t, object s, int i)
{
object data = stringData(t, s);
object data = reinterpret_cast<object>(stringData(t, s));
if (objectClass(t, data) == type(t, GcByteArray::Type)) {
return byteArrayBody(t, data, stringOffset(t, s) + i);
} else {
@ -2477,8 +2484,8 @@ inline uint32_t
methodHash(Thread* t, object mo)
{
GcMethod* method = cast<GcMethod>(t, mo);
return byteArrayHash(t, method->name())
^ byteArrayHash(t, method->spec());
return byteArrayHash(t, reinterpret_cast<object>(method->name()))
^ byteArrayHash(t, reinterpret_cast<object>(method->spec()));
}
inline bool
@ -2487,8 +2494,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, a->name(), b->name()) and
byteArrayEqual(t, a->spec(), b->spec()));
(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())));
}
class MethodSpecIterator {
@ -2865,7 +2872,7 @@ findInHierarchy(Thread* t, GcClass* class_, object name, object spec,
throwNew(t, errorType, "%s %s not found in %s",
&byteArrayBody(t, name, 0),
&byteArrayBody(t, spec, 0),
&byteArrayBody(t, class_->name(), 0));
class_->name()->body().begin());
}
return o;
@ -2899,10 +2906,10 @@ findInterfaceMethod(Thread* t, GcMethod* method, GcClass* class_)
{
assertT(t, (class_->vmFlags() & BootstrapFlag) == 0);
object interface = method->class_();
GcClass* interface = method->class_();
object itable = class_->interfaceTable();
for (unsigned i = 0; i < arrayLength(t, itable); i += 2) {
if (arrayBody(t, itable, i) == interface) {
if (arrayBody(t, itable, i) == reinterpret_cast<object>(interface)) {
return cast<GcMethod>(t, arrayBody
(t, arrayBody(t, itable, i + 1), method->offset()));
}
@ -2923,7 +2930,7 @@ objectArrayBody(Thread* t UNUSED, object array, unsigned index)
{
assertT(t, objectClass(t, array)->fixedSize() == BytesPerWord * 2);
assertT(t, objectClass(t, array)->arrayElementSize() == BytesPerWord);
assertT(t, objectClass(t, array)->objectMask()
assertT(t, reinterpret_cast<object>(objectClass(t, array)->objectMask())
== classObjectMask(t, arrayBody
(t, t->m->types, GcArray::Type)));
return fieldAtOffset<object>(array, ArrayBody + (index * BytesPerWord));
@ -3462,10 +3469,10 @@ disposeLocalReference(Thread* t, jobject r)
}
inline bool
methodVirtual(Thread* t, GcMethod* method)
methodVirtual(Thread* t UNUSED, GcMethod* method)
{
return (method->flags() & (ACC_STATIC | ACC_PRIVATE)) == 0
and byteArrayBody(t, method->name(), 0) != '<';
and method->name()->body()[0] != '<';
}
inline unsigned
@ -3644,7 +3651,7 @@ inline GcClass*
resolveClassInPool(Thread* t, GcMethod* method, unsigned index,
bool throw_ = true)
{
return resolveClassInPool(t, classLoader(t, method->class_()),
return resolveClassInPool(t, reinterpret_cast<object>(method->class_()->loader()),
method, index, throw_);
}
@ -3696,7 +3703,7 @@ inline object
resolveField(Thread* t, GcMethod* method, unsigned index, bool throw_ = true)
{
return resolveField
(t, classLoader(t, method->class_()), method, index, throw_);
(t, reinterpret_cast<object>(method->class_()->loader()), method, index, throw_);
}
inline void
@ -3798,7 +3805,7 @@ inline GcMethod*
resolveMethod(Thread* t, GcMethod* method, unsigned index, bool throw_ = true)
{
return resolveMethod
(t, classLoader(t, method->class_()), method, index, throw_);
(t, reinterpret_cast<object>(method->class_()->loader()), method, index, throw_);
}
object
@ -3867,25 +3874,25 @@ getMethodRuntimeData(Thread* t, GcMethod* method)
method->runtimeDataIndex() - 1);
}
inline object
inline GcJclass*
getJClass(Thread* t, GcClass* c)
{
PROTECT(t, c);
object jclass = classRuntimeDataJclass(t, getClassRuntimeData(t, c));
GcJclass* jclass = cast<GcJclass>(t, classRuntimeDataJclass(t, getClassRuntimeData(t, c)));
loadMemoryBarrier();
if (jclass == 0) {
ACQUIRE(t, t->m->classLock);
jclass = classRuntimeDataJclass(t, getClassRuntimeData(t, c));
jclass = cast<GcJclass>(t, classRuntimeDataJclass(t, getClassRuntimeData(t, c)));
if (jclass == 0) {
jclass = t->m->classpath->makeJclass(t, c);
jclass = cast<GcJclass>(t, t->m->classpath->makeJclass(t, c));
storeStoreMemoryBarrier();
set(t, getClassRuntimeData(t, c), ClassRuntimeDataJclass, jclass);
set(t, getClassRuntimeData(t, c), ClassRuntimeDataJclass, reinterpret_cast<object>(jclass));
}
}

View File

@ -37,9 +37,9 @@ codeReadInt32(Thread* t, object code, unsigned& ip)
}
inline bool
isSuperclass(Thread* t, GcClass* class_, GcClass* base)
isSuperclass(Thread* t UNUSED, GcClass* class_, GcClass* base)
{
for (GcClass* oc = cast<GcClass>(t, base->super()); oc; oc = cast<GcClass>(t, oc->super())) {
for (GcClass* oc = base->super(); oc; oc = oc->super()) {
if (oc == class_) {
return true;
}
@ -52,8 +52,8 @@ isSpecialMethod(Thread* t, GcMethod* method, GcClass* class_)
{
return (class_->flags() & ACC_SUPER)
and strcmp(reinterpret_cast<const int8_t*>("<init>"),
&byteArrayBody(t, method->name(), 0)) != 0
and isSuperclass(t, cast<GcClass>(t, method->class_()), class_);
method->name()->body().begin()) != 0
and isSuperclass(t, method->class_(), class_);
}
void

View File

@ -51,7 +51,7 @@ resolveSystemClassThrow(Thread* t, object loader, object spec)
object
fieldForOffsetInClass(Thread* t, GcClass* c, unsigned offset)
{
GcClass* super = cast<GcClass>(t, c->super());
GcClass* super = c->super();
if (super) {
object field = fieldForOffsetInClass(t, super, offset);
if (field) {

View File

@ -55,7 +55,8 @@ loadLibrary(Thread* t, object, uintptr_t* arguments)
{
object name = reinterpret_cast<object>(arguments[1]);
Thread::LibraryLoadStack stack(t, reinterpret_cast<object>(arguments[2]));
Thread::LibraryLoadStack stack(
t, cast<GcClassLoader>(t, reinterpret_cast<object>(arguments[2])));
unsigned length = stringLength(t, name);
THREAD_RUNTIME_ARRAY(t, char, n, length + 1);
@ -106,12 +107,12 @@ void JNICALL
closeMemoryMappedFile(Thread*, GcMethod*, uintptr_t*);
object
makeMethodOrConstructor(Thread* t, object c, unsigned index)
makeMethodOrConstructor(Thread* t, GcJclass* c, unsigned index)
{
PROTECT(t, c);
object method = arrayBody
(t, classMethodTable(t, jclassVmClass(t, c)), index);
(t, classMethodTable(t, c->vmClass()), index);
PROTECT(t, method);
unsigned parameterCount;
@ -121,7 +122,7 @@ makeMethodOrConstructor(Thread* t, object c, unsigned index)
&parameterCount, &returnTypeSpec);
PROTECT(t, parameterTypes);
object returnType = resolveJType
GcJclass* returnType = resolveJType
(t, classLoader(t, methodClass(t, method)), reinterpret_cast<char*>
(&byteArrayBody(t, methodSpec(t, method), returnTypeSpec)),
byteArrayLength(t, methodSpec(t, method)) - 1 - returnTypeSpec);
@ -136,9 +137,9 @@ makeMethodOrConstructor(Thread* t, object c, unsigned index)
} else {
PROTECT(t, exceptionTypes);
object name = t->m->classpath->makeString
GcString* name = cast<GcString>(t, t->m->classpath->makeString
(t, methodName(t, method), 0,
byteArrayLength(t, methodName(t, method)) - 1);
byteArrayLength(t, methodName(t, method)) - 1));
return reinterpret_cast<object>(makeJmethod
(t, 0, index, c, name, parameterTypes, exceptionTypes, returnType, 0, 0,
@ -147,16 +148,16 @@ makeMethodOrConstructor(Thread* t, object c, unsigned index)
}
object
makeField(Thread* t, object c, unsigned index)
makeField(Thread* t, GcJclass* c, unsigned index)
{
PROTECT(t, c);
object field = arrayBody
(t, classFieldTable(t, jclassVmClass(t, c)), index);
(t, classFieldTable(t, c->vmClass()), index);
PROTECT(t, field);
object type = getJClass
GcJclass* type = getJClass
(t, resolveClassBySpec
(t, classLoader(t, fieldClass(t, field)),
reinterpret_cast<char*>
@ -164,9 +165,9 @@ makeField(Thread* t, object c, unsigned index)
byteArrayLength(t, fieldSpec(t, field)) - 1));
PROTECT(t, type);
object name = t->m->classpath->makeString
GcString* name = cast<GcString>(t, t->m->classpath->makeString
(t, fieldName(t, field), 0,
byteArrayLength(t, fieldName(t, field)) - 1);
byteArrayLength(t, fieldName(t, field)) - 1));
return reinterpret_cast<object>(makeJfield(t, 0, c, type, 0, 0, name, index));
}
@ -279,7 +280,7 @@ class MyClasspath : public Classpath {
} else {
resolveSystemClass
(t, root(t, Machine::BootLoader),
type(t, GcThreadGroup::Type)->name(), false);
reinterpret_cast<object>(type(t, GcThreadGroup::Type)->name()), false);
group = makeNew(t, type(t, GcThreadGroup::Type));
@ -291,7 +292,7 @@ class MyClasspath : public Classpath {
resolveSystemClass
(t, root(t, Machine::BootLoader),
type(t, GcThread::Type)->name(), false);
reinterpret_cast<object>(type(t, GcThread::Type)->name()), false);
object thread = makeNew(t, type(t, GcThread::Type));
PROTECT(t, thread);
@ -313,11 +314,11 @@ class MyClasspath : public Classpath {
virtual object
makeJMethod(Thread* t, GcMethod* vmMethod)
{
object table = classMethodTable(t, vmMethod->class_());
object table = vmMethod->class_()->methodTable();
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
if (reinterpret_cast<object>(vmMethod) == arrayBody(t, table, i)) {
return makeMethodOrConstructor
(t, getJClass(t, cast<GcClass>(t, vmMethod->class_())), i);
(t, getJClass(t, vmMethod->class_()), i);
}
}
abort(t);
@ -570,15 +571,15 @@ class MyClasspath : public Classpath {
return true;
}
virtual object libraryClassLoader(Thread* t, GcMethod* caller)
virtual GcClassLoader* libraryClassLoader(Thread* t, GcMethod* caller)
{
return strcmp(
"java/lang/Runtime",
reinterpret_cast<char*>(
&byteArrayBody(t, className(t, caller->class_()), 0)))
caller->class_()->name()->body().begin()))
== 0
? t->libraryLoadStack->classLoader
: classLoader(t, caller->class_());
: caller->class_()->loader();
}
virtual void
@ -1088,9 +1089,9 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_java_lang_Class_getInterfaces
(Thread* t, object, uintptr_t* arguments)
{
object c = reinterpret_cast<object>(arguments[0]);
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
object addendum = classAddendum(t, jclassVmClass(t, c));
object addendum = classAddendum(t, c->vmClass());
if (addendum) {
object table = classAddendumInterfaceTable(t, addendum);
if (table) {
@ -1100,8 +1101,8 @@ Avian_java_lang_Class_getInterfaces
PROTECT(t, array);
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
object c = getJClass(t, cast<GcClass>(t, arrayBody(t, table, i)));
set(t, array, ArrayBody + (i * BytesPerWord), c);
GcJclass* c = getJClass(t, cast<GcClass>(t, arrayBody(t, table, i)));
set(t, array, ArrayBody + (i * BytesPerWord), reinterpret_cast<object>(c));
}
return reinterpret_cast<uintptr_t>(array);
@ -1144,8 +1145,8 @@ Avian_java_lang_Class_getEnclosingMethod
if (enclosingClass) {
PROTECT(t, enclosingClass);
enclosingClass = getJClass
(t, resolveClass(t, classLoader(t, c), enclosingClass));
// enclosingClass = getJClass
// (t, resolveClass(t, classLoader(t, c), enclosingClass));
object enclosingMethod = classAddendumEnclosingMethod(t, addendum);
if (enclosingMethod) {
@ -1196,16 +1197,16 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_java_lang_Class_getComponentType
(Thread* t, object, uintptr_t* arguments)
{
object c = reinterpret_cast<object>(arguments[0]);
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
if (classArrayDimensions(t, jclassVmClass(t, c))) {
uint8_t n = byteArrayBody(t, className(t, jclassVmClass(t, c)), 1);
if (classArrayDimensions(t, c->vmClass())) {
uint8_t n = byteArrayBody(t, className(t, c->vmClass()), 1);
if (n != 'L' and n != '[') {
return reinterpret_cast<uintptr_t>
(getJClass(t, primitiveClass(t, n)));
} else {
return reinterpret_cast<uintptr_t>
(getJClass(t, cast<GcClass>(t, classStaticTable(t, jclassVmClass(t, c)))));
(getJClass(t, cast<GcClass>(t, classStaticTable(t, c->vmClass()))));
}
} else {
return 0;
@ -1235,7 +1236,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_java_lang_Class_getDeclaredField
(Thread* t, object, uintptr_t* arguments)
{
object c = reinterpret_cast<object>(arguments[0]);
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
PROTECT(t, c);
object name = reinterpret_cast<object>(arguments[1]);
@ -1247,7 +1248,7 @@ Avian_java_lang_Class_getDeclaredField
int index = intValue
(t, t->m->processor->invoke
(t, method, 0, jclassVmClass(t, c), name));
(t, method, 0, c->vmClass(), name));
if (index >= 0) {
return reinterpret_cast<uintptr_t>(local::makeField(t, c, index));
@ -1260,7 +1261,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_java_lang_Class_getDeclaredConstructorOrMethod
(Thread* t, object, uintptr_t* arguments)
{
object c = reinterpret_cast<object>(arguments[0]);
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
PROTECT(t, c);
object name = reinterpret_cast<object>(arguments[1]);
@ -1275,7 +1276,7 @@ Avian_java_lang_Class_getDeclaredConstructorOrMethod
int index = intValue
(t, t->m->processor->invoke
(t, method, 0, jclassVmClass(t, c), name, parameterTypes));
(t, method, 0, c->vmClass(), name, parameterTypes));
if (index >= 0) {
return reinterpret_cast<uintptr_t>
@ -1520,13 +1521,13 @@ Avian_dalvik_system_VMStack_getCallingClassLoader
if (counter--) {
return true;
} else {
this->loader = classLoader(t, walker->method()->class_());
this->loader = walker->method()->class_()->loader();
return false;
}
}
Thread* t;
object loader;
GcClassLoader* loader;
unsigned counter;
} v(t);
@ -1554,11 +1555,11 @@ Avian_dalvik_system_VMStack_getClasses
(t, type(t, GcJclass::Type), walker->count());
}
object c = getJClass(t, cast<GcClass>(t, walker->method()->class_()));
GcJclass* c = getJClass(t, walker->method()->class_());
assertT(t, counter - 2 < objectArrayLength(t, array));
set(t, array, ArrayBody + ((counter - 2) * BytesPerWord), c);
set(t, array, ArrayBody + ((counter - 2) * BytesPerWord), reinterpret_cast<object>(c));
return true;
}
@ -1828,7 +1829,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_java_lang_Class_getDeclaredMethods
(Thread* t, object, uintptr_t* arguments)
{
object c = reinterpret_cast<object>(arguments[0]);
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
PROTECT(t, c);
bool publicOnly = arguments[1];
@ -1838,14 +1839,14 @@ Avian_java_lang_Class_getDeclaredMethods
"(Lavian/VMClass;Z)[Ljava/lang/reflect/Method;");
return reinterpret_cast<uintptr_t>
(t->m->processor->invoke(t, get, 0, jclassVmClass(t, c), publicOnly));
(t->m->processor->invoke(t, get, 0, c->vmClass(), publicOnly));
}
extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_java_lang_Class_getDeclaredFields
(Thread* t, object, uintptr_t* arguments)
{
object c = reinterpret_cast<object>(arguments[0]);
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
PROTECT(t, c);
bool publicOnly = arguments[1];
@ -1855,7 +1856,7 @@ Avian_java_lang_Class_getDeclaredFields
"(Lavian/VMClass;Z)[Ljava/lang/reflect/Field;");
return reinterpret_cast<uintptr_t>
(t->m->processor->invoke(t, get, 0, jclassVmClass(t, c), publicOnly));
(t->m->processor->invoke(t, get, 0, c->vmClass(), publicOnly));
}
extern "C" AVIAN_EXPORT int64_t JNICALL
@ -2282,7 +2283,7 @@ Avian_avian_Classes_makeMethod
{
return reinterpret_cast<uintptr_t>
(local::makeMethodOrConstructor
(t, reinterpret_cast<object>(arguments[0]), arguments[1]));
(t, cast<GcJclass>(t, reinterpret_cast<object>(arguments[0])), arguments[1]));
}
extern "C" AVIAN_EXPORT int64_t JNICALL
@ -2291,7 +2292,7 @@ Avian_avian_Classes_makeField
{
return reinterpret_cast<uintptr_t>
(local::makeField
(t, reinterpret_cast<object>(arguments[0]), arguments[1]));
(t, cast<GcJclass>(t, reinterpret_cast<object>(arguments[0])), arguments[1]));
}
extern "C" AVIAN_EXPORT int64_t JNICALL

View File

@ -29,7 +29,7 @@ class MyClasspath : public Classpath {
virtual object
makeJclass(Thread* t, GcClass* class_)
{
return reinterpret_cast<object>(vm::makeJclass(t, reinterpret_cast<object>(class_)));
return reinterpret_cast<object>(vm::makeJclass(t, class_));
}
virtual object
@ -53,7 +53,7 @@ class MyClasspath : public Classpath {
return reinterpret_cast<object>(vm::makeThread
(t, 0, 0, 0, 0, 0, NewState, NormalPriority, 0, 0, 0,
root(t, Machine::AppLoader), 0, 0, group, 0));
cast<GcClassLoader>(t, root(t, Machine::AppLoader)), 0, 0, cast<GcThreadGroup>(t, group), 0));
}
virtual object
@ -61,10 +61,10 @@ class MyClasspath : public Classpath {
{
PROTECT(t, vmMethod);
object jmethod = reinterpret_cast<object>(makeJmethod(t, reinterpret_cast<object>(vmMethod), false));
object jmethod = reinterpret_cast<object>(makeJmethod(t, vmMethod, false));
return byteArrayBody(t, vmMethod->name(), 0) == '<'
? reinterpret_cast<object>(makeJconstructor(t, jmethod)) : jmethod;
return vmMethod->name()->body()[0] == '<'
? reinterpret_cast<object>(makeJconstructor(t, cast<GcJmethod>(t, jmethod))) : jmethod;
}
virtual object
@ -78,7 +78,7 @@ class MyClasspath : public Classpath {
virtual object
makeJField(Thread* t, object vmField)
{
return reinterpret_cast<object>(makeJfield(t, vmField, false));
return reinterpret_cast<object>(makeJfield(t, cast<GcField>(t, vmField), false));
}
virtual object
@ -204,12 +204,12 @@ class MyClasspath : public Classpath {
&byteArrayBody(t, calleeClassName, 0)))));
}
virtual object libraryClassLoader(Thread* t, GcMethod* caller)
virtual GcClassLoader* libraryClassLoader(Thread* t, GcMethod* caller)
{
return (caller->class_() == reinterpret_cast<object>(type(t, Gc::ClassLoaderType))
return (caller->class_() == type(t, Gc::ClassLoaderType)
and t->libraryLoadStack)
? t->libraryLoadStack->classLoader
: classLoader(t, caller->class_());
: caller->class_()->loader();
}
virtual void
@ -265,7 +265,7 @@ Avian_java_lang_Object_toString
unsigned hash = objectHash(t, this_);
object s = makeString
(t, "%s@0x%x",
&byteArrayBody(t, objectClass(t, this_)->name(), 0),
objectClass(t, this_)->name()->body().begin(),
hash);
return reinterpret_cast<int64_t>(s);
@ -581,7 +581,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_java_lang_ClassLoader_getCaller(Thread* t, object, uintptr_t*)
{
return reinterpret_cast<int64_t>(
getJClass(t, cast<GcClass>(t, getCaller(t, 2)->class_())));
getJClass(t, getCaller(t, 2)->class_()));
}
extern "C" AVIAN_EXPORT void JNICALL
@ -591,7 +591,7 @@ extern "C" AVIAN_EXPORT void JNICALL
Thread::LibraryLoadStack stack(
t,
classLoader(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))));
cast<GcJclass>(t, reinterpret_cast<object>(arguments[1]))->vmClass()->loader());
bool mapName = arguments[2];

View File

@ -331,7 +331,7 @@ getClassName(Thread* t, GcClass* c)
}
}
return c->name();
return reinterpret_cast<object>(c->name());
}
object
@ -579,7 +579,7 @@ class MyClasspath : public Classpath {
{
PROTECT(t, vmMethod);
return byteArrayBody(t, vmMethod->name(), 0) == '<'
return vmMethod->name()->body()[0] == '<'
? reinterpret_cast<object>(makeJconstructor(t, reinterpret_cast<object>(vmMethod)))
: reinterpret_cast<object>(makeJmethod(t, reinterpret_cast<object>(vmMethod)));
}
@ -653,11 +653,11 @@ class MyClasspath : public Classpath {
resolveNative(Thread* t, GcMethod* method)
{
if (strcmp(reinterpret_cast<const int8_t*>("sun/font/SunFontManager"),
&byteArrayBody(t, className(t, method->class_()), 0)) == 0
method->class_()->name()->body().begin()) == 0
and strcmp(reinterpret_cast<const int8_t*>("initIDs"),
&byteArrayBody(t, method->name(), 0)) == 0
method->name()->body().begin()) == 0
and strcmp(reinterpret_cast<const int8_t*>("()V"),
&byteArrayBody(t, method->spec(), 0)) == 0)
method->spec()->body().begin()) == 0)
{
PROTECT(t, method);
@ -692,7 +692,7 @@ class MyClasspath : public Classpath {
globalMachine = t->m;
resolveSystemClass(t, root(t, Machine::BootLoader),
type(t, GcClassLoader::Type)->name());
reinterpret_cast<object>(type(t, GcClassLoader::Type)->name()));
setRoot(t, Machine::ThreadTerminated, reinterpret_cast<object>(resolveMethod
(t, root(t, Machine::BootLoader), "java/lang/ThreadGroup",
@ -844,30 +844,28 @@ class MyClasspath : public Classpath {
(&byteArrayBody(t, calleeClassName, 0))));
}
virtual object libraryClassLoader(Thread* t, GcMethod* caller)
virtual GcClassLoader* libraryClassLoader(Thread* t, GcMethod* caller)
{
#ifdef AVIAN_OPENJDK_SRC
return (caller->class_() == type(t, Machine::ClassLoaderType)
and t->libraryLoadStack)
return (caller->class_()
== type(t, Machine::ClassLoaderType) and t->libraryLoadStack)
? t->libraryLoadStack->classLoader
#else
return strcmp(
"java/lang/ClassLoader$NativeLibrary",
reinterpret_cast<char*>(
&byteArrayBody(t, className(t, caller->class_()), 0)))
== 0
? classLoader(
return strcmp("java/lang/ClassLoader$NativeLibrary",
reinterpret_cast
<char*>(caller->class_()->name()->body().begin())) == 0
? cast<GcClass>(
t,
jclassVmClass(t,
t->m->processor->invoke(
t,
resolveMethod(t,
cast<GcClass>(t, caller->class_()),
"getFromClass",
"()Ljava/lang/Class;"),
0)))
cast<GcJclass>(t,
t->m->processor->invoke(
t,
resolveMethod(t,
caller->class_(),
"getFromClass",
"()Ljava/lang/Class;"),
0))->vmClass())->loader()
#endif
: classLoader(t, caller->class_());
: caller->class_()->loader();
}
virtual void
@ -2236,7 +2234,7 @@ makeJmethod(Thread* t, object vmMethod, int index)
&parameterCount, &returnTypeSpec);
PROTECT(t, parameterTypes);
object returnType = resolveJType
GcJclass* returnType = resolveJType
(t, classLoader(t, methodClass(t, vmMethod)), reinterpret_cast<char*>
(&byteArrayBody(t, methodSpec(t, vmMethod), returnTypeSpec)),
byteArrayLength(t, methodSpec(t, vmMethod)) - 1 - returnTypeSpec);
@ -2298,12 +2296,12 @@ makeJmethod(Thread* t, object vmMethod, int index)
expect(t, index != -1);
object jclass = getJClass(t, cast<GcClass>(t, methodClass(t, vmMethod)));
GcJclass* jclass = getJClass(t, cast<GcClass>(t, methodClass(t, vmMethod)));
return reinterpret_cast<object>(makeJmethod
(t, true, 0, jclass, index, name, returnType, parameterTypes,
exceptionTypes, methodFlags(t, vmMethod), signature, 0, annotationTable,
parameterAnnotationTable, annotationDefault, 0, 0, 0));
(t, true, 0, jclass, index, cast<GcString>(t, name), returnType, parameterTypes,
exceptionTypes, methodFlags(t, vmMethod), cast<GcString>(t, signature), 0, cast<GcByteArray>(t, annotationTable),
cast<GcByteArray>(t, parameterAnnotationTable), cast<GcByteArray>(t, annotationDefault), 0, 0, 0));
}
object
@ -2368,11 +2366,11 @@ makeJconstructor(Thread* t, object vmMethod, int index)
expect(t, index != -1);
object jclass = getJClass(t, cast<GcClass>(t, methodClass(t, vmMethod)));
GcJclass* jclass = getJClass(t, cast<GcClass>(t, methodClass(t, vmMethod)));
return reinterpret_cast<object>(makeJconstructor
(t, true, 0, jclass, index, parameterTypes, exceptionTypes, methodFlags
(t, vmMethod), signature, 0, annotationTable, parameterAnnotationTable,
(t, vmMethod), cast<GcString>(t, signature), 0, cast<GcByteArray>(t, annotationTable), cast<GcByteArray>(t, parameterAnnotationTable),
0, 0, 0));
}
@ -2394,7 +2392,7 @@ makeJfield(Thread* t, object vmField, int index)
byteArrayLength(t, fieldSpec(t, vmField)) - 1);
PROTECT(t, type);
object jtype = getJClass(t, type);
GcJclass* jtype = getJClass(t, type);
object signature;
object annotationTable;
@ -2436,11 +2434,11 @@ makeJfield(Thread* t, object vmField, int index)
expect(t, index != -1);
object jclass = getJClass(t, cast<GcClass>(t, fieldClass(t, vmField)));
GcJclass* jclass = getJClass(t, cast<GcClass>(t, fieldClass(t, vmField)));
return reinterpret_cast<object>(makeJfield
(t, true, 0, jclass, index, name, jtype, fieldFlags
(t, vmField), signature, 0, annotationTable, 0, 0, 0, 0));
(t, true, 0, jclass, index, cast<GcString>(t, name), jtype, fieldFlags
(t, vmField), cast<GcString>(t, signature), 0, cast<GcByteArray>(t, annotationTable), 0, 0, 0, 0));
}
void
@ -3414,7 +3412,7 @@ jvmDumpThreads(Thread* t, uintptr_t* arguments)
unsigned threadsLength = objectArrayLength(t, *threads);
GcClass* arrayClass = resolveObjectArrayClass
(t, type(t, GcStackTraceElement::Type)->loader(),
(t, reinterpret_cast<object>(type(t, GcStackTraceElement::Type)->loader()),
reinterpret_cast<object>(type(t, GcStackTraceElement::Type)));
object result = makeObjectArray(t, arrayClass, threadsLength);
PROTECT(t, result);
@ -3478,12 +3476,12 @@ jvmGetClassContext(Thread* t, uintptr_t*)
PROTECT(t, context);
for (unsigned i = 0; i < objectArrayLength(t, trace); ++i) {
object c = getJClass(
object c = reinterpret_cast<object>(getJClass(
t,
cast<GcClass>(
t,
methodClass(t,
traceElementMethod(t, objectArrayBody(t, trace, i)))));
traceElementMethod(t, objectArrayBody(t, trace, i))))));
set(t, context, ArrayBody + (i * BytesPerWord), c);
}
@ -3574,11 +3572,11 @@ EXPORT(JVM_LatestUserDefinedLoader)(Thread* t)
{ }
virtual bool visit(Processor::StackWalker* walker) {
object loader = classLoader(t, walker->method()->class_());
object loader = reinterpret_cast<object>(walker->method()->class_()->loader());
if (loader
and loader != root(t, Machine::BootLoader)
and strcmp
(&byteArrayBody(t, objectClass(t, loader)->name(), 0),
(objectClass(t, loader)->name()->body().begin(),
reinterpret_cast<const int8_t*>
("sun/reflect/DelegatingClassLoader")))
{
@ -3616,7 +3614,7 @@ jvmGetArrayElement(Thread* t, uintptr_t* arguments)
jobject array = reinterpret_cast<jobject>(arguments[0]);
jint index = arguments[1];
switch (byteArrayBody(t, objectClass(t, *array)->name(), 1)) {
switch (objectClass(t, *array)->name()->body()[1]) {
case 'Z':
return reinterpret_cast<intptr_t>
(makeLocalReference
@ -3677,7 +3675,7 @@ EXPORT(JVM_SetArrayElement)(Thread* t, jobject array, jint index,
{
ENTER(t, Thread::ActiveState);
switch (byteArrayBody(t, objectClass(t, *array)->name(), 1)) {
switch (objectClass(t, *array)->name()->body()[1]) {
case 'Z':
fieldAtOffset<int8_t>(*array, ArrayBody + index) = booleanValue(t, *value);
break;
@ -3806,7 +3804,7 @@ EXPORT(JVM_GetCallerClass)(Thread* t, int target)
GcMethod* method = getCaller(t, target, true);
return method ? makeLocalReference
(t, getJClass(t, cast<GcClass>(t, method->class_()))) : 0;
(t, reinterpret_cast<object>(getJClass(t, method->class_()))) : 0;
}
extern "C" AVIAN_EXPORT jclass JNICALL
@ -3818,32 +3816,32 @@ EXPORT(JVM_FindPrimitiveClass)(Thread* t, const char* name)
case 'b':
if (name[1] == 'o') {
return makeLocalReference
(t, getJClass(t, type(t, GcJboolean::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJboolean::Type))));
} else {
return makeLocalReference
(t, getJClass(t, type(t, GcJbyte::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJbyte::Type))));
}
case 'c':
return makeLocalReference
(t, getJClass(t, type(t, GcJchar::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJchar::Type))));
case 'd':
return makeLocalReference
(t, getJClass(t, type(t, GcJdouble::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJdouble::Type))));
case 'f':
return makeLocalReference
(t, getJClass(t, type(t, GcJfloat::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJfloat::Type))));
case 'i':
return makeLocalReference
(t, getJClass(t, type(t, GcJint::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJint::Type))));
case 'l':
return makeLocalReference
(t, getJClass(t, type(t, GcJlong::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJlong::Type))));
case 's':
return makeLocalReference
(t, getJClass(t, type(t, GcJshort::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJshort::Type))));
case 'v':
return makeLocalReference
(t, getJClass(t, type(t, GcJvoid::Type)));
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJvoid::Type))));
default:
throwNew(t, GcIllegalArgumentException::Type);
}
@ -3890,7 +3888,7 @@ jvmFindClassFromClassLoader(Thread* t, uintptr_t* arguments)
initClass(t, c);
}
return reinterpret_cast<uint64_t>(makeLocalReference(t, getJClass(t, c)));
return reinterpret_cast<uint64_t>(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, c))));
}
extern "C" AVIAN_EXPORT jclass JNICALL
@ -3933,7 +3931,7 @@ jvmFindLoadedClass(Thread* t, uintptr_t* arguments)
GcClass* c = findLoadedClass(t, *loader, spec);
return reinterpret_cast<uint64_t>
(c ? makeLocalReference(t, getJClass(t, c)) : 0);
(c ? makeLocalReference(t, reinterpret_cast<object>(getJClass(t, c))) : 0);
}
extern "C" AVIAN_EXPORT jclass JNICALL
@ -3954,7 +3952,7 @@ jvmDefineClass(Thread* t, uintptr_t* arguments)
return reinterpret_cast<uint64_t>
(makeLocalReference
(t, getJClass(t, cast<GcClass>(t, defineClass(t, *loader, data, length)))));
(t, reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, defineClass(t, *loader, data, length))))));
}
extern "C" AVIAN_EXPORT jclass JNICALL
@ -4008,7 +4006,7 @@ jvmGetClassInterfaces(Thread* t, uintptr_t* arguments)
PROTECT(t, array);
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
object c = getJClass(t, cast<GcClass>(t, arrayBody(t, table, i)));
object c = reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, arrayBody(t, table, i))));
set(t, array, ArrayBody + (i * BytesPerWord), c);
}
@ -4043,7 +4041,7 @@ EXPORT(JVM_GetClassLoader)(Thread* t, jclass c)
GcMethod* caller = getCaller(t, 2);
if (caller and strcmp
(reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, caller->class_()), 0)),
(caller->class_()->name()->body().begin()),
"sun/misc/Unsafe") == 0)
{
return 0;
@ -4152,11 +4150,11 @@ jvmGetComponentType(Thread* t, uintptr_t* arguments)
uint8_t n = byteArrayBody(t, className(t, jclassVmClass(t, *c)), 1);
if (n != 'L' and n != '[') {
return reinterpret_cast<uintptr_t>
(makeLocalReference(t, getJClass(t, primitiveClass(t, n))));
(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, primitiveClass(t, n)))));
} else {
return reinterpret_cast<uintptr_t>
(makeLocalReference
(t, getJClass(t, cast<GcClass>(t, classStaticTable(t, jclassVmClass(t, *c))))));
(t, reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, classStaticTable(t, jclassVmClass(t, *c)))))));
}
} else {
return 0;
@ -4208,8 +4206,8 @@ jvmGetDeclaringClass(Thread* t, uintptr_t* arguments)
{
return reinterpret_cast<uintptr_t>
(makeLocalReference
(t, getDeclaringClass
(t, jclassVmClass(t, *reinterpret_cast<jobject>(arguments[0])))));
(t, reinterpret_cast<object>(getDeclaringClass
(t, jclassVmClass(t, *reinterpret_cast<jobject>(arguments[0]))))));
}
extern "C" AVIAN_EXPORT jclass JNICALL
@ -4429,7 +4427,7 @@ jvmInvokeMethod(Thread* t, uintptr_t* arguments)
instance = 0;
}
if (instance and not instanceOf(t, cast<GcClass>(t, vmMethod->class_()), *instance)) {
if (instance and not instanceOf(t, vmMethod->class_(), *instance)) {
throwNew(t, GcIllegalArgumentException::Type);
}
@ -5260,8 +5258,8 @@ getEnclosingMethodInfo(Thread* t, uintptr_t* arguments)
object array = makeObjectArray(t, type(t, GcJobject::Type), 3);
PROTECT(t, array);
enclosingClass = getJClass
(t, resolveClass(t, classLoader(t, class_), enclosingClass));
enclosingClass = reinterpret_cast<object>(getJClass
(t, resolveClass(t, classLoader(t, class_), enclosingClass)));
set(t, array, ArrayBody, enclosingClass);

View File

@ -318,7 +318,7 @@ GcMethod*
findMethod(Thread* t, GcMethod* method, object instance)
{
if ((method->flags() & ACC_STATIC) == 0) {
if (classFlags(t, method->class_()) & ACC_INTERFACE) {
if (method->class_()->flags() & ACC_INTERFACE) {
return findInterfaceMethod(t, method, objectClass(t, instance));
} else if (methodVirtual(t, method)) {
return findVirtualMethod(t, method, objectClass(t, instance));
@ -336,10 +336,10 @@ resolveTarget(MyThread* t, void* stack, GcMethod* method)
PROTECT(t, method);
PROTECT(t, class_);
resolveSystemClass(t, root(t, Machine::BootLoader), class_->name());
resolveSystemClass(t, root(t, Machine::BootLoader), reinterpret_cast<object>(class_->name()));
}
if (classFlags(t, method->class_()) & ACC_INTERFACE) {
if (method->class_()->flags() & ACC_INTERFACE) {
return findInterfaceMethod(t, method, class_);
} else {
return findVirtualMethod(t, method, class_);
@ -352,7 +352,7 @@ resolveTarget(MyThread* t, GcClass* class_, unsigned index)
if (class_->vmFlags() & BootstrapFlag) {
PROTECT(t, class_);
resolveSystemClass(t, root(t, Machine::BootLoader), class_->name());
resolveSystemClass(t, root(t, Machine::BootLoader), reinterpret_cast<object>(class_->name()));
}
return cast<GcMethod>(t, arrayBody(t, class_->virtualTable(), index));
@ -456,11 +456,11 @@ nextFrame(MyThread* t, void** ip, void** sp, GcMethod* method, GcMethod* target,
}
// fprintf(stderr, "nextFrame %s.%s%s target %s.%s%s ip %p sp %p\n",
// &byteArrayBody(t, className(t, method->class_()), 0),
// &byteArrayBody(t, method->name(), 0),
// &byteArrayBody(t, method->spec(), 0),
// method->class_()->name()->body().begin(),
// method->name()->body().begin(),
// method->spec()->body().begin(),
// target
// ? &byteArrayBody(t, className(t, target->class_()), 0)
// ? &byteArrayBody(t, target->class_()->name(), 0)
// : 0,
// target
// ? &byteArrayBody(t, methodName(t, target), 0)
@ -2006,7 +2006,7 @@ releaseLock(MyThread* t, GcMethod* method, void* stack)
if (t->methodLockIsClean) {
object lock;
if (method->flags() & ACC_STATIC) {
lock = method->class_();
lock = reinterpret_cast<object>(method->class_());
} else {
lock = *localObject
(t, stackForFrame(t, stack, method), method,
@ -2301,9 +2301,9 @@ prepareMethodForCall(MyThread* t, GcMethod* target)
{
if (methodAbstract(t, target)) {
throwNew(t, GcAbstractMethodError::Type, "%s.%s%s",
&byteArrayBody(t, className(t, target->class_()), 0),
&byteArrayBody(t, target->name(), 0),
&byteArrayBody(t, target->spec(), 0));
target->class_()->name()->body().begin(),
target->name()->body().begin(),
target->spec()->body().begin());
} else {
if (unresolved(t, methodAddress(t, target))) {
PROTECT(t, target);
@ -2347,9 +2347,9 @@ checkMethod(Thread* t, GcMethod* method, bool shouldBeStatic)
if (((method->flags() & ACC_STATIC) == 0) == shouldBeStatic) {
throwNew(t, GcIncompatibleClassChangeError::Type,
"expected %s.%s%s to be %s",
&byteArrayBody(t, className(t, method->class_()), 0),
&byteArrayBody(t, method->name(), 0),
&byteArrayBody(t, method->spec(), 0),
method->class_()->name()->body().begin(),
method->name()->body().begin(),
method->spec()->body().begin(),
shouldBeStatic ? "static" : "non-static");
}
}
@ -2375,7 +2375,7 @@ findSpecialMethodFromReference(MyThread* t, object pair)
GcClass* class_ = cast<GcClass>(t, methodClass(t, pairFirst(t, pair)));
if (isSpecialMethod(t, target, class_)) {
target = findVirtualMethod(t, target, cast<GcClass>(t, class_->super()));
target = findVirtualMethod(t, target, class_->super());
}
checkMethod(t, target, false);
@ -2440,8 +2440,8 @@ traceSize(Thread* t)
t->m->processor->walkStack(t, &counter);
return GcArray::FixedSize + (counter.count * ArrayElementSizeOfArray)
+ (counter.count * GcTraceElement::FixedSize);
return pad(GcArray::FixedSize) + (counter.count * pad(ArrayElementSizeOfArray))
+ (counter.count * pad(GcTraceElement::FixedSize));
}
void NO_RETURN
@ -2690,8 +2690,8 @@ void
checkCast(MyThread* t, GcClass* class_, object o)
{
if (UNLIKELY(o and not isAssignableFrom(t, class_, objectClass(t, o)))) {
object classNameFrom = objectClass(t, o)->name();
object classNameTo = class_->name();
object classNameFrom = reinterpret_cast<object>(objectClass(t, o)->name());
object classNameTo = reinterpret_cast<object>(class_->name());
THREAD_RUNTIME_ARRAY(t, char, classFrom, byteArrayLength(t, classNameFrom));
THREAD_RUNTIME_ARRAY(t, char, classTo, byteArrayLength(t, classNameTo));
replace('/', '.', RUNTIME_ARRAY_BODY(classFrom),
@ -3121,7 +3121,7 @@ compileDirectInvoke(MyThread* t, Frame* frame, GcMethod* target, bool tailCall)
// don't bother calling an empty method unless calling it might
// cause the class to be initialized, which may have side effects
if (emptyMethod(t, target)
and (not classNeedsInit(t, cast<GcClass>(t, target->class_()))))
and (not classNeedsInit(t, target->class_())))
{
frame->popFootprint(target->parameterFootprint());
tailCall = false;
@ -3129,7 +3129,7 @@ compileDirectInvoke(MyThread* t, Frame* frame, GcMethod* target, bool tailCall)
BootContext* bc = frame->context->bootContext;
if (bc) {
if ((target->class_() == frame->context->method->class_()
or (not classNeedsInit(t, cast<GcClass>(t, target->class_()))))
or (not classNeedsInit(t, target->class_())))
and (not (avian::codegen::TailCalls and tailCall
and (target->flags() & ACC_NATIVE))))
{
@ -3144,7 +3144,7 @@ compileDirectInvoke(MyThread* t, Frame* frame, GcMethod* target, bool tailCall)
compileDirectInvoke(t, frame, target, tailCall, true, 0);
}
} else if (unresolved(t, methodAddress(t, target))
or classNeedsInit(t, cast<GcClass>(t, target->class_())))
or classNeedsInit(t, target->class_()))
{
compileDirectInvoke(t, frame, target, tailCall, true, 0);
} else {
@ -3230,7 +3230,7 @@ handleMonitorEvent(MyThread* t, Frame* frame, intptr_t function)
if (method->flags() & ACC_STATIC) {
PROTECT(t, method);
lock = frame->append(method->class_());
lock = frame->append(reinterpret_cast<object>(method->class_()));
} else {
lock = loadLocal(
frame->context, 1, ir::Type::object(), savedTargetIndex(t, method));
@ -3294,10 +3294,10 @@ inTryBlock(MyThread* t, object code, unsigned ip)
}
bool
needsReturnBarrier(MyThread* t, GcMethod* method)
needsReturnBarrier(MyThread* t UNUSED, GcMethod* method)
{
return (method->flags() & ConstructorFlag)
and (classVmFlags(t, method->class_()) & HasFinalMemberFlag);
and (method->class_()->vmFlags() & HasFinalMemberFlag);
}
bool
@ -3354,8 +3354,8 @@ isTailCall(MyThread* t, object code, unsigned ip, GcMethod* caller, GcMethod* ca
{
return isTailCall
(t, code, ip, caller, callee->returnCode(),
className(t, callee->class_()), callee->name(),
callee->spec());
reinterpret_cast<object>(callee->class_()->name()), reinterpret_cast<object>(callee->name()),
reinterpret_cast<object>(callee->spec()));
}
bool
@ -3531,14 +3531,14 @@ ir::Value* popLongAddress(Frame* frame)
}
bool
intrinsic(MyThread* t, Frame* frame, GcMethod* target)
intrinsic(MyThread* t UNUSED, Frame* frame, GcMethod* target)
{
#define MATCH(name, constant) \
(byteArrayLength(t, name) \
(name->length() \
== sizeof(constant) and::strcmp( \
reinterpret_cast<char*>(&byteArrayBody(t, name, 0)), constant) == 0)
reinterpret_cast<char*>(name->body().begin()), constant) == 0)
object className = vm::className(t, target->class_());
GcByteArray* className = target->class_()->name();
if (UNLIKELY(MATCH(className, "java/lang/Math"))) {
avian::codegen::Compiler* c = frame->c;
if (MATCH(target->name(), "sqrt") and MATCH(target->spec(), "(D)D")) {
@ -4970,9 +4970,9 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
GcMethod* target = resolveMethod(t, context->method, index - 1, false);
if (LIKELY(target)) {
GcClass* class_ = cast<GcClass>(t, context->method->class_());
GcClass* class_ = context->method->class_();
if (isSpecialMethod(t, target, class_)) {
target = findVirtualMethod(t, target, cast<GcClass>(t, class_->super()));
target = findVirtualMethod(t, target, class_->super());
}
checkMethod(t, target, false);
@ -6751,22 +6751,22 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
logCompile
(t, 0, 0,
reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, context->method->class_()), 0)),
(context->method->class_()->name()->body().begin()),
reinterpret_cast<const char*>
(&byteArrayBody(t, context->method->name(), 0)),
(context->method->name()->body().begin()),
reinterpret_cast<const char*>
(&byteArrayBody(t, context->method->spec(), 0)));
(context->method->spec()->body().begin()));
}
// for debugging:
if (false and
::strcmp
(reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, context->method->class_()), 0)),
(context->method->class_()->name()->body().begin()),
"java/lang/System") == 0 and
::strcmp
(reinterpret_cast<const char*>
(&byteArrayBody(t, context->method->name(), 0)),
(context->method->name()->body().begin()),
"<clinit>") == 0)
{
trap();
@ -6804,7 +6804,7 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
context->executableSize = (allocator->memory.begin() + allocator->offset)
- static_cast<uint8_t*>(context->executableStart);
initArray(t, pool, context->objectPoolCount + 1);
initArray(t, reinterpret_cast<GcArray*>(pool), context->objectPoolCount + 1);
mark(t, pool, 0);
set(t, pool, ArrayBody, root(t, ObjectPools));
@ -6883,21 +6883,21 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
logCompile
(t, start, codeSize,
reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, context->method->class_()), 0)),
(context->method->class_()->name()->body().begin()),
reinterpret_cast<const char*>
(&byteArrayBody(t, context->method->name(), 0)),
(context->method->name()->body().begin()),
reinterpret_cast<const char*>
(&byteArrayBody(t, context->method->spec(), 0)));
(context->method->spec()->body().begin()));
// for debugging:
if (false and
::strcmp
(reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, context->method->class_()), 0)),
(context->method->class_()->name()->body().begin()),
"java/lang/System") == 0 and
::strcmp
(reinterpret_cast<const char*>
(&byteArrayBody(t, context->method->name(), 0)),
(context->method->name()->body().begin()),
"<clinit>") == 0)
{
trap();
@ -6913,9 +6913,9 @@ compile(MyThread* t, Context* context)
avian::codegen::Compiler* c = context->compiler;
// fprintf(stderr, "compiling %s.%s%s\n",
// &byteArrayBody(t, className(t, context->method->class_()), 0),
// &byteArrayBody(t, context->method->name(), 0),
// &byteArrayBody(t, context->method->spec(), 0));
// context->method->class_()->name()->body().begin(),
// context->method->name()->body().begin(),
// context->method->spec()->body().begin());
unsigned footprint = context->method->parameterFootprint();
unsigned locals = localSize(t, context->method);
@ -6934,7 +6934,7 @@ compile(MyThread* t, Context* context)
for (MethodSpecIterator it
(t, reinterpret_cast<const char*>
(&byteArrayBody(t, context->method->spec(), 0)));
(context->method->spec()->body().begin()));
it.hasNext();)
{
switch (*it.next()) {
@ -7148,11 +7148,11 @@ invokeNativeSlow(MyThread* t, GcMethod* method, void* function)
+ t->arch->frameFooterSize()
+ t->arch->frameReturnAddressSize();
object jclass = 0;
GcJclass* jclass = 0;
PROTECT(t, jclass);
if (method->flags() & ACC_STATIC) {
jclass = getJClass(t, cast<GcClass>(t, method->class_()));
jclass = getJClass(t, method->class_());
RUNTIME_ARRAY_BODY(args)[argOffset++]
= reinterpret_cast<uintptr_t>(&jclass);
} else {
@ -7163,7 +7163,7 @@ invokeNativeSlow(MyThread* t, GcMethod* method, void* function)
MethodSpecIterator it
(t, reinterpret_cast<const char*>
(&byteArrayBody(t, method->spec(), 0)));
(method->spec()->body().begin()));
while (it.hasNext()) {
unsigned type = RUNTIME_ARRAY_BODY(types)[typeOffset++]
@ -7204,13 +7204,13 @@ invokeNativeSlow(MyThread* t, GcMethod* method, void* function)
if (DebugNatives) {
fprintf(stderr, "invoke native method %s.%s\n",
&byteArrayBody(t, className(t, method->class_()), 0),
&byteArrayBody(t, method->name(), 0));
method->class_()->name()->body().begin(),
method->name()->body().begin());
}
if (method->flags() & ACC_SYNCHRONIZED) {
if (method->flags() & ACC_STATIC) {
acquire(t, method->class_());
acquire(t, reinterpret_cast<object>(method->class_()));
} else {
acquire(t, *reinterpret_cast<object*>(RUNTIME_ARRAY_BODY(args)[1]));
}
@ -7234,7 +7234,7 @@ invokeNativeSlow(MyThread* t, GcMethod* method, void* function)
if (method->flags() & ACC_SYNCHRONIZED) {
if (method->flags() & ACC_STATIC) {
release(t, method->class_());
release(t, reinterpret_cast<object>(method->class_()));
} else {
release(t, *reinterpret_cast<object*>(RUNTIME_ARRAY_BODY(args)[1]));
}
@ -7242,8 +7242,8 @@ invokeNativeSlow(MyThread* t, GcMethod* method, void* function)
if (DebugNatives) {
fprintf(stderr, "return from native method %s.%s\n",
&byteArrayBody(t, className(t, method->class_()), 0),
&byteArrayBody(t, method->name(), 0));
method->class_()->name()->body().begin(),
method->name()->body().begin());
}
if (UNLIKELY(t->exception)) {
@ -7498,7 +7498,7 @@ visitArguments(MyThread* t, Heap::Visitor* v, void* stack, GcMethod* method)
for (MethodSpecIterator it
(t, reinterpret_cast<const char*>
(&byteArrayBody(t, method->spec(), 0)));
(method->spec()->body().begin()));
it.hasNext();)
{
switch (*it.next()) {
@ -7633,7 +7633,7 @@ callContinuation(MyThread* t, object continuation, object result,
int8_t*
returnSpec(MyThread* t, GcMethod* method)
{
int8_t* s = &byteArrayBody(t, method->spec(), 0);
int8_t* s = method->spec()->body().begin();
while (*s and *s != ')') ++ s;
expect(t, *s == ')');
return s + 1;
@ -7657,7 +7657,7 @@ returnClass(MyThread* t, GcMethod* method)
memcpy(&byteArrayBody(t, name, 0), spec + 1, length - 2);
}
return resolveClass(t, classLoader(t, method->class_()), name);
return resolveClass(t, reinterpret_cast<object>(method->class_()->loader()), name);
}
bool
@ -7769,7 +7769,7 @@ callContinuation(MyThread* t, object continuation, object result,
and continuationContextContinuation(t, unwindContext))
{
nextContinuation = continuationContextContinuation(t, unwindContext);
result = reinterpret_cast<object>(makeUnwindResult(t, continuation, result, exception));
result = reinterpret_cast<object>(makeUnwindResult(t, continuation, result, cast<GcThrowable>(t, exception)));
action = Unwind;
} else if (rewindContext
and continuationContextContinuation(t, rewindContext))
@ -8186,7 +8186,7 @@ class SignalHandler: public SignalRegistrar::Handler {
static_cast<void**>(*stack) - t->arch->frameReturnAddressSize(),
t->continuation, t->trace);
if (ensure(t, fixedSize + traceSize(t))) {
if (ensure(t, pad(fixedSize) + traceSize(t))) {
atomicOr(&(t->flags), Thread::TracingFlag);
t->exception = makeThrowable(t, type);
atomicAnd(&(t->flags), ~Thread::TracingFlag);
@ -8454,10 +8454,10 @@ class MyProcessor: public Processor {
offset,
0,
0,
reinterpret_cast<object>(name),
reinterpret_cast<object>(spec),
addendum,
reinterpret_cast<object>(class_),
name,
spec,
cast<GcMethodAddendum>(t, addendum),
class_,
reinterpret_cast<object>(code));
}
@ -8488,17 +8488,17 @@ class MyProcessor: public Processor {
arrayElementSize,
arrayDimensions,
0,
objectMask,
name,
sourceFile,
super,
cast<GcIntArray>(t, objectMask),
cast<GcByteArray>(t, name),
cast<GcByteArray>(t, sourceFile),
cast<GcClass>(t, super),
interfaceTable,
virtualTable,
fieldTable,
methodTable,
staticTable,
reinterpret_cast<GcClassAddendum*>(staticTable), // DANGER DANGER DANGER!!!!!!!!!
addendum,
loader,
cast<GcClassLoader>(t, loader),
0,
vtableLength);
}
@ -8626,7 +8626,7 @@ class MyProcessor: public Processor {
method = findMethod(t, method, this_);
const char* spec = reinterpret_cast<char*>
(&byteArrayBody(t, method->spec(), 0));
(method->spec()->body().begin());
unsigned size = method->parameterFootprint();
THREAD_RUNTIME_ARRAY(t, uintptr_t, array, size);
@ -8656,7 +8656,7 @@ class MyProcessor: public Processor {
method = findMethod(t, method, this_);
const char* spec = reinterpret_cast<char*>
(&byteArrayBody(t, method->spec(), 0));
(method->spec()->body().begin());
unsigned size = method->parameterFootprint();
THREAD_RUNTIME_ARRAY(t, uintptr_t, array, size);
@ -8687,7 +8687,7 @@ class MyProcessor: public Processor {
method = findMethod(t, method, this_);
const char* spec = reinterpret_cast<char*>
(&byteArrayBody(t, method->spec(), 0));
(method->spec()->body().begin());
unsigned size = method->parameterFootprint();
THREAD_RUNTIME_ARRAY(t, uintptr_t, array, size);
@ -9484,11 +9484,11 @@ fixupMethods(Thread* t, GcHashMap* map, BootImage* image UNUSED, uint8_t* code)
reinterpret_cast<uint8_t*>(methodCompiled(t, method)),
methodCompiledSize(t, method),
reinterpret_cast<char*>
(&byteArrayBody(t, className(t, method->class_()), 0)),
(method->class_()->name()->body().begin()),
reinterpret_cast<char*>
(&byteArrayBody(t, method->name(), 0)),
(method->name()->body().begin()),
reinterpret_cast<char*>
(&byteArrayBody(t, method->spec(), 0)));
(method->spec()->body().begin()));
}
}
}
@ -10007,7 +10007,7 @@ compile(MyThread* t, FixedAllocator* allocator, BootContext* bootContext,
PROTECT(t, method);
if (bootContext == 0 and method->flags() & ACC_STATIC) {
initClass(t, cast<GcClass>(t, method->class_()));
initClass(t, method->class_());
}
if (methodAddress(t, method) != defaultThunk(t)) {
@ -10091,7 +10091,7 @@ compile(MyThread* t, FixedAllocator* allocator, BootContext* bootContext,
set(t, reinterpret_cast<object>(method), MethodCode, clone->code());
if (methodVirtual(t, method)) {
classVtable(t, method->class_(), method->offset())
classVtable(t, reinterpret_cast<object>(method->class_()), method->offset())
= reinterpret_cast<void*>(methodCompiled(t, clone));
}

View File

@ -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, method->class_());
acquire(t, reinterpret_cast<object>(method->class_()));
} else {
acquire(t, peekObject(t, base));
}
@ -356,7 +356,7 @@ popFrame(Thread* t)
if (method->flags() & ACC_SYNCHRONIZED) {
if (method->flags() & ACC_STATIC) {
release(t, method->class_());
release(t, reinterpret_cast<object>(method->class_()));
} else {
release(t, peekObject(t, frameBase(t, t->frame)));
}
@ -494,7 +494,7 @@ marshalArguments(Thread* t, uintptr_t* args, uint8_t* types, unsigned sp,
{
MethodSpecIterator it
(t, reinterpret_cast<const char*>
(&byteArrayBody(t, method->spec(), 0)));
(method->spec()->body().begin()));
unsigned argOffset = 0;
unsigned typeOffset = 0;
@ -565,7 +565,7 @@ invokeNativeSlow(Thread* t, GcMethod* method, void* function)
unsigned sp;
if (method->flags() & ACC_STATIC) {
sp = frameBase(t, t->frame);
jclass = getJClass(t, cast<GcClass>(t, method->class_()));
jclass = getJClass(t, method->class_());
RUNTIME_ARRAY_BODY(args)[argOffset++]
= reinterpret_cast<uintptr_t>(&jclass);
} else {
@ -588,8 +588,8 @@ invokeNativeSlow(Thread* t, GcMethod* method, void* function)
if (DebugRun) {
fprintf(stderr, "invoke native method %s.%s\n",
&byteArrayBody(t, className(t, method->class_()), 0),
&byteArrayBody(t, method->name(), 0));
method->class_()->name()->body().begin(),
method->name()->body().begin());
}
{ ENTER(t, Thread::IdleState);
@ -608,10 +608,8 @@ invokeNativeSlow(Thread* t, GcMethod* method, void* function)
if (DebugRun) {
fprintf(stderr, "return from native method %s.%s\n",
&byteArrayBody
(t, className(t, frameMethod(t, t->frame)->class_()), 0),
&byteArrayBody
(t, frameMethod(t, t->frame)->name(), 0));
frameMethod(t, t->frame)->class_()->name()->body().begin(),
frameMethod(t, t->frame)->name()->body().begin());
}
popFrame(t);
@ -797,10 +795,8 @@ interpret3(Thread* t, const int base)
fprintf(stderr, "ip: %d; instruction: 0x%x in %s.%s ",
ip - 1,
instruction,
&byteArrayBody
(t, className(t, frameMethod(t, frame)->class_()), 0),
&byteArrayBody
(t, frameMethod(t, frame)->name(), 0));
frameMethod(t, frame)->class_()->name()->body().begin(),
frameMethod(t, frame)->name()->body().begin());
int line = findLineNumber(t, frameMethod(t, frame), ip);
switch (line) {
@ -1076,9 +1072,8 @@ interpret3(Thread* t, const int base)
if (not instanceOf(t, class_, peekObject(t, sp - 1))) {
exception = makeThrowable
(t, GcClassCastException::Type, "%s as %s",
&byteArrayBody
(t, objectClass(t, peekObject(t, sp - 1))->name(), 0),
&byteArrayBody(t, class_->name(), 0));
objectClass(t, peekObject(t, sp - 1))->name()->body().begin(),
class_->name()->body().begin());
goto throw_;
}
}
@ -1862,9 +1857,9 @@ interpret3(Thread* t, const int base)
unsigned parameterFootprint = method->parameterFootprint();
if (LIKELY(peekObject(t, sp - parameterFootprint))) {
GcClass* class_ = cast<GcClass>(t, frameMethod(t, frame)->class_());
GcClass* class_ = frameMethod(t, frame)->class_();
if (isSpecialMethod(t, method, class_)) {
class_ = cast<GcClass>(t, class_->super());
class_ = class_->super();
PROTECT(t, method);
PROTECT(t, class_);
@ -1888,7 +1883,7 @@ interpret3(Thread* t, const int base)
GcMethod* method = resolveMethod(t, frameMethod(t, frame), index - 1);
PROTECT(t, method);
initClass(t, cast<GcClass>(t, method->class_()));
initClass(t, method->class_());
code = reinterpret_cast<object>(method);
} goto invoke;
@ -2563,7 +2558,7 @@ interpret3(Thread* t, const int base)
case return_: {
GcMethod* method = frameMethod(t, frame);
if ((method->flags() & ConstructorFlag)
and (classVmFlags(t, method->class_()) & HasFinalMemberFlag))
and (method->class_()->vmFlags() & HasFinalMemberFlag))
{
storeStoreMemoryBarrier();
}
@ -2670,8 +2665,8 @@ interpret3(Thread* t, const int base)
GcClass* class_ = objectClass(t, peekObject(t, sp - parameterFootprint));
assertT(t, class_->vmFlags() & BootstrapFlag);
resolveClass(t, classLoader(t, frameMethod(t, frame)->class_()),
class_->name());
resolveClass(t, reinterpret_cast<object>(frameMethod(t, frame)->class_()->loader()),
reinterpret_cast<object>(class_->name()));
ip -= 3;
} goto loop;
@ -2896,16 +2891,16 @@ invoke(Thread* t, GcMethod* method)
class_ = objectClass(t, peekObject(t, t->sp - parameterFootprint));
if (class_->vmFlags() & BootstrapFlag) {
resolveClass(t, root(t, Machine::BootLoader), class_->name());
resolveClass(t, root(t, Machine::BootLoader), reinterpret_cast<object>(class_->name()));
}
if (classFlags(t, method->class_()) & ACC_INTERFACE) {
if (method->class_()->flags() & ACC_INTERFACE) {
method = findInterfaceMethod(t, method, class_);
} else {
method = findVirtualMethod(t, method, class_);
}
} else {
class_ = cast<GcClass>(t, method->class_());
class_ = method->class_();
}
if (method->flags() & ACC_STATIC) {
@ -3001,10 +2996,10 @@ class MyProcessor: public Processor {
offset,
0,
0,
reinterpret_cast<object>(name),
reinterpret_cast<object>(spec),
addendum,
reinterpret_cast<object>(class_),
name,
spec,
cast<GcMethodAddendum>(t, addendum),
class_,
reinterpret_cast<object>(code));
}
@ -3028,10 +3023,26 @@ class MyProcessor: public Processor {
object loader,
unsigned vtableLength UNUSED)
{
return vm::makeClass
(t, flags, vmFlags, fixedSize, arrayElementSize, arrayDimensions, 0,
objectMask, name, sourceFile, super, interfaceTable, virtualTable,
fieldTable, methodTable, addendum, staticTable, loader, 0, 0);
return vm::makeClass(t,
flags,
vmFlags,
fixedSize,
arrayElementSize,
arrayDimensions,
0,
cast<GcIntArray>(t, objectMask),
cast<GcByteArray>(t, name),
cast<GcByteArray>(t, sourceFile),
cast<GcClass>(t, super),
interfaceTable,
virtualTable,
fieldTable,
methodTable,
cast<GcClassAddendum>(t, addendum),
staticTable,
cast<GcClassLoader>(t, loader),
0,
0);
}
virtual void
@ -3133,7 +3144,7 @@ class MyProcessor: public Processor {
}
const char* spec = reinterpret_cast<char*>
(&byteArrayBody(t, method->spec(), 0));
(method->spec()->body().begin());
pushArguments(t, this_, spec, arguments);
return local::invoke(t, method);
@ -3157,7 +3168,7 @@ class MyProcessor: public Processor {
}
const char* spec = reinterpret_cast<char*>
(&byteArrayBody(t, method->spec(), 0));
(method->spec()->body().begin());
pushArguments(t, this_, spec, arguments);
return local::invoke(t, method);
@ -3181,7 +3192,7 @@ class MyProcessor: public Processor {
}
const char* spec = reinterpret_cast<char*>
(&byteArrayBody(t, method->spec(), 0));
(method->spec()->body().begin());
pushArguments(t, this_, spec, indirectObjects, arguments);
return local::invoke(t, method);

View File

@ -323,11 +323,11 @@ defineClass(Thread* t, uintptr_t* arguments)
return reinterpret_cast<uint64_t>(makeLocalReference(
t,
getJClass(t,
reinterpret_cast<object>(getJClass(t,
cast<GcClass>(t, defineClass(t,
loader ? *loader : root(t, Machine::BootLoader),
buffer,
length)))));
length))))));
}
jclass JNICALL
@ -351,10 +351,12 @@ findClass(Thread* t, uintptr_t* arguments)
GcMethod* caller = getCaller(t, 0);
GcClass* c = resolveClass(t,
caller ? t->m->classpath->libraryClassLoader(t, caller)
: root(t, Machine::AppLoader),
n);
GcClass* c = resolveClass(
t,
caller ? reinterpret_cast
<object>(t->m->classpath->libraryClassLoader(t, caller))
: root(t, Machine::AppLoader),
n);
if (t->m->classpath->mayInitClasses()) {
PROTECT(t, c);
@ -362,7 +364,7 @@ findClass(Thread* t, uintptr_t* arguments)
initClass(t, c);
}
return reinterpret_cast<uint64_t>(makeLocalReference(t, getJClass(t, c)));
return reinterpret_cast<uint64_t>(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, c))));
}
jclass JNICALL
@ -451,7 +453,7 @@ getObjectClass(Thread* t, uintptr_t* arguments)
jobject o = reinterpret_cast<jclass>(arguments[0]);
return reinterpret_cast<uint64_t>(makeLocalReference(
t, getJClass(t, objectClass(t, *o))));
t, reinterpret_cast<object>(getJClass(t, objectClass(t, *o)))));
}
jclass JNICALL
@ -471,7 +473,7 @@ getSuperclass(Thread* t, uintptr_t* arguments)
} else {
object super = classSuper(t, class_);
return super ? reinterpret_cast<uint64_t>
(makeLocalReference(t, getJClass(t, cast<GcClass>(t, super)))) : 0;
(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, super))))) : 0;
}
}

View File

@ -738,7 +738,7 @@ invoke(Thread* t, uintptr_t* arguments)
void
finalizeObject(Thread* t, object o, const char* name)
{
for (GcClass* c = objectClass(t, o); c; c = cast<GcClass>(t, c->super())) {
for (GcClass* c = objectClass(t, o); c; c = c->super()) {
for (unsigned i = 0; i < arrayLength(t, c->methodTable()); ++i) {
object m = arrayBody(t, c->methodTable(), i);
@ -1070,7 +1070,7 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
GcMethod* template_ = makeMethod
(t, 0, returnCode, parameterCount, parameterFootprint, 0, 0, 0, 0,
pairFirst(t, nameAndType), pairSecond(t, nameAndType), 0, 0, 0);
cast<GcByteArray>(t, pairFirst(t, nameAndType)), cast<GcByteArray>(t, pairSecond(t, nameAndType)), 0, 0, 0);
object value = reinterpret_cast
<object>(makeInvocation(t,
@ -1195,8 +1195,12 @@ addInterfaces(Thread* t, GcClass* class_, GcHashMap* map)
for (unsigned i = 0; i < arrayLength(t, table); i += increment) {
GcClass* interface = cast<GcClass>(t, arrayBody(t, table, i));
object name = interface->name();
hashMapInsertMaybe(t, map, name, reinterpret_cast<object>(interface), byteArrayHash,
GcByteArray* name = interface->name();
hashMapInsertMaybe(t,
map,
reinterpret_cast<object>(name),
reinterpret_cast<object>(interface),
byteArrayHash,
byteArrayEqual);
}
}
@ -1205,7 +1209,7 @@ addInterfaces(Thread* t, GcClass* class_, GcHashMap* map)
GcClassAddendum*
getClassAddendum(Thread* t, GcClass* class_, GcSingleton* pool)
{
GcClassAddendum* addendum = cast<GcClassAddendum>(t, class_->addendum());
GcClassAddendum* addendum = class_->addendum();
if (addendum == 0) {
PROTECT(t, class_);
@ -1229,7 +1233,7 @@ parseInterfaceTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool,
PROTECT(t, map);
if (class_->super()) {
addInterfaces(t, cast<GcClass>(t, class_->super()), map);
addInterfaces(t, class_->super(), map);
}
unsigned count = s.read2();
@ -1249,7 +1253,7 @@ parseInterfaceTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool,
PROTECT(t, name);
GcClass* interface = resolveClass
(t, class_->loader(), name, true, throwType);
(t, reinterpret_cast<object>(class_->loader()), name, true, throwType);
PROTECT(t, interface);
@ -1301,7 +1305,7 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
unsigned memberOffset = BytesPerWord;
if (class_->super()) {
memberOffset = classFixedSize(t, class_->super());
memberOffset = class_->super()->fixedSize();
}
unsigned count = s.read2();
@ -1377,10 +1381,10 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
flags,
0, // offset
0, // native ID
singletonObject(t, pool, name - 1),
singletonObject(t, pool, spec - 1),
addendum,
reinterpret_cast<object>(class_));
cast<GcByteArray>(t, singletonObject(t, pool, name - 1)),
cast<GcByteArray>(t, singletonObject(t, pool, spec - 1)),
cast<GcFieldAddendum>(t, addendum),
class_);
unsigned size = fieldSize(t, code);
if (flags & ACC_STATIC) {
@ -1474,13 +1478,13 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
}
}
class_->fixedSize() = pad(memberOffset);
class_->fixedSize() = memberOffset;
if (class_->super()
and memberOffset == classFixedSize(t, class_->super()))
and memberOffset == class_->super()->fixedSize())
{
set(t, reinterpret_cast<object>(class_), ClassObjectMask,
classObjectMask(t, class_->super()));
reinterpret_cast<object>(class_->super()->objectMask()));
} else {
object mask = reinterpret_cast<object>(makeIntArray
(t, ceilingDivide(class_->fixedSize(), 32 * BytesPerWord)));
@ -1488,11 +1492,11 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
object superMask = 0;
if (class_->super()) {
superMask = classObjectMask(t, class_->super());
superMask = reinterpret_cast<object>(class_->super()->objectMask());
if (superMask) {
memcpy(&intArrayBody(t, mask, 0),
&intArrayBody(t, superMask, 0),
ceilingDivide(classFixedSize(t, class_->super()),
ceilingDivide(class_->super()->fixedSize(),
32 * BytesPerWord)
* 4);
}
@ -1999,7 +2003,7 @@ addInterfaceMethods(Thread* t, GcClass* class_, GcHashMap* virtualMap,
method->name(),
method->spec(),
0,
reinterpret_cast<object>(class_),
class_,
0);
hashMapInsert(t,
@ -2042,7 +2046,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
if ((class_->flags() & ACC_INTERFACE) == 0) {
if (class_->super()) {
superVirtualTable = classVirtualTable(t, class_->super());
superVirtualTable = class_->super()->virtualTable();
}
if (superVirtualTable) {
@ -2207,10 +2211,10 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
if (UNLIKELY((class_->flags() & ACC_INTERFACE) == 0
and vm::strcmp
(reinterpret_cast<const int8_t*>("finalize"),
&byteArrayBody(t, method->name(), 0)) == 0
method->name()->body().begin()) == 0
and vm::strcmp
(reinterpret_cast<const int8_t*>("()V"),
&byteArrayBody(t, method->spec(), 0)) == 0
method->spec()->body().begin()) == 0
and (not emptyMethod(t, method))))
{
class_->vmFlags() |= HasFinalizerFlag;
@ -2219,13 +2223,13 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
method->offset() = i;
if (vm::strcmp(reinterpret_cast<const int8_t*>("<clinit>"),
&byteArrayBody(t, method->name(), 0)) == 0)
method->name()->body().begin()) == 0)
{
method->vmFlags() |= ClassInitFlag;
class_->vmFlags() |= NeedInitFlag;
} else if (vm::strcmp
(reinterpret_cast<const int8_t*>("<init>"),
&byteArrayBody(t, method->name(), 0)) == 0)
method->name()->body().begin()) == 0)
{
method->vmFlags() |= ConstructorFlag;
}
@ -2253,14 +2257,14 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
// inherit virtual table from superclass
set(t, reinterpret_cast<object>(class_), ClassVirtualTable, superVirtualTable);
if (classInterfaceTable(t, class_->super())
if (class_->super()->interfaceTable()
and arrayLength(t, class_->interfaceTable())
== arrayLength
(t, classInterfaceTable(t, class_->super())))
(t, class_->super()->interfaceTable()))
{
// inherit interface table from superclass
set(t, reinterpret_cast<object>(class_), ClassInterfaceTable,
classInterfaceTable(t, class_->super()));
class_->super()->interfaceTable());
} else {
populateInterfaceVtables = true;
}
@ -2411,9 +2415,9 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
object reference = reinterpret_cast<object>(makeInnerClassReference
(t,
inner ? referenceName(t, singletonObject(t, pool, inner - 1)) : 0,
outer ? referenceName(t, singletonObject(t, pool, outer - 1)) : 0,
name ? singletonObject(t, pool, name - 1) : 0,
cast<GcByteArray>(t, inner ? referenceName(t, singletonObject(t, pool, inner - 1)) : 0),
cast<GcByteArray>(t, outer ? referenceName(t, singletonObject(t, pool, outer - 1)) : 0),
cast<GcByteArray>(t, name ? singletonObject(t, pool, name - 1) : 0),
flags));
set(t, table, ArrayBody + (i * BytesPerWord), reference);
@ -2506,13 +2510,13 @@ updateBootstrapClass(Thread* t, GcClass* bootstrapClass, GcClass* class_)
bootstrapClass->vmFlags() |= class_->vmFlags();
bootstrapClass->flags() |= class_->flags();
set(t, reinterpret_cast<object>(bootstrapClass), ClassSuper, class_->super());
set(t, reinterpret_cast<object>(bootstrapClass), ClassInterfaceTable, class_->interfaceTable());
set(t, reinterpret_cast<object>(bootstrapClass), ClassVirtualTable, class_->virtualTable());
set(t, reinterpret_cast<object>(bootstrapClass), ClassFieldTable, class_->fieldTable());
set(t, reinterpret_cast<object>(bootstrapClass), ClassMethodTable, class_->methodTable());
set(t, reinterpret_cast<object>(bootstrapClass), ClassStaticTable, class_->staticTable());
set(t, reinterpret_cast<object>(bootstrapClass), ClassAddendum, class_->addendum());
set(t, reinterpret_cast<object>(bootstrapClass), ClassSuper, reinterpret_cast<object>(class_->super()));
set(t, reinterpret_cast<object>(bootstrapClass), ClassInterfaceTable, reinterpret_cast<object>(class_->interfaceTable()));
set(t, reinterpret_cast<object>(bootstrapClass), ClassVirtualTable, reinterpret_cast<object>(class_->virtualTable()));
set(t, reinterpret_cast<object>(bootstrapClass), ClassFieldTable, reinterpret_cast<object>(class_->fieldTable()));
set(t, reinterpret_cast<object>(bootstrapClass), ClassMethodTable, reinterpret_cast<object>(class_->methodTable()));
set(t, reinterpret_cast<object>(bootstrapClass), ClassStaticTable, reinterpret_cast<object>(class_->staticTable()));
set(t, reinterpret_cast<object>(bootstrapClass), ClassAddendum, reinterpret_cast<object>(class_->addendum()));
updateClassTables(t, bootstrapClass, class_);
}
@ -2532,7 +2536,7 @@ makeArrayClass(Thread* t, object loader, unsigned dimensions, object spec,
// make a stack trace for a ClassNotFoundException.
resolveSystemClass
(t, root(t, Machine::BootLoader),
type(t, GcJobject::Type)->name(), false);
reinterpret_cast<object>(type(t, GcJobject::Type)->name()), false);
}
object vtable = type(t, GcJobject::Type)->virtualTable();
@ -2544,7 +2548,7 @@ makeArrayClass(Thread* t, object loader, unsigned dimensions, object spec,
2 * BytesPerWord,
BytesPerWord,
dimensions,
type(t, GcArray::Type)->objectMask(),
reinterpret_cast<object>(type(t, GcArray::Type)->objectMask()),
spec,
0,
reinterpret_cast<object>(type(t, GcJobject::Type)),
@ -2579,7 +2583,7 @@ saveLoadedClass(Thread* t, object loader, GcClass* c)
hashMapInsert(t,
cast<GcHashMap>(t, classLoaderMap(t, loader)),
c->name(),
reinterpret_cast<object>(c->name()),
reinterpret_cast<object>(c),
byteArrayHash);
}
@ -2643,17 +2647,17 @@ makeArrayClass(Thread* t, object loader, object spec, bool throw_,
ACQUIRE(t, t->m->classLock);
GcClass* class_ = findLoadedClass(t, elementClass->loader(), spec);
GcClass* class_ = findLoadedClass(t, reinterpret_cast<object>(elementClass->loader()), spec);
if (class_) {
return class_;
}
class_ = makeArrayClass
(t, elementClass->loader(), dimensions, spec, reinterpret_cast<object>(elementClass));
(t, reinterpret_cast<object>(elementClass->loader()), dimensions, spec, reinterpret_cast<object>(elementClass));
PROTECT(t, class_);
saveLoadedClass(t, elementClass->loader(), class_);
saveLoadedClass(t, reinterpret_cast<object>(elementClass->loader()), class_);
return class_;
}
@ -2721,10 +2725,10 @@ bootClass(Thread* t, Gc::Type type, int superType, uint32_t objectMask,
if (objectMask) {
if (super
and super->objectMask()
and intArrayBody(t, super->objectMask(), 0)
and super->objectMask()->body()[0]
== static_cast<int32_t>(objectMask))
{
mask = vm::type(t, static_cast<Gc::Type>(superType))->objectMask();
mask = reinterpret_cast<object>(vm::type(t, static_cast<Gc::Type>(superType))->objectMask());
} else {
mask = reinterpret_cast<object>(makeIntArray(t, 1));
intArrayBody(t, mask, 0) = objectMask;
@ -3156,7 +3160,7 @@ updatePackageMap(Thread* t, GcClass* class_)
setRoot(t, Machine::PackageMap, reinterpret_cast<object>(makeHashMap(t, 0, 0)));
}
object className = class_->name();
object className = reinterpret_cast<object>(class_->name());
if ('[' != byteArrayBody(t, className, 0)) {
THREAD_RUNTIME_ARRAY
(t, char, packageName, byteArrayLength(t, className));
@ -3179,7 +3183,7 @@ updatePackageMap(Thread* t, GcClass* class_)
(t, cast<GcHashMap>(t, root(t, Machine::PackageMap)), key, byteArrayHash,
byteArrayEqual);
object source = class_->source();
object source = reinterpret_cast<object>(class_->source());
if (source) {
// note that we strip the "file:" prefix, since OpenJDK's
// Package.defineSystemPackage expects an unadorned filename:
@ -4115,7 +4119,7 @@ isAssignableFrom(Thread* t, GcClass* a, GcClass* b)
} else if ((a->vmFlags() & PrimitiveFlag)
== (b->vmFlags() & PrimitiveFlag))
{
for (; b; b = cast<GcClass>(t, b->super())) {
for (; b; b = b->super()) {
if (b == a) {
return true;
}
@ -4131,7 +4135,7 @@ instanceOf(Thread* t, GcClass* class_, object o)
if (o == 0) {
return false;
} else {
return isAssignableFrom(t, class_, reinterpret_cast<GcClass*>(objectClass(t, o)));
return isAssignableFrom(t, class_, objectClass(t, o));
}
}
@ -4273,8 +4277,7 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size,
0, // array dimensions
0, // runtime data index
0, // object mask
referenceName
(t, singletonObject(t, pool, name - 1)),
cast<GcByteArray>(t, referenceName(t, singletonObject(t, pool, name - 1))),
0, // source file
0, // super
0, // interfaces
@ -4283,7 +4286,7 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size,
0, // methods
0, // addendum
0, // static table
loader,
cast<GcClassLoader>(t, loader),
0, // source
0);// vtable length
PROTECT(t, class_);
@ -4324,17 +4327,17 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size,
class_->fixedSize(),
class_->arrayElementSize(),
class_->arrayDimensions(),
class_->objectMask(),
class_->name(),
class_->sourceFile(),
class_->super(),
class_->interfaceTable(),
class_->virtualTable(),
class_->fieldTable(),
class_->methodTable(),
class_->addendum(),
class_->staticTable(),
class_->loader(),
reinterpret_cast<object>(class_->objectMask()),
reinterpret_cast<object>(class_->name()),
reinterpret_cast<object>(class_->sourceFile()),
reinterpret_cast<object>(class_->super()),
reinterpret_cast<object>(class_->interfaceTable()),
reinterpret_cast<object>(class_->virtualTable()),
reinterpret_cast<object>(class_->fieldTable()),
reinterpret_cast<object>(class_->methodTable()),
reinterpret_cast<object>(class_->addendum()),
reinterpret_cast<object>(class_->staticTable()),
reinterpret_cast<object>(class_->loader()),
vtableLength);
PROTECT(t, real);
@ -4345,7 +4348,7 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size,
if (root(t, Machine::PoolMap)) {
object bootstrapClass = hashMapFind
(t, cast<GcHashMap>(t, root(t, Machine::BootstrapClassMap)), class_->name(),
(t, cast<GcHashMap>(t, root(t, Machine::BootstrapClassMap)), reinterpret_cast<object>(class_->name()),
byteArrayHash, byteArrayEqual);
hashMapInsert(
@ -4523,7 +4526,7 @@ resolveClass(Thread* t, object loader, object spec, bool throw_,
if (classLoaderClass->vmFlags() & BootstrapFlag) {
resolveSystemClass
(t, root(t, Machine::BootLoader),
classLoaderClass->name());
reinterpret_cast<object>(classLoaderClass->name()));
}
}
}
@ -4589,8 +4592,7 @@ resolveMethod(Thread* t, GcClass* class_, const char* methodName,
if (method == 0) {
throwNew(t, GcNoSuchMethodError::Type, "%s %s not found in %s",
methodName, methodSpec, &byteArrayBody
(t, class_->name(), 0));
methodName, methodSpec, class_->name()->body().begin());
} else {
return method;
}
@ -4613,13 +4615,13 @@ resolveField(Thread* t, GcClass* class_, const char* fieldName,
GcClass* c = class_;
PROTECT(t, c);
for (; c != 0 and field == 0; c = cast<GcClass>(t, c->super())) {
for (; c != 0 and field == 0; c = c->super()) {
field = findFieldInClass(t, c, name, spec);
}
if (field == 0) {
throwNew(t, GcNoSuchFieldError::Type, "%s %s not found in %s",
fieldName, fieldSpec, &byteArrayBody(t, class_->name(), 0));
fieldName, fieldSpec, class_->name()->body().begin());
} else {
return field;
}
@ -4673,7 +4675,7 @@ preInitClass(Thread* t, GcClass* c)
}
} else if (c->vmFlags() & InitErrorFlag) {
throwNew(t, GcNoClassDefFoundError::Type, "%s",
&byteArrayBody(t, c->name(), 0));
c->name()->body().begin());
} else {
c->vmFlags() |= InitFlag;
return true;
@ -4715,7 +4717,7 @@ initClass(Thread* t, GcClass* c)
{
PROTECT(t, c);
object super = c->super();
object super = reinterpret_cast<object>(c->super());
if (super) {
initClass(t, cast<GcClass>(t, super));
}
@ -4779,7 +4781,7 @@ object
makeObjectArray(Thread* t, GcClass* elementClass, unsigned count)
{
GcClass* arrayClass = resolveObjectArrayClass
(t, elementClass->loader(), reinterpret_cast<object>(elementClass));
(t, reinterpret_cast<object>(elementClass->loader()), reinterpret_cast<object>(elementClass));
PROTECT(t, arrayClass);
@ -4818,7 +4820,7 @@ findInHierarchyOrNull(Thread* t, GcClass* class_, object name, object spec,
}
if (o == 0) {
for (; o == 0 and class_; class_ = cast<GcClass>(t, class_->super())) {
for (; o == 0 and class_; class_ = class_->super()) {
o = find(t, class_, name, spec);
}
@ -5050,8 +5052,7 @@ printTrace(Thread* t, object exception)
logTrace(errorLog(t), "caused by: ");
}
logTrace(errorLog(t), "%s", &byteArrayBody
(t, objectClass(t, e)->name(), 0));
logTrace(errorLog(t), "%s", objectClass(t, e)->name()->body().begin());
if (throwableMessage(t, e)) {
object m = throwableMessage(t, e);
@ -5281,9 +5282,9 @@ getCaller(Thread* t, unsigned target, bool skipMethodInvoke)
virtual bool visit(Processor::StackWalker* walker) {
if (skipMethodInvoke
and cast<GcClass>(t, walker->method()->class_())
and walker->method()->class_()
== type(t, GcJmethod::Type)
and strcmp(&byteArrayBody(t, walker->method()->name(), 0),
and strcmp(walker->method()->name()->body().begin(),
reinterpret_cast<const int8_t*>("invoke")) == 0) {
return true;
}
@ -5348,7 +5349,7 @@ populateMultiArray(Thread* t, object array, int32_t* counts,
PROTECT(t, array);
object spec = objectClass(t, array)->name();
object spec = reinterpret_cast<object>(objectClass(t, array)->name());
PROTECT(t, spec);
object elementSpec = reinterpret_cast<object>(makeByteArray(t, byteArrayLength(t, spec) - 1));
@ -5357,7 +5358,7 @@ populateMultiArray(Thread* t, object array, int32_t* counts,
byteArrayLength(t, spec) - 1);
GcClass* class_ = resolveClass
(t, objectClass(t, array)->loader(), elementSpec);
(t, reinterpret_cast<object>(objectClass(t, array)->loader()), elementSpec);
PROTECT(t, class_);
for (int32_t i = 0; i < counts[index]; ++i) {
@ -5449,10 +5450,8 @@ vmfPrintTrace(Thread* t, FILE* out)
Visitor(Thread* t, FILE* out): t(t), out(out) { }
virtual bool visit(Processor::StackWalker* walker) {
const int8_t* class_ = &byteArrayBody
(t, className(t, walker->method()->class_()), 0);
const int8_t* method = &byteArrayBody
(t, walker->method()->name(), 0);
const int8_t* class_ = walker->method()->class_()->name()->body().begin();
const int8_t* method = walker->method()->name()->body().begin();
int line = t->m->processor->lineNumber
(t, walker->method(), walker->ip());

View File

@ -71,14 +71,14 @@ jniNameLength(Thread* t, GcMethod* method, bool decorate)
{
unsigned size = 0;
object className = ::className(t, method->class_());
object className = reinterpret_cast<object>(method->class_()->name());
for (unsigned i = 0; i < byteArrayLength(t, className) - 1; ++i) {
size += mangledSize(byteArrayBody(t, className, i));
}
++ size;
object methodName = method->name();
object methodName = reinterpret_cast<object>(method->name());
for (unsigned i = 0; i < byteArrayLength(t, methodName) - 1; ++i) {
size += mangledSize(byteArrayBody(t, methodName, i));
}
@ -86,7 +86,7 @@ jniNameLength(Thread* t, GcMethod* method, bool decorate)
if (decorate) {
size += 2;
object methodSpec = method->spec();
object methodSpec = reinterpret_cast<object>(method->spec());
for (unsigned i = 1; i < byteArrayLength(t, methodSpec) - 1
and byteArrayBody(t, methodSpec, i) != ')'; ++i)
{
@ -104,14 +104,14 @@ makeJNIName(Thread* t, const char* prefix, unsigned prefixLength, char* name,
memcpy(name, prefix, prefixLength);
name += prefixLength;
object className = ::className(t, method->class_());
object className = reinterpret_cast<object>(method->class_()->name());
for (unsigned i = 0; i < byteArrayLength(t, className) - 1; ++i) {
name += mangle(byteArrayBody(t, className, i), name);
}
*(name++) = '_';
object methodName = method->name();
object methodName = reinterpret_cast<object>(method->name());
for (unsigned i = 0; i < byteArrayLength(t, methodName) - 1; ++i) {
name += mangle(byteArrayBody(t, methodName, i), name);
}
@ -120,7 +120,7 @@ makeJNIName(Thread* t, const char* prefix, unsigned prefixLength, char* name,
*(name++) = '_';
*(name++) = '_';
object methodSpec = method->spec();
object methodSpec = reinterpret_cast<object>(method->spec());
for (unsigned i = 1; i < byteArrayLength(t, methodSpec) - 1
and byteArrayBody(t, methodSpec, i) != ')'; ++i)
{
@ -232,15 +232,15 @@ resolveNative(Thread* t, GcMethod* method)
assertT(t, method->flags() & ACC_NATIVE);
initClass(t, cast<GcClass>(t, method->class_()));
initClass(t, method->class_());
if (methodRuntimeDataNative(t, getMethodRuntimeData(t, method)) == 0) {
object native = resolveNativeMethod(t, method);
if (UNLIKELY(native == 0)) {
throwNew(t, GcUnsatisfiedLinkError::Type, "%s.%s%s",
&byteArrayBody(t, className(t, method->class_()), 0),
&byteArrayBody(t, method->name(), 0),
&byteArrayBody(t, method->spec(), 0));
method->class_()->name()->body().begin(),
method->name()->body().begin(),
method->spec()->body().begin());
}
PROTECT(t, native);

View File

@ -618,13 +618,11 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
if (((methodName == 0
or ::strcmp
(reinterpret_cast<char*>
(&byteArrayBody
(t, method->name(), 0)), methodName) == 0)
(method->name()->body().begin()), methodName) == 0)
and (methodSpec == 0
or ::strcmp
(reinterpret_cast<char*>
(&byteArrayBody
(t, method->spec(), 0)), methodSpec)
(method->spec()->body().begin()), methodSpec)
== 0)))
{
if (method->code()
@ -640,26 +638,26 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
}
}
object addendum = method->addendum();
if (addendum and methodAddendumExceptionTable(t, addendum)) {
GcMethodAddendum* addendum = method->addendum();
if (addendum and addendum->exceptionTable()) {
PROTECT(t, addendum);
// resolve exception types now to avoid trying to update
// immutable references at runtime
for (unsigned i = 0; i < shortArrayLength
(t, methodAddendumExceptionTable(t, addendum)); ++i)
(t, addendum->exceptionTable()); ++i)
{
uint16_t index = shortArrayBody
(t, methodAddendumExceptionTable(t, addendum), i) - 1;
(t, addendum->exceptionTable(), i) - 1;
object o = singletonObject
(t, cast<GcSingleton>(t, addendumPool(t, addendum)), index);
(t, cast<GcSingleton>(t, addendum->pool()), index);
if (objectClass(t, o) == type(t, GcReference::Type)) {
o = reinterpret_cast<object>(resolveClass
(t, root(t, Machine::BootLoader), referenceName(t, o)));
set(t, addendumPool(t, addendum),
set(t, addendum->pool(),
SingletonBody + (index * BytesPerWord), o);
}
}

View File

@ -7,7 +7,9 @@
There is NO WARRANTY for this software. See license.txt for
details. */
#include <string>
#include "assert.h"
#ifndef AVIAN_TOOLS_TYPE_GENERATOR_IO_H
@ -101,7 +103,7 @@ class Output {
virtual void dispose() = 0;
virtual void write(const char* s) = 0;
virtual void write(const std::string& s) = 0;
void write(int i) {
static const int Size = 32;
@ -133,8 +135,8 @@ class FileOutput : public Output {
}
}
virtual void write(const char* s) {
fputs(s, stream);
virtual void write(const std::string& s) {
fputs(s.c_str(), stream);
}
const char* filename() {

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,6 @@ class Object {
Method,
Type,
Pair,
Number,
Character,
String,
Eos