Signed-off-by: Vegard Nossum <[email protected]>
---
include/vm/types.h | 1 +
vm/types.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/include/vm/types.h b/include/vm/types.h
index dc944d9..9b5c2f6 100644
--- a/include/vm/types.h
+++ b/include/vm/types.h
@@ -20,6 +20,7 @@ enum vm_type {
extern enum vm_type str_to_type(const char *);
extern enum vm_type get_method_return_type(char *);
+extern unsigned int vm_type_size(enum vm_type);
int skip_type(const char **type);
int count_arguments(const char *);
diff --git a/vm/types.c b/vm/types.c
index 778375a..e54e711 100644
--- a/vm/types.c
+++ b/vm/types.c
@@ -42,6 +42,25 @@ enum vm_type get_method_return_type(char *type)
return str_to_type(type + 1);
}
+unsigned int vm_type_size(enum vm_type type)
+{
+ static const int size[VM_TYPE_MAX] = {
+ [J_VOID] = 0,
+ [J_REFERENCE] = sizeof(void *),
+ [J_BYTE] = 1,
+ [J_SHORT] = 2,
+ [J_INT] = 4,
+ [J_LONG] = 8,
+ [J_CHAR] = 2,
+ [J_FLOAT] = 4,
+ [J_DOUBLE] = 8,
+ [J_BOOLEAN] = 1,
+ [J_RETURN_ADDRESS] = sizeof(void *),
+ };
+
+ return size[type];
+}
+
#include <stdio.h>
static int count_skip_arguments(const char **type);
--
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