objectformat: one word after mtable in object layout
[mate.git] / ffi / native.c
index 25e0d1ccc9c7e0542f06ba47e85b61c1e770d7a1..45964b77f701a067273b3cb945e8b4d9d402e885 100644 (file)
@@ -1,4 +1,6 @@
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 
 static char ascii(char s) {
        if(s < 0x20) return '.';
@@ -46,42 +48,82 @@ void java_io_PrintStream__printf___I_V(int a)
 
 struct integer {
        unsigned int method_table_ptr;
+       unsigned int gc_data;
        int value;
 };
 
-void java_io_PrintStream__printf_0___Ljava_lang_String__V
-       (const char *fmt)
+struct string {
+       unsigned int method_table_ptr;
+       unsigned int gc_data;
+       struct chararray *value;
+};
+
+struct chararray {
+       unsigned int length;
+       char str;
+};
+
+void jmate_io_PrintStream__printf_0___Ljava_lang_String__V
+       (struct string *fmt)
 {
-       printf("%s", fmt);
+       printf("%s", &fmt->value->str);
 }
 
-void java_io_PrintStream__printf_1___Ljava_lang_String_Ljava_lang_Object__V
-       (struct integer *a1, const char *fmt)
+void jmate_io_PrintStream__printf_1___Ljava_lang_String_Ljava_lang_Object__V
+       (struct integer *a1, struct string *fmt)
 {
-       printf(fmt, a1->value);
+#if 0
+       printf("fmt:        0x%08x\n", (unsigned int) fmt);
+       printf("fmt->value: 0x%08x\n", (unsigned int) fmt->value);
+       printf("fmt->val.len: 0x%08x\n", (unsigned int) (*fmt->value).length);
+       printf("first: %d\n", fmt->value->length);
+       printf("*fmt: %s\n", &fmt->value->str);
+#endif
+       printf(&fmt->value->str, a1->value);
 }
 
-void java_io_PrintStream__printf_2___Ljava_lang_String_Ljava_lang_Object_Ljava_lang_Object__V
-       (struct integer *a2, struct integer *a1, const char *fmt)
+void jmate_io_PrintStream__printf_2___Ljava_lang_String_Ljava_lang_Object_Ljava_lang_Object__V
+       (struct integer *a2, struct integer *a1, struct string *fmt)
 {
-       printf(fmt, a1->value, a2->value);
+       printf(&fmt->value->str, a1->value, a2->value);
 }
 
 void
-java_io_PrintStream__printf_3___Ljava_lang_String_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object__V
-       (struct integer *a3, struct integer *a2, struct integer *a1, const char *fmt)
+jmate_io_PrintStream__printf_3___Ljava_lang_String_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object__V
+       (struct integer *a3, struct integer *a2, struct integer *a1, struct string *fmt)
 {
-       printf(fmt, a1->value, a2->value, a3->value);
+       printf(&fmt->value->str, a1->value, a2->value, a3->value);
 }
 
-void java_io_PrintStream__printf_4___Ljava_lang_String_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object__V
-       (struct integer *a4, struct integer *a3, struct integer *a2, struct integer *a1, const char *fmt)
+void jmate_io_PrintStream__printf_4___Ljava_lang_String_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object__V
+       (struct integer *a4, struct integer *a3, struct integer *a2, struct integer *a1, struct string *fmt)
 {
-       printf(fmt, a1->value, a2->value, a3->value, a4->value);
+       printf(&fmt->value->str, a1->value, a2->value, a3->value, a4->value);
+}
+
+void jmate_io_PrintStream__printf_5___Ljava_lang_String_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object__V
+       (struct integer *a5, struct integer *a4, struct integer *a3, struct integer *a2, struct integer *a1, struct string *fmt)
+{
+       printf(&fmt->value->str, a1->value, a2->value, a3->value, a4->value, a5->value);
+}
+
+void gnu_classpath_VMSystemProperties__preInit___Ljava_util_Properties__V() {
+       return;
 }
 
-void java_io_PrintStream__printf_5___Ljava_lang_String_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object_Ljava_lang_Object__V
-       (struct integer *a5, struct integer *a4, struct integer *a3, struct integer *a2, struct integer *a1, const char *fmt)
+void java_lang_VMSystem__arraycopy___Ljava_lang_Object_ILjava_lang_Object_II_V(
+               int len, int dest_start, struct chararray *dest,
+               int src_start, struct chararray *src)
+#if 0
+               /* original */
+               struct chararray *src, int src_start,
+               struct chararray *dest, int dest_start, int len)
+#endif
 {
-       printf(fmt, a1->value, a2->value, a3->value, a4->value, a5->value);
+       memcpy(&dest->str, &src->str + src_start, len);
+       dest->length = len;
+#if 0
+       hexdump(src, len + 4);
+       hexdump(dest, len + 4);
+#endif
 }