Please check whether this fixes your crash with PrintTest. (It should crash in monoburg now instead). If it does, you can apply it, I think :-)
Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com> --- vm/class.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/vm/class.c b/vm/class.c index eaacbda..12e11ee 100644 --- a/vm/class.c +++ b/vm/class.c @@ -193,8 +193,7 @@ int vm_class_link(struct vm_class *vmc, const struct cafebabe_class *class) static_offset = 0; } - /* XXX: only static fields, right size, etc. */ - vmc->static_values = malloc(static_offset + class->fields_count * 8); + unsigned int static_size = 0; for (uint16_t i = 0; i < class->fields_count; ++i) { struct vm_field *vmf = &vmc->fields[i]; @@ -204,6 +203,16 @@ int vm_class_link(struct vm_class *vmc, const struct cafebabe_class *class) return -1; } + if (vm_field_is_static(vmf)) + static_size += 8; + } + + /* XXX: only static fields, right size, etc. */ + vmc->static_values = malloc(static_offset + static_size * 8); + + for (uint16_t i = 0; i < class->fields_count; ++i) { + struct vm_field *vmf = &vmc->fields[i]; + if (vm_field_is_static(vmf)) { if (vm_field_init_static(vmf, static_offset)) { NOT_IMPLEMENTED; @@ -220,7 +229,7 @@ int vm_class_link(struct vm_class *vmc, const struct cafebabe_class *class) } vmc->object_size = offset; - vmc->static_size = static_offset; + vmc->static_size = static_offset + static_size * 8; vmc->methods = malloc(sizeof(*vmc->methods) * class->methods_count); if (!vmc->methods) { -- 1.6.0.4 ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel