diff --git a/src/avian/constants.h b/src/avian/constants.h index ef2bc24364..ebeb975af3 100644 --- a/src/avian/constants.h +++ b/src/avian/constants.h @@ -258,6 +258,7 @@ const unsigned ACC_SUPER = 1 << 5; const unsigned ACC_SYNCHRONIZED = ACC_SUPER; const unsigned ACC_VOLATILE = 1 << 6; const unsigned ACC_TRANSIENT = 1 << 7; +const unsigned ACC_VARARGS = 1 << 7; const unsigned ACC_NATIVE = 1 << 8; const unsigned ACC_INTERFACE = 1 << 9; const unsigned ACC_ABSTRACT = 1 << 10; diff --git a/src/avian/machine.h b/src/avian/machine.h index 3011dd47ed..d1fa2cced9 100644 --- a/src/avian/machine.h +++ b/src/avian/machine.h @@ -125,10 +125,15 @@ using namespace avian::util; type2 name2; \ } MAKE_NAME(resource_)(t, name1, name2); +AVIAN_EXPORT void vmPrintTrace(vm::Thread* t); + +AVIAN_EXPORT void vmfPrintTrace(vm::Thread* t, FILE* out); + namespace vm { const bool Verbose = false; const bool DebugRun = false; +const bool DebugCalls = false; const bool DebugStack = false; const bool DebugMonitors = false; const bool DebugReferences = false; @@ -2559,10 +2564,6 @@ void popResources(Thread* t); } // namespace vm -AVIAN_EXPORT void vmPrintTrace(vm::Thread* t); - -AVIAN_EXPORT void vmfPrintTrace(vm::Thread* t, FILE* out); - namespace vm { void dumpHeap(Thread* t, FILE* out); diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp index 5d4ef7ce51..dfc8464c2e 100644 --- a/src/classpath-openjdk.cpp +++ b/src/classpath-openjdk.cpp @@ -4880,9 +4880,8 @@ uint64_t jvmGetClassDeclaredConstructors(Thread* t, uintptr_t* arguments) GcMethod* vmMethod = cast(t, table->body()[i]); PROTECT(t, vmMethod); - if (((not publicOnly) or (vmMethod->flags() & ACC_PUBLIC)) - and strcmp(reinterpret_cast(vmMethod->name()->body().begin()), - "") == 0) { + bool isCtor = strcmp(reinterpret_cast(vmMethod->name()->body().begin()), "") == 0; + if (((not publicOnly) or (vmMethod->flags() & ACC_PUBLIC)) and isCtor) { object method = makeJconstructor(t, vmMethod, i); assertT(t, ai < objectArrayLength(t, array)); diff --git a/src/interpret.cpp b/src/interpret.cpp index 6ed8fefe03..12ddc9e0bb 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -574,10 +574,11 @@ unsigned invokeNativeSlow(Thread* t, GcMethod* method, void* function) uint64_t result; if (DebugRun) { + signed char *cname = method->class_() && method->class_()->name() ? method->class_()->name()->body().begin() : (signed char*) "?"; + signed char *mname = method->name() ? method->name()->body().begin() : (signed char*) "?"; fprintf(stderr, "invoke native method %s.%s\n", - method->class_()->name()->body().begin(), - method->name()->body().begin()); + cname, mname); } { @@ -785,12 +786,13 @@ loop: instruction = code->body()[ip++]; if (DebugRun) { + GcMethod *method_ = frameMethod(t, frame); + signed char *cname = method_->class_() && method_->class_()->name() ? method_->class_()->name()->body().begin() : (signed char*) "?"; + signed char *mname = method_->name() ? method_->name()->body().begin() : (signed char*) "?"; fprintf(stderr, "ip: %d; instruction: 0x%x in %s.%s ", ip - 1, - instruction, - frameMethod(t, frame)->class_()->name()->body().begin(), - frameMethod(t, frame)->name()->body().begin()); + instruction, cname, mname); int line = findLineNumber(t, frameMethod(t, frame), ip); switch (line) { @@ -2989,6 +2991,12 @@ invoke : { if (method->flags() & ACC_NATIVE) { invokeNative(t, method); } else { + if (DebugCalls && method) { + printf("invoke %s.%s\n", + method->class_() && method->class_()->name() ? (const char *)method->class_()->name()->body().begin() : "", + method->name() ? (const char *)method->name()->body().begin() : "" + ); + } checkStack(t, method); pushFrame(t, method); } @@ -2996,8 +3004,8 @@ invoke : { goto loop; throw_: - if (DebugRun) { - fprintf(stderr, "throw\n"); + if (DebugRun || DebugCalls) { + fprintf(stderr, "throw @ %s\n", frameMethod(t, frame)->name()->body().begin()); } pokeInt(t, t->frame + FrameIpOffset, t->ip);