Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 include/vm/call.h |   31 ++++++++++++++++++++++++++++++-
 vm/call.c         |   12 ------------
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/include/vm/call.h b/include/vm/call.h
index c1ed6bd..557fb86 100644
--- a/include/vm/call.h
+++ b/include/vm/call.h
@@ -4,10 +4,39 @@
 #include <stdarg.h>
 #include <stdint.h>
 
+#include "vm/jni.h"
+
 struct vm_method;
 struct vm_object;
 
-unsigned long vm_call_method(struct vm_method *method, ...);
 unsigned long vm_call_method_v(struct vm_method *method, va_list args);
 
+#define DECLARE_VM_CALL_METHOD(type, suffix)                           \
+       static inline type                                              \
+       vm_call_method##suffix(struct vm_method *method, ...)           \
+       {                                                               \
+               type result;                                            \
+               va_list args;                                           \
+                                                                       \
+               va_start(args, method);                                 \
+               result = (type)vm_call_method_v(method, args);          \
+               va_end(args);                                           \
+                                                                       \
+               return result;                                          \
+       }
+
+static inline void vm_call_method(struct vm_method *method, ...)
+{
+       va_list args;
+
+       va_start(args, method);
+       vm_call_method_v(method, args);
+       va_end(args);
+}
+
+DECLARE_VM_CALL_METHOD(unsigned long, _ulong);
+DECLARE_VM_CALL_METHOD(struct vm_object *, _object);
+DECLARE_VM_CALL_METHOD(jint, _jint);
+DECLARE_VM_CALL_METHOD(jboolean, _jboolean);
+
 #endif
diff --git a/vm/call.c b/vm/call.c
index 0b81e99..718917e 100644
--- a/vm/call.c
+++ b/vm/call.c
@@ -112,15 +112,3 @@ unsigned long vm_call_method_v(struct vm_method *method, 
va_list args)
 
        return vm_call_method_a(method, args_array);
 }
-
-unsigned long vm_call_method(struct vm_method *method, ...)
-{
-       unsigned long result;
-       va_list args;
-
-       va_start(args, method);
-       result = vm_call_method_v(method, args);
-       va_end(args);
-
-       return result;
-}
-- 
1.6.0.6


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

Reply via email to