[kaffe] CVS kaffe (dalibor): Moved class file reading functions into their own C file
Kaffe CVS
cvs-commits at kaffe.org
Tue Apr 27 09:39:02 PDT 2004
PatchSet 4702
Date: 2004/04/27 16:14:21
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Moved class file reading functions into their own C file
2004-04-27 Dalibor Topic <robilad at kaffe.org>
* kaffe/kaffevm/file.c:
New file.
* kaffe/kaffeh/Makefile.am:
(GEN_SOURCES) Added file.c.
* kaffe/kaffeh/Makefile.in:
Regenerated.
* kaffe/kaffevm/Makefile.am:
(libkaffevm_la_SOURCES) Added file.c.
* kaffe/kaffevm/Makefile.in:
Regenerated.
* kaffe/kaffevm/file.h:
Moved implementation to file.c
Members:
ChangeLog:1.2278->1.2279
kaffe/kaffeh/Makefile.am:1.14->1.15
kaffe/kaffeh/Makefile.in:1.106->1.107
kaffe/kaffevm/Makefile.am:1.56->1.57
kaffe/kaffevm/Makefile.in:1.147->1.148
kaffe/kaffevm/file.c:INITIAL->1.1
kaffe/kaffevm/file.h:1.7->1.8
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2278 kaffe/ChangeLog:1.2279
--- kaffe/ChangeLog:1.2278 Tue Apr 27 10:53:44 2004
+++ kaffe/ChangeLog Tue Apr 27 16:14:21 2004
@@ -1,5 +1,25 @@
2004-04-27 Dalibor Topic <robilad at kaffe.org>
+ * kaffe/kaffevm/file.c:
+ New file.
+
+ * kaffe/kaffeh/Makefile.am:
+ (GEN_SOURCES) Added file.c.
+
+ * kaffe/kaffeh/Makefile.in:
+ Regenerated.
+
+ * kaffe/kaffevm/Makefile.am:
+ (libkaffevm_la_SOURCES) Added file.c.
+
+ * kaffe/kaffevm/Makefile.in:
+ Regenerated.
+
+ * kaffe/kaffevm/file.h:
+ Moved implementation to file.c
+
+2004-04-27 Dalibor Topic <robilad at kaffe.org>
+
* config/i386/beos/md.h,
config/i386/bsdi/md.h,
config/i386/dgux/md.h,
Index: kaffe/kaffe/kaffeh/Makefile.am
diff -u kaffe/kaffe/kaffeh/Makefile.am:1.14 kaffe/kaffe/kaffeh/Makefile.am:1.15
--- kaffe/kaffe/kaffeh/Makefile.am:1.14 Thu Jul 31 22:46:45 2003
+++ kaffe/kaffe/kaffeh/Makefile.am Tue Apr 27 16:14:23 2004
@@ -10,15 +10,27 @@
bin_PROGRAMS = kaffeh
-GEN_SRCS = inflate.c jar.c utf8const.c readClass.c constants.c debug.c
+GEN_SRCS = \
+ constants.c \
+ debug.c \
+ file.c \
+ inflate.c \
+ jar.c \
+ readClass.c \
+ utf8const.c
DISTCLEANFILES = $(GEN_SRCS)
-kaffeh_SOURCES = sigs.c support.c main.c mem.c
+kaffeh_SOURCES = \
+ main.c \
+ mem.c \
+ sigs.c \
+ support.c
nodist_kaffeh_SOURCES = $(GEN_SRCS)
-noinst_HEADERS = kaffeh-support.h \
+noinst_HEADERS = \
+ kaffeh-support.h \
java_lang_ClassLoader.h \
java_lang_Object.h \
java_lang_String.h
Index: kaffe/kaffe/kaffeh/Makefile.in
diff -u kaffe/kaffe/kaffeh/Makefile.in:1.106 kaffe/kaffe/kaffeh/Makefile.in:1.107
--- kaffe/kaffe/kaffeh/Makefile.in:1.106 Mon Apr 26 16:47:56 2004
+++ kaffe/kaffe/kaffeh/Makefile.in Tue Apr 27 16:14:23 2004
@@ -73,10 +73,11 @@
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
-am_kaffeh_OBJECTS = sigs.$(OBJEXT) support.$(OBJEXT) main.$(OBJEXT) \
- mem.$(OBJEXT)
-am__objects_1 = inflate.$(OBJEXT) jar.$(OBJEXT) utf8const.$(OBJEXT) \
- readClass.$(OBJEXT) constants.$(OBJEXT) debug.$(OBJEXT)
+am_kaffeh_OBJECTS = main.$(OBJEXT) mem.$(OBJEXT) sigs.$(OBJEXT) \
+ support.$(OBJEXT)
+am__objects_1 = constants.$(OBJEXT) debug.$(OBJEXT) file.$(OBJEXT) \
+ inflate.$(OBJEXT) jar.$(OBJEXT) readClass.$(OBJEXT) \
+ utf8const.$(OBJEXT)
nodist_kaffeh_OBJECTS = $(am__objects_1)
kaffeh_OBJECTS = $(am_kaffeh_OBJECTS) $(nodist_kaffeh_OBJECTS)
kaffeh_LDADD = $(LDADD)
@@ -84,10 +85,11 @@
depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE at DEP_FILES = ./$(DEPDIR)/constants.Po ./$(DEPDIR)/debug.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/inflate.Po ./$(DEPDIR)/jar.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/mem.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/readClass.Po ./$(DEPDIR)/sigs.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/support.Po ./$(DEPDIR)/utf8const.Po
+ at AMDEP_TRUE@ ./$(DEPDIR)/file.Po ./$(DEPDIR)/inflate.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/jar.Po ./$(DEPDIR)/main.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/mem.Po ./$(DEPDIR)/readClass.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/sigs.Po ./$(DEPDIR)/support.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/utf8const.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
@@ -341,11 +343,25 @@
toolslibdir = @toolslibdir@
with_engine = @with_engine@
AM_CPPFLAGS = -I../kaffevm -I$(srcdir)/../kaffevm -DKAFFEH -I$(top_builddir)/include
-GEN_SRCS = inflate.c jar.c utf8const.c readClass.c constants.c debug.c
+GEN_SRCS = \
+ constants.c \
+ debug.c \
+ file.c \
+ inflate.c \
+ jar.c \
+ readClass.c \
+ utf8const.c
+
DISTCLEANFILES = $(GEN_SRCS)
-kaffeh_SOURCES = sigs.c support.c main.c mem.c
+kaffeh_SOURCES = \
+ main.c \
+ mem.c \
+ sigs.c \
+ support.c
+
nodist_kaffeh_SOURCES = $(GEN_SRCS)
-noinst_HEADERS = kaffeh-support.h \
+noinst_HEADERS = \
+ kaffeh-support.h \
java_lang_ClassLoader.h \
java_lang_Object.h \
java_lang_String.h
@@ -423,6 +439,7 @@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/constants.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/debug.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/file.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/inflate.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jar.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@
Index: kaffe/kaffe/kaffevm/Makefile.am
diff -u kaffe/kaffe/kaffevm/Makefile.am:1.56 kaffe/kaffe/kaffevm/Makefile.am:1.57
--- kaffe/kaffe/kaffevm/Makefile.am:1.56 Mon Mar 29 21:31:27 2004
+++ kaffe/kaffe/kaffevm/Makefile.am Tue Apr 27 16:14:23 2004
@@ -69,6 +69,7 @@
debug.c \
exception.c \
external.c \
+ file.c \
findInJar.c \
fp.c \
gc.c \
Index: kaffe/kaffe/kaffevm/Makefile.in
diff -u kaffe/kaffe/kaffevm/Makefile.in:1.147 kaffe/kaffe/kaffevm/Makefile.in:1.148
--- kaffe/kaffe/kaffevm/Makefile.in:1.147 Mon Apr 26 16:47:57 2004
+++ kaffe/kaffe/kaffevm/Makefile.in Tue Apr 27 16:14:23 2004
@@ -78,12 +78,12 @@
$(am__DEPENDENCIES_2) systems/$(THREAD_SYSTEM)/libkthread.la
am_libkaffevm_la_OBJECTS = access.lo baseClasses.lo classMethod.lo \
classPool.lo methodCache.lo code-analyse.lo code.lo \
- constants.lo debug.lo exception.lo external.lo findInJar.lo \
- fp.lo gc.lo hashtab.lo inflate.lo itypes.lo jar.lo jni.lo \
- ksem.lo locks.lo lookup.lo object.lo readClass.lo sha-1.lo \
- soft.lo stackTrace.lo stats.lo string.lo stringParsing.lo \
- support.lo thread.lo utf8const.lo gcFuncs.lo gcRefs.lo \
- verify.lo verify2.lo verify-block.lo verify-debug.lo \
+ constants.lo debug.lo exception.lo external.lo file.lo \
+ findInJar.lo fp.lo gc.lo hashtab.lo inflate.lo itypes.lo \
+ jar.lo jni.lo ksem.lo locks.lo lookup.lo object.lo \
+ readClass.lo sha-1.lo soft.lo stackTrace.lo stats.lo string.lo \
+ stringParsing.lo support.lo thread.lo utf8const.lo gcFuncs.lo \
+ gcRefs.lo verify.lo verify2.lo verify-block.lo verify-debug.lo \
verify-sigstack.lo verify-type.lo verify-uninit.lo
am__objects_1 = gc-mem.lo md.lo
nodist_libkaffevm_la_OBJECTS = $(am__objects_1)
@@ -99,18 +99,18 @@
@AMDEP_TRUE@ ./$(DEPDIR)/code-analyse.Plo ./$(DEPDIR)/code.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/constants.Plo ./$(DEPDIR)/debug.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/exception.Plo ./$(DEPDIR)/external.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/findInJar.Plo ./$(DEPDIR)/fp.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/gc-mem.Plo ./$(DEPDIR)/gc.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/gcFuncs.Plo ./$(DEPDIR)/gcRefs.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/hashtab.Plo ./$(DEPDIR)/inflate.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/itypes.Plo ./$(DEPDIR)/jar.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/jni.Plo ./$(DEPDIR)/ksem.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/locks.Plo ./$(DEPDIR)/lookup.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/md.Plo ./$(DEPDIR)/methodCache.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/object.Plo ./$(DEPDIR)/readClass.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/sha-1.Plo ./$(DEPDIR)/soft.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/stackTrace.Plo ./$(DEPDIR)/stats.Plo \
- at AMDEP_TRUE@ ./$(DEPDIR)/string.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/file.Plo ./$(DEPDIR)/findInJar.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/fp.Plo ./$(DEPDIR)/gc-mem.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/gc.Plo ./$(DEPDIR)/gcFuncs.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/gcRefs.Plo ./$(DEPDIR)/hashtab.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/inflate.Plo ./$(DEPDIR)/itypes.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/jar.Plo ./$(DEPDIR)/jni.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/ksem.Plo ./$(DEPDIR)/locks.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/lookup.Plo ./$(DEPDIR)/md.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/methodCache.Plo ./$(DEPDIR)/object.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/readClass.Plo ./$(DEPDIR)/sha-1.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/soft.Plo ./$(DEPDIR)/stackTrace.Plo \
+ at AMDEP_TRUE@ ./$(DEPDIR)/stats.Plo ./$(DEPDIR)/string.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/stringParsing.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/support.Plo ./$(DEPDIR)/thread.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/utf8const.Plo \
@@ -429,6 +429,7 @@
debug.c \
exception.c \
external.c \
+ file.c \
findInJar.c \
fp.c \
gc.c \
@@ -590,6 +591,7 @@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/debug.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/exception.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/external.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/file.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/findInJar.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fp.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gc-mem.Plo at am__quote@
===================================================================
Checking out kaffe/kaffe/kaffevm/file.c
RCS: /home/cvs/kaffe/kaffe/kaffe/kaffevm/file.c,v
VERS: 1.1
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/kaffe/kaffevm/file.c Tue Apr 27 16:20:31 2004
@@ -0,0 +1,129 @@
+/*
+ * file.c
+ * File support routines.
+ *
+ * Copyright (c) 1996, 1997
+ * Transvirtual Technologies, Inc. All rights reserved.
+ *
+ * Copyright (c) 2004
+ * Kaffe.org contributors. See ChangeLog for details. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+/*
+ * Used in kaffeh and kaffevm
+ *
+ * XXX rename to classFileHandle.h ?
+ */
+#include "config.h"
+#include "config-std.h"
+#include "gtypes.h"
+#include "errors.h"
+#include "file.h"
+
+/*
+ * Init a a classFile struct to point to the given buffer.
+ */
+void
+classFileInit(classFile* cf, const unsigned char* buf, size_t len, ClassFileType cft)
+{
+ assert (((buf == NULL) && (len == 0))
+ || ((buf != NULL) && (len != 0)));
+
+ cf->base = cf->cur = buf;
+ cf->size = len;
+ cf->type = cft;
+}
+
+/*
+ * Check that the needed number of bytes are available. If
+ * not a ClassFormatError is posted in einfo.
+ */
+bool
+checkBufSize(classFile* cf, u4 need, const char* cfname, errorInfo* einfo)
+{
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ if ((unsigned)(cf->base + cf->size - cf->cur) < need)
+ {
+ if (cfname != NULL)
+ postExceptionMessage(einfo,
+ JAVA_LANG(ClassFormatError),
+ "%s class file truncated",
+ cfname);
+ else
+ postExceptionMessage(einfo,
+ JAVA_LANG(ClassFormatError),
+ "Truncated class file");
+
+ return false;
+ }
+
+ return true;
+}
+
+/* Read a single unsigned byte from cf */
+void
+readu1(u1* c, classFile* cf)
+{
+ assert(c != NULL);
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ *c = cf->cur[0];
+ cf->cur += 1;
+}
+
+/* Read a pair of unsigned bytes from cf */
+void
+readu2(u2* c, classFile* cf)
+{
+ assert(c != NULL);
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ *c = (((u2) cf->cur[0]) << 8) | ((u2) cf->cur[1]);
+ cf->cur += 2;
+}
+
+/* Read a four-byte unsigned word of unsigned bytes from cf */
+void
+readu4(u4* c, classFile* cf)
+{
+ assert(c != NULL);
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ *c = (((u4) cf->cur[0]) << 24)
+ | (((u4) cf->cur[1]) << 16)
+ | (((u4) cf->cur[2]) << 8)
+ | ((u4) cf->cur[3]);
+ cf->cur += 4;
+}
+
+/**
+ * Read len*size bytes out of the classfile, and into dest.
+ */
+void
+readm(void* dest, size_t len, size_t size, classFile* cf)
+{
+ assert(dest != NULL);
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ memcpy(dest, cf->cur, len*size);
+ cf->cur += len*size;
+}
+
+/* Skip over an arbitrary chunk of cf */
+void
+seekm(classFile* cf, size_t len)
+{
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ cf->cur += len;
+}
Index: kaffe/kaffe/kaffevm/file.h
diff -u kaffe/kaffe/kaffevm/file.h:1.7 kaffe/kaffe/kaffevm/file.h:1.8
--- kaffe/kaffe/kaffevm/file.h:1.7 Sun Apr 18 13:57:26 2004
+++ kaffe/kaffe/kaffevm/file.h Tue Apr 27 16:14:24 2004
@@ -40,121 +40,39 @@
/*
* Init a a classFile struct to point to the given buffer.
*/
-static inline void classFileInit(classFile* cf,
- const unsigned char* buf,
- size_t len,
- ClassFileType cft) __UNUSED__;
+extern void classFileInit(classFile* cf,
+ const unsigned char* buf,
+ size_t len,
+ ClassFileType cft);
/*
* Check that the needed number of bytes are available. If
* not a ClassFormatError is posted in einfo.
*/
-static inline bool checkBufSize(classFile* cf, u4 need,
- const char* cfname,
- errorInfo* einfo) __UNUSED__;
-/* Read a single unsigned byte from cf */
-static inline void readu1(u1* c, classFile* cf) __UNUSED__;
-/* Read a pair of unsigned bytes from cf */
-static inline void readu2(u2* c, classFile* cf) __UNUSED__;
-/* Read a four-byte unsigned word from cf */
-static inline void readu4(u4* c, classFile* cf) __UNUSED__;
-/* Read an arbitrary chunk from cf */
-static inline void readm(void* dest, size_t len,
- size_t size, classFile* cf) __UNUSED__;
-/* Skip over an arbitrary chunk of cf */
-static inline void seekm(classFile*cf, size_t len) __UNUSED__;
-
-static inline void
-classFileInit(classFile* cf, const unsigned char* buf, size_t len, ClassFileType cft)
-{
- assert (((buf == NULL) && (len == 0))
- || ((buf != NULL) && (len != 0)));
-
- cf->base = cf->cur = buf;
- cf->size = len;
- cf->type = cft;
-}
-
-static inline bool
-checkBufSize(classFile* cf, u4 need, const char* cfname, errorInfo* einfo)
-{
- assert(cf != NULL);
- assert(cf->type != CP_INVALID);
-
- if ((unsigned)(cf->base + cf->size - cf->cur) < need)
- {
- if (cfname != NULL)
- postExceptionMessage(einfo,
- JAVA_LANG(ClassFormatError),
- "%s class file truncated",
- cfname);
- else
- postExceptionMessage(einfo,
- JAVA_LANG(ClassFormatError),
- "Truncated class file");
-
- return false;
- }
-
- return true;
-}
-
-static inline void
-readu1(u1* c, classFile* cf)
-{
- assert(c != NULL);
- assert(cf != NULL);
- assert(cf->type != CP_INVALID);
+extern bool checkBufSize(classFile* cf,
+ u4 need,
+ const char* cfname,
+ errorInfo* einfo);
- *c = cf->cur[0];
- cf->cur += 1;
-}
-
-static inline void
-readu2(u2* c, classFile* cf)
-{
- assert(c != NULL);
- assert(cf != NULL);
- assert(cf->type != CP_INVALID);
-
- *c = (((u2) cf->cur[0]) << 8) | ((u2) cf->cur[1]);
- cf->cur += 2;
-}
-
-static inline void
-readu4(u4* c, classFile* cf)
-{
- assert(c != NULL);
- assert(cf != NULL);
- assert(cf->type != CP_INVALID);
-
- *c = (((u4) cf->cur[0]) << 24)
- | (((u4) cf->cur[1]) << 16)
- | (((u4) cf->cur[2]) << 8)
- | ((u4) cf->cur[3]);
- cf->cur += 4;
-}
+/* Read a single unsigned byte from cf */
+extern void readu1(u1* c,
+ classFile* cf);
-/**
- * Read len*size bytes out of the classfile, and into dest.
- */
-static inline void
-readm(void* dest, size_t len, size_t size, classFile* cf)
-{
- assert(dest != NULL);
- assert(cf != NULL);
- assert(cf->type != CP_INVALID);
+/* Read a pair of unsigned bytes from cf */
+extern void readu2(u2* c,
+ classFile* cf);
- memcpy(dest, cf->cur, len*size);
- cf->cur += len*size;
-}
+/* Read a four-byte unsigned word from cf */
+extern void readu4(u4* c,
+ classFile* cf);
-static inline void
-seekm(classFile* cf, size_t len)
-{
- assert(cf != NULL);
- assert(cf->type != CP_INVALID);
+/* Read an arbitrary chunk from cf */
+extern void readm(void* dest,
+ size_t len,
+ size_t size,
+ classFile* cf);
- cf->cur += len;
-}
+/* Skip over an arbitrary chunk of cf */
+extern void seekm(classFile*cf,
+ size_t len);
#endif /* kaffe_kaffevm_file_h */
More information about the kaffe
mailing list