Makes the code easier to read.
Signed-off-by: Vegard Nossum <[email protected]>
---
vm/class.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/vm/class.c b/vm/class.c
index 91f4ca0..8cb6ebb 100644
--- a/vm/class.c
+++ b/vm/class.c
@@ -266,6 +266,7 @@ int vm_class_link(struct vm_class *vmc, const struct
cafebabe_class *class)
}
unsigned int static_size = 0;
+ unsigned int object_size = 0;
for (uint16_t i = 0; i < class->fields_count; ++i) {
struct vm_field *vmf = &vmc->fields[i];
@@ -277,10 +278,15 @@ int vm_class_link(struct vm_class *vmc, const struct
cafebabe_class *class)
if (vm_field_is_static(vmf))
static_size += 8;
+ else
+ object_size += 8;
}
/* XXX: only static fields, right size, etc. */
- vmc->static_values = malloc(static_offset + static_size);
+ vmc->static_size = static_offset + static_size;
+ vmc->static_values = malloc(vmc->static_size);
+
+ vmc->object_size = offset + object_size;
for (uint16_t i = 0; i < class->fields_count; ++i) {
struct vm_field *vmf = &vmc->fields[i];
@@ -300,9 +306,6 @@ int vm_class_link(struct vm_class *vmc, const struct
cafebabe_class *class)
}
}
- vmc->object_size = offset;
- vmc->static_size = static_offset + static_size;
-
vmc->methods = malloc(sizeof(*vmc->methods) * class->methods_count);
if (!vmc->methods) {
NOT_IMPLEMENTED;
--
1.6.0.6
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel