mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
touch up type safety in types.def
This commit is contained in:
parent
c796bdbde4
commit
a1583f1ecc
@ -58,20 +58,20 @@ Java_java_net_Socket_closeInput(JNIEnv* e, jclass, SOCKET sock) {
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Avian_java_net_Socket_send(vm::Thread* t, vm::object, uintptr_t* arguments) { /* SOCKET s, object buffer_obj, int start_pos, int count */
|
||||
SOCKET& s = *(reinterpret_cast<SOCKET*>(&arguments[0]));
|
||||
vm::object buffer_obj = reinterpret_cast<vm::object>(arguments[2]);
|
||||
vm::GcByteArray* buffer_obj = vm::cast<vm::GcByteArray>(t, reinterpret_cast<vm::object>(arguments[2]));
|
||||
int32_t& start_pos = *(reinterpret_cast<int32_t*>(&arguments[3]));
|
||||
int32_t& count = *(reinterpret_cast<int32_t*>(&arguments[4]));
|
||||
char* buffer = reinterpret_cast<char*>(&vm::byteArrayBody(t, buffer_obj, start_pos));
|
||||
char* buffer = reinterpret_cast<char*>(&buffer_obj->body()[start_pos]);
|
||||
avian::classpath::sockets::send((JNIEnv*)t, s, buffer, count);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
Avian_java_net_Socket_recv(vm::Thread* t, vm::object, uintptr_t* arguments) { /* SOCKET s, object buffer_obj, int start_pos, int count */
|
||||
SOCKET& s = *(reinterpret_cast<SOCKET*>(&arguments[0]));
|
||||
vm::object buffer_obj = reinterpret_cast<vm::object>(arguments[2]);
|
||||
vm::GcByteArray* buffer_obj = vm::cast<vm::GcByteArray>(t, reinterpret_cast<vm::object>(arguments[2]));
|
||||
int32_t& start_pos = *(reinterpret_cast<int32_t*>(&arguments[3]));
|
||||
int32_t& count = *(reinterpret_cast<int32_t*>(&arguments[4]));
|
||||
char* buffer = reinterpret_cast<char*>(&vm::byteArrayBody(t, buffer_obj, start_pos));
|
||||
char* buffer = reinterpret_cast<char*>(&buffer_obj->body()[start_pos]);
|
||||
return avian::classpath::sockets::recv((JNIEnv*)t, s, buffer, count);
|
||||
}
|
||||
|
||||
|
@ -497,7 +497,7 @@ resolveExceptionJTypes(Thread* t, GcClassLoader* loader, GcMethodAddendum* adden
|
||||
|
||||
o = reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, o)));
|
||||
|
||||
set(t, array, ArrayBody + (i * BytesPerWord), o);
|
||||
set(t, reinterpret_cast<object>(array), ArrayBody + (i * BytesPerWord), o);
|
||||
}
|
||||
|
||||
return array;
|
||||
|
@ -1356,7 +1356,6 @@ vmRun_returnAddress();
|
||||
class GcThread;
|
||||
class GcThrowable;
|
||||
class GcString;
|
||||
class GcField;
|
||||
|
||||
class Thread {
|
||||
public:
|
||||
|
@ -327,10 +327,10 @@ class MyClasspath : public Classpath {
|
||||
{
|
||||
return cast<GcMethod>(t, objectClass(t, jmethod) == type(t, GcJmethod::Type)
|
||||
? arrayBody
|
||||
(t, jclassVmClass(t, jmethodDeclaringClass(t, jmethod))->methodTable(),
|
||||
(t, jmethodDeclaringClass(t, jmethod)->vmClass()->methodTable(),
|
||||
jmethodSlot(t, jmethod))
|
||||
: arrayBody
|
||||
(t,jclassVmClass(t, jconstructorDeclaringClass(t, jmethod))->methodTable(),
|
||||
(t, jconstructorDeclaringClass(t, jmethod)->vmClass()->methodTable(),
|
||||
jconstructorSlot(t, jmethod)));
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ class MyClasspath : public Classpath {
|
||||
getVMField(Thread* t, object jfield)
|
||||
{
|
||||
return cast<GcField>(t, arrayBody
|
||||
(t, jclassVmClass(t, jfieldDeclaringClass(t, jfield))->fieldTable(),
|
||||
(t, jfieldDeclaringClass(t, jfield)->vmClass()->fieldTable(),
|
||||
jfieldSlot(t, jfield)));
|
||||
}
|
||||
|
||||
@ -1402,7 +1402,7 @@ Avian_sun_misc_Unsafe_objectFieldOffset
|
||||
object jfield = reinterpret_cast<object>(arguments[1]);
|
||||
return fieldOffset
|
||||
(t, arrayBody
|
||||
(t, jclassVmClass(t, jfieldDeclaringClass(t, jfield))->fieldTable(),
|
||||
(t, jfieldDeclaringClass(t, jfield)->vmClass()->fieldTable(),
|
||||
jfieldSlot(t, jfield)));
|
||||
}
|
||||
|
||||
@ -1878,9 +1878,9 @@ Avian_java_lang_reflect_Method_isAnnotationPresent
|
||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->methodTable(),
|
||||
arguments[1]);
|
||||
|
||||
object addendum = methodAddendum(t, method);
|
||||
GcMethodAddendum* addendum = methodAddendum(t, method);
|
||||
if (addendum) {
|
||||
object table = addendumAnnotationTable(t, addendum);
|
||||
object table = addendum->annotationTable();
|
||||
if (table) {
|
||||
for (unsigned i = 0; i < objectArrayLength(t, table); ++i) {
|
||||
if (objectArrayBody(t, objectArrayBody(t, table, i), 1)
|
||||
@ -1903,9 +1903,9 @@ Avian_java_lang_reflect_Method_getAnnotation
|
||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->methodTable(),
|
||||
arguments[1]);
|
||||
|
||||
object addendum = methodAddendum(t, method);
|
||||
GcMethodAddendum* addendum = methodAddendum(t, method);
|
||||
if (addendum) {
|
||||
object table = addendumAnnotationTable(t, addendum);
|
||||
object table = addendum->annotationTable();
|
||||
if (table) {
|
||||
for (unsigned i = 0; i < objectArrayLength(t, table); ++i) {
|
||||
if (objectArrayBody(t, objectArrayBody(t, table, i), 1)
|
||||
@ -1921,7 +1921,7 @@ Avian_java_lang_reflect_Method_getAnnotation
|
||||
|
||||
return reinterpret_cast<uintptr_t>
|
||||
(t->m->processor->invoke
|
||||
(t, get, 0, classLoader(t, methodClass(t, method)),
|
||||
(t, get, 0, methodClass(t, method)->loader(),
|
||||
objectArrayBody(t, table, i)));
|
||||
}
|
||||
}
|
||||
@ -1939,9 +1939,9 @@ Avian_java_lang_reflect_Method_getDeclaredAnnotations
|
||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->methodTable(),
|
||||
arguments[1]);
|
||||
|
||||
object addendum = methodAddendum(t, method);
|
||||
GcMethodAddendum* addendum = methodAddendum(t, method);
|
||||
if (addendum) {
|
||||
object table = addendumAnnotationTable(t, addendum);
|
||||
object table = addendum->annotationTable();
|
||||
if (table) {
|
||||
PROTECT(t, method);
|
||||
PROTECT(t, table);
|
||||
@ -1960,7 +1960,7 @@ Avian_java_lang_reflect_Method_getDeclaredAnnotations
|
||||
|
||||
for (unsigned i = 0; i < objectArrayLength(t, table); ++i) {
|
||||
object a = t->m->processor->invoke
|
||||
(t, get, 0, classLoader(t, methodClass(t, method)),
|
||||
(t, get, 0, methodClass(t, method)->loader(),
|
||||
objectArrayBody(t, table, i));
|
||||
|
||||
set(t, array, ArrayBody + (i * BytesPerWord), a);
|
||||
@ -1987,9 +1987,9 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->fieldTable(),
|
||||
arguments[1]));
|
||||
|
||||
object addendum = reinterpret_cast<object>(field->addendum());
|
||||
GcFieldAddendum* addendum = field->addendum();
|
||||
if (addendum) {
|
||||
object table = addendumAnnotationTable(t, addendum);
|
||||
object table = addendum->annotationTable();
|
||||
if (table) {
|
||||
PROTECT(t, field);
|
||||
PROTECT(t, table);
|
||||
@ -2040,7 +2040,7 @@ Avian_java_lang_reflect_Method_getDefaultValue
|
||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))->methodTable(),
|
||||
arguments[2]);
|
||||
|
||||
object addendum = methodAddendum(t, method);
|
||||
GcMethodAddendum* addendum = methodAddendum(t, method);
|
||||
if (addendum) {
|
||||
GcMethod* get = resolveMethod
|
||||
(t, cast<GcClassLoader>(t, root(t, Machine::BootLoader)), "avian/Classes",
|
||||
@ -2050,7 +2050,7 @@ Avian_java_lang_reflect_Method_getDefaultValue
|
||||
|
||||
return reinterpret_cast<uintptr_t>
|
||||
(t->m->processor->invoke
|
||||
(t, get, 0, classLoader(t, methodClass(t, method)), addendum));
|
||||
(t, get, 0, methodClass(t, method)->loader(), addendum));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -2180,9 +2180,9 @@ Avian_java_lang_reflect_Field_getAnnotation
|
||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->fieldTable(),
|
||||
arguments[1]));
|
||||
|
||||
object addendum = reinterpret_cast<object>(field->addendum());
|
||||
GcFieldAddendum* addendum = field->addendum();
|
||||
if (addendum) {
|
||||
object table = addendumAnnotationTable(t, addendum);
|
||||
object table = addendum->annotationTable();
|
||||
if (table) {
|
||||
for (unsigned i = 0; i < objectArrayLength(t, table); ++i) {
|
||||
if (objectArrayBody(t, objectArrayBody(t, table, i), 1)
|
||||
|
@ -351,7 +351,7 @@ object
|
||||
makeJconstructor(Thread* t, GcMethod* vmMethod, int index = -1);
|
||||
|
||||
object
|
||||
makeJfield(Thread* t, object vmField, int index = -1);
|
||||
makeJfield(Thread* t, GcField* vmField, int index = -1);
|
||||
|
||||
#ifdef AVIAN_OPENJDK_SRC
|
||||
void
|
||||
@ -593,24 +593,24 @@ class MyClasspath : public Classpath {
|
||||
{
|
||||
return cast<GcMethod>(t, objectClass(t, jmethod) == type(t, GcJmethod::Type)
|
||||
? arrayBody
|
||||
(t, jclassVmClass(t, jmethodClazz(t, jmethod))->methodTable(),
|
||||
(t, jmethodClazz(t, jmethod)->vmClass()->methodTable(),
|
||||
jmethodSlot(t, jmethod))
|
||||
: arrayBody
|
||||
(t, jclassVmClass(t, jconstructorClazz(t, jmethod))->methodTable(),
|
||||
(t, jconstructorClazz(t, jmethod)->vmClass()->methodTable(),
|
||||
jconstructorSlot(t, jmethod)));
|
||||
}
|
||||
|
||||
virtual object
|
||||
makeJField(Thread* t, GcField* vmField)
|
||||
{
|
||||
return reinterpret_cast<object>(makeJfield(t, reinterpret_cast<object>(vmField)));
|
||||
return reinterpret_cast<object>(makeJfield(t, vmField));
|
||||
}
|
||||
|
||||
virtual GcField*
|
||||
getVMField(Thread* t, object jfield)
|
||||
{
|
||||
return cast<GcField>(t, arrayBody
|
||||
(t, jclassVmClass(t, jfieldClazz(t, jfield))->fieldTable(), jfieldSlot(t, jfield)));
|
||||
(t, jfieldClazz(t, jfield)->vmClass()->fieldTable(), jfieldSlot(t, jfield)));
|
||||
}
|
||||
|
||||
virtual void
|
||||
@ -2136,8 +2136,8 @@ countFields(Thread* t, GcClass* c, bool publicOnly)
|
||||
if (publicOnly) {
|
||||
unsigned count = 0;
|
||||
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
|
||||
object vmField = arrayBody(t, table, i);
|
||||
if (fieldFlags(t, vmField) & ACC_PUBLIC) {
|
||||
GcField* vmField = cast<GcField>(t, arrayBody(t, table, i));
|
||||
if (vmField->flags() & ACC_PUBLIC) {
|
||||
++ count;
|
||||
}
|
||||
}
|
||||
@ -2387,30 +2387,29 @@ makeJconstructor(Thread* t, GcMethod* vmMethod, int index)
|
||||
}
|
||||
|
||||
object
|
||||
makeJfield(Thread* t, object vmField, int index)
|
||||
makeJfield(Thread* t, GcField* vmField, int index)
|
||||
{
|
||||
PROTECT(t, vmField);
|
||||
|
||||
object name = intern
|
||||
(t, reinterpret_cast<object>(t->m->classpath->makeString
|
||||
(t, fieldName(t, vmField), 0, byteArrayLength
|
||||
(t, fieldName(t, vmField)) - 1)));
|
||||
(t, reinterpret_cast<object>(vmField->name()), 0, vmField->name()->length() - 1)));
|
||||
PROTECT(t, name);
|
||||
|
||||
GcClass* type = resolveClassBySpec
|
||||
(t, cast<GcClassLoader>(t, classLoader(t, fieldClass(t, vmField))),
|
||||
(t, vmField->class_()->loader(),
|
||||
reinterpret_cast<char*>
|
||||
(&byteArrayBody(t, fieldSpec(t, vmField), 0)),
|
||||
byteArrayLength(t, fieldSpec(t, vmField)) - 1);
|
||||
(vmField->spec()->body().begin()),
|
||||
vmField->spec()->length() - 1);
|
||||
PROTECT(t, type);
|
||||
|
||||
GcJclass* jtype = getJClass(t, type);
|
||||
|
||||
object signature;
|
||||
object annotationTable;
|
||||
object addendum = fieldAddendum(t, vmField);
|
||||
GcFieldAddendum* addendum = vmField->addendum();
|
||||
if (addendum) {
|
||||
signature = addendumSignature(t, addendum);
|
||||
signature = addendum->signature();
|
||||
if (signature) {
|
||||
PROTECT(t, addendum);
|
||||
|
||||
@ -2418,7 +2417,7 @@ makeJfield(Thread* t, object vmField, int index)
|
||||
(t, signature, 0, byteArrayLength(t, signature) - 1));
|
||||
}
|
||||
|
||||
annotationTable = addendumAnnotationTable(t, addendum);
|
||||
annotationTable = addendum->annotationTable();
|
||||
} else {
|
||||
signature = 0;
|
||||
annotationTable = 0;
|
||||
@ -2428,16 +2427,16 @@ makeJfield(Thread* t, object vmField, int index)
|
||||
PROTECT(t, annotationTable);
|
||||
|
||||
if (annotationTable) {
|
||||
GcClassRuntimeData* runtimeData = getClassRuntimeData(t, cast<GcClass>(t, fieldClass(t, vmField)));
|
||||
GcClassRuntimeData* runtimeData = getClassRuntimeData(t, vmField->class_());
|
||||
|
||||
set(t, reinterpret_cast<object>(runtimeData), ClassRuntimeDataPool,
|
||||
addendumPool(t, fieldAddendum(t, vmField)));
|
||||
set(t, runtimeData, ClassRuntimeDataPool,
|
||||
vmField->addendum()->pool());
|
||||
}
|
||||
|
||||
if (index == -1) {
|
||||
object table = classFieldTable(t, fieldClass(t, vmField));
|
||||
object table = vmField->class_()->fieldTable();
|
||||
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
|
||||
if (vmField == arrayBody(t, table, i)) {
|
||||
if (reinterpret_cast<object>(vmField) == arrayBody(t, table, i)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
@ -2446,11 +2445,10 @@ makeJfield(Thread* t, object vmField, int index)
|
||||
|
||||
expect(t, index != -1);
|
||||
|
||||
GcJclass* jclass = getJClass(t, cast<GcClass>(t, fieldClass(t, vmField)));
|
||||
GcJclass* jclass = getJClass(t, vmField->class_());
|
||||
|
||||
return reinterpret_cast<object>(makeJfield
|
||||
(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));
|
||||
(t, true, 0, jclass, index, cast<GcString>(t, name), jtype, vmField->flags(), cast<GcString>(t, signature), 0, cast<GcByteArray>(t, annotationTable), 0, 0, 0, 0));
|
||||
}
|
||||
|
||||
void
|
||||
@ -2595,7 +2593,7 @@ Avian_sun_misc_Unsafe_staticFieldOffset
|
||||
object jfield = reinterpret_cast<object>(arguments[1]);
|
||||
return fieldOffset
|
||||
(t, arrayBody
|
||||
(t, jclassVmClass(t, jfieldClazz(t, jfield))->fieldTable(), jfieldSlot(t, jfield)));
|
||||
(t, jfieldClazz(t, jfield)->vmClass()->fieldTable(), jfieldSlot(t, jfield)));
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
@ -2603,8 +2601,7 @@ Avian_sun_misc_Unsafe_staticFieldBase
|
||||
(Thread* t, object, uintptr_t* arguments)
|
||||
{
|
||||
return reinterpret_cast<int64_t>
|
||||
(jclassVmClass
|
||||
(t, jfieldClazz(t, reinterpret_cast<object>(arguments[1])))->staticTable());
|
||||
(jfieldClazz(t, reinterpret_cast<object>(arguments[1]))->vmClass()->staticTable());
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
@ -2614,7 +2611,7 @@ Avian_sun_misc_Unsafe_objectFieldOffset
|
||||
object jfield = reinterpret_cast<object>(arguments[1]);
|
||||
return fieldOffset
|
||||
(t, arrayBody
|
||||
(t, jclassVmClass(t, jfieldClazz(t, jfield))->fieldTable(), jfieldSlot(t, jfield)));
|
||||
(t, jfieldClazz(t, jfield)->vmClass()->fieldTable(), jfieldSlot(t, jfield)));
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
@ -3487,10 +3484,8 @@ jvmGetClassContext(Thread* t, uintptr_t*)
|
||||
for (unsigned i = 0; i < objectArrayLength(t, trace); ++i) {
|
||||
object c = reinterpret_cast<object>(getJClass(
|
||||
t,
|
||||
cast<GcClass>(
|
||||
t,
|
||||
methodClass(t,
|
||||
traceElementMethod(t, objectArrayBody(t, trace, i))))));
|
||||
methodClass(t,
|
||||
traceElementMethod(t, objectArrayBody(t, trace, i)))));
|
||||
|
||||
set(t, context, ArrayBody + (i * BytesPerWord), c);
|
||||
}
|
||||
@ -3902,7 +3897,7 @@ jvmFindClassFromClassLoader(Thread* t, uintptr_t* arguments)
|
||||
|
||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||
EXPORT(JVM_FindClassFromClassLoader)(Thread* t, const char* name,
|
||||
jboolean init, jobject* loader,
|
||||
jboolean init, jobject loader,
|
||||
jboolean throwError)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(name),
|
||||
@ -3944,7 +3939,7 @@ jvmFindLoadedClass(Thread* t, uintptr_t* arguments)
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||
EXPORT(JVM_FindLoadedClass)(Thread* t, jobject* loader, jstring name)
|
||||
EXPORT(JVM_FindLoadedClass)(Thread* t, jobject loader, jstring name)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(loader),
|
||||
reinterpret_cast<uintptr_t>(name) };
|
||||
@ -3965,7 +3960,7 @@ jvmDefineClass(Thread* t, uintptr_t* arguments)
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||
EXPORT(JVM_DefineClass)(Thread* t, const char*, jobject* loader,
|
||||
EXPORT(JVM_DefineClass)(Thread* t, const char*, jobject loader,
|
||||
const uint8_t* data, jsize length, jobject)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(loader),
|
||||
@ -3976,7 +3971,7 @@ EXPORT(JVM_DefineClass)(Thread* t, const char*, jobject* loader,
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||
EXPORT(JVM_DefineClassWithSource)(Thread* t, const char*, jobject* loader,
|
||||
EXPORT(JVM_DefineClassWithSource)(Thread* t, const char*, jobject loader,
|
||||
const uint8_t* data, jsize length, jobject,
|
||||
const char*)
|
||||
{
|
||||
@ -3984,7 +3979,7 @@ EXPORT(JVM_DefineClassWithSource)(Thread* t, const char*, jobject* loader,
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||
EXPORT(JVM_DefineClassWithSourceCond)(Thread* t, const char*, jobject* loader,
|
||||
EXPORT(JVM_DefineClassWithSourceCond)(Thread* t, const char*, jobject loader,
|
||||
const uint8_t* data, jsize length,
|
||||
jobject, const char*, jboolean)
|
||||
{
|
||||
@ -4329,10 +4324,10 @@ jvmGetClassDeclaredFields(Thread* t, uintptr_t* arguments)
|
||||
|
||||
unsigned ai = 0;
|
||||
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
|
||||
object vmField = arrayBody(t, table, i);
|
||||
GcField* vmField = cast<GcField>(t, arrayBody(t, table, i));
|
||||
PROTECT(t, vmField);
|
||||
|
||||
if ((not publicOnly) or (fieldFlags(t, vmField) & ACC_PUBLIC)) {
|
||||
if ((not publicOnly) or (vmField->flags() & ACC_PUBLIC)) {
|
||||
object field = makeJfield(t, vmField, i);
|
||||
|
||||
assertT(t, ai < objectArrayLength(t, array));
|
||||
@ -4428,7 +4423,7 @@ jvmInvokeMethod(Thread* t, uintptr_t* arguments)
|
||||
jobjectArray args = reinterpret_cast<jobjectArray>(arguments[2]);
|
||||
|
||||
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody
|
||||
(t, jclassVmClass(t, jmethodClazz(t, *method))->methodTable(),
|
||||
(t, jmethodClazz(t, *method)->vmClass()->methodTable(),
|
||||
jmethodSlot(t, *method)));
|
||||
|
||||
if (vmMethod->flags() & ACC_STATIC) {
|
||||
@ -4463,11 +4458,11 @@ jvmNewInstanceFromConstructor(Thread* t, uintptr_t* arguments)
|
||||
jobjectArray args = reinterpret_cast<jobjectArray>(arguments[1]);
|
||||
|
||||
object instance = make
|
||||
(t, jclassVmClass(t, jconstructorClazz(t, *constructor)));
|
||||
(t, jconstructorClazz(t, *constructor)->vmClass());
|
||||
PROTECT(t, instance);
|
||||
|
||||
GcMethod* method = cast<GcMethod>(t, arrayBody
|
||||
(t, jclassVmClass(t, jconstructorClazz(t, *constructor))->methodTable(),
|
||||
(t, jconstructorClazz(t, *constructor)->vmClass()->methodTable(),
|
||||
jconstructorSlot(t, *constructor)));
|
||||
|
||||
invoke(t, method, reinterpret_cast<object>(instance), args ? reinterpret_cast<object>(*args) : 0);
|
||||
|
@ -7519,7 +7519,7 @@ walkContinuationBody(MyThread* t, Heap::Walker* w, GcContinuation* c, int start)
|
||||
{
|
||||
const int BodyOffset = ContinuationBody / BytesPerWord;
|
||||
|
||||
GcMethod* method = cast<GcMethod>(t, reinterpret_cast<object>(t->m->heap->follow(c->method())));
|
||||
GcMethod* method = t->m->heap->follow(c->method());
|
||||
int count = frameMapSizeInBits(t, method);
|
||||
|
||||
if (count) {
|
||||
|
@ -122,13 +122,13 @@ int printInstruction(uint8_t* code, unsigned& ip, const char* prefix)
|
||||
return fprintf(stderr, "drem");
|
||||
case dsub:
|
||||
return fprintf(stderr, "dsub");
|
||||
case dup:
|
||||
case vm::dup:
|
||||
return fprintf(stderr, "dup");
|
||||
case dup_x1:
|
||||
return fprintf(stderr, "dup_x1");
|
||||
case dup_x2:
|
||||
return fprintf(stderr, "dup_x2");
|
||||
case dup2:
|
||||
case vm::dup2:
|
||||
return fprintf(stderr, "dup2");
|
||||
case dup2_x1:
|
||||
return fprintf(stderr, "dup2_x1");
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <avian/util/string.h>
|
||||
#include <avian/util/runtime-array.h>
|
||||
#include <avian/util/list.h>
|
||||
#include <avian/util/slice.h>
|
||||
#include <avian/util/hash.h>
|
||||
|
||||
#include "avian/zlib-custom.h"
|
||||
@ -285,7 +284,7 @@ class JarIndex {
|
||||
|
||||
while (p < end) {
|
||||
if (signature(p) == EntrySignature) {
|
||||
index = index->add(Entry(hash(avian::util::Slice<const uint8_t>(reinterpret_cast<const uint8_t*>(fileName(p)), fileNameLength(p))), p));
|
||||
index = index->add(Entry(hash(Slice<const uint8_t>(fileName(p), fileNameLength(p))), p));
|
||||
|
||||
p = endOfEntry(p);
|
||||
} else {
|
||||
|
@ -843,56 +843,42 @@ writeOffset(Output* out, Class* cl)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
writeAccessorName(Output* out, Class* cl, Field& field)
|
||||
{
|
||||
out->write(cl->name);
|
||||
out->write(capitalize(field.name));
|
||||
std::string cppClassName(Class* cl) {
|
||||
if(cl->name == "jobject") {
|
||||
return "object";
|
||||
} else {
|
||||
return "Gc" + capitalize(cl->name) + "*";
|
||||
}
|
||||
}
|
||||
|
||||
void writeFieldType(Output* out, Module& module, Field& f) {
|
||||
std::string cppFieldType(Module& module, Field& f) {
|
||||
if(f.javaSpec.size() != 0) {
|
||||
if(f.javaSpec[0] == 'L') {
|
||||
std::string className = f.javaSpec.substr(1, f.javaSpec.size() - 2);
|
||||
std::map<std::string, Class*>::iterator it = module.javaClasses.find(className);
|
||||
if(it != module.javaClasses.end()) {
|
||||
if(it->second->name == "jobject") {
|
||||
// TEMPORARY HACK!
|
||||
out->write("object");
|
||||
} else {
|
||||
out->write("Gc");
|
||||
out->write(capitalize(it->second->name));
|
||||
out->write("*");
|
||||
}
|
||||
return;
|
||||
return cppClassName(it->second);
|
||||
}
|
||||
} else if(f.javaSpec[0] == '[') {
|
||||
std::map<std::string, Class*>::iterator it = module.javaClasses.find(f.javaSpec);
|
||||
if(it != module.javaClasses.end()) {
|
||||
out->write("Gc");
|
||||
out->write(capitalize(it->second->name));
|
||||
out->write("*");
|
||||
return;
|
||||
return cppClassName(it->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::map<std::string, Class*>::iterator it = module.classes.find(f.typeName);
|
||||
assert(f.typeName.size() > 0);
|
||||
if(it != module.classes.end()) {
|
||||
out->write("Gc");
|
||||
out->write(capitalize(it->second->name));
|
||||
out->write("*");
|
||||
return cppClassName(it->second);
|
||||
} else {
|
||||
out->write(f.typeName);
|
||||
return f.typeName;
|
||||
}
|
||||
}
|
||||
|
||||
void writeSimpleFieldType(Output* out, Module& module, Field& f) {
|
||||
if(f.javaSpec.size() != 0 && (f.javaSpec[0] == 'L' || f.javaSpec[0] == '[')) {
|
||||
out->write("object");
|
||||
} else {
|
||||
writeFieldType(out, module, f);
|
||||
}
|
||||
void writeAccessorName(Output* out, Class* cl, Field& field)
|
||||
{
|
||||
out->write(cl->name);
|
||||
out->write(capitalize(field.name));
|
||||
}
|
||||
|
||||
void
|
||||
@ -918,7 +904,7 @@ writeAccessor(Output* out, Module& module, Class* cl, Field& field, bool isArray
|
||||
// out->write(take(strlen(typeName) - 3, typeName));
|
||||
// out->write("*");
|
||||
// } else {
|
||||
writeSimpleFieldType(out, module, field);
|
||||
out->write(cppFieldType(module, field));
|
||||
out->write("&");
|
||||
// }
|
||||
|
||||
@ -950,7 +936,7 @@ writeAccessor(Output* out, Module& module, Class* cl, Field& field, bool isArray
|
||||
// out->write(take(strlen(typeName) - 3, typeName));
|
||||
// out->write("*");
|
||||
// } else {
|
||||
writeSimpleFieldType(out, module, field);
|
||||
out->write(cppFieldType(module, field));
|
||||
out->write("*");
|
||||
// }
|
||||
|
||||
@ -1026,7 +1012,7 @@ writeConstructorParameters(Output* out, Module& module, Class* cl)
|
||||
Field& f = **it;
|
||||
if(!f.polyfill) {
|
||||
out->write(", ");
|
||||
writeFieldType(out, module, f);
|
||||
out->write(cppFieldType(module, f));
|
||||
out->write(" ");
|
||||
out->write(obfuscate(f.name));
|
||||
}
|
||||
@ -1082,7 +1068,7 @@ void writeClassAccessors(Output* out, Module& module, Class* cl)
|
||||
for(std::vector<Field*>::iterator it = cl->fields.begin(); it != cl->fields.end(); ++it) {
|
||||
Field& f = **it;
|
||||
out->write(" ");
|
||||
writeFieldType(out, module, f);
|
||||
out->write(cppFieldType(module, f));
|
||||
if(!f.polyfill) {
|
||||
out->write("&");
|
||||
}
|
||||
@ -1097,7 +1083,7 @@ void writeClassAccessors(Output* out, Module& module, Class* cl)
|
||||
out->write("); // polyfill, assumed to be implemented elsewhere\n");
|
||||
} else {
|
||||
out->write(") { return field_at<");
|
||||
writeFieldType(out, module, f);
|
||||
out->write(cppFieldType(module, f));
|
||||
out->write(">(");
|
||||
out->write(capitalize(cl->name));
|
||||
out->write(capitalize(f.name));
|
||||
|
Loading…
Reference in New Issue
Block a user