## Process this file with automake to produce Makefile.in
-# $Id: Makefile.am 1145 2004-06-05 23:57:56Z twisti $
+# $Id: Makefile.am 1173 2004-06-16 14:56:18Z jowenn $
@SET_MAKE@
java.lang.String \
java.lang.Class \
java.io.FileDescriptor \
+ java.io.VMFile \
gnu.java.nio.SelectorImpl \
gnu.java.nio.FileLockImpl \
gnu.java.lang.reflect.TypeSignature \
java.io.FileWriter \
java.net.NetworkInterface \
java.net.SocketImpl \
- java.net.PlainSocketImpl \
+ gnu.java.net.PlainSocketImpl \
java.net.DatagramSocketImpl \
java.net.InetAddress \
java.net.DatagramPacket \
- java.net.PlainDatagramSocketImpl \
+ gnu.java.net.PlainDatagramSocketImpl \
java.nio.CharBufferImpl \
- java.nio.channels.FileChannelImpl \
java.nio.DoubleBufferImpl \
java.nio.LongBufferImpl \
java.nio.ByteOrder \
java.nio.IntBufferImpl \
java.nio.DirectByteBufferImpl \
java.nio.FloatBufferImpl \
+ gnu.java.nio.channels.FileChannelImpl \
java.sql.Connection \
java.lang.Math \
java.lang.StringBuffer \
java.lang.reflect.Constructor \
java.lang.reflect.Method \
java.lang.ThreadGroup \
- java.lang.Thread \
+ java.lang.VMThread \
java.lang.VMDouble \
java.lang.VMFloat \
java.lang.Cloneable \
java.lang.VMString \
java.util.Properties \
java.lang.Runtime \
+ java.lang.VMRuntime \
java.lang.Throwable \
java.lang.VMThrowable \
gnu.java.security.x509.X509Certificate \
Changes: Christian Thalinger
- $Id: asmpart.h 1164 2004-06-12 13:32:49Z stefan $
+ $Id: asmpart.h 1173 2004-06-16 14:56:18Z jowenn $
*/
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
extern threadcritnode asm_criticalsections;
#endif
+
void asm_getclassvalues_atomic(vftbl *super, vftbl *sub, castinfo *out);
+
#endif /* _ASMPART_H */
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 1113 2004-06-02 10:31:09Z twisti $
+ $Id: builtin.c 1173 2004-06-16 14:56:18Z jowenn $
*/
size_t s;
s=(end-begin);
/*printf ("begin: %p, end: %p, diff: %ld, size :%ld\n",begin,end,s,s*sizeof(stacktraceelement));*/
+ *el=heap_allocate(sizeof(stacktraceelement)*(s+1), true, 0);
+#if 0
*el=MNEW(stacktraceelement,s+1); /*GC*/
+#endif
memcpy(*el,begin,(end-begin)*sizeof(stacktraceelement));
(*el)[s].method=0;
#if defined(__GNUC__)
Philipp Tomsich
Edwin Steiner
- $Id: global.h 1155 2004-06-09 16:28:52Z twisti $
+ $Id: global.h 1173 2004-06-16 14:56:18Z jowenn $
*/
/* should # method def'd and used be kept after static parse (will it be used?) */
s4 subRedefs;
s4 subRedefsUsed;
+ s4 nativelyoverloaded; /*used in header.c and only valid there*/
};
/* flag variables *************************************************************/
+extern bool cacao_initializing;
extern bool compileall;
extern bool runverbose;
extern bool verboseexception;
Changes: Mark Probst
Philipp Tomsich
- $Id: headers.c 1171 2004-06-12 15:04:31Z stefan $
+ $Id: headers.c 1173 2004-06-16 14:56:18Z jowenn $
*/
outputsize = newsize;
}
+static void printOverloadPart(utf *desc)
+{
+ char *utf_ptr=desc->text;
+ u2 c;
+
+ fprintf(file,"__");
+ while ((c=utf_nextu2(&utf_ptr))!=')') {
+ switch (c) {
+ case 'I':
+ case 'S':
+ case 'B':
+ case 'C':
+ case 'Z':
+ case 'J':
+ case 'F':
+ case 'D':
+ fprintf (file, "%c",(char)c);
+ break;
+ case '[':
+ fprintf(file,"_3");
+ break;
+ case 'L':
+ putc('L',file);
+ while ( (c=utf_nextu2(&utf_ptr)) != ';')
+ printIDpart (c);
+ fprintf(file,"_2");
+ break;
+ case '(':
+ break;
+ default: panic ("invalid method descriptor");
+ }
+ }
+}
static char *printtype(char *utf_ptr)
{
fprintf(file, " JNICALL Java_");
printID(m->class->name);
- /* rename overloaded method */
- if ((ident_count = searchidentchain_utf(m->name)))
- fprintf(file, "%d", ident_count - 1);
chain_addlast(ident_chain, m->name);
fprintf(file, "_");
printID(m->name);
+ if (m->nativelyoverloaded) printOverloadPart(m->descriptor);
fprintf(file, "(JNIEnv *env");
utf_ptr = m->descriptor->text + 1;
char uclassname[1024];
u2 i;
methodinfo *m;
+ u2 i2;
+ methodinfo *m2;
+ u2 nativelyoverloaded;
/* store class in chain */
chain_addlast(nativeclass_chain, c);
/* create method-prototypes */
+ /* find overloaded methods */
+ for (i = 0; i < c->methodscount; i++) {
+
+ m = &(c->methods[i]);
+
+ if (!(m->flags & ACC_NATIVE)) continue;
+ if (!m->nativelyoverloaded) {
+ nativelyoverloaded=false;
+ for (i2=i+1;i2<c->methodscount; i2++) {
+ m2 = &(c->methods[i2]);
+ if (!(m2->flags & ACC_NATIVE)) continue;
+ if (m->name==m2->name) {
+ m2->nativelyoverloaded=true;
+ nativelyoverloaded=true;
+ }
+ }
+ m->nativelyoverloaded=nativelyoverloaded;
+ }
+
+ }
+
for (i = 0; i < c->methodscount; i++) {
m = &(c->methods[i]);
printID(m->class->name);
fprintf(file,"_");
printID(m->name);
+ if (m->nativelyoverloaded) printOverloadPart(m->descriptor);
fprintf(file,"\n },\n");
}
memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen.inc 1165 2004-06-12 13:33:38Z stefan $
+ $Id: codegen.inc 1173 2004-06-16 14:56:18Z jowenn $
*/
void *endpc;
};
-static struct avl_table *methodtree;
+static struct avl_table *methodtree=0;
static int methodtree_comparator(const void *pc, const void *element,
void *param);
#endif
methodtree = avl_create(methodtree_comparator, NULL, NULL);
mte = NEW(methodtree_element);
- mte->startpc = (void *) asm_calljavafunction;
- mte->endpc = (void *) calljava_xhandler;
+
+ mte->startpc = asm_calljavafunction;
+ mte->endpc = asm_calljavafunction2-1;
+
avl_insert(methodtree, mte);
mte = NEW(methodtree_element);
- mte->startpc = (void *) asm_calljavafunction2;
- mte->endpc = (void *) calljava_xhandler2;
+
+ mte->startpc = asm_calljavafunction2;
+ mte->endpc = asm_call_jit_compiler-1;
+
avl_insert(methodtree, mte);
}
#endif
}
+void codegen_insertNative(void *startpc,void *endpc) {
+ methodtree_element *mte;
+
+ if (!methodtree) {
+ methodtree_element *mte;
+
+ methodtree = avl_create(methodtree_comparator, NULL, NULL);
+
+ mte = NEW(methodtree_element);
+ mte->startpc = asm_calljavafunction;
+ mte->endpc = asm_calljavafunction2-1;
+ avl_insert(methodtree, mte);
+
+ mte = NEW(methodtree_element);
+ mte->startpc = asm_calljavafunction2;
+ mte->endpc = asm_call_jit_compiler-1;
+ avl_insert(methodtree, mte);
+ }
+
+
+ mte = NEW(methodtree_element);
+ mte->startpc = startpc;
+ mte->endpc = endpc;
+
+ if (avl_insert(methodtree, mte))
+ panic("duplicate entry");
+}
void dseg_display(s4 *s4ptr)
{
Reinhard Grafl
Christian Thalinger
- $Id: asmpart.S 1140 2004-06-05 20:58:14Z twisti $
+ $Id: asmpart.S 1173 2004-06-16 14:56:18Z jowenn $
*/
Java_java_lang_VMSecurityManager_currentClassLoader:
+ mov cacao_initializing,%eax
+ test %eax,%eax
+ jz Java_java_lang_VMSecurityManager_cont
+
+ mov $0,%eax
+ ret
+Java_java_lang_VMSecurityManager_cont:
lea builtin_asm_getclassloader,%eax
push %eax /*store collector function pointer*/
jmp getClassContext_begin
addl $116, %edx
push %edx /*esp+8*/ /*position of return address of native stub*/
call builtin_asm_get_stackframeinfo
- movl (%eax),%eax /*comment ??*/
+/* movl (%eax),%eax*/ /*TEST*/
push 0(%eax) /*esp+4*/ /*address of frame info block*/
movl 124(%esp),%edx
getClassContext_nativeCall:
movl $1,32(%esp)
movl 4(%esp),%eax /*get top most element on stackframe help information stack*/
+ test %eax,%eax
+ jz getClassContext_leave
movl 0(%eax),%ecx
movl %ecx,4(%esp)
addl $8,%eax
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1168 2004-06-12 14:58:25Z stefan $
+ $Id: codegen.c 1173 2004-06-16 14:56:18Z jowenn $
*/
u1 *createnativestub(functionptr f, methodinfo *m)
{
u1 *s = CNEW(u1, NATIVESTUBSIZE); /* memory to hold the stub */
-
+ int addmethod=0;
u1 *tptr;
int i;
int stackframesize = 4+12; /* initial 4 bytes is space for jni env,
int stackframeoffset = 4;
int p, t;
-
+
mcodeptr = s; /* make macros work */
if (m->flags & ACC_STATIC) {
if (m->flags & ACC_STATIC) {
/* if class isn't yet initialized, do it */
if (!m->class->initialized) {
+ s4 *header=(s4*)s;
+ *header = 0;/*extablesize*/
+ header;
+ *header = 0;/*line number table start*/
+ header++;
+ *header = 0;/*line number table size*/
+ header++;
+ *header = 0;/*fltsave*/
+ header++;
+ *header = 0;/*intsave*/
+ header++;
+ *header = 0;/*isleaf*/
+ header++;
+ *header = 0;/*issync*/
+ header++;
+ *header = 0;/*framesize*/
+ header++;
+ *header = m;/*methodpointer*/
+ *header++;
+ mcodeptr=s=header;
+ addmethod=1;
/* call helper function which patches this code */
i386_mov_imm_reg((s4) m->class, REG_ITMP1);
i386_mov_imm_reg((s4) asm_check_clinit, REG_ITMP2);
i386_mov_imm_reg((s4) asm_handle_nat_exception, REG_ITMP3);
i386_jmp_reg(REG_ITMP3);
+ if (addmethod) {
+ codegen_insertNative(s,mcodeptr);
+ }
+
#if 0
- dolog_plain("stubsize: %d (for %d params)\n", (s4) (mcodeptr - s), m->paramcount);
+ dolog_plain("native stubentry: %p, stubsize: %x (for %d params) --", (s4)s,(s4) (mcodeptr - s), m->paramcount);
+ utf_display(m->name);
+ dolog_plain("\n");
#endif
#if defined(STATISTICS)
Changes: Joseph Wenninger
- $Id: jni.c 1112 2004-05-31 15:47:20Z jowenn $
+ $Id: jni.c 1173 2004-06-16 14:56:18Z jowenn $
*/
jobject CallStaticObjectMethod(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
{
- log_text("JNI-Call: CallStaticObjectMethod");
+ jobject ret;
+ va_list vaargs;
- return NULL;
+ /* log_text("JNI-Call: CallStaticObjectMethod");*/
+
+ va_start(vaargs, methodID);
+ ret = callObjectMethod(0, methodID, vaargs);
+ va_end(vaargs);
+
+ return ret;
}
jobject CallStaticObjectMethodV(JNIEnv *env, jclass clazz, jmethodID methodID, va_list args)
{
- log_text("JNI-Call: CallStaticObjectMethodV");
-
- return NULL;
+ /* log_text("JNI-Call: CallStaticObjectMethodV"); */
+
+ return callObjectMethod(0,methodID,args);
}
Mark Probst
Edwin Steiner
- $Id: loader.c 1154 2004-06-09 16:28:00Z twisti $
+ $Id: loader.c 1173 2004-06-16 14:56:18Z jowenn $
*/
m->linenumbercount = 0;
m->linenumbers = 0;
m->class = c;
-
+ m->nativelyoverloaded=false;
m->flags = suck_u2(cb);
m->name = class_getconstant(c, suck_u2(cb), CONSTANT_Utf8);
- Calling the class loader
- Running the main method
- $Id: main.c 1150 2004-06-06 13:29:25Z twisti $
+ $Id: main.c 1173 2004-06-16 14:56:18Z jowenn $
*/
#include "typeinfo.h"
#endif
-/* command line option */
+bool cacao_initializing;
+
+/* command line option */
bool verbose = false;
bool compileall = false;
bool runverbose = false; /* trace all method invocation */
tables_init();
suck_init(classpath);
+ cacao_initializing=true;
+
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
initThreadsEarly();
#endif
initThreads((u1*) &dummy);
#endif
+ *threadrootmethod=0;
+ class_init(class_new(utf_new_char("java/lang/System"))); /*That's important, otherwise we get into trouble, if
+ the Runtime static initializer is called before (circular dependency. This is with classpath
+ 0.09. Another important thing is, that this has to happen after initThreads!!!
+ */
+ cacao_initializing=false;
/************************* Start worker routines ********************/
if (startit) {
*threadrootmethod = mainmethod;
+
/* here we go... */
asm_calljavafunction(mainmethod, a, NULL, NULL, NULL);
## Process this file with automake to produce Makefile.in
-# $Id: Makefile.am 1148 2004-06-06 13:20:49Z twisti $
+# $Id: Makefile.am 1173 2004-06-16 14:56:18Z jowenn $
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit/@ARCH_DIR@
libnat_a_SOURCES = \
Constructor.c \
Field.c \
- FileChannelImpl.c \
Method.c \
Proxy.c \
Runtime.c \
VMClass.c \
VMClassLoader.c \
VMObject.c \
- VMObjectStreamClass.c \
VMSecurityManager.c \
VMString.c \
VMSystem.c \
Changes: Joseph Wenninger
Christian Thalinger
- $Id: Runtime.c 1147 2004-06-06 13:20:11Z twisti $
+ $Id: Runtime.c 1173 2004-06-16 14:56:18Z jowenn $
*/
#include "java_io_File.h"
#include "java_lang_String.h"
#include "java_lang_Process.h"
-#include "java_util_Properties.h" /* required by java_lang_Runtime.h */
-#include "java_lang_Runtime.h"
+#include "java_util_Properties.h" /* needed for java_lang_Runtime.h */
+#include "java_lang_VMRuntime.h"
#define JOWENN_DEBUG
static s4 finalizeOnExit = false;
#define MAXPROPS 100
+static bool shouldFinalizersBeRunOnExit=false;
static int activeprops = 19;
static char *proplist[MAXPROPS][2] = {
activeprops++;
}
/*
- * Class: java_lang_Runtime
+ * Class: java_lang_VMRuntime
* Method: execInternal
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Ljava/lang/Process;
*/
-JNIEXPORT java_lang_Process* JNICALL Java_java_lang_Runtime_execInternal(JNIEnv *env, java_lang_Runtime *this, java_objectarray *cmd, java_objectarray *shellenv, java_io_File *workingdir)
+JNIEXPORT java_lang_Process* JNICALL Java_java_lang_VMRuntime_execInternal(JNIEnv *env, jclass clazz, java_objectarray *cmd, java_objectarray *shellenv, java_io_File *workingdir)
{
log_text("Java_java_lang_Runtime_execInternal called");
/*
- * Class: java/lang/Runtime
+ * Class: java/lang/VMRuntime
* Method: exitInternal
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_exitInternal(JNIEnv *env, java_lang_Runtime *this, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit(JNIEnv *env, jclass clazz, s4 par1)
{
if (finalizeOnExit)
gc_finalize_all();
* Method: freeMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_freeMemory(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_freeMemory(JNIEnv *env, jclass clazz)
{
return gc_get_free_bytes();
}
* Method: gc
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_gc(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_gc(JNIEnv *env, jclass clazz)
{
gc_call();
}
* Method: runFinalization
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_runFinalization(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalization(JNIEnv *env, jclass clazz)
{
gc_invoke_finalizers();
}
* Method: runFinalizersOnExit
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_runFinalizersOnExitInternal(JNIEnv *env, jclass clazz, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizersOnExit(JNIEnv *env, jclass clazz, s4 par1)
{
- finalizeOnExit = par1;
+#warning threading
+ shouldFinalizersBeRunOnExit=par1;
+}
+
+/*
+ * Class: java/lang/Runtime
+ * Method: runFinalizationsForExit
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizationForExit(JNIEnv *env, jclass clazz)
+{
+ if (shouldFinalizersBeRunOnExit) {
+ gc_call();
+ // gc_finalize_all();
+ }
+ log_text("Java_java_lang_VMRuntime_runFinalizationForExit called");
+
}
* Method: totalMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_totalMemory(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_totalMemory(JNIEnv *env, jclass clazz)
{
return gc_get_heap_size();
}
* Method: traceInstructions
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_traceInstructions(JNIEnv *env, java_lang_Runtime *this, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceInstructions(JNIEnv *env, jclass clazz, s4 par1)
{
/* not supported */
}
* Method: traceMethodCalls
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_traceMethodCalls(JNIEnv *env, java_lang_Runtime *this, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceMethodCalls(JNIEnv *env, jclass clazz, s4 par1)
{
/* not supported */
}
* Method: availableProcessors
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Runtime_availableProcessors(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, jclass clazz)
{
#if defined(_SC_NPROC_ONLN)
return (s4) sysconf(_SC_NPROC_ONLN);
* Method: nativeLoad
* Signature: (Ljava/lang/String;)I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Runtime_nativeLoad(JNIEnv *env, java_lang_Runtime *this, java_lang_String *par1)
+JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_nativeLoad(JNIEnv *env, jclass clazz, java_lang_String *par1)
{
#ifdef JOWENN_DEBUG
char *buffer;
buffer = MNEW(char, buffer_len);
- strcpy(buffer, "Java_java_lang_Runtime_nativeLoad:");
+ strcpy(buffer, "Java_java_lang_VMRuntime_nativeLoad:");
utf_sprint(buffer + strlen((char *) data), data);
log_text(buffer);
MFREE(buffer, char, buffer_len);
#endif
- log_text("Java_java_lang_Runtime_nativeLoad");
+ log_text("Java_java_lang_VMRuntime_nativeLoad");
return 1;
}
/*
- * Class: java_lang_Runtime
+ * Class: java_lang_VMRuntime
* Method: nativeGetLibname
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
-JNIEXPORT java_lang_String* JNICALL Java_java_lang_Runtime_nativeGetLibname(JNIEnv *env, jclass clazz, java_lang_String *par1, java_lang_String *par2)
+JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMRuntime_nativeGetLibname(JNIEnv *env, jclass clazz, java_lang_String *par1, java_lang_String *par2)
{
-#ifdef JOWENN_DEBUG
char *buffer;
int buffer_len;
utf *data;
-
+ java_lang_String *resultString;
data = javastring_toutf(par2, 0);
if (!data) {
return 0;;
}
- buffer_len = utf_strlen(data) + 40;
-
+ buffer_len = utf_strlen(data) + 6/*lib .so*/ +1 /*0*/;
buffer = MNEW(char, buffer_len);
+ sprintf(buffer,"lib");
+ utf_sprint(buffer+3,data);
+ strcat(buffer,".so");
- strcpy(buffer, "Java_java_lang_Runtime_nativeGetLibname:");
- utf_sprint(buffer + strlen((char *) data), data);
- log_text(buffer);
+ log_text(buffer);
+
+ resultString=javastring_new_char(buffer);
MFREE(buffer, char, buffer_len);
-#endif
- log_text("Java_java_lang_Runtime_nativeGetLibname");
- return 0;
+ return resultString;
}
/*
- * Class: java_lang_Runtime
+ * Class: java_lang_VMRuntime
* Method: insertSystemProperties
* Signature: (Ljava/util/Properties;)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_insertSystemProperties(JNIEnv *env, jclass clazz, java_util_Properties *p)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_insertSystemProperties(JNIEnv *env, jclass clazz, java_util_Properties *p)
{
#define BUFFERSIZE 200
/*
- * Class: java_lang_Runtime
+ * Class: java_lang_VMRuntime
* Method: maxMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_maxMemory(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_maxMemory(JNIEnv *env, jclass clazz)
{
return gc_get_max_heap_size();
}
Changes: Joseph Wenninger
- $Id: Thread.c 1067 2004-05-18 10:25:51Z stefan $
+ $Id: Thread.c 1173 2004-06-16 14:56:18Z jowenn $
*/
#include "java_lang_ThreadGroup.h"
#include "java_lang_Object.h" /* needed for java_lang_Thread.h */
#include "java_lang_Throwable.h" /* needed for java_lang_Thread.h */
+#include "java_lang_VMThread.h"
#include "java_lang_Thread.h"
* Method: countStackFrames
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_countStackFrames(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
{
- log_text("java_lang_Thread_countStackFrames called");
+ log_text("java_lang_VMThread_countStackFrames called");
return 0;
}
* Method: currentThread
* Signature: ()Ljava/lang/Thread;
*/
-JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread(JNIEnv *env, jclass clazz)
+JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_VMThread_currentThread(JNIEnv *env, jclass clazz)
{
java_lang_Thread *t;
if (runverbose)
- log_text("java_lang_Thread_currentThread called");
+ log_text("java_lang_VMThread_currentThread called");
#if defined(USE_THREADS)
#if !defined(NATIVE_THREADS)
#endif
if (!t->group) {
- log_text("java_lang_Thread_currentThread: t->group=NULL");
+ log_text("java_lang_VMThread_currentThread: t->group=NULL");
/* ThreadGroup of currentThread is not initialized */
t->group = (java_lang_ThreadGroup *)
* Method: nativeInterrupt
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeInterrupt(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, java_lang_VMThread *this)
{
- log_text("Java_java_lang_Thread_interrupt0 called");
+ log_text("Java_java_lang_VMThread_interrupt0 called");
}
* Method: isAlive
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isAlive(JNIEnv *env, java_lang_VMThread *this)
{
if (runverbose)
- log_text("java_lang_Thread_isAlive called");
+ log_text("java_lang_VMThread_isAlive called");
#if defined(USE_THREADS)
- return aliveThread((thread *) this);
+ return aliveThread((thread *) this->thread);
#endif
}
* Method: isInterrupted
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_isInterrupted(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
{
- log_text("Java_java_lang_Thread_isInterrupted called");
+ log_text("Java_java_lang_VMThread_isInterrupted called");
return 0;
}
* Method: registerNatives
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_registerNatives(JNIEnv *env, jclass clazz)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_registerNatives(JNIEnv *env, jclass clazz)
{
/* empty */
}
* Method: resume0
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeResume(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, java_lang_VMThread *this)
{
if (runverbose)
- log_text("java_lang_Thread_resume0 called");
+ log_text("java_lang_VMThread_resume0 called");
#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
- resumeThread((thread *) this);
+ resumeThread((thread *) this->thread);
#endif
}
* Method: setPriority0
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeSetPriority(JNIEnv *env, java_lang_Thread *this, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, s4 par1)
{
if (runverbose)
- log_text("java_lang_Thread_setPriority0 called");
+ log_text("java_lang_VMThread_setPriority0 called");
#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
- setPriorityThread((thread *) this, par1);
+ setPriorityThread((thread *) this->thread, par1);
#endif
}
* Method: sleep
* Signature: (JI)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_sleep(JNIEnv *env, jclass clazz, s8 millis, s4 par2)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_sleep(JNIEnv *env, jclass clazz, s8 millis, s4 par2)
{
if (runverbose)
- log_text("java_lang_Thread_sleep called");
+ log_text("java_lang_VMThread_sleep called");
#if defined(USE_THREADS)
sleepThread(millis);
* Method: start
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_start(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, s8 par1)
{
if (runverbose)
- log_text("java_lang_Thread_start called");
+ log_text("java_lang_VMThread_start called");
#if defined(USE_THREADS)
- startThread((thread*)this);
+#warning perhaps it would be better to always work with the vmthread structure in the thread code (jowenn)
+ if (this->thread->vmThread==0)
+ this->thread->vmThread=this;
+ startThread((thread*)(this->thread));
#endif
}
* Method: stop0
* Signature: (Ljava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeStop(JNIEnv *env, java_lang_Thread *this, java_lang_Throwable *par1)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop(JNIEnv *env, java_lang_VMThread *this, java_lang_Throwable *par1)
{
if (runverbose)
- log_text ("java_lang_Thread_stop0 called");
+ log_text ("java_lang_VMThread_stop0 called");
#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
- if (currentThread == (thread*)this) {
+ if (currentThread == (thread*)this->thread) {
log_text("killing");
killThread(0);
/*
*/
} else {
- CONTEXT((thread*)this).flags |= THREAD_FLAGS_KILLED;
- resumeThread((thread*)this);
+ /*CONTEXT((thread*)this)*/ this->flags |= THREAD_FLAGS_KILLED;
+ resumeThread((thread*)this->thread);
}
#endif
}
* Method: suspend0
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeSuspend(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_suspend(JNIEnv *env, java_lang_VMThread *this)
{
if (runverbose)
- log_text("java_lang_Thread_suspend0 called");
+ log_text("java_lang_VMThread_suspend0 called");
#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
- suspendThread((thread*)this);
+ suspendThread((thread*)this->thread);
#endif
}
* Method: yield
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_yield(JNIEnv *env, jclass clazz)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_yield(JNIEnv *env, jclass clazz)
{
if (runverbose)
- log_text("java_lang_Thread_yield called");
+ log_text("java_lang_VMThread_yield called");
#if defined(USE_THREADS)
yieldThread();
* Method: interrupted
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_interrupted(JNIEnv *env, jclass clazz)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
{
- log_text("Java_java_lang_Thread_interrupted");
+ log_text("Java_java_lang_VMThread_interrupted");
return 0;
}
* Method: nativeInit
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeInit(JNIEnv *env, java_lang_Thread *this, s8 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeInit(JNIEnv *env, java_lang_VMThread *this, s8 par1)
{
/*
if (*exceptionptr)
log_text("There has been an exception, strange...");*/
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
- initThread(this);
+ initThread(this->thread);
#endif
- this->priority = 5;
+ this->thread->priority = 5;
}
* Method: holdsLock
* Signature: (Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object *par1)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object *par1)
{
return 0;
}
Changes: Joseph Wenninger
- $Id: VMClass.c 1075 2004-05-20 16:58:49Z twisti $
+ $Id: VMClass.c 1173 2004-06-16 14:56:18Z jowenn $
*/
* Method: getClassLoader
* Signature: ()Ljava/lang/ClassLoader;
*/
-JNIEXPORT java_lang_ClassLoader* JNICALL Java_java_lang_VMClass_getClassLoader(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_lang_ClassLoader* JNICALL Java_java_lang_VMClass_getClassLoader(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- return ((classinfo*)(this->vmData))->classloader;
+ return ((classinfo*)that)->classloader;
/* init_systemclassloader();
return SystemClassLoader;*/
* Method: getComponentType
* Signature: ()Ljava/lang/Class;
*/
-JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getComponentType(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getComponentType(JNIEnv *env, jclass clazz,java_lang_Class *that)
{
- classinfo *thisclass = (classinfo *) this->vmData;
+ classinfo *thisclass = (classinfo *) that;
classinfo *c = NULL;
arraydescriptor *desc;
* Method: getDeclaredConstructors
* Signature: (Z)[Ljava/lang/reflect/Constructor;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredConstructors(JNIEnv *env, java_lang_VMClass *this, s4 public_only)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredConstructors(JNIEnv *env, jclass clazz,
+ struct java_lang_Class *that, s4 public_only)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
java_objectheader *o;
classinfo *class_constructor;
java_objectarray *array_constructor; /* result: array of Method-objects */
* Method: getDeclaredClasses
* Signature: (Z)[Ljava/lang/Class;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredClasses(JNIEnv *env, java_lang_VMClass *this, s4 publicOnly)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredClasses(JNIEnv *env, jclass clazz, java_lang_Class *that, s4 publicOnly)
{
#if defined(__GNUC__)
#warning fix the public only case
#endif
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
int pos = 0; /* current declared class */
int declaredclasscount = 0; /* number of declared classes */
java_objectarray *result; /* array of declared classes */
int notPublicOnly = !publicOnly;
int i;
- if (!this)
- return NULL;
-
- if (!this->vmData)
+ if (!that)
return NULL;
/*printf("PublicOnly: %d\n",publicOnly);*/
- if (!Java_java_lang_VMClass_isPrimitive(env, (java_lang_VMClass *) c) && (c->name->text[0] != '[')) {
+ if (!Java_java_lang_VMClass_isPrimitive(env, clazz, (java_lang_Class *) c) && (c->name->text[0] != '[')) {
/* determine number of declared classes */
for (i = 0; i < c->innerclasscount; i++) {
if ( (c->innerclass[i].outer_class == c) && (notPublicOnly || (c->innerclass[i].flags & ACC_PUBLIC)))
* Method: getDeclaringClass
* Signature: ()Ljava/lang/Class;
*/
-JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getDeclaringClass(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getDeclaringClass(JNIEnv *env, jclass clazz, struct java_lang_Class *that)
{
#if defined(__GNUC__)
#warning fixme
#endif
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
- if (this && this->vmData && !Java_java_lang_VMClass_isPrimitive(env, this) && (c->name->text[0] != '[')) {
+ if (that && !Java_java_lang_VMClass_isPrimitive(env, clazz,that) && (c->name->text[0] != '[')) {
int i;
if (c->innerclasscount == 0) /* no innerclasses exist */
}
-/*
- * Class: java/lang/Class
- * Method: getField0
- * Signature: (Ljava/lang/String;I)Ljava/lang/reflect/Field;
- */
-JNIEXPORT java_lang_reflect_Field* JNICALL Java_java_lang_VMClass_getField0(JNIEnv *env, java_lang_VMClass *this, java_lang_String *name, s4 public_only)
+java_lang_reflect_Field* cacao_getField0(JNIEnv *env, java_lang_Class *that, java_lang_String *name, s4 public_only)
{
classinfo *c;
classinfo *fieldtype;
o = (java_lang_reflect_Field *) native_new_and_init(c);
/* get fieldinfo entry */
- idx = class_findfield_index_approx((classinfo *) this->vmData, javastring_toutf(name, false));
+ idx = class_findfield_index_approx((classinfo *) that, javastring_toutf(name, false));
if (idx < 0) {
*exceptionptr = new_exception(string_java_lang_NoSuchFieldException);
return NULL;
}
- f = &(((classinfo *) this->vmData)->fields[idx]);
+ f = &(((classinfo *) that)->fields[idx]);
if (f) {
if (public_only && !(f->flags & ACC_PUBLIC)) {
/* field is not public and public only had been requested*/
return NULL;
/* initialize instance fields */
- setfield_critical(c,o,"declaringClass", "Ljava/lang/Class;", jobject, (jobject) (this->vmData) /*this*/);
+ setfield_critical(c,o,"declaringClass", "Ljava/lang/Class;", jobject, (jobject) that /*this*/);
/* ((java_lang_reflect_Field*)(o))->flag=f->flags;*/
/* save type in slot-field for faster processing */
/* setfield_critical(c,o,"flag", "I", jint, (jint) f->flags); */
* Method: getDeclaredFields
* Signature: (Z)[Ljava/lang/reflect/Field;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredFields(JNIEnv *env, java_lang_VMClass *this, s4 public_only)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredFields(JNIEnv *env, jclass clazz, java_lang_Class *that, s4 public_only)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
classinfo *class_field;
java_objectarray *array_field; /* result: array of field-objects */
int public_fields = 0; /* number of elements in field-array */
for (i = 0; i < c->fieldscount; i++)
if ( (c->fields[i].flags & ACC_PUBLIC) || (!public_only))
array_field->data[pos++] =
- (java_objectheader *) Java_java_lang_VMClass_getField0(env,
- this,
- (java_lang_String *) javastring_new(c->fields[i].name),
- public_only);
+ (java_objectheader *) cacao_getField0(env,
+ that, (java_lang_String *) javastring_new(c->fields[i].name),public_only);
return array_field;
}
* Method: getInterfaces
* Signature: ()[Ljava/lang/Class;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getInterfaces(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getInterfaces(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
u4 i;
java_objectarray *a;
}
-/*
- * Class: java/lang/Class
- * Method: getMethod0
- * Signature: (Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;
- */
-JNIEXPORT java_lang_reflect_Method* JNICALL Java_java_lang_VMClass_getMethod0(JNIEnv *env, java_lang_Class *this, java_lang_String *name, java_objectarray *types, s4 which)
+java_lang_reflect_Method* cacao_getMethod0(JNIEnv *env, java_lang_Class *that, java_lang_String *name, java_objectarray *types, s4 which)
{
classinfo *c;
- classinfo *clazz = (classinfo *) this;
+ classinfo *clazz = (classinfo *) that;
java_lang_reflect_Method* o; /* result: Method-object */
java_objectarray *exceptiontypes; /* the exceptions thrown by the method */
methodinfo *m; /* the method to be represented */
* Method: getDeclaredMethods
* Signature: (Z)[Ljava/lang/reflect/Method;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredMethods(JNIEnv *env, java_lang_VMClass *this, s4 public_only)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredMethods(JNIEnv *env, jclass clazz, java_lang_Class *that, s4 public_only)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
java_objectheader *o;
classinfo *class_method;
java_objectarray *array_method; /* result: array of Method-objects */
/* JOWENN: array classes do not declare methods according to mauve test. It should be considered, if
we should return to my old clone method overriding instead of declaring it as a member function */
- if (Java_java_lang_VMClass_isArray(env, this)) {
+ if (Java_java_lang_VMClass_isArray(env, clazz,that)) {
return builtin_anewarray(0, class_method);
}
* Method: getModifiers
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_getModifiers(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_getModifiers(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *c = (classinfo *) (this->vmData);
+ classinfo *c = (classinfo *) that;
return c->flags;
}
* Method: getName
* Signature: ()Ljava/lang/String;
*/
-JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMClass_getName(JNIEnv *env, java_lang_VMClass* this)
+JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMClass_getName(JNIEnv *env, jclass clazz, java_lang_Class* that)
{
u4 i;
- classinfo *c = (classinfo *) (this->vmData);
+ classinfo *c = (classinfo *) that;
java_lang_String *s = (java_lang_String *) javastring_new(c->name);
if (!s)
}
-/*
- * Class: java/lang/Class
- * Method: getProtectionDomain0
- * Signature: ()Ljava/security/ProtectionDomain;
- */
-JNIEXPORT java_security_ProtectionDomain* JNICALL Java_java_lang_VMClass_getProtectionDomain0(JNIEnv *env, java_lang_Class *this)
-{
- log_text("Java_java_lang_VMClass_getProtectionDomain0");
- return NULL;
-}
-
-
-/*
- * Class: java/lang/Class
- * Method: getSigners
- * Signature: ()[Ljava/lang/Object;
- */
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getSigners(JNIEnv *env, java_lang_Class *this)
-{
- log_text("Java_java_lang_VMClass_getSigners");
- return NULL;
-}
-
/*
* Class: java/lang/Class
* Method: getSuperclass
* Signature: ()Ljava/lang/Class;
*/
-JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getSuperclass(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getSuperclass(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *cl = (classinfo *) this->vmData;
+ classinfo *cl = (classinfo *) that;
classinfo *c = cl->super;
if (!c)
* Method: isArray
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isArray(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isArray(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
return c->vftbl->arraydesc != NULL;
}
* Method: isAssignableFrom
* Signature: (Ljava/lang/Class;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isAssignableFrom(JNIEnv *env, java_lang_VMClass *this, java_lang_Class *sup)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isAssignableFrom(JNIEnv *env, jclass clazz, java_lang_Class *that, java_lang_Class *sup)
{
/* log_text("Java_java_lang_VMClass_isAssignableFrom");*/
- if (!this) return 0;
+
if (!sup) return 0;
- if (!this->vmData) {
+ if (!that) {
panic("sup->vmClass is NULL in VMClass.isAssignableFrom");
return 0;
}
- return (*env)->IsAssignableForm(env, (jclass) sup, (jclass) (this->vmData));
+ return (*env)->IsAssignableForm(env, (jclass) sup, (jclass) that);
}
* Method: isInstance
* Signature: (Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInstance(JNIEnv *env, java_lang_VMClass *this, java_lang_Object *obj)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInstance(JNIEnv *env, jclass clazz, java_lang_Class *that, java_lang_Object *obj)
{
- classinfo *clazz = (classinfo *) this->vmData;
+ classinfo *clazz = (classinfo *) that;
- return (*env)->IsInstanceOf(env, (jobject) obj, clazz);
+ return (*env)->IsInstanceOf(env, (jobject) obj, that);
}
* Method: isInterface
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInterface(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInterface(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
if (c->flags & ACC_INTERFACE)
return true;
* Method: isPrimitive
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isPrimitive(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isPrimitive(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
int i;
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
/* search table of primitive classes */
for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
}
-/*
- * Class: java/lang/Class
- * Method: registerNatives
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_registerNatives(JNIEnv *env)
-{
- /* empty */
-}
-
-
-/*
- * Class: java/lang/Class
- * Method: setProtectionDomain0
- * Signature: (Ljava/security/ProtectionDomain;)V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_setProtectionDomain0(JNIEnv *env, java_lang_Class *this, java_security_ProtectionDomain *par1)
-{
- if (verbose)
- log_text("Java_java_lang_VMClass_setProtectionDomain0");
-}
-
-
-/*
- * Class: java/lang/Class
- * Method: setSigners
- * Signature: ([Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_setSigners(JNIEnv *env, java_lang_Class *this, java_objectarray *par1)
-{
- if (verbose)
- log_text("Java_java_lang_VMClass_setSigners");
-}
/*
* Method: initialize
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMClass_initialize(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT void JNICALL Java_java_lang_VMClass_initialize(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
log_text("Java_java_lang_VMClass_initialize");
}
}
-/*
- * Class: java_lang_VMClass
- * Method: step7
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_step7(JNIEnv *env, java_lang_VMClass *this)
-{
- log_text("Java_java_lang_VMClass_step7");
-}
-/*
- * Class: java_lang_VMClass
- * Method: step8
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_step8(JNIEnv *env, java_lang_VMClass *this)
-{
- log_text("Java_java_lang_VMClass_step8");
-}
-
-
-/*
- * Class: java_lang_VMClass
- * Method: isInitialized
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInitialized(JNIEnv *env, java_lang_VMClass *this)
-{
- log_text("Java_java_lang_VMClass_isInitialized");
-
- return 1;
-}
-
-
-/*
- * Class: java_lang_VMClass
- * Method: setInitialized
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_setInitialized(JNIEnv *env, java_lang_VMClass *this)
-{
- log_text("Java_java_lang_VMClass_setInitialized");
-}
-
/*
* These are local overrides for various environment variables in Emacs.
--- /dev/null
+/* This file is machine generated, don't edit it !*/
+
+#ifndef _GNU_JAVA_NET_PLAINDATAGRAMSOCKETIMPL_H
+#define _GNU_JAVA_NET_PLAINDATAGRAMSOCKETIMPL_H
+
+/* Structure information for class: gnu/java/net/PlainDatagramSocketImpl */
+
+typedef struct gnu_java_net_PlainDatagramSocketImpl {
+ java_objectheader header;
+ s4 localPort;
+ struct java_io_FileDescriptor* fd;
+ s4 native_fd;
+ struct java_lang_Object* RECEIVE_LOCK;
+ struct java_lang_Object* SEND_LOCK;
+} gnu_java_net_PlainDatagramSocketImpl;
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: bind
+ * Signature: (ILjava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_bind(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this, s4 par1, struct java_net_InetAddress* par2);
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: create
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_create(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this);
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: sendto
+ * Signature: (Ljava/net/InetAddress;I[BII)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_sendto(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this, struct java_net_InetAddress* par1, s4 par2, java_bytearray* par3, s4 par4, s4 par5);
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: receive0
+ * Signature: (Ljava/net/DatagramPacket;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this, struct java_net_DatagramPacket* par1);
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: setOption
+ * Signature: (ILjava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_setOption(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this, s4 par1, struct java_lang_Object* par2);
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: getOption
+ * Signature: (I)Ljava/lang/Object;
+ */
+JNIEXPORT struct java_lang_Object* JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_getOption(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this, s4 par1);
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: close
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_close(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this);
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: join
+ * Signature: (Ljava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_join(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this, struct java_net_InetAddress* par1);
+
+
+/*
+ * Class: gnu/java/net/PlainDatagramSocketImpl
+ * Method: leave
+ * Signature: (Ljava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainDatagramSocketImpl_leave(JNIEnv *env, struct gnu_java_net_PlainDatagramSocketImpl* this, struct java_net_InetAddress* par1);
+
+#endif
+
--- /dev/null
+/* This file is machine generated, don't edit it !*/
+
+#ifndef _GNU_JAVA_NET_PLAINSOCKETIMPL_H
+#define _GNU_JAVA_NET_PLAINSOCKETIMPL_H
+
+/* Structure information for class: gnu/java/net/PlainSocketImpl */
+
+typedef struct gnu_java_net_PlainSocketImpl {
+ java_objectheader header;
+ struct java_net_InetAddress* address;
+ struct java_io_FileDescriptor* fd;
+ s4 localport;
+ s4 port;
+ s4 native_fd;
+ struct java_io_InputStream* in;
+ struct java_io_OutputStream* out;
+ s4 inChannelOperation;
+} gnu_java_net_PlainSocketImpl;
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: setOption
+ * Signature: (ILjava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_setOption(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, s4 par1, struct java_lang_Object* par2);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: getOption
+ * Signature: (I)Ljava/lang/Object;
+ */
+JNIEXPORT struct java_lang_Object* JNICALL Java_gnu_java_net_PlainSocketImpl_getOption(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, s4 par1);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: create
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_create(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, s4 par1);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: connect
+ * Signature: (Ljava/net/InetAddress;I)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_connect(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, struct java_net_InetAddress* par1, s4 par2);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: bind
+ * Signature: (Ljava/net/InetAddress;I)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_bind(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, struct java_net_InetAddress* par1, s4 par2);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: listen
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_listen(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, s4 par1);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: accept
+ * Signature: (Ljava/net/SocketImpl;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_accept(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, struct java_net_SocketImpl* par1);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: available
+ * Signature: ()I
+ */
+JNIEXPORT s4 JNICALL Java_gnu_java_net_PlainSocketImpl_available(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: close
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_close(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: read
+ * Signature: ([BII)I
+ */
+JNIEXPORT s4 JNICALL Java_gnu_java_net_PlainSocketImpl_read(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, java_bytearray* par1, s4 par2, s4 par3);
+
+
+/*
+ * Class: gnu/java/net/PlainSocketImpl
+ * Method: write
+ * Signature: ([BII)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_write(JNIEnv *env, struct gnu_java_net_PlainSocketImpl* this, java_bytearray* par1, s4 par2, s4 par3);
+
+#endif
+
s8 position;
s8 size;
s4 shared;
- struct java_io_FileDescriptor* fd;
- s4 released;
+ struct gnu_java_nio_channels_FileChannelImpl* ch;
} gnu_java_nio_FileLockImpl;
-
-/*
- * Class: gnu/java/nio/FileLockImpl
- * Method: releaseImpl
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_gnu_java_nio_FileLockImpl_releaseImpl(JNIEnv *env, struct gnu_java_nio_FileLockImpl* this);
-
#endif
java_objectheader header;
s4 closed;
struct java_nio_channels_spi_SelectorProvider* provider;
- s4 closed0;
struct java_util_Set* keys;
struct java_util_Set* selected;
- struct java_util_Set* canceled;
+ struct java_lang_Object* selectThreadMutex;
+ struct java_lang_Thread* selectThread;
+ s4 unhandledWakeup;
} gnu_java_nio_SelectorImpl;
+
+/*
+ * Class: gnu/java/nio/SelectorImpl
+ * Method: implSelect
+ * Signature: ([I[I[IJ)I
+ */
+JNIEXPORT s4 JNICALL Java_gnu_java_nio_SelectorImpl_implSelect(JNIEnv *env, jclass clazz, java_intarray* par1, java_intarray* par2, java_intarray* par3, s8 par4);
+
#endif
--- /dev/null
+/* This file is machine generated, don't edit it !*/
+
+#ifndef _GNU_JAVA_NIO_CHANNELS_FILECHANNELIMPL_H
+#define _GNU_JAVA_NIO_CHANNELS_FILECHANNELIMPL_H
+
+/* Structure information for class: gnu/java/nio/channels/FileChannelImpl */
+
+typedef struct gnu_java_nio_channels_FileChannelImpl {
+ java_objectheader header;
+ s4 opened;
+ s4 fd;
+ s4 mode;
+} gnu_java_nio_channels_FileChannelImpl;
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_init(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: open
+ * Signature: (Ljava/lang/String;I)I
+ */
+JNIEXPORT s4 JNICALL Java_gnu_java_nio_channels_FileChannelImpl_open(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, struct java_lang_String* par1, s4 par2);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: available
+ * Signature: ()I
+ */
+JNIEXPORT s4 JNICALL Java_gnu_java_nio_channels_FileChannelImpl_available(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: implPosition
+ * Signature: ()J
+ */
+JNIEXPORT s8 JNICALL Java_gnu_java_nio_channels_FileChannelImpl_implPosition(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: seek
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_seek(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, s8 par1);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: implTruncate
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_implTruncate(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, s8 par1);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: unlock
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_unlock(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, s8 par1, s8 par2);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: size
+ * Signature: ()J
+ */
+JNIEXPORT s8 JNICALL Java_gnu_java_nio_channels_FileChannelImpl_size(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: implCloseChannel
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_implCloseChannel(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: read
+ * Signature: ()I
+ */
+JNIEXPORT s4 JNICALL Java_gnu_java_nio_channels_FileChannelImpl_read__(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: read
+ * Signature: ([BII)I
+ */
+JNIEXPORT s4 JNICALL Java_gnu_java_nio_channels_FileChannelImpl_read___3BII(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, java_bytearray* par1, s4 par2, s4 par3);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: write
+ * Signature: ([BII)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_write___3BII(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, java_bytearray* par1, s4 par2, s4 par3);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: write
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_write__I(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, s4 par1);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: mapImpl
+ * Signature: (CJI)Ljava/nio/MappedByteBuffer;
+ */
+JNIEXPORT struct java_nio_MappedByteBuffer* JNICALL Java_gnu_java_nio_channels_FileChannelImpl_mapImpl(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, s4 par1, s8 par2, s4 par3);
+
+
+/*
+ * Class: gnu/java/nio/channels/FileChannelImpl
+ * Method: lock
+ * Signature: (JJZZ)Z
+ */
+JNIEXPORT s4 JNICALL Java_gnu_java_nio_channels_FileChannelImpl_lock(JNIEnv *env, struct gnu_java_nio_channels_FileChannelImpl* this, s8 par1, s8 par2, s4 par3, s4 par4);
+
+#endif
+
struct java_lang_String* path;
} java_io_File;
-
-/*
- * Class: java/io/File
- * Method: isFileInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_isFileInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: isDirectoryInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_isDirectoryInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: canReadInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_canReadInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: canWriteInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_canWriteInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: deleteInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_deleteInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: existsInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_existsInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: lastModifiedInternal
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_File_lastModifiedInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: lengthInternal
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_File_lengthInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: listInternal
- * Signature: (Ljava/lang/String;)[Ljava/lang/String;
- */
-JNIEXPORT java_objectarray* JNICALL Java_java_io_File_listInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: mkdirInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_mkdirInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: createInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_createInternal(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: setReadOnlyInternal
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_setReadOnlyInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/io/File
- * Method: renameToInternal
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_renameToInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1, struct java_lang_String* par2);
-
-
-/*
- * Class: java/io/File
- * Method: setLastModifiedInternal
- * Signature: (Ljava/lang/String;J)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_File_setLastModifiedInternal(JNIEnv *env, struct java_io_File* this, struct java_lang_String* par1, s8 par2);
-
#endif
typedef struct java_io_FileDescriptor {
java_objectheader header;
- s8 nativeFd;
+ struct java_nio_channels_ByteChannel* channel;
} java_io_FileDescriptor;
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeInit
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_io_FileDescriptor_nativeInit(JNIEnv *env, jclass clazz);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeOpen
- * Signature: (Ljava/lang/String;I)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_FileDescriptor_nativeOpen(JNIEnv *env, struct java_io_FileDescriptor* this, struct java_lang_String* par1, s4 par2);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeClose
- * Signature: (J)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_FileDescriptor_nativeClose(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeWriteByte
- * Signature: (JI)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_FileDescriptor_nativeWriteByte(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1, s4 par2);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeWriteBuf
- * Signature: (J[BII)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_FileDescriptor_nativeWriteBuf(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1, java_bytearray* par2, s4 par3, s4 par4);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeReadByte
- * Signature: (J)I
- */
-JNIEXPORT s4 JNICALL Java_java_io_FileDescriptor_nativeReadByte(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeReadBuf
- * Signature: (J[BII)I
- */
-JNIEXPORT s4 JNICALL Java_java_io_FileDescriptor_nativeReadBuf(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1, java_bytearray* par2, s4 par3, s4 par4);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeAvailable
- * Signature: (J)I
- */
-JNIEXPORT s4 JNICALL Java_java_io_FileDescriptor_nativeAvailable(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeSeek
- * Signature: (JJIZ)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_FileDescriptor_nativeSeek(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1, s8 par2, s4 par3, s4 par4);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeGetFilePointer
- * Signature: (J)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_FileDescriptor_nativeGetFilePointer(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeGetLength
- * Signature: (J)J
- */
-JNIEXPORT s8 JNICALL Java_java_io_FileDescriptor_nativeGetLength(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeSetLength
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL Java_java_io_FileDescriptor_nativeSetLength(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1, s8 par2);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeValid
- * Signature: (J)Z
- */
-JNIEXPORT s4 JNICALL Java_java_io_FileDescriptor_nativeValid(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1);
-
-
-/*
- * Class: java/io/FileDescriptor
- * Method: nativeSync
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_java_io_FileDescriptor_nativeSync(JNIEnv *env, struct java_io_FileDescriptor* this, s8 par1);
-
#endif
typedef struct java_io_FileInputStream {
java_objectheader header;
struct java_io_FileDescriptor* fd;
- struct java_nio_channels_FileChannel* ch;
+ struct gnu_java_nio_channels_FileChannelImpl* ch;
} java_io_FileInputStream;
#endif
s4 isDeserializing;
s4 fieldsAlreadyRead;
struct java_util_Vector* validators;
+ struct java_util_Hashtable* classLookupTable;
+ struct java_io_ObjectInputStream_GetField* prereadFields;
} java_io_ObjectInputStream;
typedef struct java_io_RandomAccessFile {
java_objectheader header;
+ struct gnu_java_nio_channels_FileChannelImpl* ch;
struct java_io_FileDescriptor* fd;
struct java_io_DataOutputStream* out;
struct java_io_DataInputStream* in;
- struct java_nio_channels_FileChannel* ch;
} java_io_RandomAccessFile;
#endif
--- /dev/null
+/* This file is machine generated, don't edit it !*/
+
+#ifndef _JAVA_IO_VMFILE_H
+#define _JAVA_IO_VMFILE_H
+
+/* Structure information for class: java/io/VMFile */
+
+typedef struct java_io_VMFile {
+ java_objectheader header;
+} java_io_VMFile;
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: lastModified
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT s8 JNICALL Java_java_io_VMFile_lastModified(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: setReadOnly
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_setReadOnly(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: create
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_create(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: list
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT java_objectarray* JNICALL Java_java_io_VMFile_list(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: renameTo
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_renameTo(JNIEnv *env, jclass clazz, struct java_lang_String* par1, struct java_lang_String* par2);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: length
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT s8 JNICALL Java_java_io_VMFile_length(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: exists
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_exists(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: delete
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_delete(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: setLastModified
+ * Signature: (Ljava/lang/String;J)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_setLastModified(JNIEnv *env, jclass clazz, struct java_lang_String* par1, s8 par2);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: mkdir
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_mkdir(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: isFile
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_isFile(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: canWrite
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_canWrite(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: canRead
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_canRead(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/io/VMFile
+ * Method: isDirectory
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_io_VMFile_isDirectory(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+#endif
+
*/
JNIEXPORT s4 JNICALL Java_java_io_VMObjectStreamClass_hasClassInitializer(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setDoubleNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;D)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setDoubleNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, double par3);
+
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setFloatNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;F)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setFloatNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, float par3);
+
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setLongNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;J)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setLongNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, s8 par3);
+
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setIntNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;I)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setIntNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, s4 par3);
+
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setShortNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;S)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setShortNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, s4 par3);
+
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setCharNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;C)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setCharNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, s4 par3);
+
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setByteNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;B)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setByteNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, s4 par3);
+
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setBooleanNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;Z)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setBooleanNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, s4 par3);
+
+
+/*
+ * Class: java/io/VMObjectStreamClass
+ * Method: setObjectNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_java_io_VMObjectStreamClass_setObjectNative(JNIEnv *env, jclass clazz, struct java_lang_reflect_Field* par1, struct java_lang_Object* par2, struct java_lang_Object* par3);
+
#endif
java_objectheader header;
java_objectarray* signers;
struct java_security_ProtectionDomain* pd;
- struct java_lang_VMClass* vmClass;
+ struct java_lang_Object* vmdata;
struct java_lang_reflect_Constructor* constructor;
} java_lang_Class;
struct java_util_Set* shutdownHooks;
} java_lang_Runtime;
-
-/*
- * Class: java/lang/Runtime
- * Method: availableProcessors
- * Signature: ()I
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Runtime_availableProcessors(JNIEnv *env, struct java_lang_Runtime* this);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: freeMemory
- * Signature: ()J
- */
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_freeMemory(JNIEnv *env, struct java_lang_Runtime* this);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: totalMemory
- * Signature: ()J
- */
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_totalMemory(JNIEnv *env, struct java_lang_Runtime* this);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: maxMemory
- * Signature: ()J
- */
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_maxMemory(JNIEnv *env, struct java_lang_Runtime* this);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: gc
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Runtime_gc(JNIEnv *env, struct java_lang_Runtime* this);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: runFinalization
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Runtime_runFinalization(JNIEnv *env, struct java_lang_Runtime* this);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: traceInstructions
- * Signature: (Z)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Runtime_traceInstructions(JNIEnv *env, struct java_lang_Runtime* this, s4 par1);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: traceMethodCalls
- * Signature: (Z)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Runtime_traceMethodCalls(JNIEnv *env, struct java_lang_Runtime* this, s4 par1);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: runFinalizersOnExitInternal
- * Signature: (Z)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Runtime_runFinalizersOnExitInternal(JNIEnv *env, jclass clazz, s4 par1);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: exitInternal
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Runtime_exitInternal(JNIEnv *env, struct java_lang_Runtime* this, s4 par1);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: nativeLoad
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Runtime_nativeLoad(JNIEnv *env, struct java_lang_Runtime* this, struct java_lang_String* par1);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: nativeGetLibname
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT struct java_lang_String* JNICALL Java_java_lang_Runtime_nativeGetLibname(JNIEnv *env, jclass clazz, struct java_lang_String* par1, struct java_lang_String* par2);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: execInternal
- * Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Ljava/lang/Process;
- */
-JNIEXPORT struct java_lang_Process* JNICALL Java_java_lang_Runtime_execInternal(JNIEnv *env, struct java_lang_Runtime* this, java_objectarray* par1, java_objectarray* par2, struct java_io_File* par3);
-
-
-/*
- * Class: java/lang/Runtime
- * Method: insertSystemProperties
- * Signature: (Ljava/util/Properties;)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Runtime_insertSystemProperties(JNIEnv *env, jclass clazz, struct java_util_Properties* par1);
-
#endif
typedef struct java_lang_Thread {
java_objectheader header;
+ struct java_lang_VMThread* vmThread;
struct java_lang_ThreadGroup* group;
- struct java_lang_Runnable* toRun;
+ struct java_lang_Runnable* runnable;
struct java_lang_String* name;
- s8 PrivateInfo;
- struct java_lang_Thread* next;
s4 daemon;
s4 priority;
+ s8 stacksize;
+ struct java_lang_Throwable* stillborn;
struct java_lang_ClassLoader* contextClassLoader;
} java_lang_Thread;
-
-/*
- * Class: java/lang/Thread
- * Method: currentThread
- * Signature: ()Ljava/lang/Thread;
- */
-JNIEXPORT struct java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread(JNIEnv *env, jclass clazz);
-
-
-/*
- * Class: java/lang/Thread
- * Method: yield
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_yield(JNIEnv *env, jclass clazz);
-
-
-/*
- * Class: java/lang/Thread
- * Method: sleep
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_sleep(JNIEnv *env, jclass clazz, s8 par1, s4 par2);
-
-
-/*
- * Class: java/lang/Thread
- * Method: start
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_start(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: interrupted
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_interrupted(JNIEnv *env, jclass clazz);
-
-
-/*
- * Class: java/lang/Thread
- * Method: isInterrupted
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_isInterrupted(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: isAlive
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: countStackFrames
- * Signature: ()I
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_countStackFrames(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: holdsLock
- * Signature: (Ljava/lang/Object;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_holdsLock(JNIEnv *env, jclass clazz, struct java_lang_Object* par1);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeInit
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeInit(JNIEnv *env, struct java_lang_Thread* this, s8 par1);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeStop
- * Signature: (Ljava/lang/Throwable;)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeStop(JNIEnv *env, struct java_lang_Thread* this, struct java_lang_Throwable* par1);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeInterrupt
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeInterrupt(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeSuspend
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeSuspend(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeResume
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeResume(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeSetPriority
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeSetPriority(JNIEnv *env, struct java_lang_Thread* this, s4 par1);
-
#endif
typedef struct java_lang_VMClass {
java_objectheader header;
- s4 initializing_thread;
- s4 erroneous_state;
- struct gnu_classpath_RawData* vmData;
} java_lang_VMClass;
-/*
- * Class: java/lang/VMClass
- * Method: isInitialized
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInitialized(JNIEnv *env, struct java_lang_VMClass* this);
-
-
-/*
- * Class: java/lang/VMClass
- * Method: setInitialized
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_setInitialized(JNIEnv *env, struct java_lang_VMClass* this);
-
-
-/*
- * Class: java/lang/VMClass
- * Method: step7
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_step7(JNIEnv *env, struct java_lang_VMClass* this);
-
-
-/*
- * Class: java/lang/VMClass
- * Method: step8
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_step8(JNIEnv *env, struct java_lang_VMClass* this);
-
-
/*
* Class: java/lang/VMClass
* Method: isInstance
- * Signature: (Ljava/lang/Object;)Z
+ * Signature: (Ljava/lang/Class;Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInstance(JNIEnv *env, struct java_lang_VMClass* this, struct java_lang_Object* par1);
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInstance(JNIEnv *env, jclass clazz, struct java_lang_Class* par1, struct java_lang_Object* par2);
/*
* Class: java/lang/VMClass
* Method: isAssignableFrom
- * Signature: (Ljava/lang/Class;)Z
+ * Signature: (Ljava/lang/Class;Ljava/lang/Class;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isAssignableFrom(JNIEnv *env, struct java_lang_VMClass* this, struct java_lang_Class* par1);
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isAssignableFrom(JNIEnv *env, jclass clazz, struct java_lang_Class* par1, struct java_lang_Class* par2);
/*
* Class: java/lang/VMClass
* Method: isInterface
- * Signature: ()Z
+ * Signature: (Ljava/lang/Class;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInterface(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInterface(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: isPrimitive
- * Signature: ()Z
+ * Signature: (Ljava/lang/Class;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isPrimitive(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isPrimitive(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: getName
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT struct java_lang_String* JNICALL Java_java_lang_VMClass_getName(JNIEnv *env, struct java_lang_VMClass* this);
-
-
-/*
- * Class: java/lang/VMClass
- * Method: getBeautifiedName
* Signature: (Ljava/lang/Class;)Ljava/lang/String;
*/
-JNIEXPORT struct java_lang_String* JNICALL Java_java_lang_VMClass_getBeautifiedName(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
+JNIEXPORT struct java_lang_String* JNICALL Java_java_lang_VMClass_getName(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: getSuperclass
- * Signature: ()Ljava/lang/Class;
+ * Signature: (Ljava/lang/Class;)Ljava/lang/Class;
*/
-JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_VMClass_getSuperclass(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_VMClass_getSuperclass(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: getInterfaces
- * Signature: ()[Ljava/lang/Class;
+ * Signature: (Ljava/lang/Class;)[Ljava/lang/Class;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getInterfaces(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getInterfaces(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: getComponentType
- * Signature: ()Ljava/lang/Class;
+ * Signature: (Ljava/lang/Class;)Ljava/lang/Class;
*/
-JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_VMClass_getComponentType(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_VMClass_getComponentType(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: getModifiers
- * Signature: ()I
+ * Signature: (Ljava/lang/Class;)I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_getModifiers(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_getModifiers(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: getDeclaringClass
- * Signature: ()Ljava/lang/Class;
+ * Signature: (Ljava/lang/Class;)Ljava/lang/Class;
*/
-JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_VMClass_getDeclaringClass(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_VMClass_getDeclaringClass(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: getDeclaredClasses
- * Signature: (Z)[Ljava/lang/Class;
+ * Signature: (Ljava/lang/Class;Z)[Ljava/lang/Class;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredClasses(JNIEnv *env, struct java_lang_VMClass* this, s4 par1);
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredClasses(JNIEnv *env, jclass clazz, struct java_lang_Class* par1, s4 par2);
/*
* Class: java/lang/VMClass
* Method: getDeclaredFields
- * Signature: (Z)[Ljava/lang/reflect/Field;
+ * Signature: (Ljava/lang/Class;Z)[Ljava/lang/reflect/Field;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredFields(JNIEnv *env, struct java_lang_VMClass* this, s4 par1);
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredFields(JNIEnv *env, jclass clazz, struct java_lang_Class* par1, s4 par2);
/*
* Class: java/lang/VMClass
* Method: getDeclaredMethods
- * Signature: (Z)[Ljava/lang/reflect/Method;
+ * Signature: (Ljava/lang/Class;Z)[Ljava/lang/reflect/Method;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredMethods(JNIEnv *env, struct java_lang_VMClass* this, s4 par1);
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredMethods(JNIEnv *env, jclass clazz, struct java_lang_Class* par1, s4 par2);
/*
* Class: java/lang/VMClass
* Method: getDeclaredConstructors
- * Signature: (Z)[Ljava/lang/reflect/Constructor;
+ * Signature: (Ljava/lang/Class;Z)[Ljava/lang/reflect/Constructor;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredConstructors(JNIEnv *env, struct java_lang_VMClass* this, s4 par1);
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredConstructors(JNIEnv *env, jclass clazz, struct java_lang_Class* par1, s4 par2);
/*
* Class: java/lang/VMClass
* Method: getClassLoader
- * Signature: ()Ljava/lang/ClassLoader;
+ * Signature: (Ljava/lang/Class;)Ljava/lang/ClassLoader;
*/
-JNIEXPORT struct java_lang_ClassLoader* JNICALL Java_java_lang_VMClass_getClassLoader(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT struct java_lang_ClassLoader* JNICALL Java_java_lang_VMClass_getClassLoader(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
/*
* Class: java/lang/VMClass
* Method: isArray
- * Signature: ()I
+ * Signature: (Ljava/lang/Class;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isArray(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isArray(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
* Class: java/lang/VMClass
* Method: initialize
- * Signature: ()V
+ * Signature: (Ljava/lang/Class;)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMClass_initialize(JNIEnv *env, struct java_lang_VMClass* this);
+JNIEXPORT void JNICALL Java_java_lang_VMClass_initialize(JNIEnv *env, jclass clazz, struct java_lang_Class* par1);
/*
--- /dev/null
+/* This file is machine generated, don't edit it !*/
+
+#ifndef _JAVA_LANG_VMRUNTIME_H
+#define _JAVA_LANG_VMRUNTIME_H
+
+/* Structure information for class: java/lang/VMRuntime */
+
+typedef struct java_lang_VMRuntime {
+ java_objectheader header;
+} java_lang_VMRuntime;
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: availableProcessors
+ * Signature: ()I
+ */
+JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: freeMemory
+ * Signature: ()J
+ */
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_freeMemory(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: totalMemory
+ * Signature: ()J
+ */
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_totalMemory(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: maxMemory
+ * Signature: ()J
+ */
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_maxMemory(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: gc
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_gc(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: runFinalization
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalization(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: runFinalizationForExit
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizationForExit(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: traceInstructions
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceInstructions(JNIEnv *env, jclass clazz, s4 par1);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: traceMethodCalls
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceMethodCalls(JNIEnv *env, jclass clazz, s4 par1);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: runFinalizersOnExit
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizersOnExit(JNIEnv *env, jclass clazz, s4 par1);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: exit
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit(JNIEnv *env, jclass clazz, s4 par1);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: nativeLoad
+ * Signature: (Ljava/lang/String;)I
+ */
+JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_nativeLoad(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: nativeGetLibname
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT struct java_lang_String* JNICALL Java_java_lang_VMRuntime_nativeGetLibname(JNIEnv *env, jclass clazz, struct java_lang_String* par1, struct java_lang_String* par2);
+
+
+/*
+ * Class: java/lang/VMRuntime
+ * Method: insertSystemProperties
+ * Signature: (Ljava/util/Properties;)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_insertSystemProperties(JNIEnv *env, jclass clazz, struct java_util_Properties* par1);
+
+#endif
+
java_objectheader header;
} java_lang_VMString;
-
-/*
- * Class: java/lang/VMString
- * Method: intern
- * Signature: (Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT struct java_lang_String* JNICALL Java_java_lang_VMString_intern(JNIEnv *env, jclass clazz, struct java_lang_String* par1);
-
#endif
--- /dev/null
+/* This file is machine generated, don't edit it !*/
+
+#ifndef _JAVA_LANG_VMTHREAD_H
+#define _JAVA_LANG_VMTHREAD_H
+
+/* Structure information for class: java/lang/VMThread */
+
+typedef struct java_lang_VMThread {
+ java_objectheader header;
+ struct java_lang_Thread* thread;
+ s4 running;
+ s4 status;
+ s4 priority;
+ s4 restorePoint;
+ struct gnu_classpath_RawData* stackMem;
+ struct gnu_classpath_RawData* stackBase;
+ struct gnu_classpath_RawData* stackEnd;
+ struct gnu_classpath_RawData* usedStackTop;
+ s8 time;
+ struct java_lang_Throwable* texceptionptr;
+ struct java_lang_Thread* nextlive;
+ struct java_lang_Thread* next;
+ s4 flags;
+} java_lang_VMThread;
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: start
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, struct java_lang_VMThread* this, s8 par1);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: interrupt
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, struct java_lang_VMThread* this);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: isInterrupted
+ * Signature: ()Z
+ */
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, struct java_lang_VMThread* this);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: suspend
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_suspend(JNIEnv *env, struct java_lang_VMThread* this);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: resume
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, struct java_lang_VMThread* this);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: nativeSetPriority
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, struct java_lang_VMThread* this, s4 par1);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: nativeStop
+ * Signature: (Ljava/lang/Throwable;)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop(JNIEnv *env, struct java_lang_VMThread* this, struct java_lang_Throwable* par1);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: currentThread
+ * Signature: ()Ljava/lang/Thread;
+ */
+JNIEXPORT struct java_lang_Thread* JNICALL Java_java_lang_VMThread_currentThread(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: yield
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_yield(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: sleep
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_sleep(JNIEnv *env, jclass clazz, s8 par1, s4 par2);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: interrupted
+ * Signature: ()Z
+ */
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: holdsLock
+ * Signature: (Ljava/lang/Object;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, struct java_lang_Object* par1);
+
+#endif
+
typedef struct java_net_InetAddress {
java_objectheader header;
+ s4 address;
java_bytearray* addr;
struct java_lang_String* hostName;
struct java_lang_String* hostname_alias;
s8 lookup_time;
- s4 address;
s4 family;
} java_net_InetAddress;
/*
* Class: java/net/InetAddress
- * Method: getLocalHostName
+ * Method: getLocalHostname
* Signature: ()Ljava/lang/String;
*/
-JNIEXPORT struct java_lang_String* JNICALL Java_java_net_InetAddress_getLocalHostName(JNIEnv *env, jclass clazz);
+JNIEXPORT struct java_lang_String* JNICALL Java_java_net_InetAddress_getLocalHostname(JNIEnv *env, jclass clazz);
/*
struct java_nio_ByteOrder* endian;
s4 array_offset;
java_bytearray* backing_buffer;
+ struct java_lang_Object* owner;
struct gnu_classpath_RawData* address;
- s4 offset;
s4 readOnly;
} java_nio_DirectByteBufferImpl;
/*
* Class: java/nio/DirectByteBufferImpl
* Method: getImpl
- * Signature: (I)B
+ * Signature: (Lgnu/classpath/RawData;I)B
*/
-JNIEXPORT s4 JNICALL Java_java_nio_DirectByteBufferImpl_getImpl(JNIEnv *env, struct java_nio_DirectByteBufferImpl* this, s4 par1);
+JNIEXPORT s4 JNICALL Java_java_nio_DirectByteBufferImpl_getImpl__Lgnu_classpath_RawData_2I(JNIEnv *env, jclass clazz, struct gnu_classpath_RawData* par1, s4 par2);
/*
* Class: java/nio/DirectByteBufferImpl
* Method: putImpl
- * Signature: (IB)V
+ * Signature: (Lgnu/classpath/RawData;IB)V
*/
-JNIEXPORT void JNICALL Java_java_nio_DirectByteBufferImpl_putImpl(JNIEnv *env, struct java_nio_DirectByteBufferImpl* this, s4 par1, s4 par2);
+JNIEXPORT void JNICALL Java_java_nio_DirectByteBufferImpl_putImpl(JNIEnv *env, jclass clazz, struct gnu_classpath_RawData* par1, s4 par2, s4 par3);
+
+
+/*
+ * Class: java/nio/DirectByteBufferImpl
+ * Method: getImpl
+ * Signature: (Lgnu/classpath/RawData;I[BII)V
+ */
+JNIEXPORT void JNICALL Java_java_nio_DirectByteBufferImpl_getImpl__Lgnu_classpath_RawData_2I_3BII(JNIEnv *env, jclass clazz, struct gnu_classpath_RawData* par1, s4 par2, java_bytearray* par3, s4 par4, s4 par5);
+
+
+/*
+ * Class: java/nio/DirectByteBufferImpl
+ * Method: shiftDown
+ * Signature: (Lgnu/classpath/RawData;III)V
+ */
+JNIEXPORT void JNICALL Java_java_nio_DirectByteBufferImpl_shiftDown(JNIEnv *env, jclass clazz, struct gnu_classpath_RawData* par1, s4 par2, s4 par3, s4 par4);
+
+
+/*
+ * Class: java/nio/DirectByteBufferImpl
+ * Method: adjustAddress
+ * Signature: (Lgnu/classpath/RawData;I)Lgnu/classpath/RawData;
+ */
+JNIEXPORT struct gnu_classpath_RawData* JNICALL Java_java_nio_DirectByteBufferImpl_adjustAddress(JNIEnv *env, jclass clazz, struct gnu_classpath_RawData* par1, s4 par2);
#endif
The .hh files created with the header file generator are all
included here as are the C functions implementing these methods.
- $Id: native.c 1113 2004-06-02 10:31:09Z twisti $
+ $Id: native.c 1173 2004-06-16 14:56:18Z jowenn $
*/
void use_class_as_object(classinfo *c)
{
-/* vftbl *vt; */
-/* vftbl *newtbl; */
- java_objectheader *vmo;
-
-/* vt = class_java_lang_Class->vftbl; */
-
if (!c->classvftbl) {
c->classvftbl = true;
- /* copy_vftbl(&newtbl, vt);
- newtbl->class = c->header.vftbl->class;
- newtbl->baseval = c->header.vftbl->baseval;
- newtbl->diffval = c->header.vftbl->diffval;
- c->header.vftbl = newtbl;*/
-
c->header.vftbl = class_java_lang_Class->vftbl;
-
- method_vmclass_init =
- class_findmethod(class_java_lang_VMClass,
- utf_new_char("<init>"),
- utf_new_char("(Lgnu/classpath/RawData;)V"));
-
- if (method_vmclass_init == 0) {
- class_showmethods(class_java_lang_VMClass);
- panic("Needed class initializer for VMClass could not be found");
- }
-
- vmo = builtin_new(class_java_lang_VMClass);
-
- if (!vmo)
- panic("Error while creating instance of java/lang/VMClass");
-
- asm_calljavafunction(method_vmclass_init, vmo, c, NULL, NULL);
-
- c->vmClass = (java_lang_VMClass *) vmo;
-#if 0
- setfield_critical(class_java_lang_Class,vmo,"vmClass", "Ljava/lang/VMClass;", jobject, (jobject) class_java_lang_Class /*this*/);
-#endif
-
- }
+ }
}
class_java_lang_Void = class_new(utf_new_char("java/lang/Void"));
class_load(class_java_lang_Void);
class_link(class_java_lang_Void);
+
}
classinfo **current;
classinfo *c;
size_t size=(((size_t)start)-((size_t)end)) / sizeof (classinfo*);
-/* printf("end %p, start %p, size %ld\n",end,start,size);*/
+ /*printf("end %p, start %p, size %ld\n",end,start,size);*/
if (!class_java_lang_Class)
class_java_lang_Class = class_new(utf_new_char ("java/lang/Class"));
if (!class_java_lang_SecurityManager)
- Calling the class loader
- Running the main method
- $Id: cacao.c 1150 2004-06-06 13:29:25Z twisti $
+ $Id: cacao.c 1173 2004-06-16 14:56:18Z jowenn $
*/
#include "typeinfo.h"
#endif
-/* command line option */
+bool cacao_initializing;
+
+/* command line option */
bool verbose = false;
bool compileall = false;
bool runverbose = false; /* trace all method invocation */
tables_init();
suck_init(classpath);
+ cacao_initializing=true;
+
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
initThreadsEarly();
#endif
initThreads((u1*) &dummy);
#endif
+ *threadrootmethod=0;
+ class_init(class_new(utf_new_char("java/lang/System"))); /*That's important, otherwise we get into trouble, if
+ the Runtime static initializer is called before (circular dependency. This is with classpath
+ 0.09. Another important thing is, that this has to happen after initThreads!!!
+ */
+ cacao_initializing=false;
/************************* Start worker routines ********************/
if (startit) {
*threadrootmethod = mainmethod;
+
/* here we go... */
asm_calljavafunction(mainmethod, a, NULL, NULL, NULL);
Changes: Mark Probst
Philipp Tomsich
- $Id: headers.c 1171 2004-06-12 15:04:31Z stefan $
+ $Id: headers.c 1173 2004-06-16 14:56:18Z jowenn $
*/
outputsize = newsize;
}
+static void printOverloadPart(utf *desc)
+{
+ char *utf_ptr=desc->text;
+ u2 c;
+
+ fprintf(file,"__");
+ while ((c=utf_nextu2(&utf_ptr))!=')') {
+ switch (c) {
+ case 'I':
+ case 'S':
+ case 'B':
+ case 'C':
+ case 'Z':
+ case 'J':
+ case 'F':
+ case 'D':
+ fprintf (file, "%c",(char)c);
+ break;
+ case '[':
+ fprintf(file,"_3");
+ break;
+ case 'L':
+ putc('L',file);
+ while ( (c=utf_nextu2(&utf_ptr)) != ';')
+ printIDpart (c);
+ fprintf(file,"_2");
+ break;
+ case '(':
+ break;
+ default: panic ("invalid method descriptor");
+ }
+ }
+}
static char *printtype(char *utf_ptr)
{
fprintf(file, " JNICALL Java_");
printID(m->class->name);
- /* rename overloaded method */
- if ((ident_count = searchidentchain_utf(m->name)))
- fprintf(file, "%d", ident_count - 1);
chain_addlast(ident_chain, m->name);
fprintf(file, "_");
printID(m->name);
+ if (m->nativelyoverloaded) printOverloadPart(m->descriptor);
fprintf(file, "(JNIEnv *env");
utf_ptr = m->descriptor->text + 1;
char uclassname[1024];
u2 i;
methodinfo *m;
+ u2 i2;
+ methodinfo *m2;
+ u2 nativelyoverloaded;
/* store class in chain */
chain_addlast(nativeclass_chain, c);
/* create method-prototypes */
+ /* find overloaded methods */
+ for (i = 0; i < c->methodscount; i++) {
+
+ m = &(c->methods[i]);
+
+ if (!(m->flags & ACC_NATIVE)) continue;
+ if (!m->nativelyoverloaded) {
+ nativelyoverloaded=false;
+ for (i2=i+1;i2<c->methodscount; i2++) {
+ m2 = &(c->methods[i2]);
+ if (!(m2->flags & ACC_NATIVE)) continue;
+ if (m->name==m2->name) {
+ m2->nativelyoverloaded=true;
+ nativelyoverloaded=true;
+ }
+ }
+ m->nativelyoverloaded=nativelyoverloaded;
+ }
+
+ }
+
for (i = 0; i < c->methodscount; i++) {
m = &(c->methods[i]);
printID(m->class->name);
fprintf(file,"_");
printID(m->name);
+ if (m->nativelyoverloaded) printOverloadPart(m->descriptor);
fprintf(file,"\n },\n");
}
typedef struct java_lang_Thread {
java_objectheader header;
+ struct java_lang_VMThread* vmThread;
struct java_lang_ThreadGroup* group;
- struct java_lang_Runnable* toRun;
+ struct java_lang_Runnable* runnable;
struct java_lang_String* name;
- s8 PrivateInfo;
- struct java_lang_Thread* next;
s4 daemon;
s4 priority;
+ s8 stacksize;
+ struct java_lang_Throwable* stillborn;
struct java_lang_ClassLoader* contextClassLoader;
} java_lang_Thread;
-
-/*
- * Class: java/lang/Thread
- * Method: currentThread
- * Signature: ()Ljava/lang/Thread;
- */
-JNIEXPORT struct java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread(JNIEnv *env, jclass clazz);
-
-
-/*
- * Class: java/lang/Thread
- * Method: yield
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_yield(JNIEnv *env, jclass clazz);
-
-
-/*
- * Class: java/lang/Thread
- * Method: sleep
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_sleep(JNIEnv *env, jclass clazz, s8 par1, s4 par2);
-
-
-/*
- * Class: java/lang/Thread
- * Method: start
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_start(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: interrupted
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_interrupted(JNIEnv *env, jclass clazz);
-
-
-/*
- * Class: java/lang/Thread
- * Method: isInterrupted
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_isInterrupted(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: isAlive
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: countStackFrames
- * Signature: ()I
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_countStackFrames(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: holdsLock
- * Signature: (Ljava/lang/Object;)Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_holdsLock(JNIEnv *env, jclass clazz, struct java_lang_Object* par1);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeInit
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeInit(JNIEnv *env, struct java_lang_Thread* this, s8 par1);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeStop
- * Signature: (Ljava/lang/Throwable;)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeStop(JNIEnv *env, struct java_lang_Thread* this, struct java_lang_Throwable* par1);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeInterrupt
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeInterrupt(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeSuspend
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeSuspend(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeResume
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeResume(JNIEnv *env, struct java_lang_Thread* this);
-
-
-/*
- * Class: java/lang/Thread
- * Method: nativeSetPriority
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeSetPriority(JNIEnv *env, struct java_lang_Thread* this, s4 par1);
-
#endif
--- /dev/null
+/* This file is machine generated, don't edit it !*/
+
+#ifndef _JAVA_LANG_VMTHREAD_H
+#define _JAVA_LANG_VMTHREAD_H
+
+/* Structure information for class: java/lang/VMThread */
+
+typedef struct java_lang_VMThread {
+ java_objectheader header;
+ struct java_lang_Thread* thread;
+ s4 running;
+ s4 status;
+ s4 priority;
+ s4 restorePoint;
+ struct gnu_classpath_RawData* stackMem;
+ struct gnu_classpath_RawData* stackBase;
+ struct gnu_classpath_RawData* stackEnd;
+ struct gnu_classpath_RawData* usedStackTop;
+ s8 time;
+ struct java_lang_Throwable* texceptionptr;
+ struct java_lang_Thread* nextlive;
+ struct java_lang_Thread* next;
+ s4 flags;
+} java_lang_VMThread;
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: start
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, struct java_lang_VMThread* this, s8 par1);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: interrupt
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, struct java_lang_VMThread* this);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: isInterrupted
+ * Signature: ()Z
+ */
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, struct java_lang_VMThread* this);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: suspend
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_suspend(JNIEnv *env, struct java_lang_VMThread* this);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: resume
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, struct java_lang_VMThread* this);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: nativeSetPriority
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, struct java_lang_VMThread* this, s4 par1);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: nativeStop
+ * Signature: (Ljava/lang/Throwable;)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop(JNIEnv *env, struct java_lang_VMThread* this, struct java_lang_Throwable* par1);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: currentThread
+ * Signature: ()Ljava/lang/Thread;
+ */
+JNIEXPORT struct java_lang_Thread* JNICALL Java_java_lang_VMThread_currentThread(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: yield
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_yield(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: sleep
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMThread_sleep(JNIEnv *env, jclass clazz, s8 par1, s4 par2);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: interrupted
+ * Signature: ()Z
+ */
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz);
+
+
+/*
+ * Class: java/lang/VMThread
+ * Method: holdsLock
+ * Signature: (Ljava/lang/Object;)Z
+ */
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, struct java_lang_Object* par1);
+
+#endif
+
Changes: Joseph Wenninger
- $Id: jni.c 1112 2004-05-31 15:47:20Z jowenn $
+ $Id: jni.c 1173 2004-06-16 14:56:18Z jowenn $
*/
jobject CallStaticObjectMethod(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
{
- log_text("JNI-Call: CallStaticObjectMethod");
+ jobject ret;
+ va_list vaargs;
- return NULL;
+ /* log_text("JNI-Call: CallStaticObjectMethod");*/
+
+ va_start(vaargs, methodID);
+ ret = callObjectMethod(0, methodID, vaargs);
+ va_end(vaargs);
+
+ return ret;
}
jobject CallStaticObjectMethodV(JNIEnv *env, jclass clazz, jmethodID methodID, va_list args)
{
- log_text("JNI-Call: CallStaticObjectMethodV");
-
- return NULL;
+ /* log_text("JNI-Call: CallStaticObjectMethodV"); */
+
+ return callObjectMethod(0,methodID,args);
}
The .hh files created with the header file generator are all
included here as are the C functions implementing these methods.
- $Id: native.c 1113 2004-06-02 10:31:09Z twisti $
+ $Id: native.c 1173 2004-06-16 14:56:18Z jowenn $
*/
void use_class_as_object(classinfo *c)
{
-/* vftbl *vt; */
-/* vftbl *newtbl; */
- java_objectheader *vmo;
-
-/* vt = class_java_lang_Class->vftbl; */
-
if (!c->classvftbl) {
c->classvftbl = true;
- /* copy_vftbl(&newtbl, vt);
- newtbl->class = c->header.vftbl->class;
- newtbl->baseval = c->header.vftbl->baseval;
- newtbl->diffval = c->header.vftbl->diffval;
- c->header.vftbl = newtbl;*/
-
c->header.vftbl = class_java_lang_Class->vftbl;
-
- method_vmclass_init =
- class_findmethod(class_java_lang_VMClass,
- utf_new_char("<init>"),
- utf_new_char("(Lgnu/classpath/RawData;)V"));
-
- if (method_vmclass_init == 0) {
- class_showmethods(class_java_lang_VMClass);
- panic("Needed class initializer for VMClass could not be found");
- }
-
- vmo = builtin_new(class_java_lang_VMClass);
-
- if (!vmo)
- panic("Error while creating instance of java/lang/VMClass");
-
- asm_calljavafunction(method_vmclass_init, vmo, c, NULL, NULL);
-
- c->vmClass = (java_lang_VMClass *) vmo;
-#if 0
- setfield_critical(class_java_lang_Class,vmo,"vmClass", "Ljava/lang/VMClass;", jobject, (jobject) class_java_lang_Class /*this*/);
-#endif
-
- }
+ }
}
class_java_lang_Void = class_new(utf_new_char("java/lang/Void"));
class_load(class_java_lang_Void);
class_link(class_java_lang_Void);
+
}
classinfo **current;
classinfo *c;
size_t size=(((size_t)start)-((size_t)end)) / sizeof (classinfo*);
-/* printf("end %p, start %p, size %ld\n",end,start,size);*/
+ /*printf("end %p, start %p, size %ld\n",end,start,size);*/
if (!class_java_lang_Class)
class_java_lang_Class = class_new(utf_new_char ("java/lang/Class"));
if (!class_java_lang_SecurityManager)
## Process this file with automake to produce Makefile.in
-# $Id: Makefile.am 1148 2004-06-06 13:20:49Z twisti $
+# $Id: Makefile.am 1173 2004-06-16 14:56:18Z jowenn $
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit/@ARCH_DIR@
libnat_a_SOURCES = \
Constructor.c \
Field.c \
- FileChannelImpl.c \
Method.c \
Proxy.c \
Runtime.c \
VMClass.c \
VMClassLoader.c \
VMObject.c \
- VMObjectStreamClass.c \
VMSecurityManager.c \
VMString.c \
VMSystem.c \
Changes: Joseph Wenninger
- $Id: VMClass.c 1075 2004-05-20 16:58:49Z twisti $
+ $Id: VMClass.c 1173 2004-06-16 14:56:18Z jowenn $
*/
* Method: getClassLoader
* Signature: ()Ljava/lang/ClassLoader;
*/
-JNIEXPORT java_lang_ClassLoader* JNICALL Java_java_lang_VMClass_getClassLoader(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_lang_ClassLoader* JNICALL Java_java_lang_VMClass_getClassLoader(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- return ((classinfo*)(this->vmData))->classloader;
+ return ((classinfo*)that)->classloader;
/* init_systemclassloader();
return SystemClassLoader;*/
* Method: getComponentType
* Signature: ()Ljava/lang/Class;
*/
-JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getComponentType(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getComponentType(JNIEnv *env, jclass clazz,java_lang_Class *that)
{
- classinfo *thisclass = (classinfo *) this->vmData;
+ classinfo *thisclass = (classinfo *) that;
classinfo *c = NULL;
arraydescriptor *desc;
* Method: getDeclaredConstructors
* Signature: (Z)[Ljava/lang/reflect/Constructor;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredConstructors(JNIEnv *env, java_lang_VMClass *this, s4 public_only)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredConstructors(JNIEnv *env, jclass clazz,
+ struct java_lang_Class *that, s4 public_only)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
java_objectheader *o;
classinfo *class_constructor;
java_objectarray *array_constructor; /* result: array of Method-objects */
* Method: getDeclaredClasses
* Signature: (Z)[Ljava/lang/Class;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredClasses(JNIEnv *env, java_lang_VMClass *this, s4 publicOnly)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredClasses(JNIEnv *env, jclass clazz, java_lang_Class *that, s4 publicOnly)
{
#if defined(__GNUC__)
#warning fix the public only case
#endif
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
int pos = 0; /* current declared class */
int declaredclasscount = 0; /* number of declared classes */
java_objectarray *result; /* array of declared classes */
int notPublicOnly = !publicOnly;
int i;
- if (!this)
- return NULL;
-
- if (!this->vmData)
+ if (!that)
return NULL;
/*printf("PublicOnly: %d\n",publicOnly);*/
- if (!Java_java_lang_VMClass_isPrimitive(env, (java_lang_VMClass *) c) && (c->name->text[0] != '[')) {
+ if (!Java_java_lang_VMClass_isPrimitive(env, clazz, (java_lang_Class *) c) && (c->name->text[0] != '[')) {
/* determine number of declared classes */
for (i = 0; i < c->innerclasscount; i++) {
if ( (c->innerclass[i].outer_class == c) && (notPublicOnly || (c->innerclass[i].flags & ACC_PUBLIC)))
* Method: getDeclaringClass
* Signature: ()Ljava/lang/Class;
*/
-JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getDeclaringClass(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getDeclaringClass(JNIEnv *env, jclass clazz, struct java_lang_Class *that)
{
#if defined(__GNUC__)
#warning fixme
#endif
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
- if (this && this->vmData && !Java_java_lang_VMClass_isPrimitive(env, this) && (c->name->text[0] != '[')) {
+ if (that && !Java_java_lang_VMClass_isPrimitive(env, clazz,that) && (c->name->text[0] != '[')) {
int i;
if (c->innerclasscount == 0) /* no innerclasses exist */
}
-/*
- * Class: java/lang/Class
- * Method: getField0
- * Signature: (Ljava/lang/String;I)Ljava/lang/reflect/Field;
- */
-JNIEXPORT java_lang_reflect_Field* JNICALL Java_java_lang_VMClass_getField0(JNIEnv *env, java_lang_VMClass *this, java_lang_String *name, s4 public_only)
+java_lang_reflect_Field* cacao_getField0(JNIEnv *env, java_lang_Class *that, java_lang_String *name, s4 public_only)
{
classinfo *c;
classinfo *fieldtype;
o = (java_lang_reflect_Field *) native_new_and_init(c);
/* get fieldinfo entry */
- idx = class_findfield_index_approx((classinfo *) this->vmData, javastring_toutf(name, false));
+ idx = class_findfield_index_approx((classinfo *) that, javastring_toutf(name, false));
if (idx < 0) {
*exceptionptr = new_exception(string_java_lang_NoSuchFieldException);
return NULL;
}
- f = &(((classinfo *) this->vmData)->fields[idx]);
+ f = &(((classinfo *) that)->fields[idx]);
if (f) {
if (public_only && !(f->flags & ACC_PUBLIC)) {
/* field is not public and public only had been requested*/
return NULL;
/* initialize instance fields */
- setfield_critical(c,o,"declaringClass", "Ljava/lang/Class;", jobject, (jobject) (this->vmData) /*this*/);
+ setfield_critical(c,o,"declaringClass", "Ljava/lang/Class;", jobject, (jobject) that /*this*/);
/* ((java_lang_reflect_Field*)(o))->flag=f->flags;*/
/* save type in slot-field for faster processing */
/* setfield_critical(c,o,"flag", "I", jint, (jint) f->flags); */
* Method: getDeclaredFields
* Signature: (Z)[Ljava/lang/reflect/Field;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredFields(JNIEnv *env, java_lang_VMClass *this, s4 public_only)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredFields(JNIEnv *env, jclass clazz, java_lang_Class *that, s4 public_only)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
classinfo *class_field;
java_objectarray *array_field; /* result: array of field-objects */
int public_fields = 0; /* number of elements in field-array */
for (i = 0; i < c->fieldscount; i++)
if ( (c->fields[i].flags & ACC_PUBLIC) || (!public_only))
array_field->data[pos++] =
- (java_objectheader *) Java_java_lang_VMClass_getField0(env,
- this,
- (java_lang_String *) javastring_new(c->fields[i].name),
- public_only);
+ (java_objectheader *) cacao_getField0(env,
+ that, (java_lang_String *) javastring_new(c->fields[i].name),public_only);
return array_field;
}
* Method: getInterfaces
* Signature: ()[Ljava/lang/Class;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getInterfaces(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getInterfaces(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
u4 i;
java_objectarray *a;
}
-/*
- * Class: java/lang/Class
- * Method: getMethod0
- * Signature: (Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;
- */
-JNIEXPORT java_lang_reflect_Method* JNICALL Java_java_lang_VMClass_getMethod0(JNIEnv *env, java_lang_Class *this, java_lang_String *name, java_objectarray *types, s4 which)
+java_lang_reflect_Method* cacao_getMethod0(JNIEnv *env, java_lang_Class *that, java_lang_String *name, java_objectarray *types, s4 which)
{
classinfo *c;
- classinfo *clazz = (classinfo *) this;
+ classinfo *clazz = (classinfo *) that;
java_lang_reflect_Method* o; /* result: Method-object */
java_objectarray *exceptiontypes; /* the exceptions thrown by the method */
methodinfo *m; /* the method to be represented */
* Method: getDeclaredMethods
* Signature: (Z)[Ljava/lang/reflect/Method;
*/
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredMethods(JNIEnv *env, java_lang_VMClass *this, s4 public_only)
+JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getDeclaredMethods(JNIEnv *env, jclass clazz, java_lang_Class *that, s4 public_only)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
java_objectheader *o;
classinfo *class_method;
java_objectarray *array_method; /* result: array of Method-objects */
/* JOWENN: array classes do not declare methods according to mauve test. It should be considered, if
we should return to my old clone method overriding instead of declaring it as a member function */
- if (Java_java_lang_VMClass_isArray(env, this)) {
+ if (Java_java_lang_VMClass_isArray(env, clazz,that)) {
return builtin_anewarray(0, class_method);
}
* Method: getModifiers
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_getModifiers(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_getModifiers(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *c = (classinfo *) (this->vmData);
+ classinfo *c = (classinfo *) that;
return c->flags;
}
* Method: getName
* Signature: ()Ljava/lang/String;
*/
-JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMClass_getName(JNIEnv *env, java_lang_VMClass* this)
+JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMClass_getName(JNIEnv *env, jclass clazz, java_lang_Class* that)
{
u4 i;
- classinfo *c = (classinfo *) (this->vmData);
+ classinfo *c = (classinfo *) that;
java_lang_String *s = (java_lang_String *) javastring_new(c->name);
if (!s)
}
-/*
- * Class: java/lang/Class
- * Method: getProtectionDomain0
- * Signature: ()Ljava/security/ProtectionDomain;
- */
-JNIEXPORT java_security_ProtectionDomain* JNICALL Java_java_lang_VMClass_getProtectionDomain0(JNIEnv *env, java_lang_Class *this)
-{
- log_text("Java_java_lang_VMClass_getProtectionDomain0");
- return NULL;
-}
-
-
-/*
- * Class: java/lang/Class
- * Method: getSigners
- * Signature: ()[Ljava/lang/Object;
- */
-JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMClass_getSigners(JNIEnv *env, java_lang_Class *this)
-{
- log_text("Java_java_lang_VMClass_getSigners");
- return NULL;
-}
-
/*
* Class: java/lang/Class
* Method: getSuperclass
* Signature: ()Ljava/lang/Class;
*/
-JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getSuperclass(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getSuperclass(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *cl = (classinfo *) this->vmData;
+ classinfo *cl = (classinfo *) that;
classinfo *c = cl->super;
if (!c)
* Method: isArray
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isArray(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isArray(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
return c->vftbl->arraydesc != NULL;
}
* Method: isAssignableFrom
* Signature: (Ljava/lang/Class;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isAssignableFrom(JNIEnv *env, java_lang_VMClass *this, java_lang_Class *sup)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isAssignableFrom(JNIEnv *env, jclass clazz, java_lang_Class *that, java_lang_Class *sup)
{
/* log_text("Java_java_lang_VMClass_isAssignableFrom");*/
- if (!this) return 0;
+
if (!sup) return 0;
- if (!this->vmData) {
+ if (!that) {
panic("sup->vmClass is NULL in VMClass.isAssignableFrom");
return 0;
}
- return (*env)->IsAssignableForm(env, (jclass) sup, (jclass) (this->vmData));
+ return (*env)->IsAssignableForm(env, (jclass) sup, (jclass) that);
}
* Method: isInstance
* Signature: (Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInstance(JNIEnv *env, java_lang_VMClass *this, java_lang_Object *obj)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInstance(JNIEnv *env, jclass clazz, java_lang_Class *that, java_lang_Object *obj)
{
- classinfo *clazz = (classinfo *) this->vmData;
+ classinfo *clazz = (classinfo *) that;
- return (*env)->IsInstanceOf(env, (jobject) obj, clazz);
+ return (*env)->IsInstanceOf(env, (jobject) obj, that);
}
* Method: isInterface
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInterface(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInterface(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
if (c->flags & ACC_INTERFACE)
return true;
* Method: isPrimitive
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isPrimitive(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isPrimitive(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
int i;
- classinfo *c = (classinfo *) this->vmData;
+ classinfo *c = (classinfo *) that;
/* search table of primitive classes */
for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
}
-/*
- * Class: java/lang/Class
- * Method: registerNatives
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_registerNatives(JNIEnv *env)
-{
- /* empty */
-}
-
-
-/*
- * Class: java/lang/Class
- * Method: setProtectionDomain0
- * Signature: (Ljava/security/ProtectionDomain;)V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_setProtectionDomain0(JNIEnv *env, java_lang_Class *this, java_security_ProtectionDomain *par1)
-{
- if (verbose)
- log_text("Java_java_lang_VMClass_setProtectionDomain0");
-}
-
-
-/*
- * Class: java/lang/Class
- * Method: setSigners
- * Signature: ([Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_setSigners(JNIEnv *env, java_lang_Class *this, java_objectarray *par1)
-{
- if (verbose)
- log_text("Java_java_lang_VMClass_setSigners");
-}
/*
* Method: initialize
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMClass_initialize(JNIEnv *env, java_lang_VMClass *this)
+JNIEXPORT void JNICALL Java_java_lang_VMClass_initialize(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
log_text("Java_java_lang_VMClass_initialize");
}
}
-/*
- * Class: java_lang_VMClass
- * Method: step7
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_step7(JNIEnv *env, java_lang_VMClass *this)
-{
- log_text("Java_java_lang_VMClass_step7");
-}
-/*
- * Class: java_lang_VMClass
- * Method: step8
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_step8(JNIEnv *env, java_lang_VMClass *this)
-{
- log_text("Java_java_lang_VMClass_step8");
-}
-
-
-/*
- * Class: java_lang_VMClass
- * Method: isInitialized
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInitialized(JNIEnv *env, java_lang_VMClass *this)
-{
- log_text("Java_java_lang_VMClass_isInitialized");
-
- return 1;
-}
-
-
-/*
- * Class: java_lang_VMClass
- * Method: setInitialized
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_java_lang_VMClass_setInitialized(JNIEnv *env, java_lang_VMClass *this)
-{
- log_text("Java_java_lang_VMClass_setInitialized");
-}
-
/*
* These are local overrides for various environment variables in Emacs.
Changes: Joseph Wenninger
Christian Thalinger
- $Id: VMRuntime.c 1147 2004-06-06 13:20:11Z twisti $
+ $Id: VMRuntime.c 1173 2004-06-16 14:56:18Z jowenn $
*/
#include "java_io_File.h"
#include "java_lang_String.h"
#include "java_lang_Process.h"
-#include "java_util_Properties.h" /* required by java_lang_Runtime.h */
-#include "java_lang_Runtime.h"
+#include "java_util_Properties.h" /* needed for java_lang_Runtime.h */
+#include "java_lang_VMRuntime.h"
#define JOWENN_DEBUG
static s4 finalizeOnExit = false;
#define MAXPROPS 100
+static bool shouldFinalizersBeRunOnExit=false;
static int activeprops = 19;
static char *proplist[MAXPROPS][2] = {
activeprops++;
}
/*
- * Class: java_lang_Runtime
+ * Class: java_lang_VMRuntime
* Method: execInternal
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Ljava/lang/Process;
*/
-JNIEXPORT java_lang_Process* JNICALL Java_java_lang_Runtime_execInternal(JNIEnv *env, java_lang_Runtime *this, java_objectarray *cmd, java_objectarray *shellenv, java_io_File *workingdir)
+JNIEXPORT java_lang_Process* JNICALL Java_java_lang_VMRuntime_execInternal(JNIEnv *env, jclass clazz, java_objectarray *cmd, java_objectarray *shellenv, java_io_File *workingdir)
{
log_text("Java_java_lang_Runtime_execInternal called");
/*
- * Class: java/lang/Runtime
+ * Class: java/lang/VMRuntime
* Method: exitInternal
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_exitInternal(JNIEnv *env, java_lang_Runtime *this, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit(JNIEnv *env, jclass clazz, s4 par1)
{
if (finalizeOnExit)
gc_finalize_all();
* Method: freeMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_freeMemory(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_freeMemory(JNIEnv *env, jclass clazz)
{
return gc_get_free_bytes();
}
* Method: gc
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_gc(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_gc(JNIEnv *env, jclass clazz)
{
gc_call();
}
* Method: runFinalization
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_runFinalization(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalization(JNIEnv *env, jclass clazz)
{
gc_invoke_finalizers();
}
* Method: runFinalizersOnExit
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_runFinalizersOnExitInternal(JNIEnv *env, jclass clazz, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizersOnExit(JNIEnv *env, jclass clazz, s4 par1)
{
- finalizeOnExit = par1;
+#warning threading
+ shouldFinalizersBeRunOnExit=par1;
+}
+
+/*
+ * Class: java/lang/Runtime
+ * Method: runFinalizationsForExit
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizationForExit(JNIEnv *env, jclass clazz)
+{
+ if (shouldFinalizersBeRunOnExit) {
+ gc_call();
+ // gc_finalize_all();
+ }
+ log_text("Java_java_lang_VMRuntime_runFinalizationForExit called");
+
}
* Method: totalMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_totalMemory(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_totalMemory(JNIEnv *env, jclass clazz)
{
return gc_get_heap_size();
}
* Method: traceInstructions
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_traceInstructions(JNIEnv *env, java_lang_Runtime *this, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceInstructions(JNIEnv *env, jclass clazz, s4 par1)
{
/* not supported */
}
* Method: traceMethodCalls
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_traceMethodCalls(JNIEnv *env, java_lang_Runtime *this, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceMethodCalls(JNIEnv *env, jclass clazz, s4 par1)
{
/* not supported */
}
* Method: availableProcessors
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Runtime_availableProcessors(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, jclass clazz)
{
#if defined(_SC_NPROC_ONLN)
return (s4) sysconf(_SC_NPROC_ONLN);
* Method: nativeLoad
* Signature: (Ljava/lang/String;)I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Runtime_nativeLoad(JNIEnv *env, java_lang_Runtime *this, java_lang_String *par1)
+JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_nativeLoad(JNIEnv *env, jclass clazz, java_lang_String *par1)
{
#ifdef JOWENN_DEBUG
char *buffer;
buffer = MNEW(char, buffer_len);
- strcpy(buffer, "Java_java_lang_Runtime_nativeLoad:");
+ strcpy(buffer, "Java_java_lang_VMRuntime_nativeLoad:");
utf_sprint(buffer + strlen((char *) data), data);
log_text(buffer);
MFREE(buffer, char, buffer_len);
#endif
- log_text("Java_java_lang_Runtime_nativeLoad");
+ log_text("Java_java_lang_VMRuntime_nativeLoad");
return 1;
}
/*
- * Class: java_lang_Runtime
+ * Class: java_lang_VMRuntime
* Method: nativeGetLibname
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
-JNIEXPORT java_lang_String* JNICALL Java_java_lang_Runtime_nativeGetLibname(JNIEnv *env, jclass clazz, java_lang_String *par1, java_lang_String *par2)
+JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMRuntime_nativeGetLibname(JNIEnv *env, jclass clazz, java_lang_String *par1, java_lang_String *par2)
{
-#ifdef JOWENN_DEBUG
char *buffer;
int buffer_len;
utf *data;
-
+ java_lang_String *resultString;
data = javastring_toutf(par2, 0);
if (!data) {
return 0;;
}
- buffer_len = utf_strlen(data) + 40;
-
+ buffer_len = utf_strlen(data) + 6/*lib .so*/ +1 /*0*/;
buffer = MNEW(char, buffer_len);
+ sprintf(buffer,"lib");
+ utf_sprint(buffer+3,data);
+ strcat(buffer,".so");
- strcpy(buffer, "Java_java_lang_Runtime_nativeGetLibname:");
- utf_sprint(buffer + strlen((char *) data), data);
- log_text(buffer);
+ log_text(buffer);
+
+ resultString=javastring_new_char(buffer);
MFREE(buffer, char, buffer_len);
-#endif
- log_text("Java_java_lang_Runtime_nativeGetLibname");
- return 0;
+ return resultString;
}
/*
- * Class: java_lang_Runtime
+ * Class: java_lang_VMRuntime
* Method: insertSystemProperties
* Signature: (Ljava/util/Properties;)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Runtime_insertSystemProperties(JNIEnv *env, jclass clazz, java_util_Properties *p)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_insertSystemProperties(JNIEnv *env, jclass clazz, java_util_Properties *p)
{
#define BUFFERSIZE 200
/*
- * Class: java_lang_Runtime
+ * Class: java_lang_VMRuntime
* Method: maxMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_Runtime_maxMemory(JNIEnv *env, java_lang_Runtime *this)
+JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_maxMemory(JNIEnv *env, jclass clazz)
{
return gc_get_max_heap_size();
}
Changes: Joseph Wenninger
- $Id: VMThread.c 1067 2004-05-18 10:25:51Z stefan $
+ $Id: VMThread.c 1173 2004-06-16 14:56:18Z jowenn $
*/
#include "java_lang_ThreadGroup.h"
#include "java_lang_Object.h" /* needed for java_lang_Thread.h */
#include "java_lang_Throwable.h" /* needed for java_lang_Thread.h */
+#include "java_lang_VMThread.h"
#include "java_lang_Thread.h"
* Method: countStackFrames
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_countStackFrames(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
{
- log_text("java_lang_Thread_countStackFrames called");
+ log_text("java_lang_VMThread_countStackFrames called");
return 0;
}
* Method: currentThread
* Signature: ()Ljava/lang/Thread;
*/
-JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread(JNIEnv *env, jclass clazz)
+JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_VMThread_currentThread(JNIEnv *env, jclass clazz)
{
java_lang_Thread *t;
if (runverbose)
- log_text("java_lang_Thread_currentThread called");
+ log_text("java_lang_VMThread_currentThread called");
#if defined(USE_THREADS)
#if !defined(NATIVE_THREADS)
#endif
if (!t->group) {
- log_text("java_lang_Thread_currentThread: t->group=NULL");
+ log_text("java_lang_VMThread_currentThread: t->group=NULL");
/* ThreadGroup of currentThread is not initialized */
t->group = (java_lang_ThreadGroup *)
* Method: nativeInterrupt
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeInterrupt(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, java_lang_VMThread *this)
{
- log_text("Java_java_lang_Thread_interrupt0 called");
+ log_text("Java_java_lang_VMThread_interrupt0 called");
}
* Method: isAlive
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isAlive(JNIEnv *env, java_lang_VMThread *this)
{
if (runverbose)
- log_text("java_lang_Thread_isAlive called");
+ log_text("java_lang_VMThread_isAlive called");
#if defined(USE_THREADS)
- return aliveThread((thread *) this);
+ return aliveThread((thread *) this->thread);
#endif
}
* Method: isInterrupted
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_isInterrupted(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
{
- log_text("Java_java_lang_Thread_isInterrupted called");
+ log_text("Java_java_lang_VMThread_isInterrupted called");
return 0;
}
* Method: registerNatives
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_registerNatives(JNIEnv *env, jclass clazz)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_registerNatives(JNIEnv *env, jclass clazz)
{
/* empty */
}
* Method: resume0
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeResume(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, java_lang_VMThread *this)
{
if (runverbose)
- log_text("java_lang_Thread_resume0 called");
+ log_text("java_lang_VMThread_resume0 called");
#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
- resumeThread((thread *) this);
+ resumeThread((thread *) this->thread);
#endif
}
* Method: setPriority0
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeSetPriority(JNIEnv *env, java_lang_Thread *this, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, s4 par1)
{
if (runverbose)
- log_text("java_lang_Thread_setPriority0 called");
+ log_text("java_lang_VMThread_setPriority0 called");
#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
- setPriorityThread((thread *) this, par1);
+ setPriorityThread((thread *) this->thread, par1);
#endif
}
* Method: sleep
* Signature: (JI)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_sleep(JNIEnv *env, jclass clazz, s8 millis, s4 par2)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_sleep(JNIEnv *env, jclass clazz, s8 millis, s4 par2)
{
if (runverbose)
- log_text("java_lang_Thread_sleep called");
+ log_text("java_lang_VMThread_sleep called");
#if defined(USE_THREADS)
sleepThread(millis);
* Method: start
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_start(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, s8 par1)
{
if (runverbose)
- log_text("java_lang_Thread_start called");
+ log_text("java_lang_VMThread_start called");
#if defined(USE_THREADS)
- startThread((thread*)this);
+#warning perhaps it would be better to always work with the vmthread structure in the thread code (jowenn)
+ if (this->thread->vmThread==0)
+ this->thread->vmThread=this;
+ startThread((thread*)(this->thread));
#endif
}
* Method: stop0
* Signature: (Ljava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeStop(JNIEnv *env, java_lang_Thread *this, java_lang_Throwable *par1)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop(JNIEnv *env, java_lang_VMThread *this, java_lang_Throwable *par1)
{
if (runverbose)
- log_text ("java_lang_Thread_stop0 called");
+ log_text ("java_lang_VMThread_stop0 called");
#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
- if (currentThread == (thread*)this) {
+ if (currentThread == (thread*)this->thread) {
log_text("killing");
killThread(0);
/*
*/
} else {
- CONTEXT((thread*)this).flags |= THREAD_FLAGS_KILLED;
- resumeThread((thread*)this);
+ /*CONTEXT((thread*)this)*/ this->flags |= THREAD_FLAGS_KILLED;
+ resumeThread((thread*)this->thread);
}
#endif
}
* Method: suspend0
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeSuspend(JNIEnv *env, java_lang_Thread *this)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_suspend(JNIEnv *env, java_lang_VMThread *this)
{
if (runverbose)
- log_text("java_lang_Thread_suspend0 called");
+ log_text("java_lang_VMThread_suspend0 called");
#if defined(USE_THREADS) && !defined(NATIVE_THREADS)
- suspendThread((thread*)this);
+ suspendThread((thread*)this->thread);
#endif
}
* Method: yield
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_yield(JNIEnv *env, jclass clazz)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_yield(JNIEnv *env, jclass clazz)
{
if (runverbose)
- log_text("java_lang_Thread_yield called");
+ log_text("java_lang_VMThread_yield called");
#if defined(USE_THREADS)
yieldThread();
* Method: interrupted
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_interrupted(JNIEnv *env, jclass clazz)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
{
- log_text("Java_java_lang_Thread_interrupted");
+ log_text("Java_java_lang_VMThread_interrupted");
return 0;
}
* Method: nativeInit
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_java_lang_Thread_nativeInit(JNIEnv *env, java_lang_Thread *this, s8 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeInit(JNIEnv *env, java_lang_VMThread *this, s8 par1)
{
/*
if (*exceptionptr)
log_text("There has been an exception, strange...");*/
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
- initThread(this);
+ initThread(this->thread);
#endif
- this->priority = 5;
+ this->thread->priority = 5;
}
* Method: holdsLock
* Signature: (Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_Thread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object *par1)
+JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object *par1)
{
return 0;
}
if (mux->muxWaiters != 0)
{
tid = mux->muxWaiters;
- mux->muxWaiters = tid->next;
+ mux->muxWaiters = tid->vmThread->next;
iresumeThread(tid);
}
}
/* If there's anyone waiting here, wake them up */
if (mux->muxWaiters != 0) {
tid = mux->muxWaiters;
- mux->muxWaiters = tid->next;
+ mux->muxWaiters = tid->vmThread->next;
iresumeThread(tid);
}
DBG( fprintf(stderr, "releasing a waiter\n"); );
tid = cv->cvWaiters;
- cv->cvWaiters = tid->next;
+ cv->cvWaiters = tid->vmThread->next;
/* Place it on mux list */
- tid->next = cv->mux->muxWaiters;
+ tid->vmThread->next = cv->mux->muxWaiters;
cv->mux->muxWaiters = tid;
}
}
/* Find the end of the cv list */
if (cv->cvWaiters) {
- for (tidp = &cv->cvWaiters; *tidp != 0; tidp = &(*tidp)->next)
+ for (tidp = &cv->cvWaiters; *tidp != 0; tidp = &(*tidp)->vmThread->next)
;
/* Place entire cv list on mux list */
while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
{
tid = sleepThreads;
- sleepThreads = sleepThreads->next;
- tid->next = 0;
+ sleepThreads = sleepThreads->vmThread->next;
+ tid->vmThread->next = 0;
iresumeThread(tid);
}
while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
{
tid = sleepThreads;
- sleepThreads = sleepThreads->next;
- tid->next = 0;
+ sleepThreads = sleepThreads->vmThread->next;
+ tid->vmThread->next = 0;
iresumeThread(tid);
}
{
for (tid = readQ[i]; tid != 0; tid = ntid)
{
- ntid = tid->next;
+ ntid = tid->vmThread->next;
iresumeThread(tid);
}
readQ[i] = 0;
{
for (tid = writeQ[i]; tid != 0; tid = ntid)
{
- ntid = tid->next;
+ ntid = tid->vmThread->next;
iresumeThread(tid);
}
writeQ[i] = 0;
int blockInts;
bool needReschedule;
-ctx contexts[MAXTHREADS];
+vmthread *contexts[MAXTHREADS];
/* Number of threads alive, also counting daemons */
static int talive;
static thread* startDaemon(void* func, char* nm, int stackSize);
+
+
+java_objectheader *init_vmthread(void *thr)
+{
+ methodinfo *m;
+ java_objectheader *o;
+ classinfo *c=class_new(utf_new_char("java/lang/VMThread"));
+
+ if (!c)
+ return *exceptionptr;
+
+ o = builtin_new(c); /* create object */
+
+ if (!o)
+ return NULL;
+
+ /* find initializer */
+
+ m = class_findmethod(c,
+ utf_new_char("<init>"),
+ utf_new_char("(Ljava/lang/Thread;)V"));
+
+ if (!m) { /* initializer not found */
+ if (verbose) {
+ char logtext[MAXLOGTEXT];
+ sprintf(logtext, "Warning: class has no instance-initializer: ");
+ utf_sprint_classname(logtext + strlen(logtext), c->name);
+ log_text(logtext);
+ }
+ return o;
+ }
+
+ /* call initializer */
+
+ asm_calljavafunction(m, o, thr, NULL, NULL);
+ return o;
+}
+
+
+
+
/*
* Allocate the stack for a thread
*/
* immediately because it is still in use!
*/
void
-freeThreadStack (thread *tid)
+freeThreadStack (vmthread *vmtid)
{
- if (!(CONTEXT(tid).flags & THREAD_FLAGS_NOSTACKALLOC))
+ if (!(vmtid->flags & THREAD_FLAGS_NOSTACKALLOC))
{
int pageSize = getpagesize();
unsigned long pageBegin;
- pageBegin = (unsigned long)(CONTEXT(tid).stackMem) + pageSize - 1;
+ pageBegin = (unsigned long)(vmtid->stackMem) + pageSize - 1;
pageBegin = pageBegin - pageBegin % pageSize;
assert(stack_to_be_freed == 0);
- stack_to_be_freed = CONTEXT(tid).stackMem;
+ stack_to_be_freed = vmtid->stackMem;
}
- CONTEXT(tid).stackMem = 0;
- CONTEXT(tid).stackBase = 0;
- CONTEXT(tid).stackEnd = 0;
+ vmtid->stackMem = 0;
+ vmtid->stackBase = 0;
+ vmtid->stackEnd = 0;
}
/*
initLocks();
for (i = 0; i < MAXTHREADS; ++i) {
- contexts[i].free = true;
- contexts[i].thread = NULL;
+ contexts[i]=0;
}
/* Allocate a thread to be the main thread */
liveThreads = the_main_thread =
(thread *) builtin_new(class_new(utf_new_char("java/lang/Thread")));
+ the_main_thread->vmThread=init_vmthread(the_main_thread);
assert(the_main_thread != 0);
- the_main_thread->PrivateInfo = 1;
- CONTEXT(the_main_thread).free = false;
+/* the_main_thread->PrivateInfo = 1;
+ CONTEXT(the_main_thread).free = false;*/
#if 0
{
for (i=0; i<len; i++)
d[i] = mainname[i];
}*/
+
the_main_thread->priority = NORM_THREAD_PRIO;
CONTEXT(the_main_thread).priority = (u1)the_main_thread->priority;
CONTEXT(the_main_thread).texceptionptr = 0;
- the_main_thread->next = 0;
+ the_main_thread->vmThread->next = 0;
CONTEXT(the_main_thread).status = THREAD_SUSPENDED;
CONTEXT(the_main_thread).stackBase = CONTEXT(the_main_thread).stackEnd = stackbottom;
THREADINFO(&CONTEXT(the_main_thread));
CONTEXT(the_main_thread).flags = THREAD_FLAGS_NOSTACKALLOC;
CONTEXT(the_main_thread).nextlive = 0;
- CONTEXT(the_main_thread).thread = the_main_thread;
+ /*CONTEXT(the_main_thread).thread = the_main_thread;*/
/*the_main_thread->single_step = 0;*/
the_main_thread->daemon = 0;
/*the_main_thread->stillborn = 0;*/
DBG( fprintf(stderr, "finishing initThreads\n"); );
mainThread = currentThread = the_main_thread;
-
+ contexts[0]=mainThread->vmThread;
/* Add thread into runQ */
iresumeThread(mainThread);
/* Allocate a stack context */
for (i = 0; i < MAXTHREADS; ++i)
- if (contexts[i].free)
+ if (contexts[i]==0)
break;
- if (i == MAXTHREADS)
+ if (i == MAXTHREADS)
panic("Too many threads");
assert(tid->priority >= MIN_THREAD_PRIO && tid->priority <= MAX_THREAD_PRIO);
+ contexts[i]=tid->vmThread;
+/* tid->PrivateInfo = i + 1;
+ CONTEXT(tid).free = false;*/
+ if (tid->vmThread==0) {
+ panic("vmThread field not set");
+/* tid->vmThread=init_vmthread(tid);*/
+ }
- tid->PrivateInfo = i + 1;
- CONTEXT(tid).free = false;
- CONTEXT(tid).thread = tid;
+/* CONTEXT(tid).thread = tid;*/
CONTEXT(tid).nextlive = liveThreads;
liveThreads = tid;
allocThreadStack(tid, threadStackSize);
tid = (thread *) builtin_new(class_new(utf_new_char("java/lang/Thread")));
assert(tid != 0);
- for (i = 0; i < MAXTHREADS; ++i)
- if (contexts[i].free)
+/* for (i = 0; i < MAXTHREADS; ++i)
+ if (contexts[i]==0)
break;
if (i == MAXTHREADS)
- panic("Too many threads");
+ panic("Too many threads");*/
- tid->PrivateInfo = i + 1;
- CONTEXT(tid).free = false;
+/* tid->PrivateInfo = i + 1;
+ CONTEXT(tid).free = false;*/
tid->name = 0; /* for the moment */
tid->priority = MAX_THREAD_PRIO;
CONTEXT(tid).priority = (u1)tid->priority;
- tid->next = 0;
+ tid->vmThread->next = 0;
CONTEXT(tid).status = THREAD_SUSPENDED;
allocThreadStack(tid, stackSize);
assert(blockInts == 0);
/* Find the run()V method and call it */
- method = class_findmethod(currentThread->header.vftbl->class,
+ method = class_findmethod(currentThread->vmThread->header.vftbl->class,
utf_new_char("run"), utf_new_char("()V"));
if (method == 0)
panic("Cannot find method \'void run ()\'");
- asm_calljavafunction(method, currentThread, NULL, NULL, NULL);
+ asm_calljavafunction(method, currentThread->vmThread, NULL, NULL, NULL);
if (*exceptionptr) {
utf_display((*exceptionptr)->vftbl->class->name);
void
iresumeThread(thread* tid)
{
+ vmthread *vmctid;
DBG( printf("resumeThread %p\n", tid); );
intsDisable();
+ if (tid->vmThread==0) {
+ intsRestore();
+ return;
+ }
+
+ if (currentThread->vmThread==0) {
+ long i1;
+ for (i1=0;i1<MAXTHREADS;i1++) {
+ if (!contexts[i1]) continue;
+ if (contexts[i1]->thread==currentThread) {
+ vmctid=contexts[i1];
+ break;
+ }
+ }
+ if (i1==MAXTHREADS) vmctid=0; /*panic("Thread not found in iresumeThread");*/
+
+ } else {
+ vmctid=currentThread->vmThread;
+ }
if (CONTEXT(tid).status != THREAD_RUNNING)
{
if (threadQhead[CONTEXT(tid).priority] == 0) {
threadQhead[CONTEXT(tid).priority] = tid;
threadQtail[CONTEXT(tid).priority] = tid;
- if (CONTEXT(tid).priority
- > CONTEXT(currentThread).priority)
+
+ if ((vmctid==0) || (CONTEXT(tid).priority
+ > vmctid->priority) )
needReschedule = true;
}
else
{
- threadQtail[CONTEXT(tid).priority]->next = tid;
+ threadQtail[CONTEXT(tid).priority]->vmThread->next = tid;
threadQtail[CONTEXT(tid).priority] = tid;
}
- tid->next = 0;
+ tid->vmThread->next = 0;
}
SDBG( else { printf("Re-resuming %p\n", tid); } );
!= threadQtail[CONTEXT(currentThread).priority])
{
/* Get the next thread and move me to the end */
- threadQhead[CONTEXT(currentThread).priority] = currentThread->next;
- threadQtail[CONTEXT(currentThread).priority]->next = currentThread;
+ threadQhead[CONTEXT(currentThread).priority] = currentThread->vmThread->next;
+ threadQtail[CONTEXT(currentThread).priority]->vmThread->next = currentThread;
threadQtail[CONTEXT(currentThread).priority] = currentThread;
- currentThread->next = 0;
+ currentThread->vmThread->next = 0;
needReschedule = true;
}
for (ntid = &threadQhead[CONTEXT(tid).priority];
*ntid != 0;
- ntid = &(*ntid)->next)
+ ntid = &(*ntid)->vmThread->next)
{
if (*ntid == tid)
{
- *ntid = tid->next;
- tid->next = 0;
+ *ntid = tid->vmThread->next;
+ tid->vmThread->next = 0;
if (tid == currentThread)
{
reschedule();
for (ntid = &threadQhead[CONTEXT(tid).priority];
*ntid != 0;
- ntid = &(*ntid)->next)
+ ntid = &(*ntid)->vmThread->next)
{
if (*ntid == tid)
{
- *ntid = tid->next;
+ *ntid = tid->vmThread->next;
/* Insert onto head of lock wait Q */
- tid->next = *queue;
+ tid->vmThread->next = *queue;
*queue = tid;
if (tid == currentThread)
{
void
killThread(thread* tid)
{
+ vmthread *context;
thread** ntid;
intsDisable();
tid = currentThread;
}
+ if (tid->vmThread==0) {
+ long i1;
+ for (i1=0;i1<MAXTHREADS;i1++) {
+ if (!contexts[i1]) continue;
+ if (contexts[i1]->thread==tid) {
+ context=contexts[i1];
+ break;
+ }
+ }
+ if (i1==MAXTHREADS) panic("Thread not found in killThread");
+
+ } else context=tid->vmThread;
+
DBG( printf("killThread %p\n", tid); );
- if (CONTEXT(tid).status != THREAD_DEAD)
+ if (context->status != THREAD_DEAD)
{
/* Get thread off runq (if it needs it) */
- if (CONTEXT(tid).status == THREAD_RUNNING)
+ if (context->status == THREAD_RUNNING)
{
- for (ntid = &threadQhead[CONTEXT(tid).priority];
+ for (ntid = &threadQhead[context->priority];
*ntid != 0;
- ntid = &(*ntid)->next)
+ ntid = &(*ntid)->vmThread->next)
{
if (*ntid == tid)
{
- *ntid = tid->next;
+ *ntid = context->next;
break;
}
}
}
- CONTEXT(tid).status = THREAD_DEAD;
+ context->status = THREAD_DEAD;
talive--;
if (tid->daemon) {
tdaemon--;
{
if (tid == (*ntid))
{
- (*ntid) = CONTEXT(tid).nextlive;
+ (*ntid) = context->nextlive;
break;
}
}
+
/* Free stack */
- freeThreadStack(tid);
+ freeThreadStack(context);
/* free context */
- if (tid != mainThread) {
+ if (tid != mainThread)
+ {
+ long i;
+ for (i=0;i<MAXTHREADS;i++) {
+ if (!contexts[i]) continue;
+ if (contexts[i]==context) {
+ contexts[i]=0;
+ break;
+ }
+ }
+ }
+/* if (tid != mainThread) {
CONTEXT(tid).free = true;
CONTEXT(tid).thread = NULL;
- }
+ }*/
/* Run something else */
needReschedule = true;
}
+ for (ntid = &sleepThreads;
+ *ntid != 0;
+ ntid = &(CONTEXT((*ntid)).next))
+ {
+ if (tid == (*ntid))
+ {
+ (*ntid) = context->next;
+ break;
+ }
+ }
+
intsRestore();
}
assert(prio >= MIN_THREAD_PRIO && prio <= MAX_THREAD_PRIO);
- if (tid->PrivateInfo == 0) {
+#warning fixme ??
+/* if (tid->PrivateInfo == 0) {
tid->priority = prio;
return;
- }
+ }*/
if (CONTEXT(tid).status == THREAD_SUSPENDED) {
CONTEXT(tid).priority = (u8)prio;
intsDisable();
/* Remove from current thread list */
- for (ntid = &threadQhead[CONTEXT(tid).priority]; *ntid != 0; ntid = &(*ntid)->next) {
+ for (ntid = &threadQhead[CONTEXT(tid).priority]; *ntid != 0; ntid = &(*ntid)->vmThread->next) {
if (*ntid == tid) {
- *ntid = tid->next;
+ *ntid = tid->vmThread->next;
break;
}
}
}
}
else {
- threadQtail[prio]->next = tid;
+ threadQtail[prio]->vmThread->next = tid;
threadQtail[prio] = tid;
}
- tid->next = 0;
+ tid->vmThread->next = 0;
intsRestore();
}
CONTEXT(currentThread).time = time + currentTime();
/* Find place in alarm list */
- for (tidp = &sleepThreads; (*tidp) != 0; tidp = &(*tidp)->next)
+ for (tidp = &sleepThreads; (*tidp) != 0; tidp = &((*tidp)->vmThread->next))
{
- if (CONTEXT(*tidp).time > CONTEXT(currentThread).time)
+ if (CONTEXT((*tidp)).time > CONTEXT(currentThread).time)
break;
}
bool
aliveThread(thread* tid)
{
- if (tid->PrivateInfo != 0 && CONTEXT(tid).status != THREAD_DEAD)
+ if (tid!=mainThread && CONTEXT(tid).status != THREAD_DEAD)
return (true);
else
return (false);
CONTEXT(currentThread).texceptionptr = *exceptionptr;
DBG( fprintf(stderr, "thread switch from: %p to: %p\n", lastThread, currentThread); );
+ {
THREADSWITCH((&CONTEXT(currentThread)),
(&CONTEXT(lastThread)));
+ }
blockInts = b;
*exceptionptr = CONTEXT(currentThread).texceptionptr;
struct _thread;
+#if 0
typedef struct _ctx
{
struct _thread *thread;
struct _thread *nextlive;
u1 flags;
} ctx;
+#endif
/*
struct _stringClass;
} threadGroup;
+
+/* This structure mirrors java.lang.VMThread.h */
+typedef struct vmthread {
+ java_objectheader header;
+ struct _thread* thread;
+ s4 running;
+ s4 status;
+ s4 priority;
+ void* restorePoint;
+ void* stackMem;
+ void* stackBase;
+ void* stackEnd;
+ void* usedStackTop;
+ s8 time;
+ java_objectheader *texceptionptr;
+ struct _thread* nextlive;
+ struct _thread* next;
+ s4 flags;
+} vmthread;
+
/* This structure mirrors java.lang.Thread.h */
typedef struct _thread {
java_objectheader header;
- struct _threadGroup* group;
- struct java_objectheader* toRun;
- struct java_objectheader* name;
- s8 PrivateInfo;
- struct _thread* next;
+ vmthread* vmThread;
+ threadGroup* group;
+ struct java_lang_Runnable* runnable;
+ struct java_lang_String* name;
s4 daemon;
s4 priority;
- struct java_objectheader* contextClassLoader;
+ s8 stacksize;
+ struct java_lang_Throwable* stillborn;
+ struct java_lang_ClassLoader* contextClassLoader;
} thread;
void initThreads (u1 *stackbottom);
extern bool needReschedule;
extern thread *currentThread;
extern thread *mainThread;
-extern ctx contexts[];
+/*extern ctx contexts[];*/
extern int threadStackSize;
extern thread *liveThreads;
extern thread *threadQhead[MAX_THREAD_PRIO + 1];
-#define CONTEXT(_t) (contexts[(_t)->PrivateInfo - 1])
+/*#define CONTEXT(_t) (contexts[(_t)->PrivateInfo - 1])*/
+#define CONTEXT(_t) (*(_t->vmThread))
#define intsDisable() blockInts++
#define THREADSWITCH(to, from) \
do { \
- asm_perform_threadswitch(&(from)->restorePoint,\
- &(to)->restorePoint, &(from)->usedStackTop); \
+ void *from1; \
+ void *from2; \
+ asm_perform_threadswitch((from?&(from)->restorePoint:&from1),\
+ &(to)->restorePoint, (from?&(from)->usedStackTop:&from2)); \
} while (0)
{
int cmp = tree->avl_compare (item, p->avl_data, tree->avl_param);
- if (cmp < 0)
+ if (cmp < 0)
p = p->avl_link[0];
else if (cmp > 0)
p = p->avl_link[1];
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 1113 2004-06-02 10:31:09Z twisti $
+ $Id: builtin.c 1173 2004-06-16 14:56:18Z jowenn $
*/
size_t s;
s=(end-begin);
/*printf ("begin: %p, end: %p, diff: %ld, size :%ld\n",begin,end,s,s*sizeof(stacktraceelement));*/
+ *el=heap_allocate(sizeof(stacktraceelement)*(s+1), true, 0);
+#if 0
*el=MNEW(stacktraceelement,s+1); /*GC*/
+#endif
memcpy(*el,begin,(end-begin)*sizeof(stacktraceelement));
(*el)[s].method=0;
#if defined(__GNUC__)
Philipp Tomsich
Edwin Steiner
- $Id: global.h 1155 2004-06-09 16:28:52Z twisti $
+ $Id: global.h 1173 2004-06-16 14:56:18Z jowenn $
*/
/* should # method def'd and used be kept after static parse (will it be used?) */
s4 subRedefs;
s4 subRedefsUsed;
+ s4 nativelyoverloaded; /*used in header.c and only valid there*/
};
/* flag variables *************************************************************/
+extern bool cacao_initializing;
extern bool compileall;
extern bool runverbose;
extern bool verboseexception;
Changes: Christian Thalinger
- $Id: asmpart.h 1164 2004-06-12 13:32:49Z stefan $
+ $Id: asmpart.h 1173 2004-06-16 14:56:18Z jowenn $
*/
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
extern threadcritnode asm_criticalsections;
#endif
+
void asm_getclassvalues_atomic(vftbl *super, vftbl *sub, castinfo *out);
+
#endif /* _ASMPART_H */
memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen.inc 1165 2004-06-12 13:33:38Z stefan $
+ $Id: codegen.inc 1173 2004-06-16 14:56:18Z jowenn $
*/
void *endpc;
};
-static struct avl_table *methodtree;
+static struct avl_table *methodtree=0;
static int methodtree_comparator(const void *pc, const void *element,
void *param);
#endif
methodtree = avl_create(methodtree_comparator, NULL, NULL);
mte = NEW(methodtree_element);
- mte->startpc = (void *) asm_calljavafunction;
- mte->endpc = (void *) calljava_xhandler;
+
+ mte->startpc = asm_calljavafunction;
+ mte->endpc = asm_calljavafunction2-1;
+
avl_insert(methodtree, mte);
mte = NEW(methodtree_element);
- mte->startpc = (void *) asm_calljavafunction2;
- mte->endpc = (void *) calljava_xhandler2;
+
+ mte->startpc = asm_calljavafunction2;
+ mte->endpc = asm_call_jit_compiler-1;
+
avl_insert(methodtree, mte);
}
#endif
}
+void codegen_insertNative(void *startpc,void *endpc) {
+ methodtree_element *mte;
+
+ if (!methodtree) {
+ methodtree_element *mte;
+
+ methodtree = avl_create(methodtree_comparator, NULL, NULL);
+
+ mte = NEW(methodtree_element);
+ mte->startpc = asm_calljavafunction;
+ mte->endpc = asm_calljavafunction2-1;
+ avl_insert(methodtree, mte);
+
+ mte = NEW(methodtree_element);
+ mte->startpc = asm_calljavafunction2;
+ mte->endpc = asm_call_jit_compiler-1;
+ avl_insert(methodtree, mte);
+ }
+
+
+ mte = NEW(methodtree_element);
+ mte->startpc = startpc;
+ mte->endpc = endpc;
+
+ if (avl_insert(methodtree, mte))
+ panic("duplicate entry");
+}
void dseg_display(s4 *s4ptr)
{
Reinhard Grafl
Christian Thalinger
- $Id: asmpart.S 1140 2004-06-05 20:58:14Z twisti $
+ $Id: asmpart.S 1173 2004-06-16 14:56:18Z jowenn $
*/
Java_java_lang_VMSecurityManager_currentClassLoader:
+ mov cacao_initializing,%eax
+ test %eax,%eax
+ jz Java_java_lang_VMSecurityManager_cont
+
+ mov $0,%eax
+ ret
+Java_java_lang_VMSecurityManager_cont:
lea builtin_asm_getclassloader,%eax
push %eax /*store collector function pointer*/
jmp getClassContext_begin
addl $116, %edx
push %edx /*esp+8*/ /*position of return address of native stub*/
call builtin_asm_get_stackframeinfo
- movl (%eax),%eax /*comment ??*/
+/* movl (%eax),%eax*/ /*TEST*/
push 0(%eax) /*esp+4*/ /*address of frame info block*/
movl 124(%esp),%edx
getClassContext_nativeCall:
movl $1,32(%esp)
movl 4(%esp),%eax /*get top most element on stackframe help information stack*/
+ test %eax,%eax
+ jz getClassContext_leave
movl 0(%eax),%ecx
movl %ecx,4(%esp)
addl $8,%eax
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1168 2004-06-12 14:58:25Z stefan $
+ $Id: codegen.c 1173 2004-06-16 14:56:18Z jowenn $
*/
u1 *createnativestub(functionptr f, methodinfo *m)
{
u1 *s = CNEW(u1, NATIVESTUBSIZE); /* memory to hold the stub */
-
+ int addmethod=0;
u1 *tptr;
int i;
int stackframesize = 4+12; /* initial 4 bytes is space for jni env,
int stackframeoffset = 4;
int p, t;
-
+
mcodeptr = s; /* make macros work */
if (m->flags & ACC_STATIC) {
if (m->flags & ACC_STATIC) {
/* if class isn't yet initialized, do it */
if (!m->class->initialized) {
+ s4 *header=(s4*)s;
+ *header = 0;/*extablesize*/
+ header;
+ *header = 0;/*line number table start*/
+ header++;
+ *header = 0;/*line number table size*/
+ header++;
+ *header = 0;/*fltsave*/
+ header++;
+ *header = 0;/*intsave*/
+ header++;
+ *header = 0;/*isleaf*/
+ header++;
+ *header = 0;/*issync*/
+ header++;
+ *header = 0;/*framesize*/
+ header++;
+ *header = m;/*methodpointer*/
+ *header++;
+ mcodeptr=s=header;
+ addmethod=1;
/* call helper function which patches this code */
i386_mov_imm_reg((s4) m->class, REG_ITMP1);
i386_mov_imm_reg((s4) asm_check_clinit, REG_ITMP2);
i386_mov_imm_reg((s4) asm_handle_nat_exception, REG_ITMP3);
i386_jmp_reg(REG_ITMP3);
+ if (addmethod) {
+ codegen_insertNative(s,mcodeptr);
+ }
+
#if 0
- dolog_plain("stubsize: %d (for %d params)\n", (s4) (mcodeptr - s), m->paramcount);
+ dolog_plain("native stubentry: %p, stubsize: %x (for %d params) --", (s4)s,(s4) (mcodeptr - s), m->paramcount);
+ utf_display(m->name);
+ dolog_plain("\n");
#endif
#if defined(STATISTICS)
Mark Probst
Edwin Steiner
- $Id: loader.c 1154 2004-06-09 16:28:00Z twisti $
+ $Id: loader.c 1173 2004-06-16 14:56:18Z jowenn $
*/
m->linenumbercount = 0;
m->linenumbers = 0;
m->class = c;
-
+ m->nativelyoverloaded=false;
m->flags = suck_u2(cb);
m->name = class_getconstant(c, suck_u2(cb), CONSTANT_Utf8);
--- /dev/null
+public class fintest2 {
+ public int num;
+
+ public fintest2 (int n) { num = n; }
+
+ public void finalize () {
+ System.out.print ("finalized ");
+ System.out.print (num);
+ System.out.println (". object");
+ }
+
+ public static void main (String[] s) {
+ int i;
+ fintest2 f=null;
+
+ Runtime.getRuntime().runFinalizersOnExit(true);
+
+ for (i=0; i<100; i++) {
+ System.out.print (i);
+ System.out.println (". Objekt wird angelegt");
+ f = new fintest2(i);
+ }
+
+ Runtime.getRuntime().exit(0);
+
+ }
+
+ }
+
+
--- /dev/null
+public class fintest2a {
+ public int num;
+
+ public fintest2a (int n) { num = n; }
+
+ public void finalize () {
+ System.out.print ("finalized ");
+ System.out.print (num);
+ System.out.println (". object");
+ }
+
+ public static void main (String[] s) {
+ int i;
+ fintest2a f=null;
+
+ for (i=0; i<100; i++) {
+ System.out.print (i);
+ System.out.println (". Objekt wird angelegt");
+ f = new fintest2a(i);
+ }
+
+ Runtime.getRuntime().exit(0);
+
+ }
+
+ }
+
+
--- /dev/null
+public class fintest3 {
+ public int num;
+
+ public fintest3 (int n) { num = n; }
+
+ public void finalize () {
+ System.out.print ("finalized ");
+ System.out.print (num);
+ System.out.println (". object");
+ }
+
+ public static void main (String[] s) {
+ int i;
+ fintest3 f=null;
+ Runtime.getRuntime().runFinalizersOnExit(true);
+ for (i=0; i<100; i++) {
+ System.out.print (i);
+ System.out.println (". Objekt wird angelegt");
+ f = new fintest3(i);
+ }
+
+
+ }
+
+ }
+
+
--- /dev/null
+public class fintest3a {
+ public int num;
+
+ public fintest3a (int n) { num = n; }
+
+ public void finalize () {
+ System.out.print ("finalized ");
+ System.out.print (num);
+ System.out.println (". object");
+ }
+
+ public static void main (String[] s) {
+ int i;
+ fintest3a f=null;
+
+ for (i=0; i<100; i++) {
+ System.out.print (i);
+ System.out.println (". Objekt wird angelegt");
+ f = new fintest3a(i);
+ }
+
+
+ }
+
+ }
+
+
--- /dev/null
+public class fintest4 {
+ public int num;
+
+ public fintest4 (int n) { num = n; }
+
+ public void finalize () {
+ System.out.print ("finalized ");
+ System.out.print (num);
+ System.out.println (". object");
+ }
+
+ public static void main (String[] s) {
+ int i;
+ fintest3 f=null;
+ Runtime.getRuntime().runFinalizersOnExit(true);
+ for (i=0; i<100; i++) {
+ System.out.print (i);
+ System.out.println (". Objekt wird angelegt");
+ f = new fintest3(i);
+ }
+
+ throw new NullPointerException();
+ }
+
+ }
+
+
--- /dev/null
+public class fintest4a {
+ public int num;
+
+ public fintest4a (int n) { num = n; }
+
+ public void finalize () {
+ System.out.print ("finalized ");
+ System.out.print (num);
+ System.out.println (". object");
+ }
+
+ public static void main (String[] s) {
+ int i;
+ fintest3a f=null;
+
+ for (i=0; i<100; i++) {
+ System.out.print (i);
+ System.out.println (". Objekt wird angelegt");
+ f = new fintest3a(i);
+ }
+
+ throw new NullPointerException();
+ }
+
+ }
+
+
public class httpd
{
- static String document_root = "/nethome/hansolo/schani/public_html";
+ static String document_root;
static int num_threads = 10;
ServerThread threads[] = null;
public static void main (String args[])
{
+ document_root=args[0];
new httpd().run();
}
-all: testlib1 testlib2
+all: testlib1 testlib2 testlib3
testlib1:
javac stackTraceTest1.java
testlib2:
javac stackTraceTest2.java
gcc -shared -o libstackTraceTest2.so stackTraceTest2.c
+
+testlib3:
+ javac stackTraceTest3.java
+ gcc -shared -o libstackTraceTest3.so stackTraceTest3.c
+
clean:
rm -f libstackTraceTest1.so stackTraceTest1.class
rm -f libstackTraceTest2.so stackTraceTest2.class
+ rm -f libstackTraceTest3.so stackTraceTest3.class
test:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd` java stackTraceTest1
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd` java stackTraceTest2
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd` java stackTraceTest3
--- /dev/null
+class nestedstaticinitializers2_clinit1 {
+
+ public nestedstaticinitializers2_clinit1() {
+ System.out.println("Never reached");
+ }
+
+ public static int x;
+ static {
+ nestedstaticinitializers2_clinit2.x=3;
+ }
+
+}
+
+class nestedstaticinitializers2_clinit2 {
+ public static int x;
+ static {
+ nestedstaticinitializers2_clinit3.x=3;
+ }
+
+}
+
+class nestedstaticinitializers2_clinit3 {
+ public static int x;
+ static {
+ int y[]=new int[-1];
+ }
+
+}
+
+class nestedstaticinitializers2 {
+ public static void main (String args[]) {
+ try {
+ nestedstaticinitializers2_clinit1 x[]=new nestedstaticinitializers2_clinit1[10];
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
if (mux->muxWaiters != 0)
{
tid = mux->muxWaiters;
- mux->muxWaiters = tid->next;
+ mux->muxWaiters = tid->vmThread->next;
iresumeThread(tid);
}
}
/* If there's anyone waiting here, wake them up */
if (mux->muxWaiters != 0) {
tid = mux->muxWaiters;
- mux->muxWaiters = tid->next;
+ mux->muxWaiters = tid->vmThread->next;
iresumeThread(tid);
}
DBG( fprintf(stderr, "releasing a waiter\n"); );
tid = cv->cvWaiters;
- cv->cvWaiters = tid->next;
+ cv->cvWaiters = tid->vmThread->next;
/* Place it on mux list */
- tid->next = cv->mux->muxWaiters;
+ tid->vmThread->next = cv->mux->muxWaiters;
cv->mux->muxWaiters = tid;
}
}
/* Find the end of the cv list */
if (cv->cvWaiters) {
- for (tidp = &cv->cvWaiters; *tidp != 0; tidp = &(*tidp)->next)
+ for (tidp = &cv->cvWaiters; *tidp != 0; tidp = &(*tidp)->vmThread->next)
;
/* Place entire cv list on mux list */
int blockInts;
bool needReschedule;
-ctx contexts[MAXTHREADS];
+vmthread *contexts[MAXTHREADS];
/* Number of threads alive, also counting daemons */
static int talive;
static thread* startDaemon(void* func, char* nm, int stackSize);
+
+
+java_objectheader *init_vmthread(void *thr)
+{
+ methodinfo *m;
+ java_objectheader *o;
+ classinfo *c=class_new(utf_new_char("java/lang/VMThread"));
+
+ if (!c)
+ return *exceptionptr;
+
+ o = builtin_new(c); /* create object */
+
+ if (!o)
+ return NULL;
+
+ /* find initializer */
+
+ m = class_findmethod(c,
+ utf_new_char("<init>"),
+ utf_new_char("(Ljava/lang/Thread;)V"));
+
+ if (!m) { /* initializer not found */
+ if (verbose) {
+ char logtext[MAXLOGTEXT];
+ sprintf(logtext, "Warning: class has no instance-initializer: ");
+ utf_sprint_classname(logtext + strlen(logtext), c->name);
+ log_text(logtext);
+ }
+ return o;
+ }
+
+ /* call initializer */
+
+ asm_calljavafunction(m, o, thr, NULL, NULL);
+ return o;
+}
+
+
+
+
/*
* Allocate the stack for a thread
*/
* immediately because it is still in use!
*/
void
-freeThreadStack (thread *tid)
+freeThreadStack (vmthread *vmtid)
{
- if (!(CONTEXT(tid).flags & THREAD_FLAGS_NOSTACKALLOC))
+ if (!(vmtid->flags & THREAD_FLAGS_NOSTACKALLOC))
{
int pageSize = getpagesize();
unsigned long pageBegin;
- pageBegin = (unsigned long)(CONTEXT(tid).stackMem) + pageSize - 1;
+ pageBegin = (unsigned long)(vmtid->stackMem) + pageSize - 1;
pageBegin = pageBegin - pageBegin % pageSize;
assert(stack_to_be_freed == 0);
- stack_to_be_freed = CONTEXT(tid).stackMem;
+ stack_to_be_freed = vmtid->stackMem;
}
- CONTEXT(tid).stackMem = 0;
- CONTEXT(tid).stackBase = 0;
- CONTEXT(tid).stackEnd = 0;
+ vmtid->stackMem = 0;
+ vmtid->stackBase = 0;
+ vmtid->stackEnd = 0;
}
/*
initLocks();
for (i = 0; i < MAXTHREADS; ++i) {
- contexts[i].free = true;
- contexts[i].thread = NULL;
+ contexts[i]=0;
}
/* Allocate a thread to be the main thread */
liveThreads = the_main_thread =
(thread *) builtin_new(class_new(utf_new_char("java/lang/Thread")));
+ the_main_thread->vmThread=init_vmthread(the_main_thread);
assert(the_main_thread != 0);
- the_main_thread->PrivateInfo = 1;
- CONTEXT(the_main_thread).free = false;
+/* the_main_thread->PrivateInfo = 1;
+ CONTEXT(the_main_thread).free = false;*/
#if 0
{
for (i=0; i<len; i++)
d[i] = mainname[i];
}*/
+
the_main_thread->priority = NORM_THREAD_PRIO;
CONTEXT(the_main_thread).priority = (u1)the_main_thread->priority;
CONTEXT(the_main_thread).texceptionptr = 0;
- the_main_thread->next = 0;
+ the_main_thread->vmThread->next = 0;
CONTEXT(the_main_thread).status = THREAD_SUSPENDED;
CONTEXT(the_main_thread).stackBase = CONTEXT(the_main_thread).stackEnd = stackbottom;
THREADINFO(&CONTEXT(the_main_thread));
CONTEXT(the_main_thread).flags = THREAD_FLAGS_NOSTACKALLOC;
CONTEXT(the_main_thread).nextlive = 0;
- CONTEXT(the_main_thread).thread = the_main_thread;
+ /*CONTEXT(the_main_thread).thread = the_main_thread;*/
/*the_main_thread->single_step = 0;*/
the_main_thread->daemon = 0;
/*the_main_thread->stillborn = 0;*/
DBG( fprintf(stderr, "finishing initThreads\n"); );
mainThread = currentThread = the_main_thread;
-
+ contexts[0]=mainThread->vmThread;
/* Add thread into runQ */
iresumeThread(mainThread);
/* Allocate a stack context */
for (i = 0; i < MAXTHREADS; ++i)
- if (contexts[i].free)
+ if (contexts[i]==0)
break;
- if (i == MAXTHREADS)
+ if (i == MAXTHREADS)
panic("Too many threads");
assert(tid->priority >= MIN_THREAD_PRIO && tid->priority <= MAX_THREAD_PRIO);
+ contexts[i]=tid->vmThread;
+/* tid->PrivateInfo = i + 1;
+ CONTEXT(tid).free = false;*/
+ if (tid->vmThread==0) {
+ panic("vmThread field not set");
+/* tid->vmThread=init_vmthread(tid);*/
+ }
- tid->PrivateInfo = i + 1;
- CONTEXT(tid).free = false;
- CONTEXT(tid).thread = tid;
+/* CONTEXT(tid).thread = tid;*/
CONTEXT(tid).nextlive = liveThreads;
liveThreads = tid;
allocThreadStack(tid, threadStackSize);
tid = (thread *) builtin_new(class_new(utf_new_char("java/lang/Thread")));
assert(tid != 0);
- for (i = 0; i < MAXTHREADS; ++i)
- if (contexts[i].free)
+/* for (i = 0; i < MAXTHREADS; ++i)
+ if (contexts[i]==0)
break;
if (i == MAXTHREADS)
- panic("Too many threads");
+ panic("Too many threads");*/
- tid->PrivateInfo = i + 1;
- CONTEXT(tid).free = false;
+/* tid->PrivateInfo = i + 1;
+ CONTEXT(tid).free = false;*/
tid->name = 0; /* for the moment */
tid->priority = MAX_THREAD_PRIO;
CONTEXT(tid).priority = (u1)tid->priority;
- tid->next = 0;
+ tid->vmThread->next = 0;
CONTEXT(tid).status = THREAD_SUSPENDED;
allocThreadStack(tid, stackSize);
assert(blockInts == 0);
/* Find the run()V method and call it */
- method = class_findmethod(currentThread->header.vftbl->class,
+ method = class_findmethod(currentThread->vmThread->header.vftbl->class,
utf_new_char("run"), utf_new_char("()V"));
if (method == 0)
panic("Cannot find method \'void run ()\'");
- asm_calljavafunction(method, currentThread, NULL, NULL, NULL);
+ asm_calljavafunction(method, currentThread->vmThread, NULL, NULL, NULL);
if (*exceptionptr) {
utf_display((*exceptionptr)->vftbl->class->name);
void
iresumeThread(thread* tid)
{
+ vmthread *vmctid;
DBG( printf("resumeThread %p\n", tid); );
intsDisable();
+ if (tid->vmThread==0) {
+ intsRestore();
+ return;
+ }
+
+ if (currentThread->vmThread==0) {
+ long i1;
+ for (i1=0;i1<MAXTHREADS;i1++) {
+ if (!contexts[i1]) continue;
+ if (contexts[i1]->thread==currentThread) {
+ vmctid=contexts[i1];
+ break;
+ }
+ }
+ if (i1==MAXTHREADS) vmctid=0; /*panic("Thread not found in iresumeThread");*/
+
+ } else {
+ vmctid=currentThread->vmThread;
+ }
if (CONTEXT(tid).status != THREAD_RUNNING)
{
if (threadQhead[CONTEXT(tid).priority] == 0) {
threadQhead[CONTEXT(tid).priority] = tid;
threadQtail[CONTEXT(tid).priority] = tid;
- if (CONTEXT(tid).priority
- > CONTEXT(currentThread).priority)
+
+ if ((vmctid==0) || (CONTEXT(tid).priority
+ > vmctid->priority) )
needReschedule = true;
}
else
{
- threadQtail[CONTEXT(tid).priority]->next = tid;
+ threadQtail[CONTEXT(tid).priority]->vmThread->next = tid;
threadQtail[CONTEXT(tid).priority] = tid;
}
- tid->next = 0;
+ tid->vmThread->next = 0;
}
SDBG( else { printf("Re-resuming %p\n", tid); } );
!= threadQtail[CONTEXT(currentThread).priority])
{
/* Get the next thread and move me to the end */
- threadQhead[CONTEXT(currentThread).priority] = currentThread->next;
- threadQtail[CONTEXT(currentThread).priority]->next = currentThread;
+ threadQhead[CONTEXT(currentThread).priority] = currentThread->vmThread->next;
+ threadQtail[CONTEXT(currentThread).priority]->vmThread->next = currentThread;
threadQtail[CONTEXT(currentThread).priority] = currentThread;
- currentThread->next = 0;
+ currentThread->vmThread->next = 0;
needReschedule = true;
}
for (ntid = &threadQhead[CONTEXT(tid).priority];
*ntid != 0;
- ntid = &(*ntid)->next)
+ ntid = &(*ntid)->vmThread->next)
{
if (*ntid == tid)
{
- *ntid = tid->next;
- tid->next = 0;
+ *ntid = tid->vmThread->next;
+ tid->vmThread->next = 0;
if (tid == currentThread)
{
reschedule();
for (ntid = &threadQhead[CONTEXT(tid).priority];
*ntid != 0;
- ntid = &(*ntid)->next)
+ ntid = &(*ntid)->vmThread->next)
{
if (*ntid == tid)
{
- *ntid = tid->next;
+ *ntid = tid->vmThread->next;
/* Insert onto head of lock wait Q */
- tid->next = *queue;
+ tid->vmThread->next = *queue;
*queue = tid;
if (tid == currentThread)
{
void
killThread(thread* tid)
{
+ vmthread *context;
thread** ntid;
intsDisable();
tid = currentThread;
}
+ if (tid->vmThread==0) {
+ long i1;
+ for (i1=0;i1<MAXTHREADS;i1++) {
+ if (!contexts[i1]) continue;
+ if (contexts[i1]->thread==tid) {
+ context=contexts[i1];
+ break;
+ }
+ }
+ if (i1==MAXTHREADS) panic("Thread not found in killThread");
+
+ } else context=tid->vmThread;
+
DBG( printf("killThread %p\n", tid); );
- if (CONTEXT(tid).status != THREAD_DEAD)
+ if (context->status != THREAD_DEAD)
{
/* Get thread off runq (if it needs it) */
- if (CONTEXT(tid).status == THREAD_RUNNING)
+ if (context->status == THREAD_RUNNING)
{
- for (ntid = &threadQhead[CONTEXT(tid).priority];
+ for (ntid = &threadQhead[context->priority];
*ntid != 0;
- ntid = &(*ntid)->next)
+ ntid = &(*ntid)->vmThread->next)
{
if (*ntid == tid)
{
- *ntid = tid->next;
+ *ntid = context->next;
break;
}
}
}
- CONTEXT(tid).status = THREAD_DEAD;
+ context->status = THREAD_DEAD;
talive--;
if (tid->daemon) {
tdaemon--;
{
if (tid == (*ntid))
{
- (*ntid) = CONTEXT(tid).nextlive;
+ (*ntid) = context->nextlive;
break;
}
}
+
/* Free stack */
- freeThreadStack(tid);
+ freeThreadStack(context);
/* free context */
- if (tid != mainThread) {
+ if (tid != mainThread)
+ {
+ long i;
+ for (i=0;i<MAXTHREADS;i++) {
+ if (!contexts[i]) continue;
+ if (contexts[i]==context) {
+ contexts[i]=0;
+ break;
+ }
+ }
+ }
+/* if (tid != mainThread) {
CONTEXT(tid).free = true;
CONTEXT(tid).thread = NULL;
- }
+ }*/
/* Run something else */
needReschedule = true;
}
+ for (ntid = &sleepThreads;
+ *ntid != 0;
+ ntid = &(CONTEXT((*ntid)).next))
+ {
+ if (tid == (*ntid))
+ {
+ (*ntid) = context->next;
+ break;
+ }
+ }
+
intsRestore();
}
assert(prio >= MIN_THREAD_PRIO && prio <= MAX_THREAD_PRIO);
- if (tid->PrivateInfo == 0) {
+#warning fixme ??
+/* if (tid->PrivateInfo == 0) {
tid->priority = prio;
return;
- }
+ }*/
if (CONTEXT(tid).status == THREAD_SUSPENDED) {
CONTEXT(tid).priority = (u8)prio;
intsDisable();
/* Remove from current thread list */
- for (ntid = &threadQhead[CONTEXT(tid).priority]; *ntid != 0; ntid = &(*ntid)->next) {
+ for (ntid = &threadQhead[CONTEXT(tid).priority]; *ntid != 0; ntid = &(*ntid)->vmThread->next) {
if (*ntid == tid) {
- *ntid = tid->next;
+ *ntid = tid->vmThread->next;
break;
}
}
}
}
else {
- threadQtail[prio]->next = tid;
+ threadQtail[prio]->vmThread->next = tid;
threadQtail[prio] = tid;
}
- tid->next = 0;
+ tid->vmThread->next = 0;
intsRestore();
}
CONTEXT(currentThread).time = time + currentTime();
/* Find place in alarm list */
- for (tidp = &sleepThreads; (*tidp) != 0; tidp = &(*tidp)->next)
+ for (tidp = &sleepThreads; (*tidp) != 0; tidp = &((*tidp)->vmThread->next))
{
- if (CONTEXT(*tidp).time > CONTEXT(currentThread).time)
+ if (CONTEXT((*tidp)).time > CONTEXT(currentThread).time)
break;
}
bool
aliveThread(thread* tid)
{
- if (tid->PrivateInfo != 0 && CONTEXT(tid).status != THREAD_DEAD)
+ if (tid!=mainThread && CONTEXT(tid).status != THREAD_DEAD)
return (true);
else
return (false);
CONTEXT(currentThread).texceptionptr = *exceptionptr;
DBG( fprintf(stderr, "thread switch from: %p to: %p\n", lastThread, currentThread); );
+ {
THREADSWITCH((&CONTEXT(currentThread)),
(&CONTEXT(lastThread)));
+ }
blockInts = b;
*exceptionptr = CONTEXT(currentThread).texceptionptr;
struct _thread;
+#if 0
typedef struct _ctx
{
struct _thread *thread;
struct _thread *nextlive;
u1 flags;
} ctx;
+#endif
/*
struct _stringClass;
} threadGroup;
+
+/* This structure mirrors java.lang.VMThread.h */
+typedef struct vmthread {
+ java_objectheader header;
+ struct _thread* thread;
+ s4 running;
+ s4 status;
+ s4 priority;
+ void* restorePoint;
+ void* stackMem;
+ void* stackBase;
+ void* stackEnd;
+ void* usedStackTop;
+ s8 time;
+ java_objectheader *texceptionptr;
+ struct _thread* nextlive;
+ struct _thread* next;
+ s4 flags;
+} vmthread;
+
/* This structure mirrors java.lang.Thread.h */
typedef struct _thread {
java_objectheader header;
- struct _threadGroup* group;
- struct java_objectheader* toRun;
- struct java_objectheader* name;
- s8 PrivateInfo;
- struct _thread* next;
+ vmthread* vmThread;
+ threadGroup* group;
+ struct java_lang_Runnable* runnable;
+ struct java_lang_String* name;
s4 daemon;
s4 priority;
- struct java_objectheader* contextClassLoader;
+ s8 stacksize;
+ struct java_lang_Throwable* stillborn;
+ struct java_lang_ClassLoader* contextClassLoader;
} thread;
void initThreads (u1 *stackbottom);
extern bool needReschedule;
extern thread *currentThread;
extern thread *mainThread;
-extern ctx contexts[];
+/*extern ctx contexts[];*/
extern int threadStackSize;
extern thread *liveThreads;
extern thread *threadQhead[MAX_THREAD_PRIO + 1];
-#define CONTEXT(_t) (contexts[(_t)->PrivateInfo - 1])
+/*#define CONTEXT(_t) (contexts[(_t)->PrivateInfo - 1])*/
+#define CONTEXT(_t) (*(_t->vmThread))
#define intsDisable() blockInts++
#define THREADSWITCH(to, from) \
do { \
- asm_perform_threadswitch(&(from)->restorePoint,\
- &(to)->restorePoint, &(from)->usedStackTop); \
+ void *from1; \
+ void *from2; \
+ asm_perform_threadswitch((from?&(from)->restorePoint:&from1),\
+ &(to)->restorePoint, (from?&(from)->usedStackTop:&from2)); \
} while (0)
while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
{
tid = sleepThreads;
- sleepThreads = sleepThreads->next;
- tid->next = 0;
+ sleepThreads = sleepThreads->vmThread->next;
+ tid->vmThread->next = 0;
iresumeThread(tid);
}
while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
{
tid = sleepThreads;
- sleepThreads = sleepThreads->next;
- tid->next = 0;
+ sleepThreads = sleepThreads->vmThread->next;
+ tid->vmThread->next = 0;
iresumeThread(tid);
}
{
for (tid = readQ[i]; tid != 0; tid = ntid)
{
- ntid = tid->next;
+ ntid = tid->vmThread->next;
iresumeThread(tid);
}
readQ[i] = 0;
{
for (tid = writeQ[i]; tid != 0; tid = ntid)
{
- ntid = tid->next;
+ ntid = tid->vmThread->next;
iresumeThread(tid);
}
writeQ[i] = 0;
{
int cmp = tree->avl_compare (item, p->avl_data, tree->avl_param);
- if (cmp < 0)
+ if (cmp < 0)
p = p->avl_link[0];
else if (cmp > 0)
p = p->avl_link[1];