Fix primitive array handling

This commit is contained in:
Mike Hearn 2017-01-19 16:41:01 +00:00 committed by exfalso
parent f7a651d6ba
commit 539af98836
4 changed files with 23 additions and 14 deletions

View File

@ -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;

View File

@ -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);

View File

@ -4880,9 +4880,8 @@ uint64_t jvmGetClassDeclaredConstructors(Thread* t, uintptr_t* arguments)
GcMethod* vmMethod = cast<GcMethod>(t, table->body()[i]);
PROTECT(t, vmMethod);
if (((not publicOnly) or (vmMethod->flags() & ACC_PUBLIC))
and strcmp(reinterpret_cast<char*>(vmMethod->name()->body().begin()),
"<init>") == 0) {
bool isCtor = strcmp(reinterpret_cast<char*>(vmMethod->name()->body().begin()), "<init>") == 0;
if (((not publicOnly) or (vmMethod->flags() & ACC_PUBLIC)) and isCtor) {
object method = makeJconstructor(t, vmMethod, i);
assertT(t, ai < objectArrayLength(t, array));

View File

@ -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);