A sentence in the JVM spec gave me the impression that accessing a final
class field should not trigger class initialization, but this appears to
be wrong. It appears that this sentence was intended for the compiler,
since GNU classpath's System.out is in fact static final and without this
patch, we crash (with a NullPointerException) on trying to call
System.out.println because System does not initialize when we access
System.out.

Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 arch/x86/insn-selector_32.brg |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/insn-selector_32.brg b/arch/x86/insn-selector_32.brg
index 9ca1095..39303ba 100644
--- a/arch/x86/insn-selector_32.brg
+++ b/arch/x86/insn-selector_32.brg
@@ -835,7 +835,7 @@ reg:        EXPR_CLASS_FIELD 1
        vmc = vmf->class;
 
        /* XXX: Lock class */
-       if (vmc->state >= VM_CLASS_INITIALIZING || vm_field_is_final(vmf)) {
+       if (vmc->state >= VM_CLASS_INITIALIZING) {
                /* Class is already initialized; no need for fix-up. We also
                 * don't want the fixup if we're already inside the
                 * initializer. */
@@ -1201,7 +1201,7 @@ stmt:     STMT_STORE(EXPR_CLASS_FIELD, reg)
        vmc = vmf->class;
 
        /* XXX: Lock class */
-       if (vmc->state >= VM_CLASS_INITIALIZING || vm_field_is_final(vmf)) {
+       if (vmc->state >= VM_CLASS_INITIALIZING) {
                /* Class is already initialized; no need for fix-up. We also
                 * don't want the fixup if we're already inside the
                 * initializer. */
-- 
1.6.0.4


------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to