tolerate ConstantValue attributes on non-static fields, since the compiler ensures that they are initialized in any constructors for that class (i.e., the VM does not need to do anything special to initialize them)

This commit is contained in:
Joel Dice
2009-01-10 12:25:52 -07:00
parent e86acf4543
commit 54ad7c4e98
4 changed files with 21 additions and 5 deletions

View File

@ -1453,7 +1453,9 @@ interpret(Thread* t)
object field = resolveField(t, codePool(t, code), index - 1);
if (UNLIKELY(exception)) goto throw_;
if (throwIfVolatileField(t, field)) goto throw_;
assert(t, (fieldFlags(t, field) & ACC_STATIC) == 0);
pushField(t, popObject(t), field);
} else {
exception = makeNullPointerException(t);
@ -1468,6 +1470,8 @@ interpret(Thread* t)
if (UNLIKELY(exception)) goto throw_;
if (throwIfVolatileField(t, field)) goto throw_;
assert(t, fieldFlags(t, field) & ACC_STATIC);
PROTECT(t, field);
if (UNLIKELY(classInit(t, fieldClass(t, field), 3))) goto invoke;
@ -2401,6 +2405,8 @@ interpret(Thread* t)
if (UNLIKELY(exception)) goto throw_;
if (throwIfVolatileField(t, field)) goto throw_;
assert(t, (fieldFlags(t, field) & ACC_STATIC) == 0);
switch (fieldCode(t, field)) {
case ByteField:
case BooleanField:
@ -2467,6 +2473,8 @@ interpret(Thread* t)
if (UNLIKELY(exception)) goto throw_;
if (throwIfVolatileField(t, field)) goto throw_;
assert(t, fieldFlags(t, field) & ACC_STATIC);
PROTECT(t, field);
if (UNLIKELY(classInit(t, fieldClass(t, field), 3))) goto invoke;