Initial revision
From-SVN: r26263
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// -*- c++ -*-
|
||||
// boehm-gc.h - Defines for Boehm collector.
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JV_BOEHM_GC__
|
||||
#define __JV_BOEHM_GC__
|
||||
|
||||
#define JV_MARKOBJ_DECL void *_Jv_MarkObj (void *, void *, void *, void *)
|
||||
#define JV_MARKARRAY_DECL void *_Jv_MarkArray (void *, void *, void *, void *)
|
||||
|
||||
extern "C"
|
||||
{
|
||||
JV_MARKOBJ_DECL;
|
||||
JV_MARKARRAY_DECL;
|
||||
};
|
||||
|
||||
#endif /* __JV_BOEHM_GC__ */
|
||||
@@ -0,0 +1,133 @@
|
||||
// cni.h -*- c++ -*-
|
||||
// This file describes the Cygnus Native Interface, CNI.
|
||||
// It provides a nicer interface to many of the things in javaprims.h.
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JAVA_CNI_H__
|
||||
#define __JAVA_CNI_H__
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <java/lang/Class.h>
|
||||
|
||||
#include <java-threads.h>
|
||||
#include <java-array.h>
|
||||
|
||||
extern inline jobject
|
||||
JvAllocObject (jclass cls)
|
||||
{
|
||||
return _Jv_AllocObject (cls, cls->size());
|
||||
}
|
||||
|
||||
extern inline jobject
|
||||
JvAllocObject (jclass cls, jsize sz)
|
||||
{
|
||||
return _Jv_AllocObject (cls, sz);
|
||||
}
|
||||
|
||||
extern "C" jstring _Jv_NewStringUTF (const char *bytes);
|
||||
extern "C" void _Jv_InitClass (jclass);
|
||||
|
||||
extern inline void
|
||||
JvInitClass (jclass cls)
|
||||
{
|
||||
return _Jv_InitClass (cls);
|
||||
}
|
||||
|
||||
extern inline jstring
|
||||
JvAllocString (jsize sz)
|
||||
{
|
||||
return _Jv_AllocString (sz);
|
||||
}
|
||||
|
||||
extern inline jstring
|
||||
JvNewString (const jchar *chars, jsize len)
|
||||
{
|
||||
return _Jv_NewString (chars, len);
|
||||
}
|
||||
|
||||
extern inline jstring
|
||||
JvNewStringLatin1 (const char *bytes, jsize len)
|
||||
{
|
||||
return _Jv_NewStringLatin1 (bytes, len);
|
||||
}
|
||||
|
||||
extern inline jstring
|
||||
JvNewStringLatin1 (const char *bytes)
|
||||
{
|
||||
return _Jv_NewStringLatin1 (bytes, strlen (bytes));
|
||||
}
|
||||
|
||||
extern inline jchar *
|
||||
_Jv_GetStringChars (jstring str)
|
||||
{
|
||||
return (jchar*)((char*) str->data + str->boffset);
|
||||
}
|
||||
|
||||
extern inline jchar*
|
||||
JvGetStringChars (jstring str)
|
||||
{
|
||||
return _Jv_GetStringChars (str);
|
||||
}
|
||||
|
||||
extern inline jsize
|
||||
JvGetStringUTFLength (jstring string)
|
||||
{
|
||||
return _Jv_GetStringUTFLength (string);
|
||||
}
|
||||
|
||||
extern inline jsize
|
||||
JvGetStringUTFRegion (jstring str, jsize start, jsize len, char *buf)
|
||||
{
|
||||
return _Jv_GetStringUTFRegion (str, start, len, buf);
|
||||
}
|
||||
|
||||
extern inline jstring
|
||||
JvNewStringUTF (const char *bytes)
|
||||
{
|
||||
return _Jv_NewStringUTF (bytes);
|
||||
}
|
||||
|
||||
extern class _Jv_PrimClass _Jv_byteClass, _Jv_shortClass, _Jv_intClass,
|
||||
_Jv_longClass, _Jv_booleanClass, _Jv_charClass, _Jv_floatClass,
|
||||
_Jv_doubleClass, _Jv_voidClass;
|
||||
#define JvPrimClass(TYPE) ((jclass) & _Jv_##TYPE##Class)
|
||||
|
||||
class JvSynchronize
|
||||
{
|
||||
private:
|
||||
jobject obj;
|
||||
public:
|
||||
JvSynchronize (const jobject &o) : obj (o)
|
||||
{ _Jv_MonitorEnter (obj); }
|
||||
~JvSynchronize ()
|
||||
{ _Jv_MonitorExit (obj); }
|
||||
};
|
||||
|
||||
// Throw some exception.
|
||||
extern void JvThrow (jobject obj) __attribute__ ((__noreturn__));
|
||||
extern inline void
|
||||
JvThrow (jobject obj)
|
||||
{
|
||||
_Jv_Throw ((void *) obj);
|
||||
}
|
||||
|
||||
/* Call malloc, but throw exception if insufficient memory. */
|
||||
extern inline void *
|
||||
JvMalloc (jsize size)
|
||||
{
|
||||
return _Jv_Malloc (size);
|
||||
}
|
||||
|
||||
extern inline void
|
||||
JvFree (void *ptr)
|
||||
{
|
||||
return _Jv_Free (ptr);
|
||||
}
|
||||
#endif /* __JAVA_CNI_H__ */
|
||||
@@ -0,0 +1,252 @@
|
||||
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define this if you want runtime debugging enabled. */
|
||||
#undef DEBUG
|
||||
|
||||
/* Define if using POSIX threads that have the mutexattr functions. */
|
||||
#undef HAVE_PTHREAD_MUTEXATTR_INIT
|
||||
|
||||
/* Define this if you prefer size over speed for java.lang.Character. */
|
||||
#undef COMPACT_CHARACTER
|
||||
|
||||
/* Define if you have memcpy. */
|
||||
#undef HAVE_MEMCPY
|
||||
|
||||
/* Define if you have memmove. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define if you have strerror. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define if you have __int32_t and __uint32_t. */
|
||||
#undef HAVE_INT32_DEFINED
|
||||
|
||||
/* Define if you're running eCos. */
|
||||
#undef ECOS
|
||||
|
||||
/* */
|
||||
#undef HAVE_LOCALTIME
|
||||
|
||||
/* */
|
||||
#undef HAVE_MKTIME
|
||||
|
||||
/* Define if using POSIX threads on Linux. */
|
||||
#undef LINUX_THREADS
|
||||
|
||||
/* Define if you have the `ctime_r' function. */
|
||||
#undef HAVE_CTIME_R
|
||||
|
||||
/* Define if you have the `gmtime_r' function. */
|
||||
#undef HAVE_GMTIME_R
|
||||
|
||||
/* Define if you have the `localtime_r' function. */
|
||||
#undef HAVE_LOCALTIME_R
|
||||
|
||||
/* Define if inet6 structures are defined in netinet/in.h. */
|
||||
#undef HAVE_INET6
|
||||
|
||||
/* Define it socklen_t typedef is in sys/socket.h. */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define if Boehm GC in use. */
|
||||
#undef HAVE_BOEHM_GC
|
||||
|
||||
/* Define if gethostname is declared in <unistd.h>. */
|
||||
#undef HAVE_GETHOSTNAME_DECL
|
||||
|
||||
/* Define if gethostbyname_r returns `int'. */
|
||||
#undef GETHOSTBYNAME_R_RETURNS_INT
|
||||
|
||||
/* Define if gethostbyaddr_r returns `int'. */
|
||||
#undef GETHOSTBYADDR_R_RETURNS_INT
|
||||
|
||||
/* Define if struct tm has tm_gmtoff field. */
|
||||
#undef STRUCT_TM_HAS_GMTOFF
|
||||
|
||||
/* Define if global `timezone' exists. */
|
||||
#undef HAVE_TIMEZONE
|
||||
|
||||
/* Define if you have the appropriate function. */
|
||||
#undef HAVE_ACCESS
|
||||
#undef HAVE_STAT
|
||||
#undef HAVE_MKDIR
|
||||
#undef HAVE_RENAME
|
||||
#undef HAVE_RMDIR
|
||||
#undef HAVE_UNLINK
|
||||
#undef HAVE_REALPATH
|
||||
#undef HAVE_READDIR_R
|
||||
#undef HAVE_GETHOSTBYNAME_R
|
||||
#undef HAVE_GETHOSTBYADDR_R
|
||||
|
||||
/* Define if you have the access function. */
|
||||
#undef HAVE_ACCESS
|
||||
|
||||
/* Define if you have the ctime function. */
|
||||
#undef HAVE_CTIME
|
||||
|
||||
/* Define if you have the ctime_r function. */
|
||||
#undef HAVE_CTIME_R
|
||||
|
||||
/* Define if you have the fsync function. */
|
||||
#undef HAVE_FSYNC
|
||||
|
||||
/* Define if you have the ftime function. */
|
||||
#undef HAVE_FTIME
|
||||
|
||||
/* Define if you have the gethostbyaddr_r function. */
|
||||
#undef HAVE_GETHOSTBYADDR_R
|
||||
|
||||
/* Define if you have the gethostbyname_r function. */
|
||||
#undef HAVE_GETHOSTBYNAME_R
|
||||
|
||||
/* Define if you have the gethostname function. */
|
||||
#undef HAVE_GETHOSTNAME
|
||||
|
||||
/* Define if you have the getpwuid_r function. */
|
||||
#undef HAVE_GETPWUID_R
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define if you have the gmtime_r function. */
|
||||
#undef HAVE_GMTIME_R
|
||||
|
||||
/* Define if you have the inet_addr function. */
|
||||
#undef HAVE_INET_ADDR
|
||||
|
||||
/* Define if you have the inet_aton function. */
|
||||
#undef HAVE_INET_ATON
|
||||
|
||||
/* Define if you have the inet_pton function. */
|
||||
#undef HAVE_INET_PTON
|
||||
|
||||
/* Define if you have the ioctl function. */
|
||||
#undef HAVE_IOCTL
|
||||
|
||||
/* Define if you have the localtime_r function. */
|
||||
#undef HAVE_LOCALTIME_R
|
||||
|
||||
/* Define if you have the memcpy function. */
|
||||
#undef HAVE_MEMCPY
|
||||
|
||||
/* Define if you have the memmove function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
#undef HAVE_MKDIR
|
||||
|
||||
/* Define if you have the open function. */
|
||||
#undef HAVE_OPEN
|
||||
|
||||
/* Define if you have the pthread_mutexattr_setkind_np function. */
|
||||
#undef HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
|
||||
|
||||
/* Define if you have the pthread_mutexattr_settype function. */
|
||||
#undef HAVE_PTHREAD_MUTEXATTR_SETTYPE
|
||||
|
||||
/* Define if you have the readdir_r function. */
|
||||
#undef HAVE_READDIR_R
|
||||
|
||||
/* Define if you have the realpath function. */
|
||||
#undef HAVE_REALPATH
|
||||
|
||||
/* Define if you have the rename function. */
|
||||
#undef HAVE_RENAME
|
||||
|
||||
/* Define if you have the rmdir function. */
|
||||
#undef HAVE_RMDIR
|
||||
|
||||
/* Define if you have the sched_yield function. */
|
||||
#undef HAVE_SCHED_YIELD
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define if you have the sleep function. */
|
||||
#undef HAVE_SLEEP
|
||||
|
||||
/* Define if you have the stat function. */
|
||||
#undef HAVE_STAT
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define if you have the time function. */
|
||||
#undef HAVE_TIME
|
||||
|
||||
/* Define if you have the uname function. */
|
||||
#undef HAVE_UNAME
|
||||
|
||||
/* Define if you have the unlink function. */
|
||||
#undef HAVE_UNLINK
|
||||
|
||||
/* Define if you have the <arpa/inet.h> header file. */
|
||||
#undef HAVE_ARPA_INET_H
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define if you have the <netinet/in.h> header file. */
|
||||
#undef HAVE_NETINET_IN_H
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define if you have the <sys/filio.h> header file. */
|
||||
#undef HAVE_SYS_FILIO_H
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// java-array.h - Header file for CNI arrays. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JAVA_ARRAY_H__
|
||||
#define __JAVA_ARRAY_H__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
|
||||
extern "Java" {
|
||||
|
||||
class __JArray : public java::lang::Object
|
||||
{
|
||||
public:
|
||||
int length;
|
||||
friend jsize JvGetArrayLength (__JArray*);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class JArray : public __JArray
|
||||
{
|
||||
T data[0];
|
||||
public:
|
||||
friend T* elements<>(JArray<T>& x);
|
||||
friend T* elements<>(JArray<T>* x);
|
||||
// T* getData() { return data; }
|
||||
// T& operator[](jint i) { return data[i]; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
T* elements(JArray<T>& x) { return x.data; }
|
||||
template<class T>
|
||||
T* elements(JArray<T>* x) { return x->data; }
|
||||
|
||||
}; // end extern "Java"
|
||||
|
||||
/* These typesdefs match those in JNI. */
|
||||
typedef __JArray *jarray;
|
||||
typedef JArray<jobject> *jobjectArray;
|
||||
typedef JArray<jboolean> *jbooleanArray;
|
||||
typedef JArray<jbyte> *jbyteArray;
|
||||
typedef JArray<jchar> *jcharArray;
|
||||
typedef JArray<jshort> *jshortArray;
|
||||
typedef JArray<jint> *jintArray;
|
||||
typedef JArray<jlong> *jlongArray;
|
||||
typedef JArray<jfloat> *jfloatArray;
|
||||
typedef JArray<jdouble> *jdoubleArray;
|
||||
typedef JArray<jstring> *jstringArray;
|
||||
// Temporary work-around for gcjh bug. FIXME
|
||||
typedef JArray<jcharArray> *jobjectArrayjchar;
|
||||
|
||||
extern "C" jbooleanArray JvNewBooleanArray (jint length);
|
||||
extern "C" jbyteArray JvNewByteArray (jint length);
|
||||
extern "C" jcharArray JvNewCharArray (jint length);
|
||||
extern "C" jshortArray JvNewShortArray (jint length);
|
||||
extern "C" jintArray JvNewIntArray (jint length);
|
||||
extern "C" jlongArray JvNewLongArray (jint length);
|
||||
extern "C" jfloatArray JvNewFloatArray (jint length);
|
||||
extern "C" jdoubleArray JvNewDoubleArray (jint length);
|
||||
extern "C" jobjectArray _Jv_NewObjectArray(jsize length, jclass, jobject init);
|
||||
|
||||
inline jobjectArray JvNewObjectArray (jsize length, jclass cls, jobject init)
|
||||
{ return _Jv_NewObjectArray (length, cls, init); }
|
||||
|
||||
extern "C" jstringArray JvConvertArgv(int argc, const char **argv);
|
||||
extern "C" void JvRunMain (jclass klass, int argc, const char **argv);
|
||||
|
||||
inline jsize JvGetArrayLength (jarray array) { return array->length; }
|
||||
|
||||
#endif /* __JAVA_ARRAY_H__ */
|
||||
@@ -0,0 +1,38 @@
|
||||
// java-assert.h - Header file holding assertion definitions. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JAVA_ASSERT_H__
|
||||
#define __JAVA_ASSERT_H__
|
||||
|
||||
// This is a libgcj implementation header.
|
||||
|
||||
void _Jv_Abort (const char *, const char *, int, const char *)
|
||||
__attribute__ ((__noreturn__));
|
||||
|
||||
#ifdef DEBUG
|
||||
#define _Jv_AssertDoCall(Message) _Jv_Abort (__FUNCTION__, __FILE__, __LINE__, Message)
|
||||
|
||||
#define JvAssertMessage(Expr, Message) \
|
||||
do { if (! (Expr)) _Jv_AssertDoCall (Message); } while (0)
|
||||
#define JvAssert(Expr) \
|
||||
do { if (! (Expr)) _Jv_AssertDoCall (# Expr); } while (0)
|
||||
|
||||
#define JvFail(Message) _Jv_AssertDoCall (Message)
|
||||
|
||||
#else /* DEBUG */
|
||||
|
||||
#define _Jv_AssertDoCall(Message)
|
||||
#define JvAssertMessage(Expr, Message)
|
||||
#define JvAssert(Expr)
|
||||
#define JvFail(Message) _Jv_Abort (0, 0, 0, Message)
|
||||
|
||||
#endif /* not DEBUG */
|
||||
|
||||
#endif /* __JAVA_ASSERT_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,158 @@
|
||||
// java-field.h - Header file for fieldID instances. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JAVA_FIELD_H__
|
||||
#define __JAVA_FIELD_H__
|
||||
|
||||
#include <java/lang/Class.h>
|
||||
#include <java/lang/reflect/Field.h>
|
||||
|
||||
#define _Jv_FIELD_UNRESOLVED_FLAG 0x8000
|
||||
#define _Jv_FIELD_CONSTANT_VALUE 0x4000
|
||||
|
||||
struct _Jv_Field
|
||||
{
|
||||
#ifndef COMPACT_FIELDS
|
||||
struct _Jv_Utf8Const* name;
|
||||
#endif
|
||||
|
||||
/* The type of the field, if isResolved().
|
||||
If !isResolved(): The fields's signature as a (Utf8Const*). */
|
||||
jclass type;
|
||||
|
||||
_Jv_ushort flags;
|
||||
|
||||
#ifdef COMPACT_FIELDS
|
||||
short nameIndex; /* ofsfet in class's name table */
|
||||
#else
|
||||
_Jv_ushort bsize; /* not really needed ... */
|
||||
#endif
|
||||
|
||||
union {
|
||||
int boffset; /* offset in bytes for instance field */
|
||||
void* addr; /* address of static field */
|
||||
} u;
|
||||
|
||||
#ifdef __cplusplus
|
||||
jboolean isResolved ()
|
||||
{ return ! (flags & _Jv_FIELD_UNRESOLVED_FLAG); }
|
||||
|
||||
public:
|
||||
|
||||
int getOffset () { return u.boffset; }
|
||||
|
||||
jobject getObjectField (jobject obj)
|
||||
{ return *(jobject *)((char *)obj + getOffset ()); }
|
||||
|
||||
jfieldID getNextInstanceField () { return this + 1; }
|
||||
|
||||
jboolean isRef () { return ! isResolved () || ! type->isPrimitive (); }
|
||||
|
||||
// FIXME - may need to mask off internal flags.
|
||||
int getModifiers() { return flags; }
|
||||
|
||||
#ifdef COMPACT_FIELDS
|
||||
_Jv_Utf8Const * getNameUtf8Const (jclass cls)
|
||||
{ return clas->fieldNames + nameIndex; }
|
||||
#else
|
||||
_Jv_Utf8Const * getNameUtf8Const (jclass) { return name; }
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
inline jbyte
|
||||
_Jv_GetStaticByteField (jclass, _Jv_Field* field)
|
||||
{
|
||||
return * (jbyte *) field->u.addr;
|
||||
}
|
||||
|
||||
inline jshort
|
||||
_Jv_GetStaticShortField (jclass, _Jv_Field* field)
|
||||
{
|
||||
return * (jshort *) field->u.addr;
|
||||
}
|
||||
|
||||
inline jint
|
||||
_Jv_GetStaticIntField (jclass, _Jv_Field* field)
|
||||
{
|
||||
return * (jint *) field->u.addr;
|
||||
}
|
||||
|
||||
inline jlong
|
||||
_Jv_GetStaticLongField (jclass, _Jv_Field* field)
|
||||
{
|
||||
return * (jlong *) field->u.addr;
|
||||
}
|
||||
|
||||
inline jobject
|
||||
_Jv_GetObjectField (jobject obj, _Jv_Field* field)
|
||||
{
|
||||
return field->getObjectField (obj);
|
||||
}
|
||||
|
||||
inline jbyte
|
||||
_Jv_GetByteField (jobject obj, _Jv_Field* field)
|
||||
{
|
||||
return * (jbyte *) ((char*) obj + field->getOffset ());
|
||||
}
|
||||
|
||||
inline jshort
|
||||
_Jv_GetShortField (jobject obj, _Jv_Field* field)
|
||||
{
|
||||
return * (jshort *) ((char*) obj + field->getOffset ());
|
||||
}
|
||||
inline jint
|
||||
_Jv_GetIntField (jobject obj, _Jv_Field* field)
|
||||
{
|
||||
return * (jint *) ((char*) obj + field->getOffset ());
|
||||
}
|
||||
inline jlong
|
||||
_Jv_GetLongField (jobject obj, _Jv_Field* field)
|
||||
{
|
||||
return * (jlong *) ((char*) obj + field->getOffset ());
|
||||
}
|
||||
|
||||
extern inline jfieldID
|
||||
_Jv_FromReflectedField (java::lang::reflect::Field *field)
|
||||
{
|
||||
return (jfieldID) ((char *) field->declaringClass->fields + field->offset);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __JAVA_CNI_H__
|
||||
extern inline jfieldID
|
||||
JvGetFirstInstanceField (jclass klass)
|
||||
{
|
||||
return &(klass->fields[klass->static_field_count]);
|
||||
}
|
||||
|
||||
extern inline jint
|
||||
JvNumInstanceFields (jclass klass)
|
||||
{
|
||||
return klass->field_count - klass->static_field_count;
|
||||
}
|
||||
|
||||
extern inline jboolean
|
||||
JvFieldIsRef (jfieldID field)
|
||||
{
|
||||
return field->isRef ();
|
||||
}
|
||||
|
||||
extern inline jobject
|
||||
JvGetObjectField (jobject obj, _Jv_Field* field)
|
||||
{
|
||||
return _Jv_GetObjectField (obj, field);
|
||||
}
|
||||
#endif /* defined (__JAVA_CNI_H__) */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __JAVA_FIELD_H */
|
||||
@@ -0,0 +1,16 @@
|
||||
// java-method.h - Header file for methodID instances. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
extern inline jmethodID
|
||||
_Jv_FromReflectedMethod(java::lang::reflect::Method *method)
|
||||
{
|
||||
return (jmethodID)
|
||||
((char *) method->declaringClass->methods + method->offset);
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
// javaprims.h - Main external header file for libgcj. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JAVAPRIMS_H__
|
||||
#define __JAVAPRIMS_H__
|
||||
|
||||
// To force selection of correct types that will mangle consistently
|
||||
// across platforms.
|
||||
extern "Java"
|
||||
{
|
||||
typedef __java_byte jbyte;
|
||||
typedef __java_short jshort;
|
||||
typedef __java_int jint;
|
||||
typedef __java_long jlong;
|
||||
typedef __java_float jfloat;
|
||||
typedef __java_double jdouble;
|
||||
typedef __java_char jchar;
|
||||
typedef __java_boolean jboolean;
|
||||
typedef jint jsize;
|
||||
|
||||
// The following class declarations are automatically generated by
|
||||
// the `classes.pl' script.
|
||||
namespace java
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
class BufferedInputStream;
|
||||
class BufferedOutputStream;
|
||||
class BufferedReader;
|
||||
class BufferedWriter;
|
||||
class ByteArrayInputStream;
|
||||
class ByteArrayOutputStream;
|
||||
class CharArrayReader;
|
||||
class CharArrayWriter;
|
||||
class CharConversionException;
|
||||
class DataInput;
|
||||
class DataInputStream;
|
||||
class DataOutput;
|
||||
class DataOutputStream;
|
||||
class EOFException;
|
||||
class File;
|
||||
class FileDescriptor;
|
||||
class FileInputStream;
|
||||
class FileNotFoundException;
|
||||
class FileOutputStream;
|
||||
class FileReader;
|
||||
class FileWriter;
|
||||
class FilenameFilter;
|
||||
class FilterInputStream;
|
||||
class FilterOutputStream;
|
||||
class FilterReader;
|
||||
class FilterWriter;
|
||||
class IOException;
|
||||
class InputStream;
|
||||
class InputStreamReader;
|
||||
class InterruptedIOException;
|
||||
class LineNumberInputStream;
|
||||
class LineNumberReader;
|
||||
class OutputStream;
|
||||
class OutputStreamWriter;
|
||||
class PipedInputStream;
|
||||
class PipedOutputStream;
|
||||
class PipedReader;
|
||||
class PipedWriter;
|
||||
class PrintStream;
|
||||
class PrintWriter;
|
||||
class PushbackInputStream;
|
||||
class PushbackReader;
|
||||
class RandomAccessFile;
|
||||
class Reader;
|
||||
class SequenceInputStream;
|
||||
class Serializable;
|
||||
class StreamTokenizer;
|
||||
class StringBufferInputStream;
|
||||
class StringReader;
|
||||
class StringWriter;
|
||||
class SyncFailedException;
|
||||
class UTFDataFormatException;
|
||||
class UnsupportedEncodingException;
|
||||
class Writer;
|
||||
};
|
||||
|
||||
namespace lang
|
||||
{
|
||||
class AbstractMethodError;
|
||||
class ArithmeticException;
|
||||
class ArrayIndexOutOfBoundsException;
|
||||
class ArrayStoreException;
|
||||
class Boolean;
|
||||
class Byte;
|
||||
class Character;
|
||||
class Class;
|
||||
class ClassCastException;
|
||||
class ClassCircularityError;
|
||||
class ClassFormatError;
|
||||
class ClassLoader;
|
||||
class ClassNotFoundException;
|
||||
class CloneNotSupportedException;
|
||||
class Cloneable;
|
||||
class Comparable;
|
||||
class Compiler;
|
||||
class Double;
|
||||
class Error;
|
||||
class Exception;
|
||||
class ExceptionInInitializerError;
|
||||
class FirstThread;
|
||||
class Float;
|
||||
class IllegalAccessError;
|
||||
class IllegalAccessException;
|
||||
class IllegalArgumentException;
|
||||
class IllegalMonitorStateException;
|
||||
class IllegalStateException;
|
||||
class IllegalThreadStateException;
|
||||
class IncompatibleClassChangeError;
|
||||
class IndexOutOfBoundsException;
|
||||
class InstantiationError;
|
||||
class InstantiationException;
|
||||
class Integer;
|
||||
class InternalError;
|
||||
class InterruptedException;
|
||||
class LinkageError;
|
||||
class Long;
|
||||
class Math;
|
||||
class NegativeArraySizeException;
|
||||
class NoClassDefFoundError;
|
||||
class NoSuchFieldError;
|
||||
class NoSuchFieldException;
|
||||
class NoSuchMethodError;
|
||||
class NoSuchMethodException;
|
||||
class NullPointerException;
|
||||
class Number;
|
||||
class NumberFormatException;
|
||||
class Object;
|
||||
class OutOfMemoryError;
|
||||
class Process;
|
||||
class Runnable;
|
||||
class Runtime;
|
||||
class RuntimeException;
|
||||
class SecurityException;
|
||||
class SecurityManager;
|
||||
class Short;
|
||||
class StackOverflowError;
|
||||
class String;
|
||||
class StringBuffer;
|
||||
class StringIndexOutOfBoundsException;
|
||||
class System;
|
||||
class Thread;
|
||||
class ThreadDeath;
|
||||
class ThreadGroup;
|
||||
class Throwable;
|
||||
class UnknownError;
|
||||
class UnsatisfiedLinkError;
|
||||
class UnsupportedOperationException;
|
||||
class VerifyError;
|
||||
class VirtualMachineError;
|
||||
class Void;
|
||||
|
||||
namespace reflect
|
||||
{
|
||||
class AccessibleObject;
|
||||
class Array;
|
||||
class Constructor;
|
||||
class Field;
|
||||
class InvocationTargetException;
|
||||
class Member;
|
||||
class Method;
|
||||
class Modifier;
|
||||
};
|
||||
};
|
||||
|
||||
namespace util
|
||||
{
|
||||
class BitSet;
|
||||
class Calendar;
|
||||
class ConcurrentModificationException;
|
||||
class Date;
|
||||
class Dictionary;
|
||||
class EmptyStackException;
|
||||
class Enumeration;
|
||||
class EventListener;
|
||||
class EventObject;
|
||||
class GregorianCalendar;
|
||||
class Hashtable;
|
||||
class HashtableEntry;
|
||||
class HashtableEnumeration;
|
||||
class ListResourceBundle;
|
||||
class Locale;
|
||||
class MissingResourceException;
|
||||
class NoSuchElementException;
|
||||
class Observable;
|
||||
class Observer;
|
||||
class Properties;
|
||||
class Random;
|
||||
class ResourceBundle;
|
||||
class SimpleTimeZone;
|
||||
class Stack;
|
||||
class StringTokenizer;
|
||||
class TimeZone;
|
||||
class TooManyListenersException;
|
||||
class Vector;
|
||||
class VectorEnumeration;
|
||||
|
||||
namespace zip
|
||||
{
|
||||
class Adler32;
|
||||
class CRC32;
|
||||
class Checksum;
|
||||
class Deflater;
|
||||
class DeflaterOutputStream;
|
||||
class ZipConstants;
|
||||
class ZipEntry;
|
||||
class ZipEnumeration;
|
||||
class ZipException;
|
||||
class ZipFile;
|
||||
class ZipOutputStream;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct java::lang::Object* jobject;
|
||||
typedef class java::lang::Class* jclass;
|
||||
typedef class java::lang::Throwable* jthrowable;
|
||||
typedef class java::lang::String* jstring;
|
||||
struct _Jv_JNIEnv;
|
||||
|
||||
typedef struct _Jv_Field *jfieldID;
|
||||
typedef struct _Jv_Method *jmethodID;
|
||||
|
||||
extern "C" jobject _Jv_AllocObject (jclass, jint);
|
||||
extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
|
||||
extern "C" jstring _Jv_AllocString(jsize);
|
||||
extern "C" jstring _Jv_NewString (const jchar*, jsize);
|
||||
extern "C" jchar* _Jv_GetStringChars (jstring str);
|
||||
extern "C" jint _Jv_MonitorEnter (jobject);
|
||||
extern "C" jint _Jv_MonitorExit (jobject);
|
||||
extern "C" jstring _Jv_NewStringLatin1(const char*, jsize);
|
||||
extern "C" jsize _Jv_GetStringUTFLength (jstring);
|
||||
extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
|
||||
|
||||
extern "C" void _Jv_Throw (void *) __attribute__ ((__noreturn__));
|
||||
extern "C" void* _Jv_Malloc (jsize);
|
||||
extern "C" void _Jv_Free (void*);
|
||||
|
||||
typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
|
||||
typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
|
||||
|
||||
struct _Jv_Utf8Const
|
||||
{
|
||||
_Jv_ushort hash;
|
||||
_Jv_ushort length; /* In bytes, of data portion, without final '\0'. */
|
||||
char data[1]; /* In Utf8 format, with final '\0'. */
|
||||
};
|
||||
|
||||
#endif /* __JAVAPRIMS_H__ */
|
||||
@@ -0,0 +1,302 @@
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JAVA_JNI_H__
|
||||
#define __JAVA_JNI_H__
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define __need___va_list
|
||||
# include <stdarg.h>
|
||||
# define _Jv_va_list __gnuc_va_list
|
||||
#else
|
||||
# include <stdarg.h>
|
||||
# define _Jv_va_list va_list
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// This is wrong, because it pollutes the name-space too much!
|
||||
#include <javaprims.h>
|
||||
|
||||
typedef struct _Jv_JNIEnv JNIEnv;
|
||||
#else
|
||||
|
||||
typedef int jbyte __attribute__((__mode__(__QI__)));
|
||||
typedef int jshort __attribute__((__mode__(__HI__)));
|
||||
typedef int jint __attribute__((__mode__(__SI__)));
|
||||
typedef int jlong __attribute__((__mode__(__DI__)));
|
||||
typedef bool jboolean __attribute__((__mode__(__QI__)));
|
||||
typedef unsigned short jchar __attribute__((__mode__(__HI__)));
|
||||
typedef float jfloat;
|
||||
typedef double jdouble;
|
||||
typedef jint jsize;
|
||||
|
||||
typedef const struct JNINativeInterface *JNIEnv;
|
||||
#endif
|
||||
|
||||
typedef union jvalue
|
||||
{
|
||||
jboolean z;
|
||||
jbyte b;
|
||||
jchar c;
|
||||
jshort s;
|
||||
jint i;
|
||||
jlong j;
|
||||
jfloat f;
|
||||
jdouble d;
|
||||
jobject l;
|
||||
} jvalue;
|
||||
|
||||
typedef void * (*_Jv_func)(...);
|
||||
|
||||
struct JNINativeInterface
|
||||
{
|
||||
_Jv_func reserved0;
|
||||
_Jv_func reserved1;
|
||||
_Jv_func reserved2;
|
||||
_Jv_func reserved3;
|
||||
_Jv_func GetVersion;
|
||||
_Jv_func DefineClass;
|
||||
_Jv_func FindClass;
|
||||
_Jv_func reserved4;
|
||||
_Jv_func reserved5;
|
||||
_Jv_func reserved6;
|
||||
jclass (*GetSuperclass) (JNIEnv*, jclass);
|
||||
jboolean (*IsAssignableFrom) (JNIEnv*, jclass, jclass);
|
||||
_Jv_func reserved7;
|
||||
jint (*Throw) (JNIEnv*, jthrowable);
|
||||
_Jv_func ThrowNew;
|
||||
_Jv_func ExceptionOccurred;
|
||||
_Jv_func ExceptionDescribe;
|
||||
_Jv_func ExceptionClear;
|
||||
_Jv_func FatalError;
|
||||
_Jv_func reserved8;
|
||||
_Jv_func reserved9;
|
||||
_Jv_func NewGlobalRef;
|
||||
_Jv_func DeleteGlobalRef;
|
||||
_Jv_func DeleteLocalRef;
|
||||
_Jv_func IsSameObject;
|
||||
_Jv_func reserved10;
|
||||
_Jv_func reserved11;
|
||||
_Jv_func AllocObject;
|
||||
_Jv_func NewObject;
|
||||
_Jv_func NewObjectV;
|
||||
_Jv_func NewObjectA;
|
||||
_Jv_func GetObjectClass;
|
||||
_Jv_func IsInstanceOf;
|
||||
_Jv_func GetMethodID;
|
||||
_Jv_func CallObjectMethod;
|
||||
_Jv_func CallObjectMethodV;
|
||||
_Jv_func CallObjectMethodA;
|
||||
_Jv_func CallBooleanMethod;
|
||||
_Jv_func CallBooleanMethodV;
|
||||
_Jv_func CallBooleanMethodA;
|
||||
_Jv_func CallByteMethod;
|
||||
_Jv_func CallByteMethodV;
|
||||
_Jv_func CallByteMethodA;
|
||||
_Jv_func CallCharMethod;
|
||||
_Jv_func CallCharMethodV;
|
||||
_Jv_func CallCharMethodA;
|
||||
_Jv_func CallShortMethod;
|
||||
_Jv_func CallShortMethodV;
|
||||
_Jv_func CallShortMethodA;
|
||||
_Jv_func CallIntMethod;
|
||||
_Jv_func CallIntMethodV;
|
||||
_Jv_func CallIntMethodA;
|
||||
_Jv_func CallLongMethod;
|
||||
_Jv_func CallLongMethodV;
|
||||
_Jv_func CallLongMethodA;
|
||||
_Jv_func CallFloatMethod;
|
||||
_Jv_func CallFloatMethodV;
|
||||
_Jv_func CallFloatMethodA;
|
||||
_Jv_func CallDoubleMethod;
|
||||
_Jv_func CallDoubleMethodV;
|
||||
_Jv_func CallDoubleMethodA;
|
||||
_Jv_func CallVoidMethod;
|
||||
_Jv_func CallVoidMethodV;
|
||||
_Jv_func CallVoidMethodA;
|
||||
_Jv_func CallNonvirtualObjectMethod;
|
||||
_Jv_func CallNonvirtualObjectMethodV;
|
||||
_Jv_func CallNonvirtualObjectMethodA;
|
||||
jboolean (*CallNonvirtualBooleanMethod) (JNIEnv*, jobject, jclass, jmethodID, ...);
|
||||
jboolean (*CallNonvirtualBooleanMethodV) (JNIEnv*, jobject, jclass, jmethodID, _Jv_va_list);
|
||||
jboolean (*CallNonvirtualBooleanMethodA) (JNIEnv*, jobject, jclass, jmethodID, jvalue*);
|
||||
_Jv_func CallNonvirtualByteMethod;
|
||||
_Jv_func CallNonvirtualByteMethodV;
|
||||
_Jv_func CallNonvirtualByteMethodA;
|
||||
_Jv_func CallNonvirtualCharMethod;
|
||||
_Jv_func CallNonvirtualCharMethodV;
|
||||
_Jv_func CallNonvirtualCharMethodA;
|
||||
_Jv_func CallNonvirtualShortMethod;
|
||||
_Jv_func CallNonvirtualShortMethodV;
|
||||
_Jv_func CallNonvirtualShortMethodA;
|
||||
_Jv_func CallNonvirtualIntMethod;
|
||||
_Jv_func CallNonvirtualIntMethodV;
|
||||
_Jv_func CallNonvirtualIntMethodA;
|
||||
_Jv_func CallNonvirtualLongMethod;
|
||||
_Jv_func CallNonvirtualLongMethodV;
|
||||
_Jv_func CallNonvirtualLongMethodA;
|
||||
_Jv_func CallNonvirtualFloatMethod;
|
||||
_Jv_func CallNonvirtualFloatMethodV;
|
||||
_Jv_func CallNonvirtualFloatMethodA;
|
||||
_Jv_func CallNonvirtualDoubleMethod;
|
||||
jdouble (*CallNonvirtualDoubleMethodV) (JNIEnv*, jobject, jclass, jmethodID, _Jv_va_list);
|
||||
_Jv_func CallNonvirtualDoubleMethodA;
|
||||
_Jv_func CallNonvirtualVoidMethod;
|
||||
_Jv_func CallNonvirtualVoidMethodV;
|
||||
_Jv_func CallNonvirtualVoidMethodA;
|
||||
_Jv_func GetFieldID;
|
||||
jobject (*GetObjectField) (JNIEnv*, jobject, jfieldID);
|
||||
jboolean (*GetBooleanField) (JNIEnv*, jobject, jfieldID);
|
||||
jbyte (*GetByteField) (JNIEnv*, jobject, jfieldID);
|
||||
jchar (*GetCharField) (JNIEnv*, jobject, jfieldID);
|
||||
jshort (*GetShortField) (JNIEnv*, jobject, jfieldID);
|
||||
jint (*GetIntField) (JNIEnv*, jobject, jfieldID);
|
||||
jlong (*GetLongField) (JNIEnv*, jobject, jfieldID);
|
||||
jfloat (*GetFloatField) (JNIEnv*, jobject, jfieldID);
|
||||
jdouble (*GetDoubleField) (JNIEnv*, jobject, jfieldID);
|
||||
_Jv_func SetObjectField;
|
||||
_Jv_func SetBooleanField;
|
||||
_Jv_func SetByteField;
|
||||
_Jv_func SetCharField;
|
||||
_Jv_func SetShortField;
|
||||
_Jv_func SetIntField;
|
||||
_Jv_func SetLongField;
|
||||
_Jv_func SetFloatField;
|
||||
_Jv_func SetDoubleField;
|
||||
_Jv_func GetStaticMethodID;
|
||||
_Jv_func CallStaticObjectMethod;
|
||||
_Jv_func CallStaticObjectMethodV;
|
||||
_Jv_func CallStaticObjectMethodA;
|
||||
_Jv_func CallStaticBooleanMethod;
|
||||
_Jv_func CallStaticBooleanMethodV;
|
||||
_Jv_func CallStaticBooleanMethodA;
|
||||
_Jv_func CallStaticByteMethod;
|
||||
_Jv_func CallStaticByteMethodV;
|
||||
_Jv_func CallStaticByteMethodA;
|
||||
_Jv_func CallStaticCharMethod;
|
||||
_Jv_func CallStaticCharMethodV;
|
||||
_Jv_func CallStaticCharMethodA;
|
||||
_Jv_func CallStaticShortMethod;
|
||||
_Jv_func CallStaticShortMethodV;
|
||||
_Jv_func CallStaticShortMethodA;
|
||||
_Jv_func CallStaticIntMethod;
|
||||
_Jv_func CallStaticIntMethodV;
|
||||
_Jv_func CallStaticIntMethodA;
|
||||
_Jv_func CallStaticLongMethod;
|
||||
_Jv_func CallStaticLongMethodV;
|
||||
_Jv_func CallStaticLongMethodA;
|
||||
_Jv_func CallStaticFloatMethod;
|
||||
_Jv_func CallStaticFloatMethodV;
|
||||
_Jv_func CallStaticFloatMethodA;
|
||||
_Jv_func CallStaticDoubleMethod;
|
||||
_Jv_func CallStaticDoubleMethodV;
|
||||
_Jv_func CallStaticDoubleMethodA;
|
||||
_Jv_func CallStaticVoidMethod;
|
||||
_Jv_func CallStaticVoidMethodV;
|
||||
_Jv_func CallStaticVoidMethodA;
|
||||
_Jv_func GetStaticFieldID;
|
||||
_Jv_func GetStaticObjectField;
|
||||
_Jv_func GetStaticBooleanField;
|
||||
_Jv_func GetStaticByteField;
|
||||
_Jv_func GetStaticCharField;
|
||||
_Jv_func GetStaticShortField;
|
||||
_Jv_func GetStaticIntField;
|
||||
_Jv_func GetStaticLongField;
|
||||
_Jv_func GetStaticFloatField;
|
||||
_Jv_func GetStaticDoubleField;
|
||||
_Jv_func SetStaticObjectField;
|
||||
_Jv_func SetStaticBooleanField;
|
||||
_Jv_func SetStaticByteField;
|
||||
_Jv_func SetStaticCharField;
|
||||
_Jv_func SetStaticShortField;
|
||||
_Jv_func SetStaticIntField;
|
||||
_Jv_func SetStaticLongField;
|
||||
_Jv_func SetStaticFloatField;
|
||||
_Jv_func SetStaticDoubleField;
|
||||
_Jv_func NewString;
|
||||
jint (*GetStringLength) (JNIEnv*, jstring);
|
||||
_Jv_func GetStringChars;
|
||||
_Jv_func ReleaseStringChars;
|
||||
_Jv_func NewStringUTF;
|
||||
_Jv_func GetStringUTFLength;
|
||||
_Jv_func GetStringUTFChars;
|
||||
_Jv_func ReleaseStringUTFChars;
|
||||
_Jv_func GetArrayLength;
|
||||
_Jv_func NewObjectArray;
|
||||
_Jv_func GetObjectArrayElement;
|
||||
_Jv_func SetObjectArrayElement;
|
||||
_Jv_func NewBooleanArray;
|
||||
_Jv_func NewByteArray;
|
||||
_Jv_func NewCharArray;
|
||||
_Jv_func NewShortArray;
|
||||
_Jv_func NewIntArray;
|
||||
_Jv_func NewLongArray;
|
||||
_Jv_func NewFloatArray;
|
||||
_Jv_func NewDoubleArray;
|
||||
_Jv_func GetBooleanArrayElements;
|
||||
_Jv_func GetByteArrayElements;
|
||||
_Jv_func GetCharArrayElements;
|
||||
_Jv_func GetShortArrayElements;
|
||||
_Jv_func GetIntArrayElements;
|
||||
_Jv_func GetLongArrayElements;
|
||||
_Jv_func GetFloatArrayElements;
|
||||
_Jv_func GetDoubleArrayElements;
|
||||
_Jv_func ReleaseBooleanArrayElements;
|
||||
_Jv_func ReleaseByteArrayElements;
|
||||
_Jv_func ReleaseCharArrayElements;
|
||||
_Jv_func ReleaseShortArrayElements;
|
||||
_Jv_func ReleaseIntArrayElements;
|
||||
_Jv_func ReleaseLongArrayElements;
|
||||
_Jv_func ReleaseFloatArrayElements;
|
||||
_Jv_func ReleaseDoubleArrayElements;
|
||||
_Jv_func GetBooleanArrayRegion;
|
||||
_Jv_func GetByteArrayRegion;
|
||||
_Jv_func GetCharArrayRegion;
|
||||
_Jv_func GetShortArrayRegion;
|
||||
_Jv_func GetIntArrayRegion;
|
||||
_Jv_func GetLongArrayRegion;
|
||||
_Jv_func GetFloatArrayRegion;
|
||||
_Jv_func GetDoubleArrayRegion;
|
||||
_Jv_func SetBooleanArrayRegion;
|
||||
_Jv_func SetByteArrayRegion;
|
||||
_Jv_func SetCharArrayRegion;
|
||||
_Jv_func SetShortArrayRegion;
|
||||
_Jv_func SetIntArrayRegion;
|
||||
_Jv_func SetLongArrayRegion;
|
||||
_Jv_func SetFloatArrayRegion;
|
||||
_Jv_func SetDoubleArrayRegion;
|
||||
_Jv_func RegisterNatives;
|
||||
_Jv_func UnregisterNatives;
|
||||
_Jv_func MonitorEnter;
|
||||
_Jv_func MonitorExit;
|
||||
_Jv_func GetJavaVM;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
struct _Jv_JNIEnv
|
||||
{
|
||||
struct JNINativeInterface *p;
|
||||
|
||||
jclass GetSuperclass (jclass cl);
|
||||
jsize GetStringLength (jstring str);
|
||||
|
||||
};
|
||||
|
||||
extern inline jclass
|
||||
_Jv_JNIEnv::GetSuperclass (jclass cl)
|
||||
{ return p->GetSuperclass (this, cl); }
|
||||
|
||||
extern inline jsize
|
||||
_Jv_JNIEnv::GetStringLength (jstring str)
|
||||
{ return p->GetStringLength (this, str); }
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __JAVA_JNI_H__ */
|
||||
@@ -0,0 +1,101 @@
|
||||
// jvm.h - Header file for private implementation information. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JAVA_JVM_H__
|
||||
#define __JAVA_JVM_H__
|
||||
|
||||
#include <java-assert.h>
|
||||
#include <java-field.h>
|
||||
|
||||
/* Structure of the virtual table. */
|
||||
struct _Jv_VTable
|
||||
{
|
||||
jclass clas;
|
||||
void *method[1];
|
||||
};
|
||||
|
||||
/* Extract a character from a Java-style Utf8 string.
|
||||
* PTR points to the current character.
|
||||
* LIMIT points to the end of the Utf8 string.
|
||||
* PTR is incremented to point after the character thta gets returns.
|
||||
* On an error, -1 is returned. */
|
||||
#define UTF8_GET(PTR, LIMIT) \
|
||||
((PTR) >= (LIMIT) ? -1 \
|
||||
: *(PTR) < 128 ? *(PTR)++ \
|
||||
: (*(PTR)&0xE0) == 0xC0 && ((PTR)+=2)<=(LIMIT) && ((PTR)[-1]&0xC0) == 0x80 \
|
||||
? (((PTR)[-2] & 0x1F) << 6) + ((PTR)[-1] & 0x3F) \
|
||||
: (*(PTR) & 0xF0) == 0xE0 && ((PTR) += 3) <= (LIMIT) \
|
||||
&& ((PTR)[-2] & 0xC0) == 0x80 && ((PTR)[-1] & 0xC0) == 0x80 \
|
||||
? (((PTR)[-3]&0x0F) << 12) + (((PTR)[-2]&0x3F) << 6) + ((PTR)[-1]&0x3F) \
|
||||
: ((PTR)++, -1))
|
||||
|
||||
extern int _Jv_strLengthUtf8(char* str, int len);
|
||||
|
||||
typedef struct _Jv_Utf8Const Utf8Const;
|
||||
_Jv_Utf8Const *_Jv_makeUtf8Const (char *s, int len);
|
||||
extern jboolean _Jv_equalUtf8Consts (_Jv_Utf8Const *, _Jv_Utf8Const *);
|
||||
extern jboolean _Jv_equal (_Jv_Utf8Const *, jstring, jint);
|
||||
|
||||
#define StringClass _CL_Q34java4lang6String
|
||||
extern java::lang::Class StringClass;
|
||||
|
||||
/* Type of pointer used as finalizer. */
|
||||
typedef void _Jv_FinalizerFunc (jobject);
|
||||
|
||||
/* Allocate space for a new Java object. */
|
||||
void *_Jv_AllocObj (jsize size);
|
||||
/* Allocate space for an array of Java objects. */
|
||||
void *_Jv_AllocArray (jsize size);
|
||||
/* Allocate space that is known to be pointer-free. */
|
||||
void *_Jv_AllocBytes (jsize size);
|
||||
/* Initialize the GC. */
|
||||
void _Jv_InitGC (void);
|
||||
/* Register a finalizer. */
|
||||
void _Jv_RegisterFinalizer (void *object, _Jv_FinalizerFunc *method);
|
||||
|
||||
/* Run finalizers for objects ready to be finalized.. */
|
||||
void _Jv_RunFinalizers (void);
|
||||
/* Run all finalizers. Should be called only before exit. */
|
||||
void _Jv_RunAllFinalizers (void);
|
||||
/* Perform a GC. */
|
||||
void _Jv_RunGC (void);
|
||||
|
||||
/* Return approximation of total size of heap. */
|
||||
long _Jv_GCTotalMemory (void);
|
||||
/* Return approximation of total free memory. */
|
||||
long _Jv_GCFreeMemory (void);
|
||||
|
||||
/* Allocate some unscanned bytes. Throw exception if out of memory. */
|
||||
void *_Jv_AllocBytesChecked (jsize size);
|
||||
|
||||
// This function is used to determine the hash code of an object.
|
||||
inline jint
|
||||
_Jv_HashCode (jobject obj)
|
||||
{
|
||||
return (jint) obj;
|
||||
}
|
||||
|
||||
extern "C" void _Jv_ThrowBadArrayIndex (jint bad_index);
|
||||
extern "C" jobject _Jv_NewArray (jint type, jint size);
|
||||
extern "C" jobject _Jv_NewMultiArray (jclass klass, jint dims, ...);
|
||||
extern "C" void *_Jv_CheckCast (jclass klass, jobject obj);
|
||||
extern "C" void *_Jv_LookupInterfaceMethod (jclass klass, Utf8Const *name,
|
||||
Utf8Const *signature);
|
||||
extern "C" void _Jv_CheckArrayStore (jobject array, jobject obj);
|
||||
extern "C" void _Jv_RegisterClass (jclass klass);
|
||||
extern "C" void _Jv_RegisterClasses (jclass *classes);
|
||||
extern jclass _Jv_FindClass (_Jv_Utf8Const *name,
|
||||
java::lang::ClassLoader *loader);
|
||||
extern jclass _Jv_FindClassFromSignature (char *,
|
||||
java::lang::ClassLoader *loader);
|
||||
|
||||
extern jobject _Jv_NewMultiArray (jclass, jint ndims, jint* dims);
|
||||
|
||||
#endif /* __JAVA_JVM_H__ */
|
||||
@@ -0,0 +1,17 @@
|
||||
// -*- c++ -*-
|
||||
// no-gc.h - Defines for no garbage collector.
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JV_NO_GC__
|
||||
#define __JV_NO_GC__
|
||||
|
||||
// Nothing.
|
||||
|
||||
#endif /* __JV_NO_GC__ */
|
||||
@@ -0,0 +1,154 @@
|
||||
// -*- c++ -*-
|
||||
// no-threads.h - Defines for using no threads.
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JV_NO_THREADS__
|
||||
#define __JV_NO_THREADS__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Typedefs.
|
||||
//
|
||||
|
||||
typedef int _Jv_ConditionVariable_t;
|
||||
typedef int _Jv_Mutex_t;
|
||||
typedef int _Jv_Thread_t;
|
||||
typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
|
||||
|
||||
|
||||
//
|
||||
// Condition variables.
|
||||
//
|
||||
|
||||
inline void
|
||||
_Jv_CondInit (_Jv_ConditionVariable_t *)
|
||||
{
|
||||
}
|
||||
|
||||
// Waiting is ok provided there is a timeout. Otherwise we will just
|
||||
// wait forever.
|
||||
inline int
|
||||
_Jv_CondWait (_Jv_ConditionVariable_t *, _Jv_Mutex_t *,
|
||||
jlong millis, jint nanos)
|
||||
{
|
||||
if (millis == 0 && nanos == 0)
|
||||
JvFail ("_Jv_CondWait without timeout");
|
||||
|
||||
#ifdef HAVE_SLEEP
|
||||
int seconds = millis / 1000;
|
||||
if (seconds > 0)
|
||||
sleep (seconds);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_CondNotify (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
|
||||
{
|
||||
// It is ok to notify -- it just has no effect.
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_CondNotifyAll (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
|
||||
{
|
||||
// It is ok to notify -- it just has no effect.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Mutexes.
|
||||
//
|
||||
|
||||
inline void
|
||||
_Jv_MutexInit (_Jv_Mutex_t *)
|
||||
{
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_MutexLock (_Jv_Mutex_t *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_MutexUnlock (_Jv_Mutex_t *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Thread creation and manipulation.
|
||||
//
|
||||
|
||||
inline void
|
||||
_Jv_InitThreads (void)
|
||||
{
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadInitData (_Jv_Thread_t **data, java::lang::Thread *)
|
||||
{
|
||||
*data = NULL;
|
||||
}
|
||||
|
||||
inline java::lang::Thread *
|
||||
_Jv_ThreadCurrent (void)
|
||||
{
|
||||
extern java::lang::Thread *_Jv_OnlyThread;
|
||||
return _Jv_OnlyThread;
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadYield (void)
|
||||
{
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadSetPriority (_Jv_Thread_t *, jint)
|
||||
{
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadCancel (_Jv_Thread_t *, void *)
|
||||
{
|
||||
JvFail ("_Jv_ThreadCancel");
|
||||
}
|
||||
|
||||
// Like Cancel, but doesn't run cleanups.
|
||||
inline void
|
||||
_Jv_ThreadDestroy (_Jv_Thread_t *)
|
||||
{
|
||||
JvFail ("_Jv_ThreadDestroy");
|
||||
}
|
||||
|
||||
void _Jv_ThreadStart (java::lang::Thread *, _Jv_Thread_t *,
|
||||
_Jv_ThreadStartFunc *meth);
|
||||
|
||||
inline void
|
||||
_Jv_ThreadWait (void)
|
||||
{
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadInterrupt (_Jv_Thread_t *)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* __JV_NO_THREADS__ */
|
||||
@@ -0,0 +1,210 @@
|
||||
// -*- c++ -*-
|
||||
// posix-threads.h - Defines for using POSIX threads.
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JV_POSIX_THREADS__
|
||||
#define __JV_POSIX_THREADS__
|
||||
|
||||
// NOTE: This file may only reference those pthread functions which
|
||||
// are known not to be overridden by the Boehm GC. If in doubt, scan
|
||||
// boehm-gc/gc.h. This is yucky but lets us avoid including gc.h
|
||||
// everywhere (which would be truly yucky).
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
||||
#if defined (HAVE_PTHREAD_MUTEXATTR_SETTYPE) || defined (HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
|
||||
# define HAVE_RECURSIVE_MUTEX 1
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Typedefs.
|
||||
//
|
||||
|
||||
typedef pthread_cond_t _Jv_ConditionVariable_t;
|
||||
#ifdef HAVE_RECURSIVE_MUTEX
|
||||
typedef pthread_mutex_t _Jv_Mutex_t;
|
||||
#else
|
||||
// Some systems do not have recursive mutexes, so we must simulate
|
||||
// them. Solaris is one such system.
|
||||
typedef struct
|
||||
{
|
||||
// Mutex used when locking this structure transiently.
|
||||
pthread_mutex_t mutex;
|
||||
// Mutex the thread holds the entire time this mutex is held. This
|
||||
// is used to make condition variables work properly.
|
||||
pthread_mutex_t mutex2;
|
||||
// Condition variable used when waiting for this lock.
|
||||
pthread_cond_t cond;
|
||||
// Thread holding this mutex. If COUNT is 0, no thread is holding.
|
||||
pthread_t thread;
|
||||
// Number of times mutex is held. If 0, the lock is not held.
|
||||
int count;
|
||||
} _Jv_Mutex_t;
|
||||
#endif /* HAVE_RECURSIVE_MUTEX */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// Flag values are defined in implementation.
|
||||
int flags;
|
||||
|
||||
// Actual thread id.
|
||||
pthread_t thread;
|
||||
|
||||
// Exception we want to throw when cancelled.
|
||||
void *exception;
|
||||
} _Jv_Thread_t;
|
||||
typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
|
||||
|
||||
|
||||
//
|
||||
// Condition variables.
|
||||
//
|
||||
|
||||
inline void
|
||||
_Jv_CondInit (_Jv_ConditionVariable_t *cv)
|
||||
{
|
||||
pthread_cond_init (cv, 0);
|
||||
}
|
||||
|
||||
#ifndef LINUX_THREADS
|
||||
|
||||
// pthread_cond_destroy does nothing on Linux and it is a win to avoid
|
||||
// defining this macro.
|
||||
|
||||
#define _Jv_HaveCondDestroy
|
||||
|
||||
inline void
|
||||
_Jv_CondDestroy (_Jv_ConditionVariable_t *cv)
|
||||
{
|
||||
pthread_cond_destroy (cv);
|
||||
}
|
||||
|
||||
#endif /* LINUX_THREADS */
|
||||
|
||||
int _Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu,
|
||||
jlong millis, jint nanos);
|
||||
|
||||
inline int
|
||||
_Jv_CondNotify (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *)
|
||||
{
|
||||
// FIXME: check to see if mutex is held by current thread.
|
||||
return pthread_cond_signal (cv);
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_CondNotifyAll (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *)
|
||||
{
|
||||
// FIXME: check to see if mutex is held by current thread.
|
||||
return pthread_cond_broadcast (cv);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Mutexes.
|
||||
//
|
||||
|
||||
#ifdef RECURSIVE_MUTEX_IS_DEFAULT
|
||||
inline void
|
||||
_Jv_MutexInit (_Jv_Mutex_t *mu)
|
||||
{
|
||||
pthread_mutex_init (mu, NULL);
|
||||
}
|
||||
#else
|
||||
void _Jv_MutexInit (_Jv_Mutex_t *mu);
|
||||
#endif
|
||||
|
||||
#ifndef LINUX_THREADS
|
||||
|
||||
// pthread_mutex_destroy does nothing on Linux and it is a win to avoid
|
||||
// defining this macro.
|
||||
|
||||
#define _Jv_HaveMutexDestroy
|
||||
|
||||
#ifdef HAVE_RECURSIVE_MUTEX
|
||||
|
||||
inline void
|
||||
_Jv_MutexDestroy (_Jv_Mutex_t *mu)
|
||||
{
|
||||
pthread_mutex_destroy (mu);
|
||||
}
|
||||
|
||||
#else /* HAVE_RECURSIVE_MUTEX */
|
||||
|
||||
extern void _Jv_MutexDestroy (_Jv_Mutex_t *mu);
|
||||
|
||||
#endif /* HAVE_RECURSIVE_MUTEX */
|
||||
#endif /* LINUX_THREADS */
|
||||
|
||||
#ifdef HAVE_RECURSIVE_MUTEX
|
||||
|
||||
inline int
|
||||
_Jv_MutexLock (_Jv_Mutex_t *mu)
|
||||
{
|
||||
return pthread_mutex_lock (mu);
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_MutexUnlock (_Jv_Mutex_t *mu)
|
||||
{
|
||||
return pthread_mutex_unlock (mu);
|
||||
}
|
||||
|
||||
#else /* HAVE_RECURSIVE_MUTEX */
|
||||
|
||||
extern int _Jv_MutexLock (_Jv_Mutex_t *mu);
|
||||
extern int _Jv_MutexUnlock (_Jv_Mutex_t *mu);
|
||||
|
||||
#endif /* HAVE_RECURSIVE_MUTEX */
|
||||
|
||||
|
||||
//
|
||||
// Thread creation and manipulation.
|
||||
//
|
||||
|
||||
void _Jv_InitThreads (void);
|
||||
|
||||
void _Jv_ThreadInitData (_Jv_Thread_t **data, java::lang::Thread *thread);
|
||||
|
||||
inline java::lang::Thread *
|
||||
_Jv_ThreadCurrent (void)
|
||||
{
|
||||
extern pthread_key_t _Jv_ThreadKey;
|
||||
return (java::lang::Thread *) pthread_getspecific (_Jv_ThreadKey);
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadYield (void)
|
||||
{
|
||||
#ifdef HAVE_SCHED_YIELD
|
||||
sched_yield ();
|
||||
#endif /* HAVE_SCHED_YIELD */
|
||||
}
|
||||
|
||||
void _Jv_ThreadSetPriority (_Jv_Thread_t *data, jint prio);
|
||||
|
||||
void _Jv_ThreadCancel (_Jv_Thread_t *data, void *error);
|
||||
|
||||
// Like Cancel, but doesn't run cleanups.
|
||||
inline void
|
||||
_Jv_ThreadDestroy (_Jv_Thread_t *)
|
||||
{
|
||||
JvFail ("_Jv_ThreadDestroy");
|
||||
}
|
||||
|
||||
void _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data,
|
||||
_Jv_ThreadStartFunc *meth);
|
||||
|
||||
void _Jv_ThreadWait (void);
|
||||
|
||||
void _Jv_ThreadInterrupt (_Jv_Thread_t *data);
|
||||
|
||||
#endif /* __JV_POSIX_THREADS__ */
|
||||
@@ -0,0 +1,139 @@
|
||||
// -*- c++ -*-
|
||||
// quick-threads.h - Defines for using QuickThreads.
|
||||
|
||||
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JV_QUICK_THREADS__
|
||||
#define __JV_QUICK_THREADS__
|
||||
|
||||
#include <coop.h>
|
||||
|
||||
//
|
||||
// Typedefs.
|
||||
//
|
||||
|
||||
typedef coop_c _Jv_ConditionVariable_t;
|
||||
typedef coop_m _Jv_Mutex_t;
|
||||
typedef coop_t *_Jv_Thread_t;
|
||||
typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
|
||||
|
||||
|
||||
//
|
||||
// Condition variables.
|
||||
//
|
||||
|
||||
inline void
|
||||
_Jv_CondInit (_Jv_ConditionVariable_t *cv)
|
||||
{
|
||||
coop_condition_variable_init (cv);
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu,
|
||||
jlong millis, jint nanos)
|
||||
{
|
||||
return coop_condition_variable_wait (cv, mu, millis * 1000 + nanos / 1000);
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_CondNotify (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu)
|
||||
{
|
||||
return coop_condition_variable_signal (cv, mu);
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_CondNotifyAll (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu)
|
||||
{
|
||||
return coop_condition_variable_signal_all (cv, mu);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Mutexes.
|
||||
//
|
||||
|
||||
inline void
|
||||
_Jv_MutexInit (_Jv_Mutex_t *mu)
|
||||
{
|
||||
coop_mutex_init (mu);
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_MutexLock (_Jv_Mutex_t *mu)
|
||||
{
|
||||
coop_mutex_lock (mu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int
|
||||
_Jv_MutexUnlock (_Jv_Mutex_t *mu)
|
||||
{
|
||||
return coop_mutex_unlock (mu);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Thread creation and manipulation.
|
||||
//
|
||||
|
||||
void _Jv_InitThreads (void);
|
||||
|
||||
inline void
|
||||
_Jv_ThreadInitData (_Jv_Thread_t **data, java::lang::Thread *)
|
||||
{
|
||||
*data = new _Jv_Thread_t;
|
||||
**data = (coop_t *) 0;
|
||||
}
|
||||
|
||||
inline java::lang::Thread *
|
||||
_Jv_ThreadCurrent (void)
|
||||
{
|
||||
extern int _Jv_ThreadKey;
|
||||
return (java::lang::Thread *) coop_getspecific (_Jv_ThreadKey);
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadYield (void)
|
||||
{
|
||||
coop_yield ();
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadSetPriority (_Jv_Thread_t *, jint)
|
||||
{
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadCancel (_Jv_Thread_t *data, void *error)
|
||||
{
|
||||
coop_terminate (*data, error);
|
||||
}
|
||||
|
||||
// Like Cancel, but doesn't run cleanups.
|
||||
inline void
|
||||
_Jv_ThreadDestroy (_Jv_Thread_t *data)
|
||||
{
|
||||
coop_terminate (*data, 0);
|
||||
}
|
||||
|
||||
void _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data,
|
||||
_Jv_ThreadStartFunc *meth);
|
||||
|
||||
inline void
|
||||
_Jv_ThreadWait (void)
|
||||
{
|
||||
coop_start ();
|
||||
}
|
||||
|
||||
inline void
|
||||
_Jv_ThreadInterrupt (_Jv_Thread_t *)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* __JV_QUICK_THREADS__ */
|
||||
Reference in New Issue
Block a user