fix putstatic code order regression in compile.cpp

Also, ensure that class is initialized before getting or setting
static fields in lazy loading code.
This commit is contained in:
Joel Dice 2011-03-17 08:46:46 -06:00
parent 44020482e5
commit 110e2e1d52

View File

@ -2922,6 +2922,8 @@ getStaticFieldValueFromReference(MyThread* t, object pair)
object field = resolveField(t, pair);
PROTECT(t, field);
initClass(t, fieldClass(t, field));
ACQUIRE_FIELD_FOR_READ(t, field);
return getFieldValue(t, classStaticTable(t, fieldClass(t, field)), field);
@ -2946,6 +2948,8 @@ setStaticLongFieldValueFromReference(MyThread* t, object pair, uint64_t value)
object field = resolveField(t, pair);
PROTECT(t, field);
initClass(t, fieldClass(t, field));
ACQUIRE_FIELD_FOR_WRITE(t, field);
cast<int64_t>
@ -2974,6 +2978,8 @@ setStaticObjectFieldValueFromReference(MyThread* t, object pair, object value)
object field = resolveField(t, pair);
PROTECT(t, field);
initClass(t, fieldClass(t, field));
ACQUIRE_FIELD_FOR_WRITE(t, field);
set(t, classStaticTable(t, fieldClass(t, field)), fieldOffset(t, field),
@ -3025,6 +3031,8 @@ setStaticFieldValueFromReference(MyThread* t, object pair, uint32_t value)
object field = resolveField(t, pair);
PROTECT(t, field);
initClass(t, fieldClass(t, field));
ACQUIRE_FIELD_FOR_WRITE(t, field);
setFieldValue(t, classStaticTable(t, fieldClass(t, field)), field, value);
@ -5452,7 +5460,6 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
if (LIKELY(field)) {
int fieldCode = vm::fieldCode(t, field);
Compiler::Operand* value = popField(t, frame, fieldCode);
object staticTable = 0;
@ -5485,6 +5492,8 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
}
}
Compiler::Operand* value = popField(t, frame, fieldCode);
Compiler::Operand* table;
if (instruction == putstatic) {
@ -7828,7 +7837,7 @@ class ArgumentList {
default:
addInt(cast<int32_t>(objectArrayBody(t, arguments, index++),
BytesPerWord));
break;
break;
}
}
}