These are needed for subroutine inlining.
Signed-off-by: Tomek Grabiec <[email protected]>
---
include/vm/bytecode.h | 6 ++++++
vm/bytecode.c | 29 +++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/include/vm/bytecode.h b/include/vm/bytecode.h
index 23c047a..ef5e342 100644
--- a/include/vm/bytecode.h
+++ b/include/vm/bytecode.h
@@ -22,4 +22,10 @@ uint16_t read_u16(const unsigned char *p);
int32_t read_s32(const unsigned char *p);
uint32_t read_u32(const unsigned char *p);
+void write_u8(unsigned char *p, uint8_t value);
+void write_s16(unsigned char *p, int16_t value);
+void write_u16(unsigned char *p, uint16_t value);
+void write_s32(unsigned char *p, int32_t value);
+void write_u32(unsigned char *p, uint32_t value);
+
#endif
diff --git a/vm/bytecode.c b/vm/bytecode.c
index 9b2cedf..9b914cc 100644
--- a/vm/bytecode.c
+++ b/vm/bytecode.c
@@ -113,3 +113,32 @@ uint32_t read_u32(const unsigned char *p)
return result;
}
+
+void write_u8(unsigned char *p, uint8_t value)
+{
+ *p = value;
+}
+
+void write_u16(unsigned char *p, uint16_t value)
+{
+ write_u8(p + 0, (value >> 8) & 0xff);
+ write_u8(p + 1, value & 0xff);
+}
+
+void write_u32(unsigned char *p, uint32_t value)
+{
+ write_u8(p + 0, (value >> 24) & 0xff);
+ write_u8(p + 1, (value >> 16) & 0xff);
+ write_u8(p + 2, (value >> 8) & 0xff);
+ write_u8(p + 3, value & 0xff);
+}
+
+void write_s16(unsigned char *p, int16_t value)
+{
+ write_u16(p, (uint16_t) value);
+}
+
+void write_s32(unsigned char *p, int32_t value)
+{
+ write_u32(p, (uint32_t) value);
+}
--
1.6.0.6
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel