We need to initialize static fields to zero even before the class initializer runs (since the initializer may refer to static fields).
This still needs a lot of work, but here is a preliminary fix that initializes a whole pointer instead of just a single byte. We are still not using the constant (as found in the ConstantValue attribute), but this gets us past java.lang.Runtime initialization. Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com> --- vm/field.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vm/field.c b/vm/field.c index 040dc11..ce0275e 100644 --- a/vm/field.c +++ b/vm/field.c @@ -68,7 +68,7 @@ int vm_field_init_static(struct vm_field *vmf, unsigned int offset) = &class->fields[vmf->field_index]; /* XXX: Actually _use_ the ConstantValue attribute */ - vmf->class->static_values[offset] = 0; + *(unsigned long *) &vmf->class->static_values[offset] = 0; unsigned int constant_value_index = 0; if (cafebabe_attribute_array_get(&field->attributes, -- 1.6.0.4 ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel