aboutsummaryrefslogtreecommitdiff
path: root/libjava/gcj
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>1999-09-10 22:03:10 +0000
committerTom Tromey <tromey@gcc.gnu.org>1999-09-10 22:03:10 +0000
commit27e934d8bae03ea7eddeb3770641440333a71478 (patch)
tree2d703bb5c0f735c114d35388f4ce82a2a194fe18 /libjava/gcj
parent512d594b4f7945440be373bf14c6af8b88c91749 (diff)
downloadgcc-27e934d8bae03ea7eddeb3770641440333a71478.zip
gcc-27e934d8bae03ea7eddeb3770641440333a71478.tar.gz
gcc-27e934d8bae03ea7eddeb3770641440333a71478.tar.bz2
configure: Rebuilt.
* configure: Rebuilt. * configure.in: Build include/Makefile. * Makefile.in: Rebuilt. * Makefile.am (SUBDIRS): Added gcj and include. (install-data-local): New target. (extra_headers): New macro. * include/Makefile.in: New file. * include/Makefile.am: New file. * interpret.cc: Don't include gcj/field.h or gcj/cni.h. * java/lang/reflect/natField.cc: Don't include gcj/field.h or gcj/cni.h. * boehm.cc: Don't include java-threads.h or gcj/field.h. * resolve.cc: Include config.h. * defineclass.cc: Include config.h. * include/java-interp.h: Don't include config.h. * include/jvm.h: Include java-threads.h, Object.h, java-gc.h, cni.h. * gcj/javaprims.h: Regenerated namespace decls. * classes.pl (scan): Don't put `;' after closing brace. * Makefile.in: Rebuilt. * Makefile.am (INCLUDES): Added -I for top_srcdir. * configure.in: Create gcj/Makefile. * gcj/Makefile.in: New file. * gcj/Makefile.am: New file. * java/lang/Object.h: Don't include any other headers. * gcj/array.h: Renamed from include/java-array.h. * gcj/field.h: Renamed from include/java-field.h. * gcj/method.h: Renamed from include/java-method.h. * gcj/cni.h, gcj/javaprims.h: Moved from include/. Updated all files to reflect new include structure. From-SVN: r29278
Diffstat (limited to 'libjava/gcj')
-rw-r--r--libjava/gcj/Makefile.am6
-rw-r--r--libjava/gcj/Makefile.in269
-rw-r--r--libjava/gcj/array.h77
-rw-r--r--libjava/gcj/cni.h132
-rw-r--r--libjava/gcj/field.h169
-rw-r--r--libjava/gcj/javaprims.h306
-rw-r--r--libjava/gcj/method.h21
7 files changed, 980 insertions, 0 deletions
diff --git a/libjava/gcj/Makefile.am b/libjava/gcj/Makefile.am
new file mode 100644
index 0000000..35fc7ee
--- /dev/null
+++ b/libjava/gcj/Makefile.am
@@ -0,0 +1,6 @@
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = foreign no-installinfo
+
+gcjdir = $(includedir)/gcj
+gcj_HEADERS = array.h cni.h field.h javaprims.h method.h
diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in
new file mode 100644
index 0000000..b74bff6
--- /dev/null
+++ b/libjava/gcj/Makefile.in
@@ -0,0 +1,269 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@
+AR = @AR@
+AS = @AS@
+CC = @CC@
+COMPPATH = @COMPPATH@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DIVIDESPEC = @DIVIDESPEC@
+DLLTOOL = @DLLTOOL@
+EH_COMMON_INCLUDE = @EH_COMMON_INCLUDE@
+EXEEXT = @EXEEXT@
+GCDEPS = @GCDEPS@
+GCINCS = @GCINCS@
+GCLIBS = @GCLIBS@
+GCOBJS = @GCOBJS@
+GCSPEC = @GCSPEC@
+LD = @LD@
+LIBGCJ_CFLAGS = @LIBGCJ_CFLAGS@
+LIBGCJ_CXXFLAGS = @LIBGCJ_CXXFLAGS@
+LIBGCJ_JAVAFLAGS = @LIBGCJ_JAVAFLAGS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+PACKAGE = @PACKAGE@
+PERL = @PERL@
+RANLIB = @RANLIB@
+SYSTEMSPEC = @SYSTEMSPEC@
+THREADDEPS = @THREADDEPS@
+THREADINCS = @THREADINCS@
+THREADLIBS = @THREADLIBS@
+THREADOBJS = @THREADOBJS@
+THREADSPEC = @THREADSPEC@
+USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
+VERSION = @VERSION@
+ZDEPS = @ZDEPS@
+ZINCS = @ZINCS@
+ZLIBS = @ZLIBS@
+ZLIBSPEC = @ZLIBSPEC@
+here = @here@
+libgcj_basedir = @libgcj_basedir@
+
+AUTOMAKE_OPTIONS = foreign no-installinfo
+
+gcjdir = $(includedir)/gcj
+gcj_HEADERS = array.h cni.h field.h javaprims.h method.h
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = ../include/config.h
+CONFIG_CLEAN_FILES =
+HEADERS = $(gcj_HEADERS)
+
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign gcj/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+install-gcjHEADERS: $(gcj_HEADERS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(gcjdir)
+ @list='$(gcj_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(gcjdir)/$$p"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(gcjdir)/$$p; \
+ done
+
+uninstall-gcjHEADERS:
+ @$(NORMAL_UNINSTALL)
+ list='$(gcj_HEADERS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(gcjdir)/$$p; \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = gcj
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign gcj/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-info-am:
+install-info: install-info-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am: install-gcjHEADERS
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-gcjHEADERS
+uninstall: uninstall-am
+all-am: Makefile $(HEADERS)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(gcjdir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-tags clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-tags distclean-generic clean-am
+ -rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: uninstall-gcjHEADERS install-gcjHEADERS tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-info-am \
+install-info install-exec-am install-exec install-data-am install-data \
+install-am install uninstall-am uninstall all-redirect all-am all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libjava/gcj/array.h b/libjava/gcj/array.h
new file mode 100644
index 0000000..cd419d7
--- /dev/null
+++ b/libjava/gcj/array.h
@@ -0,0 +1,77 @@
+// 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 __GCJ_ARRAY_H__
+#define __GCJ_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;
+
+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);
+void _Jv_RunMain (const char* name, int argc, const char **argv);
+
+inline jsize JvGetArrayLength (jarray array) { return array->length; }
+
+#endif /* __GCJ_ARRAY_H__ */
diff --git a/libjava/gcj/cni.h b/libjava/gcj/cni.h
new file mode 100644
index 0000000..2cdd545
--- /dev/null
+++ b/libjava/gcj/cni.h
@@ -0,0 +1,132 @@
+// gcj/cni.h -*- c++ -*-
+// This file describes the Cygnus Native Interface, CNI.
+// It provides a nicer interface to many of the things in gcj/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 __GCJ_CNI_H__
+#define __GCJ_CNI_H__
+
+#include <java/lang/Object.h>
+#include <java/lang/Class.h>
+
+#include <gcj/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 /* __GCJ_CNI_H__ */
diff --git a/libjava/gcj/field.h b/libjava/gcj/field.h
new file mode 100644
index 0000000..07cb4f8
--- /dev/null
+++ b/libjava/gcj/field.h
@@ -0,0 +1,169 @@
+// 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 __GCJ_FIELD_H__
+#define __GCJ_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 ()
+ {
+ if (!isResolved ())
+ {
+ char first = ((_Jv_Utf8Const*)type)->data[0];
+ return first == '[' || first == 'L';
+ }
+ else
+ {
+ return ! 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 __GCJ_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 (__GCJ_CNI_H__) */
+
+#endif
+
+#endif /* __GCJ_FIELD_H */
diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h
new file mode 100644
index 0000000..ee08537
--- /dev/null
+++ b/libjava/gcj/javaprims.h
@@ -0,0 +1,306 @@
+// 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__
+
+// FIXME: this is a hack until we get a proper gcjh.
+// It is needed to work around system header files that define TRUE
+// and FALSE.
+#undef TRUE
+#define TRUE TRUE
+#undef FALSE
+#define FALSE FALSE
+
+// 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 ConcreteProcess;
+ 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 PropertyResourceBundle;
+ class Random;
+ class ResourceBundle;
+ class SimpleTimeZone;
+ class Stack;
+ class StringTokenizer;
+ class TimeZone;
+ class TooManyListenersException;
+ class Vector;
+ class VectorEnumeration;
+ namespace jar
+ {
+ class JarEntry;
+ class JarFile;
+ class JarInputStream;
+ }
+
+ namespace zip
+ {
+ class Adler32;
+ class CRC32;
+ class CheckedInputStream;
+ class CheckedOutputStream;
+ class Checksum;
+ class DataFormatException;
+ class Deflater;
+ class DeflaterOutputStream;
+ class GZIPInputStream;
+ class GZIPOutputStream;
+ class Inflater;
+ class InflaterInputStream;
+ class ZipConstants;
+ class ZipEntry;
+ class ZipEnumeration;
+ class ZipException;
+ class ZipFile;
+ class ZipInputStream;
+ 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__)));
+
+typedef union {
+ jobject o;
+ jint i; // Also stores smaller integral types.
+ jfloat f;
+ jint ia[1]; // Half of _Jv_word2.
+ void* p;
+
+ // these are things we will store in the constant
+ jclass clazz;
+ jstring string;
+ struct _Jv_Field *field;
+ struct _Jv_Utf8Const *utf8;
+ struct _Jv_ResolvedMethod *rmethod;
+} _Jv_word;
+
+typedef union {
+ jint ia[2];
+ jlong l;
+ jdouble d;
+} _Jv_word2;
+
+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__ */
diff --git a/libjava/gcj/method.h b/libjava/gcj/method.h
new file mode 100644
index 0000000..a97ba4a
--- /dev/null
+++ b/libjava/gcj/method.h
@@ -0,0 +1,21 @@
+// 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. */
+
+#ifndef __GCJ_METHOD_H__
+#define __GCJ_METHOD_H__
+
+extern inline jmethodID
+_Jv_FromReflectedMethod(java::lang::reflect::Method *method)
+{
+ return (jmethodID)
+ ((char *) method->declaringClass->methods + method->offset);
+}
+
+#endif /* __GCJ_METHOD_H__ */