1 /* class: java/lang/System */
7 #include "java_lang_Object.h"
12 * Class: java/lang/System
13 * Method: currentTimeMillis
16 JNIEXPORT s8 JNICALL Java_java_lang_VMSystem_currentTimeMillis ( JNIEnv *env )
20 (void) gettimeofday(&tv, NULL);
21 return ((s8) tv.tv_sec) * 1000 + tv.tv_usec / 1000;
26 * Class: java/lang/System
28 * Signature: (Ljava/lang/Object;ILjava/lang/Object;II)V
30 JNIEXPORT void JNICALL Java_java_lang_VMSystem_arraycopy (JNIEnv *env, jclass clazz,struct java_lang_Object* source, s4 sp, struct java_lang_Object* dest, s4 dp, s4 len)
33 java_arrayheader *s = (java_arrayheader*) source;
34 java_arrayheader *d = (java_arrayheader*) dest;
35 arraydescriptor *sdesc;
36 arraydescriptor *ddesc;
38 /* printf("arraycopy: %p:%x->%p:%x\n",source,sp,dest,dp);
42 exceptionptr = proto_java_lang_NullPointerException;
46 sdesc = s->objheader.vftbl->arraydesc;
47 ddesc = d->objheader.vftbl->arraydesc;
49 if (!sdesc || !ddesc || (sdesc->arraytype != ddesc->arraytype)) {
50 exceptionptr = proto_java_lang_ArrayStoreException;
54 if ((len<0) || (sp<0) || (sp+len > s->size) || (dp<0) || (dp+len > d->size)) {
55 exceptionptr = proto_java_lang_ArrayIndexOutOfBoundsException;
59 if (sdesc->componentvftbl == ddesc->componentvftbl) {
60 /* We copy primitive values or references of exactly the same type */
61 s4 dataoffset = sdesc->dataoffset;
62 s4 componentsize = sdesc->componentsize;
63 memmove(((u1*)d) + dataoffset + componentsize * dp,
64 ((u1*)s) + dataoffset + componentsize * sp,
65 (size_t) len * componentsize);
68 /* We copy references of different type */
69 java_objectarray *oas = (java_objectarray*) s;
70 java_objectarray *oad = (java_objectarray*) d;
73 for (i=0; i<len; i++) {
74 java_objectheader *o = oas->data[sp+i];
75 if (!builtin_canstore(oad, o)) {
76 exceptionptr = proto_java_lang_ArrayStoreException;
82 /* XXX this does not completely obey the specification!
83 * If an exception is thrown only the elements above
84 * the current index have been copied. The
85 * specification requires that only the elements
86 * *below* the current index have been copied before
89 for (i=len-1; i>=0; i--) {
90 java_objectheader *o = oas->data[sp+i];
91 if (!builtin_canstore(oad, o)) {
92 exceptionptr = proto_java_lang_ArrayStoreException;
100 void attach_property (char *name, char *value)
102 log_text("attach_property not supported");
104 if (activeprops >= MAXPROPS) panic ("Too many properties defined");
105 proplist[activeprops][0] = name;
106 proplist[activeprops][1] = value;
112 * Class: java/lang/System
113 * Method: identityHashCode
114 * Signature: (Ljava/lang/Object;)I
116 JNIEXPORT s4 JNICALL Java_java_lang_VMSystem_identityHashCode (JNIEnv *env , jclass clazz, struct java_lang_Object* par1)
118 return ((char*) par1) - ((char*) 0);
123 * These are local overrides for various environment variables in Emacs.
124 * Please do not remove this and leave it at the end of the file, where
125 * Emacs will automagically detect them.
126 * ---------------------------------------------------------------------
129 * indent-tabs-mode: t