From 5c807a4ddc00fdd501ee8fd76bf11bb88e1643a7 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 17 Dec 2007 15:38:59 -0700 Subject: [PATCH] implement shl; fix thinko in Frame::Protector; fix uninitialized value warnings --- src/compile.cpp | 13 ++++++++----- src/compiler.cpp | 7 +++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/compile.cpp b/src/compile.cpp index ec0cb1bbf9..a8f4089a88 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -274,7 +274,7 @@ class Frame { virtual void visit(Heap::Visitor* v) { v->visit(&(frame->method)); - if (next == 0) { + if (frame->next == 0) { Vector* pool = frame->objectPool; for (unsigned i = 0; i < pool->length(); i += sizeof(PoolElement)) { v->visit(&(pool->peek(i)->value)); @@ -283,7 +283,7 @@ class Frame { Vector* log = frame->traceLog; unsigned traceSize = traceSizeInBytes(t, frame->method); for (unsigned i = 0; i < log->length(); i += traceSize) { - v->visit(&(pool->peek(i)->target)); + v->visit(&(log->peek(i)->target)); } } } @@ -364,7 +364,7 @@ class Frame { } static unsigned traceSizeInBytes(Thread* t, object method) { - return sizeof(TraceElement) + mapSizeInWords(t, method); + return sizeof(TraceElement) + mapSizeInBytes(t, method); } void pushedInt() { @@ -1774,6 +1774,8 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip) Operand* table; if (instruction == getstatic) { + PROTECT(t, field); + initClass(t, fieldClass(t, field)); if (UNLIKELY(t->exception)) return; @@ -2689,10 +2691,11 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip) object field = resolveField(t, codePool(t, code), index - 1); if (UNLIKELY(t->exception)) return; - object staticTable; + object staticTable = 0; if (instruction == putstatic) { PROTECT(t, field); + initClass(t, fieldClass(t, field)); if (UNLIKELY(t->exception)) return; @@ -3218,7 +3221,7 @@ invokeNative(MyThread* t) { object node = findTraceNode(t, *static_cast(t->stack)); object target = resolveTarget(t, t->stack, traceNodeTarget(t, node)); - uint64_t result; + uint64_t result = 0; if (LIKELY(t->exception == 0)) { result = invokeNative2(t, target); diff --git a/src/compiler.cpp b/src/compiler.cpp index 7b46010d3c..1241817752 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -1599,6 +1599,13 @@ MemoryOperand::accept(Context* c, Operation operation, dx->release(c); } break; + case shl: { + RegisterOperand* cx = temporary(c, rcx); + cx->accept(c, mov, operand); + encode(c, 0xd3, 4, this, true); + cx->release(c); + } break; + case sub: { encode(c, 0x29, operand->value, this, true); } break;