Major file restructuring.
authortwisti <none@none>
Sun, 2 Nov 2003 22:51:59 +0000 (22:51 +0000)
committertwisti <none@none>
Sun, 2 Nov 2003 22:51:59 +0000 (22:51 +0000)
243 files changed:
Makefile.am
Makefile.in
acconfig.h
alpha/Makefile.am [deleted file]
alpha/asmpart.S [deleted file]
alpha/calling.doc [deleted file]
alpha/cray.c [deleted file]
alpha/defines.h [deleted file]
alpha/disass.c [deleted file]
alpha/gen.c [deleted file]
alpha/native-math.h [deleted file]
alpha/ngen.c [deleted file]
alpha/ngen.h [deleted file]
alpha/sigcontext.h [deleted file]
alpha/threads.h [deleted file]
alpha/types.h [deleted file]
asmpart.h
builtin.c
builtin.h
callargs.h [deleted file]
config.h.in
configure
configure.in
global.h
headers.c
i386/Makefile.am [deleted file]
i386/ansidecl.h [deleted file]
i386/asmpart.S [deleted file]
i386/bfd.h [deleted file]
i386/dis-asm.h [deleted file]
i386/dis-buf.c [deleted file]
i386/disass.c [deleted file]
i386/i386-dis.c [deleted file]
i386/methodtable.c [deleted file]
i386/methodtable.h [deleted file]
i386/native-math.h [deleted file]
i386/ngen.c [deleted file]
i386/ngen.h [deleted file]
i386/threads.h [deleted file]
i386/types.h [deleted file]
jit.c [deleted file]
jit.h [deleted file]
jit/Makefile.am
jit/Makefile.in
jit/alpha/Makefile.am [new file with mode: 0644]
jit/alpha/asmpart.S [new file with mode: 0644]
jit/alpha/codegen.c [new file with mode: 0644]
jit/alpha/codegen.h [new file with mode: 0644]
jit/alpha/disass.c [new file with mode: 0644]
jit/alpha/disass.h [new file with mode: 0644]
jit/alpha/native-math.h [new file with mode: 0644]
jit/alpha/sigcontext.h [new file with mode: 0644]
jit/alpha/threads.h [new file with mode: 0644]
jit/alpha/types.h [new file with mode: 0644]
jit/codegen.inc [new file with mode: 0644]
jit/i386/Makefile.am [new file with mode: 0644]
jit/i386/ansidecl.h [new file with mode: 0644]
jit/i386/asmpart.S [new file with mode: 0644]
jit/i386/bfd.h [new file with mode: 0644]
jit/i386/codegen.c [new file with mode: 0644]
jit/i386/codegen.h [new file with mode: 0644]
jit/i386/dis-asm.h [new file with mode: 0644]
jit/i386/dis-buf.c [new file with mode: 0644]
jit/i386/disass.c [new file with mode: 0644]
jit/i386/disass.h [new file with mode: 0644]
jit/i386/i386-dis.c [new file with mode: 0644]
jit/i386/methodtable.c [new file with mode: 0644]
jit/i386/methodtable.h [new file with mode: 0644]
jit/i386/native-math.h [new file with mode: 0644]
jit/i386/threads.h [new file with mode: 0644]
jit/i386/types.h [new file with mode: 0644]
jit/inline.c
jit/inline.h [new file with mode: 0644]
jit/jit.c [new file with mode: 0644]
jit/jit.h [new file with mode: 0644]
jit/jitdef.h
jit/loop/Makefile.am [new file with mode: 0644]
jit/loop/analyze.c [new file with mode: 0644]
jit/loop/analyze.h [new file with mode: 0644]
jit/loop/graph.c [new file with mode: 0644]
jit/loop/graph.h [new file with mode: 0644]
jit/loop/loop.c [new file with mode: 0644]
jit/loop/loop.h [new file with mode: 0644]
jit/loop/tracing.c [new file with mode: 0644]
jit/loop/tracing.h [new file with mode: 0644]
jit/mcode.c [deleted file]
jit/parse.c
jit/parse.h [new file with mode: 0644]
jit/parseRT.c [new file with mode: 0644]
jit/parseRT.h
jit/parseRTprint.h
jit/parseRTstats.c [new file with mode: 0644]
jit/parseRTstats.h
jit/reg.c [deleted file]
jit/reg.h [new file with mode: 0644]
jit/reg.inc [new file with mode: 0644]
jit/sets.c
jit/sets.h
jit/stack.c
jit/stack.h [new file with mode: 0644]
jni.c
jni.h
loader.c
loader.h
main.c
mips/Makefile.am [deleted file]
mips/asmpart.S [deleted file]
mips/calling.doc [deleted file]
mips/defines.h [deleted file]
mips/disass.c [deleted file]
mips/native-math.h [deleted file]
mips/ngen.c [deleted file]
mips/ngen.h [deleted file]
mips/threads.h [deleted file]
mips/types.h [deleted file]
mm/Makefile.am
mm/Makefile.in
mm/boehm.c
narray/Makefile.am [deleted file]
narray/analyze.c [deleted file]
narray/graph.c [deleted file]
narray/loop.c [deleted file]
narray/loop.h [deleted file]
narray/tracing.c [deleted file]
nat/Makefile.in
natcalls.h
native.c
native.h
nativecalls.h
powerpc/Makefile.am [deleted file]
powerpc/asmart.c [deleted file]
powerpc/asmpart.S [deleted file]
powerpc/defines.h [deleted file]
powerpc/dis-asm.h [deleted file]
powerpc/disass.c [deleted file]
powerpc/native-math.h [deleted file]
powerpc/ngen.c [deleted file]
powerpc/ngen.h [deleted file]
powerpc/ppc-dis.c [deleted file]
powerpc/ppc-opc.c [deleted file]
powerpc/ppc.h [deleted file]
powerpc/threads.h [deleted file]
powerpc/types.h [deleted file]
src/cacao/cacao.c
src/cacaoh/headers.c
src/mm/Makefile.am
src/mm/boehm.c
src/mm/memory.c
src/mm/memory.h
src/native/jni.c
src/native/jni.h
src/native/natcalls.h
src/native/native.c
src/native/native.h
src/native/nativecalls.inc
src/threads/green/Makefile.am
src/threads/green/threadio.c
src/threads/green/threads.c
src/toolbox/Makefile.am
src/toolbox/chain.h
src/vm/builtin.c
src/vm/builtin.h
src/vm/global.h
src/vm/jit/Makefile.am
src/vm/jit/alpha/Makefile.am [new file with mode: 0644]
src/vm/jit/alpha/asmpart.S [new file with mode: 0644]
src/vm/jit/alpha/codegen.c [new file with mode: 0644]
src/vm/jit/alpha/codegen.h [new file with mode: 0644]
src/vm/jit/alpha/disass.c [new file with mode: 0644]
src/vm/jit/alpha/disass.h [new file with mode: 0644]
src/vm/jit/alpha/types.h [new file with mode: 0644]
src/vm/jit/asmpart.h
src/vm/jit/codegen.inc [new file with mode: 0644]
src/vm/jit/i386/Makefile.am [new file with mode: 0644]
src/vm/jit/i386/ansidecl.h [new file with mode: 0644]
src/vm/jit/i386/asmpart.S [new file with mode: 0644]
src/vm/jit/i386/bfd.h [new file with mode: 0644]
src/vm/jit/i386/codegen.c [new file with mode: 0644]
src/vm/jit/i386/codegen.h [new file with mode: 0644]
src/vm/jit/i386/dis-asm.h [new file with mode: 0644]
src/vm/jit/i386/dis-buf.c [new file with mode: 0644]
src/vm/jit/i386/disass.c [new file with mode: 0644]
src/vm/jit/i386/disass.h [new file with mode: 0644]
src/vm/jit/i386/i386-dis.c [new file with mode: 0644]
src/vm/jit/i386/types.h [new file with mode: 0644]
src/vm/jit/inline/inline.c
src/vm/jit/inline/inline.h [new file with mode: 0644]
src/vm/jit/inline/parseRT.c [new file with mode: 0644]
src/vm/jit/inline/parseRT.h
src/vm/jit/inline/parseRTprint.h
src/vm/jit/inline/parseRTstats.c [new file with mode: 0644]
src/vm/jit/inline/parseRTstats.h
src/vm/jit/inline/sets.c
src/vm/jit/inline/sets.h
src/vm/jit/jit.c [new file with mode: 0644]
src/vm/jit/jit.h [new file with mode: 0644]
src/vm/jit/loop/Makefile.am [new file with mode: 0644]
src/vm/jit/loop/analyze.c [new file with mode: 0644]
src/vm/jit/loop/analyze.h [new file with mode: 0644]
src/vm/jit/loop/graph.c [new file with mode: 0644]
src/vm/jit/loop/graph.h [new file with mode: 0644]
src/vm/jit/loop/loop.c [new file with mode: 0644]
src/vm/jit/loop/loop.h [new file with mode: 0644]
src/vm/jit/loop/tracing.c [new file with mode: 0644]
src/vm/jit/loop/tracing.h [new file with mode: 0644]
src/vm/jit/parse.c
src/vm/jit/parse.h [new file with mode: 0644]
src/vm/jit/reg.h [new file with mode: 0644]
src/vm/jit/reg.inc [new file with mode: 0644]
src/vm/jit/stack.c
src/vm/jit/stack.h [new file with mode: 0644]
src/vm/loader.c
src/vm/loader.h
src/vm/tables.c
src/vm/tables.h
tables.c
tables.h
tests/Makefile.in
threads/Makefile.am
threads/Makefile.in
threads/thread.c
threads/threadio.c
toolbox/Makefile.am
toolbox/Makefile.in
toolbox/chain.h
toolbox/memory.c
toolbox/memory.h
x86_64/Makefile.am [deleted file]
x86_64/ansidecl.h [deleted file]
x86_64/asmpart.S [deleted file]
x86_64/bfd.h [deleted file]
x86_64/defines.h [deleted file]
x86_64/dis-asm.h [deleted file]
x86_64/dis-buf.c [deleted file]
x86_64/disass.c [deleted file]
x86_64/i386-dis.c [deleted file]
x86_64/methodtable.c [deleted file]
x86_64/methodtable.h [deleted file]
x86_64/native-math.h [deleted file]
x86_64/ngen.c [deleted file]
x86_64/ngen.h [deleted file]
x86_64/threads.h [deleted file]
x86_64/types.h [deleted file]

index bcd69a0751266e8f3a59d8213a0bc2d8e38bce73..0d2e1eefd4a71c7e9fc4e601f0bfdb9bff4670c9 100644 (file)
@@ -1,26 +1,32 @@
 ## Process this file with automake to produce Makefile.in
 
-# $Id: Makefile.am 503 2003-10-22 17:35:21Z twisti $
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
 
 @SET_MAKE@
 
 MAINTAINERCLEANFILES = Makefile.in configure
-ALLSUBDIRS = mm toolbox jit nat threads tst doc narray jvmtst
-SUBDIRS = $(ALLSUBDIRS) @SYSDEP_DIR@
-DIST_SUBDIRS = $(ALLSUBDIRS) alpha mips i386 powerpc x86_64
-
-EXTRA_DIST = html/cacaoinstall.html html/cacaoman.html html/index.html \
-                               jni.c natcalls.h nativecalls.h
-
-CLEANFILES = @SYSDEP_DIR@/asmpart.o \
-             @SYSDEP_DIR@/offsets.h \
-                nativetable.hh \
-                nativetypes.hh
+ALLSUBDIRS = mm toolbox threads jit nat tst doc jvmtst
+SUBDIRS = $(ALLSUBDIRS)
+DIST_SUBDIRS = $(ALLSUBDIRS)
+
+EXTRA_DIST = \
+       html/cacaoinstall.html \
+       html/cacaoman.html \
+       html/index.html \
+       jni.c \
+       natcalls.h \
+       nativecalls.h
+
+CLEANFILES = \
+       jit/@ARCH_DIR@/asmpart.o \
+       jit/@ARCH_DIR@/offsets.h \
+       nativetable.hh \
+       nativetypes.hh
 
 bin_PROGRAMS = cacao
 noinst_PROGRAMS = cacaoh
 
-INCLUDES = -I$(top_srcdir)/@SYSDEP_DIR@ -I$(top_srcdir)/jit
+INCLUDES = -I$(top_srcdir)/jit/@ARCH_DIR@ -I$(top_srcdir)/jit
 
 BOEHM_LIBS = mm/libboehm.a mm/boehm-gc/.libs/libgc.a
 
@@ -28,10 +34,7 @@ cacao_SOURCES = \
        asmpart.h \
        builtin.c \
        builtin.h \
-       callargs.h \
        global.h \
-       jit.c \
-       jit.h \
        loader.c \
        loader.h \
        main.c \
@@ -42,15 +45,17 @@ cacao_SOURCES = \
        tables.h
 
 cacao_LDADD = \
-       @SYSDEP_DIR@/asmpart.o \
-       @COMPILER_OBJECTS@ \
+       jit/libjit.a \
+       jit/loop/libloop.a \
+       jit/@ARCH_DIR@/libarch.a \
        toolbox/libtoolbox.a \
        $(BOEHM_LIBS) \
        @THREAD_OBJ@
 
 cacao_DEPENDENCIES = \
-       @SYSDEP_DIR@/asmpart.o \
-       @COMPILER_OBJECTS@ \
+       jit/libjit.a \
+       jit/loop/libloop.a \
+       jit/@ARCH_DIR@/libarch.a \
        toolbox/libtoolbox.a \
        $(BOEHM_LIBS) \
        @THREAD_OBJ@
@@ -71,9 +76,9 @@ cacaoh_DEPENDENCIES = \
        $(BOEHM_LIBS) \
        @THREAD_OBJ@
 
-native.c: nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh
+native.c: nativetypes.hh jit/@ARCH_DIR@/offsets.h nativetable.hh
 
-nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh: cacaoh
+nativetypes.hh jit/@ARCH_DIR@/offsets.h nativetable.hh: cacaoh
        ./cacaoh \
                java.lang.Object \
                java.lang.String \
@@ -133,16 +138,14 @@ nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh: cacaoh
                java.io.UnixFileSystem \
                java.lang.ClassLoader_NativeLibrary
 
-@SYSDEP_DIR@/asmpart.o: $(top_srcdir)/@SYSDEP_DIR@/@ASMPART@ @SYSDEP_DIR@/offsets.h
-       @CC@ $(ASMFLAGS) $(INCLUDES) -c -g -o $@ $<
-
 checkjvm:
        $(MAKE) -C jvmtst $@
 
+
 ## Local variables:
 ## mode: Makefile
 ## indent-tabs-mode: t
 ## c-basic-offset: 4
-## tab-width: 4
+## tab-width: 8
 ## compile-command: "automake --add-missing"
 ## End:
index 2c1266808b8ecfc81416f2a9770842953e7d3bc1..5ad42e85bf89f40b802bc997ee584d5232c4cf87 100644 (file)
@@ -10,7 +10,7 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-# $Id: Makefile.in 491 2003-10-20 17:56:03Z twisti $
+# $Id: Makefile.in 557 2003-11-02 22:51:59Z twisti $
 
 
 SHELL = @SHELL@
@@ -61,47 +61,51 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 host_alias = @host_alias@
 host_triplet = @host@
-ASMPART = @ASMPART@
-BOEHM_LIB = @BOEHM_LIB@
+ARCH_DIR = @ARCH_DIR@
 CC = @CC@
 COMPILER_OBJECTS = @COMPILER_OBJECTS@
-GC_OBJ = @GC_OBJ@
 LIBTHREAD = @LIBTHREAD@
 MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
-SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
 MAINTAINERCLEANFILES = Makefile.in configure
-ALLSUBDIRS = toolbox mm jit nat threads tst doc narray jvmtst
-SUBDIRS = $(ALLSUBDIRS) @SYSDEP_DIR@
-DIST_SUBDIRS = $(ALLSUBDIRS) alpha mips i386 powerpc x86_64
+ALLSUBDIRS = mm toolbox threads jit nat tst doc jvmtst
+SUBDIRS = $(ALLSUBDIRS)
+DIST_SUBDIRS = $(ALLSUBDIRS)
 
-EXTRA_DIST = html/cacaoinstall.html html/cacaoman.html html/index.html                                 jni.c natcalls.h nativecalls.h
+EXTRA_DIST =   html/cacaoinstall.html  html/cacaoman.html      html/index.html         jni.c   natcalls.h      nativecalls.h
 
 
-CLEANFILES = @SYSDEP_DIR@/asmpart.o              @SYSDEP_DIR@/offsets.h                 nativetable.hh                  nativetypes.hh
+CLEANFILES =   jit/@ARCH_DIR@/asmpart.o        jit/@ARCH_DIR@/offsets.h        nativetable.hh  nativetypes.hh
 
 
 bin_PROGRAMS = cacao
 noinst_PROGRAMS = cacaoh
 
-INCLUDES = -I$(top_srcdir)/@SYSDEP_DIR@ -I$(top_srcdir)/jit -I@SYSDEP_DIR@ -I$(top_srcdir)
+INCLUDES = -I$(top_srcdir)/jit/@ARCH_DIR@ -I$(top_srcdir)/jit
 
-cacao_SOURCES =        asmpart.h       builtin.c       builtin.h       callargs.h      global.h        jit.c   jit.h   loader.c        loader.h        main.c  native.c        native.h        jni.h   tables.c        tables.h
+BOEHM_LIBS = mm/libboehm.a mm/boehm-gc/.libs/libgc.a
 
+cacao_SOURCES =        asmpart.h       builtin.c       builtin.h       global.h        loader.c        loader.h        main.c  native.c        native.h        jni.h   tables.c        tables.h
 
-cacao_LDADD =          @SYSDEP_DIR@/asmpart.o  @COMPILER_OBJECTS@      toolbox/libtoolbox.a    @GC_OBJ@        @THREAD_OBJ@
 
+cacao_LDADD =          jit/libjit.a    jit/loop/libloop.a      jit/@ARCH_DIR@/libarch.a        toolbox/libtoolbox.a    $(BOEHM_LIBS)   @THREAD_OBJ@
 
-cacao_DEPENDENCIES =   @SYSDEP_DIR@/asmpart.o  @COMPILER_OBJECTS@      toolbox/libtoolbox.a    @GC_OBJ@        @THREAD_OBJ@
 
+cacao_DEPENDENCIES =   jit/libjit.a    jit/loop/libloop.a      jit/@ARCH_DIR@/libarch.a        toolbox/libtoolbox.a    $(BOEHM_LIBS)   @THREAD_OBJ@
+
+
+cacaoh_SOURCES =       headers.c       tables.c        loader.c        builtin.c
+
+
+cacaoh_LDADD =         toolbox/libtoolbox.a    $(BOEHM_LIBS)   @THREAD_OBJ@
+
+
+cacaoh_DEPENDENCIES =          toolbox/libtoolbox.a    $(BOEHM_LIBS)   @THREAD_OBJ@
 
-cacaoh_SOURCES = headers.c tables.c loader.c builtin.c
-cacaoh_LDADD = toolbox/libtoolbox.a @GC_OBJ@ @THREAD_OBJ@
-cacaoh_DEPENDENCIES = toolbox/libtoolbox.a @GC_OBJ@ @THREAD_OBJ@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = config.h
@@ -113,7 +117,7 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I.
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
-cacao_OBJECTS =  builtin.o jit.o loader.o main.o native.o tables.o
+cacao_OBJECTS =  builtin.o loader.o main.o native.o tables.o
 cacao_LDFLAGS = 
 cacaoh_OBJECTS =  headers.o tables.o loader.o builtin.o
 cacaoh_LDFLAGS = 
@@ -131,8 +135,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
 TAR = tar
 GZIP_ENV = --best
-DEP_FILES =  .deps/builtin.P .deps/headers.P .deps/jit.P .deps/loader.P \
-.deps/main.P .deps/native.P .deps/tables.P
+DEP_FILES =  .deps/builtin.P .deps/headers.P .deps/loader.P .deps/main.P \
+.deps/native.P .deps/tables.P
 SOURCES = $(cacao_SOURCES) $(cacaoh_SOURCES)
 OBJECTS = $(cacao_OBJECTS) $(cacaoh_OBJECTS)
 
@@ -522,9 +526,9 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 @SET_MAKE@
 
-native.c: nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh
+native.c: nativetypes.hh jit/@ARCH_DIR@/offsets.h nativetable.hh
 
-nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh: cacaoh
+nativetypes.hh jit/@ARCH_DIR@/offsets.h nativetable.hh: cacaoh
        ./cacaoh \
                java.lang.Object \
                java.lang.String \
@@ -584,9 +588,6 @@ nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh: cacaoh
                java.io.UnixFileSystem \
                java.lang.ClassLoader_NativeLibrary
 
-@SYSDEP_DIR@/asmpart.o: $(top_srcdir)/@SYSDEP_DIR@/@ASMPART@ @SYSDEP_DIR@/offsets.h
-       @CC@ $(ASMFLAGS) $(INCLUDES) -c -g -o $@ $<
-
 checkjvm:
        $(MAKE) -C jvmtst $@
 
index 3af1aa6b554e3e8bbfdf05bdbc0535abd6e6dc94..710c7065a37135696b03842b86384e9b7c0f722a 100644 (file)
@@ -1,3 +1,37 @@
+/* acconfig.h - config.h defines
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors:
+
+   $Id: acconfig.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
 /* Define if mman.h defines MAP_FAILED  */
 #undef HAVE_MAP_FAILED
 
 #undef PACKAGE
 #undef VERSION
 
-/* sysdep */
-#undef SYSDEP_DIR
+/* Architecture directory */
+#undef ARCH_DIR
 
 #undef USE_CODEMMAP
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/alpha/Makefile.am b/alpha/Makefile.am
deleted file mode 100644 (file)
index ac52964..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-EXTRA_DIST = asmpart.S disass.c cray.c gen.c ngen.c \
-            defines.h native-math.h ngen.h sigcontext.h \
-            types.h threads.h 
diff --git a/alpha/asmpart.S b/alpha/asmpart.S
deleted file mode 100644 (file)
index 0e71fb3..0000000
+++ /dev/null
@@ -1,1229 +0,0 @@
-/* -*- mode: asm; tab-width: 4 -*- */
-/****************************** asmpart.S **************************************
-*                                                                              *
-*   It contains the Java-C interface functions for Alpha processors.           *
-*                                                                              *
-*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
-*                                                                              *
-*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
-*                                                                              *
-*   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
-*            Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
-*                                                                              *
-*   Last Change: 2003/02/17                                                    *
-*                                                                              *
-*******************************************************************************/
-
-#include "offsets.h"
-
-#define v0      $0
-
-#define t0      $1
-#define t1      $2
-#define t2      $3
-#define t3      $4
-#define t4      $5
-#define t5      $6
-#define t6      $7
-#define t7      $8
-
-#define        s0      $9
-#define        s1      $10
-#define        s2      $11
-#define        s3      $12
-#define        s4      $13
-#define        s5      $14
-#define        s6      $15
-
-#define a0      $16
-#define a1      $17
-#define a2      $18
-#define a3      $19
-#define a4      $20
-#define a5      $21
-
-#define t8      $22
-#define t9      $23
-#define t10     $24
-#define t11     $25
-#define ra      $26
-#define t12     $27
-
-#define pv      t12
-#define AT      $at
-#define gp      $29
-#define sp      $30
-#define zero    $31
-
-#define itmp1   $25
-#define itmp2   $28
-#define itmp3   $29
-
-#define xptr    itmp1
-#define xpc     itmp2
-
-#define sf0     $f2
-#define sf1     $f3
-#define sf2     $f4
-#define sf3     $f5
-#define sf4     $f6
-#define sf5     $f7
-#define sf6     $f8
-#define sf7     $f9
-
-#define fzero   $f31
-
-
-#define PAL_imb 134
-
-       .text
-       .set    noat
-       .set    noreorder
-
-
-/********************* exported functions and variables ***********************/
-
-       .globl has_no_x_instr_set
-       .globl synchronize_caches
-       .globl asm_calljavamethod
-       .globl asm_calljavafunction
-       .globl asm_call_jit_compiler
-       .globl asm_dumpregistersandcall
-       .globl asm_handle_exception
-       .globl asm_handle_nat_exception
-       .globl asm_builtin_checkcast    
-       .globl asm_builtin_checkarraycast
-       .globl asm_builtin_aastore
-       .globl asm_builtin_monitorenter
-       .globl asm_builtin_monitorexit
-       .globl asm_builtin_idiv
-       .globl asm_builtin_irem
-       .globl asm_builtin_ldiv
-       .globl asm_builtin_lrem
-       .globl asm_perform_threadswitch
-       .globl asm_initialize_thread_stack
-       .globl asm_switchstackandcall
-       .globl asm_getcallingmethod
-       .globl asm_builtin_trace
-       .globl asm_builtin_exittrace
-
-/*************************** imported functions *******************************/
-
-       .globl jit_compile
-       .globl builtin_monitorexit
-       .globl builtin_throw_exception
-       .globl builtin_trace_exception
-       .globl class_java_lang_Object
-
-
-/*********************** function has_no_x_instr_set ***************************
-*                                                                              *
-*   determines if the byte support instruction set (21164a and higher)         *
-*   is available.                                                              *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    has_no_x_instr_set
-has_no_x_instr_set:
-
-       .long   0x47e03c20                /* amask   1,v0                         */
-       jmp     zero,(ra)                 /* return                               */
-
-       .end    has_no_x_instr_set
-
-
-/********************* function synchronize_caches ****************************/
-
-       .ent    synchronize_caches
-synchronize_caches:
-
-       call_pal PAL_imb                  /* synchronise instruction cache        */
-       jmp     zero,(ra)                 /* return                               */
-
-       .end    synchronize_caches
-
-
-/********************* function asm_calljavamethod *****************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 parameters.                                                   *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   An possibly throwed exception will be returned to the caller as function   *
-*   return value, so the java method cannot return a fucntion value (this      *
-*   function usually calls 'main' and '<clinit>' which do not return a         *
-*   function value).                                                           *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-#define        MethodPointer   -8
-#define        FrameSize       -12
-#define     IsSync          -16
-#define     IsLeaf          -20
-#define     IntSave         -24
-#define     FltSave         -28
-#define     ExTableSize     -32
-#define     ExTableStart    -32
-
-#define     ExEntrySize     -32
-#define     ExStartPC       -8
-#define     ExEndPC         -16
-#define     ExHandlerPC     -24
-#define     ExCatchType     -32
-
-       .ent    asm_calljavamethod
-
-call_name:
-       .ascii  "calljavamethod\0\0"
-
-       .align  3
-       .quad   0                         /* catch type all                       */
-       .quad   calljava_xhandler         /* handler pc                           */
-       .quad   calljava_xhandler         /* end pc                               */
-       .quad   asm_calljavamethod        /* start pc                             */
-       .long   1                         /* extable size                         */
-       .long   0                         /* fltsave                              */
-       .long   0                         /* intsave                              */
-       .long   0                         /* isleaf                               */
-       .long   0                         /* IsSync                               */
-       .long   32                        /* frame size                           */
-       .quad   0                         /* method pointer (pointer to name)     */
-
-asm_calljavamethod:
-
-       .frame $30,32,$26
-       .mask 0x4000000,-32
-       ldgp    gp,0(pv)
-       lda     sp,-32(sp)                /* allocate stack space                 */
-       stq     gp,24(sp)                 /* save global pointer                  */
-       stq     ra,0(sp)                  /* save return address                  */
-       .prologue 1
-
-       stq     a0,16(sp)                 /* save method pointer for compiler     */
-       lda     v0,16(sp)                 /* pass pointer to method pointer via v0*/
-
-       mov     a1,a0                     /* pass the remaining parameters        */
-       mov     a2,a1
-       mov     a3,a2
-       mov     a4,a3
-
-       lda     $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
-       stq     $28,8(sp)                 /* store function address               */
-       mov     sp,$28                    /* set method pointer                   */
-
-       ldq     pv,8($28)                 /* method call as in Java               */
-       jmp     ra,(pv)                   /* call JIT compiler                    */
-calljava_jit:
-       lda     pv,-64(ra)                /* asm_calljavamethod-calljava_jit !!!!!*/
-
-calljava_return:
-
-       ldq     ra,0(sp)                  /* restore return address               */
-       ldq     gp,24(sp)                 /* restore global pointer               */
-       lda     sp,32(sp)                 /* free stack space                     */
-    clr     v0
-
-calljava_ret:
-       jmp     zero,(ra)
-
-calljava_xhandler:
-
-       ldq     gp,24(sp)                 /* restore global pointer               */
-       mov     itmp1,a0
-       jsr     ra,builtin_throw_exception
-       ldq     ra,0(sp)                  /* restore return address               */
-       lda     sp,32(sp)                 /* free stack space                     */
-       jmp     zero,(ra)
-       .end    asm_calljavamethod
-
-
-/********************* function asm_calljavafunction ***************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 address parameters.                                           *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_calljavafunction
-
-call_name2:
-       .ascii  "calljavafunction\0\0"
-
-       .align  3
-       .quad   0                         /* catch type all                       */
-       .quad   calljava_xhandler2        /* handler pc                           */
-       .quad   calljava_xhandler2        /* end pc                               */
-       .quad   asm_calljavafunction      /* start pc                             */
-       .long   1                         /* extable size                         */
-       .long   0                         /* fltsave                              */
-       .long   0                         /* intsave                              */
-       .long   0                         /* isleaf                               */
-       .long   0                         /* IsSync                               */
-       .long   32                        /* frame size                           */
-       .quad   0                         /* method pointer (pointer to name)     */
-
-asm_calljavafunction:
-
-       .frame $30,32,$26
-       .mask 0x4000000,-32
-       ldgp    gp,0(pv)
-       lda     sp,-32(sp)                /* allocate stack space                 */
-       stq     gp,24(sp)                 /* save global pointer                  */
-       stq     ra,0(sp)                  /* save return address                  */
-       .prologue 1
-
-       stq     a0,16(sp)                 /* save method pointer for compiler     */
-       lda     v0,16(sp)                 /* pass pointer to method pointer via v0*/
-
-       mov     a1,a0                     /* pass the remaining parameters        */
-       mov     a2,a1
-       mov     a3,a2
-       mov     a4,a3
-
-       lda     $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
-       stq     $28,8(sp)                 /* store function address               */
-       mov     sp,$28                    /* set method pointer                   */
-
-       ldq     pv,8($28)                 /* method call as in Java               */
-       jmp     ra,(pv)                   /* call JIT compiler                    */
-calljava_jit2:
-       lda     pv,-64(ra)                /* asm_calljavafunction-calljava_jit !!!!!*/
-
-calljava_return2:
-
-       ldq     ra,0(sp)                  /* restore return address               */
-       ldq     gp,24(sp)                 /* restore global pointer               */
-       lda     sp,32(sp)                 /* free stack space                     */
-
-calljava_ret2:
-       jmp     zero,(ra)
-
-calljava_xhandler2:
-
-       ldq     gp,24(sp)                 /* restore global pointer               */
-       mov     itmp1,a0
-       jsr     ra,builtin_throw_exception
-       ldq     ra,0(sp)                  /* restore return address               */
-       lda     sp,32(sp)                 /* free stack space                     */
-       jmp     zero,(ra)
-       .end    asm_calljavafunction
-                                               
-
-/****************** function asm_call_jit_compiler *****************************
-*                                                                              *
-*   invokes the compiler for untranslated JavaVM methods.                      *
-*                                                                              *
-*   Register R0 contains a pointer to the method info structure (prepared      *
-*   by createcompilerstub). Using the return address in R26 and the            *
-*   offset in the LDA instruction or using the value in methodptr R28 the      *
-*   patching address for storing the method address can be computed:           *
-*                                                                              *
-*   method address was either loaded using                                     *
-*   M_LDQ (REG_PV, REG_PV, a)        ; invokestatic/special    ($27)           *
-*   M_LDA (REG_PV, REG_RA, low)                                                *
-*   M_LDAH(REG_PV, REG_RA, high)     ; optional                                *
-*   or                                                                         *
-*   M_LDQ (REG_PV, REG_METHODPTR, m) ; invokevirtual/interface ($28)           *
-*   in the static case the method pointer can be computed using the            *
-*   return address and the lda function following the jmp instruction          *
-*                                                                              *
-*******************************************************************************/
-
-
-       .ent    asm_call_jit_compiler
-asm_call_jit_compiler:
-
-       .frame $30,0,$26
-       ldgp    gp,0(pv)
-       ldl     t8,-8(ra)             /* load instruction LDQ PV,xxx($yy)         */
-       srl     t8,16,t8              /* shift right register number $yy          */
-       and     t8,31,t8              /* isolate register number                  */
-       subl    t8,28,t8              /* test for REG_METHODPTR                   */
-       beq     t8,noregchange       
-       ldl     t8,0(ra)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t8,48,t8
-       sra     t8,48,t8              /* isolate offset                           */
-       addq    t8,ra,$28             /* compute update address                   */
-       ldl     t8,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
-       srl     t8,16,t8              /* isolate instruction code                 */
-       lda     t8,-0x177b(t8)        /* test for LDAH                            */
-       bne     t8,noregchange       
-       ldl     t8,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
-       sll     t8,16,t8              /* compute high offset                      */
-       addl    t8,0,t8               /* sign extend high offset                  */
-       addq    t8,$28,$28            /* compute update address                   */
-noregchange:
-       lda     sp,-14*8(sp)          /* reserve stack space                      */
-       stq     a0,0*8(sp)            /* save all argument registers              */
-       stq     a1,1*8(sp)            /* they could be used by method             */
-       stq     a2,2*8(sp)
-       stq     a3,3*8(sp)
-       stq     a4,4*8(sp)
-       stq     a5,5*8(sp)
-       stt     $f16,6*8(sp)
-       stt     $f17,7*8(sp)
-       stt     $f18,8*8(sp)
-       stt     $f19,9*8(sp)
-       stt     $f20,10*8(sp)
-       stt     $f21,11*8(sp)
-       stq     $28,12*8(sp)          /* save method pointer                      */
-       stq     ra,13*8(sp)           /* save return address                      */
-
-       ldq     a0,0(v0)              /* pass 'methodinfo' pointer to             */
-       jsr     ra,jit_compile        /* jit compiler                             */
-       ldgp    gp,0(ra)
-
-       call_pal PAL_imb              /* synchronise instruction cache            */
-
-       ldq     a0,0*8(sp)            /* load argument registers                  */
-       ldq     a1,1*8(sp)
-       ldq     a2,2*8(sp)
-       ldq     a3,3*8(sp)
-       ldq     a4,4*8(sp)
-       ldq     a5,5*8(sp)
-       ldt     $f16,6*8(sp)
-       ldt     $f17,7*8(sp)
-       ldt     $f18,8*8(sp)
-       ldt     $f19,9*8(sp)
-       ldt     $f20,10*8(sp)
-       ldt     $f21,11*8(sp)
-       ldq     $28,12*8(sp)          /* load method pointer                      */
-       ldq     ra,13*8(sp)           /* load return address                      */
-       lda     sp,14*8(sp)           /* deallocate stack area                    */
-
-       ldl     t8,-8(ra)             /* load instruction LDQ PV,xxx($yy)         */
-       sll     t8,48,t8
-       sra     t8,48,t8              /* isolate offset                           */
-
-       addq    t8,$28,t8             /* compute update address via method pointer*/
-       stq     v0,0(t8)              /* save new method address there            */
-
-       mov     v0,pv                 /* load method address into pv              */
-
-       jmp     zero,(pv)             /* and call method. The method returns      */
-                                     /* directly to the caller (ra).             */
-
-       .end    asm_call_jit_compiler
-
-
-/****************** function asm_dumpregistersandcall **************************
-*                                                                              *
-*   This funtion saves all callee saved registers and calls the function       *
-*   which is passed as parameter.                                              *
-*                                                                              *
-*   This function is needed by the garbage collector, which needs to access    *
-*   all registers which are stored on the stack. Unused registers are          *
-*   cleared to avoid interferances with the GC.                                *
-*                                                                              *
-*   void asm_dumpregistersandcall (functionptr f);                             *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_dumpregistersandcall
-asm_dumpregistersandcall:
-       lda     sp,-16*8(sp)          /* allocate stack                           */
-       stq     ra,0(sp)              /* save return address                      */
-
-       stq     s0,1*8(sp)            /* save all callee saved registers          */
-       stq     s1,2*8(sp)            /* intialize the remaining registers        */
-       stq     s2,3*8(sp)
-       stq     s3,4*8(sp)
-       stq     s4,5*8(sp)
-       stq     s5,6*8(sp)
-       stq     s6,7*8(sp)
-       stt     $f2,8*8(sp)
-       stt     $f3,9*8(sp)
-       stt     $f4,10*8(sp)
-       stt     $f5,11*8(sp)
-       stt     $f6,12*8(sp)
-       stt     $f7,13*8(sp)
-       stt     $f8,14*8(sp)
-       stt     $f9,15*8(sp)
-
-       clr     v0                   /* intialize the remaining registers         */
-       clr     t0
-       clr     t1
-       clr     t2
-       clr     t3
-       clr     t4
-       clr     t5
-       clr     t6
-       clr     t7
-       clr     a1
-       clr     a2
-       clr     a3
-       clr     a4
-       clr     a5
-       clr     t8
-       clr     t9
-       clr     t10
-       clr     t11
-       clr     t12
-       clr     $28
-       clr     $29
-       cpys    $f31,$f31,$f0
-       cpys    $f31,$f31,$f1
-       cpys    $f31,$f31,$f10
-       cpys    $f31,$f31,$f11
-       cpys    $f31,$f31,$f12
-       cpys    $f31,$f31,$f13
-       cpys    $f31,$f31,$f14
-       cpys    $f31,$f31,$f15
-       cpys    $f31,$f31,$f16
-       cpys    $f31,$f31,$f17
-       cpys    $f31,$f31,$f18
-       cpys    $f31,$f31,$f19
-       cpys    $f31,$f31,$f20
-       cpys    $f31,$f31,$f21
-       cpys    $f31,$f31,$f22
-       cpys    $f31,$f31,$f23
-       cpys    $f31,$f31,$f24
-       cpys    $f31,$f31,$f25
-       cpys    $f31,$f31,$f26
-       cpys    $f31,$f31,$f27
-       cpys    $f31,$f31,$f28
-       cpys    $f31,$f31,$f29
-       cpys    $f31,$f31,$f30
-
-       mov     a0,pv                 /* load function pointer                    */
-       jmp     ra,(pv)               /* and call function                        */
-
-       ldq     ra,0(sp)              /* load return address                      */
-       lda     sp,16*8(sp)           /* deallocate stack                         */
-       jmp     zero,(ra)             /* return                                   */
-
-       .end    asm_dumpregistersandcall
-
-
-/********************* function asm_handle_exception ***************************
-*                                                                              *
-*   This function handles an exception. It does not use the usual calling      *
-*   conventions. The exception pointer is passed in REG_ITMP1 and the          *
-*   pc from the exception raising position is passed in REG_ITMP2. It searches *
-*   the local exception table for a handler. If no one is found, it unwinds    *
-*   stacks and continues searching the callers.                                *
-*                                                                              *
-*   void asm_handle_exception (exceptionptr, exceptionpc);                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_handle_nat_exception
-asm_handle_nat_exception:
-
-       ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,48,t0
-       sra     t0,48,t0              /* isolate offset                           */
-       addq    t0,ra,pv              /* compute update address                   */
-       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
-       srl     t0,16,t0              /* isolate instruction code                 */
-       lda     t0,-0x177b(t0)        /* test for LDAH                            */
-       bne     t0,asm_handle_exception       
-       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
-       sll     t0,16,t0              /* compute high offset                      */
-       addl    t0,0,t0               /* sign extend high offset                  */
-       addq    t0,pv,pv              /* compute update address                   */
-
-       .aent    asm_handle_exception
-asm_handle_exception:
-
-       lda     sp,-18*8(sp)          /* allocate stack                           */
-       stq     t0,0*8(sp)            /* save possible used registers             */
-       stq     t1,1*8(sp)            /* also registers used by trace_exception   */
-       stq     t2,2*8(sp)
-       stq     t3,3*8(sp)
-       stq     t4,4*8(sp)
-       stq     t5,5*8(sp)
-       stq     t6,6*8(sp)
-       stq     t7,7*8(sp)
-       stq     t8,8*8(sp)
-       stq     t9,9*8(sp)
-       stq     t10,10*8(sp)
-       stq     v0,11*8(sp)
-       stq     a0,12*8(sp)
-       stq     a1,13*8(sp)
-       stq     a2,14*8(sp)
-       stq     a3,15*8(sp)
-       stq     a4,16*8(sp)
-       stq     a5,17*8(sp)
-
-       lda     t3,1(zero)            /* set no unwind flag                       */
-ex_stack_loop:
-       lda     sp,-5*8(sp)           /* allocate stack                           */
-       stq     xptr,0*8(sp)          /* save used register                       */
-       stq     xpc,1*8(sp)
-       stq     pv,2*8(sp)
-       stq     ra,3*8(sp)
-       stq     t3,4*8(sp)
-
-       mov     xptr,a0
-       ldq     a1,MethodPointer(pv)
-       mov     xpc,a2
-       mov     t3,a3
-       br      ra,ex_trace           /* set ra for gp loading                    */
-ex_trace:
-       ldgp    gp,0(ra)              /* load gp                                  */
-       jsr     ra,builtin_trace_exception /* trace_exception(xptr,methodptr)     */
-       
-       ldq     xptr,0*8(sp)          /* restore used register                    */
-       ldq     xpc,1*8(sp)
-       ldq     pv,2*8(sp)
-       ldq     ra,3*8(sp)
-       ldq     t3,4*8(sp)
-       lda     sp,5*8(sp)            /* deallocate stack                         */
-       
-       ldl     t0,ExTableSize(pv)    /* t0 = exception table size                */
-       beq     t0,empty_table        /* if empty table skip                      */
-       lda     t1,ExTableStart(pv)   /* t1 = start of exception table            */
-
-ex_table_loop:
-       ldq     t2,ExStartPC(t1)      /* t2 = exception start pc                  */
-       cmple   t2,xpc,t2             /* t2 = (startpc <= xpc)                    */
-       beq     t2,ex_table_cont      /* if (false) continue                      */
-       ldq     t2,ExEndPC(t1)        /* t2 = exception end pc                    */
-       cmplt   xpc,t2,t2             /* t2 = (xpc < endpc)                       */
-       beq     t2,ex_table_cont      /* if (false) continue                      */
-       ldq     a1,ExCatchType(t1)    /* arg1 = exception catch type              */
-       beq     a1,ex_handle_it       /* NULL catches everything                  */
-
-       ldq     a0,offobjvftbl(xptr)  /* a0 = vftblptr(xptr)                      */
-       ldq     a1,offobjvftbl(a1)    /* a1 = vftblptr(catchtype) class (not obj) */
-       ldl     a0,offbaseval(a0)     /* a0 = baseval(xptr)                       */
-       ldl     v0,offbaseval(a1)     /* a2 = baseval(catchtype)                  */
-       ldl     a1,offdiffval(a1)     /* a1 = diffval(catchtype)                  */
-       subl    a0,v0,a0              /* a0 = baseval(xptr) - baseval(catchtype)  */
-       cmpule  a0,a1,v0              /* v0 = xptr is instanceof catchtype        */
-       beq     v0,ex_table_cont      /* if (false) continue                      */
-
-ex_handle_it:
-
-       ldq     xpc,ExHandlerPC(t1)   /* xpc = exception handler pc               */
-
-       beq     t3,ex_jump            /* if (!(no stack unwinding) skip           */
-
-       ldq     t0,0*8(sp)            /* restore possible used registers          */
-       ldq     t1,1*8(sp)            /* also registers used by trace_exception   */
-       ldq     t2,2*8(sp)
-       ldq     t3,3*8(sp)
-       ldq     t4,4*8(sp)
-       ldq     t5,5*8(sp)
-       ldq     t6,6*8(sp)
-       ldq     t7,7*8(sp)
-       ldq     t8,8*8(sp)
-       ldq     t9,9*8(sp)
-       ldq     t10,10*8(sp)
-       ldq     v0,11*8(sp)
-       ldq     a0,12*8(sp)
-       ldq     a1,13*8(sp)
-       ldq     a2,14*8(sp)
-       ldq     a3,15*8(sp)
-       ldq     a4,16*8(sp)
-       ldq     a5,17*8(sp)
-       lda     sp,18*8(sp)           /* deallocate stack                         */
-
-ex_jump:
-       jmp     zero,(xpc)            /* jump to the handler                      */
-
-ex_table_cont:
-       lda     t1,ExEntrySize(t1)    /* next exception table entry               */
-       subl    t0,1,t0               /* decrement entry counter                  */
-       bgt     t0,ex_table_loop      /* if (t0 > 0) next entry                   */
-
-empty_table:
-       beq     t3,ex_already_cleared /* if here the first time, then             */
-       lda     sp,18*8(sp)           /* deallocate stack and                     */
-       clr     t3                    /* clear the no unwind flag                 */
-ex_already_cleared:
-       ldl     t0,IsSync(pv)         /* t0 = SyncOffset                          */
-       beq     t0,no_monitor_exit    /* if zero no monitorexit                   */
-       addq    sp,t0,t0              /* add stackptr to Offset                   */
-       ldq     a0,-8(t0)             /* load monitorexit pointer                 */
-
-       lda     sp,-7*8(sp)           /* allocate stack                           */
-       stq     t0,0*8(sp)            /* save used register                       */
-       stq     t1,1*8(sp)
-       stq     t3,2*8(sp)
-       stq     xptr,3*8(sp)
-       stq     xpc,4*8(sp)
-       stq     pv,5*8(sp)
-       stq     ra,6*8(sp)
-
-       br      ra,ex_mon_load        /* set ra for gp loading                    */
-ex_mon_load:
-       ldgp    gp,0(ra)              /* load gp                                  */
-       jsr     ra,builtin_monitorexit/* builtin_monitorexit(objectptr)           */
-       
-       ldq     t0,0*8(sp)            /* restore used register                    */
-       ldq     t1,1*8(sp)
-       ldq     t3,2*8(sp)
-       ldq     xptr,3*8(sp)
-       ldq     xpc,4*8(sp)
-       ldq     pv,5*8(sp)
-       ldq     ra,6*8(sp)
-       lda     sp,7*8(sp)            /* deallocate stack                         */
-
-no_monitor_exit:
-       ldl     t0,FrameSize(pv)      /* t0 = frame size                          */
-       addq    sp,t0,sp              /* unwind stack                             */
-       mov     sp,t0                 /* t0 = pointer to save area                */
-       ldl     t1,IsLeaf(pv)         /* t1 = is leaf procedure                   */
-       bne     t1,ex_no_restore      /* if (leaf) skip                           */
-       ldq     ra,-8(t0)             /* restore ra                               */
-       lda     t0,-8(t0)             /* t0--                                     */
-ex_no_restore:
-       mov     ra,xpc                /* the new xpc is ra                        */
-       ldl     t1,IntSave(pv)        /* t1 = saved int register count            */
-       br      t2,ex_int1            /* t2 = current pc                          */
-ex_int1:
-       lda     t2,44(t2)             /* lda t2,ex_int2-ex_int1(t2) !!!!!!!!!!!!! */
-       negl    t1,t1                 /* negate register count                    */
-       s4addq  t1,t2,t2              /* t2 = ex_int_sav - 4 * register count     */
-       jmp     zero,(t2)             /* jump to save position                    */
-       ldq     s0,-56(t0)
-       ldq     s1,-48(t0)
-       ldq     s2,-40(t0)
-       ldq     s3,-32(t0)
-       ldq     s4,-24(t0)
-       ldq     s5,-16(t0)
-       ldq     s6,-8(t0)
-ex_int2:
-       s8addq  t1,t0,t0              /* t0 = t0 - 8 * register count             */
-
-       ldl     t1,FltSave(pv)        /* t1 = saved flt register count            */
-       br      t2,ex_flt1            /* t2 = current pc                          */
-ex_flt1:
-       lda     t2,48(t2)             /* lda t2,ex_flt2-ex_flt1(t2) !!!!!!!!!!!!! */
-       negl    t1,t1                 /* negate register count                    */
-       s4addq  t1,t2,t2              /* t2 = ex_flt_sav - 4 * register count     */
-       jmp     zero,(t2)             /* jump to save position                    */
-       ldt     $f2,-64(t0)
-       ldt     $f3,-56(t0)
-       ldt     $f4,-48(t0)
-       ldt     $f5,-40(t0)
-       ldt     $f6,-32(t0)
-       ldt     $f7,-24(t0)
-       ldt     $f8,-16(t0)
-       ldt     $f9,-8(t0)
-ex_flt2:
-       ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,48,t0
-       sra     t0,48,t0              /* isolate offset                           */
-       addq    t0,ra,pv              /* compute update address                   */
-       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
-       srl     t0,16,t0              /* isolate instruction code                 */
-       lda     t0,-0x177b(t0)        /* test for LDAH                            */
-       bne     t0,ex_stack_loop       
-       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(RA)         */
-       sll     t0,16,t0              /* compute high offset                      */
-       addl    t0,0,t0               /* sign extend high offset                  */
-       addq    t0,pv,pv              /* compute update address                   */
-       br      ex_stack_loop
-
-       .end    asm_handle_nat_exception
-
-
-/********************* function asm_builtin_monitorenter ***********************
-*                                                                              *
-*   Does null check and calls monitorenter or throws an exception              *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_monitorenter
-asm_builtin_monitorenter:
-
-       ldgp    gp,0(pv)
-       lda     pv,builtin_monitorenter
-       beq     a0,nb_monitorenter        /* if (null) throw exception            */
-       jmp     zero,(pv)                 /* else call builtin_monitorenter       */
-
-nb_monitorenter:
-       ldq     xptr,proto_java_lang_NullPointerException
-       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
-       br      asm_handle_nat_exception
-       .end    asm_builtin_monitorenter
-
-
-/********************* function asm_builtin_monitorexit ************************
-*                                                                              *
-*   Does null check and calls monitorexit or throws an exception               *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_monitorexit
-asm_builtin_monitorexit:
-
-       ldgp    gp,0(pv)
-       lda     pv,builtin_monitorexit
-       beq     a0,nb_monitorexit         /* if (null) throw exception            */
-       jmp     zero,(pv)                 /* else call builtin_monitorexit        */
-
-nb_monitorexit:
-       ldq     xptr,proto_java_lang_NullPointerException
-       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
-       br      asm_handle_nat_exception
-       .end    asm_builtin_monitorexit
-
-
-/************************ function asm_builtin_idiv ****************************
-*                                                                              *
-*   Does null check and calls idiv or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_idiv
-asm_builtin_idiv:
-
-       ldgp    gp,0(pv)
-       lda     pv,builtin_idiv
-       beq     a1,nb_idiv                /* if (null) throw exception            */
-       jmp     zero,(pv)                 /* else call builtin_idiv               */
-
-nb_idiv:
-       ldq     xptr,proto_java_lang_ArithmeticException
-       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
-       br      asm_handle_nat_exception
-       .end    asm_builtin_idiv
-
-
-/************************ function asm_builtin_ldiv ****************************
-*                                                                              *
-*   Does null check and calls ldiv or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_ldiv
-asm_builtin_ldiv:
-
-       ldgp    gp,0(pv)
-       lda     pv,builtin_ldiv
-       beq     a1,nb_ldiv                /* if (null) throw exception            */
-       jmp     zero,(pv)                 /* else call builtin_ldiv               */
-
-nb_ldiv:
-       ldq     xptr,proto_java_lang_ArithmeticException
-       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
-       br      asm_handle_nat_exception
-       .end    asm_builtin_ldiv
-
-
-/************************ function asm_builtin_irem ****************************
-*                                                                              *
-*   Does null check and calls irem or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_irem
-asm_builtin_irem:
-
-       ldgp    gp,0(pv)
-       lda     pv,builtin_irem
-       beq     a1,nb_irem                /* if (null) throw exception            */
-       jmp     zero,(pv)                 /* else call builtin_irem               */
-
-nb_irem:
-       ldq     xptr,proto_java_lang_ArithmeticException
-       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
-       br      asm_handle_nat_exception
-       .end    asm_builtin_irem
-
-
-/************************ function asm_builtin_lrem ****************************
-*                                                                              *
-*   Does null check and calls lrem or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_lrem
-asm_builtin_lrem:
-
-       ldgp    gp,0(pv)
-       lda     pv,builtin_lrem
-       beq     a1,nb_lrem                /* if (null) throw exception            */
-       jmp     zero,(pv)                 /* else call builtin_lrem               */
-
-nb_lrem:
-       ldq     xptr,proto_java_lang_ArithmeticException
-       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
-       br      asm_handle_nat_exception
-       .end    asm_builtin_lrem
-
-
- /*********************** function new_builtin_checkcast ************************
- *                                                                              *
- *   Does the cast check and eventually throws an exception                     *
- *                                                                              *
- *******************************************************************************/
-
-    .ent    asm_builtin_checkcast
-asm_builtin_checkcast:
-
-    ldgp    gp,0(pv)
-    lda     sp,-16(sp)                  # allocate stack space
-    stq     ra,0(sp)                    # save return address
-    stq     a0,8(sp)                    # save object pointer
-    jsr     ra,builtin_checkcast        # builtin_checkcast
-    ldgp    gp,0(ra)
-    beq     v0,nb_ccast_throw           # if (false) throw exception
-    ldq     ra,0(sp)                    # restore return address
-    ldq     v0,8(sp)                    # return object pointer
-    lda     sp,16(sp)                   # free stack space
-    jmp     zero,(ra)
-
-nb_ccast_throw:
-    ldq     xptr,proto_java_lang_ClassCastException
-    ldq     ra,0(sp)                    # restore return address
-    lda     sp,16(sp)                   # free stack space
-    lda     xpc,-4(ra)                  # faulting address is return adress - 4
-    br      asm_handle_nat_exception
-    .end    asm_builtin_checkcast
-
-               
-/******************* function asm_builtin_checkarraycast ***********************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_checkarraycast
-asm_builtin_checkarraycast:
-
-       ldgp    gp,0(pv)
-       lda     sp,-16(sp)                /* allocate stack space                 */
-       stq     ra,0(sp)                  /* save return address                  */
-       stq     a0,8(sp)                  /* save object pointer                  */
-       jsr     ra,builtin_checkarraycast /* builtin_checkarraycast               */
-       ldgp    gp,0(ra)
-       beq     v0,nb_carray_throw        /* if (false) throw exception           */
-       ldq     ra,0(sp)                  /* restore return address               */
-       ldq     v0,8(sp)                  /* return object pointer                */
-       lda     sp,16(sp)                 /* free stack space                     */
-       jmp     zero,(ra)
-
-nb_carray_throw:
-       ldq     xptr,proto_java_lang_ClassCastException
-       ldq     ra,0(sp)                  /* restore return address               */
-       lda     sp,16(sp)                 /* free stack space                     */
-       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
-       br      asm_handle_nat_exception
-       .end    asm_builtin_checkarraycast
-
-
-/******************* function asm_builtin_aastore ******************************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_aastore
-asm_builtin_aastore:
-
-       ldgp    gp,0(pv)
-       beq     a0,nb_aastore_null        /* if null pointer throw exception      */
-       ldl     t0,offarraysize(a0)       /* load size                            */
-       lda     sp,-24(sp)                /* allocate stack space                 */
-       stq     ra,0(sp)                  /* save return address                  */
-       s8addq  a1,a0,t1                  /* add index*8 to arrayref              */
-       cmpult  a1,t0,t0                  /* do bound check                       */
-       beq     t0,nb_aastore_bound       /* if out of bounds throw exception     */
-       mov     a2,a1                     /* object is second argument            */
-       stq     t1,8(sp)                  /* save store position                  */
-       stq     a1,16(sp)                 /* save object                          */
-       jsr     ra,builtin_canstore       /* builtin_canstore(arrayref,object)    */
-       ldgp    gp,0(ra)
-       ldq     ra,0(sp)                  /* restore return address               */
-       ldq     a0,8(sp)                  /* restore store position               */
-       ldq     a1,16(sp)                 /* restore object                       */
-       lda     sp,24(sp)                 /* free stack space                     */
-       beq     v0,nb_aastore_throw       /* if (false) throw exception           */
-       stq     a1,offobjarrdata(a0)      /* store objectptr in array             */
-       jmp     zero,(ra)
-
-nb_aastore_null:
-       ldq     xptr,proto_java_lang_NullPointerException
-       mov     ra,xpc                    /* faulting address is return adress    */
-       br      asm_handle_nat_exception
-
-nb_aastore_bound:
-       ldq     xptr,proto_java_lang_ArrayIndexOutOfBoundsException
-       lda     sp,24(sp)                 /* free stack space                     */
-       mov     ra,xpc                    /* faulting address is return adress    */
-       br      asm_handle_nat_exception
-
-nb_aastore_throw:
-       ldq     xptr,proto_java_lang_ArrayStoreException
-       mov     ra,xpc                    /* faulting address is return adress    */
-       br      asm_handle_nat_exception
-
-       .end    asm_builtin_aastore
-
-
-/******************* function asm_initialize_thread_stack **********************
-*                                                                              *
-*   initialized a thread stack                                                 *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_initialize_thread_stack
-asm_initialize_thread_stack:
-
-       lda     a1,-128(a1)
-       stq     zero, 0(a1)
-       stq     zero, 8(a1)
-       stq     zero, 16(a1)
-       stq     zero, 24(a1)
-       stq     zero, 32(a1)
-       stq     zero, 40(a1)
-       stq     zero, 48(a1)
-       stt     fzero, 56(a1)
-       stt     fzero, 64(a1)
-       stt     fzero, 72(a1)
-       stt     fzero, 80(a1)
-       stt     fzero, 88(a1)
-       stt     fzero, 96(a1)
-       stt     fzero, 104(a1)
-       stt     fzero, 112(a1)
-       stq     a0, 120(a1)
-       mov     a1, v0
-       jmp     zero,(ra)
-       .end    asm_initialize_thread_stack
-
-
-/******************* function asm_perform_threadswitch *************************
-*                                                                              *
-*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
-*                                                                              *
-*   performs a threadswitch                                                    *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_perform_threadswitch
-asm_perform_threadswitch:
-
-       subq    sp,128,sp
-       stq     s0, 0(sp)
-       stq     s1, 8(sp)
-       stq     s2, 16(sp)
-       stq     s3, 24(sp)
-       stq     s4, 32(sp)
-       stq     s5, 40(sp)
-       stq     s6, 48(sp)
-       stt     sf0, 56(sp)
-       stt     sf1, 64(sp)
-       stt     sf2, 72(sp)
-       stt     sf3, 80(sp)
-       stt     sf4, 88(sp)
-       stt     sf5, 96(sp)
-       stt     sf6, 104(sp)
-       stt     sf7, 112(sp)
-       stq     ra, 120(sp)
-       stq     sp, 0(a0)
-       stq     sp, 0(a2)
-       ldq     sp, 0(a1)
-       ldq     s0, 0(sp)
-       ldq     s1, 8(sp)
-       ldq     s2, 16(sp)
-       ldq     s3, 24(sp)
-       ldq     s4, 32(sp)
-       ldq     s5, 40(sp)
-       ldq     s6, 48(sp)
-       ldt     sf0, 56(sp)
-       ldt     sf1, 64(sp)
-       ldt     sf2, 72(sp)
-       ldt     sf3, 80(sp)
-       ldt     sf4, 88(sp)
-       ldt     sf5, 96(sp)
-       ldt     sf6, 104(sp)
-       ldt     sf7, 112(sp)
-       ldq     ra, 120(sp)
-       mov     ra, pv
-       addq    sp, 128, sp
-       jmp     zero,(ra)
-       .end    asm_perform_threadswitch
-
-
-/********************* function asm_switchstackandcall *************************
-*                                                                              *
-*  void *asm_switchstackandcall (void *stack, void *func, void **stacktopsave, *
-*                               void *p);                                      *
-*                                                                              *
-*   Switches to a new stack, calls a function and switches back.               *
-*       a0      new stack pointer                                              *
-*       a1      function pointer                                               *
-*              a2              pointer to variable where stack top should be stored           *
-*              a3      pointer to user data, is passed to the function                *
-*                                                                              *
-*******************************************************************************/
-
-
-       .ent    asm_switchstackandcall
-asm_switchstackandcall:
-       lda     a0,-2*8(a0)     /* allocate new stack                                 */
-       stq     ra,0(a0)        /* save return address on new stack                   */
-       stq     sp,1*8(a0)      /* save old stack pointer on new stack                */
-       stq sp,0(a2)        /* save old stack pointer to variable                 */
-       mov     a0,sp           /* switch to new stack                                */
-       
-       mov     a1,pv           /* load function pointer                              */
-       mov a3,a0           /* pass pointer */
-       jmp     ra,(pv)         /* and call function                                  */
-
-       ldq     ra,0(sp)        /* load return address                                */
-       ldq     sp,1*8(sp)      /* switch to old stack                                */
-
-       jmp     zero,(ra)       /* return                                             */
-
-       .end    asm_switchstackandcall
-
-               
-/********************* function asm_getcallingmethod ***************************
-*                                                                              *
-*   classinfo *asm_getcallingmethodclass ();                                                              *
-*                                                                                                                                                         *    
-*   goes back stack frames to get the calling method                                              *       
-*                                                                                                                                                         *    
-*                              t2 .. sp                                                                                                       *
-*                              t3 .. ra                                                                                                       *
-*                              t4 .. pv                                                                                                       *
-*                                                                              *
-*******************************************************************************/
-
-
-       .ent    asm_getcallingmethod
-asm_getcallingmethod:
-
-       ldq             t3,16(sp)             /* load return address of native function   */                            
-       addq    sp,24,t2                          /* skip frames of C-Function and nativestub */        
-               
-    /* determine pv (t3) of java-function from ra */
-
-       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,48,t0
-       sra     t0,48,t0              /* isolate offset                           */
-       addq    t0,t3,t4              /* compute update address                   */
-       ldl     t0,4(t3)              /* load instruction LDAH PV,xxx(PV)         */
-       srl     t0,16,t0              /* isolate instruction code                 */
-       lda     t0,-0x177b(t0)        /* test for LDAH                            */
-       bne     t0,pv_ok1       
-       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,16,t0              /* compute high offset                      */
-       addl    t0,0,t0               /* sign extend high offset                  */
-       addq    t0,t4,t4              /* compute update address                   */
-
-pv_ok1:                        
-       ldl     t0,FrameSize(t4)      /* t0 = frame size                          */            
-       addq    t2,t0,t2                          /* skip frame of java function                          */
-       ldq             t3,-8(t2)                         /* load new ra                              */                                                                
-
-    /* determine pv (t3) of java-function from ra */
-
-       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,48,t0
-       sra     t0,48,t0              /* isolate offset                           */
-       addq    t0,t3,t4              /* compute update address                   */
-       ldl     t0,4(t3)              /* load instruction LDAH PV,xxx(PV)         */
-       srl     t0,16,t0              /* isolate instruction code                 */
-       lda     t0,-0x177b(t0)        /* test for LDAH                            */
-       bne     t0,pv_ok2
-       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,16,t0              /* compute high offset                      */
-       addl    t0,0,t0               /* sign extend high offset                  */
-       addq    t0,t4,t4              /* compute update address                   */
-
-pv_ok2:                
-       ldq     v0,MethodPointer(t4)  /*                                                                                  */
-
-                                                                               
-       jmp     zero,(ra)                                 /* return                                   */
-
-       .end    asm_getcallingmethod
-
-
-
-
-
-
-
-
-/*********************** function asm_builtin_trace ****************************
-*                                                                              *
-*   Intended to be called from the native stub. Saves all argument registers   *
-*   and calls builtin_trace_args.                                              *
-*                                                                              *
-*******************************************************************************/
-
-       .ent asm_builtin_trace
-asm_builtin_trace:
-       ldgp gp,0(pv)
-       lda sp,-112(sp)
-       stq itmp1,0(sp)
-       stq ra,8(sp)
-       stq a0,16(sp)
-       stq a1,24(sp)
-       stq a2,32(sp)
-       stq a3,40(sp)
-       stq a4,48(sp)
-       stq a5,56(sp)
-       stt $f16,64(sp)
-       stt $f17,72(sp)
-       stt $f18,80(sp)
-       stt $f19,88(sp)
-       stt $f20,96(sp)
-       stt $f21,104(sp)
-       
-       jsr ra,builtin_trace_args
-       
-       ldq ra,8(sp)
-       ldq a0,16(sp)
-       ldq a1,24(sp)
-       ldq a2,32(sp)
-       ldq a3,40(sp)
-       ldq a4,48(sp)
-       ldq a5,56(sp)
-       ldt $f16,64(sp)
-       ldt $f17,72(sp)
-       ldt $f18,80(sp)
-       ldt $f19,88(sp)
-       ldt $f20,96(sp)
-       ldt $f21,104(sp)
-       lda sp,112(sp)
-       jmp zero,(ra)
-
-       .end asm_builtin_trace
-
-
-/********************* function asm_builtin_exittrace **************************
-*                                                                              *
-*   Intended to be called from the native stub. Saves return value and calls   *
-*   builtin_displaymethodstop.                                                 *
-*                                                                              *
-*******************************************************************************/
-
-       .ent asm_builtin_exittrace
-asm_builtin_exittrace:
-       ldgp gp,0(pv)
-       lda sp,-24(sp)
-       stq ra,0(sp)
-       stq v0,8(sp)
-       stt $f0,16(sp)
-       
-       jsr ra,builtin_displaymethodstop
-       
-       ldq ra,0(sp)
-       ldq v0,8(sp)
-       ldt $f0,16(sp)
-       lda sp,24(sp)
-       jmp zero,(ra)
-
-       .end asm_builtin_exittrace
diff --git a/alpha/calling.doc b/alpha/calling.doc
deleted file mode 100644 (file)
index 7dff369..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/* calling.doc *****************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    A short description of Alpha calling conventions and register usage.
-
-    Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-             Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: 2003/03/07
-
-*******************************************************************************/
-
-Short documentation of the Java calling conventions for the Alpha.
-
---------------------------------------------------------------------------------
-
-
-The calling conventions basically follow the conventions for normal C
-functions. However, the R28 register has a special meaning:
-
-R28 ..... contains a pointer to the correct 'methodinfo' structure for this
-          method, in case it has to be passed on to the JIT compiler.
-
-          If Java methods call C functions directly (C functions don't have
-          'methodinfo' structures associated naturally), the value of this
-          register is undefined. Every function called by the JavaVM
-          (builtin_new, etc.) is called this way.
-
-R27 (pv)  This register needs to maintain its value all the time. It must
-                 be restored after each method call. More importantly, the code
-                 sequence for this operation is standardized and is interpreted
-                 by the exception handling code.
-
-
-The other registers are used according to the standard Alpha calling
-conventions. Here is a summary of the usage:
-
-integer registers:
-
-R0 ........ method result value for types INT, LONG and ADDRESS
-
-R1-R8 ..... temporary registers (destroyed by called method)
-
-R9-R15 .... saved registers (left unchanged by called method)
-
-R16-R21 ... argument registers 0 - 5 (contain the first six method arguments
-            of type INT, LONG and ADDRESS. Argument registers are destroyed
-            by called method)
-
-R22-R24 ... temporary registers (destroyed by called method)
-
-R25 ....... code generator temporary register (destroyed by called method)
-
-R26 (ra) .. return address (left unchanged by called method)
-
-R27 (pv) .. procedure vector, points to the first instruction of the called
-            method. This vector is used for addressing the entries in the
-            data segment. The ov of the caller is recomputed from the ra.
-            Therefore it is necessary that a return is always done using ra.
-
-R28 ....... pointer to 'methodinfo' structure. This register has to be set
-            correctly, because it is needed in the case the jit is invoked.
-            Also used as code generator temporary register. It isdestroyed
-            by called method)
-
-R29 ....... code generator temporary register (destroyed by called method)
-
-R30 (sp) .. stack pointer. The stack grows from high to low.
-
-R31 ....... always contains zero
-
-floating point registers:
-
-F0 ........ method result value for types FLOAT and DOUBLE
-
-F1 ........ temporary register (destroyed by called method)
-                                
-F2-F9 ..... saved registers (left unchanged by called method)
-
-F10-F15 ... temporary registers (destroyed by called method)
-
-F16-F21 ... argument registers 0 - 5 (contain the first six method arguments
-            of type FLOAT and DOUBLE. Argument registers are destroyed
-            by called method)
-F22-F27 ... temporary registers (destroyed by called method)
-
-F28-F30 ... code generator temporary register (destroyed by called method)
-
-F31 ....... always contains zero
-
-
-
-
-PARAMETER PASSING ON THE STACK:
-
-Only six parameters can be passed in registers, so every argument beginning
-from the seventh needs to use the stack, according to the following
-conventions:
-
-
-                  | .....                                          |
-                  --------------------------------------------------
-                  |  Parameter 9  ( 64 bit regardless of type)     |
-                  --------------------------------------------------
-                  |  Parameter 8  ( 64 bit regardless of type)     |
-                  --------------------------------------------------
-   R30 (sp) --->  |  Parameter 7  ( 64 bit regardless of type)     |
-                  --------------------------------------------------
-  
-The stack pointer points at the bottom of the parameter passing area.
-
-
-
-
-
-ENTIRE STACK FRAME LAYOUT:
-
-Each method (except leaf methods which make no further calls) need to save
-some registers on the stack.  Possibly a method also needs to use part of the
-stack frame as spill area for local values. Parameter passing for more than
-six parameters requires stack space as well.
-
-An entire stack frame looks like this (each entry is exactly 64 bits long,
-sizes are given in multiples of 64 bit units):
-    
-            ---------------------------------------------
-            |  parameter n (passed from caller)         |
-            ---------------------------------------------   
-            |  parameter n-1                            |
-            ---------------------------------------------
-            | ...                                       |
-            ---------------------------------------------
-            |  parameter 7                              |
-old SP ---> ============================================= --- parentargs_base
-            |  saved RA                                 |
-            ---------------------------------------------     savedregs_num
-            |  others saved registers                   |
-            ============================================= --- maxmemuse + 1
-            |  optional monitor_exit argument           |
-            ============================================= --- maxmemuse
-            |  area for spilled registers               |
-            =============================================
-            |  ....                                     |
-            ---------------------------------------------
-            |  parameter 8                              |
-            ---------------------------------------------
-            |  parameter 7 (passed to called method)    |
-new SP ---> =============================================
diff --git a/alpha/cray.c b/alpha/cray.c
deleted file mode 100644 (file)
index b585bc4..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-/****************************** asmpart.c **************************************
-*                                                                              *
-*   is an assembly language file, but called .c to fake the preprocessor.      *
-*   It contains the Java-C interace functions for Alpha processors.           *
-*                                                                              *
-*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
-*                                                                              *
-*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
-*                                                                              *
-*   Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
-*            Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
-*                                                                              *
-*   Last Change: 1997/04/26                                                    *
-*                                                                              *
-*******************************************************************************/
-
-#define v0      r0
-
-#define t0      r1
-#define t1      r2
-#define t2      r3
-#define t3      r4
-#define t4      r5
-#define t5      r6
-#define t6      r7
-#define t7      r8
-
-#define        s0      r9
-#define        s1      r10
-#define        s2      r11
-#define        s3      r12
-#define        s4      r13
-#define        s5      r14
-#define        s6      r15
-
-#define a0      r16
-#define a1      r17
-#define a2      r18
-#define a3      r19
-#define a4      r20
-#define a5      r21
-
-#define t8      r22
-#define t9      r23
-#define t10     r24
-#define t11     r25
-#define ra      r26
-#define t12     r27
-
-#define pv      t12
-#define AT      .
-#define gp      r29
-#define sp      r30
-#define zero    r31
-
-#define PAL_imb 134
-
-
-/*     .set    noat
-       .set    noreorder
-*/
-
-       
-/********************* exported functions and variables ***********************/
-
-/*     .globl has_no_x_instr_set
-       .globl synchronize_caches
-       .globl asm_calljavamethod
-       .globl asm_call_jit_compiler
-       .globl asm_dumpregistersandcall
-*/
-
-/*************************** imported functions *******************************/
-
-/*     .globl  compiler_compile
-*/
-
-/*********************** function has_no_x_instr_set ***************************
-*                                                                              *
-*   determines if the byte support instruction set (21164a and higher)         *
-*   is available.                                                              *
-*                                                                              *
-*******************************************************************************/
-       zero <- t0
-       
-       .ident    has_no_x_instr_set
-       .psect code_sec, code
-has_no_x_instr_set::
-
-/*     .long   0x47e03c20                  ; amask   1,r0
-*/
-
-       zap   r0,1,r0
-
-       jmp     zero,(ra)                   ; return
-
-       .end    has_no_x_instr_set
-
-
-/********************* function synchronize_caches ****************************/
-
-       .ident    synchronize_caches
-       .psect code_sec, code
-synchronize_caches::
-
-       call_pal PAL_imb                    ; synchronise instruction cache
-       jmp     zero,(ra)                   ; return
-
-       .end    synchronize_caches
-
-
-
-/********************* function asm_calljavamethod *****************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 parameters.                                                   *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   An possibly throwed exception will be returned to the caller as function   *
-*   return value, so the java method cannot return a fucntion value (this      *
-*   function usually calls 'main' and '<clinit>' which do not return a         *
-*   function value).                                                           *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ident    asm_calljavamethod
-       .psect codesect3, code
-       .external asm_call_jit_compiler
-       
-asm_calljavamethod::
-
-;      ldgp    gp,0(pv)
-;      .prologue  1
-       lda     sp,-24(sp)                  ; allocate stack space
-       stq     ra,0(sp)                    ; save return address
-
-       stq     r16,16(sp)                  ; save method pointer for compiler
-       lda     r0,16(sp)                   ; pass pointer to method pointer via r0
-
-       bis     r17,r17,r16                 ; pass the remaining parameters
-       bis     r18,r18,r17
-       bis     r19,r19,r18
-       bis     r20,r20,r19
-
-       la     r28,asm_call_jit_compiler   ; fake virtual function call
-       ; Changed!! from lda
-       
-       stq     r28,8(sp)                   ; store function address
-       bis     sp,sp,r28                   ; set method pointer
-
-       ldq     pv,8(r28)                   ; method call as in Java
-       jmp     ra,(pv)                     ; call JIT compiler
-
-       ldq     ra,0(sp)                    ; restore return address
-       lda     sp,24(sp)                   ; free stack space
-
-       bis     r1,r1,r0                    ; pass exception to caller (C)
-       jmp     zero,(ra)
-
-       .end    asm_calljavamethod
-
-
-/****************** function asm_call_jit_compiler *****************************
-*                                                                              *
-*   invokes the compiler for untranslated JavaVM methods.                      *
-*                                                                              *
-*   Register R0 contains a pointer to the method info structure (prepared      *
-*   by createcompilerstub). Using the return address in R26 and the            *
-*   offset in the LDA instruction or using the value in methodptr R28 the      *
-*   patching address for storing the method address can be computed:           *
-*                                                                              *
-*   method address was either loaded using                                     *
-*   M_LDQ (REG_PV, REG_PV, a)        ; invokestatic/special    (r27)           *
-*   M_LDA (REG_PV, REG_RA, low)                                                *
-*   M_LDAH(REG_PV, REG_RA, high)     ; optional                                *
-*   or                                                                         *
-*   M_LDQ (REG_PV, REG_METHODPTR, m) ; invokevirtual/interace (r28)           *
-*   in the static case the method pointer can be computed using the            *
-*   return address and the lda function following the jmp instruction          *
-*                                                                              *
-*******************************************************************************/
-
-
-       .ident    asm_call_jit_compiler
-       .psect code_sec1, code
-       .external compiler_compile
-
-asm_call_jit_compiler::
-
-;      ldgp    gp,0(pv)
-;      .prologue  1
-       ldl     r22,-8(ra)              ; load instruction LDQ PV,xxx(ryy)
-       srl     r22,16,r22              ; shift right register number ryy
-       and     r22,31,r22              ; isolate register number
-       subl    r22,28,r22              ; test for REG_METHODPTR
-       beq     r22,noregchange       
-       ldl     r22,0(ra)               ; load instruction LDA PV,xxx(RA)
-       sll     r22,48,r22
-       sra     r22,48,r22              ; isolate offset
-       addq    r22,ra,r28              ; compute update address
-       ldl     r22,4(ra)               ; load instruction LDAH PV,xxx(PV)
-       srl     r22,16,r22              ; isolate instruction code
-       lda     r22,-0x177b(r22)        ; test for LDAH
-       bne     r22,noregchange       
-       ldl     r22,0(ra)               ; load instruction LDA PV,xxx(RA)
-       sll     r22,16,r22              ; compute high offset
-       addl    r22,0,r22               ; sign extend high offset
-       addq    r22,r28,r28             ; compute update address
-noregchange:
-       lda     sp,-14*8(sp)            ; reserve stack space
-       stq     r16,0*8(sp)             ; save all argument registers
-       stq     r17,1*8(sp)             ; they could be used by method
-       stq     r18,2*8(sp)
-       stq     r19,3*8(sp)
-       stq     r20,4*8(sp)
-       stq     r21,5*8(sp)
-       stt     f16,6*8(sp)
-       stt     f17,7*8(sp)
-       stt     f18,8*8(sp)
-       stt     f19,9*8(sp)
-       stt     f20,10*8(sp)
-       stt     f21,11*8(sp)
-       stq     r28,12*8(sp)            ; save method pointer
-       stq     ra,13*8(sp)             ; save return address
-
-       ldq     r16,0(r0)               ; pass 'methodinfo' pointer to
-       bsr     ra,compiler_compile     ; compiler
-;      ldgp    gp,0(ra)
-
-       call_pal PAL_imb                ; synchronise instruction cache
-
-       ldq     r16,0*8(sp)             ; load argument registers
-       ldq     r17,1*8(sp)
-       ldq     r18,2*8(sp)
-       ldq     r19,3*8(sp)
-       ldq     r20,4*8(sp)
-       ldq     r21,5*8(sp)
-       ldt     f16,6*8(sp)
-       ldt     f17,7*8(sp)
-       ldt     f18,8*8(sp)
-       ldt     f19,9*8(sp)
-       ldt     f20,10*8(sp)
-       ldt     f21,11*8(sp)
-       ldq     r28,12*8(sp)            ; load method pointer
-       ldq     ra,13*8(sp)             ; load return address
-       lda     sp,14*8(sp)             ; deallocate stack area
-
-       ldl     r22,-8(ra)              ; load instruction LDQ PV,xxx(ryy)
-       sll     r22,48,r22
-       sra     r22,48,r22              ; isolate offset
-
-       addq    r22,r28,r22             ; compute update address via method pointer
-       stq     r0,0(r22)               ; save new method address there
-
-    bis     r0,r0,pv                ; load method address into pv
-
-       jmp     zero, (pv)              ; and call method. The method returns
-                                       ; directly to the caller (ra).
-                                                                
-       .end    asm_call_jit_compiler
-
-
-/****************** function asm_dumpregistersandcall **************************
-*                                                                              *
-*   This funtion saves all callee saved registers and calls the function       *
-*   which is passed as parameter.                                              *
-*                                                                              *
-*   This function is needed by the garbage collector, which needs to access    *
-*   all registers which are stored on the stack. Unused registers are          *
-*   cleared to avoid intererances with the GC.                                *
-*                                                                              *
-*   void asm_dumpregistersandcall (functionptr f);                             *
-*                                                                              *
-*******************************************************************************/
-
-       .ident    asm_dumpregistersandcall
-       .psect code_sec2, code
-asm_dumpregistersandcall::
-       lda     sp,-16*8(sp)            ; allocate stack
-       stq     ra,0(sp)                ; save return address
-
-       stq     r9,1*8(sp)              ; save all callee saved registers
-       stq     r10,2*8(sp)             ; intialize the remaining registers
-       stq     r11,3*8(sp)
-       stq     r12,4*8(sp)
-       stq     r13,5*8(sp)
-       stq     r14,6*8(sp)
-       stq     r15,7*8(sp)
-       stt     f2,8*8(sp)
-       stt     f3,9*8(sp)
-       stt     f4,10*8(sp)
-       stt     f5,11*8(sp)
-       stt     f6,12*8(sp)
-       stt     f7,13*8(sp)
-       stt     f8,14*8(sp)
-       stt     f9,15*8(sp)
-
-       bis     zero,zero,r0           ; intialize the remaining registers
-       bis     zero,zero,r1
-       bis     zero,zero,r2
-       bis     zero,zero,r3
-       bis     zero,zero,r4
-       bis     zero,zero,r5
-       bis     zero,zero,r6
-       bis     zero,zero,r7
-       bis     zero,zero,r8
-       bis     zero,zero,r17
-       bis     zero,zero,r18
-       bis     zero,zero,r19
-       bis     zero,zero,r20
-       bis     zero,zero,r21
-       bis     zero,zero,r22
-       bis     zero,zero,r23
-       bis     zero,zero,r24
-       bis     zero,zero,r25
-       bis     zero,zero,r26
-       bis     zero,zero,r27
-       bis     zero,zero,r28
-       bis     zero,zero,r29
-       cpys    f31,f31,f0
-       cpys    f31,f31,f1
-       cpys    f31,f31,f10
-       cpys    f31,f31,f11
-       cpys    f31,f31,f12
-       cpys    f31,f31,f13
-       cpys    f31,f31,f14
-       cpys    f31,f31,f15
-       cpys    f31,f31,f16
-       cpys    f31,f31,f17
-       cpys    f31,f31,f18
-       cpys    f31,f31,f19
-       cpys    f31,f31,f20
-       cpys    f31,f31,f21
-       cpys    f31,f31,f22
-       cpys    f31,f31,f23
-       cpys    f31,f31,f24
-       cpys    f31,f31,f25
-       cpys    f31,f31,f26
-       cpys    f31,f31,f27
-       cpys    f31,f31,f28
-       cpys    f31,f31,f29
-       cpys    f31,f31,f30
-
-       bis     r16,r16,pv              ; load function pointer
-       jmp     ra,(pv)                 ; and call function
-
-       ldq     ra,0(sp)                ; load return address
-       lda     sp,16*8(sp)             ; deallocate stack
-       jmp     zero,(ra)               ; return
-
-       .end    
-
diff --git a/alpha/defines.h b/alpha/defines.h
deleted file mode 100644 (file)
index dc60708..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* alpha/defines.h *************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       system-dependent definitions
-
-       Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/09/11
-
-*******************************************************************************/
-
-#define USE_INTERNAL_THREADS
-
-#define HAVE_FCNTL
-#define HAVE_IOCTL
diff --git a/alpha/disass.c b/alpha/disass.c
deleted file mode 100644 (file)
index c04e876..0000000
+++ /dev/null
@@ -1,428 +0,0 @@
-/* disass.c ********************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       A very primitive disassembler for Alpha machine code for easy debugging.
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/18
-
-*******************************************************************************/
-
-/*  The disassembler uses two tables for decoding the instructions. The first
-       table (ops) is used to classify the instructions based on the op code and
-       contains the instruction names for instructions which don't used the
-       function codes. This table is indexed by the op code (6 bit, 64 entries).
-       The second table (op3s) contains instructions which contain both an op
-       code and a function code. This table is an unsorted list of instructions
-       which is terminated by op code and function code zero. This list is
-       searched linearly for a matching pair of opcode and function code.
-*/
-
-#define ITYPE_UNDEF 0           /* undefined instructions (illegal opcode)    */
-#define ITYPE_JMP   1           /* jump instructions                          */
-#define ITYPE_MEM   2           /* memory instructions                        */
-#define ITYPE_FMEM  3           /* floating point memory instructions         */
-#define ITYPE_BRA   4           /* branch instructions                        */
-#define ITYPE_OP    5           /* integer instructions                       */
-#define ITYPE_FOP   6           /* floating point instructions                */
-
-
-/* instruction decode table for 6 bit op codes                                */
-
-static struct {char *name; int itype;} ops[] = {
-
-       /* 0x00 */  {"",        ITYPE_UNDEF},
-       /* 0x01 */  {"",        ITYPE_UNDEF},
-       /* 0x02 */  {"",        ITYPE_UNDEF},
-       /* 0x03 */  {"",        ITYPE_UNDEF},
-       /* 0x04 */  {"",        ITYPE_UNDEF},
-       /* 0x05 */  {"",        ITYPE_UNDEF},
-       /* 0x06 */  {"",        ITYPE_UNDEF},
-       /* 0x07 */  {"",        ITYPE_UNDEF},
-       /* 0x08 */  {"lda    ",   ITYPE_MEM},
-       /* 0x09 */  {"ldah   ",   ITYPE_MEM},
-       /* 0x0a */  {"ldb    ",   ITYPE_MEM},
-       /* 0x0b */  {"ldq_u  ",   ITYPE_MEM},
-       /* 0x0c */  {"ldw    ",   ITYPE_MEM},
-       /* 0x0d */  {"stw    ",   ITYPE_MEM},
-       /* 0x0e */  {"stb    ",   ITYPE_MEM},
-       /* 0x0f */  {"stq_u  ",   ITYPE_MEM},
-       /* 0x10 */  {"op     ",    ITYPE_OP},
-       /* 0x11 */  {"op     ",    ITYPE_OP},
-       /* 0x12 */  {"op     ",    ITYPE_OP},
-       /* 0x13 */  {"op     ",    ITYPE_OP},
-       /* 0x14 */  {"",        ITYPE_UNDEF},
-       /* 0x15 */  {"",        ITYPE_UNDEF},
-       /* 0x16 */  {"fop    ",   ITYPE_FOP},
-       /* 0x17 */  {"fop    ",   ITYPE_FOP},
-       /* 0x18 */  {"memfmt ",   ITYPE_MEM},
-       /* 0x19 */  {"",        ITYPE_UNDEF},
-       /* 0x1a */  {"jmp    ",   ITYPE_JMP},
-       /* 0x1b */  {"",        ITYPE_UNDEF},
-       /* 0x1c */  {"op     ",    ITYPE_OP},
-       /* 0x1d */  {"",        ITYPE_UNDEF},
-       /* 0x1e */  {"",        ITYPE_UNDEF},
-       /* 0x1f */  {"",        ITYPE_UNDEF},
-       /* 0x20 */  {"ldf    ",  ITYPE_FMEM},
-       /* 0x21 */  {"ldg    ",  ITYPE_FMEM},
-       /* 0x22 */  {"lds    ",  ITYPE_FMEM},
-       /* 0x23 */  {"ldt    ",  ITYPE_FMEM},
-       /* 0x24 */  {"stf    ",  ITYPE_FMEM},
-       /* 0x25 */  {"stg    ",  ITYPE_FMEM},
-       /* 0x26 */  {"sts    ",  ITYPE_FMEM},
-       /* 0x27 */  {"stt    ",  ITYPE_FMEM},
-       /* 0x28 */  {"ldl    ",   ITYPE_MEM},
-       /* 0x29 */  {"ldq    ",   ITYPE_MEM},
-       /* 0x2a */  {"ldl_l  ",   ITYPE_MEM},
-       /* 0x2b */  {"ldq_l  ",   ITYPE_MEM},
-       /* 0x2c */  {"stl    ",   ITYPE_MEM},
-       /* 0x2d */  {"stq    ",   ITYPE_MEM},
-       /* 0x2e */  {"stl_c  ",   ITYPE_MEM},
-       /* 0x2f */  {"stq_c  ",   ITYPE_MEM},
-       /* 0x30 */  {"br     ",   ITYPE_BRA},
-       /* 0x31 */  {"fbeq   ",   ITYPE_BRA},
-       /* 0x32 */  {"fblt   ",   ITYPE_BRA},
-       /* 0x33 */  {"fble   ",   ITYPE_BRA},
-       /* 0x34 */  {"bsr    ",   ITYPE_BRA},
-       /* 0x35 */  {"fbne   ",   ITYPE_BRA},
-       /* 0x36 */  {"fbge   ",   ITYPE_BRA},
-       /* 0x37 */  {"fbgt   ",   ITYPE_BRA},
-       /* 0x38 */  {"blbc   ",   ITYPE_BRA},
-       /* 0x39 */  {"beq    ",   ITYPE_BRA},
-       /* 0x3a */  {"blt    ",   ITYPE_BRA},
-       /* 0x3b */  {"ble    ",   ITYPE_BRA},
-       /* 0x3c */  {"blbs   ",   ITYPE_BRA},
-       /* 0x3d */  {"bne    ",   ITYPE_BRA},
-       /* 0x3e */  {"bge    ",   ITYPE_BRA},
-       /* 0x3f */  {"bgt    ",   ITYPE_BRA}
-};
-
-
-/* instruction decode list for 6 bit op codes and 9 bit function codes        */
-static struct { u2 op, fun; char *name; }  op3s[] = {
-
-       { 0x10, 0x00,  "addl   " },
-       { 0x10, 0x40,  "addl/v " },
-       { 0x10, 0x20,  "addq   " },
-       { 0x10, 0x60,  "addq/v " },
-       { 0x10, 0x09,  "subl   " },
-       { 0x10, 0x49,  "subl/v " },
-       { 0x10, 0x29,  "subq   " },
-       { 0x10, 0x69,  "subq/v " },
-       { 0x10, 0x2D,  "cmpeq  " },
-       { 0x10, 0x4D,  "cmplt  " },
-       { 0x10, 0x6D,  "cmple  " },
-       { 0x10, 0x1D,  "cmpult " },
-       { 0x10, 0x3D,  "cmpule " },
-       { 0x10, 0x0F,  "cmpbge " },
-       { 0x10, 0x02,  "s4addl " },
-       { 0x10, 0x0b,  "s4subl " },
-       { 0x10, 0x22,  "s4addq " },
-       { 0x10, 0x2b,  "s4subq " },
-       { 0x10, 0x12,  "s8addl " },
-       { 0x10, 0x1b,  "s8subl " },
-       { 0x10, 0x32,  "s8addq " },
-       { 0x10, 0x3b,  "s8subq " },
-       { 0x11, 0x00,  "and    " },
-       { 0x11, 0x20,  "or     " },
-       { 0x11, 0x40,  "xor    " },
-       { 0x11, 0x08,  "andnot " },
-       { 0x11, 0x28,  "ornot  " },
-       { 0x11, 0x48,  "xornot " },
-       { 0x11, 0x24,  "cmoveq " },
-       { 0x11, 0x44,  "cmovlt " },
-       { 0x11, 0x64,  "cmovle " },
-       { 0x11, 0x26,  "cmovne " },
-       { 0x11, 0x46,  "cmovge " },
-       { 0x11, 0x66,  "cmovgt " },
-       { 0x11, 0x14,  "cmovlbs" },
-       { 0x11, 0x16,  "cmovlbc" },
-       { 0x12, 0x39,  "sll    " },
-       { 0x12, 0x3C,  "sra    " },
-       { 0x12, 0x34,  "srl    " },
-       { 0x12, 0x30,  "zap    " },
-       { 0x12, 0x31,  "zapnot " },
-       { 0x12, 0x06,  "extbl  " },
-       { 0x12, 0x16,  "extwl  " },
-       { 0x12, 0x26,  "extll  " },
-       { 0x12, 0x36,  "extql  " },
-       { 0x12, 0x5a,  "extwh  " },
-       { 0x12, 0x6a,  "extlh  " },
-       { 0x12, 0x7a,  "extqh  " },
-       { 0x12, 0x0b,  "insbl  " },
-       { 0x12, 0x1b,  "inswl  " },
-       { 0x12, 0x2b,  "insll  " },
-       { 0x12, 0x3b,  "insql  " },
-       { 0x12, 0x57,  "inswh  " },
-       { 0x12, 0x67,  "inslh  " },
-       { 0x12, 0x77,  "insqh  " },
-       { 0x12, 0x02,  "mskbl  " },
-       { 0x12, 0x12,  "mskwl  " },
-       { 0x12, 0x22,  "mskll  " },
-       { 0x12, 0x32,  "mskql  " },
-       { 0x12, 0x52,  "mskwh  " },
-       { 0x12, 0x62,  "msklh  " },
-       { 0x12, 0x72,  "mskqh  " },
-       { 0x13, 0x00,  "mull   " },
-       { 0x13, 0x20,  "mulq   " },
-       { 0x13, 0x40,  "mull/v " },
-       { 0x13, 0x60,  "mulq/v " },
-       { 0x13, 0x30,  "umulh  " },
-       { 0x16, 0x080, "fadd   " },
-       { 0x16, 0x0a0, "dadd   " },
-       { 0x16, 0x081, "fsub   " },
-       { 0x16, 0x0a1, "dsub   " },
-       { 0x16, 0x082, "fmul   " },
-       { 0x16, 0x0a2, "dmul   " },
-       { 0x16, 0x083, "fdiv   " },
-       { 0x16, 0x0a3, "ddiv   " },
-       { 0x16, 0x580, "fadds  " },
-       { 0x16, 0x5a0, "dadds  " },
-       { 0x16, 0x581, "fsubs  " },
-       { 0x16, 0x5a1, "dsubs  " },
-       { 0x16, 0x582, "fmuls  " },
-       { 0x16, 0x5a2, "dmuls  " },
-       { 0x16, 0x583, "fdivs  " },
-       { 0x16, 0x5a3, "ddivs  " },
-       { 0x16, 0x0ac, "cvtdf  " },
-       { 0x16, 0x0bc, "cvtlf  " },
-       { 0x16, 0x0be, "cvtld  " },
-       { 0x16, 0x0af, "cvtdl  " },
-       { 0x16, 0x02f, "cvtdlc " },
-       { 0x17, 0x030, "cvtli  " },
-       { 0x16, 0x1af, "cvtdlv " },
-       { 0x16, 0x12f, "cvtdlcv" },
-       { 0x17, 0x130, "cvtliv " },
-       { 0x16, 0x5ac, "cvtdfs " },
-       { 0x16, 0x5af, "cvtdls " },
-       { 0x16, 0x52f, "cvtdlcs" },
-       { 0x16, 0x0a4, "fcmpun " },
-       { 0x16, 0x0a5, "fcmpeq " },
-       { 0x16, 0x0a6, "fcmplt " },
-       { 0x16, 0x0a7, "fcmple " },
-       { 0x16, 0x5a4, "fcmpuns" },
-       { 0x16, 0x5a5, "fcmpeqs" },
-       { 0x16, 0x5a6, "fcmplts" },
-       { 0x16, 0x5a7, "fcmples" },
-       { 0x17, 0x020, "fmov   " },
-       { 0x17, 0x021, "fmovn  " },
-       { 0x1c, 0x0,   "bsext  " },
-       { 0x1c, 0x1,   "wsext  " },
-       
-       { 0x00, 0x00,  NULL }
-};
-
-
-/* name table for 32 integer registers                                        */
-
-static char *regs[] = {
-
-       /* 0x00 */  "v0",   /*  "$0", */
-       /* 0x01 */  "t0",   /*  "$1", */
-       /* 0x02 */  "t1",   /*  "$2", */
-       /* 0x03 */  "t2",   /*  "$3", */
-       /* 0x04 */  "t3",   /*  "$4", */
-       /* 0x05 */  "t4",   /*  "$5", */
-       /* 0x06 */  "t5",   /*  "$6", */
-       /* 0x07 */  "t6",   /*  "$7", */
-
-       /* 0x08 */  "t7",   /*  "$8", */
-       /* 0x09 */  "s0",   /*  "$9", */
-       /* 0x0a */  "s1",   /* "$10", */
-       /* 0x0b */  "s2",   /* "$11", */
-       /* 0x0c */  "s3",   /* "$12", */
-       /* 0x0d */  "s4",   /* "$13", */
-       /* 0x0e */  "s5",   /* "$14", */
-       /* 0x0f */  "s6",   /* "$15", */
-
-       /* 0x10 */  "a0",   /* "$16", */
-       /* 0x11 */  "a1",   /* "$17", */
-       /* 0x12 */  "a2",   /* "$18", */
-       /* 0x13 */  "a3",   /* "$19", */
-       /* 0x14 */  "a4",   /* "$20", */
-       /* 0x15 */  "a5",   /* "$21", */
-       /* 0x16 */  "t8",   /* "$22", */
-       /* 0x17 */  "t9",   /* "$23", */
-
-       /* 0x18 */  "t10",  /* "$24", */
-       /* 0x19 */  "t11",  /* "$25", */
-       /* 0x1a */  "ra",   /* "$26", */
-       /* 0x1b */  "pv",   /* "$27", */
-       /* 0x1c */  "at",   /* "$28", */
-       /* 0x1d */  "gp",   /* "$29", */
-       /* 0x1e */  "sp",   /* "$30", */
-       /* 0x1f */  "zero"  /* "$31"  */
-};
-
-
-/* function disassinstr ********************************************************
-
-       outputs a disassembler listing of one machine code instruction on 'stdout'
-       c:   instructions machine code
-       pos: instructions address relative to method start
-
-*******************************************************************************/
-
-static void disassinstr(int c, int pos)
-{
-       int op;                     /* 6 bit op code                              */
-       int opfun;                  /* 7 bit function code                        */
-       int ra, rb, rc;             /* 6 bit register specifiers                  */
-       int lit;                    /* 8 bit unsigned literal                     */
-       int i;                      /* loop counter                               */
-
-       op    = (c >> 26) & 0x3f;   /* 6 bit op code                              */
-       opfun = (c >> 5)  & 0x7f;   /* 7 bit function code                        */
-       ra    = (c >> 21) & 0x1f;   /* 6 bit source register specifier            */
-       rb    = (c >> 16) & 0x1f;   /* 6 bit source register specifier            */
-       rc    = (c >> 0)  & 0x1f;   /* 6 bit destination register specifiers      */
-       lit   = (c >> 13) & 0xff;   /* 8 bit unsigned literal                     */
-
-       printf ("%6x: %8x  ", pos, c);
-       
-       switch (ops[op].itype) {
-               case ITYPE_JMP:
-                       switch ((c >> 14) & 3) {  /* branch hint */
-                               case 0:
-                                       if (ra == 31) {
-                                               printf ("jmp     (%s)\n", regs[rb]); 
-                                               return;
-                                               }
-                                       printf ("jmp     "); 
-                                       break;
-                               case 1:
-                                       if (ra == 26) {
-                                               printf ("jsr     (%s)\n", regs[rb]); 
-                                               return;
-                                               }
-                                       printf ("jsr     "); 
-                                       break;
-                               case 2:
-                                       if (ra == 31 && rb == 26) {
-                                               printf ("ret\n"); 
-                                               return;
-                                               }
-                                       if (ra == 31) {
-                                               printf ("ret     (%s)\n", regs[rb]); 
-                                               return;
-                                               }
-                                       printf ("ret     ");
-                                       break;
-                               case 3:
-                                       printf ("jsr_co  "); 
-                                       break;
-                               }
-                       printf ("%s,(%s)\n", regs[ra], regs[rb]); 
-                       break;
-
-               case ITYPE_MEM: {
-                       int disp = (c << 16) >> 16; /* 16 bit signed displacement         */
-
-                       if (op == 0x18 && ra == 0 && ra == 0 && disp == 0)
-                               printf ("trapb\n"); 
-                       else
-                               printf ("%s %s,%d(%s)\n", ops[op].name, regs[ra], disp, regs[rb]); 
-                       break;
-                       }
-
-               case ITYPE_FMEM: {
-                       printf ("%s $f%d,%d(%s)\n", ops[op].name, ra, (c << 16) >> 16, regs[rb]); 
-                       break;
-                       }
-
-               case ITYPE_BRA:             /* 21 bit signed branch offset */
-                       if (op == 0x30 && ra == 31)
-                               printf("br      0x%x\n", pos + 4 + ((c << 11) >> 9));
-                       else if (op == 0x34 && ra == 26)
-                               printf("brs     0x%x\n", pos + 4 + ((c << 11) >> 9));
-                       else
-                               printf("%s %s,0x%x\n",
-                                      ops[op].name, regs[ra], pos + 4 + ((c << 11) >> 9));
-                       break;
-                       
-               case ITYPE_FOP: {
-                       int fopfun = (c >> 5) & 0x7ff;  /* 11 bit fp function code        */
-
-                       if (op == 0x17 && fopfun == 0x020 && ra == rb) {
-                               if (ra == 31 && rc == 31)
-                                       printf("fnop\n");
-                               else
-                                       printf("fmov    $f%d,$f%d\n", ra, rc);
-                               return;
-                               }
-                       for (i = 0; op3s[i].name; i++)
-                               if (op3s[i].op == op && op3s[i].fun == fopfun) {
-                                       printf("%s $f%d,$f%d,$f%d\n", op3s[i].name, ra, rb,  rc);
-                                       return;
-                                       }
-                       printf("%s%x $f%d,$f%d,$f%d\n", ops[op].name, fopfun, ra, rb, rc);
-                       break;
-                       }
-
-               case ITYPE_OP:
-                       if (op == 0x11 && opfun == 0x20 && ra == rb && ~(c&0x1000)) {
-                               if (ra == 31 && rc == 31)
-                                       printf("nop\n");
-                               else if (ra == 31)
-                                       printf("clr     %s\n", regs[rc]);
-                               else
-                                       printf("mov     %s,%s\n", regs[ra], regs[rc]);
-                               return;
-                               }
-                       for (i = 0; op3s[i].name; i++) {
-                               if (op3s[i].op == op && op3s[i].fun == opfun) {
-                                       if (c & 0x1000)                  /* immediate instruction */
-                                               printf("%s %s,%d,%s\n",
-                                                      op3s[i].name, regs[ra], lit, regs[rc]);
-                                       else
-                                               printf("%s %s,%s,%s\n",
-                                                      op3s[i].name, regs[ra], regs[rb], regs[rc]);
-                                       return;
-                                       }
-                               }
-                       /* fall through */
-               default:
-                       if (c & 0x1000)                          /* immediate instruction */
-                               printf("UNDEF  %x(%x) $%d,%d,$%d\n", op, opfun, ra, lit, rc);
-                       else
-                               printf("UNDEF  %x(%x) $%d,$%d,$%d\n", op, opfun, ra, rb,  rc);          
-               }
-}
-
-
-/* function disassemble ********************************************************
-
-       outputs a disassembler listing of some machine code on 'stdout'
-       code: pointer to first instruction
-       len:  code size (number of instructions * 4)
-
-*******************************************************************************/
-
-static void disassemble(int *code, int len)
-{
-       int p;
-
-       printf ("  --- disassembler listing ---\n");    
-       for (p = 0; p < len; p += 4, code++)
-               disassinstr(*code, p); 
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/alpha/gen.c b/alpha/gen.c
deleted file mode 100644 (file)
index 3d75256..0000000
+++ /dev/null
@@ -1,1850 +0,0 @@
-/***************************** alpha/gen.c *************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the codegenerator for an Alpha processor.
-       This module generates Alpha machine code for a sequence of
-       pseudo commands (PCMDs).
-
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/10/22
-
-*******************************************************************************/
-
-
-
-/*******************************************************************************
-
-Datatypes and Register Allocations:
------------------------------------ 
-
-On 64-bit-machines (like the Alpha) all operands are stored in the
-registers in a 64-bit form, even when the correspondig JavaVM 
-operands only need 32 bits.
-This is done by a canonical representation:
-
-32-bit integers are allways stored as sign-extended 64-bit values
-(this approach is directly supported by the Alpha architecture and
-is very easy to implement).
-
-32-bit-floats are stored in a 64-bit doubleprecision register by
-simply expanding the exponent and mantissa with zeroes.
-(also supported by the architecture)
-
-
-Stackframes:
-
-The calling conventions and the layout of the stack is 
-explained in detail in the documention file: calling.doc
-
-*******************************************************************************/
-
-
-/************************ Preallocated registers ******************************/
-
-/* integer registers */
-  
-#define REG_RESULT      0    /* to deliver method results                     */ 
-#define REG_EXCEPTION          1    /* to throw an exception across method bounds    */
-
-#define REG_RA                 26   /* return address                                */
-#define REG_PV                 27   /* procedure vector, must be provided by caller  */
-#define REG_METHODPTR  28   /* pointer to the place from where the procedure */
-                             /* vector has been fetched                       */
-#define REG_ITMP1              25   /* temporary register                            */
-#define REG_ITMP2              28   /* temporary register                            */
-#define REG_ITMP3              29   /* temporary register                            */
-
-#define REG_SP                 30   /* stack pointer                                 */
-#define REG_ZERO               31   /* allways zero                                  */
-
-/* floating point registers */
-
-#define REG_FRESULT     0    /* to deliver floating point method results      */ 
-#define REG_FTMP1       28   /* temporary floating point register             */
-#define REG_FTMP2       29   /* temporary floating point register             */
-#define REG_FTMP3       30   /* temporary floating point register             */
-
-
-/******************** register descripton - array *****************************/
-
-/* #define REG_RES   0         reserved register for OS or code generator */
-/* #define REG_RET   1         return value register */
-/* #define REG_EXC   2         exception value register */
-/* #define REG_SAV   3         (callee) saved register */
-/* #define REG_TMP   4         scratch temporary register (caller saved) */
-/* #define REG_ARG   5         argument register (caller saved) */
-
-/* #define REG_END   -1        last entry in tables */
-int regdescint[] = {
-       REG_RET, REG_EXC, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
-       REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, 
-       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
-       REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
-       REG_END };
-
-#define INT_SAV_FST      9   /* first int callee saved register               */
-#define INT_SAV_CNT      7   /* number of int callee saved registers          */
-#define INT_ARG_FST     16   /* first int callee saved register               */
-#define INT_ARG_CNT      6   /* number of int callee saved registers          */
-
-/* for use of reserved registers, see comment above */
-       
-int regdescfloat[] = {
-       REG_RET, REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
-       REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
-       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
-       REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES,
-       REG_END };
-
-#define FLT_SAV_FST      2   /* first int callee saved register               */
-#define FLT_SAV_CNT      8   /* number of int callee saved registers          */
-#define FLT_ARG_FST     16   /* first int callee saved register               */
-#define FLT_ARG_CNT      6   /* number of int callee saved registers          */
-
-/* for use of reserved registers, see comment above */
-
-
-/*** parameter allocation mode ***/
-
-int reg_parammode = PARAMMODE_NUMBERED;  
-
-   /* parameter-registers will be allocated by assigning the
-      1. parameter:   int/float-reg 16
-      2. parameter:   int/float-reg 17  
-      3. parameter:   int/float-reg 18 ....
-   */
-
-
-/************************** stackframe-infos **********************************/
-
-int localvars_base;  /* offset in stackframe for the local variables          */
-int savedregs_base;  /* offset in stackframe for the save area                */
-int parentargs_base; /* offset in stackframe for the parameter from the caller*/
-
-/* -> see file 'calling.doc' */
-
-
-/******************** macros to create code ***********************************/
-
-/* 3-address-operations: M_OP3
-      op ..... opcode
-      fu ..... function-number
-      a  ..... register number source 1
-      b  ..... register number or constant integer source 2
-      c  ..... register number destination
-      const .. switch to use b as constant integer 
-                 (0 means: use b as register number)
-                 (1 means: use b as constant 8-bit-integer)
-*/      
-#define M_OP3(op,fu,a,b,c,const) \
-       mcode_adds4 ( (((s4)(op))<<26)|((a)<<21)|((b)<<(16-3*(const)))| \
-       ((const)<<12)|((fu)<<5)|((c)) )
-
-/* 3-address-floating-point-operation: M_FOP3 
-     op .... opcode
-     fu .... function-number
-     a,b ... source floating-point registers
-     c ..... destination register
-*/ 
-#define M_FOP3(op,fu,a,b,c) \
-       mcode_adds4 ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((fu)<<5)|(c) )
-
-/* branch instructions: M_BRA 
-      op ..... opcode
-      a ...... register to be tested
-      disp ... relative address to be jumped to (divided by 4)
-*/
-#define M_BRA(op,a,disp) \
-       mcode_adds4 ( (((s4)(op))<<26)|((a)<<21)|((disp)&0x1fffff) )
-
-
-/* memory operations: M_MEM
-      op ..... opcode
-      a ...... source/target register for memory access
-      b ...... base register
-      disp ... displacement (16 bit signed) to be added to b
-*/ 
-#define M_MEM(op,a,b,disp) \
-       mcode_adds4 ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((disp)&0xffff) )
-
-
-/***** macros for all used commands (see an Alpha-manual for description) *****/ 
-
-#define M_LDA(a,b,disp)         M_MEM (0x08,a,b,disp)           /* low const  */
-#define M_LDAH(a,b,disp)        M_MEM (0x09,a,b,disp)           /* high const */
-#define M_BLDU(a,b,disp)        M_MEM (0x0a,a,b,disp)           /*  8 load    */
-#define M_SLDU(a,b,disp)        M_MEM (0x0c,a,b,disp)           /* 16 load    */
-#define M_ILD(a,b,disp)         M_MEM (0x28,a,b,disp)           /* 32 load    */
-#define M_LLD(a,b,disp)         M_MEM (0x29,a,b,disp)           /* 64 load    */
-#define M_BST(a,b,disp)         M_MEM (0x0e,a,b,disp)           /*  8 store   */
-#define M_SST(a,b,disp)         M_MEM (0x0d,a,b,disp)           /* 16 store   */
-#define M_IST(a,b,disp)         M_MEM (0x2c,a,b,disp)           /* 32 store   */
-#define M_LST(a,b,disp)         M_MEM (0x2d,a,b,disp)           /* 64 store   */
-
-#define M_BSEXT(b,c)            M_OP3 (0x1c,0x0,REG_ZERO,b,c,0) /*  8 signext */
-#define M_SSEXT(b,c)            M_OP3 (0x1c,0x1,REG_ZERO,b,c,0) /* 16 signext */
-
-#define M_BR(disp)              M_BRA (0x30,REG_ZERO,disp)      /* branch     */
-#define M_BSR(ra,disp)          M_BRA (0x34,ra,disp)            /* branch sbr */
-#define M_BEQZ(a,disp)          M_BRA (0x39,a,disp)             /* br a == 0  */
-#define M_BLTZ(a,disp)          M_BRA (0x3a,a,disp)             /* br a <  0  */
-#define M_BLEZ(a,disp)          M_BRA (0x3b,a,disp)             /* br a <= 0  */
-#define M_BNEZ(a,disp)          M_BRA (0x3d,a,disp)             /* br a != 0  */
-#define M_BGEZ(a,disp)          M_BRA (0x3e,a,disp)             /* br a >= 0  */
-#define M_BGTZ(a,disp)          M_BRA (0x3f,a,disp)             /* br a >  0  */
-
-#define M_JMP(a,b)              M_MEM (0x1a,a,b,0x0000)         /* jump       */
-#define M_JSR(a,b)              M_MEM (0x1a,a,b,0x4000)         /* call sbr   */
-#define M_RET(a,b)              M_MEM (0x1a,a,b,0x8000)         /* return     */
-
-#define M_IADD(a,b,c,const)     M_OP3 (0x10,0x0,  a,b,c,const)  /* 32 add     */
-#define M_LADD(a,b,c,const)     M_OP3 (0x10,0x20, a,b,c,const)  /* 64 add     */
-#define M_ISUB(a,b,c,const)     M_OP3 (0x10,0x09, a,b,c,const)  /* 32 sub     */
-#define M_LSUB(a,b,c,const)     M_OP3 (0x10,0x29, a,b,c,const)  /* 64 sub     */
-#define M_IMUL(a,b,c,const)     M_OP3 (0x13,0x00, a,b,c,const)  /* 32 mul     */
-#define M_LMUL(a,b,c,const)     M_OP3 (0x13,0x20, a,b,c,const)  /* 64 mul     */
-
-#define M_CMPEQ(a,b,c,const)    M_OP3 (0x10,0x2d, a,b,c,const)  /* c = a == b */
-#define M_CMPLT(a,b,c,const)    M_OP3 (0x10,0x4d, a,b,c,const)  /* c = a <  b */
-#define M_CMPLE(a,b,c,const)    M_OP3 (0x10,0x6d, a,b,c,const)  /* c = a <= b */
-
-#define M_CMPULE(a,b,c,const)   M_OP3 (0x10,0x3d, a,b,c,const)  /* c = a <= b */
-
-#define M_AND(a,b,c,const)      M_OP3 (0x11,0x00, a,b,c,const)  /* c = a &  b */
-#define M_OR(a,b,c,const)       M_OP3 (0x11,0x20, a,b,c,const)  /* c = a |  b */
-#define M_XOR(a,b,c,const)      M_OP3 (0x11,0x40, a,b,c,const)  /* c = a ^  b */
-
-#define M_SLL(a,b,c,const)      M_OP3 (0x12,0x39, a,b,c,const)  /* c = a << b */
-#define M_SRA(a,b,c,const)      M_OP3 (0x12,0x3c, a,b,c,const)  /* c = a >> b */
-#define M_SRL(a,b,c,const)      M_OP3 (0x12,0x34, a,b,c,const)  /* c = a >>>b */
-
-#define M_FLD(a,b,disp)         M_MEM (0x22,a,b,disp)           /* load flt   */
-#define M_DLD(a,b,disp)         M_MEM (0x23,a,b,disp)           /* load dbl   */
-#define M_FST(a,b,disp)         M_MEM (0x26,a,b,disp)           /* store flt  */
-#define M_DST(a,b,disp)         M_MEM (0x27,a,b,disp)           /* store dbl  */
-
-#define M_FADD(a,b,c)           M_FOP3 (0x16, 0x080, a,b,c)     /* flt add    */
-#define M_DADD(a,b,c)           M_FOP3 (0x16, 0x0a0, a,b,c)     /* dbl add    */
-#define M_FSUB(a,b,c)           M_FOP3 (0x16, 0x081, a,b,c)     /* flt sub    */
-#define M_DSUB(a,b,c)           M_FOP3 (0x16, 0x0a1, a,b,c)     /* dbl sub    */
-#define M_FMUL(a,b,c)           M_FOP3 (0x16, 0x082, a,b,c)     /* flt mul    */
-#define M_DMUL(a,b,c)           M_FOP3 (0x16, 0x0a2, a,b,c)     /* dbl mul    */
-#define M_FDIV(a,b,c)           M_FOP3 (0x16, 0x083, a,b,c)     /* flt div    */
-#define M_DDIV(a,b,c)           M_FOP3 (0x16, 0x0a3, a,b,c)     /* dbl div    */
-
-#define M_CVTLF(a,b,c)          M_FOP3 (0x16, 0x0bc, a,b,c)     /* long2flt   */
-#define M_CVTLD(a,b,c)          M_FOP3 (0x16, 0x0be, a,b,c)     /* long2dbl   */
-#define M_CVTDL(a,b,c)          M_FOP3 (0x16, 0x0af, a,b,c)     /* dbl2long   */
-#define M_CVTDL_C(a,b,c)        M_FOP3 (0x16, 0x02f, a,b,c)     /* dbl2long   */
-
-#define M_FCMPEQ(a,b,c)         M_FOP3 (0x16, 0x0a5, a,b,c)     /* c = a==b   */
-#define M_FCMPLT(a,b,c)         M_FOP3 (0x16, 0x0a6, a,b,c)     /* c = a<b    */
-
-#define M_FMOV(fa,fb)           M_FOP3 (0x17, 0x020, fa,fa,fb)  /* b = a      */
-#define M_FMOVN(fa,fb)          M_FOP3 (0x17, 0x021, fa,fa,fb)  /* b = -a     */
-
-#define M_FBEQZ(fa,disp)        M_BRA (0x31,fa,disp)            /* br a == 0.0*/
-
-/****** macros for special commands (see an Alpha-manual for description) *****/ 
-
-#define M_S4ADDL(a,b,c,const)   M_OP3 (0x10,0x02, a,b,c,const) /* c = a*4 + b */
-#define M_S4ADDQ(a,b,c,const)   M_OP3 (0x10,0x22, a,b,c,const) /* c = a*4 + b */
-#define M_S4SUBL(a,b,c,const)   M_OP3 (0x10,0x0b, a,b,c,const) /* c = a*4 - b */
-#define M_S4SUBQ(a,b,c,const)   M_OP3 (0x10,0x2b, a,b,c,const) /* c = a*4 - b */
-#define M_S8ADDL(a,b,c,const)   M_OP3 (0x10,0x12, a,b,c,const) /* c = a*8 + b */
-#define M_S8ADDQ(a,b,c,const)   M_OP3 (0x10,0x32, a,b,c,const) /* c = a*8 + b */
-#define M_S8SUBL(a,b,c,const)   M_OP3 (0x10,0x1b, a,b,c,const) /* c = a*8 - b */
-#define M_S8SUBQ(a,b,c,const)   M_OP3 (0x10,0x3b, a,b,c,const) /* c = a*8 - b */
-
-#define M_LLD_U(a,b,disp)       M_MEM (0x0b,a,b,disp)          /* unalign ld  */
-#define M_LST_U(a,b,disp)       M_MEM (0x0f,a,b,disp)          /* unalign st  */
-
-#define M_ZAP(a,b,c,const)      M_OP3 (0x12,0x30, a,b,c,const)
-#define M_ZAPNOT(a,b,c,const)   M_OP3 (0x12,0x31, a,b,c,const)
-#define M_EXTBL(a,b,c,const)    M_OP3 (0x12,0x06, a,b,c,const)
-#define M_EXTWL(a,b,c,const)    M_OP3 (0x12,0x16, a,b,c,const)
-#define M_EXTLL(a,b,c,const)    M_OP3 (0x12,0x26, a,b,c,const)
-#define M_EXTQL(a,b,c,const)    M_OP3 (0x12,0x36, a,b,c,const)
-#define M_EXTWH(a,b,c,const)    M_OP3 (0x12,0x5a, a,b,c,const)
-#define M_EXTLH(a,b,c,const)    M_OP3 (0x12,0x6a, a,b,c,const)
-#define M_EXTQH(a,b,c,const)    M_OP3 (0x12,0x7a, a,b,c,const)
-#define M_INSBL(a,b,c,const)    M_OP3 (0x12,0x0b, a,b,c,const)
-#define M_INSWL(a,b,c,const)    M_OP3 (0x12,0x1b, a,b,c,const)
-#define M_INSLL(a,b,c,const)    M_OP3 (0x12,0x2b, a,b,c,const)
-#define M_INSQL(a,b,c,const)    M_OP3 (0x12,0x3b, a,b,c,const)
-#define M_INSWH(a,b,c,const)    M_OP3 (0x12,0x57, a,b,c,const)
-#define M_INSLH(a,b,c,const)    M_OP3 (0x12,0x67, a,b,c,const)
-#define M_INSQH(a,b,c,const)    M_OP3 (0x12,0x77, a,b,c,const)
-#define M_MSKBL(a,b,c,const)    M_OP3 (0x12,0x02, a,b,c,const)
-#define M_MSKWL(a,b,c,const)    M_OP3 (0x12,0x12, a,b,c,const)
-#define M_MSKLL(a,b,c,const)    M_OP3 (0x12,0x22, a,b,c,const)
-#define M_MSKQL(a,b,c,const)    M_OP3 (0x12,0x32, a,b,c,const)
-#define M_MSKWH(a,b,c,const)    M_OP3 (0x12,0x52, a,b,c,const)
-#define M_MSKLH(a,b,c,const)    M_OP3 (0x12,0x62, a,b,c,const)
-#define M_MSKQH(a,b,c,const)    M_OP3 (0x12,0x72, a,b,c,const)
-
-
-/****** macros for unused commands (see an Alpha-manual for description) ******/ 
-
-#define M_ANDNOT(a,b,c,const)   M_OP3 (0x11,0x08, a,b,c,const) /* c = a &~ b  */
-#define M_ORNOT(a,b,c,const)    M_OP3 (0x11,0x28, a,b,c,const) /* c = a |~ b  */
-#define M_XORNOT(a,b,c,const)   M_OP3 (0x11,0x48, a,b,c,const) /* c = a ^~ b  */
-
-#define M_CMOVEQ(a,b,c,const)   M_OP3 (0x11,0x24, a,b,c,const) /* a==0 ? c=b  */
-#define M_CMOVNE(a,b,c,const)   M_OP3 (0x11,0x26, a,b,c,const) /* a!=0 ? c=b  */
-#define M_CMOVLT(a,b,c,const)   M_OP3 (0x11,0x44, a,b,c,const) /* a< 0 ? c=b  */
-#define M_CMOVGE(a,b,c,const)   M_OP3 (0x11,0x46, a,b,c,const) /* a>=0 ? c=b  */
-#define M_CMOVLE(a,b,c,const)   M_OP3 (0x11,0x64, a,b,c,const) /* a<=0 ? c=b  */
-#define M_CMOVGT(a,b,c,const)   M_OP3 (0x11,0x66, a,b,c,const) /* a> 0 ? c=b  */
-
-#define M_CMPULT(a,b,c,const)   M_OP3 (0x10,0x1d, a,b,c,const)
-#define M_CMPBGE(a,b,c,const)   M_OP3 (0x10,0x0f, a,b,c,const)
-
-#define M_FCMPUN(a,b,c)         M_FOP3 (0x16, 0x0a4, a,b,c)    /* unordered   */
-#define M_FCMPLE(a,b,c)         M_FOP3 (0x16, 0x0a7, a,b,c)    /* c = a<=b    */
-
-#define M_FBNEZ(fa,disp)        M_BRA (0x35,fa,disp)
-#define M_FBLEZ(fa,disp)        M_BRA (0x33,fa,disp)
-
-#define M_JMP_CO(a,b)           M_MEM (0x1a,a,b,0xc000)        /* call cosub  */
-
-
-/******************** system independent macros *******************************/
-
-
-/************** additional functions to generate code *************************/
-
-
-/* M_INTMOVE:
-     generates an integer-move from register a to b.
-     if a and b are the same int-register, no code will be generated.
-*/ 
-
-static void M_INTMOVE(int a, int b)
-{
-       if (a == b) return;
-       M_OR (a,a,b, 0);
-}
-
-
-/* M_FLTMOVE:
-    generates a floating-point-move from register a to b.
-    if a and b are the same float-register, no code will be generated
-*/ 
-
-static void M_FLTMOVE(int a, int b)
-{
-       if (a == b) return;
-       M_FMOV (a, b);
-}
-
-
-/* var_to_reg_xxx:
-    this function generates code to fetch data from a pseudo-register
-    into a real register. 
-    If the pseudo-register has actually been assigned to a real 
-    register, no code will be emitted, since following operations
-    can use this register directly.
-    
-    v: pseudoregister to be fetched from
-    tempregnum: temporary register to be used if v is actually spilled to ram
-
-    return: the register number, where the operand can be found after 
-            fetching (this wil be either tempregnum or the register
-            number allready given to v)
-*/
-
-static int var_to_reg_int (varid v, int tempregnum)
-{
-       reginfo *ri = v->reg;
-
-       if (!(ri->typeflags & REG_INMEMORY))
-               return ri->num;
-#ifdef STATISTICS
-       count_spills++;
-#endif
-       M_LLD (tempregnum, REG_SP, 8 * (localvars_base + ri->num) );
-       return tempregnum;
-}
-
-
-static int var_to_reg_flt (varid v, int tempregnum)
-{
-       reginfo *ri = v->reg;
-
-
-       if (!(ri->typeflags & REG_INMEMORY))
-               return ri->num;
-#ifdef STATISTICS
-       count_spills++;
-#endif
-       M_DLD (tempregnum, REG_SP, 8 * (localvars_base + ri->num) );
-       return tempregnum;
-}
-
-
-/* reg_of_var:
-     This function determines a register, to which the result of an
-     operation should go, when it is ultimatively intended to store the result
-     in pseudoregister v.
-     If v is assigned to an actual register, this register will be
-     returned.
-     Otherwise (when v is spilled) this function returns tempregnum.
-*/        
-
-static int reg_of_var(varid v, int tempregnum)
-{
-       if (!(v->reg->typeflags & REG_INMEMORY))
-               return v->reg->num;
-       return tempregnum;
-}
-
-
-/* store_reg_to_var_xxx:
-    This function generates the code to store the result of an operation
-    back into a spilled pseudo-variable.
-    If the pseudo-variable has not been spilled in the first place, this 
-    function will generate nothing.
-    
-    v ............ Pseudovariable
-    tempregnum ... Number of the temporary registers as returned by
-                   reg_of_var.
-*/     
-
-static void store_reg_to_var_int (varid v, int tempregnum)
-{
-       reginfo *ri = v->reg;
-
-       if (!(ri->typeflags & REG_INMEMORY))
-               return;
-#ifdef STATISTICS
-       count_spills++;
-#endif
-       M_LST (tempregnum, REG_SP, 8 * (localvars_base + ri->num) );
-}
-
-static void store_reg_to_var_flt (varid v, int tempregnum)
-{
-       reginfo *ri = v->reg;
-
-       if (!(ri->typeflags & REG_INMEMORY))
-               return;
-#ifdef STATISTICS
-       count_spills++;
-#endif
-       M_DST (tempregnum, REG_SP, 8 * (localvars_base + ri->num) );
-}
-
-
-/***************** functions to process the pseudo commands *******************/
-
-/* gen_method:
-    function to generate method-call
-*/
-
-static void gen_method (pcmd *c)
-{
-       int p, pa, r;
-       s4  a;
-       reginfo *ri;
-       classinfo *ci;
-       
-       for (p = 0; p < c->u.method.paramnum; p++) {
-               ri = c->u.method.params[p]->reg;
-
-               if (p < INT_ARG_CNT) {            /* arguments that go into registers */
-                       if (IS_INT_LNG_REG(ri->typeflags)) {
-                               if (!(ri->typeflags & REG_INMEMORY))
-                                       M_INTMOVE(ri->num, INT_ARG_FST+p);
-                               else
-                                       M_LLD(INT_ARG_FST+p, REG_SP, 8*(localvars_base + ri->num));
-                               }
-                       else {
-                               if (!(ri->typeflags & REG_INMEMORY))
-                                       M_FLTMOVE (ri->num, FLT_ARG_FST+p);
-                               else
-                                       M_DLD(FLT_ARG_FST+p, REG_SP, 8*(localvars_base + ri->num));
-                               }
-                       }
-               else {                             /* arguments that go into memory   */
-                       pa = p - INT_ARG_CNT;
-                       if (pa >= arguments_num)
-                               panic ("invalid stackframe structure");
-                       
-                       if (IS_INT_LNG_REG(ri->typeflags)) {
-                               r = var_to_reg_int (c->u.method.params[p], REG_ITMP1);
-                               M_LST(r, REG_SP, 8 * (0 + pa));
-                               }
-                       else {
-                               r = var_to_reg_flt (c->u.method.params[p], REG_FTMP1);
-                               M_DST (r, REG_SP, 8 * (0 + pa));
-                               }
-                       }
-               }  /* end of for */
-
-       switch (c->opcode) {
-               case CMD_BUILTIN:
-                       a = dseg_addaddress ( (void*) (c->u.method.builtin) );
-
-                       M_LLD (REG_PV, REG_PV, a);        /* Pointer to built-in-function */
-                       goto makeactualcall;
-
-               case CMD_INVOKESTATIC:
-               case CMD_INVOKESPECIAL:
-                       a = dseg_addaddress ( c->u.method.method->stubroutine );
-
-                       M_LLD (REG_PV, REG_PV, a );              /* Method-Pointer in r27 */
-
-                       goto makeactualcall;
-
-               case CMD_INVOKEVIRTUAL:
-
-                       M_LLD (REG_METHODPTR, 16, OFFSET(java_objectheader, vftbl));
-                       M_LLD (REG_PV, REG_METHODPTR,
-                          OFFSET(vftbl,table[0]) + 
-                          sizeof(methodptr) * c->u.method.method->vftblindex );
-
-                       goto makeactualcall;
-
-               case CMD_INVOKEINTERFACE:
-                       ci = c->u.method.method->class;
-                       
-                       M_LLD (REG_METHODPTR, 16, OFFSET(java_objectheader, vftbl));    
-                       M_LLD (REG_METHODPTR, REG_METHODPTR, OFFSET(vftbl, interfacetable[0]) -
-                              sizeof(methodptr*) * ci->index);
-                       M_LLD (REG_PV, REG_METHODPTR, sizeof(methodptr) * (c->u.method.method - ci->methods) );
-
-                       goto makeactualcall;
-
-               default:
-                       sprintf (logtext, "Unkown PCMD-Command: %d", c->opcode);
-                       error ();
-               }
-
-
-makeactualcall:
-
-
-       M_JSR (REG_RA, REG_PV);
-       if (mcodelen<=32768) M_LDA (REG_PV, REG_RA, -mcodelen);
-       else {
-               s4 ml=-mcodelen, mh=0;
-               while (ml<-32768) { ml+=65536; mh--; }
-               M_LDA (REG_PV, REG_RA, ml );
-               M_LDAH (REG_PV, REG_PV, mh );
-       }
-       
-       if ( c->dest ) {
-               ri = c->dest->reg;
-
-               if (IS_INT_LNG_REG(ri->typeflags)) {
-                       if (!(ri->typeflags & REG_INMEMORY))
-                               M_INTMOVE (REG_RESULT, ri->num);
-                       else  M_LST (REG_RESULT, REG_SP, 8 * (localvars_base + ri->num) );
-                       }
-               else {
-                       if (!(ri->typeflags & REG_INMEMORY))
-                               M_FLTMOVE (REG_RESULT, ri->num);
-                       else  M_DST (REG_RESULT, REG_SP, 8 * (localvars_base + ri->num) );
-                       }
-               }
-
-       if (c->u.method.exceptionvar) {
-               ri = c->u.method.exceptionvar->reg;
-               if (!(ri->typeflags & REG_INMEMORY))
-                       M_INTMOVE (REG_EXCEPTION, ri->num);     
-               else M_LST (REG_EXCEPTION, REG_SP, 8 *(localvars_base + ri->num) );
-               }
-}
-
-
-/************************ function block_genmcode ******************************
-
-       generates machine code for a complete basic block
-
-*******************************************************************************/
-
-
-static void block_genmcode(basicblock *b)
-{
-       int  s1, s2, s3, d;
-       s4   a;
-       pcmd *c;
-                       
-       mcode_blockstart (b);
-
-       for(c = list_first(&(b->pcmdlist));
-           c != NULL;
-           c = list_next(&(b->pcmdlist), c))
-
-       switch (c->opcode) {
-
-               case CMD_TRACEBUILT:
-                       M_LDA (REG_SP, REG_SP, -8);
-                       a = dseg_addaddress (c->u.a.value);
-                       M_LLD(REG_ITMP1, REG_PV, a);
-                       M_LST(REG_ITMP1, REG_SP, 0);
-                       a = dseg_addaddress ((void*) (builtin_trace_args));
-                       M_LLD(REG_PV, REG_PV, a);
-                       M_JSR (REG_RA, REG_PV);
-                       if (mcodelen<=32768) M_LDA (REG_PV, REG_RA, -mcodelen);
-                       else {
-                               s4 ml=-mcodelen, mh=0;
-                               while (ml<-32768) { ml+=65536; mh--; }
-                               M_LDA (REG_PV, REG_RA, ml );
-                               M_LDAH (REG_PV, REG_PV, mh );
-                               }
-                       M_LDA (REG_SP, REG_SP, 8);
-                       b -> mpc = mcodelen;
-                       break;
-
-
-               /*********************** constant operations **************************/
-
-               case CMD_LOADCONST_I:
-                       d = reg_of_var(c->dest, REG_ITMP1);
-                       if ( (c->u.i.value >= -32768) && (c->u.i.value <= 32767) ) {
-                               M_LDA (d, REG_ZERO, c->u.i.value);
-                               } 
-                       else {
-                               a = dseg_adds4 (c->u.i.value);
-                               M_ILD (d, REG_PV, a);
-                               }
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_LOADCONST_L:
-                       d = reg_of_var(c->dest, REG_ITMP1);
-#if U8_AVAILABLE
-                       if ((c->u.l.value >= -32768) && (c->u.l.value <= 32767) ) {
-                               M_LDA (d, REG_ZERO, c->u.l.value);
-                               } 
-                       else {
-                               a = dseg_adds8 (c->u.l.value);
-                               M_LLD (d, REG_PV, a);
-                               }
-#else
-                       a = dseg_adds8 (c->u.l.value);
-                       M_LLD (d, REG_PV, a);
-#endif
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_LOADCONST_F:
-                       d = reg_of_var (c->dest, REG_FTMP1);
-                       a = dseg_addfloat (c->u.f.value);
-                       M_FLD (d, REG_PV, a);
-                       store_reg_to_var_flt (c->dest, d);
-                       break;
-                       
-               case CMD_LOADCONST_D:
-                       d = reg_of_var (c->dest, REG_FTMP1);
-                       a = dseg_adddouble (c->u.d.value);
-                       M_DLD (d, REG_PV, a);
-                       store_reg_to_var_flt (c->dest, d);
-                       break;
-
-
-               case CMD_LOADCONST_A:
-                       d = reg_of_var(c->dest, REG_ITMP1);
-                       if (c->u.a.value) {
-                               a = dseg_addaddress (c->u.a.value);
-                               M_LLD (d, REG_PV, a);
-                               }
-                       else {
-                               M_INTMOVE (REG_ZERO, d);
-                               }
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               /************************* move operation *****************************/
-
-               case CMD_MOVE:
-                       if (IS_INT_LNG_REG(c->source1->reg->typeflags)) {
-                               d = reg_of_var(c->dest, REG_ITMP1);
-                               s1 = var_to_reg_int(c->source1, d);
-                               M_INTMOVE(s1,d);
-                               store_reg_to_var_int(c->dest, d);
-                               }
-                       else {
-                               d = reg_of_var(c->dest, REG_FTMP1);
-                               s1 = var_to_reg_flt(c->source1, d);
-                               M_FLTMOVE(s1,d);
-                               store_reg_to_var_flt(c->dest, d);
-                               }
-                       break;
-
-
-               /********************* integer operations *****************************/
-
-               case CMD_IINC:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1); 
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       if ((c->u.i.value >= 0) && (c->u.i.value <= 256)) {
-                               M_IADD (s1, c->u.i.value, d, 1);
-                               }
-                       else if ((c->u.i.value >= -256) && (c->u.i.value < 0)) {
-                               M_ISUB (s1, (-c->u.i.value), d, 1);
-                               }
-                       else {
-                               M_LDA  (d, s1, c->u.i.value);
-                               M_IADD (d, REG_ZERO, d, 0);
-                               }
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_INEG:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1); 
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_ISUB (REG_ZERO, s1, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_LNEG:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_LSUB (REG_ZERO, s1, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_I2L:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_INTMOVE (s1, d);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_L2I:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_IADD (s1, REG_ZERO, d , 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_INT2BYTE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_BSEXT  (s1, d);
-                               }
-                       else {
-                               M_SLL (s1,56, d, 1);
-                               M_SRA ( d,56, d, 1);
-                               }
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_INT2CHAR:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-            M_ZAPNOT (s1, 0x03, d, 1);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_INT2SHORT:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_SSEXT  (s1, d);
-                               }
-                       else {
-                               M_SLL ( s1, 48, d, 1);
-                               M_SRA (  d, 48, d, 1);
-                               }
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_IADD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_IADD (s1, s2, d,  0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-               case CMD_LADD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_LADD (s1, s2, d,  0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_ISUB:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_ISUB (s1, s2, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-               case CMD_LSUB:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_LSUB (s1, s2, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_IMUL:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_IMUL (s1, s2, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-               case CMD_LMUL:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_LMUL (s1, s2, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-                   
-               case CMD_ISHL:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_AND (s2, 0x1f, REG_ITMP3, 1);
-                       M_SLL (s1, REG_ITMP3, d, 0);
-                       M_IADD (d, REG_ZERO, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_ISHR:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_AND (s2, 0x1f, REG_ITMP3,  1);
-                       M_SRA (s1, REG_ITMP3, d,   0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_IUSHR:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_AND    (s2, 0x1f, REG_ITMP2,  1);
-            M_ZAPNOT (s1, 0x0f, d, 1);
-                       M_SRL    ( d, REG_ITMP2, d, 0);
-                       M_IADD   ( d, REG_ZERO, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_LSHL:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_SLL (s1, s2, d,  0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_LSHR:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_SRA (s1, s2, d,  0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_LUSHR:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_SRL (s1, s2, d,  0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_IAND:
-               case CMD_LAND:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_AND (s1, s2, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_IOR:
-               case CMD_LOR:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_OR   ( s1,s2, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_IXOR:
-               case CMD_LXOR:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_XOR (s1, s2, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-
-               case CMD_LCMP:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_CMPLT  (s1, s2, REG_ITMP3, 0);
-                       M_CMPLT  (s2, s1, REG_ITMP1, 0);
-                       M_LSUB   (REG_ITMP1, REG_ITMP3, d, 0);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-                       
-
-               /*********************** floating operations **************************/
-
-               case CMD_FNEG:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FMOVN (s1, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               case CMD_DNEG:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FMOVN (s1, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-
-               case CMD_FADD:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FADD ( s1,s2, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               case CMD_DADD:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_DADD (s1, s2, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-
-               case CMD_FSUB:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FSUB (s1, s2, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               case CMD_DSUB:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_DSUB (s1, s2, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-
-               case CMD_FMUL:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FMUL   (s1, s2, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               case CMD_DMUL:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_DMUL   (s1, s2, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-
-               case CMD_FDIV:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FDIV   (s1, s2, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               case CMD_DDIV:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_DDIV   (s1, s2, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               
-               case CMD_FREM:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FDIV   ( s1,s2, REG_FTMP3 );
-                       M_CVTDL_C ( REG_ZERO, REG_FTMP3, REG_FTMP3 ); /* round to integer */
-                       M_CVTLF ( REG_ZERO, REG_FTMP3, REG_FTMP3 );
-                       M_FMUL ( REG_FTMP3, s2, REG_FTMP3 );
-                       M_FSUB ( s1, REG_FTMP3, d);
-                       store_reg_to_var_flt(c->dest, d);
-                   break;
-               case CMD_DREM:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_DDIV   ( s1,s2, REG_FTMP3 );
-                       M_CVTDL_C ( REG_ZERO, REG_FTMP3, REG_FTMP3 ); /* round to integer */
-                       M_CVTLD ( REG_ZERO, REG_FTMP3, REG_FTMP3 );
-                       M_DMUL ( REG_FTMP3, s2, REG_FTMP3 );
-                       M_DSUB ( s1, REG_FTMP3, d);
-                       store_reg_to_var_flt(c->dest, d);
-                   break;
-
-               case CMD_I2F:
-               case CMD_L2F:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       a = dseg_adddouble(0.0);
-                       M_LST (s1, REG_PV, a);
-                       M_DLD (d, REG_PV, a);
-                       M_CVTLF ( REG_ZERO, d, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-
-               case CMD_I2D:
-               case CMD_L2D:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       a = dseg_adddouble(0.0);
-                       M_LST (s1, REG_PV, a);
-                       M_DLD (d, REG_PV, a);
-                       M_CVTLD ( REG_ZERO, d, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-                       
-               case CMD_F2I:
-               case CMD_D2I:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       a = dseg_adddouble(0.0);
-                       M_CVTDL_C (REG_ZERO, s1, REG_FTMP1);
-                       M_DST (REG_FTMP1, REG_PV, a);
-                       M_ILD (d, REG_PV, a);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-               
-               case CMD_F2L:
-               case CMD_D2L:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       a = dseg_adddouble(0.0);
-                       M_CVTDL_C (REG_ZERO, s1, REG_FTMP1);
-                       M_DST (REG_FTMP1, REG_PV, a);
-                       M_LLD (d, REG_PV, a);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_F2D:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FLTMOVE (s1, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-                                       
-               case CMD_D2F:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_FADD (s1, REG_ZERO, d);
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               
-               case CMD_FCMPL:
-               case CMD_DCMPL:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_LSUB   (REG_ZERO, 1, d, 1);
-                       M_FCMPEQ (s1, s2, REG_FTMP3);
-                       M_FBEQZ  (REG_FTMP3, 1);   /* jump over next instructions         */
-                       M_OR     (REG_ZERO, REG_ZERO, d, 0);
-                       M_FCMPLT (s2, s1, REG_FTMP3);
-                       M_FBEQZ  (REG_FTMP3, 1);   /* jump over next instruction          */
-                       M_LADD   (REG_ZERO, 1, d, 1);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-                       
-               case CMD_FCMPG:
-               case CMD_DCMPG:
-                       s1 = var_to_reg_flt(c->source1, REG_FTMP1);
-                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_LADD   (REG_ZERO, 1, d, 1);
-                       M_FCMPEQ (s1, s2, REG_FTMP3);
-                       M_FBEQZ  (REG_FTMP3, 1);   /* jump over next instruction          */
-                       M_OR     (REG_ZERO, REG_ZERO, d, 0);
-                       M_FCMPLT (s1, s2, REG_FTMP3);
-                       M_FBEQZ  (REG_FTMP3, 1);   /* jump over next instruction          */
-                       M_LSUB   (REG_ZERO, 1, d, 1);
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-
-               /********************** memory operations *****************************/
-
-               case CMD_ARRAYLENGTH:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_ILD    (d, s1, OFFSET(java_arrayheader, size));
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_AALOAD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_S8ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_LLD    ( d, REG_ITMP1, OFFSET (java_objectarray, data[0]));
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-               case CMD_LALOAD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_S8ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_LLD    ( d, REG_ITMP1, OFFSET (java_longarray, data[0]));
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-               case CMD_IALOAD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       M_S4ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_ILD    ( d, REG_ITMP1, OFFSET (java_intarray, data[0]));
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-               case CMD_FALOAD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_S4ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_FLD    ( d, REG_ITMP1, OFFSET (java_floatarray, data[0]));
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               case CMD_DALOAD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_FTMP3);
-                       M_S8ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_DLD    ( d, REG_ITMP1, OFFSET (java_doublearray, data[0]));
-                       store_reg_to_var_flt(c->dest, d);
-                       break;
-               case CMD_CALOAD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD   (s2, s1, REG_ITMP1, 0);
-                               M_LADD   (s2, REG_ITMP1, REG_ITMP1, 0);
-                               M_SLDU   (d, REG_ITMP1, OFFSET (java_chararray, data[0]));
-                               }
-                       else {
-                               M_LADD   (s2, s1, REG_ITMP1,  0);
-                               M_LADD   (s2, REG_ITMP1, REG_ITMP1, 0);
-                               M_LLD_U  (REG_ITMP2, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               M_LDA    (REG_ITMP1, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               M_EXTWL  (REG_ITMP2, REG_ITMP1, d, 0);
-                               }
-                       store_reg_to_var_int(c->dest, d);
-                       break;                  
-               case CMD_SALOAD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD   (s2, s1, REG_ITMP1, 0);
-                               M_LADD   (s2, REG_ITMP1, REG_ITMP1, 0);
-                               M_SLDU   (d, REG_ITMP1, OFFSET (java_shortarray, data[0]));
-                               M_SSEXT  (d, d);
-                               }
-                       else {
-                               M_LADD   (s2, s1, REG_ITMP1,  0);
-                               M_LADD   (s2, REG_ITMP1, REG_ITMP1, 0);
-                               M_LLD_U  (REG_ITMP2, REG_ITMP1, OFFSET(java_shortarray, data[0]));
-                               M_LDA    (REG_ITMP1, REG_ITMP1, OFFSET(java_shortarray, data[0]) + 2);
-                               M_EXTQH  (REG_ITMP2, REG_ITMP1, d, 0);
-                               M_SRA    (d, 48, d, 1);
-                               }
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-               case CMD_BALOAD:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       d = reg_of_var(c->dest, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD   (s2, s1, REG_ITMP1, 0);
-                               M_BLDU   (d, REG_ITMP1, OFFSET (java_shortarray, data[0]));
-                               M_BSEXT  (d, d);
-                               }
-                       else {
-                               M_LADD   (s2, s1, REG_ITMP1,  0);
-                               M_LLD_U  (REG_ITMP2, REG_ITMP1, OFFSET(java_bytearray, data[0]));
-                               M_LDA    (REG_ITMP1, REG_ITMP1, OFFSET(java_bytearray, data[0]) + 1);
-                               M_EXTQH  (REG_ITMP2, REG_ITMP1, d,   0);
-                               M_SRA    (d, 56, d,  1);
-                               }
-                       store_reg_to_var_int(c->dest, d);
-                       break;
-
-               case CMD_AASTORE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       s3 = var_to_reg_int(c->source3, REG_ITMP3);
-                       M_S8ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_LST    (s3, REG_ITMP1, OFFSET (java_objectarray, data[0]));
-                       break;
-               case CMD_LASTORE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       s3 = var_to_reg_int(c->source3, REG_ITMP3);
-                       M_S8ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_LST    (s3, REG_ITMP1, OFFSET (java_longarray, data[0]));
-                       break;
-               case CMD_IASTORE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       s3 = var_to_reg_int(c->source3, REG_ITMP3);
-                       M_S4ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_IST    (s3, REG_ITMP1, OFFSET (java_intarray, data[0]));
-                       break;
-               case CMD_FASTORE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       s3 = var_to_reg_flt(c->source3, REG_FTMP3);
-                       M_S4ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_FST    (s3, REG_ITMP1, OFFSET (java_floatarray, data[0]));
-                       break;
-               case CMD_DASTORE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       s3 = var_to_reg_flt(c->source3, REG_FTMP3);
-                       M_S8ADDQ (s2, s1, REG_ITMP1, 0);
-                       M_DST    (s3, REG_ITMP1, OFFSET (java_doublearray, data[0]));
-                       break;
-               case CMD_CASTORE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       s3 = var_to_reg_int(c->source3, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD   (s2, s1, REG_ITMP1, 0);
-                               M_LADD   (s2, REG_ITMP1, REG_ITMP1, 0);
-                               M_SST    (s3, REG_ITMP1, OFFSET (java_chararray, data[0]));
-                               }
-                       else {
-                               M_LADD   (s2, s1, REG_ITMP1, 0);
-                               M_LADD   (s2, REG_ITMP1, REG_ITMP1, 0);
-                               M_LLD_U  (REG_ITMP2, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               M_LDA    (REG_ITMP1, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               M_INSWL  (s3, REG_ITMP1, REG_ITMP3, 0);
-                               M_MSKWL  (REG_ITMP2, REG_ITMP1, REG_ITMP2, 0);
-                               M_OR     (REG_ITMP2, REG_ITMP3, REG_ITMP2, 0);
-                               M_LST_U  (REG_ITMP2, REG_ITMP1, 0);
-                               }
-                       break;
-               case CMD_SASTORE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       s3 = var_to_reg_int(c->source3, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD   (s2, s1, REG_ITMP1, 0);
-                               M_LADD   (s2, REG_ITMP1, REG_ITMP1, 0);
-                               M_SST    (s3, REG_ITMP1, OFFSET (java_shortarray, data[0]));
-                               }
-                       else {
-                               M_LADD   (s2, s1, REG_ITMP1, 0);
-                               M_LADD   (s2, REG_ITMP1, REG_ITMP1, 0);
-                               M_LLD_U  (REG_ITMP2, REG_ITMP1, OFFSET(java_shortarray, data[0]));
-                               M_LDA    (REG_ITMP1, REG_ITMP1, OFFSET(java_shortarray, data[0]));
-                               M_INSWL  (s3, REG_ITMP1, REG_ITMP3, 0);
-                               M_MSKWL  (REG_ITMP2, REG_ITMP1, REG_ITMP2, 0);
-                               M_OR     (REG_ITMP2, REG_ITMP3, REG_ITMP2, 0);
-                               M_LST_U  (REG_ITMP2, REG_ITMP1, 0);
-                               }
-                       break;
-               case CMD_BASTORE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       s3 = var_to_reg_int(c->source3, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD   (s2, s1, REG_ITMP1, 0);
-                               M_BST    (s3, REG_ITMP1, OFFSET (java_bytearray, data[0]));
-                               }
-                       else {
-                               M_LADD   (s2, s1, REG_ITMP1,  0);
-                               M_LLD_U  (REG_ITMP2, REG_ITMP1, OFFSET (java_bytearray, data[0]));
-                               M_LDA    (REG_ITMP1, REG_ITMP1, OFFSET (java_bytearray, data[0]));
-                               M_INSBL  (s3, REG_ITMP1, REG_ITMP3,     0);
-                               M_MSKBL  (REG_ITMP2, REG_ITMP1, REG_ITMP2,  0);
-                               M_OR     (REG_ITMP2, REG_ITMP3, REG_ITMP2,  0);
-                               M_LST_U  (REG_ITMP2, REG_ITMP1, 0);
-                               }
-                       break;
-
-
-               case CMD_PUTFIELD:
-                       switch (c->u.mem.type) {
-                               case TYPE_INT:
-                                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                                       M_IST (s2, s1, c->u.mem.offset);
-                                       break;
-                               case TYPE_LONG:
-                               case TYPE_ADDRESS:
-                                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                                       M_LST (s2, s1, c->u.mem.offset);
-                                       break;
-                               case TYPE_FLOAT:
-                                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                                       M_FST (s2, s1, c->u.mem.offset);
-                                       break;
-                               case TYPE_DOUBLE:
-                                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                                       s2 = var_to_reg_flt(c->source2, REG_FTMP2);
-                                       M_DST (s2, s1, c->u.mem.offset);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case CMD_GETFIELD:
-                       switch (c->u.mem.type) {
-                               case TYPE_INT:
-                                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                                       d = reg_of_var(c->dest, REG_ITMP3);
-                                       M_ILD (d, s1, c->u.mem.offset);
-                                       store_reg_to_var_int(c->dest, d);
-                                       break;
-                               case TYPE_LONG:
-                               case TYPE_ADDRESS:
-                                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                                       d = reg_of_var(c->dest, REG_ITMP3);
-                                       M_LLD (d, s1, c->u.mem.offset);
-                                       store_reg_to_var_int(c->dest, d);
-                                       break;
-                               case TYPE_FLOAT:
-                                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                                       d = reg_of_var(c->dest, REG_FTMP1);
-                                       M_FLD (d, s1, c->u.mem.offset);
-                                       store_reg_to_var_flt(c->dest, d);
-                                       break;
-                               case TYPE_DOUBLE:                               
-                                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                                       d = reg_of_var(c->dest, REG_FTMP1);
-                                       M_DLD (d, s1, c->u.mem.offset);
-                                       store_reg_to_var_flt(c->dest, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               /********************** branch operations *****************************/
-
-               case CMD_GOTO:
-                       mcode_addreference (c->u.bra.target);
-                       M_BR (0);
-                       break;
-
-               case CMD_JSR: {
-                       reginfo *di = c->dest->reg;
-
-                       if (di->typeflags & REG_INMEMORY)
-                               panic ("Can not put returnaddress into memory var");
-
-                       mcode_addreference (c->u.bra.target);
-                       M_BSR (di->num, 0);
-                       }
-                       break;
-                       
-               case CMD_RET:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       M_RET (REG_ZERO, s1);
-                       break;
-
-               case CMD_IFEQ:
-               case CMD_IFEQL:
-               case CMD_IFNULL:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       mcode_addreference (c->u.bra.target);
-                       M_BEQZ (s1, 0);
-                       break;
-               case CMD_IFLT:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       mcode_addreference (c->u.bra.target);
-                       M_BLTZ (s1, 0);
-                       break;
-               case CMD_IFLE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       mcode_addreference (c->u.bra.target);
-                       M_BLEZ (s1, 0);
-                       break;
-               case CMD_IFNE:
-               case CMD_IFNONNULL:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       mcode_addreference (c->u.bra.target);
-                       M_BNEZ (s1, 0);
-                       break;
-               case CMD_IFGT:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       mcode_addreference (c->u.bra.target);
-                       M_BGTZ (s1, 0);
-                       break;
-               case CMD_IFGE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       mcode_addreference (c->u.bra.target);
-                       M_BGEZ (s1, 0);
-                       break;
-
-               case CMD_IF_ICMPEQ:
-               case CMD_IF_ACMPEQ:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       M_CMPEQ (s1, s2, REG_ITMP1, 0);
-                       mcode_addreference (c->u.bra.target);
-                       M_BNEZ (REG_ITMP1, 0);
-                       break;
-               case CMD_IF_ICMPNE:
-               case CMD_IF_ACMPNE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       M_CMPEQ (s1, s2, REG_ITMP1, 0);
-                       mcode_addreference (c->u.bra.target);
-                       M_BEQZ (REG_ITMP1, 0);
-                       break;
-               case CMD_IF_ICMPLT:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       M_CMPLT (s1, s2, REG_ITMP1, 0);
-                       mcode_addreference (c->u.bra.target);
-                       M_BNEZ (REG_ITMP1, 0);
-                       break;
-               case CMD_IF_ICMPGT:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       M_CMPLE (s1, s2, REG_ITMP1, 0);
-                       mcode_addreference ( c->u.bra.target );
-                       M_BEQZ (REG_ITMP1, 0);
-                       break;
-               case CMD_IF_ICMPLE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       M_CMPLE (s1, s2, REG_ITMP1, 0);
-                       mcode_addreference (c->u.bra.target);
-                       M_BNEZ (REG_ITMP1, 0);
-                       break;
-               case CMD_IF_ICMPGE:
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       M_CMPLT (s1, s2, REG_ITMP1,  0);
-                       mcode_addreference (c->u.bra.target);
-                       M_BEQZ (REG_ITMP1, 0);
-                       break;
-
-               case CMD_IF_UCMPGE: /* branch if the unsigned value of s1 is 
-                                      greater that s2 (note, that s2 has
-                                      to be >= 0) */
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       M_CMPULE (s2, s1, REG_ITMP1, 0);
-                       mcode_addreference (c->u.bra.target);
-                       M_BNEZ (REG_ITMP1, 0);
-            break;
-
-
-               case CMD_IRETURN:
-               case CMD_LRETURN:
-               case CMD_ARETURN:
-                       s1 = var_to_reg_int(c->source1, REG_RESULT);
-                       M_INTMOVE (s1, REG_RESULT);
-                       goto nowperformreturn;
-               case CMD_FRETURN:
-               case CMD_DRETURN:
-                       s1 = var_to_reg_flt(c->source1, REG_FRESULT);
-                       M_FLTMOVE (s1, REG_FRESULT);
-                       goto nowperformreturn;
-
-               case CMD_RETURN:
-nowperformreturn:
-                       {
-                       int r, p;
-                       
-                       s2 = var_to_reg_int(c->source2, REG_ITMP2);
-                       M_INTMOVE (s2, REG_EXCEPTION);
-
-                       p = parentargs_base;
-                       if (!isleafmethod)
-                               {p--;  M_LLD (REG_RA, REG_SP, 8*p);}
-                       for (r = INT_SAV_FST; r < INT_SAV_FST + INT_SAV_CNT; r++)
-                               if (!(intregs[r].typeflags & REG_ISUNUSED))
-                                       {p--; M_LLD (r, REG_SP, 8*p);}
-                       for (r = FLT_SAV_FST; r < FLT_SAV_FST + FLT_SAV_CNT; r++)
-                               if (!(floatregs[r].typeflags & REG_ISUNUSED))
-                                       {p--; M_DLD (r, REG_SP, 8*p);}
-
-                       if (parentargs_base)
-                               {M_LDA (REG_SP, REG_SP, parentargs_base*8);}
-                       if (runverbose) {
-                               M_LDA (REG_SP, REG_SP, -32);
-                               M_LST(REG_RA, REG_SP, 0);
-                               M_LST(REG_RESULT, REG_SP, 8);
-                               M_DST(REG_FRESULT, REG_SP,16);
-                               M_LST(REG_EXCEPTION, REG_SP, 24);
-                               a = dseg_addaddress (method);
-                               M_LLD(INT_ARG_FST, REG_PV, a);
-                               M_OR(REG_RESULT, REG_RESULT, INT_ARG_FST + 1, 0);
-                               M_FLTMOVE(REG_FRESULT, FLT_ARG_FST + 2);
-                               a = dseg_addaddress ((void*) (builtin_displaymethodstop));
-                               M_LLD(REG_PV, REG_PV, a);
-                               M_JSR (REG_RA, REG_PV);
-                               if (mcodelen<=32768) M_LDA (REG_PV, REG_RA, -mcodelen);
-                               else {
-                                       s4 ml=-mcodelen, mh=0;
-                                       while (ml<-32768) { ml+=65536; mh--; }
-                                       M_LDA (REG_PV, REG_RA, ml );
-                                       M_LDAH (REG_PV, REG_PV, mh );
-                                       }
-                               M_LLD(REG_EXCEPTION, REG_SP, 24);
-                               M_DLD(REG_FRESULT, REG_SP,16);
-                               M_LLD(REG_RESULT, REG_SP, 8);
-                               M_LLD(REG_RA, REG_SP, 0);
-                               M_LDA (REG_SP, REG_SP, 32);
-                               }
-                       M_RET (REG_ZERO, REG_RA);
-                       }
-                       break;
-
-
-               case CMD_TABLEJUMP:
-                       {
-                       int i;
-
-                       /* build jump table top down and use address of lowest entry */
-
-                       a = 0;
-                       for (i = c->u.tablejump.targetcount - 1; i >= 0; i--) {
-                               a = dseg_addtarget (c->u.tablejump.targets[i]);
-                               }
-                       }
-
-                       /* last offset a returned by dseg_addtarget is used by load */
-
-                       s1 = var_to_reg_int(c->source1, REG_ITMP1);
-                       M_S8ADDQ (s1, REG_PV, REG_ITMP2, 0);
-                       M_LLD (REG_ITMP3, REG_ITMP2, a);
-                       M_JMP (REG_ZERO, REG_ITMP3);
-                       break;
-
-
-               case CMD_INVOKESTATIC:
-               case CMD_INVOKESPECIAL:
-               case CMD_INVOKEVIRTUAL:
-               case CMD_INVOKEINTERFACE:
-               case CMD_BUILTIN:
-                       gen_method (c);
-                       break;
-
-               case CMD_DROP:
-               case CMD_ACTIVATE:
-                       break;
-
-               default: sprintf (logtext, "Unknown pseudo command: %d(%d)", c->opcode,
-                                 c->tag);
-                                error();
-       }
-}
-
-
-/*********************** function input_args_prealloc **************************
-
-       preallocates the input arguments (on the Alpha only for leaf methods)
-
-*******************************************************************************/
-
-
-static void input_args_prealloc()
-{
-       int     i, t;
-       varid   p;
-       reginfo *r;
-
-       if (isleafmethod)
-               for (i = 0; (i < mparamnum) && (i < INT_ARG_CNT); i++) {
-                       t = mparamtypes[i];
-                       p = mparamvars[i];
-                       p->saved = !isleafmethod;
-                       if (t==TYPE_DOUBLE || t==TYPE_FLOAT)
-                               r = &floatregs[FLT_ARG_FST + i];
-                       else
-                               r = &intregs[INT_ARG_FST + i];
-                       r->typeflags &= ~REG_ISFREEUNUSED;
-                       p->reg = r;
-                       }
-}
-
-
-/********************* function gen_computestackframe **************************
-
-       computes the size and the layout of a stack frame.
-       The values of localvars_base, savedregs_base, parentargs_base 
-    are numbers of 8-byte slots in the stackframe (every spilled or
-    saved register value will be stored in a 64-bit slot, regardless
-    of its type: INT/LONG/FLOAT/DOUBLE/ADDRESS)
-       (a detailed description of the stack frame is contained in 'calling.doc')
-
-
-*******************************************************************************/
-
-
-static void gen_computestackframe()
-{
-       int i;
-
-       savedregs_num = (isleafmethod) ? 0 : 1;   /* space to save the RA */
-
-       /* space to save used callee saved registers */
-
-       for (i = INT_SAV_FST; i < INT_SAV_FST + INT_SAV_CNT; i++)
-               if (! (intregs[i].typeflags & REG_ISUNUSED))
-                       savedregs_num++;
-       for (i = FLT_SAV_FST; i < FLT_SAV_FST + FLT_SAV_CNT; i++)
-               if (! (floatregs[i].typeflags & REG_ISUNUSED))
-                       savedregs_num++;
-
-       localvars_base = arguments_num;
-       savedregs_base = localvars_base + localvars_num;
-       parentargs_base = savedregs_base + savedregs_num;
-}
-
-
-/******************** function gen_header **************************************
-
-       using the data computed by gen_computestackframe it generates a function
-       header which:
-       
-               - saves the necessary registers
-               - copies arguments to registers or to stack slots
-               
-*******************************************************************************/
-
-
-static void gen_header ()
-{
-       int p, pa, r;
-       reginfo *ri;
-
-
-       /* create stack frame (if necessary) */
-
-       if (parentargs_base)
-               {M_LDA (REG_SP, REG_SP, -parentargs_base * 8);}
-
-       /* save return address and used callee saved registers */
-
-       p = parentargs_base;
-       if (!isleafmethod)
-               {p--;  M_LST (REG_RA, REG_SP, 8*p);}
-       for (r = INT_SAV_FST; r < INT_SAV_FST + INT_SAV_CNT; r++)
-               if (!(intregs[r].typeflags & REG_ISUNUSED))
-                       {p--; M_LST (r, REG_SP, 8 * p);}
-       for (r = FLT_SAV_FST; r < FLT_SAV_FST + FLT_SAV_CNT; r++)
-               if (!(floatregs[r].typeflags & REG_ISUNUSED))
-                       {p--; M_DST (r, REG_SP, 8 * p);}
-
-       /* take arguments out of register or stack frame */
-
-       for (p = 0; p < mparamnum; p++) {
-               ri = mparamvars[p]->reg;
-
-               if (p < INT_ARG_CNT) {                       /* register arguments    */
-                       if (IS_INT_LNG_REG(ri->typeflags)) {     /* integer args          */ 
-                               if (!(ri->typeflags & REG_INMEMORY)) /* reg arg -> register   */
-                                       M_INTMOVE (16+p, ri->num);
-                               else                                 /* reg arg -> spilled    */
-                                       M_LST (16+p, REG_SP, 8 * (localvars_base + ri->num));
-                               }
-                       else {                                   /* floating args         */   
-                               if (!(ri->typeflags & REG_INMEMORY)) /* reg-arg -> register   */
-                                       M_FLTMOVE (16+p, ri->num);
-                               else                                             /* reg-arg -> spilled    */
-                                       M_DST (16+p, REG_SP, 8 * (localvars_base + ri->num));
-                               }
-                       }
-
-               else {                                       /* stack arguments       */
-                       pa = p - INT_ARG_CNT;
-                       if (IS_INT_LNG_REG(ri->typeflags)) {     /* integer args          */
-                               if (!(ri->typeflags & REG_INMEMORY)) /* stack arg -> register */ 
-                                       M_LLD (ri->num, REG_SP, 8 * (parentargs_base + pa));
-                               else {                               /* stack arg -> spilled  */
-                                       M_LLD (REG_ITMP1, REG_SP, 8 * (parentargs_base + pa));
-                                       M_LST (REG_ITMP1, REG_SP, 8 * (localvars_base + ri->num));
-                                       }
-                               }
-                       else {
-                               if (!(ri->typeflags & REG_INMEMORY)) /* stack-arg -> register */
-                                       M_DLD (ri->num, REG_SP, 8 * (parentargs_base + pa) );
-                               else {                               /* stack-arg -> spilled  */
-                                       M_DLD (REG_FTMP1, REG_SP, 8 * (parentargs_base + pa));
-                                       M_DST (REG_FTMP1, REG_SP, 8 * (localvars_base + ri->num));
-                                       }
-                               }
-                       }
-               }  /* end for */
-}  /* end gen_header */
-
-
-/************************ function gen_resolvebranch ***************************
-
-       backpatches a branch instruction; Alpha branch instructions are very
-       regular, so it is only necessary to overwrite some fixed bits in the
-       instruction.
-
-       parameters: mcodepiece .. start of code area
-                   sourcepos ... offset of branch instruction
-                   targetpos ... offset of branch target
-
-*******************************************************************************/
-
-
-static void gen_resolvebranch ( void* mcodepiece, s4 sourcepos, s4 targetpos)
-{
-       s4 *command = mcodepiece;
-       s4 offset = targetpos - (sourcepos+4);
-
-       (*command) |=  ((offset >> 2) & ((s4) 0x1fffff) );
-}
-
-
-
-/******** redefinition of code generation makros (compilinf into array) *******/
-
-/* 
-These macros are newly defined to allow code generation into an array.
-This is necessary, because the original M_.. macros generate code by
-calling 'mcode_adds4' that uses an additional data structure to
-receive the code.
-
-For a faster (but less flexible) version to generate code, these
-macros directly use the (s4* p) - pointer to put the code directly
-in a locally defined array.
-This makes sense only for the stub-generation-routines below.
-*/
-
-#undef M_OP3
-#define M_OP3(op,fu,a,b,c,const) \
-       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<(16-3*(const)))| \
-       ((const)<<12)|((fu)<<5)|((c)) )
-#undef M_FOP3
-#define M_FOP3(op,fu,a,b,c) \
-       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((fu)<<5)|(c) )
-#undef M_BRA
-#define M_BRA(op,a,disp) \
-       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((disp)&0x1fffff) )
-#undef M_MEM
-#define M_MEM(op,a,b,disp) \
-       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((disp)&0xffff) )
-
-
-#if 0
-
-/************************ function createcompilerstub **************************
-
-       creates a stub routine which calls the compiler
-       
-*******************************************************************************/
-
-#define COMPSTUBSIZE 3
-
-u1 *createcompilerstub (methodinfo *m)
-{
-       u8 *s = CNEW (u8, COMPSTUBSIZE);    /* memory to hold the stub            */
-       s4 *p = (s4*) s;                    /* code generation pointer            */
-       
-                                           /* code for the stub                  */
-       M_LLD (REG_PV, REG_PV, 16);         /* load pointer to the compiler       */
-       M_JMP (0, REG_PV);                  /* jump to the compiler, return address
-                                              in reg 0 is used as method pointer */
-       s[1] = (u8) m;                      /* literals to be adressed            */  
-       s[2] = (u8) asm_call_jit_compiler;  /* jump directly via PV from above    */
-
-#ifdef STATISTICS
-       count_cstub_len += COMPSTUBSIZE * 8;
-#endif
-
-       return (u1*) s;
-}
-
-
-/************************* function removecompilerstub *************************
-
-     deletes a compilerstub from memory  (simply by freeing it)
-
-*******************************************************************************/
-
-void removecompilerstub (u1 *stub) 
-{
-       CFREE (stub, COMPSTUBSIZE * 8);
-}
-
-
-/************************ function: removenativestub ***************************
-
-    removes a previously created native-stub from memory
-    
-*******************************************************************************/
-
-void removenativestub (u1 *stub)
-{
-       CFREE (stub, NATIVESTUBSIZE * 8);
-}
-
-#endif /* 0 */
-
-
-/********************* Funktion: createnativestub ******************************
-
-       creates a stub routine which calls a native method
-       
-*******************************************************************************/
-
-#define NATIVESTUBSIZE 11
-
-u1 *oldcreatenativestub (functionptr f, methodinfo *m)
-{
-       u8 *s = CNEW (u8, NATIVESTUBSIZE);  /* memory to hold the stub      */
-       s4 *p = (s4*) s;                    /* code generation pointer      */
-
-       M_LDA  (REG_SP, REG_SP, -8);        /* build up stackframe          */
-       M_LST  (REG_RA, REG_SP, 0);         /* store return address         */
-
-       M_LLD  (REG_PV, REG_PV, 6*8);       /* load adress of native method */
-       M_JSR  (REG_RA, REG_PV);            /* call native method           */
-       M_LDA  (REG_PV, REG_RA, -4*4);      /* recompute pv from ra         */
-
-       M_LLD  (22, REG_PV, 7*8);           /* get address of exceptionptr  */
-       M_LLD  (REG_EXCEPTION, 22, 0);      /* load exception into reg. 1   */
-       M_LST  (REG_ZERO, 22, 0);           /* store NULL into exceptionptr */
-
-       M_LLD  (REG_RA, REG_SP, 0);         /* load return address          */
-       M_LDA  (REG_SP, REG_SP, 8);         /* remove stackframe            */
-       
-       M_RET  (REG_ZERO, REG_RA);          /* return to caller             */
-
-       s[6] = (u8) f;                      /* address of native method     */
-       s[7] = (u8) (&exceptionptr);        /* address of exceptionptr      */
-
-#ifdef STATISTICS
-       count_nstub_len += NATIVESTUBSIZE * 8;
-#endif
-
-       return (u1*) s;
-}
diff --git a/alpha/native-math.h b/alpha/native-math.h
deleted file mode 100644 (file)
index 2ad03a4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* alpha/native-math.h *********************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the machine-specific floating point definitions.
-
-       Authors: Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-                Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/10/21
-
-*******************************************************************************/
-
-#ifndef _NATIVE_MATH_H
-#define _NATIVE_MATH_H
-
-/* include machine-specific math.h */
-
-#include <math.h>
-
-/* define infinity for floating point numbers */
-
-static u4 flt_nan    = 0xffffffff;
-static u4 flt_posinf = 0x7f800000;
-static u4 flt_neginf = 0xff800000;
-
-#define FLT_NAN    (*((float*) (&flt_nan)))
-#define FLT_POSINF (*((float*) (&flt_posinf)))
-#define FLT_NEGINF (*((float*) (&flt_neginf)))
-
-/* define infinity for double floating point numbers */
-
-static u8 dbl_nan    = 0xffffffffffffffffL ;
-static u8 dbl_posinf = 0x7ff0000000000000L ;
-static u8 dbl_neginf = 0xfff0000000000000L ;
-
-#define DBL_NAN    (*((double*) (&dbl_nan)))
-#define DBL_POSINF (*((double*) (&dbl_posinf)))
-#define DBL_NEGINF (*((double*) (&dbl_neginf)))
-
-#endif
diff --git a/alpha/ngen.c b/alpha/ngen.c
deleted file mode 100644 (file)
index 531d407..0000000
+++ /dev/null
@@ -1,3909 +0,0 @@
-/* alpha/ngen.c ****************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the codegenerator for an Alpha processor.
-       This module generates Alpha machine code for a sequence of
-       pseudo commands (ICMDs).
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: $Id: ngen.c 552 2003-11-01 20:47:35Z twisti $
-
-*******************************************************************************/
-
-#include "jitdef.h"   /* phil */
-
-/* *****************************************************************************
-
-Datatypes and Register Allocations:
------------------------------------ 
-
-On 64-bit-machines (like the Alpha) all operands are stored in the
-registers in a 64-bit form, even when the correspondig JavaVM  operands
-only need 32 bits. This is done by a canonical representation:
-
-32-bit integers are allways stored as sign-extended 64-bit values (this
-approach is directly supported by the Alpha architecture and is very easy
-to implement).
-
-32-bit-floats are stored in a 64-bit doubleprecision register by simply
-expanding the exponent and mantissa with zeroes. (also supported by the
-architecture)
-
-
-Stackframes:
-
-The calling conventions and the layout of the stack is  explained in detail
-in the documention file: calling.doc
-
-*******************************************************************************/
-
-
-/* additional functions and macros to generate code ***************************/
-
-/* #define BlockPtrOfPC(pc)        block+block_index[pc] */
-#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
-
-
-#ifdef STATISTICS
-#define COUNT_SPILLS count_spills++
-#else
-#define COUNT_SPILLS
-#endif
-
-
-/* gen_nullptr_check(objreg) */
-
-#ifdef SOFTNULLPTRCHECK
-#define gen_nullptr_check(objreg) \
-       if (checknull) {\
-       M_BEQZ((objreg), 0);\
-       mcode_addxnullrefs(mcodeptr);\
-       }
-#else
-#define gen_nullptr_check(objreg)
-#endif
-
-
-/* MCODECHECK(icnt) */
-
-#define MCODECHECK(icnt) \
-       if((mcodeptr+(icnt))>mcodeend)mcodeptr=mcode_increase((u1*)mcodeptr)
-
-/* M_INTMOVE:
-     generates an integer-move from register a to b.
-     if a and b are the same int-register, no code will be generated.
-*/ 
-
-#define M_INTMOVE(a,b) if(a!=b){M_MOV(a,b);}
-
-
-/* M_FLTMOVE:
-    generates a floating-point-move from register a to b.
-    if a and b are the same float-register, no code will be generated
-*/ 
-
-#define M_FLTMOVE(a,b) if(a!=b){M_FMOV(a,b);}
-
-
-/* var_to_reg_xxx:
-    this function generates code to fetch data from a pseudo-register
-    into a real register. 
-    If the pseudo-register has actually been assigned to a real 
-    register, no code will be emitted, since following operations
-    can use this register directly.
-    
-    v: pseudoregister to be fetched from
-    tempregnum: temporary register to be used if v is actually spilled to ram
-
-    return: the register number, where the operand can be found after 
-            fetching (this wil be either tempregnum or the register
-            number allready given to v)
-*/
-
-#define var_to_reg_int(regnr,v,tempnr) { \
-       if ((v)->flags & INMEMORY) \
-               {COUNT_SPILLS;M_LLD(tempnr,REG_SP,8*(v)->regoff);regnr=tempnr;} \
-       else regnr=(v)->regoff; \
-}
-
-
-#define var_to_reg_flt(regnr,v,tempnr) { \
-       if ((v)->flags & INMEMORY) \
-               {COUNT_SPILLS;M_DLD(tempnr,REG_SP,8*(v)->regoff);regnr=tempnr;} \
-       else regnr=(v)->regoff; \
-}
-
-
-/* reg_of_var:
-    This function determines a register, to which the result of an operation
-    should go, when it is ultimatively intended to store the result in
-    pseudoregister v.
-    If v is assigned to an actual register, this register will be returned.
-    Otherwise (when v is spilled) this function returns tempregnum.
-    If not already done, regoff and flags are set in the stack location.
-*/        
-
-static int reg_of_var(stackptr v, int tempregnum)
-{
-       varinfo      *var;
-
-       switch (v->varkind) {
-               case TEMPVAR:
-                       if (!(v->flags & INMEMORY))
-                               return(v->regoff);
-                       break;
-               case STACKVAR:
-                       var = &(interfaces[v->varnum][v->type]);
-                       v->regoff = var->regoff;
-                       if (!(var->flags & INMEMORY))
-                               return(var->regoff);
-                       break;
-               case LOCALVAR:
-                       var = &(locals[v->varnum][v->type]);
-                       v->regoff = var->regoff;
-                       if (!(var->flags & INMEMORY))
-                               return(var->regoff);
-                       break;
-               case ARGVAR:
-                       v->regoff = v->varnum;
-                       if (IS_FLT_DBL_TYPE(v->type)) {
-                               if (v->varnum < fltreg_argnum) {
-                                       v->regoff = argfltregs[v->varnum];
-                                       return(argfltregs[v->varnum]);
-                                       }
-                               }
-                       else
-                               if (v->varnum < intreg_argnum) {
-                                       v->regoff = argintregs[v->varnum];
-                                       return(argintregs[v->varnum]);
-                                       }
-                       v->regoff -= intreg_argnum;
-                       break;
-               }
-       v->flags |= INMEMORY;
-       return tempregnum;
-}
-
-
-/* store_reg_to_var_xxx:
-    This function generates the code to store the result of an operation
-    back into a spilled pseudo-variable.
-    If the pseudo-variable has not been spilled in the first place, this 
-    function will generate nothing.
-    
-    v ............ Pseudovariable
-    tempregnum ... Number of the temporary registers as returned by
-                   reg_of_var.
-*/     
-
-#define store_reg_to_var_int(sptr, tempregnum) {       \
-       if ((sptr)->flags & INMEMORY) {                    \
-               COUNT_SPILLS;                                  \
-               M_LST(tempregnum, REG_SP, 8 * (sptr)->regoff); \
-               }                                              \
-       }
-
-#define store_reg_to_var_flt(sptr, tempregnum) {       \
-       if ((sptr)->flags & INMEMORY) {                    \
-               COUNT_SPILLS;                                  \
-               M_DST(tempregnum, REG_SP, 8 * (sptr)->regoff); \
-               }                                              \
-       }
-
-
-/* NullPointerException handlers and exception handling initialisation        */
-
-typedef struct sigctx_struct {
-
-       long          sc_onstack;           /* sigstack state to restore          */
-       long          sc_mask;              /* signal mask to restore             */
-       long          sc_pc;                /* pc at time of signal               */
-       long          sc_ps;                /* psl to retore                      */
-       long          sc_regs[32];          /* processor regs 0 to 31             */
-       long          sc_ownedfp;           /* fp has been used                   */
-       long          sc_fpregs[32];        /* fp regs 0 to 31                    */
-       unsigned long sc_fpcr;              /* floating point control register    */
-       unsigned long sc_fp_control;        /* software fpcr                      */
-                                           /* rest is unused                     */
-       unsigned long sc_reserved1, sc_reserved2;
-       unsigned long sc_ssize;
-       char          *sc_sbase;
-       unsigned long sc_traparg_a0;
-       unsigned long sc_traparg_a1;
-       unsigned long sc_traparg_a2;
-       unsigned long sc_fp_trap_pc;
-       unsigned long sc_fp_trigger_sum;
-       unsigned long sc_fp_trigger_inst;
-       unsigned long sc_retcode[2];
-} sigctx_struct;
-
-
-/* NullPointerException signal handler for hardware null pointer check */
-
-void catch_NullPointerException(int sig, int code, sigctx_struct *sigctx)
-{
-       sigset_t nsig;
-       int      instr;
-       long     faultaddr;
-
-       /* Reset signal handler - necessary for SysV, does no harm for BSD */
-
-       instr = *((int*)(sigctx->sc_pc));
-       faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f];
-
-       if (faultaddr == 0) {
-               signal(sig, (void*) catch_NullPointerException); /* reinstall handler */
-               sigemptyset(&nsig);
-               sigaddset(&nsig, sig);
-               sigprocmask(SIG_UNBLOCK, &nsig, NULL);           /* unblock signal    */
-               sigctx->sc_regs[REG_ITMP1_XPTR] =
-                                           (long) proto_java_lang_NullPointerException;
-               sigctx->sc_regs[REG_ITMP2_XPC] = sigctx->sc_pc;
-               sigctx->sc_pc = (long) asm_handle_exception;
-               return;
-               }
-       else {
-               faultaddr += (long) ((instr << 16) >> 16);
-               fprintf(stderr, "faulting address: 0x%16lx\n", faultaddr);
-               panic("Stack overflow");
-               }
-}
-
-
-#ifdef __osf__
-
-void init_exceptions(void)
-{
-
-#else /* Linux */
-
-/* Linux on Digital Alpha needs an initialisation of the ieee floating point
-       control for IEEE compliant arithmetic (option -mieee of GCC). Under
-       Digital Unix this is done automatically.
-*/
-
-#include <asm/fpu.h>
-
-extern unsigned long ieee_get_fp_control();
-extern void ieee_set_fp_control(unsigned long fp_control);
-
-void init_exceptions(void)
-{
-/* initialize floating point control */
-
-ieee_set_fp_control(ieee_get_fp_control()
-                    & ~IEEE_TRAP_ENABLE_INV
-                    & ~IEEE_TRAP_ENABLE_DZE
-/*                  & ~IEEE_TRAP_ENABLE_UNF   we dont want underflow */
-                    & ~IEEE_TRAP_ENABLE_OVF);
-#endif
-
-       /* install signal handlers we need to convert to exceptions */
-
-       if (!checknull) {
-
-#if defined(SIGSEGV)
-               signal(SIGSEGV, (void*) catch_NullPointerException);
-#endif
-
-#if defined(SIGBUS)
-               signal(SIGBUS, (void*) catch_NullPointerException);
-#endif
-               }
-}
-
-
-/* function gen_mcode **********************************************************
-
-       generates machine code
-
-*******************************************************************************/
-
-#define        MethodPointer   -8
-#define        FrameSize       -12
-#define     IsSync          -16
-#define     IsLeaf          -20
-#define     IntSave         -24
-#define     FltSave         -28
-#define     ExTableSize     -32
-#define     ExTableStart    -32
-
-#define     ExEntrySize     -32
-#define     ExStartPC       -8
-#define     ExEndPC         -16
-#define     ExHandlerPC     -24
-#define     ExCatchType     -32
-
-static void gen_mcode()
-{
-       int  len, s1, s2, s3, d, bbs;
-       s4   a;
-       s4          *mcodeptr;
-       stackptr    src;
-       varinfo     *var;
-       basicblock  *bptr;
-       instruction *iptr;
-       xtable *ex;
-
-       {
-       int p, pa, t, l, r;
-
-       savedregs_num = (isleafmethod) ? 0 : 1;           /* space to save the RA */
-
-       /* space to save used callee saved registers */
-
-       savedregs_num += (savintregcnt - maxsavintreguse);
-       savedregs_num += (savfltregcnt - maxsavfltreguse);
-
-       parentargs_base = maxmemuse + savedregs_num;
-
-#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               parentargs_base++;
-
-#endif
-
-       /* create method header */
-
-       (void) dseg_addaddress(method);                         /* MethodPointer  */
-       (void) dseg_adds4(parentargs_base * 8);                 /* FrameSize      */
-
-#ifdef USE_THREADS
-
-       /* IsSync contains the offset relative to the stack pointer for the
-          argument of monitor_exit used in the exception handler. Since the
-          offset could be zero and give a wrong meaning of the flag it is
-          offset by one.
-       */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               (void) dseg_adds4((maxmemuse + 1) * 8);             /* IsSync         */
-       else
-
-#endif
-
-       (void) dseg_adds4(0);                                   /* IsSync         */
-                                              
-       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
-       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
-       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
-       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
-
-       /* create exception table */
-
-       for (ex = extable; ex != NULL; ex = ex->down) {
-
-#ifdef LOOP_DEBUG      
-               if (ex->start != NULL)
-                       printf("adding start - %d - ", ex->start->debug_nr);
-               else {
-                       printf("PANIC - start is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->start);
-
-#ifdef LOOP_DEBUG                      
-               if (ex->end != NULL)
-                       printf("adding end - %d - ", ex->end->debug_nr);
-               else {
-                       printf("PANIC - end is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->end);
-
-#ifdef LOOP_DEBUG              
-               if (ex->handler != NULL)
-                       printf("adding handler - %d\n", ex->handler->debug_nr);
-               else {
-                       printf("PANIC - handler is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->handler);
-          
-               (void) dseg_addaddress(ex->catchtype);
-               }
-       
-       /* initialize mcode variables */
-       
-       mcodeptr = (s4*) mcodebase;
-       mcodeend = (s4*) (mcodebase + mcodesize);
-       MCODECHECK(128 + mparamcount);
-
-       /* create stack frame (if necessary) */
-
-       if (parentargs_base)
-               {M_LDA (REG_SP, REG_SP, -parentargs_base * 8);}
-
-       /* save return address and used callee saved registers */
-
-       p = parentargs_base;
-       if (!isleafmethod)
-               {p--;  M_AST (REG_RA, REG_SP, 8*p);}
-       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
-               {p--; M_LST (savintregs[r], REG_SP, 8 * p);}
-       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
-               {p--; M_DST (savfltregs[r], REG_SP, 8 * p);}
-
-       /* save monitorenter argument */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               if (method->flags & ACC_STATIC) {
-                       p = dseg_addaddress (class);
-                       M_ALD(REG_ITMP1, REG_PV, p);
-                       M_AST(REG_ITMP1, REG_SP, 8 * maxmemuse);
-                       } 
-               else {
-                       M_AST (argintregs[0], REG_SP, 8 * maxmemuse);
-                       }
-               }                       
-#endif
-
-       /* copy argument registers to stack and call trace function with pointer
-          to arguments on stack. ToDo: save floating point registers !!!!!!!!!
-       */
-
-       if (runverbose) {
-               M_LDA (REG_SP, REG_SP, -(14*8));
-               M_AST(REG_RA, REG_SP, 1*8);
-
-               M_LST(argintregs[0], REG_SP,  2*8);
-               M_LST(argintregs[1], REG_SP,  3*8);
-               M_LST(argintregs[2], REG_SP,  4*8);
-               M_LST(argintregs[3], REG_SP,  5*8);
-               M_LST(argintregs[4], REG_SP,  6*8);
-               M_LST(argintregs[5], REG_SP,  7*8);
-
-               M_DST(argfltregs[0], REG_SP,  8*8);
-               M_DST(argfltregs[1], REG_SP,  9*8);
-               M_DST(argfltregs[2], REG_SP, 10*8);
-               M_DST(argfltregs[3], REG_SP, 11*8);
-               M_DST(argfltregs[4], REG_SP, 12*8);
-               M_DST(argfltregs[5], REG_SP, 13*8);
-
-               p = dseg_addaddress (method);
-               M_ALD(REG_ITMP1, REG_PV, p);
-               M_AST(REG_ITMP1, REG_SP, 0);
-               p = dseg_addaddress ((void*) (builtin_trace_args));
-               M_ALD(REG_PV, REG_PV, p);
-               M_JSR(REG_RA, REG_PV);
-               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
-               M_ALD(REG_RA, REG_SP, 1*8);
-
-               M_LLD(argintregs[0], REG_SP,  2*8);
-               M_LLD(argintregs[1], REG_SP,  3*8);
-               M_LLD(argintregs[2], REG_SP,  4*8);
-               M_LLD(argintregs[3], REG_SP,  5*8);
-               M_LLD(argintregs[4], REG_SP,  6*8);
-               M_LLD(argintregs[5], REG_SP,  7*8);
-
-               M_DLD(argfltregs[0], REG_SP,  8*8);
-               M_DLD(argfltregs[1], REG_SP,  9*8);
-               M_DLD(argfltregs[2], REG_SP, 10*8);
-               M_DLD(argfltregs[3], REG_SP, 11*8);
-               M_DLD(argfltregs[4], REG_SP, 12*8);
-               M_DLD(argfltregs[5], REG_SP, 13*8);
-
-               M_LDA (REG_SP, REG_SP, 14*8);
-               }
-
-       /* take arguments out of register or stack frame */
-
-       for (p = 0, l = 0; p < mparamcount; p++) {
-               t = mparamtypes[p];
-               var = &(locals[l][t]);
-               l++;
-               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
-                       l++;
-               if (var->type < 0)
-                       continue;
-               r = var->regoff; 
-               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
-                       if (p < INT_ARG_CNT) {                   /* register arguments    */
-                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
-                                       {M_INTMOVE (argintregs[p], r);}
-                               else                                 /* reg arg -> spilled    */
-                                       M_LST (argintregs[p], REG_SP, 8 * r);
-                               }
-                       else {                                   /* stack arguments       */
-                               pa = p - INT_ARG_CNT;
-                               if (!(var->flags & INMEMORY))        /* stack arg -> register */ 
-                                       M_LLD (r, REG_SP, 8 * (parentargs_base + pa));
-                               else {                               /* stack arg -> spilled  */
-                                       M_LLD (REG_ITMP1, REG_SP, 8 * (parentargs_base + pa));
-                                       M_LST (REG_ITMP1, REG_SP, 8 * r);
-                                       }
-                               }
-                       }
-               else {                                       /* floating args         */   
-                       if (p < FLT_ARG_CNT) {                   /* register arguments    */
-                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
-                                       {M_FLTMOVE (argfltregs[p], r);}
-                               else                                             /* reg arg -> spilled    */
-                                       M_DST (argfltregs[p], REG_SP, 8 * r);
-                               }
-                       else {                                   /* stack arguments       */
-                               pa = p - FLT_ARG_CNT;
-                               if (!(var->flags & INMEMORY))        /* stack-arg -> register */
-                                       M_DLD (r, REG_SP, 8 * (parentargs_base + pa) );
-                               else {                               /* stack-arg -> spilled  */
-                                       M_DLD (REG_FTMP1, REG_SP, 8 * (parentargs_base + pa));
-                                       M_DST (REG_FTMP1, REG_SP, 8 * r);
-                                       }
-                               }
-                       }
-               }  /* end for */
-
-       /* call trace function */
-
-#if 0
-       if (runverbose && !isleafmethod) {
-               M_LDA (REG_SP, REG_SP, -8);
-               p = dseg_addaddress (method);
-               M_ALD(REG_ITMP1, REG_PV, p);
-               M_AST(REG_ITMP1, REG_SP, 0);
-               p = dseg_addaddress ((void*) (builtin_trace_args));
-               M_ALD(REG_PV, REG_PV, p);
-               M_JSR(REG_RA, REG_PV);
-               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
-               M_LDA(REG_SP, REG_SP, 8);
-               }
-#endif
-
-       /* call monitorenter function */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               p = dseg_addaddress ((void*) (builtin_monitorenter));
-               M_ALD(REG_PV, REG_PV, p);
-               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
-               M_JSR(REG_RA, REG_PV);
-               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
-               }                       
-#endif
-       }
-
-       /* end of header generation */
-
-       /* walk through all basic blocks */
-       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
-
-               bptr -> mpc = (int)((u1*) mcodeptr - mcodebase);
-
-               if (bptr->flags >= BBREACHED) {
-
-               /* branch resolving */
-
-               {
-               branchref *brefs;
-               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
-                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
-                                         brefs->branchpos, bptr->mpc);
-                       }
-               }
-
-               /* copy interface registers to their destination */
-
-               src = bptr->instack;
-               len = bptr->indepth;
-               MCODECHECK(64+len);
-               while (src != NULL) {
-                       len--;
-                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
-                               d = reg_of_var(src, REG_ITMP1);
-                               M_INTMOVE(REG_ITMP1, d);
-                               store_reg_to_var_int(src, d);
-                               }
-                       else {
-                               d = reg_of_var(src, REG_IFTMP);
-                               if ((src->varkind != STACKVAR)) {
-                                       s2 = src->type;
-                                       if (IS_FLT_DBL_TYPE(s2)) {
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       s1 = interfaces[len][s2].regoff;
-                                                       M_FLTMOVE(s1,d);
-                                                       }
-                                               else {
-                                                       M_DLD(d, REG_SP, 8 * interfaces[len][s2].regoff);
-                                                       }
-                                               store_reg_to_var_flt(src, d);
-                                               }
-                                       else {
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       s1 = interfaces[len][s2].regoff;
-                                                       M_INTMOVE(s1,d);
-                                                       }
-                                               else {
-                                                       M_LLD(d, REG_SP, 8 * interfaces[len][s2].regoff);
-                                                       }
-                                               store_reg_to_var_int(src, d);
-                                               }
-                                       }
-                               }
-                       src = src->prev;
-                       }
-
-               /* walk through all instructions */
-               
-               src = bptr->instack;
-               len = bptr->icount;
-               for (iptr = bptr->iinstr;
-                   len > 0;
-                   src = iptr->dst, len--, iptr++) {
-
-       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
-       switch (iptr->opc) {
-
-               case ICMD_NOP:        /* ...  ==> ...                                 */
-                       break;
-
-               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_BEQZ(s1, 0);
-                       mcode_addxnullrefs(mcodeptr);
-                       break;
-
-               /* constant operations ************************************************/
-
-#define ICONST(r,c) if(((c)>=-32768)&&((c)<= 32767)){M_LDA(r,REG_ZERO,c);} \
-                    else{a=dseg_adds4(c);M_ILD(r,REG_PV,a);}
-
-#define LCONST(r,c) if(((c)>=-32768)&&((c)<= 32767)){M_LDA(r,REG_ZERO,c);} \
-                    else{a=dseg_adds8(c);M_LLD(r,REG_PV,a);}
-
-               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.i = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       ICONST(d, iptr->val.i);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.l = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       LCONST(d, iptr->val.l);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.f = constant                    */
-
-                       d = reg_of_var (iptr->dst, REG_FTMP1);
-                       a = dseg_addfloat (iptr->val.f);
-                       M_FLD(d, REG_PV, a);
-                       store_reg_to_var_flt (iptr->dst, d);
-                       break;
-                       
-               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.d = constant                    */
-
-                       d = reg_of_var (iptr->dst, REG_FTMP1);
-                       a = dseg_adddouble (iptr->val.d);
-                       M_DLD(d, REG_PV, a);
-                       store_reg_to_var_flt (iptr->dst, d);
-                       break;
-
-               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.a = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->val.a) {
-                               a = dseg_addaddress (iptr->val.a);
-                               M_ALD(d, REG_PV, a);
-                               }
-                       else {
-                               M_INTMOVE(REG_ZERO, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               /* load/store operations **********************************************/
-
-               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_LLOAD:      /* op1 = local variable                         */
-               case ICMD_ALOAD:
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY)
-                               M_LLD(d, REG_SP, 8 * var->regoff);
-                       else
-                               {M_INTMOVE(var->regoff,d);}
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_DLOAD:      /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY)
-                               M_DLD(d, REG_SP, 8 * var->regoff);
-                       else
-                               {M_FLTMOVE(var->regoff,d);}
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-
-               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
-               case ICMD_LSTORE:     /* op1 = local variable                         */
-               case ICMD_ASTORE:
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               M_LST(s1, REG_SP, 8 * var->regoff);
-                               }
-                       else {
-                               var_to_reg_int(s1, src, var->regoff);
-                               M_INTMOVE(s1, var->regoff);
-                               }
-                       break;
-
-               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_DSTORE:     /* op1 = local variable                         */
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               M_DST(s1, REG_SP, 8 * var->regoff);
-                               }
-                       else {
-                               var_to_reg_flt(s1, src, var->regoff);
-                               M_FLTMOVE(s1, var->regoff);
-                               }
-                       break;
-
-
-               /* pop/dup/swap operations ********************************************/
-
-               /* attention: double and longs are only one entry in CACAO ICMDs      */
-
-               case ICMD_POP:        /* ..., value  ==> ...                          */
-               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
-                       break;
-
-#define M_COPY(from,to) \
-                       d = reg_of_var(to, REG_IFTMP); \
-                       if ((from->regoff != to->regoff) || \
-                           ((from->flags ^ to->flags) & INMEMORY)) { \
-                               if (IS_FLT_DBL_TYPE(from->type)) { \
-                                       var_to_reg_flt(s1, from, d); \
-                                       M_FLTMOVE(s1,d); \
-                                       store_reg_to_var_flt(to, d); \
-                                       }\
-                               else { \
-                                       var_to_reg_int(s1, from, d); \
-                                       M_INTMOVE(s1,d); \
-                                       store_reg_to_var_int(to, d); \
-                                       }\
-                               }
-
-               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
-                       M_COPY(src, iptr->dst);
-                       break;
-
-               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
-
-                       M_COPY(src,       iptr->dst->prev->prev);
-
-               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
-
-                       M_COPY(src,       iptr->dst);
-                       M_COPY(src->prev, iptr->dst->prev);
-                       break;
-
-               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
-
-                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
-
-               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
-
-                       M_COPY(src,             iptr->dst);
-                       M_COPY(src->prev,       iptr->dst->prev);
-                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
-                       M_COPY(src, iptr->dst->prev->prev->prev);
-                       break;
-
-               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
-
-                       M_COPY(src,                   iptr->dst);
-                       M_COPY(src->prev,             iptr->dst->prev);
-                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
-                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
-                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
-                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
-                       break;
-
-               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
-
-                       M_COPY(src, iptr->dst->prev);
-                       M_COPY(src->prev, iptr->dst);
-                       break;
-
-
-               /* integer operations *************************************************/
-
-               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_int(s1, src, REG_ITMP1); 
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISUB(REG_ZERO, s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSUB(REG_ZERO, s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IADD(s1, REG_ZERO, d );
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_BSEXT(s1, d);
-                               }
-                       else {
-                               M_SLL_IMM(s1, 56, d);
-                               M_SRA_IMM( d, 56, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_CZEXT(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_SSEXT(s1, d);
-                               }
-                       else {
-                               M_SLL_IMM(s1, 48, d);
-                               M_SRA_IMM( d, 48, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IADD(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
-                               M_IADD_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_IADD(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LADD(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
-                               M_LADD_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_LADD(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISUB(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
-                               M_ISUB_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_ISUB(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSUB(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
-                               M_LSUB_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_LSUB(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IMUL(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
-                               M_IMUL_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_IMUL(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LMUL (s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
-                               M_LMUL_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_LMUL(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value << constant       */
-               case ICMD_LDIVPOW2:   /* val.i = constant                             */
-                                     
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->val.i <= 15) {
-                               M_LDA(REG_ITMP2, s1, (1 << iptr->val.i) -1);
-                               M_CMOVGE(s1, s1, REG_ITMP2);
-                               }
-                       else {
-                               M_SRA_IMM(s1, 63, REG_ITMP2);
-                               M_SRL_IMM(REG_ITMP2, 64 - iptr->val.i, REG_ITMP2);
-                               M_LADD(s1, REG_ITMP2, REG_ITMP2);
-                               }
-                       M_SRA_IMM(REG_ITMP2, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND_IMM(s2, 0x1f, REG_ITMP3);
-                       M_SLL(s1, REG_ITMP3, d);
-                       M_IADD(d, REG_ZERO, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SLL_IMM(s1, iptr->val.i & 0x1f, d);
-                       M_IADD(d, REG_ZERO, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND_IMM(s2, 0x1f, REG_ITMP3);
-                       M_SRA(s1, REG_ITMP3, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SRA_IMM(s1, iptr->val.i & 0x1f, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND_IMM(s2, 0x1f, REG_ITMP2);
-            M_IZEXT(s1, d);
-                       M_SRL(d, REG_ITMP2, d);
-                       M_IADD(d, REG_ZERO, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_IZEXT(s1, d);
-                       M_SRL_IMM(d, iptr->val.i & 0x1f, d);
-                       M_IADD(d, REG_ZERO, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SLL(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SLL_IMM(s1, iptr->val.i & 0x3f, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SRA(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SRA_IMM(s1, iptr->val.i & 0x3f, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SRL(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SRL_IMM(s1, iptr->val.i & 0x3f, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
-               case ICMD_LAND:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
-                               M_AND_IMM(s1, iptr->val.i, d);
-                               }
-                       else if (iptr->val.i == 0xffff) {
-                               M_CZEXT(s1, d);
-                               }
-                       else if (iptr->val.i == 0xffffff) {
-                               M_ZAPNOT_IMM(s1, 0x07, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_AND(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                               }
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
-                               M_AND_IMM(s1, iptr->val.i, d);
-                               M_BGEZ(s1, 3);
-                               M_ISUB(REG_ZERO, s1, d);
-                               M_AND_IMM(d, iptr->val.i, d);
-                               }
-                       else if (iptr->val.i == 0xffff) {
-                               M_CZEXT(s1, d);
-                               M_BGEZ(s1, 3);
-                               M_ISUB(REG_ZERO, s1, d);
-                               M_CZEXT(d, d);
-                               }
-                       else if (iptr->val.i == 0xffffff) {
-                               M_ZAPNOT_IMM(s1, 0x07, d);
-                               M_BGEZ(s1, 3);
-                               M_ISUB(REG_ZERO, s1, d);
-                               M_ZAPNOT_IMM(d, 0x07, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_AND(s1, REG_ITMP2, d);
-                               M_BGEZ(s1, 3);
-                               M_ISUB(REG_ZERO, s1, d);
-                               M_AND(d, REG_ITMP2, d);
-                               }
-                       M_ISUB(REG_ZERO, d, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IREM0X10001:  /* ..., value  ==> ..., value % 0x100001      */
-               
-/*          b = value & 0xffff;
-                       a = value >> 16;
-                       a = ((b - a) & 0xffff) + (b < a);
-*/
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP3);
-                               s1 = REG_ITMP3;
-                               }
-                       M_BLTZ(s1, 7);
-            M_CZEXT(s1, REG_ITMP2);
-                       M_SRA_IMM(s1, 16, d);
-                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
-                       M_ISUB(REG_ITMP2, d, d);
-            M_CZEXT(d, d);
-                       M_IADD(d, REG_ITMP1, d);
-                       M_BR(11 + (s1 == REG_ITMP1));
-                       M_ISUB(REG_ZERO, s1, REG_ITMP1);
-            M_CZEXT(REG_ITMP1, REG_ITMP2);
-                       M_SRA_IMM(REG_ITMP1, 16, d);
-                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
-                       M_ISUB(REG_ITMP2, d, d);
-            M_CZEXT(d, d);
-                       M_IADD(d, REG_ITMP1, d);
-                       M_ISUB(REG_ZERO, d, d);
-                       if (s1 == REG_ITMP1) {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               }
-                       M_SLL_IMM(s1, 33, REG_ITMP2);
-                       M_CMPEQ(REG_ITMP2, REG_ZERO, REG_ITMP2);
-                       M_ISUB(d, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
-                               M_AND_IMM(s1, iptr->val.l, d);
-                               }
-                       else if (iptr->val.l == 0xffffL) {
-                               M_CZEXT(s1, d);
-                               }
-                       else if (iptr->val.l == 0xffffffL) {
-                               M_ZAPNOT_IMM(s1, 0x07, d);
-                               }
-                       else if (iptr->val.l == 0xffffffffL) {
-                               M_IZEXT(s1, d);
-                               }
-                       else if (iptr->val.l == 0xffffffffffL) {
-                               M_ZAPNOT_IMM(s1, 0x1f, d);
-                               }
-                       else if (iptr->val.l == 0xffffffffffffL) {
-                               M_ZAPNOT_IMM(s1, 0x3f, d);
-                               }
-                       else if (iptr->val.l == 0xffffffffffffffL) {
-                               M_ZAPNOT_IMM(s1, 0x7f, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_AND(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                               }
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
-                               M_AND_IMM(s1, iptr->val.l, d);
-                               M_BGEZ(s1, 3);
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_AND_IMM(d, iptr->val.l, d);
-                               }
-                       else if (iptr->val.l == 0xffffL) {
-                               M_CZEXT(s1, d);
-                               M_BGEZ(s1, 3);
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_CZEXT(d, d);
-                               }
-                       else if (iptr->val.l == 0xffffffL) {
-                               M_ZAPNOT_IMM(s1, 0x07, d);
-                               M_BGEZ(s1, 3);
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_ZAPNOT_IMM(d, 0x07, d);
-                               }
-                       else if (iptr->val.l == 0xffffffffL) {
-                               M_IZEXT(s1, d);
-                               M_BGEZ(s1, 3);
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_IZEXT(d, d);
-                               }
-                       else if (iptr->val.l == 0xffffffffffL) {
-                               M_ZAPNOT_IMM(s1, 0x1f, d);
-                               M_BGEZ(s1, 3);
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_ZAPNOT_IMM(d, 0x1f, d);
-                               }
-                       else if (iptr->val.l == 0xffffffffffffL) {
-                               M_ZAPNOT_IMM(s1, 0x3f, d);
-                               M_BGEZ(s1, 3);
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_ZAPNOT_IMM(d, 0x3f, d);
-                               }
-                       else if (iptr->val.l == 0xffffffffffffffL) {
-                               M_ZAPNOT_IMM(s1, 0x7f, d);
-                               M_BGEZ(s1, 3);
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_ZAPNOT_IMM(d, 0x7f, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_AND(s1, REG_ITMP2, d);
-                               M_BGEZ(s1, 3);
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_AND(d, REG_ITMP2, d);
-                               }
-                       M_LSUB(REG_ZERO, d, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LREM0X10001:/* ..., value  ==> ..., value % 0x10001         */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP3);
-                               s1 = REG_ITMP3;
-                               }
-                       M_CZEXT(s1, REG_ITMP2);
-                       M_SRA_IMM(s1, 16, d);
-                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
-                       M_LSUB(REG_ITMP2, d, d);
-            M_CZEXT(d, d);
-                       M_LADD(d, REG_ITMP1, d);
-                       M_LDA(REG_ITMP2, REG_ZERO, -1);
-                       M_SRL_IMM(REG_ITMP2, 33, REG_ITMP2);
-                       if (s1 == REG_ITMP1) {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               }
-                       M_CMPULT(s1, REG_ITMP2, REG_ITMP2);
-                       M_BNEZ(REG_ITMP2, 11);
-                       M_LDA(d, REG_ZERO, -257);
-                       M_ZAPNOT_IMM(d, 0xcd, d);
-                       M_LSUB(REG_ZERO, s1, REG_ITMP2);
-                       M_CMOVGE(s1, s1, REG_ITMP2);
-                       M_UMULH(REG_ITMP2, d, REG_ITMP2);
-                       M_SRL_IMM(REG_ITMP2, 16, REG_ITMP2);
-                       M_LSUB(REG_ZERO, REG_ITMP2, d);
-                       M_CMOVGE(s1, REG_ITMP2, d);
-                       M_SLL_IMM(d, 16, REG_ITMP2);
-                       M_LADD(d, REG_ITMP2, d);
-                       M_LSUB(s1, d, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
-               case ICMD_LOR:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_OR( s1,s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
-                               M_OR_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_OR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
-                               M_OR_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_OR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
-               case ICMD_LXOR:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_XOR(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
-                               M_XOR_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_XOR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
-                               M_XOR_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_XOR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_LCMP:       /* ..., val1, val2  ==> ..., val1 cmp val2      */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_CMPLT(s1, s2, REG_ITMP3);
-                       M_CMPLT(s2, s1, REG_ITMP1);
-                       M_LSUB (REG_ITMP1, REG_ITMP3, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
-                                     /* op1 = variable, val.i = constant             */
-
-                       var = &(locals[iptr->op1][TYPE_INT]);
-                       if (var->flags & INMEMORY) {
-                               s1 = REG_ITMP1;
-                               M_LLD(s1, REG_SP, 8 * var->regoff);
-                               }
-                       else
-                               s1 = var->regoff;
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
-                               M_IADD_IMM(s1, iptr->val.i, s1);
-                               }
-                       else if ((iptr->val.i > -256) && (iptr->val.i < 0)) {
-                               M_ISUB_IMM(s1, (-iptr->val.i), s1);
-                               }
-                       else {
-                               M_LDA (s1, s1, iptr->val.i);
-                               M_IADD(s1, REG_ZERO, s1);
-                               }
-                       if (var->flags & INMEMORY)
-                               M_LST(s1, REG_SP, 8 * var->regoff);
-                       break;
-
-
-               /* floating operations ************************************************/
-
-               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FMOVN(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FMOVN(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_FADD(s1, s2, d);
-                               }
-                       else {
-                               M_FADDS(s1, s2, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_DADD(s1, s2, d);
-                               }
-                       else {
-                               M_DADDS(s1, s2, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_FSUB(s1, s2, d);
-                               }
-                       else {
-                               M_FSUBS(s1, s2, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_DSUB(s1, s2, d);
-                               }
-                       else {
-                               M_DSUBS(s1, s2, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_FMUL(s1, s2, d);
-                               }
-                       else {
-                               M_FMULS(s1, s2, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 *** val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_DMUL(s1, s2, d);
-                               }
-                       else {
-                               M_DMULS(s1, s2, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_FDIV(s1, s2, d);
-                               }
-                       else {
-                               M_FDIVS(s1, s2, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_DDIV(s1, s2, d);
-                               }
-                       else {
-                               M_DDIVS(s1, s2, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-               
-               case ICMD_FREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_FDIV(s1,s2, REG_FTMP3);
-                               M_CVTDL_C(REG_FTMP3, REG_FTMP3); /* round to integer */
-                               M_CVTLF(REG_FTMP3, REG_FTMP3);
-                               M_FMUL(REG_FTMP3, s2, REG_FTMP3);
-                               M_FSUB(s1, REG_FTMP3, d);
-                               }
-                       else {
-                               M_FDIVS(s1,s2, REG_FTMP3);
-                               M_TRAPB;
-                               M_CVTDL_CS(REG_FTMP3, REG_FTMP3); /* round to integer */
-                               M_TRAPB;
-                               M_CVTLF(REG_FTMP3, REG_FTMP3);
-                               M_FMULS(REG_FTMP3, s2, REG_FTMP3);
-                               M_TRAPB;
-                               M_FSUBS(s1, REG_FTMP3, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                   break;
-
-               case ICMD_DREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_DDIV(s1,s2, REG_FTMP3);
-                               M_CVTDL_C(REG_FTMP3, REG_FTMP3); /* round to integer */
-                               M_CVTLD(REG_FTMP3, REG_FTMP3);
-                               M_DMUL(REG_FTMP3, s2, REG_FTMP3);
-                               M_DSUB(s1, REG_FTMP3, d);
-                               }
-                       else {
-                               M_DDIVS(s1,s2, REG_FTMP3);
-                               M_TRAPB;
-                               M_CVTDL_CS(REG_FTMP3, REG_FTMP3); /* round to integer */
-                               M_TRAPB;
-                               M_CVTLD(REG_FTMP3, REG_FTMP3);
-                               M_DMULS(REG_FTMP3, s2, REG_FTMP3);
-                               M_TRAPB;
-                               M_DSUBS(s1, REG_FTMP3, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                   break;
-
-               case ICMD_I2F:       /* ..., value  ==> ..., (float) value            */
-               case ICMD_L2F:
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       a = dseg_adddouble(0.0);
-                       M_LST (s1, REG_PV, a);
-                       M_DLD (d, REG_PV, a);
-                       M_CVTLF(d, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_I2D:       /* ..., value  ==> ..., (double) value           */
-               case ICMD_L2D:
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       a = dseg_adddouble(0.0);
-                       M_LST (s1, REG_PV, a);
-                       M_DLD (d, REG_PV, a);
-                       M_CVTLD(d, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-                       
-               case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
-               case ICMD_D2I:
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       a = dseg_adddouble(0.0);
-                       if (opt_noieee) {
-                               M_CVTDL_C(s1, REG_FTMP1);
-                               M_CVTLI(REG_FTMP1, REG_FTMP2);
-                               }
-                       else {
-                               M_CVTDL_CS(s1, REG_FTMP1);
-                               M_TRAPB;
-                               M_CVTLIS(REG_FTMP1, REG_FTMP2);
-                               M_TRAPB;
-                               }
-                       M_DST (REG_FTMP1, REG_PV, a);
-                       M_ILD (d, REG_PV, a);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-               
-               case ICMD_F2L:       /* ..., value  ==> ..., (long) value             */
-               case ICMD_D2L:
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       a = dseg_adddouble(0.0);
-                       if (opt_noieee) {
-                               M_CVTDL_C(s1, REG_FTMP1);
-                               }
-                       else {
-                               M_CVTDL_CS(s1, REG_FTMP1);
-                               M_TRAPB;
-                               }
-                       M_DST (REG_FTMP1, REG_PV, a);
-                       M_LLD (d, REG_PV, a);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FLTMOVE(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-                                       
-               case ICMD_D2F:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (opt_noieee) {
-                               M_CVTDF(s1, d);
-                               }
-                       else {
-                               M_CVTDFS(s1, d);
-                               M_TRAPB;
-                               }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-               
-               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
-               case ICMD_DCMPL:
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (opt_noieee) {
-                               M_LSUB_IMM(REG_ZERO, 1, d);
-                               M_FCMPEQ(s1, s2, REG_FTMP3);
-                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instructions */
-                               M_CLR   (d);
-                               M_FCMPLT(s2, s1, REG_FTMP3);
-                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
-                               M_LADD_IMM(REG_ZERO, 1, d);
-                               }
-                       else {
-                               M_LSUB_IMM(REG_ZERO, 1, d);
-                               M_FCMPEQS(s1, s2, REG_FTMP3);
-                               M_TRAPB;
-                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instructions */
-                               M_CLR   (d);
-                               M_FCMPLTS(s2, s1, REG_FTMP3);
-                               M_TRAPB;
-                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
-                               M_LADD_IMM(REG_ZERO, 1, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-                       
-               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
-               case ICMD_DCMPG:
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (opt_noieee) {
-                               M_LADD_IMM(REG_ZERO, 1, d);
-                               M_FCMPEQ(s1, s2, REG_FTMP3);
-                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
-                               M_CLR   (d);
-                               M_FCMPLT(s1, s2, REG_FTMP3);
-                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
-                               M_LSUB_IMM(REG_ZERO, 1, d);
-                               }
-                       else {
-                               M_LADD_IMM(REG_ZERO, 1, d);
-                               M_FCMPEQS(s1, s2, REG_FTMP3);
-                               M_TRAPB;
-                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
-                               M_CLR   (d);
-                               M_FCMPLTS(s1, s2, REG_FTMP3);
-                               M_TRAPB;
-                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
-                               M_LSUB_IMM(REG_ZERO, 1, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               /* memory operations **************************************************/
-
-                       /* #define gen_bound_check \
-                       if (checkbounds) {\
-                               M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));\
-                               M_CMPULT(s2, REG_ITMP3, REG_ITMP3);\
-                               M_BEQZ(REG_ITMP3, 0);\
-                               mcode_addxboundrefs(mcodeptr);\
-                               }
-                       */
-
-#define gen_bound_check \
-            if (checkbounds) { \
-                               M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));\
-                               M_CMPULT(s2, REG_ITMP3, REG_ITMP3);\
-                               M_BEQZ(REG_ITMP3, 0);\
-                               mcode_addxboundrefs(mcodeptr); \
-                }
-
-               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., length              */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       gen_nullptr_check(s1);
-                       M_ILD(d, s1, OFFSET(java_arrayheader, size));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_SAADDQ(s2, s1, REG_ITMP1);
-                       M_ALD( d, REG_ITMP1, OFFSET(java_objectarray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_S8ADDQ(s2, s1, REG_ITMP1);
-                       M_LLD(d, REG_ITMP1, OFFSET(java_longarray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                 
-                       M_S4ADDQ(s2, s1, REG_ITMP1);
-                       M_ILD(d, REG_ITMP1, OFFSET(java_intarray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_S4ADDQ(s2, s1, REG_ITMP1);
-                       M_FLD(d, REG_ITMP1, OFFSET(java_floatarray, data[0]));
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_S8ADDQ(s2, s1, REG_ITMP1);
-                       M_DLD(d, REG_ITMP1, OFFSET(java_doublearray, data[0]));
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       if (has_ext_instr_set) {
-                               M_LADD(s2, s1, REG_ITMP1);
-                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
-                               M_SLDU(d, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               }
-                       else {
-                               M_LADD (s2, s1, REG_ITMP1);
-                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
-                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               M_EXTWL(REG_ITMP2, REG_ITMP1, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;                  
-
-               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       if (has_ext_instr_set) {
-                               M_LADD(s2, s1, REG_ITMP1);
-                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
-                               M_SLDU( d, REG_ITMP1, OFFSET (java_shortarray, data[0]));
-                               M_SSEXT(d, d);
-                               }
-                       else {
-                               M_LADD(s2, s1, REG_ITMP1);
-                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
-                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_shortarray, data[0]));
-                               M_LDA(REG_ITMP1, REG_ITMP1, OFFSET(java_shortarray, data[0])+2);
-                               M_EXTQH(REG_ITMP2, REG_ITMP1, d);
-                               M_SRA_IMM(d, 48, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       if (has_ext_instr_set) {
-                               M_LADD   (s2, s1, REG_ITMP1);
-                               M_BLDU   (d, REG_ITMP1, OFFSET (java_bytearray, data[0]));
-                               M_BSEXT  (d, d);
-                               }
-                       else {
-                               M_LADD(s2, s1, REG_ITMP1);
-                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_bytearray, data[0]));
-                               M_LDA(REG_ITMP1, REG_ITMP1, OFFSET(java_bytearray, data[0])+1);
-                               M_EXTQH(REG_ITMP2, REG_ITMP1, d);
-                               M_SRA_IMM(d, 56, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_AASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_SAADDQ(s2, s1, REG_ITMP1);
-                       M_AST   (s3, REG_ITMP1, OFFSET(java_objectarray, data[0]));
-                       break;
-
-               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_S8ADDQ(s2, s1, REG_ITMP1);
-                       M_LST   (s3, REG_ITMP1, OFFSET(java_longarray, data[0]));
-                       break;
-
-               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_S4ADDQ(s2, s1, REG_ITMP1);
-                       M_IST   (s3, REG_ITMP1, OFFSET(java_intarray, data[0]));
-                       break;
-
-               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_flt(s3, src, REG_FTMP3);
-                       M_S4ADDQ(s2, s1, REG_ITMP1);
-                       M_FST   (s3, REG_ITMP1, OFFSET(java_floatarray, data[0]));
-                       break;
-
-               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_flt(s3, src, REG_FTMP3);
-                       M_S8ADDQ(s2, s1, REG_ITMP1);
-                       M_DST   (s3, REG_ITMP1, OFFSET(java_doublearray, data[0]));
-                       break;
-
-               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD(s2, s1, REG_ITMP1);
-                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
-                               M_SST (s3, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               }
-                       else {
-                               M_LADD (s2, s1, REG_ITMP1);
-                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
-                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                               M_INSWL(s3, REG_ITMP1, REG_ITMP3);
-                               M_MSKWL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
-                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
-                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
-                               }
-                       break;
-
-               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD(s2, s1, REG_ITMP1);
-                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
-                               M_SST (s3, REG_ITMP1, OFFSET(java_shortarray, data[0]));
-                               }
-                       else {
-                               M_LADD (s2, s1, REG_ITMP1);
-                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
-                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_shortarray, data[0]));
-                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_shortarray, data[0]));
-                               M_INSWL(s3, REG_ITMP1, REG_ITMP3);
-                               M_MSKWL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
-                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
-                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
-                               }
-                       break;
-
-               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       if (has_ext_instr_set) {
-                               M_LADD(s2, s1, REG_ITMP1);
-                               M_BST (s3, REG_ITMP1, OFFSET(java_bytearray, data[0]));
-                               }
-                       else {
-                               M_LADD (s2, s1, REG_ITMP1);
-                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_bytearray, data[0]));
-                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_bytearray, data[0]));
-                               M_INSBL(s3, REG_ITMP1, REG_ITMP3);
-                               M_MSKBL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
-                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
-                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
-                               }
-                       break;
-
-
-               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
-                       M_ALD(REG_ITMP1, REG_PV, a);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       M_IST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       M_LST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       M_AST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       M_FST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       M_DST(s2, REG_ITMP1, 0);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
-                       M_ALD(REG_ITMP1, REG_PV, a);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_ILD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_LLD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_ADR:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_ALD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_FLT:
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       M_FLD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       M_DLD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       M_IST(s2, s1, a);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       M_LST(s2, s1, a);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       M_AST(s2, s1, a);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       gen_nullptr_check(s1);
-                                       M_FST(s2, s1, a);
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       gen_nullptr_check(s1);
-                                       M_DST(s2, s1, a);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_ILD(d, s1, a);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_LLD(d, s1, a);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_ALD(d, s1, a);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       M_FLD(d, s1, a);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       M_DLD(d, s1, a);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               /* branch operations **************************************************/
-
-#define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}}
-
-               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_INTMOVE(s1, REG_ITMP1_XPTR);
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP2, REG_PV, a);
-                       M_JMP(REG_ITMP2_XPC, REG_ITMP2);
-                       M_NOP;              /* nop ensures that XPC is less than the end */
-                                           /* of basic block                            */
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_GOTO:         /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-                       M_BR(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_JSR:          /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-
-                       M_BSR(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-                       
-               case ICMD_RET:          /* ... ==> ...                                */
-                                       /* op1 = local variable                       */
-
-                       var = &(locals[iptr->op1][TYPE_ADR]);
-                       if (var->flags & INMEMORY) {
-                               M_ALD(REG_ITMP1, REG_SP, 8 * var->regoff);
-                               M_RET(REG_ZERO, REG_ITMP1);
-                               }
-                       else
-                               M_RET(REG_ZERO, var->regoff);
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_IFNULL:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_BEQZ(s1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_BNEZ(s1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFEQ:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BEQZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
-                                       M_CMPEQ_IMM(s1, iptr->val.i, REG_ITMP1);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BNEZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFLT:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BLTZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
-                                       M_CMPLT_IMM(s1, iptr->val.i, REG_ITMP1);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BNEZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFLE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BLEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
-                                       M_CMPLE_IMM(s1, iptr->val.i, REG_ITMP1);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BNEZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFNE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BNEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
-                                       M_CMPEQ_IMM(s1, iptr->val.i, REG_ITMP1);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BEQZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFGT:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BGTZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
-                                       M_CMPLE_IMM(s1, iptr->val.i, REG_ITMP1);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BEQZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFGE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BGEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
-                                       M_CMPLT_IMM(s1, iptr->val.i, REG_ITMP1);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BEQZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BEQZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
-                                       M_CMPEQ_IMM(s1, iptr->val.l, REG_ITMP1);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BNEZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BLTZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
-                                       M_CMPLT_IMM(s1, iptr->val.l, REG_ITMP1);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BNEZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BLEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
-                                       M_CMPLE_IMM(s1, iptr->val.l, REG_ITMP1);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BNEZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BNEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
-                                       M_CMPEQ_IMM(s1, iptr->val.l, REG_ITMP1);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BEQZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BGTZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
-                                       M_CMPLE_IMM(s1, iptr->val.l, REG_ITMP1);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BEQZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BGEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
-                                       M_CMPLT_IMM(s1, iptr->val.l, REG_ITMP1);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BEQZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPEQ:    /* op1 = target JavaVM pc                     */
-               case ICMD_IF_ACMPEQ:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPEQ(s1, s2, REG_ITMP1);
-                       M_BNEZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPNE:    /* op1 = target JavaVM pc                     */
-               case ICMD_IF_ACMPNE:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPEQ(s1, s2, REG_ITMP1);
-                       M_BEQZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPLT:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPLT(s1, s2, REG_ITMP1);
-                       M_BNEZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPGT:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPLE(s1, s2, REG_ITMP1);
-                       M_BEQZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPLE:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPLE(s1, s2, REG_ITMP1);
-                       M_BNEZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPGE:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPLT(s1, s2, REG_ITMP1);
-                       M_BEQZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               /* (value xx 0) ? IFxx_ICONST : ELSE_ICONST                           */
-
-               case ICMD_ELSE_ICONST:  /* handled by IFxx_ICONST                     */
-                       break;
-
-               case ICMD_IFEQ_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPEQ(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPEQ(s1, REG_ZERO, d);
-                                       M_XOR_IMM(d, 1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVEQ_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVEQ(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFNE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPEQ(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPEQ(s1, REG_ZERO, d);
-                                       M_XOR_IMM(d, 1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVNE_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVNE(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFLT_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPLT(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPLE(REG_ZERO, s1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVLT_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVLT(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFGE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPLE(REG_ZERO, s1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPLT(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVGE_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVGE(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFGT_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPLT(REG_ZERO, s1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPLE(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVGT_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVGT(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFLE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPLE(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPLT(REG_ZERO, s1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVLE_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVLE(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_LRETURN:
-               case ICMD_ARETURN:
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               a = dseg_addaddress ((void*) (builtin_monitorexit));
-                               M_ALD(REG_PV, REG_PV, a);
-                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
-                               M_JSR(REG_RA, REG_PV);
-                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
-                               }                       
-#endif
-                       var_to_reg_int(s1, src, REG_RESULT);
-                       M_INTMOVE(s1, REG_RESULT);
-                       goto nowperformreturn;
-
-               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_DRETURN:
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               a = dseg_addaddress ((void*) (builtin_monitorexit));
-                               M_ALD(REG_PV, REG_PV, a);
-                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
-                               M_JSR(REG_RA, REG_PV);
-                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
-                               }                       
-#endif
-                       var_to_reg_flt(s1, src, REG_FRESULT);
-                       M_FLTMOVE(s1, REG_FRESULT);
-                       goto nowperformreturn;
-
-               case ICMD_RETURN:      /* ...  ==> ...                                */
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               a = dseg_addaddress ((void*) (builtin_monitorexit));
-                               M_ALD(REG_PV, REG_PV, a);
-                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
-                               M_JSR(REG_RA, REG_PV);
-                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
-                               }                       
-#endif
-
-nowperformreturn:
-                       {
-                       int r, p;
-                       
-                       p = parentargs_base;
-                       
-                       /* restore return address                                         */
-
-                       if (!isleafmethod)
-                               {p--;  M_LLD (REG_RA, REG_SP, 8 * p);}
-
-                       /* restore saved registers                                        */
-
-                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
-                                       {p--; M_LLD(savintregs[r], REG_SP, 8 * p);}
-                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
-                                       {p--; M_DLD(savfltregs[r], REG_SP, 8 * p);}
-
-                       /* deallocate stack                                               */
-
-                       if (parentargs_base)
-                               {M_LDA(REG_SP, REG_SP, parentargs_base*8);}
-
-                       /* call trace function */
-
-                       if (runverbose) {
-                               M_LDA (REG_SP, REG_SP, -24);
-                               M_AST(REG_RA, REG_SP, 0);
-                               M_LST(REG_RESULT, REG_SP, 8);
-                               M_DST(REG_FRESULT, REG_SP,16);
-                               a = dseg_addaddress (method);
-                               M_ALD(argintregs[0], REG_PV, a);
-                               M_MOV(REG_RESULT, argintregs[1]);
-                               M_FLTMOVE(REG_FRESULT, argfltregs[2]);
-                               M_FLTMOVE(REG_FRESULT, argfltregs[3]);
-                               a = dseg_addaddress ((void*) (builtin_displaymethodstop));
-                               M_ALD(REG_PV, REG_PV, a);
-                               M_JSR (REG_RA, REG_PV);
-                               s1 = (int)((u1*) mcodeptr - mcodebase);
-                               if (s1<=32768) M_LDA (REG_PV, REG_RA, -s1);
-                               else {
-                                       s4 ml=-s1, mh=0;
-                                       while (ml<-32768) { ml+=65536; mh--; }
-                                       M_LDA (REG_PV, REG_RA, ml );
-                                       M_LDAH (REG_PV, REG_PV, mh );
-                                       }
-                               M_DLD(REG_FRESULT, REG_SP,16);
-                               M_LLD(REG_RESULT, REG_SP, 8);
-                               M_ALD(REG_RA, REG_SP, 0);
-                               M_LDA (REG_SP, REG_SP, 24);
-                               }
-
-                       M_RET(REG_ZERO, REG_RA);
-                       ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
-                       {
-                       s4 i, l, *s4ptr;
-                       void **tptr;
-
-                       tptr = (void **) iptr->target;
-
-                       s4ptr = iptr->val.a;
-                       l = s4ptr[1];                          /* low     */
-                       i = s4ptr[2];                          /* high    */
-                       
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (l == 0)
-                               {M_INTMOVE(s1, REG_ITMP1);}
-                       else if (l <= 32768) {
-                               M_LDA(REG_ITMP1, s1, -l);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, l);
-                               M_ISUB(s1, REG_ITMP2, REG_ITMP1);
-                               }
-                       i = i - l + 1;
-
-                       /* range check */
-
-                       if (i <= 256)
-                               M_CMPULE_IMM(REG_ITMP1, i - 1, REG_ITMP2);
-                       else {
-                               M_LDA(REG_ITMP2, REG_ZERO, i - 1);
-                               M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
-                               }
-                       M_BEQZ(REG_ITMP2, 0);
-
-
-                       /* mcode_addreference(BlockPtrOfPC(s4ptr[0]), mcodeptr); */
-                       mcode_addreference((basicblock *) tptr[0], mcodeptr);
-
-                       /* build jump table top down and use address of lowest entry */
-
-                       /* s4ptr += 3 + i; */
-                       tptr += i;
-
-                       while (--i >= 0) {
-                               /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
-                               dseg_addtarget((basicblock *) tptr[0]); 
-                               --tptr;
-                               }
-                       }
-
-                       /* length of dataseg after last dseg_addtarget is used by load */
-
-                       M_SAADDQ(REG_ITMP1, REG_PV, REG_ITMP2);
-                       M_ALD(REG_ITMP2, REG_ITMP2, -dseglen);
-                       M_JMP(REG_ZERO, REG_ITMP2);
-                       ALIGNCODENOP;
-                       break;
-
-
-               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
-                       {
-                       s4 i, l, val, *s4ptr;
-                       void **tptr;
-
-                       tptr = (void **) iptr->target;
-
-                       s4ptr = iptr->val.a;
-                       l = s4ptr[0];                          /* default  */
-                       i = s4ptr[1];                          /* count    */
-                       
-                       MCODECHECK((i<<2)+8);
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       while (--i >= 0) {
-                               s4ptr += 2;
-                               ++tptr;
-
-                               val = s4ptr[0];
-                               if ((val >= 0) && (val <= 255)) {
-                                       M_CMPEQ_IMM(s1, val, REG_ITMP2);
-                                       }
-                               else {
-                                       if ((val >= -32768) && (val <= 32767)) {
-                                               M_LDA(REG_ITMP2, REG_ZERO, val);
-                                               } 
-                                       else {
-                                               a = dseg_adds4 (val);
-                                               M_ILD(REG_ITMP2, REG_PV, a);
-                                               }
-                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP2);
-                                       }
-                               M_BNEZ(REG_ITMP2, 0);
-                               /* mcode_addreference(BlockPtrOfPC(s4ptr[1]), mcodeptr); */
-                               mcode_addreference((basicblock *) tptr[0], mcodeptr); 
-                               }
-
-                       M_BR(0);
-                       /* mcode_addreference(BlockPtrOfPC(l), mcodeptr); */
-                       
-                       tptr = (void **) iptr->target;
-                       mcode_addreference((basicblock *) tptr[0], mcodeptr);
-
-                       ALIGNCODENOP;
-                       break;
-                       }
-
-
-               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 3;
-                       goto gen_method;
-
-               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 2;
-                       goto gen_method;
-
-               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 1;
-                       goto gen_method;
-
-               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-                       s3 = iptr->op1;
-
-gen_method: {
-                       methodinfo   *m;
-                       classinfo    *ci;
-
-                       MCODECHECK((s3 << 1) + 64);
-
-                       /* copy arguments to registers or stack location                  */
-
-                       for (; --s3 >= 0; src = src->prev) {
-                               if (src->varkind == ARGVAR)
-                                       continue;
-                               if (IS_INT_LNG_TYPE(src->type)) {
-                                       if (s3 < INT_ARG_CNT) {
-                                               s1 = argintregs[s3];
-                                               var_to_reg_int(d, src, s1);
-                                               M_INTMOVE(d, s1);
-                                               }
-                                       else  {
-                                               var_to_reg_int(d, src, REG_ITMP1);
-                                               M_LST(d, REG_SP, 8 * (s3 - INT_ARG_CNT));
-                                               }
-                                       }
-                               else
-                                       if (s3 < FLT_ARG_CNT) {
-                                               s1 = argfltregs[s3];
-                                               var_to_reg_flt(d, src, s1);
-                                               M_FLTMOVE(d, s1);
-                                               }
-                                       else {
-                                               var_to_reg_flt(d, src, REG_FTMP1);
-                                               M_DST(d, REG_SP, 8 * (s3 - FLT_ARG_CNT));
-                                               }
-                               } /* end of for */
-
-                       m = iptr->val.a;
-                       switch (iptr->opc) {
-                               case ICMD_BUILTIN3:
-                               case ICMD_BUILTIN2:
-                               case ICMD_BUILTIN1:
-                                       a = dseg_addaddress ((void*) (m));
-
-                                       M_ALD(REG_PV, REG_PV, a); /* Pointer to built-in-function */
-                                       d = iptr->op1;
-                                       goto makeactualcall;
-
-                               case ICMD_INVOKESTATIC:
-                               case ICMD_INVOKESPECIAL:
-                                       a = dseg_addaddress (m->stubroutine);
-
-                                       M_ALD(REG_PV, REG_PV, a );       /* method pointer in r27 */
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               case ICMD_INVOKEVIRTUAL:
-
-                                       gen_nullptr_check(argintregs[0]);
-                                       M_ALD(REG_METHODPTR, argintregs[0],
-                                                                OFFSET(java_objectheader, vftbl));
-                                       M_ALD(REG_PV, REG_METHODPTR, OFFSET(vftbl, table[0]) +
-                                                               sizeof(methodptr) * m->vftblindex);
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               case ICMD_INVOKEINTERFACE:
-                                       ci = m->class;
-                                       
-                                       gen_nullptr_check(argintregs[0]);
-                                       M_ALD(REG_METHODPTR, argintregs[0],
-                                                                OFFSET(java_objectheader, vftbl));    
-                                       M_ALD(REG_METHODPTR, REG_METHODPTR,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             sizeof(methodptr*) * ci->index);
-                                       M_ALD(REG_PV, REG_METHODPTR,
-                                                           sizeof(methodptr) * (m - ci->methods));
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               default:
-                                       d = 0;
-                                       sprintf (logtext, "Unkown ICMD-Command: %d", iptr->opc);
-                                       error ();
-                               }
-
-makeactualcall:
-
-                       M_JSR (REG_RA, REG_PV);
-
-                       /* recompute pv */
-
-                       s1 = (int)((u1*) mcodeptr - mcodebase);
-                       if (s1<=32768) M_LDA (REG_PV, REG_RA, -s1);
-                       else {
-                               s4 ml=-s1, mh=0;
-                               while (ml<-32768) { ml+=65536; mh--; }
-                               M_LDA (REG_PV, REG_RA, ml );
-                               M_LDAH (REG_PV, REG_PV, mh );
-                               }
-
-                       /* d contains return type */
-
-                       if (d != TYPE_VOID) {
-                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
-                                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                                       M_INTMOVE(REG_RESULT, s1);
-                                       store_reg_to_var_int(iptr->dst, s1);
-                                       }
-                               else {
-                                       s1 = reg_of_var(iptr->dst, REG_FRESULT);
-                                       M_FLTMOVE(REG_FRESULT, s1);
-                                       store_reg_to_var_flt(iptr->dst, s1);
-                                       }
-                               }
-                       }
-                       break;
-
-
-               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          return (sub != NULL) &&
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL);
- *
- *          superclass is a class:
- *
- *          return ((sub != NULL) && (0
- *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                  super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                               }
-                       M_CLR(d);
-                       if (iptr->op1) {                               /* class/interface */
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       M_BEQZ(s1, 6);
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
-                                       M_LDA(REG_ITMP2, REG_ITMP2, - super->index);
-                                       M_BLEZ(REG_ITMP2, 2);
-                                       M_ALD(REG_ITMP1, REG_ITMP1,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             super->index * sizeof(methodptr*));
-                                       M_CMPULT(REG_ZERO, REG_ITMP1, d);      /* REG_ITMP1 != 0  */
-                                       }
-                               else {                                     /* class           */
-/*
-                                       s2 = super->vftbl->diffval;
-                                       M_BEQZ(s1, 4 + (s2 > 255));
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       M_LDA(REG_ITMP1, REG_ITMP1, - super->vftbl->baseval);
-                                       if (s2 <= 255)
-                                               M_CMPULE_IMM(REG_ITMP1, s2, d);
-                                       else {
-                                               M_LDA(REG_ITMP2, REG_ZERO, s2);
-                                               M_CMPULE(REG_ITMP1, REG_ITMP2, d);
-                                               }
-*/
-                                       M_BEQZ(s1, 7);
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       a = dseg_addaddress ((void*) super->vftbl);
-                                       M_ALD(REG_ITMP2, REG_PV, a);
-                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
-                                       M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                                       M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
-                                       M_CMPULE(REG_ITMP1, REG_ITMP2, d);
-                                       }
-                               }
-                       else
-                               panic ("internal error: no inlined array instanceof");
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          OK if ((sub == NULL) ||
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL));
- *
- *          superclass is a class:
- *
- *          OK if ((sub == NULL) || (0
- *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                 super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       var_to_reg_int(s1, src, d);
-                       if (iptr->op1) {                               /* class/interface */
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       M_BEQZ(s1, 6);
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
-                                       M_LDA(REG_ITMP2, REG_ITMP2, - super->index);
-                                       M_BLEZ(REG_ITMP2, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       M_ALD(REG_ITMP2, REG_ITMP1,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             super->index * sizeof(methodptr*));
-                                       M_BEQZ(REG_ITMP2, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       }
-                               else {                                     /* class           */
-/*
-                                       s2 = super->vftbl->diffval;
-                                       M_BEQZ(s1, 4 + (s2 != 0) + (s2 > 255));
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       M_LDA(REG_ITMP1, REG_ITMP1, - super->vftbl->baseval);
-                                       if (s2 == 0) {
-                                               M_BNEZ(REG_ITMP1, 0);
-                                               }
-                                       else if (s2 <= 255) {
-                                               M_CMPULE_IMM(REG_ITMP1, s2, REG_ITMP2);
-                                               M_BEQZ(REG_ITMP2, 0);
-                                               }
-                                       else {
-                                               M_LDA(REG_ITMP2, REG_ZERO, s2);
-                                               M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
-                                               M_BEQZ(REG_ITMP2, 0);
-                                               }
-*/
-                                       M_BEQZ(s1, 8 + (d == REG_ITMP3));
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       a = dseg_addaddress ((void*) super->vftbl);
-                                       M_ALD(REG_ITMP2, REG_PV, a);
-                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       if (d != REG_ITMP3) {
-                                               M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
-                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                                               M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
-                                               }
-                                       else {
-                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, baseval));
-                                               M_ISUB(REG_ITMP1, REG_ITMP2, REG_ITMP1);
-                                               M_ALD(REG_ITMP2, REG_PV, a);
-                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                                               }
-                                       M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
-                                       M_BEQZ(REG_ITMP2, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       }
-                               }
-                       else
-                               panic ("internal error: no inlined array checkcast");
-                       }
-                       M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_BLTZ(s1, 0);
-                       mcode_addxcheckarefs(mcodeptr);
-                       break;
-
-               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
-                                     /* op1 = dimension, val.a = array descriptor    */
-
-                       /* check for negative sizes and copy sizes to stack if necessary  */
-
-                       MCODECHECK((iptr->op1 << 1) + 64);
-
-                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
-                               var_to_reg_int(s2, src, REG_ITMP1);
-                               M_BLTZ(s2, 0);
-                               mcode_addxcheckarefs(mcodeptr);
-
-                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
-
-                               if (src->varkind != ARGVAR) {
-                                       M_LST(s2, REG_SP, 8 * (s1 + INT_ARG_CNT));
-                                       }
-                               }
-
-                       /* a0 = dimension count */
-
-                       ICONST(argintregs[0], iptr->op1);
-
-                       /* a1 = arraydescriptor */
-
-                       a = dseg_addaddress(iptr->val.a);
-                       M_ALD(argintregs[1], REG_PV, a);
-
-                       /* a2 = pointer to dimensions = stack pointer */
-
-                       M_INTMOVE(REG_SP, argintregs[2]);
-
-                       a = dseg_addaddress((void*) (builtin_nmultianewarray));
-                       M_ALD(REG_PV, REG_PV, a);
-                       M_JSR(REG_RA, REG_PV);
-                       s1 = (int)((u1*) mcodeptr - mcodebase);
-                       if (s1 <= 32768)
-                               M_LDA (REG_PV, REG_RA, -s1);
-                       else {
-                               s4 ml = -s1, mh = 0;
-                               while (ml < -32768) {ml += 65536; mh--;}
-                               M_LDA(REG_PV, REG_RA, ml);
-                               M_LDAH(REG_PV, REG_PV, mh);
-                           }
-                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                       M_INTMOVE(REG_RESULT, s1);
-                       store_reg_to_var_int(iptr->dst, s1);
-                       break;
-
-
-               default: sprintf (logtext, "Unknown pseudo command: %d", iptr->opc);
-                        error();
-       
-   
-
-       } /* switch */
-               
-       } /* for instruction */
-               
-       /* copy values to interface registers */
-
-       src = bptr->outstack;
-       len = bptr->outdepth;
-       MCODECHECK(64+len);
-       while (src) {
-               len--;
-               if ((src->varkind != STACKVAR)) {
-                       s2 = src->type;
-                       if (IS_FLT_DBL_TYPE(s2)) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_FLTMOVE(s1,interfaces[len][s2].regoff);
-                                       }
-                               else {
-                                       M_DST(s1, REG_SP, 8 * interfaces[len][s2].regoff);
-                                       }
-                               }
-                       else {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_INTMOVE(s1,interfaces[len][s2].regoff);
-                                       }
-                               else {
-                                       M_LST(s1, REG_SP, 8 * interfaces[len][s2].regoff);
-                                       }
-                               }
-                       }
-               src = src->prev;
-               }
-       } /* if (bptr -> flags >= BBREACHED) */
-       } /* for basic block */
-
-       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
-
-       {
-       /* generate bound check stubs */
-
-       s4 *xcodeptr = NULL;
-       
-       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
-                               xboundrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-
-               gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
-                                 xboundrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xboundrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       M_BR((xcodeptr-mcodeptr)-1);
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(proto_java_lang_ArrayIndexOutOfBoundsException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_JMP(REG_ZERO, REG_ITMP3);
-                       }
-               }
-
-       /* generate negative array size check stubs */
-
-       xcodeptr = NULL;
-       
-       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
-                               xcheckarefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
-                                 xcheckarefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xcheckarefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       M_BR((xcodeptr-mcodeptr)-1);
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(proto_java_lang_NegativeArraySizeException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_JMP(REG_ZERO, REG_ITMP3);
-                       }
-               }
-
-       /* generate cast check stubs */
-
-       xcodeptr = NULL;
-       
-       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
-                               xcastrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
-                                 xcastrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xcastrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       M_BR((xcodeptr-mcodeptr)-1);
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(proto_java_lang_ClassCastException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_JMP(REG_ZERO, REG_ITMP3);
-                       }
-               }
-
-
-#ifdef SOFTNULLPTRCHECK
-
-       /* generate null pointer check stubs */
-
-       xcodeptr = NULL;
-
-       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
-                               xnullrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
-                                 xnullrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xnullrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       M_BR((xcodeptr-mcodeptr)-1);
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(proto_java_lang_NullPointerException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_JMP(REG_ZERO, REG_ITMP3);
-                       }
-               }
-
-#endif
-       }
-
-       mcode_finish((int)((u1*) mcodeptr - mcodebase));
-}
-
-
-/* redefinition of code generation macros (compiling into array) **************/
-
-/* 
-These macros are newly defined to allow code generation into an array.
-This is necessary, because the original M_.. macros generate code by
-calling 'mcode_adds4' that uses an additional data structure to
-receive the code.
-
-For a faster (but less flexible) version to generate code, these
-macros directly use the (s4* p) - pointer to put the code directly
-in a locally defined array.
-This makes sense only for the stub-generation-routines below.
-*/
-
-#undef M_OP3
-#define M_OP3(op,fu,a,b,c,const) \
-       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<(16-3*(const)))| \
-       ((const)<<12)|((fu)<<5)|((c)) )
-#undef M_FOP3
-#define M_FOP3(op,fu,a,b,c) \
-       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((fu)<<5)|(c) )
-#undef M_BRA
-#define M_BRA(op,a,disp) \
-       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((disp)&0x1fffff) )
-#undef M_MEM
-#define M_MEM(op,a,b,disp) \
-       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((disp)&0xffff) )
-
-
-/* function createcompilerstub *************************************************
-
-       creates a stub routine which calls the compiler
-       
-*******************************************************************************/
-
-#define COMPSTUBSIZE 3
-
-u1 *createcompilerstub (methodinfo *m)
-{
-       u8 *s = CNEW (u8, COMPSTUBSIZE);    /* memory to hold the stub            */
-       s4 *p = (s4*) s;                    /* code generation pointer            */
-       
-                                           /* code for the stub                  */
-       M_ALD (REG_PV, REG_PV, 16);         /* load pointer to the compiler       */
-       M_JMP (0, REG_PV);                  /* jump to the compiler, return address
-                                              in reg 0 is used as method pointer */
-       s[1] = (u8) m;                      /* literals to be adressed            */  
-       s[2] = (u8) asm_call_jit_compiler;  /* jump directly via PV from above    */
-
-#ifdef STATISTICS
-       count_cstub_len += COMPSTUBSIZE * 8;
-#endif
-
-       return (u1*) s;
-}
-
-
-/* function removecompilerstub *************************************************
-
-     deletes a compilerstub from memory  (simply by freeing it)
-
-*******************************************************************************/
-
-void removecompilerstub (u1 *stub) 
-{
-       CFREE (stub, COMPSTUBSIZE * 8);
-}
-
-/* function: createnativestub **************************************************
-
-       creates a stub routine which calls a native method
-
-*******************************************************************************/
-
-#define NATIVESTUBSIZE 34
-#define NATIVESTUBOFFSET 8
-
-int runverbosenat = 0;
-
-u1 *createnativestub (functionptr f, methodinfo *m)
-{
-       int disp;
-       u8 *s = CNEW (u8, NATIVESTUBSIZE);  /* memory to hold the stub            */
-       u8 *cs = s + NATIVESTUBOFFSET;
-       s4 *p = (s4*) (cs);                 /* code generation pointer            */
-
-       *(cs-1) = (u8) f;                   /* address of native method           */
-       *(cs-2) = (u8) (&exceptionptr);     /* address of exceptionptr            */
-       *(cs-3) = (u8) asm_handle_nat_exception; /* addr of asm exception handler */
-       *(cs-4) = (u8) (&env);              /* addr of jni_environement           */
-       *(cs-5) = (u8) asm_builtin_trace;
-       *(cs-6) = (u8) m;
-       *(cs-7) = (u8) asm_builtin_exittrace;
-       *(cs-8) = (u8) builtin_trace_exception;
-
-#if 0
-       printf("stub: ");
-       utf_display(m->class->name);
-       printf(".");
-       utf_display(m->name);
-       printf(" 0x%p\n", cs);
-#endif
-
-       M_LDA  (REG_SP, REG_SP, -8);        /* build up stackframe                */
-       M_AST  (REG_RA, REG_SP, 0);         /* store return address               */
-
-#if 1
-       if (runverbosenat) {
-               M_ALD(REG_ITMP1, REG_PV, -6*8);
-               M_ALD(REG_PV, REG_PV, -5*8);
-
-               M_JSR(REG_RA, REG_PV);
-               disp = -(int) (p - (s4*) cs)*4;
-               M_LDA(REG_PV, REG_RA, disp);
-       }
-#endif
-
-       reg_init();
-
-       M_MOV  (argintregs[4],argintregs[5]); 
-       M_FMOV (argfltregs[4],argfltregs[5]);
-
-       M_MOV  (argintregs[3],argintregs[4]);
-       M_FMOV (argfltregs[3],argfltregs[4]);
-
-       M_MOV  (argintregs[2],argintregs[3]);
-       M_FMOV (argfltregs[2],argfltregs[3]);
-
-       M_MOV  (argintregs[1],argintregs[2]);
-       M_FMOV (argfltregs[1],argfltregs[2]);
-
-       M_MOV  (argintregs[0],argintregs[1]);
-       M_FMOV (argfltregs[0],argfltregs[1]);
-       
-       M_ALD  (argintregs[0], REG_PV, -4*8);/* load adress of jni_environement   */
-
-       M_ALD  (REG_PV, REG_PV, -1*8);      /* load adress of native method       */
-       M_JSR  (REG_RA, REG_PV);            /* call native method                 */
-
-       disp = -(int) (p - (s4*) cs)*4;
-       M_LDA  (REG_PV, REG_RA, disp);      /* recompute pv from ra               */
-       M_ALD  (REG_ITMP3, REG_PV, -2*8);   /* get address of exceptionptr        */
-
-       M_ALD  (REG_ITMP1, REG_ITMP3, 0);   /* load exception into reg. itmp1     */
-       M_BNEZ (REG_ITMP1,
-                       3 + (runverbosenat ? 6 : 0));  /* if no exception then return        */
-
-#if 1
-       if (runverbosenat) {
-               M_ALD(argintregs[0], REG_PV, -6*8);
-               M_MOV(REG_RESULT, argintregs[1]);
-               M_FMOV(REG_FRESULT, argfltregs[2]);
-               M_FMOV(REG_FRESULT, argfltregs[3]);
-               M_ALD(REG_PV, REG_PV, -7*8);
-               M_JSR(REG_RA, REG_PV);
-       }
-#endif
-
-       M_ALD  (REG_RA, REG_SP, 0);         /* load return address                */
-       M_LDA  (REG_SP, REG_SP, 8);         /* remove stackframe                  */
-
-       M_RET  (REG_ZERO, REG_RA);          /* return to caller                   */
-       
-       M_AST  (REG_ZERO, REG_ITMP3, 0);    /* store NULL into exceptionptr       */
-
-#if 1
-       if (runverbosenat) {
-               M_LDA(REG_SP, REG_SP, -8);
-               M_AST(REG_ITMP1, REG_SP, 0);
-               M_MOV(REG_ITMP1, argintregs[0]);
-               M_ALD(argintregs[1], REG_PV, -6*8);
-               M_ALD(argintregs[2], REG_SP, 0);
-               M_CLR(argintregs[3]);
-               M_ALD(REG_PV, REG_PV, -8*8);
-               M_JSR(REG_RA, REG_PV);
-               disp = -(int) (p - (s4*) cs)*4;
-               M_LDA  (REG_PV, REG_RA, disp);
-               M_ALD(REG_ITMP1, REG_SP, 0);
-               M_LDA(REG_SP, REG_SP, 8);
-       }
-#endif
-
-       M_ALD  (REG_RA, REG_SP, 0);         /* load return address                */
-       M_LDA  (REG_SP, REG_SP, 8);         /* remove stackframe                  */
-
-       M_LDA  (REG_ITMP2, REG_RA, -4);     /* move fault address into reg. itmp2 */
-
-       M_ALD  (REG_ITMP3, REG_PV, -3*8);   /* load asm exception handler address */
-       M_JMP  (REG_ZERO, REG_ITMP3);       /* jump to asm exception handler      */
-       
-#if 0
-       {
-               static int stubprinted;
-               if (!stubprinted)
-                       printf("stubsize: %d/2\n", (int) (p - (s4*) s));
-               stubprinted = 1;
-       }
-#endif
-
-#ifdef STATISTICS
-       count_nstub_len += NATIVESTUBSIZE * 8;
-#endif
-
-       return (u1*) (s + NATIVESTUBOFFSET);
-}
-
-/* function: removenativestub **************************************************
-
-    removes a previously created native-stub from memory
-    
-*******************************************************************************/
-
-void removenativestub (u1 *stub)
-{
-       CFREE ((u8*) stub - NATIVESTUBOFFSET, NATIVESTUBSIZE * 8);
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/alpha/ngen.h b/alpha/ngen.h
deleted file mode 100644 (file)
index e89d434..0000000
+++ /dev/null
@@ -1,408 +0,0 @@
-/* alpha/ngen.h ****************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the machine dependent code generator definitions and macros for an
-       Alpha processor.
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/11
-
-*******************************************************************************/
-
-/* see also file calling.doc for explanation of calling conventions           */
-
-/* preallocated registers *****************************************************/
-
-/* integer registers */
-  
-#define REG_RESULT      0    /* to deliver method results                     */ 
-
-#define REG_RA          26   /* return address                                */
-#define REG_PV          27   /* procedure vector, must be provided by caller  */
-#define REG_METHODPTR   28   /* pointer to the place from where the procedure */
-                             /* vector has been fetched                       */
-#define REG_ITMP1       25   /* temporary register                            */
-#define REG_ITMP2       28   /* temporary register and method pointer         */
-#define REG_ITMP3       29   /* temporary register                            */
-
-#define REG_ITMP1_XPTR  25   /* exception pointer = temporary register 1      */
-#define REG_ITMP2_XPC   28   /* exception pc = temporary register 2           */
-
-#define REG_SP          30   /* stack pointer                                 */
-#define REG_ZERO        31   /* allways zero                                  */
-
-/* floating point registers */
-
-#define REG_FRESULT     0    /* to deliver floating point method results      */ 
-#define REG_FTMP1       28   /* temporary floating point register             */
-#define REG_FTMP2       29   /* temporary floating point register             */
-#define REG_FTMP3       30   /* temporary floating point register             */
-
-#define REG_IFTMP       28   /* temporary integer and floating point register */
-
-/* register descripton - array ************************************************/
-
-/* #define REG_RES   0         reserved register for OS or code generator     */
-/* #define REG_RET   1         return value register                          */
-/* #define REG_EXC   2         exception value register (only old jit)        */
-/* #define REG_SAV   3         (callee) saved register                        */
-/* #define REG_TMP   4         scratch temporary register (caller saved)      */
-/* #define REG_ARG   5         argument register (caller saved)               */
-
-/* #define REG_END   -1        last entry in tables */
-int nregdescint[] = {
-       REG_RET, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
-       REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, 
-       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
-       REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
-       REG_END };
-
-#define INT_SAV_CNT      7   /* number of int callee saved registers          */
-#define INT_ARG_CNT      6   /* number of int argument registers              */
-
-/* for use of reserved registers, see comment above */
-       
-int nregdescfloat[] = {
-       REG_RET, REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
-       REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
-       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
-       REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES,
-       REG_END };
-
-#define FLT_SAV_CNT      8   /* number of flt callee saved registers          */
-#define FLT_ARG_CNT      6   /* number of flt argument registers              */
-
-/* for use of reserved registers, see comment above */
-
-
-/* parameter allocation mode */
-
-int nreg_parammode = PARAMMODE_NUMBERED;  
-
-   /* parameter-registers will be allocated by assigning the
-      1. parameter:   int/float-reg 16
-      2. parameter:   int/float-reg 17  
-      3. parameter:   int/float-reg 18 ....
-   */
-
-
-/* stackframe-infos ***********************************************************/
-
-int parentargs_base; /* offset in stackframe for the parameter from the caller*/
-
-/* -> see file 'calling.doc' */
-
-
-/* macros to create code ******************************************************/
-
-#define REG   0
-#define CONST 1
-
-/* 3-address-operations: M_OP3
-      op ..... opcode
-      fu ..... function-number
-      a  ..... register number source 1
-      b  ..... register number or constant integer source 2
-      c  ..... register number destination
-      const .. switch to use b as constant integer 
-                 (REG means: use b as register number)
-                 (CONST means: use b as constant 8-bit-integer)
-*/      
-#define M_OP3(op,fu,a,b,c,const) \
-       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<(16-3*(const)))| \
-       ((const)<<12)|((fu)<<5)|((c)) )
-
-/* 3-address-floating-point-operation: M_FOP3 
-     op .... opcode
-     fu .... function-number
-     a,b ... source floating-point registers
-     c ..... destination register
-*/ 
-#define M_FOP3(op,fu,a,b,c) \
-       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((fu)<<5)|(c) )
-
-/* branch instructions: M_BRA 
-      op ..... opcode
-      a ...... register to be tested
-      disp ... relative address to be jumped to (divided by 4)
-*/
-#define M_BRA(op,a,disp) \
-       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((disp)&0x1fffff) )
-
-
-/* memory operations: M_MEM
-      op ..... opcode
-      a ...... source/target register for memory access
-      b ...... base register
-      disp ... displacement (16 bit signed) to be added to b
-*/ 
-#define M_MEM(op,a,b,disp) \
-       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((disp)&0xffff) )
-
-
-/* macros for all used commands (see an Alpha-manual for description) *********/ 
-
-#define M_LDA(a,b,disp)         M_MEM (0x08,a,b,disp)           /* low const  */
-#define M_LDAH(a,b,disp)        M_MEM (0x09,a,b,disp)           /* high const */
-#define M_BLDU(a,b,disp)        M_MEM (0x0a,a,b,disp)           /*  8 load    */
-#define M_SLDU(a,b,disp)        M_MEM (0x0c,a,b,disp)           /* 16 load    */
-#define M_ILD(a,b,disp)         M_MEM (0x28,a,b,disp)           /* 32 load    */
-#define M_LLD(a,b,disp)         M_MEM (0x29,a,b,disp)           /* 64 load    */
-#define M_ALD(a,b,disp)         M_MEM (0x29,a,b,disp)           /* addr load  */
-#define M_BST(a,b,disp)         M_MEM (0x0e,a,b,disp)           /*  8 store   */
-#define M_SST(a,b,disp)         M_MEM (0x0d,a,b,disp)           /* 16 store   */
-#define M_IST(a,b,disp)         M_MEM (0x2c,a,b,disp)           /* 32 store   */
-#define M_LST(a,b,disp)         M_MEM (0x2d,a,b,disp)           /* 64 store   */
-#define M_AST(a,b,disp)         M_MEM (0x2d,a,b,disp)           /* addr store */
-
-#define M_BSEXT(b,c)            M_OP3 (0x1c,0x0,REG_ZERO,b,c,0) /*  8 signext */
-#define M_SSEXT(b,c)            M_OP3 (0x1c,0x1,REG_ZERO,b,c,0) /* 16 signext */
-
-#define M_BR(disp)              M_BRA (0x30,REG_ZERO,disp)      /* branch     */
-#define M_BSR(ra,disp)          M_BRA (0x34,ra,disp)            /* branch sbr */
-#define M_BEQZ(a,disp)          M_BRA (0x39,a,disp)             /* br a == 0  */
-#define M_BLTZ(a,disp)          M_BRA (0x3a,a,disp)             /* br a <  0  */
-#define M_BLEZ(a,disp)          M_BRA (0x3b,a,disp)             /* br a <= 0  */
-#define M_BNEZ(a,disp)          M_BRA (0x3d,a,disp)             /* br a != 0  */
-#define M_BGEZ(a,disp)          M_BRA (0x3e,a,disp)             /* br a >= 0  */
-#define M_BGTZ(a,disp)          M_BRA (0x3f,a,disp)             /* br a >  0  */
-
-#define M_JMP(a,b)              M_MEM (0x1a,a,b,0x0000)         /* jump       */
-#define M_JSR(a,b)              M_MEM (0x1a,a,b,0x4000)         /* call sbr   */
-#define M_RET(a,b)              M_MEM (0x1a,a,b,0x8000)         /* return     */
-
-#define M_IADD(a,b,c)           M_OP3 (0x10,0x0,  a,b,c,0)      /* 32 add     */
-#define M_LADD(a,b,c)           M_OP3 (0x10,0x20, a,b,c,0)      /* 64 add     */
-#define M_ISUB(a,b,c)           M_OP3 (0x10,0x09, a,b,c,0)      /* 32 sub     */
-#define M_LSUB(a,b,c)           M_OP3 (0x10,0x29, a,b,c,0)      /* 64 sub     */
-#define M_IMUL(a,b,c)           M_OP3 (0x13,0x00, a,b,c,0)      /* 32 mul     */
-#define M_LMUL(a,b,c)           M_OP3 (0x13,0x20, a,b,c,0)      /* 64 mul     */
-
-#define M_IADD_IMM(a,b,c)       M_OP3 (0x10,0x0,  a,b,c,1)      /* 32 add     */
-#define M_LADD_IMM(a,b,c)       M_OP3 (0x10,0x20, a,b,c,1)      /* 64 add     */
-#define M_ISUB_IMM(a,b,c)       M_OP3 (0x10,0x09, a,b,c,1)      /* 32 sub     */
-#define M_LSUB_IMM(a,b,c)       M_OP3 (0x10,0x29, a,b,c,1)      /* 64 sub     */
-#define M_IMUL_IMM(a,b,c)       M_OP3 (0x13,0x00, a,b,c,1)      /* 32 mul     */
-#define M_LMUL_IMM(a,b,c)       M_OP3 (0x13,0x20, a,b,c,1)      /* 64 mul     */
-
-#define M_CMPEQ(a,b,c)          M_OP3 (0x10,0x2d, a,b,c,0)      /* c = a == b */
-#define M_CMPLT(a,b,c)          M_OP3 (0x10,0x4d, a,b,c,0)      /* c = a <  b */
-#define M_CMPLE(a,b,c)          M_OP3 (0x10,0x6d, a,b,c,0)      /* c = a <= b */
-
-#define M_CMPULE(a,b,c)         M_OP3 (0x10,0x3d, a,b,c,0)      /* c = a <= b */
-#define M_CMPULT(a,b,c)         M_OP3 (0x10,0x1d, a,b,c,0)      /* c = a <= b */
-
-#define M_CMPEQ_IMM(a,b,c)      M_OP3 (0x10,0x2d, a,b,c,1)      /* c = a == b */
-#define M_CMPLT_IMM(a,b,c)      M_OP3 (0x10,0x4d, a,b,c,1)      /* c = a <  b */
-#define M_CMPLE_IMM(a,b,c)      M_OP3 (0x10,0x6d, a,b,c,1)      /* c = a <= b */
-
-#define M_CMPULE_IMM(a,b,c)     M_OP3 (0x10,0x3d, a,b,c,1)      /* c = a <= b */
-#define M_CMPULT_IMM(a,b,c)     M_OP3 (0x10,0x1d, a,b,c,1)      /* c = a <= b */
-
-#define M_AND(a,b,c)            M_OP3 (0x11,0x00, a,b,c,0)      /* c = a &  b */
-#define M_OR( a,b,c)            M_OP3 (0x11,0x20, a,b,c,0)      /* c = a |  b */
-#define M_XOR(a,b,c)            M_OP3 (0x11,0x40, a,b,c,0)      /* c = a ^  b */
-
-#define M_AND_IMM(a,b,c)        M_OP3 (0x11,0x00, a,b,c,1)      /* c = a &  b */
-#define M_OR_IMM( a,b,c)        M_OP3 (0x11,0x20, a,b,c,1)      /* c = a |  b */
-#define M_XOR_IMM(a,b,c)        M_OP3 (0x11,0x40, a,b,c,1)      /* c = a ^  b */
-
-#define M_MOV(a,c)              M_OR (a,a,c)                    /* c = a      */
-#define M_CLR(c)                M_OR (31,31,c)                  /* c = 0      */
-#define M_NOP                   M_OR (31,31,31)                 /* ;          */
-
-#define M_SLL(a,b,c)            M_OP3 (0x12,0x39, a,b,c,0)      /* c = a << b */
-#define M_SRA(a,b,c)            M_OP3 (0x12,0x3c, a,b,c,0)      /* c = a >> b */
-#define M_SRL(a,b,c)            M_OP3 (0x12,0x34, a,b,c,0)      /* c = a >>>b */
-
-#define M_SLL_IMM(a,b,c)        M_OP3 (0x12,0x39, a,b,c,1)      /* c = a << b */
-#define M_SRA_IMM(a,b,c)        M_OP3 (0x12,0x3c, a,b,c,1)      /* c = a >> b */
-#define M_SRL_IMM(a,b,c)        M_OP3 (0x12,0x34, a,b,c,1)      /* c = a >>>b */
-
-#define M_FLD(a,b,disp)         M_MEM (0x22,a,b,disp)           /* load flt   */
-#define M_DLD(a,b,disp)         M_MEM (0x23,a,b,disp)           /* load dbl   */
-#define M_FST(a,b,disp)         M_MEM (0x26,a,b,disp)           /* store flt  */
-#define M_DST(a,b,disp)         M_MEM (0x27,a,b,disp)           /* store dbl  */
-
-#define M_FADD(a,b,c)           M_FOP3 (0x16, 0x080, a,b,c)     /* flt add    */
-#define M_DADD(a,b,c)           M_FOP3 (0x16, 0x0a0, a,b,c)     /* dbl add    */
-#define M_FSUB(a,b,c)           M_FOP3 (0x16, 0x081, a,b,c)     /* flt sub    */
-#define M_DSUB(a,b,c)           M_FOP3 (0x16, 0x0a1, a,b,c)     /* dbl sub    */
-#define M_FMUL(a,b,c)           M_FOP3 (0x16, 0x082, a,b,c)     /* flt mul    */
-#define M_DMUL(a,b,c)           M_FOP3 (0x16, 0x0a2, a,b,c)     /* dbl mul    */
-#define M_FDIV(a,b,c)           M_FOP3 (0x16, 0x083, a,b,c)     /* flt div    */
-#define M_DDIV(a,b,c)           M_FOP3 (0x16, 0x0a3, a,b,c)     /* dbl div    */
-
-#define M_FADDS(a,b,c)          M_FOP3 (0x16, 0x580, a,b,c)     /* flt add    */
-#define M_DADDS(a,b,c)          M_FOP3 (0x16, 0x5a0, a,b,c)     /* dbl add    */
-#define M_FSUBS(a,b,c)          M_FOP3 (0x16, 0x581, a,b,c)     /* flt sub    */
-#define M_DSUBS(a,b,c)          M_FOP3 (0x16, 0x5a1, a,b,c)     /* dbl sub    */
-#define M_FMULS(a,b,c)          M_FOP3 (0x16, 0x582, a,b,c)     /* flt mul    */
-#define M_DMULS(a,b,c)          M_FOP3 (0x16, 0x5a2, a,b,c)     /* dbl mul    */
-#define M_FDIVS(a,b,c)          M_FOP3 (0x16, 0x583, a,b,c)     /* flt div    */
-#define M_DDIVS(a,b,c)          M_FOP3 (0x16, 0x5a3, a,b,c)     /* dbl div    */
-
-#define M_CVTDF(b,c)            M_FOP3 (0x16, 0x0ac, 31,b,c)    /* dbl2long   */
-#define M_CVTLF(b,c)            M_FOP3 (0x16, 0x0bc, 31,b,c)    /* long2flt   */
-#define M_CVTLD(b,c)            M_FOP3 (0x16, 0x0be, 31,b,c)    /* long2dbl   */
-#define M_CVTDL(b,c)            M_FOP3 (0x16, 0x1af, 31,b,c)    /* dbl2long   */
-#define M_CVTDL_C(b,c)          M_FOP3 (0x16, 0x12f, 31,b,c)    /* dbl2long   */
-#define M_CVTLI(b,c)            M_FOP3 (0x17, 0x130, 31,b,c)    /* long2int   */
-
-#define M_CVTDFS(b,c)           M_FOP3 (0x16, 0x5ac, 31,b,c)    /* dbl2long   */
-#define M_CVTDLS(b,c)           M_FOP3 (0x16, 0x5af, 31,b,c)    /* dbl2long   */
-#define M_CVTDL_CS(b,c)         M_FOP3 (0x16, 0x52f, 31,b,c)    /* dbl2long   */
-#define M_CVTLIS(b,c)           M_FOP3 (0x17, 0x530, 31,b,c)    /* long2int   */
-
-#define M_FCMPEQ(a,b,c)         M_FOP3 (0x16, 0x0a5, a,b,c)     /* c = a==b   */
-#define M_FCMPLT(a,b,c)         M_FOP3 (0x16, 0x0a6, a,b,c)     /* c = a<b    */
-
-#define M_FCMPEQS(a,b,c)        M_FOP3 (0x16, 0x5a5, a,b,c)     /* c = a==b   */
-#define M_FCMPLTS(a,b,c)        M_FOP3 (0x16, 0x5a6, a,b,c)     /* c = a<b    */
-
-#define M_FMOV(fa,fb)           M_FOP3 (0x17, 0x020, fa,fa,fb)  /* b = a      */
-#define M_FMOVN(fa,fb)          M_FOP3 (0x17, 0x021, fa,fa,fb)  /* b = -a     */
-
-#define M_FNOP                  M_FMOV (31,31)
-
-#define M_FBEQZ(fa,disp)        M_BRA (0x31,fa,disp)            /* br a == 0.0*/
-
-/* macros for special commands (see an Alpha-manual for description) **********/ 
-
-#define M_TRAPB                 M_MEM (0x18,0,0,0x0000)        /* trap barrier*/
-
-#define M_S4ADDL(a,b,c)         M_OP3 (0x10,0x02, a,b,c,0)     /* c = a*4 + b */
-#define M_S4ADDQ(a,b,c)         M_OP3 (0x10,0x22, a,b,c,0)     /* c = a*4 + b */
-#define M_S4SUBL(a,b,c)         M_OP3 (0x10,0x0b, a,b,c,0)     /* c = a*4 - b */
-#define M_S4SUBQ(a,b,c)         M_OP3 (0x10,0x2b, a,b,c,0)     /* c = a*4 - b */
-#define M_S8ADDL(a,b,c)         M_OP3 (0x10,0x12, a,b,c,0)     /* c = a*8 + b */
-#define M_S8ADDQ(a,b,c)         M_OP3 (0x10,0x32, a,b,c,0)     /* c = a*8 + b */
-#define M_S8SUBL(a,b,c)         M_OP3 (0x10,0x1b, a,b,c,0)     /* c = a*8 - b */
-#define M_S8SUBQ(a,b,c)         M_OP3 (0x10,0x3b, a,b,c,0)     /* c = a*8 - b */
-#define M_SAADDQ(a,b,c)         M_S8ADDQ(a,b,c)                /* c = a*8 + b */
-
-#define M_S4ADDL_IMM(a,b,c)     M_OP3 (0x10,0x02, a,b,c,1)     /* c = a*4 + b */
-#define M_S4ADDQ_IMM(a,b,c)     M_OP3 (0x10,0x22, a,b,c,1)     /* c = a*4 + b */
-#define M_S4SUBL_IMM(a,b,c)     M_OP3 (0x10,0x0b, a,b,c,1)     /* c = a*4 - b */
-#define M_S4SUBQ_IMM(a,b,c)     M_OP3 (0x10,0x2b, a,b,c,1)     /* c = a*4 - b */
-#define M_S8ADDL_IMM(a,b,c)     M_OP3 (0x10,0x12, a,b,c,1)     /* c = a*8 + b */
-#define M_S8ADDQ_IMM(a,b,c)     M_OP3 (0x10,0x32, a,b,c,1)     /* c = a*8 + b */
-#define M_S8SUBL_IMM(a,b,c)     M_OP3 (0x10,0x1b, a,b,c,1)     /* c = a*8 - b */
-#define M_S8SUBQ_IMM(a,b,c)     M_OP3 (0x10,0x3b, a,b,c,1)     /* c = a*8 - b */
-
-#define M_LLD_U(a,b,disp)       M_MEM (0x0b,a,b,disp)          /* unalign ld  */
-#define M_LST_U(a,b,disp)       M_MEM (0x0f,a,b,disp)          /* unalign st  */
-
-#define M_ZAP(a,b,c)            M_OP3 (0x12,0x30, a,b,c,0)
-#define M_ZAPNOT(a,b,c)         M_OP3 (0x12,0x31, a,b,c,0)
-
-#define M_ZAP_IMM(a,b,c)        M_OP3 (0x12,0x30, a,b,c,1)
-#define M_ZAPNOT_IMM(a,b,c)     M_OP3 (0x12,0x31, a,b,c,1)
-
-#define M_BZEXT(a,b)            M_ZAPNOT_IMM(a, 0x01, b)       /*  8 zeroext  */
-#define M_CZEXT(a,b)            M_ZAPNOT_IMM(a, 0x03, b)       /* 16 zeroext  */
-#define M_IZEXT(a,b)            M_ZAPNOT_IMM(a, 0x0f, b)       /* 32 zeroext  */
-
-#define M_EXTBL(a,b,c)          M_OP3 (0x12,0x06, a,b,c,0)
-#define M_EXTWL(a,b,c)          M_OP3 (0x12,0x16, a,b,c,0)
-#define M_EXTLL(a,b,c)          M_OP3 (0x12,0x26, a,b,c,0)
-#define M_EXTQL(a,b,c)          M_OP3 (0x12,0x36, a,b,c,0)
-#define M_EXTWH(a,b,c)          M_OP3 (0x12,0x5a, a,b,c,0)
-#define M_EXTLH(a,b,c)          M_OP3 (0x12,0x6a, a,b,c,0)
-#define M_EXTQH(a,b,c)          M_OP3 (0x12,0x7a, a,b,c,0)
-#define M_INSBL(a,b,c)          M_OP3 (0x12,0x0b, a,b,c,0)
-#define M_INSWL(a,b,c)          M_OP3 (0x12,0x1b, a,b,c,0)
-#define M_INSLL(a,b,c)          M_OP3 (0x12,0x2b, a,b,c,0)
-#define M_INSQL(a,b,c)          M_OP3 (0x12,0x3b, a,b,c,0)
-#define M_INSWH(a,b,c)          M_OP3 (0x12,0x57, a,b,c,0)
-#define M_INSLH(a,b,c)          M_OP3 (0x12,0x67, a,b,c,0)
-#define M_INSQH(a,b,c)          M_OP3 (0x12,0x77, a,b,c,0)
-#define M_MSKBL(a,b,c)          M_OP3 (0x12,0x02, a,b,c,0)
-#define M_MSKWL(a,b,c)          M_OP3 (0x12,0x12, a,b,c,0)
-#define M_MSKLL(a,b,c)          M_OP3 (0x12,0x22, a,b,c,0)
-#define M_MSKQL(a,b,c)          M_OP3 (0x12,0x32, a,b,c,0)
-#define M_MSKWH(a,b,c)          M_OP3 (0x12,0x52, a,b,c,0)
-#define M_MSKLH(a,b,c)          M_OP3 (0x12,0x62, a,b,c,0)
-#define M_MSKQH(a,b,c)          M_OP3 (0x12,0x72, a,b,c,0)
-
-#define M_EXTBL_IMM(a,b,c)      M_OP3 (0x12,0x06, a,b,c,1)
-#define M_EXTWL_IMM(a,b,c)      M_OP3 (0x12,0x16, a,b,c,1)
-#define M_EXTLL_IMM(a,b,c)      M_OP3 (0x12,0x26, a,b,c,1)
-#define M_EXTQL_IMM(a,b,c)      M_OP3 (0x12,0x36, a,b,c,1)
-#define M_EXTWH_IMM(a,b,c)      M_OP3 (0x12,0x5a, a,b,c,1)
-#define M_EXTLH_IMM(a,b,c)      M_OP3 (0x12,0x6a, a,b,c,1)
-#define M_EXTQH_IMM(a,b,c)      M_OP3 (0x12,0x7a, a,b,c,1)
-#define M_INSBL_IMM(a,b,c)      M_OP3 (0x12,0x0b, a,b,c,1)
-#define M_INSWL_IMM(a,b,c)      M_OP3 (0x12,0x1b, a,b,c,1)
-#define M_INSLL_IMM(a,b,c)      M_OP3 (0x12,0x2b, a,b,c,1)
-#define M_INSQL_IMM(a,b,c)      M_OP3 (0x12,0x3b, a,b,c,1)
-#define M_INSWH_IMM(a,b,c)      M_OP3 (0x12,0x57, a,b,c,1)
-#define M_INSLH_IMM(a,b,c)      M_OP3 (0x12,0x67, a,b,c,1)
-#define M_INSQH_IMM(a,b,c)      M_OP3 (0x12,0x77, a,b,c,1)
-#define M_MSKBL_IMM(a,b,c)      M_OP3 (0x12,0x02, a,b,c,1)
-#define M_MSKWL_IMM(a,b,c)      M_OP3 (0x12,0x12, a,b,c,1)
-#define M_MSKLL_IMM(a,b,c)      M_OP3 (0x12,0x22, a,b,c,1)
-#define M_MSKQL_IMM(a,b,c)      M_OP3 (0x12,0x32, a,b,c,1)
-#define M_MSKWH_IMM(a,b,c)      M_OP3 (0x12,0x52, a,b,c,1)
-#define M_MSKLH_IMM(a,b,c)      M_OP3 (0x12,0x62, a,b,c,1)
-#define M_MSKQH_IMM(a,b,c)      M_OP3 (0x12,0x72, a,b,c,1)
-
-#define M_UMULH(a,b,c)          M_OP3 (0x13,0x30, a,b,c,0)     /* 64 umulh    */
-
-#define M_UMULH_IMM(a,b,c)      M_OP3 (0x13,0x30, a,b,c,1)     /* 64 umulh    */
-
-#define M_CMOVEQ(a,b,c)         M_OP3 (0x11,0x24, a,b,c,0)     /* a==0 ? c=b  */
-#define M_CMOVNE(a,b,c)         M_OP3 (0x11,0x26, a,b,c,0)     /* a!=0 ? c=b  */
-#define M_CMOVLT(a,b,c)         M_OP3 (0x11,0x44, a,b,c,0)     /* a< 0 ? c=b  */
-#define M_CMOVGE(a,b,c)         M_OP3 (0x11,0x46, a,b,c,0)     /* a>=0 ? c=b  */
-#define M_CMOVLE(a,b,c)         M_OP3 (0x11,0x64, a,b,c,0)     /* a<=0 ? c=b  */
-#define M_CMOVGT(a,b,c)         M_OP3 (0x11,0x66, a,b,c,0)     /* a> 0 ? c=b  */
-
-#define M_CMOVEQ_IMM(a,b,c)     M_OP3 (0x11,0x24, a,b,c,1)     /* a==0 ? c=b  */
-#define M_CMOVNE_IMM(a,b,c)     M_OP3 (0x11,0x26, a,b,c,1)     /* a!=0 ? c=b  */
-#define M_CMOVLT_IMM(a,b,c)     M_OP3 (0x11,0x44, a,b,c,1)     /* a< 0 ? c=b  */
-#define M_CMOVGE_IMM(a,b,c)     M_OP3 (0x11,0x46, a,b,c,1)     /* a>=0 ? c=b  */
-#define M_CMOVLE_IMM(a,b,c)     M_OP3 (0x11,0x64, a,b,c,1)     /* a<=0 ? c=b  */
-#define M_CMOVGT_IMM(a,b,c)     M_OP3 (0x11,0x66, a,b,c,1)     /* a> 0 ? c=b  */
-
-/* macros for unused commands (see an Alpha-manual for description) ***********/ 
-
-#define M_ANDNOT(a,b,c,const)   M_OP3 (0x11,0x08, a,b,c,const) /* c = a &~ b  */
-#define M_ORNOT(a,b,c,const)    M_OP3 (0x11,0x28, a,b,c,const) /* c = a |~ b  */
-#define M_XORNOT(a,b,c,const)   M_OP3 (0x11,0x48, a,b,c,const) /* c = a ^~ b  */
-
-#define M_CMPBGE(a,b,c,const)   M_OP3 (0x10,0x0f, a,b,c,const)
-
-#define M_FCMPUN(a,b,c)         M_FOP3 (0x16, 0x0a4, a,b,c)    /* unordered   */
-#define M_FCMPLE(a,b,c)         M_FOP3 (0x16, 0x0a7, a,b,c)    /* c = a<=b    */
-
-#define M_FCMPUNS(a,b,c)        M_FOP3 (0x16, 0x5a4, a,b,c)    /* unordered   */
-#define M_FCMPLES(a,b,c)        M_FOP3 (0x16, 0x5a7, a,b,c)    /* c = a<=b    */
-
-#define M_FBNEZ(fa,disp)        M_BRA (0x35,fa,disp)
-#define M_FBLEZ(fa,disp)        M_BRA (0x33,fa,disp)
-
-#define M_JMP_CO(a,b)           M_MEM (0x1a,a,b,0xc000)        /* call cosub  */
-
-
-/* function gen_resolvebranch **************************************************
-
-       backpatches a branch instruction; Alpha branch instructions are very
-       regular, so it is only necessary to overwrite some fixed bits in the
-       instruction.
-
-       parameters: ip ... pointer to instruction after branch (void*)
-                   so ... offset of instruction after branch  (s4)
-                   to ... offset of branch target             (s4)
-
-*******************************************************************************/
-
-#define gen_resolvebranch(ip,so,to) ((s4*)(ip))[-1]|=((s4)(to)-(so))>>2&0x1fffff
-
-#define SOFTNULLPTRCHECK       /* soft null pointer check supportet as option */
diff --git a/alpha/sigcontext.h b/alpha/sigcontext.h
deleted file mode 100644 (file)
index 2b5f1b5..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _ASMAXP_SIGCONTEXT_H
-#define _ASMAXP_SIGCONTEXT_H
-
-struct sigcontext_struct {
-
-       /*
-       * what should we have here? I'd probably better use the same
-       * stack layout as OSF/1, just in case we ever want to try
-       * running their binaries.. 
-       *
-       * This is the basic layout, but I don't know if we'll ever
-       * actually fill in all the values..
-       */
-
-       long          sc_onstack;    /* sigstack state to restore       */
-       long          sc_mask;       /* signal mask to restore          */
-       long          sc_pc;         /* pc at time of signal            */
-       long          sc_ps;         /* psl to retore                   */
-       long          sc_regs[32];   /* processor regs 0 to 31          */
-       long          sc_ownedfp;    /* fp has been used                */
-       long          sc_fpregs[32]; /* fp regs 0 to 31                 */
-       unsigned long sc_fpcr;       /* floating point control register */
-       unsigned long sc_fp_control; /* software fpcr                   */
-                                    /* rest is unused                  */
-       unsigned long sc_reserved1, sc_reserved2;
-       unsigned long sc_ssize;
-       char          *sc_sbase;
-       unsigned long sc_traparg_a0;
-       unsigned long sc_traparg_a1;
-       unsigned long sc_traparg_a2;
-       unsigned long sc_fp_trap_pc;
-       unsigned long sc_fp_trigger_sum;
-       unsigned long sc_fp_trigger_inst;
-       unsigned long sc_retcode[2];
-};
-
-#endif
diff --git a/alpha/threads.h b/alpha/threads.h
deleted file mode 100644 (file)
index c35df86..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************** threads.h **************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       System dependent part of thread header file.
-
-       Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/19
-
-*******************************************************************************/
-
-
-#ifndef __sysdep_threads_h
-#define __sysdep_threads_h
-
-#include "config.h"
-#include "threads/thread.h"
-
-/* Thread handling */
-
-/* prototypes */
-
-void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
-u1*  asm_initialize_thread_stack (void *func, u1 *stack);
-void *asm_switchstackandcall (void *stack, void *func, void **stacktopsave, void *p);
-
-/* access macros */
-
-#define        THREADSTACKSIZE         (32 * 1024)
-
-#define        THREADSWITCH(to, from)  asm_perform_threadswitch(&(from)->restorePoint,\
-                                    &(to)->restorePoint, &(from)->usedStackTop)
-
-#define THREADINIT(to, func)    (to)->restorePoint =                         \
-                                    asm_initialize_thread_stack((u1*)(func), \
-                                                            (to)->stackEnd)
-
-#define        THREADINFO(e)                               \
-               do {                                        \
-                       (e)->restorePoint = 0;                  \
-                       (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
-               } while(0)
-
-#endif
diff --git a/alpha/types.h b/alpha/types.h
deleted file mode 100644 (file)
index 94b3779..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* alpha/types.h ***************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       machine specific definitions for the Alpha processor
-       
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/09/22
-
-*******************************************************************************/
-
-#ifndef _CACAO_TYPES_H
-
-#define _CACAO_TYPES_H
-
-#define POINTERSIZE         8
-#define WORDS_BIGENDIAN     0
-
-#define SUPPORT_DIVISION    0
-#define SUPPORT_LONG        1
-#define SUPPORT_FLOAT       1
-#define SUPPORT_DOUBLE      1
-
-#define SUPPORT_LONG_ADD    1
-#define SUPPORT_LONG_CMP    1
-#define SUPPORT_LONG_LOG    1
-#define SUPPORT_LONG_SHIFT  1
-#define SUPPORT_LONG_MULDIV 1
-#define SUPPORT_LONG_ICVT   1
-#define SUPPORT_LONG_FCVT   1
-
-#define CONDITIONAL_LOADCONST
-
-#define U8_AVAILABLE        1
-
-
-typedef signed char             s1;
-typedef unsigned char           u1;
-typedef signed short int        s2;
-typedef unsigned short int      u2;
-
-typedef signed int              s4;
-typedef unsigned int            u4;
-
-#if U8_AVAILABLE
-typedef signed long int         s8;
-typedef unsigned long int       u8; 
-#else
-typedef struct {u4 low, high;}  u8;
-#define s8 u8
-#endif
-
-#endif
-
index 2504c53f5451cc1db7a709097bc442876378acf2..6b15f6dece832368cc983261d781aaf4fc0733b2 100644 (file)
--- a/asmpart.h
+++ b/asmpart.h
@@ -1,22 +1,41 @@
-/****************************** asmpart.h **************************************
+/* asmpart.h - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Headerfile for asmpart.S. asmpart.S contains the machine dependent
-       Java - C interface functions.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1997/10/15
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas Krall
+
+   $Id: asmpart.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include "global.h"
 
-/* determines if the byte support instruction set (21164a and higher)
+/* 
+   determines if the byte support instruction set (21164a and higher)
    is available.
 */
 int has_no_x_instr_set();
@@ -24,21 +43,24 @@ int has_no_x_instr_set();
 void synchronize_caches();
 
 
-/* invokes the compiler for untranslated JavaVM methods.
+/* 
+   invokes the compiler for untranslated JavaVM methods.
    Register R0 contains a pointer to the method info structure
    (prepared by createcompilerstub).
 */
 void asm_call_jit_compiler();
 
 
-/* This function calls a Java-method (which possibly needs compilation)
+/* 
+   This function calls a Java-method (which possibly needs compilation)
    with up to 4 parameters. This function calls a Java-method (which
    possibly needs compilation) with up to 4 parameters.
 */
 java_objectheader *asm_calljavamethod(methodinfo *m, void *arg1, void *arg2,
                                       void *arg3, void *arg4);
 
-/* This function calls a Java-method (which possibly needs compilation)
+/* 
+   This function calls a Java-method (which possibly needs compilation)
    with up to 4 parameters. This function calls a Java-method (which
    possibly needs compilation) with up to 4 parameters. 
    also supports a return value
@@ -46,12 +68,17 @@ java_objectheader *asm_calljavamethod(methodinfo *m, void *arg1, void *arg2,
 java_objectheader *asm_calljavafunction(methodinfo *m, void *arg1, void *arg2,
                                         void *arg3, void *arg4);
 
-/* gets the class of the caller from the stack frame
+void asm_handle_exception();
+void asm_handle_nat_exception();
+
+/* 
+   gets the class of the caller from the stack frame
 */
 methodinfo *asm_getcallingmethod();
 
 
-/* This funtion saves all callee saved registers and calls the function
+/* 
+   This funtion saves all callee saved registers and calls the function
    which is passed as parameter.
    This function is needed by the garbage collector, which needs to access
    all registers which are stored on the stack. Unused registers are
@@ -64,3 +91,17 @@ void *asm_switchstackandcall(void *stack, void *func, void **stacktopsave, void
 
 void asm_builtin_trace();
 void asm_builtin_exittrace();
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index e1d804ae2a46f0b7d59ea936a37c57e0b4e143ef..ec7e82ab4444fd9077e2163d281b5f2506a6cca5 100644 (file)
--- a/builtin.c
+++ b/builtin.c
@@ -1,35 +1,56 @@
-/****************************** builtin.c **************************************
+/* builtin.c - functions for unsupported operations
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains C functions for JavaVM Instructions that cannot be translated
-       to machine language directly. Consequently, the generated machine code
-       for these instructions contains function calls instead of machine
-       instructions, using the C calling convention.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl          EMAIL: cacao@complang.tuwien.ac.at
-                        Andreas  Krall          EMAIL: cacao@complang.tuwien.ac.at
-                        Mark Probst             EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 2003/02/12
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-#include <assert.h>
+   Authors: Reinhard Grafl
+            Andreas Krall
+            Mark Probst
+
+   Contains C functions for JavaVM Instructions that cannot be
+   translated to machine language directly. Consequently, the
+   generated machine code for these instructions contains function
+   calls instead of machine instructions, using the C calling
+   convention.
+
+   $Id: builtin.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
+
+#include <assert.h>
 #include "global.h"
 #include "builtin.h"
-
 #include "loader.h"
 #include "tables.h"
-
 #include "threads/thread.h"
-#include "threads/locks.h"                             /* schani */
+#include "threads/locks.h"
+#include "toolbox/loging.h"
 
 #include "native-math.h"
 
+
 builtin_descriptor builtin_desc[] = {
        {(functionptr) builtin_instanceof,                 "instanceof"},
        {(functionptr) builtin_checkcast,                  "checkcast"},
@@ -45,9 +66,7 @@ builtin_descriptor builtin_desc[] = {
        {(functionptr) builtin_anewarray,          "anewarray"},
        {(functionptr) builtin_newarray_array,     "newarray_array"},
 #if defined(__I386__)
-       /*
-        * have 2 parameters (needs stack manipulation)
-        */
+       /* have 2 parameters (needs stack manipulation) */
        {(functionptr) asm_builtin_anewarray,      "anewarray"},
        {(functionptr) asm_builtin_newarray_array, "newarray_array"},
 #endif
@@ -123,7 +142,7 @@ builtin_descriptor builtin_desc[] = {
 #endif
        {(functionptr) builtin_d2f,                                "d2f"},
        {(functionptr) NULL,                                       "unknown"}
-       };
+};
 
 
 /*****************************************************************************
@@ -145,20 +164,20 @@ s4 builtin_isanysubclass (classinfo *sub, classinfo *super)
 { 
        if (super->flags & ACC_INTERFACE)
                return (sub->vftbl->interfacetablelength > super->index) &&
-                          (sub->vftbl->interfacetable[-super->index] != NULL);
+                       (sub->vftbl->interfacetable[-super->index] != NULL);
 
        /*
-       while (sub != 0)
-               if (sub == super)
-                       return 1;
-               else
-                       sub = sub->super;
+         while (sub != 0)
+         if (sub == super)
+         return 1;
+         else
+         sub = sub->super;
 
-       return 0;
+         return 0;
        */
 
        return (unsigned) (sub->vftbl->baseval - super->vftbl->baseval) <=
-                  (unsigned) (super->vftbl->diffval);
+               (unsigned) (super->vftbl->diffval);
 }
 
 
@@ -174,9 +193,9 @@ s4 builtin_isanysubclass (classinfo *sub, classinfo *super)
 
 s4 builtin_instanceof(java_objectheader *obj, classinfo *class)
 {
-       #ifdef DEBUG
+#ifdef DEBUG
        log_text ("builtin_instanceof called");
-       #endif
+#endif
        
        if (!obj) return 0;
        return builtin_isanysubclass (obj->vftbl->class, class);
@@ -227,13 +246,13 @@ static s4 builtin_descriptorscompatible(constant_arraydescriptor *desc, constant
        if (desc==target) return 1;
        if (desc->arraytype != target->arraytype) return 0;
        switch (target->arraytype) {
-               case ARRAYTYPE_OBJECT: 
-                       return builtin_isanysubclass (desc->objectclass, target->objectclass);
-               case ARRAYTYPE_ARRAY:
-                       return builtin_descriptorscompatible 
-                         (desc->elementdescriptor, target->elementdescriptor);
-               default: return 1;
-               }
+       case ARRAYTYPE_OBJECT: 
+               return builtin_isanysubclass (desc->objectclass, target->objectclass);
+       case ARRAYTYPE_ARRAY:
+               return builtin_descriptorscompatible 
+                       (desc->elementdescriptor, target->elementdescriptor);
+       default: return 1;
+       }
 }
 
 
@@ -265,40 +284,40 @@ s4 builtin_checkarraycast(java_objectheader *o, constant_arraydescriptor *desc)
                printf ("#### checkarraycast failed 1\n");
 #endif
                return 0;
-               }
+       }
                
        if (a->arraytype != desc->arraytype) {
 #ifdef DEBUG
                printf ("#### checkarraycast failed 2\n");
 #endif
                return 0;
-               }
+       }
        
        switch (a->arraytype) {
-               case ARRAYTYPE_OBJECT: {
-                       java_objectarray *oa = (java_objectarray*) o;
-                       int result = builtin_isanysubclass (oa->elementtype, desc->objectclass);
+       case ARRAYTYPE_OBJECT: {
+               java_objectarray *oa = (java_objectarray*) o;
+               int result = builtin_isanysubclass (oa->elementtype, desc->objectclass);
 
 #ifdef DEBUG
-                       if (!result)
-                               printf ("#### checkarraycast failed 3\n");
+               if (!result)
+                       printf ("#### checkarraycast failed 3\n");
 #endif
-                       return result;
-                       }
-               case ARRAYTYPE_ARRAY: {
-                       java_arrayarray *aa = (java_arrayarray*) o;
-                       int result = builtin_descriptorscompatible
-                               (aa->elementdescriptor, desc->elementdescriptor);
+               return result;
+       }
+       case ARRAYTYPE_ARRAY: {
+               java_arrayarray *aa = (java_arrayarray*) o;
+               int result = builtin_descriptorscompatible
+                       (aa->elementdescriptor, desc->elementdescriptor);
 
 #ifdef DEBUG
-                       if (!result)
-                               printf ("#### checkarraycast failed 4\n");
+               if (!result)
+                       printf ("#### checkarraycast failed 4\n");
 #endif
-                       return result;
-                       }
-               default:   
-                       return 1;
-               }
+               return result;
+       }
+       default:   
+               return 1;
+       }
 }
 
 
@@ -318,7 +337,7 @@ java_objectheader *builtin_throw_exception (java_objectheader *local_exceptionpt
                sprintf(logtext, "Builtin exception thrown: ");
                utf_sprint(logtext + strlen(logtext), local_exceptionptr->vftbl->class->name);
                dolog();
-               }
+       }
        exceptionptr = local_exceptionptr;
        return local_exceptionptr;
 }
@@ -341,15 +360,15 @@ s4 builtin_canstore (java_objectarray *a, java_objectheader *o)
        case ARRAYTYPE_OBJECT:
                if ( ! builtin_checkcast (o, a->elementtype) ) {
                        return 0;
-                       }
+               }
                return 1;
                break;
 
        case ARRAYTYPE_ARRAY:
                if ( ! builtin_checkarraycast 
-                                (o, ((java_arrayarray*)a)->elementdescriptor) ) {
+                        (o, ((java_arrayarray*)a)->elementdescriptor) ) {
                        return 0;
-                       }
+               }
                return 1;
                break;
 
@@ -461,74 +480,74 @@ void* __builtin_newarray(s4 base_size,
 
 #if 0
        {
-       classinfo *c;
+               classinfo *c;
 
-       switch (arraytype) {
-       case ARRAYTYPE_INT:
-               c = create_array_class(utf_new_char("[I"));
-               XXX_use_class_as_object(c, "int");
-               break;
+               switch (arraytype) {
+               case ARRAYTYPE_INT:
+                       c = create_array_class(utf_new_char("[I"));
+                       XXX_use_class_as_object(c, "int");
+                       break;
 
-       case ARRAYTYPE_LONG:
-               c = create_array_class(utf_new_char("[J"));
-               XXX_use_class_as_object(c, "long");
-               break;
+               case ARRAYTYPE_LONG:
+                       c = create_array_class(utf_new_char("[J"));
+                       XXX_use_class_as_object(c, "long");
+                       break;
 
-       case ARRAYTYPE_FLOAT:
-               c = create_array_class(utf_new_char("[F"));
-               XXX_use_class_as_object(c, "float");
-               break;
+               case ARRAYTYPE_FLOAT:
+                       c = create_array_class(utf_new_char("[F"));
+                       XXX_use_class_as_object(c, "float");
+                       break;
 
-       case ARRAYTYPE_DOUBLE:
-               c = create_array_class(utf_new_char("[D"));
-               XXX_use_class_as_object(c, "double");
-               break;
+               case ARRAYTYPE_DOUBLE:
+                       c = create_array_class(utf_new_char("[D"));
+                       XXX_use_class_as_object(c, "double");
+                       break;
 
-       case ARRAYTYPE_BYTE:
-               c = create_array_class(utf_new_char("[B"));
-               XXX_use_class_as_object(c, "byte");
-               break;
+               case ARRAYTYPE_BYTE:
+                       c = create_array_class(utf_new_char("[B"));
+                       XXX_use_class_as_object(c, "byte");
+                       break;
 
-       case ARRAYTYPE_CHAR:
-               c = create_array_class(utf_new_char("[C"));
-               XXX_use_class_as_object(c, "char");
-               break;
+               case ARRAYTYPE_CHAR:
+                       c = create_array_class(utf_new_char("[C"));
+                       XXX_use_class_as_object(c, "char");
+                       break;
 
-       case ARRAYTYPE_SHORT:
-               c = create_array_class(utf_new_char("[S"));
-               XXX_use_class_as_object(c, "short");
-               break;
+               case ARRAYTYPE_SHORT:
+                       c = create_array_class(utf_new_char("[S"));
+                       XXX_use_class_as_object(c, "short");
+                       break;
 
-       case ARRAYTYPE_BOOLEAN:
-               c = create_array_class(utf_new_char("[Z"));
-               XXX_use_class_as_object(c, "boolean");
-               break;
+               case ARRAYTYPE_BOOLEAN:
+                       c = create_array_class(utf_new_char("[Z"));
+                       XXX_use_class_as_object(c, "boolean");
+                       break;
 
-       case ARRAYTYPE_OBJECT:
-               {
-               char *cname, *buf;
-               cname = heap_allocate(utf_strlen(el->name), false, NULL);
-               utf_sprint(cname, el->name);
-               buf = heap_allocate(strlen(cname) + 3, false, NULL);
-/*  printf("\n\n[L%s;\n\n", cname); */
-               sprintf(buf, "[L%s;", cname);
-               c = create_array_class(utf_new_char(buf));
-/*             MFREE(buf, char, strlen(cname) + 3); */
-/*             MFREE(cname, char, utf_strlen(el->name)); */
-               XXX_use_class_as_object(c, cname);
-               }
-               break;
+               case ARRAYTYPE_OBJECT:
+                       {
+                               char *cname, *buf;
+                               cname = heap_allocate(utf_strlen(el->name), false, NULL);
+                               utf_sprint(cname, el->name);
+                               buf = heap_allocate(strlen(cname) + 3, false, NULL);
+                               /*  printf("\n\n[L%s;\n\n", cname); */
+                               sprintf(buf, "[L%s;", cname);
+                               c = create_array_class(utf_new_char(buf));
+                               /*              MFREE(buf, char, strlen(cname) + 3); */
+                               /*              MFREE(cname, char, utf_strlen(el->name)); */
+                               XXX_use_class_as_object(c, cname);
+                       }
+                       break;
 
-       case ARRAYTYPE_ARRAY:
-               c = create_array_class(utf_new_char("[["));
-               XXX_use_class_as_object(c, "java/lang/Boolean");
-               break;
+               case ARRAYTYPE_ARRAY:
+                       c = create_array_class(utf_new_char("[["));
+                       XXX_use_class_as_object(c, "java/lang/Boolean");
+                       break;
 
-       default:
-               panic("unknown array type");
-       }
+               default:
+                       panic("unknown array type");
+               }
 
-       a->objheader.vftbl = c->vftbl;
+               a->objheader.vftbl = c->vftbl;
        }
 #else
        a->objheader.vftbl = class_array->vftbl;
@@ -573,7 +592,7 @@ java_objectarray *builtin_anewarray (s4 size, classinfo *elementtype)
 *****************************************************************************/
 
 java_arrayarray *builtin_newarray_array 
-               (s4 size, constant_arraydescriptor *elementdesc)
+(s4 size, constant_arraydescriptor *elementdesc)
 {
        java_arrayarray *a; 
        a = (java_arrayarray*)__builtin_newarray(sizeof(java_arrayarray),
@@ -773,7 +792,7 @@ java_longarray *builtin_newarray_long (s4 size)
        /* Helper functions */
 
 static java_arrayheader *multianewarray_part (java_intarray *dims, int thisdim,
-                                          constant_arraydescriptor *desc)
+                                                                                         constant_arraydescriptor *desc)
 {
        u4 size,i;
        java_arrayarray *a;
@@ -808,7 +827,7 @@ static java_arrayheader *multianewarray_part (java_intarray *dims, int thisdim,
                
                default: panic ("Invalid arraytype in multianewarray");
                }
-               }
+       }
 
        /* if the last dimension has not been reached yet */
 
@@ -820,25 +839,25 @@ static java_arrayheader *multianewarray_part (java_intarray *dims, int thisdim,
        
        for (i=0; i<size; i++) {
                java_arrayheader *ea = 
-                 multianewarray_part (dims, thisdim+1, desc->elementdescriptor);
+                       multianewarray_part (dims, thisdim+1, desc->elementdescriptor);
                if (!ea) return NULL;
 
                a -> data[i] = ea;
-               }
+       }
                
        return (java_arrayheader*) a;
 }
 
 
 java_arrayheader *builtin_multianewarray (java_intarray *dims,
-                                         constant_arraydescriptor *desc)
+                                                                                 constant_arraydescriptor *desc)
 {
        return multianewarray_part (dims, 0, desc);
 }
 
 
 static java_arrayheader *nmultianewarray_part (int n, long *dims, int thisdim,
-                                          constant_arraydescriptor *desc)
+                                                                                          constant_arraydescriptor *desc)
 {
        int size, i;
        java_arrayarray *a;
@@ -867,14 +886,14 @@ static java_arrayheader *nmultianewarray_part (int n, long *dims, int thisdim,
                        return (java_arrayheader*) builtin_newarray_long(size); 
                case ARRAYTYPE_OBJECT:
                        return (java_arrayheader*) builtin_anewarray(size,
-                                                                          desc->objectclass);
+                                                                                                                desc->objectclass);
                case ARRAYTYPE_ARRAY:
                        return (java_arrayheader*) builtin_newarray_array(size,
-                                                                          desc->elementdescriptor);
+                                                                                                                         desc->elementdescriptor);
                
                default: panic ("Invalid arraytype in multianewarray");
                }
-               }
+       }
 
        /* if the last dimension has not been reached yet */
 
@@ -890,14 +909,14 @@ static java_arrayheader *nmultianewarray_part (int n, long *dims, int thisdim,
                if (!ea) return NULL;
 
                a -> data[i] = ea;
-               }
+       }
                
        return (java_arrayheader*) a;
 }
 
 
 java_arrayheader *builtin_nmultianewarray (int size,
-                                         constant_arraydescriptor *desc, long *dims)
+                                                                                  constant_arraydescriptor *desc, long *dims)
 {
        (void) builtin_newarray_int(size); /* for compatibility with -old */
        return nmultianewarray_part (size, dims, 0, desc);
@@ -922,7 +941,7 @@ s4 builtin_aastore (java_objectarray *a, s4 index, java_objectheader *o)
        if (builtin_canstore(a,o)) {
                a->data[index] = o;
                return 1;
-               }
+       }
        return 0;
 }
 
@@ -943,7 +962,7 @@ s4 builtin_aastore (java_objectarray *a, s4 index, java_objectheader *o)
 u4 methodindent=0;
 
 java_objectheader *builtin_trace_exception (java_objectheader *exceptionptr,
-                                  methodinfo *method, int *pos, int noindent) {
+                                                                                       methodinfo *method, int *pos, int noindent) {
 
        if (!noindent)
                methodindent--;
@@ -960,11 +979,11 @@ java_objectheader *builtin_trace_exception (java_objectheader *exceptionptr,
                        else
                                printf("(NOSYNC)");
                        printf("(%p) at position %p\n", method->entrypoint, pos);
-                       }
+               }
                else
                        printf("call_java_method\n");
                fflush (stdout);
-               }
+       }
        return exceptionptr;
 }
 
@@ -986,109 +1005,109 @@ void builtin_trace_args(s8 a0, s8 a1, s8 a2, s8 a3, s8 a4, s8 a5,
        utf_sprint (logtext+strlen(logtext), method->descriptor);
        sprintf (logtext+strlen(logtext), "(");
        switch (method->paramcount) {
-        case 0:
-            break;
+       case 0:
+               break;
 
 #if defined(__I386__)
-               case 1:
-                       sprintf(logtext+strlen(logtext), "%llx", a0);
-                       break;
+       case 1:
+               sprintf(logtext+strlen(logtext), "%llx", a0);
+               break;
 
-               case 2:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx", a0, a1);
-                       break;
+       case 2:
+               sprintf(logtext+strlen(logtext), "%llx, %llx", a0, a1);
+               break;
 
-               case 3:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx", a0, a1, a2);
-                       break;
+       case 3:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx", a0, a1, a2);
+               break;
 
-               case 4:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3);
-                       break;
+       case 4:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3);
+               break;
 
-               case 5:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3,   a4);
-                       break;
+       case 5:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3,   a4);
+               break;
 
-               case 6:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5);
-                       break;
+       case 6:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3,   a4,   a5);
+               break;
 
 #if TRACE_ARGS_NUM > 6
-               case 7:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5,   a6);
-                       break;
+       case 7:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3,   a4,   a5,   a6);
+               break;
 
-               case 8:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5,   a6,   a7);
-                       break;
+       case 8:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3,   a4,   a5,   a6,   a7);
+               break;
 
-               default:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx, %llx, ...(%d)",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5,   a6,   a7,   method->paramcount - 8);
-                       break;
+       default:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx, %llx, ...(%d)",
+                               a0,   a1,   a2,   a3,   a4,   a5,   a6,   a7,   method->paramcount - 8);
+               break;
 #else
-               default:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, ...(%d)",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5,   method->paramcount - 6);
-                       break;
+       default:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, ...(%d)",
+                               a0,   a1,   a2,   a3,   a4,   a5,   method->paramcount - 6);
+               break;
 #endif
 #else
-               case 1:
-                       sprintf(logtext+strlen(logtext), "%lx", a0);
-                       break;
+       case 1:
+               sprintf(logtext+strlen(logtext), "%lx", a0);
+               break;
 
-               case 2:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx", a0, a1);
-                       break;
+       case 2:
+               sprintf(logtext+strlen(logtext), "%lx, %lx", a0, a1);
+               break;
 
-               case 3:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx", a0, a1, a2);
-                       break;
+       case 3:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx", a0, a1, a2);
+               break;
 
-               case 4:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3);
-                       break;
+       case 4:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3);
+               break;
 
-               case 5:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3,  a4);
-                       break;
+       case 5:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3,  a4);
+               break;
 
-               case 6:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5);
-                       break;
+       case 6:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3,  a4,  a5);
+               break;
 
 #if TRACE_ARGS_NUM > 6
-               case 7:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5,  a6);
-                       break;
+       case 7:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3,  a4,  a5,  a6);
+               break;
 
-               case 8:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5,  a6,  a7);
-                       break;
+       case 8:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3,  a4,  a5,  a6,  a7);
+               break;
 
-               default:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx, ...(%d)",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5,  a6,  a7,  method->paramcount - 8);
-                       break;
+       default:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx, ...(%d)",
+                               a0,  a1,  a2,  a3,  a4,  a5,  a6,  a7,  method->paramcount - 8);
+               break;
 #else
-               default:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, ...(%d)",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5,   method->paramcount - 6);
-                       break;
+       default:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, ...(%d)",
+                               a0,  a1,  a2,  a3,  a4,  a5,   method->paramcount - 6);
+               break;
 #endif
 #endif
-               }
+       }
        sprintf (logtext+strlen(logtext), ")");
 
        dolog ();
@@ -1120,30 +1139,30 @@ void builtin_displaymethodstop(methodinfo *method, s8 l, double d, float f)
        utf_sprint (logtext+strlen(logtext), method->name);
        utf_sprint (logtext+strlen(logtext), method->descriptor);
        switch (method->returntype) {
-               case TYPE_INT:
-                       sprintf (logtext+strlen(logtext), "->%d", (s4) l);
-                       break;
-               case TYPE_LONG:
+       case TYPE_INT:
+               sprintf (logtext+strlen(logtext), "->%d", (s4) l);
+               break;
+       case TYPE_LONG:
 #if defined(__I386__)
-                       sprintf(logtext+strlen(logtext), "->%lld", (s8) l);
+               sprintf(logtext+strlen(logtext), "->%lld", (s8) l);
 #else
-                       sprintf(logtext+strlen(logtext), "->%ld", (s8) l);
+               sprintf(logtext+strlen(logtext), "->%ld", (s8) l);
 #endif
-                       break;
-               case TYPE_ADDRESS:
+               break;
+       case TYPE_ADDRESS:
 #if defined(__I386__)
-                       sprintf(logtext+strlen(logtext), "->%p", (u1*) ((s4) l));
+               sprintf(logtext+strlen(logtext), "->%p", (u1*) ((s4) l));
 #else
-                       sprintf(logtext+strlen(logtext), "->%p", (u1*) l);
+               sprintf(logtext+strlen(logtext), "->%p", (u1*) l);
 #endif
-                       break;
-               case TYPE_FLOAT:
-                       sprintf (logtext+strlen(logtext), "->%g", f);
-                       break;
-               case TYPE_DOUBLE:
-                       sprintf (logtext+strlen(logtext), "->%g", d);
-                       break;
-               }
+               break;
+       case TYPE_FLOAT:
+               sprintf (logtext+strlen(logtext), "->%g", f);
+               break;
+       case TYPE_DOUBLE:
+               sprintf (logtext+strlen(logtext), "->%g", d);
+               break;
+       }
        dolog ();
 }
 
@@ -1181,37 +1200,37 @@ internal_lock_mutex_for_object (java_objectheader *object)
        entry = &mutexHashTable[hashValue];
 
        if (entry->object != 0)
-       {
-               if (entry->mutex.count == 0 && entry->conditionCount == 0)
                {
-                       entry->object = 0;
-                       entry->mutex.holder = 0;
-                       entry->mutex.count = 0;
-                       entry->mutex.muxWaiters = 0;
+                       if (entry->mutex.count == 0 && entry->conditionCount == 0)
+                               {
+                                       entry->object = 0;
+                                       entry->mutex.holder = 0;
+                                       entry->mutex.count = 0;
+                                       entry->mutex.muxWaiters = 0;
+                               }
+                       else
+                               {
+                                       while (entry->next != 0 && entry->object != object)
+                                               entry = entry->next;
+
+                                       if (entry->object != object)
+                                               {
+                                                       entry->next = firstFreeOverflowEntry;
+                                                       firstFreeOverflowEntry = firstFreeOverflowEntry->next;
+
+                                                       entry = entry->next;
+                                                       entry->object = 0;
+                                                       entry->next = 0;
+                                                       assert(entry->conditionCount == 0);
+                                               }
+                               }
                }
        else
-       {
-               while (entry->next != 0 && entry->object != object)
-               entry = entry->next;
-
-               if (entry->object != object)
                {
-                       entry->next = firstFreeOverflowEntry;
-                       firstFreeOverflowEntry = firstFreeOverflowEntry->next;
-
-                       entry = entry->next;
-                       entry->object = 0;
-                       entry->next = 0;
-                       assert(entry->conditionCount == 0);
+                       entry->mutex.holder = 0;
+                       entry->mutex.count = 0;
+                       entry->mutex.muxWaiters = 0;
                }
-       }
-       }
-       else
-       {
-               entry->mutex.holder = 0;
-               entry->mutex.count = 0;
-               entry->mutex.muxWaiters = 0;
-       }
 
        if (entry->object == 0)
                entry->object = object;
@@ -1237,23 +1256,23 @@ internal_unlock_mutex_for_object (java_objectheader *object)
        if (entry->object == object)
                internal_unlock_mutex(&entry->mutex);
        else
-       {
-               while (entry->next != 0 && entry->next->object != object)
-                       entry = entry->next;
+               {
+                       while (entry->next != 0 && entry->next->object != object)
+                               entry = entry->next;
 
-               assert(entry->next != 0);
+                       assert(entry->next != 0);
 
-               internal_unlock_mutex(&entry->next->mutex);
+                       internal_unlock_mutex(&entry->next->mutex);
 
-               if (entry->next->mutex.count == 0 && entry->conditionCount == 0)
-               {
-                       mutexHashEntry *unlinked = entry->next;
+                       if (entry->next->mutex.count == 0 && entry->conditionCount == 0)
+                               {
+                                       mutexHashEntry *unlinked = entry->next;
 
-                       entry->next = unlinked->next;
-                       unlinked->next = firstFreeOverflowEntry;
-                       firstFreeOverflowEntry = unlinked;
+                                       entry->next = unlinked->next;
+                                       unlinked->next = firstFreeOverflowEntry;
+                                       firstFreeOverflowEntry = unlinked;
+                               }
                }
-       }
 }
 #endif
 
@@ -1291,13 +1310,13 @@ void builtin_monitorexit (java_objectheader *o)
 
        hashValue = MUTEX_HASH_VALUE(o);
        if (mutexHashTable[hashValue].object == o)
-       {
-               if (mutexHashTable[hashValue].mutex.count == 1
-                       && mutexHashTable[hashValue].mutex.muxWaiters != 0)
-                       internal_unlock_mutex_for_object(o);
-               else
-                       --mutexHashTable[hashValue].mutex.count;
-       }
+               {
+                       if (mutexHashTable[hashValue].mutex.count == 1
+                               && mutexHashTable[hashValue].mutex.muxWaiters != 0)
+                               internal_unlock_mutex_for_object(o);
+                       else
+                               --mutexHashTable[hashValue].mutex.count;
+               }
        else
                internal_unlock_mutex_for_object(o);
 
@@ -1465,14 +1484,14 @@ float builtin_fadd (float a, float b)
        if (finitef(a)) {
                if (finitef(b)) return a+b;
                else return b;
-               }
+       }
        else {
                if (finitef(b)) return a;
                else {
                        if (copysignf(1.0, a)==copysignf(1.0, b)) return a;
                        else  return FLT_NAN;
-                       }
                }
+       }
 }
 
 float builtin_fsub (float a, float b)
@@ -1488,18 +1507,18 @@ float builtin_fmul (float a, float b)
                if (finitef(b)) return a*b;
                else {
                        if (a==0) return FLT_NAN;
-                                else return copysignf(b, copysignf(1.0, b)*a);
-                       }
+                       else return copysignf(b, copysignf(1.0, b)*a);
                }
+       }
        else {
                if (finitef(b)) {
                        if (b==0) return FLT_NAN;
-                                else return copysignf(a, copysignf(1.0, a)*b);
-                       }
+                       else return copysignf(a, copysignf(1.0, a)*b);
+               }
                else {
                        return copysignf(a, copysignf(1.0, a)*copysignf(1.0, b));
-                       }
                }
+       }
 }
 
 float builtin_fdiv (float a, float b)
@@ -1512,8 +1531,8 @@ float builtin_fdiv (float a, float b)
                                return FLT_POSINF;
                        else if (a < 0)
                                return FLT_NEGINF;
-                       }
                }
+       }
        return FLT_NAN;
 }
 
@@ -1528,8 +1547,8 @@ float builtin_fneg (float a)
        if (isnanf(a)) return a;
        else {
                if (finitef(a)) return -a;
-                                  else return copysignf(a,-copysignf(1.0, a));
-               }
+               else return copysignf(a,-copysignf(1.0, a));
+       }
 }
 
 s4 builtin_fcmpl (float a, float b)
@@ -1539,7 +1558,7 @@ s4 builtin_fcmpl (float a, float b)
        if (!finitef(a) || !finitef(b)) {
                a = finitef(a) ? 0 : copysignf(1.0,      a);
                b = finitef(b) ? 0 : copysignf(1.0, b);
-               }
+       }
        if (a>b) return 1;
        if (a==b) return 0;
        return -1;
@@ -1552,7 +1571,7 @@ s4 builtin_fcmpg (float a, float b)
        if (!finitef(a) || !finitef(b)) {
                a = finitef(a) ? 0 : copysignf(1.0, a);
                b = finitef(b) ? 0 : copysignf(1.0, b);
-               }
+       }
        if (a>b) return 1;
        if (a==b) return 0;
        return -1;
@@ -1569,14 +1588,14 @@ double builtin_dadd (double a, double b)
        if (finite(a)) {
                if (finite(b)) return a+b;
                else return b;
-               }
+       }
        else {
                if (finite(b)) return a;
                else {
                        if (copysign(1.0, a)==copysign(1.0, b)) return a;
                        else  return DBL_NAN;
-                       }
                }
+       }
 }
 
 double builtin_dsub (double a, double b)
@@ -1592,18 +1611,18 @@ double builtin_dmul (double a, double b)
                if (finite(b)) return a*b;
                else {
                        if (a==0) return DBL_NAN;
-                                else return copysign(b, copysign(1.0, b)*a);
-                       }
+                       else return copysign(b, copysign(1.0, b)*a);
                }
+       }
        else {
                if (finite(b)) {
                        if (b==0) return DBL_NAN;
-                                else return copysign(a, copysign(1.0, a)*b);
-                       }
+                       else return copysign(a, copysign(1.0, a)*b);
+               }
                else {
                        return copysign(a, copysign(1.0, a)*copysign(1.0, b));
-                       }
                }
+       }
 }
 
 double builtin_ddiv (double a, double b)
@@ -1616,8 +1635,8 @@ double builtin_ddiv (double a, double b)
                                return DBL_POSINF;
                        else if (a < 0)
                                return DBL_NEGINF;
-                       }
                }
+       }
        return DBL_NAN;
 }
 
@@ -1631,8 +1650,8 @@ double builtin_dneg (double a)
        if (isnan(a)) return a;
        else {
                if (finite(a)) return -a;
-                                 else return copysign(a,-copysign(1.0, a));
-               }
+               else return copysign(a,-copysign(1.0, a));
+       }
 }
 
 s4 builtin_dcmpl (double a, double b)
@@ -1642,7 +1661,7 @@ s4 builtin_dcmpl (double a, double b)
        if (!finite(a) || !finite(b)) {
                a = finite(a) ? 0 : copysign(1.0, a);
                b = finite(b) ? 0 : copysign(1.0, b);
-               }
+       }
        if (a>b) return 1;
        if (a==b) return 0;
        return -1;
@@ -1655,7 +1674,7 @@ s4 builtin_dcmpg (double a, double b)
        if (!finite(a) || !finite(b)) {
                a = finite(a) ? 0 : copysign(1.0, a);
                b = finite(b) ? 0 : copysign(1.0, b);
-               }
+       }
        if (a>b) return 1;
        if (a==b) return 0;
        return -1;
@@ -1675,14 +1694,14 @@ s8 builtin_i2l (s4 i)
 
 float builtin_i2f (s4 a)
 {
-float f = (float) a;
-return f;
+       float f = (float) a;
+       return f;
 }
 
 double builtin_i2d (s4 a)
 {
-double d = (double) a;
-return d;
+       double d = (double) a;
+       return d;
 }
 
 
@@ -1719,46 +1738,46 @@ double builtin_l2d (s8 a)
 s4 builtin_f2i(float a) 
 {
 
-return builtin_d2i((double) a);
+       return builtin_d2i((double) a);
 
-/*     float f;
+       /*      float f;
        
-       if (isnanf(a))
+               if (isnanf(a))
                return 0;
-       if (finitef(a)) {
+               if (finitef(a)) {
                if (a > 2147483647)
-                       return 2147483647;
+               return 2147483647;
                if (a < (-2147483648))
-                       return (-2147483648);
+               return (-2147483648);
                return (s4) a;
                }
-       f = copysignf((float) 1.0, a);
-       if (f > 0)
+               f = copysignf((float) 1.0, a);
+               if (f > 0)
                return 2147483647;
-       return (-2147483648); */
+               return (-2147483648); */
 }
 
 
 s8 builtin_f2l (float a)
 {
 
-return builtin_d2l((double) a);
+       return builtin_d2l((double) a);
 
-/*     float f;
+       /*      float f;
        
-       if (finitef(a)) {
+               if (finitef(a)) {
                if (a > 9223372036854775807L)
-                       return 9223372036854775807L;
+               return 9223372036854775807L;
                if (a < (-9223372036854775808L))
-                       return (-9223372036854775808L);
+               return (-9223372036854775808L);
                return (s8) a;
                }
-       if (isnanf(a))
+               if (isnanf(a))
                return 0;
-       f = copysignf((float) 1.0, a);
-       if (f > 0)
+               f = copysignf((float) 1.0, a);
+               if (f > 0)
                return 9223372036854775807L;
-       return (-9223372036854775808L); */
+               return (-9223372036854775808L); */
 }
 
 
@@ -1768,7 +1787,7 @@ double builtin_f2d (float a)
        else {
                if (isnanf(a)) return DBL_NAN;
                else               return copysign(DBL_POSINF, (double) copysignf(1.0, a) );
-               }
+       }
 }
 
 
@@ -1782,7 +1801,7 @@ s4 builtin_d2i (double a)
                if (a <= (-2147483647-1))
                        return (-2147483647-1);
                return (s4) a;
-               }
+       }
        if (isnan(a))
                return 0;
        d = copysign(1.0, a);
@@ -1802,7 +1821,7 @@ s8 builtin_d2l (double a)
                if (a <= (-9223372036854775807LL-1))
                        return (-9223372036854775807LL-1);
                return (s8) a;
-               }
+       }
        if (isnan(a))
                return 0;
        d = copysign(1.0, a);
@@ -1818,7 +1837,7 @@ float builtin_d2f (double a)
        else {
                if (isnan(a)) return FLT_NAN;
                else              return copysignf (FLT_POSINF, (float) copysign(1.0, a));
-               }
+       }
 }
 
 
index cfd81f69da791259641658de9b5a29a6d1ad6ca2..0afdbf45137a27d7474916e94de1d0d5838cf21c 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -142,3 +142,16 @@ s8       asm_builtin_d2l (double a);
 
 float    builtin_d2f (double a);
 
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/callargs.h b/callargs.h
deleted file mode 100644 (file)
index 5144375..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#define TRACECALLARGS
index a88ef41558a6d090c98a389b19fae06a50eaca19..563817e72a7f7ba7163a9fa388dccf42be44d9a0 100644 (file)
@@ -1,4 +1,32 @@
-/* config.h.in.  Generated from configure.in by autoheader.  */
+/* config.h.in.  Generated automatically from configure.in by autoheader 2.13.  */
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define if you have a working `mmap' system call.  */
+#undef HAVE_MMAP
+
+/* Define as __inline if that's what the C compiler calls it.  */
+#undef inline
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define as the return type of signal handlers (int or void).  */
+#undef RETSIGTYPE
+
+/* Define to `unsigned' if <sys/types.h> doesn't define.  */
+#undef size_t
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <sys/time.h> and <time.h>.  */
+#undef TIME_WITH_SYS_TIME
+
+/* Define if your <sys/time.h> declares struct tm.  */
+#undef TM_IN_SYS_TIME
+
 /* Define if mman.h defines MAP_FAILED  */
 #undef HAVE_MAP_FAILED
 
 #undef EXTERNAL_OVERFLOW
 #undef DONT_FREE_FIRST
 
-/* Make automake happy */
-#undef PACKAGE
-#undef VERSION
-
-/* sysdep */
-#undef SYSDEP_DIR
+/* Architecture directory */
+#undef ARCH_DIR
 
-#undef OLD_COMPILER
 #undef USE_CODEMMAP
 
-#undef USE_BOEHM
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_DIRENT_H
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define to 1 if you have the `getcwd' function. */
+/* Define if you have the getcwd function.  */
 #undef HAVE_GETCWD
 
-/* Define to 1 if you have the `getpagesize' function. */
+/* Define if you have the getpagesize function.  */
 #undef HAVE_GETPAGESIZE
 
-/* Define to 1 if you have the `gettimeofday' function. */
+/* Define if you have the gettimeofday function.  */
 #undef HAVE_GETTIMEOFDAY
 
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `m' library (-lm). */
-#undef HAVE_LIBM
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `mkdir' function. */
+/* Define if you have the mkdir function.  */
 #undef HAVE_MKDIR
 
-/* Define to 1 if you have the `mktime' function. */
+/* Define if you have the mktime function.  */
 #undef HAVE_MKTIME
 
-/* Define to 1 if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-#undef HAVE_NDIR_H
-
-/* Define to 1 if you have the `select' function. */
+/* Define if you have the select function.  */
 #undef HAVE_SELECT
 
-/* Define to 1 if you have the `socket' function. */
+/* Define if you have the socket function.  */
 #undef HAVE_SOCKET
 
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
+/* Define if you have the <dirent.h> header file.  */
+#undef HAVE_DIRENT_H
 
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
+/* Define if you have the <fcntl.h> header file.  */
+#undef HAVE_FCNTL_H
 
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
+/* Define if you have the <ndir.h> header file.  */
+#undef HAVE_NDIR_H
 
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
-   */
+/* Define if you have the <sys/dir.h> header file.  */
 #undef HAVE_SYS_DIR_H
 
-/* Define to 1 if you have the <sys/ioctl.h> header file. */
+/* Define if you have the <sys/ioctl.h> header file.  */
 #undef HAVE_SYS_IOCTL_H
 
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
-   */
+/* Define if you have the <sys/ndir.h> header file.  */
 #undef HAVE_SYS_NDIR_H
 
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/time.h> header file. */
+/* Define if you have the <sys/time.h> header file.  */
 #undef HAVE_SYS_TIME_H
 
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
+/* Define if you have the <unistd.h> header file.  */
 #undef HAVE_UNISTD_H
 
+/* Define if you have the m library (-lm).  */
+#undef HAVE_LIBM
+
 /* Name of package */
 #undef PACKAGE
 
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define as the return type of signal handlers (`int' or `void'). */
-#undef RETSIGTYPE
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#undef TM_IN_SYS_TIME
-
 /* Version number of package */
 #undef VERSION
 
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
-
-/* Define as `__inline' if that's what the C compiler calls it, or to nothing
-   if it is not supported. */
-#undef inline
-
-/* Define to `long' if <sys/types.h> does not define. */
-#undef off_t
-
-/* Define to `unsigned' if <sys/types.h> does not define. */
-#undef size_t
index 78c320a626917f65270a8f872fd86cd6d8011be7..6b859f4ca933c9c37f14753ca901d3ef8b02af8d 100755 (executable)
--- a/configure
+++ b/configure
 #! /bin/sh
+
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.57.
+# Generated automatically using autoconf version 2.13 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
-fi
-
-# Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    $as_unset $as_var
-  fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)$' \| \
-        .     : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-         /^X\/\(\/\/\)$/{ s//\1/; q; }
-         /^X\/\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  case $0 in
-    *[\\/]* ) as_myself=$0 ;;
-    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
-       ;;
-  esac
-  # We did not find ourselves, most probably we were run as `sh COMMAND'
-  # in which case we are not to be found in the path.
-  if test "x$as_myself" = x; then
-    as_myself=$0
-  fi
-  if test ! -f "$as_myself"; then
-    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
-   { (exit 1); exit 1; }; }
-  fi
-  case $CONFIG_SHELL in
-  '')
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-        case $as_dir in
-        /*)
-          if ("$as_dir/$as_base" -c '
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-          fi;;
-        esac
-       done
-done
-;;
-  esac
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
-    sed '
-      N
-      s,$,-,
-      : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
-      t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
-    ' >$as_me.lineno &&
-  chmod +x $as_me.lineno ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensible to this).
-  . ./$as_me.lineno
-  # Exit status is that of the last command.
-  exit
-}
 
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='     ' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conf$$.exe; then
-    # Don't use ln at all; we don't have any links
-    as_ln_s='cp -p'
-  else
-    as_ln_s='ln -s'
-  fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS="  $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-exec 6>&1
-
-#
-# Initializations.
-#
+# Defaults:
+ac_help=
 ac_default_prefix=/usr/local
-ac_config_libobj_dir=.
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete.  It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
-# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-
-ac_unique_file="jit.c"
+# Any additions from configure.in:
 ac_default_prefix=/usr/local/cacao
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE COMPILER_OBJECTS ASMPART SYSDEP_DIR CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB CPP EGREP LIBOBJS LIBTHREAD THREAD_OBJ GC_OBJ BOEHM_LIB LTLIBOBJS'
-ac_subst_files=''
+ac_help="$ac_help
+  --enable-threads        enable threads support"
 
 # Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
 # The variables have the same names as the options, with
 # dashes changed to underlines.
-cache_file=/dev/null
+build=NONE
+cache_file=./config.cache
 exec_prefix=NONE
+host=NONE
 no_create=
+nonopt=NONE
 no_recursion=
 prefix=NONE
 program_prefix=NONE
@@ -328,15 +32,10 @@ program_transform_name=s,x,x,
 silent=
 site=
 srcdir=
+target=NONE
 verbose=
 x_includes=NONE
 x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
@@ -350,9 +49,17 @@ oldincludedir='/usr/include'
 infodir='${prefix}/info'
 mandir='${prefix}/man'
 
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
 ac_prev=
 for ac_option
 do
+
   # If the previous option needs an argument, assign it.
   if test -n "$ac_prev"; then
     eval "$ac_prev=\$ac_option"
@@ -360,59 +67,59 @@ do
     continue
   fi
 
-  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  case $ac_option in
+  case "$ac_option" in
 
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir=$ac_optarg ;;
+    bindir="$ac_optarg" ;;
 
   -build | --build | --buil | --bui | --bu)
-    ac_prev=build_alias ;;
+    ac_prev=build ;;
   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build_alias=$ac_optarg ;;
+    build="$ac_optarg" ;;
 
   -cache-file | --cache-file | --cache-fil | --cache-fi \
   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
     ac_prev=cache_file ;;
   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file=$ac_optarg ;;
-
-  --config-cache | -C)
-    cache_file=config.cache ;;
+    cache_file="$ac_optarg" ;;
 
   -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
     ac_prev=datadir ;;
   -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
   | --da=*)
-    datadir=$ac_optarg ;;
+    datadir="$ac_optarg" ;;
 
   -disable-* | --disable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval "enable_$ac_feature=no" ;;
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
 
   -enable-* | --enable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    case $ac_option in
-      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
       *) ac_optarg=yes ;;
     esac
-    eval "enable_$ac_feature='$ac_optarg'" ;;
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -421,47 +128,95 @@ do
   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
   | --exec=* | --exe=* | --ex=*)
-    exec_prefix=$ac_optarg ;;
+    exec_prefix="$ac_optarg" ;;
 
   -gas | --gas | --ga | --g)
     # Obsolete; use --with-gas.
     with_gas=yes ;;
 
-  -help | --help | --hel | --he | -h)
-    ac_init_help=long ;;
-  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-    ac_init_help=recursive ;;
-  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-    ac_init_help=short ;;
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
 
   -host | --host | --hos | --ho)
-    ac_prev=host_alias ;;
+    ac_prev=host ;;
   -host=* | --host=* | --hos=* | --ho=*)
-    host_alias=$ac_optarg ;;
+    host="$ac_optarg" ;;
 
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
   | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir=$ac_optarg ;;
+    includedir="$ac_optarg" ;;
 
   -infodir | --infodir | --infodi | --infod | --info | --inf)
     ac_prev=infodir ;;
   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir=$ac_optarg ;;
+    infodir="$ac_optarg" ;;
 
   -libdir | --libdir | --libdi | --libd)
     ac_prev=libdir ;;
   -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir=$ac_optarg ;;
+    libdir="$ac_optarg" ;;
 
   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
   | --libexe | --libex | --libe)
     ac_prev=libexecdir ;;
   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
   | --libexe=* | --libex=* | --libe=*)
-    libexecdir=$ac_optarg ;;
+    libexecdir="$ac_optarg" ;;
 
   -localstatedir | --localstatedir | --localstatedi | --localstated \
   | --localstate | --localstat | --localsta | --localst \
@@ -470,19 +225,19 @@ do
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
   | --localstate=* | --localstat=* | --localsta=* | --localst=* \
   | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
-    localstatedir=$ac_optarg ;;
+    localstatedir="$ac_optarg" ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
     ac_prev=mandir ;;
   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir=$ac_optarg ;;
+    mandir="$ac_optarg" ;;
 
   -nfp | --nfp | --nf)
     # Obsolete; use --without-fp.
     with_fp=no ;;
 
   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c | -n)
+  | --no-cr | --no-c)
     no_create=yes ;;
 
   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -496,26 +251,26 @@ do
   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir=$ac_optarg ;;
+    oldincludedir="$ac_optarg" ;;
 
   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
     ac_prev=prefix ;;
   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix=$ac_optarg ;;
+    prefix="$ac_optarg" ;;
 
   -program-prefix | --program-prefix | --program-prefi | --program-pref \
   | --program-pre | --program-pr | --program-p)
     ac_prev=program_prefix ;;
   -program-prefix=* | --program-prefix=* | --program-prefi=* \
   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix=$ac_optarg ;;
+    program_prefix="$ac_optarg" ;;
 
   -program-suffix | --program-suffix | --program-suffi | --program-suff \
   | --program-suf | --program-su | --program-s)
     ac_prev=program_suffix ;;
   -program-suffix=* | --program-suffix=* | --program-suffi=* \
   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix=$ac_optarg ;;
+    program_suffix="$ac_optarg" ;;
 
   -program-transform-name | --program-transform-name \
   | --program-transform-nam | --program-transform-na \
@@ -532,7 +287,7 @@ do
   | --program-transfo=* | --program-transf=* \
   | --program-trans=* | --program-tran=* \
   | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name=$ac_optarg ;;
+    program_transform_name="$ac_optarg" ;;
 
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil)
@@ -542,7 +297,7 @@ do
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
   | --sbi=* | --sb=*)
-    sbindir=$ac_optarg ;;
+    sbindir="$ac_optarg" ;;
 
   -sharedstatedir | --sharedstatedir | --sharedstatedi \
   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -553,57 +308,58 @@ do
   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
   | --sha=* | --sh=*)
-    sharedstatedir=$ac_optarg ;;
+    sharedstatedir="$ac_optarg" ;;
 
   -site | --site | --sit)
     ac_prev=site ;;
   -site=* | --site=* | --sit=*)
-    site=$ac_optarg ;;
+    site="$ac_optarg" ;;
 
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir=$ac_optarg ;;
+    srcdir="$ac_optarg" ;;
 
   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
   | --syscon | --sysco | --sysc | --sys | --sy)
     ac_prev=sysconfdir ;;
   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir=$ac_optarg ;;
+    sysconfdir="$ac_optarg" ;;
 
   -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target_alias ;;
+    ac_prev=target ;;
   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target_alias=$ac_optarg ;;
+    target="$ac_optarg" ;;
 
   -v | -verbose | --verbose | --verbos | --verbo | --verb)
     verbose=yes ;;
 
-  -version | --version | --versio | --versi | --vers | -V)
-    ac_init_version=: ;;
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.13"
+    exit 0 ;;
 
   -with-* | --with-*)
-    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
     ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case $ac_option in
-      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+    case "$ac_option" in
+      *=*) ;;
       *) ac_optarg=yes ;;
     esac
-    eval "with_$ac_package='$ac_optarg'" ;;
+    eval "with_${ac_package}='$ac_optarg'" ;;
 
   -without-* | --without-*)
-    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/-/_/g'`
-    eval "with_$ac_package=no" ;;
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -614,110 +370,99 @@ do
     ac_prev=x_includes ;;
   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes=$ac_optarg ;;
+    x_includes="$ac_optarg" ;;
 
   -x-libraries | --x-libraries | --x-librarie | --x-librari \
   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
     ac_prev=x_libraries ;;
   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries=$ac_optarg ;;
+    x_libraries="$ac_optarg" ;;
 
-  -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
     ;;
 
-  *=*)
-    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
-    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
-    eval "$ac_envvar='$ac_optarg'"
-    export $ac_envvar ;;
-
   *)
-    # FIXME: should be removed in autoconf 3.0.
-    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
     ;;
 
   esac
 done
 
 if test -n "$ac_prev"; then
-  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
 fi
 
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
-  eval ac_val=$`echo $ac_var`
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
-    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; };;
-  esac
-done
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
 
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-              localstatedir libdir includedir oldincludedir infodir mandir
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
 do
-  eval ac_val=$`echo $ac_var`
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* ) ;;
-    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; };;
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
   esac
 done
 
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
-  if test "x$build_alias" = x; then
-    cross_compiling=maybe
-    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used." >&2
-  elif test "x$build_alias" != "x$host_alias"; then
-    cross_compiling=yes
-  fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
 
-test "$silent" = yes && exec 6>/dev/null
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
 
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=main.c
 
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then its parent.
-  ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$0" : 'X\(//\)[^/]' \| \
-         X"$0" : 'X\(//\)$' \| \
-         X"$0" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$0" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
   srcdir=$ac_confdir
   if test ! -r $srcdir/$ac_unique_file; then
     srcdir=..
@@ -727,441 +472,13 @@ else
 fi
 if test ! -r $srcdir/$ac_unique_file; then
   if test "$ac_srcdir_defaulted" = yes; then
-    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
-   { (exit 1); exit 1; }; }
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
   else
-    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
   fi
 fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
-  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
-   { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
-  # Omit some internal or obsolete options to make the list less imposing.
-  # This message is too long to be a string in the A/UX 3.1 sh.
-  cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE.  See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
-  -h, --help              display this help and exit
-      --help=short        display options specific to this package
-      --help=recursive    display the short help of all the included packages
-  -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
-      --cache-file=FILE   cache test results in FILE [disabled]
-  -C, --config-cache      alias for \`--cache-file=config.cache'
-  -n, --no-create         do not create output files
-      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
-
-_ACEOF
-
-  cat <<_ACEOF
-Installation directories:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
-  --bindir=DIR           user executables [EPREFIX/bin]
-  --sbindir=DIR          system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR       program executables [EPREFIX/libexec]
-  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
-  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
-  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
-  --libdir=DIR           object code libraries [EPREFIX/lib]
-  --includedir=DIR       C header files [PREFIX/include]
-  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
-  --infodir=DIR          info documentation [PREFIX/info]
-  --mandir=DIR           man documentation [PREFIX/man]
-_ACEOF
-
-  cat <<\_ACEOF
-
-Program names:
-  --program-prefix=PREFIX            prepend PREFIX to installed program names
-  --program-suffix=SUFFIX            append SUFFIX to installed program names
-  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
-
-System types:
-  --build=BUILD     configure for building on BUILD [guessed]
-  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
-
-  cat <<\_ACEOF
-
-Optional Features:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-threads        enable threads support
-
-Optional Packages:
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-gc=ARG         use garbage collector gc2,gc1,boehm
-
-Some influential environment variables:
-  CC          C compiler command
-  CFLAGS      C compiler flags
-  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-              nonstandard directory <lib dir>
-  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
-              headers in a nonstandard directory <include dir>
-  CPP         C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-_ACEOF
-fi
-
-if test "$ac_init_help" = "recursive"; then
-  # If there are subdirs, report their specific --help.
-  ac_popdir=`pwd`
-  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d $ac_dir || continue
-    ac_builddir=.
-
-if test "$ac_dir" != .; then
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
-  .)  # No --srcdir option.  We are building in place.
-    ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
-
-    cd $ac_dir
-    # Check for guested configure; otherwise get Cygnus style configure.
-    if test -f $ac_srcdir/configure.gnu; then
-      echo
-      $SHELL $ac_srcdir/configure.gnu  --help=recursive
-    elif test -f $ac_srcdir/configure; then
-      echo
-      $SHELL $ac_srcdir/configure  --help=recursive
-    elif test -f $ac_srcdir/configure.ac ||
-           test -f $ac_srcdir/configure.in; then
-      echo
-      $ac_configure --help
-    else
-      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi
-    cd $ac_popdir
-  done
-fi
-
-test -n "$ac_init_help" && exit 0
-if $ac_init_version; then
-  cat <<\_ACEOF
-
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
-  exit 0
-fi
-exec 5>config.log
-cat >&5 <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by $as_me, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
-
-  $ $0 $@
-
-_ACEOF
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  echo "PATH: $as_dir"
-done
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_sep=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
-    2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-        ac_must_keep_next=false # Got value, back to normal.
-      else
-        case $ac_arg in
-          *=* | --config-cache | -C | -disable-* | --disable-* \
-          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-          | -with-* | --with-* | -without-* | --without-* | --x)
-            case "$ac_configure_args0 " in
-              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-            esac
-            ;;
-          -* ) ac_must_keep_next=true ;;
-        esac
-      fi
-      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
-      # Get rid of the leading space.
-      ac_sep=" "
-      ;;
-    esac
-  done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
-
-    cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-{
-  (set) 2>&1 |
-    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
-      sed -n \
-        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
-      ;;
-    *)
-      sed -n \
-        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
-      ;;
-    esac;
-}
-    echo
-
-    cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=$`echo $ac_var`
-      echo "$ac_var='"'"'$ac_val'"'"'"
-    done | sort
-    echo
-
-    if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
-      echo
-      for ac_var in $ac_subst_files
-      do
-       eval ac_val=$`echo $ac_var`
-        echo "$ac_var='"'"'$ac_val'"'"'"
-      done | sort
-      echo
-    fi
-
-    if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
-      echo
-      sed "/^$/d" confdefs.h | sort
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      echo "$as_me: caught signal $ac_signal"
-    echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core core.* *.core &&
-  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-     ' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
 # Prefer explicitly selected file to automatically selected ones.
 if test -z "$CONFIG_SITE"; then
   if test "x$prefix" != xNONE; then
@@ -1172,103 +489,39 @@ if test -z "$CONFIG_SITE"; then
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
-    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
+    echo "loading site script $ac_site_file"
     . "$ac_site_file"
   fi
 done
 
 if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . $cache_file;;
-      *)                      . ./$cache_file;;
-    esac
-  fi
+  echo "loading cache $cache_file"
+  . $cache_file
 else
-  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
-               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
-  eval ac_new_val="\$ac_env_${ac_var}_value"
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
-echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
-echo "$as_me:   current value: $ac_new_val" >&2;}
-        ac_cache_corrupted=:
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
+  echo "creating cache $cache_file"
+  > $cache_file
 fi
 
 ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='       '
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
 
 
 ac_aux_dir=
@@ -1281,74 +534,41 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install.sh -c"
     break
-  elif test -f $ac_dir/shtool; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
-   { (exit 1); exit 1; }; }
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
 fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 
-# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
-   { (exit 1); exit 1; }; }
-
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
-if test "${ac_cv_build+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
-  ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
-  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
-build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
-if test "${ac_cv_host+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
-  ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
-  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
 
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
-host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:554: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
 
 
 am__api_version="1.4"
@@ -1359,78 +579,65 @@ am__api_version="1.4"
 # SunOS /usr/etc/install
 # IRIX /sbin/install
 # AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:588: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
-          if test $ac_prog = install &&
-            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-            # AIX install.  It has an incompatible calling convention.
-            :
-          elif test $ac_prog = install &&
-            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-            # program-specific install script used by HP pwplus--don't use.
-            :
-          else
-            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-            break 3
-          fi
-        fi
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+         if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         else
+           ac_cv_path_install="$ac_dir/$ac_prog -c"
+           break 2
+         fi
+       fi
       done
-    done
-    ;;
-esac
-done
-
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
 
 fi
   if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
+    INSTALL="$ac_cv_path_install"
   else
     # As a last resort, use the slow shell script.  We don't cache a
     # path for INSTALL within a source directory, because that will
     # break other packages using the cache if that directory is
     # removed, or if the path is relative.
-    INSTALL=$ac_install_sh
+    INSTALL="$ac_install_sh"
   fi
 fi
-echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6
+echo "$ac_t""$INSTALL" 1>&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:641: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -1452,11 +659,8 @@ if (
       # if, for instance, CONFIG_SHELL is bash and it inherits a
       # broken ls alias from the environment.  This has actually
       # happened.  Such a system could not be considered "sane".
-      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&5
-echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&2;}
-   { (exit 1); exit 1; }; }
+      { echo "configure: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
    fi
 
    test "$2" = conftestfile
@@ -1465,54 +669,54 @@ then
    # Ok.
    :
 else
-   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
-   { (exit 1); exit 1; }; }
+   { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
 fi
 rm -f conftest*
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+  program_transform_name=
+else
+  # Double any \ or $.  echo might interpret backslashes.
+  cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+  rm -f conftestsed
+fi
 test "$program_prefix" != NONE &&
-  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+  program_transform_name="s,^,${program_prefix},; $program_transform_name"
 # Use a double $ so make ignores it.
 test "$program_suffix" != NONE &&
-  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
-# Double any \ or $.  echo might interpret backslashes.
-# By default was `s,x,x', remove it if useless.
-cat <<\_ACEOF >conftest.sed
-s/[\\$]/&&/g;s/;s,x,x,$//
-_ACEOF
-program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm conftest.sed
-
-echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:698: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.make <<\_ACEOF
+  cat > conftestmake <<\EOF
 all:
-       @echo 'ac_maketemp="$(MAKE)"'
-_ACEOF
+       @echo 'ac_maketemp="${MAKE}"'
+EOF
 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
 if test -n "$ac_maketemp"; then
   eval ac_cv_prog_make_${ac_make}_set=yes
 else
   eval ac_cv_prog_make_${ac_make}_set=no
 fi
-rm -f conftest.make
+rm -f conftestmake
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+  echo "$ac_t""yes" 1>&6
   SET_MAKE=
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  echo "$ac_t""no" 1>&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
@@ -1522,827 +726,372 @@ PACKAGE=cacao
 VERSION=0.40
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
-  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-   { (exit 1); exit 1; }; }
+  { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
 fi
-
-cat >>confdefs.h <<_ACEOF
+cat >> confdefs.h <<EOF
 #define PACKAGE "$PACKAGE"
-_ACEOF
+EOF
 
-
-cat >>confdefs.h <<_ACEOF
+cat >> confdefs.h <<EOF
 #define VERSION "$VERSION"
-_ACEOF
+EOF
 
 
 
 missing_dir=`cd $ac_aux_dir && pwd`
-echo "$as_me:$LINENO: checking for working aclocal-${am__api_version}" >&5
-echo $ECHO_N "checking for working aclocal-${am__api_version}... $ECHO_C" >&6
+echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6
+echo "configure:744: checking for working aclocal-${am__api_version}" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
    ACLOCAL=aclocal-${am__api_version}
-   echo "$as_me:$LINENO: result: found" >&5
-echo "${ECHO_T}found" >&6
+   echo "$ac_t""found" 1>&6
 else
    ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
-   echo "$as_me:$LINENO: result: missing" >&5
-echo "${ECHO_T}missing" >&6
+   echo "$ac_t""missing" 1>&6
 fi
 
-echo "$as_me:$LINENO: checking for working autoconf" >&5
-echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:757: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (autoconf --version) < /dev/null > /dev/null 2>&1; then
    AUTOCONF=autoconf
-   echo "$as_me:$LINENO: result: found" >&5
-echo "${ECHO_T}found" >&6
+   echo "$ac_t""found" 1>&6
 else
    AUTOCONF="$missing_dir/missing autoconf"
-   echo "$as_me:$LINENO: result: missing" >&5
-echo "${ECHO_T}missing" >&6
+   echo "$ac_t""missing" 1>&6
 fi
 
-echo "$as_me:$LINENO: checking for working automake-${am__api_version}" >&5
-echo $ECHO_N "checking for working automake-${am__api_version}... $ECHO_C" >&6
+echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6
+echo "configure:770: checking for working automake-${am__api_version}" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
    AUTOMAKE=automake-${am__api_version}
-   echo "$as_me:$LINENO: result: found" >&5
-echo "${ECHO_T}found" >&6
+   echo "$ac_t""found" 1>&6
 else
    AUTOMAKE="$missing_dir/missing automake-${am__api_version}"
-   echo "$as_me:$LINENO: result: missing" >&5
-echo "${ECHO_T}missing" >&6
+   echo "$ac_t""missing" 1>&6
 fi
 
-echo "$as_me:$LINENO: checking for working autoheader" >&5
-echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:783: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (autoheader --version) < /dev/null > /dev/null 2>&1; then
    AUTOHEADER=autoheader
-   echo "$as_me:$LINENO: result: found" >&5
-echo "${ECHO_T}found" >&6
+   echo "$ac_t""found" 1>&6
 else
    AUTOHEADER="$missing_dir/missing autoheader"
-   echo "$as_me:$LINENO: result: missing" >&5
-echo "${ECHO_T}missing" >&6
+   echo "$ac_t""missing" 1>&6
 fi
 
-echo "$as_me:$LINENO: checking for working makeinfo" >&5
-echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:796: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
    MAKEINFO=makeinfo
-   echo "$as_me:$LINENO: result: found" >&5
-echo "${ECHO_T}found" >&6
+   echo "$ac_t""found" 1>&6
 else
    MAKEINFO="$missing_dir/missing makeinfo"
-   echo "$as_me:$LINENO: result: missing" >&5
-echo "${ECHO_T}missing" >&6
+   echo "$ac_t""missing" 1>&6
 fi
 
 
 
-          ac_config_headers="$ac_config_headers config.h"
 
-          ac_config_commands="$ac_config_commands default-1"
 
 
 
 
 
-ASMPART="asmpart.S"
 case "$host_cpu" in
 alpha* )
-       SYSDEP_DIR="alpha"
+       ARCH_DIR="alpha"
        CFLAGS="-mieee -O0 -g3 -D__ALPHA__"
-       COMPILER_OBJECTS=""
-       cat >>confdefs.h <<\_ACEOF
+       cat >> confdefs.h <<\EOF
 #define TRACE_ARGS_NUM 6
-_ACEOF
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define USE_CODEMMAP 1
+EOF
+
+       ;;
+
+i386* | i486* | i586* | i686* )
+       ARCH_DIR="i386"
+       CFLAGS="-Wall -O0 -g3 -D__I386__"
+       cat >> confdefs.h <<\EOF
+#define TRACE_ARGS_NUM 8
+EOF
 
-       cat >>confdefs.h <<\_ACEOF
+       cat >> confdefs.h <<\EOF
 #define USE_CODEMMAP 1
-_ACEOF
+EOF
 
        ;;
 
 mips* )
-       SYSDEP_DIR="mips"
-       ASMPART="asmpart.s"
+       ARCH_DIR="mips"
         CFLAGS="-64 -O2 -OPT:Olimit=0 -g -DMAP_ANONYMOUS=0 -woff 1110,1164,1515 -D__MIPS__"
        LIBS="-lelfutil"
-       COMPILER_OBJECTS=""
-       cat >>confdefs.h <<\_ACEOF
+       cat >> confdefs.h <<\EOF
 #define TRACE_ARGS_NUM 8
-_ACEOF
+EOF
 
        ;;
 
-i386* | i486* | i586* | i686* )
-       SYSDEP_DIR="i386"
-       CFLAGS="-Wall -O0 -g3 -D__I386__"
-       COMPILER_OBJECTS="i386/libdisass.a"
-       cat >>confdefs.h <<\_ACEOF
+powerpc* | ppc* )
+       ARCH_DIR="powerpc"
+       CFLAGS="-O2 -g -DMAP_ANONYMOUS=0 -no-cpp-precomp"
+       cat >> confdefs.h <<\EOF
 #define TRACE_ARGS_NUM 8
-_ACEOF
-
-       cat >>confdefs.h <<\_ACEOF
-#define USE_CODEMMAP 1
-_ACEOF
+EOF
 
        ;;
 
 x86_64* )
-       SYSDEP_DIR="x86_64"
+       ARCH_DIR="x86_64"
        CFLAGS="-O0 -g3 -D__X86_64__"
-       COMPILER_OBJECTS="x86_64/libdisass.a"
-       cat >>confdefs.h <<\_ACEOF
+       cat >> confdefs.h <<\EOF
 #define TRACE_ARGS_NUM 6
-_ACEOF
+EOF
 
-       cat >>confdefs.h <<\_ACEOF
+       cat >> confdefs.h <<\EOF
 #define USE_CODEMMAP 1
-_ACEOF
-
-       ;;
-
-powerpc* | ppc* )
-       SYSDEP_DIR="powerpc"
-       CFLAGS="-O2 -g -DMAP_ANONYMOUS=0 -no-cpp-precomp"
-       COMPILER_OBJECTS="powerpc/libdisass.a"
-       cat >>confdefs.h <<\_ACEOF
-#define TRACE_ARGS_NUM 8
-_ACEOF
+EOF
 
        ;;
 
 sparc* | * )
-       { { echo "$as_me:$LINENO: error: $target systems are not supported at this time" >&5
-echo "$as_me: error: $target systems are not supported at this time" >&2;}
-   { (exit 1); exit 1; }; }
+       { echo "configure: error: $host_cpu systems are not supported at this time" 1>&2; exit 1; }
         ;;
 esac
 
 
 
+cat >> confdefs.h <<EOF
+#define ARCH_DIR "$ARCH_DIR"
+EOF
 
-cat >>confdefs.h <<_ACEOF
-#define SYSDEP_DIR "$SYSDEP_DIR"
-_ACEOF
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
 
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
 
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
+# Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  CC=$ac_ct_CC
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:891: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
 fi
 fi
-CC=$ac_cv_prog_CC
+CC="$ac_cv_prog_CC"
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  CC=$ac_ct_CC
+  echo "$ac_t""$CC" 1>&6
 else
-  CC="$ac_cv_prog_CC"
+  echo "$ac_t""no" 1>&6
 fi
 
-fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:921: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+       continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
 if test $ac_prog_rejected = yes; then
   # We found a bogon in the path, so make sure we never use it.
   set dummy $ac_cv_prog_CC
   shift
-  if test $# != 0; then
+  if test $# -gt 0; then
     # We chose a different compiler from the bogus one.
     # However, it has the same basename, so the bogon will be chosen
     # first if we set CC to just the basename; use the full file name.
     shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
   fi
 fi
 fi
 fi
-CC=$ac_cv_prog_CC
+CC="$ac_cv_prog_CC"
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  echo "$ac_t""$CC" 1>&6
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  echo "$ac_t""no" 1>&6
 fi
 
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:972: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
 fi
 fi
-CC=$ac_cv_prog_CC
+CC="$ac_cv_prog_CC"
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  echo "$ac_t""$CC" 1>&6
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  echo "$ac_t""no" 1>&6
 fi
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+ ;;
+    esac
   fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
-  test -n "$ac_ct_CC" && break
-done
-
-  CC=$ac_ct_CC
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
-     "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-  (eval $ac_compiler --version </dev/null >&5) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-  (eval $ac_compiler -v </dev/null >&5) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-  (eval $ac_compiler -V </dev/null >&5) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1004: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output" >&5
-echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
-  (eval $ac_link_default) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # Find the output, starting from the most likely.  This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
-        ;;
-    conftest.$ac_ext )
-        # This is the source file.
-        ;;
-    [ab].out )
-        # We found the default executable, but exeext='' is most
-        # certainly right.
-        break;;
-    *.* )
-        ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-        # FIXME: I believe we export ac_cv_exeext for Libtool,
-        # but it would be cool to find out if it's true.  Does anybody
-        # maintain Libtool? --akim.
-        export ac_cv_exeext
-        break;;
-    * )
-        break;;
-  esac
-done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1015 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
   else
-    if test "$cross_compiling" = maybe; then
-       cross_compiling=yes
-    else
-       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-    fi
+    ac_cv_prog_cc_cross=yes
   fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-          export ac_cv_exeext
-          break;;
-    * ) break;;
-  esac
-done
-else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1046: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1051: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  ac_cv_prog_gcc=no
+fi
+fi
 
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_compiler_gnu=yes
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
+  GCC=
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1079: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
   ac_cv_prog_cc_g=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_prog_cc_g=no
+  ac_cv_prog_cc_g=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
+
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
 if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
+  CFLAGS="$ac_save_CFLAGS"
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
     CFLAGS="-g -O2"
@@ -2356,992 +1105,358 @@ else
     CFLAGS=
   fi
 fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX                  -qlanglvl=ansi
-# Ultrix and OSF/1     -std1
-# HP-UX 10.20 and later        -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4                 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_stdc=$ac_arg
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
-  x|xno)
-    echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
-  *)
-    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-    CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C.  Since we use `exit',
-# in C++ we need to declare it.  In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
-  choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  for ac_declaration in \
-   '' \
-   'extern "C" void std::exit (int) throw (); using std::exit;' \
-   'extern "C" void std::exit (int); using std::exit;' \
-   'extern "C" void exit (int) throw ();' \
-   'extern "C" void exit (int);' \
-   'void exit (int);'
-do
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_declaration
-int
-main ()
-{
-exit (42);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
-  echo '#ifdef __cplusplus' >>confdefs.h
-  echo $ac_declaration      >>confdefs.h
-  echo '#endif'             >>confdefs.h
-fi
-
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1113: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
 fi
 fi
-RANLIB=$ac_cv_prog_RANLIB
+RANLIB="$ac_cv_prog_RANLIB"
 if test -n "$RANLIB"; then
-  echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  RANLIB=$ac_ct_RANLIB
+  echo "$ac_t""$RANLIB" 1>&6
 else
-  RANLIB="$ac_cv_prog_RANLIB"
+  echo "$ac_t""no" 1>&6
 fi
 
-echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:1141: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.make <<\_ACEOF
+  cat > conftestmake <<\EOF
 all:
-       @echo 'ac_maketemp="$(MAKE)"'
-_ACEOF
+       @echo 'ac_maketemp="${MAKE}"'
+EOF
 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
 if test -n "$ac_maketemp"; then
   eval ac_cv_prog_make_${ac_make}_set=yes
 else
   eval ac_cv_prog_make_${ac_make}_set=no
 fi
-rm -f conftest.make
+rm -f conftestmake
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+  echo "$ac_t""yes" 1>&6
   SET_MAKE=
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  echo "$ac_t""no" 1>&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
 
-
-
-echo "$as_me:$LINENO: checking for sin in -lm" >&5
-echo $ECHO_N "checking for sin in -lm... $ECHO_C" >&6
-if test "${ac_cv_lib_m_sin+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
+echo "configure:1169: checking for sin in -lm" >&5
+ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_check_lib_save_LIBS=$LIBS
+  ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+cat > conftest.$ac_ext <<EOF
+#line 1177 "configure"
+#include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
 /* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char sin ();
-int
-main ()
-{
-sin ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_m_sin=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    builtin and then its argument prototype would still apply.  */
+char sin();
+
+int main() {
+sin()
+; return 0; }
+EOF
+if { (eval echo configure:1188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
-ac_cv_lib_m_sin=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_m_sin" >&5
-echo "${ECHO_T}$ac_cv_lib_m_sin" >&6
-if test $ac_cv_lib_m_sin = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
-_ACEOF
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
 
   LIBS="-lm $LIBS"
 
+else
+  echo "$ac_t""no" 1>&6
 fi
 
 
-
-
-
-
-
 ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
-echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:1221: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1226 "configure"
+#include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
-
-int
-main ()
-{
-if ((DIR *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:1234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=no"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
-_ACEOF
-
-ac_header_dirent=$ac_hdr; break
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ ac_header_dirent=$ac_hdr; break
+else
+  echo "$ac_t""no" 1>&6
 fi
-
 done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
-  echo "$as_me:$LINENO: checking for library containing opendir" >&5
-echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
-if test "${ac_cv_search_opendir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-ac_cv_search_opendir=no
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:1259: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldir  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1267 "configure"
+#include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
 /* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
-int
-main ()
-{
-opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="none required"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_opendir" = no; then
-  for ac_lib in dir; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
-int
-main ()
-{
-opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="-l$ac_lib"
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-  done
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
-LIBS=$ac_func_search_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-echo "${ECHO_T}$ac_cv_search_opendir" >&6
-if test "$ac_cv_search_opendir" != no; then
-  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 fi
-
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -ldir"
 else
-  echo "$as_me:$LINENO: checking for library containing opendir" >&5
-echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
-if test "${ac_cv_search_opendir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-ac_cv_search_opendir=no
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  echo "$ac_t""no" 1>&6
+fi
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
-int
-main ()
-{
-opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="none required"
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_opendir" = no; then
-  for ac_lib in x; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:1300: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lx  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1308 "configure"
+#include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
 /* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
-int
-main ()
-{
-opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="-l$ac_lib"
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-  done
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
-LIBS=$ac_func_search_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-echo "${ECHO_T}$ac_cv_search_opendir" >&6
-if test "$ac_cv_search_opendir" != no; then
-  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -lx"
+else
+  echo "$ac_t""no" 1>&6
+fi
 
 fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1342: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
   # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                     Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1357 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1363: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   :
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether non-existent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  break
-fi
-
-    done
-    ac_cv_prog_CPP=$CPP
-
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                     Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1374 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1380: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   :
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether non-existent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1391 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
 else
-  ac_cpp_err=yes
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
 fi
-if test -z "$ac_cpp_err"; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
+rm -f conftest*
 fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
-else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+rm -f conftest*
 fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
 else
-  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
-    fi
+  ac_cv_prog_CPP="$CPP"
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
+echo "$ac_t""$CPP" 1>&6
 
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1422: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 1427 "configure"
+#include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
 #include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
   ac_cv_header_stdc=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_stdc=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+cat > conftest.$ac_ext <<EOF
+#line 1452 "configure"
+#include "confdefs.h"
 #include <string.h>
-
-_ACEOF
+EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
+  egrep "memchr" >/dev/null 2>&1; then
   :
 else
+  rm -rf conftest*
   ac_cv_header_stdc=no
 fi
 rm -f conftest*
@@ -3350,20 +1465,16 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+cat > conftest.$ac_ext <<EOF
+#line 1470 "configure"
+#include "confdefs.h"
 #include <stdlib.h>
-
-_ACEOF
+EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
+  egrep "free" >/dev/null 2>&1; then
   :
 else
+  rm -rf conftest*
   ac_cv_header_stdc=no
 fi
 rm -f conftest*
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
+if test "$cross_compiling" = yes; then
   :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 1491 "configure"
+#include "confdefs.h"
 #include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-                   (('a' <= (c) && (c) <= 'i') \
-                     || ('j' <= (c) && (c) <= 'r') \
-                     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-        || toupper (i) != TOUPPER (i))
-      exit(2);
-  exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
   :
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_header_stdc=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -fr conftest*
 fi
+
 fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+  cat >> confdefs.h <<\EOF
 #define STDC_HEADERS 1
-_ACEOF
+EOF
 
 fi
 
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                  inttypes.h stdint.h unistd.h
+for ac_hdr in fcntl.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1529: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1534 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
-
-done
-
-
-
-for ac_header in fcntl.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
+rm -f conftest*
 fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-  no:yes )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
+  echo "$ac_t""no" 1>&6
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
 done
 
-
-for ac_header in sys/time.h
+for ac_hdr in sys/time.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-  no:yes )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=$ac_header_preproc"
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1569: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1574 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1579: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
+rm -f conftest*
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
 fi
-
 done
 
-
-for ac_header in unistd.h
+for ac_hdr in unistd.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-  no:yes )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=$ac_header_preproc"
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1609: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1614 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1619: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
+rm -f conftest*
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
 fi
-
 done
 
-
-for ac_header in sys/ioctl.h
+for ac_hdr in sys/ioctl.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-  no:yes )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=$ac_header_preproc"
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1649: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1654 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
+rm -f conftest*
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
 fi
-
 done
 
 
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
-if test "${ac_cv_c_const+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
-  typedef int charset[2];
-  const charset x;
-  /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *ccp;
-  char **p;
-  /* NEC SVR4.0.2 mips cc rejects this.  */
-  struct point {int x, y;};
-  static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
-     It does not let you subtract one const X* pointer from another in
-     an arm of an if-expression whose if-part is not a constant
-     expression */
-  const char *g = "string";
-  ccp = &g + (g ? g-g : 0);
-  /* HPUX 7.0 cc rejects these. */
-  ++ccp;
-  p = (char**) ccp;
-  ccp = (char const *const *) p;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
-    char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-    *t++ = 0;
-  }
-  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-    int x[] = {25, 17};
-    const int *foo = &x[0];
-    ++foo;
-  }
-  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-    typedef const int *iptr;
-    iptr p = 0;
-    ++p;
-  }
-  { /* AIX XL C 1.02.0.0 rejects this saying
-       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-  }
-#endif
-
-  ;
-  return 0;
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1687: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1692 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
 }
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
   ac_cv_c_const=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_const=no
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_const=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
 fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
-if test $ac_cv_c_const = no; then
 
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
 
 fi
 
-echo "$as_me:$LINENO: checking for inline" >&5
-echo $ECHO_N "checking for inline... $ECHO_C" >&6
-if test "${ac_cv_c_inline+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1762: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  cat > conftest.$ac_ext <<EOF
+#line 1769 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:1776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
 done
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6
-case $ac_cv_c_inline in
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
   inline | yes) ;;
-  no)
-cat >>confdefs.h <<\_ACEOF
-#define inline
-_ACEOF
+  no) cat >> confdefs.h <<\EOF
+#define inline 
+EOF
  ;;
-  *)  cat >>confdefs.h <<_ACEOF
+  *)  cat >> confdefs.h <<EOF
 #define inline $ac_cv_c_inline
-_ACEOF
+EOF
  ;;
 esac
 
-echo "$as_me:$LINENO: checking for off_t" >&5
-echo $ECHO_N "checking for off_t... $ECHO_C" >&6
-if test "${ac_cv_type_off_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:1802: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((off_t *) 0)
-  return 0;
-if (sizeof (off_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  cat > conftest.$ac_ext <<EOF
+#line 1807 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
   ac_cv_type_off_t=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_off_t=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+  rm -rf conftest*
+  ac_cv_type_off_t=no
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-echo "${ECHO_T}$ac_cv_type_off_t" >&6
-if test $ac_cv_type_off_t = yes; then
-  :
-else
+rm -f conftest*
 
-cat >>confdefs.h <<_ACEOF
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+  cat >> confdefs.h <<\EOF
 #define off_t long
-_ACEOF
+EOF
 
 fi
 
-echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6
-if test "${ac_cv_type_size_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:1835: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((size_t *) 0)
-  return 0;
-if (sizeof (size_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  cat > conftest.$ac_ext <<EOF
+#line 1840 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
   ac_cv_type_size_t=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_size_t=no
+  rm -rf conftest*
+  ac_cv_type_size_t=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6
-if test $ac_cv_type_size_t = yes; then
-  :
-else
+rm -f conftest*
 
-cat >>confdefs.h <<_ACEOF
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+  cat >> confdefs.h <<\EOF
 #define size_t unsigned
-_ACEOF
+EOF
 
 fi
 
-echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
-if test "${ac_cv_header_time+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1868: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 1873 "configure"
+#include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
 #include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:1882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
   ac_cv_header_time=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_time=no
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_time=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6
-if test $ac_cv_header_time = yes; then
 
-cat >>confdefs.h <<\_ACEOF
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+  cat >> confdefs.h <<\EOF
 #define TIME_WITH_SYS_TIME 1
-_ACEOF
+EOF
 
 fi
 
-echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
-echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
-if test "${ac_cv_struct_tm+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+echo "configure:1903: checking whether struct tm is in sys/time.h or time.h" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 1908 "configure"
+#include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
-
-int
-main ()
-{
+int main() {
 struct tm *tp; tp->tm_sec;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+; return 0; }
+EOF
+if { (eval echo configure:1916: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_struct_tm=sys/time.h
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_struct_tm=sys/time.h
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
 fi
-echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
-echo "${ECHO_T}$ac_cv_struct_tm" >&6
-if test $ac_cv_struct_tm = sys/time.h; then
 
-cat >>confdefs.h <<\_ACEOF
+echo "$ac_t""$ac_cv_struct_tm" 1>&6
+if test $ac_cv_struct_tm = sys/time.h; then
+  cat >> confdefs.h <<\EOF
 #define TM_IN_SYS_TIME 1
-_ACEOF
+EOF
 
 fi
 
 
-if test $ac_cv_c_compiler_gnu = yes; then
-    echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
-echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
-if test "${ac_cv_prog_gcc_traditional+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test $ac_cv_prog_gcc = yes; then
+    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
+echo "configure:1939: checking whether ${CC-cc} needs -traditional" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 1945 "configure"
+#include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
-_ACEOF
+EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1; then
+  egrep "$ac_pattern" >/dev/null 2>&1; then
+  rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
 else
+  rm -rf conftest*
   ac_cv_prog_gcc_traditional=no
 fi
 rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
-    cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+    cat > conftest.$ac_ext <<EOF
+#line 1963 "configure"
+#include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
-_ACEOF
+EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1; then
+  egrep "$ac_pattern" >/dev/null 2>&1; then
+  rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
 fi
 rm -f conftest*
 
   fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
-echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
+
+echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
-echo "$as_me:$LINENO: checking for working memcmp" >&5
-echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6
-if test "${ac_cv_func_memcmp_working+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:1985: checking for 8-bit clean memcmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
-  ac_cv_func_memcmp_working=no
+  ac_cv_func_memcmp_clean=no
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 1993 "configure"
+#include "confdefs.h"
 
-int
-main ()
+main()
 {
-
-  /* Some versions of memcmp are not 8-bit clean.  */
   char c0 = 0x40, c1 = 0x80, c2 = 0x81;
-  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
-    exit (1);
-
-  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
-     or more and with at least one buffer not starting on a 4-byte boundary.
-     William Lewis provided this test program.   */
-  {
-    char foo[21];
-    char bar[21];
-    int i;
-    for (i = 0; i < 4; i++)
-      {
-        char *a = foo + i;
-        char *b = bar + i;
-        strcpy (a, "--------01111111");
-        strcpy (b, "--------10000000");
-        if (memcmp (a, b, 16) >= 0)
-          exit (1);
-      }
-    exit (0);
-  }
-
-  ;
-  return 0;
+  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
 }
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_memcmp_working=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-ac_cv_func_memcmp_working=no
-fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+EOF
+if { (eval echo configure:2003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_memcmp_clean=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_memcmp_clean=no
 fi
+rm -fr conftest*
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
-echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6
-test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
 
+fi
 
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
 
-for ac_header in stdlib.h unistd.h
+for ac_hdr in unistd.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-  no:yes )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=$ac_header_preproc"
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2024: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2029 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
+rm -f conftest*
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
 fi
-
 done
 
-
 for ac_func in getpagesize
 do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2063: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2068 "configure"
+#include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 /* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
+$ac_func();
 #endif
 
-int
-main ()
-{
-return f != $ac_func;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
+; return 0; }
+EOF
+if { (eval echo configure:2091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest*
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
 fi
 done
 
-echo "$as_me:$LINENO: checking for working mmap" >&5
-echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:2116: checking for working mmap" >&5
+if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
   ac_cv_func_mmap_fixed_mapped=no
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-/* malloc might have been renamed as rpl_malloc. */
-#undef malloc
+  cat > conftest.$ac_ext <<EOF
+#line 2124 "configure"
+#include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
    Here is a matrix of mmap possibilities:
@@ -4838,34 +2135,34 @@ $ac_includes_default
    back from the file, nor mmap's back from the file at a different
    address.  (There have been systems where private was not correctly
    implemented like the infamous i386 svr4.0, and systems where the
-   VM page cache was not coherent with the file system buffer cache
+   VM page cache was not coherent with the filesystem buffer cache
    like early versions of FreeBSD and possibly contemporary NetBSD.)
    For shared mappings, we should conversely verify that changes get
-   propagated back to all the places they're supposed to be.
+   propogated back to all the places they're supposed to be.
 
    Grep wants private fixed already mapped.
    The main things grep needs to know about mmap are:
    * does it exist and is it safe to write into the mmap'd area
    * how to use it (BSD variants)  */
-
+#include <sys/types.h>
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#if !STDC_HEADERS && !HAVE_STDLIB_H
-char *malloc ();
-#endif
-
 /* This mess was copied from the GNU getpagesize.h.  */
-#if !HAVE_GETPAGESIZE
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
+
 /* Assume that all systems that can run configure have sys/param.h.  */
-# if !HAVE_SYS_PARAM_H
+# ifndef HAVE_SYS_PARAM_H
 #  define HAVE_SYS_PARAM_H 1
 # endif
 
 # ifdef _SC_PAGESIZE
 #  define getpagesize() sysconf(_SC_PAGESIZE)
 # else /* no _SC_PAGESIZE */
-#  if HAVE_SYS_PARAM_H
+#  ifdef HAVE_SYS_PARAM_H
 #   include <sys/param.h>
 #   ifdef EXEC_PAGESIZE
 #    define getpagesize() EXEC_PAGESIZE
@@ -4892,113 +2189,111 @@ char *malloc ();
 
 #endif /* no HAVE_GETPAGESIZE */
 
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
 int
-main ()
+main()
 {
-  char *data, *data2, *data3;
-  int i, pagesize;
-  int fd;
-
-  pagesize = getpagesize ();
-
-  /* First, make a file with some known garbage in it. */
-  data = (char *) malloc (pagesize);
-  if (!data)
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    *(data + i) = rand ();
-  umask (0);
-  fd = creat ("conftest.mmap", 0600);
-  if (fd < 0)
-    exit (1);
-  if (write (fd, data, pagesize) != pagesize)
-    exit (1);
-  close (fd);
-
-  /* Next, try to mmap the file at a fixed address which already has
-     something else allocated at it.  If we can, also make sure that
-     we see the same garbage.  */
-  fd = open ("conftest.mmap", O_RDWR);
-  if (fd < 0)
-    exit (1);
-  data2 = (char *) malloc (2 * pagesize);
-  if (!data2)
-    exit (1);
-  data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
-  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
-                     MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data2 + i))
-      exit (1);
-
-  /* Finally, make sure that changes to the mapped area do not
-     percolate back to the file as seen by read().  (This is a bug on
-     some variants of i386 svr4.0.)  */
-  for (i = 0; i < pagesize; ++i)
-    *(data2 + i) = *(data2 + i) + 1;
-  data3 = (char *) malloc (pagesize);
-  if (!data3)
-    exit (1);
-  if (read (fd, data3, pagesize) != pagesize)
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data3 + i))
-      exit (1);
-  close (fd);
-  exit (0);
+       char *data, *data2, *data3;
+       int i, pagesize;
+       int fd;
+
+       pagesize = getpagesize();
+
+       /*
+        * First, make a file with some known garbage in it.
+        */
+       data = malloc(pagesize);
+       if (!data)
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               *(data + i) = rand();
+       umask(0);
+       fd = creat("conftestmmap", 0600);
+       if (fd < 0)
+               exit(1);
+       if (write(fd, data, pagesize) != pagesize)
+               exit(1);
+       close(fd);
+
+       /*
+        * Next, try to mmap the file at a fixed address which
+        * already has something else allocated at it.  If we can,
+        * also make sure that we see the same garbage.
+        */
+       fd = open("conftestmmap", O_RDWR);
+       if (fd < 0)
+               exit(1);
+       data2 = malloc(2 * pagesize);
+       if (!data2)
+               exit(1);
+       data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+       if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+           MAP_PRIVATE | MAP_FIXED, fd, 0L))
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               if (*(data + i) != *(data2 + i))
+                       exit(1);
+
+       /*
+        * Finally, make sure that changes to the mapped area
+        * do not percolate back to the file as seen by read().
+        * (This is a bug on some variants of i386 svr4.0.)
+        */
+       for (i = 0; i < pagesize; ++i)
+               *(data2 + i) = *(data2 + i) + 1;
+       data3 = malloc(pagesize);
+       if (!data3)
+               exit(1);
+       if (read(fd, data3, pagesize) != pagesize)
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               if (*(data + i) != *(data3 + i))
+                       exit(1);
+       close(fd);
+       unlink("conftestmmap");
+       exit(0);
 }
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+
+EOF
+if { (eval echo configure:2264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
   ac_cv_func_mmap_fixed_mapped=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_mmap_fixed_mapped=no
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_mmap_fixed_mapped=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -fr conftest*
 fi
+
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
 
-cat >>confdefs.h <<\_ACEOF
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+  cat >> confdefs.h <<\EOF
 #define HAVE_MMAP 1
-_ACEOF
+EOF
 
 fi
-rm -f conftest.mmap
 
-echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
-if test "${ac_cv_type_signal+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:2287: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 2292 "configure"
+#include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
 #ifdef signal
-# undef signal
+#undef signal
 #endif
 #ifdef __cplusplus
 extern "C" void (*signal (int, void (*)(int)))(int);
@@ -5006,204 +2301,151 @@ extern "C" void (*signal (int, void (*)(int)))(int);
 void (*signal ()) ();
 #endif
 
-int
-main ()
-{
+int main() {
 int i;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+; return 0; }
+EOF
+if { (eval echo configure:2309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
   ac_cv_type_signal=void
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_signal=int
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_type_signal=int
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6
 
-cat >>confdefs.h <<_ACEOF
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
 #define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
-
-
-
-
-
-
+EOF
 
 
 for ac_func in getcwd gettimeofday mkdir mktime select socket
 do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2330: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2335 "configure"
+#include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
 /* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
+$ac_func();
 #endif
 
-int
-main ()
-{
-return f != $ac_func;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
+; return 0; }
+EOF
+if { (eval echo configure:2358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest*
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
 fi
 done
 
 
 if test $ac_cv_func_mmap_fixed_mapped = yes; then
-       echo "$as_me:$LINENO: checking whether MAP_FAILED is defined" >&5
-echo $ECHO_N "checking whether MAP_FAILED is defined... $ECHO_C" >&6
-if test "${ac_cv_map_failed+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+       echo $ac_n "checking whether MAP_FAILED is defined""... $ac_c" 1>&6
+echo "configure:2385: checking whether MAP_FAILED is defined" >&5
+if eval "test \"`echo '$''{'ac_cv_map_failed'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2390 "configure"
+#include "confdefs.h"
 #include <sys/mman.h>
                                     #ifdef MAP_FAILED
                                        yes
                                     #endif
-_ACEOF
+EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "yes" >/dev/null 2>&1; then
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
   ac_cv_map_failed=yes
 else
+  rm -rf conftest*
   ac_cv_map_failed=no
 fi
 rm -f conftest*
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_map_failed" >&5
-echo "${ECHO_T}$ac_cv_map_failed" >&6
 
-       echo "$as_me:$LINENO: checking whether MAP_ANONYMOUS is defined" >&5
-echo $ECHO_N "checking whether MAP_ANONYMOUS is defined... $ECHO_C" >&6
-if test "${ac_cv_map_anonymous+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo "$ac_t""$ac_cv_map_failed" 1>&6
+
+       echo $ac_n "checking whether MAP_ANONYMOUS is defined""... $ac_c" 1>&6
+echo "configure:2412: checking whether MAP_ANONYMOUS is defined" >&5
+if eval "test \"`echo '$''{'ac_cv_map_anonymous'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 2417 "configure"
+#include "confdefs.h"
 #include <sys/mman.h>
                                     #ifdef MAP_ANONYMOUS
                                        yes
                                     #endif
-_ACEOF
+EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "yes" >/dev/null 2>&1; then
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
   ac_cv_map_anonymous=yes
 else
+  rm -rf conftest*
   ac_cv_map_anonymous=no
 fi
 rm -f conftest*
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_map_anonymous" >&5
-echo "${ECHO_T}$ac_cv_map_anonymous" >&6
+
+echo "$ac_t""$ac_cv_map_anonymous" 1>&6
 
        if test $ac_cv_map_failed = yes; then
-               cat >>confdefs.h <<\_ACEOF
+               cat >> confdefs.h <<\EOF
 #define HAVE_MAP_FAILED 1
-_ACEOF
-
+EOF
        fi
 
        if test $ac_cv_map_anonymous = yes; then
-               cat >>confdefs.h <<\_ACEOF
+               cat >> confdefs.h <<\EOF
 #define HAVE_MAP_ANONYMOUS 1
-_ACEOF
-
+EOF
        fi
 fi
 
 # Check whether --enable-threads or --disable-threads was given.
 if test "${enable_threads+set}" = set; then
   enableval="$enable_threads"
+  :
+fi
 
-fi;
-
-# Check whether --with-gc or --without-gc was given.
-if test "${with_gc+set}" = set; then
-  withval="$with_gc"
-
-fi;
 
-echo "$as_me:$LINENO: checking whether to include threads support" >&5
-echo $ECHO_N "checking whether to include threads support... $ECHO_C" >&6
+echo $ac_n "checking whether to include threads support""... $ac_c" 1>&6
+echo "configure:2463: checking whether to include threads support" >&5
 if test x"$enable_threads" = "xno"; then
-       echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+       echo "$ac_t""no" 1>&6
 else
-       echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+       echo "$ac_t""yes" 1>&6
 
-       cat >>confdefs.h <<\_ACEOF
+       cat >> confdefs.h <<\EOF
 #define USE_THREADS 1
-_ACEOF
+EOF
 
-       cat >>confdefs.h <<\_ACEOF
+       cat >> confdefs.h <<\EOF
 #define EXTERNAL_OVERFLOW 1
-_ACEOF
+EOF
 
-       cat >>confdefs.h <<\_ACEOF
+       cat >> confdefs.h <<\EOF
 #define DONT_FREE_FIRST 1
-_ACEOF
+EOF
 
 
        LIBTHREAD="libthreads.a"
        THREAD_OBJ="threads/libthreads.a"
-
-
+       
+       
 fi
 
-echo "$as_me:$LINENO: checking which garbage collector to use" >&5
-echo $ECHO_N "checking which garbage collector to use... $ECHO_C" >&6
-case "$with_gc" in
-gc1 )
-       echo "$as_me:$LINENO: result: old garbage collector" >&5
-echo "${ECHO_T}old garbage collector" >&6
-       GC_OBJ="mm/libmm_old.a"
-       ;;
-gc2 )
-       echo "$as_me:$LINENO: result: new garbage collector" >&5
-echo "${ECHO_T}new garbage collector" >&6
-       GC_OBJ="mm/libmm_new.a"
-       ;;
-boehm | "" )
-       echo "$as_me:$LINENO: result: Boehm garbage collector" >&5
-echo "${ECHO_T}Boehm garbage collector" >&6
-       GC_OBJ="mm/libboehm.a libgc.a"
-       if test ! -e libgc.a; then
-               { { echo "$as_me:$LINENO: error: libgc.a not found, see README.boehm" >&5
-echo "$as_me: error: libgc.a not found, see README.boehm" >&2;}
-   { (exit 1); exit 1; }; }
-       fi
-       cat >>confdefs.h <<\_ACEOF
-#define USE_BOEHM 1
-_ACEOF
-
-       BOEHM_LIB="libboehm.a"
-       ;;
-* )
-       { { echo "$as_me:$LINENO: error: Invalid GC" >&5
-echo "$as_me: error: Invalid GC" >&2;}
-   { (exit 1); exit 1; }; }
-       ;;
-esac
-
+subdirs="mm/boehm-gc"
 
 
-                                                                                                                                                                ac_config_files="$ac_config_files Makefile toolbox/Makefile mm/Makefile threads/Makefile jit/Makefile alpha/Makefile mips/Makefile i386/Makefile x86_64/Makefile powerpc/Makefile nat/Makefile doc/Makefile narray/Makefile tst/Makefile tst/kaffe/Makefile jvmtst/Makefile"
-cat >confcache <<\_ACEOF
+trap '' 1 2 15
+cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems.  If it contains results you don't
-# want to keep, you may remove or edit it.
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
 #
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
 #
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
+EOF
 # The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
 # So, don't put newlines in cache variables' values.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
-{
-  (set) 2>&1 |
-    case `(ac_space=' '; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
-      sed -n \
-        "s/'/'\\\\''/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;;
-    *)
-      # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n \
-        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
-      ;;
-    esac;
-} |
-  sed '
-     t clear
-     : clear
-     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
-     t end
-     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
   if test -w $cache_file; then
-    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
-    cat confcache >$cache_file
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
   else
     echo "not updating unwritable cache $cache_file"
   fi
 fi
 rm -f confcache
 
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[        ]*VPATH[        ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[   ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[     ]*$//;
-}'
+  ac_vpsub='/^[        ]*VPATH[        ]*=[^:]*$/d'
 fi
 
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
-  # 1. Remove the extension, and $U if already installed.
-  ac_i=`echo "$ac_i" |
-         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
-  # 2. Add them.
-  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
 
+DEFS=-DHAVE_CONFIG_H
 
+# Without the "./", some shells look in PATH for config.status.
 : ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
 # Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
 # Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
-fi
-
-# Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
+# configure, is in ./config.log if it exists.
 
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
 do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    $as_unset $as_var
-  fi
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
 done
 
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
-  as_expr=expr
-else
-  as_expr=false
-fi
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile \
+          mm/Makefile \
+         toolbox/Makefile \
+         threads/Makefile \
+         jit/Makefile \
+          jit/loop/Makefile \
+          jit/alpha/Makefile \
+          jit/i386/Makefile \
+          jit/mips/Makefile \
+          jit/powerpc/Makefile \
+          jit/x86_64/Makefile \
+          nat/Makefile \
+          doc/Makefile \
+         tst/Makefile \
+         tst/kaffe/Makefile \
+         jvmtst/Makefile  config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@COMPILER_OBJECTS@%$COMPILER_OBJECTS%g
+s%@ARCH_DIR@%$ARCH_DIR%g
+s%@CC@%$CC%g
+s%@RANLIB@%$RANLIB%g
+s%@CPP@%$CPP%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@LIBTHREAD@%$LIBTHREAD%g
+s%@THREAD_OBJ@%$THREAD_OBJ%g
+s%@subdirs@%$subdirs%g
 
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)$' \| \
-        .     : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-         /^X\/\(\/\/\)$/{ s//\1/; q; }
-         /^X\/\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
   else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  case $0 in
-    *[\\/]* ) as_myself=$0 ;;
-    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
-       ;;
-  esac
-  # We did not find ourselves, most probably we were run as `sh COMMAND'
-  # in which case we are not to be found in the path.
-  if test "x$as_myself" = x; then
-    as_myself=$0
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
   fi
-  if test ! -f "$as_myself"; then
-    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
-   { (exit 1); exit 1; }; }
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
   fi
-  case $CONFIG_SHELL in
-  '')
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-        case $as_dir in
-        /*)
-          if ("$as_dir/$as_base" -c '
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-          fi;;
-        esac
-       done
 done
-;;
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile \
+          mm/Makefile \
+         toolbox/Makefile \
+         threads/Makefile \
+         jit/Makefile \
+          jit/loop/Makefile \
+          jit/alpha/Makefile \
+          jit/i386/Makefile \
+          jit/mips/Makefile \
+          jit/powerpc/Makefile \
+          jit/x86_64/Makefile \
+          nat/Makefile \
+          doc/Makefile \
+         tst/Makefile \
+         tst/kaffe/Makefile \
+         jvmtst/Makefile "}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
   esac
 
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
-    sed '
-      N
-      s,$,-,
-      : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
-      t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
-    ' >$as_me.lineno &&
-  chmod +x $as_me.lineno ||
-    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensible to this).
-  . ./$as_me.lineno
-  # Exit status is that of the last command.
-  exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='     ' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
 
-if expr a : '\(a\)' >/dev/null 2>&1; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conf$$.exe; then
-    # Don't use ln at all; we don't have any links
-    as_ln_s='cp -p'
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
   else
-    as_ln_s='ln -s'
+    ac_dir_suffix= ac_dots=
   fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
-
 
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS="  $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.  Logging --version etc. is OK.
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by $as_me, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
-
-  CONFIG_FILES    = $CONFIG_FILES
-  CONFIG_HEADERS  = $CONFIG_HEADERS
-  CONFIG_LINKS    = $CONFIG_LINKS
-  CONFIG_COMMANDS = $CONFIG_COMMANDS
-  $ $0 $@
-
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-_ACEOF
-
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
-  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
-  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
-  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
-  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
-  -h, --help       print this help, then exit
-  -V, --version    print version number, then exit
-  -q, --quiet      do not print progress messages
-  -d, --debug      don't remove temporary files
-      --recheck    update $as_me by reconfiguring in the same conditions
-  --file=FILE[:TEMPLATE]
-                   instantiate the configuration file FILE
-  --header=FILE[:TEMPLATE]
-                   instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Configuration commands:
-$config_commands
-
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-config.status
-configured by $0, generated by GNU Autoconf 2.57,
-  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-INSTALL="$INSTALL"
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value.  By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
-  case $1 in
-  --*=*)
-    ac_option=`expr "x$1" : 'x\([^=]*\)='`
-    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
-    ac_shift=:
-    ;;
-  -*)
-    ac_option=$1
-    ac_optarg=$2
-    ac_shift=shift
-    ;;
-  *) # This is not an option, so the user has probably given explicit
-     # arguments.
-     ac_option=$1
-     ac_need_defaults=false;;
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
   esac
 
-  case $ac_option in
-  # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    ac_cs_recheck=: ;;
-  --version | --vers* | -V )
-    echo "$ac_cs_version"; exit 0 ;;
-  --he | --h)
-    # Conflict between --help and --header
-    { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
-   { (exit 1); exit 1; }; };;
-  --help | --hel | -h )
-    echo "$ac_cs_usage"; exit 0 ;;
-  --debug | --d* | -d )
-    debug=: ;;
-  --file | --fil | --fi | --f )
-    $ac_shift
-    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
-    ac_need_defaults=false;;
-  --header | --heade | --head | --hea )
-    $ac_shift
-    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
-    ac_need_defaults=false;;
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil | --si | --s)
-    ac_cs_silent=: ;;
-
-  # This is an error.
-  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
-   { (exit 1); exit 1; }; } ;;
-
-  *) ac_config_targets="$ac_config_targets $1" ;;
-
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
   esac
-  shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
-  exec 6>/dev/null
-  ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
 
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
-  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
 
-_ACEOF
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
 
-cat >>$CONFIG_STATUS <<_ACEOF
-#
-# INIT-COMMANDS section.
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
 #
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([  ]*\)#\([        ]*define[       ][      ]*\)'
+ac_dB='\([     ][      ]*\)[^  ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_uB='\([     ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
 
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
 
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[   ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
 
-_ACEOF
-
-
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_config_target in $ac_config_targets
+rm -f conftest.tail
+while :
 do
-  case "$ac_config_target" in
-  # Handling of arguments.
-  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-  "toolbox/Makefile" ) CONFIG_FILES="$CONFIG_FILES toolbox/Makefile" ;;
-  "mm/Makefile" ) CONFIG_FILES="$CONFIG_FILES mm/Makefile" ;;
-  "threads/Makefile" ) CONFIG_FILES="$CONFIG_FILES threads/Makefile" ;;
-  "jit/Makefile" ) CONFIG_FILES="$CONFIG_FILES jit/Makefile" ;;
-  "alpha/Makefile" ) CONFIG_FILES="$CONFIG_FILES alpha/Makefile" ;;
-  "mips/Makefile" ) CONFIG_FILES="$CONFIG_FILES mips/Makefile" ;;
-  "i386/Makefile" ) CONFIG_FILES="$CONFIG_FILES i386/Makefile" ;;
-  "x86_64/Makefile" ) CONFIG_FILES="$CONFIG_FILES x86_64/Makefile" ;;
-  "powerpc/Makefile" ) CONFIG_FILES="$CONFIG_FILES powerpc/Makefile" ;;
-  "nat/Makefile" ) CONFIG_FILES="$CONFIG_FILES nat/Makefile" ;;
-  "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
-  "narray/Makefile" ) CONFIG_FILES="$CONFIG_FILES narray/Makefile" ;;
-  "tst/Makefile" ) CONFIG_FILES="$CONFIG_FILES tst/Makefile" ;;
-  "tst/kaffe/Makefile" ) CONFIG_FILES="$CONFIG_FILES tst/kaffe/Makefile" ;;
-  "jvmtst/Makefile" ) CONFIG_FILES="$CONFIG_FILES jvmtst/Makefile" ;;
-  "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
-  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
-  esac
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
 done
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used.  Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
-  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-fi
-
-# Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
-$debug ||
-{
-  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-
-# Create a (secure) tmp directory for tmp files.
-
-{
-  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
-}  ||
-{
-  tmp=./confstat$$-$RANDOM
-  (umask 077 && mkdir $tmp)
-} ||
-{
-   echo "$me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
-#
-# CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
-  # Protect against being on the right side of a sed subst in config.status.
-  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
-   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
-s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
-s,@INSTALL_DATA@,$INSTALL_DATA,;t t
-s,@PACKAGE@,$PACKAGE,;t t
-s,@VERSION@,$VERSION,;t t
-s,@ACLOCAL@,$ACLOCAL,;t t
-s,@AUTOCONF@,$AUTOCONF,;t t
-s,@AUTOMAKE@,$AUTOMAKE,;t t
-s,@AUTOHEADER@,$AUTOHEADER,;t t
-s,@MAKEINFO@,$MAKEINFO,;t t
-s,@SET_MAKE@,$SET_MAKE,;t t
-s,@COMPILER_OBJECTS@,$COMPILER_OBJECTS,;t t
-s,@ASMPART@,$ASMPART,;t t
-s,@SYSDEP_DIR@,$SYSDEP_DIR,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LIBTHREAD@,$LIBTHREAD,;t t
-s,@THREAD_OBJ@,$THREAD_OBJ,;t t
-s,@GC_OBJ@,$GC_OBJ,;t t
-s,@BOEHM_LIB@,$BOEHM_LIB,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
-  cat >>$CONFIG_STATUS <<\_ACEOF
-  # Split the substitutions into bite-sized pieces for seds with
-  # small command number limits, like on Digital OSF/1 and HP-UX.
-  ac_max_sed_lines=48
-  ac_sed_frag=1 # Number of current file.
-  ac_beg=1 # First line for current file.
-  ac_end=$ac_max_sed_lines # Line after last line for current file.
-  ac_more_lines=:
-  ac_sed_cmds=
-  while $ac_more_lines; do
-    if test $ac_beg -gt 1; then
-      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-    else
-      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-    fi
-    if test ! -s $tmp/subs.frag; then
-      ac_more_lines=false
-    else
-      # The purpose of the label and of the branching condition is to
-      # speed up the sed processing (if there are no `@' at all, there
-      # is no need to browse any of the substitutions).
-      # These are the two extra sed commands mentioned above.
-      (echo ':t
-  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
-      if test -z "$ac_sed_cmds"; then
-       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
-      else
-       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
-      fi
-      ac_sed_frag=`expr $ac_sed_frag + 1`
-      ac_beg=$ac_end
-      ac_end=`expr $ac_end + $ac_max_sed_lines`
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
     fi
-  done
-  if test -z "$ac_sed_cmds"; then
-    ac_sed_cmds=cat
+    rm -f $ac_file
+    mv conftest.h $ac_file
   fi
-fi # test -n "$CONFIG_FILES"
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case $ac_file in
-  - | *:- | *:-:* ) # input from stdin
-        cat >$tmp/stdin
-        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  * )   ac_file_in=$ac_file.in ;;
-  esac
+fi; done
 
-  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
-  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$ac_file" : 'X\(//\)[^/]' \| \
-         X"$ac_file" : 'X\(//\)$' \| \
-         X"$ac_file" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-  { if $as_mkdir_p; then
-    mkdir -p "$ac_dir"
-  else
-    as_dir="$ac_dir"
-    as_dirs=
-    while test ! -d "$as_dir"; do
-      as_dirs="$as_dir $as_dirs"
-      as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$as_dir" : 'X\(//\)[^/]' \| \
-         X"$as_dir" : 'X\(//\)$' \| \
-         X"$as_dir" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-    done
-    test ! -n "$as_dirs" || mkdir $as_dirs
-  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
-   { (exit 1); exit 1; }; }; }
-
-  ac_builddir=.
-
-if test "$ac_dir" != .; then
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+EOF
+cat >> $CONFIG_STATUS <<EOF
 
-case $srcdir in
-  .)  # No --srcdir option.  We are building in place.
-    ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
 
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
 
-  case $INSTALL in
-  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
-  esac
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+if test "$no_recursion" != yes; then
+
+  # Remove --cache-file and --srcdir arguments so they do not pile up.
+  ac_sub_configure_args=
+  ac_prev=
+  for ac_arg in $ac_configure_args; do
+    if test -n "$ac_prev"; then
+      ac_prev=
+      continue
+    fi
+    case "$ac_arg" in
+    -cache-file | --cache-file | --cache-fil | --cache-fi \
+    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+      ac_prev=cache_file ;;
+    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+      ;;
+    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+      ac_prev=srcdir ;;
+    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+      ;;
+    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+    esac
+  done
 
-  if test x"$ac_file" != x-; then
-    { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    rm -f "$ac_file"
-  fi
-  # Let's still pretend it is `configure' which instantiates (i.e., don't
-  # use $as_me), people would be surprised to read:
-  #    /* config.h.  Generated by config.status.  */
-  if test x"$ac_file" = x-; then
-    configure_input=
-  else
-    configure_input="$ac_file.  "
-  fi
-  configure_input=$configure_input"Generated from `echo $ac_file_in |
-                                     sed 's,.*/,,'` by configure."
-
-  # First look for the input files in the build tree, otherwise in the
-  # src tree.
-  ac_file_inputs=`IFS=:
-    for f in $ac_file_in; do
-      case $f in
-      -) echo $tmp/stdin ;;
-      [\\/$]*)
-         # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-         echo $f;;
-      *) # Relative
-         if test -f "$f"; then
-           # Build tree
-           echo $f
-         elif test -f "$srcdir/$f"; then
-           # Source tree
-           echo $srcdir/$f
-         else
-           # /dev/null tree
-           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-         fi;;
-      esac
-    done` || { (exit 1); exit 1; }
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-  sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-s,@INSTALL@,$ac_INSTALL,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
-  rm -f $tmp/stdin
-  if test x"$ac_file" != x-; then
-    mv $tmp/out $ac_file
-  else
-    cat $tmp/out
-    rm -f $tmp/out
-  fi
+  for ac_config_dir in mm/boehm-gc; do
 
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+    # Do not complain, so a configure script can configure whichever
+    # parts of a large source tree are present.
+    if test ! -d $srcdir/$ac_config_dir; then
+      continue
+    fi
 
-#
-# CONFIG_HEADER section.
-#
+    echo configuring in $ac_config_dir
 
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([  ]*\)#\([        ]*define[       ][      ]*\)'
-ac_dB='[       ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
+    case "$srcdir" in
+    .) ;;
+    *)
+      if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
+      else
+        { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
+      fi
+      ;;
+    esac
 
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case $ac_file in
-  - | *:- | *:-:* ) # input from stdin
-        cat >$tmp/stdin
-        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  * )   ac_file_in=$ac_file.in ;;
-  esac
+    ac_popdir=`pwd`
+    cd $ac_config_dir
 
-  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
-  # First look for the input files in the build tree, otherwise in the
-  # src tree.
-  ac_file_inputs=`IFS=:
-    for f in $ac_file_in; do
-      case $f in
-      -) echo $tmp/stdin ;;
-      [\\/$]*)
-         # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-         echo $f;;
-      *) # Relative
-         if test -f "$f"; then
-           # Build tree
-           echo $f
-         elif test -f "$srcdir/$f"; then
-           # Source tree
-           echo $srcdir/$f
-         else
-           # /dev/null tree
-           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-         fi;;
-      esac
-    done` || { (exit 1); exit 1; }
-  # Remove the trailing spaces.
-  sed 's/[     ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h.  The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status.  Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[   ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[   ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless.  Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
+      # A "../" for each directory in /$ac_config_dir.
+      ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
 
-# This sed command replaces #undef with comments.  This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[   ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo '  if grep "^[    ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo '  :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
-do
-  # Write a limited-size here document to $tmp/defines.sed.
-  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
-  # Speed up: don't consider the non `#define' lines.
-  echo '/^[    ]*#[    ]*define/!b' >>$CONFIG_STATUS
-  # Work around the forget-to-reset-the-flag bug.
-  echo 't clr' >>$CONFIG_STATUS
-  echo ': clr' >>$CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
-  echo 'CEOF
-  sed -f $tmp/defines.sed $tmp/in >$tmp/out
-  rm -f $tmp/in
-  mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
-  rm -f conftest.defines
-  mv conftest.tail conftest.defines
-done
-rm -f conftest.defines
-echo '  fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
+    case "$srcdir" in
+    .) # No --srcdir option.  We are building in place.
+      ac_sub_srcdir=$srcdir ;;
+    /*) # Absolute path.
+      ac_sub_srcdir=$srcdir/$ac_config_dir ;;
+    *) # Relative path.
+      ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
+    esac
 
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
-  # Write a limited-size here document to $tmp/undefs.sed.
-  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
-  # Speed up: don't consider the non `#undef'
-  echo '/^[    ]*#[    ]*undef/!b' >>$CONFIG_STATUS
-  # Work around the forget-to-reset-the-flag bug.
-  echo 't clr' >>$CONFIG_STATUS
-  echo ': clr' >>$CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
-  echo 'CEOF
-  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
-  rm -f $tmp/in
-  mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
-  rm -f conftest.undefs
-  mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-  # Let's still pretend it is `configure' which instantiates (i.e., don't
-  # use $as_me), people would be surprised to read:
-  #    /* config.h.  Generated by config.status.  */
-  if test x"$ac_file" = x-; then
-    echo "/* Generated by configure.  */" >$tmp/config.h
-  else
-    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
-  fi
-  cat $tmp/in >>$tmp/config.h
-  rm -f $tmp/in
-  if test x"$ac_file" != x-; then
-    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
-      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_sub_srcdir/configure; then
+      ac_sub_configure=$ac_sub_srcdir/configure
+    elif test -f $ac_sub_srcdir/configure.in; then
+      ac_sub_configure=$ac_configure
     else
-      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$ac_file" : 'X\(//\)[^/]' \| \
-         X"$ac_file" : 'X\(//\)$' \| \
-         X"$ac_file" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-      { if $as_mkdir_p; then
-    mkdir -p "$ac_dir"
-  else
-    as_dir="$ac_dir"
-    as_dirs=
-    while test ! -d "$as_dir"; do
-      as_dirs="$as_dir $as_dirs"
-      as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$as_dir" : 'X\(//\)[^/]' \| \
-         X"$as_dir" : 'X\(//\)$' \| \
-         X"$as_dir" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-    done
-    test ! -n "$as_dirs" || mkdir $as_dirs
-  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
-   { (exit 1); exit 1; }; }; }
-
-      rm -f $ac_file
-      mv $tmp/config.h $ac_file
+      echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
+      ac_sub_configure=
     fi
-  else
-    cat $tmp/config.h
-    rm -f $tmp/config.h
-  fi
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
 
-#
-# CONFIG_COMMANDS section.
-#
-for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
-  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
-  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
-  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
-$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$ac_dest" : 'X\(//\)[^/]' \| \
-         X"$ac_dest" : 'X\(//\)$' \| \
-         X"$ac_dest" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$ac_dest" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-  ac_builddir=.
-
-if test "$ac_dir" != .; then
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+    # The recursion is here.
+    if test -n "$ac_sub_configure"; then
 
-case $srcdir in
-  .)  # No --srcdir option.  We are building in place.
-    ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
-
-
-  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
-echo "$as_me: executing $ac_dest commands" >&6;}
-  case $ac_dest in
-    default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;;
-  esac
-done
-_ACEOF
+      # Make the cache file name correct relative to the subdirectory.
+      case "$cache_file" in
+      /*) ac_sub_cache_file=$cache_file ;;
+      *) # Relative path.
+        ac_sub_cache_file="$ac_dots$cache_file" ;;
+      esac
+  case "$ac_given_INSTALL" in
+        [/$]*) INSTALL="$ac_given_INSTALL" ;;
+        *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+        esac
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+      echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
+      # The eval makes quoting arguments work.
+      if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+      then :
+      else
+        { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
+      fi
+    fi
 
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded.  So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status.  When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
-  ac_cs_success=:
-  ac_config_status_args=
-  test "$silent" = yes &&
-    ac_config_status_args="$ac_config_status_args --quiet"
-  exec 5>/dev/null
-  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
-  exec 5>>config.log
-  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
-  # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
+    cd "$ac_popdir"
+  done
 fi
 
index e7e3cf926abfe9bd5d26bc7a59a27d2cbcc942f5..ba484df7237eafc8f07f908c0c98376d19751fb8 100644 (file)
@@ -1,7 +1,7 @@
 dnl autoconf; autoheader; automake
 
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(jit.c)
+AC_INIT(main.c)
 AC_CANONICAL_HOST
 
 AM_INIT_AUTOMAKE(cacao, 0.40)
@@ -11,58 +11,50 @@ AC_PREFIX_DEFAULT(/usr/local/cacao)
 
 dnl system type
 
-ASMPART="asmpart.S"
 case "$host_cpu" in
 alpha* )
-       SYSDEP_DIR="alpha"
+       ARCH_DIR="alpha"
        CFLAGS="-mieee -O0 -g3 -D__ALPHA__"
-       COMPILER_OBJECTS=""
        AC_DEFINE(TRACE_ARGS_NUM, 6)
        AC_DEFINE(USE_CODEMMAP)
        ;;
 
+i386* | i486* | i586* | i686* )
+       ARCH_DIR="i386"
+       CFLAGS="-Wall -O0 -g3 -D__I386__"
+       AC_DEFINE(TRACE_ARGS_NUM, 8)
+       AC_DEFINE(USE_CODEMMAP)
+       ;;
+
 mips* )
-       SYSDEP_DIR="mips"
-       ASMPART="asmpart.s"
+       ARCH_DIR="mips"
         CFLAGS="-64 -O2 -OPT:Olimit=0 -g -DMAP_ANONYMOUS=0 -woff 1110,1164,1515 -D__MIPS__"
        LIBS="-lelfutil"
-       COMPILER_OBJECTS=""
        AC_DEFINE(TRACE_ARGS_NUM, 8)
        ;;
 
-i386* | i486* | i586* | i686* )
-       SYSDEP_DIR="i386"
-       CFLAGS="-O0 -g3 -D__I386__"
-       COMPILER_OBJECTS="i386/libdisass.a"
+powerpc* | ppc* )
+       ARCH_DIR="powerpc"
+       CFLAGS="-O2 -g -DMAP_ANONYMOUS=0 -no-cpp-precomp"
        AC_DEFINE(TRACE_ARGS_NUM, 8)
-       AC_DEFINE(USE_CODEMMAP)
        ;;
 
 x86_64* )
-       SYSDEP_DIR="x86_64"
+       ARCH_DIR="x86_64"
        CFLAGS="-O0 -g3 -D__X86_64__"
-       COMPILER_OBJECTS="x86_64/libdisass.a"
        AC_DEFINE(TRACE_ARGS_NUM, 6)
        AC_DEFINE(USE_CODEMMAP)
        ;;
 
-powerpc* | ppc* )
-       SYSDEP_DIR="powerpc"
-       CFLAGS="-O2 -g -DMAP_ANONYMOUS=0 -no-cpp-precomp"
-       COMPILER_OBJECTS="powerpc/libdisass.a"
-       AC_DEFINE(TRACE_ARGS_NUM, 8)
-       ;;
-
 sparc* | * )
        AC_MSG_ERROR($host_cpu systems are not supported at this time)
         ;;
 esac
 
 AC_SUBST(COMPILER_OBJECTS)
-AC_SUBST(ASMPART)
 
-AC_DEFINE_UNQUOTED(SYSDEP_DIR, "$SYSDEP_DIR")
-AC_SUBST(SYSDEP_DIR)
+AC_DEFINE_UNQUOTED(ARCH_DIR, "$ARCH_DIR")
+AC_SUBST(ARCH_DIR)
 
 dnl Checks for programs.
 AC_PROG_CC
@@ -157,14 +149,14 @@ AC_OUTPUT(Makefile \
          toolbox/Makefile \
          threads/Makefile \
          jit/Makefile \
-          alpha/Makefile \
-          mips/Makefile \
-          i386/Makefile \
-          x86_64/Makefile \
-          powerpc/Makefile \
+          jit/loop/Makefile \
+          jit/alpha/Makefile \
+          jit/i386/Makefile \
+          jit/mips/Makefile \
+          jit/powerpc/Makefile \
+          jit/x86_64/Makefile \
           nat/Makefile \
           doc/Makefile \
-         narray/Makefile \
          tst/Makefile \
          tst/kaffe/Makefile \
          jvmtst/Makefile )
index 40db75667a913b2e3773f362e3ac7e086f165151..c72293e512a8f2867325749e1848f2d9429cf0e3 100644 (file)
--- a/global.h
+++ b/global.h
@@ -1,25 +1,47 @@
-/* global.h ********************************************************************
+/* global.h - global definitions
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains global definitions which are used in the whole program, includes
-       some files and contains global used macros.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl              EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall   (andi)     EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Mark     Probst  (schani)   EMAIL: cacao@complang.tuwien.ac.at
-                        Philipp  Tomsich (phil)     EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: $Id: global.h 548 2003-11-01 19:46:25Z twisti $
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas Krall
+
+   Changes: Mark Probst
+            Philipp Tomsich
 
-#ifndef __global_h_
-#define __global_h_
+   $Id: global.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _GLOBAL_H
+#define _GLOBAL_H
 
 #include "config.h"
+#include "types.h"
+#include "toolbox/list.h"
+
 
 #define _GNU_SOURCE
 
  */
 #define SIZE_FROM_CLASSINFO
 
-/* standard includes **********************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "toolbox/memory.h"
-#include "toolbox/chain.h"
-#include "toolbox/list.h"
-#include "toolbox/loging.h"
-
-/* system dependent types *****************************************************/
-
-#include "types.h"
-
 
 /* additional data types ******************************************************/
 
@@ -209,6 +215,7 @@ struct utf {
        char       *text;           /* pointer to text                            */
 };
 
+
 /* data structure of internal javastrings stored in global hashtable **********/
 
 struct literalstring {
@@ -216,14 +223,16 @@ struct literalstring {
        java_objectheader *string;  
 };
 
+
 /* data structure for accessing hashtables ************************************/
 
 typedef struct {            
-  u4 size;
-  u4 entries;        /* number of entries in the table */
-  void **ptr;        /* pointer to hashtable */
+       u4 size;
+       u4 entries;        /* number of entries in the table */
+       void **ptr;        /* pointer to hashtable */
 } hashtable;
 
+
 /* data structures of remaining constant pool entries *************************/
 
 typedef struct {                /* Fieldref, Methodref and InterfaceMethodref     */
@@ -232,32 +241,39 @@ typedef struct {                /* Fieldref, Methodref and InterfaceMethodref
        utf       *descriptor;  /* field/method/interface type descriptor string  */
 } constant_FMIref;
 
+
 typedef struct {            /* Integer                                        */
        s4 value;
 } constant_integer;
+
        
 typedef struct {            /* Float                                          */
        float value;
 } constant_float;
 
+
 typedef struct {            /* Long                                           */
        s8 value;
 } constant_long;
        
+
 typedef struct {            /* Double                                         */
        double value;
 } constant_double;
 
+
 typedef struct {            /* NameAndType (Field or Method)                  */
        utf *name;              /* field/method name                              */
        utf *descriptor;        /* field/method type descriptor string            */
 } constant_nameandtype;
 
-/*  arraydescriptor describes array types. Basic array types contain their
-       type in the arraytype field, objectclass contains a class pointer for
-       arrays of objects (arraytype == ARRAYTYPE_OBJECT), elementdescriptor
-       contains a pointer to an arraydescriptor which describes the element
-       types in the case of arrays of arrays (arraytype == ARRAYTYPE_ARRAY).
+
+/* 
+   arraydescriptor describes array types. Basic array types contain their
+   type in the arraytype field, objectclass contains a class pointer for
+   arrays of objects (arraytype == ARRAYTYPE_OBJECT), elementdescriptor
+   contains a pointer to an arraydescriptor which describes the element
+   types in the case of arrays of arrays (arraytype == ARRAYTYPE_ARRAY).
 */
 
 typedef struct constant_arraydescriptor {
@@ -266,7 +282,6 @@ typedef struct constant_arraydescriptor {
        struct constant_arraydescriptor *elementdescriptor;
 } constant_arraydescriptor;
 
-#include "jit/sets.h"
 
 /* data structures of the runtime system **************************************/
 
@@ -383,22 +398,26 @@ typedef struct primitivetypeinfo {
        char *name;                          /* name of primitive class           */
 } primitivetypeinfo;
 
+
 /* field, method and class structures *****************************************/
 
+#include "sets.h"
 typedef        struct xtafldinfo {
-               bool       fieldChecked;                
-               classinfo *fldClassType;
-               classSet  *XTAclassSet;      /* field class type set                  */  
-               } xtafldinfo;
+       bool       fieldChecked;                
+       classinfo *fldClassType;
+       classSet  *XTAclassSet;          /* field class type set                  */
+} xtafldinfo;
+
+
 /* fieldinfo ******************************************************************/
 
 struct fieldinfo {           /* field of a class                                 */
-       s4       flags;       /* ACC flags                                        */
-       s4       type;        /* basic data type                                  */
+       s4  flags;            /* ACC flags                                        */
+       s4  type;             /* basic data type                                  */
        utf *name;            /* name of field                                    */
        utf *descriptor;      /* JavaVM descriptor string of field                */
        
-       s4       offset;      /* offset from start of object (instance variables) */
+       s4  offset;           /* offset from start of object (instance variables) */
 
        union {               /* storage for static values (class variables)      */
                s4 i; 
@@ -409,8 +428,7 @@ struct fieldinfo {        /* field of a class                                 */
        } value;
        
        xtafldinfo *xta;
-
-} ;
+};
 
 struct basicblock;
 
@@ -701,7 +719,7 @@ extern int count_utf_new_found;
 
 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
 
-#endif
+#endif /* _GLOBAL_H */
 
 
 /*
index a56f63d246113e5ab5690849d6eb4861e2edcfda..fc0d43f1117601c8c37cefc772b6ea38227674a1 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -1,30 +1,47 @@
-/* headers.c *******************************************************************
+/* headers.c - main for header generation (cacaoh)
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       This module replaces 'main' for header file generation. It also fakes some
-       references to external modules which would otherwise depend on the header
-       files generated by this very program.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       This module is quite a quick hack and not documented very well as a
-       consequence.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-       Last Change: $Id: headers.c 542 2003-10-30 20:58:18Z twisti $
+   Contact: cacao@complang.tuwien.ac.at
 
-*******************************************************************************/
+   Authors: Reinhard Grafl
 
-#define CACAOH
+   Changes: Mark Probst
+            Philipp Tomsich
 
-#include "config.h" /* phil */
+   $Id: headers.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdlib.h>
+#include "config.h"
 #include "global.h"
 #include "tables.h"
 #include "loader.h"
+#include "toolbox/chain.h"
+#include "toolbox/memory.h"
+#include "toolbox/loging.h"
 
 
 /******* replace some external functions  *********/
@@ -100,12 +117,12 @@ static bool dopadding;
 
 static void printIDpart (int c) 
 {
-               if (     (c>='a' && c<='z')
-                     || (c>='A' && c<='Z')
-                     || (c>='0' && c<='9')
-                     || (c=='_') )          
-                          putc (c,file);
-        else       putc ('_',file);
+       if (     (c>='a' && c<='z')
+                        || (c>='A' && c<='Z')
+                        || (c>='0' && c<='9')
+                        || (c=='_') )          
+               putc (c,file);
+       else       putc ('_',file);
 
 }
 
@@ -135,57 +152,57 @@ static char *printtype (char *utf_ptr)
        u2 c;
 
        switch (utf_nextu2(&utf_ptr)) {
-               case 'V': fprintf (file, "void");
-                         break;
-               case 'I':
-               case 'S':
-               case 'B':
-               case 'C':
-               case 'Z': addoutputsize (4);
-                  fprintf (file, "s4");
-                  break;
-               case 'J': addoutputsize (8);
-                  fprintf (file, "s8");
-                  break;
-               case 'F': addoutputsize (4);
-                  fprintf (file, "float");
-                  break;
-               case 'D': addoutputsize (8);
-                  fprintf (file, "double");
-                  break;
-               case '[':
-                       addoutputsize ( sizeof(java_arrayheader*) ); 
-                       switch (utf_nextu2(&utf_ptr)) {
-                               case 'I':  fprintf (file, "java_intarray*"); break;
-                               case 'J':  fprintf (file, "java_longarray*"); break;
-                               case 'Z':  fprintf (file, "java_booleanarray*"); break;
-                               case 'B':  fprintf (file, "java_bytearray*"); break;
-                               case 'S':  fprintf (file, "java_shortarray*"); break;
-                               case 'C':  fprintf (file, "java_chararray*"); break;
-                               case 'F':  fprintf (file, "java_floatarray*"); break;
-                               case 'D':  fprintf (file, "java_doublearray*"); break;
+       case 'V': fprintf (file, "void");
+               break;
+       case 'I':
+       case 'S':
+       case 'B':
+       case 'C':
+       case 'Z': addoutputsize (4);
+               fprintf (file, "s4");
+               break;
+       case 'J': addoutputsize (8);
+               fprintf (file, "s8");
+               break;
+       case 'F': addoutputsize (4);
+               fprintf (file, "float");
+               break;
+       case 'D': addoutputsize (8);
+               fprintf (file, "double");
+               break;
+       case '[':
+               addoutputsize ( sizeof(java_arrayheader*) ); 
+               switch (utf_nextu2(&utf_ptr)) {
+               case 'I':  fprintf (file, "java_intarray*"); break;
+               case 'J':  fprintf (file, "java_longarray*"); break;
+               case 'Z':  fprintf (file, "java_booleanarray*"); break;
+               case 'B':  fprintf (file, "java_bytearray*"); break;
+               case 'S':  fprintf (file, "java_shortarray*"); break;
+               case 'C':  fprintf (file, "java_chararray*"); break;
+               case 'F':  fprintf (file, "java_floatarray*"); break;
+               case 'D':  fprintf (file, "java_doublearray*"); break;
                                
-                               case '[':  fprintf (file, "java_arrayarray*");                                         
-                                          while ((c = utf_nextu2(&utf_ptr)) == '[') ;
-                                          if (c=='L') 
-                                                          while (utf_nextu2(&utf_ptr) != ';');
-                           break;
+               case '[':  fprintf (file, "java_arrayarray*");                                         
+                       while ((c = utf_nextu2(&utf_ptr)) == '[') ;
+                       if (c=='L') 
+                               while (utf_nextu2(&utf_ptr) != ';');
+                       break;
                            
-                               case 'L':  fprintf (file, "java_objectarray*");
-                                          while ( utf_nextu2(&utf_ptr) != ';');
-                                          break;
-                               default: panic ("invalid type descriptor");
-                               }
+               case 'L':  fprintf (file, "java_objectarray*");
+                       while ( utf_nextu2(&utf_ptr) != ';');
                        break;
+               default: panic ("invalid type descriptor");
+               }
+               break;
                
-               case 'L': 
-                       addoutputsize ( sizeof(java_objectheader*));
-            fprintf (file, "struct ");
-            while ( (c = utf_nextu2(&utf_ptr)) != ';' ) printIDpart (c);        
-            fprintf (file, "*");
-                       break;
+       case 'L': 
+               addoutputsize ( sizeof(java_objectheader*));
+               fprintf (file, "struct ");
+               while ( (c = utf_nextu2(&utf_ptr)) != ';' ) printIDpart (c);     
+               fprintf (file, "*");
+               break;
                                        
-               default:  panic ("Unknown type in field descriptor");
+       default:  panic ("Unknown type in field descriptor");
        }
        
        return utf_ptr;
@@ -218,7 +235,7 @@ static void printfields (classinfo *c)
                addoutputsize ( sizeof(java_objectheader) );
                fprintf (file, "   java_objectheader header;\n");
                return;
-               }
+       }
                
        printfields (c->super);
        
@@ -237,8 +254,8 @@ static void printfields (classinfo *c)
                        chain_addlast(ident_chain,f->name);     
 
                        fprintf (file, ";\n");
-                       }
                }
+       }
 }
 
 /***************** store prototype for native method in file ******************/
@@ -285,7 +302,7 @@ static void printmethod (methodinfo *m)
                printID (m->class->name);
                fprintf (file, "* this ");
 
-           };
+       };
 
        if ((*utf_ptr)!=')') fprintf (file, ", "); 
                        
@@ -293,7 +310,7 @@ static void printmethod (methodinfo *m)
                utf_ptr = printtype (utf_ptr);
                fprintf (file, " par%d", paramnum++);
                if ((*utf_ptr)!=')') fprintf (file, ", ");
-               }
+       }
                        
        fprintf (file, ");\n");
 }
@@ -303,22 +320,22 @@ static void printmethod (methodinfo *m)
 
 static void simple_classname(char *buffer, utf *u)
 {
-  int i, simplename_start;
+       int i, simplename_start;
 
-  for (i=utf_strlen(u)-1; i>=0; i--) { 
+       for (i=utf_strlen(u)-1; i>=0; i--) { 
 
-       if (u->text[i] == '$') u->text[i] = '_'; else /* convert '$' to '_' */
-    if (u->text[i] == '/') {
-       /* beginning of simple name */
-        simplename_start = i+1;
-               break;
+               if (u->text[i] == '$') u->text[i] = '_'; else /* convert '$' to '_' */
+                       if (u->text[i] == '/') {
+                               /* beginning of simple name */
+                               simplename_start = i+1;
+                               break;
+                       }
        }
-  }
 
-  for (i=simplename_start; i < utf_strlen(u); i++) 
-                 buffer[i-simplename_start] = u->text[i];
+       for (i=simplename_start; i < utf_strlen(u); i++) 
+               buffer[i-simplename_start] = u->text[i];
 
-  buffer[i-simplename_start] = '\0';                
+       buffer[i-simplename_start] = '\0';                
 }
 
 /*********** create headerfile for classes and store native methods in chain ************/
@@ -370,9 +387,9 @@ static void headerfile_generate (classinfo *c)
 
                if (m->flags & ACC_NATIVE) {
                        chain_addlast (nativemethod_chain, m);     
-                       printmethod(m);                                             
-                       }                                                       
-               }
+                       printmethod(m);                                             
+               }                                                       
+       }
                                
 
        chain_free(ident_chain);                                 
@@ -409,7 +426,7 @@ static void printnativetableentry (methodinfo *m)
        utf_fprint (file, m->descriptor);
        fprintf (file, "\",\n     ");
        if ( (m->flags & ACC_STATIC) !=0)  fprintf (file, "true");
-                                     else fprintf (file, "false");
+       else fprintf (file, "false");
        fprintf (file, ",\n     ");
        fprintf (file, "(functionptr) Java_");
        printID (m->class->name);
@@ -478,7 +495,7 @@ Prints usage information for the JAVA header generator to stdout.
 
 static void print_usage()
 {
-       printf ("USAGE: jch class [class..]\n");
+       printf("Usage: cacaoh class [class..]\n");
 }   
 
 
@@ -497,95 +514,94 @@ int main(int argc, char **argv)
        void *dummy;
                
 
-   /********** internal (only used by main) *****************************/
+       /********** internal (only used by main) *****************************/
    
        char classpath[500] = "";
        char offsets_filename[1024] = ""; /* phil */
        u4 heapsize = 100000;
 
-   /*********** options so only headers are generated *******************/
+       /*********** options so only headers are generated *******************/
    
-   makeinitializations=false;
+       makeinitializations=false;
    
 
-   /************ Collect some info from the environment *****************/
+       /************ Collect some info from the environment *****************/
 
-       cp = getenv ("CLASSPATH");
+       cp = getenv("CLASSPATH");
        if (cp) {
-               strcpy (classpath + strlen(classpath), ":");
-               strcpy (classpath + strlen(classpath), cp);
-               }
+               strcpy(classpath + strlen(classpath), ":");
+               strcpy(classpath + strlen(classpath), cp);
+       }
 
        if (argc < 2) {
-               print_usage ();
+               print_usage();
                exit(10);
-               }
+       }
 
 
-   /**************************** Program start **************************/
+       /**************************** Program start **************************/
 
-       log_init (NULL);
-       log_text ("Java - header-generator started"); 
+       log_init(NULL);
+       log_text("Java - header-generator started"); 
        
-       sprintf(offsets_filename, "%s/offsets.h", SYSDEP_DIR); /* phil */
+       sprintf(offsets_filename, "jit/%s/offsets.h", ARCH_DIR); /* phil */
        file = fopen(offsets_filename, "w");
        if (file == NULL) {
-               fprintf (stderr, "Can not open file '%s' for write", offsets_filename);
+               fprintf(stderr, "Can not open file '%s' for write", offsets_filename);
                exit(-1);
        }
        
-       fprintf (file, "/* This file is machine generated, don't edit it !*/\n\n"); 
+       fprintf(file, "/* This file is machine generated, don't edit it !*/\n\n"); 
 
-       fprintf (file, "#define offobjvftbl    %3d\n", (int) OFFSET(java_objectheader, vftbl));
-       fprintf (file, "#define offarraysize   %3d\n", (int) OFFSET(java_arrayheader, size));
-       fprintf (file, "#define offobjarrdata  %3d\n\n", (int) OFFSET(java_objectarray, data[0]));
-       fprintf (file, "#define offbaseval     %3d\n", (int) OFFSET(vftbl, baseval));
-       fprintf (file, "#define offdiffval     %3d\n", (int) OFFSET(vftbl, diffval));
+       fprintf(file, "#define offobjvftbl    %3d\n", (int) OFFSET(java_objectheader, vftbl));
+       fprintf(file, "#define offarraysize   %3d\n", (int) OFFSET(java_arrayheader, size));
+       fprintf(file, "#define offobjarrdata  %3d\n\n", (int) OFFSET(java_objectarray, data[0]));
+       fprintf(file, "#define offbaseval     %3d\n", (int) OFFSET(vftbl, baseval));
+       fprintf(file, "#define offdiffval     %3d\n", (int) OFFSET(vftbl, diffval));
 
-       fclose (file);
+       fclose(file);
 
-       suck_init (classpath);
+       suck_init(classpath);
    
-       tables_init ();
-       heap_init (heapsize, heapsize, &dummy);
-       loader_init ();
+       tables_init();
+       heap_init(heapsize, heapsize, &dummy);
+       loader_init();
 
 
-   /*********************** Load JAVA classes  **************************/
+       /*********************** Load JAVA classes  **************************/
        
-       nativemethod_chain = chain_new ();
-       nativeclass_chain = chain_new ();
+       nativemethod_chain = chain_new();
+       nativeclass_chain = chain_new();
        
-       for (a=1; a<argc; a++) {   
-               cp = argv[a];
+       for (a = 1; a < argc; a++) {
+               cp = argv[a];
 
                /* convert classname */
-               for (i=strlen(cp)-1; i>=0; i--)    
+               for (i = strlen(cp) - 1; i >= 0; i--)    
                        switch (cp[i]) {
-                         case '.': cp[i]='/';
-                                       break;
-                         case '_': cp[i]='$';    
+                       case '.': cp[i]='/';
+                               break;
+                       case '_': cp[i]='$';    
                        }
        
-               topclass = loader_load ( utf_new_char (cp) );
+               topclass = loader_load(utf_new_char(cp));
                
-        headerfile_generate (topclass);
+        headerfile_generate(topclass);
        }
 
-       headers_finish ();
+       headers_finish();
 
-   /************************ Release all resources **********************/
+       /************************ Release all resources **********************/
 
-       loader_close ();
-       heap_close ();
-       tables_close ( literalstring_free );
+       loader_close();
+       heap_close();
+       tables_close( literalstring_free );
        
 
-   /* Print "finished" message */
+       /* Print "finished" message */
 
-       log_text ("Java - header-generator stopped");
-       log_cputime ();
+       log_text("Java - header-generator stopped");
+       log_cputime();
        mem_usagelog(1);
        
        return 0;
diff --git a/i386/Makefile.am b/i386/Makefile.am
deleted file mode 100644 (file)
index b6e889a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-EXTRA_DIST = asmpart.S disass.c ngen.c \
-            native-math.h ngen.h \
-                methodtable.c methodtable.h \
-            types.h threads.h dis-asm.h bfd.h
-
-noinst_LIBRARIES = libdisass.a
-
-libdisass_a_SOURCES = i386-dis.c dis-buf.c
diff --git a/i386/ansidecl.h b/i386/ansidecl.h
deleted file mode 100644 (file)
index 9a7c577..0000000
+++ /dev/null
@@ -1,295 +0,0 @@
-/* ANSI and traditional C compatability macros
-   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-/* ANSI and traditional C compatibility macros
-
-   ANSI C is assumed if __STDC__ is #defined.
-
-   Macro               ANSI C definition       Traditional C definition
-   -----               ---- - ----------       ----------- - ----------
-   ANSI_PROTOTYPES     1                       not defined
-   PTR                 `void *'                `char *'
-   PTRCONST            `void *const'           `char *'
-   LONG_DOUBLE         `long double'           `double'
-   const               not defined             `'
-   volatile            not defined             `'
-   signed              not defined             `'
-   VA_START(ap, var)   va_start(ap, var)       va_start(ap)
-
-   Note that it is safe to write "void foo();" indicating a function
-   with no return value, in all K+R compilers we have been able to test.
-
-   For declaring functions with prototypes, we also provide these:
-
-   PARAMS ((prototype))
-   -- for functions which take a fixed number of arguments.  Use this
-   when declaring the function.  When defining the function, write a
-   K+R style argument list.  For example:
-
-       char *strcpy PARAMS ((char *dest, char *source));
-       ...
-       char *
-       strcpy (dest, source)
-            char *dest;
-            char *source;
-       { ... }
-
-
-   VPARAMS ((prototype, ...))
-   -- for functions which take a variable number of arguments.  Use
-   PARAMS to declare the function, VPARAMS to define it.  For example:
-
-       int printf PARAMS ((const char *format, ...));
-       ...
-       int
-       printf VPARAMS ((const char *format, ...))
-       {
-          ...
-       }
-
-   For writing functions which take variable numbers of arguments, we
-   also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros.  These
-   hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
-   thoroughly than the simple VA_START() macro mentioned above.
-
-   VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
-   Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
-   corresponding to the list of fixed arguments.  Then use va_arg
-   normally to get the variable arguments, or pass your va_list object
-   around.  You do not declare the va_list yourself; VA_OPEN does it
-   for you.
-
-   Here is a complete example:
-
-       int
-       printf VPARAMS ((const char *format, ...))
-       {
-          int result;
-
-          VA_OPEN (ap, format);
-          VA_FIXEDARG (ap, const char *, format);
-
-          result = vfprintf (stdout, format, ap);
-          VA_CLOSE (ap);
-
-          return result;
-       }
-
-
-   You can declare variables either before or after the VA_OPEN,
-   VA_FIXEDARG sequence.  Also, VA_OPEN and VA_CLOSE are the beginning
-   and end of a block.  They must appear at the same nesting level,
-   and any variables declared after VA_OPEN go out of scope at
-   VA_CLOSE.  Unfortunately, with a K+R compiler, that includes the
-   argument list.  You can have multiple instances of VA_OPEN/VA_CLOSE
-   pairs in a single function in case you need to traverse the
-   argument list more than once.
-
-   For ease of writing code which uses GCC extensions but needs to be
-   portable to other compilers, we provide the GCC_VERSION macro that
-   simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
-   wrappers around __attribute__.  Also, __extension__ will be #defined
-   to nothing if it doesn't work.  See below.
-
-   This header also defines a lot of obsolete macros:
-   CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
-   AND, DOTS, NOARGS.  Don't use them.  */
-
-#ifndef        _ANSIDECL_H
-#define _ANSIDECL_H    1
-
-/* Every source file includes this file,
-   so they will all get the switch for lint.  */
-/* LINTLIBRARY */
-
-/* Using MACRO(x,y) in cpp #if conditionals does not work with some
-   older preprocessors.  Thus we can't define something like this:
-
-#define HAVE_GCC_VERSION(MAJOR, MINOR) \
-  (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
-
-and then test "#if HAVE_GCC_VERSION(2,7)".
-
-So instead we use the macro below and test it against specific values.  */
-
-/* This macro simplifies testing whether we are using gcc, and if it
-   is of a particular minimum version. (Both major & minor numbers are
-   significant.)  This macro will evaluate to 0 if we are not using
-   gcc at all.  */
-#ifndef GCC_VERSION
-#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
-#endif /* GCC_VERSION */
-
-#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
-/* All known AIX compilers implement these things (but don't always
-   define __STDC__).  The RISC/OS MIPS compiler defines these things
-   in SVR4 mode, but does not define __STDC__.  */
-
-#define ANSI_PROTOTYPES        1
-#define PTR            void *
-#define PTRCONST       void *const
-#define LONG_DOUBLE    long double
-
-#define PARAMS(ARGS)           ARGS
-#define VPARAMS(ARGS)          ARGS
-#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
-
-/* variadic function helper macros */
-/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
-   use without inhibiting further decls and without declaring an
-   actual variable.  */
-#define VA_OPEN(AP, VAR)       { va_list AP; va_start(AP, VAR); { struct Qdmy
-#define VA_CLOSE(AP)           } va_end(AP); }
-#define VA_FIXEDARG(AP, T, N)  struct Qdmy
-#undef const
-#undef volatile
-#undef signed
-
-/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
-   it too, but it's not in C89.  */
-#undef inline
-#if __STDC_VERSION__ > 199901L
-/* it's a keyword */
-#else
-# if GCC_VERSION >= 2007
-#  define inline __inline__   /* __inline__ prevents -pedantic warnings */
-# else
-#  define inline  /* nothing */
-# endif
-#endif
-
-/* These are obsolete.  Do not use.  */
-#ifndef IN_GCC
-#define CONST          const
-#define VOLATILE       volatile
-#define SIGNED         signed
-
-#define PROTO(type, name, arglist)     type name arglist
-#define EXFUN(name, proto)             name proto
-#define DEFUN(name, arglist, args)     name(args)
-#define DEFUN_VOID(name)               name(void)
-#define AND            ,
-#define DOTS           , ...
-#define NOARGS         void
-#endif /* ! IN_GCC */
-
-#else  /* Not ANSI C.  */
-
-#undef  ANSI_PROTOTYPES
-#define PTR            char *
-#define PTRCONST       PTR
-#define LONG_DOUBLE    double
-
-#define PARAMS(args)           ()
-#define VPARAMS(args)          (va_alist) va_dcl
-#define VA_START(va_list, var) va_start(va_list)
-
-#define VA_OPEN(AP, VAR)               { va_list AP; va_start(AP); { struct Qdmy
-#define VA_CLOSE(AP)                   } va_end(AP); }
-#define VA_FIXEDARG(AP, TYPE, NAME)    TYPE NAME = va_arg(AP, TYPE)
-
-/* some systems define these in header files for non-ansi mode */
-#undef const
-#undef volatile
-#undef signed
-#undef inline
-#define const
-#define volatile
-#define signed
-#define inline
-
-#ifndef IN_GCC
-#define CONST
-#define VOLATILE
-#define SIGNED
-
-#define PROTO(type, name, arglist)     type name ()
-#define EXFUN(name, proto)             name()
-#define DEFUN(name, arglist, args)     name arglist args;
-#define DEFUN_VOID(name)               name()
-#define AND            ;
-#define DOTS
-#define NOARGS
-#endif /* ! IN_GCC */
-
-#endif /* ANSI C.  */
-
-/* Define macros for some gcc attributes.  This permits us to use the
-   macros freely, and know that they will come into play for the
-   version of gcc in which they are supported.  */
-
-#if (GCC_VERSION < 2007)
-# define __attribute__(x)
-#endif
-
-/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
-#ifndef ATTRIBUTE_MALLOC
-# if (GCC_VERSION >= 2096)
-#  define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-# else
-#  define ATTRIBUTE_MALLOC
-# endif /* GNUC >= 2.96 */
-#endif /* ATTRIBUTE_MALLOC */
-
-/* Attributes on labels were valid as of gcc 2.93. */
-#ifndef ATTRIBUTE_UNUSED_LABEL
-# if (GCC_VERSION >= 2093)
-#  define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
-# else
-#  define ATTRIBUTE_UNUSED_LABEL
-# endif /* GNUC >= 2.93 */
-#endif /* ATTRIBUTE_UNUSED_LABEL */
-
-#ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#endif /* ATTRIBUTE_UNUSED */
-
-#ifndef ATTRIBUTE_NORETURN
-#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
-#endif /* ATTRIBUTE_NORETURN */
-
-#ifndef ATTRIBUTE_PRINTF
-#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
-#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
-#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
-#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
-#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
-#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
-#endif /* ATTRIBUTE_PRINTF */
-
-/* We use __extension__ in some places to suppress -pedantic warnings
-   about GCC extensions.  This feature didn't work properly before
-   gcc 2.8.  */
-#if GCC_VERSION < 2008
-#define __extension__
-#endif
-
-/* Bootstrap support:  Adjust certain macros defined by Autoconf,
-   which are only valid for the stage1 compiler.  If we detect
-   a modern version of GCC, we are probably in stage2 or beyond,
-   so unconditionally reset the values.  Note that const, inline,
-   etc. have been dealt with above.  */
-#if (GCC_VERSION >= 2007)
-# ifndef HAVE_LONG_DOUBLE
-#  define HAVE_LONG_DOUBLE 1
-# endif
-#endif /* GCC >= 2.7 */
-
-#endif /* ansidecl.h   */
diff --git a/i386/asmpart.S b/i386/asmpart.S
deleted file mode 100644 (file)
index 95d9be6..0000000
+++ /dev/null
@@ -1,1079 +0,0 @@
-/* -*- mode: asm; tab-width: 4 -*- */
-/****************************** asmpart.c **************************************
-*                                                                              *
-*   It contains the Java-C interface functions for i386 processors.            *
-*                                                                              *
-*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
-*                                                                              *
-*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
-*                                                                              *
-*   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
-*            Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
-*            Christian Thalinger                                               *
-*                                                                              *
-*   Last Change: $Id: asmpart.S 550 2003-11-01 20:34:14Z twisti $        *
-*                                                                              *
-*******************************************************************************/
-
-#include "offsets.h"
-
-       .text
-
-
-/********************* exported functions and variables ***********************/
-
-       .globl has_no_x_instr_set
-       .globl asm_calljavamethod
-       .globl asm_calljavafunction
-       .globl asm_call_jit_compiler
-       .globl asm_dumpregistersandcall
-       .globl asm_handle_exception
-       .globl asm_handle_nat_exception
-       .globl asm_builtin_checkcast    
-       .globl asm_builtin_checkarraycast
-       .globl asm_builtin_anewarray
-       .globl asm_builtin_newarray_array
-       .globl asm_builtin_aastore
-       .globl asm_builtin_monitorenter
-       .globl asm_builtin_monitorexit
-       .globl asm_builtin_ldiv
-       .globl asm_builtin_lrem
-    .globl asm_builtin_f2i
-    .globl asm_builtin_f2l
-    .globl asm_builtin_d2i
-    .globl asm_builtin_d2l
-       .globl asm_builtin_arrayinstanceof
-       .globl asm_perform_threadswitch
-       .globl asm_initialize_thread_stack
-       .globl asm_switchstackandcall
-       .globl asm_getcallingmethod
-    .globl asm_builtin_trace
-    .globl asm_builtin_exittrace
-    
-/*************************** imported functions *******************************/
-
-       .globl jit_compile
-       .globl builtin_monitorexit
-       .globl builtin_throw_exception
-       .globl builtin_trace_exception
-       .globl class_java_lang_Object
-       .globl findmethod
-
-/*********************** function has_no_x_instr_set ***************************
-*                                                                              *
-*   determines if the byte support instruction set (21164a and higher)         *
-*   is available.                                                              *
-*                                                                              *
-*   Use it on i386 architecture to init the fpu.                               *
-*                                                                              *
-*******************************************************************************/
-
-has_no_x_instr_set:
-               finit                         /* intitialize the fpu                  */
-
-               pushl   $0x027f   /* Round to nearest, 53-bit mode, exceptions masked */
-               fldcw   (%esp)
-               addl    $4,%esp
-               
-               xor             %eax,%eax                               /* result code 0 (not used for i386)  */
-               ret
-
-
-/********************* function asm_calljavamethod *****************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 parameters.                                                   *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   An possibly throwed exception will be returned to the caller as function   *
-*   return value, so the java method cannot return a fucntion value (this      *
-*   function usually calls 'main' and '<clinit>' which do not return a         *
-*   function value).                                                           *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-#define        MethodPointer   -4
-#define        FrameSize       -8
-#define     IsSync          -12
-#define     IsLeaf          -16
-#define     IntSave         -20
-#define     FltSave         -24
-#define     ExTableSize     -28
-#define     ExTableStart    -28
-
-#define     ExEntrySize     -16
-#define     ExStartPC       -4
-#define     ExEndPC         -8
-#define     ExHandlerPC     -12
-#define     ExCatchType     -16
-
-call_name:
-       .ascii  "calljavamethod\0\0"
-
-/*     .align  3 */
-       .align  8
-       .long   0                         /* catch type all                       */
-       .long   calljava_xhandler         /* handler pc                           */
-       .long   calljava_xhandler         /* end pc                               */
-       .long   asm_calljavamethod        /* start pc                             */
-       .long   1                         /* extable size                         */
-       .long   0                         /* fltsave                              */
-       .long   0                         /* intsave                              */
-       .long   0                         /* isleaf                               */
-       .long   0                         /* IsSync                               */
-       .long   32                        /* frame size                           */
-       .long   0                         /* method pointer (pointer to name)     */
-
-asm_calljavamethod:
-               pushl   %ebp                  /* allocate stack space                 */
-               movl    %esp, %ebp
-
-               subl    $32,%esp              /* pass the remaining parameters        */
-               xorl    %edx,%edx
-
-               movl    %edx,28(%esp)         /* convert parms to 8 byte              */
-               movl    24(%ebp),%eax
-               movl    %eax,24(%esp)
-               
-               movl    %edx,20(%esp)
-               movl    20(%ebp),%eax
-               movl    %eax,16(%esp)
-
-               movl    %edx,12(%esp)
-               movl    16(%ebp),%eax
-               movl    %eax,8(%esp)
-
-               movl    %edx,4(%esp)
-               movl    12(%ebp),%eax
-               movl    %eax,(%esp)
-
-               movl    8(%ebp),%eax          /* move function pointer to %eax        */
-
-               lea             asm_call_jit_compiler,%ecx
-               call    *%ecx                 /* call JIT compiler                    */
-               
-calljava_jit:
-calljava_return:
-calljava_ret:
-               xorl    %eax,%eax
-               leave                                             /* free stack space                     */
-               ret
-
-calljava_xhandler:
-               pushl   %eax                              /* pass exception pointer               */
-               call    builtin_throw_exception
-               addl    $4,%esp
-               addl    $32,%esp
-               popl    %ebp
-               ret
-
-
-/********************* function asm_calljavafunction ***************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 address parameters.                                           *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-call_name2:
-       .ascii  "calljavafunction\0\0"
-
-/*     .align  3 */
-       .align  8
-       .long   0                         /* catch type all                       */
-       .long   calljava_xhandler2        /* handler pc                           */
-       .long   calljava_xhandler2        /* end pc                               */
-       .long   asm_calljavafunction      /* start pc                             */
-       .long   1                         /* extable size                         */
-       .long   0                         /* fltsave                              */
-       .long   0                         /* intsave                              */
-       .long   0                         /* isleaf                               */
-       .long   0                         /* IsSync                               */
-       .long   32                        /* frame size                           */
-       .long   0                         /* method pointer (pointer to name)     */
-
-asm_calljavafunction:
-               pushl   %ebp                  /* allocate stack space                 */
-               movl    %esp, %ebp
-
-               subl    $32,%esp              /* pass the remaining parameters        */
-               xorl    %edx,%edx
-
-               movl    %edx,28(%esp)         /* convert parms to 8 byte              */
-               movl    24(%ebp),%eax
-               movl    %eax,24(%esp)
-               
-               movl    %edx,20(%esp)
-               movl    20(%ebp),%eax
-               movl    %eax,16(%esp)
-
-               movl    %edx,12(%esp)
-               movl    16(%ebp),%eax
-               movl    %eax,8(%esp)
-
-               movl    %edx,4(%esp)
-               movl    12(%ebp),%eax
-               movl    %eax,(%esp)
-
-               movl    8(%ebp),%eax          /* move function pointer to %eax        */
-
-               lea             asm_call_jit_compiler,%ecx 
-               call    *%ecx                 /* call JIT compiler                    */
-       
-calljava_jit2:
-calljava_return2:
-calljava_ret2:
-               leave
-               ret
-
-calljava_xhandler2:
-               pushl   %eax                              /* pass exception pointer               */
-               call    builtin_throw_exception
-               addl    $4,%esp
-               addl    $32,%esp
-               popl    %ebp
-               ret
-                                               
-
-/****************** function asm_call_jit_compiler *****************************
-*                                                                              *
-*   invokes the compiler for untranslated JavaVM methods.                      *
-*                                                                              *
-*   Register R0 contains a pointer to the method info structure (prepared      *
-*   by createcompilerstub). Using the return address in R26 and the            *
-*   offset in the LDA instruction or using the value in methodptr R28 the      *
-*   patching address for storing the method address can be computed:           *
-*                                                                              *
-*   method address was either loaded using                                     *
-*                                                                              *
-*   i386_mov_imm_reg(a, REG_ITMP2)                ; invokestatic/special       *
-*   i386_call_reg(REG_ITMP2)                                                   *
-*                                                                              *
-*   or                                                                         *
-*                                                                              *
-*   i386_mov_membase_reg(REG_SP, 0, REG_ITMP1)    ; invokevirtual/interface    *
-*   i386_mov_membase_reg(REG_ITMP1, OFFSET(, vftbl), REG_ITMP2)                *
-*   i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + \                *
-*       sizeof(methodptr) * m->vftblindex, REG_ITMP1)                          *
-*   i386_call_reg(REG_ITMP1)                                                   *
-*                                                                              *
-*   in the static case the method pointer can be computed using the            *
-*   return address and the lda function following the jmp instruction          *
-*                                                                              *
-*******************************************************************************/
-
-
-asm_call_jit_compiler:
-        push    %ecx
-               push    %ebx            /* save register                              */
-        push    %ebp
-                               
-               mov     12(%esp),%ebp   /* get return address (2 push)                */
-               mov     -1(%ebp),%bl    /* get function code                          */
-               cmp     $0xd2,%bl               /* called with `call *REG_ITMP2' (%edx)?      */
-               jne             L_not_static_special
-
-               sub     $6,%ebp                 /* calculate address of immediate             */
-               jmp             L_call_jit_compile
-               
-L_not_static_special:
-               cmp     $0xd0,%bl               /* called with `call *REG_ITMP1' (%eax)       */
-               jne             L_not_virtual_interface
-               
-               sub     $6,%ebp         /* calculate address of offset                */
-               mov     (%ebp),%ebp     /* get offset                                 */
-               add     %edx,%ebp       /* add base address to get method address     */
-               jmp             L_call_jit_compile
-
-L_not_virtual_interface:        /* a call from asm_calljavamethod             */
-               xor     %ebp,%ebp
-               
-L_call_jit_compile:
-               push    %ebp            /* save address for method pointer            */
-
-               push    %eax                    /* push methodpointer on stack                */
-               call    jit_compile
-               add     $4,%esp
-
-               pop     %ebp            /* restore address for method pointer         */
-               test    %ebp,%ebp               /* is address == 0 (asm_calljavamethod)       */
-               je              L_call_method
-               
-               mov     %eax,(%ebp)             /* and now save the new pointer               */
-
-L_call_method:
-        pop     %ebp
-               pop     %ebx            /* restore registers                          */
-        pop     %ecx
-                       
-               jmp             *%eax                   /* ...and now call the new method             */
-
-
-
-/****************** function asm_dumpregistersandcall **************************
-*                                                                              *
-*   This funtion saves all callee saved registers and calls the function       *
-*   which is passed as parameter.                                              *
-*                                                                              *
-*   This function is needed by the garbage collector, which needs to access    *
-*   all registers which are stored on the stack. Unused registers are          *
-*   cleared to avoid interferances with the GC.                                *
-*                                                                              *
-*   void asm_dumpregistersandcall (functionptr f);                             *
-*                                                                              *
-*******************************************************************************/
-
-asm_dumpregistersandcall:
-        xor     %eax,%eax
-        mov     %eax,(%eax)
-        
-               push    %ebx
-               push    %ebp
-               push    %esi
-               push    %edi
-                               
-               mov     8(%ebp),%eax            /* load function pointer */
-               call    *%eax                           /* call function */
-
-               pop             %edi
-               pop             %esi
-               pop             %ebp
-               pop             %ebx
-               
-               ret
-        
-
-/********************* function asm_handle_exception ***************************
-*                                                                              *
-*   This function handles an exception. It does not use the usual calling      *
-*   conventions. The exception pointer is passed in REG_ITMP1 and the          *
-*   pc from the exception raising position is passed in REG_ITMP2. It searches *
-*   the local exception table for a handler. If no one is found, it unwinds    *
-*   stacks and continues searching the callers.                                *
-*                                                                              *
-*   void asm_handle_exception (exceptionptr, exceptionpc);                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_handle_nat_exception:
-               add     $4,%esp                                         /* clear return address of native stub */
-               
-asm_handle_exception:
-               push    %eax
-               push    %edx                                            /* get the data segment ptr       */
-               call    findmethod
-               mov     %eax,%ecx
-               pop     %edx
-               pop     %eax
-
-               push    %ebp
-               mov     %esp,%ebp
-
-               push    %eax                                            /* save exception pointer         */
-/*             subl    $2,%edx */
-               push    %edx                                            /* save exception pc              */
-               push    %ecx                                            /* save data segment pointer      */
-        
-               push    %ebx
-               push    %esi
-               push    %edi
-               
-ex_stack_loop:
-               sub     $16,%esp
-
-               movl    %eax,(%esp)                                     /* exception pointer */
-
-               movl    MethodPointer(%ecx),%eax        /* method pointer */
-               movl    %eax,4(%esp)
-               
-               movl    %edx,8(%esp)                            /* exception pc */
-               movl    $1,12(%esp)                                     /* set no unwind flag */
-               call    builtin_trace_exception
-
-               addl    $16,%esp
-
-               movl    -12(%ebp),%esi                          /* %esi = data segment pointer */
-               movl    ExTableSize(%esi),%ecx          /* %ecx = exception table size */
-               test    %ecx,%ecx                                       /* if empty table skip */
-               je              empty_table
-
-               lea             ExTableStart(%esi),%edi         /* %edi = start of exception table */
-               movl    -4(%ebp),%eax                           /* get xptr */
-               
-ex_table_loop:
-               movl    -8(%ebp),%edx                           /* get xpc */
-               
-               movl    ExStartPC(%edi),%ebx            /* %ebx = exception start pc */
-               cmpl    %edx,%ebx                                       /* %ebx = (startpc <= xpc) */
-               jg              ex_table_cont                           /* if (false) continue */
-               movl    ExEndPC(%edi),%ebx                      /* %ebx = exception end pc */
-               cmpl    %ebx,%edx                                       /* %ebx = (xpc < endpc) */
-               jge             ex_table_cont                           /* if (false) continue */
-               movl    ExCatchType(%edi),%ebx          /* arg1 = exception catch type */
-               test    %ebx,%ebx                                       /* NULL catches everything */
-               je              ex_handle_it
-
-               movl    offobjvftbl(%eax),%esi          /* %esi = vftblptr(xptr) */
-               movl    offobjvftbl(%ebx),%ebx          /* %ebx = vftblptr(catchtype) class (not obj) */
-               movl    offbaseval(%esi),%esi           /* %esi = baseval(xptr) */
-               movl    offbaseval(%ebx),%edx           /* %edx = baseval(catchtype) */
-               movl    offdiffval(%ebx),%ebx           /* %ebx = diffval(catchtype) */
-               subl    %edx,%esi                                       /* %esi = baseval(xptr) - baseval(catchtype) */
-               cmpl    %ebx,%esi                                       /* xptr is instanceof catchtype */
-               ja              ex_table_cont
-               
-ex_handle_it:
-               movl    ExHandlerPC(%edi),%edx
-               
-               popl    %edi
-               popl    %esi
-               popl    %ebx
-        
-        popl    %eax                        /* pop %ecx (dummy) */
-        popl    %eax                        /* pop %edx (dummy) */
-        popl    %eax                        /* pop %eax */
-        
-               leave
-
-               jmp             *%edx
-
-ex_table_cont:
-               lea             ExEntrySize(%edi),%edi
-               decl    %ecx
-               test    %ecx,%ecx
-               jg              ex_table_loop
-               
-empty_table:
-               popl    %edi
-               popl    %esi
-               popl    %ebx
-               popl    %ecx                                            /* restore data segment pointer   */
-               popl    %edx
-               popl    %eax                                            /* restore exception pointer      */
-               popl    %ebp
-
-               movl    %eax,%edi                                       /* save exception pointer         */
-                               
-ex_already_cleared:            
-               movl    IsSync(%ecx),%eax                       /* %eax = SyncOffset              */
-               test    %eax,%eax                                       /* if zero no monitorexit         */
-               je              no_monitor_exit
-               
-               addl    %esp,%eax
-               movl    -8(%eax),%eax
-        pusha                               /* save regs                      */
-               pushl   %eax
-               call    builtin_monitorexit
-               addl    $4,%esp
-        popa                                /* restore regs                   */
-        
-no_monitor_exit:
-               movl    FrameSize(%ecx),%eax            /* %eax = frame size              */
-               addl    %eax,%esp                                       /* unwind stack                   */
-               movl    %esp,%eax                                       /* %eax = pointer to save area    */
-
-               movl    IntSave(%ecx),%edx                      /* %edx = saved int register count */
-               test    %edx,%edx
-               je              noint
-               cmpl    $1,%edx
-               je              int1
-               
-int2:  
-               movl    -16(%eax),%ebx
-
-int1:  
-               movl    -8(%eax),%ebp
-
-               shll    $3,%edx                                         /* multiply by 8 bytes             */
-               subl    %edx,%eax
-               
-noint:
-               movl    FltSave(%ecx),%edx                      /* %edx = saved flt register count */
-               test    %edx,%edx
-               je              noflt
-               cmpl    $1,%edx
-               je              flt1
-               cmpl    $2,%edx
-               je              flt2
-               cmpl    $3,%edx
-               je              flt3
-               
-flt4:  
-               fldl    -32(%eax)
-               fstp    %st(1)
-
-flt3:  
-               fldl    -24(%eax)
-               fstp    %st(2)
-               
-flt2:  
-               fldl    -16(%eax)
-               fstp    %st(3)
-               
-flt1:  
-               fldl    -8(%eax)
-               fstp    %st(4)
-               
-noflt:                                 
-               popl    %edx                                            /* the new xpc is return address  */
-               subl    $2,%edx
-               
-               pushl   %edx
-               pushl   %ebx
-               pushl   %ebp
-               pushl   %esi
-               pushl   %edi
-                                                               
-               pushl   %edx                                            /* get the new data segment ptr   */
-               call    findmethod
-               movl    %eax,%ecx
-               addl    $4,%esp
-
-               popl    %edi
-               popl    %esi
-               popl    %ebp
-               popl    %ebx
-               popl    %edx
-               
-               movl    %edi,%eax                                       /* restore saved exception pointer */
-                               
-               pushl   %ebp
-               movl    %esp,%ebp
-
-               pushl   %eax                                            /* save exception pointer         */
-               pushl   %edx                                            /* save exception pc              */
-               pushl   %ecx                                            /* save data segment pointer      */
-               pushl   %ebx
-               pushl   %esi
-               pushl   %edi
-               
-               jmp             ex_stack_loop
-               
-
-/********************* function asm_builtin_monitorenter ***********************
-*                                                                              *
-*   Does null check and calls monitorenter or throws an exception              *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_monitorenter:
-               cmpl    $0,4(%esp)
-               je              nb_monitorenter                 /* if (null) throw exception          */
-               jmp             builtin_monitorenter    /* else call builtin_monitorenter     */
-
-nb_monitorenter:
-               popl    %edx                                    /* delete return address */
-               subl    $2,%edx                                 /* faulting address is return adress - 2 */
-               movl    proto_java_lang_NullPointerException,%eax
-               jmp             asm_handle_exception
-               
-
-/********************* function asm_builtin_monitorexit ************************
-*                                                                              *
-*   Does null check and calls monitorexit or throws an exception               *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_monitorexit:
-               cmpl    $0,4(%esp)
-               je              nb_monitorexit                  /* if (null) throw exception          */
-               jmp             builtin_monitorexit             /* else call builtin_monitorenter     */
-
-nb_monitorexit:
-               popl    %edx                                    /* delete return address */
-               subl    $2,%edx                                 /* faulting address is return adress - 2 */
-               movl    proto_java_lang_NullPointerException,%eax
-               jmp             asm_handle_exception
-
-
-/************************ function asm_builtin_ldiv ****************************
-*                                                                              *
-*   Does null check and calls ldiv or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_ldiv:
-               movl    12(%esp),%eax
-               orl             16(%esp),%eax
-               test    %eax,%eax                               /* if (null) throw exception */
-               je              nb_ldiv
-
-               jmp             builtin_ldiv
-
-nb_ldiv:
-               popl    %edx                                    /* delete return address */
-               subl    $2,%edx                                 /* faulting address is return adress - 2 */
-               
-               movl    proto_java_lang_ArithmeticException,%eax
-               jmp             asm_handle_exception
-                               
-
-/************************ function asm_builtin_lrem ****************************
-*                                                                              *
-*   Does null check and calls lrem or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_lrem:
-               movl    12(%esp),%eax
-               orl             16(%esp),%eax
-               test    %eax,%eax                               /* if (null) throw exception */
-               je              nb_lrem
-
-               jmp             builtin_lrem
-
-nb_lrem:
-               popl    %edx                                    /* delete return address */
-               subl    $2,%edx                                 /* faulting address is return adress - 2 */
-               
-               movl    proto_java_lang_ArithmeticException,%eax
-               jmp             asm_handle_exception
-               
-
-/************************ function asm_builtin_x2x *****************************
-*                                                                              *
-*   Wrapper functions for corner cases                                         *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_f2i:
-        sub     $4,%esp
-        fsts    (%esp)
-        call    builtin_f2i
-        add     $4,%esp
-        ret            
-
-asm_builtin_d2i:
-        sub     $8,%esp
-        fstl    (%esp)
-        call    builtin_d2i
-        add     $8,%esp
-        ret            
-
-asm_builtin_f2l:
-        sub     $4,%esp
-        fsts    (%esp)
-        call    builtin_f2l
-        add     $4,%esp
-        ret            
-
-asm_builtin_d2l:
-        sub     $8,%esp
-        fstl    (%esp)
-        call    builtin_d2l
-        add     $8,%esp
-        ret            
-
-        
-/*********************** function new_builtin_checkcast ************************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_checkcast:
-               xorl    %eax,%eax
-               movl    $0,(%eax)
-               ret
-
-               
-/******************* function asm_builtin_checkarraycast ***********************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_checkarraycast:
-               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes)    */
-
-               movl    12(%esp),%eax           /* 8 (frame) + 4 (return)             */
-               movl    %eax,(%esp)                             /* save object pointer                */
-
-               movl    20(%esp),%eax
-               movl    %eax,4(%esp)
-
-               call    builtin_checkarraycast  /* builtin_checkarraycast             */
-       
-               test    %eax,%eax               /* if (false) throw exception         */
-               je              nb_carray_throw
-
-               movl    12(%esp),%eax                   /* return object pointer              */
-               addl    $8,%esp
-               ret
-
-nb_carray_throw:
-               addl    $8,%esp
-               
-               popl    %edx                                    /* delete return address              */
-               subl    $2,%edx                                 /* faulting address is return adress - 2 */
-               
-               movl    proto_java_lang_ClassCastException,%eax
-               jmp             asm_handle_exception
-
-               
-/******************* function asm_builtin_anewarray ****************************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_anewarray:
-               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
-
-               movl    12(%esp),%eax
-               movl    %eax,(%esp)
-
-               movl    20(%esp),%eax
-               movl    %eax,4(%esp)
-
-               call    builtin_anewarray
-       
-               addl    $8,%esp
-               ret
-
-               
-/******************* function asm_builtin_newarray_array ***********************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_newarray_array:
-               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
-
-               movl    12(%esp),%eax
-               movl    %eax,(%esp)
-
-               movl    20(%esp),%eax
-               movl    %eax,4(%esp)
-
-               call    builtin_newarray_array
-       
-               addl    $8,%esp
-               ret
-
-               
-/******************* function asm_builtin_aastore ******************************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_aastore:
-               subl    $12,%esp                                /* build stack frame (3 * 4 bytes)    */
-
-               movl    16(%esp),%eax           /* 12 (frame) + 4 (return)            */
-               test    %eax,%eax                               /* if null pointer throw exception    */
-               je              nb_aastore_null
-
-               movl    offarraysize(%eax),%edx /* load size                          */
-               movl    24(%esp),%ecx                   /* index                              */
-               cmpl    %edx,%ecx                               /* do bound check                     */
-               ja              nb_aastore_bound                /* if out of bounds throw exception   */
-
-               shll    $2,%ecx                                 /* index * 4                          */
-               addl    %eax,%ecx                               /* add index * 4 to arrayref          */
-               
-               movl    %ecx,8(%esp)                    /* save store position                */
-               
-               movl    16(%esp),%eax           /* 12 (frame) + 4 (return)            */
-               movl    %eax,(%esp)
-
-               movl    32(%esp),%eax                   /* object is second argument          */
-               movl    %eax,4(%esp)
-               
-               call    builtin_canstore                /* builtin_canstore(arrayref,object)  */
-
-               test    %eax,%eax                               /* if (false) throw exception         */
-               je              nb_aastore_throw
-
-               movl    32(%esp),%eax
-               movl    8(%esp),%ecx
-               movl    %eax,offobjarrdata(%ecx)/* store objectptr in array           */
-               
-               addl    $12,%esp
-               ret
-
-nb_aastore_null:
-               addl    $12,%esp
-               popl    %edx                                    /* delete return address */
-               subl    $2,%edx                                 /* faulting address is return adress - 2 */
-               
-               movl    proto_java_lang_NullPointerException,%eax
-               jmp             asm_handle_exception
-
-nb_aastore_bound:
-               addl    $12,%esp
-               popl    %edx                                    /* delete return address */
-               subl    $2,%edx                                 /* faulting address is return adress - 2 */
-               
-               movl    proto_java_lang_ArrayIndexOutOfBoundsException,%eax
-               jmp             asm_handle_exception
-               
-nb_aastore_throw:
-               addl    $12,%esp
-               popl    %edx                                    /* delete return address */
-               subl    $2,%edx                                 /* faulting address is return adress - 2 */
-               
-               movl    proto_java_lang_ArrayStoreException,%eax
-               jmp             asm_handle_exception
-
-               
-/******************* function asm_builtin_arrayinstanceof **********************
-*                                                                              *
-*   Does the instanceof check of arrays                                        *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_arrayinstanceof:
-               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
-
-               movl    12(%esp),%eax
-               movl    %eax,(%esp)
-
-               movl    20(%esp),%eax
-               movl    %eax,4(%esp)
-
-               call    builtin_arrayinstanceof
-       
-               addl    $8,%esp
-               ret
-
-               
-/******************* function asm_initialize_thread_stack **********************
-*                                                                              *
-* initialized a thread stack                                                   *
-* (to)->restorePoint = asm_initialize_thread_stack((u1*)(func), (to)->stackEnd)*
-*                                                                              *
-*******************************************************************************/
-
-asm_initialize_thread_stack:
-               movl    8(%esp),%eax            /* (to)->stackEnd                     */
-               subl    $36,%eax                                /* 4 bytes * 8 regs + 4 bytes func    */
-
-               xorl    %edx,%edx
-               movl    %edx,0(%eax)
-               movl    %edx,4(%eax)
-               movl    %edx,8(%eax)
-               movl    %edx,12(%eax)
-               movl    %edx,16(%eax)
-               movl    %edx,20(%eax)
-               movl    %edx,24(%eax)
-               movl    %edx,28(%eax)
-
-               movl    4(%esp),%edx            /* save (u1*) (func)                  */
-               movl    %edx,32(%eax)
-
-               ret                             /* return restorepoint in %eax        */
-
-
-/******************* function asm_perform_threadswitch *************************
-*                                                                              *
-*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
-*                                                                              *
-*   performs a threadswitch                                                    *
-*                                                                              *
-*******************************************************************************/
-
-asm_perform_threadswitch:
-               subl    $36,%esp
-
-               movl    %eax,0(%esp)
-               movl    %edx,4(%esp)
-               movl    %ecx,8(%esp)
-               movl    %ebx,12(%esp)
-               movl    %esp,16(%esp)
-               movl    %ebp,20(%esp)
-               movl    %esi,24(%esp)
-               movl    %edi,28(%esp)
-
-               movl    36(%esp),%eax                   /* save current return address */
-               movl    %eax,32(%esp)
-
-               movl    40(%esp),%eax                   /* first argument **from */
-               movl    %esp,0(%eax)
-
-               movl    48(%esp),%eax                   /* third argument **stackTop */
-               movl    %esp,0(%eax)
-
-               movl    44(%esp),%eax                   /* second argument **to */
-               movl    0(%eax),%esp                    /* load new stack pointer */
-
-               movl    0(%esp),%eax
-               movl    4(%esp),%edx
-               movl    8(%esp),%ecx
-               movl    12(%esp),%ebx
-                                                                               /* skip stack pointer */
-               movl    20(%esp),%ebp
-               movl    24(%esp),%esi
-               movl    28(%esp),%edi
-
-               addl    $32,%esp                /* leave return address on stack      */
-               ret
-               
-
-/********************* function asm_switchstackandcall *************************
-*                                                                              *
-*  int asm_switchstackandcall (void *stack, void *func, void **stacktopsave,   *
-*                                     void *p);                                       *
-*                                                                              *
-*   Switches to a new stack, calls a function and switches back.               *
-*       a0      new stack pointer                                              *
-*       a1      function pointer                                               *
-*              a2              pointer to variable where stack top should be stored           *
-*       a3      pointer to user data, is passed to the function                *
-*                                                                              *
-*******************************************************************************/
-
-asm_switchstackandcall:
-               movl    4(%esp),%edx                    /* first argument *stack */
-               subl    $8,%edx                                 /* allocate new stack */
-
-               movl    (%esp),%eax                             /* save return address on new stack */
-               movl    %eax,(%edx)
-
-               movl    %esp,4(%edx)                    /* save old stack pointer on new stack */
-
-               movl    12(%esp),%eax                   /* third argument **stacktopsave */
-               movl    %esp,(%eax)                             /* save old stack pointer to variable */
-
-               movl    8(%esp),%eax                    /* load function pointer */
-               movl    16(%esp),%ecx                   /* fourth argument *p */
-               
-               movl    %edx,%esp                               /* switch to new stack */
-
-               subl    $4,%esp
-               movl    %ecx,0(%esp)                    /* pass pointer */
-               call    *%eax                                   /* and call function */
-               addl    $4,%esp
-
-               movl    (%esp),%edx                             /* load return address */
-               movl    4(%esp),%esp                    /* switch to old stack */
-               movl    %edx,(%esp)
-               ret
-
-               
-/********************* function asm_getcallingmethod ***************************
-*                                                                              *
-*   classinfo *asm_getcallingmethod ();                                                                   *
-*                                                                                                                                                         *    
-*   goes back stack frames to get the calling method                                              *       
-*                                                                                                                                                         *    
-*                              t2 .. sp                                                                                                       *
-*                              t3 .. ra                                                                                                       *
-*                              t4 .. pv                                                                                                       *
-*                                                                              *
-*******************************************************************************/
-
-asm_getcallingmethod:
-               xorl    %eax,%eax
-/*             movl    $0,(%eax) */
-               ret
-
-
-/*********************** function asm_builtin_trace ****************************
-*                                                                              *
-*   Intended to be called from the native stub. Saves all argument registers   *
-*   and calls builtin_trace_args.                                              *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_trace:
-        pusha
-        subl    $68,%esp                /* 4 + 8 * 4 + 68 = 104 */
-
-        movl    104(%esp),%eax
-        movl    108(%esp),%edx
-        movl    %eax,(%esp)
-        movl    %edx,4(%esp)
-
-        movl    112(%esp),%eax
-        movl    116(%esp),%edx
-        movl    %eax,8(%esp)
-        movl    %edx,12(%esp)
-
-        movl    120(%esp),%eax
-        movl    124(%esp),%edx
-        movl    %eax,16(%esp)
-        movl    %edx,20(%esp)
-
-        movl    128(%esp),%eax
-        movl    132(%esp),%edx
-        movl    %eax,24(%esp)
-        movl    %edx,28(%esp)
-
-        movl    136(%esp),%eax
-        movl    140(%esp),%edx
-        movl    %eax,32(%esp)
-        movl    %edx,36(%esp)
-
-        movl    144(%esp),%eax
-        movl    148(%esp),%edx
-        movl    %eax,40(%esp)
-        movl    %edx,44(%esp)
-
-        movl    152(%esp),%eax
-        movl    156(%esp),%edx
-        movl    %eax,48(%esp)
-        movl    %edx,52(%esp)
-
-        movl    160(%esp),%eax
-        movl    164(%esp),%edx
-        movl    %eax,56(%esp)
-        movl    %edx,60(%esp)
-
-        movl    168(%esp),%eax
-        movl    %eax,64(%esp)
-        
-        call    builtin_trace_args
-        addl    $68,%esp
-
-        popa
-        ret
-
-
-/********************* function asm_builtin_exittrace **************************
-*                                                                              *
-*   Intended to be called from the native stub. Saves return value and calls   *
-*   builtin_displaymethodstop.                                                 *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_exittrace:
-        pusha
-        subl    $24,%esp
-        
-        movl    60(%esp),%eax           /* 4 + 8 * 4 + 24 = 60 */
-        movl    %eax,(%esp)
-
-        movl    64(%esp),%eax
-        movl    68(%esp),%edx
-        movl    %eax,4(%esp)
-        movl    %edx,8(%esp)
-
-        movl    72(%esp),%eax
-        movl    76(%esp),%edx
-        movl    %eax,12(%esp)
-        movl    %edx,16(%esp)
-
-        movl    80(%esp),%eax
-        movl    %eax,20(%esp)
-
-        call    builtin_displaymethodstop
-        addl    $24,%esp
-
-        popa
-        ret
diff --git a/i386/bfd.h b/i386/bfd.h
deleted file mode 100644 (file)
index cd75aeb..0000000
+++ /dev/null
@@ -1,4177 +0,0 @@
-/* DO NOT EDIT!  -*- buffer-read-only: t -*-  This file is automatically 
-   generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c", 
-   "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c", 
-   "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c", 
-   "linker.c" and "simple.c".
-   Run "make headers" in your build bfd/ to regenerate.  */
-
-/* Main header file for the bfd library -- portable access to object files.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
-   Free Software Foundation, Inc.
-   Contributed by Cygnus Support.
-
-   This file is part of BFD, the Binary File Descriptor library.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-#ifndef __BFD_H_SEEN__
-#define __BFD_H_SEEN__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "ansidecl.h"
-#include "symcat.h"
-#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-#ifndef SABER
-/* This hack is to avoid a problem with some strict ANSI C preprocessors.
-   The problem is, "32_" is not a valid preprocessing token, and we don't
-   want extra underscores (e.g., "nlm_32_").  The XCONCAT2 macro will
-   cause the inner CONCAT2 macros to be evaluated first, producing
-   still-valid pp-tokens.  Then the final concatenation can be done.  */
-#undef CONCAT4
-#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
-#endif
-#endif
-
-/* The word size used by BFD on the host.  This may be 64 with a 32
-   bit target if the host is 64 bit, or if other 64 bit targets have
-   been selected with --enable-targets, or if --enable-64-bit-bfd.  */
-#define BFD_ARCH_SIZE 32
-
-/* The word size of the default bfd target.  */
-#define BFD_DEFAULT_TARGET_SIZE 32
-
-#define BFD_HOST_64BIT_LONG 0
-#if 0
-#define BFD_HOST_64_BIT 
-#define BFD_HOST_U_64_BIT 
-#endif
-
-#if BFD_ARCH_SIZE >= 64
-#define BFD64
-#endif
-
-#ifndef INLINE
-#if __GNUC__ >= 2
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-#endif
-
-/* Forward declaration.  */
-typedef struct _bfd bfd;
-
-/* To squelch erroneous compiler warnings ("illegal pointer
-   combination") from the SVR3 compiler, we would like to typedef
-   boolean to int (it doesn't like functions which return boolean.
-   Making sure they are never implicitly declared to return int
-   doesn't seem to help).  But this file is not configured based on
-   the host.  */
-/* General rules: functions which are boolean return true on success
-   and false on failure (unless they're a predicate).   -- bfd.doc */
-/* I'm sure this is going to break something and someone is going to
-   force me to change it.  */
-/* typedef enum boolean {false, true} boolean; */
-/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
-/* It gets worse if the host also defines a true/false enum... -sts */
-/* And even worse if your compiler has built-in boolean types... -law */
-/* And even worse if your compiler provides a stdbool.h that conflicts
-   with these definitions... gcc 2.95 and later do.  If so, it must
-   be included first.  -drow */
-#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
-#define TRUE_FALSE_ALREADY_DEFINED
-#else
-#if defined (__bool_true_false_are_defined)
-/* We have <stdbool.h>.  */
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif
-#endif
-#ifdef MPW
-/* Pre-emptive strike - get the file with the enum.  */
-#include <Types.h>
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif /* MPW */
-#ifndef TRUE_FALSE_ALREADY_DEFINED
-/*typedef enum bfd_boolean {false, true} boolean;*/
-typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
-#define BFD_TRUE_FALSE
-#else
-/* Use enum names that will appear nowhere else.  */
-typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
-#endif
-
-/* Support for different sizes of target format ints and addresses.
-   If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
-   set to 1 above.  Otherwise, if gcc is being used, this code will
-   use gcc's "long long" type.  Otherwise, BFD_HOST_64_BIT must be
-   defined above.  */
-
-#ifndef BFD_HOST_64_BIT
-# if BFD_HOST_64BIT_LONG
-#  define BFD_HOST_64_BIT long
-#  define BFD_HOST_U_64_BIT unsigned long
-# else
-#  ifdef __GNUC__
-#   if __GNUC__ >= 2
-#    define BFD_HOST_64_BIT long long
-#    define BFD_HOST_U_64_BIT unsigned long long
-#   endif /* __GNUC__ >= 2 */
-#  endif /* ! defined (__GNUC__) */
-# endif /* ! BFD_HOST_64BIT_LONG */
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
-#ifdef BFD64
-
-#ifndef BFD_HOST_64_BIT
- #error No 64 bit integer type available
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
-typedef BFD_HOST_U_64_BIT bfd_vma;
-typedef BFD_HOST_64_BIT bfd_signed_vma;
-typedef BFD_HOST_U_64_BIT bfd_size_type;
-typedef BFD_HOST_U_64_BIT symvalue;
-
-#ifndef fprintf_vma
-#if BFD_HOST_64BIT_LONG
-#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
-#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
-#else
-#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
-#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
-#define fprintf_vma(s,x) \
-  fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#define sprintf_vma(s,x) \
-  sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#endif
-#endif
-
-#else /* not BFD64  */
-
-/* Represent a target address.  Also used as a generic unsigned type
-   which is guaranteed to be big enough to hold any arithmetic types
-   we need to deal with.  */
-typedef unsigned long bfd_vma;
-
-/* A generic signed type which is guaranteed to be big enough to hold any
-   arithmetic types we need to deal with.  Can be assumed to be compatible
-   with bfd_vma in the same way that signed and unsigned ints are compatible
-   (as parameters, in assignment, etc).  */
-typedef long bfd_signed_vma;
-
-typedef unsigned long symvalue;
-typedef unsigned long bfd_size_type;
-
-/* Print a bfd_vma x on stream s.  */
-#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
-#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
-
-#endif /* not BFD64  */
-
-/* A pointer to a position in a file.  */
-/* FIXME:  This should be using off_t from <sys/types.h>.
-   For now, try to avoid breaking stuff by not including <sys/types.h> here.
-   This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
-   Probably the best long-term answer is to avoid using file_ptr AND off_t
-   in this header file, and to handle this in the BFD implementation
-   rather than in its interface.  */
-/* typedef off_t       file_ptr; */
-typedef bfd_signed_vma file_ptr;
-typedef bfd_vma ufile_ptr;
-
-extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
-extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
-
-#define printf_vma(x) fprintf_vma(stdout,x)
-#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
-
-typedef unsigned int flagword; /* 32 bits of flags */
-typedef unsigned char bfd_byte;
-\f
-/* File formats.  */
-
-typedef enum bfd_format
-{
-  bfd_unknown = 0,     /* File format is unknown.  */
-  bfd_object,          /* Linker/assember/compiler output.  */
-  bfd_archive,         /* Object archive file.  */
-  bfd_core,            /* Core dump.  */
-  bfd_type_end         /* Marks the end; don't use it!  */
-}
-bfd_format;
-
-/* Values that may appear in the flags field of a BFD.  These also
-   appear in the object_flags field of the bfd_target structure, where
-   they indicate the set of flags used by that backend (not all flags
-   are meaningful for all object file formats) (FIXME: at the moment,
-   the object_flags values have mostly just been copied from backend
-   to another, and are not necessarily correct).  */
-
-/* No flags.  */
-#define BFD_NO_FLAGS           0x00
-
-/* BFD contains relocation entries.  */
-#define HAS_RELOC      0x01
-
-/* BFD is directly executable.  */
-#define EXEC_P         0x02
-
-/* BFD has line number information (basically used for F_LNNO in a
-   COFF header).  */
-#define HAS_LINENO     0x04
-
-/* BFD has debugging information.  */
-#define HAS_DEBUG      0x08
-
-/* BFD has symbols.  */
-#define HAS_SYMS       0x10
-
-/* BFD has local symbols (basically used for F_LSYMS in a COFF
-   header).  */
-#define HAS_LOCALS     0x20
-
-/* BFD is a dynamic object.  */
-#define DYNAMIC        0x40
-
-/* Text section is write protected (if D_PAGED is not set, this is
-   like an a.out NMAGIC file) (the linker sets this by default, but
-   clears it for -r or -N).  */
-#define WP_TEXT        0x80
-
-/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
-   linker sets this by default, but clears it for -r or -n or -N).  */
-#define D_PAGED        0x100
-
-/* BFD is relaxable (this means that bfd_relax_section may be able to
-   do something) (sometimes bfd_relax_section can do something even if
-   this is not set).  */
-#define BFD_IS_RELAXABLE 0x200
-
-/* This may be set before writing out a BFD to request using a
-   traditional format.  For example, this is used to request that when
-   writing out an a.out object the symbols not be hashed to eliminate
-   duplicates.  */
-#define BFD_TRADITIONAL_FORMAT 0x400
-
-/* This flag indicates that the BFD contents are actually cached in
-   memory.  If this is set, iostream points to a bfd_in_memory struct.  */
-#define BFD_IN_MEMORY 0x800
-/* The sections in this BFD specify a memory page.  */
-#define HAS_LOAD_PAGE 0x1000
-\f
-/* Symbols and relocation.  */
-
-/* A count of carsyms (canonical archive symbols).  */
-typedef unsigned long symindex;
-
-/* How to perform a relocation.  */
-typedef const struct reloc_howto_struct reloc_howto_type;
-
-#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-
-/* General purpose part of a symbol X;
-   target specific parts are in libcoff.h, libaout.h, etc.  */
-
-#define bfd_get_section(x) ((x)->section)
-#define bfd_get_output_section(x) ((x)->section->output_section)
-#define bfd_set_section(x,y) ((x)->section) = (y)
-#define bfd_asymbol_base(x) ((x)->section->vma)
-#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
-#define bfd_asymbol_name(x) ((x)->name)
-/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
-#define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
-
-/* A canonical archive symbol.  */
-/* This is a type pun with struct ranlib on purpose!  */
-typedef struct carsym
-{
-  char *name;
-  file_ptr file_offset;        /* Look here to find the file.  */
-}
-carsym;                        /* To make these you call a carsymogen.  */
-
-/* Used in generating armaps (archive tables of contents).
-   Perhaps just a forward definition would do?  */
-struct orl                     /* Output ranlib.  */
-{
-  char **name;         /* Symbol name.  */
-  union
-  {
-    file_ptr pos;
-    bfd *abfd;
-  } u;                 /* bfd* or file position.  */
-  int namidx;          /* Index into string table.  */
-};
-\f
-/* Linenumber stuff.  */
-typedef struct lineno_cache_entry
-{
-  unsigned int line_number;    /* Linenumber from start of function.  */
-  union
-  {
-    struct symbol_cache_entry *sym;    /* Function name.  */
-    bfd_vma offset;                    /* Offset into section.  */
-  } u;
-}
-alent;
-\f
-/* Object and core file sections.  */
-
-#define        align_power(addr, align)        \
-  (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
-
-typedef struct sec *sec_ptr;
-
-#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
-#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
-#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
-#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
-#define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
-#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
-#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
-#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
-#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
-
-#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)true), true)
-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
-
-typedef struct stat stat_type;
-\f
-typedef enum bfd_print_symbol
-{
-  bfd_print_symbol_name,
-  bfd_print_symbol_more,
-  bfd_print_symbol_all
-} bfd_print_symbol_type;
-
-/* Information about a symbol that nm needs.  */
-
-typedef struct _symbol_info
-{
-  symvalue value;
-  char type;
-  const char *name;            /* Symbol name.  */
-  unsigned char stab_type;     /* Stab type.  */
-  char stab_other;             /* Stab other.  */
-  short stab_desc;             /* Stab desc.  */
-  const char *stab_name;       /* String for stab type.  */
-} symbol_info;
-
-/* Get the name of a stabs type code.  */
-
-extern const char *bfd_get_stab_name PARAMS ((int));
-\f
-/* Hash table routines.  There is no way to free up a hash table.  */
-
-/* An element in the hash table.  Most uses will actually use a larger
-   structure, and an instance of this will be the first field.  */
-
-struct bfd_hash_entry
-{
-  /* Next entry for this hash code.  */
-  struct bfd_hash_entry *next;
-  /* String being hashed.  */
-  const char *string;
-  /* Hash code.  This is the full hash code, not the index into the
-     table.  */
-  unsigned long hash;
-};
-
-/* A hash table.  */
-
-struct bfd_hash_table
-{
-  /* The hash array.  */
-  struct bfd_hash_entry **table;
-  /* The number of slots in the hash table.  */
-  unsigned int size;
-  /* A function used to create new elements in the hash table.  The
-     first entry is itself a pointer to an element.  When this
-     function is first invoked, this pointer will be NULL.  However,
-     having the pointer permits a hierarchy of method functions to be
-     built each of which calls the function in the superclass.  Thus
-     each function should be written to allocate a new block of memory
-     only if the argument is NULL.  */
-  struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
-                                            struct bfd_hash_table *,
-                                            const char *));
-   /* An objalloc for this hash table.  This is a struct objalloc *,
-     but we use PTR to avoid requiring the inclusion of objalloc.h.  */
-  PTR memory;
-};
-
-/* Initialize a hash table.  */
-extern boolean bfd_hash_table_init
-  PARAMS ((struct bfd_hash_table *,
-          struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
-                                      struct bfd_hash_table *,
-                                      const char *)));
-
-/* Initialize a hash table specifying a size.  */
-extern boolean bfd_hash_table_init_n
-  PARAMS ((struct bfd_hash_table *,
-          struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
-                                      struct bfd_hash_table *,
-                                      const char *),
-          unsigned int size));
-
-/* Free up a hash table.  */
-extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
-
-/* Look up a string in a hash table.  If CREATE is true, a new entry
-   will be created for this string if one does not already exist.  The
-   COPY argument must be true if this routine should copy the string
-   into newly allocated memory when adding an entry.  */
-extern struct bfd_hash_entry *bfd_hash_lookup
-  PARAMS ((struct bfd_hash_table *, const char *, boolean create,
-          boolean copy));
-
-/* Replace an entry in a hash table.  */
-extern void bfd_hash_replace
-  PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
-          struct bfd_hash_entry *nw));
-
-/* Base method for creating a hash table entry.  */
-extern struct bfd_hash_entry *bfd_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
-          const char *));
-
-/* Grab some space for a hash table entry.  */
-extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
-                                     unsigned int));
-
-/* Traverse a hash table in a random order, calling a function on each
-   element.  If the function returns false, the traversal stops.  The
-   INFO argument is passed to the function.  */
-extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
-                                      boolean (*) (struct bfd_hash_entry *,
-                                                   PTR),
-                                      PTR info));
-
-#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
-
-/* User program access to BFD facilities.  */
-
-/* Direct I/O routines, for programs which know more about the object
-   file than BFD does.  Use higher level routines if possible.  */
-
-extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *));
-extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *));
-extern int bfd_seek PARAMS ((bfd *, file_ptr, int));
-extern ufile_ptr bfd_tell PARAMS ((bfd *));
-extern int bfd_flush PARAMS ((bfd *));
-extern int bfd_stat PARAMS ((bfd *, struct stat *));
-
-/* Deprecated old routines.  */
-#if __GNUC__
-#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
-  (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__),     \
-   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
-#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
-  (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__),    \
-   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
-#else
-#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
-  (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
-   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
-#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
-  (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
-   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
-#endif
-extern void warn_deprecated
-  PARAMS ((const char *, const char *, int, const char *));
-
-/* Cast from const char * to char * so that caller can assign to
-   a char * without a warning.  */
-#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
-#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
-#define bfd_get_format(abfd) ((abfd)->format)
-#define bfd_get_target(abfd) ((abfd)->xvec->name)
-#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
-#define bfd_family_coff(abfd) \
-  (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
-   bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
-#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
-#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_header_big_endian(abfd) \
-  ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
-#define bfd_header_little_endian(abfd) \
-  ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_get_file_flags(abfd) ((abfd)->flags)
-#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
-#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
-#define bfd_my_archive(abfd) ((abfd)->my_archive)
-#define bfd_has_map(abfd) ((abfd)->has_armap)
-
-#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
-#define bfd_usrdata(abfd) ((abfd)->usrdata)
-
-#define bfd_get_start_address(abfd) ((abfd)->start_address)
-#define bfd_get_symcount(abfd) ((abfd)->symcount)
-#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
-#define bfd_count_sections(abfd) ((abfd)->section_count)
-
-#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
-
-#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
-
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
-
-extern boolean bfd_cache_close PARAMS ((bfd *abfd));
-/* NB: This declaration should match the autogenerated one in libbfd.h.  */
-
-extern boolean bfd_record_phdr
-  PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
-          boolean, boolean, unsigned int, struct sec **));
-
-/* Byte swapping routines.  */
-
-bfd_vma                bfd_getb64         PARAMS ((const unsigned char *));
-bfd_vma        bfd_getl64         PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
-bfd_vma                bfd_getb32         PARAMS ((const unsigned char *));
-bfd_vma                bfd_getl32         PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
-bfd_vma                bfd_getb16         PARAMS ((const unsigned char *));
-bfd_vma                bfd_getl16         PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
-void           bfd_putb64         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putl64         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putb32         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putl32         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putb16         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putl16         PARAMS ((bfd_vma, unsigned char *));
-
-/* Byte swapping routines which take size and endiannes as arguments.  */
-
-bfd_vma         bfd_get_bits       PARAMS ((bfd_byte *, int, boolean));
-void            bfd_put_bits       PARAMS ((bfd_vma, bfd_byte *, int, boolean));
-\f
-/* Externally visible ECOFF routines.  */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct symbol_cache_entry;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
-struct bfd_elf_version_tree;
-#endif
-extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
-extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
-extern boolean bfd_ecoff_set_regmasks
-  PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
-          unsigned long *cprmask));
-extern PTR bfd_ecoff_debug_init
-  PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
-          const struct ecoff_debug_swap *output_swap,
-          struct bfd_link_info *));
-extern void bfd_ecoff_debug_free
-  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
-          const struct ecoff_debug_swap *output_swap,
-          struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate
-  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
-          const struct ecoff_debug_swap *output_swap,
-          bfd *input_bfd, struct ecoff_debug_info *input_debug,
-          const struct ecoff_debug_swap *input_swap,
-          struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate_other
-  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
-          const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
-          struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_externals
-  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap,
-          boolean relocateable,
-          boolean (*get_extr) (struct symbol_cache_entry *,
-                               struct ecoff_extr *),
-          void (*set_index) (struct symbol_cache_entry *,
-                             bfd_size_type)));
-extern boolean bfd_ecoff_debug_one_external
-  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap,
-          const char *name, struct ecoff_extr *esym));
-extern bfd_size_type bfd_ecoff_debug_size
-  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap));
-extern boolean bfd_ecoff_write_debug
-  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap, file_ptr where));
-extern boolean bfd_ecoff_write_accumulated_debug
-  PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap,
-          struct bfd_link_info *info, file_ptr where));
-extern boolean bfd_mips_ecoff_create_embedded_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
-          char **));
-
-/* Externally visible ELF routines.  */
-
-struct bfd_link_needed_list
-{
-  struct bfd_link_needed_list *next;
-  bfd *by;
-  const char *name;
-};
-
-extern boolean bfd_elf32_record_link_assignment
-  PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
-extern boolean bfd_elf64_record_link_assignment
-  PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
-extern struct bfd_link_needed_list *bfd_elf_get_needed_list
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf_get_bfd_needed_list
-  PARAMS ((bfd *, struct bfd_link_needed_list **));
-extern boolean bfd_elf32_size_dynamic_sections
-  PARAMS ((bfd *, const char *, const char *, const char *,
-          const char * const *, struct bfd_link_info *, struct sec **,
-          struct bfd_elf_version_tree *));
-extern boolean bfd_elf64_size_dynamic_sections
-  PARAMS ((bfd *, const char *, const char *, const char *,
-          const char * const *, struct bfd_link_info *, struct sec **,
-          struct bfd_elf_version_tree *));
-extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
-extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
-extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
-extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf32_discard_info
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf64_discard_info
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* Return an upper bound on the number of bytes required to store a
-   copy of ABFD's program header table entries.  Return -1 if an error
-   occurs; bfd_get_error will return an appropriate code.  */
-extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
-
-/* Copy ABFD's program header table entries to *PHDRS.  The entries
-   will be stored as an array of Elf_Internal_Phdr structures, as
-   defined in include/elf/internal.h.  To find out how large the
-   buffer needs to be, call bfd_get_elf_phdr_upper_bound.
-
-   Return the number of program header table entries read, or -1 if an
-   error occurs; bfd_get_error will return an appropriate code.  */
-extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
-
-/* Return the arch_size field of an elf bfd, or -1 if not elf.  */
-extern int bfd_get_arch_size PARAMS ((bfd *));
-
-/* Return true if address "naturally" sign extends, or -1 if not elf.  */
-extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
-
-extern boolean bfd_m68k_elf32_create_embedded_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
-          char **));
-extern boolean bfd_mips_elf32_create_embedded_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
-          char **));
-
-/* SunOS shared library support routines for the linker.  */
-
-extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sunos_record_link_assignment
-  PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_sunos_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
-          struct sec **));
-
-/* Linux shared library support routines for the linker.  */
-
-extern boolean bfd_i386linux_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_m68klinux_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sparclinux_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* mmap hacks */
-
-struct _bfd_window_internal;
-typedef struct _bfd_window_internal bfd_window_internal;
-
-typedef struct _bfd_window
-{
-  /* What the user asked for.  */
-  PTR data;
-  bfd_size_type size;
-  /* The actual window used by BFD.  Small user-requested read-only
-     regions sharing a page may share a single window into the object
-     file.  Read-write versions shouldn't until I've fixed things to
-     keep track of which portions have been claimed by the
-     application; don't want to give the same region back when the
-     application wants two writable copies!  */
-  struct _bfd_window_internal *i;
-}
-bfd_window;
-
-extern void bfd_init_window PARAMS ((bfd_window *));
-extern void bfd_free_window PARAMS ((bfd_window *));
-extern boolean bfd_get_file_window
-  PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
-
-/* XCOFF support routines for the linker.  */
-
-extern boolean bfd_xcoff_link_record_set
-  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
-          bfd_size_type));
-extern boolean bfd_xcoff_import_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
-          bfd_vma, const char *, const char *, const char *, unsigned int));
-extern boolean bfd_xcoff_export_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
-extern boolean bfd_xcoff_link_count_reloc
-  PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_record_link_assignment
-  PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
-          unsigned long, unsigned long, unsigned long, boolean,
-          int, boolean, boolean, struct sec **, boolean));
-extern boolean bfd_xcoff_link_generate_rtinit
-  PARAMS ((bfd *, const char *, const char *, boolean));
-
-/* XCOFF support routines for ar.  */
-extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *));
-
-/* Externally visible COFF routines.  */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct internal_syment;
-union internal_auxent;
-#endif
-
-extern boolean bfd_coff_get_syment
-  PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
-
-extern boolean bfd_coff_get_auxent
-  PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
-
-extern boolean bfd_coff_set_symbol_class
-  PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
-
-extern boolean bfd_m68k_coff_create_embedded_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
-          char **));
-
-/* ARM Interworking support.  Called from linker.  */
-extern boolean bfd_arm_allocate_interworking_sections
-  PARAMS ((struct bfd_link_info *));
-
-extern boolean bfd_arm_process_before_allocation
-  PARAMS ((bfd *, struct bfd_link_info *, int));
-
-extern boolean bfd_arm_get_bfd_for_interworking
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* PE ARM Interworking support.  Called from linker.  */
-extern boolean bfd_arm_pe_allocate_interworking_sections
-  PARAMS ((struct bfd_link_info *));
-
-extern boolean bfd_arm_pe_process_before_allocation
-  PARAMS ((bfd *, struct bfd_link_info *, int));
-
-extern boolean bfd_arm_pe_get_bfd_for_interworking
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* ELF ARM Interworking support.  Called from linker.  */
-extern boolean bfd_elf32_arm_allocate_interworking_sections
-  PARAMS ((struct bfd_link_info *));
-
-extern boolean bfd_elf32_arm_process_before_allocation
-  PARAMS ((bfd *, struct bfd_link_info *, int));
-
-extern boolean bfd_elf32_arm_get_bfd_for_interworking
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* TI COFF load page support.  */
-extern void bfd_ticoff_set_section_load_page
-  PARAMS ((struct sec *, int));
-
-extern int bfd_ticoff_get_section_load_page
-  PARAMS ((struct sec *));
-
-/* Extracted from init.c.  */
-void
-bfd_init PARAMS ((void));
-
-/* Extracted from opncls.c.  */
-bfd *
-bfd_openr PARAMS ((const char *filename, const char *target));
-
-bfd *
-bfd_fdopenr PARAMS ((const char *filename, const char *target, int fd));
-
-bfd *
-bfd_openstreamr PARAMS ((const char *, const char *, PTR));
-
-bfd *
-bfd_openw PARAMS ((const char *filename, const char *target));
-
-boolean
-bfd_close PARAMS ((bfd *abfd));
-
-boolean
-bfd_close_all_done PARAMS ((bfd *));
-
-bfd *
-bfd_create PARAMS ((const char *filename, bfd *templ));
-
-boolean
-bfd_make_writable PARAMS ((bfd *abfd));
-
-boolean
-bfd_make_readable PARAMS ((bfd *abfd));
-
-/* Extracted from libbfd.c.  */
-
-/* Byte swapping macros for user section data.  */
-
-#define bfd_put_8(abfd, val, ptr) \
-                ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
-#define bfd_put_signed_8 \
-               bfd_put_8
-#define bfd_get_8(abfd, ptr) \
-                (*(unsigned char *) (ptr) & 0xff)
-#define bfd_get_signed_8(abfd, ptr) \
-               (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
-
-#define bfd_put_16(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
-#define bfd_put_signed_16 \
-                bfd_put_16
-#define bfd_get_16(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx16, (ptr))
-#define bfd_get_signed_16(abfd, ptr) \
-                BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-
-#define bfd_put_32(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
-#define bfd_put_signed_32 \
-                bfd_put_32
-#define bfd_get_32(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx32, (ptr))
-#define bfd_get_signed_32(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
-
-#define bfd_put_64(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
-#define bfd_put_signed_64 \
-                bfd_put_64
-#define bfd_get_64(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx64, (ptr))
-#define bfd_get_signed_64(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
-
-#define bfd_get(bits, abfd, ptr)                               \
-                ( (bits) ==  8 ? (bfd_vma) bfd_get_8 (abfd, ptr)       \
-                : (bits) == 16 ? bfd_get_16 (abfd, ptr)        \
-                : (bits) == 32 ? bfd_get_32 (abfd, ptr)        \
-                : (bits) == 64 ? bfd_get_64 (abfd, ptr)        \
-                : (abort (), (bfd_vma) - 1))
-
-#define bfd_put(bits, abfd, val, ptr)                          \
-                ( (bits) ==  8 ? bfd_put_8  (abfd, val, ptr)   \
-                : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)   \
-                : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)   \
-                : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)   \
-                : (abort (), (void) 0))
-
-
-/* Byte swapping macros for file header data.  */
-
-#define bfd_h_put_8(abfd, val, ptr) \
-  bfd_put_8 (abfd, val, ptr)
-#define bfd_h_put_signed_8(abfd, val, ptr) \
-  bfd_put_8 (abfd, val, ptr)
-#define bfd_h_get_8(abfd, ptr) \
-  bfd_get_8 (abfd, ptr)
-#define bfd_h_get_signed_8(abfd, ptr) \
-  bfd_get_signed_8 (abfd, ptr)
-
-#define bfd_h_put_16(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
-#define bfd_h_put_signed_16 \
-  bfd_h_put_16
-#define bfd_h_get_16(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx16, (ptr))
-#define bfd_h_get_signed_16(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
-
-#define bfd_h_put_32(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
-#define bfd_h_put_signed_32 \
-  bfd_h_put_32
-#define bfd_h_get_32(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx32, (ptr))
-#define bfd_h_get_signed_32(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
-
-#define bfd_h_put_64(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
-#define bfd_h_put_signed_64 \
-  bfd_h_put_64
-#define bfd_h_get_64(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx64, (ptr))
-#define bfd_h_get_signed_64(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
-
-/* Refinements on the above, which should eventually go away.  Save
-   cluttering the source with (bfd_vma) and (bfd_byte *) casts.  */
-
-#define H_PUT_64(abfd, val, where) \
-  bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_32(abfd, val, where) \
-  bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_16(abfd, val, where) \
-  bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_8 bfd_h_put_8
-
-#define H_PUT_S64(abfd, val, where) \
-  bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S32(abfd, val, where) \
-  bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S16(abfd, val, where) \
-  bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S8 bfd_h_put_signed_8
-
-#define H_GET_64(abfd, where) \
-  bfd_h_get_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_32(abfd, where) \
-  bfd_h_get_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_16(abfd, where) \
-  bfd_h_get_16 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_8 bfd_h_get_8
-
-#define H_GET_S64(abfd, where) \
-  bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S32(abfd, where) \
-  bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S16(abfd, where) \
-  bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S8 bfd_h_get_signed_8
-
-
-/* Extracted from bfdio.c.  */
-long
-bfd_get_mtime PARAMS ((bfd *abfd));
-
-long
-bfd_get_size PARAMS ((bfd *abfd));
-
-/* Extracted from bfdwin.c.  */
-/* Extracted from section.c.  */
-/* This structure is used for a comdat section, as in PE.  A comdat
-   section is associated with a particular symbol.  When the linker
-   sees a comdat section, it keeps only one of the sections with a
-   given name and associated with a given symbol.  */
-
-struct bfd_comdat_info
-{
-  /* The name of the symbol associated with a comdat section.  */
-  const char *name;
-
-  /* The local symbol table index of the symbol associated with a
-     comdat section.  This is only meaningful to the object file format
-     specific code; it is not an index into the list returned by
-     bfd_canonicalize_symtab.  */
-  long symbol;
-};
-
-typedef struct sec
-{
-  /* The name of the section; the name isn't a copy, the pointer is
-     the same as that passed to bfd_make_section.  */
-  const char *name;
-
-  /* A unique sequence number.  */
-  int id;
-
-  /* Which section in the bfd; 0..n-1 as sections are created in a bfd.  */
-  int index;
-
-  /* The next section in the list belonging to the BFD, or NULL.  */
-  struct sec *next;
-
-  /* The field flags contains attributes of the section. Some
-     flags are read in from the object file, and some are
-     synthesized from other information.  */
-  flagword flags;
-
-#define SEC_NO_FLAGS   0x000
-
-  /* Tells the OS to allocate space for this section when loading.
-     This is clear for a section containing debug information only.  */
-#define SEC_ALLOC      0x001
-
-  /* Tells the OS to load the section from the file when loading.
-     This is clear for a .bss section.  */
-#define SEC_LOAD       0x002
-
-  /* The section contains data still to be relocated, so there is
-     some relocation information too.  */
-#define SEC_RELOC      0x004
-
-  /* ELF reserves 4 processor specific bits and 8 operating system
-     specific bits in sh_flags; at present we can get away with just
-     one in communicating between the assembler and BFD, but this
-     isn't a good long-term solution.  */
-#define SEC_ARCH_BIT_0 0x008
-
-  /* A signal to the OS that the section contains read only data.  */
-#define SEC_READONLY   0x010
-
-  /* The section contains code only.  */
-#define SEC_CODE       0x020
-
-  /* The section contains data only.  */
-#define SEC_DATA       0x040
-
-  /* The section will reside in ROM.  */
-#define SEC_ROM        0x080
-
-  /* The section contains constructor information. This section
-     type is used by the linker to create lists of constructors and
-     destructors used by <<g++>>. When a back end sees a symbol
-     which should be used in a constructor list, it creates a new
-     section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
-     the symbol to it, and builds a relocation. To build the lists
-     of constructors, all the linker has to do is catenate all the
-     sections called <<__CTOR_LIST__>> and relocate the data
-     contained within - exactly the operations it would peform on
-     standard data.  */
-#define SEC_CONSTRUCTOR 0x100
-
-  /* The section has contents - a data section could be
-     <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
-     <<SEC_HAS_CONTENTS>>  */
-#define SEC_HAS_CONTENTS 0x200
-
-  /* An instruction to the linker to not output the section
-     even if it has information which would normally be written.  */
-#define SEC_NEVER_LOAD 0x400
-
-  /* The section is a COFF shared library section.  This flag is
-     only for the linker.  If this type of section appears in
-     the input file, the linker must copy it to the output file
-     without changing the vma or size.  FIXME: Although this
-     was originally intended to be general, it really is COFF
-     specific (and the flag was renamed to indicate this).  It
-     might be cleaner to have some more general mechanism to
-     allow the back end to control what the linker does with
-     sections.  */
-#define SEC_COFF_SHARED_LIBRARY 0x800
-
-  /* The section contains thread local data.  */
-#define SEC_THREAD_LOCAL 0x1000
-
-  /* The section has GOT references.  This flag is only for the
-     linker, and is currently only used by the elf32-hppa back end.
-     It will be set if global offset table references were detected
-     in this section, which indicate to the linker that the section
-     contains PIC code, and must be handled specially when doing a
-     static link.  */
-#define SEC_HAS_GOT_REF 0x4000
-
-  /* The section contains common symbols (symbols may be defined
-     multiple times, the value of a symbol is the amount of
-     space it requires, and the largest symbol value is the one
-     used).  Most targets have exactly one of these (which we
-     translate to bfd_com_section_ptr), but ECOFF has two.  */
-#define SEC_IS_COMMON 0x8000
-
-  /* The section contains only debugging information.  For
-     example, this is set for ELF .debug and .stab sections.
-     strip tests this flag to see if a section can be
-     discarded.  */
-#define SEC_DEBUGGING 0x10000
-
-  /* The contents of this section are held in memory pointed to
-     by the contents field.  This is checked by bfd_get_section_contents,
-     and the data is retrieved from memory if appropriate.  */
-#define SEC_IN_MEMORY 0x20000
-
-  /* The contents of this section are to be excluded by the
-     linker for executable and shared objects unless those
-     objects are to be further relocated.  */
-#define SEC_EXCLUDE 0x40000
-
-  /* The contents of this section are to be sorted based on the sum of
-     the symbol and addend values specified by the associated relocation
-     entries.  Entries without associated relocation entries will be
-     appended to the end of the section in an unspecified order.  */
-#define SEC_SORT_ENTRIES 0x80000
-
-  /* When linking, duplicate sections of the same name should be
-     discarded, rather than being combined into a single section as
-     is usually done.  This is similar to how common symbols are
-     handled.  See SEC_LINK_DUPLICATES below.  */
-#define SEC_LINK_ONCE 0x100000
-
-  /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
-     should handle duplicate sections.  */
-#define SEC_LINK_DUPLICATES 0x600000
-
-  /* This value for SEC_LINK_DUPLICATES means that duplicate
-     sections with the same name should simply be discarded.  */
-#define SEC_LINK_DUPLICATES_DISCARD 0x0
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if there are any duplicate sections, although
-     it should still only link one copy.  */
-#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if any duplicate sections are a different size.  */
-#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if any duplicate sections contain different
-     contents.  */
-#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
-
-  /* This section was created by the linker as part of dynamic
-     relocation or other arcane processing.  It is skipped when
-     going through the first-pass output, trusting that someone
-     else up the line will take care of it later.  */
-#define SEC_LINKER_CREATED 0x800000
-
-  /* This section should not be subject to garbage collection.  */
-#define SEC_KEEP 0x1000000
-
-  /* This section contains "short" data, and should be placed
-     "near" the GP.  */
-#define SEC_SMALL_DATA 0x2000000
-
-  /* This section contains data which may be shared with other
-     executables or shared objects.  */
-#define SEC_SHARED 0x4000000
-
-  /* When a section with this flag is being linked, then if the size of
-     the input section is less than a page, it should not cross a page
-     boundary.  If the size of the input section is one page or more, it
-     should be aligned on a page boundary.  */
-#define SEC_BLOCK 0x8000000
-
-  /* Conditionally link this section; do not link if there are no
-     references found to any symbol in the section.  */
-#define SEC_CLINK 0x10000000
-
-  /* Attempt to merge identical entities in the section.
-     Entity size is given in the entsize field.  */
-#define SEC_MERGE 0x20000000
-
-  /* If given with SEC_MERGE, entities to merge are zero terminated
-     strings where entsize specifies character size instead of fixed
-     size entries.  */
-#define SEC_STRINGS 0x40000000
-
-  /* This section contains data about section groups.  */
-#define SEC_GROUP 0x80000000
-
-  /*  End of section flags.  */
-
-  /* Some internal packed boolean fields.  */
-
-  /* See the vma field.  */
-  unsigned int user_set_vma : 1;
-
-  /* Whether relocations have been processed.  */
-  unsigned int reloc_done : 1;
-
-  /* A mark flag used by some of the linker backends.  */
-  unsigned int linker_mark : 1;
-
-  /* Another mark flag used by some of the linker backends.  Set for
-     output sections that have an input section.  */
-  unsigned int linker_has_input : 1;
-
-  /* A mark flag used by some linker backends for garbage collection.  */
-  unsigned int gc_mark : 1;
-
-  /* Used by the ELF code to mark sections which have been allocated
-     to segments.  */
-  unsigned int segment_mark : 1;
-
-  /* End of internal packed boolean fields.  */
-
-  /*  The virtual memory address of the section - where it will be
-      at run time.  The symbols are relocated against this.  The
-      user_set_vma flag is maintained by bfd; if it's not set, the
-      backend can assign addresses (for example, in <<a.out>>, where
-      the default address for <<.data>> is dependent on the specific
-      target and various flags).  */
-  bfd_vma vma;
-
-  /*  The load address of the section - where it would be in a
-      rom image; really only used for writing section header
-      information.  */
-  bfd_vma lma;
-
-  /* The size of the section in octets, as it will be output.
-     Contains a value even if the section has no contents (e.g., the
-     size of <<.bss>>).  This will be filled in after relocation.  */
-  bfd_size_type _cooked_size;
-
-  /* The original size on disk of the section, in octets.  Normally this
-     value is the same as the size, but if some relaxing has
-     been done, then this value will be bigger.  */
-  bfd_size_type _raw_size;
-
-  /* If this section is going to be output, then this value is the
-     offset in *bytes* into the output section of the first byte in the
-     input section (byte ==> smallest addressable unit on the
-     target).  In most cases, if this was going to start at the
-     100th octet (8-bit quantity) in the output section, this value
-     would be 100.  However, if the target byte size is 16 bits
-     (bfd_octets_per_byte is "2"), this value would be 50.  */
-  bfd_vma output_offset;
-
-  /* The output section through which to map on output.  */
-  struct sec *output_section;
-
-  /* The alignment requirement of the section, as an exponent of 2 -
-     e.g., 3 aligns to 2^3 (or 8).  */
-  unsigned int alignment_power;
-
-  /* If an input section, a pointer to a vector of relocation
-     records for the data in this section.  */
-  struct reloc_cache_entry *relocation;
-
-  /* If an output section, a pointer to a vector of pointers to
-     relocation records for the data in this section.  */
-  struct reloc_cache_entry **orelocation;
-
-  /* The number of relocation records in one of the above.  */
-  unsigned reloc_count;
-
-  /* Information below is back end specific - and not always used
-     or updated.  */
-
-  /* File position of section data.  */
-  file_ptr filepos;
-
-  /* File position of relocation info.  */
-  file_ptr rel_filepos;
-
-  /* File position of line data.  */
-  file_ptr line_filepos;
-
-  /* Pointer to data for applications.  */
-  PTR userdata;
-
-  /* If the SEC_IN_MEMORY flag is set, this points to the actual
-     contents.  */
-  unsigned char *contents;
-
-  /* Attached line number information.  */
-  alent *lineno;
-
-  /* Number of line number records.  */
-  unsigned int lineno_count;
-
-  /* Entity size for merging purposes.  */
-  unsigned int entsize;
-
-  /* Optional information about a COMDAT entry; NULL if not COMDAT.  */
-  struct bfd_comdat_info *comdat;
-
-  /* When a section is being output, this value changes as more
-     linenumbers are written out.  */
-  file_ptr moving_line_filepos;
-
-  /* What the section number is in the target world.  */
-  int target_index;
-
-  PTR used_by_bfd;
-
-  /* If this is a constructor section then here is a list of the
-     relocations created to relocate items within it.  */
-  struct relent_chain *constructor_chain;
-
-  /* The BFD which owns the section.  */
-  bfd *owner;
-
-  /* A symbol which points at this section only.  */
-  struct symbol_cache_entry *symbol;
-  struct symbol_cache_entry **symbol_ptr_ptr;
-
-  struct bfd_link_order *link_order_head;
-  struct bfd_link_order *link_order_tail;
-} asection;
-
-/* These sections are global, and are managed by BFD.  The application
-   and target back end are not permitted to change the values in
-   these sections.  New code should use the section_ptr macros rather
-   than referring directly to the const sections.  The const sections
-   may eventually vanish.  */
-#define BFD_ABS_SECTION_NAME "*ABS*"
-#define BFD_UND_SECTION_NAME "*UND*"
-#define BFD_COM_SECTION_NAME "*COM*"
-#define BFD_IND_SECTION_NAME "*IND*"
-
-/* The absolute section.  */
-extern const asection bfd_abs_section;
-#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-/* Pointer to the undefined section.  */
-extern const asection bfd_und_section;
-#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-/* Pointer to the common section.  */
-extern const asection bfd_com_section;
-#define bfd_com_section_ptr ((asection *) &bfd_com_section)
-/* Pointer to the indirect section.  */
-extern const asection bfd_ind_section;
-#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
-#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-
-#define bfd_is_const_section(SEC)              \
- (   ((SEC) == bfd_abs_section_ptr)            \
-  || ((SEC) == bfd_und_section_ptr)            \
-  || ((SEC) == bfd_com_section_ptr)            \
-  || ((SEC) == bfd_ind_section_ptr))
-
-extern const struct symbol_cache_entry * const bfd_abs_symbol;
-extern const struct symbol_cache_entry * const bfd_com_symbol;
-extern const struct symbol_cache_entry * const bfd_und_symbol;
-extern const struct symbol_cache_entry * const bfd_ind_symbol;
-#define bfd_get_section_size_before_reloc(section) \
-     ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
-                            : (section)->_raw_size)
-#define bfd_get_section_size_after_reloc(section) \
-     ((section)->reloc_done ? (section)->_cooked_size \
-                            : (abort (), (bfd_size_type) 1))
-
-/* Macros to handle insertion and deletion of a bfd's sections.  These
-   only handle the list pointers, ie. do not adjust section_count,
-   target_index etc.  */
-#define bfd_section_list_remove(ABFD, PS) \
-  do                                                   \
-    {                                                  \
-      asection **_ps = PS;                             \
-      asection *_s = *_ps;                             \
-      *_ps = _s->next;                                 \
-      if (_s->next == NULL)                            \
-        (ABFD)->section_tail = _ps;                    \
-    }                                                  \
-  while (0)
-#define bfd_section_list_insert(ABFD, PS, S) \
-  do                                                   \
-    {                                                  \
-      asection **_ps = PS;                             \
-      asection *_s = S;                                \
-      _s->next = *_ps;                                 \
-      *_ps = _s;                                       \
-      if (_s->next == NULL)                            \
-        (ABFD)->section_tail = &_s->next;              \
-    }                                                  \
-  while (0)
-
-void
-bfd_section_list_clear PARAMS ((bfd *));
-
-asection *
-bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
-
-char *
-bfd_get_unique_section_name PARAMS ((bfd *abfd,
-    const char *templat,
-    int *count));
-
-asection *
-bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name));
-
-asection *
-bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name));
-
-asection *
-bfd_make_section PARAMS ((bfd *, const char *name));
-
-boolean
-bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
-
-void
-bfd_map_over_sections PARAMS ((bfd *abfd,
-    void (*func) (bfd *abfd,
-    asection *sect,
-    PTR obj),
-    PTR obj));
-
-boolean
-bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
-
-boolean
-bfd_set_section_contents PARAMS ((bfd *abfd, asection *section,
-    PTR data, file_ptr offset,
-    bfd_size_type count));
-
-boolean
-bfd_get_section_contents PARAMS ((bfd *abfd, asection *section,
-    PTR location, file_ptr offset,
-    bfd_size_type count));
-
-boolean
-bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec,
-    bfd *obfd, asection *osec));
-
-#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
-     BFD_SEND (obfd, _bfd_copy_private_section_data, \
-               (ibfd, isection, obfd, osection))
-void
-_bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section));
-
-boolean
-bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group));
-
-/* Extracted from archures.c.  */
-enum bfd_architecture
-{
-  bfd_arch_unknown,   /* File arch not known.  */
-  bfd_arch_obscure,   /* Arch known, not one of these.  */
-  bfd_arch_m68k,      /* Motorola 68xxx */
-#define bfd_mach_m68000 1
-#define bfd_mach_m68008 2
-#define bfd_mach_m68010 3
-#define bfd_mach_m68020 4
-#define bfd_mach_m68030 5
-#define bfd_mach_m68040 6
-#define bfd_mach_m68060 7
-#define bfd_mach_cpu32  8
-#define bfd_mach_mcf5200  9
-#define bfd_mach_mcf5206e 10
-#define bfd_mach_mcf5307  11
-#define bfd_mach_mcf5407  12
-  bfd_arch_vax,       /* DEC Vax */
-  bfd_arch_i960,      /* Intel 960 */
-    /* The order of the following is important.
-       lower number indicates a machine type that
-       only accepts a subset of the instructions
-       available to machines with higher numbers.
-       The exception is the "ca", which is
-       incompatible with all other machines except
-       "core".  */
-
-#define bfd_mach_i960_core      1
-#define bfd_mach_i960_ka_sa     2
-#define bfd_mach_i960_kb_sb     3
-#define bfd_mach_i960_mc        4
-#define bfd_mach_i960_xa        5
-#define bfd_mach_i960_ca        6
-#define bfd_mach_i960_jx        7
-#define bfd_mach_i960_hx        8
-
-  bfd_arch_or32,      /* OpenRISC 32 */
-
-  bfd_arch_a29k,      /* AMD 29000 */
-  bfd_arch_sparc,     /* SPARC */
-#define bfd_mach_sparc                 1
-/* The difference between v8plus and v9 is that v9 is a true 64 bit env.  */
-#define bfd_mach_sparc_sparclet        2
-#define bfd_mach_sparc_sparclite       3
-#define bfd_mach_sparc_v8plus          4
-#define bfd_mach_sparc_v8plusa         5 /* with ultrasparc add'ns.  */
-#define bfd_mach_sparc_sparclite_le    6
-#define bfd_mach_sparc_v9              7
-#define bfd_mach_sparc_v9a             8 /* with ultrasparc add'ns.  */
-#define bfd_mach_sparc_v8plusb         9 /* with cheetah add'ns.  */
-#define bfd_mach_sparc_v9b             10 /* with cheetah add'ns.  */
-/* Nonzero if MACH has the v9 instruction set.  */
-#define bfd_mach_sparc_v9_p(mach) \
-  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
-   && (mach) != bfd_mach_sparc_sparclite_le)
-  bfd_arch_mips,      /* MIPS Rxxxx */
-#define bfd_mach_mips3000              3000
-#define bfd_mach_mips3900              3900
-#define bfd_mach_mips4000              4000
-#define bfd_mach_mips4010              4010
-#define bfd_mach_mips4100              4100
-#define bfd_mach_mips4111              4111
-#define bfd_mach_mips4120              4120
-#define bfd_mach_mips4300              4300
-#define bfd_mach_mips4400              4400
-#define bfd_mach_mips4600              4600
-#define bfd_mach_mips4650              4650
-#define bfd_mach_mips5000              5000
-#define bfd_mach_mips5400              5400
-#define bfd_mach_mips5500              5500
-#define bfd_mach_mips6000              6000
-#define bfd_mach_mips8000              8000
-#define bfd_mach_mips10000             10000
-#define bfd_mach_mips12000             12000
-#define bfd_mach_mips16                16
-#define bfd_mach_mips5                 5
-#define bfd_mach_mips_sb1              12310201 /* octal 'SB', 01 */
-#define bfd_mach_mipsisa32             32
-#define bfd_mach_mipsisa64             64
-  bfd_arch_i386,      /* Intel 386 */
-#define bfd_mach_i386_i386 1
-#define bfd_mach_i386_i8086 2
-#define bfd_mach_i386_i386_intel_syntax 3
-#define bfd_mach_x86_64 64
-#define bfd_mach_x86_64_intel_syntax 65
-  bfd_arch_we32k,     /* AT&T WE32xxx */
-  bfd_arch_tahoe,     /* CCI/Harris Tahoe */
-  bfd_arch_i860,      /* Intel 860 */
-  bfd_arch_i370,      /* IBM 360/370 Mainframes */
-  bfd_arch_romp,      /* IBM ROMP PC/RT */
-  bfd_arch_alliant,   /* Alliant */
-  bfd_arch_convex,    /* Convex */
-  bfd_arch_m88k,      /* Motorola 88xxx */
-  bfd_arch_m98k,      /* Motorola 98xxx */
-  bfd_arch_pyramid,   /* Pyramid Technology */
-  bfd_arch_h8300,     /* Hitachi H8/300 */
-#define bfd_mach_h8300   1
-#define bfd_mach_h8300h  2
-#define bfd_mach_h8300s  3
-  bfd_arch_pdp11,     /* DEC PDP-11 */
-  bfd_arch_powerpc,   /* PowerPC */
-#define bfd_mach_ppc           32
-#define bfd_mach_ppc64         64
-#define bfd_mach_ppc_403       403
-#define bfd_mach_ppc_403gc     4030
-#define bfd_mach_ppc_505       505
-#define bfd_mach_ppc_601       601
-#define bfd_mach_ppc_602       602
-#define bfd_mach_ppc_603       603
-#define bfd_mach_ppc_ec603e    6031
-#define bfd_mach_ppc_604       604
-#define bfd_mach_ppc_620       620
-#define bfd_mach_ppc_630       630
-#define bfd_mach_ppc_750       750
-#define bfd_mach_ppc_860       860
-#define bfd_mach_ppc_a35       35
-#define bfd_mach_ppc_rs64ii    642
-#define bfd_mach_ppc_rs64iii   643
-#define bfd_mach_ppc_7400      7400
-#define bfd_mach_ppc_e500      500
-  bfd_arch_rs6000,    /* IBM RS/6000 */
-#define bfd_mach_rs6k          6000
-#define bfd_mach_rs6k_rs1      6001
-#define bfd_mach_rs6k_rsc      6003
-#define bfd_mach_rs6k_rs2      6002
-  bfd_arch_hppa,      /* HP PA RISC */
-  bfd_arch_d10v,      /* Mitsubishi D10V */
-#define bfd_mach_d10v          1
-#define bfd_mach_d10v_ts2      2
-#define bfd_mach_d10v_ts3      3
-  bfd_arch_d30v,      /* Mitsubishi D30V */
-  bfd_arch_dlx,       /* DLX */
-  bfd_arch_m68hc11,   /* Motorola 68HC11 */
-  bfd_arch_m68hc12,   /* Motorola 68HC12 */
-  bfd_arch_z8k,       /* Zilog Z8000 */
-#define bfd_mach_z8001         1
-#define bfd_mach_z8002         2
-  bfd_arch_h8500,     /* Hitachi H8/500 */
-  bfd_arch_sh,        /* Hitachi SH */
-#define bfd_mach_sh            1
-#define bfd_mach_sh2        0x20
-#define bfd_mach_sh_dsp     0x2d
-#define bfd_mach_sh3        0x30
-#define bfd_mach_sh3_dsp    0x3d
-#define bfd_mach_sh3e       0x3e
-#define bfd_mach_sh4        0x40
-#define bfd_mach_sh5        0x50
-  bfd_arch_alpha,     /* Dec Alpha */
-#define bfd_mach_alpha_ev4  0x10
-#define bfd_mach_alpha_ev5  0x20
-#define bfd_mach_alpha_ev6  0x30
-  bfd_arch_arm,       /* Advanced Risc Machines ARM.  */
-#define bfd_mach_arm_2         1
-#define bfd_mach_arm_2a        2
-#define bfd_mach_arm_3         3
-#define bfd_mach_arm_3M        4
-#define bfd_mach_arm_4         5
-#define bfd_mach_arm_4T        6
-#define bfd_mach_arm_5         7
-#define bfd_mach_arm_5T        8
-#define bfd_mach_arm_5TE       9
-#define bfd_mach_arm_XScale    10
-  bfd_arch_ns32k,     /* National Semiconductors ns32000 */
-  bfd_arch_w65,       /* WDC 65816 */
-  bfd_arch_tic30,     /* Texas Instruments TMS320C30 */
-  bfd_arch_tic4x,     /* Texas Instruments TMS320C3X/4X */
-#define bfd_mach_c3x           30
-#define bfd_mach_c4x           40
-  bfd_arch_tic54x,    /* Texas Instruments TMS320C54X */
-  bfd_arch_tic80,     /* TI TMS320c80 (MVP) */
-  bfd_arch_v850,      /* NEC V850 */
-#define bfd_mach_v850          1
-#define bfd_mach_v850e         'E'
-  bfd_arch_arc,       /* ARC Cores */
-#define bfd_mach_arc_5         5
-#define bfd_mach_arc_6         6
-#define bfd_mach_arc_7         7
-#define bfd_mach_arc_8         8
-  bfd_arch_m32r,      /* Mitsubishi M32R/D */
-#define bfd_mach_m32r          1 /* For backwards compatibility.  */
-#define bfd_mach_m32rx         'x'
-  bfd_arch_mn10200,   /* Matsushita MN10200 */
-  bfd_arch_mn10300,   /* Matsushita MN10300 */
-#define bfd_mach_mn10300               300
-#define bfd_mach_am33          330
-  bfd_arch_fr30,
-#define bfd_mach_fr30          0x46523330
-  bfd_arch_frv,
-#define bfd_mach_frv           1
-#define bfd_mach_frvsimple     2
-#define bfd_mach_fr300         300
-#define bfd_mach_fr400         400
-#define bfd_mach_frvtomcat     499     /* fr500 prototype */
-#define bfd_mach_fr500         500
-  bfd_arch_mcore,
-  bfd_arch_ia64,      /* HP/Intel ia64 */
-#define bfd_mach_ia64_elf64    64
-#define bfd_mach_ia64_elf32    32
-  bfd_arch_ip2k,      /* Ubicom IP2K microcontrollers. */
-#define bfd_mach_ip2022        1
-#define bfd_mach_ip2022ext     2
-  bfd_arch_pj,
-  bfd_arch_avr,       /* Atmel AVR microcontrollers.  */
-#define bfd_mach_avr1          1
-#define bfd_mach_avr2          2
-#define bfd_mach_avr3          3
-#define bfd_mach_avr4          4
-#define bfd_mach_avr5          5
-  bfd_arch_cris,      /* Axis CRIS */
-  bfd_arch_s390,      /* IBM s390 */
-#define bfd_mach_s390_31       31
-#define bfd_mach_s390_64       64
-  bfd_arch_openrisc,  /* OpenRISC */
-  bfd_arch_mmix,      /* Donald Knuth's educational processor.  */
-  bfd_arch_xstormy16,
-#define bfd_mach_xstormy16     1
-  bfd_arch_last
-  };
-
-typedef struct bfd_arch_info
-{
-  int bits_per_word;
-  int bits_per_address;
-  int bits_per_byte;
-  enum bfd_architecture arch;
-  unsigned long mach;
-  const char *arch_name;
-  const char *printable_name;
-  unsigned int section_align_power;
-  /* True if this is the default machine for the architecture.
-     The default arch should be the first entry for an arch so that
-     all the entries for that arch can be accessed via <<next>>.  */
-  boolean the_default;
-  const struct bfd_arch_info * (*compatible)
-       PARAMS ((const struct bfd_arch_info *a,
-                const struct bfd_arch_info *b));
-
-  boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
-
-  const struct bfd_arch_info *next;
-}
-bfd_arch_info_type;
-
-const char *
-bfd_printable_name PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_scan_arch PARAMS ((const char *string));
-
-const char **
-bfd_arch_list PARAMS ((void));
-
-const bfd_arch_info_type *
-bfd_arch_get_compatible PARAMS ((
-    const bfd *abfd,
-    const bfd *bbfd));
-
-void
-bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
-
-enum bfd_architecture
-bfd_get_arch PARAMS ((bfd *abfd));
-
-unsigned long
-bfd_get_mach PARAMS ((bfd *abfd));
-
-unsigned int
-bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
-
-unsigned int
-bfd_arch_bits_per_address PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_get_arch_info PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_lookup_arch PARAMS ((enum bfd_architecture
-    arch,
-    unsigned long machine));
-
-const char *
-bfd_printable_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long machine));
-
-unsigned int
-bfd_octets_per_byte PARAMS ((bfd *abfd));
-
-unsigned int
-bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
-    unsigned long machine));
-
-/* Extracted from reloc.c.  */
-typedef enum bfd_reloc_status
-{
-  /* No errors detected.  */
-  bfd_reloc_ok,
-
-  /* The relocation was performed, but there was an overflow.  */
-  bfd_reloc_overflow,
-
-  /* The address to relocate was not within the section supplied.  */
-  bfd_reloc_outofrange,
-
-  /* Used by special functions.  */
-  bfd_reloc_continue,
-
-  /* Unsupported relocation size requested.  */
-  bfd_reloc_notsupported,
-
-  /* Unused.  */
-  bfd_reloc_other,
-
-  /* The symbol to relocate against was undefined.  */
-  bfd_reloc_undefined,
-
-  /* The relocation was performed, but may not be ok - presently
-     generated only when linking i960 coff files with i960 b.out
-     symbols.  If this type is returned, the error_message argument
-     to bfd_perform_relocation will be set.  */
-  bfd_reloc_dangerous
- }
- bfd_reloc_status_type;
-
-
-typedef struct reloc_cache_entry
-{
-  /* A pointer into the canonical table of pointers.  */
-  struct symbol_cache_entry **sym_ptr_ptr;
-
-  /* offset in section.  */
-  bfd_size_type address;
-
-  /* addend for relocation value.  */
-  bfd_vma addend;
-
-  /* Pointer to how to perform the required relocation.  */
-  reloc_howto_type *howto;
-
-}
-arelent;
-
-enum complain_overflow
-{
-  /* Do not complain on overflow.  */
-  complain_overflow_dont,
-
-  /* Complain if the bitfield overflows, whether it is considered
-     as signed or unsigned.  */
-  complain_overflow_bitfield,
-
-  /* Complain if the value overflows when considered as signed
-     number.  */
-  complain_overflow_signed,
-
-  /* Complain if the value overflows when considered as an
-     unsigned number.  */
-  complain_overflow_unsigned
-};
-
-struct reloc_howto_struct
-{
-  /*  The type field has mainly a documentary use - the back end can
-      do what it wants with it, though normally the back end's
-      external idea of what a reloc number is stored
-      in this field.  For example, a PC relative word relocation
-      in a coff environment has the type 023 - because that's
-      what the outside world calls a R_PCRWORD reloc.  */
-  unsigned int type;
-
-  /*  The value the final relocation is shifted right by.  This drops
-      unwanted data from the relocation.  */
-  unsigned int rightshift;
-
-  /*  The size of the item to be relocated.  This is *not* a
-      power-of-two measure.  To get the number of bytes operated
-      on by a type of relocation, use bfd_get_reloc_size.  */
-  int size;
-
-  /*  The number of bits in the item to be relocated.  This is used
-      when doing overflow checking.  */
-  unsigned int bitsize;
-
-  /*  Notes that the relocation is relative to the location in the
-      data section of the addend.  The relocation function will
-      subtract from the relocation value the address of the location
-      being relocated.  */
-  boolean pc_relative;
-
-  /*  The bit position of the reloc value in the destination.
-      The relocated value is left shifted by this amount.  */
-  unsigned int bitpos;
-
-  /* What type of overflow error should be checked for when
-     relocating.  */
-  enum complain_overflow complain_on_overflow;
-
-  /* If this field is non null, then the supplied function is
-     called rather than the normal function.  This allows really
-     strange relocation methods to be accomodated (e.g., i960 callj
-     instructions).  */
-  bfd_reloc_status_type (*special_function)
-    PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
-             bfd *, char **));
-
-  /* The textual name of the relocation type.  */
-  char *name;
-
-  /* Some formats record a relocation addend in the section contents
-     rather than with the relocation.  For ELF formats this is the
-     distinction between USE_REL and USE_RELA (though the code checks
-     for USE_REL == 1/0).  The value of this field is TRUE if the
-     addend is recorded with the section contents; when performing a
-     partial link (ld -r) the section contents (the data) will be
-     modified.  The value of this field is FALSE if addends are
-     recorded with the relocation (in arelent.addend); when performing
-     a partial link the relocation will be modified.
-     All relocations for all ELF USE_RELA targets should set this field
-     to FALSE (values of TRUE should be looked on with suspicion).
-     However, the converse is not true: not all relocations of all ELF
-     USE_REL targets set this field to TRUE.  Why this is so is peculiar
-     to each particular target.  For relocs that aren't used in partial
-     links (e.g. GOT stuff) it doesn't matter what this is set to.  */
-  boolean partial_inplace;
-
-  /* The src_mask selects which parts of the read in data
-     are to be used in the relocation sum.  E.g., if this was an 8 bit
-     byte of data which we read and relocated, this would be
-     0x000000ff.  When we have relocs which have an addend, such as
-     sun4 extended relocs, the value in the offset part of a
-     relocating field is garbage so we never use it.  In this case
-     the mask would be 0x00000000.  */
-  bfd_vma src_mask;
-
-  /* The dst_mask selects which parts of the instruction are replaced
-     into the instruction.  In most cases src_mask == dst_mask,
-     except in the above special case, where dst_mask would be
-     0x000000ff, and src_mask would be 0x00000000.  */
-  bfd_vma dst_mask;
-
-  /* When some formats create PC relative instructions, they leave
-     the value of the pc of the place being relocated in the offset
-     slot of the instruction, so that a PC relative relocation can
-     be made just by adding in an ordinary offset (e.g., sun3 a.out).
-     Some formats leave the displacement part of an instruction
-     empty (e.g., m88k bcs); this flag signals the fact.  */
-  boolean pcrel_offset;
-};
-
-#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
-  { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
-#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
-  HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
-         NAME, false, 0, 0, IN)
-
-#define EMPTY_HOWTO(C) \
-  HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \
-         NULL, false, 0, 0, false)
-
-#define HOWTO_PREPARE(relocation, symbol)               \
-  {                                                     \
-    if (symbol != (asymbol *) NULL)                     \
-      {                                                 \
-        if (bfd_is_com_section (symbol->section))       \
-          {                                             \
-            relocation = 0;                             \
-          }                                             \
-        else                                            \
-          {                                             \
-            relocation = symbol->value;                 \
-          }                                             \
-      }                                                 \
-  }
-
-unsigned int
-bfd_get_reloc_size PARAMS ((reloc_howto_type *));
-
-typedef struct relent_chain
-{
-  arelent relent;
-  struct relent_chain *next;
-}
-arelent_chain;
-
-bfd_reloc_status_type
-bfd_check_overflow PARAMS ((enum complain_overflow how,
-    unsigned int bitsize,
-    unsigned int rightshift,
-    unsigned int addrsize,
-    bfd_vma relocation));
-
-bfd_reloc_status_type
-bfd_perform_relocation PARAMS ((bfd *abfd,
-    arelent *reloc_entry,
-    PTR data,
-    asection *input_section,
-    bfd *output_bfd,
-    char **error_message));
-
-bfd_reloc_status_type
-bfd_install_relocation PARAMS ((bfd *abfd,
-    arelent *reloc_entry,
-    PTR data, bfd_vma data_start,
-    asection *input_section,
-    char **error_message));
-
-enum bfd_reloc_code_real {
-  _dummy_first_bfd_reloc_code_real,
-
-
-/* Basic absolute relocations of N bits.  */
-  BFD_RELOC_64,
-  BFD_RELOC_32,
-  BFD_RELOC_26,
-  BFD_RELOC_24,
-  BFD_RELOC_16,
-  BFD_RELOC_14,
-  BFD_RELOC_8,
-
-/* PC-relative relocations.  Sometimes these are relative to the address
-of the relocation itself; sometimes they are relative to the start of
-the section containing the relocation.  It depends on the specific target.
-
-The 24-bit relocation is used in some Intel 960 configurations.  */
-  BFD_RELOC_64_PCREL,
-  BFD_RELOC_32_PCREL,
-  BFD_RELOC_24_PCREL,
-  BFD_RELOC_16_PCREL,
-  BFD_RELOC_12_PCREL,
-  BFD_RELOC_8_PCREL,
-
-/* For ELF.  */
-  BFD_RELOC_32_GOT_PCREL,
-  BFD_RELOC_16_GOT_PCREL,
-  BFD_RELOC_8_GOT_PCREL,
-  BFD_RELOC_32_GOTOFF,
-  BFD_RELOC_16_GOTOFF,
-  BFD_RELOC_LO16_GOTOFF,
-  BFD_RELOC_HI16_GOTOFF,
-  BFD_RELOC_HI16_S_GOTOFF,
-  BFD_RELOC_8_GOTOFF,
-  BFD_RELOC_64_PLT_PCREL,
-  BFD_RELOC_32_PLT_PCREL,
-  BFD_RELOC_24_PLT_PCREL,
-  BFD_RELOC_16_PLT_PCREL,
-  BFD_RELOC_8_PLT_PCREL,
-  BFD_RELOC_64_PLTOFF,
-  BFD_RELOC_32_PLTOFF,
-  BFD_RELOC_16_PLTOFF,
-  BFD_RELOC_LO16_PLTOFF,
-  BFD_RELOC_HI16_PLTOFF,
-  BFD_RELOC_HI16_S_PLTOFF,
-  BFD_RELOC_8_PLTOFF,
-
-/* Relocations used by 68K ELF.  */
-  BFD_RELOC_68K_GLOB_DAT,
-  BFD_RELOC_68K_JMP_SLOT,
-  BFD_RELOC_68K_RELATIVE,
-
-/* Linkage-table relative.  */
-  BFD_RELOC_32_BASEREL,
-  BFD_RELOC_16_BASEREL,
-  BFD_RELOC_LO16_BASEREL,
-  BFD_RELOC_HI16_BASEREL,
-  BFD_RELOC_HI16_S_BASEREL,
-  BFD_RELOC_8_BASEREL,
-  BFD_RELOC_RVA,
-
-/* Absolute 8-bit relocation, but used to form an address like 0xFFnn.  */
-  BFD_RELOC_8_FFnn,
-
-/* These PC-relative relocations are stored as word displacements --
-i.e., byte displacements shifted right two bits.  The 30-bit word
-displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
-SPARC.  (SPARC tools generally refer to this as <<WDISP30>>.)  The
-signed 16-bit displacement is used on the MIPS, and the 23-bit
-displacement is used on the Alpha.  */
-  BFD_RELOC_32_PCREL_S2,
-  BFD_RELOC_16_PCREL_S2,
-  BFD_RELOC_23_PCREL_S2,
-
-/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
-the target word.  These are used on the SPARC.  */
-  BFD_RELOC_HI22,
-  BFD_RELOC_LO10,
-
-/* For systems that allocate a Global Pointer register, these are
-displacements off that register.  These relocation types are
-handled specially, because the value the register will have is
-decided relatively late.  */
-  BFD_RELOC_GPREL16,
-  BFD_RELOC_GPREL32,
-
-/* Reloc types used for i960/b.out.  */
-  BFD_RELOC_I960_CALLJ,
-
-/* SPARC ELF relocations.  There is probably some overlap with other
-relocation types already defined.  */
-  BFD_RELOC_NONE,
-  BFD_RELOC_SPARC_WDISP22,
-  BFD_RELOC_SPARC22,
-  BFD_RELOC_SPARC13,
-  BFD_RELOC_SPARC_GOT10,
-  BFD_RELOC_SPARC_GOT13,
-  BFD_RELOC_SPARC_GOT22,
-  BFD_RELOC_SPARC_PC10,
-  BFD_RELOC_SPARC_PC22,
-  BFD_RELOC_SPARC_WPLT30,
-  BFD_RELOC_SPARC_COPY,
-  BFD_RELOC_SPARC_GLOB_DAT,
-  BFD_RELOC_SPARC_JMP_SLOT,
-  BFD_RELOC_SPARC_RELATIVE,
-  BFD_RELOC_SPARC_UA16,
-  BFD_RELOC_SPARC_UA32,
-  BFD_RELOC_SPARC_UA64,
-
-/* I think these are specific to SPARC a.out (e.g., Sun 4).  */
-  BFD_RELOC_SPARC_BASE13,
-  BFD_RELOC_SPARC_BASE22,
-
-/* SPARC64 relocations  */
-#define BFD_RELOC_SPARC_64 BFD_RELOC_64
-  BFD_RELOC_SPARC_10,
-  BFD_RELOC_SPARC_11,
-  BFD_RELOC_SPARC_OLO10,
-  BFD_RELOC_SPARC_HH22,
-  BFD_RELOC_SPARC_HM10,
-  BFD_RELOC_SPARC_LM22,
-  BFD_RELOC_SPARC_PC_HH22,
-  BFD_RELOC_SPARC_PC_HM10,
-  BFD_RELOC_SPARC_PC_LM22,
-  BFD_RELOC_SPARC_WDISP16,
-  BFD_RELOC_SPARC_WDISP19,
-  BFD_RELOC_SPARC_7,
-  BFD_RELOC_SPARC_6,
-  BFD_RELOC_SPARC_5,
-#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
-  BFD_RELOC_SPARC_PLT32,
-  BFD_RELOC_SPARC_PLT64,
-  BFD_RELOC_SPARC_HIX22,
-  BFD_RELOC_SPARC_LOX10,
-  BFD_RELOC_SPARC_H44,
-  BFD_RELOC_SPARC_M44,
-  BFD_RELOC_SPARC_L44,
-  BFD_RELOC_SPARC_REGISTER,
-
-/* SPARC little endian relocation  */
-  BFD_RELOC_SPARC_REV32,
-
-/* Alpha ECOFF and ELF relocations.  Some of these treat the symbol or
-"addend" in some special way.
-For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
-writing; when reading, it will be the absolute section symbol.  The
-addend is the displacement in bytes of the "lda" instruction from
-the "ldah" instruction (which is at the address of this reloc).  */
-  BFD_RELOC_ALPHA_GPDISP_HI16,
-
-/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
-with GPDISP_HI16 relocs.  The addend is ignored when writing the
-relocations out, and is filled in with the file's GP value on
-reading, for convenience.  */
-  BFD_RELOC_ALPHA_GPDISP_LO16,
-
-/* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
-relocation except that there is no accompanying GPDISP_LO16
-relocation.  */
-  BFD_RELOC_ALPHA_GPDISP,
-
-/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
-the assembler turns it into a LDQ instruction to load the address of
-the symbol, and then fills in a register in the real instruction.
-
-The LITERAL reloc, at the LDQ instruction, refers to the .lita
-section symbol.  The addend is ignored when writing, but is filled
-in with the file's GP value on reading, for convenience, as with the
-GPDISP_LO16 reloc.
-
-The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
-It should refer to the symbol to be referenced, as with 16_GOTOFF,
-but it generates output not based on the position within the .got
-section, but relative to the GP value chosen for the file during the
-final link stage.
-
-The LITUSE reloc, on the instruction using the loaded address, gives
-information to the linker that it might be able to use to optimize
-away some literal section references.  The symbol is ignored (read
-as the absolute section symbol), and the "addend" indicates the type
-of instruction using the register:
-1 - "memory" fmt insn
-2 - byte-manipulation (byte offset reg)
-3 - jsr (target of branch)  */
-  BFD_RELOC_ALPHA_LITERAL,
-  BFD_RELOC_ALPHA_ELF_LITERAL,
-  BFD_RELOC_ALPHA_LITUSE,
-
-/* The HINT relocation indicates a value that should be filled into the
-"hint" field of a jmp/jsr/ret instruction, for possible branch-
-prediction logic which may be provided on some processors.  */
-  BFD_RELOC_ALPHA_HINT,
-
-/* The LINKAGE relocation outputs a linkage pair in the object file,
-which is filled by the linker.  */
-  BFD_RELOC_ALPHA_LINKAGE,
-
-/* The CODEADDR relocation outputs a STO_CA in the object file,
-which is filled by the linker.  */
-  BFD_RELOC_ALPHA_CODEADDR,
-
-/* The GPREL_HI/LO relocations together form a 32-bit offset from the
-GP register.  */
-  BFD_RELOC_ALPHA_GPREL_HI16,
-  BFD_RELOC_ALPHA_GPREL_LO16,
-
-/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must
-share a common GP, and the target address is adjusted for 
-STO_ALPHA_STD_GPLOAD.  */
-  BFD_RELOC_ALPHA_BRSGP,
-
-/* Alpha thread-local storage relocations.  */
-  BFD_RELOC_ALPHA_TLSGD,
-  BFD_RELOC_ALPHA_TLSLDM,
-  BFD_RELOC_ALPHA_DTPMOD64,
-  BFD_RELOC_ALPHA_GOTDTPREL16,
-  BFD_RELOC_ALPHA_DTPREL64,
-  BFD_RELOC_ALPHA_DTPREL_HI16,
-  BFD_RELOC_ALPHA_DTPREL_LO16,
-  BFD_RELOC_ALPHA_DTPREL16,
-  BFD_RELOC_ALPHA_GOTTPREL16,
-  BFD_RELOC_ALPHA_TPREL64,
-  BFD_RELOC_ALPHA_TPREL_HI16,
-  BFD_RELOC_ALPHA_TPREL_LO16,
-  BFD_RELOC_ALPHA_TPREL16,
-
-/* Bits 27..2 of the relocation address shifted right 2 bits;
-simple reloc otherwise.  */
-  BFD_RELOC_MIPS_JMP,
-
-/* The MIPS16 jump instruction.  */
-  BFD_RELOC_MIPS16_JMP,
-
-/* MIPS16 GP relative reloc.  */
-  BFD_RELOC_MIPS16_GPREL,
-
-/* High 16 bits of 32-bit value; simple reloc.  */
-  BFD_RELOC_HI16,
-
-/* High 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result.  If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added.  */
-  BFD_RELOC_HI16_S,
-
-/* Low 16 bits.  */
-  BFD_RELOC_LO16,
-
-/* Like BFD_RELOC_HI16_S, but PC relative.  */
-  BFD_RELOC_PCREL_HI16_S,
-
-/* Like BFD_RELOC_LO16, but PC relative.  */
-  BFD_RELOC_PCREL_LO16,
-
-/* Relocation against a MIPS literal section.  */
-  BFD_RELOC_MIPS_LITERAL,
-
-/* MIPS ELF relocations.  */
-  BFD_RELOC_MIPS_GOT16,
-  BFD_RELOC_MIPS_CALL16,
-  BFD_RELOC_MIPS_GOT_HI16,
-  BFD_RELOC_MIPS_GOT_LO16,
-  BFD_RELOC_MIPS_CALL_HI16,
-  BFD_RELOC_MIPS_CALL_LO16,
-  BFD_RELOC_MIPS_SUB,
-  BFD_RELOC_MIPS_GOT_PAGE,
-  BFD_RELOC_MIPS_GOT_OFST,
-  BFD_RELOC_MIPS_GOT_DISP,
-  BFD_RELOC_MIPS_SHIFT5,
-  BFD_RELOC_MIPS_SHIFT6,
-  BFD_RELOC_MIPS_INSERT_A,
-  BFD_RELOC_MIPS_INSERT_B,
-  BFD_RELOC_MIPS_DELETE,
-  BFD_RELOC_MIPS_HIGHEST,
-  BFD_RELOC_MIPS_HIGHER,
-  BFD_RELOC_MIPS_SCN_DISP,
-  BFD_RELOC_MIPS_REL16,
-  BFD_RELOC_MIPS_RELGOT,
-  BFD_RELOC_MIPS_JALR,
-
-/* Fujitsu Frv Relocations.  */
-  BFD_RELOC_FRV_LABEL16,
-  BFD_RELOC_FRV_LABEL24,
-  BFD_RELOC_FRV_LO16,
-  BFD_RELOC_FRV_HI16,
-  BFD_RELOC_FRV_GPREL12,
-  BFD_RELOC_FRV_GPRELU12,
-  BFD_RELOC_FRV_GPREL32,
-  BFD_RELOC_FRV_GPRELHI,
-  BFD_RELOC_FRV_GPRELLO,
-
-
-/* i386/elf relocations  */
-  BFD_RELOC_386_GOT32,
-  BFD_RELOC_386_PLT32,
-  BFD_RELOC_386_COPY,
-  BFD_RELOC_386_GLOB_DAT,
-  BFD_RELOC_386_JUMP_SLOT,
-  BFD_RELOC_386_RELATIVE,
-  BFD_RELOC_386_GOTOFF,
-  BFD_RELOC_386_GOTPC,
-  BFD_RELOC_386_TLS_TPOFF,
-  BFD_RELOC_386_TLS_IE,
-  BFD_RELOC_386_TLS_GOTIE,
-  BFD_RELOC_386_TLS_LE,
-  BFD_RELOC_386_TLS_GD,
-  BFD_RELOC_386_TLS_LDM,
-  BFD_RELOC_386_TLS_LDO_32,
-  BFD_RELOC_386_TLS_IE_32,
-  BFD_RELOC_386_TLS_LE_32,
-  BFD_RELOC_386_TLS_DTPMOD32,
-  BFD_RELOC_386_TLS_DTPOFF32,
-  BFD_RELOC_386_TLS_TPOFF32,
-
-/* x86-64/elf relocations  */
-  BFD_RELOC_X86_64_GOT32,
-  BFD_RELOC_X86_64_PLT32,
-  BFD_RELOC_X86_64_COPY,
-  BFD_RELOC_X86_64_GLOB_DAT,
-  BFD_RELOC_X86_64_JUMP_SLOT,
-  BFD_RELOC_X86_64_RELATIVE,
-  BFD_RELOC_X86_64_GOTPCREL,
-  BFD_RELOC_X86_64_32S,
-  BFD_RELOC_X86_64_DTPMOD64,
-  BFD_RELOC_X86_64_DTPOFF64,
-  BFD_RELOC_X86_64_TPOFF64,
-  BFD_RELOC_X86_64_TLSGD,
-  BFD_RELOC_X86_64_TLSLD,
-  BFD_RELOC_X86_64_DTPOFF32,
-  BFD_RELOC_X86_64_GOTTPOFF,
-  BFD_RELOC_X86_64_TPOFF32,
-
-/* ns32k relocations  */
-  BFD_RELOC_NS32K_IMM_8,
-  BFD_RELOC_NS32K_IMM_16,
-  BFD_RELOC_NS32K_IMM_32,
-  BFD_RELOC_NS32K_IMM_8_PCREL,
-  BFD_RELOC_NS32K_IMM_16_PCREL,
-  BFD_RELOC_NS32K_IMM_32_PCREL,
-  BFD_RELOC_NS32K_DISP_8,
-  BFD_RELOC_NS32K_DISP_16,
-  BFD_RELOC_NS32K_DISP_32,
-  BFD_RELOC_NS32K_DISP_8_PCREL,
-  BFD_RELOC_NS32K_DISP_16_PCREL,
-  BFD_RELOC_NS32K_DISP_32_PCREL,
-
-/* PDP11 relocations  */
-  BFD_RELOC_PDP11_DISP_8_PCREL,
-  BFD_RELOC_PDP11_DISP_6_PCREL,
-
-/* Picojava relocs.  Not all of these appear in object files.  */
-  BFD_RELOC_PJ_CODE_HI16,
-  BFD_RELOC_PJ_CODE_LO16,
-  BFD_RELOC_PJ_CODE_DIR16,
-  BFD_RELOC_PJ_CODE_DIR32,
-  BFD_RELOC_PJ_CODE_REL16,
-  BFD_RELOC_PJ_CODE_REL32,
-
-/* Power(rs6000) and PowerPC relocations.  */
-  BFD_RELOC_PPC_B26,
-  BFD_RELOC_PPC_BA26,
-  BFD_RELOC_PPC_TOC16,
-  BFD_RELOC_PPC_B16,
-  BFD_RELOC_PPC_B16_BRTAKEN,
-  BFD_RELOC_PPC_B16_BRNTAKEN,
-  BFD_RELOC_PPC_BA16,
-  BFD_RELOC_PPC_BA16_BRTAKEN,
-  BFD_RELOC_PPC_BA16_BRNTAKEN,
-  BFD_RELOC_PPC_COPY,
-  BFD_RELOC_PPC_GLOB_DAT,
-  BFD_RELOC_PPC_JMP_SLOT,
-  BFD_RELOC_PPC_RELATIVE,
-  BFD_RELOC_PPC_LOCAL24PC,
-  BFD_RELOC_PPC_EMB_NADDR32,
-  BFD_RELOC_PPC_EMB_NADDR16,
-  BFD_RELOC_PPC_EMB_NADDR16_LO,
-  BFD_RELOC_PPC_EMB_NADDR16_HI,
-  BFD_RELOC_PPC_EMB_NADDR16_HA,
-  BFD_RELOC_PPC_EMB_SDAI16,
-  BFD_RELOC_PPC_EMB_SDA2I16,
-  BFD_RELOC_PPC_EMB_SDA2REL,
-  BFD_RELOC_PPC_EMB_SDA21,
-  BFD_RELOC_PPC_EMB_MRKREF,
-  BFD_RELOC_PPC_EMB_RELSEC16,
-  BFD_RELOC_PPC_EMB_RELST_LO,
-  BFD_RELOC_PPC_EMB_RELST_HI,
-  BFD_RELOC_PPC_EMB_RELST_HA,
-  BFD_RELOC_PPC_EMB_BIT_FLD,
-  BFD_RELOC_PPC_EMB_RELSDA,
-  BFD_RELOC_PPC64_HIGHER,
-  BFD_RELOC_PPC64_HIGHER_S,
-  BFD_RELOC_PPC64_HIGHEST,
-  BFD_RELOC_PPC64_HIGHEST_S,
-  BFD_RELOC_PPC64_TOC16_LO,
-  BFD_RELOC_PPC64_TOC16_HI,
-  BFD_RELOC_PPC64_TOC16_HA,
-  BFD_RELOC_PPC64_TOC,
-  BFD_RELOC_PPC64_PLTGOT16,
-  BFD_RELOC_PPC64_PLTGOT16_LO,
-  BFD_RELOC_PPC64_PLTGOT16_HI,
-  BFD_RELOC_PPC64_PLTGOT16_HA,
-  BFD_RELOC_PPC64_ADDR16_DS,
-  BFD_RELOC_PPC64_ADDR16_LO_DS,
-  BFD_RELOC_PPC64_GOT16_DS,
-  BFD_RELOC_PPC64_GOT16_LO_DS,
-  BFD_RELOC_PPC64_PLT16_LO_DS,
-  BFD_RELOC_PPC64_SECTOFF_DS,
-  BFD_RELOC_PPC64_SECTOFF_LO_DS,
-  BFD_RELOC_PPC64_TOC16_DS,
-  BFD_RELOC_PPC64_TOC16_LO_DS,
-  BFD_RELOC_PPC64_PLTGOT16_DS,
-  BFD_RELOC_PPC64_PLTGOT16_LO_DS,
-
-/* IBM 370/390 relocations  */
-  BFD_RELOC_I370_D12,
-
-/* The type of reloc used to build a contructor table - at the moment
-probably a 32 bit wide absolute relocation, but the target can choose.
-It generally does map to one of the other relocation types.  */
-  BFD_RELOC_CTOR,
-
-/* ARM 26 bit pc-relative branch.  The lowest two bits must be zero and are
-not stored in the instruction.  */
-  BFD_RELOC_ARM_PCREL_BRANCH,
-
-/* ARM 26 bit pc-relative branch.  The lowest bit must be zero and is
-not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
-field in the instruction.  */
-  BFD_RELOC_ARM_PCREL_BLX,
-
-/* Thumb 22 bit pc-relative branch.  The lowest bit must be zero and is
-not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
-field in the instruction.  */
-  BFD_RELOC_THUMB_PCREL_BLX,
-
-/* These relocs are only used within the ARM assembler.  They are not
-(at present) written to any object files.  */
-  BFD_RELOC_ARM_IMMEDIATE,
-  BFD_RELOC_ARM_ADRL_IMMEDIATE,
-  BFD_RELOC_ARM_OFFSET_IMM,
-  BFD_RELOC_ARM_SHIFT_IMM,
-  BFD_RELOC_ARM_SWI,
-  BFD_RELOC_ARM_MULTI,
-  BFD_RELOC_ARM_CP_OFF_IMM,
-  BFD_RELOC_ARM_ADR_IMM,
-  BFD_RELOC_ARM_LDR_IMM,
-  BFD_RELOC_ARM_LITERAL,
-  BFD_RELOC_ARM_IN_POOL,
-  BFD_RELOC_ARM_OFFSET_IMM8,
-  BFD_RELOC_ARM_HWLITERAL,
-  BFD_RELOC_ARM_THUMB_ADD,
-  BFD_RELOC_ARM_THUMB_IMM,
-  BFD_RELOC_ARM_THUMB_SHIFT,
-  BFD_RELOC_ARM_THUMB_OFFSET,
-  BFD_RELOC_ARM_GOT12,
-  BFD_RELOC_ARM_GOT32,
-  BFD_RELOC_ARM_JUMP_SLOT,
-  BFD_RELOC_ARM_COPY,
-  BFD_RELOC_ARM_GLOB_DAT,
-  BFD_RELOC_ARM_PLT32,
-  BFD_RELOC_ARM_RELATIVE,
-  BFD_RELOC_ARM_GOTOFF,
-  BFD_RELOC_ARM_GOTPC,
-
-/* Hitachi SH relocs.  Not all of these appear in object files.  */
-  BFD_RELOC_SH_PCDISP8BY2,
-  BFD_RELOC_SH_PCDISP12BY2,
-  BFD_RELOC_SH_IMM4,
-  BFD_RELOC_SH_IMM4BY2,
-  BFD_RELOC_SH_IMM4BY4,
-  BFD_RELOC_SH_IMM8,
-  BFD_RELOC_SH_IMM8BY2,
-  BFD_RELOC_SH_IMM8BY4,
-  BFD_RELOC_SH_PCRELIMM8BY2,
-  BFD_RELOC_SH_PCRELIMM8BY4,
-  BFD_RELOC_SH_SWITCH16,
-  BFD_RELOC_SH_SWITCH32,
-  BFD_RELOC_SH_USES,
-  BFD_RELOC_SH_COUNT,
-  BFD_RELOC_SH_ALIGN,
-  BFD_RELOC_SH_CODE,
-  BFD_RELOC_SH_DATA,
-  BFD_RELOC_SH_LABEL,
-  BFD_RELOC_SH_LOOP_START,
-  BFD_RELOC_SH_LOOP_END,
-  BFD_RELOC_SH_COPY,
-  BFD_RELOC_SH_GLOB_DAT,
-  BFD_RELOC_SH_JMP_SLOT,
-  BFD_RELOC_SH_RELATIVE,
-  BFD_RELOC_SH_GOTPC,
-  BFD_RELOC_SH_GOT_LOW16,
-  BFD_RELOC_SH_GOT_MEDLOW16,
-  BFD_RELOC_SH_GOT_MEDHI16,
-  BFD_RELOC_SH_GOT_HI16,
-  BFD_RELOC_SH_GOTPLT_LOW16,
-  BFD_RELOC_SH_GOTPLT_MEDLOW16,
-  BFD_RELOC_SH_GOTPLT_MEDHI16,
-  BFD_RELOC_SH_GOTPLT_HI16,
-  BFD_RELOC_SH_PLT_LOW16,
-  BFD_RELOC_SH_PLT_MEDLOW16,
-  BFD_RELOC_SH_PLT_MEDHI16,
-  BFD_RELOC_SH_PLT_HI16,
-  BFD_RELOC_SH_GOTOFF_LOW16,
-  BFD_RELOC_SH_GOTOFF_MEDLOW16,
-  BFD_RELOC_SH_GOTOFF_MEDHI16,
-  BFD_RELOC_SH_GOTOFF_HI16,
-  BFD_RELOC_SH_GOTPC_LOW16,
-  BFD_RELOC_SH_GOTPC_MEDLOW16,
-  BFD_RELOC_SH_GOTPC_MEDHI16,
-  BFD_RELOC_SH_GOTPC_HI16,
-  BFD_RELOC_SH_COPY64,
-  BFD_RELOC_SH_GLOB_DAT64,
-  BFD_RELOC_SH_JMP_SLOT64,
-  BFD_RELOC_SH_RELATIVE64,
-  BFD_RELOC_SH_GOT10BY4,
-  BFD_RELOC_SH_GOT10BY8,
-  BFD_RELOC_SH_GOTPLT10BY4,
-  BFD_RELOC_SH_GOTPLT10BY8,
-  BFD_RELOC_SH_GOTPLT32,
-  BFD_RELOC_SH_SHMEDIA_CODE,
-  BFD_RELOC_SH_IMMU5,
-  BFD_RELOC_SH_IMMS6,
-  BFD_RELOC_SH_IMMS6BY32,
-  BFD_RELOC_SH_IMMU6,
-  BFD_RELOC_SH_IMMS10,
-  BFD_RELOC_SH_IMMS10BY2,
-  BFD_RELOC_SH_IMMS10BY4,
-  BFD_RELOC_SH_IMMS10BY8,
-  BFD_RELOC_SH_IMMS16,
-  BFD_RELOC_SH_IMMU16,
-  BFD_RELOC_SH_IMM_LOW16,
-  BFD_RELOC_SH_IMM_LOW16_PCREL,
-  BFD_RELOC_SH_IMM_MEDLOW16,
-  BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
-  BFD_RELOC_SH_IMM_MEDHI16,
-  BFD_RELOC_SH_IMM_MEDHI16_PCREL,
-  BFD_RELOC_SH_IMM_HI16,
-  BFD_RELOC_SH_IMM_HI16_PCREL,
-  BFD_RELOC_SH_PT_16,
-  BFD_RELOC_SH_TLS_GD_32,
-  BFD_RELOC_SH_TLS_LD_32,
-  BFD_RELOC_SH_TLS_LDO_32,
-  BFD_RELOC_SH_TLS_IE_32,
-  BFD_RELOC_SH_TLS_LE_32,
-  BFD_RELOC_SH_TLS_DTPMOD32,
-  BFD_RELOC_SH_TLS_DTPOFF32,
-  BFD_RELOC_SH_TLS_TPOFF32,
-
-/* Thumb 23-, 12- and 9-bit pc-relative branches.  The lowest bit must
-be zero and is not stored in the instruction.  */
-  BFD_RELOC_THUMB_PCREL_BRANCH9,
-  BFD_RELOC_THUMB_PCREL_BRANCH12,
-  BFD_RELOC_THUMB_PCREL_BRANCH23,
-
-/* ARC Cores relocs.
-ARC 22 bit pc-relative branch.  The lowest two bits must be zero and are
-not stored in the instruction.  The high 20 bits are installed in bits 26
-through 7 of the instruction.  */
-  BFD_RELOC_ARC_B22_PCREL,
-
-/* ARC 26 bit absolute branch.  The lowest two bits must be zero and are not
-stored in the instruction.  The high 24 bits are installed in bits 23
-through 0.  */
-  BFD_RELOC_ARC_B26,
-
-/* Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0.  */
-  BFD_RELOC_D10V_10_PCREL_R,
-
-/* Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0.  This is the same as the previous reloc
-except it is in the left container, i.e.,
-shifted left 15 bits.  */
-  BFD_RELOC_D10V_10_PCREL_L,
-
-/* This is an 18-bit reloc with the right 2 bits
-assumed to be 0.  */
-  BFD_RELOC_D10V_18,
-
-/* This is an 18-bit reloc with the right 2 bits
-assumed to be 0.  */
-  BFD_RELOC_D10V_18_PCREL,
-
-/* Mitsubishi D30V relocs.
-This is a 6-bit absolute reloc.  */
-  BFD_RELOC_D30V_6,
-
-/* This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0.  */
-  BFD_RELOC_D30V_9_PCREL,
-
-/* This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.  */
-  BFD_RELOC_D30V_9_PCREL_R,
-
-/* This is a 12-bit absolute reloc with the
-right 3 bitsassumed to be 0.  */
-  BFD_RELOC_D30V_15,
-
-/* This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0.  */
-  BFD_RELOC_D30V_15_PCREL,
-
-/* This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.  */
-  BFD_RELOC_D30V_15_PCREL_R,
-
-/* This is an 18-bit absolute reloc with
-the right 3 bits assumed to be 0.  */
-  BFD_RELOC_D30V_21,
-
-/* This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0.  */
-  BFD_RELOC_D30V_21_PCREL,
-
-/* This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.  */
-  BFD_RELOC_D30V_21_PCREL_R,
-
-/* This is a 32-bit absolute reloc.  */
-  BFD_RELOC_D30V_32,
-
-/* This is a 32-bit pc-relative reloc.  */
-  BFD_RELOC_D30V_32_PCREL,
-
-/* DLX relocs  */
-  BFD_RELOC_DLX_HI16_S,
-
-/* DLX relocs  */
-  BFD_RELOC_DLX_LO16,
-
-/* DLX relocs  */
-  BFD_RELOC_DLX_JMP26,
-
-/* Mitsubishi M32R relocs.
-This is a 24 bit absolute address.  */
-  BFD_RELOC_M32R_24,
-
-/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0.  */
-  BFD_RELOC_M32R_10_PCREL,
-
-/* This is an 18-bit reloc with the right 2 bits assumed to be 0.  */
-  BFD_RELOC_M32R_18_PCREL,
-
-/* This is a 26-bit reloc with the right 2 bits assumed to be 0.  */
-  BFD_RELOC_M32R_26_PCREL,
-
-/* This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as unsigned.  */
-  BFD_RELOC_M32R_HI16_ULO,
-
-/* This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as signed.  */
-  BFD_RELOC_M32R_HI16_SLO,
-
-/* This is a 16-bit reloc containing the lower 16 bits of an address.  */
-  BFD_RELOC_M32R_LO16,
-
-/* This is a 16-bit reloc containing the small data area offset for use in
-add3, load, and store instructions.  */
-  BFD_RELOC_M32R_SDA16,
-
-/* This is a 9-bit reloc  */
-  BFD_RELOC_V850_9_PCREL,
-
-/* This is a 22-bit reloc  */
-  BFD_RELOC_V850_22_PCREL,
-
-/* This is a 16 bit offset from the short data area pointer.  */
-  BFD_RELOC_V850_SDA_16_16_OFFSET,
-
-/* This is a 16 bit offset (of which only 15 bits are used) from the
-short data area pointer.  */
-  BFD_RELOC_V850_SDA_15_16_OFFSET,
-
-/* This is a 16 bit offset from the zero data area pointer.  */
-  BFD_RELOC_V850_ZDA_16_16_OFFSET,
-
-/* This is a 16 bit offset (of which only 15 bits are used) from the
-zero data area pointer.  */
-  BFD_RELOC_V850_ZDA_15_16_OFFSET,
-
-/* This is an 8 bit offset (of which only 6 bits are used) from the
-tiny data area pointer.  */
-  BFD_RELOC_V850_TDA_6_8_OFFSET,
-
-/* This is an 8bit offset (of which only 7 bits are used) from the tiny
-data area pointer.  */
-  BFD_RELOC_V850_TDA_7_8_OFFSET,
-
-/* This is a 7 bit offset from the tiny data area pointer.  */
-  BFD_RELOC_V850_TDA_7_7_OFFSET,
-
-/* This is a 16 bit offset from the tiny data area pointer.  */
-  BFD_RELOC_V850_TDA_16_16_OFFSET,
-
-/* This is a 5 bit offset (of which only 4 bits are used) from the tiny
-data area pointer.  */
-  BFD_RELOC_V850_TDA_4_5_OFFSET,
-
-/* This is a 4 bit offset from the tiny data area pointer.  */
-  BFD_RELOC_V850_TDA_4_4_OFFSET,
-
-/* This is a 16 bit offset from the short data area pointer, with the
-bits placed non-contigously in the instruction.  */
-  BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
-
-/* This is a 16 bit offset from the zero data area pointer, with the
-bits placed non-contigously in the instruction.  */
-  BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
-
-/* This is a 6 bit offset from the call table base pointer.  */
-  BFD_RELOC_V850_CALLT_6_7_OFFSET,
-
-/* This is a 16 bit offset from the call table base pointer.  */
-  BFD_RELOC_V850_CALLT_16_16_OFFSET,
-
-/* Used for relaxing indirect function calls.  */
-  BFD_RELOC_V850_LONGCALL,
-
-/* Used for relaxing indirect jumps.  */
-  BFD_RELOC_V850_LONGJUMP,
-
-/* Used to maintain alignment whilst relaxing.  */
-  BFD_RELOC_V850_ALIGN,
-
-/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.  */
-  BFD_RELOC_MN10300_32_PCREL,
-
-/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.  */
-  BFD_RELOC_MN10300_16_PCREL,
-
-/* This is a 8bit DP reloc for the tms320c30, where the most
-significant 8 bits of a 24 bit word are placed into the least
-significant 8 bits of the opcode.  */
-  BFD_RELOC_TIC30_LDP,
-
-/* This is a 7bit reloc for the tms320c54x, where the least
-significant 7 bits of a 16 bit word are placed into the least
-significant 7 bits of the opcode.  */
-  BFD_RELOC_TIC54X_PARTLS7,
-
-/* This is a 9bit DP reloc for the tms320c54x, where the most
-significant 9 bits of a 16 bit word are placed into the least
-significant 9 bits of the opcode.  */
-  BFD_RELOC_TIC54X_PARTMS9,
-
-/* This is an extended address 23-bit reloc for the tms320c54x.  */
-  BFD_RELOC_TIC54X_23,
-
-/* This is a 16-bit reloc for the tms320c54x, where the least
-significant 16 bits of a 23-bit extended address are placed into
-the opcode.  */
-  BFD_RELOC_TIC54X_16_OF_23,
-
-/* This is a reloc for the tms320c54x, where the most
-significant 7 bits of a 23-bit extended address are placed into
-the opcode.  */
-  BFD_RELOC_TIC54X_MS7_OF_23,
-
-/* This is a 48 bit reloc for the FR30 that stores 32 bits.  */
-  BFD_RELOC_FR30_48,
-
-/* This is a 32 bit reloc for the FR30 that stores 20 bits split up into
-two sections.  */
-  BFD_RELOC_FR30_20,
-
-/* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
-4 bits.  */
-  BFD_RELOC_FR30_6_IN_4,
-
-/* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
-into 8 bits.  */
-  BFD_RELOC_FR30_8_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
-into 8 bits.  */
-  BFD_RELOC_FR30_9_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
-into 8 bits.  */
-  BFD_RELOC_FR30_10_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
-short offset into 8 bits.  */
-  BFD_RELOC_FR30_9_PCREL,
-
-/* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
-short offset into 11 bits.  */
-  BFD_RELOC_FR30_12_PCREL,
-
-/* Motorola Mcore relocations.  */
-  BFD_RELOC_MCORE_PCREL_IMM8BY4,
-  BFD_RELOC_MCORE_PCREL_IMM11BY2,
-  BFD_RELOC_MCORE_PCREL_IMM4BY2,
-  BFD_RELOC_MCORE_PCREL_32,
-  BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
-  BFD_RELOC_MCORE_RVA,
-
-/* These are relocations for the GETA instruction.  */
-  BFD_RELOC_MMIX_GETA,
-  BFD_RELOC_MMIX_GETA_1,
-  BFD_RELOC_MMIX_GETA_2,
-  BFD_RELOC_MMIX_GETA_3,
-
-/* These are relocations for a conditional branch instruction.  */
-  BFD_RELOC_MMIX_CBRANCH,
-  BFD_RELOC_MMIX_CBRANCH_J,
-  BFD_RELOC_MMIX_CBRANCH_1,
-  BFD_RELOC_MMIX_CBRANCH_2,
-  BFD_RELOC_MMIX_CBRANCH_3,
-
-/* These are relocations for the PUSHJ instruction.  */
-  BFD_RELOC_MMIX_PUSHJ,
-  BFD_RELOC_MMIX_PUSHJ_1,
-  BFD_RELOC_MMIX_PUSHJ_2,
-  BFD_RELOC_MMIX_PUSHJ_3,
-
-/* These are relocations for the JMP instruction.  */
-  BFD_RELOC_MMIX_JMP,
-  BFD_RELOC_MMIX_JMP_1,
-  BFD_RELOC_MMIX_JMP_2,
-  BFD_RELOC_MMIX_JMP_3,
-
-/* This is a relocation for a relative address as in a GETA instruction or
-a branch.  */
-  BFD_RELOC_MMIX_ADDR19,
-
-/* This is a relocation for a relative address as in a JMP instruction.  */
-  BFD_RELOC_MMIX_ADDR27,
-
-/* This is a relocation for an instruction field that may be a general
-register or a value 0..255.  */
-  BFD_RELOC_MMIX_REG_OR_BYTE,
-
-/* This is a relocation for an instruction field that may be a general
-register.  */
-  BFD_RELOC_MMIX_REG,
-
-/* This is a relocation for two instruction fields holding a register and
-an offset, the equivalent of the relocation.  */
-  BFD_RELOC_MMIX_BASE_PLUS_OFFSET,
-
-/* This relocation is an assertion that the expression is not allocated as
-a global register.  It does not modify contents.  */
-  BFD_RELOC_MMIX_LOCAL,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
-short offset into 7 bits.  */
-  BFD_RELOC_AVR_7_PCREL,
-
-/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
-short offset into 12 bits.  */
-  BFD_RELOC_AVR_13_PCREL,
-
-/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
-program memory address) into 16 bits.  */
-  BFD_RELOC_AVR_16_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-data memory address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_LO8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of data memory address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_HI8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of program memory address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_HH8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually data memory address) into 8 bit immediate value of SUBI insn.  */
-  BFD_RELOC_AVR_LO8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of data memory address) into 8 bit immediate value of
-SUBI insn.  */
-  BFD_RELOC_AVR_HI8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(most high 8 bit of program memory address) into 8 bit immediate value
-of LDI or SUBI insn.  */
-  BFD_RELOC_AVR_HH8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-command address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_LO8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of command address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_HI8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of command address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_HH8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually command address) into 8 bit immediate value of SUBI insn.  */
-  BFD_RELOC_AVR_LO8_LDI_PM_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of 16 bit command address) into 8 bit immediate value
-of SUBI insn.  */
-  BFD_RELOC_AVR_HI8_LDI_PM_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 6 bit of 22 bit command address) into 8 bit immediate
-value of SUBI insn.  */
-  BFD_RELOC_AVR_HH8_LDI_PM_NEG,
-
-/* This is a 32 bit reloc for the AVR that stores 23 bit value
-into 22 bits.  */
-  BFD_RELOC_AVR_CALL,
-
-/* Direct 12 bit.  */
-  BFD_RELOC_390_12,
-
-/* 12 bit GOT offset.  */
-  BFD_RELOC_390_GOT12,
-
-/* 32 bit PC relative PLT address.  */
-  BFD_RELOC_390_PLT32,
-
-/* Copy symbol at runtime.  */
-  BFD_RELOC_390_COPY,
-
-/* Create GOT entry.  */
-  BFD_RELOC_390_GLOB_DAT,
-
-/* Create PLT entry.  */
-  BFD_RELOC_390_JMP_SLOT,
-
-/* Adjust by program base.  */
-  BFD_RELOC_390_RELATIVE,
-
-/* 32 bit PC relative offset to GOT.  */
-  BFD_RELOC_390_GOTPC,
-
-/* 16 bit GOT offset.  */
-  BFD_RELOC_390_GOT16,
-
-/* PC relative 16 bit shifted by 1.  */
-  BFD_RELOC_390_PC16DBL,
-
-/* 16 bit PC rel. PLT shifted by 1.  */
-  BFD_RELOC_390_PLT16DBL,
-
-/* PC relative 32 bit shifted by 1.  */
-  BFD_RELOC_390_PC32DBL,
-
-/* 32 bit PC rel. PLT shifted by 1.  */
-  BFD_RELOC_390_PLT32DBL,
-
-/* 32 bit PC rel. GOT shifted by 1.  */
-  BFD_RELOC_390_GOTPCDBL,
-
-/* 64 bit GOT offset.  */
-  BFD_RELOC_390_GOT64,
-
-/* 64 bit PC relative PLT address.  */
-  BFD_RELOC_390_PLT64,
-
-/* 32 bit rel. offset to GOT entry.  */
-  BFD_RELOC_390_GOTENT,
-
-/* Scenix IP2K - 9-bit register number / data address  */
-  BFD_RELOC_IP2K_FR9,
-
-/* Scenix IP2K - 4-bit register/data bank number  */
-  BFD_RELOC_IP2K_BANK,
-
-/* Scenix IP2K - low 13 bits of instruction word address  */
-  BFD_RELOC_IP2K_ADDR16CJP,
-
-/* Scenix IP2K - high 3 bits of instruction word address  */
-  BFD_RELOC_IP2K_PAGE3,
-
-/* Scenix IP2K - ext/low/high 8 bits of data address  */
-  BFD_RELOC_IP2K_LO8DATA,
-  BFD_RELOC_IP2K_HI8DATA,
-  BFD_RELOC_IP2K_EX8DATA,
-
-/* Scenix IP2K - low/high 8 bits of instruction word address  */
-  BFD_RELOC_IP2K_LO8INSN,
-  BFD_RELOC_IP2K_HI8INSN,
-
-/* Scenix IP2K - even/odd PC modifier to modify snb pcl.0  */
-  BFD_RELOC_IP2K_PC_SKIP,
-
-/* Scenix IP2K - 16 bit word address in text section.  */
-  BFD_RELOC_IP2K_TEXT,
-
-/* Scenix IP2K - 7-bit sp or dp offset  */
-  BFD_RELOC_IP2K_FR_OFFSET,
-
-/* Scenix VPE4K coprocessor - data/insn-space addressing  */
-  BFD_RELOC_VPE4KMATH_DATA,
-  BFD_RELOC_VPE4KMATH_INSN,
-
-/* These two relocations are used by the linker to determine which of
-the entries in a C++ virtual function table are actually used.  When
-the --gc-sections option is given, the linker will zero out the entries
-that are not used, so that the code for those functions need not be
-included in the output.
-
-VTABLE_INHERIT is a zero-space relocation used to describe to the
-linker the inheritence tree of a C++ virtual function table.  The
-relocation's symbol should be the parent class' vtable, and the
-relocation should be located at the child vtable.
-
-VTABLE_ENTRY is a zero-space relocation that describes the use of a
-virtual function table entry.  The reloc's symbol should refer to the
-table of the class mentioned in the code.  Off of that base, an offset
-describes the entry that is being used.  For Rela hosts, this offset
-is stored in the reloc's addend.  For Rel hosts, we are forced to put
-this offset in the reloc's section offset.  */
-  BFD_RELOC_VTABLE_INHERIT,
-  BFD_RELOC_VTABLE_ENTRY,
-
-/* Intel IA64 Relocations.  */
-  BFD_RELOC_IA64_IMM14,
-  BFD_RELOC_IA64_IMM22,
-  BFD_RELOC_IA64_IMM64,
-  BFD_RELOC_IA64_DIR32MSB,
-  BFD_RELOC_IA64_DIR32LSB,
-  BFD_RELOC_IA64_DIR64MSB,
-  BFD_RELOC_IA64_DIR64LSB,
-  BFD_RELOC_IA64_GPREL22,
-  BFD_RELOC_IA64_GPREL64I,
-  BFD_RELOC_IA64_GPREL32MSB,
-  BFD_RELOC_IA64_GPREL32LSB,
-  BFD_RELOC_IA64_GPREL64MSB,
-  BFD_RELOC_IA64_GPREL64LSB,
-  BFD_RELOC_IA64_LTOFF22,
-  BFD_RELOC_IA64_LTOFF64I,
-  BFD_RELOC_IA64_PLTOFF22,
-  BFD_RELOC_IA64_PLTOFF64I,
-  BFD_RELOC_IA64_PLTOFF64MSB,
-  BFD_RELOC_IA64_PLTOFF64LSB,
-  BFD_RELOC_IA64_FPTR64I,
-  BFD_RELOC_IA64_FPTR32MSB,
-  BFD_RELOC_IA64_FPTR32LSB,
-  BFD_RELOC_IA64_FPTR64MSB,
-  BFD_RELOC_IA64_FPTR64LSB,
-  BFD_RELOC_IA64_PCREL21B,
-  BFD_RELOC_IA64_PCREL21BI,
-  BFD_RELOC_IA64_PCREL21M,
-  BFD_RELOC_IA64_PCREL21F,
-  BFD_RELOC_IA64_PCREL22,
-  BFD_RELOC_IA64_PCREL60B,
-  BFD_RELOC_IA64_PCREL64I,
-  BFD_RELOC_IA64_PCREL32MSB,
-  BFD_RELOC_IA64_PCREL32LSB,
-  BFD_RELOC_IA64_PCREL64MSB,
-  BFD_RELOC_IA64_PCREL64LSB,
-  BFD_RELOC_IA64_LTOFF_FPTR22,
-  BFD_RELOC_IA64_LTOFF_FPTR64I,
-  BFD_RELOC_IA64_LTOFF_FPTR32MSB,
-  BFD_RELOC_IA64_LTOFF_FPTR32LSB,
-  BFD_RELOC_IA64_LTOFF_FPTR64MSB,
-  BFD_RELOC_IA64_LTOFF_FPTR64LSB,
-  BFD_RELOC_IA64_SEGREL32MSB,
-  BFD_RELOC_IA64_SEGREL32LSB,
-  BFD_RELOC_IA64_SEGREL64MSB,
-  BFD_RELOC_IA64_SEGREL64LSB,
-  BFD_RELOC_IA64_SECREL32MSB,
-  BFD_RELOC_IA64_SECREL32LSB,
-  BFD_RELOC_IA64_SECREL64MSB,
-  BFD_RELOC_IA64_SECREL64LSB,
-  BFD_RELOC_IA64_REL32MSB,
-  BFD_RELOC_IA64_REL32LSB,
-  BFD_RELOC_IA64_REL64MSB,
-  BFD_RELOC_IA64_REL64LSB,
-  BFD_RELOC_IA64_LTV32MSB,
-  BFD_RELOC_IA64_LTV32LSB,
-  BFD_RELOC_IA64_LTV64MSB,
-  BFD_RELOC_IA64_LTV64LSB,
-  BFD_RELOC_IA64_IPLTMSB,
-  BFD_RELOC_IA64_IPLTLSB,
-  BFD_RELOC_IA64_COPY,
-  BFD_RELOC_IA64_LTOFF22X,
-  BFD_RELOC_IA64_LDXMOV,
-  BFD_RELOC_IA64_TPREL14,
-  BFD_RELOC_IA64_TPREL22,
-  BFD_RELOC_IA64_TPREL64I,
-  BFD_RELOC_IA64_TPREL64MSB,
-  BFD_RELOC_IA64_TPREL64LSB,
-  BFD_RELOC_IA64_LTOFF_TPREL22,
-  BFD_RELOC_IA64_DTPMOD64MSB,
-  BFD_RELOC_IA64_DTPMOD64LSB,
-  BFD_RELOC_IA64_LTOFF_DTPMOD22,
-  BFD_RELOC_IA64_DTPREL14,
-  BFD_RELOC_IA64_DTPREL22,
-  BFD_RELOC_IA64_DTPREL64I,
-  BFD_RELOC_IA64_DTPREL32MSB,
-  BFD_RELOC_IA64_DTPREL32LSB,
-  BFD_RELOC_IA64_DTPREL64MSB,
-  BFD_RELOC_IA64_DTPREL64LSB,
-  BFD_RELOC_IA64_LTOFF_DTPREL22,
-
-/* Motorola 68HC11 reloc.
-This is the 8 bit high part of an absolute address.  */
-  BFD_RELOC_M68HC11_HI8,
-
-/* Motorola 68HC11 reloc.
-This is the 8 bit low part of an absolute address.  */
-  BFD_RELOC_M68HC11_LO8,
-
-/* Motorola 68HC11 reloc.
-This is the 3 bit of a value.  */
-  BFD_RELOC_M68HC11_3B,
-
-/* Motorola 68HC11 reloc.
-This reloc marks the beginning of a jump/call instruction.
-It is used for linker relaxation to correctly identify beginning
-of instruction and change some branchs to use PC-relative
-addressing mode.  */
-  BFD_RELOC_M68HC11_RL_JUMP,
-
-/* Motorola 68HC11 reloc.
-This reloc marks a group of several instructions that gcc generates
-and for which the linker relaxation pass can modify and/or remove
-some of them.  */
-  BFD_RELOC_M68HC11_RL_GROUP,
-
-/* Motorola 68HC11 reloc.
-This is the 16-bit lower part of an address.  It is used for 'call'
-instruction to specify the symbol address without any special
-transformation (due to memory bank window).  */
-  BFD_RELOC_M68HC11_LO16,
-
-/* Motorola 68HC11 reloc.
-This is a 8-bit reloc that specifies the page number of an address.
-It is used by 'call' instruction to specify the page number of
-the symbol.  */
-  BFD_RELOC_M68HC11_PAGE,
-
-/* Motorola 68HC11 reloc.
-This is a 24-bit reloc that represents the address with a 16-bit
-value and a 8-bit page number.  The symbol address is transformed
-to follow the 16K memory bank of 68HC12 (seen as mapped in the window).  */
-  BFD_RELOC_M68HC11_24,
-
-/* These relocs are only used within the CRIS assembler.  They are not
-(at present) written to any object files.  */
-  BFD_RELOC_CRIS_BDISP8,
-  BFD_RELOC_CRIS_UNSIGNED_5,
-  BFD_RELOC_CRIS_SIGNED_6,
-  BFD_RELOC_CRIS_UNSIGNED_6,
-  BFD_RELOC_CRIS_UNSIGNED_4,
-
-/* Relocs used in ELF shared libraries for CRIS.  */
-  BFD_RELOC_CRIS_COPY,
-  BFD_RELOC_CRIS_GLOB_DAT,
-  BFD_RELOC_CRIS_JUMP_SLOT,
-  BFD_RELOC_CRIS_RELATIVE,
-
-/* 32-bit offset to symbol-entry within GOT.  */
-  BFD_RELOC_CRIS_32_GOT,
-
-/* 16-bit offset to symbol-entry within GOT.  */
-  BFD_RELOC_CRIS_16_GOT,
-
-/* 32-bit offset to symbol-entry within GOT, with PLT handling.  */
-  BFD_RELOC_CRIS_32_GOTPLT,
-
-/* 16-bit offset to symbol-entry within GOT, with PLT handling.  */
-  BFD_RELOC_CRIS_16_GOTPLT,
-
-/* 32-bit offset to symbol, relative to GOT.  */
-  BFD_RELOC_CRIS_32_GOTREL,
-
-/* 32-bit offset to symbol with PLT entry, relative to GOT.  */
-  BFD_RELOC_CRIS_32_PLT_GOTREL,
-
-/* 32-bit offset to symbol with PLT entry, relative to this relocation.  */
-  BFD_RELOC_CRIS_32_PLT_PCREL,
-
-/* Intel i860 Relocations.  */
-  BFD_RELOC_860_COPY,
-  BFD_RELOC_860_GLOB_DAT,
-  BFD_RELOC_860_JUMP_SLOT,
-  BFD_RELOC_860_RELATIVE,
-  BFD_RELOC_860_PC26,
-  BFD_RELOC_860_PLT26,
-  BFD_RELOC_860_PC16,
-  BFD_RELOC_860_LOW0,
-  BFD_RELOC_860_SPLIT0,
-  BFD_RELOC_860_LOW1,
-  BFD_RELOC_860_SPLIT1,
-  BFD_RELOC_860_LOW2,
-  BFD_RELOC_860_SPLIT2,
-  BFD_RELOC_860_LOW3,
-  BFD_RELOC_860_LOGOT0,
-  BFD_RELOC_860_SPGOT0,
-  BFD_RELOC_860_LOGOT1,
-  BFD_RELOC_860_SPGOT1,
-  BFD_RELOC_860_LOGOTOFF0,
-  BFD_RELOC_860_SPGOTOFF0,
-  BFD_RELOC_860_LOGOTOFF1,
-  BFD_RELOC_860_SPGOTOFF1,
-  BFD_RELOC_860_LOGOTOFF2,
-  BFD_RELOC_860_LOGOTOFF3,
-  BFD_RELOC_860_LOPC,
-  BFD_RELOC_860_HIGHADJ,
-  BFD_RELOC_860_HAGOT,
-  BFD_RELOC_860_HAGOTOFF,
-  BFD_RELOC_860_HAPC,
-  BFD_RELOC_860_HIGH,
-  BFD_RELOC_860_HIGOT,
-  BFD_RELOC_860_HIGOTOFF,
-
-/* OpenRISC Relocations.  */
-  BFD_RELOC_OPENRISC_ABS_26,
-  BFD_RELOC_OPENRISC_REL_26,
-
-/* H8 elf Relocations.  */
-  BFD_RELOC_H8_DIR16A8,
-  BFD_RELOC_H8_DIR16R8,
-  BFD_RELOC_H8_DIR24A8,
-  BFD_RELOC_H8_DIR24R8,
-  BFD_RELOC_H8_DIR32A16,
-
-/* Sony Xstormy16 Relocations.  */
-  BFD_RELOC_XSTORMY16_REL_12,
-  BFD_RELOC_XSTORMY16_24,
-  BFD_RELOC_XSTORMY16_FPTR16,
-
-/* Relocations used by VAX ELF.  */
-  BFD_RELOC_VAX_GLOB_DAT,
-  BFD_RELOC_VAX_JMP_SLOT,
-  BFD_RELOC_VAX_RELATIVE,
-  BFD_RELOC_UNUSED };
-typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-reloc_howto_type *
-bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-
-const char *
-bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
-
-/* Extracted from syms.c.  */
-
-typedef struct symbol_cache_entry
-{
-  /* A pointer to the BFD which owns the symbol. This information
-     is necessary so that a back end can work out what additional
-     information (invisible to the application writer) is carried
-     with the symbol.
-
-     This field is *almost* redundant, since you can use section->owner
-     instead, except that some symbols point to the global sections
-     bfd_{abs,com,und}_section.  This could be fixed by making
-     these globals be per-bfd (or per-target-flavor).  FIXME.  */
-  struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field.  */
-
-  /* The text of the symbol. The name is left alone, and not copied; the
-     application may not alter it.  */
-  const char *name;
-
-  /* The value of the symbol.  This really should be a union of a
-     numeric value with a pointer, since some flags indicate that
-     a pointer to another symbol is stored here.  */
-  symvalue value;
-
-  /* Attributes of a symbol.  */
-#define BSF_NO_FLAGS    0x00
-
-  /* The symbol has local scope; <<static>> in <<C>>. The value
-     is the offset into the section of the data.  */
-#define BSF_LOCAL      0x01
-
-  /* The symbol has global scope; initialized data in <<C>>. The
-     value is the offset into the section of the data.  */
-#define BSF_GLOBAL     0x02
-
-  /* The symbol has global scope and is exported. The value is
-     the offset into the section of the data.  */
-#define BSF_EXPORT     BSF_GLOBAL /* No real difference.  */
-
-  /* A normal C symbol would be one of:
-     <<BSF_LOCAL>>, <<BSF_FORT_COMM>>,  <<BSF_UNDEFINED>> or
-     <<BSF_GLOBAL>>.  */
-
-  /* The symbol is a debugging record. The value has an arbitary
-     meaning, unless BSF_DEBUGGING_RELOC is also set.  */
-#define BSF_DEBUGGING  0x08
-
-  /* The symbol denotes a function entry point.  Used in ELF,
-     perhaps others someday.  */
-#define BSF_FUNCTION    0x10
-
-  /* Used by the linker.  */
-#define BSF_KEEP        0x20
-#define BSF_KEEP_G      0x40
-
-  /* A weak global symbol, overridable without warnings by
-     a regular global symbol of the same name.  */
-#define BSF_WEAK        0x80
-
-  /* This symbol was created to point to a section, e.g. ELF's
-     STT_SECTION symbols.  */
-#define BSF_SECTION_SYM 0x100
-
-  /* The symbol used to be a common symbol, but now it is
-     allocated.  */
-#define BSF_OLD_COMMON  0x200
-
-  /* The default value for common data.  */
-#define BFD_FORT_COMM_DEFAULT_VALUE 0
-
-  /* In some files the type of a symbol sometimes alters its
-     location in an output file - ie in coff a <<ISFCN>> symbol
-     which is also <<C_EXT>> symbol appears where it was
-     declared and not at the end of a section.  This bit is set
-     by the target BFD part to convey this information.  */
-#define BSF_NOT_AT_END    0x400
-
-  /* Signal that the symbol is the label of constructor section.  */
-#define BSF_CONSTRUCTOR   0x800
-
-  /* Signal that the symbol is a warning symbol.  The name is a
-     warning.  The name of the next symbol is the one to warn about;
-     if a reference is made to a symbol with the same name as the next
-     symbol, a warning is issued by the linker.  */
-#define BSF_WARNING       0x1000
-
-  /* Signal that the symbol is indirect.  This symbol is an indirect
-     pointer to the symbol with the same name as the next symbol.  */
-#define BSF_INDIRECT      0x2000
-
-  /* BSF_FILE marks symbols that contain a file name.  This is used
-     for ELF STT_FILE symbols.  */
-#define BSF_FILE          0x4000
-
-  /* Symbol is from dynamic linking information.  */
-#define BSF_DYNAMIC       0x8000
-
-  /* The symbol denotes a data object.  Used in ELF, and perhaps
-     others someday.  */
-#define BSF_OBJECT        0x10000
-
-  /* This symbol is a debugging symbol.  The value is the offset
-     into the section of the data.  BSF_DEBUGGING should be set
-     as well.  */
-#define BSF_DEBUGGING_RELOC 0x20000
-
-  /* This symbol is thread local.  Used in ELF.  */
-#define BSF_THREAD_LOCAL  0x40000
-
-  flagword flags;
-
-  /* A pointer to the section to which this symbol is
-     relative.  This will always be non NULL, there are special
-     sections for undefined and absolute symbols.  */
-  struct sec *section;
-
-  /* Back end special data.  */
-  union
-    {
-      PTR p;
-      bfd_vma i;
-    }
-  udata;
-}
-asymbol;
-
-#define bfd_get_symtab_upper_bound(abfd) \
-     BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
-boolean
-bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
-
-boolean
-bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name));
-
-#define bfd_is_local_label_name(abfd, name) \
-     BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-
-#define bfd_canonicalize_symtab(abfd, location) \
-     BFD_SEND (abfd, _bfd_canonicalize_symtab,\
-                  (abfd, location))
-
-boolean
-bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
-
-void
-bfd_print_symbol_vandf PARAMS ((bfd *abfd, PTR file, asymbol *symbol));
-
-#define bfd_make_empty_symbol(abfd) \
-     BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
-asymbol *
-_bfd_generic_make_empty_symbol PARAMS ((bfd *));
-
-#define bfd_make_debug_symbol(abfd,ptr,size) \
-        BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
-int
-bfd_decode_symclass PARAMS ((asymbol *symbol));
-
-boolean
-bfd_is_undefined_symclass PARAMS ((int symclass));
-
-void
-bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
-
-boolean
-bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
-
-#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
-     BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
-               (ibfd, isymbol, obfd, osymbol))
-
-/* Extracted from bfd.c.  */
-struct _bfd
-{
-  /* The filename the application opened the BFD with.  */
-  const char *filename;
-
-  /* A pointer to the target jump table.  */
-  const struct bfd_target *xvec;
-
-  /* To avoid dragging too many header files into every file that
-     includes `<<bfd.h>>', IOSTREAM has been declared as a "char *",
-     and MTIME as a "long".  Their correct types, to which they
-     are cast when used, are "FILE *" and "time_t".    The iostream
-     is the result of an fopen on the filename.  However, if the
-     BFD_IN_MEMORY flag is set, then iostream is actually a pointer
-     to a bfd_in_memory struct.  */
-  PTR iostream;
-
-  /* Is the file descriptor being cached?  That is, can it be closed as
-     needed, and re-opened when accessed later?  */
-  boolean cacheable;
-
-  /* Marks whether there was a default target specified when the
-     BFD was opened. This is used to select which matching algorithm
-     to use to choose the back end.  */
-  boolean target_defaulted;
-
-  /* The caching routines use these to maintain a
-     least-recently-used list of BFDs.  */
-  struct _bfd *lru_prev, *lru_next;
-
-  /* When a file is closed by the caching routines, BFD retains
-     state information on the file here...  */
-  ufile_ptr where;
-
-  /* ... and here: (``once'' means at least once).  */
-  boolean opened_once;
-
-  /* Set if we have a locally maintained mtime value, rather than
-     getting it from the file each time.  */
-  boolean mtime_set;
-
-  /* File modified time, if mtime_set is true.  */
-  long mtime;
-
-  /* Reserved for an unimplemented file locking extension.  */
-  int ifd;
-
-  /* The format which belongs to the BFD. (object, core, etc.)  */
-  bfd_format format;
-
-  /* The direction with which the BFD was opened.  */
-  enum bfd_direction
-    {
-      no_direction = 0,
-      read_direction = 1,
-      write_direction = 2,
-      both_direction = 3
-    }
-  direction;
-
-  /* Format_specific flags.  */
-  flagword flags;
-
-  /* Currently my_archive is tested before adding origin to
-     anything. I believe that this can become always an add of
-     origin, with origin set to 0 for non archive files.  */
-  ufile_ptr origin;
-
-  /* Remember when output has begun, to stop strange things
-     from happening.  */
-  boolean output_has_begun;
-
-  /* A hash table for section names.  */
-  struct bfd_hash_table section_htab;
-
-  /* Pointer to linked list of sections.  */
-  struct sec *sections;
-
-  /* The place where we add to the section list.  */
-  struct sec **section_tail;
-
-  /* The number of sections.  */
-  unsigned int section_count;
-
-  /* Stuff only useful for object files:
-     The start address.  */
-  bfd_vma start_address;
-
-  /* Used for input and output.  */
-  unsigned int symcount;
-
-  /* Symbol table for output BFD (with symcount entries).  */
-  struct symbol_cache_entry  **outsymbols;
-
-  /* Used for slurped dynamic symbol tables.  */
-  unsigned int dynsymcount;
-
-  /* Pointer to structure which contains architecture information.  */
-  const struct bfd_arch_info *arch_info;
-
-  /* Stuff only useful for archives.  */
-  PTR arelt_data;
-  struct _bfd *my_archive;     /* The containing archive BFD.  */
-  struct _bfd *next;           /* The next BFD in the archive.  */
-  struct _bfd *archive_head;   /* The first BFD in the archive.  */
-  boolean has_armap;
-
-  /* A chain of BFD structures involved in a link.  */
-  struct _bfd *link_next;
-
-  /* A field used by _bfd_generic_link_add_archive_symbols.  This will
-     be used only for archive elements.  */
-  int archive_pass;
-
-  /* Used by the back end to hold private data.  */
-  union
-    {
-      struct aout_data_struct *aout_data;
-      struct artdata *aout_ar_data;
-      struct _oasys_data *oasys_obj_data;
-      struct _oasys_ar_data *oasys_ar_data;
-      struct coff_tdata *coff_obj_data;
-      struct pe_tdata *pe_obj_data;
-      struct xcoff_tdata *xcoff_obj_data;
-      struct ecoff_tdata *ecoff_obj_data;
-      struct ieee_data_struct *ieee_data;
-      struct ieee_ar_data_struct *ieee_ar_data;
-      struct srec_data_struct *srec_data;
-      struct ihex_data_struct *ihex_data;
-      struct tekhex_data_struct *tekhex_data;
-      struct elf_obj_tdata *elf_obj_data;
-      struct nlm_obj_tdata *nlm_obj_data;
-      struct bout_data_struct *bout_data;
-      struct mmo_data_struct *mmo_data;
-      struct sun_core_struct *sun_core_data;
-      struct sco5_core_struct *sco5_core_data;
-      struct trad_core_struct *trad_core_data;
-      struct som_data_struct *som_data;
-      struct hpux_core_struct *hpux_core_data;
-      struct hppabsd_core_struct *hppabsd_core_data;
-      struct sgi_core_struct *sgi_core_data;
-      struct lynx_core_struct *lynx_core_data;
-      struct osf_core_struct *osf_core_data;
-      struct cisco_core_struct *cisco_core_data;
-      struct versados_data_struct *versados_data;
-      struct netbsd_core_struct *netbsd_core_data;
-      struct mach_o_data_struct *mach_o_data;
-      struct mach_o_fat_data_struct *mach_o_fat_data;
-      struct bfd_pef_data_struct *pef_data;
-      struct bfd_pef_xlib_data_struct *pef_xlib_data;
-      struct bfd_sym_data_struct *sym_data;
-      PTR any;
-    }
-  tdata;
-
-  /* Used by the application to hold private data.  */
-  PTR usrdata;
-
-  /* Where all the allocated stuff under this BFD goes.  This is a
-     struct objalloc *, but we use PTR to avoid requiring the inclusion of
-     objalloc.h.  */
-  PTR memory;
-};
-
-typedef enum bfd_error
-{
-  bfd_error_no_error = 0,
-  bfd_error_system_call,
-  bfd_error_invalid_target,
-  bfd_error_wrong_format,
-  bfd_error_wrong_object_format,
-  bfd_error_invalid_operation,
-  bfd_error_no_memory,
-  bfd_error_no_symbols,
-  bfd_error_no_armap,
-  bfd_error_no_more_archived_files,
-  bfd_error_malformed_archive,
-  bfd_error_file_not_recognized,
-  bfd_error_file_ambiguously_recognized,
-  bfd_error_no_contents,
-  bfd_error_nonrepresentable_section,
-  bfd_error_no_debug_section,
-  bfd_error_bad_value,
-  bfd_error_file_truncated,
-  bfd_error_file_too_big,
-  bfd_error_invalid_error_code
-}
-bfd_error_type;
-
-bfd_error_type
-bfd_get_error PARAMS ((void));
-
-void
-bfd_set_error PARAMS ((bfd_error_type error_tag));
-
-const char *
-bfd_errmsg PARAMS ((bfd_error_type error_tag));
-
-void
-bfd_perror PARAMS ((const char *message));
-
-typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
-
-bfd_error_handler_type
-bfd_set_error_handler PARAMS ((bfd_error_handler_type));
-
-void
-bfd_set_error_program_name PARAMS ((const char *));
-
-bfd_error_handler_type
-bfd_get_error_handler PARAMS ((void));
-
-const char *
-bfd_archive_filename PARAMS ((bfd *));
-
-long
-bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
-
-long
-bfd_canonicalize_reloc PARAMS ((bfd *abfd,
-    asection *sec,
-    arelent **loc,
-    asymbol **syms));
-
-void
-bfd_set_reloc PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count));
-
-boolean
-bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
-
-int
-bfd_get_arch_size PARAMS ((bfd *abfd));
-
-int
-bfd_get_sign_extend_vma PARAMS ((bfd *abfd));
-
-boolean
-bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
-
-unsigned int
-bfd_get_gp_size PARAMS ((bfd *abfd));
-
-void
-bfd_set_gp_size PARAMS ((bfd *abfd, unsigned int i));
-
-bfd_vma
-bfd_scan_vma PARAMS ((const char *string, const char **end, int base));
-
-boolean
-bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
-
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
-     BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
-               (ibfd, obfd))
-boolean
-bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
-
-#define bfd_merge_private_bfd_data(ibfd, obfd) \
-     BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
-               (ibfd, obfd))
-boolean
-bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
-
-#define bfd_set_private_flags(abfd, flags) \
-     BFD_SEND (abfd, _bfd_set_private_flags, \
-               (abfd, flags))
-#define bfd_sizeof_headers(abfd, reloc) \
-     BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
-     BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, sec, syms, off, file, func, line))
-
-       /* Do these three do anything useful at all, for any back end?  */
-#define bfd_debug_info_start(abfd) \
-        BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
-        BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
-        BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-
-#define bfd_stat_arch_elt(abfd, stat) \
-        BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
-        BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
-        BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
-       BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_gc_sections(abfd, link_info) \
-       BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-
-#define bfd_merge_sections(abfd, link_info) \
-       BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
-
-#define bfd_discard_group(abfd, sec) \
-       BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-
-#define bfd_link_hash_table_create(abfd) \
-       BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_hash_table_free(abfd, hash) \
-       BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
-
-#define bfd_link_add_symbols(abfd, info) \
-       BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_link_just_syms(sec, info) \
-       BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-
-#define bfd_final_link(abfd, info) \
-       BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
-       BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
-       BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
-       BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
-       BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
-       BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
-       BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
-       PARAMS ((bfd *, struct bfd_link_info *,
-                 struct bfd_link_order *, bfd_byte *,
-                 boolean, asymbol **));
-
-boolean
-bfd_alt_mach_code PARAMS ((bfd *abfd, int alternative));
-
-struct bfd_preserve
-{
-  PTR marker;
-  PTR tdata;
-  flagword flags;
-  const struct bfd_arch_info *arch_info;
-  struct sec *sections;
-  struct sec **section_tail;
-  unsigned int section_count;
-  struct bfd_hash_table section_htab;
-};
-
-boolean
-bfd_preserve_save PARAMS ((bfd *, struct bfd_preserve *));
-
-void
-bfd_preserve_restore PARAMS ((bfd *, struct bfd_preserve *));
-
-void
-bfd_preserve_finish PARAMS ((bfd *, struct bfd_preserve *));
-
-/* Extracted from archive.c.  */
-symindex
-bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
-
-boolean
-bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
-
-bfd *
-bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
-
-/* Extracted from corefile.c.  */
-const char *
-bfd_core_file_failing_command PARAMS ((bfd *abfd));
-
-int
-bfd_core_file_failing_signal PARAMS ((bfd *abfd));
-
-boolean
-core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-
-/* Extracted from targets.c.  */
-#define BFD_SEND(bfd, message, arglist) \
-               ((*((bfd)->xvec->message)) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND
-#define BFD_SEND(bfd, message, arglist) \
-  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-    ((*((bfd)->xvec->message)) arglist) : \
-    (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-#define BFD_SEND_FMT(bfd, message, arglist) \
-            (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND_FMT
-#define BFD_SEND_FMT(bfd, message, arglist) \
-  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
-   (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-
-enum bfd_flavour
-{
-  bfd_target_unknown_flavour,
-  bfd_target_aout_flavour,
-  bfd_target_coff_flavour,
-  bfd_target_ecoff_flavour,
-  bfd_target_xcoff_flavour,
-  bfd_target_elf_flavour,
-  bfd_target_ieee_flavour,
-  bfd_target_nlm_flavour,
-  bfd_target_oasys_flavour,
-  bfd_target_tekhex_flavour,
-  bfd_target_srec_flavour,
-  bfd_target_ihex_flavour,
-  bfd_target_som_flavour,
-  bfd_target_os9k_flavour,
-  bfd_target_versados_flavour,
-  bfd_target_msdos_flavour,
-  bfd_target_ovax_flavour,
-  bfd_target_evax_flavour,
-  bfd_target_mmo_flavour,
-  bfd_target_mach_o_flavour,
-  bfd_target_pef_flavour,
-  bfd_target_pef_xlib_flavour,
-  bfd_target_sym_flavour
-};
-
-enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-
-/* Forward declaration.  */
-typedef struct bfd_link_info _bfd_link_info;
-
-typedef struct bfd_target
-{
-  /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  */
-  char *name;
-
- /* The "flavour" of a back end is a general indication about
-    the contents of a file.  */
-  enum bfd_flavour flavour;
-
-  /* The order of bytes within the data area of a file.  */
-  enum bfd_endian byteorder;
-
- /* The order of bytes within the header parts of a file.  */
-  enum bfd_endian header_byteorder;
-
-  /* A mask of all the flags which an executable may have set -
-     from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.  */
-  flagword object_flags;
-
- /* A mask of all the flags which a section may have set - from
-    the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.  */
-  flagword section_flags;
-
- /* The character normally found at the front of a symbol.
-    (if any), perhaps `_'.  */
-  char symbol_leading_char;
-
- /* The pad character for file names within an archive header.  */
-  char ar_pad_char;
-
-  /* The maximum number of characters in an archive header.  */
-  unsigned short ar_max_namelen;
-
-  /* Entries for byte swapping for data. These are different from the
-     other entry points, since they don't take a BFD asthe first argument.
-     Certain other handlers could do the same.  */
-  bfd_vma        (*bfd_getx64) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
-  void           (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
-  bfd_vma        (*bfd_getx32) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
-  void           (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
-  bfd_vma        (*bfd_getx16) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
-  void           (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
-
-  /* Byte swapping for the headers.  */
-  bfd_vma        (*bfd_h_getx64) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
-  void           (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
-  bfd_vma        (*bfd_h_getx32) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
-  void           (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
-  bfd_vma        (*bfd_h_getx16) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
-  void           (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
-
-  /* Format dependent routines: these are vectors of entry points
-     within the target vector structure, one for each format to check.  */
-
-  /* Check the format of a file being read.  Return a <<bfd_target *>> or zero.  */
-  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
-
-  /* Set the format of a file being written.  */
-  boolean  (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
-
-  /* Write cached information into a file being written, at <<bfd_close>>.  */
-  boolean  (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
-
-
-  /* Generic entry points.  */
-#define BFD_JUMP_TABLE_GENERIC(NAME) \
-CONCAT2 (NAME,_close_and_cleanup), \
-CONCAT2 (NAME,_bfd_free_cached_info), \
-CONCAT2 (NAME,_new_section_hook), \
-CONCAT2 (NAME,_get_section_contents), \
-CONCAT2 (NAME,_get_section_contents_in_window)
-
-  /* Called when the BFD is being closed to do any necessary cleanup.  */
-  boolean  (*_close_and_cleanup) PARAMS ((bfd *));
-  /* Ask the BFD to free all cached information.  */
-  boolean  (*_bfd_free_cached_info) PARAMS ((bfd *));
-  /* Called when a new section is created.  */
-  boolean  (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
-  /* Read the contents of a section.  */
-  boolean  (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
-                                                 file_ptr, bfd_size_type));
-  boolean  (*_bfd_get_section_contents_in_window)
-    PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
-
-  /* Entry points to copy private data.  */
-#define BFD_JUMP_TABLE_COPY(NAME) \
-CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
-CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
-CONCAT2 (NAME,_bfd_copy_private_section_data), \
-CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
-CONCAT2 (NAME,_bfd_set_private_flags), \
-CONCAT2 (NAME,_bfd_print_private_bfd_data) \
-  /* Called to copy BFD general private data from one object file
-     to another.  */
-  boolean  (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
-  /* Called to merge BFD general private data from one object file
-     to a common output file when linking.  */
-  boolean  (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
-  /* Called to copy BFD private section data from one object file
-     to another.  */
-  boolean  (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
-                                                      bfd *, sec_ptr));
-  /* Called to copy BFD private symbol data from one symbol
-     to another.  */
-  boolean  (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
-                                                     bfd *, asymbol *));
-  /* Called to set private backend flags.  */
-  boolean  (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
-
-  /* Called to print private BFD data.  */
-  boolean  (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
-
-  /* Core file entry points.  */
-#define BFD_JUMP_TABLE_CORE(NAME) \
-CONCAT2 (NAME,_core_file_failing_command), \
-CONCAT2 (NAME,_core_file_failing_signal), \
-CONCAT2 (NAME,_core_file_matches_executable_p)
-  char *   (*_core_file_failing_command) PARAMS ((bfd *));
-  int      (*_core_file_failing_signal) PARAMS ((bfd *));
-  boolean  (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
-
-  /* Archive entry points.  */
-#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
-CONCAT2 (NAME,_slurp_armap), \
-CONCAT2 (NAME,_slurp_extended_name_table), \
-CONCAT2 (NAME,_construct_extended_name_table), \
-CONCAT2 (NAME,_truncate_arname), \
-CONCAT2 (NAME,_write_armap), \
-CONCAT2 (NAME,_read_ar_hdr), \
-CONCAT2 (NAME,_openr_next_archived_file), \
-CONCAT2 (NAME,_get_elt_at_index), \
-CONCAT2 (NAME,_generic_stat_arch_elt), \
-CONCAT2 (NAME,_update_armap_timestamp)
-  boolean  (*_bfd_slurp_armap) PARAMS ((bfd *));
-  boolean  (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
-  boolean  (*_bfd_construct_extended_name_table)
-    PARAMS ((bfd *, char **, bfd_size_type *, const char **));
-  void     (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
-  boolean  (*write_armap)
-    PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-  PTR      (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
-  bfd *    (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
-#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
-  bfd *    (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
-  int      (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
-  boolean  (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
-
-  /* Entry points used for symbols.  */
-#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
-CONCAT2 (NAME,_get_symtab_upper_bound), \
-CONCAT2 (NAME,_get_symtab), \
-CONCAT2 (NAME,_make_empty_symbol), \
-CONCAT2 (NAME,_print_symbol), \
-CONCAT2 (NAME,_get_symbol_info), \
-CONCAT2 (NAME,_bfd_is_local_label_name), \
-CONCAT2 (NAME,_get_lineno), \
-CONCAT2 (NAME,_find_nearest_line), \
-CONCAT2 (NAME,_bfd_make_debug_symbol), \
-CONCAT2 (NAME,_read_minisymbols), \
-CONCAT2 (NAME,_minisymbol_to_symbol)
-  long     (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
-  long     (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
-                                                struct symbol_cache_entry **));
-  struct symbol_cache_entry *
-           (*_bfd_make_empty_symbol) PARAMS ((bfd *));
-  void     (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
-                                         struct symbol_cache_entry *,
-                                         bfd_print_symbol_type));
-#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
-  void     (*_bfd_get_symbol_info) PARAMS ((bfd *,
-                                            struct symbol_cache_entry *,
-                                            symbol_info *));
-#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
-  boolean  (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
-
-  alent *  (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
-  boolean  (*_bfd_find_nearest_line)
-    PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
-             const char **, const char **, unsigned int *));
- /* Back-door to allow format-aware applications to create debug symbols
-    while using BFD for everything else.  Currently used by the assembler
-    when creating COFF files.  */
-  asymbol *(*_bfd_make_debug_symbol) PARAMS ((bfd *, void *,
-                                              unsigned long size));
-#define bfd_read_minisymbols(b, d, m, s) \
-  BFD_SEND (b, _read_minisymbols, (b, d, m, s))
-  long     (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
-                                         unsigned int *));
-#define bfd_minisymbol_to_symbol(b, d, m, f) \
-  BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
-  asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
-                                             asymbol *));
-
-  /* Routines for relocs.  */
-#define BFD_JUMP_TABLE_RELOCS(NAME) \
-CONCAT2 (NAME,_get_reloc_upper_bound), \
-CONCAT2 (NAME,_canonicalize_reloc), \
-CONCAT2 (NAME,_bfd_reloc_type_lookup)
-  long     (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
-  long     (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
-                                               struct symbol_cache_entry **));
-  /* See documentation on reloc types.  */
-  reloc_howto_type *
-           (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-  /* Routines used when writing an object file.  */
-#define BFD_JUMP_TABLE_WRITE(NAME) \
-CONCAT2 (NAME,_set_arch_mach), \
-CONCAT2 (NAME,_set_section_contents)
-  boolean  (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
-                                          unsigned long));
-  boolean  (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
-                                                 file_ptr, bfd_size_type));
-
-  /* Routines used by the linker.  */
-#define BFD_JUMP_TABLE_LINK(NAME) \
-CONCAT2 (NAME,_sizeof_headers), \
-CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
-CONCAT2 (NAME,_bfd_relax_section), \
-CONCAT2 (NAME,_bfd_link_hash_table_create), \
-CONCAT2 (NAME,_bfd_link_hash_table_free), \
-CONCAT2 (NAME,_bfd_link_add_symbols), \
-CONCAT2 (NAME,_bfd_link_just_syms), \
-CONCAT2 (NAME,_bfd_final_link), \
-CONCAT2 (NAME,_bfd_link_split_section), \
-CONCAT2 (NAME,_bfd_gc_sections), \
-CONCAT2 (NAME,_bfd_merge_sections), \
-CONCAT2 (NAME,_bfd_discard_group)
-  int      (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
-  bfd_byte *(*_bfd_get_relocated_section_contents)
-    PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
-             bfd_byte *, boolean, struct symbol_cache_entry **));
-
-  boolean  (*_bfd_relax_section)
-    PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
-
-  /* Create a hash table for the linker.  Different backends store
-     different information in this table.  */
-  struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
-
-  /* Release the memory associated with the linker hash table.  */
-  void (*_bfd_link_hash_table_free) PARAMS ((struct bfd_link_hash_table *));
-
-  /* Add symbols from this object file into the hash table.  */
-  boolean  (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
-
-  /* Indicate that we are only retrieving symbol values from this section.  */
-  void     (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
-
-  /* Do a link based on the link_order structures attached to each
-     section of the BFD.  */
-  boolean  (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
-
-  /* Should this section be split up into smaller pieces during linking.  */
-  boolean  (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
-
-  /* Remove sections that are not referenced from the output.  */
-  boolean  (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
-
-  /* Attempt to merge SEC_MERGE sections.  */
-  boolean  (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
-
-  /* Discard members of a group.  */
-  boolean  (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
-
-  /* Routines to handle dynamic symbols and relocs.  */
-#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
-CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
-CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
-CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
-CONCAT2 (NAME,_canonicalize_dynamic_reloc)
-  /* Get the amount of memory required to hold the dynamic symbols.  */
-  long     (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
-  /* Read in the dynamic symbols.  */
-  long     (*_bfd_canonicalize_dynamic_symtab)
-    PARAMS ((bfd *, struct symbol_cache_entry **));
-  /* Get the amount of memory required to hold the dynamic relocs.  */
-  long     (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
-  /* Read in the dynamic relocs.  */
-  long     (*_bfd_canonicalize_dynamic_reloc)
-    PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
-
-  /* Opposite endian version of this target.  */
-  const struct bfd_target * alternative_target;
-
-  /* Data for use by back-end routines, which isn't
-     generic enough to belong in this structure.  */
-  PTR backend_data;
-
-} bfd_target;
-
-boolean
-bfd_set_default_target PARAMS ((const char *name));
-
-const bfd_target *
-bfd_find_target PARAMS ((const char *target_name, bfd *abfd));
-
-const char **
-bfd_target_list PARAMS ((void));
-
-const bfd_target *
-bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
-
-/* Extracted from format.c.  */
-boolean
-bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
-
-boolean
-bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
-
-boolean
-bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
-
-const char *
-bfd_format_string PARAMS ((bfd_format format));
-
-/* Extracted from linker.c.  */
-boolean
-bfd_link_split_section PARAMS ((bfd *abfd, asection *sec));
-
-#define bfd_link_split_section(abfd, sec) \
-       BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
-/* Extracted from simple.c.  */
-bfd_byte *
-bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf));
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/i386/dis-asm.h b/i386/dis-asm.h
deleted file mode 100644 (file)
index 2f3418e..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/* Interface between the opcode library and its callers.
-
-   Copyright 2001, 2002 Free Software Foundation, Inc.
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-   
-   Written by Cygnus Support, 1993.
-
-   The opcode library (libopcodes.a) provides instruction decoders for
-   a large variety of instruction sets, callable with an identical
-   interface, for making instruction-processing programs more independent
-   of the instruction set being processed.  */
-
-#ifndef DIS_ASM_H
-#define DIS_ASM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include "bfd.h"
-
-#include "types.h"
-#include "ansidecl.h"
-
-#define _(String) (String)
-
-typedef int (*fprintf_ftype) PARAMS((PTR, const char*, ...));
-
-enum dis_insn_type {
-  dis_noninsn,                 /* Not a valid instruction */
-  dis_nonbranch,               /* Not a branch instruction */
-  dis_branch,                  /* Unconditional branch */
-  dis_condbranch,              /* Conditional branch */
-  dis_jsr,                     /* Jump to subroutine */
-  dis_condjsr,                 /* Conditional jump to subroutine */
-  dis_dref,                    /* Data reference instruction */
-  dis_dref2                    /* Two data references in instruction */
-};
-
-/* This struct is passed into the instruction decoding routine, 
-   and is passed back out into each callback.  The various fields are used
-   for conveying information from your main routine into your callbacks,
-   for passing information into the instruction decoders (such as the
-   addresses of the callback functions), or for passing information
-   back from the instruction decoders to their callers.
-
-   It must be initialized before it is first passed; this can be done
-   by hand, or using one of the initialization macros below.  */
-
-typedef struct disassemble_info {
-  fprintf_ftype fprintf_func;
-  PTR stream;
-  PTR application_data;
-
-  /* Target description.  We could replace this with a pointer to the bfd,
-     but that would require one.  There currently isn't any such requirement
-     so to avoid introducing one we record these explicitly.  */
-  /* The bfd_flavour.  This can be bfd_target_unknown_flavour.  */
-  enum bfd_flavour flavour;
-  /* The bfd_arch value.  */
-  enum bfd_architecture arch;
-  /* The bfd_mach value.  */
-  unsigned long mach;
-  /* Endianness (for bi-endian cpus).  Mono-endian cpus can ignore this.  */
-  enum bfd_endian endian;
-  /* An arch/mach-specific bitmask of selected instruction subsets, mainly
-     for processors with run-time-switchable instruction sets.  The default,
-     zero, means that there is no constraint.  CGEN-based opcodes ports
-     may use ISA_foo masks.  */
-  unsigned long insn_sets;
-
-  /* Some targets need information about the current section to accurately
-     display insns.  If this is NULL, the target disassembler function
-     will have to make its best guess.  */
-  asection *section;
-
-  /* An array of pointers to symbols either at the location being disassembled
-     or at the start of the function being disassembled.  The array is sorted
-     so that the first symbol is intended to be the one used.  The others are
-     present for any misc. purposes.  This is not set reliably, but if it is
-     not NULL, it is correct.  */
-  asymbol **symbols;
-  /* Number of symbols in array.  */
-  int num_symbols;
-
-  /* For use by the disassembler.
-     The top 16 bits are reserved for public use (and are documented here).
-     The bottom 16 bits are for the internal use of the disassembler.  */
-  unsigned long flags;
-#define INSN_HAS_RELOC 0x80000000
-  PTR private_data;
-
-  /* Function used to get bytes to disassemble.  MEMADDR is the
-     address of the stuff to be disassembled, MYADDR is the address to
-     put the bytes in, and LENGTH is the number of bytes to read.
-     INFO is a pointer to this struct.
-     Returns an errno value or 0 for success.  */
-  int (*read_memory_func)
-    PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
-            struct disassemble_info *info));
-
-  /* Function which should be called if we get an error that we can't
-     recover from.  STATUS is the errno value from read_memory_func and
-     MEMADDR is the address that we were trying to read.  INFO is a
-     pointer to this struct.  */
-  void (*memory_error_func)
-    PARAMS ((int status, bfd_vma memaddr, struct disassemble_info *info));
-
-  /* Function called to print ADDR.  */
-  void (*print_address_func)
-    PARAMS ((bfd_vma addr, struct disassemble_info *info));
-
-  /* Function called to determine if there is a symbol at the given ADDR.
-     If there is, the function returns 1, otherwise it returns 0.
-     This is used by ports which support an overlay manager where
-     the overlay number is held in the top part of an address.  In
-     some circumstances we want to include the overlay number in the
-     address, (normally because there is a symbol associated with
-     that address), but sometimes we want to mask out the overlay bits.  */
-  int (* symbol_at_address_func)
-    PARAMS ((bfd_vma addr, struct disassemble_info * info));
-
-  /* These are for buffer_read_memory.  */
-  bfd_byte *buffer;
-  bfd_vma buffer_vma;
-  unsigned int buffer_length;
-
-  /* This variable may be set by the instruction decoder.  It suggests
-      the number of bytes objdump should display on a single line.  If
-      the instruction decoder sets this, it should always set it to
-      the same value in order to get reasonable looking output.  */
-  int bytes_per_line;
-
-  /* the next two variables control the way objdump displays the raw data */
-  /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */
-  /* output will look like this:
-     00:   00000000 00000000
-     with the chunks displayed according to "display_endian". */
-  int bytes_per_chunk;
-  enum bfd_endian display_endian;
-
-  /* Number of octets per incremented target address 
-     Normally one, but some DSPs have byte sizes of 16 or 32 bits.  */
-  unsigned int octets_per_byte;
-
-  /* Results from instruction decoders.  Not all decoders yet support
-     this information.  This info is set each time an instruction is
-     decoded, and is only valid for the last such instruction.
-
-     To determine whether this decoder supports this information, set
-     insn_info_valid to 0, decode an instruction, then check it.  */
-
-  char insn_info_valid;                /* Branch info has been set. */
-  char branch_delay_insns;     /* How many sequential insn's will run before
-                                  a branch takes effect.  (0 = normal) */
-  char data_size;              /* Size of data reference in insn, in bytes */
-  enum dis_insn_type insn_type;        /* Type of instruction */
-  bfd_vma target;              /* Target address of branch or dref, if known;
-                                  zero if unknown.  */
-  bfd_vma target2;             /* Second target address for dref2 */
-
-  /* Command line options specific to the target disassembler.  */
-  char * disassembler_options;
-
-} disassemble_info;
-
-\f
-/* Standard disassemblers.  Disassemble one instruction at the given
-   target address.  Return number of octets processed.  */
-typedef int (*disassembler_ftype)
-     PARAMS((bfd_vma, disassemble_info *));
-
-extern int print_insn_big_mips         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_mips      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i386             PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_i386_att         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i386_intel       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ia64             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i370             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68hc11          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68hc12          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_z8001            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_z8002            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300h           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300s           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8500            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_alpha            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_arm          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_arm       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sparc            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_a29k         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_a29k      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_avr              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_d10v             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_d30v             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_dlx              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_fr30             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_hppa             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i860             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i960             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ip2k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m32r             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m88k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mcore            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mmix             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mn10200          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mn10300          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ns32k            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_openrisc         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_or32          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_or32       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_pdp11            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_pj               PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_powerpc      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_powerpc   PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_rs6000           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_s390              PARAMS ((bfd_vma, disassemble_info*)); 
-extern int print_insn_sh               PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic30            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic4x            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic54x           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic80            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_v850             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_vax              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_w65              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_xstormy16                PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sh64             PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_sh64x_media      PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_frv              PARAMS ((bfd_vma, disassemble_info *));
-
-extern disassembler_ftype arc_get_disassembler PARAMS ((void *));
-extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *));
-
-extern void print_arm_disassembler_options PARAMS ((FILE *));
-extern void parse_arm_disassembler_option  PARAMS ((char *));
-extern int  get_arm_regname_num_options    PARAMS ((void));
-extern int  set_arm_regname_option         PARAMS ((int));
-extern int  get_arm_regnames               PARAMS ((int, const char **, const char **, const char ***));
-
-/* Fetch the disassembler for a given BFD, if that support is available.  */
-extern disassembler_ftype disassembler PARAMS ((bfd *));
-
-/* Document any target specific options available from the disassembler.  */
-extern void disassembler_usage          PARAMS ((FILE *));
-
-\f
-/* This block of definitions is for particular callers who read instructions
-   into a buffer before calling the instruction decoder.  */
-
-/* Here is a function which callers may wish to use for read_memory_func.
-   It gets bytes from a buffer.  */
-extern int buffer_read_memory
-  PARAMS ((bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *));
-
-/* This function goes with buffer_read_memory.
-   It prints a message using info->fprintf_func and info->stream.  */
-extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *));
-
-
-/* Just print the address in hex.  This is included for completeness even
-   though both GDB and objdump provide their own (to print symbolic
-   addresses).  */
-extern void generic_print_address
-  PARAMS ((bfd_vma, struct disassemble_info *));
-
-/* Always true.  */
-extern int generic_symbol_at_address
-  PARAMS ((bfd_vma, struct disassemble_info *));
-
-/* Macro to initialize a disassemble_info struct.  This should be called
-   by all applications creating such a struct.  */
-#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
-  (INFO).flavour = bfd_target_unknown_flavour, \
-  (INFO).arch = bfd_arch_unknown, \
-  (INFO).mach = 0, \
-  (INFO).insn_sets = 0, \
-  (INFO).endian = BFD_ENDIAN_UNKNOWN, \
-  (INFO).octets_per_byte = 1, \
-  INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC)
-
-/* Call this macro to initialize only the internal variables for the
-   disassembler.  Architecture dependent things such as byte order, or machine
-   variant are not touched by this macro.  This makes things much easier for
-   GDB which must initialize these things separately.  */
-
-#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
-  (INFO).fprintf_func = (fprintf_ftype)(FPRINTF_FUNC), \
-  (INFO).stream = (PTR)(STREAM), \
-  (INFO).section = NULL, \
-  (INFO).symbols = NULL, \
-  (INFO).num_symbols = 0, \
-  (INFO).private_data = NULL, \
-  (INFO).buffer = NULL, \
-  (INFO).buffer_vma = 0, \
-  (INFO).buffer_length = 0, \
-  (INFO).read_memory_func = buffer_read_memory, \
-  (INFO).memory_error_func = perror_memory, \
-  (INFO).print_address_func = generic_print_address, \
-  (INFO).symbol_at_address_func = generic_symbol_at_address, \
-  (INFO).flags = 0, \
-  (INFO).bytes_per_line = 0, \
-  (INFO).bytes_per_chunk = 0, \
-  (INFO).display_endian = BFD_ENDIAN_UNKNOWN, \
-  (INFO).disassembler_options = NULL, \
-  (INFO).insn_info_valid = 0
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* ! defined (DIS_ASM_H) */
diff --git a/i386/dis-buf.c b/i386/dis-buf.c
deleted file mode 100644 (file)
index de297b6..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Disassemble from a buffer, for GNU.
-   Copyright 1993, 1994, 1996, 1997, 1998, 1999, 2000
-   Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-/*  #include "sysdep.h" */
-#include "dis-asm.h"
-#include <errno.h>
-/*  #include "opintl.h" */
-
-/* Get LENGTH bytes from info's buffer, at target address memaddr.
-   Transfer them to myaddr.  */
-#if 0
-int
-buffer_read_memory (memaddr, myaddr, length, info)
-     bfd_vma memaddr;
-     bfd_byte *myaddr;
-     unsigned int length;
-     struct disassemble_info *info;
-{
-  unsigned int opb = info->octets_per_byte;
-  unsigned int end_addr_offset = length / opb;
-  unsigned int max_addr_offset = info->buffer_length / opb; 
-  unsigned int octets = (memaddr - info->buffer_vma) * opb;
-
-  printf("%d %d\n", memaddr, info->buffer_vma);
-  if (memaddr < info->buffer_vma
-      || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
-    /* Out of bounds.  Use EIO because GDB uses it.  */
-    return EIO;
-  memcpy (myaddr, info->buffer + octets, length);
-
-  return 0;
-}
-#endif
-
-/* Print an error message.  We can assume that this is in response to
-   an error return from buffer_read_memory.  */
-void
-perror_memory (status, memaddr, info)
-     int status;
-     bfd_vma memaddr;
-     struct disassemble_info *info;
-{
-  if (status != EIO)
-    /* Can't happen.  */
-    info->fprintf_func (info->stream, _("Unknown error %d\n"), status);
-  else
-    /* Actually, address between memaddr and memaddr + len was
-       out of bounds.  */
-    info->fprintf_func (info->stream,
-                       _("Address 0x%x is out of bounds.\n"), memaddr);
-}
-
-/* This could be in a separate file, to save miniscule amounts of space
-   in statically linked executables.  */
-
-/* Just print the address is hex.  This is included for completeness even
-   though both GDB and objdump provide their own (to print symbolic
-   addresses).  */
-
-void
-generic_print_address (addr, info)
-     bfd_vma addr;
-     struct disassemble_info *info;
-{
-  char buf[30];
-
-  sprintf_vma (buf, addr);
-  (*info->fprintf_func) (info->stream, "0x%s", buf);
-}
-
-#if 0
-/* Just concatenate the address as hex.  This is included for
-   completeness even though both GDB and objdump provide their own (to
-   print symbolic addresses).  */
-
-void generic_strcat_address PARAMS ((bfd_vma, char *, int));
-
-void
-generic_strcat_address (addr, buf, len)
-     bfd_vma addr;
-     char *buf;
-     int len;
-{
-  if (buf != (char *)NULL && len > 0)
-    {
-      char tmpBuf[30];
-
-      sprintf_vma (tmpBuf, addr);
-      if ((strlen (buf) + strlen (tmpBuf)) <= (unsigned int) len)
-       strcat (buf, tmpBuf);
-      else
-       strncat (buf, tmpBuf, (len - strlen(buf)));
-    }
-  return;
-}
-#endif
-
-/* Just return the given address.  */
-
-int
-generic_symbol_at_address (addr, info)
-     bfd_vma addr ATTRIBUTE_UNUSED;
-     struct disassemble_info *info ATTRIBUTE_UNUSED;
-{
-  return 1;
-}
diff --git a/i386/disass.c b/i386/disass.c
deleted file mode 100644 (file)
index 2ef723a..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* i386/disass.c ***************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Wrapper functions to call the disassembler from the GNU binutils.
-
-    Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-             Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-             Christian Thalinger
-
-    Last Change: $Id: disass.c 491 2003-10-20 17:56:03Z twisti $
-
-*******************************************************************************/
-
-#include "dis-asm.h"
-
-static u1 *codestatic = 0;
-static int pstatic = 0;
-
-char mylinebuf[512];
-int mylen;
-
-
-static void myprintf(PTR p, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       mylen += vsprintf(mylinebuf + mylen, fmt, ap);
-       va_end(ap);
-}
-
-static int buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info)
-{
-       if (length == 1)
-               *myaddr = *((u1 *) memaddr);
-       else
-               memcpy(myaddr, (void *) memaddr, length);
-       return 0;
-}
-
-
-/* name table for 8 integer registers */
-
-static char *regs[] = {
-       "eax",
-       "ecx",
-       "edx",
-       "ebx",
-       "esp",
-       "ebp",
-       "esi",
-       "edi"
-};
-
-
-/* function disassinstr ********************************************************
-
-       outputs a disassembler listing of one machine code instruction on 'stdout'
-       c:   instructions machine code
-       pos: instructions address relative to method start
-
-*******************************************************************************/
-
-static void disassinstr(u1 *code, int pos)
-{
-       static disassemble_info info;
-       static int dis_initialized;
-       int seqlen;
-       int i;
-
-       if (!dis_initialized) {
-               INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
-               info.mach = bfd_mach_i386_i386;
-               dis_initialized = 1;
-       }
-
-       printf("0x%08x:   ", (s4) code);
-       mylen = 0;
-       seqlen = print_insn_i386((bfd_vma) code, &info);
-
-       for (i = 0; i < seqlen; i++) {
-               printf("%02x ", *(code++));
-       }
-
-       for (; i < 8; i++) {
-               printf("   ");
-       }
-
-       printf("   %s\n", mylinebuf);
-
-       codestatic = code - 1;
-       pstatic = pos + seqlen - 1;
-}
-
-
-/* function disassemble ********************************************************
-
-       outputs a disassembler listing of some machine code on 'stdout'
-       code: pointer to first instruction
-       len:  code size (number of instructions * 4)
-
-*******************************************************************************/
-
-static void disassemble(u1 *code, int len)
-{
-       int p;
-       int seqlen;
-       int i;
-       disassemble_info info;
-
-       INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
-       info.mach = bfd_mach_i386_i386;
-
-       printf("  --- disassembler listing ---\n");
-       for (p = 0; p < len;) {
-               printf("0x%08x:   ", (s4) code);
-               mylen = 0;
-
-               seqlen = print_insn_i386((bfd_vma) code, &info);
-               p += seqlen;
-/*             myprintf(NULL, "\n"); */
-
-               for (i = 0; i < seqlen; i++) {
-                       printf("%02x ", *(code++));
-               }
-
-               for (; i < 8; i++) {
-                       printf("   ");
-               }
-
-               printf("   %s\n", mylinebuf);
-       }
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/i386/i386-dis.c b/i386/i386-dis.c
deleted file mode 100644 (file)
index 5b01e2f..0000000
+++ /dev/null
@@ -1,4147 +0,0 @@
-/* Print i386 instructions for GDB, the GNU debugger.
-   Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2001
-   Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-/*
- * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
- * July 1988
- *  modified by John Hassey (hassey@dg-rtp.dg.com)
- *  x86-64 support added by Jan Hubicka (jh@suse.cz)
- */
-
-/*
- * The main tables describing the instructions is essentially a copy
- * of the "Opcode Map" chapter (Appendix A) of the Intel 80386
- * Programmers Manual.  Usually, there is a capital letter, followed
- * by a small letter.  The capital letter tell the addressing mode,
- * and the small letter tells about the operand size.  Refer to
- * the Intel manual for details.
- */
-
-#include "dis-asm.h"
-/*  #include "sysdep.h" */
-/*  #include "opintl.h" */
-
-#define MAXLEN 20
-
-#include <setjmp.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifndef UNIXWARE_COMPAT
-/* Set non-zero for broken, compatible instructions.  Set to zero for
-   non-broken opcodes.  */
-#define UNIXWARE_COMPAT 1
-#endif
-
-static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *));
-static void ckprefix PARAMS ((void));
-static const char *prefix_name PARAMS ((int, int));
-static int print_insn PARAMS ((bfd_vma, disassemble_info *));
-static void dofloat PARAMS ((int));
-static void OP_ST PARAMS ((int, int));
-static void OP_STi  PARAMS ((int, int));
-static int putop PARAMS ((const char *, int));
-static void oappend PARAMS ((const char *));
-static void append_seg PARAMS ((void));
-static void OP_indirE PARAMS ((int, int));
-static void print_operand_value PARAMS ((char *, int, bfd_vma));
-static void OP_E PARAMS ((int, int));
-static void OP_G PARAMS ((int, int));
-static bfd_vma get64 PARAMS ((void));
-static bfd_signed_vma get32 PARAMS ((void));
-static bfd_signed_vma get32s PARAMS ((void));
-static int get16 PARAMS ((void));
-static void set_op PARAMS ((bfd_vma, int));
-static void OP_REG PARAMS ((int, int));
-static void OP_IMREG PARAMS ((int, int));
-static void OP_I PARAMS ((int, int));
-static void OP_I64 PARAMS ((int, int));
-static void OP_sI PARAMS ((int, int));
-static void OP_J PARAMS ((int, int));
-static void OP_SEG PARAMS ((int, int));
-static void OP_DIR PARAMS ((int, int));
-static void OP_OFF PARAMS ((int, int));
-static void OP_OFF64 PARAMS ((int, int));
-static void ptr_reg PARAMS ((int, int));
-static void OP_ESreg PARAMS ((int, int));
-static void OP_DSreg PARAMS ((int, int));
-static void OP_C PARAMS ((int, int));
-static void OP_D PARAMS ((int, int));
-static void OP_T PARAMS ((int, int));
-static void OP_Rd PARAMS ((int, int));
-static void OP_MMX PARAMS ((int, int));
-static void OP_XMM PARAMS ((int, int));
-static void OP_EM PARAMS ((int, int));
-static void OP_EX PARAMS ((int, int));
-static void OP_MS PARAMS ((int, int));
-static void OP_XS PARAMS ((int, int));
-static void OP_3DNowSuffix PARAMS ((int, int));
-static void OP_SIMD_Suffix PARAMS ((int, int));
-static void SIMD_Fixup PARAMS ((int, int));
-static void BadOp PARAMS ((void));
-
-struct dis_private {
-  /* Points to first byte not fetched.  */
-  bfd_byte *max_fetched;
-  bfd_byte the_buffer[MAXLEN];
-  bfd_vma insn_start;
-  int orig_sizeflag;
-  jmp_buf bailout;
-};
-
-/* The opcode for the fwait instruction, which we treat as a prefix
-   when we can.  */
-#define FWAIT_OPCODE (0x9b)
-
-/* Set to 1 for 64bit mode disassembly.  */
-static int mode_64bit;
-
-/* Flags for the prefixes for the current instruction.  See below.  */
-static int prefixes;
-
-/* REX prefix the current instruction.  See below.  */
-static int rex;
-/* Bits of REX we've already used.  */
-static int rex_used;
-#define REX_MODE64     8
-#define REX_EXTX       4
-#define REX_EXTY       2
-#define REX_EXTZ       1
-/* Mark parts used in the REX prefix.  When we are testing for
-   empty prefix (for 8bit register REX extension), just mask it
-   out.  Otherwise test for REX bit is excuse for existence of REX
-   only in case value is nonzero.  */
-#define USED_REX(value)                                        \
-  {                                                    \
-    if (value)                                         \
-      rex_used |= (rex & value) ? (value) | 0x40 : 0;  \
-    else                                               \
-      rex_used |= 0x40;                                        \
-  }
-
-/* Flags for prefixes which we somehow handled when printing the
-   current instruction.  */
-static int used_prefixes;
-
-/* Flags stored in PREFIXES.  */
-#define PREFIX_REPZ 1
-#define PREFIX_REPNZ 2
-#define PREFIX_LOCK 4
-#define PREFIX_CS 8
-#define PREFIX_SS 0x10
-#define PREFIX_DS 0x20
-#define PREFIX_ES 0x40
-#define PREFIX_FS 0x80
-#define PREFIX_GS 0x100
-#define PREFIX_DATA 0x200
-#define PREFIX_ADDR 0x400
-#define PREFIX_FWAIT 0x800
-
-/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
-   to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
-   on error.  */
-#define FETCH_DATA(info, addr) \
-  ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
-   ? 1 : fetch_data ((info), (addr)))
-
-static int
-fetch_data (info, addr)
-     struct disassemble_info *info;
-     bfd_byte *addr;
-{
-  int status;
-  struct dis_private *priv = (struct dis_private *) info->private_data;
-  bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer);
-
-  status = (*info->read_memory_func) (start,
-                                     priv->max_fetched,
-                                     addr - priv->max_fetched,
-                                     info);
-  if (status != 0)
-    {
-      /* If we did manage to read at least one byte, then
-         print_insn_i386 will do something sensible.  Otherwise, print
-         an error.  We do that here because this is where we know
-         STATUS.  */
-      if (priv->max_fetched == priv->the_buffer)
-       (*info->memory_error_func) (status, start, info);
-      longjmp (priv->bailout, 1);
-    }
-  else
-    priv->max_fetched = addr;
-  return 1;
-}
-
-#define XX NULL, 0
-
-#define Eb OP_E, b_mode
-#define Ev OP_E, v_mode
-#define Ed OP_E, d_mode
-#define indirEb OP_indirE, b_mode
-#define indirEv OP_indirE, v_mode
-#define Ew OP_E, w_mode
-#define Ma OP_E, v_mode
-#define M OP_E, 0              /* lea, lgdt, etc. */
-#define Mp OP_E, 0             /* 32 or 48 bit memory operand for LDS, LES etc */
-#define Gb OP_G, b_mode
-#define Gv OP_G, v_mode
-#define Gd OP_G, d_mode
-#define Gw OP_G, w_mode
-#define Rd OP_Rd, d_mode
-#define Rm OP_Rd, m_mode
-#define Ib OP_I, b_mode
-#define sIb OP_sI, b_mode      /* sign extened byte */
-#define Iv OP_I, v_mode
-#define Iq OP_I, q_mode
-#define Iv64 OP_I64, v_mode
-#define Iw OP_I, w_mode
-#define Jb OP_J, b_mode
-#define Jv OP_J, v_mode
-#define Cm OP_C, m_mode
-#define Dm OP_D, m_mode
-#define Td OP_T, d_mode
-
-#define RMeAX OP_REG, eAX_reg
-#define RMeBX OP_REG, eBX_reg
-#define RMeCX OP_REG, eCX_reg
-#define RMeDX OP_REG, eDX_reg
-#define RMeSP OP_REG, eSP_reg
-#define RMeBP OP_REG, eBP_reg
-#define RMeSI OP_REG, eSI_reg
-#define RMeDI OP_REG, eDI_reg
-#define RMrAX OP_REG, rAX_reg
-#define RMrBX OP_REG, rBX_reg
-#define RMrCX OP_REG, rCX_reg
-#define RMrDX OP_REG, rDX_reg
-#define RMrSP OP_REG, rSP_reg
-#define RMrBP OP_REG, rBP_reg
-#define RMrSI OP_REG, rSI_reg
-#define RMrDI OP_REG, rDI_reg
-#define RMAL OP_REG, al_reg
-#define RMAL OP_REG, al_reg
-#define RMCL OP_REG, cl_reg
-#define RMDL OP_REG, dl_reg
-#define RMBL OP_REG, bl_reg
-#define RMAH OP_REG, ah_reg
-#define RMCH OP_REG, ch_reg
-#define RMDH OP_REG, dh_reg
-#define RMBH OP_REG, bh_reg
-#define RMAX OP_REG, ax_reg
-#define RMDX OP_REG, dx_reg
-
-#define eAX OP_IMREG, eAX_reg
-#define eBX OP_IMREG, eBX_reg
-#define eCX OP_IMREG, eCX_reg
-#define eDX OP_IMREG, eDX_reg
-#define eSP OP_IMREG, eSP_reg
-#define eBP OP_IMREG, eBP_reg
-#define eSI OP_IMREG, eSI_reg
-#define eDI OP_IMREG, eDI_reg
-#define AL OP_IMREG, al_reg
-#define AL OP_IMREG, al_reg
-#define CL OP_IMREG, cl_reg
-#define DL OP_IMREG, dl_reg
-#define BL OP_IMREG, bl_reg
-#define AH OP_IMREG, ah_reg
-#define CH OP_IMREG, ch_reg
-#define DH OP_IMREG, dh_reg
-#define BH OP_IMREG, bh_reg
-#define AX OP_IMREG, ax_reg
-#define DX OP_IMREG, dx_reg
-#define indirDX OP_IMREG, indir_dx_reg
-
-#define Sw OP_SEG, w_mode
-#define Ap OP_DIR, 0
-#define Ob OP_OFF, b_mode
-#define Ob64 OP_OFF64, b_mode
-#define Ov OP_OFF, v_mode
-#define Ov64 OP_OFF64, v_mode
-#define Xb OP_DSreg, eSI_reg
-#define Xv OP_DSreg, eSI_reg
-#define Yb OP_ESreg, eDI_reg
-#define Yv OP_ESreg, eDI_reg
-#define DSBX OP_DSreg, eBX_reg
-
-#define es OP_REG, es_reg
-#define ss OP_REG, ss_reg
-#define cs OP_REG, cs_reg
-#define ds OP_REG, ds_reg
-#define fs OP_REG, fs_reg
-#define gs OP_REG, gs_reg
-
-#define MX OP_MMX, 0
-#define XM OP_XMM, 0
-#define EM OP_EM, v_mode
-#define EX OP_EX, v_mode
-#define MS OP_MS, v_mode
-#define XS OP_XS, v_mode
-#define None OP_E, 0
-#define OPSUF OP_3DNowSuffix, 0
-#define OPSIMD OP_SIMD_Suffix, 0
-
-#define cond_jump_flag NULL, cond_jump_mode
-#define loop_jcxz_flag NULL, loop_jcxz_mode
-
-/* bits in sizeflag */
-#define SUFFIX_ALWAYS 4
-#define AFLAG 2
-#define DFLAG 1
-
-#define b_mode 1  /* byte operand */
-#define v_mode 2  /* operand size depends on prefixes */
-#define w_mode 3  /* word operand */
-#define d_mode 4  /* double word operand  */
-#define q_mode 5  /* quad word operand */
-#define x_mode 6
-#define m_mode 7  /* d_mode in 32bit, q_mode in 64bit mode.  */
-#define cond_jump_mode 8
-#define loop_jcxz_mode 9
-
-#define es_reg 100
-#define cs_reg 101
-#define ss_reg 102
-#define ds_reg 103
-#define fs_reg 104
-#define gs_reg 105
-
-#define eAX_reg 108
-#define eCX_reg 109
-#define eDX_reg 110
-#define eBX_reg 111
-#define eSP_reg 112
-#define eBP_reg 113
-#define eSI_reg 114
-#define eDI_reg 115
-
-#define al_reg 116
-#define cl_reg 117
-#define dl_reg 118
-#define bl_reg 119
-#define ah_reg 120
-#define ch_reg 121
-#define dh_reg 122
-#define bh_reg 123
-
-#define ax_reg 124
-#define cx_reg 125
-#define dx_reg 126
-#define bx_reg 127
-#define sp_reg 128
-#define bp_reg 129
-#define si_reg 130
-#define di_reg 131
-
-#define rAX_reg 132
-#define rCX_reg 133
-#define rDX_reg 134
-#define rBX_reg 135
-#define rSP_reg 136
-#define rBP_reg 137
-#define rSI_reg 138
-#define rDI_reg 139
-
-#define indir_dx_reg 150
-
-#define FLOATCODE 1
-#define USE_GROUPS 2
-#define USE_PREFIX_USER_TABLE 3
-#define X86_64_SPECIAL 4
-
-#define FLOAT    NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
-
-#define GRP1b    NULL, NULL, USE_GROUPS, NULL,  0, NULL, 0
-#define GRP1S    NULL, NULL, USE_GROUPS, NULL,  1, NULL, 0
-#define GRP1Ss   NULL, NULL, USE_GROUPS, NULL,  2, NULL, 0
-#define GRP2b    NULL, NULL, USE_GROUPS, NULL,  3, NULL, 0
-#define GRP2S    NULL, NULL, USE_GROUPS, NULL,  4, NULL, 0
-#define GRP2b_one NULL, NULL, USE_GROUPS, NULL,  5, NULL, 0
-#define GRP2S_one NULL, NULL, USE_GROUPS, NULL,  6, NULL, 0
-#define GRP2b_cl  NULL, NULL, USE_GROUPS, NULL,  7, NULL, 0
-#define GRP2S_cl  NULL, NULL, USE_GROUPS, NULL,  8, NULL, 0
-#define GRP3b    NULL, NULL, USE_GROUPS, NULL,  9, NULL, 0
-#define GRP3S    NULL, NULL, USE_GROUPS, NULL, 10, NULL, 0
-#define GRP4     NULL, NULL, USE_GROUPS, NULL, 11, NULL, 0
-#define GRP5     NULL, NULL, USE_GROUPS, NULL, 12, NULL, 0
-#define GRP6     NULL, NULL, USE_GROUPS, NULL, 13, NULL, 0
-#define GRP7     NULL, NULL, USE_GROUPS, NULL, 14, NULL, 0
-#define GRP8     NULL, NULL, USE_GROUPS, NULL, 15, NULL, 0
-#define GRP9     NULL, NULL, USE_GROUPS, NULL, 16, NULL, 0
-#define GRP10    NULL, NULL, USE_GROUPS, NULL, 17, NULL, 0
-#define GRP11    NULL, NULL, USE_GROUPS, NULL, 18, NULL, 0
-#define GRP12    NULL, NULL, USE_GROUPS, NULL, 19, NULL, 0
-#define GRP13    NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0
-#define GRP14    NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0
-#define GRPAMD   NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0
-
-#define PREGRP0   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  0, NULL, 0
-#define PREGRP1   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  1, NULL, 0
-#define PREGRP2   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  2, NULL, 0
-#define PREGRP3   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  3, NULL, 0
-#define PREGRP4   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  4, NULL, 0
-#define PREGRP5   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  5, NULL, 0
-#define PREGRP6   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  6, NULL, 0
-#define PREGRP7   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  7, NULL, 0
-#define PREGRP8   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  8, NULL, 0
-#define PREGRP9   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  9, NULL, 0
-#define PREGRP10  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 10, NULL, 0
-#define PREGRP11  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 11, NULL, 0
-#define PREGRP12  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 12, NULL, 0
-#define PREGRP13  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 13, NULL, 0
-#define PREGRP14  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 14, NULL, 0
-#define PREGRP15  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 15, NULL, 0
-#define PREGRP16  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 16, NULL, 0
-#define PREGRP17  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 17, NULL, 0
-#define PREGRP18  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 18, NULL, 0
-#define PREGRP19  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 19, NULL, 0
-#define PREGRP20  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 20, NULL, 0
-#define PREGRP21  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 21, NULL, 0
-#define PREGRP22  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 22, NULL, 0
-#define PREGRP23  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 23, NULL, 0
-#define PREGRP24  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 24, NULL, 0
-#define PREGRP25  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 25, NULL, 0
-#define PREGRP26  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 26, NULL, 0
-
-#define X86_64_0  NULL, NULL, X86_64_SPECIAL, NULL,  0, NULL, 0
-
-typedef void (*op_rtn) PARAMS ((int bytemode, int sizeflag));
-
-struct dis386 {
-  const char *name;
-  op_rtn op1;
-  int bytemode1;
-  op_rtn op2;
-  int bytemode2;
-  op_rtn op3;
-  int bytemode3;
-};
-
-/* Upper case letters in the instruction names here are macros.
-   'A' => print 'b' if no register operands or suffix_always is true
-   'B' => print 'b' if suffix_always is true
-   'E' => print 'e' if 32-bit form of jcxz
-   'F' => print 'w' or 'l' depending on address size prefix (loop insns)
-   'H' => print ",pt" or ",pn" branch hint
-   'L' => print 'l' if suffix_always is true
-   'N' => print 'n' if instruction has no wait "prefix"
-   'O' => print 'd', or 'o'
-   'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
-   .      or suffix_always is true.  print 'q' if rex prefix is present.
-   'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always
-   .      is true
-   'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode)
-   'S' => print 'w', 'l' or 'q' if suffix_always is true
-   'T' => print 'q' in 64bit mode and behave as 'P' otherwise
-   'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
-   'X' => print 's', 'd' depending on data16 prefix (for XMM)
-   'W' => print 'b' or 'w' ("w" or "de" in intel mode)
-   'Y' => 'q' if instruction has an REX 64bit overwrite prefix
-
-   Many of the above letters print nothing in Intel mode.  See "putop"
-   for the details.
-
-   Braces '{' and '}', and vertical bars '|', indicate alternative
-   mnemonic strings for AT&T, Intel, X86_64 AT&T, and X86_64 Intel
-   modes.  In cases where there are only two alternatives, the X86_64
-   instruction is reserved, and "(bad)" is printed.
-*/
-
-static const struct dis386 dis386[] = {
-  /* 00 */
-  { "addB",            Eb, Gb, XX },
-  { "addS",            Ev, Gv, XX },
-  { "addB",            Gb, Eb, XX },
-  { "addS",            Gv, Ev, XX },
-  { "addB",            AL, Ib, XX },
-  { "addS",            eAX, Iv, XX },
-  { "push{T|}",                es, XX, XX },
-  { "pop{T|}",         es, XX, XX },
-  /* 08 */
-  { "orB",             Eb, Gb, XX },
-  { "orS",             Ev, Gv, XX },
-  { "orB",             Gb, Eb, XX },
-  { "orS",             Gv, Ev, XX },
-  { "orB",             AL, Ib, XX },
-  { "orS",             eAX, Iv, XX },
-  { "push{T|}",                cs, XX, XX },
-  { "(bad)",           XX, XX, XX },   /* 0x0f extended opcode escape */
-  /* 10 */
-  { "adcB",            Eb, Gb, XX },
-  { "adcS",            Ev, Gv, XX },
-  { "adcB",            Gb, Eb, XX },
-  { "adcS",            Gv, Ev, XX },
-  { "adcB",            AL, Ib, XX },
-  { "adcS",            eAX, Iv, XX },
-  { "push{T|}",                ss, XX, XX },
-  { "popT|}",          ss, XX, XX },
-  /* 18 */
-  { "sbbB",            Eb, Gb, XX },
-  { "sbbS",            Ev, Gv, XX },
-  { "sbbB",            Gb, Eb, XX },
-  { "sbbS",            Gv, Ev, XX },
-  { "sbbB",            AL, Ib, XX },
-  { "sbbS",            eAX, Iv, XX },
-  { "push{T|}",                ds, XX, XX },
-  { "pop{T|}",         ds, XX, XX },
-  /* 20 */
-  { "andB",            Eb, Gb, XX },
-  { "andS",            Ev, Gv, XX },
-  { "andB",            Gb, Eb, XX },
-  { "andS",            Gv, Ev, XX },
-  { "andB",            AL, Ib, XX },
-  { "andS",            eAX, Iv, XX },
-  { "(bad)",           XX, XX, XX },   /* SEG ES prefix */
-  { "daa{|}",          XX, XX, XX },
-  /* 28 */
-  { "subB",            Eb, Gb, XX },
-  { "subS",            Ev, Gv, XX },
-  { "subB",            Gb, Eb, XX },
-  { "subS",            Gv, Ev, XX },
-  { "subB",            AL, Ib, XX },
-  { "subS",            eAX, Iv, XX },
-  { "(bad)",           XX, XX, XX },   /* SEG CS prefix */
-  { "das{|}",          XX, XX, XX },
-  /* 30 */
-  { "xorB",            Eb, Gb, XX },
-  { "xorS",            Ev, Gv, XX },
-  { "xorB",            Gb, Eb, XX },
-  { "xorS",            Gv, Ev, XX },
-  { "xorB",            AL, Ib, XX },
-  { "xorS",            eAX, Iv, XX },
-  { "(bad)",           XX, XX, XX },   /* SEG SS prefix */
-  { "aaa{|}",          XX, XX, XX },
-  /* 38 */
-  { "cmpB",            Eb, Gb, XX },
-  { "cmpS",            Ev, Gv, XX },
-  { "cmpB",            Gb, Eb, XX },
-  { "cmpS",            Gv, Ev, XX },
-  { "cmpB",            AL, Ib, XX },
-  { "cmpS",            eAX, Iv, XX },
-  { "(bad)",           XX, XX, XX },   /* SEG DS prefix */
-  { "aas{|}",          XX, XX, XX },
-  /* 40 */
-  { "inc{S|}",         RMeAX, XX, XX },
-  { "inc{S|}",         RMeCX, XX, XX },
-  { "inc{S|}",         RMeDX, XX, XX },
-  { "inc{S|}",         RMeBX, XX, XX },
-  { "inc{S|}",         RMeSP, XX, XX },
-  { "inc{S|}",         RMeBP, XX, XX },
-  { "inc{S|}",         RMeSI, XX, XX },
-  { "inc{S|}",         RMeDI, XX, XX },
-  /* 48 */
-  { "dec{S|}",         RMeAX, XX, XX },
-  { "dec{S|}",         RMeCX, XX, XX },
-  { "dec{S|}",         RMeDX, XX, XX },
-  { "dec{S|}",         RMeBX, XX, XX },
-  { "dec{S|}",         RMeSP, XX, XX },
-  { "dec{S|}",         RMeBP, XX, XX },
-  { "dec{S|}",         RMeSI, XX, XX },
-  { "dec{S|}",         RMeDI, XX, XX },
-  /* 50 */
-  { "pushS",           RMrAX, XX, XX },
-  { "pushS",           RMrCX, XX, XX },
-  { "pushS",           RMrDX, XX, XX },
-  { "pushS",           RMrBX, XX, XX },
-  { "pushS",           RMrSP, XX, XX },
-  { "pushS",           RMrBP, XX, XX },
-  { "pushS",           RMrSI, XX, XX },
-  { "pushS",           RMrDI, XX, XX },
-  /* 58 */
-  { "popS",            RMrAX, XX, XX },
-  { "popS",            RMrCX, XX, XX },
-  { "popS",            RMrDX, XX, XX },
-  { "popS",            RMrBX, XX, XX },
-  { "popS",            RMrSP, XX, XX },
-  { "popS",            RMrBP, XX, XX },
-  { "popS",            RMrSI, XX, XX },
-  { "popS",            RMrDI, XX, XX },
-  /* 60 */
-  { "pusha{P|}",       XX, XX, XX },
-  { "popa{P|}",                XX, XX, XX },
-  { "bound{S|}",       Gv, Ma, XX },
-  { X86_64_0 },
-  { "(bad)",           XX, XX, XX },   /* seg fs */
-  { "(bad)",           XX, XX, XX },   /* seg gs */
-  { "(bad)",           XX, XX, XX },   /* op size prefix */
-  { "(bad)",           XX, XX, XX },   /* adr size prefix */
-  /* 68 */
-  { "pushT",           Iq, XX, XX },
-  { "imulS",           Gv, Ev, Iv },
-  { "pushT",           sIb, XX, XX },
-  { "imulS",           Gv, Ev, sIb },
-  { "ins{b||b|}",      Yb, indirDX, XX },
-  { "ins{R||R|}",      Yv, indirDX, XX },
-  { "outs{b||b|}",     indirDX, Xb, XX },
-  { "outs{R||R|}",     indirDX, Xv, XX },
-  /* 70 */
-  { "joH",             Jb, XX, cond_jump_flag },
-  { "jnoH",            Jb, XX, cond_jump_flag },
-  { "jbH",             Jb, XX, cond_jump_flag },
-  { "jaeH",            Jb, XX, cond_jump_flag },
-  { "jeH",             Jb, XX, cond_jump_flag },
-  { "jneH",            Jb, XX, cond_jump_flag },
-  { "jbeH",            Jb, XX, cond_jump_flag },
-  { "jaH",             Jb, XX, cond_jump_flag },
-  /* 78 */
-  { "jsH",             Jb, XX, cond_jump_flag },
-  { "jnsH",            Jb, XX, cond_jump_flag },
-  { "jpH",             Jb, XX, cond_jump_flag },
-  { "jnpH",            Jb, XX, cond_jump_flag },
-  { "jlH",             Jb, XX, cond_jump_flag },
-  { "jgeH",            Jb, XX, cond_jump_flag },
-  { "jleH",            Jb, XX, cond_jump_flag },
-  { "jgH",             Jb, XX, cond_jump_flag },
-  /* 80 */
-  { GRP1b },
-  { GRP1S },
-  { "(bad)",           XX, XX, XX },
-  { GRP1Ss },
-  { "testB",           Eb, Gb, XX },
-  { "testS",           Ev, Gv, XX },
-  { "xchgB",           Eb, Gb, XX },
-  { "xchgS",           Ev, Gv, XX },
-  /* 88 */
-  { "movB",            Eb, Gb, XX },
-  { "movS",            Ev, Gv, XX },
-  { "movB",            Gb, Eb, XX },
-  { "movS",            Gv, Ev, XX },
-  { "movQ",            Ev, Sw, XX },
-  { "leaS",            Gv, M, XX },
-  { "movQ",            Sw, Ev, XX },
-  { "popU",            Ev, XX, XX },
-  /* 90 */
-  { "nop",             XX, XX, XX },
-  /* FIXME: NOP with REPz prefix is called PAUSE.  */
-  { "xchgS",           RMeCX, eAX, XX },
-  { "xchgS",           RMeDX, eAX, XX },
-  { "xchgS",           RMeBX, eAX, XX },
-  { "xchgS",           RMeSP, eAX, XX },
-  { "xchgS",           RMeBP, eAX, XX },
-  { "xchgS",           RMeSI, eAX, XX },
-  { "xchgS",           RMeDI, eAX, XX },
-  /* 98 */
-  { "cW{tR||tR|}",     XX, XX, XX },
-  { "cR{tO||tO|}",     XX, XX, XX },
-  { "lcall{T|}",       Ap, XX, XX },
-  { "(bad)",           XX, XX, XX },   /* fwait */
-  { "pushfT",          XX, XX, XX },
-  { "popfT",           XX, XX, XX },
-  { "sahf{|}",         XX, XX, XX },
-  { "lahf{|}",         XX, XX, XX },
-  /* a0 */
-  { "movB",            AL, Ob64, XX },
-  { "movS",            eAX, Ov64, XX },
-  { "movB",            Ob64, AL, XX },
-  { "movS",            Ov64, eAX, XX },
-  { "movs{b||b|}",     Yb, Xb, XX },
-  { "movs{R||R|}",     Yv, Xv, XX },
-  { "cmps{b||b|}",     Xb, Yb, XX },
-  { "cmps{R||R|}",     Xv, Yv, XX },
-  /* a8 */
-  { "testB",           AL, Ib, XX },
-  { "testS",           eAX, Iv, XX },
-  { "stosB",           Yb, AL, XX },
-  { "stosS",           Yv, eAX, XX },
-  { "lodsB",           AL, Xb, XX },
-  { "lodsS",           eAX, Xv, XX },
-  { "scasB",           AL, Yb, XX },
-  { "scasS",           eAX, Yv, XX },
-  /* b0 */
-  { "movB",            RMAL, Ib, XX },
-  { "movB",            RMCL, Ib, XX },
-  { "movB",            RMDL, Ib, XX },
-  { "movB",            RMBL, Ib, XX },
-  { "movB",            RMAH, Ib, XX },
-  { "movB",            RMCH, Ib, XX },
-  { "movB",            RMDH, Ib, XX },
-  { "movB",            RMBH, Ib, XX },
-  /* b8 */
-  { "movS",            RMeAX, Iv64, XX },
-  { "movS",            RMeCX, Iv64, XX },
-  { "movS",            RMeDX, Iv64, XX },
-  { "movS",            RMeBX, Iv64, XX },
-  { "movS",            RMeSP, Iv64, XX },
-  { "movS",            RMeBP, Iv64, XX },
-  { "movS",            RMeSI, Iv64, XX },
-  { "movS",            RMeDI, Iv64, XX },
-  /* c0 */
-  { GRP2b },
-  { GRP2S },
-  { "retT",            Iw, XX, XX },
-  { "retT",            XX, XX, XX },
-  { "les{S|}",         Gv, Mp, XX },
-  { "ldsS",            Gv, Mp, XX },
-  { "movA",            Eb, Ib, XX },
-  { "movQ",            Ev, Iv, XX },
-  /* c8 */
-  { "enterT",          Iw, Ib, XX },
-  { "leaveT",          XX, XX, XX },
-  { "lretP",           Iw, XX, XX },
-  { "lretP",           XX, XX, XX },
-  { "int3",            XX, XX, XX },
-  { "int",             Ib, XX, XX },
-  { "into{|}",         XX, XX, XX },
-  { "iretP",           XX, XX, XX },
-  /* d0 */
-  { GRP2b_one },
-  { GRP2S_one },
-  { GRP2b_cl },
-  { GRP2S_cl },
-  { "aam{|}",          sIb, XX, XX },
-  { "aad{|}",          sIb, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "xlat",            DSBX, XX, XX },
-  /* d8 */
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  /* e0 */
-  { "loopneFH",                Jb, XX, loop_jcxz_flag },
-  { "loopeFH",         Jb, XX, loop_jcxz_flag },
-  { "loopFH",          Jb, XX, loop_jcxz_flag },
-  { "jEcxzH",          Jb, XX, loop_jcxz_flag },
-  { "inB",             AL, Ib, XX },
-  { "inS",             eAX, Ib, XX },
-  { "outB",            Ib, AL, XX },
-  { "outS",            Ib, eAX, XX },
-  /* e8 */
-  { "callT",           Jv, XX, XX },
-  { "jmpT",            Jv, XX, XX },
-  { "ljmp{T|}",                Ap, XX, XX },
-  { "jmp",             Jb, XX, XX },
-  { "inB",             AL, indirDX, XX },
-  { "inS",             eAX, indirDX, XX },
-  { "outB",            indirDX, AL, XX },
-  { "outS",            indirDX, eAX, XX },
-  /* f0 */
-  { "(bad)",           XX, XX, XX },   /* lock prefix */
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },   /* repne */
-  { "(bad)",           XX, XX, XX },   /* repz */
-  { "hlt",             XX, XX, XX },
-  { "cmc",             XX, XX, XX },
-  { GRP3b },
-  { GRP3S },
-  /* f8 */
-  { "clc",             XX, XX, XX },
-  { "stc",             XX, XX, XX },
-  { "cli",             XX, XX, XX },
-  { "sti",             XX, XX, XX },
-  { "cld",             XX, XX, XX },
-  { "std",             XX, XX, XX },
-  { GRP4 },
-  { GRP5 },
-};
-
-static const struct dis386 dis386_twobyte[] = {
-  /* 00 */
-  { GRP6 },
-  { GRP7 },
-  { "larS",            Gv, Ew, XX },
-  { "lslS",            Gv, Ew, XX },
-  { "(bad)",           XX, XX, XX },
-  { "syscall",         XX, XX, XX },
-  { "clts",            XX, XX, XX },
-  { "sysretP",         XX, XX, XX },
-  /* 08 */
-  { "invd",            XX, XX, XX },
-  { "wbinvd",          XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "ud2a",            XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { GRPAMD },
-  { "femms",           XX, XX, XX },
-  { "",                        MX, EM, OPSUF }, /* See OP_3DNowSuffix.  */
-  /* 10 */
-  { PREGRP8 },
-  { PREGRP9 },
-  { "movlpX",          XM, EX, SIMD_Fixup, 'h' }, /* really only 2 operands */
-  { "movlpX",          EX, XM, SIMD_Fixup, 'h' },
-  { "unpcklpX",                XM, EX, XX },
-  { "unpckhpX",                XM, EX, XX },
-  { "movhpX",          XM, EX, SIMD_Fixup, 'l' },
-  { "movhpX",          EX, XM, SIMD_Fixup, 'l' },
-  /* 18 */
-  { GRP14 },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  /* 20 */
-  { "movL",            Rm, Cm, XX },
-  { "movL",            Rm, Dm, XX },
-  { "movL",            Cm, Rm, XX },
-  { "movL",            Dm, Rm, XX },
-  { "movL",            Rd, Td, XX },
-  { "(bad)",           XX, XX, XX },
-  { "movL",            Td, Rd, XX },
-  { "(bad)",           XX, XX, XX },
-  /* 28 */
-  { "movapX",          XM, EX, XX },
-  { "movapX",          EX, XM, XX },
-  { PREGRP2 },
-  { "movntpX",         Ev, XM, XX },
-  { PREGRP4 },
-  { PREGRP3 },
-  { "ucomisX",         XM,EX, XX },
-  { "comisX",          XM,EX, XX },
-  /* 30 */
-  { "wrmsr",           XX, XX, XX },
-  { "rdtsc",           XX, XX, XX },
-  { "rdmsr",           XX, XX, XX },
-  { "rdpmc",           XX, XX, XX },
-  { "sysenter",                XX, XX, XX },
-  { "sysexit",         XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  /* 38 */
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  /* 40 */
-  { "cmovo",           Gv, Ev, XX },
-  { "cmovno",          Gv, Ev, XX },
-  { "cmovb",           Gv, Ev, XX },
-  { "cmovae",          Gv, Ev, XX },
-  { "cmove",           Gv, Ev, XX },
-  { "cmovne",          Gv, Ev, XX },
-  { "cmovbe",          Gv, Ev, XX },
-  { "cmova",           Gv, Ev, XX },
-  /* 48 */
-  { "cmovs",           Gv, Ev, XX },
-  { "cmovns",          Gv, Ev, XX },
-  { "cmovp",           Gv, Ev, XX },
-  { "cmovnp",          Gv, Ev, XX },
-  { "cmovl",           Gv, Ev, XX },
-  { "cmovge",          Gv, Ev, XX },
-  { "cmovle",          Gv, Ev, XX },
-  { "cmovg",           Gv, Ev, XX },
-  /* 50 */
-  { "movmskpX",                Gd, XS, XX },
-  { PREGRP13 },
-  { PREGRP12 },
-  { PREGRP11 },
-  { "andpX",           XM, EX, XX },
-  { "andnpX",          XM, EX, XX },
-  { "orpX",            XM, EX, XX },
-  { "xorpX",           XM, EX, XX },
-  /* 58 */
-  { PREGRP0 },
-  { PREGRP10 },
-  { PREGRP17 },
-  { PREGRP16 },
-  { PREGRP14 },
-  { PREGRP7 },
-  { PREGRP5 },
-  { PREGRP6 },
-  /* 60 */
-  { "punpcklbw",       MX, EM, XX },
-  { "punpcklwd",       MX, EM, XX },
-  { "punpckldq",       MX, EM, XX },
-  { "packsswb",                MX, EM, XX },
-  { "pcmpgtb",         MX, EM, XX },
-  { "pcmpgtw",         MX, EM, XX },
-  { "pcmpgtd",         MX, EM, XX },
-  { "packuswb",                MX, EM, XX },
-  /* 68 */
-  { "punpckhbw",       MX, EM, XX },
-  { "punpckhwd",       MX, EM, XX },
-  { "punpckhdq",       MX, EM, XX },
-  { "packssdw",                MX, EM, XX },
-  { PREGRP26 },
-  { PREGRP24 },
-  { "movd",            MX, Ed, XX },
-  { PREGRP19 },
-  /* 70 */
-  { PREGRP22 },
-  { GRP10 },
-  { GRP11 },
-  { GRP12 },
-  { "pcmpeqb",         MX, EM, XX },
-  { "pcmpeqw",         MX, EM, XX },
-  { "pcmpeqd",         MX, EM, XX },
-  { "emms",            XX, XX, XX },
-  /* 78 */
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { PREGRP23 },
-  { PREGRP20 },
-  /* 80 */
-  { "joH",             Jv, XX, cond_jump_flag },
-  { "jnoH",            Jv, XX, cond_jump_flag },
-  { "jbH",             Jv, XX, cond_jump_flag },
-  { "jaeH",            Jv, XX, cond_jump_flag },
-  { "jeH",             Jv, XX, cond_jump_flag },
-  { "jneH",            Jv, XX, cond_jump_flag },
-  { "jbeH",            Jv, XX, cond_jump_flag },
-  { "jaH",             Jv, XX, cond_jump_flag },
-  /* 88 */
-  { "jsH",             Jv, XX, cond_jump_flag },
-  { "jnsH",            Jv, XX, cond_jump_flag },
-  { "jpH",             Jv, XX, cond_jump_flag },
-  { "jnpH",            Jv, XX, cond_jump_flag },
-  { "jlH",             Jv, XX, cond_jump_flag },
-  { "jgeH",            Jv, XX, cond_jump_flag },
-  { "jleH",            Jv, XX, cond_jump_flag },
-  { "jgH",             Jv, XX, cond_jump_flag },
-  /* 90 */
-  { "seto",            Eb, XX, XX },
-  { "setno",           Eb, XX, XX },
-  { "setb",            Eb, XX, XX },
-  { "setae",           Eb, XX, XX },
-  { "sete",            Eb, XX, XX },
-  { "setne",           Eb, XX, XX },
-  { "setbe",           Eb, XX, XX },
-  { "seta",            Eb, XX, XX },
-  /* 98 */
-  { "sets",            Eb, XX, XX },
-  { "setns",           Eb, XX, XX },
-  { "setp",            Eb, XX, XX },
-  { "setnp",           Eb, XX, XX },
-  { "setl",            Eb, XX, XX },
-  { "setge",           Eb, XX, XX },
-  { "setle",           Eb, XX, XX },
-  { "setg",            Eb, XX, XX },
-  /* a0 */
-  { "pushT",           fs, XX, XX },
-  { "popT",            fs, XX, XX },
-  { "cpuid",           XX, XX, XX },
-  { "btS",             Ev, Gv, XX },
-  { "shldS",           Ev, Gv, Ib },
-  { "shldS",           Ev, Gv, CL },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  /* a8 */
-  { "pushT",           gs, XX, XX },
-  { "popT",            gs, XX, XX },
-  { "rsm",             XX, XX, XX },
-  { "btsS",            Ev, Gv, XX },
-  { "shrdS",           Ev, Gv, Ib },
-  { "shrdS",           Ev, Gv, CL },
-  { GRP13 },
-  { "imulS",           Gv, Ev, XX },
-  /* b0 */
-  { "cmpxchgB",                Eb, Gb, XX },
-  { "cmpxchgS",                Ev, Gv, XX },
-  { "lssS",            Gv, Mp, XX },
-  { "btrS",            Ev, Gv, XX },
-  { "lfsS",            Gv, Mp, XX },
-  { "lgsS",            Gv, Mp, XX },
-  { "movz{bR|x|bR|x}", Gv, Eb, XX },
-  { "movz{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movzww ! */
-  /* b8 */
-  { "(bad)",           XX, XX, XX },
-  { "ud2b",            XX, XX, XX },
-  { GRP8 },
-  { "btcS",            Ev, Gv, XX },
-  { "bsfS",            Gv, Ev, XX },
-  { "bsrS",            Gv, Ev, XX },
-  { "movs{bR|x|bR|x}", Gv, Eb, XX },
-  { "movs{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movsww ! */
-  /* c0 */
-  { "xaddB",           Eb, Gb, XX },
-  { "xaddS",           Ev, Gv, XX },
-  { PREGRP1 },
-  { "movntiS",         Ev, Gv, XX },
-  { "pinsrw",          MX, Ed, Ib },
-  { "pextrw",          Gd, MS, Ib },
-  { "shufpX",          XM, EX, Ib },
-  { GRP9 },
-  /* c8 */
-  { "bswap",           RMeAX, XX, XX },
-  { "bswap",           RMeCX, XX, XX },
-  { "bswap",           RMeDX, XX, XX },
-  { "bswap",           RMeBX, XX, XX },
-  { "bswap",           RMeSP, XX, XX },
-  { "bswap",           RMeBP, XX, XX },
-  { "bswap",           RMeSI, XX, XX },
-  { "bswap",           RMeDI, XX, XX },
-  /* d0 */
-  { "(bad)",           XX, XX, XX },
-  { "psrlw",           MX, EM, XX },
-  { "psrld",           MX, EM, XX },
-  { "psrlq",           MX, EM, XX },
-  { "paddq",           MX, EM, XX },
-  { "pmullw",          MX, EM, XX },
-  { PREGRP21 },
-  { "pmovmskb",                Gd, MS, XX },
-  /* d8 */
-  { "psubusb",         MX, EM, XX },
-  { "psubusw",         MX, EM, XX },
-  { "pminub",          MX, EM, XX },
-  { "pand",            MX, EM, XX },
-  { "paddusb",         MX, EM, XX },
-  { "paddusw",         MX, EM, XX },
-  { "pmaxub",          MX, EM, XX },
-  { "pandn",           MX, EM, XX },
-  /* e0 */
-  { "pavgb",           MX, EM, XX },
-  { "psraw",           MX, EM, XX },
-  { "psrad",           MX, EM, XX },
-  { "pavgw",           MX, EM, XX },
-  { "pmulhuw",         MX, EM, XX },
-  { "pmulhw",          MX, EM, XX },
-  { PREGRP15 },
-  { PREGRP25 },
-  /* e8 */
-  { "psubsb",          MX, EM, XX },
-  { "psubsw",          MX, EM, XX },
-  { "pminsw",          MX, EM, XX },
-  { "por",             MX, EM, XX },
-  { "paddsb",          MX, EM, XX },
-  { "paddsw",          MX, EM, XX },
-  { "pmaxsw",          MX, EM, XX },
-  { "pxor",            MX, EM, XX },
-  /* f0 */
-  { "(bad)",           XX, XX, XX },
-  { "psllw",           MX, EM, XX },
-  { "pslld",           MX, EM, XX },
-  { "psllq",           MX, EM, XX },
-  { "pmuludq",         MX, EM, XX },
-  { "pmaddwd",         MX, EM, XX },
-  { "psadbw",          MX, EM, XX },
-  { PREGRP18 },
-  /* f8 */
-  { "psubb",           MX, EM, XX },
-  { "psubw",           MX, EM, XX },
-  { "psubd",           MX, EM, XX },
-  { "psubq",           MX, EM, XX },
-  { "paddb",           MX, EM, XX },
-  { "paddw",           MX, EM, XX },
-  { "paddd",           MX, EM, XX },
-  { "(bad)",           XX, XX, XX }
-};
-
-static const unsigned char onebyte_has_modrm[256] = {
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-  /*       -------------------------------        */
-  /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
-  /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
-  /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
-  /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
-  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
-  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
-  /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
-  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
-  /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
-  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
-  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
-  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
-  /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
-  /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
-  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
-  /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1  /* f0 */
-  /*       -------------------------------        */
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-};
-
-static const unsigned char twobyte_has_modrm[256] = {
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-  /*       -------------------------------        */
-  /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
-  /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
-  /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
-  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
-  /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
-  /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
-  /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
-  /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
-  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
-  /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
-  /* a0 */ 0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1, /* af */
-  /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
-  /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
-  /* d0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
-  /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
-  /* f0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
-  /*       -------------------------------        */
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-};
-
-static const unsigned char twobyte_uses_SSE_prefix[256] = {
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-  /*       -------------------------------        */
-  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
-  /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
-  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
-  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
-  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
-  /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
-  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
-  /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
-  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
-  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
-  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
-  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
-  /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
-  /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
-  /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
-  /* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0  /* ff */
-  /*       -------------------------------        */
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-};
-
-static char obuf[100];
-static char *obufp;
-static char scratchbuf[100];
-static unsigned char *start_codep;
-static unsigned char *insn_codep;
-static unsigned char *codep;
-static disassemble_info *the_info;
-static int mod;
-static int rm;
-static int reg;
-static unsigned char need_modrm;
-
-/* If we are accessing mod/rm/reg without need_modrm set, then the
-   values are stale.  Hitting this abort likely indicates that you
-   need to update onebyte_has_modrm or twobyte_has_modrm.  */
-#define MODRM_CHECK  if (!need_modrm) abort ()
-
-static const char **names64;
-static const char **names32;
-static const char **names16;
-static const char **names8;
-static const char **names8rex;
-static const char **names_seg;
-static const char **index16;
-
-static const char *intel_names64[] = {
-  "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
-  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
-};
-static const char *intel_names32[] = {
-  "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
-  "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
-};
-static const char *intel_names16[] = {
-  "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
-  "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
-};
-static const char *intel_names8[] = {
-  "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
-};
-static const char *intel_names8rex[] = {
-  "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
-  "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
-};
-static const char *intel_names_seg[] = {
-  "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
-};
-static const char *intel_index16[] = {
-  "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
-};
-
-static const char *att_names64[] = {
-  "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
-  "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
-};
-static const char *att_names32[] = {
-  "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
-  "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
-};
-static const char *att_names16[] = {
-  "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
-  "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
-};
-static const char *att_names8[] = {
-  "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
-};
-static const char *att_names8rex[] = {
-  "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
-  "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
-};
-static const char *att_names_seg[] = {
-  "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
-};
-static const char *att_index16[] = {
-  "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
-};
-
-static const struct dis386 grps[][8] = {
-  /* GRP1b */
-  {
-    { "addA",  Eb, Ib, XX },
-    { "orA",   Eb, Ib, XX },
-    { "adcA",  Eb, Ib, XX },
-    { "sbbA",  Eb, Ib, XX },
-    { "andA",  Eb, Ib, XX },
-    { "subA",  Eb, Ib, XX },
-    { "xorA",  Eb, Ib, XX },
-    { "cmpA",  Eb, Ib, XX }
-  },
-  /* GRP1S */
-  {
-    { "addQ",  Ev, Iv, XX },
-    { "orQ",   Ev, Iv, XX },
-    { "adcQ",  Ev, Iv, XX },
-    { "sbbQ",  Ev, Iv, XX },
-    { "andQ",  Ev, Iv, XX },
-    { "subQ",  Ev, Iv, XX },
-    { "xorQ",  Ev, Iv, XX },
-    { "cmpQ",  Ev, Iv, XX }
-  },
-  /* GRP1Ss */
-  {
-    { "addQ",  Ev, sIb, XX },
-    { "orQ",   Ev, sIb, XX },
-    { "adcQ",  Ev, sIb, XX },
-    { "sbbQ",  Ev, sIb, XX },
-    { "andQ",  Ev, sIb, XX },
-    { "subQ",  Ev, sIb, XX },
-    { "xorQ",  Ev, sIb, XX },
-    { "cmpQ",  Ev, sIb, XX }
-  },
-  /* GRP2b */
-  {
-    { "rolA",  Eb, Ib, XX },
-    { "rorA",  Eb, Ib, XX },
-    { "rclA",  Eb, Ib, XX },
-    { "rcrA",  Eb, Ib, XX },
-    { "shlA",  Eb, Ib, XX },
-    { "shrA",  Eb, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarA",  Eb, Ib, XX },
-  },
-  /* GRP2S */
-  {
-    { "rolQ",  Ev, Ib, XX },
-    { "rorQ",  Ev, Ib, XX },
-    { "rclQ",  Ev, Ib, XX },
-    { "rcrQ",  Ev, Ib, XX },
-    { "shlQ",  Ev, Ib, XX },
-    { "shrQ",  Ev, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarQ",  Ev, Ib, XX },
-  },
-  /* GRP2b_one */
-  {
-    { "rolA",  Eb, XX, XX },
-    { "rorA",  Eb, XX, XX },
-    { "rclA",  Eb, XX, XX },
-    { "rcrA",  Eb, XX, XX },
-    { "shlA",  Eb, XX, XX },
-    { "shrA",  Eb, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarA",  Eb, XX, XX },
-  },
-  /* GRP2S_one */
-  {
-    { "rolQ",  Ev, XX, XX },
-    { "rorQ",  Ev, XX, XX },
-    { "rclQ",  Ev, XX, XX },
-    { "rcrQ",  Ev, XX, XX },
-    { "shlQ",  Ev, XX, XX },
-    { "shrQ",  Ev, XX, XX },
-    { "(bad)", XX, XX, XX},
-    { "sarQ",  Ev, XX, XX },
-  },
-  /* GRP2b_cl */
-  {
-    { "rolA",  Eb, CL, XX },
-    { "rorA",  Eb, CL, XX },
-    { "rclA",  Eb, CL, XX },
-    { "rcrA",  Eb, CL, XX },
-    { "shlA",  Eb, CL, XX },
-    { "shrA",  Eb, CL, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarA",  Eb, CL, XX },
-  },
-  /* GRP2S_cl */
-  {
-    { "rolQ",  Ev, CL, XX },
-    { "rorQ",  Ev, CL, XX },
-    { "rclQ",  Ev, CL, XX },
-    { "rcrQ",  Ev, CL, XX },
-    { "shlQ",  Ev, CL, XX },
-    { "shrQ",  Ev, CL, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarQ",  Ev, CL, XX }
-  },
-  /* GRP3b */
-  {
-    { "testA", Eb, Ib, XX },
-    { "(bad)", Eb, XX, XX },
-    { "notA",  Eb, XX, XX },
-    { "negA",  Eb, XX, XX },
-    { "mulA",  Eb, XX, XX },   /* Don't print the implicit %al register,  */
-    { "imulA", Eb, XX, XX },   /* to distinguish these opcodes from other */
-    { "divA",  Eb, XX, XX },   /* mul/imul opcodes.  Do the same for div  */
-    { "idivA", Eb, XX, XX }    /* and idiv for consistency.               */
-  },
-  /* GRP3S */
-  {
-    { "testQ", Ev, Iv, XX },
-    { "(bad)", XX, XX, XX },
-    { "notQ",  Ev, XX, XX },
-    { "negQ",  Ev, XX, XX },
-    { "mulQ",  Ev, XX, XX },   /* Don't print the implicit register.  */
-    { "imulQ", Ev, XX, XX },
-    { "divQ",  Ev, XX, XX },
-    { "idivQ", Ev, XX, XX },
-  },
-  /* GRP4 */
-  {
-    { "incA",  Eb, XX, XX },
-    { "decA",  Eb, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP5 */
-  {
-    { "incQ",  Ev, XX, XX },
-    { "decQ",  Ev, XX, XX },
-    { "callT", indirEv, XX, XX },
-    { "lcallT",        indirEv, XX, XX },
-    { "jmpT",  indirEv, XX, XX },
-    { "ljmpT", indirEv, XX, XX },
-    { "pushU", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP6 */
-  {
-    { "sldtQ", Ev, XX, XX },
-    { "strQ",  Ev, XX, XX },
-    { "lldt",  Ew, XX, XX },
-    { "ltr",   Ew, XX, XX },
-    { "verr",  Ew, XX, XX },
-    { "verw",  Ew, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX }
-  },
-  /* GRP7 */
-  {
-    { "sgdtQ",  M, XX, XX },
-    { "sidtQ",  M, XX, XX },
-    { "lgdtQ",  M, XX, XX },
-    { "lidtQ",  M, XX, XX },
-    { "smswQ", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "lmsw",  Ew, XX, XX },
-    { "invlpg",        Ew, XX, XX },
-  },
-  /* GRP8 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "btQ",   Ev, Ib, XX },
-    { "btsQ",  Ev, Ib, XX },
-    { "btrQ",  Ev, Ib, XX },
-    { "btcQ",  Ev, Ib, XX },
-  },
-  /* GRP9 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "cmpxchg8b", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP10 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "psrlw", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "psraw", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "psllw", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP11 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "psrld", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "psrad", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "pslld", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP12 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "psrlq", MS, Ib, XX },
-    { "psrldq",        MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "psllq", MS, Ib, XX },
-    { "pslldq",        MS, Ib, XX },
-  },
-  /* GRP13 */
-  {
-    { "fxsave", Ev, XX, XX },
-    { "fxrstor", Ev, XX, XX },
-    { "ldmxcsr", Ev, XX, XX },
-    { "stmxcsr", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "lfence", None, XX, XX },
-    { "mfence", None, XX, XX },
-    { "sfence", None, XX, XX },
-    /* FIXME: the sfence with memory operand is clflush!  */
-  },
-  /* GRP14 */
-  {
-    { "prefetchnta", Ev, XX, XX },
-    { "prefetcht0", Ev, XX, XX },
-    { "prefetcht1", Ev, XX, XX },
-    { "prefetcht2", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRPAMD */
-  {
-    { "prefetch", Eb, XX, XX },
-    { "prefetchw", Eb, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  }
-};
-
-static const struct dis386 prefix_user_table[][4] = {
-  /* PREGRP0 */
-  {
-    { "addps", XM, EX, XX },
-    { "addss", XM, EX, XX },
-    { "addpd", XM, EX, XX },
-    { "addsd", XM, EX, XX },
-  },
-  /* PREGRP1 */
-  {
-    { "", XM, EX, OPSIMD },    /* See OP_SIMD_SUFFIX.  */
-    { "", XM, EX, OPSIMD },
-    { "", XM, EX, OPSIMD },
-    { "", XM, EX, OPSIMD },
-  },
-  /* PREGRP2 */
-  {
-    { "cvtpi2ps", XM, EM, XX },
-    { "cvtsi2ssY", XM, Ev, XX },
-    { "cvtpi2pd", XM, EM, XX },
-    { "cvtsi2sdY", XM, Ev, XX },
-  },
-  /* PREGRP3 */
-  {
-    { "cvtps2pi", MX, EX, XX },
-    { "cvtss2siY", Gv, EX, XX },
-    { "cvtpd2pi", MX, EX, XX },
-    { "cvtsd2siY", Gv, EX, XX },
-  },
-  /* PREGRP4 */
-  {
-    { "cvttps2pi", MX, EX, XX },
-    { "cvttss2siY", Gv, EX, XX },
-    { "cvttpd2pi", MX, EX, XX },
-    { "cvttsd2siY", Gv, EX, XX },
-  },
-  /* PREGRP5 */
-  {
-    { "divps", XM, EX, XX },
-    { "divss", XM, EX, XX },
-    { "divpd", XM, EX, XX },
-    { "divsd", XM, EX, XX },
-  },
-  /* PREGRP6 */
-  {
-    { "maxps", XM, EX, XX },
-    { "maxss", XM, EX, XX },
-    { "maxpd", XM, EX, XX },
-    { "maxsd", XM, EX, XX },
-  },
-  /* PREGRP7 */
-  {
-    { "minps", XM, EX, XX },
-    { "minss", XM, EX, XX },
-    { "minpd", XM, EX, XX },
-    { "minsd", XM, EX, XX },
-  },
-  /* PREGRP8 */
-  {
-    { "movups", XM, EX, XX },
-    { "movss", XM, EX, XX },
-    { "movupd", XM, EX, XX },
-    { "movsd", XM, EX, XX },
-  },
-  /* PREGRP9 */
-  {
-    { "movups", EX, XM, XX },
-    { "movss", EX, XM, XX },
-    { "movupd", EX, XM, XX },
-    { "movsd", EX, XM, XX },
-  },
-  /* PREGRP10 */
-  {
-    { "mulps", XM, EX, XX },
-    { "mulss", XM, EX, XX },
-    { "mulpd", XM, EX, XX },
-    { "mulsd", XM, EX, XX },
-  },
-  /* PREGRP11 */
-  {
-    { "rcpps", XM, EX, XX },
-    { "rcpss", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP12 */
-  {
-    { "rsqrtps", XM, EX, XX },
-    { "rsqrtss", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP13 */
-  {
-    { "sqrtps", XM, EX, XX },
-    { "sqrtss", XM, EX, XX },
-    { "sqrtpd", XM, EX, XX },
-    { "sqrtsd", XM, EX, XX },
-  },
-  /* PREGRP14 */
-  {
-    { "subps", XM, EX, XX },
-    { "subss", XM, EX, XX },
-    { "subpd", XM, EX, XX },
-    { "subsd", XM, EX, XX },
-  },
-  /* PREGRP15 */
-  {
-    { "(bad)", XM, EX, XX },
-    { "cvtdq2pd", XM, EX, XX },
-    { "cvttpd2dq", XM, EX, XX },
-    { "cvtpd2dq", XM, EX, XX },
-  },
-  /* PREGRP16 */
-  {
-    { "cvtdq2ps", XM, EX, XX },
-    { "cvttps2dq",XM, EX, XX },
-    { "cvtps2dq",XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP17 */
-  {
-    { "cvtps2pd", XM, EX, XX },
-    { "cvtss2sd", XM, EX, XX },
-    { "cvtpd2ps", XM, EX, XX },
-    { "cvtsd2ss", XM, EX, XX },
-  },
-  /* PREGRP18 */
-  {
-    { "maskmovq", MX, MS, XX },
-    { "(bad)", XM, EX, XX },
-    { "maskmovdqu", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP19 */
-  {
-    { "movq", MX, EM, XX },
-    { "movdqu", XM, EX, XX },
-    { "movdqa", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP20 */
-  {
-    { "movq", EM, MX, XX },
-    { "movdqu", EX, XM, XX },
-    { "movdqa", EX, XM, XX },
-    { "(bad)", EX, XM, XX },
-  },
-  /* PREGRP21 */
-  {
-    { "(bad)", EX, XM, XX },
-    { "movq2dq", XM, MS, XX },
-    { "movq", EX, XM, XX },
-    { "movdq2q", MX, XS, XX },
-  },
-  /* PREGRP22 */
-  {
-    { "pshufw", MX, EM, Ib },
-    { "pshufhw", XM, EX, Ib },
-    { "pshufd", XM, EX, Ib },
-    { "pshuflw", XM, EX, Ib },
-  },
-  /* PREGRP23 */
-  {
-    { "movd", Ed, MX, XX },
-    { "movq", XM, EX, XX },
-    { "movd", Ed, XM, XX },
-    { "(bad)", Ed, XM, XX },
-  },
-  /* PREGRP24 */
-  {
-    { "(bad)", MX, EX, XX },
-    { "(bad)", XM, EX, XX },
-    { "punpckhqdq", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP25 */
-  {
-  { "movntq", Ev, MX, XX },
-  { "(bad)", Ev, XM, XX },
-  { "movntdq", Ev, XM, XX },
-  { "(bad)", Ev, XM, XX },
-  },
-  /* PREGRP26 */
-  {
-    { "(bad)", MX, EX, XX },
-    { "(bad)", XM, EX, XX },
-    { "punpcklqdq", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-};
-
-static const struct dis386 x86_64_table[][2] = {
-  {
-    { "arpl", Ew, Gw, XX },
-    { "movs{||lq|xd}", Gv, Ed, XX },
-  },
-};
-
-#define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
-
-static void
-ckprefix ()
-{
-  int newrex;
-  rex = 0;
-  prefixes = 0;
-  used_prefixes = 0;
-  rex_used = 0;
-  while (1)
-    {
-      FETCH_DATA (the_info, codep + 1);
-      newrex = 0;
-      switch (*codep)
-       {
-       /* REX prefixes family.  */
-       case 0x40:
-       case 0x41:
-       case 0x42:
-       case 0x43:
-       case 0x44:
-       case 0x45:
-       case 0x46:
-       case 0x47:
-       case 0x48:
-       case 0x49:
-       case 0x4a:
-       case 0x4b:
-       case 0x4c:
-       case 0x4d:
-       case 0x4e:
-       case 0x4f:
-           if (mode_64bit)
-             newrex = *codep;
-           else
-             return;
-         break;
-       case 0xf3:
-         prefixes |= PREFIX_REPZ;
-         break;
-       case 0xf2:
-         prefixes |= PREFIX_REPNZ;
-         break;
-       case 0xf0:
-         prefixes |= PREFIX_LOCK;
-         break;
-       case 0x2e:
-         prefixes |= PREFIX_CS;
-         break;
-       case 0x36:
-         prefixes |= PREFIX_SS;
-         break;
-       case 0x3e:
-         prefixes |= PREFIX_DS;
-         break;
-       case 0x26:
-         prefixes |= PREFIX_ES;
-         break;
-       case 0x64:
-         prefixes |= PREFIX_FS;
-         break;
-       case 0x65:
-         prefixes |= PREFIX_GS;
-         break;
-       case 0x66:
-         prefixes |= PREFIX_DATA;
-         break;
-       case 0x67:
-         prefixes |= PREFIX_ADDR;
-         break;
-       case FWAIT_OPCODE:
-         /* fwait is really an instruction.  If there are prefixes
-            before the fwait, they belong to the fwait, *not* to the
-            following instruction.  */
-         if (prefixes)
-           {
-             prefixes |= PREFIX_FWAIT;
-             codep++;
-             return;
-           }
-         prefixes = PREFIX_FWAIT;
-         break;
-       default:
-         return;
-       }
-      /* Rex is ignored when followed by another prefix.  */
-      if (rex)
-       {
-         oappend (prefix_name (rex, 0));
-         oappend (" ");
-       }
-      rex = newrex;
-      codep++;
-    }
-}
-
-/* Return the name of the prefix byte PREF, or NULL if PREF is not a
-   prefix byte.  */
-
-static const char *
-prefix_name (pref, sizeflag)
-     int pref;
-     int sizeflag;
-{
-  switch (pref)
-    {
-    /* REX prefixes family.  */
-    case 0x40:
-      return "rex";
-    case 0x41:
-      return "rexZ";
-    case 0x42:
-      return "rexY";
-    case 0x43:
-      return "rexYZ";
-    case 0x44:
-      return "rexX";
-    case 0x45:
-      return "rexXZ";
-    case 0x46:
-      return "rexXY";
-    case 0x47:
-      return "rexXYZ";
-    case 0x48:
-      return "rex64";
-    case 0x49:
-      return "rex64Z";
-    case 0x4a:
-      return "rex64Y";
-    case 0x4b:
-      return "rex64YZ";
-    case 0x4c:
-      return "rex64X";
-    case 0x4d:
-      return "rex64XZ";
-    case 0x4e:
-      return "rex64XY";
-    case 0x4f:
-      return "rex64XYZ";
-    case 0xf3:
-      return "repz";
-    case 0xf2:
-      return "repnz";
-    case 0xf0:
-      return "lock";
-    case 0x2e:
-      return "cs";
-    case 0x36:
-      return "ss";
-    case 0x3e:
-      return "ds";
-    case 0x26:
-      return "es";
-    case 0x64:
-      return "fs";
-    case 0x65:
-      return "gs";
-    case 0x66:
-      return (sizeflag & DFLAG) ? "data16" : "data32";
-    case 0x67:
-      if (mode_64bit)
-        return (sizeflag & AFLAG) ? "addr32" : "addr64";
-      else
-        return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32";
-    case FWAIT_OPCODE:
-      return "fwait";
-    default:
-      return NULL;
-    }
-}
-
-static char op1out[100], op2out[100], op3out[100];
-static int op_ad, op_index[3];
-static bfd_vma op_address[3];
-static bfd_vma op_riprel[3];
-static bfd_vma start_pc;
-\f
-/*
- *   On the 386's of 1988, the maximum length of an instruction is 15 bytes.
- *   (see topic "Redundant prefixes" in the "Differences from 8086"
- *   section of the "Virtual 8086 Mode" chapter.)
- * 'pc' should be the address of this instruction, it will
- *   be used to print the target address if this is a relative jump or call
- * The function returns the length of this instruction in bytes.
- */
-
-static char intel_syntax;
-static char open_char;
-static char close_char;
-static char separator_char;
-static char scale_char;
-
-/* Here for backwards compatibility.  When gdb stops using
-   print_insn_i386_att and print_insn_i386_intel these functions can
-   disappear, and print_insn_i386 be merged into print_insn.  */
-int
-print_insn_i386_att (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  intel_syntax = 0;
-
-  return print_insn (pc, info);
-}
-
-int
-print_insn_i386_intel (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  intel_syntax = 1;
-
-  return print_insn (pc, info);
-}
-
-int
-print_insn_i386 (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  intel_syntax = -1;
-
-  return print_insn (pc, info);
-}
-
-static int
-print_insn (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  const struct dis386 *dp;
-  int i;
-  int two_source_ops;
-  char *first, *second, *third;
-  int needcomma;
-  unsigned char uses_SSE_prefix;
-  int sizeflag;
-  const char *p;
-  struct dis_private priv;
-
-  mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
-               || info->mach == bfd_mach_x86_64);
-
-  if (intel_syntax == -1)
-    intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
-                   || info->mach == bfd_mach_x86_64_intel_syntax);
-
-  if (info->mach == bfd_mach_i386_i386
-      || info->mach == bfd_mach_x86_64
-      || info->mach == bfd_mach_i386_i386_intel_syntax
-      || info->mach == bfd_mach_x86_64_intel_syntax)
-    priv.orig_sizeflag = AFLAG | DFLAG;
-  else if (info->mach == bfd_mach_i386_i8086)
-    priv.orig_sizeflag = 0;
-  else
-    abort ();
-
-  for (p = info->disassembler_options; p != NULL; )
-    {
-      if (strncmp (p, "x86-64", 6) == 0)
-       {
-         mode_64bit = 1;
-         priv.orig_sizeflag = AFLAG | DFLAG;
-       }
-      else if (strncmp (p, "i386", 4) == 0)
-       {
-         mode_64bit = 0;
-         priv.orig_sizeflag = AFLAG | DFLAG;
-       }
-      else if (strncmp (p, "i8086", 5) == 0)
-       {
-         mode_64bit = 0;
-         priv.orig_sizeflag = 0;
-       }
-      else if (strncmp (p, "intel", 5) == 0)
-       {
-         intel_syntax = 1;
-       }
-      else if (strncmp (p, "att", 3) == 0)
-       {
-         intel_syntax = 0;
-       }
-      else if (strncmp (p, "addr", 4) == 0)
-       {
-         if (p[4] == '1' && p[5] == '6')
-           priv.orig_sizeflag &= ~AFLAG;
-         else if (p[4] == '3' && p[5] == '2')
-           priv.orig_sizeflag |= AFLAG;
-       }
-      else if (strncmp (p, "data", 4) == 0)
-       {
-         if (p[4] == '1' && p[5] == '6')
-           priv.orig_sizeflag &= ~DFLAG;
-         else if (p[4] == '3' && p[5] == '2')
-           priv.orig_sizeflag |= DFLAG;
-       }
-      else if (strncmp (p, "suffix", 6) == 0)
-       priv.orig_sizeflag |= SUFFIX_ALWAYS;
-
-      p = strchr (p, ',');
-      if (p != NULL)
-       p++;
-    }
-
-  if (intel_syntax)
-    {
-      names64 = intel_names64;
-      names32 = intel_names32;
-      names16 = intel_names16;
-      names8 = intel_names8;
-      names8rex = intel_names8rex;
-      names_seg = intel_names_seg;
-      index16 = intel_index16;
-      open_char = '[';
-      close_char = ']';
-      separator_char = '+';
-      scale_char = '*';
-    }
-  else
-    {
-      names64 = att_names64;
-      names32 = att_names32;
-      names16 = att_names16;
-      names8 = att_names8;
-      names8rex = att_names8rex;
-      names_seg = att_names_seg;
-      index16 = att_index16;
-      open_char = '(';
-      close_char =  ')';
-      separator_char = ',';
-      scale_char = ',';
-    }
-
-  /* The output looks better if we put 7 bytes on a line, since that
-     puts most long word instructions on a single line.  */
-  info->bytes_per_line = 7;
-
-  info->private_data = (PTR) &priv;
-  priv.max_fetched = priv.the_buffer;
-  priv.insn_start = pc;
-
-  obuf[0] = 0;
-  op1out[0] = 0;
-  op2out[0] = 0;
-  op3out[0] = 0;
-
-  op_index[0] = op_index[1] = op_index[2] = -1;
-
-  the_info = info;
-  start_pc = pc;
-  start_codep = priv.the_buffer;
-  codep = priv.the_buffer;
-
-  if (setjmp (priv.bailout) != 0)
-    {
-      const char *name;
-
-      /* Getting here means we tried for data but didn't get it.  That
-        means we have an incomplete instruction of some sort.  Just
-        print the first byte as a prefix or a .byte pseudo-op.  */
-      if (codep > priv.the_buffer)
-       {
-         name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
-         if (name != NULL)
-           (*info->fprintf_func) (info->stream, "%s", name);
-         else
-           {
-             /* Just print the first byte as a .byte instruction.  */
-             (*info->fprintf_func) (info->stream, ".byte 0x%x",
-                                    (unsigned int) priv.the_buffer[0]);
-           }
-
-         return 1;
-       }
-
-      return -1;
-    }
-
-  obufp = obuf;
-  ckprefix ();
-
-  insn_codep = codep;
-  sizeflag = priv.orig_sizeflag;
-
-  FETCH_DATA (info, codep + 1);
-  two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
-
-  if ((prefixes & PREFIX_FWAIT)
-      && ((*codep < 0xd8) || (*codep > 0xdf)))
-    {
-      const char *name;
-
-      /* fwait not followed by floating point instruction.  Print the
-         first prefix, which is probably fwait itself.  */
-      name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
-      if (name == NULL)
-       name = INTERNAL_DISASSEMBLER_ERROR;
-      (*info->fprintf_func) (info->stream, "%s", name);
-      return 1;
-    }
-
-  if (*codep == 0x0f)
-    {
-      FETCH_DATA (info, codep + 2);
-      dp = &dis386_twobyte[*++codep];
-      need_modrm = twobyte_has_modrm[*codep];
-      uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep];
-    }
-  else
-    {
-      dp = &dis386[*codep];
-      need_modrm = onebyte_has_modrm[*codep];
-      uses_SSE_prefix = 0;
-    }
-  codep++;
-
-  if (!uses_SSE_prefix && (prefixes & PREFIX_REPZ))
-    {
-      oappend ("repz ");
-      used_prefixes |= PREFIX_REPZ;
-    }
-  if (!uses_SSE_prefix && (prefixes & PREFIX_REPNZ))
-    {
-      oappend ("repnz ");
-      used_prefixes |= PREFIX_REPNZ;
-    }
-  if (prefixes & PREFIX_LOCK)
-    {
-      oappend ("lock ");
-      used_prefixes |= PREFIX_LOCK;
-    }
-
-  if (prefixes & PREFIX_ADDR)
-    {
-      sizeflag ^= AFLAG;
-      if (dp->bytemode3 != loop_jcxz_mode || intel_syntax)
-       {
-         if ((sizeflag & AFLAG) || mode_64bit)
-           oappend ("addr32 ");
-         else
-           oappend ("addr16 ");
-         used_prefixes |= PREFIX_ADDR;
-       }
-    }
-
-  if (!uses_SSE_prefix && (prefixes & PREFIX_DATA))
-    {
-      sizeflag ^= DFLAG;
-      if (dp->bytemode3 == cond_jump_mode
-         && dp->bytemode1 == v_mode
-         && !intel_syntax)
-       {
-         if (sizeflag & DFLAG)
-           oappend ("data32 ");
-         else
-           oappend ("data16 ");
-         used_prefixes |= PREFIX_DATA;
-       }
-    }
-
-  if (need_modrm)
-    {
-      FETCH_DATA (info, codep + 1);
-      mod = (*codep >> 6) & 3;
-      reg = (*codep >> 3) & 7;
-      rm = *codep & 7;
-    }
-
-  if (dp->name == NULL && dp->bytemode1 == FLOATCODE)
-    {
-      dofloat (sizeflag);
-    }
-  else
-    {
-      int index;
-      if (dp->name == NULL)
-       {
-         switch (dp->bytemode1)
-           {
-           case USE_GROUPS:
-             dp = &grps[dp->bytemode2][reg];
-             break;
-
-           case USE_PREFIX_USER_TABLE:
-             index = 0;
-             used_prefixes |= (prefixes & PREFIX_REPZ);
-             if (prefixes & PREFIX_REPZ)
-               index = 1;
-             else
-               {
-                 used_prefixes |= (prefixes & PREFIX_DATA);
-                 if (prefixes & PREFIX_DATA)
-                   index = 2;
-                 else
-                   {
-                     used_prefixes |= (prefixes & PREFIX_REPNZ);
-                     if (prefixes & PREFIX_REPNZ)
-                       index = 3;
-                   }
-               }
-             dp = &prefix_user_table[dp->bytemode2][index];
-             break;
-
-           case X86_64_SPECIAL:
-             dp = &x86_64_table[dp->bytemode2][mode_64bit];
-             break;
-
-           default:
-             oappend (INTERNAL_DISASSEMBLER_ERROR);
-             break;
-           }
-       }
-
-      if (putop (dp->name, sizeflag) == 0)
-       {
-         obufp = op1out;
-         op_ad = 2;
-         if (dp->op1)
-           (*dp->op1) (dp->bytemode1, sizeflag);
-
-         obufp = op2out;
-         op_ad = 1;
-         if (dp->op2)
-           (*dp->op2) (dp->bytemode2, sizeflag);
-
-         obufp = op3out;
-         op_ad = 0;
-         if (dp->op3)
-           (*dp->op3) (dp->bytemode3, sizeflag);
-       }
-    }
-
-  /* See if any prefixes were not used.  If so, print the first one
-     separately.  If we don't do this, we'll wind up printing an
-     instruction stream which does not precisely correspond to the
-     bytes we are disassembling.  */
-  if ((prefixes & ~used_prefixes) != 0)
-    {
-      const char *name;
-
-      name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
-      if (name == NULL)
-       name = INTERNAL_DISASSEMBLER_ERROR;
-      (*info->fprintf_func) (info->stream, "%s", name);
-      return 1;
-    }
-  if (rex & ~rex_used)
-    {
-      const char *name;
-      name = prefix_name (rex | 0x40, priv.orig_sizeflag);
-      if (name == NULL)
-       name = INTERNAL_DISASSEMBLER_ERROR;
-      (*info->fprintf_func) (info->stream, "%s ", name);
-    }
-
-  obufp = obuf + strlen (obuf);
-  for (i = strlen (obuf); i < 6; i++)
-    oappend (" ");
-  oappend (" ");
-  (*info->fprintf_func) (info->stream, "%s", obuf);
-
-  /* The enter and bound instructions are printed with operands in the same
-     order as the intel book; everything else is printed in reverse order.  */
-  if (intel_syntax || two_source_ops)
-    {
-      first = op1out;
-      second = op2out;
-      third = op3out;
-      op_ad = op_index[0];
-      op_index[0] = op_index[2];
-      op_index[2] = op_ad;
-    }
-  else
-    {
-      first = op3out;
-      second = op2out;
-      third = op1out;
-    }
-  needcomma = 0;
-  if (*first)
-    {
-      if (op_index[0] != -1 && !op_riprel[0])
-       (*info->print_address_func) ((bfd_vma) op_address[op_index[0]], info);
-      else
-       (*info->fprintf_func) (info->stream, "%s", first);
-      needcomma = 1;
-    }
-  if (*second)
-    {
-      if (needcomma)
-       (*info->fprintf_func) (info->stream, ",");
-      if (op_index[1] != -1 && !op_riprel[1])
-       (*info->print_address_func) ((bfd_vma) op_address[op_index[1]], info);
-      else
-       (*info->fprintf_func) (info->stream, "%s", second);
-      needcomma = 1;
-    }
-  if (*third)
-    {
-      if (needcomma)
-       (*info->fprintf_func) (info->stream, ",");
-      if (op_index[2] != -1 && !op_riprel[2])
-       (*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info);
-      else
-       (*info->fprintf_func) (info->stream, "%s", third);
-    }
-  for (i = 0; i < 3; i++)
-    if (op_index[i] != -1 && op_riprel[i])
-      {
-       (*info->fprintf_func) (info->stream, "        # ");
-       (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
-                                               + op_address[op_index[i]]), info);
-      }
-  return codep - priv.the_buffer;
-}
-
-static const char *float_mem[] = {
-  /* d8 */
-  "fadd{s||s|}",
-  "fmul{s||s|}",
-  "fcom{s||s|}",
-  "fcomp{s||s|}",
-  "fsub{s||s|}",
-  "fsubr{s||s|}",
-  "fdiv{s||s|}",
-  "fdivr{s||s|}",
-  /*  d9 */
-  "fld{s||s|}",
-  "(bad)",
-  "fst{s||s|}",
-  "fstp{s||s|}",
-  "fldenv",
-  "fldcw",
-  "fNstenv",
-  "fNstcw",
-  /* da */
-  "fiadd{l||l|}",
-  "fimul{l||l|}",
-  "ficom{l||l|}",
-  "ficomp{l||l|}",
-  "fisub{l||l|}",
-  "fisubr{l||l|}",
-  "fidiv{l||l|}",
-  "fidivr{l||l|}",
-  /* db */
-  "fild{l||l|}",
-  "(bad)",
-  "fist{l||l|}",
-  "fistp{l||l|}",
-  "(bad)",
-  "fld{t||t|}",
-  "(bad)",
-  "fstp{t||t|}",
-  /* dc */
-  "fadd{l||l|}",
-  "fmul{l||l|}",
-  "fcom{l||l|}",
-  "fcomp{l||l|}",
-  "fsub{l||l|}",
-  "fsubr{l||l|}",
-  "fdiv{l||l|}",
-  "fdivr{l||l|}",
-  /* dd */
-  "fld{l||l|}",
-  "(bad)",
-  "fst{l||l|}",
-  "fstp{l||l|}",
-  "frstor",
-  "(bad)",
-  "fNsave",
-  "fNstsw",
-  /* de */
-  "fiadd",
-  "fimul",
-  "ficom",
-  "ficomp",
-  "fisub",
-  "fisubr",
-  "fidiv",
-  "fidivr",
-  /* df */
-  "fild",
-  "(bad)",
-  "fist",
-  "fistp",
-  "fbld",
-  "fild{ll||ll|}",
-  "fbstp",
-  "fistpll",
-};
-
-#define ST OP_ST, 0
-#define STi OP_STi, 0
-
-#define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0
-#define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0
-#define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0
-#define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0
-#define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0
-#define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0
-#define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0
-#define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0
-#define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0
-
-static const struct dis386 float_reg[][8] = {
-  /* d8 */
-  {
-    { "fadd",  ST, STi, XX },
-    { "fmul",  ST, STi, XX },
-    { "fcom",  STi, XX, XX },
-    { "fcomp", STi, XX, XX },
-    { "fsub",  ST, STi, XX },
-    { "fsubr", ST, STi, XX },
-    { "fdiv",  ST, STi, XX },
-    { "fdivr", ST, STi, XX },
-  },
-  /* d9 */
-  {
-    { "fld",   STi, XX, XX },
-    { "fxch",  STi, XX, XX },
-    { FGRPd9_2 },
-    { "(bad)", XX, XX, XX },
-    { FGRPd9_4 },
-    { FGRPd9_5 },
-    { FGRPd9_6 },
-    { FGRPd9_7 },
-  },
-  /* da */
-  {
-    { "fcmovb",        ST, STi, XX },
-    { "fcmove",        ST, STi, XX },
-    { "fcmovbe",ST, STi, XX },
-    { "fcmovu",        ST, STi, XX },
-    { "(bad)", XX, XX, XX },
-    { FGRPda_5 },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* db */
-  {
-    { "fcmovnb",ST, STi, XX },
-    { "fcmovne",ST, STi, XX },
-    { "fcmovnbe",ST, STi, XX },
-    { "fcmovnu",ST, STi, XX },
-    { FGRPdb_4 },
-    { "fucomi",        ST, STi, XX },
-    { "fcomi", ST, STi, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* dc */
-  {
-    { "fadd",  STi, ST, XX },
-    { "fmul",  STi, ST, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-#if UNIXWARE_COMPAT
-    { "fsub",  STi, ST, XX },
-    { "fsubr", STi, ST, XX },
-    { "fdiv",  STi, ST, XX },
-    { "fdivr", STi, ST, XX },
-#else
-    { "fsubr", STi, ST, XX },
-    { "fsub",  STi, ST, XX },
-    { "fdivr", STi, ST, XX },
-    { "fdiv",  STi, ST, XX },
-#endif
-  },
-  /* dd */
-  {
-    { "ffree", STi, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "fst",   STi, XX, XX },
-    { "fstp",  STi, XX, XX },
-    { "fucom", STi, XX, XX },
-    { "fucomp",        STi, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* de */
-  {
-    { "faddp", STi, ST, XX },
-    { "fmulp", STi, ST, XX },
-    { "(bad)", XX, XX, XX },
-    { FGRPde_3 },
-#if UNIXWARE_COMPAT
-    { "fsubp", STi, ST, XX },
-    { "fsubrp",        STi, ST, XX },
-    { "fdivp", STi, ST, XX },
-    { "fdivrp",        STi, ST, XX },
-#else
-    { "fsubrp",        STi, ST, XX },
-    { "fsubp", STi, ST, XX },
-    { "fdivrp",        STi, ST, XX },
-    { "fdivp", STi, ST, XX },
-#endif
-  },
-  /* df */
-  {
-    { "ffreep",        STi, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { FGRPdf_4 },
-    { "fucomip",ST, STi, XX },
-    { "fcomip", ST, STi, XX },
-    { "(bad)", XX, XX, XX },
-  },
-};
-
-static char *fgrps[][8] = {
-  /* d9_2  0 */
-  {
-    "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
-  },
-
-  /* d9_4  1 */
-  {
-    "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
-  },
-
-  /* d9_5  2 */
-  {
-    "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
-  },
-
-  /* d9_6  3 */
-  {
-    "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
-  },
-
-  /* d9_7  4 */
-  {
-    "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
-  },
-
-  /* da_5  5 */
-  {
-    "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
-  },
-
-  /* db_4  6 */
-  {
-    "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
-    "fNsetpm(287 only)","(bad)","(bad)","(bad)",
-  },
-
-  /* de_3  7 */
-  {
-    "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
-  },
-
-  /* df_4  8 */
-  {
-    "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
-  },
-};
-
-static void
-dofloat (sizeflag)
-     int sizeflag;
-{
-  const struct dis386 *dp;
-  unsigned char floatop;
-
-  floatop = codep[-1];
-
-  if (mod != 3)
-    {
-      putop (float_mem[(floatop - 0xd8) * 8 + reg], sizeflag);
-      obufp = op1out;
-      if (floatop == 0xdb)
-        OP_E (x_mode, sizeflag);
-      else if (floatop == 0xdd)
-        OP_E (d_mode, sizeflag);
-      else
-        OP_E (v_mode, sizeflag);
-      return;
-    }
-  /* Skip mod/rm byte.  */
-  MODRM_CHECK;
-  codep++;
-
-  dp = &float_reg[floatop - 0xd8][reg];
-  if (dp->name == NULL)
-    {
-      putop (fgrps[dp->bytemode1][rm], sizeflag);
-
-      /* Instruction fnstsw is only one with strange arg.  */
-      if (floatop == 0xdf && codep[-1] == 0xe0)
-       strcpy (op1out, names16[0]);
-    }
-  else
-    {
-      putop (dp->name, sizeflag);
-
-      obufp = op1out;
-      if (dp->op1)
-       (*dp->op1) (dp->bytemode1, sizeflag);
-      obufp = op2out;
-      if (dp->op2)
-       (*dp->op2) (dp->bytemode2, sizeflag);
-    }
-}
-
-static void
-OP_ST (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  oappend ("%st");
-}
-
-static void
-OP_STi (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  sprintf (scratchbuf, "%%st(%d)", rm);
-  oappend (scratchbuf + intel_syntax);
-}
-
-/* Capital letters in template are macros.  */
-static int
-putop (template, sizeflag)
-     const char *template;
-     int sizeflag;
-{
-  const char *p;
-  int alt;
-
-  for (p = template; *p; p++)
-    {
-      switch (*p)
-       {
-       default:
-         *obufp++ = *p;
-         break;
-       case '{':
-         alt = 0;
-         if (intel_syntax)
-           alt += 1;
-         if (mode_64bit)
-           alt += 2;
-         while (alt != 0)
-           {
-             while (*++p != '|')
-               {
-                 if (*p == '}')
-                   {
-                     /* Alternative not valid.  */
-                     strcpy (obuf, "(bad)");
-                     obufp = obuf + 5;
-                     return 1;
-                   }
-                 else if (*p == '\0')
-                   abort ();
-               }
-             alt--;
-           }
-         break;
-       case '|':
-         while (*++p != '}')
-           {
-             if (*p == '\0')
-               abort ();
-           }
-         break;
-       case '}':
-         break;
-       case 'A':
-          if (intel_syntax)
-            break;
-         if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
-           *obufp++ = 'b';
-         break;
-       case 'B':
-          if (intel_syntax)
-            break;
-         if (sizeflag & SUFFIX_ALWAYS)
-           *obufp++ = 'b';
-         break;
-       case 'E':               /* For jcxz/jecxz */
-         if (mode_64bit)
-           {
-             if (sizeflag & AFLAG)
-               *obufp++ = 'r';
-             else
-               *obufp++ = 'e';
-           }
-         else
-           if (sizeflag & AFLAG)
-             *obufp++ = 'e';
-         used_prefixes |= (prefixes & PREFIX_ADDR);
-         break;
-       case 'F':
-          if (intel_syntax)
-            break;
-         if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
-           {
-             if (sizeflag & AFLAG)
-               *obufp++ = mode_64bit ? 'q' : 'l';
-             else
-               *obufp++ = mode_64bit ? 'l' : 'w';
-             used_prefixes |= (prefixes & PREFIX_ADDR);
-           }
-         break;
-       case 'H':
-          if (intel_syntax)
-            break;
-         if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
-             || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
-           {
-             used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS);
-             *obufp++ = ',';
-             *obufp++ = 'p';
-             if (prefixes & PREFIX_DS)
-               *obufp++ = 't';
-             else
-               *obufp++ = 'n';
-           }
-         break;
-       case 'L':
-          if (intel_syntax)
-            break;
-         if (sizeflag & SUFFIX_ALWAYS)
-           *obufp++ = 'l';
-         break;
-       case 'N':
-         if ((prefixes & PREFIX_FWAIT) == 0)
-           *obufp++ = 'n';
-         else
-           used_prefixes |= PREFIX_FWAIT;
-         break;
-       case 'O':
-         USED_REX (REX_MODE64);
-         if (rex & REX_MODE64)
-           *obufp++ = 'o';
-         else
-           *obufp++ = 'd';
-         break;
-       case 'T':
-          if (intel_syntax)
-            break;
-         if (mode_64bit)
-           {
-             *obufp++ = 'q';
-             break;
-           }
-         /* Fall through.  */
-       case 'P':
-          if (intel_syntax)
-            break;
-         if ((prefixes & PREFIX_DATA)
-             || (rex & REX_MODE64)
-             || (sizeflag & SUFFIX_ALWAYS))
-           {
-             USED_REX (REX_MODE64);
-             if (rex & REX_MODE64)
-               *obufp++ = 'q';
-             else
-               {
-                  if (sizeflag & DFLAG)
-                     *obufp++ = 'l';
-                  else
-                    *obufp++ = 'w';
-                  used_prefixes |= (prefixes & PREFIX_DATA);
-               }
-           }
-         break;
-       case 'U':
-          if (intel_syntax)
-            break;
-         if (mode_64bit)
-           {
-             *obufp++ = 'q';
-             break;
-           }
-         /* Fall through.  */
-       case 'Q':
-          if (intel_syntax)
-            break;
-         USED_REX (REX_MODE64);
-         if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
-           {
-             if (rex & REX_MODE64)
-               *obufp++ = 'q';
-             else
-               {
-                 if (sizeflag & DFLAG)
-                   *obufp++ = 'l';
-                 else
-                   *obufp++ = 'w';
-                 used_prefixes |= (prefixes & PREFIX_DATA);
-               }
-           }
-         break;
-       case 'R':
-         USED_REX (REX_MODE64);
-          if (intel_syntax)
-           {
-             if (rex & REX_MODE64)
-               {
-                 *obufp++ = 'q';
-                 *obufp++ = 't';
-               }
-             else if (sizeflag & DFLAG)
-               {
-                 *obufp++ = 'd';
-                 *obufp++ = 'q';
-               }
-             else
-               {
-                 *obufp++ = 'w';
-                 *obufp++ = 'd';
-               }
-           }
-         else
-           {
-             if (rex & REX_MODE64)
-               *obufp++ = 'q';
-             else if (sizeflag & DFLAG)
-               *obufp++ = 'l';
-             else
-               *obufp++ = 'w';
-           }
-         if (!(rex & REX_MODE64))
-           used_prefixes |= (prefixes & PREFIX_DATA);
-         break;
-       case 'S':
-          if (intel_syntax)
-            break;
-         if (sizeflag & SUFFIX_ALWAYS)
-           {
-             if (rex & REX_MODE64)
-               *obufp++ = 'q';
-             else
-               {
-                 if (sizeflag & DFLAG)
-                   *obufp++ = 'l';
-                 else
-                   *obufp++ = 'w';
-                 used_prefixes |= (prefixes & PREFIX_DATA);
-               }
-           }
-         break;
-       case 'X':
-         if (prefixes & PREFIX_DATA)
-           *obufp++ = 'd';
-         else
-           *obufp++ = 's';
-          used_prefixes |= (prefixes & PREFIX_DATA);
-         break;
-       case 'Y':
-          if (intel_syntax)
-            break;
-         if (rex & REX_MODE64)
-           {
-             USED_REX (REX_MODE64);
-             *obufp++ = 'q';
-           }
-         break;
-         /* implicit operand size 'l' for i386 or 'q' for x86-64 */
-       case 'W':
-         /* operand size flag for cwtl, cbtw */
-         USED_REX (0);
-         if (rex)
-           *obufp++ = 'l';
-         else if (sizeflag & DFLAG)
-           *obufp++ = 'w';
-         else
-           *obufp++ = 'b';
-          if (intel_syntax)
-           {
-             if (rex)
-               {
-                 *obufp++ = 'q';
-                 *obufp++ = 'e';
-               }
-             if (sizeflag & DFLAG)
-               {
-                 *obufp++ = 'd';
-                 *obufp++ = 'e';
-               }
-             else
-               {
-                 *obufp++ = 'w';
-               }
-           }
-         if (!rex)
-           used_prefixes |= (prefixes & PREFIX_DATA);
-         break;
-       }
-    }
-  *obufp = 0;
-  return 0;
-}
-
-static void
-oappend (s)
-     const char *s;
-{
-  strcpy (obufp, s);
-  obufp += strlen (s);
-}
-
-static void
-append_seg ()
-{
-  if (prefixes & PREFIX_CS)
-    {
-      used_prefixes |= PREFIX_CS;
-      oappend ("%cs:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_DS)
-    {
-      used_prefixes |= PREFIX_DS;
-      oappend ("%ds:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_SS)
-    {
-      used_prefixes |= PREFIX_SS;
-      oappend ("%ss:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_ES)
-    {
-      used_prefixes |= PREFIX_ES;
-      oappend ("%es:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_FS)
-    {
-      used_prefixes |= PREFIX_FS;
-      oappend ("%fs:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_GS)
-    {
-      used_prefixes |= PREFIX_GS;
-      oappend ("%gs:" + intel_syntax);
-    }
-}
-
-static void
-OP_indirE (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  if (!intel_syntax)
-    oappend ("*");
-  OP_E (bytemode, sizeflag);
-}
-
-static void
-print_operand_value (buf, hex, disp)
-  char *buf;
-  int hex;
-  bfd_vma disp;
-{
-  if (mode_64bit)
-    {
-      if (hex)
-       {
-         char tmp[30];
-         int i;
-         buf[0] = '0';
-         buf[1] = 'x';
-         sprintf_vma (tmp, disp);
-         for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
-         strcpy (buf + 2, tmp + i);
-       }
-      else
-       {
-         bfd_signed_vma v = disp;
-         char tmp[30];
-         int i;
-         if (v < 0)
-           {
-             *(buf++) = '-';
-             v = -disp;
-             /* Check for possible overflow on 0x8000000000000000.  */
-             if (v < 0)
-               {
-                 strcpy (buf, "9223372036854775808");
-                 return;
-               }
-           }
-         if (!v)
-           {
-             strcpy (buf, "0");
-             return;
-           }
-
-         i = 0;
-         tmp[29] = 0;
-         while (v)
-           {
-             tmp[28 - i] = (v % 10) + '0';
-             v /= 10;
-             i++;
-           }
-         strcpy (buf, tmp + 29 - i);
-       }
-    }
-  else
-    {
-      if (hex)
-       sprintf (buf, "0x%x", (unsigned int) disp);
-      else
-       sprintf (buf, "%d", (int) disp);
-    }
-}
-
-static void
-OP_E (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_vma disp;
-  int add = 0;
-  int riprel = 0;
-  USED_REX (REX_EXTZ);
-  if (rex & REX_EXTZ)
-    add += 8;
-
-  /* Skip mod/rm byte.  */
-  MODRM_CHECK;
-  codep++;
-
-  if (mod == 3)
-    {
-      switch (bytemode)
-       {
-       case b_mode:
-         USED_REX (0);
-         if (rex)
-           oappend (names8rex[rm + add]);
-         else
-           oappend (names8[rm + add]);
-         break;
-       case w_mode:
-         oappend (names16[rm + add]);
-         break;
-       case d_mode:
-         oappend (names32[rm + add]);
-         break;
-       case q_mode:
-         oappend (names64[rm + add]);
-         break;
-       case m_mode:
-         if (mode_64bit)
-           oappend (names64[rm + add]);
-         else
-           oappend (names32[rm + add]);
-         break;
-       case v_mode:
-         USED_REX (REX_MODE64);
-         if (rex & REX_MODE64)
-           oappend (names64[rm + add]);
-         else if (sizeflag & DFLAG)
-           oappend (names32[rm + add]);
-         else
-           oappend (names16[rm + add]);
-         used_prefixes |= (prefixes & PREFIX_DATA);
-         break;
-       case 0:
-         if (!(codep[-2] == 0xAE && codep[-1] == 0xF8 /* sfence */)
-             && !(codep[-2] == 0xAE && codep[-1] == 0xF0 /* mfence */)
-             && !(codep[-2] == 0xAE && codep[-1] == 0xe8 /* lfence */))
-           BadOp ();   /* bad sfence,lea,lds,les,lfs,lgs,lss modrm */
-         break;
-       default:
-         oappend (INTERNAL_DISASSEMBLER_ERROR);
-         break;
-       }
-      return;
-    }
-
-  disp = 0;
-  append_seg ();
-
-  if ((sizeflag & AFLAG) || mode_64bit) /* 32 bit address mode */
-    {
-      int havesib;
-      int havebase;
-      int base;
-      int index = 0;
-      int scale = 0;
-
-      havesib = 0;
-      havebase = 1;
-      base = rm;
-
-      if (base == 4)
-       {
-         havesib = 1;
-         FETCH_DATA (the_info, codep + 1);
-         scale = (*codep >> 6) & 3;
-         index = (*codep >> 3) & 7;
-         base = *codep & 7;
-         USED_REX (REX_EXTY);
-         USED_REX (REX_EXTZ);
-         if (rex & REX_EXTY)
-           index += 8;
-         if (rex & REX_EXTZ)
-           base += 8;
-         codep++;
-       }
-
-      switch (mod)
-       {
-       case 0:
-         if ((base & 7) == 5)
-           {
-             havebase = 0;
-             if (mode_64bit && !havesib && (sizeflag & AFLAG))
-               riprel = 1;
-             disp = get32s ();
-           }
-         break;
-       case 1:
-         FETCH_DATA (the_info, codep + 1);
-         disp = *codep++;
-         if ((disp & 0x80) != 0)
-           disp -= 0x100;
-         break;
-       case 2:
-         disp = get32s ();
-         break;
-       }
-
-      if (!intel_syntax)
-        if (mod != 0 || (base & 7) == 5)
-          {
-           print_operand_value (scratchbuf, !riprel, disp);
-            oappend (scratchbuf);
-           if (riprel)
-             {
-               set_op (disp, 1);
-               oappend ("(%rip)");
-             }
-          }
-
-      if (havebase || (havesib && (index != 4 || scale != 0)))
-       {
-          if (intel_syntax)
-            {
-              switch (bytemode)
-                {
-                case b_mode:
-                  oappend ("BYTE PTR ");
-                  break;
-                case w_mode:
-                  oappend ("WORD PTR ");
-                  break;
-                case v_mode:
-                  oappend ("DWORD PTR ");
-                  break;
-                case d_mode:
-                  oappend ("QWORD PTR ");
-                  break;
-                case m_mode:
-                 if (mode_64bit)
-                   oappend ("DWORD PTR ");
-                 else
-                   oappend ("QWORD PTR ");
-                 break;
-                case x_mode:
-                  oappend ("XWORD PTR ");
-                  break;
-                default:
-                  break;
-                }
-             }
-         *obufp++ = open_char;
-         if (intel_syntax && riprel)
-           oappend ("rip + ");
-          *obufp = '\0';
-         USED_REX (REX_EXTZ);
-         if (!havesib && (rex & REX_EXTZ))
-           base += 8;
-         if (havebase)
-           oappend (mode_64bit && (sizeflag & AFLAG)
-                    ? names64[base] : names32[base]);
-         if (havesib)
-           {
-             if (index != 4)
-               {
-                  if (intel_syntax)
-                    {
-                      if (havebase)
-                        {
-                          *obufp++ = separator_char;
-                          *obufp = '\0';
-                        }
-                      sprintf (scratchbuf, "%s",
-                              mode_64bit && (sizeflag & AFLAG)
-                              ? names64[index] : names32[index]);
-                    }
-                  else
-                   sprintf (scratchbuf, ",%s",
-                            mode_64bit && (sizeflag & AFLAG)
-                            ? names64[index] : names32[index]);
-                 oappend (scratchbuf);
-               }
-              if (!intel_syntax
-                  || (intel_syntax
-                      && bytemode != b_mode
-                      && bytemode != w_mode
-                      && bytemode != v_mode))
-                {
-                  *obufp++ = scale_char;
-                  *obufp = '\0';
-                 sprintf (scratchbuf, "%d", 1 << scale);
-                 oappend (scratchbuf);
-                }
-           }
-          if (intel_syntax)
-            if (mod != 0 || (base & 7) == 5)
-              {
-               /* Don't print zero displacements.  */
-                if (disp != 0)
-                  {
-                   if ((bfd_signed_vma) disp > 0)
-                     {
-                       *obufp++ = '+';
-                       *obufp = '\0';
-                     }
-
-                   print_operand_value (scratchbuf, 0, disp);
-                    oappend (scratchbuf);
-                  }
-              }
-
-         *obufp++ = close_char;
-          *obufp = '\0';
-       }
-      else if (intel_syntax)
-        {
-          if (mod != 0 || (base & 7) == 5)
-            {
-             if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
-                             | PREFIX_ES | PREFIX_FS | PREFIX_GS))
-               ;
-             else
-               {
-                 oappend (names_seg[ds_reg - es_reg]);
-                 oappend (":");
-               }
-             print_operand_value (scratchbuf, 1, disp);
-              oappend (scratchbuf);
-            }
-        }
-    }
-  else
-    { /* 16 bit address mode */
-      switch (mod)
-       {
-       case 0:
-         if ((rm & 7) == 6)
-           {
-             disp = get16 ();
-             if ((disp & 0x8000) != 0)
-               disp -= 0x10000;
-           }
-         break;
-       case 1:
-         FETCH_DATA (the_info, codep + 1);
-         disp = *codep++;
-         if ((disp & 0x80) != 0)
-           disp -= 0x100;
-         break;
-       case 2:
-         disp = get16 ();
-         if ((disp & 0x8000) != 0)
-           disp -= 0x10000;
-         break;
-       }
-
-      if (!intel_syntax)
-        if (mod != 0 || (rm & 7) == 6)
-          {
-           print_operand_value (scratchbuf, 0, disp);
-            oappend (scratchbuf);
-          }
-
-      if (mod != 0 || (rm & 7) != 6)
-       {
-         *obufp++ = open_char;
-          *obufp = '\0';
-         oappend (index16[rm + add]);
-          *obufp++ = close_char;
-          *obufp = '\0';
-       }
-    }
-}
-
-static void
-OP_G (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add += 8;
-  switch (bytemode)
-    {
-    case b_mode:
-      USED_REX (0);
-      if (rex)
-       oappend (names8rex[reg + add]);
-      else
-       oappend (names8[reg + add]);
-      break;
-    case w_mode:
-      oappend (names16[reg + add]);
-      break;
-    case d_mode:
-      oappend (names32[reg + add]);
-      break;
-    case q_mode:
-      oappend (names64[reg + add]);
-      break;
-    case v_mode:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       oappend (names64[reg + add]);
-      else if (sizeflag & DFLAG)
-       oappend (names32[reg + add]);
-      else
-       oappend (names16[reg + add]);
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      break;
-    }
-}
-
-static bfd_vma
-get64 ()
-{
-  bfd_vma x;
-#ifdef BFD64
-  unsigned int a;
-  unsigned int b;
-
-  FETCH_DATA (the_info, codep + 8);
-  a = *codep++ & 0xff;
-  a |= (*codep++ & 0xff) << 8;
-  a |= (*codep++ & 0xff) << 16;
-  a |= (*codep++ & 0xff) << 24;
-  b = *codep++ & 0xff;
-  b |= (*codep++ & 0xff) << 8;
-  b |= (*codep++ & 0xff) << 16;
-  b |= (*codep++ & 0xff) << 24;
-  x = a + ((bfd_vma) b << 32);
-#else
-  abort ();
-  x = 0;
-#endif
-  return x;
-}
-
-static bfd_signed_vma
-get32 ()
-{
-  bfd_signed_vma x = 0;
-
-  FETCH_DATA (the_info, codep + 4);
-  x = *codep++ & (bfd_signed_vma) 0xff;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
-  return x;
-}
-
-static bfd_signed_vma
-get32s ()
-{
-  bfd_signed_vma x = 0;
-
-  FETCH_DATA (the_info, codep + 4);
-  x = *codep++ & (bfd_signed_vma) 0xff;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
-
-  x = (x ^ ((bfd_signed_vma) 1 << 31)) - ((bfd_signed_vma) 1 << 31);
-
-  return x;
-}
-
-static int
-get16 ()
-{
-  int x = 0;
-
-  FETCH_DATA (the_info, codep + 2);
-  x = *codep++ & 0xff;
-  x |= (*codep++ & 0xff) << 8;
-  return x;
-}
-
-static void
-set_op (op, riprel)
-     bfd_vma op;
-     int riprel;
-{
-  op_index[op_ad] = op_ad;
-  if (mode_64bit)
-    {
-      op_address[op_ad] = op;
-      op_riprel[op_ad] = riprel;
-    }
-  else
-    {
-      /* Mask to get a 32-bit address.  */
-      op_address[op_ad] = op & 0xffffffff;
-      op_riprel[op_ad] = riprel & 0xffffffff;
-    }
-}
-
-static void
-OP_REG (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  const char *s;
-  int add = 0;
-  USED_REX (REX_EXTZ);
-  if (rex & REX_EXTZ)
-    add = 8;
-
-  switch (code)
-    {
-    case indir_dx_reg:
-      if (intel_syntax)
-        s = "[dx]";
-      else
-        s = "(%dx)";
-      break;
-    case ax_reg: case cx_reg: case dx_reg: case bx_reg:
-    case sp_reg: case bp_reg: case si_reg: case di_reg:
-      s = names16[code - ax_reg + add];
-      break;
-    case es_reg: case ss_reg: case cs_reg:
-    case ds_reg: case fs_reg: case gs_reg:
-      s = names_seg[code - es_reg + add];
-      break;
-    case al_reg: case ah_reg: case cl_reg: case ch_reg:
-    case dl_reg: case dh_reg: case bl_reg: case bh_reg:
-      USED_REX (0);
-      if (rex)
-       s = names8rex[code - al_reg + add];
-      else
-       s = names8[code - al_reg];
-      break;
-    case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
-    case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
-      if (mode_64bit)
-       {
-         s = names64[code - rAX_reg + add];
-         break;
-       }
-      code += eAX_reg - rAX_reg;
-      /* Fall through.  */
-    case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
-    case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       s = names64[code - eAX_reg + add];
-      else if (sizeflag & DFLAG)
-       s = names32[code - eAX_reg + add];
-      else
-       s = names16[code - eAX_reg + add];
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    default:
-      s = INTERNAL_DISASSEMBLER_ERROR;
-      break;
-    }
-  oappend (s);
-}
-
-static void
-OP_IMREG (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  const char *s;
-
-  switch (code)
-    {
-    case indir_dx_reg:
-      if (intel_syntax)
-        s = "[dx]";
-      else
-        s = "(%dx)";
-      break;
-    case ax_reg: case cx_reg: case dx_reg: case bx_reg:
-    case sp_reg: case bp_reg: case si_reg: case di_reg:
-      s = names16[code - ax_reg];
-      break;
-    case es_reg: case ss_reg: case cs_reg:
-    case ds_reg: case fs_reg: case gs_reg:
-      s = names_seg[code - es_reg];
-      break;
-    case al_reg: case ah_reg: case cl_reg: case ch_reg:
-    case dl_reg: case dh_reg: case bl_reg: case bh_reg:
-      USED_REX (0);
-      if (rex)
-       s = names8rex[code - al_reg];
-      else
-       s = names8[code - al_reg];
-      break;
-    case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
-    case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       s = names64[code - eAX_reg];
-      else if (sizeflag & DFLAG)
-       s = names32[code - eAX_reg];
-      else
-       s = names16[code - eAX_reg];
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    default:
-      s = INTERNAL_DISASSEMBLER_ERROR;
-      break;
-    }
-  oappend (s);
-}
-
-static void
-OP_I (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_signed_vma op;
-  bfd_signed_vma mask = -1;
-
-  switch (bytemode)
-    {
-    case b_mode:
-      FETCH_DATA (the_info, codep + 1);
-      op = *codep++;
-      mask = 0xff;
-      break;
-    case q_mode:
-      if (mode_64bit)
-       {
-         op = get32s ();
-         break;
-       }
-      /* Fall through.  */
-    case v_mode:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       op = get32s ();
-      else if (sizeflag & DFLAG)
-       {
-         op = get32 ();
-         mask = 0xffffffff;
-       }
-      else
-       {
-         op = get16 ();
-         mask = 0xfffff;
-       }
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    case w_mode:
-      mask = 0xfffff;
-      op = get16 ();
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      return;
-    }
-
-  op &= mask;
-  scratchbuf[0] = '$';
-  print_operand_value (scratchbuf + 1, 1, op);
-  oappend (scratchbuf + intel_syntax);
-  scratchbuf[0] = '\0';
-}
-
-static void
-OP_I64 (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_signed_vma op;
-  bfd_signed_vma mask = -1;
-
-  if (!mode_64bit)
-    {
-      OP_I (bytemode, sizeflag);
-      return;
-    }
-
-  switch (bytemode)
-    {
-    case b_mode:
-      FETCH_DATA (the_info, codep + 1);
-      op = *codep++;
-      mask = 0xff;
-      break;
-    case v_mode:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       op = get64 ();
-      else if (sizeflag & DFLAG)
-       {
-         op = get32 ();
-         mask = 0xffffffff;
-       }
-      else
-       {
-         op = get16 ();
-         mask = 0xfffff;
-       }
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    case w_mode:
-      mask = 0xfffff;
-      op = get16 ();
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      return;
-    }
-
-  op &= mask;
-  scratchbuf[0] = '$';
-  print_operand_value (scratchbuf + 1, 1, op);
-  oappend (scratchbuf + intel_syntax);
-  scratchbuf[0] = '\0';
-}
-
-static void
-OP_sI (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_signed_vma op;
-  bfd_signed_vma mask = -1;
-
-  switch (bytemode)
-    {
-    case b_mode:
-      FETCH_DATA (the_info, codep + 1);
-      op = *codep++;
-      if ((op & 0x80) != 0)
-       op -= 0x100;
-      mask = 0xffffffff;
-      break;
-    case v_mode:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       op = get32s ();
-      else if (sizeflag & DFLAG)
-       {
-         op = get32s ();
-         mask = 0xffffffff;
-       }
-      else
-       {
-         mask = 0xffffffff;
-         op = get16 ();
-         if ((op & 0x8000) != 0)
-           op -= 0x10000;
-       }
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    case w_mode:
-      op = get16 ();
-      mask = 0xffffffff;
-      if ((op & 0x8000) != 0)
-       op -= 0x10000;
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      return;
-    }
-
-  scratchbuf[0] = '$';
-  print_operand_value (scratchbuf + 1, 1, op);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_J (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_vma disp;
-  bfd_vma mask = -1;
-
-  switch (bytemode)
-    {
-    case b_mode:
-      FETCH_DATA (the_info, codep + 1);
-      disp = *codep++;
-      if ((disp & 0x80) != 0)
-       disp -= 0x100;
-      break;
-    case v_mode:
-      if (sizeflag & DFLAG)
-       disp = get32s ();
-      else
-       {
-         disp = get16 ();
-         /* For some reason, a data16 prefix on a jump instruction
-            means that the pc is masked to 16 bits after the
-            displacement is added!  */
-         mask = 0xffff;
-       }
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      return;
-    }
-  disp = (start_pc + codep - start_codep + disp) & mask;
-  set_op (disp, 0);
-  print_operand_value (scratchbuf, 1, disp);
-  oappend (scratchbuf);
-}
-
-static void
-OP_SEG (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  oappend (names_seg[reg]);
-}
-
-static void
-OP_DIR (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag;
-{
-  int seg, offset;
-
-  if (sizeflag & DFLAG)
-    {
-      offset = get32 ();
-      seg = get16 ();
-    }
-  else
-    {
-      offset = get16 ();
-      seg = get16 ();
-    }
-  used_prefixes |= (prefixes & PREFIX_DATA);
-  if (intel_syntax)
-    sprintf (scratchbuf, "0x%x,0x%x", seg, offset);
-  else
-    sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
-  oappend (scratchbuf);
-}
-
-static void
-OP_OFF (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag;
-{
-  bfd_vma off;
-
-  append_seg ();
-
-  if ((sizeflag & AFLAG) || mode_64bit)
-    off = get32 ();
-  else
-    off = get16 ();
-
-  if (intel_syntax)
-    {
-      if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
-                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
-       {
-         oappend (names_seg[ds_reg - es_reg]);
-         oappend (":");
-       }
-    }
-  print_operand_value (scratchbuf, 1, off);
-  oappend (scratchbuf);
-}
-
-static void
-OP_OFF64 (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  bfd_vma off;
-
-  if (!mode_64bit)
-    {
-      OP_OFF (bytemode, sizeflag);
-      return;
-    }
-
-  append_seg ();
-
-  off = get64 ();
-
-  if (intel_syntax)
-    {
-      if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
-                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
-       {
-         oappend (names_seg[ds_reg - es_reg]);
-         oappend (":");
-       }
-    }
-  print_operand_value (scratchbuf, 1, off);
-  oappend (scratchbuf);
-}
-
-static void
-ptr_reg (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  const char *s;
-  if (intel_syntax)
-    oappend ("[");
-  else
-    oappend ("(");
-
-  USED_REX (REX_MODE64);
-  if (rex & REX_MODE64)
-    {
-      if (!(sizeflag & AFLAG))
-        s = names32[code - eAX_reg];
-      else
-        s = names64[code - eAX_reg];
-    }
-  else if (sizeflag & AFLAG)
-    s = names32[code - eAX_reg];
-  else
-    s = names16[code - eAX_reg];
-  oappend (s);
-  if (intel_syntax)
-    oappend ("]");
-  else
-    oappend (")");
-}
-
-static void
-OP_ESreg (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  oappend ("%es:" + intel_syntax);
-  ptr_reg (code, sizeflag);
-}
-
-static void
-OP_DSreg (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  if ((prefixes
-       & (PREFIX_CS
-         | PREFIX_DS
-         | PREFIX_SS
-         | PREFIX_ES
-         | PREFIX_FS
-         | PREFIX_GS)) == 0)
-    prefixes |= PREFIX_DS;
-  append_seg ();
-  ptr_reg (code, sizeflag);
-}
-
-static void
-OP_C (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add = 8;
-  sprintf (scratchbuf, "%%cr%d", reg + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_D (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add = 8;
-  if (intel_syntax)
-    sprintf (scratchbuf, "db%d", reg + add);
-  else
-    sprintf (scratchbuf, "%%db%d", reg + add);
-  oappend (scratchbuf);
-}
-
-static void
-OP_T (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  sprintf (scratchbuf, "%%tr%d", reg);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_Rd (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  if (mod == 3)
-    OP_E (bytemode, sizeflag);
-  else
-    BadOp ();
-}
-
-static void
-OP_MMX (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add = 8;
-  used_prefixes |= (prefixes & PREFIX_DATA);
-  if (prefixes & PREFIX_DATA)
-    sprintf (scratchbuf, "%%xmm%d", reg + add);
-  else
-    sprintf (scratchbuf, "%%mm%d", reg + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_XMM (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add = 8;
-  sprintf (scratchbuf, "%%xmm%d", reg + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_EM (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  int add = 0;
-  if (mod != 3)
-    {
-      OP_E (bytemode, sizeflag);
-      return;
-    }
-  USED_REX (REX_EXTZ);
-  if (rex & REX_EXTZ)
-    add = 8;
-
-  /* Skip mod/rm byte.  */
-  MODRM_CHECK;
-  codep++;
-  used_prefixes |= (prefixes & PREFIX_DATA);
-  if (prefixes & PREFIX_DATA)
-    sprintf (scratchbuf, "%%xmm%d", rm + add);
-  else
-    sprintf (scratchbuf, "%%mm%d", rm + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_EX (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  int add = 0;
-  if (mod != 3)
-    {
-      OP_E (bytemode, sizeflag);
-      return;
-    }
-  USED_REX (REX_EXTZ);
-  if (rex & REX_EXTZ)
-    add = 8;
-
-  /* Skip mod/rm byte.  */
-  MODRM_CHECK;
-  codep++;
-  sprintf (scratchbuf, "%%xmm%d", rm + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_MS (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  if (mod == 3)
-    OP_EM (bytemode, sizeflag);
-  else
-    BadOp ();
-}
-
-static void
-OP_XS (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  if (mod == 3)
-    OP_EX (bytemode, sizeflag);
-  else
-    BadOp ();
-}
-
-static const char *Suffix3DNow[] = {
-/* 00 */       NULL,           NULL,           NULL,           NULL,
-/* 04 */       NULL,           NULL,           NULL,           NULL,
-/* 08 */       NULL,           NULL,           NULL,           NULL,
-/* 0C */       "pi2fw",        "pi2fd",        NULL,           NULL,
-/* 10 */       NULL,           NULL,           NULL,           NULL,
-/* 14 */       NULL,           NULL,           NULL,           NULL,
-/* 18 */       NULL,           NULL,           NULL,           NULL,
-/* 1C */       "pf2iw",        "pf2id",        NULL,           NULL,
-/* 20 */       NULL,           NULL,           NULL,           NULL,
-/* 24 */       NULL,           NULL,           NULL,           NULL,
-/* 28 */       NULL,           NULL,           NULL,           NULL,
-/* 2C */       NULL,           NULL,           NULL,           NULL,
-/* 30 */       NULL,           NULL,           NULL,           NULL,
-/* 34 */       NULL,           NULL,           NULL,           NULL,
-/* 38 */       NULL,           NULL,           NULL,           NULL,
-/* 3C */       NULL,           NULL,           NULL,           NULL,
-/* 40 */       NULL,           NULL,           NULL,           NULL,
-/* 44 */       NULL,           NULL,           NULL,           NULL,
-/* 48 */       NULL,           NULL,           NULL,           NULL,
-/* 4C */       NULL,           NULL,           NULL,           NULL,
-/* 50 */       NULL,           NULL,           NULL,           NULL,
-/* 54 */       NULL,           NULL,           NULL,           NULL,
-/* 58 */       NULL,           NULL,           NULL,           NULL,
-/* 5C */       NULL,           NULL,           NULL,           NULL,
-/* 60 */       NULL,           NULL,           NULL,           NULL,
-/* 64 */       NULL,           NULL,           NULL,           NULL,
-/* 68 */       NULL,           NULL,           NULL,           NULL,
-/* 6C */       NULL,           NULL,           NULL,           NULL,
-/* 70 */       NULL,           NULL,           NULL,           NULL,
-/* 74 */       NULL,           NULL,           NULL,           NULL,
-/* 78 */       NULL,           NULL,           NULL,           NULL,
-/* 7C */       NULL,           NULL,           NULL,           NULL,
-/* 80 */       NULL,           NULL,           NULL,           NULL,
-/* 84 */       NULL,           NULL,           NULL,           NULL,
-/* 88 */       NULL,           NULL,           "pfnacc",       NULL,
-/* 8C */       NULL,           NULL,           "pfpnacc",      NULL,
-/* 90 */       "pfcmpge",      NULL,           NULL,           NULL,
-/* 94 */       "pfmin",        NULL,           "pfrcp",        "pfrsqrt",
-/* 98 */       NULL,           NULL,           "pfsub",        NULL,
-/* 9C */       NULL,           NULL,           "pfadd",        NULL,
-/* A0 */       "pfcmpgt",      NULL,           NULL,           NULL,
-/* A4 */       "pfmax",        NULL,           "pfrcpit1",     "pfrsqit1",
-/* A8 */       NULL,           NULL,           "pfsubr",       NULL,
-/* AC */       NULL,           NULL,           "pfacc",        NULL,
-/* B0 */       "pfcmpeq",      NULL,           NULL,           NULL,
-/* B4 */       "pfmul",        NULL,           "pfrcpit2",     "pfmulhrw",
-/* B8 */       NULL,           NULL,           NULL,           "pswapd",
-/* BC */       NULL,           NULL,           NULL,           "pavgusb",
-/* C0 */       NULL,           NULL,           NULL,           NULL,
-/* C4 */       NULL,           NULL,           NULL,           NULL,
-/* C8 */       NULL,           NULL,           NULL,           NULL,
-/* CC */       NULL,           NULL,           NULL,           NULL,
-/* D0 */       NULL,           NULL,           NULL,           NULL,
-/* D4 */       NULL,           NULL,           NULL,           NULL,
-/* D8 */       NULL,           NULL,           NULL,           NULL,
-/* DC */       NULL,           NULL,           NULL,           NULL,
-/* E0 */       NULL,           NULL,           NULL,           NULL,
-/* E4 */       NULL,           NULL,           NULL,           NULL,
-/* E8 */       NULL,           NULL,           NULL,           NULL,
-/* EC */       NULL,           NULL,           NULL,           NULL,
-/* F0 */       NULL,           NULL,           NULL,           NULL,
-/* F4 */       NULL,           NULL,           NULL,           NULL,
-/* F8 */       NULL,           NULL,           NULL,           NULL,
-/* FC */       NULL,           NULL,           NULL,           NULL,
-};
-
-static void
-OP_3DNowSuffix (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  const char *mnemonic;
-
-  FETCH_DATA (the_info, codep + 1);
-  /* AMD 3DNow! instructions are specified by an opcode suffix in the
-     place where an 8-bit immediate would normally go.  ie. the last
-     byte of the instruction.  */
-  obufp = obuf + strlen (obuf);
-  mnemonic = Suffix3DNow[*codep++ & 0xff];
-  if (mnemonic)
-    oappend (mnemonic);
-  else
-    {
-      /* Since a variable sized modrm/sib chunk is between the start
-        of the opcode (0x0f0f) and the opcode suffix, we need to do
-        all the modrm processing first, and don't know until now that
-        we have a bad opcode.  This necessitates some cleaning up.  */
-      op1out[0] = '\0';
-      op2out[0] = '\0';
-      BadOp ();
-    }
-}
-
-static const char *simd_cmp_op[] = {
-  "eq",
-  "lt",
-  "le",
-  "unord",
-  "neq",
-  "nlt",
-  "nle",
-  "ord"
-};
-
-static void
-OP_SIMD_Suffix (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  unsigned int cmp_type;
-
-  FETCH_DATA (the_info, codep + 1);
-  obufp = obuf + strlen (obuf);
-  cmp_type = *codep++ & 0xff;
-  if (cmp_type < 8)
-    {
-      char suffix1 = 'p', suffix2 = 's';
-      used_prefixes |= (prefixes & PREFIX_REPZ);
-      if (prefixes & PREFIX_REPZ)
-       suffix1 = 's';
-      else
-       {
-         used_prefixes |= (prefixes & PREFIX_DATA);
-         if (prefixes & PREFIX_DATA)
-           suffix2 = 'd';
-         else
-           {
-             used_prefixes |= (prefixes & PREFIX_REPNZ);
-             if (prefixes & PREFIX_REPNZ)
-               suffix1 = 's', suffix2 = 'd';
-           }
-       }
-      sprintf (scratchbuf, "cmp%s%c%c",
-              simd_cmp_op[cmp_type], suffix1, suffix2);
-      used_prefixes |= (prefixes & PREFIX_REPZ);
-      oappend (scratchbuf);
-    }
-  else
-    {
-      /* We have a bad extension byte.  Clean up.  */
-      op1out[0] = '\0';
-      op2out[0] = '\0';
-      BadOp ();
-    }
-}
-
-static void
-SIMD_Fixup (extrachar, sizeflag)
-     int extrachar;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  /* Change movlps/movhps to movhlps/movlhps for 2 register operand
-     forms of these instructions.  */
-  if (mod == 3)
-    {
-      char *p = obuf + strlen (obuf);
-      *(p + 1) = '\0';
-      *p       = *(p - 1);
-      *(p - 1) = *(p - 2);
-      *(p - 2) = *(p - 3);
-      *(p - 3) = extrachar;
-    }
-}
-
-static void
-BadOp (void)
-{
-  /* Throw away prefixes and 1st. opcode byte.  */
-  codep = insn_codep + 1;
-  oappend ("(bad)");
-}
diff --git a/i386/methodtable.c b/i386/methodtable.c
deleted file mode 100644 (file)
index c58d490..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* i386/methodtable.c **********************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Contains the codegenerator for an i386 processor.
-    This module generates i386 machine code for a sequence of
-    pseudo commands (ICMDs).
-
-    Authors: Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: methodtable.c 525 2003-10-22 21:14:23Z twisti $
-
-*******************************************************************************/
-
-#include "methodtable.h"
-
-static mtentry *mtroot = NULL;
-
-
-
-void addmethod(u1 *start, u1 *end)
-{
-  /* boehm makes problems with jvm98 db */
-#if 0
-    mtentry *mte = GCNEW(mtentry, 1);
-#else
-    mtentry *mte = NEW(mtentry);
-#endif
-
-/*      fprintf(stderr, "start=%lx end=%lx\n", start, end); */
-
-    if (mtroot == NULL) {
-#if 0
-        mtentry *tmp = GCNEW(mtentry, 1);
-#else
-        mtentry *tmp = NEW(mtentry);
-#endif
-       tmp->start = (u1 *) asm_calljavamethod;
-       tmp->end = (u1 *) asm_calljavafunction;    /* little hack, but should work */
-       tmp->next = mtroot;
-       mtroot = tmp;
-
-#if 0
-        tmp = GCNEW(mtentry, 1);
-#else
-        tmp = NEW(mtentry);
-#endif
-       tmp->start = (u1 *) asm_calljavafunction;
-       tmp->end = (u1 *) asm_call_jit_compiler;    /* little hack, but should work */
-       tmp->next = mtroot;
-       mtroot = tmp;
-    }
-
-    mte->start = start;
-    mte->end = end;
-    mte->next = mtroot;
-    mtroot = mte;
-}
-
-
-
-u1 *findmethod(u1 *pos)
-{
-    mtentry *mte = mtroot;
-
-/*      printf("findmethod: start\n"); */
-
-    while (mte != NULL) {
-/*          printf("%p <= %p <= %p\n", mte->start, pos, mte->end); */
-          
-       if (mte->start <= pos && pos <= mte->end) {
-           return mte->start;
-
-       } else {
-           mte = mte->next;
-       }
-    }
-       
-    return NULL;
-}
-
-
-
-void asmprintf(int x)
-{
-    printf("val=%x\n", x);
-    fflush(stdout);
-}
diff --git a/i386/methodtable.h b/i386/methodtable.h
deleted file mode 100644 (file)
index ac91a79..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* i386/methodtable.h **********************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Contains the codegenerator for an i386 processor.
-    This module generates i386 machine code for a sequence of
-    pseudo commands (ICMDs).
-
-    Authors: Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: methodtable.h 385 2003-07-10 10:45:57Z twisti $
-
-*******************************************************************************/
-
-#ifndef _METHODTABLE_H
-#define _METHODTABLE_H
-
-typedef struct _mtentry mtentry;
-
-struct _mtentry {
-    u1 *start;
-    u1 *end;
-    mtentry *next;
-};
-
-void addmethod(u1 *start, u1 *end);
-u1 *findmethod(u1 *pos);
-
-#endif
diff --git a/i386/native-math.h b/i386/native-math.h
deleted file mode 100644 (file)
index 8e879ce..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* i386/native-math.h **********************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Contains the machine-specific floating point definitions.
-
-    Authors: Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-             Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
-             Christian Thalinger
-
-    $Id: native-math.h 433 2003-09-13 15:13:59Z twisti $
-
-*******************************************************************************/
-
-#ifndef _NATIVE_MATH_H
-#define _NATIVE_MATH_H
-
-/* include machine-specific math.h */
-
-#include <math.h>
-
-/* define infinity for floating point numbers */
-
-static u4 flt_nan    = 0x7fc00000;
-static u4 flt_posinf = 0x7f800000;
-static u4 flt_neginf = 0xff800000;
-
-#define FLT_NAN     (*((float*) (&flt_nan)))
-#define FLT_POSINF  (*((float*) (&flt_posinf)))
-#define FLT_NEGINF  (*((float*) (&flt_neginf)))
-
-/* define infinity for double floating point numbers */
-
-static u8 dbl_nan    = 0x7ff8000000000000LL;
-static u8 dbl_posinf = 0x7ff0000000000000LL;
-static u8 dbl_neginf = 0xfff0000000000000LL;
-
-#define DBL_NAN     (*((double*) (&dbl_nan)))
-#define DBL_POSINF  (*((double*) (&dbl_posinf)))
-#define DBL_NEGINF  (*((double*) (&dbl_neginf)))
-
-#endif
diff --git a/i386/ngen.c b/i386/ngen.c
deleted file mode 100644 (file)
index 75815bf..0000000
+++ /dev/null
@@ -1,6002 +0,0 @@
-/* i386/ngen.c - machine code generator for i386
-
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Institut f. Computersprachen, TU Wien
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
-   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
-   J. Wenninger
-
-   This file is part of CACAO.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
-
-   Contact: cacao@complang.tuwien.ac.at
-
-   Authors: Andreas Krall
-            Christian Thalinger
-
-   $Id: ngen.c 551 2003-11-01 20:35:28Z twisti $
-
-*/
-
-
-#include "jitdef.h"   /* phil */
-#include "methodtable.c"
-
-/* additional functions and macros to generate code ***************************/
-
-#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
-
-
-#ifdef STATISTICS
-#define COUNT_SPILLS count_spills++
-#else
-#define COUNT_SPILLS
-#endif
-
-
-#define CALCOFFSETBYTES(var, val) \
-    if ((s4) (val) < -128 || (s4) (val) > 127) (var) += 4; \
-    else if ((s4) (val) != 0) (var) += 1;
-
-
-#define CALCREGOFFBYTES(var, val) \
-    if ((val) > 15) (var) += 4; \
-    else if ((val) != 0) (var) += 1;
-
-
-#define CALCIMMEDIATEBYTES(var, val) \
-    if ((s4) (val) < -128 || (s4) (val) > 127) (var) += 4; \
-    else (var) += 1;
-
-
-/* gen_nullptr_check(objreg) */
-
-#define gen_nullptr_check(objreg) \
-       if (checknull) { \
-        i386_test_reg_reg((objreg), (objreg)); \
-        i386_jcc(I386_CC_E, 0); \
-           mcode_addxnullrefs(mcodeptr); \
-       }
-
-
-/* MCODECHECK(icnt) */
-
-#define MCODECHECK(icnt) \
-       if ((mcodeptr + (icnt)) > (u1*) mcodeend) mcodeptr = (u1*) mcode_increase((u1*) mcodeptr)
-
-/* M_INTMOVE:
-     generates an integer-move from register a to b.
-     if a and b are the same int-register, no code will be generated.
-*/ 
-
-#define M_INTMOVE(reg,dreg) if ((reg) != (dreg)) { i386_mov_reg_reg((reg),(dreg)); }
-
-
-/* M_FLTMOVE:
-    generates a floating-point-move from register a to b.
-    if a and b are the same float-register, no code will be generated
-*/
-
-#define M_FLTMOVE(reg,dreg) panic("M_FLTMOVE");
-
-#define M_LNGMEMMOVE(reg,dreg) \
-    do { \
-        i386_mov_membase_reg(REG_SP, (reg) * 8, REG_ITMP1); \
-        i386_mov_membase_reg(REG_SP, (reg) * 8 + 4, REG_ITMP2); \
-        i386_mov_reg_membase(REG_ITMP1, REG_SP, (dreg) * 8); \
-        i386_mov_reg_membase(REG_ITMP2, REG_SP, (dreg) * 8 + 4); \
-    } while (0)
-
-
-/* var_to_reg_xxx:
-    this function generates code to fetch data from a pseudo-register
-    into a real register. 
-    If the pseudo-register has actually been assigned to a real 
-    register, no code will be emitted, since following operations
-    can use this register directly.
-    
-    v: pseudoregister to be fetched from
-    tempregnum: temporary register to be used if v is actually spilled to ram
-
-    return: the register number, where the operand can be found after 
-            fetching (this wil be either tempregnum or the register
-            number allready given to v)
-*/
-
-#define var_to_reg_int(regnr,v,tempnr) \
-    if ((v)->flags & INMEMORY) { \
-        COUNT_SPILLS; \
-        i386_mov_membase_reg(REG_SP, (v)->regoff * 8, tempnr); \
-        regnr = tempnr; \
-    } else { \
-        regnr = (v)->regoff; \
-    }
-
-
-
-#define var_to_reg_flt(regnr,v,tempnr) \
-    if ((v)->type == TYPE_FLT) { \
-        if ((v)->flags & INMEMORY) { \
-            COUNT_SPILLS; \
-            i386_flds_membase(REG_SP, (v)->regoff * 8); \
-            fpu_st_offset++; \
-            regnr = tempnr; \
-        } else { \
-            i386_fld_reg((v)->regoff + fpu_st_offset); \
-            fpu_st_offset++; \
-            regnr = (v)->regoff; \
-        } \
-    } else { \
-        if ((v)->flags & INMEMORY) { \
-            COUNT_SPILLS; \
-            i386_fldl_membase(REG_SP, (v)->regoff * 8); \
-            fpu_st_offset++; \
-            regnr = tempnr; \
-        } else { \
-            i386_fld_reg((v)->regoff + fpu_st_offset); \
-            fpu_st_offset++; \
-            regnr = (v)->regoff; \
-        } \
-    }
-
-#define NEW_var_to_reg_flt(regnr,v,tempnr) \
-    if ((v)->type == TYPE_FLT) { \
-       if ((v)->flags & INMEMORY) { \
-            COUNT_SPILLS; \
-            i386_flds_membase(REG_SP, (v)->regoff * 8); \
-            fpu_st_offset++; \
-            regnr = tempnr; \
-        } else { \
-            regnr = (v)->regoff; \
-        } \
-    } else { \
-        if ((v)->flags & INMEMORY) { \
-            COUNT_SPILLS; \
-            i386_fldl_membase(REG_SP, (v)->regoff * 8); \
-            fpu_st_offset++; \
-            regnr = tempnr; \
-        } else { \
-            regnr = (v)->regoff; \
-        } \
-    }
-
-
-/* reg_of_var:
-    This function determines a register, to which the result of an operation
-    should go, when it is ultimatively intended to store the result in
-    pseudoregister v.
-    If v is assigned to an actual register, this register will be returned.
-    Otherwise (when v is spilled) this function returns tempregnum.
-    If not already done, regoff and flags are set in the stack location.
-*/        
-
-static int reg_of_var(stackptr v, int tempregnum)
-{
-       varinfo      *var;
-
-       switch (v->varkind) {
-       case TEMPVAR:
-               if (!(v->flags & INMEMORY))
-                       return(v->regoff);
-               break;
-       case STACKVAR:
-               var = &(interfaces[v->varnum][v->type]);
-               v->regoff = var->regoff;
-               if (!(var->flags & INMEMORY))
-                       return(var->regoff);
-               break;
-       case LOCALVAR:
-               var = &(locals[v->varnum][v->type]);
-               v->regoff = var->regoff;
-               if (!(var->flags & INMEMORY))
-                       return(var->regoff);
-               break;
-       case ARGVAR:
-               v->regoff = v->varnum;
-               if (IS_FLT_DBL_TYPE(v->type)) {
-                       if (v->varnum < fltreg_argnum) {
-                               v->regoff = argfltregs[v->varnum];
-                               return(argfltregs[v->varnum]);
-                       }
-               }
-               else
-                       if (v->varnum < intreg_argnum) {
-                               v->regoff = argintregs[v->varnum];
-                               return(argintregs[v->varnum]);
-                       }
-               v->regoff -= intreg_argnum;
-               break;
-       }
-       v->flags |= INMEMORY;
-       return tempregnum;
-}
-
-
-/* store_reg_to_var_xxx:
-    This function generates the code to store the result of an operation
-    back into a spilled pseudo-variable.
-    If the pseudo-variable has not been spilled in the first place, this 
-    function will generate nothing.
-    
-    v ............ Pseudovariable
-    tempregnum ... Number of the temporary registers as returned by
-                   reg_of_var.
-*/     
-
-#define store_reg_to_var_int(sptr, tempregnum) \
-    if ((sptr)->flags & INMEMORY) { \
-        COUNT_SPILLS; \
-        i386_mov_reg_membase(tempregnum, REG_SP, (sptr)->regoff * 8); \
-    }
-
-
-#define store_reg_to_var_flt(sptr, tempregnum) \
-    if ((sptr)->type == TYPE_FLT) { \
-        if ((sptr)->flags & INMEMORY) { \
-             COUNT_SPILLS; \
-             i386_fstps_membase(REG_SP, (sptr)->regoff * 8); \
-             fpu_st_offset--; \
-        } else { \
-/*                  i386_fxch_reg((sptr)->regoff);*/ \
-             i386_fstp_reg((sptr)->regoff + fpu_st_offset); \
-             fpu_st_offset--; \
-        } \
-    } else { \
-        if ((sptr)->flags & INMEMORY) { \
-            COUNT_SPILLS; \
-            i386_fstpl_membase(REG_SP, (sptr)->regoff * 8); \
-            fpu_st_offset--; \
-        } else { \
-/*                  i386_fxch_reg((sptr)->regoff);*/ \
-            i386_fstp_reg((sptr)->regoff + fpu_st_offset); \
-            fpu_st_offset--; \
-        } \
-    }
-
-
-/* NullPointerException signal handler for hardware null pointer check */
-
-void catch_NullPointerException(int sig)
-{
-       sigset_t nsig;
-       int      instr;
-/*     long     faultaddr; */
-
-       void **_p = (void **) &sig;
-       struct sigcontext *sigctx = (struct sigcontext *) ++_p;
-
-       /* Reset signal handler - necessary for SysV, does no harm for BSD */
-
-       instr = *((int*)(sigctx->eip));
-/*     faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f]; */
-
-/*     fprintf(stderr, "null=%d %p addr=%p\n", sig, sigctx, sigctx->eip); */
-
-/*     if (faultaddr == 0) { */
-               signal(sig, (void *) catch_NullPointerException);          /* reinstall handler */
-               sigemptyset(&nsig);
-               sigaddset(&nsig, sig);
-               sigprocmask(SIG_UNBLOCK, &nsig, NULL);                     /* unblock signal    */
-               sigctx->eax = (long) proto_java_lang_NullPointerException; /* REG_ITMP1_XPTR    */
-               sigctx->edx = sigctx->eip;                                 /* REG_ITMP2_XPC     */
-               sigctx->eip = (long) asm_handle_exception;
-
-               return;
-
-/*     } else { */
-/*             faultaddr += (long) ((instr << 16) >> 16); */
-/*             fprintf(stderr, "faulting address: 0x%08x\n", faultaddr); */
-/*             panic("Stack overflow"); */
-/*     } */
-}
-
-/* ArithmeticException signal handler for hardware divide by zero check */
-
-void catch_ArithmeticException(int sig)
-{
-       sigset_t nsig;
-
-       void **_p = (void **) &sig;
-       struct sigcontext *sigctx = (struct sigcontext *) ++_p;
-
-       classinfo *c;
-       java_objectheader *p;
-       methodinfo *m;
-
-       /* Reset signal handler - necessary for SysV, does no harm for BSD        */
-
-       signal(sig, (void *) catch_ArithmeticException);     /* reinstall handler */
-       sigemptyset(&nsig);
-       sigaddset(&nsig, sig);
-       sigprocmask(SIG_UNBLOCK, &nsig, NULL);               /* unblock signal    */
-
-       c = loader_load(utf_new_char("java/lang/ArithmeticException"));
-       p = builtin_new(c);
-       m = class_findmethod(c, 
-                                                utf_new_char("<init>"), 
-                                                utf_new_char("(Ljava/lang/String;)V"));
-
-       asm_calljavamethod(m, p, javastring_new_char("/ by zero"), NULL, NULL);
-
-       sigctx->eax = (long) p;                              /* REG_ITMP1_XPTR    */
-       sigctx->edx = sigctx->eip;                           /* REG_ITMP2_XPC     */
-       sigctx->eip = (long) asm_handle_exception;
-
-       return;
-}
-
-void init_exceptions(void)
-{
-       /* install signal handlers we need to convert to exceptions */
-
-       if (!checknull) {
-
-#if defined(SIGSEGV)
-               signal(SIGSEGV, (void *) catch_NullPointerException);
-#endif
-
-#if defined(SIGBUS)
-               signal(SIGBUS, (void *) catch_NullPointerException);
-#endif
-       }
-
-       signal(SIGFPE, (void *) catch_ArithmeticException);
-}
-
-
-/* function gen_mcode **********************************************************
-
-       generates machine code
-
-*******************************************************************************/
-
-u1          *mcodeptr;
-
-static void gen_mcode()
-{
-       int  len, s1, s2, s3, d/*, bbs*/;
-       s4   a;
-       stackptr    src;
-       varinfo     *var;
-/*     varinfo     *dst; */
-       basicblock  *bptr;
-       instruction *iptr;
-
-       int fpu_st_offset = 0;
-
-       xtable *ex;
-
-       {
-       int p, pa, t, l, r;
-
-       savedregs_num = 0;
-
-       /* space to save used callee saved registers */
-
-       savedregs_num += (savintregcnt - maxsavintreguse);
-       savedregs_num += (savfltregcnt - maxsavfltreguse);
-
-       parentargs_base = maxmemuse + savedregs_num;
-
-#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               parentargs_base++;
-
-#endif
-
-       /* create method header */
-
-       (void) dseg_addaddress(method);                         /* MethodPointer  */
-       (void) dseg_adds4(parentargs_base * 8);                 /* FrameSize      */
-
-#ifdef USE_THREADS
-
-       /* IsSync contains the offset relative to the stack pointer for the
-          argument of monitor_exit used in the exception handler. Since the
-          offset could be zero and give a wrong meaning of the flag it is
-          offset by one.
-       */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               (void) dseg_adds4((maxmemuse + 1) * 8);             /* IsSync         */
-       else
-
-#endif
-
-       (void) dseg_adds4(0);                                   /* IsSync         */
-                                              
-       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
-       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
-       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
-       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
-
-       /* create exception table */
-
-       for (ex = extable; ex != NULL; ex = ex->down) {
-
-#ifdef LOOP_DEBUG      
-               if (ex->start != NULL)
-                       printf("adding start - %d - ", ex->start->debug_nr);
-               else {
-                       printf("PANIC - start is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->start);
-
-#ifdef LOOP_DEBUG                      
-               if (ex->end != NULL)
-                       printf("adding end - %d - ", ex->end->debug_nr);
-               else {
-                       printf("PANIC - end is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->end);
-
-#ifdef LOOP_DEBUG              
-               if (ex->handler != NULL)
-                       printf("adding handler - %d\n", ex->handler->debug_nr);
-               else {
-                       printf("PANIC - handler is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->handler);
-          
-               (void) dseg_addaddress(ex->catchtype);
-       }
-       
-       /* initialize mcode variables */
-       
-       mcodeptr = (u1*) mcodebase;
-       mcodeend = (s4*) (mcodebase + mcodesize);
-       MCODECHECK(128 + mparamcount);
-
-       /* create stack frame (if necessary) */
-
-       if (parentargs_base) {
-               i386_alu_imm_reg(I386_SUB, parentargs_base * 8, REG_SP);
-       }
-
-       /* save return address and used callee saved registers */
-
-       p = parentargs_base;
-       for (r = savintregcnt - 1; r >= maxsavintreguse; r--) {
-               p--; i386_mov_reg_membase(savintregs[r], REG_SP, p * 8);
-       }
-       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--) {
-               p--; i386_fld_reg(savfltregs[r]); i386_fstpl_membase(REG_SP, p * 8);
-       }
-
-       /* save monitorenter argument */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               if (method->flags & ACC_STATIC) {
-                       i386_mov_imm_reg((s4) class, REG_ITMP1);
-                       i386_mov_reg_membase(REG_ITMP1, REG_SP, maxmemuse * 8);
-
-               } else {
-                       i386_mov_membase_reg(REG_SP, parentargs_base * 8 + 4, REG_ITMP1);
-                       i386_mov_reg_membase(REG_ITMP1, REG_SP, maxmemuse * 8);
-               }
-       }                       
-#endif
-
-       /* copy argument registers to stack and call trace function with pointer
-          to arguments on stack.
-       */
-
-       if (runverbose) {
-               i386_alu_imm_reg(I386_SUB, TRACE_ARGS_NUM * 8 + 4, REG_SP);
-
-               for (p = 0; p < mparamcount; p++) {
-                       t = mparamtypes[p];
-                       if (IS_INT_LNG_TYPE(t)) {
-                               if (IS_2_WORD_TYPE(t)) {
-                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
-                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4 + 4, REG_ITMP2);
-
-                               } else if (t == TYPE_ADR) {
-                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
-                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
-
-                               } else {
-                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
-                                       i386_cltd();
-                               }
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
-                               i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
-
-                       } else {
-                               if (t == TYPE_FLT) {
-                                       i386_flds_membase(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4);
-                                       i386_fstps_membase(REG_SP, p * 8);
-                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
-                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
-
-                               } else {
-                                       i386_fldl_membase(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4);
-                                       i386_fstpl_membase(REG_SP, p * 8);
-                               }
-                       }
-               }
-
-               /* fill up the remaining arguments */
-               i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
-               for (p = mparamcount; p < TRACE_ARGS_NUM; p++) {
-                       i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
-                       i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8 + 4);
-               }
-
-               i386_mov_imm_membase((s4) method, REG_SP, TRACE_ARGS_NUM * 8);
-
-               i386_mov_imm_reg((s4) builtin_trace_args, REG_ITMP1);
-/*             i386_mov_imm_reg(asm_builtin_trace, REG_ITMP1); */
-               i386_call_reg(REG_ITMP1);
-
-               i386_alu_imm_reg(I386_ADD, TRACE_ARGS_NUM * 8 + 4, REG_SP);
-       }
-
-       /* take arguments out of register or stack frame */
-
-       for (p = 0, l = 0; p < mparamcount; p++) {
-               t = mparamtypes[p];
-               var = &(locals[l][t]);
-               l++;
-               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
-                       l++;
-               if (var->type < 0)
-                       continue;
-               r = var->regoff; 
-               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
-                       if (p < intreg_argnum) {                 /* register arguments    */
-                               panic("integer register argument");
-                               if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
-/*                                     M_INTMOVE (argintregs[p], r); */
-
-                               } else {                             /* reg arg -> spilled    */
-/*                                     M_LST (argintregs[p], REG_SP, 8 * r); */
-                               }
-                       } else {                                 /* stack arguments       */
-                               pa = p - intreg_argnum;
-                               if (!(var->flags & INMEMORY)) {      /* stack arg -> register */ 
-                                       i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, r);            /* + 4 for return address */
-                               } else {                             /* stack arg -> spilled  */
-                                       if (!IS_2_WORD_TYPE(t)) {
-                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1);    /* + 4 for return address */
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1);    /* + 4 for return address */
-                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4 + 4, REG_ITMP2);    /* + 4 for return address */
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, r * 8 + 4);
-                                       }
-                               }
-                       }
-               
-               } else {                                     /* floating args         */   
-                       if (p < fltreg_argnum) {                 /* register arguments    */
-                               if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
-                                       panic("There are no float argument registers!");
-
-                               } else {                                         /* reg arg -> spilled    */
-                                       panic("There are no float argument registers!");
-                               }
-
-                       } else {                                 /* stack arguments       */
-                               pa = p - fltreg_argnum;
-                               if (!(var->flags & INMEMORY)) {      /* stack-arg -> register */
-                                       if (t == TYPE_FLT) {
-                                               i386_flds_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
-                                               fpu_st_offset++;
-                                               i386_fstp_reg(r + fpu_st_offset);
-                                               fpu_st_offset--;
-
-                                       } else {
-                                               i386_fldl_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
-                                               fpu_st_offset++;
-                                               i386_fstp_reg(r + fpu_st_offset);
-                                               fpu_st_offset--;
-                                       }
-
-                               } else {                              /* stack-arg -> spilled  */
-/*                                     i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1); */
-/*                                     i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8); */
-                                       if (t == TYPE_FLT) {
-                                               i386_flds_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
-                                               i386_fstps_membase(REG_SP, r * 8);
-
-                                       } else {
-                                               i386_fldl_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
-                                               i386_fstpl_membase(REG_SP, r * 8);
-                                       }
-                               }
-                       }
-               }
-       }  /* end for */
-
-       /* call monitorenter function */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               i386_mov_membase_reg(REG_SP, maxmemuse * 8, REG_ITMP1);
-               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
-               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
-               i386_mov_imm_reg((s4) builtin_monitorenter, REG_ITMP2);
-               i386_call_reg(REG_ITMP2);
-               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
-       }                       
-#endif
-       }
-
-       /* end of header generation */
-
-       /* walk through all basic blocks */
-       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
-
-               bptr->mpc = (int)((u1*) mcodeptr - mcodebase);
-
-               if (bptr->flags >= BBREACHED) {
-
-               /* branch resolving */
-
-               branchref *brefs;
-               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
-                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
-                                         brefs->branchpos, bptr->mpc);
-               }
-
-               /* copy interface registers to their destination */
-
-               src = bptr->instack;
-               len = bptr->indepth;
-               MCODECHECK(64+len);
-               while (src != NULL) {
-                       len--;
-                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
-                               if (!IS_2_WORD_TYPE(src->type)) {
-                                       if (bptr->type == BBTYPE_SBR) {
-                                               d = reg_of_var(src, REG_ITMP1);
-                                               i386_pop_reg(d);
-                                               store_reg_to_var_int(src, d);
-
-                                       } else if (bptr->type == BBTYPE_EXH) {
-                                               d = reg_of_var(src, REG_ITMP1);
-                                               M_INTMOVE(REG_ITMP1, d);
-                                               store_reg_to_var_int(src, d);
-                                       }
-
-                               } else {
-                                       panic("copy interface registers: longs have to me in memory (begin 1)");
-                               }
-
-                       } else {
-                               d = reg_of_var(src, REG_ITMP1);
-                               if ((src->varkind != STACKVAR)) {
-                                       s2 = src->type;
-                                       if (IS_FLT_DBL_TYPE(s2)) {
-                                               s1 = interfaces[len][s2].regoff;
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       M_FLTMOVE(s1, d);
-
-                                               } else {
-                                                       if (s2 == TYPE_FLT) {
-                                                               i386_flds_membase(REG_SP, s1 * 8);
-
-                                                       } else {
-                                                               i386_fldl_membase(REG_SP, s1 * 8);
-                                                       }
-                                               }
-                                               store_reg_to_var_flt(src, d);
-
-                                       } else {
-                                               s1 = interfaces[len][s2].regoff;
-                                               if (!IS_2_WORD_TYPE(interfaces[len][s2].type)) {
-                                                       if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                               M_INTMOVE(s1, d);
-
-                                                       } else {
-                                                               i386_mov_membase_reg(REG_SP, s1 * 8, d);
-                                                       }
-                                                       store_reg_to_var_int(src, d);
-
-                                               } else {
-                                                       if (interfaces[len][s2].flags & INMEMORY) {
-                                                               M_LNGMEMMOVE(s1, src->regoff);
-
-                                                       } else {
-                                                               panic("copy interface registers: longs have to be in memory (begin 2)");
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-                       src = src->prev;
-               }
-
-               /* walk through all instructions */
-               
-               src = bptr->instack;
-               len = bptr->icount;
-               for (iptr = bptr->iinstr;
-                   len > 0;
-                   src = iptr->dst, len--, iptr++) {
-
-       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
-       switch (iptr->opc) {
-
-               case ICMD_NOP:        /* ...  ==> ...                                 */
-                       break;
-
-               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_test_reg_reg(src->regoff, src->regoff);
-                       }
-                       i386_jcc(I386_CC_E, 0);
-                       mcode_addxnullrefs(mcodeptr);
-                       break;
-
-               /* constant operations ************************************************/
-
-               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.i = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_mov_imm_membase(iptr->val.i, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               if (iptr->val.i == 0) {
-                                       i386_alu_reg_reg(I386_XOR, d, d);
-
-                               } else {
-                                       i386_mov_imm_reg(iptr->val.i, d);
-                               }
-                       }
-                       break;
-
-               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.l = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_mov_imm_membase(iptr->val.l, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_imm_membase(iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
-                               
-                       } else {
-                               panic("LCONST: longs have to be in memory");
-                       }
-                       break;
-
-               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.f = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if (iptr->val.f == 0.0) {
-                               i386_fldz();
-                               fpu_st_offset++;
-
-                               /* -0.0 */
-                               if (iptr->val.i == 0x80000000) {
-                                       i386_fchs();
-                               }
-
-                       } else if (iptr->val.f == 1.0) {
-                               i386_fld1();
-                               fpu_st_offset++;
-
-                       } else if (iptr->val.f == 2.0) {
-                               i386_fld1();
-                               i386_fld1();
-                               i386_faddp();
-                               fpu_st_offset++;
-
-                       } else {
-                               a = dseg_addfloat(iptr->val.f);
-                               i386_mov_imm_reg(0, REG_ITMP1);
-                               dseg_adddata(mcodeptr);
-                               i386_flds_membase(REG_ITMP1, a);
-                               fpu_st_offset++;
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-               
-               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.d = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if (iptr->val.d == 0.0) {
-                               i386_fldz();
-                               fpu_st_offset++;
-
-                               /* -0.0 */
-                               if (iptr->val.l == 0x8000000000000000LL) {
-                                       i386_fchs();
-                               }
-
-                       } else if (iptr->val.d == 1.0) {
-                               i386_fld1();
-                               fpu_st_offset++;
-
-                       } else if (iptr->val.d == 2.0) {
-                               i386_fld1();
-                               i386_fld1();
-                               i386_faddp();
-                               fpu_st_offset++;
-
-                       } else {
-                               a = dseg_adddouble(iptr->val.d);
-                               i386_mov_imm_reg(0, REG_ITMP1);
-                               dseg_adddata(mcodeptr);
-                               i386_fldl_membase(REG_ITMP1, a);
-                               fpu_st_offset++;
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.a = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_mov_imm_membase((s4) iptr->val.a, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               if ((s4) iptr->val.a == 0) {
-                                       i386_alu_reg_reg(I386_XOR, d, d);
-
-                               } else {
-                                       i386_mov_imm_reg((s4) iptr->val.a, d);
-                               }
-                       }
-                       break;
-
-
-               /* load/store operations **********************************************/
-
-               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_ALOAD:      /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (var->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, var->regoff * 8, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       i386_mov_reg_membase(var->regoff, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (var->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, var->regoff * 8, iptr->dst->regoff);
-
-                               } else {
-                                       M_INTMOVE(var->regoff, iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-               case ICMD_LLOAD:      /* ...  ==> ..., content of local variable      */
-                                     /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (var->flags & INMEMORY) {
-                                       M_LNGMEMMOVE(var->regoff, iptr->dst->regoff);
-
-                               } else {
-                                       panic("LLOAD: longs have to be in memory");
-                               }
-
-                       } else {
-                               panic("LLOAD: longs have to be in memory");
-                       }
-                       break;
-
-               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
-                                     /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY) {
-                               i386_flds_membase(REG_SP, var->regoff * 8);
-                               fpu_st_offset++;
-                       } else {
-                               i386_fld_reg(var->regoff + fpu_st_offset);
-                               fpu_st_offset++;
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DLOAD:      /* ...  ==> ..., content of local variable      */
-                                     /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY) {
-                               i386_fldl_membase(REG_SP, var->regoff * 8);
-                               fpu_st_offset++;
-                       } else {
-                               i386_fld_reg(var->regoff + fpu_st_offset);
-                               fpu_st_offset++;
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
-               case ICMD_ASTORE:     /* op1 = local variable                         */
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, var->regoff * 8);
-                                       
-                               } else {
-                                       i386_mov_reg_membase(src->regoff, REG_SP, var->regoff * 8);
-                               }
-
-                       } else {
-                               var_to_reg_int(s1, src, var->regoff);
-                               M_INTMOVE(s1, var->regoff);
-                       }
-                       break;
-
-               case ICMD_LSTORE:     /* ..., value  ==> ...                          */
-                                     /* op1 = local variable                         */
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       M_LNGMEMMOVE(src->regoff, var->regoff);
-
-                               } else {
-                                       panic("LSTORE: longs have to be in memory");
-                               }
-
-                       } else {
-                               panic("LSTORE: longs have to be in memory");
-                       }
-                       break;
-
-               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
-                                     /* op1 = local variable                         */
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               i386_fstps_membase(REG_SP, var->regoff * 8);
-                               fpu_st_offset--;
-                       } else {
-                               var_to_reg_flt(s1, src, var->regoff);
-/*                             M_FLTMOVE(s1, var->regoff); */
-                               i386_fstp_reg(var->regoff + fpu_st_offset);
-                               fpu_st_offset--;
-                       }
-                       break;
-
-               case ICMD_DSTORE:     /* ..., value  ==> ...                          */
-                                     /* op1 = local variable                         */
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               i386_fstpl_membase(REG_SP, var->regoff * 8);
-                               fpu_st_offset--;
-                       } else {
-                               var_to_reg_flt(s1, src, var->regoff);
-/*                             M_FLTMOVE(s1, var->regoff); */
-                               i386_fstp_reg(var->regoff + fpu_st_offset);
-                               fpu_st_offset--;
-                       }
-                       break;
-
-
-               /* pop/dup/swap operations ********************************************/
-
-               /* attention: double and longs are only one entry in CACAO ICMDs      */
-
-               case ICMD_POP:        /* ..., value  ==> ...                          */
-               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
-                       break;
-
-#define M_COPY(from,to) \
-               d = reg_of_var(to, REG_ITMP1); \
-                       if ((from->regoff != to->regoff) || \
-                           ((from->flags ^ to->flags) & INMEMORY)) { \
-                               if (IS_FLT_DBL_TYPE(from->type)) { \
-                                       var_to_reg_flt(s1, from, d); \
-/*                                     M_FLTMOVE(s1, d);*/ \
-                                       store_reg_to_var_flt(to, d); \
-                               } else { \
-                    if (!IS_2_WORD_TYPE(from->type)) { \
-                        if (to->flags & INMEMORY) { \
-                             if (from->flags & INMEMORY) { \
-                                 i386_mov_membase_reg(REG_SP, from->regoff * 8, REG_ITMP1); \
-                                 i386_mov_reg_membase(REG_ITMP1, REG_SP, to->regoff * 8); \
-                             } else { \
-                                 i386_mov_reg_membase(from->regoff, REG_SP, to->regoff * 8); \
-                             } \
-                        } else { \
-                             if (from->flags & INMEMORY) { \
-                                 i386_mov_membase_reg(REG_SP, from->regoff * 8, to->regoff); \
-                             } else { \
-                                 i386_mov_reg_reg(from->regoff, to->regoff); \
-                             } \
-                        } \
-                    } else { \
-                        M_LNGMEMMOVE(from->regoff, to->regoff); \
-                    } \
-                               } \
-                       }
-
-               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
-                       M_COPY(src, iptr->dst);
-                       break;
-
-               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
-
-                       M_COPY(src,       iptr->dst->prev->prev);
-
-               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
-
-                       M_COPY(src,       iptr->dst);
-                       M_COPY(src->prev, iptr->dst->prev);
-                       break;
-
-               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
-
-                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
-
-               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
-
-                       M_COPY(src,             iptr->dst);
-                       M_COPY(src->prev,       iptr->dst->prev);
-                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
-                       M_COPY(src, iptr->dst->prev->prev->prev);
-                       break;
-
-               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
-
-                       M_COPY(src,                   iptr->dst);
-                       M_COPY(src->prev,             iptr->dst->prev);
-                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
-                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
-                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
-                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
-                       break;
-
-               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
-
-                       M_COPY(src, iptr->dst->prev);
-                       M_COPY(src->prev, iptr->dst);
-                       break;
-
-
-               /* integer operations *************************************************/
-
-               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_neg_reg(REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else {
-                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-                                       i386_neg_reg(iptr->dst->regoff);
-
-                               } else {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       i386_neg_reg(iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-               case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
-                                               i386_alu_imm_membase(I386_ADC, 0, REG_SP, iptr->dst->regoff * 8 + 4);
-                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8 + 4);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                               i386_neg_reg(REG_ITMP1);
-                                               i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
-                                               i386_neg_reg(REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_EAX);
-                                       i386_cltd();
-                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
-                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                               } else {
-                                       M_INTMOVE(src->regoff, I386_EAX);
-                                       i386_cltd();
-                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
-                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
-                               }
-                       }
-                       break;
-
-               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_shift_imm_reg(I386_SHL, 24, REG_ITMP1);
-                                       i386_shift_imm_reg(I386_SAR, 24, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       i386_shift_imm_membase(I386_SHL, 24, REG_SP, iptr->dst->regoff * 8);
-                                       i386_shift_imm_membase(I386_SAR, 24, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-                                       i386_shift_imm_reg(I386_SHL, 24, iptr->dst->regoff);
-                                       i386_shift_imm_reg(I386_SAR, 24, iptr->dst->regoff);
-
-                               } else {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       i386_shift_imm_reg(I386_SHL, 24, iptr->dst->regoff);
-                                       i386_shift_imm_reg(I386_SAR, 24, iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               i386_alu_imm_membase(I386_AND, 0x0000ffff, REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_alu_imm_reg(I386_AND, 0x0000ffff, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else {
-                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       i386_alu_imm_membase(I386_AND, 0x0000ffff, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-                                       i386_alu_imm_reg(I386_AND, 0x0000ffff, iptr->dst->regoff);
-
-                               } else {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       i386_alu_imm_reg(I386_AND, 0x0000ffff, iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_shift_imm_reg(I386_SHL, 16, REG_ITMP1);
-                                       i386_shift_imm_reg(I386_SAR, 16, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       i386_shift_imm_membase(I386_SHL, 16, REG_SP, iptr->dst->regoff * 8);
-                                       i386_shift_imm_membase(I386_SAR, 16, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-                                       i386_shift_imm_reg(I386_SHL, 16, iptr->dst->regoff);
-                                       i386_shift_imm_reg(I386_SAR, 16, iptr->dst->regoff);
-
-                               } else {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       i386_shift_imm_reg(I386_SHL, 16, iptr->dst->regoff);
-                                       i386_shift_imm_reg(I386_SAR, 16, iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-
-               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ialu(I386_ADD, src, iptr);
-                       break;
-
-               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       /* should we use a inc optimization for smaller code size? */
-                       i386_emit_ialuconst(I386_ADD, src, iptr);
-                       break;
-
-               case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-                                               i386_alu_reg_membase(I386_ADD, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_alu_reg_membase(I386_ADC, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                                       } else if (src->prev->regoff == iptr->dst->regoff) {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                               i386_alu_reg_membase(I386_ADD, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_alu_reg_membase(I386_ADC, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-                                               i386_alu_membase_reg(I386_ADD, REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_alu_membase_reg(I386_ADC, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                                       }
-
-                               }
-                       }
-                       break;
-
-               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               i386_alu_imm_membase(I386_ADD, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
-                                               i386_alu_imm_membase(I386_ADC, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                               i386_alu_imm_reg(I386_ADD, iptr->val.l, REG_ITMP1);
-                                               i386_alu_imm_reg(I386_ADC, iptr->val.l >> 32, REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       if (src->prev->regoff == iptr->dst->regoff) {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_alu_reg_membase(I386_SUB, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       if (src->prev->regoff == iptr->dst->regoff) {
-                                               i386_alu_reg_membase(I386_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else {
-                                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       i386_alu_reg_membase(I386_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, d);
-                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, d);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, d);
-                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, d);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       /* workaround for reg alloc */
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
-                                               M_INTMOVE(REG_ITMP1, d);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, d);
-                                               i386_alu_reg_reg(I386_SUB, src->regoff, d);
-                                       }
-
-                               } else {
-                                       /* workaround for reg alloc */
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
-                                               M_INTMOVE(REG_ITMP1, d);
-
-                                       } else {
-                                               M_INTMOVE(src->prev->regoff, d);
-                                               i386_alu_reg_reg(I386_SUB, src->regoff, d);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ialuconst(I386_SUB, src, iptr);
-                       break;
-
-               case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       if (src->prev->regoff == iptr->dst->regoff) {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                               i386_alu_reg_membase(I386_SUB, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_alu_reg_membase(I386_SBB, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-                                               i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_alu_membase_reg(I386_SBB, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               i386_alu_imm_membase(I386_SUB, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
-                                               i386_alu_imm_membase(I386_SBB, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                                       } else {
-                                               /* TODO: could be size optimized with lea -- see gcc output */
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                               i386_alu_imm_reg(I386_SUB, iptr->val.l, REG_ITMP1);
-                                               i386_alu_imm_reg(I386_SBB, iptr->val.l >> 32, REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_imul_reg_reg(src->prev->regoff, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                       i386_imul_reg_reg(src->regoff, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       i386_mov_reg_reg(src->prev->regoff, REG_ITMP1);
-                                       i386_imul_reg_reg(src->regoff, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       i386_imul_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-
-                               } else {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               i386_imul_reg_reg(src->prev->regoff, iptr->dst->regoff);
-
-                                       } else {
-                                               M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                                               i386_imul_reg_reg(src->regoff, iptr->dst->regoff);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       i386_imul_imm_membase_reg(iptr->val.i, REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       i386_imul_imm_reg_reg(iptr->val.i, src->regoff, REG_ITMP1);
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       i386_imul_imm_membase_reg(iptr->val.i, REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else {
-                                       i386_imul_imm_reg_reg(iptr->val.i, src->regoff, iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-               case ICMD_LMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);        /* mem -> EAX             */
-                                       /* optimize move EAX -> REG_ITMP3 is slower??? */
-/*                                     i386_mov_reg_reg(I386_EAX, REG_ITMP3); */
-                                       i386_mul_membase(REG_SP, src->regoff * 8);                            /* mem * EAX -> EDX:EAX   */
-
-                                       /* TODO: optimize move EAX -> REG_ITMP3 */
-                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP3);   /* mem -> ITMP3           */
-                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);            /* mem * ITMP3 -> ITMP3   */
-                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
-
-                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP3);       /* mem -> ITMP3           */
-                                       i386_imul_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);        /* mem * ITMP3 -> ITMP3   */
-
-                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
-                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
-                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
-                               }
-                       }
-                       break;
-
-               case ICMD_LMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       i386_mov_imm_reg(iptr->val.l, I386_EAX);                              /* imm -> EAX             */
-                                       i386_mul_membase(REG_SP, src->regoff * 8);                            /* mem * EAX -> EDX:EAX   */
-                                       /* TODO: optimize move EAX -> REG_ITMP3 */
-                                       i386_mov_imm_reg(iptr->val.l >> 32, REG_ITMP3);                       /* imm -> ITMP3           */
-                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);            /* mem * ITMP3 -> ITMP3   */
-
-                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
-                                       i386_mov_imm_reg(iptr->val.l, REG_ITMP3);                             /* imm -> ITMP3           */
-                                       i386_imul_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);        /* mem * ITMP3 -> ITMP3   */
-
-                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
-                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
-                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
-                               }
-                       }
-                       break;
-
-#define gen_div_check(v) \
-    if (checknull) { \
-        if ((v)->flags & INMEMORY) { \
-            i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8); \
-        } else { \
-            i386_test_reg_reg(src->regoff, src->regoff); \
-        } \
-        i386_jcc(I386_CC_E, 0); \
-        mcode_addxdivrefs(mcodeptr); \
-    }
-
-               case ICMD_IDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       var_to_reg_int(s1, src, REG_ITMP3);
-                       gen_div_check(src);
-               if (src->prev->flags & INMEMORY) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);
-
-                       } else {
-                               M_INTMOVE(src->prev->regoff, I386_EAX);
-                       }
-                       
-                       i386_alu_imm_reg(I386_CMP, 0x80000000, I386_EAX);    /* check as described in jvm spec */
-                       i386_jcc(I386_CC_NE, 3 + 6);
-                       i386_alu_imm_reg(I386_CMP, -1, s1);
-                       i386_jcc(I386_CC_E, 1 + 2);
-
-                       i386_cltd();
-                       i386_idiv_reg(s1);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               M_INTMOVE(I386_EAX, iptr->dst->regoff);
-                       }
-                       break;
-
-               case ICMD_IREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       var_to_reg_int(s1, src, REG_ITMP3);
-                       gen_div_check(src);
-                       if (src->prev->flags & INMEMORY) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);
-
-                       } else {
-                               M_INTMOVE(src->prev->regoff, I386_EAX);
-                       }
-                       
-                       i386_alu_imm_reg(I386_CMP, 0x80000000, I386_EAX);    /* check as described in jvm spec */
-                       i386_jcc(I386_CC_NE, 2 + 3 + 6);
-                       i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EDX);
-                       i386_alu_imm_reg(I386_CMP, -1, s1);
-                       i386_jcc(I386_CC_E, 1 + 2);
-
-                       i386_cltd();
-                       i386_idiv_reg(s1);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               M_INTMOVE(I386_EDX, iptr->dst->regoff);
-                       }
-                       break;
-
-               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       /* TODO: optimize for `/ 2' */
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-
-                       M_INTMOVE(s1, d);
-                       i386_test_reg_reg(d, d);
-                       a = 2;
-                       CALCIMMEDIATEBYTES(a, (1 << iptr->val.i) - 1);
-                       i386_jcc(I386_CC_NS, a);
-                       i386_alu_imm_reg(I386_ADD, (1 << iptr->val.i) - 1, d);
-                               
-                       i386_shift_imm_reg(I386_SAR, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LDIVPOW2:   /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       a = 2;
-                                       CALCIMMEDIATEBYTES(a, (1 << iptr->val.i) - 1);
-                                       a += 3;
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-
-                                       i386_test_reg_reg(REG_ITMP2, REG_ITMP2);
-                                       i386_jcc(I386_CC_NS, a);
-                                       i386_alu_imm_reg(I386_ADD, (1 << iptr->val.i) - 1, REG_ITMP1);
-                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
-                                       i386_shrd_imm_reg_reg(iptr->val.i, REG_ITMP2, REG_ITMP1);
-                                       i386_shift_imm_reg(I386_SAR, iptr->val.i, REG_ITMP2);
-
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                               }
-                       }
-                       break;
-
-               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP2);
-                       if (s1 == d) {
-                               M_INTMOVE(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                       } 
-
-                       a = 2;
-                       a += 2;
-                       a += 2;
-                       CALCIMMEDIATEBYTES(a, iptr->val.i);
-                       a += 2;
-
-                       /* TODO: optimize */
-                       M_INTMOVE(s1, d);
-                       i386_alu_imm_reg(I386_AND, iptr->val.i, d);
-                       i386_test_reg_reg(s1, s1);
-                       i386_jcc(I386_CC_GE, a);
-                       i386_mov_reg_reg(s1, d);
-                       i386_neg_reg(d);
-                       i386_alu_imm_reg(I386_AND, iptr->val.i, d);
-                       i386_neg_reg(d);
-
-/*                     M_INTMOVE(s1, I386_EAX); */
-/*                     i386_cltd(); */
-/*                     i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EAX); */
-/*                     i386_alu_reg_reg(I386_SUB, I386_EDX, I386_EAX); */
-/*                     i386_alu_reg_reg(I386_AND, iptr->val.i, I386_EAX); */
-/*                     i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EAX); */
-/*                     i386_alu_reg_reg(I386_SUB, I386_EDX, I386_EAX); */
-/*                     M_INTMOVE(I386_EAX, d); */
-
-/*                     i386_alu_reg_reg(I386_XOR, d, d); */
-/*                     i386_mov_imm_reg(iptr->val.i, I386_ECX); */
-/*                     i386_shrd_reg_reg(s1, d); */
-/*                     i386_shift_imm_reg(I386_SHR, 32 - iptr->val.i, d); */
-
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       /* Intel algorithm -- does not work, because constant is wrong */
-/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1); */
-/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3); */
-
-/*                                     M_INTMOVE(REG_ITMP1, REG_ITMP2); */
-/*                                     i386_test_reg_reg(REG_ITMP3, REG_ITMP3); */
-/*                                     i386_jcc(I386_CC_NS, offset); */
-/*                                     i386_alu_imm_reg(I386_ADD, (1 << iptr->val.l) - 1, REG_ITMP2); */
-/*                                     i386_alu_imm_reg(I386_ADC, 0, REG_ITMP3); */
-                                       
-/*                                     i386_shrd_imm_reg_reg(iptr->val.l, REG_ITMP3, REG_ITMP2); */
-/*                                     i386_shift_imm_reg(I386_SAR, iptr->val.l, REG_ITMP3); */
-/*                                     i386_shld_imm_reg_reg(iptr->val.l, REG_ITMP2, REG_ITMP3); */
-
-/*                                     i386_shift_imm_reg(I386_SHL, iptr->val.l, REG_ITMP2); */
-
-/*                                     i386_alu_reg_reg(I386_SUB, REG_ITMP2, REG_ITMP1); */
-/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2); */
-/*                                     i386_alu_reg_reg(I386_SBB, REG_ITMP3, REG_ITMP2); */
-
-/*                                     i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
-/*                                     i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
-
-                                       /* Alpha algorithm */
-                                       a = 3;
-                                       CALCOFFSETBYTES(a, src->regoff * 8);
-                                       a += 3;
-                                       CALCOFFSETBYTES(a, src->regoff * 8 + 4);
-
-                                       a += 2;
-                                       a += 3;
-                                       a += 2;
-
-                                       /* TODO: hmm, don't know if this is always correct */
-                                       a += 2;
-                                       CALCIMMEDIATEBYTES(a, iptr->val.l & 0x00000000ffffffff);
-                                       a += 2;
-                                       CALCIMMEDIATEBYTES(a, iptr->val.l >> 32);
-
-                                       a += 2;
-                                       a += 3;
-                                       a += 2;
-
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                       
-                                       i386_alu_imm_reg(I386_AND, iptr->val.l, REG_ITMP1);
-                                       i386_alu_imm_reg(I386_AND, iptr->val.l >> 32, REG_ITMP2);
-                                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8 + 4);
-                                       i386_jcc(I386_CC_GE, a);
-
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                       
-                                       i386_neg_reg(REG_ITMP1);
-                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
-                                       i386_neg_reg(REG_ITMP2);
-                                       
-                                       i386_alu_imm_reg(I386_AND, iptr->val.l, REG_ITMP1);
-                                       i386_alu_imm_reg(I386_AND, iptr->val.l >> 32, REG_ITMP2);
-                                       
-                                       i386_neg_reg(REG_ITMP1);
-                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
-                                       i386_neg_reg(REG_ITMP2);
-
-                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                               }
-                       }
-                       break;
-
-               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ishift(I386_SHL, src, iptr);
-                       break;
-
-               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ishiftconst(I386_SHL, src, iptr);
-                       break;
-
-               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ishift(I386_SAR, src, iptr);
-                       break;
-
-               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ishiftconst(I386_SAR, src, iptr);
-                       break;
-
-               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ishift(I386_SHR, src, iptr);
-                       break;
-
-               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ishiftconst(I386_SHR, src, iptr);
-                       break;
-
-               case ICMD_LSHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY ){
-                               if (src->prev->flags & INMEMORY) {
-/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
-/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
-
-/*                                             if (src->flags & INMEMORY) { */
-/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
-/*                                             } else { */
-/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
-/*                                             } */
-
-/*                                             i386_test_imm_reg(32, I386_ECX); */
-/*                                             i386_jcc(I386_CC_E, 2 + 2); */
-/*                                             i386_mov_reg_reg(REG_ITMP1, REG_ITMP2); */
-/*                                             i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1); */
-                                               
-/*                                             i386_shld_reg_membase(REG_ITMP1, REG_SP, src->prev->regoff * 8 + 4); */
-/*                                             i386_shift_membase(I386_SHL, REG_SP, iptr->dst->regoff * 8); */
-
-/*                                     } else { */
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-                                               
-                                               if (src->flags & INMEMORY) {
-                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
-                                               } else {
-                                                       M_INTMOVE(src->regoff, I386_ECX);
-                                               }
-                                               
-                                               i386_test_imm_reg(32, I386_ECX);
-                                               i386_jcc(I386_CC_E, 2 + 2);
-                                               i386_mov_reg_reg(REG_ITMP1, REG_ITMP2);
-                                               i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
-                                               
-                                               i386_shld_reg_reg(REG_ITMP1, REG_ITMP2);
-                                               i386_shift_reg(I386_SHL, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-/*                                     } */
-                               }
-                       }
-                       break;
-
-        case ICMD_LSHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                         /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY ) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-
-                               if (iptr->val.i & 0x20) {
-                                       i386_mov_reg_reg(REG_ITMP1, REG_ITMP2);
-                                       i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
-                                       i386_shld_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP1, REG_ITMP2);
-
-                               } else {
-                                       i386_shld_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP1, REG_ITMP2);
-                                       i386_shift_imm_reg(I386_SHL, iptr->val.i & 0x3f, REG_ITMP1);
-                               }
-
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                       }
-                       break;
-
-               case ICMD_LSHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY ){
-                               if (src->prev->flags & INMEMORY) {
-/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
-                                               /* TODO: optimize */
-/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
-/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2); */
-
-/*                                             if (src->flags & INMEMORY) { */
-/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
-/*                                             } else { */
-/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
-/*                                             } */
-
-/*                                             i386_test_imm_reg(32, I386_ECX); */
-/*                                             i386_jcc(I386_CC_E, 2 + 3); */
-/*                                             i386_mov_reg_reg(REG_ITMP2, REG_ITMP1); */
-/*                                             i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2); */
-                                               
-/*                                             i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1); */
-/*                                             i386_shift_reg(I386_SAR, REG_ITMP2); */
-/*                                             i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
-/*                                             i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
-
-/*                                     } else { */
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-
-                                               if (src->flags & INMEMORY) {
-                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
-                                               } else {
-                                                       M_INTMOVE(src->regoff, I386_ECX);
-                                               }
-
-                                               i386_test_imm_reg(32, I386_ECX);
-                                               i386_jcc(I386_CC_E, 2 + 3);
-                                               i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
-                                               i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2);
-                                               
-                                               i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1);
-                                               i386_shift_reg(I386_SAR, REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-/*                                     } */
-                               }
-                       }
-                       break;
-
-               case ICMD_LSHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY ) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-
-                               if (iptr->val.i & 0x20) {
-                                       i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
-                                       i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2);
-                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
-
-                               } else {
-                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
-                                       i386_shift_imm_reg(I386_SAR, iptr->val.i & 0x3f, REG_ITMP2);
-                               }
-
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                       }
-                       break;
-
-               case ICMD_LUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY ){
-                               if (src->prev->flags & INMEMORY) {
-/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
-                                               /* TODO: optimize */
-/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
-/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2); */
-
-/*                                             if (src->flags & INMEMORY) { */
-/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
-/*                                             } else { */
-/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
-/*                                             } */
-
-/*                                             i386_test_imm_reg(32, I386_ECX); */
-/*                                             i386_jcc(I386_CC_E, 2 + 2); */
-/*                                             i386_mov_reg_reg(REG_ITMP2, REG_ITMP1); */
-/*                                             i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2); */
-                                               
-/*                                             i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1); */
-/*                                             i386_shift_reg(I386_SHR, REG_ITMP2); */
-/*                                             i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
-/*                                             i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
-
-/*                                     } else { */
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-
-                                               if (src->flags & INMEMORY) {
-                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
-                                               } else {
-                                                       M_INTMOVE(src->regoff, I386_ECX);
-                                               }
-
-                                               i386_test_imm_reg(32, I386_ECX);
-                                               i386_jcc(I386_CC_E, 2 + 2);
-                                               i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
-                                               i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
-                                               
-                                               i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1);
-                                               i386_shift_reg(I386_SHR, REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-/*                                     } */
-                               }
-                       }
-                       break;
-
-               case ICMD_LUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY ) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-
-                               if (iptr->val.i & 0x20) {
-                                       i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
-                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
-                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
-
-                               } else {
-                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
-                                       i386_shift_imm_reg(I386_SHR, iptr->val.i & 0x3f, REG_ITMP2);
-                               }
-
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                       }
-                       break;
-
-               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ialu(I386_AND, src, iptr);
-                       break;
-
-               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ialuconst(I386_AND, src, iptr);
-                       break;
-
-               case ICMD_LAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_lalu(I386_AND, src, iptr);
-                       break;
-
-               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_laluconst(I386_AND, src, iptr);
-                       break;
-
-               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ialu(I386_OR, src, iptr);
-                       break;
-
-               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ialuconst(I386_OR, src, iptr);
-                       break;
-
-               case ICMD_LOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_lalu(I386_OR, src, iptr);
-                       break;
-
-               case ICMD_LORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_laluconst(I386_OR, src, iptr);
-                       break;
-
-               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ialu(I386_XOR, src, iptr);
-                       break;
-
-               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ialuconst(I386_XOR, src, iptr);
-                       break;
-
-               case ICMD_LXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_lalu(I386_XOR, src, iptr);
-                       break;
-
-               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_laluconst(I386_XOR, src, iptr);
-                       break;
-
-               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
-                                     /* op1 = variable, val.i = constant             */
-
-                       var = &(locals[iptr->op1][TYPE_INT]);
-                       if (var->flags & INMEMORY) {
-                               if (iptr->val.i == 1) {
-                                       i386_inc_membase(REG_SP, var->regoff * 8);
-                               } else if (iptr->val.i == -1) {
-                                       i386_dec_membase(REG_SP, var->regoff * 8);
-
-                               } else {
-                                       i386_alu_imm_membase(I386_ADD, iptr->val.i, REG_SP, var->regoff * 8);
-                               }
-
-                       } else {
-                               if (iptr->val.i == 1) {
-                                       i386_inc_reg(var->regoff);
-                               } else if (iptr->val.i == -1) {
-                                       i386_dec_reg(var->regoff);
-
-                               } else {
-                                       i386_alu_imm_reg(I386_ADD, iptr->val.i, var->regoff);
-                               }
-                       }
-                       break;
-
-
-               /* floating operations ************************************************/
-#if 0
-#define ROUND_TO_SINGLE \
-                       i386_fstps_membase(REG_SP, -8); \
-                       i386_flds_membase(REG_SP, -8);
-
-#define ROUND_TO_DOUBLE \
-                       i386_fstpl_membase(REG_SP, -8); \
-                       i386_fldl_membase(REG_SP, -8);
-
-#define FPU_SET_24BIT_MODE \
-                       if (!fpu_in_24bit_mode) { \
-                               i386_fldcw_mem(&fpu_ctrlwrd_24bit); \
-                               fpu_in_24bit_mode = 1; \
-                       }
-
-#define FPU_SET_53BIT_MODE \
-                       if (fpu_in_24bit_mode) { \
-                               i386_fldcw_mem(&fpu_ctrlwrd_53bit); \
-                               fpu_in_24bit_mode = 0; \
-                       }
-#else
-#define ROUND_TO_SINGLE
-#define ROUND_TO_DOUBLE
-#define FPU_SET_24BIT_MODE
-#define FPU_SET_53BIT_MODE
-#endif
-               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
-
-                       FPU_SET_24BIT_MODE;
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       i386_fchs();
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
-
-                       FPU_SET_53BIT_MODE;
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       i386_fchs();
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       FPU_SET_24BIT_MODE;
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       i386_faddp();
-                       fpu_st_offset--;
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       FPU_SET_53BIT_MODE;
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       i386_faddp();
-                       fpu_st_offset--;
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       FPU_SET_24BIT_MODE;
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       i386_fsubp();
-                       fpu_st_offset--;
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       FPU_SET_53BIT_MODE;
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       i386_fsubp();
-                       fpu_st_offset--;
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       FPU_SET_24BIT_MODE;
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       i386_fmulp();
-                       fpu_st_offset--;
-                       ROUND_TO_SINGLE;
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       FPU_SET_53BIT_MODE;
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-
-/*                     i386_fldt_mem(subnormal_bias1); */
-/*                     i386_fmulp(); */
-
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-
-                       i386_fmulp();
-                       fpu_st_offset--;
-
-/*                     i386_fldt_mem(subnormal_bias2); */
-/*                     i386_fmulp(); */
-
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       FPU_SET_24BIT_MODE;
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       i386_fdivp();
-                       fpu_st_offset--;
-                       ROUND_TO_SINGLE;
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       FPU_SET_53BIT_MODE;
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-
-/*                     i386_fldt_mem(subnormal_bias1); */
-/*                     i386_fmulp(); */
-
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-
-                       i386_fdivp();
-                       fpu_st_offset--;
-
-/*                     i386_fldt_mem(subnormal_bias2); */
-/*                     i386_fmulp(); */
-
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       FPU_SET_24BIT_MODE;
-                       /* exchanged to skip fxch */
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-/*                     i386_fxch(); */
-                       i386_fprem();
-                       i386_wait();
-                       i386_fnstsw();
-                       i386_sahf();
-                       i386_jcc(I386_CC_P, -(2 + 1 + 2 + 1 + 6));
-                       store_reg_to_var_flt(iptr->dst, d);
-                       i386_ffree_reg(0);
-                       i386_fincstp();
-                       fpu_st_offset--;
-                       break;
-
-               case ICMD_DREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       FPU_SET_53BIT_MODE;
-                       /* exchanged to skip fxch */
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-/*                     i386_fxch(); */
-                       i386_fprem();
-                       i386_wait();
-                       i386_fnstsw();
-                       i386_sahf();
-                       i386_jcc(I386_CC_P, -(2 + 1 + 2 + 1 + 6));
-                       store_reg_to_var_flt(iptr->dst, d);
-                       i386_ffree_reg(0);
-                       i386_fincstp();
-                       fpu_st_offset--;
-                       break;
-
-               case ICMD_I2F:       /* ..., value  ==> ..., (float) value            */
-               case ICMD_I2D:       /* ..., value  ==> ..., (double) value           */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if (src->flags & INMEMORY) {
-                               i386_fildl_membase(REG_SP, src->regoff * 8);
-                               fpu_st_offset++;
-
-                       } else {
-                               a = dseg_adds4(0);
-                               i386_mov_imm_reg(0, REG_ITMP1);
-                               dseg_adddata(mcodeptr);
-                               i386_mov_reg_membase(src->regoff, REG_ITMP1, a);
-                               i386_fildl_membase(REG_ITMP1, a);
-                               fpu_st_offset++;
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_L2F:       /* ..., value  ==> ..., (float) value            */
-               case ICMD_L2D:       /* ..., value  ==> ..., (double) value           */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if (src->flags & INMEMORY) {
-                               i386_fildll_membase(REG_SP, src->regoff * 8);
-                               fpu_st_offset++;
-
-                       } else {
-                               panic("L2F: longs have to be in memory");
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-                       
-               case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-
-                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
-                       i386_mov_imm_reg(0, REG_ITMP1);
-                       dseg_adddata(mcodeptr);
-                       i386_fldcw_membase(REG_ITMP1, a);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_fistpl_membase(REG_SP, iptr->dst->regoff * 8);
-                               fpu_st_offset--;
-
-                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
-                               i386_fldcw_membase(REG_ITMP1, a);
-
-                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8);
-
-                               a = 3;
-                               CALCOFFSETBYTES(a, src->regoff * 8);
-                               a += 5 + 2 + 3;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
-
-                       } else {
-                               a = dseg_adds4(0);
-                               i386_fistpl_membase(REG_ITMP1, a);
-                               fpu_st_offset--;
-                               i386_mov_membase_reg(REG_ITMP1, a, iptr->dst->regoff);
-
-                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
-                               i386_fldcw_membase(REG_ITMP1, a);
-
-                               i386_alu_imm_reg(I386_CMP, 0x80000000, iptr->dst->regoff);
-
-                               a = 3;
-                               CALCOFFSETBYTES(a, src->regoff * 8);
-                               a += 5 + 2 + ((REG_RESULT == d) ? 0 : 2);
-                       }
-
-                       i386_jcc(I386_CC_NE, a);
-
-                               /* XXX: change this when we use registers */
-                       i386_flds_membase(REG_SP, src->regoff * 8);
-                       i386_mov_imm_reg((s4) asm_builtin_f2i, REG_ITMP2);
-                       i386_call_reg(REG_ITMP2);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               M_INTMOVE(REG_RESULT, d);
-                       }
-                       break;
-
-               case ICMD_D2I:       /* ..., value  ==> ..., (int) value              */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-
-                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
-                       i386_mov_imm_reg(0, REG_ITMP1);
-                       dseg_adddata(mcodeptr);
-                       i386_fldcw_membase(REG_ITMP1, a);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_fistpl_membase(REG_SP, iptr->dst->regoff * 8);
-                               fpu_st_offset--;
-
-                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
-                               i386_fldcw_membase(REG_ITMP1, a);
-
-                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8);
-
-                               a = 3;
-                               CALCOFFSETBYTES(a, src->regoff * 8);
-                               a += 5 + 2 + 3;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
-
-                       } else {
-                               a = dseg_adds4(0);
-                               i386_fistpl_membase(REG_ITMP1, a);
-                               fpu_st_offset--;
-                               i386_mov_membase_reg(REG_ITMP1, a, iptr->dst->regoff);
-
-                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
-                               i386_fldcw_membase(REG_ITMP1, a);
-
-                               i386_alu_imm_reg(I386_CMP, 0x80000000, iptr->dst->regoff);
-
-                               a = 3;
-                               CALCOFFSETBYTES(a, src->regoff * 8);
-                               a += 5 + 2 + ((REG_RESULT == d) ? 0 : 2);
-                       }
-
-                       i386_jcc(I386_CC_NE, a);
-
-                       /* XXX: change this when we use registers */
-                       i386_fldl_membase(REG_SP, src->regoff * 8);
-                       i386_mov_imm_reg((s4) asm_builtin_d2i, REG_ITMP2);
-                       i386_call_reg(REG_ITMP2);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
-                       } else {
-                               M_INTMOVE(REG_RESULT, d);
-                       }
-                       break;
-
-               case ICMD_F2L:       /* ..., value  ==> ..., (long) value             */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-
-                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
-                       i386_mov_imm_reg(0, REG_ITMP1);
-                       dseg_adddata(mcodeptr);
-                       i386_fldcw_membase(REG_ITMP1, a);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_fistpll_membase(REG_SP, iptr->dst->regoff * 8);
-                               fpu_st_offset--;
-
-                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
-                               i386_fldcw_membase(REG_ITMP1, a);
-
-                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                               a = 6 + 4;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
-                               a += 3;
-                               CALCOFFSETBYTES(a, src->regoff * 8);
-                               a += 5 + 2;
-                               a += 3;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
-                               a += 3;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8 + 4);
-
-                               i386_jcc(I386_CC_NE, a);
-
-                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, iptr->dst->regoff * 8);
-
-                               a = 3;
-                               CALCOFFSETBYTES(a, src->regoff * 8);
-                               a += 5 + 2 + 3;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
-
-                               i386_jcc(I386_CC_NE, a);
-
-                               /* XXX: change this when we use registers */
-                               i386_flds_membase(REG_SP, src->regoff * 8);
-                               i386_mov_imm_reg((s4) asm_builtin_f2l, REG_ITMP2);
-                               i386_call_reg(REG_ITMP2);
-                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                       } else {
-                               panic("F2L: longs have to be in memory");
-                       }
-                       break;
-
-               case ICMD_D2L:       /* ..., value  ==> ..., (long) value             */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-
-                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
-                       i386_mov_imm_reg(0, REG_ITMP1);
-                       dseg_adddata(mcodeptr);
-                       i386_fldcw_membase(REG_ITMP1, a);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_fistpll_membase(REG_SP, iptr->dst->regoff * 8);
-                               fpu_st_offset--;
-
-                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
-                               i386_fldcw_membase(REG_ITMP1, a);
-
-                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                               a = 6 + 4;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
-                               a += 3;
-                               CALCOFFSETBYTES(a, src->regoff * 8);
-                               a += 5 + 2;
-                               a += 3;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
-                               a += 3;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8 + 4);
-
-                               i386_jcc(I386_CC_NE, a);
-
-                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, iptr->dst->regoff * 8);
-
-                               a = 3;
-                               CALCOFFSETBYTES(a, src->regoff * 8);
-                               a += 5 + 2 + 3;
-                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
-
-                               i386_jcc(I386_CC_NE, a);
-
-                               /* XXX: change this when we use registers */
-                               i386_fldl_membase(REG_SP, src->regoff * 8);
-                               i386_mov_imm_reg((s4) asm_builtin_d2l, REG_ITMP2);
-                               i386_call_reg(REG_ITMP2);
-                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                       } else {
-                               panic("D2L: longs have to be in memory");
-                       }
-                       break;
-
-               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       /* nothing to do */
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_D2F:       /* ..., value  ==> ..., (float) value            */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       /* nothing to do */
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
-               case ICMD_DCMPL:
-
-                       /* exchanged to skip fxch */
-                       var_to_reg_flt(s2, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s1, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP2);
-                       i386_alu_reg_reg(I386_XOR, d, d);
-/*                     i386_fxch(); */
-                       i386_fucompp();
-                       fpu_st_offset -= 2;
-                       i386_fnstsw();
-                       i386_test_imm_reg(0x400, I386_EAX);    /* unordered treat as GT */
-                       i386_jcc(I386_CC_E, 6);
-                       i386_alu_imm_reg(I386_AND, 0x000000ff, I386_EAX);
-                       i386_sahf();
-                       i386_jcc(I386_CC_E, 6 + 1 + 5 + 1);
-                       i386_jcc(I386_CC_B, 1 + 5);
-                       i386_dec_reg(d);
-                       i386_jmp_imm(1);
-                       i386_inc_reg(d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
-               case ICMD_DCMPG:
-
-                       /* exchanged to skip fxch */
-                       var_to_reg_flt(s2, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s1, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP2);
-                       i386_alu_reg_reg(I386_XOR, d, d);
-/*                     i386_fxch(); */
-                       i386_fucompp();
-                       fpu_st_offset -= 2;
-                       i386_fnstsw();
-                       i386_test_imm_reg(0x400, I386_EAX);    /* unordered treat as LT */
-                       i386_jcc(I386_CC_E, 3);
-                       i386_movb_imm_reg(1, I386_AH);
-                       i386_sahf();
-                       i386_jcc(I386_CC_E, 6 + 1 + 5 + 1);
-                       i386_jcc(I386_CC_B, 1 + 5);
-                       i386_dec_reg(d);
-                       i386_jmp_imm(1);
-                       i386_inc_reg(d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               /* memory operations **************************************************/
-
-#define gen_bound_check \
-    if (checkbounds) { \
-        i386_alu_membase_reg(I386_CMP, s1, OFFSET(java_arrayheader, size), s2); \
-        i386_jcc(I386_CC_AE, 0); \
-        mcode_addxboundrefs(mcodeptr); \
-    }
-
-               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., length              */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP2);
-                       gen_nullptr_check(s1);
-                       i386_mov_membase_reg(s1, OFFSET(java_arrayheader, size), d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       i386_mov_memindex_reg(OFFSET(java_objectarray, data[0]), s1, s2, 2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       
-                       if (iptr->dst->flags & INMEMORY) {
-                               i386_mov_memindex_reg(OFFSET(java_longarray, data[0]), s1, s2, 3, REG_ITMP3);
-                               i386_mov_reg_membase(REG_ITMP3, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_memindex_reg(OFFSET(java_longarray, data[0]) + 4, s1, s2, 3, REG_ITMP3);
-                               i386_mov_reg_membase(REG_ITMP3, REG_SP, iptr->dst->regoff * 8 + 4);
-                       }
-                       break;
-
-               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       i386_mov_memindex_reg(OFFSET(java_intarray, data[0]), s1, s2, 2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       i386_flds_memindex(OFFSET(java_floatarray, data[0]), s1, s2, 2);
-                       fpu_st_offset++;
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       i386_fldl_memindex(OFFSET(java_doublearray, data[0]), s1, s2, 3);
-                       fpu_st_offset++;
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       i386_movzwl_memindex_reg(OFFSET(java_chararray, data[0]), s1, s2, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;                  
-
-               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       i386_movswl_memindex_reg(OFFSET(java_shortarray, data[0]), s1, s2, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       i386_movsbl_memindex_reg(OFFSET(java_bytearray, data[0]), s1, s2, 0, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_AASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       i386_mov_reg_memindex(s3, OFFSET(java_objectarray, data[0]), s1, s2, 2);
-                       break;
-
-               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-
-                       if (src->flags & INMEMORY) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);
-                               i386_mov_reg_memindex(REG_ITMP3, OFFSET(java_longarray, data[0]), s1, s2, 3);
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);
-                               i386_mov_reg_memindex(REG_ITMP3, OFFSET(java_longarray, data[0]) + 4, s1, s2, 3);
-                       }
-                       break;
-
-               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       i386_mov_reg_memindex(s3, OFFSET(java_intarray, data[0]), s1, s2, 2);
-                       break;
-
-               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_flt(s3, src, REG_FTMP1);
-                       i386_fstps_memindex(OFFSET(java_floatarray, data[0]), s1, s2, 2);
-                       fpu_st_offset--;
-                       break;
-
-               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_flt(s3, src, REG_FTMP1);
-                       i386_fstpl_memindex(OFFSET(java_doublearray, data[0]), s1, s2, 3);
-                       fpu_st_offset--;
-                       break;
-
-               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       i386_movw_reg_memindex(s3, OFFSET(java_chararray, data[0]), s1, s2, 1);
-                       break;
-
-               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       i386_movw_reg_memindex(s3, OFFSET(java_shortarray, data[0]), s1, s2, 1);
-                       break;
-
-               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_INTMOVE(s3, REG_ITMP3);    /* because EBP, ESI, EDI have no xH and xL bytes */
-                       i386_movb_reg_memindex(REG_ITMP3, OFFSET(java_bytearray, data[0]), s1, s2, 0);
-                       break;
-
-
-               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress(&(((fieldinfo *)(iptr->val.a))->value));
-                       /* here it's slightly slower */
-                       i386_mov_imm_reg(0, REG_ITMP2);
-                       dseg_adddata(mcodeptr);
-                       i386_mov_membase_reg(REG_ITMP2, a, REG_ITMP2);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                               case TYPE_ADR:
-                                       var_to_reg_int(s2, src, REG_ITMP1);
-                                       i386_mov_reg_membase(s2, REG_ITMP2, 0);
-                                       break;
-                               case TYPE_LNG:
-                                       if (src->flags & INMEMORY) {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_ITMP2, 0);
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_ITMP2, 0 + 4);
-                                       } else {
-                                               panic("PUTSTATIC: longs have to be in memory");
-                                       }
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_flt(s2, src, REG_FTMP1);
-                                       i386_fstps_membase(REG_ITMP2, 0);
-                                       fpu_st_offset--;
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_flt(s2, src, REG_FTMP1);
-                                       i386_fstpl_membase(REG_ITMP2, 0);
-                                       fpu_st_offset--;
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress(&(((fieldinfo *)(iptr->val.a))->value));
-                       i386_mov_imm_reg(0, REG_ITMP2);
-                       dseg_adddata(mcodeptr);
-                       i386_mov_membase_reg(REG_ITMP2, a, REG_ITMP2);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                               case TYPE_ADR:
-                                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                                       i386_mov_membase_reg(REG_ITMP2, 0, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                                       d = reg_of_var(iptr->dst, REG_NULL);
-                                       if (iptr->dst->flags & INMEMORY) {
-                                               i386_mov_membase_reg(REG_ITMP2, 0, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                               i386_mov_membase_reg(REG_ITMP2, 0 + 4, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8 + 4);
-                                       } else {
-                                               panic("GETSTATIC: longs have to be in memory");
-                                       }
-                                       break;
-                               case TYPE_FLT:
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       i386_flds_membase(REG_ITMP2, 0);
-                                       fpu_st_offset++;
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       i386_fldl_membase(REG_ITMP2, 0);
-                                       fpu_st_offset++;
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                               case TYPE_ADR:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       i386_mov_reg_membase(s2, s1, a);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       gen_nullptr_check(s1);
-                                       if (src->flags & INMEMORY) {
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP2, s1, a);
-                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                               i386_mov_reg_membase(REG_ITMP2, s1, a + 4);
-                                       } else {
-                                               panic("PUTFIELD: longs have to be in memory");
-                                       }
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_flt(s2, src, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       i386_fstps_membase(s1, a);
-                                       fpu_st_offset--;
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_flt(s2, src, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       i386_fstpl_membase(s1, a);
-                                       fpu_st_offset--;
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                               case TYPE_ADR:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       i386_mov_membase_reg(s1, a, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_NULL);
-                                       gen_nullptr_check(s1);
-                                       i386_mov_membase_reg(s1, a, REG_ITMP2);
-                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8);
-                                       i386_mov_membase_reg(s1, a + 4, REG_ITMP2);
-                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       i386_flds_membase(s1, a);
-                                       fpu_st_offset++;
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       i386_fldl_membase(s1, a);
-                                       fpu_st_offset++;
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               /* branch operations **************************************************/
-
-                       /* TWISTI */
-/*  #define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}} */
-#define ALIGNCODENOP do {} while (0)
-
-               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_INTMOVE(s1, REG_ITMP1_XPTR);
-
-                       i386_call_imm(0);                    /* passing exception pointer */
-                       i386_pop_reg(REG_ITMP2_XPC);
-
-                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
-                       i386_jmp_reg(I386_EDI);
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_GOTO:         /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-
-                       i386_jmp_imm(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_JSR:          /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-
-                       i386_call_imm(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-                       
-               case ICMD_RET:          /* ... ==> ...                                */
-                                       /* op1 = local variable                       */
-
-                       var = &(locals[iptr->op1][TYPE_ADR]);
-                       var_to_reg_int(s1, var, REG_ITMP1);
-                       i386_jmp_reg(s1);
-                       break;
-
-               case ICMD_IFNULL:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_test_reg_reg(src->regoff, src->regoff);
-                       }
-                       i386_jcc(I386_CC_E, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_test_reg_reg(src->regoff, src->regoff);
-                       }
-                       i386_jcc(I386_CC_NE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFEQ:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
-                       }
-                       i386_jcc(I386_CC_E, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFLT:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
-                       }
-                       i386_jcc(I386_CC_L, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFLE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
-                       }
-                       i386_jcc(I386_CC_LE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFNE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
-                       }
-                       i386_jcc(I386_CC_NE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFGT:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
-                       }
-                       i386_jcc(I386_CC_G, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFGE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
-
-                       } else {
-                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
-                       }
-                       i386_jcc(I386_CC_GE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       if (src->flags & INMEMORY) {
-                               if (iptr->val.l == 0) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_alu_membase_reg(I386_OR, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
-
-                               } else if (iptr->val.l > 0 && iptr->val.l <= 0x00000000ffffffff) {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_alu_imm_reg(I386_XOR, iptr->val.l, REG_ITMP1);
-                                       i386_alu_membase_reg(I386_OR, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
-                                       
-                               } else {
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                                       i386_alu_imm_reg(I386_XOR, iptr->val.l >> 32, REG_ITMP2);
-                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       i386_alu_imm_reg(I386_XOR, iptr->val.l, REG_ITMP1);
-                                       i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
-                               }
-                       }
-                       i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
-                       i386_jcc(I386_CC_E, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       /* TODO: optimize as in IF_LEQ */
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
-                               i386_jcc(I386_CC_L, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-
-                               a = 3 + 6;
-                               CALCREGOFFBYTES(a, src->regoff);
-                               CALCIMMEDIATEBYTES(a, iptr->val.l);
-
-                               i386_jcc(I386_CC_G, a);
-
-                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
-                               i386_jcc(I386_CC_B, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       }                       
-                       break;
-
-               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       /* TODO: optimize as in IF_LEQ */
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
-                               i386_jcc(I386_CC_L, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-
-                               a = 3 + 6;
-                               CALCREGOFFBYTES(a, src->regoff);
-                               CALCIMMEDIATEBYTES(a, iptr->val.l);
-                               
-                               i386_jcc(I386_CC_G, a);
-
-                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
-                               i386_jcc(I386_CC_BE, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       }                       
-                       break;
-
-               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       /* TODO: optimize for val.l == 0 */
-                       if (src->flags & INMEMORY) {
-                               i386_mov_imm_reg(iptr->val.l, REG_ITMP1);
-                               i386_mov_imm_reg(iptr->val.l >> 32, REG_ITMP2);
-                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
-                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
-                       }                       
-                       i386_jcc(I386_CC_NE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       /* TODO: optimize as in IF_LEQ */
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
-                               i386_jcc(I386_CC_G, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-
-                               a = 3 + 6;
-                               CALCREGOFFBYTES(a, src->regoff);
-                               CALCIMMEDIATEBYTES(a, iptr->val.l);
-
-                               i386_jcc(I386_CC_L, a);
-
-                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
-                               i386_jcc(I386_CC_A, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       }                       
-                       break;
-
-               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       /* TODO: optimize as in IF_LEQ */
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
-                               i386_jcc(I386_CC_G, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-
-                               a = 3 + 6;
-                               CALCREGOFFBYTES(a, src->regoff);
-                               CALCIMMEDIATEBYTES(a, iptr->val.l);
-
-                               i386_jcc(I386_CC_L, a);
-
-                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
-                               i386_jcc(I386_CC_AE, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       }                       
-                       break;
-
-               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_ACMPEQ:    /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
-
-                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
-
-                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
-
-                       } else {
-                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
-                       }
-                       i386_jcc(I386_CC_E, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LCMPEQ:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
-                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
-                       }                       
-                       i386_jcc(I386_CC_E, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_ACMPNE:    /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
-
-                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
-
-                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
-
-                       } else {
-                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
-                       }
-                       i386_jcc(I386_CC_NE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LCMPNE:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
-                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
-                       }                       
-                       i386_jcc(I386_CC_NE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
-
-                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
-
-                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
-
-                       } else {
-                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
-                       }
-                       i386_jcc(I386_CC_L, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LCMPLT:    /* ..., value, value ==> ...                  */
-                                   /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
-                               i386_jcc(I386_CC_L, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-
-                               a = 3 + 3 + 6;
-                               CALCREGOFFBYTES(a, src->prev->regoff);
-                               CALCREGOFFBYTES(a, src->regoff);
-
-                               i386_jcc(I386_CC_G, a);
-
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_jcc(I386_CC_B, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       }                       
-                       break;
-
-               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
-
-                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
-
-                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
-
-                       } else {
-                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
-                       }
-                       i386_jcc(I386_CC_G, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LCMPGT:    /* ..., value, value ==> ...                  */
-                                /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
-                               i386_jcc(I386_CC_G, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-
-                               a = 3 + 3 + 6;
-                               CALCREGOFFBYTES(a, src->prev->regoff);
-                               CALCREGOFFBYTES(a, src->regoff);
-
-                               i386_jcc(I386_CC_L, a);
-
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_jcc(I386_CC_A, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       }                       
-                       break;
-
-               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
-
-                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
-
-                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
-
-                       } else {
-                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
-                       }
-                       i386_jcc(I386_CC_LE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LCMPLE:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
-                               i386_jcc(I386_CC_L, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-
-                               a = 3 + 3 + 6;
-                               CALCREGOFFBYTES(a, src->prev->regoff);
-                               CALCREGOFFBYTES(a, src->regoff);
-
-                               i386_jcc(I386_CC_G, a);
-
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_jcc(I386_CC_BE, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       }                       
-                       break;
-
-               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
-
-                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
-
-                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
-
-                       } else {
-                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
-                       }
-                       i386_jcc(I386_CC_GE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_LCMPGE:    /* ..., value, value ==> ...                  */
-                                   /* op1 = target JavaVM pc                     */
-
-                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
-                               i386_jcc(I386_CC_G, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-
-                               a = 3 + 3 + 6;
-                               CALCREGOFFBYTES(a, src->prev->regoff);
-                               CALCREGOFFBYTES(a, src->regoff);
-
-                               i386_jcc(I386_CC_L, a);
-
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_jcc(I386_CC_AE, 0);
-                               mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       }                       
-                       break;
-
-               /* (value xx 0) ? IFxx_ICONST : ELSE_ICONST                           */
-
-               case ICMD_ELSE_ICONST:  /* handled by IFxx_ICONST                     */
-                       break;
-
-               case ICMD_IFEQ_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ifcc_iconst(I386_CC_NE, src, iptr);
-                       break;
-
-               case ICMD_IFNE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ifcc_iconst(I386_CC_E, src, iptr);
-                       break;
-
-               case ICMD_IFLT_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ifcc_iconst(I386_CC_GE, src, iptr);
-                       break;
-
-               case ICMD_IFGE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ifcc_iconst(I386_CC_L, src, iptr);
-                       break;
-
-               case ICMD_IFGT_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ifcc_iconst(I386_CC_LE, src, iptr);
-                       break;
-
-               case ICMD_IFLE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       i386_emit_ifcc_iconst(I386_CC_G, src, iptr);
-                       break;
-
-
-               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_ARETURN:
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
-                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
-                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
-                               i386_call_reg(REG_ITMP1);
-                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
-                       }
-#endif
-                       var_to_reg_int(s1, src, REG_RESULT);
-                       M_INTMOVE(s1, REG_RESULT);
-                       goto nowperformreturn;
-
-               case ICMD_LRETURN:      /* ..., retvalue ==> ...                      */
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
-                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
-                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
-                               i386_call_reg(REG_ITMP1);
-                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
-                       }
-#endif
-                       if (src->flags & INMEMORY) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_RESULT);
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_RESULT2);
-
-                       } else {
-                               panic("LRETURN: longs have to be in memory");
-                       }
-                       goto nowperformreturn;
-
-               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
-                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
-                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
-                               i386_call_reg(REG_ITMP1);
-                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
-                       }
-#endif
-                       var_to_reg_flt(s1, src, REG_FRESULT);
-                       /* this may be an early return -- keep the offset correct for the remaining code */
-                       fpu_st_offset--;
-                       goto nowperformreturn;
-
-               case ICMD_DRETURN:      /* ..., retvalue ==> ...                      */
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
-                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
-                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
-                               i386_call_reg(REG_ITMP1);
-                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
-                       }
-#endif
-                       var_to_reg_flt(s1, src, REG_FRESULT);
-                       /* this may be an early return -- keep the offset correct for the remaining code */
-                       fpu_st_offset--;
-                       goto nowperformreturn;
-
-               case ICMD_RETURN:      /* ...  ==> ...                                */
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
-                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
-                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
-                               i386_call_reg(REG_ITMP1);
-                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
-                       }
-#endif
-
-nowperformreturn:
-                       {
-                       int r, p;
-                       
-                       p = parentargs_base;
-                       
-                       /* restore saved registers                                        */
-                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--) {
-                               p--;
-                               i386_mov_membase_reg(REG_SP, p * 8, savintregs[r]);
-                       }
-                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--) {
-                               p--;
-                               i386_fldl_membase(REG_SP, p * 8);
-                               fpu_st_offset++;
-                               if (iptr->opc == ICMD_FRETURN || iptr->opc == ICMD_DRETURN) {
-                                       i386_fstp_reg(savfltregs[r] + fpu_st_offset + 1);
-                               } else {
-                                       i386_fstp_reg(savfltregs[r] + fpu_st_offset);
-                               }
-                               fpu_st_offset--;
-                       }
-
-                       /* deallocate stack                                               */
-                       if (parentargs_base) {
-                               i386_alu_imm_reg(I386_ADD, parentargs_base * 8, REG_SP);
-                       }
-
-                       /* call trace function */
-                       if (runverbose) {
-                               i386_alu_imm_reg(I386_SUB, 4 + 8 + 8 + 4, REG_SP);
-
-                               i386_mov_imm_membase((s4) method, REG_SP, 0);
-
-                               i386_mov_reg_membase(REG_RESULT, REG_SP, 4);
-                               i386_mov_reg_membase(REG_RESULT2, REG_SP, 4 + 4);
-                               
-                               i386_fstl_membase(REG_SP, 4 + 8);
-                               i386_fsts_membase(REG_SP, 4 + 8 + 8);
-
-                               i386_mov_imm_reg((s4) builtin_displaymethodstop, REG_ITMP1);
-/*                             i386_mov_imm_reg(asm_builtin_exittrace, REG_ITMP1); */
-                               i386_call_reg(REG_ITMP1);
-
-                               i386_mov_membase_reg(REG_SP, 4, REG_RESULT);
-                               i386_mov_membase_reg(REG_SP, 4 + 4, REG_RESULT2);
-
-                               i386_alu_imm_reg(I386_ADD, 4 + 8 + 8 + 4, REG_SP);
-                       }
-
-                       i386_ret();
-                       ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
-                       {
-                               s4 i, l, *s4ptr;
-                               void **tptr;
-
-                               tptr = (void **) iptr->target;
-
-                               s4ptr = iptr->val.a;
-                               l = s4ptr[1];                          /* low     */
-                               i = s4ptr[2];                          /* high    */
-
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               M_INTMOVE(s1, REG_ITMP1);
-                               if (l != 0) {
-                                       i386_alu_imm_reg(I386_SUB, l, REG_ITMP1);
-                               }
-                               i = i - l + 1;
-
-                /* range check */
-
-                               i386_alu_imm_reg(I386_CMP, i - 1, REG_ITMP1);
-                               i386_jcc(I386_CC_A, 0);
-
-                /* mcode_addreference(BlockPtrOfPC(s4ptr[0]), mcodeptr); */
-                               mcode_addreference((basicblock *) tptr[0], mcodeptr);
-
-                               /* build jump table top down and use address of lowest entry */
-
-                /* s4ptr += 3 + i; */
-                               tptr += i;
-
-                               while (--i >= 0) {
-                                       /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
-                                       dseg_addtarget((basicblock *) tptr[0]); 
-                                       --tptr;
-                               }
-
-                               /* length of dataseg after last dseg_addtarget is used by load */
-
-                               i386_mov_imm_reg(0, REG_ITMP2);
-                               dseg_adddata(mcodeptr);
-                               i386_mov_memindex_reg(-dseglen, REG_ITMP2, REG_ITMP1, 2, REG_ITMP1);
-                               i386_jmp_reg(REG_ITMP1);
-                               ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
-                       {
-                               s4 i, l, val, *s4ptr;
-                               void **tptr;
-
-                               tptr = (void **) iptr->target;
-
-                               s4ptr = iptr->val.a;
-                               l = s4ptr[0];                          /* default  */
-                               i = s4ptr[1];                          /* count    */
-                       
-                               MCODECHECK((i<<2)+8);
-                               var_to_reg_int(s1, src, REG_ITMP1);    /* reg compare should always be faster */
-                               while (--i >= 0) {
-                                       s4ptr += 2;
-                                       ++tptr;
-
-                                       val = s4ptr[0];
-                                       i386_alu_imm_reg(I386_CMP, val, s1);
-                                       i386_jcc(I386_CC_E, 0);
-                                       /* mcode_addreference(BlockPtrOfPC(s4ptr[1]), mcodeptr); */
-                                       mcode_addreference((basicblock *) tptr[0], mcodeptr); 
-                               }
-
-                               i386_jmp_imm(0);
-                               /* mcode_addreference(BlockPtrOfPC(l), mcodeptr); */
-                       
-                               tptr = (void **) iptr->target;
-                               mcode_addreference((basicblock *) tptr[0], mcodeptr);
-
-                               ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 3;
-                       goto gen_method;
-
-               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 2;
-                       goto gen_method;
-
-               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 1;
-                       goto gen_method;
-
-               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-                       s3 = iptr->op1;
-
-gen_method: {
-                       methodinfo   *m;
-                       classinfo    *ci;
-
-                       MCODECHECK((s3 << 1) + 64);
-
-                       /* copy arguments to registers or stack location                  */
-
-                       for (; --s3 >= 0; src = src->prev) {
-                               if (src->varkind == ARGVAR) {
-                                       continue;
-                               }
-
-                               if (IS_INT_LNG_TYPE(src->type)) {
-                                       if (s3 < intreg_argnum) {
-                                               panic("No integer argument registers available!");
-
-                                       } else {
-                                               if (!IS_2_WORD_TYPE(src->type)) {
-                                                       if (src->flags & INMEMORY) {
-                                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, s3 * 8);
-
-                                                       } else {
-                                                               i386_mov_reg_membase(src->regoff, REG_SP, s3 * 8);
-                                                       }
-
-                                               } else {
-                                                       if (src->flags & INMEMORY) {
-                                                               M_LNGMEMMOVE(src->regoff, s3);
-
-                                                       } else {
-                                                               panic("copy arguments: longs have to be in memory");
-                                                       }
-                                               }
-                                       }
-
-                               } else {
-                                       if (s3 < fltreg_argnum) {
-                                               panic("No float argument registers available!");
-
-                                       } else {
-                                               var_to_reg_flt(d, src, REG_FTMP1);
-                                               if (src->type == TYPE_FLT) {
-                                                       i386_fstps_membase(REG_SP, s3 * 8);
-
-                                               } else {
-                                                       i386_fstpl_membase(REG_SP, s3 * 8);
-                                               }
-                                       }
-                               }
-                       } /* end of for */
-
-                       m = iptr->val.a;
-                       switch (iptr->opc) {
-                               case ICMD_BUILTIN3:
-                               case ICMD_BUILTIN2:
-                               case ICMD_BUILTIN1:
-
-                                       a = (s4) m;
-                                       d = iptr->op1;
-
-                                       i386_mov_imm_reg(a, REG_ITMP1);
-                                       i386_call_reg(REG_ITMP1);
-                                       break;
-
-                               case ICMD_INVOKESTATIC:
-
-                                       a = (s4) m->stubroutine;
-                                       d = m->returntype;
-
-                                       i386_mov_imm_reg(a, REG_ITMP2);
-                                       i386_call_reg(REG_ITMP2);
-                                       break;
-
-                               case ICMD_INVOKESPECIAL:
-
-                                       a = (s4) m->stubroutine;
-                                       d = m->returntype;
-
-                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
-                                       gen_nullptr_check(REG_ITMP1);
-                                       i386_mov_membase_reg(REG_ITMP1, 0, REG_ITMP1);    /* access memory for hardware nullptr */
-
-                                       i386_mov_imm_reg(a, REG_ITMP2);
-                                       i386_call_reg(REG_ITMP2);
-                                       break;
-
-                               case ICMD_INVOKEVIRTUAL:
-
-                                       d = m->returntype;
-
-                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
-                                       gen_nullptr_check(REG_ITMP1);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(java_objectheader, vftbl), REG_ITMP2);
-                                       i386_mov_membase32_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + sizeof(methodptr) * m->vftblindex, REG_ITMP1);
-
-                                       i386_call_reg(REG_ITMP1);
-                                       break;
-
-                               case ICMD_INVOKEINTERFACE:
-
-                                       ci = m->class;
-                                       d = m->returntype;
-
-                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
-                                       gen_nullptr_check(REG_ITMP1);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - sizeof(methodptr) * ci->index, REG_ITMP2);
-                                       i386_mov_membase32_reg(REG_ITMP2, sizeof(methodptr) * (m - ci->methods), REG_ITMP1);
-
-                                       i386_call_reg(REG_ITMP1);
-                                       break;
-
-                               default:
-                                       d = 0;
-                                       sprintf(logtext, "Unkown ICMD-Command: %d", iptr->opc);
-                                       error();
-                               }
-
-                       /* d contains return type */
-
-                       if (d != TYPE_VOID) {
-                               d = reg_of_var(iptr->dst, REG_NULL);
-
-                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
-                                       if (IS_2_WORD_TYPE(iptr->dst->type)) {
-                                               if (iptr->dst->flags & INMEMORY) {
-                                                       i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
-                                                       i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                                               } else {
-                                                       panic("RETURN: longs have to be in memory");
-                                               }
-
-                                       } else {
-                                               if (iptr->dst->flags & INMEMORY) {
-                                                       i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
-
-                                               } else {
-                                                       M_INTMOVE(REG_RESULT, iptr->dst->regoff);
-                                               }
-                                       }
-
-                               } else {
-                                       /* fld from called function -- has other fpu_st_offset counter */
-                                       fpu_st_offset++;
-                                       store_reg_to_var_flt(iptr->dst, d);
-                               }
-                       }
-                       }
-                       break;
-
-
-               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          return (sub != NULL) &&
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL);
- *
- *          superclass is a class:
- *
- *          return ((sub != NULL) && (0
- *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                  super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_INTMOVE(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                       }
-                       i386_alu_reg_reg(I386_XOR, d, d);
-                       if (iptr->op1) {                               /* class/interface */
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       i386_test_reg_reg(s1, s1);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 2;
-                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
-
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetablelength));
-                                       
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, super->index);
-                                       
-                                       a += 3;
-                                       a += 6;
-
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
-
-                                       a += 3;
-
-                                       a += 6;    /* jcc */
-                                       a += 5;
-
-                                       i386_jcc(I386_CC_E, a);
-
-                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetablelength), REG_ITMP2);
-                                       i386_alu_imm_reg(I386_SUB, super->index, REG_ITMP2);
-                                       /* TODO: test */
-                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 0;
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
-
-                                       a += 3;
-
-                                       a += 6;    /* jcc */
-                                       a += 5;
-
-                                       i386_jcc(I386_CC_LE, a);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*), REG_ITMP1);
-                                       /* TODO: test */
-                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP1);
-/*                                     i386_setcc_reg(I386_CC_A, d); */
-/*                                     i386_jcc(I386_CC_BE, 5); */
-                                       i386_jcc(I386_CC_E, 5);
-                                       i386_mov_imm_reg(1, d);
-                                       
-
-                               } else {                                   /* class           */
-                                       i386_test_reg_reg(s1, s1);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 2;
-                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
-                                       a += 5;
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
-                                       
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
-                                       
-                                       a += 2;
-                                       a += 2;    /* xor */
-
-                                       a += 2;
-
-                                       a += 6;    /* jcc */
-                                       a += 5;
-
-                                       i386_jcc(I386_CC_E, a);
-
-                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, baseval), REG_ITMP1);
-                                       i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP3);
-                                       i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
-                                       i386_alu_reg_reg(I386_SUB, REG_ITMP3, REG_ITMP1);
-                                       i386_alu_reg_reg(I386_XOR, d, d);
-                                       i386_alu_reg_reg(I386_CMP, REG_ITMP2, REG_ITMP1);
-                                       i386_jcc(I386_CC_A, 5);
-                                       i386_mov_imm_reg(1, d);
-                               }
-                       }
-                       else
-                               panic ("internal error: no inlined array instanceof");
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          OK if ((sub == NULL) ||
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL));
- *
- *          superclass is a class:
- *
- *          OK if ((sub == NULL) || (0
- *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                 super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       var_to_reg_int(s1, src, d);
-                       if (iptr->op1) {                               /* class/interface */
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       i386_test_reg_reg(s1, s1);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 2;
-                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
-
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetablelength));
-
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, super->index);
-
-                                       a += 3;
-                                       a += 6;
-
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
-
-                                       a += 3;
-                                       a += 6;
-
-                                       i386_jcc(I386_CC_E, a);
-
-                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetablelength), REG_ITMP2);
-                                       i386_alu_imm_reg(I386_SUB, super->index, REG_ITMP2);
-                                       /* TODO: test */
-                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
-                                       i386_jcc(I386_CC_LE, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*), REG_ITMP2);
-                                       /* TODO: test */
-                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
-                                       i386_jcc(I386_CC_E, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-
-                               } else {                                     /* class           */
-                                       i386_test_reg_reg(s1, s1);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 2;
-                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
-
-                                       a += 5;
-
-                                       a += 2;
-                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
-
-                                       if (d != REG_ITMP3) {
-                                               a += 2;
-                                               CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
-                                               
-                                               a += 2;
-                                               CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
-
-                                               a += 2;
-                                               
-                                       } else {
-                                               a += 2;
-                                               CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
-
-                                               a += 2;
-
-                                               a += 5;
-
-                                               a += 2;
-                                               CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
-                                       }
-
-                                       a += 2;
-
-                                       a += 6;
-
-                                       i386_jcc(I386_CC_E, a);
-
-                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
-                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, baseval), REG_ITMP1);
-                                       if (d != REG_ITMP3) {
-                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP3);
-                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
-                                               i386_alu_reg_reg(I386_SUB, REG_ITMP3, REG_ITMP1);
-
-                                       } else {
-                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP2);
-                                               i386_alu_reg_reg(I386_SUB, REG_ITMP2, REG_ITMP1);
-                                               i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
-                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
-                                       }
-                                       i386_alu_reg_reg(I386_CMP, REG_ITMP2, REG_ITMP1);
-                                       i386_jcc(I386_CC_A, 0);    /* (u) REG_ITMP1 > (u) REG_ITMP2 -> jump */
-                                       mcode_addxcastrefs(mcodeptr);
-                               }
-
-                       } else
-                               panic ("internal error: no inlined array checkcast");
-                       }
-                       M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
-
-                       if (src->flags & INMEMORY) {
-                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
-                               
-                       } else {
-                               i386_test_reg_reg(src->regoff, src->regoff);
-                       }
-                       i386_jcc(I386_CC_L, 0);
-                       mcode_addxcheckarefs(mcodeptr);
-                       break;
-
-               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
-                                     /* op1 = dimension, val.a = array descriptor    */
-
-                       /* check for negative sizes and copy sizes to stack if necessary  */
-
-                       MCODECHECK((iptr->op1 << 1) + 64);
-
-                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
-                               if (src->flags & INMEMORY) {
-                                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
-
-                               } else {
-                                       i386_test_reg_reg(src->regoff, src->regoff);
-                               }
-                               i386_jcc(I386_CC_L, 0);
-                               mcode_addxcheckarefs(mcodeptr);
-
-                               /* 
-                                * copy sizes to new stack location, be cause native function
-                                * builtin_nmultianewarray access them as (int *)
-                                */
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, -(iptr->op1 - s1) * 4);
-
-                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
-
-                               if (src->varkind != ARGVAR) {
-                                       if (src->flags & INMEMORY) {
-                                               i386_mov_membase_reg(REG_SP, (src->regoff + intreg_argnum) * 8, REG_ITMP1);
-                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, (s1 + intreg_argnum) * 8);
-
-                                       } else {
-                                               i386_mov_reg_membase(src->regoff, REG_SP, (s1 + intreg_argnum) * 8);
-                                       }
-                               }
-                       }
-                       i386_alu_imm_reg(I386_SUB, iptr->op1 * 4, REG_SP);
-
-                       /* a0 = dimension count */
-
-                       /* save stack pointer */
-                       M_INTMOVE(REG_SP, REG_ITMP1);
-
-                       i386_alu_imm_reg(I386_SUB, 12, REG_SP);
-                       i386_mov_imm_membase(iptr->op1, REG_SP, 0);
-
-                       /* a1 = arraydescriptor */
-
-                       i386_mov_imm_membase((s4) iptr->val.a, REG_SP, 4);
-
-                       /* a2 = pointer to dimensions = stack pointer */
-
-                       i386_mov_reg_membase(REG_ITMP1, REG_SP, 8);
-
-                       i386_mov_imm_reg((s4) (builtin_nmultianewarray), REG_ITMP1);
-                       i386_call_reg(REG_ITMP1);
-                       i386_alu_imm_reg(I386_ADD, 12 + iptr->op1 * 4, REG_SP);
-
-                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                       M_INTMOVE(REG_RESULT, s1);
-                       store_reg_to_var_int(iptr->dst, s1);
-                       break;
-
-
-               default: sprintf (logtext, "Unknown pseudo command: %d", iptr->opc);
-                        error();
-       
-   
-
-       } /* switch */
-               
-       } /* for instruction */
-               
-       /* copy values to interface registers */
-
-       src = bptr->outstack;
-       len = bptr->outdepth;
-       MCODECHECK(64+len);
-       while (src) {
-               len--;
-               if ((src->varkind != STACKVAR)) {
-                       s2 = src->type;
-                       if (IS_FLT_DBL_TYPE(s2)) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_FLTMOVE(s1,interfaces[len][s2].regoff);
-
-                               } else {
-                                       panic("double store");
-/*                                     M_DST(s1, REG_SP, 8 * interfaces[len][s2].regoff); */
-                               }
-
-                       } else {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               if (!IS_2_WORD_TYPE(interfaces[len][s2].type)) {
-                                       if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                               M_INTMOVE(s1, interfaces[len][s2].regoff);
-
-                                       } else {
-                                               i386_mov_reg_membase(s1, REG_SP, interfaces[len][s2].regoff * 8);
-                                       }
-
-                               } else {
-                                       if (interfaces[len][s2].flags & INMEMORY) {
-                                               M_LNGMEMMOVE(s1, interfaces[len][s2].regoff);
-
-                                       } else {
-                                               panic("copy interface registers: longs have to be in memory (end)");
-                                       }
-                               }
-                       }
-               }
-               src = src->prev;
-       }
-       } /* if (bptr -> flags >= BBREACHED) */
-       } /* for basic block */
-
-       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
-
-       {
-
-       /* generate bound check stubs */
-       u1 *xcodeptr = NULL;
-       
-       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
-                               xboundrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
-                       continue;
-                       }
-
-
-               gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
-                                 xboundrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
-               dseg_adddata(mcodeptr);
-               i386_mov_imm_reg(xboundrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
-               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
-
-               if (xcodeptr != NULL) {
-                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
-
-               } else {
-                       xcodeptr = mcodeptr;
-
-                       i386_mov_imm_reg((s4) proto_java_lang_ArrayIndexOutOfBoundsException, REG_ITMP1_XPTR);
-                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
-                       i386_jmp_reg(I386_EDI);
-               }
-       }
-
-       /* generate negative array size check stubs */
-       xcodeptr = NULL;
-       
-       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
-                               xcheckarefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
-                                 xcheckarefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
-               dseg_adddata(mcodeptr);
-               i386_mov_imm_reg(xcheckarefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
-               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
-
-               if (xcodeptr != NULL) {
-                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
-
-               } else {
-                       xcodeptr = mcodeptr;
-
-                       i386_mov_imm_reg((s4) proto_java_lang_NegativeArraySizeException, REG_ITMP1_XPTR);
-                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
-                       i386_jmp_reg(I386_EDI);
-               }
-       }
-
-       /* generate cast check stubs */
-       xcodeptr = NULL;
-       
-       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
-                               xcastrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
-                       continue;
-               }
-
-               gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
-                                 xcastrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
-               dseg_adddata(mcodeptr);
-               i386_mov_imm_reg(xcastrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
-               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
-
-               if (xcodeptr != NULL) {
-                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
-               
-               } else {
-                       xcodeptr = mcodeptr;
-
-                       i386_mov_imm_reg((s4) proto_java_lang_ClassCastException, REG_ITMP1_XPTR);
-                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
-                       i386_jmp_reg(I386_EDI);
-               }
-       }
-
-       /* generate divide by zero check stubs */
-       xcodeptr = NULL;
-       
-       for (; xdivrefs != NULL; xdivrefs = xdivrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xdivrefs->branchpos, 
-                               xdivrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
-                       continue;
-               }
-
-               gen_resolvebranch((u1*) mcodebase + xdivrefs->branchpos, 
-                                 xdivrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
-               dseg_adddata(mcodeptr);
-               i386_mov_imm_reg(xdivrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
-               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
-
-               if (xcodeptr != NULL) {
-                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
-               
-               } else {
-                       xcodeptr = mcodeptr;
-
-                       i386_mov_imm_reg((s4) proto_java_lang_ArithmeticException, REG_ITMP1_XPTR);
-                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
-                       i386_jmp_reg(I386_EDI);
-               }
-       }
-
-       /* generate null pointer check stubs */
-       xcodeptr = NULL;
-       
-       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
-                                                         xnullrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
-                       continue;
-               }
-
-               gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
-                                                 xnullrefs->branchpos, (u1*) mcodeptr - mcodebase);
-               
-               MCODECHECK(8);
-
-               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
-               dseg_adddata(mcodeptr);
-               i386_mov_imm_reg(xnullrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
-               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
-               
-               if (xcodeptr != NULL) {
-                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
-                       
-               } else {
-                       xcodeptr = mcodeptr;
-                       
-                       i386_mov_imm_reg((s4) proto_java_lang_NullPointerException, REG_ITMP1_XPTR);
-                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
-                       i386_jmp_reg(I386_EDI);
-               }
-       }
-       }
-
-       mcode_finish((int)((u1*) mcodeptr - mcodebase));
-}
-
-
-/* function createcompilerstub *************************************************
-
-   creates a stub routine which calls the compiler
-       
-*******************************************************************************/
-
-#define COMPSTUBSIZE 12
-
-u1 *createcompilerstub(methodinfo *m)
-{
-    u1 *s = CNEW(u1, COMPSTUBSIZE);     /* memory to hold the stub            */
-    mcodeptr = s;                       /* code generation pointer            */
-
-    /* code for the stub */
-    i386_mov_imm_reg((s4) m, REG_ITMP1);/* pass method pointer to compiler    */
-
-       /* we use EDI cause EDX (REG_ITMP2) is used for patching */
-    i386_mov_imm_reg((s4) asm_call_jit_compiler, I386_EDI);   /* load address */
-    i386_jmp_reg(I386_EDI);             /* jump to compiler                   */
-
-#ifdef STATISTICS
-    count_cstub_len += COMPSTUBSIZE;
-#endif
-
-    return (u1*) s;
-}
-
-
-/* function removecompilerstub *************************************************
-
-     deletes a compilerstub from memory  (simply by freeing it)
-
-*******************************************************************************/
-
-void removecompilerstub(u1 *stub) 
-{
-    CFREE(stub, COMPSTUBSIZE);
-}
-
-/* function: createnativestub **************************************************
-
-       creates a stub routine which calls a native method
-
-*******************************************************************************/
-
-#define NATIVESTUBSIZE 320
-
-u1 *createnativestub(functionptr f, methodinfo *m)
-{
-    u1 *s = CNEW(u1, NATIVESTUBSIZE);   /* memory to hold the stub            */
-
-    u1 *tptr;
-    int i;
-    int stackframesize = 4;           /* initial 4 bytes is space for jni env */
-    int stackframeoffset = 4;
-
-    int p, t;
-
-    mcodeptr = s;                   /* make macros work                   */
-
-    reg_init();
-    
-    descriptor2types(m);                     /* set paramcount and paramtypes */
-
-    if (runverbose) {
-        i386_alu_imm_reg(I386_SUB, TRACE_ARGS_NUM * 8 + 4, REG_SP);
-        
-        for (p = 0; p < m->paramcount; p++) {
-            t = m->paramtypes[p];
-            if (IS_INT_LNG_TYPE(t)) {
-                if (IS_2_WORD_TYPE(t)) {
-                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
-                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4 + 4, REG_ITMP2);
-
-                } else if (t == TYPE_ADR) {
-                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
-                    i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
-
-                } else {
-                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
-                    i386_cltd();
-                }
-                i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
-                i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
-
-            } else {
-                if (t == TYPE_FLT) {
-                    i386_flds_membase(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4);
-                    i386_fstps_membase(REG_SP, p * 8);
-                    i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
-                    i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
-
-                } else {
-                    i386_fldl_membase(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4);
-                    i386_fstpl_membase(REG_SP, p * 8);
-                }
-            }
-        }
-
-               
-        i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
-        for (p = m->paramcount; p < TRACE_ARGS_NUM; p++) {
-            i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
-            i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8 + 4);
-        }
-
-        i386_mov_imm_membase((s4) m, REG_SP, TRACE_ARGS_NUM * 8);
-
-        i386_mov_imm_reg((s4) asm_builtin_trace, REG_ITMP1);
-        i386_call_reg(REG_ITMP1);
-
-        i386_alu_imm_reg(I386_ADD, TRACE_ARGS_NUM * 8 + 4, REG_SP);
-    }
-
-    /*
-        * mark the whole fpu stack as free for native functions
-        * (only for saved register count == 0)
-        */
-    i386_ffree_reg(0);
-    i386_ffree_reg(1);
-    i386_ffree_reg(2);
-    i386_ffree_reg(3);
-    i386_ffree_reg(4);
-    i386_ffree_reg(5);
-    i386_ffree_reg(6);
-    i386_ffree_reg(7);
-
-       /*
-        * calculate stackframe size for native function
-        */
-    tptr = m->paramtypes;
-    for (i = 0; i < m->paramcount; i++) {
-        switch (*tptr++) {
-        case TYPE_INT:
-        case TYPE_FLT:
-        case TYPE_ADR:
-            stackframesize += 4;
-            break;
-
-        case TYPE_LNG:
-        case TYPE_DBL:
-            stackframesize += 8;
-            break;
-
-        default:
-            panic("unknown parameter type in native function");
-        }
-    }
-
-    i386_alu_imm_reg(I386_SUB, stackframesize, REG_SP);
-
-    tptr = m->paramtypes;
-    for (i = 0; i < m->paramcount; i++) {
-        switch (*tptr++) {
-        case TYPE_INT:
-        case TYPE_FLT:
-        case TYPE_ADR:
-            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8, REG_ITMP1);
-            i386_mov_reg_membase(REG_ITMP1, REG_SP, stackframeoffset);
-            stackframeoffset += 4;
-            break;
-
-        case TYPE_LNG:
-        case TYPE_DBL:
-            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8, REG_ITMP1);
-            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8 + 4, REG_ITMP2);
-            i386_mov_reg_membase(REG_ITMP1, REG_SP, stackframeoffset);
-            i386_mov_reg_membase(REG_ITMP2, REG_SP, stackframeoffset + 4);
-            stackframeoffset += 8;
-            break;
-
-        default:
-            panic("unknown parameter type in native function");
-        }
-    }
-
-    i386_mov_imm_membase((s4) &env, REG_SP, 0);
-    i386_mov_imm_reg((s4) f, REG_ITMP1);
-    i386_call_reg(REG_ITMP1);
-    i386_alu_imm_reg(I386_ADD, stackframesize, REG_SP);
-
-    if (runverbose) {
-        i386_alu_imm_reg(I386_SUB, 4 + 8 + 8 + 4, REG_SP);
-               
-        i386_mov_imm_membase((s4) m, REG_SP, 0);
-               
-        i386_mov_reg_membase(REG_RESULT, REG_SP, 4);
-        i386_mov_reg_membase(REG_RESULT2, REG_SP, 4 + 4);
-               
-        i386_fstl_membase(REG_SP, 4 + 8);
-        i386_fsts_membase(REG_SP, 4 + 8 + 8);
-               
-        i386_mov_imm_reg((s4) asm_builtin_exittrace, REG_ITMP1);
-        i386_call_reg(REG_ITMP1);
-               
-        i386_mov_membase_reg(REG_SP, 4, REG_RESULT);
-        i386_mov_membase_reg(REG_SP, 4 + 4, REG_RESULT2);
-               
-        i386_alu_imm_reg(I386_ADD, 4 + 8 + 8 + 4, REG_SP);
-    }
-
-       /* we can use EDI cause it's not preserved across function calls */
-       i386_mov_imm_reg((s4) &exceptionptr, I386_EDI);
-       i386_mov_membase_reg(I386_EDI, 0, I386_EDI);
-       i386_test_reg_reg(I386_EDI, I386_EDI);
-       i386_jcc(I386_CC_NE, 1);
-
-       i386_ret();
-
-       i386_mov_reg_reg(I386_EDI, REG_ITMP1_XPTR);
-       i386_mov_imm_reg((s4) &exceptionptr, I386_EDI);
-       i386_mov_imm_membase(0, I386_EDI, 0);
-       i386_mov_membase_reg(REG_SP, 0, REG_ITMP2_XPC);
-       i386_alu_imm_reg(I386_SUB, 2, REG_ITMP2_XPC);
-
-       i386_mov_imm_reg((s4) asm_handle_nat_exception, I386_EDI);
-       i386_jmp_reg(I386_EDI);
-
-#ifdef STATISTICS
-       count_nstub_len += NATIVESTUBSIZE;
-#endif
-
-       return (u1*) s;
-}
-
-/* function: removenativestub **************************************************
-
-    removes a previously created native-stub from memory
-    
-*******************************************************************************/
-
-void removenativestub(u1 *stub)
-{
-    CFREE(stub, NATIVESTUBSIZE);
-}
-
-
-
-void i386_emit_ialu(s4 alu_op, stackptr src, instruction *iptr)
-{
-       if (iptr->dst->flags & INMEMORY) {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (src->regoff == iptr->dst->regoff) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                       } else if (src->prev->regoff == iptr->dst->regoff) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                       }
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       if (src->regoff == iptr->dst->regoff) {
-                               i386_alu_reg_membase(alu_op, src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_reg(alu_op, src->prev->regoff, REG_ITMP1);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                       }
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (src->prev->regoff == iptr->dst->regoff) {
-                               i386_alu_reg_membase(alu_op, src->regoff, REG_SP, iptr->dst->regoff * 8);
-                                               
-                       } else {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_alu_reg_reg(alu_op, src->regoff, REG_ITMP1);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                       }
-
-               } else {
-                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
-                       i386_alu_reg_membase(alu_op, src->regoff, REG_SP, iptr->dst->regoff * 8);
-               }
-
-       } else {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-                       i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                       i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                       i386_alu_membase_reg(alu_op, REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-
-               } else {
-                       if (src->regoff == iptr->dst->regoff) {
-                               i386_alu_reg_reg(alu_op, src->prev->regoff, iptr->dst->regoff);
-
-                       } else {
-                               M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                               i386_alu_reg_reg(alu_op, src->regoff, iptr->dst->regoff);
-                       }
-               }
-       }
-}
-
-
-
-void i386_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr)
-{
-       if (iptr->dst->flags & INMEMORY) {
-               if (src->flags & INMEMORY) {
-                       if (src->regoff == iptr->dst->regoff) {
-                               i386_alu_imm_membase(alu_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_imm_reg(alu_op, iptr->val.i, REG_ITMP1);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                       }
-
-               } else {
-                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
-                       i386_alu_imm_membase(alu_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
-               }
-
-       } else {
-               if (src->flags & INMEMORY) {
-                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-                       i386_alu_imm_reg(alu_op, iptr->val.i, iptr->dst->regoff);
-
-               } else {
-                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                       i386_alu_imm_reg(alu_op, iptr->val.i, iptr->dst->regoff);
-               }
-       }
-}
-
-
-
-void i386_emit_lalu(s4 alu_op, stackptr src, instruction *iptr)
-{
-       if (iptr->dst->flags & INMEMORY) {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (src->regoff == iptr->dst->regoff) {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               i386_alu_reg_membase(alu_op, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                       } else if (src->prev->regoff == iptr->dst->regoff) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               i386_alu_reg_membase(alu_op, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                       } else {
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                       }
-               }
-       }
-}
-
-
-
-void i386_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr)
-{
-       if (iptr->dst->flags & INMEMORY) {
-               if (src->flags & INMEMORY) {
-                       if (src->regoff == iptr->dst->regoff) {
-                               i386_alu_imm_membase(alu_op, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
-                               i386_alu_imm_membase(alu_op, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
-
-                       } else {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
-                               i386_alu_imm_reg(alu_op, iptr->val.l, REG_ITMP1);
-                               i386_alu_imm_reg(alu_op, iptr->val.l >> 32, REG_ITMP2);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
-                       }
-               }
-       }
-}
-
-
-
-void i386_emit_ishift(s4 shift_op, stackptr src, instruction *iptr)
-{
-       if (iptr->dst->flags & INMEMORY) {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (src->prev->regoff == iptr->dst->regoff) {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
-                               i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_shift_reg(shift_op, REG_ITMP1);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                       }
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
-                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
-                       i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (src->prev->regoff == iptr->dst->regoff) {
-                               M_INTMOVE(src->regoff, I386_ECX);
-                               i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
-
-                       } else {
-                               M_INTMOVE(src->regoff, I386_ECX);
-                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                               i386_shift_reg(shift_op, REG_ITMP1);
-                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                       }
-
-               } else {
-                       M_INTMOVE(src->regoff, I386_ECX);
-                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
-                       i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
-               }
-
-       } else {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
-                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-                       i386_shift_reg(shift_op, iptr->dst->regoff);
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
-                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                       i386_shift_reg(shift_op, iptr->dst->regoff);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(src->regoff, I386_ECX);
-                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-                       i386_shift_reg(shift_op, iptr->dst->regoff);
-
-               } else {
-                       M_INTMOVE(src->regoff, I386_ECX);
-                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                       i386_shift_reg(shift_op, iptr->dst->regoff);
-               }
-       }
-}
-
-
-
-void i386_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr)
-{
-       if ((src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
-               if (src->regoff == iptr->dst->regoff) {
-                       i386_shift_imm_membase(shift_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
-
-               } else {
-                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                       i386_shift_imm_reg(shift_op, iptr->val.i, REG_ITMP1);
-                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-               }
-
-       } else if ((src->flags & INMEMORY) && !(iptr->dst->flags & INMEMORY)) {
-               i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-               i386_shift_imm_reg(shift_op, iptr->val.i, iptr->dst->regoff);
-                               
-       } else if (!(src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
-               i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
-               i386_shift_imm_membase(shift_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
-
-       } else {
-               M_INTMOVE(src->regoff, iptr->dst->regoff);
-               i386_shift_imm_reg(shift_op, iptr->val.i, iptr->dst->regoff);
-       }
-}
-
-
-
-void i386_emit_ifcc_iconst(s4 if_op, stackptr src, instruction *iptr)
-{
-       if (iptr->dst->flags & INMEMORY) {
-               int offset = 0;
-
-               if (src->flags & INMEMORY) {
-                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
-
-               } else {
-                       i386_test_reg_reg(src->regoff, src->regoff);
-               }
-
-               offset += 7;
-               CALCOFFSETBYTES(offset, iptr->dst->regoff * 8);
-       
-               i386_jcc(if_op, offset + (iptr[1].opc == ICMD_ELSE_ICONST) ? 5 + offset : 0);
-               i386_mov_imm_membase(iptr->val.i, REG_SP, iptr->dst->regoff * 8);
-
-               if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                       i386_jmp_imm(offset);
-                       i386_mov_imm_membase(iptr[1].val.i, REG_SP, iptr->dst->regoff * 8);
-               }
-
-       } else {
-               if (src->flags & INMEMORY) {
-                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
-
-               } else {
-                       i386_test_reg_reg(src->regoff, src->regoff);
-               }
-
-               i386_jcc(if_op, (iptr[1].opc == ICMD_ELSE_ICONST) ? 10 : 5);
-               i386_mov_imm_reg(iptr->val.i, iptr->dst->regoff);
-
-               if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                       i386_jmp_imm(5);
-                       i386_mov_imm_reg(iptr[1].val.i, iptr->dst->regoff);
-               }
-       }
-}
-
-
-
-#if 1
-
-/*
- * mov ops
- */
-void i386_mov_reg_reg(s4 reg, s4 dreg) {
-       *(mcodeptr++) = (u1) 0x89;
-       i386_emit_reg((reg),(dreg));
-}
-
-
-void i386_mov_imm_reg(s4 imm, s4 reg) {
-       *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07);
-       i386_emit_imm32((imm));
-}
-
-
-void i386_movb_imm_reg(s4 imm, s4 reg) {
-       *(mcodeptr++) = (u1) 0xc6;
-       i386_emit_reg(0,(reg));
-       i386_emit_imm8((imm));
-}
-
-
-void i386_mov_membase_reg(s4 basereg, s4 disp, s4 reg) {
-       *(mcodeptr++) = (u1) 0x8b;
-       i386_emit_membase((basereg),(disp),(reg));
-}
-
-
-/*
- * this one is for INVOKEVIRTUAL/INVOKEINTERFACE to have a
- * constant membase immediate length of 32bit
- */
-void i386_mov_membase32_reg(s4 basereg, s4 disp, s4 reg) {
-       *(mcodeptr++) = (u1) 0x8b;
-       i386_address_byte(2, (reg), (basereg));
-       i386_emit_imm32((disp));
-}
-
-
-void i386_mov_reg_membase(s4 reg, s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0x89;
-       i386_emit_membase((basereg),(disp),(reg));
-}
-
-
-void i386_mov_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
-       *(mcodeptr++) = (u1) 0x8b;
-       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_mov_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0x89;
-       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_movw_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0x66;
-       *(mcodeptr++) = (u1) 0x89;
-       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_movb_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0x88;
-       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_mov_imm_membase(s4 imm, s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xc7;
-       i386_emit_membase((basereg),(disp),0);
-       i386_emit_imm32((imm));
-}
-
-
-void i386_movsbl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xbe;
-       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_movswl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xbf;
-       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_movzwl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xb7;
-       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-
-/*
- * alu operations
- */
-void i386_alu_reg_reg(s4 opc, s4 reg, s4 dreg) {
-       *(mcodeptr++) = (((u1) (opc)) << 3) + 1;
-       i386_emit_reg((reg),(dreg));
-}
-
-
-void i386_alu_reg_membase(s4 opc, s4 reg, s4 basereg, s4 disp) {
-       *(mcodeptr++) = (((u1) (opc)) << 3) + 1;
-       i386_emit_membase((basereg),(disp),(reg));
-}
-
-
-void i386_alu_membase_reg(s4 opc, s4 basereg, s4 disp, s4 reg) {
-       *(mcodeptr++) = (((u1) (opc)) << 3) + 3;
-       i386_emit_membase((basereg),(disp),(reg));
-}
-
-
-void i386_alu_imm_reg(s4 opc, s4 imm, s4 dreg) {
-       if (i386_is_imm8(imm)) { 
-               *(mcodeptr++) = (u1) 0x83;
-               i386_emit_reg((opc),(dreg));
-               i386_emit_imm8((imm));
-       } else { 
-               *(mcodeptr++) = (u1) 0x81;
-               i386_emit_reg((opc),(dreg));
-               i386_emit_imm32((imm));
-       } 
-}
-
-
-void i386_alu_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp) {
-       if (i386_is_imm8(imm)) { 
-               *(mcodeptr++) = (u1) 0x83;
-               i386_emit_membase((basereg),(disp),(opc));
-               i386_emit_imm8((imm));
-       } else { 
-               *(mcodeptr++) = (u1) 0x81;
-               i386_emit_membase((basereg),(disp),(opc));
-               i386_emit_imm32((imm));
-       } 
-}
-
-
-void i386_test_reg_reg(s4 reg, s4 dreg) {
-       *(mcodeptr++) = (u1) 0x85;
-       i386_emit_reg((reg),(dreg));
-}
-
-
-void i386_test_imm_reg(s4 imm, s4 reg) {
-       *(mcodeptr++) = (u1) 0xf7;
-       i386_emit_reg(0,(reg));
-       i386_emit_imm32((imm));
-}
-
-
-
-/*
- * inc, dec operations
- */
-void i386_inc_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0x40 + ((reg) & 0x07);
-}
-
-
-void i386_inc_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xff;
-       i386_emit_membase((basereg),(disp),0);
-}
-
-
-void i386_dec_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0x48 + ((reg) & 0x07);
-}
-
-                
-void i386_dec_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xff;
-       i386_emit_membase((basereg),(disp),1);
-}
-
-
-
-void i386_cltd() {
-       *(mcodeptr++) = (u1) 0x99;
-}
-
-
-
-void i386_imul_reg_reg(s4 reg, s4 dreg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xaf;
-       i386_emit_reg((dreg),(reg));
-}
-
-
-void i386_imul_membase_reg(s4 basereg, s4 disp, s4 dreg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xaf;
-       i386_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void i386_imul_imm_reg(s4 imm, s4 dreg) {
-       if (i386_is_imm8((imm))) { 
-               *(mcodeptr++) = (u1) 0x6b;
-               i386_emit_reg(0,(dreg));
-               i386_emit_imm8((imm));
-       } else { 
-               *(mcodeptr++) = (u1) 0x69;
-               i386_emit_reg(0,(dreg));
-               i386_emit_imm32((imm));
-       } 
-}
-
-
-void i386_imul_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
-       if (i386_is_imm8((imm))) { 
-               *(mcodeptr++) = (u1) 0x6b;
-               i386_emit_reg((dreg),(reg));
-               i386_emit_imm8((imm));
-       } else { 
-               *(mcodeptr++) = (u1) 0x69;
-               i386_emit_reg((dreg),(reg));
-               i386_emit_imm32((imm));
-       } 
-}
-
-
-void i386_imul_imm_membase_reg(s4 imm, s4 basereg, s4 disp, s4 dreg) {
-       if (i386_is_imm8((imm))) { 
-               *(mcodeptr++) = (u1) 0x6b;
-               i386_emit_membase((basereg),(disp),(dreg));
-               i386_emit_imm8((imm));
-       } else { 
-               *(mcodeptr++) = (u1) 0x69;
-               i386_emit_membase((basereg),(disp),(dreg));
-               i386_emit_imm32((imm));
-       } 
-}
-
-
-void i386_mul_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xf7;
-       i386_emit_membase((basereg),(disp),4);
-}
-
-
-void i386_idiv_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xf7;
-       i386_emit_reg(7,(reg));
-}
-
-
-
-void i386_ret() {
-       *(mcodeptr++) = (u1) 0xc3;
-}
-
-
-
-/*
- * shift ops
- */
-void i386_shift_reg(s4 opc, s4 reg) {
-       *(mcodeptr++) = (u1) 0xd3;
-       i386_emit_reg((opc),(reg));
-}
-
-
-void i386_shift_membase(s4 opc, s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xd3;
-       i386_emit_membase((basereg),(disp),(opc));
-}
-
-
-void i386_shift_imm_reg(s4 opc, s4 imm, s4 dreg) {
-       if ((imm) == 1) { 
-               *(mcodeptr++) = (u1) 0xd1;
-               i386_emit_reg((opc),(dreg));
-       } else { 
-               *(mcodeptr++) = (u1) 0xc1;
-               i386_emit_reg((opc),(dreg));
-               i386_emit_imm8((imm));
-       } 
-}
-
-
-void i386_shift_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp) {
-       if ((imm) == 1) { 
-               *(mcodeptr++) = (u1) 0xd1;
-               i386_emit_membase((basereg),(disp),(opc));
-       } else { 
-               *(mcodeptr++) = (u1) 0xc1;
-               i386_emit_membase((basereg),(disp),(opc));
-               i386_emit_imm8((imm));
-       } 
-}
-
-
-void i386_shld_reg_reg(s4 reg, s4 dreg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xa5;
-       i386_emit_reg((reg),(dreg));
-}
-
-
-void i386_shld_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xa4;
-       i386_emit_reg((reg),(dreg));
-       i386_emit_imm8((imm));
-}
-
-
-void i386_shld_reg_membase(s4 reg, s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xa5;
-       i386_emit_membase((basereg),(disp),(reg));
-}
-
-
-void i386_shrd_reg_reg(s4 reg, s4 dreg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xad;
-       i386_emit_reg((reg),(dreg));
-}
-
-
-void i386_shrd_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xac;
-       i386_emit_reg((reg),(dreg));
-       i386_emit_imm8((imm));
-}
-
-
-void i386_shrd_reg_membase(s4 reg, s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) 0xad;
-       i386_emit_membase((basereg),(disp),(reg));
-}
-
-
-
-/*
- * jump operations
- */
-void i386_jmp_imm(s4 imm) {
-       *(mcodeptr++) = (u1) 0xe9;
-       i386_emit_imm32((imm));
-}
-
-
-void i386_jmp_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xff;
-       i386_emit_reg(4,(reg));
-}
-
-
-void i386_jcc(s4 opc, s4 imm) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) (0x80 + i386_jcc_map[(opc)]);
-       i386_emit_imm32((imm));
-}
-
-
-
-/*
- * conditional set operations
- */
-void i386_setcc_reg(s4 opc, s4 reg) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]);
-       i386_emit_reg(0,(reg));
-}
-
-
-void i386_setcc_membase(s4 opc, s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0x0f;
-       *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]);
-       i386_emit_membase((basereg),(disp),0);
-}
-
-
-
-void i386_neg_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xf7;
-       i386_emit_reg(3,(reg));
-}
-
-
-void i386_neg_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xf7;
-       i386_emit_membase((basereg),(disp),3);
-}
-
-
-
-void i386_push_imm(s4 imm) {
-       *(mcodeptr++) = (u1) 0x68;
-       i386_emit_imm32((imm));
-}
-
-
-void i386_pop_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0x58 + (0x07 & (reg));
-}
-
-
-void i386_nop() {
-       *(mcodeptr++) = (u1) 0x90;
-}
-
-
-/*
- * call instructions
- */
-void i386_call_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xff;
-       i386_emit_reg(2,(reg));
-}
-
-
-void i386_call_imm(s4 imm) {
-       *(mcodeptr++) = (u1) 0xe8;
-       i386_emit_imm32((imm));
-}
-
-
-
-/*
- * floating point instructions
- */
-void i386_fld1() {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xe8;
-}
-
-
-void i386_fldz() {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xee;
-}
-
-
-void i386_fld_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg));
-}
-
-
-void i386_flds_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xd9;
-       i386_emit_membase((basereg),(disp),0);
-}
-
-
-void i386_fldl_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdd;
-       i386_emit_membase((basereg),(disp),0);
-}
-
-
-void i386_fldt_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdb;
-       i386_emit_membase((basereg),(disp),5);
-}
-
-
-void i386_flds_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0xd9;
-       i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_fldl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0xdd;
-       i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale));
-}
-
-
-
-
-void i386_fildl_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdb;
-       i386_emit_membase((basereg),(disp),0);
-}
-
-
-void i386_fildll_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdf;
-       i386_emit_membase((basereg),(disp),5);
-}
-
-
-
-
-void i386_fst_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdd;
-       *(mcodeptr++) = (u1) 0xd0 + (0x07 & (reg));
-}
-
-
-void i386_fsts_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xd9;
-       i386_emit_membase((basereg),(disp),2);
-}
-
-
-void i386_fstl_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdd;
-       i386_emit_membase((basereg),(disp),2);
-}
-
-
-void i386_fsts_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0xd9;
-       i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_fstl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0xdd;
-       i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_fstp_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdd;
-       *(mcodeptr++) = (u1) 0xd8 + (0x07 & (reg));
-}
-
-
-void i386_fstps_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xd9;
-       i386_emit_membase((basereg),(disp),3);
-}
-
-
-void i386_fstpl_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdd;
-       i386_emit_membase((basereg),(disp),3);
-}
-
-
-void i386_fstpt_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdb;
-       i386_emit_membase((basereg),(disp),7);
-}
-
-
-void i386_fstps_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0xd9;
-       i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_fstpl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
-       *(mcodeptr++) = (u1) 0xdd;
-       i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale));
-}
-
-
-void i386_fistl_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdb;
-       i386_emit_membase((basereg),(disp),2);
-}
-
-
-void i386_fistpl_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdb;
-       i386_emit_membase((basereg),(disp),3);
-}
-
-
-void i386_fistpll_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdf;
-       i386_emit_membase((basereg),(disp),7);
-}
-
-
-void i386_fchs() {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xe0;
-}
-
-
-void i386_faddp() {
-       *(mcodeptr++) = (u1) 0xde;
-       *(mcodeptr++) = (u1) 0xc1;
-}
-
-
-void i386_fadd_reg_st(s4 reg) {
-       *(mcodeptr++) = (u1) 0xd8;
-       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
-}
-
-
-void i386_fadd_st_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdc;
-       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
-}
-
-
-void i386_faddp_st_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xde;
-       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
-}
-
-
-void i386_fadds_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xd8;
-       i386_emit_membase((basereg),(disp),0);
-}
-
-
-void i386_faddl_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdc;
-       i386_emit_membase((basereg),(disp),0);
-}
-
-
-void i386_fsub_reg_st(s4 reg) {
-       *(mcodeptr++) = (u1) 0xd8;
-       *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg));
-}
-
-
-void i386_fsub_st_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdc;
-       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
-}
-
-
-void i386_fsubp_st_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xde;
-       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
-}
-
-
-void i386_fsubp() {
-       *(mcodeptr++) = (u1) 0xde;
-       *(mcodeptr++) = (u1) 0xe9;
-}
-
-
-void i386_fsubs_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xd8;
-       i386_emit_membase((basereg),(disp),4);
-}
-
-
-void i386_fsubl_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdc;
-       i386_emit_membase((basereg),(disp),4);
-}
-
-
-void i386_fmul_reg_st(s4 reg) {
-       *(mcodeptr++) = (u1) 0xd8;
-       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
-}
-
-
-void i386_fmul_st_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdc;
-       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
-}
-
-
-void i386_fmulp() {
-       *(mcodeptr++) = (u1) 0xde;
-       *(mcodeptr++) = (u1) 0xc9;
-}
-
-
-void i386_fmulp_st_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xde;
-       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
-}
-
-
-void i386_fmuls_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xd8;
-       i386_emit_membase((basereg),(disp),1);
-}
-
-
-void i386_fmull_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xdc;
-       i386_emit_membase((basereg),(disp),1);
-}
-
-
-void i386_fdiv_reg_st(s4 reg) {
-       *(mcodeptr++) = (u1) 0xd8;
-       *(mcodeptr++) = (u1) 0xf0 + (0x07 & (reg));
-}
-
-
-void i386_fdiv_st_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdc;
-       *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg));
-}
-
-
-void i386_fdivp() {
-       *(mcodeptr++) = (u1) 0xde;
-       *(mcodeptr++) = (u1) 0xf9;
-}
-
-
-void i386_fdivp_st_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xde;
-       *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg));
-}
-
-
-void i386_fxch() {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xc9;
-}
-
-
-void i386_fxch_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
-}
-
-
-void i386_fprem() {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xf8;
-}
-
-
-void i386_fprem1() {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xf5;
-}
-
-
-void i386_fucom() {
-       *(mcodeptr++) = (u1) 0xdd;
-       *(mcodeptr++) = (u1) 0xe1;
-}
-
-
-void i386_fucom_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdd;
-       *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg));
-}
-
-
-void i386_fucomp_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdd;
-       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
-}
-
-
-void i386_fucompp() {
-       *(mcodeptr++) = (u1) 0xda;
-       *(mcodeptr++) = (u1) 0xe9;
-}
-
-
-void i386_fnstsw() {
-       *(mcodeptr++) = (u1) 0xdf;
-       *(mcodeptr++) = (u1) 0xe0;
-}
-
-
-void i386_sahf() {
-       *(mcodeptr++) = (u1) 0x9e;
-}
-
-
-void i386_finit() {
-       *(mcodeptr++) = (u1) 0x9b;
-       *(mcodeptr++) = (u1) 0xdb;
-       *(mcodeptr++) = (u1) 0xe3;
-}
-
-
-void i386_fldcw_mem(s4 mem) {
-       *(mcodeptr++) = (u1) 0xd9;
-       i386_emit_mem(5,(mem));
-}
-
-
-void i386_fldcw_membase(s4 basereg, s4 disp) {
-       *(mcodeptr++) = (u1) 0xd9;
-       i386_emit_membase((basereg),(disp),5);
-}
-
-
-void i386_wait() {
-       *(mcodeptr++) = (u1) 0x9b;
-}
-
-
-void i386_ffree_reg(s4 reg) {
-       *(mcodeptr++) = (u1) 0xdd;
-       *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg));
-}
-
-
-void i386_fdecstp() {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xf6;
-}
-
-
-void i386_fincstp() {
-       *(mcodeptr++) = (u1) 0xd9;
-       *(mcodeptr++) = (u1) 0xf7;
-}
-
-#endif
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/i386/ngen.h b/i386/ngen.h
deleted file mode 100644 (file)
index 6d78fae..0000000
+++ /dev/null
@@ -1,1676 +0,0 @@
-/* i386/ngen.h - code generation macros and definitions for i386
-
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
-   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
-   P. Tomsich, J. Wenninger
-
-   This file is part of CACAO.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
-
-   Contact: cacao@complang.tuwien.ac.at
-
-   Authors: Andreas Krall
-            Christian Thalinger
-
-   $Id: ngen.h 551 2003-11-01 20:35:28Z twisti $
-
-*/
-
-
-#ifndef _NGEN_H
-#define _NGEN_H
-
-/* include here, so function definitions are available in mcode.c */
-#include "methodtable.h"
-
-
-/* see also file calling.doc for explanation of calling conventions           */
-
-/* preallocated registers *****************************************************/
-
-/* integer registers */
-  
-#define REG_RESULT      I386_EAX /* to deliver method results                 */
-#define REG_RESULT2     I386_EDX /* to deliver long method results            */
-
-#define REG_ITMP1       I386_EAX /* temporary register                        */
-#define REG_ITMP2       I386_EDX /* temporary register and method pointer     */
-#define REG_ITMP3       I386_ECX /* temporary register                        */
-
-#define REG_NULL        -1       /* used for reg_of_var where d is not needed */
-
-#define REG_ITMP1_XPTR  I386_EAX /* exception pointer = temporary register 1  */
-#define REG_ITMP2_XPC   I386_EDX /* exception pc = temporary register 2       */
-
-#define REG_SP          I386_ESP /* stack pointer                             */
-
-/* floating point registers */
-
-#define REG_FRESULT     0    /* to deliver floating point method results      */
-#define REG_FTMP1       6    /* temporary floating point register             */
-#define REG_FTMP2       7    /* temporary floating point register             */
-#define REG_FTMP3       7    /* temporary floating point register             */
-
-/* register descripton - array ************************************************/
-
-/* #define REG_RES   0         reserved register for OS or code generator     */
-/* #define REG_RET   1         return value register                          */
-/* #define REG_EXC   2         exception value register (only old jit)        */
-/* #define REG_SAV   3         (callee) saved register                        */
-/* #define REG_TMP   4         scratch temporary register (caller saved)      */
-/* #define REG_ARG   5         argument register (caller saved)               */
-
-/* #define REG_END   -1        last entry in tables */
-
-int nregdescint[] = {
-    REG_RET, REG_RES, REG_RES, REG_SAV, REG_RES, REG_SAV, REG_TMP, REG_TMP,
-    REG_END };
-
-/* for use of reserved registers, see comment above */
-
-int nregdescfloat[] = {
-  /* rounding problems with callee saved registers */
-/*      REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_RES, REG_RES, */
-/*      REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, */
-    REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
-    REG_END };
-
-/* for use of reserved registers, see comment above */
-
-
-/* stackframe-infos ***********************************************************/
-
-int parentargs_base; /* offset in stackframe for the parameter from the caller*/
-
-/* -> see file 'calling.doc' */
-
-
-static u1 fpu_in_24bit_mode = 0;
-
-static u2 fpu_ctrlwrd_24bit = 0x007f;    /* Round to nearest, 24-bit mode, exceptions masked */
-static u2 fpu_ctrlwrd_53bit = 0x027f;    /* Round to nearest, 53-bit mode, exceptions masked */
-
-static u4 subnormal_bias1[3] = { 0x00000000, 0x80000000, 0x03ff };    /* 2^(-15360) */
-static u4 subnormal_bias2[3] = { 0x00000000, 0x80000000, 0x7bff };    /* 2^(+15360) */
-
-
-/* macros to create code ******************************************************/
-
-/*
- * immediate data union
- */
-typedef union {
-    s4 i;
-    s8 l;
-    float f;
-    double d;
-    void *a;
-    u1 b[8];
-} i386_imm_buf;
-
-
-/*
- * x86 register numbers
- */
-typedef enum {
-    I386_EAX = 0,
-    I386_ECX = 1,
-    I386_EDX = 2,
-    I386_EBX = 3,
-    I386_ESP = 4,
-    I386_EBP = 5,
-    I386_ESI = 6,
-    I386_EDI = 7,
-    I386_NREG
-} I386_Reg_No;
-
-typedef enum {
-    I386_AL = 0,
-    I386_CL = 1,
-    I386_DL = 2,
-    I386_BL = 3,
-    I386_AH = 4,
-    I386_CH = 5,
-    I386_DH = 6,
-    I386_BH = 7,
-    I386_NREGB
-} I386_RegB_No;
-
-
-/*
- * opcodes for alu instructions
- */
-typedef enum {
-    I386_ADD = 0,
-    I386_OR  = 1,
-    I386_ADC = 2,
-    I386_SBB = 3,
-    I386_AND = 4,
-    I386_SUB = 5,
-    I386_XOR = 6,
-    I386_CMP = 7,
-    I386_NALU
-} I386_ALU_Opcode;
-
-typedef enum {
-    I386_ROL = 0,
-    I386_ROR = 1,
-    I386_RCL = 2,
-    I386_RCR = 3,
-    I386_SHL = 4,
-    I386_SHR = 5,
-    I386_SAR = 7,
-    I386_NSHIFT = 8
-} I386_Shift_Opcode;
-
-typedef enum {
-    I386_CC_O = 0,
-    I386_CC_NO = 1,
-    I386_CC_B = 2, I386_CC_C = 2, I386_CC_NAE = 2,
-    I386_CC_BE = 6, I386_CC_NA = 6,
-    I386_CC_AE = 3, I386_CC_NB = 3, I386_CC_NC = 3,
-    I386_CC_E = 4, I386_CC_Z = 4,
-    I386_CC_NE = 5, I386_CC_NZ = 5,
-    I386_CC_A = 7, I386_CC_NBE = 7,
-    I386_CC_S = 8, I386_CC_LZ = 8,
-    I386_CC_NS = 9, I386_CC_GEZ = 9,
-    I386_CC_P = 0x0a, I386_CC_PE = 0x0a,
-    I386_CC_NP = 0x0b, I386_CC_PO = 0x0b,
-    I386_CC_L = 0x0c, I386_CC_NGE = 0x0c,
-    I386_CC_GE = 0x0d, I386_CC_NL = 0x0d,
-    I386_CC_LE = 0x0e, I386_CC_NG = 0x0e,
-    I386_CC_G = 0x0f, I386_CC_NLE = 0x0f,
-    I386_NCC
-} I386_CC;
-
-static const unsigned char i386_jcc_map[] = {
-    0x00, /* o  */
-    0x01, /* no */
-    0x02, /* b, lt  */
-    0x03, /* ae */
-    0x04, /* e  */
-    0x05, /* ne */
-    0x06, /* be */
-    0x07, /* a  */
-    0x08, /* s  */
-    0x09, /* ns */
-    0x0a, /* p  */
-    0x0b, /* np */
-    0x0c, /* l  */
-    0x0d, /* ge */
-    0x0e, /* le */
-    0x0f  /* g  */
-};
-
-
-
-/*
- * modrm and stuff
- */
-#define i386_address_byte(mod, reg, rm) \
-    *(mcodeptr++) = ((((mod) & 0x03) << 6) | (((reg) & 0x07) << 3) | (((rm) & 0x07)));
-
-
-#define i386_emit_reg(reg,rm) \
-    i386_address_byte(3,(reg),(rm));
-
-
-#define i386_is_imm8(imm) \
-    (((int)(imm) >= -128 && (int)(imm) <= 127))
-
-
-#define i386_emit_imm8(imm) \
-    *(mcodeptr++) = (u1) ((imm) & 0xff);
-
-
-#define i386_emit_imm16(imm) \
-    do { \
-        i386_imm_buf imb; \
-        imb.i = (int) (imm); \
-        *(mcodeptr++) = imb.b[0]; \
-        *(mcodeptr++) = imb.b[1]; \
-    } while (0)
-
-
-#define i386_emit_imm32(imm) \
-    do { \
-        i386_imm_buf imb; \
-        imb.i = (int) (imm); \
-        *(mcodeptr++) = imb.b[0]; \
-        *(mcodeptr++) = imb.b[1]; \
-        *(mcodeptr++) = imb.b[2]; \
-        *(mcodeptr++) = imb.b[3]; \
-    } while (0)
-
-
-#define i386_emit_mem(r,disp) \
-    do { \
-        i386_address_byte(0,(r),5); \
-        i386_emit_imm32((disp)); \
-    } while (0)
-
-
-#define i386_emit_membase(basereg,disp,dreg) \
-    do { \
-        if ((basereg) == I386_ESP) { \
-            if ((disp) == 0) { \
-                i386_address_byte(0, (dreg), I386_ESP); \
-                i386_address_byte(0, I386_ESP, I386_ESP); \
-            } else if (i386_is_imm8((disp))) { \
-                i386_address_byte(1, (dreg), I386_ESP); \
-                i386_address_byte(0, I386_ESP, I386_ESP); \
-                i386_emit_imm8((disp)); \
-            } else { \
-                i386_address_byte(2, (dreg), I386_ESP); \
-                i386_address_byte(0, I386_ESP, I386_ESP); \
-                i386_emit_imm32((disp)); \
-            } \
-            break; \
-        } \
-        \
-        if ((disp) == 0 && (basereg) != I386_EBP) { \
-            i386_address_byte(0, (dreg), (basereg)); \
-            break; \
-        } \
-        \
-        if (i386_is_imm8((disp))) { \
-            i386_address_byte(1, (dreg), (basereg)); \
-            i386_emit_imm8((disp)); \
-        } else { \
-            i386_address_byte(2, (dreg), (basereg)); \
-            i386_emit_imm32((disp)); \
-        } \
-    } while (0)
-
-
-#define i386_emit_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        if ((basereg) == -1) { \
-            i386_address_byte(0, (reg), 4); \
-            i386_address_byte((scale), (indexreg), 5); \
-            i386_emit_imm32((disp)); \
-        \
-        } else if ((disp) == 0 && (basereg) != I386_EBP) { \
-            i386_address_byte(0, (reg), 4); \
-            i386_address_byte((scale), (indexreg), (basereg)); \
-        \
-        } else if (i386_is_imm8((disp))) { \
-            i386_address_byte(1, (reg), 4); \
-            i386_address_byte((scale), (indexreg), (basereg)); \
-            i386_emit_imm8 ((disp)); \
-        \
-        } else { \
-            i386_address_byte(2, (reg), 4); \
-            i386_address_byte((scale), (indexreg), (basereg)); \
-            i386_emit_imm32((disp)); \
-        }    \
-     } while (0)
-
-
-
-void i386_emit_ialu(s4 alu_op, stackptr src, instruction *iptr);
-void i386_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr);
-void i386_emit_lalu(s4 alu_op, stackptr src, instruction *iptr);
-void i386_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr);
-void i386_emit_ishift(s4 shift_op, stackptr src, instruction *iptr);
-void i386_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr);
-void i386_emit_ifcc_iconst(s4 if_op, stackptr src, instruction *iptr);
-
-
-
-#if 0
-
-/*
- * mov ops
- */
-#define i386_mov_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x89; \
-        i386_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define i386_mov_imm_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
-        i386_emit_imm32((imm)); \
-    } while (0)
-
-
-#define i386_movb_imm_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xc6; \
-        i386_emit_reg(0,(reg)); \
-        i386_emit_imm8((imm)); \
-    } while (0)
-
-
-#define i386_mov_float_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
-        i386_emit_float32((imm)); \
-    } while (0)
-
-
-#define i386_mov_reg_mem(reg,mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0x89; \
-        i386_emit_mem((reg),(mem)); \
-    } while (0)
-
-
-#define i386_mov_mem_reg(mem,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x8b; \
-        i386_emit_mem((reg),(mem)); \
-    } while (0)
-
-
-#define i386_mov_membase_reg(basereg,disp,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x8b; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-/*
- * this one is for INVOKEVIRTUAL/INVOKEINTERFACE to have a
- * constant membase immediate length of 32bit
- */
-#define i386_mov_membase32_reg(basereg,disp,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x8b; \
-        i386_address_byte(2, (reg), (basereg)); \
-        i386_emit_imm32((disp)); \
-    } while (0)
-
-
-#define i386_movw_membase_reg(basereg,disp,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x66; \
-        i386_mov_membase_reg((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define i386_movb_membase_reg(basereg,disp,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x8a; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define i386_mov_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0x89; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define i386_movw_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0x66; \
-        *(mcodeptr++) = (u1) 0x89; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define i386_movb_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0x88; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define i386_mov_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x8b; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_movw_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x66; \
-        *(mcodeptr++) = (u1) 0x8b; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_movb_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x8a; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_mov_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0x89; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_movw_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0x66; \
-        *(mcodeptr++) = (u1) 0x89; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_movb_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0x88; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_mov_imm_membase(imm,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xc7; \
-        i386_emit_membase((basereg),(disp),0); \
-        i386_emit_imm32((imm)); \
-    } while (0)
-
-
-#define i386_mov_float_membase(imm,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xc7; \
-        i386_emit_membase((basereg),(disp),0); \
-        i386_emit_float32((imm)); \
-    } while (0)
-
-
-#define i386_mov_double_low_membase(imm,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xc7; \
-        i386_emit_membase((basereg),(disp),0); \
-        i386_emit_double64_low((imm)); \
-    } while (0)
-
-
-#define i386_mov_double_high_membase(imm,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xc7; \
-        i386_emit_membase((basereg),(disp),0); \
-        i386_emit_double64_high((imm)); \
-    } while (0)
-
-
-#define i386_movsbl_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbe; \
-        i386_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define i386_movswl_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbf; \
-        i386_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define i386_movzbl_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xb6; \
-        /* XXX: why do reg and dreg have to be exchanged */ \
-        i386_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define i386_movzwl_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xb7; \
-        /* XXX: why do reg and dreg have to be exchanged */ \
-        i386_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define i386_movsbl_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbe; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_movswl_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbf; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_movzbl_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xb6; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_movzwl_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xb7; \
-        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-
-/*
- * alu operations
- */
-#define i386_alu_reg_reg(opc,reg,dreg) \
-    do { \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
-        i386_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define i386_alu_reg_membase(opc,reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define i386_alu_membase_reg(opc,basereg,disp,reg) \
-    do { \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 3; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define i386_alu_imm_reg(opc,imm,dreg) \
-    do { \
-        if (i386_is_imm8(imm)) { \
-            *(mcodeptr++) = (u1) 0x83; \
-            i386_emit_reg((opc),(dreg)); \
-            i386_emit_imm8((imm)); \
-        } else { \
-            *(mcodeptr++) = (u1) 0x81; \
-            i386_emit_reg((opc),(dreg)); \
-            i386_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define i386_alu_imm_membase(opc,imm,basereg,disp) \
-    do { \
-        if (i386_is_imm8(imm)) { \
-            *(mcodeptr++) = (u1) 0x83; \
-            i386_emit_membase((basereg),(disp),(opc)); \
-            i386_emit_imm8((imm)); \
-        } else { \
-            *(mcodeptr++) = (u1) 0x81; \
-            i386_emit_membase((basereg),(disp),(opc)); \
-            i386_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define i386_test_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x85; \
-        i386_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define i386_test_imm_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_reg(0,(reg)); \
-        i386_emit_imm32((imm)); \
-    } while (0)
-
-
-#define i386_testw_imm_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x66; \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_reg(0,(reg)); \
-        i386_emit_imm16((imm)); \
-    } while (0)
-
-
-#define i386_testb_imm_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf6; \
-        i386_emit_reg(0,(reg)); \
-        i386_emit_imm8((imm)); \
-    } while (0)
-
-
-
-/*
- * inc, dec operations
- */
-#define i386_inc_reg(reg) \
-    *(mcodeptr++) = (u1) 0x40 + ((reg) & 0x07);
-
-
-#define i386_inc_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xff; \
-        i386_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define i386_dec_reg(reg) \
-    *(mcodeptr++) = (u1) 0x48 + ((reg) & 0x07);
-
-        
-#define i386_dec_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xff; \
-        i386_emit_membase((basereg),(disp),1); \
-    } while (0)
-
-
-
-
-#define i386_cltd() \
-    *(mcodeptr++) = (u1) 0x99;
-
-
-
-#define i386_imul_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xaf; \
-        i386_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define i386_imul_membase_reg(basereg,disp,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xaf; \
-        i386_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define i386_imul_imm_reg(imm,dreg) \
-    do { \
-        if (i386_is_imm8((imm))) { \
-            *(mcodeptr++) = (u1) 0x6b; \
-            i386_emit_reg(0,(dreg)); \
-            i386_emit_imm8((imm)); \
-        } else { \
-            *(mcodeptr++) = (u1) 0x69; \
-            i386_emit_reg(0,(dreg)); \
-            i386_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define i386_imul_imm_reg_reg(imm,reg,dreg) \
-    do { \
-        if (i386_is_imm8((imm))) { \
-            *(mcodeptr++) = (u1) 0x6b; \
-            i386_emit_reg((dreg),(reg)); \
-            i386_emit_imm8((imm)); \
-        } else { \
-            *(mcodeptr++) = (u1) 0x69; \
-            i386_emit_reg((dreg),(reg)); \
-            i386_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define i386_imul_imm_membase_reg(imm,basereg,disp,dreg) \
-    do { \
-        if (i386_is_imm8((imm))) { \
-            *(mcodeptr++) = (u1) 0x6b; \
-            i386_emit_membase((basereg),(disp),(dreg)); \
-            i386_emit_imm8((imm)); \
-        } else { \
-            *(mcodeptr++) = (u1) 0x69; \
-            i386_emit_membase((basereg),(disp),(dreg)); \
-            i386_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define i386_mul_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_reg(4,(reg)); \
-    } while (0)
-
-
-#define i386_mul_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_membase((basereg),(disp),4); \
-    } while (0)
-
-
-#define i386_idiv_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_reg(7,(reg)); \
-    } while (0)
-
-
-#define i386_idiv_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_membase((basereg),(disp),7); \
-    } while (0)
-
-
-
-#define i386_ret() \
-    *(mcodeptr++) = (u1) 0xc3;
-
-
-#define i386_leave() \
-    *(mcodeptr++) = (u1) 0xc9;
-
-
-
-/*
- * shift ops
- */
-#define i386_shift_reg(opc,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd3; \
-        i386_emit_reg((opc),(reg)); \
-    } while (0)
-
-
-#define i386_shift_membase(opc,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd3; \
-        i386_emit_membase((basereg),(disp),(opc)); \
-    } while (0)
-
-
-#define i386_shift_imm_reg(opc,imm,dreg) \
-    do { \
-        if ((imm) == 1) { \
-            *(mcodeptr++) = (u1) 0xd1; \
-            i386_emit_reg((opc),(dreg)); \
-        } else { \
-            *(mcodeptr++) = (u1) 0xc1; \
-            i386_emit_reg((opc),(dreg)); \
-            i386_emit_imm8((imm)); \
-        } \
-    } while (0)
-
-
-#define i386_shift_imm_membase(opc,imm,basereg,disp) \
-    do { \
-        if ((imm) == 1) { \
-            *(mcodeptr++) = (u1) 0xd1; \
-            i386_emit_membase((basereg),(disp),(opc)); \
-        } else { \
-            *(mcodeptr++) = (u1) 0xc1; \
-            i386_emit_membase((basereg),(disp),(opc)); \
-            i386_emit_imm8((imm)); \
-        } \
-    } while (0)
-
-
-#define i386_shld_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xa5; \
-        i386_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define i386_shld_imm_reg_reg(imm,reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xa4; \
-        i386_emit_reg((reg),(dreg)); \
-        i386_emit_imm8((imm)); \
-    } while (0)
-
-
-#define i386_shld_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xa5; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define i386_shrd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xad; \
-        i386_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define i386_shrd_imm_reg_reg(imm,reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xac; \
-        i386_emit_reg((reg),(dreg)); \
-        i386_emit_imm8((imm)); \
-    } while (0)
-
-
-#define i386_shrd_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xad; \
-        i386_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-
-/*
- * jump operations
- */
-#define i386_jmp_imm(imm) \
-    do { \
-        *(mcodeptr++) = (u1) 0xe9; \
-        i386_emit_imm32((imm)); \
-    } while (0)
-
-
-#define i386_jmp_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xff; \
-        i386_emit_reg(4,(reg)); \
-    } while (0)
-
-
-#define i386_jcc(opc,imm) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) (0x80 + i386_jcc_map[(opc)]); \
-        i386_emit_imm32((imm)); \
-    } while (0)
-
-
-
-/*
- * conditional set operations
- */
-#define i386_setcc_reg(opc,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
-        i386_emit_reg(0,(reg)); \
-    } while (0)
-
-
-#define i386_setcc_membase(opc,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
-        i386_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-
-#define i386_neg_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_reg(3,(reg)); \
-    } while (0)
-
-
-#define i386_neg_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_mem(3,(mem)); \
-    } while (0)
-
-
-#define i386_neg_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        i386_emit_membase((basereg),(disp),3); \
-    } while (0)
-
-
-
-#define i386_push_reg(reg) \
-    *(mcodeptr++) = (u1) 0x50 + (0x07 & (reg));
-
-
-#define i386_push_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xff; \
-        i386_emit_membase((basereg),(disp),6); \
-    } while (0)
-
-
-#define i386_push_imm(imm) \
-    do { \
-        *(mcodeptr++) = (u1) 0x68; \
-        i386_emit_imm32((imm)); \
-    } while (0)
-
-
-#define i386_pop_reg(reg) \
-    *(mcodeptr++) = (u1) 0x58 + (0x07 & (reg));
-
-
-#define i386_nop() \
-    *(mcodeptr++) = (u1) 0x90;
-
-
-
-/*
- * call instructions
- */
-#define i386_call_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xff; \
-        i386_emit_reg(2,(reg)); \
-    } while (0)
-
-
-#define i386_call_imm(imm) \
-    do { \
-        *(mcodeptr++) = (u1) 0xe8; \
-        i386_emit_imm32((imm)); \
-    } while (0)
-
-
-
-/*
- * floating point instructions
- */
-#define i386_fld1() \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xe8; \
-    } while (0)
-
-
-#define i386_fldz() \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xee; \
-    } while (0)
-
-
-#define i386_fld_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_flds_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_mem(0,(mem)); \
-    } while (0)
-
-
-#define i386_fldl_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_mem(0,(mem)); \
-    } while (0)
-
-
-#define i386_fldt_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdb; \
-        i386_emit_mem(5,(mem)); \
-    } while (0)
-
-
-#define i386_flds_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define i386_fldl_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define i386_fldt_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdb; \
-        i386_emit_membase((basereg),(disp),5); \
-    } while (0)
-
-
-#define i386_flds_memindex(disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_fldl_memindex(disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-
-
-#define i386_fildl_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdb; \
-        i386_emit_mem(0,(mem)); \
-    } while (0)
-
-
-#define i386_fildl_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdb; \
-        i386_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define i386_fildll_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdf; \
-        i386_emit_membase((basereg),(disp),5); \
-    } while (0)
-
-
-
-
-#define i386_fst_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        *(mcodeptr++) = (u1) 0xd0 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fsts_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_mem(2,(mem)); \
-    } while (0)
-
-
-#define i386_fstl_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_mem(2,(mem)); \
-    } while (0)
-
-
-#define i386_fsts_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_membase((basereg),(disp),2); \
-    } while (0)
-
-
-#define i386_fstl_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_membase((basereg),(disp),2); \
-    } while (0)
-
-
-#define i386_fsts_memindex(disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_fstl_memindex(disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-
-
-#define i386_fstp_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        *(mcodeptr++) = (u1) 0xd8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fstps_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_mem(3,(mem)); \
-    } while (0)
-
-
-#define i386_fstpl_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_mem(3,(mem)); \
-    } while (0)
-
-
-#define i386_fstps_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_membase((basereg),(disp),3); \
-    } while (0)
-
-
-#define i386_fstpl_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_membase((basereg),(disp),3); \
-    } while (0)
-
-
-#define i386_fstpt_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdb; \
-        i386_emit_membase((basereg),(disp),7); \
-    } while (0)
-
-
-#define i386_fstps_memindex(disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define i386_fstpl_memindex(disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-
-
-#define i386_fistpl_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdb; \
-        i386_emit_mem(3,(mem)); \
-    } while (0)
-
-
-#define i386_fistpll_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdf; \
-        i386_emit_mem(7,(mem)); \
-    } while (0)
-
-
-#define i386_fistl_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdb; \
-        i386_emit_membase((basereg),(disp),2); \
-    } while (0)
-
-
-#define i386_fistpl_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdb; \
-        i386_emit_membase((basereg),(disp),3); \
-    } while (0)
-
-
-#define i386_fistpll_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdf; \
-        i386_emit_membase((basereg),(disp),7); \
-    } while (0)
-
-
-
-
-#define i386_fchs() \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xe0; \
-    } while (0)
-
-
-#define i386_faddp() \
-    do { \
-        *(mcodeptr++) = (u1) 0xde; \
-        *(mcodeptr++) = (u1) 0xc1; \
-    } while (0)
-
-
-#define i386_fadd_reg_st(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd8; \
-        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
-    } while (0)
-
-
-#define i386_fadd_st_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdc; \
-        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
-    } while (0)
-
-
-#define i386_faddp_st_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xde; \
-        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
-    } while (0)
-
-
-#define i386_fadds_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd8; \
-        i386_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define i386_faddl_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdc; \
-        i386_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define i386_fsub_reg_st(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd8; \
-        *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fsub_st_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdc; \
-        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fsubp_st_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xde; \
-        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fsubp() \
-    do { \
-        *(mcodeptr++) = (u1) 0xde; \
-        *(mcodeptr++) = (u1) 0xe9; \
-    } while (0)
-
-
-#define i386_fsubs_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd8; \
-        i386_emit_membase((basereg),(disp),4); \
-    } while (0)
-
-
-#define i386_fsubl_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdc; \
-        i386_emit_membase((basereg),(disp),4); \
-    } while (0)
-
-
-#define i386_fmul_reg_st(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd8; \
-        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fmul_st_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdc; \
-        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fmulp() \
-    do { \
-        *(mcodeptr++) = (u1) 0xde; \
-        *(mcodeptr++) = (u1) 0xc9; \
-    } while (0)
-
-
-#define i386_fmulp_st_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xde; \
-        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fmuls_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd8; \
-        i386_emit_membase((basereg),(disp),1); \
-    } while (0)
-
-
-#define i386_fmull_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdc; \
-        i386_emit_membase((basereg),(disp),1); \
-    } while (0)
-
-
-#define i386_fdiv_reg_st(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd8; \
-        *(mcodeptr++) = (u1) 0xf0 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fdiv_st_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdc; \
-        *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fdivp() \
-    do { \
-        *(mcodeptr++) = (u1) 0xde; \
-        *(mcodeptr++) = (u1) 0xf9; \
-    } while (0)
-
-
-#define i386_fdivp_st_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xde; \
-        *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fxch() \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xc9; \
-    } while (0)
-
-
-#define i386_fxch_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fprem() \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xf8; \
-    } while (0)
-
-
-#define i386_fprem1() \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xf5; \
-    } while (0)
-
-
-#define i386_fucom() \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        *(mcodeptr++) = (u1) 0xe1; \
-    } while (0)
-
-
-#define i386_fucom_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fucomp_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fucompp() \
-    do { \
-        *(mcodeptr++) = (u1) 0xda; \
-        *(mcodeptr++) = (u1) 0xe9; \
-    } while (0)
-
-
-#define i386_fnstsw() \
-    do { \
-        *(mcodeptr++) = (u1) 0xdf; \
-        *(mcodeptr++) = (u1) 0xe0; \
-    } while (0)
-
-
-#define i386_sahf() \
-    *(mcodeptr++) = (u1) 0x9e;
-
-
-#define i386_finit() \
-    do { \
-        *(mcodeptr++) = (u1) 0x9b; \
-        *(mcodeptr++) = (u1) 0xdb; \
-        *(mcodeptr++) = (u1) 0xe3; \
-    } while (0)
-
-
-#define i386_fldcw_mem(mem) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_mem(5,(mem)); \
-    } while (0)
-
-
-#define i386_fldcw_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        i386_emit_membase((basereg),(disp),5); \
-    } while (0)
-
-
-#define i386_wait() \
-    *(mcodeptr++) = (u1) 0x9b;
-
-
-#define i386_ffree_reg(reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xdd; \
-        *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define i386_fdecstp() \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xf6; \
-    } while (0)
-
-
-#define i386_fincstp() \
-    do { \
-        *(mcodeptr++) = (u1) 0xd9; \
-        *(mcodeptr++) = (u1) 0xf7; \
-    } while (0)
-
-#else
-
-/*
- * integer instructions
- */
-void i386_mov_reg_reg(s4 reg, s4 dreg);
-void i386_mov_imm_reg(s4 imm, s4 dreg);
-void i386_movb_imm_reg(s4 imm, s4 dreg);
-void i386_mov_membase_reg(s4 basereg, s4 disp, s4 reg);
-void i386_mov_membase32_reg(s4 basereg, s4 disp, s4 reg);
-void i386_mov_reg_membase(s4 reg, s4 basereg, s4 disp);
-void i386_mov_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
-void i386_mov_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_movw_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_movb_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_mov_imm_membase(s4 imm, s4 basereg, s4 disp);
-void i386_movsbl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
-void i386_movswl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
-void i386_movzwl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
-void i386_alu_reg_reg(s4 opc, s4 reg, s4 dreg);
-void i386_alu_reg_membase(s4 opc, s4 reg, s4 basereg, s4 disp);
-void i386_alu_membase_reg(s4 opc, s4 basereg, s4 disp, s4 reg);
-void i386_alu_imm_reg(s4 opc, s4 imm, s4 reg);
-void i386_alu_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp);
-void i386_test_reg_reg(s4 reg, s4 dreg);
-void i386_test_imm_reg(s4 imm, s4 dreg);
-void i386_inc_reg(s4 reg);
-void i386_inc_membase(s4 basereg, s4 disp);
-void i386_dec_reg(s4 reg);
-void i386_dec_membase(s4 basereg, s4 disp);
-void i386_cltd();
-void i386_imul_reg_reg(s4 reg, s4 dreg);
-void i386_imul_membase_reg(s4 basereg, s4 disp, s4 dreg);
-void i386_imul_imm_reg(s4 imm, s4 reg);
-void i386_imul_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
-void i386_imul_imm_membase_reg(s4 imm, s4 basereg, s4 disp, s4 dreg);
-void i386_mul_membase(s4 basereg, s4 disp);
-void i386_idiv_reg(s4 reg);
-void i386_ret();
-void i386_shift_reg(s4 opc, s4 reg);
-void i386_shift_membase(s4 opc, s4 basereg, s4 disp);
-void i386_shift_imm_reg(s4 opc, s4 imm, s4 reg);
-void i386_shift_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp);
-void i386_shld_reg_reg(s4 reg, s4 dreg);
-void i386_shld_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
-void i386_shld_reg_membase(s4 reg, s4 basereg, s4 disp);
-void i386_shrd_reg_reg(s4 reg, s4 dreg);
-void i386_shrd_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
-void i386_shrd_reg_membase(s4 reg, s4 basereg, s4 disp);
-void i386_jmp_imm(s4 imm);
-void i386_jmp_reg(s4 reg);
-void i386_jcc(s4 opc, s4 imm);
-void i386_setcc_reg(s4 opc, s4 reg);
-void i386_setcc_membase(s4 opc, s4 basereg, s4 disp);
-void i386_neg_reg(s4 reg);
-void i386_neg_membase(s4 basereg, s4 disp);
-void i386_push_imm(s4 imm);
-void i386_pop_reg(s4 reg);
-void i386_nop();
-void i386_call_reg(s4 reg);
-void i386_call_imm(s4 imm);
-
-
-
-/*
- * floating point instructions
- */
-void i386_fld1();
-void i386_fldz();
-void i386_fld_reg(s4 reg);
-void i386_flds_membase(s4 basereg, s4 disp);
-void i386_fldl_membase(s4 basereg, s4 disp);
-void i386_fldt_membase(s4 basereg, s4 disp);
-void i386_flds_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_fldl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_fildl_membase(s4 basereg, s4 disp);
-void i386_fildll_membase(s4 basereg, s4 disp);
-void i386_fst_reg(s4 reg);
-void i386_fsts_membase(s4 basereg, s4 disp);
-void i386_fstl_membase(s4 basereg, s4 disp);
-void i386_fsts_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_fstl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_fstp_reg(s4 reg);
-void i386_fstps_membase(s4 basereg, s4 disp);
-void i386_fstpl_membase(s4 basereg, s4 disp);
-void i386_fstpt_membase(s4 basereg, s4 disp);
-void i386_fstps_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_fstpl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
-void i386_fistl_membase(s4 basereg, s4 disp);
-void i386_fistpl_membase(s4 basereg, s4 disp);
-void i386_fistpll_membase(s4 basereg, s4 disp);
-void i386_fchs();
-void i386_faddp();
-void i386_fadd_reg_st(s4 reg);
-void i386_fadd_st_reg(s4 reg);
-void i386_faddp_st_reg(s4 reg);
-void i386_fadds_membase(s4 basereg, s4 disp);
-void i386_faddl_membase(s4 basereg, s4 disp);
-void i386_fsub_reg_st(s4 reg);
-void i386_fsub_st_reg(s4 reg);
-void i386_fsubp_st_reg(s4 reg);
-void i386_fsubp();
-void i386_fsubs_membase(s4 basereg, s4 disp);
-void i386_fsubl_membase(s4 basereg, s4 disp);
-void i386_fmul_reg_st(s4 reg);
-void i386_fmul_st_reg(s4 reg);
-void i386_fmulp();
-void i386_fmulp_st_reg(s4 reg);
-void i386_fmuls_membase(s4 basereg, s4 disp);
-void i386_fmull_membase(s4 basereg, s4 disp);
-void i386_fdiv_reg_st(s4 reg);
-void i386_fdiv_st_reg(s4 reg);
-void i386_fdivp();
-void i386_fdivp_st_reg(s4 reg);
-void i386_fxch();
-void i386_fxch_reg(s4 reg);
-void i386_fprem();
-void i386_fprem1();
-void i386_fucom();
-void i386_fucom_reg(s4 reg);
-void i386_fucomp_reg(s4 reg);
-void i386_fucompp();
-void i386_fnstsw();
-void i386_sahf();
-void i386_finit();
-void i386_fldcw_mem(s4 mem);
-void i386_fldcw_membase(s4 basereg, s4 disp);
-void i386_wait();
-void i386_ffree_reg(s4 reg);
-void i386_fdecstp();
-void i386_fincstp();
-
-#endif
-
-
-
-/* function gen_resolvebranch **************************************************
-
-    backpatches a branch instruction
-
-    parameters: ip ... pointer to instruction after branch (void*)
-                so ... offset of instruction after branch  (s4)
-                to ... offset of branch target             (s4)
-
-*******************************************************************************/
-
-#define gen_resolvebranch(ip,so,to) \
-    *((void **) ((ip) - 4)) = (void **) ((to) - (so));
-
-#endif
diff --git a/i386/threads.h b/i386/threads.h
deleted file mode 100644 (file)
index 72fa863..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* i386/threads.h **************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    System dependent part of thread header file.
-
-    Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-             Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: threads.h 526 2003-10-22 21:14:50Z twisti $
-
-*******************************************************************************/
-
-
-#ifndef __sysdep_threads_h
-#define __sysdep_threads_h
-
-#include "config.h"
-#include "threads/thread.h"
-
-/* Thread handling */
-
-/* prototypes */
-
-void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
-u1*  asm_initialize_thread_stack (void *func, u1 *stack);
-
-/* access macros */
-
-#define        THREADSTACKSIZE         (32 * 1024)
-
-#define        THREADSWITCH(to, from)  asm_perform_threadswitch(&(from)->restorePoint,\
-                                    &(to)->restorePoint, &(from)->usedStackTop)
-
-#define THREADINIT(to, func)    (to)->restorePoint =                         \
-                                    asm_initialize_thread_stack((u1*)(func), \
-                                                            (to)->stackEnd)
-
-#define        THREADINFO(e) \
-    do { \
-        (e)->restorePoint = 0; \
-        (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
-    } while(0)
-
-#endif
diff --git a/i386/types.h b/i386/types.h
deleted file mode 100644 (file)
index 14a01f1..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* i386/types.h ****************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Machine specific definitions for the i386 processor
-       
-    Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-             Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-             Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-             Christan Thalinger
-
-    Last Change: $Id: types.h 524 2003-10-22 21:13:55Z twisti $
-
-*******************************************************************************/
-
-#ifndef _CACAO_TYPES_H
-#define _CACAO_TYPES_H
-
-#define POINTERSIZE         4
-#define WORDS_BIGENDIAN     0
-
-#define SUPPORT_DIVISION    1
-#define SUPPORT_LONG        1
-#define SUPPORT_FLOAT       1
-#define SUPPORT_DOUBLE      1
-
-#define SUPPORT_LONG_ADD    1
-#define SUPPORT_LONG_CMP    1
-#define SUPPORT_LONG_LOG    1
-#define SUPPORT_LONG_SHIFT  1
-#define SUPPORT_LONG_MULDIV 0
-#define SUPPORT_LONG_ICVT   1
-#define SUPPORT_LONG_FCVT   1
-
-#define CONDITIONAL_LOADCONST
-#define NO_DIV_OPT
-
-#define U8_AVAILABLE        1
-
-
-typedef signed char             s1;
-typedef unsigned char           u1;
-typedef signed short int        s2;
-typedef unsigned short int      u2;
-
-typedef signed int              s4;
-typedef unsigned int            u4;
-
-#if U8_AVAILABLE
-typedef signed long long int    s8;
-typedef unsigned long long int  u8;
-#else
-typedef struct {u4 low, high;}  u8;
-#define s8 u8
-#endif
-
-#endif /* _CACAO_TYPES_H */
diff --git a/jit.c b/jit.c
deleted file mode 100644 (file)
index 01728cb..0000000
--- a/jit.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/* jit.c ***********************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties.
-
-       Contains the functions which translates a JavaVM method into native code.
-       This is the new version of the compiler which is a lot faster and has new
-       exception handling schemes. The main function is new_comp.
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: $Id: jit.c 552 2003-11-01 20:47:35Z twisti $
-
-*******************************************************************************/
-
-#include "global.h"    /* we define _GNU_SOURCE there */
-
-#include <signal.h>
-
-#include "tables.h"
-#include "loader.h"
-#include "jit.h"
-#include "builtin.h"
-#include "native.h"
-#include "asmpart.h"
-
-#include "threads/thread.h"
-
-/* include compiler data types ************************************************/ 
-
-#include "jit/jitdef.h"
-#include "narray/loop.h"
-
-
-/* global switches ************************************************************/
-int num_compiled_m = 0;
-int myCount;
-
-bool compileverbose =  false;
-bool showstack = false;
-bool showdisassemble = false; 
-bool showddatasegment = false; 
-bool showintermediate = false;
-int  optimizelevel = 0;
-
-bool useinlining = false;
-bool inlinevirtuals = false;
-bool inlineexceptions = false;
-bool inlineparamopt = false;
-bool inlineoutsiders = false;
-
-bool checkbounds = true;
-bool checknull = true;
-bool opt_noieee = false;
-bool checksync = true;
-bool opt_loops = false;
-
-bool getcompilingtime = false;
-long compilingtime = 0;
-
-int  has_ext_instr_set = 0;
-
-bool statistics = false;         
-
-int count_jit_calls = 0;
-int count_methods = 0;
-int count_spills = 0;
-int count_pcmd_activ = 0;
-int count_pcmd_drop = 0;
-int count_pcmd_zero = 0;
-int count_pcmd_const_store = 0;
-int count_pcmd_const_alu = 0;
-int count_pcmd_const_bra = 0;
-int count_pcmd_load = 0;
-int count_pcmd_move = 0;
-int count_load_instruction = 0;
-int count_pcmd_store = 0;
-int count_pcmd_store_comb = 0;
-int count_dup_instruction = 0;
-int count_pcmd_op = 0;
-int count_pcmd_mem = 0;
-int count_pcmd_met = 0;
-int count_pcmd_bra = 0;
-int count_pcmd_table = 0;
-int count_pcmd_return = 0;
-int count_pcmd_returnx = 0;
-int count_check_null = 0;
-int count_check_bound = 0;
-int count_max_basic_blocks = 0;
-int count_basic_blocks = 0;
-int count_javainstr = 0;
-int count_max_javainstr = 0;
-int count_javacodesize = 0;
-int count_javaexcsize = 0;
-int count_calls = 0;
-int count_tryblocks = 0;
-int count_code_len = 0;
-int count_data_len = 0;
-int count_cstub_len = 0;
-int count_nstub_len = 0;
-int count_max_new_stack = 0;
-int count_upper_bound_new_stack = 0;
-static int count_block_stack_init[11] = {0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0};
-int *count_block_stack = count_block_stack_init;
-static int count_analyse_iterations_init[5] = {0, 0, 0, 0, 0};
-int *count_analyse_iterations = count_analyse_iterations_init;
-static int count_method_bb_distribution_init[9] = {0, 0, 0, 0, 0,  0, 0, 0, 0};
-int *count_method_bb_distribution = count_method_bb_distribution_init;
-static int count_block_size_distribution_init[18] = {0, 0, 0, 0, 0,
-       0, 0, 0, 0, 0,   0, 0, 0, 0, 0,   0, 0, 0};
-int *count_block_size_distribution = count_block_size_distribution_init;
-static int count_store_length_init[21] = {0, 0, 0, 0, 0,  0, 0, 0, 0, 0,
-                                          0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0};
-int *count_store_length = count_store_length_init;
-static int count_store_depth_init[11] = {0, 0, 0, 0, 0,  0, 0, 0, 0, 0,   0};
-int *count_store_depth = count_store_depth_init;
-
-
-
-/* global compiler variables **************************************************/
-
-                                /* data about the currently compiled method   */
-
-static classinfo  *class;       /* class the compiled method belongs to       */
-static methodinfo *method;      /* pointer to method info of compiled method  */
-static utf        *descriptor;  /* type descriptor of compiled method         */
-static int         mparamcount; /* number of parameters (incl. this)          */
-static u1         *mparamtypes; /* types of all parameters (TYPE_INT, ...)    */
-static int         mreturntype; /* return type of method                      */
-       
-static int maxstack;            /* maximal JavaVM stack size                  */
-static int maxlocals;           /* maximal number of local JavaVM variables   */
-static int jcodelength;         /* length of JavaVM-codes                     */
-static u1 *jcode;               /* pointer to start of JavaVM-code            */
-static int exceptiontablelength;/* length of exception table                  */
-static xtable *extable;         /* pointer to start of exception table        */
-static exceptiontable *raw_extable;
-
-static int block_count;         /* number of basic blocks                     */
-static basicblock *block;       /* points to basic block array                */
-static int *block_index;        /* a table which contains for every byte of   */
-                                /* JavaVM code a basic block index if at this */
-                                /* byte there is the start of a basic block   */
-
-static int instr_count;         /* number of JavaVM instructions              */
-static instruction *instr;      /* points to intermediate code instructions   */
-
-static int stack_count;         /* number of stack elements                   */
-static stackelement *stack;     /* points to intermediate code instructions   */
-
-static bool isleafmethod;       /* true if a method doesn't call subroutines  */
-
-static basicblock *last_block;  /* points to the end of the BB list           */
-
-/* list of all classes used by the compiled method which have to be           */
-/* initialised (if not already done) before execution of this method          */
-
-static chain *uninitializedclasses;  
-                                
-
-/* include compiler subsystems ************************************************/
-
-#include "ngen.h"        /* code generator header file                 */ 
-#include "disass.c"      /* disassembler (for debug purposes only)     */ 
-#include "jit/mcode.c"          /* code generation tool functions             */ 
-#include "jit/parse.c"          /* parsing of JavaVM code                     */ 
-#include "jit/reg.c"            /* register allocation and support routines   */ 
-#include "jit/stack.c"          /* analysing the stack operations             */ 
-#include "ngen.c"        /* code generator                             */ 
-#include "narray/graph.c"      /* array bound removal                        */
-#include "narray/loop.c"       /* array bound removal                        */
-#include "narray/tracing.c"    /* array bound removal                        */
-#include "narray/analyze.c"    /* array bound removal                        */
-
-
-/* dummy function, used when there is no JavaVM code available                */
-
-static void* do_nothing_function() 
-{
-       return NULL;
-}
-
-
-/* jit_compile *****************************************************************
-
-       jit_compile, new version of compiler, translates one method to machine code
-
-*******************************************************************************/
-
-methodptr jit_compile(methodinfo *m)
-{
-       int dumpsize;
-       long starttime = 0;
-       long stoptime  = 0;
-
-       count_jit_calls++;
-
-       /* if method has been already compiled return immediately */
-
-       if (m->entrypoint)
-               return m->entrypoint;
-
-       count_methods++;
-
-       intsDisable();      /* disable interrupts */
-       
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size ();
-
-       /* measure time */
-
-       if (getcompilingtime)
-               starttime = getcputime();
-
-       /* if there is no javacode print error message and return empty method    */
-
-       if (! m->jcode) {
-               sprintf(logtext, "No code given for: ");
-               utf_sprint(logtext+strlen(logtext), m->class->name);
-               strcpy(logtext+strlen(logtext), ".");
-               utf_sprint(logtext+strlen(logtext), m->name);
-               utf_sprint(logtext+strlen(logtext), m->descriptor);
-               dolog();
-               intsRestore();                             /* enable interrupts again */
-               return (methodptr) do_nothing_function;    /* return empty method     */
-               }
-
-       /* print log message for compiled method */
-
-       if (compileverbose) {
-               sprintf(logtext, "Compiling: ");
-               utf_sprint(logtext+strlen(logtext), m->class->name);
-               strcpy(logtext+strlen(logtext), ".");
-               utf_sprint(logtext+strlen(logtext), m->name);
-               utf_sprint(logtext+strlen(logtext), m->descriptor);
-               dolog ();
-               }
-
-
-       /* initialisation of variables and subsystems */
-
-       isleafmethod = true;
-
-       method = m;
-       class = m->class;
-       descriptor = m->descriptor;
-       maxstack = m->maxstack;
-       maxlocals = m->maxlocals;
-       jcodelength = m->jcodelength;
-       jcode = m->jcode;
-       exceptiontablelength = m->exceptiontablelength;
-       raw_extable = m->exceptiontable;
-
-#ifdef STATISTICS
-       count_tryblocks += exceptiontablelength;
-       count_javacodesize += jcodelength + 18;
-       count_javaexcsize += exceptiontablelength * POINTERSIZE;
-#endif
-
-       /* initialise parameter type descriptor */
-
-       descriptor2types (m);
-       mreturntype = m->returntype;
-       mparamcount = m->paramcount;
-       mparamtypes = m->paramtypes;
-
-       /* initialize class list with class the compiled method belongs to */
-
-       uninitializedclasses = chain_new(); 
-       compiler_addinitclass (m->class);
-
-
-       /* call the compiler passes ***********************************************/
-       
-       reg_init();
-
-       if (useinlining) inlining_init();
-
-       local_init();
-
-       mcode_init();
-
-       parse();
-
-       analyse_stack();
-   
-       if (opt_loops) {
-               depthFirst();                   
-
-#ifdef LOOP_DEBUG
-               resultPass1();                  
-               fflush(stdout);
-#endif 
-
-               analyseGraph();         
-
-#ifdef LOOP_DEBUG
-               resultPass2(); 
-               fflush(stdout);
-#endif 
-
-               optimize_loops();
-
-#ifdef LOOP_DEBUG
-               /* resultPass3(); */
-#endif 
-       }
-   
-#ifdef SPECIALMEMUSE
-       preregpass();
-#endif
-       
-#ifdef LOOP_DEBUG
-       printf("Allocating registers  ");
-       fflush(stdout);
-#endif 
-
-       interface_regalloc();
-
-#ifdef LOOP_DEBUG
-       printf(".");
-       fflush(stdout);
-#endif 
-
-       allocate_scratch_registers();
-
-#ifdef LOOP_DEBUG
-       printf(".");
-       fflush(stdout); 
-#endif 
-
-       local_regalloc();
-
-#ifdef LOOP_DEBUG
-       printf(". done\n");
-
-       printf("Generating MCode ... ");
-       fflush(stdout);
-#endif 
-
-       gen_mcode();
-
-#ifdef LOOP_DEBUG
-       printf("done\n");
-       fflush(stdout);
-#endif 
-
-       /* intermediate and assembly code listings ********************************/
-               
-       if (showintermediate)
-               show_icmd_method();
-       else if (showdisassemble)
-               disassemble((void*) (m->mcode + dseglen), m->mcodelength - dseglen);
-
-       if (showddatasegment)
-               dseg_display((void*) (m->mcode));
-
-       /* release dump area */
-
-       dump_release (dumpsize);
-
-       /* measure time */
-
-       if (getcompilingtime) {
-               stoptime = getcputime();
-               compilingtime += (stoptime-starttime); 
-               }
-
-       /* initialize all used classes */
-       /* because of reentrant code global variables are not allowed here        */
-
-       {
-       chain *ul = uninitializedclasses;   /* list of uninitialized classes      */ 
-       classinfo *c;                       /* single class                       */
-
-       while ((c = chain_first(ul)) != NULL) {
-               chain_remove (ul);
-               class_init (c);                         /* may again call the compiler        */
-               }
-       chain_free (ul);
-       }
-
-       intsRestore();    /* enable interrupts again */
-
-       /* return pointer to the methods entry point */
-       
-       return m -> entrypoint;
-} 
-
-/* functions for compiler initialisation and finalisation *********************/
-
-#ifdef USEBUILTINTABLE
-static int stdopcompare(const void *a, const void *b)
-{
-       stdopdescriptor *o1 = (stdopdescriptor *) a;
-       stdopdescriptor *o2 = (stdopdescriptor *) b;
-       return (o1->opcode < o2->opcode) ? -1 : (o1->opcode > o2->opcode);
-}
-
-static inline void testsort()
-{
-       int len;
-
-       len = sizeof(stdopdescriptortable)/sizeof(stdopdescriptor);
-       qsort(stdopdescriptortable, len, sizeof(stdopdescriptor), stdopcompare);
-       len = sizeof(builtintable)/sizeof(stdopdescriptor);
-       qsort(builtintable, len, sizeof(stdopdescriptor), stdopcompare);
-}
-#endif
-
-void jit_init ()
-{
-       int i;
-
-#ifdef USEBUILTINTABLE
-       testsort();
-#endif
-
-#if defined(__ALPHA__)
-       has_ext_instr_set = ! has_no_x_instr_set();
-#endif
-
-       for (i = 0; i < 256; i++)
-               stackreq[i] = 1;
-
-       stackreq[JAVA_NOP]          = 0;
-       stackreq[JAVA_ISTORE]       = 0;
-       stackreq[JAVA_LSTORE]       = 0;
-       stackreq[JAVA_FSTORE]       = 0;
-       stackreq[JAVA_DSTORE]       = 0;
-       stackreq[JAVA_ASTORE]       = 0;
-       stackreq[JAVA_ISTORE_0]     = 0;
-       stackreq[JAVA_ISTORE_1]     = 0;
-       stackreq[JAVA_ISTORE_2]     = 0;
-       stackreq[JAVA_ISTORE_3]     = 0;
-       stackreq[JAVA_LSTORE_0]     = 0;
-       stackreq[JAVA_LSTORE_1]     = 0;
-       stackreq[JAVA_LSTORE_2]     = 0;
-       stackreq[JAVA_LSTORE_3]     = 0;
-       stackreq[JAVA_FSTORE_0]     = 0;
-       stackreq[JAVA_FSTORE_1]     = 0;
-       stackreq[JAVA_FSTORE_2]     = 0;
-       stackreq[JAVA_FSTORE_3]     = 0;
-       stackreq[JAVA_DSTORE_0]     = 0;
-       stackreq[JAVA_DSTORE_1]     = 0;
-       stackreq[JAVA_DSTORE_2]     = 0;
-       stackreq[JAVA_DSTORE_3]     = 0;
-       stackreq[JAVA_ASTORE_0]     = 0;
-       stackreq[JAVA_ASTORE_1]     = 0;
-       stackreq[JAVA_ASTORE_2]     = 0;
-       stackreq[JAVA_ASTORE_3]     = 0;
-       stackreq[JAVA_IASTORE]      = 0;
-       stackreq[JAVA_LASTORE]      = 0;
-       stackreq[JAVA_FASTORE]      = 0;
-       stackreq[JAVA_DASTORE]      = 0;
-       stackreq[JAVA_AASTORE]      = 0;
-       stackreq[JAVA_BASTORE]      = 0;
-       stackreq[JAVA_CASTORE]      = 0;
-       stackreq[JAVA_SASTORE]      = 0;
-       stackreq[JAVA_POP]          = 0;
-       stackreq[JAVA_POP2]         = 0;
-       stackreq[JAVA_IINC]         = 0;
-       stackreq[JAVA_IFEQ]         = 0;
-       stackreq[JAVA_IFNE]         = 0;
-       stackreq[JAVA_IFLT]         = 0;
-       stackreq[JAVA_IFGE]         = 0;
-       stackreq[JAVA_IFGT]         = 0;
-       stackreq[JAVA_IFLE]         = 0;
-       stackreq[JAVA_IF_ICMPEQ]    = 0;
-       stackreq[JAVA_IF_ICMPNE]    = 0;
-       stackreq[JAVA_IF_ICMPLT]    = 0;
-       stackreq[JAVA_IF_ICMPGE]    = 0;
-       stackreq[JAVA_IF_ICMPGT]    = 0;
-       stackreq[JAVA_IF_ICMPLE]    = 0;
-       stackreq[JAVA_IF_ACMPEQ]    = 0;
-       stackreq[JAVA_IF_ACMPNE]    = 0;
-       stackreq[JAVA_GOTO]         = 0;
-       stackreq[JAVA_RET]          = 0;
-       stackreq[JAVA_TABLESWITCH]  = 0;
-       stackreq[JAVA_LOOKUPSWITCH] = 0;
-       stackreq[JAVA_IRETURN]      = 0;
-       stackreq[JAVA_LRETURN]      = 0;
-       stackreq[JAVA_FRETURN]      = 0;
-       stackreq[JAVA_DRETURN]      = 0;
-       stackreq[JAVA_ARETURN]      = 0;
-       stackreq[JAVA_RETURN]       = 0;
-       stackreq[JAVA_PUTSTATIC]    = 0;
-       stackreq[JAVA_PUTFIELD]     = 0;
-       stackreq[JAVA_MONITORENTER] = 0;
-       stackreq[JAVA_MONITOREXIT]  = 0;
-       stackreq[JAVA_WIDE]         = 0;
-       stackreq[JAVA_IFNULL]       = 0;
-       stackreq[JAVA_IFNONNULL]    = 0;
-       stackreq[JAVA_GOTO_W]       = 0;
-       stackreq[JAVA_BREAKPOINT]   = 0;
-
-       stackreq[JAVA_SWAP] = 2;
-       stackreq[JAVA_DUP2] = 2;
-       stackreq[JAVA_DUP_X1] = 3;
-       stackreq[JAVA_DUP_X2] = 4;
-       stackreq[JAVA_DUP2_X1] = 3;
-       stackreq[JAVA_DUP2_X2] = 4;
-       
-       init_exceptions();
-}
-
-
-void jit_close()
-{
-       mcode_close();
-       reg_close();
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/jit.h b/jit.h
deleted file mode 100644 (file)
index effae33..0000000
--- a/jit.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* jit.h ***********************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       new compiler header file for inclusion in other moduls.
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/11/05
-
-*******************************************************************************/
-
-#ifndef __jit__
-#define __jit__
-
-/* compiler switches (set by main function) ***********************************/
-
-extern bool runverbose;         /* trace all method invocation                */
-extern bool compileverbose;     /* trace compiler actions                     */
-extern bool showdisassemble;    /* generate disassembler listing              */
-extern bool showddatasegment;   /* generate data segment listing              */
-extern bool showintermediate;   /* generate intermediate code listing         */
-extern int  optimizelevel;      /* optimzation level  (0 = no optimization)   */
-
-extern bool useinlining;       /* use method inlining                        */
-extern bool inlinevirtuals; /* inline unique virtual methods */
-extern bool inlineexceptions; /* inline methods, that contain excptions */
-extern bool inlineparamopt; /* optimize parameter passing to inlined methods */
-extern bool inlineoutsiders; /* inline methods, that are not member of the invoker's class */
-
-
-extern bool checkbounds;        /* check array bounds                         */
-extern bool opt_loops;          /* optimize array accesses in loops           */
-extern bool checknull;          /* check null pointers                        */
-extern bool opt_noieee;         /* don't implement ieee compliant floats      */
-extern bool checksync;          /* do synchronization                         */
-
-extern bool getcompilingtime;   /* compute compile time                       */
-extern long compilingtime;      /* accumulated compile time                   */
-
-extern int  has_ext_instr_set;  /* has instruction set extensions */
-
-extern bool statistics;         
-
-extern int count_jit_calls;
-extern int count_methods;
-extern int count_spills;
-extern int count_pcmd_activ;
-extern int count_pcmd_drop;
-extern int count_pcmd_zero;
-extern int count_pcmd_const_store;
-extern int count_pcmd_const_alu;
-extern int count_pcmd_const_bra;
-extern int count_pcmd_load;
-extern int count_pcmd_move;
-extern int count_load_instruction;
-extern int count_pcmd_store;
-extern int count_pcmd_store_comb;
-extern int count_dup_instruction;
-extern int count_pcmd_op;
-extern int count_pcmd_mem;
-extern int count_pcmd_met;
-extern int count_pcmd_bra;
-extern int count_pcmd_table;
-extern int count_pcmd_return;
-extern int count_pcmd_returnx;
-extern int count_check_null;
-extern int count_check_bound;
-extern int count_max_basic_blocks;
-extern int count_basic_blocks;
-extern int count_max_javainstr;
-extern int count_javainstr;
-extern int count_javacodesize;
-extern int count_javaexcsize;
-extern int count_calls;
-extern int count_tryblocks;
-extern int count_code_len;
-extern int count_data_len;
-extern int count_cstub_len;
-extern int count_nstub_len;
-extern int count_max_new_stack;
-extern int count_upper_bound_new_stack;
-extern int *count_block_stack;
-extern int *count_analyse_iterations;
-extern int *count_method_bb_distribution;
-extern int *count_block_size_distribution;
-extern int *count_store_length;
-extern int *count_store_depth;
-
-/* prototypes *****************************************************************/
-
-methodptr jit_compile (methodinfo *m);  /* compile a method with jit compiler */
-
-void jit_init();                        /* compiler initialisation            */
-void jit_close();                       /* compiler finalisation              */
-
-u1 *createcompilerstub (methodinfo *m);
-u1 *createnativestub (functionptr f, methodinfo *m);
-
-void removecompilerstub (u1 *stub);
-void removenativestub (u1 *stub);
-/*------------ Method /Class Used Markers -------------------------------*/                 
-
-/* Class flags =
-   USED all methods and fields are available; 
-   PARTUSED = specific methods (static, <init>, <clinit>, inherited def used, special) used, 
-             but not instanciated
-   NOTUSED = nothing used in class - not needed 
-*/
-
-/* Method Flags =
-   USED = method definition is used
-   PARTUSED = method definition will be used if class instanciated
-   NOTUSED  = method defintion never used
-*/
-
-#define USED      2
-#define PARTUSED  1
-#define MARKED    1
-#define NOTUSED   0
-
-#define MONO      0
-#define MONO1    1 /* potential poly that is really mono */
-#define POLY      2
-
-#endif
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
index 6877826bf4db3e47c7d247870fb4eef0aa831f42..5c4858250464b9cdd08ea847f3acf0768629ecb4 100644 (file)
@@ -1,2 +1,37 @@
-EXTRA_DIST = mcode.c parse.c reg.c stack.c jitdef.h inline.c parseRT.h \
-               parseRTprint.h sets.h sets.c parseRTstats.h
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+
+SUBDIRS = loop @ARCH_DIR@
+DIST_SUBDIRS = loop alpha i386 mips powerpc x86_64
+
+INCLUDES = -I$(top_srcdir)/jit/@ARCH_DIR@ -I$(top_srcdir)/jit
+
+EXTRA_DIST = \
+       jit.c \
+       jit.h \
+       codegen.inc \
+       parse.c \
+       reg.inc \
+       stack.c \
+       jitdef.h \
+       inline.c \
+       sets.c \
+       sets.h \
+       parseRT.c \
+       parseRTprint.h \
+       parseRTstats.c
+
+noinst_LIBRARIES = libjit.a
+
+libjit_a_SOURCES = jit.c parse.c stack.c inline.c sets.c parseRT.c parseRTstats.c
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
index 082f0ac6356188906b9f3e25bcff350cb967843d..ea058cc297cfd6b4a47bbff0a91eadb7832730bf 100644 (file)
@@ -10,6 +10,8 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+# $Id: Makefile.in 557 2003-11-02 22:51:59Z twisti $
+
 
 SHELL = @SHELL@
 
@@ -59,24 +61,45 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 host_alias = @host_alias@
 host_triplet = @host@
-ASMPART = @ASMPART@
-BOEHM_LIB = @BOEHM_LIB@
+ARCH_DIR = @ARCH_DIR@
 CC = @CC@
 COMPILER_OBJECTS = @COMPILER_OBJECTS@
-GC_OBJ = @GC_OBJ@
 LIBTHREAD = @LIBTHREAD@
 MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
-SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
-EXTRA_DIST = mcode.c parse.c reg.c stack.c jitdef.h inline.c parseRT.h                 parseRTprint.h sets.h sets.c parseRTstats.h
+SUBDIRS = loop @ARCH_DIR@
+DIST_SUBDIRS = loop alpha i386 mips powerpc x86_64
+
+INCLUDES = -I$(top_srcdir)/jit/@ARCH_DIR@ -I$(top_srcdir)/jit
+
+EXTRA_DIST =   jit.c   jit.h   codegen.inc     parse.c         reg.inc         stack.c         jitdef.h        inline.c        sets.c  sets.h  parseRT.c       parseRTprint.h  parseRTstats.c
+
+
+noinst_LIBRARIES = libjit.a
 
+libjit_a_SOURCES = jit.c parse.c stack.c inline.c sets.c parseRT.c parseRTstats.c
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
+LIBRARIES =  $(noinst_LIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libjit_a_LIBADD = 
+libjit_a_OBJECTS =  jit.o parse.o stack.o inline.o sets.o parseRT.o \
+parseRTstats.o
+AR = ar
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
 DIST_COMMON =  Makefile.am Makefile.in
 
 
@@ -84,8 +107,14 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
 TAR = tar
 GZIP_ENV = --best
+DEP_FILES =  .deps/inline.P .deps/jit.P .deps/parse.P .deps/parseRT.P \
+.deps/parseRTstats.P .deps/sets.P .deps/stack.P
+SOURCES = $(libjit_a_SOURCES)
+OBJECTS = $(libjit_a_OBJECTS)
+
 all: all-redirect
 .SUFFIXES:
+.SUFFIXES: .S .c .o .s
 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu jit/Makefile
 
@@ -93,9 +122,125 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
        cd $(top_builddir) \
          && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
+
+mostlyclean-noinstLIBRARIES:
+
+clean-noinstLIBRARIES:
+       -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+distclean-noinstLIBRARIES:
+
+maintainer-clean-noinstLIBRARIES:
+
+.s.o:
+       $(COMPILE) -c $<
+
+.S.o:
+       $(COMPILE) -c $<
+
+mostlyclean-compile:
+       -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+       -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+libjit.a: $(libjit_a_OBJECTS) $(libjit_a_DEPENDENCIES)
+       -rm -f libjit.a
+       $(AR) cru libjit.a $(libjit_a_OBJECTS) $(libjit_a_LIBADD)
+       $(RANLIB) libjit.a
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive  \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+       @set fnord $(MAKEFLAGS); amf=$$2; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @set fnord $(MAKEFLAGS); amf=$$2; \
+       dot_seen=no; \
+       rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+         rev="$$subdir $$rev"; \
+         test "$$subdir" != "." || dot_seen=yes; \
+       done; \
+       test "$$dot_seen" = "no" && rev=". $$rev"; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+
 tags: 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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+   if test "$$subdir" = .; then :; else \
+           test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+   fi; \
+       done; \
+       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 -o $$here/TAGS $(ETAGS_ARGS) $$tags  $$unique $(LISP))
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+       -rm -f TAGS ID
+
+maintainer-clean-tags:
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 
@@ -117,30 +262,73 @@ distdir: $(DISTFILES)
            || cp -p $$d/$$file $(distdir)/$$file || :; \
          fi; \
        done
+       for subdir in $(DIST_SUBDIRS); do \
+         if test "$$subdir" = .; then :; else \
+           test -d $(distdir)/$$subdir \
+           || mkdir $(distdir)/$$subdir \
+           || exit 1; \
+           chmod 777 $(distdir)/$$subdir; \
+           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
+             || exit 1; \
+         fi; \
+       done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+       -rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+       @echo '$(COMPILE) -c $<'; \
+       $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-cp .deps/$(*F).pp .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm .deps/$(*F).pp
+
+%.lo: %.c
+       @echo '$(LTCOMPILE) -c $<'; \
+       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
+         < .deps/$(*F).pp > .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm -f .deps/$(*F).pp
 info-am:
-info: info-am
+info: info-recursive
 dvi-am:
-dvi: dvi-am
+dvi: dvi-recursive
 check-am: all-am
-check: check-am
+check: check-recursive
 installcheck-am:
-installcheck: installcheck-am
+installcheck: installcheck-recursive
 install-exec-am:
-install-exec: install-exec-am
+install-exec: install-exec-recursive
 
 install-data-am:
-install-data: install-data-am
+install-data: install-data-recursive
 
 install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
+install: install-recursive
 uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile
-all-redirect: all-am
+uninstall: uninstall-recursive
+all-am: Makefile $(LIBRARIES)
+all-redirect: all-recursive
 install-strip:
        $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
+installdirs: installdirs-recursive
+installdirs-am:
 
 
 mostlyclean-generic:
@@ -152,28 +340,46 @@ distclean-generic:
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
 
 maintainer-clean-generic:
-mostlyclean-am:  mostlyclean-generic
+mostlyclean-am:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
+               mostlyclean-tags mostlyclean-depend mostlyclean-generic
 
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
 
-clean-am:  clean-generic mostlyclean-am
+clean-am:  clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
+               clean-generic mostlyclean-am
 
-clean: clean-am
+clean: clean-recursive
 
-distclean-am:  distclean-generic clean-am
+distclean-am:  distclean-noinstLIBRARIES distclean-compile \
+               distclean-tags distclean-depend distclean-generic \
+               clean-am
 
-distclean: distclean-am
+distclean: distclean-recursive
 
-maintainer-clean-am:  maintainer-clean-generic distclean-am
+maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
+               maintainer-clean-compile maintainer-clean-tags \
+               maintainer-clean-depend 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: tags distdir info-am info dvi-am dvi check check-am \
+maintainer-clean: maintainer-clean-recursive
+
+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
+clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile install-data-recursive \
+uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
 installcheck-am installcheck install-exec-am install-exec \
 install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
+all-redirect all-am all installdirs-am installdirs mostlyclean-generic \
 distclean-generic clean-generic maintainer-clean-generic clean \
 mostlyclean distclean maintainer-clean
 
diff --git a/jit/alpha/Makefile.am b/jit/alpha/Makefile.am
new file mode 100644 (file)
index 0000000..99adcce
--- /dev/null
@@ -0,0 +1,33 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+
+INCLUDES = -I$(top_srcdir)/jit
+
+EXTRA_DIST = \
+       asmpart.S \
+       disass.c \
+       disass.h \
+       native-math.h \
+       codegen.c \
+       codegen.h \
+       types.h \
+       threads.h \
+       sigcontext.h
+
+noinst_LIBRARIES = libarch.a
+
+libarch_a_SOURCES = asmpart.S codegen.c disass.c
+
+%.o: %.S
+       $(COMPILE) -c $<
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
diff --git a/jit/alpha/asmpart.S b/jit/alpha/asmpart.S
new file mode 100644 (file)
index 0000000..0e71fb3
--- /dev/null
@@ -0,0 +1,1229 @@
+/* -*- mode: asm; tab-width: 4 -*- */
+/****************************** asmpart.S **************************************
+*                                                                              *
+*   It contains the Java-C interface functions for Alpha processors.           *
+*                                                                              *
+*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
+*                                                                              *
+*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
+*                                                                              *
+*   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
+*            Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
+*                                                                              *
+*   Last Change: 2003/02/17                                                    *
+*                                                                              *
+*******************************************************************************/
+
+#include "offsets.h"
+
+#define v0      $0
+
+#define t0      $1
+#define t1      $2
+#define t2      $3
+#define t3      $4
+#define t4      $5
+#define t5      $6
+#define t6      $7
+#define t7      $8
+
+#define        s0      $9
+#define        s1      $10
+#define        s2      $11
+#define        s3      $12
+#define        s4      $13
+#define        s5      $14
+#define        s6      $15
+
+#define a0      $16
+#define a1      $17
+#define a2      $18
+#define a3      $19
+#define a4      $20
+#define a5      $21
+
+#define t8      $22
+#define t9      $23
+#define t10     $24
+#define t11     $25
+#define ra      $26
+#define t12     $27
+
+#define pv      t12
+#define AT      $at
+#define gp      $29
+#define sp      $30
+#define zero    $31
+
+#define itmp1   $25
+#define itmp2   $28
+#define itmp3   $29
+
+#define xptr    itmp1
+#define xpc     itmp2
+
+#define sf0     $f2
+#define sf1     $f3
+#define sf2     $f4
+#define sf3     $f5
+#define sf4     $f6
+#define sf5     $f7
+#define sf6     $f8
+#define sf7     $f9
+
+#define fzero   $f31
+
+
+#define PAL_imb 134
+
+       .text
+       .set    noat
+       .set    noreorder
+
+
+/********************* exported functions and variables ***********************/
+
+       .globl has_no_x_instr_set
+       .globl synchronize_caches
+       .globl asm_calljavamethod
+       .globl asm_calljavafunction
+       .globl asm_call_jit_compiler
+       .globl asm_dumpregistersandcall
+       .globl asm_handle_exception
+       .globl asm_handle_nat_exception
+       .globl asm_builtin_checkcast    
+       .globl asm_builtin_checkarraycast
+       .globl asm_builtin_aastore
+       .globl asm_builtin_monitorenter
+       .globl asm_builtin_monitorexit
+       .globl asm_builtin_idiv
+       .globl asm_builtin_irem
+       .globl asm_builtin_ldiv
+       .globl asm_builtin_lrem
+       .globl asm_perform_threadswitch
+       .globl asm_initialize_thread_stack
+       .globl asm_switchstackandcall
+       .globl asm_getcallingmethod
+       .globl asm_builtin_trace
+       .globl asm_builtin_exittrace
+
+/*************************** imported functions *******************************/
+
+       .globl jit_compile
+       .globl builtin_monitorexit
+       .globl builtin_throw_exception
+       .globl builtin_trace_exception
+       .globl class_java_lang_Object
+
+
+/*********************** function has_no_x_instr_set ***************************
+*                                                                              *
+*   determines if the byte support instruction set (21164a and higher)         *
+*   is available.                                                              *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    has_no_x_instr_set
+has_no_x_instr_set:
+
+       .long   0x47e03c20                /* amask   1,v0                         */
+       jmp     zero,(ra)                 /* return                               */
+
+       .end    has_no_x_instr_set
+
+
+/********************* function synchronize_caches ****************************/
+
+       .ent    synchronize_caches
+synchronize_caches:
+
+       call_pal PAL_imb                  /* synchronise instruction cache        */
+       jmp     zero,(ra)                 /* return                               */
+
+       .end    synchronize_caches
+
+
+/********************* function asm_calljavamethod *****************************
+*                                                                              *
+*   This function calls a Java-method (which possibly needs compilation)       *
+*   with up to 4 parameters.                                                   *
+*                                                                              *
+*   This functions calls the JIT-compiler which eventually translates the      *
+*   method into machine code.                                                  *
+*                                                                              *
+*   An possibly throwed exception will be returned to the caller as function   *
+*   return value, so the java method cannot return a fucntion value (this      *
+*   function usually calls 'main' and '<clinit>' which do not return a         *
+*   function value).                                                           *
+*                                                                              *
+*   C-prototype:                                                               *
+*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
+*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
+*                                                                              *
+*******************************************************************************/
+
+#define        MethodPointer   -8
+#define        FrameSize       -12
+#define     IsSync          -16
+#define     IsLeaf          -20
+#define     IntSave         -24
+#define     FltSave         -28
+#define     ExTableSize     -32
+#define     ExTableStart    -32
+
+#define     ExEntrySize     -32
+#define     ExStartPC       -8
+#define     ExEndPC         -16
+#define     ExHandlerPC     -24
+#define     ExCatchType     -32
+
+       .ent    asm_calljavamethod
+
+call_name:
+       .ascii  "calljavamethod\0\0"
+
+       .align  3
+       .quad   0                         /* catch type all                       */
+       .quad   calljava_xhandler         /* handler pc                           */
+       .quad   calljava_xhandler         /* end pc                               */
+       .quad   asm_calljavamethod        /* start pc                             */
+       .long   1                         /* extable size                         */
+       .long   0                         /* fltsave                              */
+       .long   0                         /* intsave                              */
+       .long   0                         /* isleaf                               */
+       .long   0                         /* IsSync                               */
+       .long   32                        /* frame size                           */
+       .quad   0                         /* method pointer (pointer to name)     */
+
+asm_calljavamethod:
+
+       .frame $30,32,$26
+       .mask 0x4000000,-32
+       ldgp    gp,0(pv)
+       lda     sp,-32(sp)                /* allocate stack space                 */
+       stq     gp,24(sp)                 /* save global pointer                  */
+       stq     ra,0(sp)                  /* save return address                  */
+       .prologue 1
+
+       stq     a0,16(sp)                 /* save method pointer for compiler     */
+       lda     v0,16(sp)                 /* pass pointer to method pointer via v0*/
+
+       mov     a1,a0                     /* pass the remaining parameters        */
+       mov     a2,a1
+       mov     a3,a2
+       mov     a4,a3
+
+       lda     $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
+       stq     $28,8(sp)                 /* store function address               */
+       mov     sp,$28                    /* set method pointer                   */
+
+       ldq     pv,8($28)                 /* method call as in Java               */
+       jmp     ra,(pv)                   /* call JIT compiler                    */
+calljava_jit:
+       lda     pv,-64(ra)                /* asm_calljavamethod-calljava_jit !!!!!*/
+
+calljava_return:
+
+       ldq     ra,0(sp)                  /* restore return address               */
+       ldq     gp,24(sp)                 /* restore global pointer               */
+       lda     sp,32(sp)                 /* free stack space                     */
+    clr     v0
+
+calljava_ret:
+       jmp     zero,(ra)
+
+calljava_xhandler:
+
+       ldq     gp,24(sp)                 /* restore global pointer               */
+       mov     itmp1,a0
+       jsr     ra,builtin_throw_exception
+       ldq     ra,0(sp)                  /* restore return address               */
+       lda     sp,32(sp)                 /* free stack space                     */
+       jmp     zero,(ra)
+       .end    asm_calljavamethod
+
+
+/********************* function asm_calljavafunction ***************************
+*                                                                              *
+*   This function calls a Java-method (which possibly needs compilation)       *
+*   with up to 4 address parameters.                                           *
+*                                                                              *
+*   This functions calls the JIT-compiler which eventually translates the      *
+*   method into machine code.                                                  *
+*                                                                              *
+*   C-prototype:                                                               *
+*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
+*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_calljavafunction
+
+call_name2:
+       .ascii  "calljavafunction\0\0"
+
+       .align  3
+       .quad   0                         /* catch type all                       */
+       .quad   calljava_xhandler2        /* handler pc                           */
+       .quad   calljava_xhandler2        /* end pc                               */
+       .quad   asm_calljavafunction      /* start pc                             */
+       .long   1                         /* extable size                         */
+       .long   0                         /* fltsave                              */
+       .long   0                         /* intsave                              */
+       .long   0                         /* isleaf                               */
+       .long   0                         /* IsSync                               */
+       .long   32                        /* frame size                           */
+       .quad   0                         /* method pointer (pointer to name)     */
+
+asm_calljavafunction:
+
+       .frame $30,32,$26
+       .mask 0x4000000,-32
+       ldgp    gp,0(pv)
+       lda     sp,-32(sp)                /* allocate stack space                 */
+       stq     gp,24(sp)                 /* save global pointer                  */
+       stq     ra,0(sp)                  /* save return address                  */
+       .prologue 1
+
+       stq     a0,16(sp)                 /* save method pointer for compiler     */
+       lda     v0,16(sp)                 /* pass pointer to method pointer via v0*/
+
+       mov     a1,a0                     /* pass the remaining parameters        */
+       mov     a2,a1
+       mov     a3,a2
+       mov     a4,a3
+
+       lda     $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
+       stq     $28,8(sp)                 /* store function address               */
+       mov     sp,$28                    /* set method pointer                   */
+
+       ldq     pv,8($28)                 /* method call as in Java               */
+       jmp     ra,(pv)                   /* call JIT compiler                    */
+calljava_jit2:
+       lda     pv,-64(ra)                /* asm_calljavafunction-calljava_jit !!!!!*/
+
+calljava_return2:
+
+       ldq     ra,0(sp)                  /* restore return address               */
+       ldq     gp,24(sp)                 /* restore global pointer               */
+       lda     sp,32(sp)                 /* free stack space                     */
+
+calljava_ret2:
+       jmp     zero,(ra)
+
+calljava_xhandler2:
+
+       ldq     gp,24(sp)                 /* restore global pointer               */
+       mov     itmp1,a0
+       jsr     ra,builtin_throw_exception
+       ldq     ra,0(sp)                  /* restore return address               */
+       lda     sp,32(sp)                 /* free stack space                     */
+       jmp     zero,(ra)
+       .end    asm_calljavafunction
+                                               
+
+/****************** function asm_call_jit_compiler *****************************
+*                                                                              *
+*   invokes the compiler for untranslated JavaVM methods.                      *
+*                                                                              *
+*   Register R0 contains a pointer to the method info structure (prepared      *
+*   by createcompilerstub). Using the return address in R26 and the            *
+*   offset in the LDA instruction or using the value in methodptr R28 the      *
+*   patching address for storing the method address can be computed:           *
+*                                                                              *
+*   method address was either loaded using                                     *
+*   M_LDQ (REG_PV, REG_PV, a)        ; invokestatic/special    ($27)           *
+*   M_LDA (REG_PV, REG_RA, low)                                                *
+*   M_LDAH(REG_PV, REG_RA, high)     ; optional                                *
+*   or                                                                         *
+*   M_LDQ (REG_PV, REG_METHODPTR, m) ; invokevirtual/interface ($28)           *
+*   in the static case the method pointer can be computed using the            *
+*   return address and the lda function following the jmp instruction          *
+*                                                                              *
+*******************************************************************************/
+
+
+       .ent    asm_call_jit_compiler
+asm_call_jit_compiler:
+
+       .frame $30,0,$26
+       ldgp    gp,0(pv)
+       ldl     t8,-8(ra)             /* load instruction LDQ PV,xxx($yy)         */
+       srl     t8,16,t8              /* shift right register number $yy          */
+       and     t8,31,t8              /* isolate register number                  */
+       subl    t8,28,t8              /* test for REG_METHODPTR                   */
+       beq     t8,noregchange       
+       ldl     t8,0(ra)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t8,48,t8
+       sra     t8,48,t8              /* isolate offset                           */
+       addq    t8,ra,$28             /* compute update address                   */
+       ldl     t8,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t8,16,t8              /* isolate instruction code                 */
+       lda     t8,-0x177b(t8)        /* test for LDAH                            */
+       bne     t8,noregchange       
+       ldl     t8,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       sll     t8,16,t8              /* compute high offset                      */
+       addl    t8,0,t8               /* sign extend high offset                  */
+       addq    t8,$28,$28            /* compute update address                   */
+noregchange:
+       lda     sp,-14*8(sp)          /* reserve stack space                      */
+       stq     a0,0*8(sp)            /* save all argument registers              */
+       stq     a1,1*8(sp)            /* they could be used by method             */
+       stq     a2,2*8(sp)
+       stq     a3,3*8(sp)
+       stq     a4,4*8(sp)
+       stq     a5,5*8(sp)
+       stt     $f16,6*8(sp)
+       stt     $f17,7*8(sp)
+       stt     $f18,8*8(sp)
+       stt     $f19,9*8(sp)
+       stt     $f20,10*8(sp)
+       stt     $f21,11*8(sp)
+       stq     $28,12*8(sp)          /* save method pointer                      */
+       stq     ra,13*8(sp)           /* save return address                      */
+
+       ldq     a0,0(v0)              /* pass 'methodinfo' pointer to             */
+       jsr     ra,jit_compile        /* jit compiler                             */
+       ldgp    gp,0(ra)
+
+       call_pal PAL_imb              /* synchronise instruction cache            */
+
+       ldq     a0,0*8(sp)            /* load argument registers                  */
+       ldq     a1,1*8(sp)
+       ldq     a2,2*8(sp)
+       ldq     a3,3*8(sp)
+       ldq     a4,4*8(sp)
+       ldq     a5,5*8(sp)
+       ldt     $f16,6*8(sp)
+       ldt     $f17,7*8(sp)
+       ldt     $f18,8*8(sp)
+       ldt     $f19,9*8(sp)
+       ldt     $f20,10*8(sp)
+       ldt     $f21,11*8(sp)
+       ldq     $28,12*8(sp)          /* load method pointer                      */
+       ldq     ra,13*8(sp)           /* load return address                      */
+       lda     sp,14*8(sp)           /* deallocate stack area                    */
+
+       ldl     t8,-8(ra)             /* load instruction LDQ PV,xxx($yy)         */
+       sll     t8,48,t8
+       sra     t8,48,t8              /* isolate offset                           */
+
+       addq    t8,$28,t8             /* compute update address via method pointer*/
+       stq     v0,0(t8)              /* save new method address there            */
+
+       mov     v0,pv                 /* load method address into pv              */
+
+       jmp     zero,(pv)             /* and call method. The method returns      */
+                                     /* directly to the caller (ra).             */
+
+       .end    asm_call_jit_compiler
+
+
+/****************** function asm_dumpregistersandcall **************************
+*                                                                              *
+*   This funtion saves all callee saved registers and calls the function       *
+*   which is passed as parameter.                                              *
+*                                                                              *
+*   This function is needed by the garbage collector, which needs to access    *
+*   all registers which are stored on the stack. Unused registers are          *
+*   cleared to avoid interferances with the GC.                                *
+*                                                                              *
+*   void asm_dumpregistersandcall (functionptr f);                             *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_dumpregistersandcall
+asm_dumpregistersandcall:
+       lda     sp,-16*8(sp)          /* allocate stack                           */
+       stq     ra,0(sp)              /* save return address                      */
+
+       stq     s0,1*8(sp)            /* save all callee saved registers          */
+       stq     s1,2*8(sp)            /* intialize the remaining registers        */
+       stq     s2,3*8(sp)
+       stq     s3,4*8(sp)
+       stq     s4,5*8(sp)
+       stq     s5,6*8(sp)
+       stq     s6,7*8(sp)
+       stt     $f2,8*8(sp)
+       stt     $f3,9*8(sp)
+       stt     $f4,10*8(sp)
+       stt     $f5,11*8(sp)
+       stt     $f6,12*8(sp)
+       stt     $f7,13*8(sp)
+       stt     $f8,14*8(sp)
+       stt     $f9,15*8(sp)
+
+       clr     v0                   /* intialize the remaining registers         */
+       clr     t0
+       clr     t1
+       clr     t2
+       clr     t3
+       clr     t4
+       clr     t5
+       clr     t6
+       clr     t7
+       clr     a1
+       clr     a2
+       clr     a3
+       clr     a4
+       clr     a5
+       clr     t8
+       clr     t9
+       clr     t10
+       clr     t11
+       clr     t12
+       clr     $28
+       clr     $29
+       cpys    $f31,$f31,$f0
+       cpys    $f31,$f31,$f1
+       cpys    $f31,$f31,$f10
+       cpys    $f31,$f31,$f11
+       cpys    $f31,$f31,$f12
+       cpys    $f31,$f31,$f13
+       cpys    $f31,$f31,$f14
+       cpys    $f31,$f31,$f15
+       cpys    $f31,$f31,$f16
+       cpys    $f31,$f31,$f17
+       cpys    $f31,$f31,$f18
+       cpys    $f31,$f31,$f19
+       cpys    $f31,$f31,$f20
+       cpys    $f31,$f31,$f21
+       cpys    $f31,$f31,$f22
+       cpys    $f31,$f31,$f23
+       cpys    $f31,$f31,$f24
+       cpys    $f31,$f31,$f25
+       cpys    $f31,$f31,$f26
+       cpys    $f31,$f31,$f27
+       cpys    $f31,$f31,$f28
+       cpys    $f31,$f31,$f29
+       cpys    $f31,$f31,$f30
+
+       mov     a0,pv                 /* load function pointer                    */
+       jmp     ra,(pv)               /* and call function                        */
+
+       ldq     ra,0(sp)              /* load return address                      */
+       lda     sp,16*8(sp)           /* deallocate stack                         */
+       jmp     zero,(ra)             /* return                                   */
+
+       .end    asm_dumpregistersandcall
+
+
+/********************* function asm_handle_exception ***************************
+*                                                                              *
+*   This function handles an exception. It does not use the usual calling      *
+*   conventions. The exception pointer is passed in REG_ITMP1 and the          *
+*   pc from the exception raising position is passed in REG_ITMP2. It searches *
+*   the local exception table for a handler. If no one is found, it unwinds    *
+*   stacks and continues searching the callers.                                *
+*                                                                              *
+*   void asm_handle_exception (exceptionptr, exceptionpc);                     *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_handle_nat_exception
+asm_handle_nat_exception:
+
+       ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,48,t0
+       sra     t0,48,t0              /* isolate offset                           */
+       addq    t0,ra,pv              /* compute update address                   */
+       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t0,16,t0              /* isolate instruction code                 */
+       lda     t0,-0x177b(t0)        /* test for LDAH                            */
+       bne     t0,asm_handle_exception       
+       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       sll     t0,16,t0              /* compute high offset                      */
+       addl    t0,0,t0               /* sign extend high offset                  */
+       addq    t0,pv,pv              /* compute update address                   */
+
+       .aent    asm_handle_exception
+asm_handle_exception:
+
+       lda     sp,-18*8(sp)          /* allocate stack                           */
+       stq     t0,0*8(sp)            /* save possible used registers             */
+       stq     t1,1*8(sp)            /* also registers used by trace_exception   */
+       stq     t2,2*8(sp)
+       stq     t3,3*8(sp)
+       stq     t4,4*8(sp)
+       stq     t5,5*8(sp)
+       stq     t6,6*8(sp)
+       stq     t7,7*8(sp)
+       stq     t8,8*8(sp)
+       stq     t9,9*8(sp)
+       stq     t10,10*8(sp)
+       stq     v0,11*8(sp)
+       stq     a0,12*8(sp)
+       stq     a1,13*8(sp)
+       stq     a2,14*8(sp)
+       stq     a3,15*8(sp)
+       stq     a4,16*8(sp)
+       stq     a5,17*8(sp)
+
+       lda     t3,1(zero)            /* set no unwind flag                       */
+ex_stack_loop:
+       lda     sp,-5*8(sp)           /* allocate stack                           */
+       stq     xptr,0*8(sp)          /* save used register                       */
+       stq     xpc,1*8(sp)
+       stq     pv,2*8(sp)
+       stq     ra,3*8(sp)
+       stq     t3,4*8(sp)
+
+       mov     xptr,a0
+       ldq     a1,MethodPointer(pv)
+       mov     xpc,a2
+       mov     t3,a3
+       br      ra,ex_trace           /* set ra for gp loading                    */
+ex_trace:
+       ldgp    gp,0(ra)              /* load gp                                  */
+       jsr     ra,builtin_trace_exception /* trace_exception(xptr,methodptr)     */
+       
+       ldq     xptr,0*8(sp)          /* restore used register                    */
+       ldq     xpc,1*8(sp)
+       ldq     pv,2*8(sp)
+       ldq     ra,3*8(sp)
+       ldq     t3,4*8(sp)
+       lda     sp,5*8(sp)            /* deallocate stack                         */
+       
+       ldl     t0,ExTableSize(pv)    /* t0 = exception table size                */
+       beq     t0,empty_table        /* if empty table skip                      */
+       lda     t1,ExTableStart(pv)   /* t1 = start of exception table            */
+
+ex_table_loop:
+       ldq     t2,ExStartPC(t1)      /* t2 = exception start pc                  */
+       cmple   t2,xpc,t2             /* t2 = (startpc <= xpc)                    */
+       beq     t2,ex_table_cont      /* if (false) continue                      */
+       ldq     t2,ExEndPC(t1)        /* t2 = exception end pc                    */
+       cmplt   xpc,t2,t2             /* t2 = (xpc < endpc)                       */
+       beq     t2,ex_table_cont      /* if (false) continue                      */
+       ldq     a1,ExCatchType(t1)    /* arg1 = exception catch type              */
+       beq     a1,ex_handle_it       /* NULL catches everything                  */
+
+       ldq     a0,offobjvftbl(xptr)  /* a0 = vftblptr(xptr)                      */
+       ldq     a1,offobjvftbl(a1)    /* a1 = vftblptr(catchtype) class (not obj) */
+       ldl     a0,offbaseval(a0)     /* a0 = baseval(xptr)                       */
+       ldl     v0,offbaseval(a1)     /* a2 = baseval(catchtype)                  */
+       ldl     a1,offdiffval(a1)     /* a1 = diffval(catchtype)                  */
+       subl    a0,v0,a0              /* a0 = baseval(xptr) - baseval(catchtype)  */
+       cmpule  a0,a1,v0              /* v0 = xptr is instanceof catchtype        */
+       beq     v0,ex_table_cont      /* if (false) continue                      */
+
+ex_handle_it:
+
+       ldq     xpc,ExHandlerPC(t1)   /* xpc = exception handler pc               */
+
+       beq     t3,ex_jump            /* if (!(no stack unwinding) skip           */
+
+       ldq     t0,0*8(sp)            /* restore possible used registers          */
+       ldq     t1,1*8(sp)            /* also registers used by trace_exception   */
+       ldq     t2,2*8(sp)
+       ldq     t3,3*8(sp)
+       ldq     t4,4*8(sp)
+       ldq     t5,5*8(sp)
+       ldq     t6,6*8(sp)
+       ldq     t7,7*8(sp)
+       ldq     t8,8*8(sp)
+       ldq     t9,9*8(sp)
+       ldq     t10,10*8(sp)
+       ldq     v0,11*8(sp)
+       ldq     a0,12*8(sp)
+       ldq     a1,13*8(sp)
+       ldq     a2,14*8(sp)
+       ldq     a3,15*8(sp)
+       ldq     a4,16*8(sp)
+       ldq     a5,17*8(sp)
+       lda     sp,18*8(sp)           /* deallocate stack                         */
+
+ex_jump:
+       jmp     zero,(xpc)            /* jump to the handler                      */
+
+ex_table_cont:
+       lda     t1,ExEntrySize(t1)    /* next exception table entry               */
+       subl    t0,1,t0               /* decrement entry counter                  */
+       bgt     t0,ex_table_loop      /* if (t0 > 0) next entry                   */
+
+empty_table:
+       beq     t3,ex_already_cleared /* if here the first time, then             */
+       lda     sp,18*8(sp)           /* deallocate stack and                     */
+       clr     t3                    /* clear the no unwind flag                 */
+ex_already_cleared:
+       ldl     t0,IsSync(pv)         /* t0 = SyncOffset                          */
+       beq     t0,no_monitor_exit    /* if zero no monitorexit                   */
+       addq    sp,t0,t0              /* add stackptr to Offset                   */
+       ldq     a0,-8(t0)             /* load monitorexit pointer                 */
+
+       lda     sp,-7*8(sp)           /* allocate stack                           */
+       stq     t0,0*8(sp)            /* save used register                       */
+       stq     t1,1*8(sp)
+       stq     t3,2*8(sp)
+       stq     xptr,3*8(sp)
+       stq     xpc,4*8(sp)
+       stq     pv,5*8(sp)
+       stq     ra,6*8(sp)
+
+       br      ra,ex_mon_load        /* set ra for gp loading                    */
+ex_mon_load:
+       ldgp    gp,0(ra)              /* load gp                                  */
+       jsr     ra,builtin_monitorexit/* builtin_monitorexit(objectptr)           */
+       
+       ldq     t0,0*8(sp)            /* restore used register                    */
+       ldq     t1,1*8(sp)
+       ldq     t3,2*8(sp)
+       ldq     xptr,3*8(sp)
+       ldq     xpc,4*8(sp)
+       ldq     pv,5*8(sp)
+       ldq     ra,6*8(sp)
+       lda     sp,7*8(sp)            /* deallocate stack                         */
+
+no_monitor_exit:
+       ldl     t0,FrameSize(pv)      /* t0 = frame size                          */
+       addq    sp,t0,sp              /* unwind stack                             */
+       mov     sp,t0                 /* t0 = pointer to save area                */
+       ldl     t1,IsLeaf(pv)         /* t1 = is leaf procedure                   */
+       bne     t1,ex_no_restore      /* if (leaf) skip                           */
+       ldq     ra,-8(t0)             /* restore ra                               */
+       lda     t0,-8(t0)             /* t0--                                     */
+ex_no_restore:
+       mov     ra,xpc                /* the new xpc is ra                        */
+       ldl     t1,IntSave(pv)        /* t1 = saved int register count            */
+       br      t2,ex_int1            /* t2 = current pc                          */
+ex_int1:
+       lda     t2,44(t2)             /* lda t2,ex_int2-ex_int1(t2) !!!!!!!!!!!!! */
+       negl    t1,t1                 /* negate register count                    */
+       s4addq  t1,t2,t2              /* t2 = ex_int_sav - 4 * register count     */
+       jmp     zero,(t2)             /* jump to save position                    */
+       ldq     s0,-56(t0)
+       ldq     s1,-48(t0)
+       ldq     s2,-40(t0)
+       ldq     s3,-32(t0)
+       ldq     s4,-24(t0)
+       ldq     s5,-16(t0)
+       ldq     s6,-8(t0)
+ex_int2:
+       s8addq  t1,t0,t0              /* t0 = t0 - 8 * register count             */
+
+       ldl     t1,FltSave(pv)        /* t1 = saved flt register count            */
+       br      t2,ex_flt1            /* t2 = current pc                          */
+ex_flt1:
+       lda     t2,48(t2)             /* lda t2,ex_flt2-ex_flt1(t2) !!!!!!!!!!!!! */
+       negl    t1,t1                 /* negate register count                    */
+       s4addq  t1,t2,t2              /* t2 = ex_flt_sav - 4 * register count     */
+       jmp     zero,(t2)             /* jump to save position                    */
+       ldt     $f2,-64(t0)
+       ldt     $f3,-56(t0)
+       ldt     $f4,-48(t0)
+       ldt     $f5,-40(t0)
+       ldt     $f6,-32(t0)
+       ldt     $f7,-24(t0)
+       ldt     $f8,-16(t0)
+       ldt     $f9,-8(t0)
+ex_flt2:
+       ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,48,t0
+       sra     t0,48,t0              /* isolate offset                           */
+       addq    t0,ra,pv              /* compute update address                   */
+       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t0,16,t0              /* isolate instruction code                 */
+       lda     t0,-0x177b(t0)        /* test for LDAH                            */
+       bne     t0,ex_stack_loop       
+       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(RA)         */
+       sll     t0,16,t0              /* compute high offset                      */
+       addl    t0,0,t0               /* sign extend high offset                  */
+       addq    t0,pv,pv              /* compute update address                   */
+       br      ex_stack_loop
+
+       .end    asm_handle_nat_exception
+
+
+/********************* function asm_builtin_monitorenter ***********************
+*                                                                              *
+*   Does null check and calls monitorenter or throws an exception              *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_monitorenter
+asm_builtin_monitorenter:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_monitorenter
+       beq     a0,nb_monitorenter        /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_monitorenter       */
+
+nb_monitorenter:
+       ldq     xptr,proto_java_lang_NullPointerException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_monitorenter
+
+
+/********************* function asm_builtin_monitorexit ************************
+*                                                                              *
+*   Does null check and calls monitorexit or throws an exception               *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_monitorexit
+asm_builtin_monitorexit:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_monitorexit
+       beq     a0,nb_monitorexit         /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_monitorexit        */
+
+nb_monitorexit:
+       ldq     xptr,proto_java_lang_NullPointerException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_monitorexit
+
+
+/************************ function asm_builtin_idiv ****************************
+*                                                                              *
+*   Does null check and calls idiv or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_idiv
+asm_builtin_idiv:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_idiv
+       beq     a1,nb_idiv                /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_idiv               */
+
+nb_idiv:
+       ldq     xptr,proto_java_lang_ArithmeticException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_idiv
+
+
+/************************ function asm_builtin_ldiv ****************************
+*                                                                              *
+*   Does null check and calls ldiv or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_ldiv
+asm_builtin_ldiv:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_ldiv
+       beq     a1,nb_ldiv                /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_ldiv               */
+
+nb_ldiv:
+       ldq     xptr,proto_java_lang_ArithmeticException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_ldiv
+
+
+/************************ function asm_builtin_irem ****************************
+*                                                                              *
+*   Does null check and calls irem or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_irem
+asm_builtin_irem:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_irem
+       beq     a1,nb_irem                /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_irem               */
+
+nb_irem:
+       ldq     xptr,proto_java_lang_ArithmeticException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_irem
+
+
+/************************ function asm_builtin_lrem ****************************
+*                                                                              *
+*   Does null check and calls lrem or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_lrem
+asm_builtin_lrem:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_lrem
+       beq     a1,nb_lrem                /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_lrem               */
+
+nb_lrem:
+       ldq     xptr,proto_java_lang_ArithmeticException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_lrem
+
+
+ /*********************** function new_builtin_checkcast ************************
+ *                                                                              *
+ *   Does the cast check and eventually throws an exception                     *
+ *                                                                              *
+ *******************************************************************************/
+
+    .ent    asm_builtin_checkcast
+asm_builtin_checkcast:
+
+    ldgp    gp,0(pv)
+    lda     sp,-16(sp)                  # allocate stack space
+    stq     ra,0(sp)                    # save return address
+    stq     a0,8(sp)                    # save object pointer
+    jsr     ra,builtin_checkcast        # builtin_checkcast
+    ldgp    gp,0(ra)
+    beq     v0,nb_ccast_throw           # if (false) throw exception
+    ldq     ra,0(sp)                    # restore return address
+    ldq     v0,8(sp)                    # return object pointer
+    lda     sp,16(sp)                   # free stack space
+    jmp     zero,(ra)
+
+nb_ccast_throw:
+    ldq     xptr,proto_java_lang_ClassCastException
+    ldq     ra,0(sp)                    # restore return address
+    lda     sp,16(sp)                   # free stack space
+    lda     xpc,-4(ra)                  # faulting address is return adress - 4
+    br      asm_handle_nat_exception
+    .end    asm_builtin_checkcast
+
+               
+/******************* function asm_builtin_checkarraycast ***********************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_checkarraycast
+asm_builtin_checkarraycast:
+
+       ldgp    gp,0(pv)
+       lda     sp,-16(sp)                /* allocate stack space                 */
+       stq     ra,0(sp)                  /* save return address                  */
+       stq     a0,8(sp)                  /* save object pointer                  */
+       jsr     ra,builtin_checkarraycast /* builtin_checkarraycast               */
+       ldgp    gp,0(ra)
+       beq     v0,nb_carray_throw        /* if (false) throw exception           */
+       ldq     ra,0(sp)                  /* restore return address               */
+       ldq     v0,8(sp)                  /* return object pointer                */
+       lda     sp,16(sp)                 /* free stack space                     */
+       jmp     zero,(ra)
+
+nb_carray_throw:
+       ldq     xptr,proto_java_lang_ClassCastException
+       ldq     ra,0(sp)                  /* restore return address               */
+       lda     sp,16(sp)                 /* free stack space                     */
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_checkarraycast
+
+
+/******************* function asm_builtin_aastore ******************************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_aastore
+asm_builtin_aastore:
+
+       ldgp    gp,0(pv)
+       beq     a0,nb_aastore_null        /* if null pointer throw exception      */
+       ldl     t0,offarraysize(a0)       /* load size                            */
+       lda     sp,-24(sp)                /* allocate stack space                 */
+       stq     ra,0(sp)                  /* save return address                  */
+       s8addq  a1,a0,t1                  /* add index*8 to arrayref              */
+       cmpult  a1,t0,t0                  /* do bound check                       */
+       beq     t0,nb_aastore_bound       /* if out of bounds throw exception     */
+       mov     a2,a1                     /* object is second argument            */
+       stq     t1,8(sp)                  /* save store position                  */
+       stq     a1,16(sp)                 /* save object                          */
+       jsr     ra,builtin_canstore       /* builtin_canstore(arrayref,object)    */
+       ldgp    gp,0(ra)
+       ldq     ra,0(sp)                  /* restore return address               */
+       ldq     a0,8(sp)                  /* restore store position               */
+       ldq     a1,16(sp)                 /* restore object                       */
+       lda     sp,24(sp)                 /* free stack space                     */
+       beq     v0,nb_aastore_throw       /* if (false) throw exception           */
+       stq     a1,offobjarrdata(a0)      /* store objectptr in array             */
+       jmp     zero,(ra)
+
+nb_aastore_null:
+       ldq     xptr,proto_java_lang_NullPointerException
+       mov     ra,xpc                    /* faulting address is return adress    */
+       br      asm_handle_nat_exception
+
+nb_aastore_bound:
+       ldq     xptr,proto_java_lang_ArrayIndexOutOfBoundsException
+       lda     sp,24(sp)                 /* free stack space                     */
+       mov     ra,xpc                    /* faulting address is return adress    */
+       br      asm_handle_nat_exception
+
+nb_aastore_throw:
+       ldq     xptr,proto_java_lang_ArrayStoreException
+       mov     ra,xpc                    /* faulting address is return adress    */
+       br      asm_handle_nat_exception
+
+       .end    asm_builtin_aastore
+
+
+/******************* function asm_initialize_thread_stack **********************
+*                                                                              *
+*   initialized a thread stack                                                 *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_initialize_thread_stack
+asm_initialize_thread_stack:
+
+       lda     a1,-128(a1)
+       stq     zero, 0(a1)
+       stq     zero, 8(a1)
+       stq     zero, 16(a1)
+       stq     zero, 24(a1)
+       stq     zero, 32(a1)
+       stq     zero, 40(a1)
+       stq     zero, 48(a1)
+       stt     fzero, 56(a1)
+       stt     fzero, 64(a1)
+       stt     fzero, 72(a1)
+       stt     fzero, 80(a1)
+       stt     fzero, 88(a1)
+       stt     fzero, 96(a1)
+       stt     fzero, 104(a1)
+       stt     fzero, 112(a1)
+       stq     a0, 120(a1)
+       mov     a1, v0
+       jmp     zero,(ra)
+       .end    asm_initialize_thread_stack
+
+
+/******************* function asm_perform_threadswitch *************************
+*                                                                              *
+*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
+*                                                                              *
+*   performs a threadswitch                                                    *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_perform_threadswitch
+asm_perform_threadswitch:
+
+       subq    sp,128,sp
+       stq     s0, 0(sp)
+       stq     s1, 8(sp)
+       stq     s2, 16(sp)
+       stq     s3, 24(sp)
+       stq     s4, 32(sp)
+       stq     s5, 40(sp)
+       stq     s6, 48(sp)
+       stt     sf0, 56(sp)
+       stt     sf1, 64(sp)
+       stt     sf2, 72(sp)
+       stt     sf3, 80(sp)
+       stt     sf4, 88(sp)
+       stt     sf5, 96(sp)
+       stt     sf6, 104(sp)
+       stt     sf7, 112(sp)
+       stq     ra, 120(sp)
+       stq     sp, 0(a0)
+       stq     sp, 0(a2)
+       ldq     sp, 0(a1)
+       ldq     s0, 0(sp)
+       ldq     s1, 8(sp)
+       ldq     s2, 16(sp)
+       ldq     s3, 24(sp)
+       ldq     s4, 32(sp)
+       ldq     s5, 40(sp)
+       ldq     s6, 48(sp)
+       ldt     sf0, 56(sp)
+       ldt     sf1, 64(sp)
+       ldt     sf2, 72(sp)
+       ldt     sf3, 80(sp)
+       ldt     sf4, 88(sp)
+       ldt     sf5, 96(sp)
+       ldt     sf6, 104(sp)
+       ldt     sf7, 112(sp)
+       ldq     ra, 120(sp)
+       mov     ra, pv
+       addq    sp, 128, sp
+       jmp     zero,(ra)
+       .end    asm_perform_threadswitch
+
+
+/********************* function asm_switchstackandcall *************************
+*                                                                              *
+*  void *asm_switchstackandcall (void *stack, void *func, void **stacktopsave, *
+*                               void *p);                                      *
+*                                                                              *
+*   Switches to a new stack, calls a function and switches back.               *
+*       a0      new stack pointer                                              *
+*       a1      function pointer                                               *
+*              a2              pointer to variable where stack top should be stored           *
+*              a3      pointer to user data, is passed to the function                *
+*                                                                              *
+*******************************************************************************/
+
+
+       .ent    asm_switchstackandcall
+asm_switchstackandcall:
+       lda     a0,-2*8(a0)     /* allocate new stack                                 */
+       stq     ra,0(a0)        /* save return address on new stack                   */
+       stq     sp,1*8(a0)      /* save old stack pointer on new stack                */
+       stq sp,0(a2)        /* save old stack pointer to variable                 */
+       mov     a0,sp           /* switch to new stack                                */
+       
+       mov     a1,pv           /* load function pointer                              */
+       mov a3,a0           /* pass pointer */
+       jmp     ra,(pv)         /* and call function                                  */
+
+       ldq     ra,0(sp)        /* load return address                                */
+       ldq     sp,1*8(sp)      /* switch to old stack                                */
+
+       jmp     zero,(ra)       /* return                                             */
+
+       .end    asm_switchstackandcall
+
+               
+/********************* function asm_getcallingmethod ***************************
+*                                                                              *
+*   classinfo *asm_getcallingmethodclass ();                                                              *
+*                                                                                                                                                         *    
+*   goes back stack frames to get the calling method                                              *       
+*                                                                                                                                                         *    
+*                              t2 .. sp                                                                                                       *
+*                              t3 .. ra                                                                                                       *
+*                              t4 .. pv                                                                                                       *
+*                                                                              *
+*******************************************************************************/
+
+
+       .ent    asm_getcallingmethod
+asm_getcallingmethod:
+
+       ldq             t3,16(sp)             /* load return address of native function   */                            
+       addq    sp,24,t2                          /* skip frames of C-Function and nativestub */        
+               
+    /* determine pv (t3) of java-function from ra */
+
+       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,48,t0
+       sra     t0,48,t0              /* isolate offset                           */
+       addq    t0,t3,t4              /* compute update address                   */
+       ldl     t0,4(t3)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t0,16,t0              /* isolate instruction code                 */
+       lda     t0,-0x177b(t0)        /* test for LDAH                            */
+       bne     t0,pv_ok1       
+       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,16,t0              /* compute high offset                      */
+       addl    t0,0,t0               /* sign extend high offset                  */
+       addq    t0,t4,t4              /* compute update address                   */
+
+pv_ok1:                        
+       ldl     t0,FrameSize(t4)      /* t0 = frame size                          */            
+       addq    t2,t0,t2                          /* skip frame of java function                          */
+       ldq             t3,-8(t2)                         /* load new ra                              */                                                                
+
+    /* determine pv (t3) of java-function from ra */
+
+       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,48,t0
+       sra     t0,48,t0              /* isolate offset                           */
+       addq    t0,t3,t4              /* compute update address                   */
+       ldl     t0,4(t3)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t0,16,t0              /* isolate instruction code                 */
+       lda     t0,-0x177b(t0)        /* test for LDAH                            */
+       bne     t0,pv_ok2
+       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,16,t0              /* compute high offset                      */
+       addl    t0,0,t0               /* sign extend high offset                  */
+       addq    t0,t4,t4              /* compute update address                   */
+
+pv_ok2:                
+       ldq     v0,MethodPointer(t4)  /*                                                                                  */
+
+                                                                               
+       jmp     zero,(ra)                                 /* return                                   */
+
+       .end    asm_getcallingmethod
+
+
+
+
+
+
+
+
+/*********************** function asm_builtin_trace ****************************
+*                                                                              *
+*   Intended to be called from the native stub. Saves all argument registers   *
+*   and calls builtin_trace_args.                                              *
+*                                                                              *
+*******************************************************************************/
+
+       .ent asm_builtin_trace
+asm_builtin_trace:
+       ldgp gp,0(pv)
+       lda sp,-112(sp)
+       stq itmp1,0(sp)
+       stq ra,8(sp)
+       stq a0,16(sp)
+       stq a1,24(sp)
+       stq a2,32(sp)
+       stq a3,40(sp)
+       stq a4,48(sp)
+       stq a5,56(sp)
+       stt $f16,64(sp)
+       stt $f17,72(sp)
+       stt $f18,80(sp)
+       stt $f19,88(sp)
+       stt $f20,96(sp)
+       stt $f21,104(sp)
+       
+       jsr ra,builtin_trace_args
+       
+       ldq ra,8(sp)
+       ldq a0,16(sp)
+       ldq a1,24(sp)
+       ldq a2,32(sp)
+       ldq a3,40(sp)
+       ldq a4,48(sp)
+       ldq a5,56(sp)
+       ldt $f16,64(sp)
+       ldt $f17,72(sp)
+       ldt $f18,80(sp)
+       ldt $f19,88(sp)
+       ldt $f20,96(sp)
+       ldt $f21,104(sp)
+       lda sp,112(sp)
+       jmp zero,(ra)
+
+       .end asm_builtin_trace
+
+
+/********************* function asm_builtin_exittrace **************************
+*                                                                              *
+*   Intended to be called from the native stub. Saves return value and calls   *
+*   builtin_displaymethodstop.                                                 *
+*                                                                              *
+*******************************************************************************/
+
+       .ent asm_builtin_exittrace
+asm_builtin_exittrace:
+       ldgp gp,0(pv)
+       lda sp,-24(sp)
+       stq ra,0(sp)
+       stq v0,8(sp)
+       stt $f0,16(sp)
+       
+       jsr ra,builtin_displaymethodstop
+       
+       ldq ra,0(sp)
+       ldq v0,8(sp)
+       ldt $f0,16(sp)
+       lda sp,24(sp)
+       jmp zero,(ra)
+
+       .end asm_builtin_exittrace
diff --git a/jit/alpha/codegen.c b/jit/alpha/codegen.c
new file mode 100644 (file)
index 0000000..083d9fd
--- /dev/null
@@ -0,0 +1,3943 @@
+/* jit/alpha/codegen.c - machine code generator for alpha
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   $Id: codegen.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include <signal.h>
+#include "types.h"
+#include "codegen.h"
+#include "jit.h"
+#include "reg.h"
+#include "builtin.h"
+#include "asmpart.h"
+#include "jni.h"
+#include "loader.h"
+#include "tables.h"
+#include "native.h"
+
+/* include independent code generation stuff */
+#include "codegen.inc"
+#include "reg.inc"
+
+
+/* *****************************************************************************
+
+Datatypes and Register Allocations:
+----------------------------------- 
+
+On 64-bit-machines (like the Alpha) all operands are stored in the
+registers in a 64-bit form, even when the correspondig JavaVM  operands
+only need 32 bits. This is done by a canonical representation:
+
+32-bit integers are allways stored as sign-extended 64-bit values (this
+approach is directly supported by the Alpha architecture and is very easy
+to implement).
+
+32-bit-floats are stored in a 64-bit doubleprecision register by simply
+expanding the exponent and mantissa with zeroes. (also supported by the
+architecture)
+
+
+Stackframes:
+
+The calling conventions and the layout of the stack is  explained in detail
+in the documention file: calling.doc
+
+*******************************************************************************/
+
+
+/* additional functions and macros to generate code ***************************/
+
+/* #define BlockPtrOfPC(pc)        block+block_index[pc] */
+#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
+
+
+#ifdef STATISTICS
+#define COUNT_SPILLS count_spills++
+#else
+#define COUNT_SPILLS
+#endif
+
+
+/* gen_nullptr_check(objreg) */
+
+#ifdef SOFTNULLPTRCHECK
+#define gen_nullptr_check(objreg) \
+       if (checknull) {\
+       M_BEQZ((objreg), 0);\
+       mcode_addxnullrefs(mcodeptr);\
+       }
+#else
+#define gen_nullptr_check(objreg)
+#endif
+
+
+/* MCODECHECK(icnt) */
+
+#define MCODECHECK(icnt) \
+       if((mcodeptr+(icnt))>mcodeend)mcodeptr=mcode_increase((u1*)mcodeptr)
+
+/* M_INTMOVE:
+     generates an integer-move from register a to b.
+     if a and b are the same int-register, no code will be generated.
+*/ 
+
+#define M_INTMOVE(a,b) if(a!=b){M_MOV(a,b);}
+
+
+/* M_FLTMOVE:
+    generates a floating-point-move from register a to b.
+    if a and b are the same float-register, no code will be generated
+*/ 
+
+#define M_FLTMOVE(a,b) if(a!=b){M_FMOV(a,b);}
+
+
+/* var_to_reg_xxx:
+    this function generates code to fetch data from a pseudo-register
+    into a real register. 
+    If the pseudo-register has actually been assigned to a real 
+    register, no code will be emitted, since following operations
+    can use this register directly.
+    
+    v: pseudoregister to be fetched from
+    tempregnum: temporary register to be used if v is actually spilled to ram
+
+    return: the register number, where the operand can be found after 
+            fetching (this wil be either tempregnum or the register
+            number allready given to v)
+*/
+
+#define var_to_reg_int(regnr,v,tempnr) { \
+       if ((v)->flags & INMEMORY) \
+               {COUNT_SPILLS;M_LLD(tempnr,REG_SP,8*(v)->regoff);regnr=tempnr;} \
+       else regnr=(v)->regoff; \
+}
+
+
+#define var_to_reg_flt(regnr,v,tempnr) { \
+       if ((v)->flags & INMEMORY) \
+               {COUNT_SPILLS;M_DLD(tempnr,REG_SP,8*(v)->regoff);regnr=tempnr;} \
+       else regnr=(v)->regoff; \
+}
+
+
+/* reg_of_var:
+    This function determines a register, to which the result of an operation
+    should go, when it is ultimatively intended to store the result in
+    pseudoregister v.
+    If v is assigned to an actual register, this register will be returned.
+    Otherwise (when v is spilled) this function returns tempregnum.
+    If not already done, regoff and flags are set in the stack location.
+*/        
+
+static int reg_of_var(stackptr v, int tempregnum)
+{
+       varinfo      *var;
+
+       switch (v->varkind) {
+               case TEMPVAR:
+                       if (!(v->flags & INMEMORY))
+                               return(v->regoff);
+                       break;
+               case STACKVAR:
+                       var = &(interfaces[v->varnum][v->type]);
+                       v->regoff = var->regoff;
+                       if (!(var->flags & INMEMORY))
+                               return(var->regoff);
+                       break;
+               case LOCALVAR:
+                       var = &(locals[v->varnum][v->type]);
+                       v->regoff = var->regoff;
+                       if (!(var->flags & INMEMORY))
+                               return(var->regoff);
+                       break;
+               case ARGVAR:
+                       v->regoff = v->varnum;
+                       if (IS_FLT_DBL_TYPE(v->type)) {
+                               if (v->varnum < fltreg_argnum) {
+                                       v->regoff = argfltregs[v->varnum];
+                                       return(argfltregs[v->varnum]);
+                                       }
+                               }
+                       else
+                               if (v->varnum < intreg_argnum) {
+                                       v->regoff = argintregs[v->varnum];
+                                       return(argintregs[v->varnum]);
+                                       }
+                       v->regoff -= intreg_argnum;
+                       break;
+               }
+       v->flags |= INMEMORY;
+       return tempregnum;
+}
+
+
+/* store_reg_to_var_xxx:
+    This function generates the code to store the result of an operation
+    back into a spilled pseudo-variable.
+    If the pseudo-variable has not been spilled in the first place, this 
+    function will generate nothing.
+    
+    v ............ Pseudovariable
+    tempregnum ... Number of the temporary registers as returned by
+                   reg_of_var.
+*/     
+
+#define store_reg_to_var_int(sptr, tempregnum) {       \
+       if ((sptr)->flags & INMEMORY) {                    \
+               COUNT_SPILLS;                                  \
+               M_LST(tempregnum, REG_SP, 8 * (sptr)->regoff); \
+               }                                              \
+       }
+
+#define store_reg_to_var_flt(sptr, tempregnum) {       \
+       if ((sptr)->flags & INMEMORY) {                    \
+               COUNT_SPILLS;                                  \
+               M_DST(tempregnum, REG_SP, 8 * (sptr)->regoff); \
+               }                                              \
+       }
+
+
+/* NullPointerException handlers and exception handling initialisation        */
+
+typedef struct sigctx_struct {
+
+       long          sc_onstack;           /* sigstack state to restore          */
+       long          sc_mask;              /* signal mask to restore             */
+       long          sc_pc;                /* pc at time of signal               */
+       long          sc_ps;                /* psl to retore                      */
+       long          sc_regs[32];          /* processor regs 0 to 31             */
+       long          sc_ownedfp;           /* fp has been used                   */
+       long          sc_fpregs[32];        /* fp regs 0 to 31                    */
+       unsigned long sc_fpcr;              /* floating point control register    */
+       unsigned long sc_fp_control;        /* software fpcr                      */
+                                           /* rest is unused                     */
+       unsigned long sc_reserved1, sc_reserved2;
+       unsigned long sc_ssize;
+       char          *sc_sbase;
+       unsigned long sc_traparg_a0;
+       unsigned long sc_traparg_a1;
+       unsigned long sc_traparg_a2;
+       unsigned long sc_fp_trap_pc;
+       unsigned long sc_fp_trigger_sum;
+       unsigned long sc_fp_trigger_inst;
+       unsigned long sc_retcode[2];
+} sigctx_struct;
+
+
+/* NullPointerException signal handler for hardware null pointer check */
+
+void catch_NullPointerException(int sig, int code, sigctx_struct *sigctx)
+{
+       sigset_t nsig;
+       int      instr;
+       long     faultaddr;
+
+       /* Reset signal handler - necessary for SysV, does no harm for BSD */
+
+       instr = *((int*)(sigctx->sc_pc));
+       faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f];
+
+       if (faultaddr == 0) {
+               signal(sig, (void*) catch_NullPointerException); /* reinstall handler */
+               sigemptyset(&nsig);
+               sigaddset(&nsig, sig);
+               sigprocmask(SIG_UNBLOCK, &nsig, NULL);           /* unblock signal    */
+               sigctx->sc_regs[REG_ITMP1_XPTR] =
+                                           (long) proto_java_lang_NullPointerException;
+               sigctx->sc_regs[REG_ITMP2_XPC] = sigctx->sc_pc;
+               sigctx->sc_pc = (long) asm_handle_exception;
+               return;
+               }
+       else {
+               faultaddr += (long) ((instr << 16) >> 16);
+               fprintf(stderr, "faulting address: 0x%16lx\n", faultaddr);
+               panic("Stack overflow");
+               }
+}
+
+
+#ifdef __osf__
+
+void init_exceptions(void)
+{
+
+#else /* Linux */
+
+/* Linux on Digital Alpha needs an initialisation of the ieee floating point
+       control for IEEE compliant arithmetic (option -mieee of GCC). Under
+       Digital Unix this is done automatically.
+*/
+
+#include <asm/fpu.h>
+
+extern unsigned long ieee_get_fp_control();
+extern void ieee_set_fp_control(unsigned long fp_control);
+
+void init_exceptions(void)
+{
+/* initialize floating point control */
+
+ieee_set_fp_control(ieee_get_fp_control()
+                    & ~IEEE_TRAP_ENABLE_INV
+                    & ~IEEE_TRAP_ENABLE_DZE
+/*                  & ~IEEE_TRAP_ENABLE_UNF   we dont want underflow */
+                    & ~IEEE_TRAP_ENABLE_OVF);
+#endif
+
+       /* install signal handlers we need to convert to exceptions */
+
+       if (!checknull) {
+
+#if defined(SIGSEGV)
+               signal(SIGSEGV, (void*) catch_NullPointerException);
+#endif
+
+#if defined(SIGBUS)
+               signal(SIGBUS, (void*) catch_NullPointerException);
+#endif
+               }
+}
+
+
+/* function gen_mcode **********************************************************
+
+       generates machine code
+
+*******************************************************************************/
+
+#define        MethodPointer   -8
+#define        FrameSize       -12
+#define     IsSync          -16
+#define     IsLeaf          -20
+#define     IntSave         -24
+#define     FltSave         -28
+#define     ExTableSize     -32
+#define     ExTableStart    -32
+
+#define     ExEntrySize     -32
+#define     ExStartPC       -8
+#define     ExEndPC         -16
+#define     ExHandlerPC     -24
+#define     ExCatchType     -32
+
+void codegen()
+{
+       int  len, s1, s2, s3, d, bbs;
+       s4   a;
+       s4          *mcodeptr;
+       stackptr    src;
+       varinfo     *var;
+       basicblock  *bptr;
+       instruction *iptr;
+       xtable *ex;
+
+       {
+       int p, pa, t, l, r;
+
+       savedregs_num = (isleafmethod) ? 0 : 1;           /* space to save the RA */
+
+       /* space to save used callee saved registers */
+
+       savedregs_num += (savintregcnt - maxsavintreguse);
+       savedregs_num += (savfltregcnt - maxsavfltreguse);
+
+       parentargs_base = maxmemuse + savedregs_num;
+
+#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
+
+       if (checksync && (method->flags & ACC_SYNCHRONIZED))
+               parentargs_base++;
+
+#endif
+
+       /* create method header */
+
+       (void) dseg_addaddress(method);                         /* MethodPointer  */
+       (void) dseg_adds4(parentargs_base * 8);                 /* FrameSize      */
+
+#ifdef USE_THREADS
+
+       /* IsSync contains the offset relative to the stack pointer for the
+          argument of monitor_exit used in the exception handler. Since the
+          offset could be zero and give a wrong meaning of the flag it is
+          offset by one.
+       */
+
+       if (checksync && (method->flags & ACC_SYNCHRONIZED))
+               (void) dseg_adds4((maxmemuse + 1) * 8);             /* IsSync         */
+       else
+
+#endif
+
+       (void) dseg_adds4(0);                                   /* IsSync         */
+                                              
+       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
+       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
+       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
+       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
+
+       /* create exception table */
+
+       for (ex = extable; ex != NULL; ex = ex->down) {
+
+#ifdef LOOP_DEBUG      
+               if (ex->start != NULL)
+                       printf("adding start - %d - ", ex->start->debug_nr);
+               else {
+                       printf("PANIC - start is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->start);
+
+#ifdef LOOP_DEBUG                      
+               if (ex->end != NULL)
+                       printf("adding end - %d - ", ex->end->debug_nr);
+               else {
+                       printf("PANIC - end is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->end);
+
+#ifdef LOOP_DEBUG              
+               if (ex->handler != NULL)
+                       printf("adding handler - %d\n", ex->handler->debug_nr);
+               else {
+                       printf("PANIC - handler is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->handler);
+          
+               (void) dseg_addaddress(ex->catchtype);
+               }
+       
+       /* initialize mcode variables */
+       
+       mcodeptr = (s4*) mcodebase;
+       mcodeend = (s4*) (mcodebase + mcodesize);
+       MCODECHECK(128 + mparamcount);
+
+       /* create stack frame (if necessary) */
+
+       if (parentargs_base)
+               {M_LDA (REG_SP, REG_SP, -parentargs_base * 8);}
+
+       /* save return address and used callee saved registers */
+
+       p = parentargs_base;
+       if (!isleafmethod)
+               {p--;  M_AST (REG_RA, REG_SP, 8*p);}
+       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
+               {p--; M_LST (savintregs[r], REG_SP, 8 * p);}
+       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
+               {p--; M_DST (savfltregs[r], REG_SP, 8 * p);}
+
+       /* save monitorenter argument */
+
+#ifdef USE_THREADS
+       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+               if (method->flags & ACC_STATIC) {
+                       p = dseg_addaddress (class);
+                       M_ALD(REG_ITMP1, REG_PV, p);
+                       M_AST(REG_ITMP1, REG_SP, 8 * maxmemuse);
+                       } 
+               else {
+                       M_AST (argintregs[0], REG_SP, 8 * maxmemuse);
+                       }
+               }                       
+#endif
+
+       /* copy argument registers to stack and call trace function with pointer
+          to arguments on stack. ToDo: save floating point registers !!!!!!!!!
+       */
+
+       if (runverbose) {
+               M_LDA (REG_SP, REG_SP, -(14*8));
+               M_AST(REG_RA, REG_SP, 1*8);
+
+               M_LST(argintregs[0], REG_SP,  2*8);
+               M_LST(argintregs[1], REG_SP,  3*8);
+               M_LST(argintregs[2], REG_SP,  4*8);
+               M_LST(argintregs[3], REG_SP,  5*8);
+               M_LST(argintregs[4], REG_SP,  6*8);
+               M_LST(argintregs[5], REG_SP,  7*8);
+
+               M_DST(argfltregs[0], REG_SP,  8*8);
+               M_DST(argfltregs[1], REG_SP,  9*8);
+               M_DST(argfltregs[2], REG_SP, 10*8);
+               M_DST(argfltregs[3], REG_SP, 11*8);
+               M_DST(argfltregs[4], REG_SP, 12*8);
+               M_DST(argfltregs[5], REG_SP, 13*8);
+
+               p = dseg_addaddress (method);
+               M_ALD(REG_ITMP1, REG_PV, p);
+               M_AST(REG_ITMP1, REG_SP, 0);
+               p = dseg_addaddress ((void*) (builtin_trace_args));
+               M_ALD(REG_PV, REG_PV, p);
+               M_JSR(REG_RA, REG_PV);
+               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+               M_ALD(REG_RA, REG_SP, 1*8);
+
+               M_LLD(argintregs[0], REG_SP,  2*8);
+               M_LLD(argintregs[1], REG_SP,  3*8);
+               M_LLD(argintregs[2], REG_SP,  4*8);
+               M_LLD(argintregs[3], REG_SP,  5*8);
+               M_LLD(argintregs[4], REG_SP,  6*8);
+               M_LLD(argintregs[5], REG_SP,  7*8);
+
+               M_DLD(argfltregs[0], REG_SP,  8*8);
+               M_DLD(argfltregs[1], REG_SP,  9*8);
+               M_DLD(argfltregs[2], REG_SP, 10*8);
+               M_DLD(argfltregs[3], REG_SP, 11*8);
+               M_DLD(argfltregs[4], REG_SP, 12*8);
+               M_DLD(argfltregs[5], REG_SP, 13*8);
+
+               M_LDA (REG_SP, REG_SP, 14*8);
+               }
+
+       /* take arguments out of register or stack frame */
+
+       for (p = 0, l = 0; p < mparamcount; p++) {
+               t = mparamtypes[p];
+               var = &(locals[l][t]);
+               l++;
+               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
+                       l++;
+               if (var->type < 0)
+                       continue;
+               r = var->regoff; 
+               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
+                       if (p < INT_ARG_CNT) {                   /* register arguments    */
+                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
+                                       {M_INTMOVE (argintregs[p], r);}
+                               else                                 /* reg arg -> spilled    */
+                                       M_LST (argintregs[p], REG_SP, 8 * r);
+                               }
+                       else {                                   /* stack arguments       */
+                               pa = p - INT_ARG_CNT;
+                               if (!(var->flags & INMEMORY))        /* stack arg -> register */ 
+                                       M_LLD (r, REG_SP, 8 * (parentargs_base + pa));
+                               else {                               /* stack arg -> spilled  */
+                                       M_LLD (REG_ITMP1, REG_SP, 8 * (parentargs_base + pa));
+                                       M_LST (REG_ITMP1, REG_SP, 8 * r);
+                                       }
+                               }
+                       }
+               else {                                       /* floating args         */   
+                       if (p < FLT_ARG_CNT) {                   /* register arguments    */
+                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
+                                       {M_FLTMOVE (argfltregs[p], r);}
+                               else                                             /* reg arg -> spilled    */
+                                       M_DST (argfltregs[p], REG_SP, 8 * r);
+                               }
+                       else {                                   /* stack arguments       */
+                               pa = p - FLT_ARG_CNT;
+                               if (!(var->flags & INMEMORY))        /* stack-arg -> register */
+                                       M_DLD (r, REG_SP, 8 * (parentargs_base + pa) );
+                               else {                               /* stack-arg -> spilled  */
+                                       M_DLD (REG_FTMP1, REG_SP, 8 * (parentargs_base + pa));
+                                       M_DST (REG_FTMP1, REG_SP, 8 * r);
+                                       }
+                               }
+                       }
+               }  /* end for */
+
+       /* call trace function */
+
+#if 0
+       if (runverbose && !isleafmethod) {
+               M_LDA (REG_SP, REG_SP, -8);
+               p = dseg_addaddress (method);
+               M_ALD(REG_ITMP1, REG_PV, p);
+               M_AST(REG_ITMP1, REG_SP, 0);
+               p = dseg_addaddress ((void*) (builtin_trace_args));
+               M_ALD(REG_PV, REG_PV, p);
+               M_JSR(REG_RA, REG_PV);
+               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+               M_LDA(REG_SP, REG_SP, 8);
+               }
+#endif
+
+       /* call monitorenter function */
+
+#ifdef USE_THREADS
+       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+               p = dseg_addaddress ((void*) (builtin_monitorenter));
+               M_ALD(REG_PV, REG_PV, p);
+               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
+               M_JSR(REG_RA, REG_PV);
+               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+               }                       
+#endif
+       }
+
+       /* end of header generation */
+
+       /* walk through all basic blocks */
+       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
+
+               bptr -> mpc = (int)((u1*) mcodeptr - mcodebase);
+
+               if (bptr->flags >= BBREACHED) {
+
+               /* branch resolving */
+
+               {
+               branchref *brefs;
+               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
+                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
+                                         brefs->branchpos, bptr->mpc);
+                       }
+               }
+
+               /* copy interface registers to their destination */
+
+               src = bptr->instack;
+               len = bptr->indepth;
+               MCODECHECK(64+len);
+               while (src != NULL) {
+                       len--;
+                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
+                               d = reg_of_var(src, REG_ITMP1);
+                               M_INTMOVE(REG_ITMP1, d);
+                               store_reg_to_var_int(src, d);
+                               }
+                       else {
+                               d = reg_of_var(src, REG_IFTMP);
+                               if ((src->varkind != STACKVAR)) {
+                                       s2 = src->type;
+                                       if (IS_FLT_DBL_TYPE(s2)) {
+                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                                       s1 = interfaces[len][s2].regoff;
+                                                       M_FLTMOVE(s1,d);
+                                                       }
+                                               else {
+                                                       M_DLD(d, REG_SP, 8 * interfaces[len][s2].regoff);
+                                                       }
+                                               store_reg_to_var_flt(src, d);
+                                               }
+                                       else {
+                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                                       s1 = interfaces[len][s2].regoff;
+                                                       M_INTMOVE(s1,d);
+                                                       }
+                                               else {
+                                                       M_LLD(d, REG_SP, 8 * interfaces[len][s2].regoff);
+                                                       }
+                                               store_reg_to_var_int(src, d);
+                                               }
+                                       }
+                               }
+                       src = src->prev;
+                       }
+
+               /* walk through all instructions */
+               
+               src = bptr->instack;
+               len = bptr->icount;
+               for (iptr = bptr->iinstr;
+                   len > 0;
+                   src = iptr->dst, len--, iptr++) {
+
+       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
+       switch (iptr->opc) {
+
+               case ICMD_NOP:        /* ...  ==> ...                                 */
+                       break;
+
+               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_BEQZ(s1, 0);
+                       codegen_addxnullrefs(mcodeptr);
+                       break;
+
+               /* constant operations ************************************************/
+
+#define ICONST(r,c) if(((c)>=-32768)&&((c)<= 32767)){M_LDA(r,REG_ZERO,c);} \
+                    else{a=dseg_adds4(c);M_ILD(r,REG_PV,a);}
+
+#define LCONST(r,c) if(((c)>=-32768)&&((c)<= 32767)){M_LDA(r,REG_ZERO,c);} \
+                    else{a=dseg_adds8(c);M_LLD(r,REG_PV,a);}
+
+               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.i = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       ICONST(d, iptr->val.i);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.l = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       LCONST(d, iptr->val.l);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.f = constant                    */
+
+                       d = reg_of_var (iptr->dst, REG_FTMP1);
+                       a = dseg_addfloat (iptr->val.f);
+                       M_FLD(d, REG_PV, a);
+                       store_reg_to_var_flt (iptr->dst, d);
+                       break;
+                       
+               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.d = constant                    */
+
+                       d = reg_of_var (iptr->dst, REG_FTMP1);
+                       a = dseg_adddouble (iptr->val.d);
+                       M_DLD(d, REG_PV, a);
+                       store_reg_to_var_flt (iptr->dst, d);
+                       break;
+
+               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.a = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->val.a) {
+                               a = dseg_addaddress (iptr->val.a);
+                               M_ALD(d, REG_PV, a);
+                               }
+                       else {
+                               M_INTMOVE(REG_ZERO, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               /* load/store operations **********************************************/
+
+               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_LLOAD:      /* op1 = local variable                         */
+               case ICMD_ALOAD:
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1))
+                               break;
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (var->flags & INMEMORY)
+                               M_LLD(d, REG_SP, 8 * var->regoff);
+                       else
+                               {M_INTMOVE(var->regoff,d);}
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_DLOAD:      /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1))
+                               break;
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (var->flags & INMEMORY)
+                               M_DLD(d, REG_SP, 8 * var->regoff);
+                       else
+                               {M_FLTMOVE(var->regoff,d);}
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+
+               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
+               case ICMD_LSTORE:     /* op1 = local variable                         */
+               case ICMD_ASTORE:
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1))
+                               break;
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               M_LST(s1, REG_SP, 8 * var->regoff);
+                               }
+                       else {
+                               var_to_reg_int(s1, src, var->regoff);
+                               M_INTMOVE(s1, var->regoff);
+                               }
+                       break;
+
+               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
+               case ICMD_DSTORE:     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1))
+                               break;
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               M_DST(s1, REG_SP, 8 * var->regoff);
+                               }
+                       else {
+                               var_to_reg_flt(s1, src, var->regoff);
+                               M_FLTMOVE(s1, var->regoff);
+                               }
+                       break;
+
+
+               /* pop/dup/swap operations ********************************************/
+
+               /* attention: double and longs are only one entry in CACAO ICMDs      */
+
+               case ICMD_POP:        /* ..., value  ==> ...                          */
+               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
+                       break;
+
+#define M_COPY(from,to) \
+                       d = reg_of_var(to, REG_IFTMP); \
+                       if ((from->regoff != to->regoff) || \
+                           ((from->flags ^ to->flags) & INMEMORY)) { \
+                               if (IS_FLT_DBL_TYPE(from->type)) { \
+                                       var_to_reg_flt(s1, from, d); \
+                                       M_FLTMOVE(s1,d); \
+                                       store_reg_to_var_flt(to, d); \
+                                       }\
+                               else { \
+                                       var_to_reg_int(s1, from, d); \
+                                       M_INTMOVE(s1,d); \
+                                       store_reg_to_var_int(to, d); \
+                                       }\
+                               }
+
+               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
+                       M_COPY(src, iptr->dst);
+                       break;
+
+               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
+
+                       M_COPY(src,       iptr->dst->prev->prev);
+
+               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
+
+                       M_COPY(src,       iptr->dst);
+                       M_COPY(src->prev, iptr->dst->prev);
+                       break;
+
+               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
+
+                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
+
+               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
+
+                       M_COPY(src,             iptr->dst);
+                       M_COPY(src->prev,       iptr->dst->prev);
+                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
+                       M_COPY(src, iptr->dst->prev->prev->prev);
+                       break;
+
+               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
+
+                       M_COPY(src,                   iptr->dst);
+                       M_COPY(src->prev,             iptr->dst->prev);
+                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
+                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
+                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
+                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
+                       break;
+
+               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
+
+                       M_COPY(src, iptr->dst->prev);
+                       M_COPY(src->prev, iptr->dst);
+                       break;
+
+
+               /* integer operations *************************************************/
+
+               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
+
+                       var_to_reg_int(s1, src, REG_ITMP1); 
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_ISUB(REG_ZERO, s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_LSUB(REG_ZERO, s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_INTMOVE(s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_IADD(s1, REG_ZERO, d );
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_BSEXT(s1, d);
+                               }
+                       else {
+                               M_SLL_IMM(s1, 56, d);
+                               M_SRA_IMM( d, 56, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+            M_CZEXT(s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_SSEXT(s1, d);
+                               }
+                       else {
+                               M_SLL_IMM(s1, 48, d);
+                               M_SRA_IMM( d, 48, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_IADD(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_IADD_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_IADD(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_LADD(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_LADD_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_LADD(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_ISUB(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_ISUB_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_ISUB(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_LSUB(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_LSUB_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_LSUB(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_IMUL(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_IMUL_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_IMUL(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_LMUL (s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LMULCONST:  /* ..., value  ==> ..., value * constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_LMUL_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_LMUL(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value << constant       */
+               case ICMD_LDIVPOW2:   /* val.i = constant                             */
+                                     
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->val.i <= 15) {
+                               M_LDA(REG_ITMP2, s1, (1 << iptr->val.i) -1);
+                               M_CMOVGE(s1, s1, REG_ITMP2);
+                               }
+                       else {
+                               M_SRA_IMM(s1, 63, REG_ITMP2);
+                               M_SRL_IMM(REG_ITMP2, 64 - iptr->val.i, REG_ITMP2);
+                               M_LADD(s1, REG_ITMP2, REG_ITMP2);
+                               }
+                       M_SRA_IMM(REG_ITMP2, iptr->val.i, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_AND_IMM(s2, 0x1f, REG_ITMP3);
+                       M_SLL(s1, REG_ITMP3, d);
+                       M_IADD(d, REG_ZERO, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SLL_IMM(s1, iptr->val.i & 0x1f, d);
+                       M_IADD(d, REG_ZERO, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_AND_IMM(s2, 0x1f, REG_ITMP3);
+                       M_SRA(s1, REG_ITMP3, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRA_IMM(s1, iptr->val.i & 0x1f, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_AND_IMM(s2, 0x1f, REG_ITMP2);
+            M_IZEXT(s1, d);
+                       M_SRL(d, REG_ITMP2, d);
+                       M_IADD(d, REG_ZERO, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+            M_IZEXT(s1, d);
+                       M_SRL_IMM(d, iptr->val.i & 0x1f, d);
+                       M_IADD(d, REG_ZERO, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SLL(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSHLCONST:  /* ..., value  ==> ..., value << constant       */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SLL_IMM(s1, iptr->val.i & 0x3f, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRA(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSHRCONST:  /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRA_IMM(s1, iptr->val.i & 0x3f, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRL(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRL_IMM(s1, iptr->val.i & 0x3f, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
+               case ICMD_LAND:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_AND(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_AND_IMM(s1, iptr->val.i, d);
+                               }
+                       else if (iptr->val.i == 0xffff) {
+                               M_CZEXT(s1, d);
+                               }
+                       else if (iptr->val.i == 0xffffff) {
+                               M_ZAPNOT_IMM(s1, 0x07, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_AND(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                               }
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_AND_IMM(s1, iptr->val.i, d);
+                               M_BGEZ(s1, 3);
+                               M_ISUB(REG_ZERO, s1, d);
+                               M_AND_IMM(d, iptr->val.i, d);
+                               }
+                       else if (iptr->val.i == 0xffff) {
+                               M_CZEXT(s1, d);
+                               M_BGEZ(s1, 3);
+                               M_ISUB(REG_ZERO, s1, d);
+                               M_CZEXT(d, d);
+                               }
+                       else if (iptr->val.i == 0xffffff) {
+                               M_ZAPNOT_IMM(s1, 0x07, d);
+                               M_BGEZ(s1, 3);
+                               M_ISUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x07, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_AND(s1, REG_ITMP2, d);
+                               M_BGEZ(s1, 3);
+                               M_ISUB(REG_ZERO, s1, d);
+                               M_AND(d, REG_ITMP2, d);
+                               }
+                       M_ISUB(REG_ZERO, d, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IREM0X10001:  /* ..., value  ==> ..., value % 0x100001      */
+               
+/*          b = value & 0xffff;
+                       a = value >> 16;
+                       a = ((b - a) & 0xffff) + (b < a);
+*/
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP3);
+                               s1 = REG_ITMP3;
+                               }
+                       M_BLTZ(s1, 7);
+            M_CZEXT(s1, REG_ITMP2);
+                       M_SRA_IMM(s1, 16, d);
+                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
+                       M_ISUB(REG_ITMP2, d, d);
+            M_CZEXT(d, d);
+                       M_IADD(d, REG_ITMP1, d);
+                       M_BR(11 + (s1 == REG_ITMP1));
+                       M_ISUB(REG_ZERO, s1, REG_ITMP1);
+            M_CZEXT(REG_ITMP1, REG_ITMP2);
+                       M_SRA_IMM(REG_ITMP1, 16, d);
+                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
+                       M_ISUB(REG_ITMP2, d, d);
+            M_CZEXT(d, d);
+                       M_IADD(d, REG_ITMP1, d);
+                       M_ISUB(REG_ZERO, d, d);
+                       if (s1 == REG_ITMP1) {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               }
+                       M_SLL_IMM(s1, 33, REG_ITMP2);
+                       M_CMPEQ(REG_ITMP2, REG_ZERO, REG_ITMP2);
+                       M_ISUB(d, REG_ITMP2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_AND_IMM(s1, iptr->val.l, d);
+                               }
+                       else if (iptr->val.l == 0xffffL) {
+                               M_CZEXT(s1, d);
+                               }
+                       else if (iptr->val.l == 0xffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x07, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffL) {
+                               M_IZEXT(s1, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x1f, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x3f, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x7f, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_AND(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LREMPOW2:   /* ..., value  ==> ..., value % constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                               }
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_AND_IMM(s1, iptr->val.l, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_AND_IMM(d, iptr->val.l, d);
+                               }
+                       else if (iptr->val.l == 0xffffL) {
+                               M_CZEXT(s1, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_CZEXT(d, d);
+                               }
+                       else if (iptr->val.l == 0xffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x07, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x07, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffL) {
+                               M_IZEXT(s1, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_IZEXT(d, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x1f, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x1f, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x3f, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x3f, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x7f, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x7f, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_AND(s1, REG_ITMP2, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_AND(d, REG_ITMP2, d);
+                               }
+                       M_LSUB(REG_ZERO, d, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LREM0X10001:/* ..., value  ==> ..., value % 0x10001         */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP3);
+                               s1 = REG_ITMP3;
+                               }
+                       M_CZEXT(s1, REG_ITMP2);
+                       M_SRA_IMM(s1, 16, d);
+                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
+                       M_LSUB(REG_ITMP2, d, d);
+            M_CZEXT(d, d);
+                       M_LADD(d, REG_ITMP1, d);
+                       M_LDA(REG_ITMP2, REG_ZERO, -1);
+                       M_SRL_IMM(REG_ITMP2, 33, REG_ITMP2);
+                       if (s1 == REG_ITMP1) {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               }
+                       M_CMPULT(s1, REG_ITMP2, REG_ITMP2);
+                       M_BNEZ(REG_ITMP2, 11);
+                       M_LDA(d, REG_ZERO, -257);
+                       M_ZAPNOT_IMM(d, 0xcd, d);
+                       M_LSUB(REG_ZERO, s1, REG_ITMP2);
+                       M_CMOVGE(s1, s1, REG_ITMP2);
+                       M_UMULH(REG_ITMP2, d, REG_ITMP2);
+                       M_SRL_IMM(REG_ITMP2, 16, REG_ITMP2);
+                       M_LSUB(REG_ZERO, REG_ITMP2, d);
+                       M_CMOVGE(s1, REG_ITMP2, d);
+                       M_SLL_IMM(d, 16, REG_ITMP2);
+                       M_LADD(d, REG_ITMP2, d);
+                       M_LSUB(s1, d, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
+               case ICMD_LOR:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_OR( s1,s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_OR_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_OR(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LORCONST:   /* ..., value  ==> ..., value | constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_OR_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_OR(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
+               case ICMD_LXOR:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_XOR(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_XOR_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_XOR(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_XOR_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_XOR(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_LCMP:       /* ..., val1, val2  ==> ..., val1 cmp val2      */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_CMPLT(s1, s2, REG_ITMP3);
+                       M_CMPLT(s2, s1, REG_ITMP1);
+                       M_LSUB (REG_ITMP1, REG_ITMP3, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
+                                     /* op1 = variable, val.i = constant             */
+
+                       var = &(locals[iptr->op1][TYPE_INT]);
+                       if (var->flags & INMEMORY) {
+                               s1 = REG_ITMP1;
+                               M_LLD(s1, REG_SP, 8 * var->regoff);
+                               }
+                       else
+                               s1 = var->regoff;
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_IADD_IMM(s1, iptr->val.i, s1);
+                               }
+                       else if ((iptr->val.i > -256) && (iptr->val.i < 0)) {
+                               M_ISUB_IMM(s1, (-iptr->val.i), s1);
+                               }
+                       else {
+                               M_LDA (s1, s1, iptr->val.i);
+                               M_IADD(s1, REG_ZERO, s1);
+                               }
+                       if (var->flags & INMEMORY)
+                               M_LST(s1, REG_SP, 8 * var->regoff);
+                       break;
+
+
+               /* floating operations ************************************************/
+
+               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       M_FMOVN(s1, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       M_FMOVN(s1, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FADD(s1, s2, d);
+                               }
+                       else {
+                               M_FADDS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DADD(s1, s2, d);
+                               }
+                       else {
+                               M_DADDS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FSUB(s1, s2, d);
+                               }
+                       else {
+                               M_FSUBS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DSUB(s1, s2, d);
+                               }
+                       else {
+                               M_DSUBS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FMUL(s1, s2, d);
+                               }
+                       else {
+                               M_FMULS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 *** val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DMUL(s1, s2, d);
+                               }
+                       else {
+                               M_DMULS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FDIV(s1, s2, d);
+                               }
+                       else {
+                               M_FDIVS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DDIV(s1, s2, d);
+                               }
+                       else {
+                               M_DDIVS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+               
+               case ICMD_FREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FDIV(s1,s2, REG_FTMP3);
+                               M_CVTDL_C(REG_FTMP3, REG_FTMP3); /* round to integer */
+                               M_CVTLF(REG_FTMP3, REG_FTMP3);
+                               M_FMUL(REG_FTMP3, s2, REG_FTMP3);
+                               M_FSUB(s1, REG_FTMP3, d);
+                               }
+                       else {
+                               M_FDIVS(s1,s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_CVTDL_CS(REG_FTMP3, REG_FTMP3); /* round to integer */
+                               M_TRAPB;
+                               M_CVTLF(REG_FTMP3, REG_FTMP3);
+                               M_FMULS(REG_FTMP3, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_FSUBS(s1, REG_FTMP3, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                   break;
+
+               case ICMD_DREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DDIV(s1,s2, REG_FTMP3);
+                               M_CVTDL_C(REG_FTMP3, REG_FTMP3); /* round to integer */
+                               M_CVTLD(REG_FTMP3, REG_FTMP3);
+                               M_DMUL(REG_FTMP3, s2, REG_FTMP3);
+                               M_DSUB(s1, REG_FTMP3, d);
+                               }
+                       else {
+                               M_DDIVS(s1,s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_CVTDL_CS(REG_FTMP3, REG_FTMP3); /* round to integer */
+                               M_TRAPB;
+                               M_CVTLD(REG_FTMP3, REG_FTMP3);
+                               M_DMULS(REG_FTMP3, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_DSUBS(s1, REG_FTMP3, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                   break;
+
+               case ICMD_I2F:       /* ..., value  ==> ..., (float) value            */
+               case ICMD_L2F:
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       a = dseg_adddouble(0.0);
+                       M_LST (s1, REG_PV, a);
+                       M_DLD (d, REG_PV, a);
+                       M_CVTLF(d, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_I2D:       /* ..., value  ==> ..., (double) value           */
+               case ICMD_L2D:
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       a = dseg_adddouble(0.0);
+                       M_LST (s1, REG_PV, a);
+                       M_DLD (d, REG_PV, a);
+                       M_CVTLD(d, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+                       
+               case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
+               case ICMD_D2I:
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       a = dseg_adddouble(0.0);
+                       if (opt_noieee) {
+                               M_CVTDL_C(s1, REG_FTMP1);
+                               M_CVTLI(REG_FTMP1, REG_FTMP2);
+                               }
+                       else {
+                               M_CVTDL_CS(s1, REG_FTMP1);
+                               M_TRAPB;
+                               M_CVTLIS(REG_FTMP1, REG_FTMP2);
+                               M_TRAPB;
+                               }
+                       M_DST (REG_FTMP1, REG_PV, a);
+                       M_ILD (d, REG_PV, a);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+               
+               case ICMD_F2L:       /* ..., value  ==> ..., (long) value             */
+               case ICMD_D2L:
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       a = dseg_adddouble(0.0);
+                       if (opt_noieee) {
+                               M_CVTDL_C(s1, REG_FTMP1);
+                               }
+                       else {
+                               M_CVTDL_CS(s1, REG_FTMP1);
+                               M_TRAPB;
+                               }
+                       M_DST (REG_FTMP1, REG_PV, a);
+                       M_LLD (d, REG_PV, a);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       M_FLTMOVE(s1, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+                                       
+               case ICMD_D2F:       /* ..., value  ==> ..., (double) value           */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_CVTDF(s1, d);
+                               }
+                       else {
+                               M_CVTDFS(s1, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+               
+               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
+               case ICMD_DCMPL:
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (opt_noieee) {
+                               M_LSUB_IMM(REG_ZERO, 1, d);
+                               M_FCMPEQ(s1, s2, REG_FTMP3);
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instructions */
+                               M_CLR   (d);
+                               M_FCMPLT(s2, s1, REG_FTMP3);
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_LADD_IMM(REG_ZERO, 1, d);
+                               }
+                       else {
+                               M_LSUB_IMM(REG_ZERO, 1, d);
+                               M_FCMPEQS(s1, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instructions */
+                               M_CLR   (d);
+                               M_FCMPLTS(s2, s1, REG_FTMP3);
+                               M_TRAPB;
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_LADD_IMM(REG_ZERO, 1, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+                       
+               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
+               case ICMD_DCMPG:
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (opt_noieee) {
+                               M_LADD_IMM(REG_ZERO, 1, d);
+                               M_FCMPEQ(s1, s2, REG_FTMP3);
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_CLR   (d);
+                               M_FCMPLT(s1, s2, REG_FTMP3);
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_LSUB_IMM(REG_ZERO, 1, d);
+                               }
+                       else {
+                               M_LADD_IMM(REG_ZERO, 1, d);
+                               M_FCMPEQS(s1, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_CLR   (d);
+                               M_FCMPLTS(s1, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_LSUB_IMM(REG_ZERO, 1, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               /* memory operations **************************************************/
+
+                       /* #define gen_bound_check \
+                       if (checkbounds) {\
+                               M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));\
+                               M_CMPULT(s2, REG_ITMP3, REG_ITMP3);\
+                               M_BEQZ(REG_ITMP3, 0);\
+                               codegen_addxboundrefs(mcodeptr);\
+                               }
+                       */
+
+#define gen_bound_check \
+            if (checkbounds) { \
+                               M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));\
+                               M_CMPULT(s2, REG_ITMP3, REG_ITMP3);\
+                               M_BEQZ(REG_ITMP3, 0);\
+                               codegen_addxboundrefs(mcodeptr); \
+                }
+
+               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., length              */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       gen_nullptr_check(s1);
+                       M_ILD(d, s1, OFFSET(java_arrayheader, size));
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       M_SAADDQ(s2, s1, REG_ITMP1);
+                       M_ALD( d, REG_ITMP1, OFFSET(java_objectarray, data[0]));
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       M_S8ADDQ(s2, s1, REG_ITMP1);
+                       M_LLD(d, REG_ITMP1, OFFSET(java_longarray, data[0]));
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                 
+                       M_S4ADDQ(s2, s1, REG_ITMP1);
+                       M_ILD(d, REG_ITMP1, OFFSET(java_intarray, data[0]));
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       M_S4ADDQ(s2, s1, REG_ITMP1);
+                       M_FLD(d, REG_ITMP1, OFFSET(java_floatarray, data[0]));
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       M_S8ADDQ(s2, s1, REG_ITMP1);
+                       M_DLD(d, REG_ITMP1, OFFSET(java_doublearray, data[0]));
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_SLDU(d, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               }
+                       else {
+                               M_LADD (s2, s1, REG_ITMP1);
+                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               M_EXTWL(REG_ITMP2, REG_ITMP1, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;                  
+
+               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_SLDU( d, REG_ITMP1, OFFSET (java_shortarray, data[0]));
+                               M_SSEXT(d, d);
+                               }
+                       else {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_shortarray, data[0]));
+                               M_LDA(REG_ITMP1, REG_ITMP1, OFFSET(java_shortarray, data[0])+2);
+                               M_EXTQH(REG_ITMP2, REG_ITMP1, d);
+                               M_SRA_IMM(d, 48, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       if (has_ext_instr_set) {
+                               M_LADD   (s2, s1, REG_ITMP1);
+                               M_BLDU   (d, REG_ITMP1, OFFSET (java_bytearray, data[0]));
+                               M_BSEXT  (d, d);
+                               }
+                       else {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_bytearray, data[0]));
+                               M_LDA(REG_ITMP1, REG_ITMP1, OFFSET(java_bytearray, data[0])+1);
+                               M_EXTQH(REG_ITMP2, REG_ITMP1, d);
+                               M_SRA_IMM(d, 56, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_AASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       M_SAADDQ(s2, s1, REG_ITMP1);
+                       M_AST   (s3, REG_ITMP1, OFFSET(java_objectarray, data[0]));
+                       break;
+
+               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       M_S8ADDQ(s2, s1, REG_ITMP1);
+                       M_LST   (s3, REG_ITMP1, OFFSET(java_longarray, data[0]));
+                       break;
+
+               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       M_S4ADDQ(s2, s1, REG_ITMP1);
+                       M_IST   (s3, REG_ITMP1, OFFSET(java_intarray, data[0]));
+                       break;
+
+               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_flt(s3, src, REG_FTMP3);
+                       M_S4ADDQ(s2, s1, REG_ITMP1);
+                       M_FST   (s3, REG_ITMP1, OFFSET(java_floatarray, data[0]));
+                       break;
+
+               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_flt(s3, src, REG_FTMP3);
+                       M_S8ADDQ(s2, s1, REG_ITMP1);
+                       M_DST   (s3, REG_ITMP1, OFFSET(java_doublearray, data[0]));
+                       break;
+
+               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_SST (s3, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               }
+                       else {
+                               M_LADD (s2, s1, REG_ITMP1);
+                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               M_INSWL(s3, REG_ITMP1, REG_ITMP3);
+                               M_MSKWL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
+                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
+                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
+                               }
+                       break;
+
+               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_SST (s3, REG_ITMP1, OFFSET(java_shortarray, data[0]));
+                               }
+                       else {
+                               M_LADD (s2, s1, REG_ITMP1);
+                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_shortarray, data[0]));
+                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_shortarray, data[0]));
+                               M_INSWL(s3, REG_ITMP1, REG_ITMP3);
+                               M_MSKWL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
+                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
+                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
+                               }
+                       break;
+
+               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_BST (s3, REG_ITMP1, OFFSET(java_bytearray, data[0]));
+                               }
+                       else {
+                               M_LADD (s2, s1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_bytearray, data[0]));
+                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_bytearray, data[0]));
+                               M_INSBL(s3, REG_ITMP1, REG_ITMP3);
+                               M_MSKBL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
+                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
+                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
+                               }
+                       break;
+
+
+               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
+                                     /* op1 = type, val.a = field address            */
+
+                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
+                       M_ALD(REG_ITMP1, REG_PV, a);
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       M_IST(s2, REG_ITMP1, 0);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       M_LST(s2, REG_ITMP1, 0);
+                                       break;
+                               case TYPE_ADR:
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       M_AST(s2, REG_ITMP1, 0);
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_flt(s2, src, REG_FTMP2);
+                                       M_FST(s2, REG_ITMP1, 0);
+                                       break;
+                               case TYPE_DBL:
+                                       var_to_reg_flt(s2, src, REG_FTMP2);
+                                       M_DST(s2, REG_ITMP1, 0);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
+                                     /* op1 = type, val.a = field address            */
+
+                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
+                       M_ALD(REG_ITMP1, REG_PV, a);
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       M_ILD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_LNG:
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       M_LLD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_ADR:
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       M_ALD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_FLT:
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       M_FLD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               case TYPE_DBL:                          
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       M_DLD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+
+               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
+                                     /* op1 = type, val.i = field offset             */
+
+                       a = ((fieldinfo *)(iptr->val.a))->offset;
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       M_IST(s2, s1, a);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       M_LST(s2, s1, a);
+                                       break;
+                               case TYPE_ADR:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       M_AST(s2, s1, a);
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_flt(s2, src, REG_FTMP2);
+                                       gen_nullptr_check(s1);
+                                       M_FST(s2, s1, a);
+                                       break;
+                               case TYPE_DBL:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_flt(s2, src, REG_FTMP2);
+                                       gen_nullptr_check(s1);
+                                       M_DST(s2, s1, a);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
+                                     /* op1 = type, val.i = field offset             */
+
+                       a = ((fieldinfo *)(iptr->val.a))->offset;
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       gen_nullptr_check(s1);
+                                       M_ILD(d, s1, a);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       gen_nullptr_check(s1);
+                                       M_LLD(d, s1, a);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_ADR:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       gen_nullptr_check(s1);
+                                       M_ALD(d, s1, a);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       M_FLD(d, s1, a);
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               case TYPE_DBL:                          
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       M_DLD(d, s1, a);
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+
+               /* branch operations **************************************************/
+
+#define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}}
+
+               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_INTMOVE(s1, REG_ITMP1_XPTR);
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP2, REG_PV, a);
+                       M_JMP(REG_ITMP2_XPC, REG_ITMP2);
+                       M_NOP;              /* nop ensures that XPC is less than the end */
+                                           /* of basic block                            */
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_GOTO:         /* ... ==> ...                                */
+                                       /* op1 = target JavaVM pc                     */
+                       M_BR(0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_JSR:          /* ... ==> ...                                */
+                                       /* op1 = target JavaVM pc                     */
+
+                       M_BSR(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+                       
+               case ICMD_RET:          /* ... ==> ...                                */
+                                       /* op1 = local variable                       */
+
+                       var = &(locals[iptr->op1][TYPE_ADR]);
+                       if (var->flags & INMEMORY) {
+                               M_ALD(REG_ITMP1, REG_SP, 8 * var->regoff);
+                               M_RET(REG_ZERO, REG_ITMP1);
+                               }
+                       else
+                               M_RET(REG_ZERO, var->regoff);
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_IFNULL:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_BEQZ(s1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_BNEZ(s1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFEQ:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BEQZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPEQ_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFLT:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BLTZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPLT_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFLE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BLEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPLE_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFNE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BNEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPEQ_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFGT:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BGTZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPLE_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFGE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BGEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPLT_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BEQZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPEQ_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BLTZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPLT_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BLEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPLE_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BNEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPEQ_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BGTZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPLE_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BGEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPLT_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPEQ:    /* op1 = target JavaVM pc                     */
+               case ICMD_IF_ACMPEQ:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPEQ(s1, s2, REG_ITMP1);
+                       M_BNEZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPNE:    /* op1 = target JavaVM pc                     */
+               case ICMD_IF_ACMPNE:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPEQ(s1, s2, REG_ITMP1);
+                       M_BEQZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPLT:    /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPLT(s1, s2, REG_ITMP1);
+                       M_BNEZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPGT:    /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPLE(s1, s2, REG_ITMP1);
+                       M_BEQZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPLE:    /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPLE(s1, s2, REG_ITMP1);
+                       M_BNEZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPGE:    /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPLT(s1, s2, REG_ITMP1);
+                       M_BEQZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               /* (value xx 0) ? IFxx_ICONST : ELSE_ICONST                           */
+
+               case ICMD_ELSE_ICONST:  /* handled by IFxx_ICONST                     */
+                       break;
+
+               case ICMD_IFEQ_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPEQ(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPEQ(s1, REG_ZERO, d);
+                                       M_XOR_IMM(d, 1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVEQ_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVEQ(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFNE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPEQ(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPEQ(s1, REG_ZERO, d);
+                                       M_XOR_IMM(d, 1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVNE_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVNE(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFLT_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPLT(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPLE(REG_ZERO, s1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVLT_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVLT(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFGE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPLE(REG_ZERO, s1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPLT(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVGE_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVGE(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFGT_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPLT(REG_ZERO, s1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPLE(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVGT_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVGT(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFLE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPLE(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPLT(REG_ZERO, s1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVLE_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVLE(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
+               case ICMD_LRETURN:
+               case ICMD_ARETURN:
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               a = dseg_addaddress ((void*) (builtin_monitorexit));
+                               M_ALD(REG_PV, REG_PV, a);
+                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
+                               M_JSR(REG_RA, REG_PV);
+                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+                               }                       
+#endif
+                       var_to_reg_int(s1, src, REG_RESULT);
+                       M_INTMOVE(s1, REG_RESULT);
+                       goto nowperformreturn;
+
+               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
+               case ICMD_DRETURN:
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               a = dseg_addaddress ((void*) (builtin_monitorexit));
+                               M_ALD(REG_PV, REG_PV, a);
+                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
+                               M_JSR(REG_RA, REG_PV);
+                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+                               }                       
+#endif
+                       var_to_reg_flt(s1, src, REG_FRESULT);
+                       M_FLTMOVE(s1, REG_FRESULT);
+                       goto nowperformreturn;
+
+               case ICMD_RETURN:      /* ...  ==> ...                                */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               a = dseg_addaddress ((void*) (builtin_monitorexit));
+                               M_ALD(REG_PV, REG_PV, a);
+                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
+                               M_JSR(REG_RA, REG_PV);
+                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+                               }                       
+#endif
+
+nowperformreturn:
+                       {
+                       int r, p;
+                       
+                       p = parentargs_base;
+                       
+                       /* restore return address                                         */
+
+                       if (!isleafmethod)
+                               {p--;  M_LLD (REG_RA, REG_SP, 8 * p);}
+
+                       /* restore saved registers                                        */
+
+                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
+                                       {p--; M_LLD(savintregs[r], REG_SP, 8 * p);}
+                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
+                                       {p--; M_DLD(savfltregs[r], REG_SP, 8 * p);}
+
+                       /* deallocate stack                                               */
+
+                       if (parentargs_base)
+                               {M_LDA(REG_SP, REG_SP, parentargs_base*8);}
+
+                       /* call trace function */
+
+                       if (runverbose) {
+                               M_LDA (REG_SP, REG_SP, -24);
+                               M_AST(REG_RA, REG_SP, 0);
+                               M_LST(REG_RESULT, REG_SP, 8);
+                               M_DST(REG_FRESULT, REG_SP,16);
+                               a = dseg_addaddress (method);
+                               M_ALD(argintregs[0], REG_PV, a);
+                               M_MOV(REG_RESULT, argintregs[1]);
+                               M_FLTMOVE(REG_FRESULT, argfltregs[2]);
+                               M_FLTMOVE(REG_FRESULT, argfltregs[3]);
+                               a = dseg_addaddress ((void*) (builtin_displaymethodstop));
+                               M_ALD(REG_PV, REG_PV, a);
+                               M_JSR (REG_RA, REG_PV);
+                               s1 = (int)((u1*) mcodeptr - mcodebase);
+                               if (s1<=32768) M_LDA (REG_PV, REG_RA, -s1);
+                               else {
+                                       s4 ml=-s1, mh=0;
+                                       while (ml<-32768) { ml+=65536; mh--; }
+                                       M_LDA (REG_PV, REG_RA, ml );
+                                       M_LDAH (REG_PV, REG_PV, mh );
+                                       }
+                               M_DLD(REG_FRESULT, REG_SP,16);
+                               M_LLD(REG_RESULT, REG_SP, 8);
+                               M_ALD(REG_RA, REG_SP, 0);
+                               M_LDA (REG_SP, REG_SP, 24);
+                               }
+
+                       M_RET(REG_ZERO, REG_RA);
+                       ALIGNCODENOP;
+                       }
+                       break;
+
+
+               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
+                       {
+                       s4 i, l, *s4ptr;
+                       void **tptr;
+
+                       tptr = (void **) iptr->target;
+
+                       s4ptr = iptr->val.a;
+                       l = s4ptr[1];                          /* low     */
+                       i = s4ptr[2];                          /* high    */
+                       
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (l == 0)
+                               {M_INTMOVE(s1, REG_ITMP1);}
+                       else if (l <= 32768) {
+                               M_LDA(REG_ITMP1, s1, -l);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, l);
+                               M_ISUB(s1, REG_ITMP2, REG_ITMP1);
+                               }
+                       i = i - l + 1;
+
+                       /* range check */
+
+                       if (i <= 256)
+                               M_CMPULE_IMM(REG_ITMP1, i - 1, REG_ITMP2);
+                       else {
+                               M_LDA(REG_ITMP2, REG_ZERO, i - 1);
+                               M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
+                               }
+                       M_BEQZ(REG_ITMP2, 0);
+
+
+                       /* codegen_addreference(BlockPtrOfPC(s4ptr[0]), mcodeptr); */
+                       codegen_addreference((basicblock *) tptr[0], mcodeptr);
+
+                       /* build jump table top down and use address of lowest entry */
+
+                       /* s4ptr += 3 + i; */
+                       tptr += i;
+
+                       while (--i >= 0) {
+                               /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
+                               dseg_addtarget((basicblock *) tptr[0]); 
+                               --tptr;
+                               }
+                       }
+
+                       /* length of dataseg after last dseg_addtarget is used by load */
+
+                       M_SAADDQ(REG_ITMP1, REG_PV, REG_ITMP2);
+                       M_ALD(REG_ITMP2, REG_ITMP2, -dseglen);
+                       M_JMP(REG_ZERO, REG_ITMP2);
+                       ALIGNCODENOP;
+                       break;
+
+
+               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
+                       {
+                       s4 i, l, val, *s4ptr;
+                       void **tptr;
+
+                       tptr = (void **) iptr->target;
+
+                       s4ptr = iptr->val.a;
+                       l = s4ptr[0];                          /* default  */
+                       i = s4ptr[1];                          /* count    */
+                       
+                       MCODECHECK((i<<2)+8);
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       while (--i >= 0) {
+                               s4ptr += 2;
+                               ++tptr;
+
+                               val = s4ptr[0];
+                               if ((val >= 0) && (val <= 255)) {
+                                       M_CMPEQ_IMM(s1, val, REG_ITMP2);
+                                       }
+                               else {
+                                       if ((val >= -32768) && (val <= 32767)) {
+                                               M_LDA(REG_ITMP2, REG_ZERO, val);
+                                               } 
+                                       else {
+                                               a = dseg_adds4 (val);
+                                               M_ILD(REG_ITMP2, REG_PV, a);
+                                               }
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP2);
+                                       }
+                               M_BNEZ(REG_ITMP2, 0);
+                               /* codegen_addreference(BlockPtrOfPC(s4ptr[1]), mcodeptr); */
+                               codegen_addreference((basicblock *) tptr[0], mcodeptr); 
+                               }
+
+                       M_BR(0);
+                       /* codegen_addreference(BlockPtrOfPC(l), mcodeptr); */
+                       
+                       tptr = (void **) iptr->target;
+                       codegen_addreference((basicblock *) tptr[0], mcodeptr);
+
+                       ALIGNCODENOP;
+                       break;
+                       }
+
+
+               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 3;
+                       goto gen_method;
+
+               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 2;
+                       goto gen_method;
+
+               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 1;
+                       goto gen_method;
+
+               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+                       s3 = iptr->op1;
+
+gen_method: {
+                       methodinfo   *m;
+                       classinfo    *ci;
+
+                       MCODECHECK((s3 << 1) + 64);
+
+                       /* copy arguments to registers or stack location                  */
+
+                       for (; --s3 >= 0; src = src->prev) {
+                               if (src->varkind == ARGVAR)
+                                       continue;
+                               if (IS_INT_LNG_TYPE(src->type)) {
+                                       if (s3 < INT_ARG_CNT) {
+                                               s1 = argintregs[s3];
+                                               var_to_reg_int(d, src, s1);
+                                               M_INTMOVE(d, s1);
+                                               }
+                                       else  {
+                                               var_to_reg_int(d, src, REG_ITMP1);
+                                               M_LST(d, REG_SP, 8 * (s3 - INT_ARG_CNT));
+                                               }
+                                       }
+                               else
+                                       if (s3 < FLT_ARG_CNT) {
+                                               s1 = argfltregs[s3];
+                                               var_to_reg_flt(d, src, s1);
+                                               M_FLTMOVE(d, s1);
+                                               }
+                                       else {
+                                               var_to_reg_flt(d, src, REG_FTMP1);
+                                               M_DST(d, REG_SP, 8 * (s3 - FLT_ARG_CNT));
+                                               }
+                               } /* end of for */
+
+                       m = iptr->val.a;
+                       switch (iptr->opc) {
+                               case ICMD_BUILTIN3:
+                               case ICMD_BUILTIN2:
+                               case ICMD_BUILTIN1:
+                                       a = dseg_addaddress ((void*) (m));
+
+                                       M_ALD(REG_PV, REG_PV, a); /* Pointer to built-in-function */
+                                       d = iptr->op1;
+                                       goto makeactualcall;
+
+                               case ICMD_INVOKESTATIC:
+                               case ICMD_INVOKESPECIAL:
+                                       a = dseg_addaddress (m->stubroutine);
+
+                                       M_ALD(REG_PV, REG_PV, a );       /* method pointer in r27 */
+
+                                       d = m->returntype;
+                                       goto makeactualcall;
+
+                               case ICMD_INVOKEVIRTUAL:
+
+                                       gen_nullptr_check(argintregs[0]);
+                                       M_ALD(REG_METHODPTR, argintregs[0],
+                                                                OFFSET(java_objectheader, vftbl));
+                                       M_ALD(REG_PV, REG_METHODPTR, OFFSET(vftbl, table[0]) +
+                                                               sizeof(methodptr) * m->vftblindex);
+
+                                       d = m->returntype;
+                                       goto makeactualcall;
+
+                               case ICMD_INVOKEINTERFACE:
+                                       ci = m->class;
+                                       
+                                       gen_nullptr_check(argintregs[0]);
+                                       M_ALD(REG_METHODPTR, argintregs[0],
+                                                                OFFSET(java_objectheader, vftbl));    
+                                       M_ALD(REG_METHODPTR, REG_METHODPTR,
+                                             OFFSET(vftbl, interfacetable[0]) -
+                                             sizeof(methodptr*) * ci->index);
+                                       M_ALD(REG_PV, REG_METHODPTR,
+                                                           sizeof(methodptr) * (m - ci->methods));
+
+                                       d = m->returntype;
+                                       goto makeactualcall;
+
+                               default:
+                                       d = 0;
+                                       sprintf (logtext, "Unkown ICMD-Command: %d", iptr->opc);
+                                       error ();
+                               }
+
+makeactualcall:
+
+                       M_JSR (REG_RA, REG_PV);
+
+                       /* recompute pv */
+
+                       s1 = (int)((u1*) mcodeptr - mcodebase);
+                       if (s1<=32768) M_LDA (REG_PV, REG_RA, -s1);
+                       else {
+                               s4 ml=-s1, mh=0;
+                               while (ml<-32768) { ml+=65536; mh--; }
+                               M_LDA (REG_PV, REG_RA, ml );
+                               M_LDAH (REG_PV, REG_PV, mh );
+                               }
+
+                       /* d contains return type */
+
+                       if (d != TYPE_VOID) {
+                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
+                                       s1 = reg_of_var(iptr->dst, REG_RESULT);
+                                       M_INTMOVE(REG_RESULT, s1);
+                                       store_reg_to_var_int(iptr->dst, s1);
+                                       }
+                               else {
+                                       s1 = reg_of_var(iptr->dst, REG_FRESULT);
+                                       M_FLTMOVE(REG_FRESULT, s1);
+                                       store_reg_to_var_flt(iptr->dst, s1);
+                                       }
+                               }
+                       }
+                       break;
+
+
+               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
+
+                                     /* op1:   0 == array, 1 == class                */
+                                     /* val.a: (classinfo*) superclass               */
+
+/*          superclass is an interface:
+ *
+ *          return (sub != NULL) &&
+ *                 (sub->vftbl->interfacetablelength > super->index) &&
+ *                 (sub->vftbl->interfacetable[-super->index] != NULL);
+ *
+ *          superclass is a class:
+ *
+ *          return ((sub != NULL) && (0
+ *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
+ *                  super->vftbl->diffvall));
+ */
+
+                       {
+                       classinfo *super = (classinfo*) iptr->val.a;
+                       
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                               }
+                       M_CLR(d);
+                       if (iptr->op1) {                               /* class/interface */
+                               if (super->flags & ACC_INTERFACE) {        /* interface       */
+                                       M_BEQZ(s1, 6);
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
+                                       M_LDA(REG_ITMP2, REG_ITMP2, - super->index);
+                                       M_BLEZ(REG_ITMP2, 2);
+                                       M_ALD(REG_ITMP1, REG_ITMP1,
+                                             OFFSET(vftbl, interfacetable[0]) -
+                                             super->index * sizeof(methodptr*));
+                                       M_CMPULT(REG_ZERO, REG_ITMP1, d);      /* REG_ITMP1 != 0  */
+                                       }
+                               else {                                     /* class           */
+/*
+                                       s2 = super->vftbl->diffval;
+                                       M_BEQZ(s1, 4 + (s2 > 255));
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       M_LDA(REG_ITMP1, REG_ITMP1, - super->vftbl->baseval);
+                                       if (s2 <= 255)
+                                               M_CMPULE_IMM(REG_ITMP1, s2, d);
+                                       else {
+                                               M_LDA(REG_ITMP2, REG_ZERO, s2);
+                                               M_CMPULE(REG_ITMP1, REG_ITMP2, d);
+                                               }
+*/
+                                       M_BEQZ(s1, 7);
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       a = dseg_addaddress ((void*) super->vftbl);
+                                       M_ALD(REG_ITMP2, REG_PV, a);
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
+                                       M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                       M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
+                                       M_CMPULE(REG_ITMP1, REG_ITMP2, d);
+                                       }
+                               }
+                       else
+                               panic ("internal error: no inlined array instanceof");
+                       }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
+
+                                     /* op1:   0 == array, 1 == class                */
+                                     /* val.a: (classinfo*) superclass               */
+
+/*          superclass is an interface:
+ *
+ *          OK if ((sub == NULL) ||
+ *                 (sub->vftbl->interfacetablelength > super->index) &&
+ *                 (sub->vftbl->interfacetable[-super->index] != NULL));
+ *
+ *          superclass is a class:
+ *
+ *          OK if ((sub == NULL) || (0
+ *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
+ *                 super->vftbl->diffvall));
+ */
+
+                       {
+                       classinfo *super = (classinfo*) iptr->val.a;
+                       
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       var_to_reg_int(s1, src, d);
+                       if (iptr->op1) {                               /* class/interface */
+                               if (super->flags & ACC_INTERFACE) {        /* interface       */
+                                       M_BEQZ(s1, 6);
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
+                                       M_LDA(REG_ITMP2, REG_ITMP2, - super->index);
+                                       M_BLEZ(REG_ITMP2, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+                                       M_ALD(REG_ITMP2, REG_ITMP1,
+                                             OFFSET(vftbl, interfacetable[0]) -
+                                             super->index * sizeof(methodptr*));
+                                       M_BEQZ(REG_ITMP2, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+                                       }
+                               else {                                     /* class           */
+/*
+                                       s2 = super->vftbl->diffval;
+                                       M_BEQZ(s1, 4 + (s2 != 0) + (s2 > 255));
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       M_LDA(REG_ITMP1, REG_ITMP1, - super->vftbl->baseval);
+                                       if (s2 == 0) {
+                                               M_BNEZ(REG_ITMP1, 0);
+                                               }
+                                       else if (s2 <= 255) {
+                                               M_CMPULE_IMM(REG_ITMP1, s2, REG_ITMP2);
+                                               M_BEQZ(REG_ITMP2, 0);
+                                               }
+                                       else {
+                                               M_LDA(REG_ITMP2, REG_ZERO, s2);
+                                               M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
+                                               M_BEQZ(REG_ITMP2, 0);
+                                               }
+*/
+                                       M_BEQZ(s1, 8 + (d == REG_ITMP3));
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       a = dseg_addaddress ((void*) super->vftbl);
+                                       M_ALD(REG_ITMP2, REG_PV, a);
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       if (d != REG_ITMP3) {
+                                               M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                               M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
+                                               }
+                                       else {
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, baseval));
+                                               M_ISUB(REG_ITMP1, REG_ITMP2, REG_ITMP1);
+                                               M_ALD(REG_ITMP2, REG_PV, a);
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                               }
+                                       M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
+                                       M_BEQZ(REG_ITMP2, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+                                       }
+                               }
+                       else
+                               panic ("internal error: no inlined array checkcast");
+                       }
+                       M_INTMOVE(s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_BLTZ(s1, 0);
+                       codegen_addxcheckarefs(mcodeptr);
+                       break;
+
+               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
+                                     /* op1 = dimension, val.a = array descriptor    */
+
+                       /* check for negative sizes and copy sizes to stack if necessary  */
+
+                       MCODECHECK((iptr->op1 << 1) + 64);
+
+                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
+                               var_to_reg_int(s2, src, REG_ITMP1);
+                               M_BLTZ(s2, 0);
+                               codegen_addxcheckarefs(mcodeptr);
+
+                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
+
+                               if (src->varkind != ARGVAR) {
+                                       M_LST(s2, REG_SP, 8 * (s1 + INT_ARG_CNT));
+                                       }
+                               }
+
+                       /* a0 = dimension count */
+
+                       ICONST(argintregs[0], iptr->op1);
+
+                       /* a1 = arraydescriptor */
+
+                       a = dseg_addaddress(iptr->val.a);
+                       M_ALD(argintregs[1], REG_PV, a);
+
+                       /* a2 = pointer to dimensions = stack pointer */
+
+                       M_INTMOVE(REG_SP, argintregs[2]);
+
+                       a = dseg_addaddress((void*) (builtin_nmultianewarray));
+                       M_ALD(REG_PV, REG_PV, a);
+                       M_JSR(REG_RA, REG_PV);
+                       s1 = (int)((u1*) mcodeptr - mcodebase);
+                       if (s1 <= 32768)
+                               M_LDA (REG_PV, REG_RA, -s1);
+                       else {
+                               s4 ml = -s1, mh = 0;
+                               while (ml < -32768) {ml += 65536; mh--;}
+                               M_LDA(REG_PV, REG_RA, ml);
+                               M_LDAH(REG_PV, REG_PV, mh);
+                           }
+                       s1 = reg_of_var(iptr->dst, REG_RESULT);
+                       M_INTMOVE(REG_RESULT, s1);
+                       store_reg_to_var_int(iptr->dst, s1);
+                       break;
+
+
+               default: sprintf (logtext, "Unknown pseudo command: %d", iptr->opc);
+                        error();
+       
+   
+
+       } /* switch */
+               
+       } /* for instruction */
+               
+       /* copy values to interface registers */
+
+       src = bptr->outstack;
+       len = bptr->outdepth;
+       MCODECHECK(64+len);
+       while (src) {
+               len--;
+               if ((src->varkind != STACKVAR)) {
+                       s2 = src->type;
+                       if (IS_FLT_DBL_TYPE(s2)) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                       M_FLTMOVE(s1,interfaces[len][s2].regoff);
+                                       }
+                               else {
+                                       M_DST(s1, REG_SP, 8 * interfaces[len][s2].regoff);
+                                       }
+                               }
+                       else {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                       M_INTMOVE(s1,interfaces[len][s2].regoff);
+                                       }
+                               else {
+                                       M_LST(s1, REG_SP, 8 * interfaces[len][s2].regoff);
+                                       }
+                               }
+                       }
+               src = src->prev;
+               }
+       } /* if (bptr -> flags >= BBREACHED) */
+       } /* for basic block */
+
+       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
+
+       {
+       /* generate bound check stubs */
+
+       s4 *xcodeptr = NULL;
+       
+       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
+                               xboundrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
+                       continue;
+                       }
+
+
+               gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
+                                 xboundrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               M_LDA(REG_ITMP2_XPC, REG_PV, xboundrefs->branchpos - 4);
+
+               if (xcodeptr != NULL) {
+                       M_BR((xcodeptr-mcodeptr)-1);
+                       }
+               else {
+                       xcodeptr = mcodeptr;
+
+                       a = dseg_addaddress(proto_java_lang_ArrayIndexOutOfBoundsException);
+                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
+
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP3, REG_PV, a);
+
+                       M_JMP(REG_ZERO, REG_ITMP3);
+                       }
+               }
+
+       /* generate negative array size check stubs */
+
+       xcodeptr = NULL;
+       
+       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
+                               xcheckarefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
+                       continue;
+                       }
+
+               gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
+                                 xcheckarefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               M_LDA(REG_ITMP2_XPC, REG_PV, xcheckarefs->branchpos - 4);
+
+               if (xcodeptr != NULL) {
+                       M_BR((xcodeptr-mcodeptr)-1);
+                       }
+               else {
+                       xcodeptr = mcodeptr;
+
+                       a = dseg_addaddress(proto_java_lang_NegativeArraySizeException);
+                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
+
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP3, REG_PV, a);
+
+                       M_JMP(REG_ZERO, REG_ITMP3);
+                       }
+               }
+
+       /* generate cast check stubs */
+
+       xcodeptr = NULL;
+       
+       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
+                               xcastrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
+                       continue;
+                       }
+
+               gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
+                                 xcastrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               M_LDA(REG_ITMP2_XPC, REG_PV, xcastrefs->branchpos - 4);
+
+               if (xcodeptr != NULL) {
+                       M_BR((xcodeptr-mcodeptr)-1);
+                       }
+               else {
+                       xcodeptr = mcodeptr;
+
+                       a = dseg_addaddress(proto_java_lang_ClassCastException);
+                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
+
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP3, REG_PV, a);
+
+                       M_JMP(REG_ZERO, REG_ITMP3);
+                       }
+               }
+
+
+#ifdef SOFTNULLPTRCHECK
+
+       /* generate null pointer check stubs */
+
+       xcodeptr = NULL;
+
+       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
+                               xnullrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
+                       continue;
+                       }
+
+               gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
+                                 xnullrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               M_LDA(REG_ITMP2_XPC, REG_PV, xnullrefs->branchpos - 4);
+
+               if (xcodeptr != NULL) {
+                       M_BR((xcodeptr-mcodeptr)-1);
+                       }
+               else {
+                       xcodeptr = mcodeptr;
+
+                       a = dseg_addaddress(proto_java_lang_NullPointerException);
+                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
+
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP3, REG_PV, a);
+
+                       M_JMP(REG_ZERO, REG_ITMP3);
+                       }
+               }
+
+#endif
+       }
+
+       codegen_finish((int)((u1*) mcodeptr - mcodebase));
+}
+
+
+/* redefinition of code generation macros (compiling into array) **************/
+
+/* 
+These macros are newly defined to allow code generation into an array.
+This is necessary, because the original M_.. macros generate code by
+calling 'codegen_adds4' that uses an additional data structure to
+receive the code.
+
+For a faster (but less flexible) version to generate code, these
+macros directly use the (s4* p) - pointer to put the code directly
+in a locally defined array.
+This makes sense only for the stub-generation-routines below.
+*/
+
+#undef M_OP3
+#define M_OP3(op,fu,a,b,c,const) \
+       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<(16-3*(const)))| \
+       ((const)<<12)|((fu)<<5)|((c)) )
+#undef M_FOP3
+#define M_FOP3(op,fu,a,b,c) \
+       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((fu)<<5)|(c) )
+#undef M_BRA
+#define M_BRA(op,a,disp) \
+       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((disp)&0x1fffff) )
+#undef M_MEM
+#define M_MEM(op,a,b,disp) \
+       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((disp)&0xffff) )
+
+
+/* function createcompilerstub *************************************************
+
+       creates a stub routine which calls the compiler
+       
+*******************************************************************************/
+
+#define COMPSTUBSIZE 3
+
+u1 *createcompilerstub (methodinfo *m)
+{
+       u8 *s = CNEW (u8, COMPSTUBSIZE);    /* memory to hold the stub            */
+       s4 *p = (s4*) s;                    /* code generation pointer            */
+       
+                                           /* code for the stub                  */
+       M_ALD (REG_PV, REG_PV, 16);         /* load pointer to the compiler       */
+       M_JMP (0, REG_PV);                  /* jump to the compiler, return address
+                                              in reg 0 is used as method pointer */
+       s[1] = (u8) m;                      /* literals to be adressed            */  
+       s[2] = (u8) asm_call_jit_compiler;  /* jump directly via PV from above    */
+
+#ifdef STATISTICS
+       count_cstub_len += COMPSTUBSIZE * 8;
+#endif
+
+       return (u1*) s;
+}
+
+
+/* function removecompilerstub *************************************************
+
+     deletes a compilerstub from memory  (simply by freeing it)
+
+*******************************************************************************/
+
+void removecompilerstub (u1 *stub) 
+{
+       CFREE (stub, COMPSTUBSIZE * 8);
+}
+
+/* function: createnativestub **************************************************
+
+       creates a stub routine which calls a native method
+
+*******************************************************************************/
+
+#define NATIVESTUBSIZE 34
+#define NATIVESTUBOFFSET 8
+
+int runverbosenat = 0;
+
+u1 *createnativestub (functionptr f, methodinfo *m)
+{
+       int disp;
+       u8 *s = CNEW (u8, NATIVESTUBSIZE);  /* memory to hold the stub            */
+       u8 *cs = s + NATIVESTUBOFFSET;
+       s4 *p = (s4*) (cs);                 /* code generation pointer            */
+
+       *(cs-1) = (u8) f;                   /* address of native method           */
+       *(cs-2) = (u8) (&exceptionptr);     /* address of exceptionptr            */
+       *(cs-3) = (u8) asm_handle_nat_exception; /* addr of asm exception handler */
+       *(cs-4) = (u8) (&env);              /* addr of jni_environement           */
+       *(cs-5) = (u8) asm_builtin_trace;
+       *(cs-6) = (u8) m;
+       *(cs-7) = (u8) asm_builtin_exittrace;
+       *(cs-8) = (u8) builtin_trace_exception;
+
+#if 0
+       printf("stub: ");
+       utf_display(m->class->name);
+       printf(".");
+       utf_display(m->name);
+       printf(" 0x%p\n", cs);
+#endif
+
+       M_LDA  (REG_SP, REG_SP, -8);        /* build up stackframe                */
+       M_AST  (REG_RA, REG_SP, 0);         /* store return address               */
+
+#if 1
+       if (runverbosenat) {
+               M_ALD(REG_ITMP1, REG_PV, -6*8);
+               M_ALD(REG_PV, REG_PV, -5*8);
+
+               M_JSR(REG_RA, REG_PV);
+               disp = -(int) (p - (s4*) cs)*4;
+               M_LDA(REG_PV, REG_RA, disp);
+       }
+#endif
+
+       reg_init();
+
+       M_MOV  (argintregs[4],argintregs[5]); 
+       M_FMOV (argfltregs[4],argfltregs[5]);
+
+       M_MOV  (argintregs[3],argintregs[4]);
+       M_FMOV (argfltregs[3],argfltregs[4]);
+
+       M_MOV  (argintregs[2],argintregs[3]);
+       M_FMOV (argfltregs[2],argfltregs[3]);
+
+       M_MOV  (argintregs[1],argintregs[2]);
+       M_FMOV (argfltregs[1],argfltregs[2]);
+
+       M_MOV  (argintregs[0],argintregs[1]);
+       M_FMOV (argfltregs[0],argfltregs[1]);
+       
+       M_ALD  (argintregs[0], REG_PV, -4*8);/* load adress of jni_environement   */
+
+       M_ALD  (REG_PV, REG_PV, -1*8);      /* load adress of native method       */
+       M_JSR  (REG_RA, REG_PV);            /* call native method                 */
+
+       disp = -(int) (p - (s4*) cs)*4;
+       M_LDA  (REG_PV, REG_RA, disp);      /* recompute pv from ra               */
+       M_ALD  (REG_ITMP3, REG_PV, -2*8);   /* get address of exceptionptr        */
+
+       M_ALD  (REG_ITMP1, REG_ITMP3, 0);   /* load exception into reg. itmp1     */
+       M_BNEZ (REG_ITMP1,
+                       3 + (runverbosenat ? 6 : 0));  /* if no exception then return        */
+
+#if 1
+       if (runverbosenat) {
+               M_ALD(argintregs[0], REG_PV, -6*8);
+               M_MOV(REG_RESULT, argintregs[1]);
+               M_FMOV(REG_FRESULT, argfltregs[2]);
+               M_FMOV(REG_FRESULT, argfltregs[3]);
+               M_ALD(REG_PV, REG_PV, -7*8);
+               M_JSR(REG_RA, REG_PV);
+       }
+#endif
+
+       M_ALD  (REG_RA, REG_SP, 0);         /* load return address                */
+       M_LDA  (REG_SP, REG_SP, 8);         /* remove stackframe                  */
+
+       M_RET  (REG_ZERO, REG_RA);          /* return to caller                   */
+       
+       M_AST  (REG_ZERO, REG_ITMP3, 0);    /* store NULL into exceptionptr       */
+
+#if 1
+       if (runverbosenat) {
+               M_LDA(REG_SP, REG_SP, -8);
+               M_AST(REG_ITMP1, REG_SP, 0);
+               M_MOV(REG_ITMP1, argintregs[0]);
+               M_ALD(argintregs[1], REG_PV, -6*8);
+               M_ALD(argintregs[2], REG_SP, 0);
+               M_CLR(argintregs[3]);
+               M_ALD(REG_PV, REG_PV, -8*8);
+               M_JSR(REG_RA, REG_PV);
+               disp = -(int) (p - (s4*) cs)*4;
+               M_LDA  (REG_PV, REG_RA, disp);
+               M_ALD(REG_ITMP1, REG_SP, 0);
+               M_LDA(REG_SP, REG_SP, 8);
+       }
+#endif
+
+       M_ALD  (REG_RA, REG_SP, 0);         /* load return address                */
+       M_LDA  (REG_SP, REG_SP, 8);         /* remove stackframe                  */
+
+       M_LDA  (REG_ITMP2, REG_RA, -4);     /* move fault address into reg. itmp2 */
+
+       M_ALD  (REG_ITMP3, REG_PV, -3*8);   /* load asm exception handler address */
+       M_JMP  (REG_ZERO, REG_ITMP3);       /* jump to asm exception handler      */
+       
+#if 0
+       {
+               static int stubprinted;
+               if (!stubprinted)
+                       printf("stubsize: %d/2\n", (int) (p - (s4*) s));
+               stubprinted = 1;
+       }
+#endif
+
+#ifdef STATISTICS
+       count_nstub_len += NATIVESTUBSIZE * 8;
+#endif
+
+       return (u1*) (s + NATIVESTUBOFFSET);
+}
+
+/* function: removenativestub **************************************************
+
+    removes a previously created native-stub from memory
+    
+*******************************************************************************/
+
+void removenativestub (u1 *stub)
+{
+       CFREE ((u8*) stub - NATIVESTUBOFFSET, NATIVESTUBSIZE * 8);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/alpha/codegen.h b/jit/alpha/codegen.h
new file mode 100644 (file)
index 0000000..d45d3a4
--- /dev/null
@@ -0,0 +1,448 @@
+/* jit/alpha/codegen.h - code generation macros and definitions for alpha
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   $Id: codegen.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _CODEGEN_H
+#define _CODEGEN_H
+
+#include "jit.h"
+
+
+/* see also file calling.doc for explanation of calling conventions           */
+
+/* preallocated registers *****************************************************/
+
+/* integer registers */
+  
+#define REG_RESULT      0    /* to deliver method results                     */ 
+
+#define REG_RA          26   /* return address                                */
+#define REG_PV          27   /* procedure vector, must be provided by caller  */
+#define REG_METHODPTR   28   /* pointer to the place from where the procedure */
+                             /* vector has been fetched                       */
+#define REG_ITMP1       25   /* temporary register                            */
+#define REG_ITMP2       28   /* temporary register and method pointer         */
+#define REG_ITMP3       29   /* temporary register                            */
+
+#define REG_ITMP1_XPTR  25   /* exception pointer = temporary register 1      */
+#define REG_ITMP2_XPC   28   /* exception pc = temporary register 2           */
+
+#define REG_SP          30   /* stack pointer                                 */
+#define REG_ZERO        31   /* allways zero                                  */
+
+/* floating point registers */
+
+#define REG_FRESULT     0    /* to deliver floating point method results      */ 
+#define REG_FTMP1       28   /* temporary floating point register             */
+#define REG_FTMP2       29   /* temporary floating point register             */
+#define REG_FTMP3       30   /* temporary floating point register             */
+
+#define REG_IFTMP       28   /* temporary integer and floating point register */
+
+/* register descripton - array ************************************************/
+
+/* #define REG_RES   0         reserved register for OS or code generator     */
+/* #define REG_RET   1         return value register                          */
+/* #define REG_EXC   2         exception value register (only old jit)        */
+/* #define REG_SAV   3         (callee) saved register                        */
+/* #define REG_TMP   4         scratch temporary register (caller saved)      */
+/* #define REG_ARG   5         argument register (caller saved)               */
+
+/* #define REG_END   -1        last entry in tables */
+int nregdescint[] = {
+       REG_RET, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
+       REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, 
+       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
+       REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
+       REG_END };
+
+#define INT_SAV_CNT      7   /* number of int callee saved registers          */
+#define INT_ARG_CNT      6   /* number of int argument registers              */
+
+/* for use of reserved registers, see comment above */
+       
+int nregdescfloat[] = {
+       REG_RET, REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
+       REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
+       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
+       REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES,
+       REG_END };
+
+#define FLT_SAV_CNT      8   /* number of flt callee saved registers          */
+#define FLT_ARG_CNT      6   /* number of flt argument registers              */
+
+/* for use of reserved registers, see comment above */
+
+
+/* parameter allocation mode */
+
+int nreg_parammode = PARAMMODE_NUMBERED;  
+
+   /* parameter-registers will be allocated by assigning the
+      1. parameter:   int/float-reg 16
+      2. parameter:   int/float-reg 17  
+      3. parameter:   int/float-reg 18 ....
+   */
+
+
+/* stackframe-infos ***********************************************************/
+
+int parentargs_base; /* offset in stackframe for the parameter from the caller*/
+
+/* -> see file 'calling.doc' */
+
+
+/* macros to create code ******************************************************/
+
+#define REG   0
+#define CONST 1
+
+/* 3-address-operations: M_OP3
+      op ..... opcode
+      fu ..... function-number
+      a  ..... register number source 1
+      b  ..... register number or constant integer source 2
+      c  ..... register number destination
+      const .. switch to use b as constant integer 
+                 (REG means: use b as register number)
+                 (CONST means: use b as constant 8-bit-integer)
+*/      
+#define M_OP3(op,fu,a,b,c,const) \
+       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<(16-3*(const)))| \
+       ((const)<<12)|((fu)<<5)|((c)) )
+
+/* 3-address-floating-point-operation: M_FOP3 
+     op .... opcode
+     fu .... function-number
+     a,b ... source floating-point registers
+     c ..... destination register
+*/ 
+#define M_FOP3(op,fu,a,b,c) \
+       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((fu)<<5)|(c) )
+
+/* branch instructions: M_BRA 
+      op ..... opcode
+      a ...... register to be tested
+      disp ... relative address to be jumped to (divided by 4)
+*/
+#define M_BRA(op,a,disp) \
+       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((disp)&0x1fffff) )
+
+
+/* memory operations: M_MEM
+      op ..... opcode
+      a ...... source/target register for memory access
+      b ...... base register
+      disp ... displacement (16 bit signed) to be added to b
+*/ 
+#define M_MEM(op,a,b,disp) \
+       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((disp)&0xffff) )
+
+
+/* macros for all used commands (see an Alpha-manual for description) *********/ 
+
+#define M_LDA(a,b,disp)         M_MEM (0x08,a,b,disp)           /* low const  */
+#define M_LDAH(a,b,disp)        M_MEM (0x09,a,b,disp)           /* high const */
+#define M_BLDU(a,b,disp)        M_MEM (0x0a,a,b,disp)           /*  8 load    */
+#define M_SLDU(a,b,disp)        M_MEM (0x0c,a,b,disp)           /* 16 load    */
+#define M_ILD(a,b,disp)         M_MEM (0x28,a,b,disp)           /* 32 load    */
+#define M_LLD(a,b,disp)         M_MEM (0x29,a,b,disp)           /* 64 load    */
+#define M_ALD(a,b,disp)         M_MEM (0x29,a,b,disp)           /* addr load  */
+#define M_BST(a,b,disp)         M_MEM (0x0e,a,b,disp)           /*  8 store   */
+#define M_SST(a,b,disp)         M_MEM (0x0d,a,b,disp)           /* 16 store   */
+#define M_IST(a,b,disp)         M_MEM (0x2c,a,b,disp)           /* 32 store   */
+#define M_LST(a,b,disp)         M_MEM (0x2d,a,b,disp)           /* 64 store   */
+#define M_AST(a,b,disp)         M_MEM (0x2d,a,b,disp)           /* addr store */
+
+#define M_BSEXT(b,c)            M_OP3 (0x1c,0x0,REG_ZERO,b,c,0) /*  8 signext */
+#define M_SSEXT(b,c)            M_OP3 (0x1c,0x1,REG_ZERO,b,c,0) /* 16 signext */
+
+#define M_BR(disp)              M_BRA (0x30,REG_ZERO,disp)      /* branch     */
+#define M_BSR(ra,disp)          M_BRA (0x34,ra,disp)            /* branch sbr */
+#define M_BEQZ(a,disp)          M_BRA (0x39,a,disp)             /* br a == 0  */
+#define M_BLTZ(a,disp)          M_BRA (0x3a,a,disp)             /* br a <  0  */
+#define M_BLEZ(a,disp)          M_BRA (0x3b,a,disp)             /* br a <= 0  */
+#define M_BNEZ(a,disp)          M_BRA (0x3d,a,disp)             /* br a != 0  */
+#define M_BGEZ(a,disp)          M_BRA (0x3e,a,disp)             /* br a >= 0  */
+#define M_BGTZ(a,disp)          M_BRA (0x3f,a,disp)             /* br a >  0  */
+
+#define M_JMP(a,b)              M_MEM (0x1a,a,b,0x0000)         /* jump       */
+#define M_JSR(a,b)              M_MEM (0x1a,a,b,0x4000)         /* call sbr   */
+#define M_RET(a,b)              M_MEM (0x1a,a,b,0x8000)         /* return     */
+
+#define M_IADD(a,b,c)           M_OP3 (0x10,0x0,  a,b,c,0)      /* 32 add     */
+#define M_LADD(a,b,c)           M_OP3 (0x10,0x20, a,b,c,0)      /* 64 add     */
+#define M_ISUB(a,b,c)           M_OP3 (0x10,0x09, a,b,c,0)      /* 32 sub     */
+#define M_LSUB(a,b,c)           M_OP3 (0x10,0x29, a,b,c,0)      /* 64 sub     */
+#define M_IMUL(a,b,c)           M_OP3 (0x13,0x00, a,b,c,0)      /* 32 mul     */
+#define M_LMUL(a,b,c)           M_OP3 (0x13,0x20, a,b,c,0)      /* 64 mul     */
+
+#define M_IADD_IMM(a,b,c)       M_OP3 (0x10,0x0,  a,b,c,1)      /* 32 add     */
+#define M_LADD_IMM(a,b,c)       M_OP3 (0x10,0x20, a,b,c,1)      /* 64 add     */
+#define M_ISUB_IMM(a,b,c)       M_OP3 (0x10,0x09, a,b,c,1)      /* 32 sub     */
+#define M_LSUB_IMM(a,b,c)       M_OP3 (0x10,0x29, a,b,c,1)      /* 64 sub     */
+#define M_IMUL_IMM(a,b,c)       M_OP3 (0x13,0x00, a,b,c,1)      /* 32 mul     */
+#define M_LMUL_IMM(a,b,c)       M_OP3 (0x13,0x20, a,b,c,1)      /* 64 mul     */
+
+#define M_CMPEQ(a,b,c)          M_OP3 (0x10,0x2d, a,b,c,0)      /* c = a == b */
+#define M_CMPLT(a,b,c)          M_OP3 (0x10,0x4d, a,b,c,0)      /* c = a <  b */
+#define M_CMPLE(a,b,c)          M_OP3 (0x10,0x6d, a,b,c,0)      /* c = a <= b */
+
+#define M_CMPULE(a,b,c)         M_OP3 (0x10,0x3d, a,b,c,0)      /* c = a <= b */
+#define M_CMPULT(a,b,c)         M_OP3 (0x10,0x1d, a,b,c,0)      /* c = a <= b */
+
+#define M_CMPEQ_IMM(a,b,c)      M_OP3 (0x10,0x2d, a,b,c,1)      /* c = a == b */
+#define M_CMPLT_IMM(a,b,c)      M_OP3 (0x10,0x4d, a,b,c,1)      /* c = a <  b */
+#define M_CMPLE_IMM(a,b,c)      M_OP3 (0x10,0x6d, a,b,c,1)      /* c = a <= b */
+
+#define M_CMPULE_IMM(a,b,c)     M_OP3 (0x10,0x3d, a,b,c,1)      /* c = a <= b */
+#define M_CMPULT_IMM(a,b,c)     M_OP3 (0x10,0x1d, a,b,c,1)      /* c = a <= b */
+
+#define M_AND(a,b,c)            M_OP3 (0x11,0x00, a,b,c,0)      /* c = a &  b */
+#define M_OR( a,b,c)            M_OP3 (0x11,0x20, a,b,c,0)      /* c = a |  b */
+#define M_XOR(a,b,c)            M_OP3 (0x11,0x40, a,b,c,0)      /* c = a ^  b */
+
+#define M_AND_IMM(a,b,c)        M_OP3 (0x11,0x00, a,b,c,1)      /* c = a &  b */
+#define M_OR_IMM( a,b,c)        M_OP3 (0x11,0x20, a,b,c,1)      /* c = a |  b */
+#define M_XOR_IMM(a,b,c)        M_OP3 (0x11,0x40, a,b,c,1)      /* c = a ^  b */
+
+#define M_MOV(a,c)              M_OR (a,a,c)                    /* c = a      */
+#define M_CLR(c)                M_OR (31,31,c)                  /* c = 0      */
+#define M_NOP                   M_OR (31,31,31)                 /* ;          */
+
+#define M_SLL(a,b,c)            M_OP3 (0x12,0x39, a,b,c,0)      /* c = a << b */
+#define M_SRA(a,b,c)            M_OP3 (0x12,0x3c, a,b,c,0)      /* c = a >> b */
+#define M_SRL(a,b,c)            M_OP3 (0x12,0x34, a,b,c,0)      /* c = a >>>b */
+
+#define M_SLL_IMM(a,b,c)        M_OP3 (0x12,0x39, a,b,c,1)      /* c = a << b */
+#define M_SRA_IMM(a,b,c)        M_OP3 (0x12,0x3c, a,b,c,1)      /* c = a >> b */
+#define M_SRL_IMM(a,b,c)        M_OP3 (0x12,0x34, a,b,c,1)      /* c = a >>>b */
+
+#define M_FLD(a,b,disp)         M_MEM (0x22,a,b,disp)           /* load flt   */
+#define M_DLD(a,b,disp)         M_MEM (0x23,a,b,disp)           /* load dbl   */
+#define M_FST(a,b,disp)         M_MEM (0x26,a,b,disp)           /* store flt  */
+#define M_DST(a,b,disp)         M_MEM (0x27,a,b,disp)           /* store dbl  */
+
+#define M_FADD(a,b,c)           M_FOP3 (0x16, 0x080, a,b,c)     /* flt add    */
+#define M_DADD(a,b,c)           M_FOP3 (0x16, 0x0a0, a,b,c)     /* dbl add    */
+#define M_FSUB(a,b,c)           M_FOP3 (0x16, 0x081, a,b,c)     /* flt sub    */
+#define M_DSUB(a,b,c)           M_FOP3 (0x16, 0x0a1, a,b,c)     /* dbl sub    */
+#define M_FMUL(a,b,c)           M_FOP3 (0x16, 0x082, a,b,c)     /* flt mul    */
+#define M_DMUL(a,b,c)           M_FOP3 (0x16, 0x0a2, a,b,c)     /* dbl mul    */
+#define M_FDIV(a,b,c)           M_FOP3 (0x16, 0x083, a,b,c)     /* flt div    */
+#define M_DDIV(a,b,c)           M_FOP3 (0x16, 0x0a3, a,b,c)     /* dbl div    */
+
+#define M_FADDS(a,b,c)          M_FOP3 (0x16, 0x580, a,b,c)     /* flt add    */
+#define M_DADDS(a,b,c)          M_FOP3 (0x16, 0x5a0, a,b,c)     /* dbl add    */
+#define M_FSUBS(a,b,c)          M_FOP3 (0x16, 0x581, a,b,c)     /* flt sub    */
+#define M_DSUBS(a,b,c)          M_FOP3 (0x16, 0x5a1, a,b,c)     /* dbl sub    */
+#define M_FMULS(a,b,c)          M_FOP3 (0x16, 0x582, a,b,c)     /* flt mul    */
+#define M_DMULS(a,b,c)          M_FOP3 (0x16, 0x5a2, a,b,c)     /* dbl mul    */
+#define M_FDIVS(a,b,c)          M_FOP3 (0x16, 0x583, a,b,c)     /* flt div    */
+#define M_DDIVS(a,b,c)          M_FOP3 (0x16, 0x5a3, a,b,c)     /* dbl div    */
+
+#define M_CVTDF(b,c)            M_FOP3 (0x16, 0x0ac, 31,b,c)    /* dbl2long   */
+#define M_CVTLF(b,c)            M_FOP3 (0x16, 0x0bc, 31,b,c)    /* long2flt   */
+#define M_CVTLD(b,c)            M_FOP3 (0x16, 0x0be, 31,b,c)    /* long2dbl   */
+#define M_CVTDL(b,c)            M_FOP3 (0x16, 0x1af, 31,b,c)    /* dbl2long   */
+#define M_CVTDL_C(b,c)          M_FOP3 (0x16, 0x12f, 31,b,c)    /* dbl2long   */
+#define M_CVTLI(b,c)            M_FOP3 (0x17, 0x130, 31,b,c)    /* long2int   */
+
+#define M_CVTDFS(b,c)           M_FOP3 (0x16, 0x5ac, 31,b,c)    /* dbl2long   */
+#define M_CVTDLS(b,c)           M_FOP3 (0x16, 0x5af, 31,b,c)    /* dbl2long   */
+#define M_CVTDL_CS(b,c)         M_FOP3 (0x16, 0x52f, 31,b,c)    /* dbl2long   */
+#define M_CVTLIS(b,c)           M_FOP3 (0x17, 0x530, 31,b,c)    /* long2int   */
+
+#define M_FCMPEQ(a,b,c)         M_FOP3 (0x16, 0x0a5, a,b,c)     /* c = a==b   */
+#define M_FCMPLT(a,b,c)         M_FOP3 (0x16, 0x0a6, a,b,c)     /* c = a<b    */
+
+#define M_FCMPEQS(a,b,c)        M_FOP3 (0x16, 0x5a5, a,b,c)     /* c = a==b   */
+#define M_FCMPLTS(a,b,c)        M_FOP3 (0x16, 0x5a6, a,b,c)     /* c = a<b    */
+
+#define M_FMOV(fa,fb)           M_FOP3 (0x17, 0x020, fa,fa,fb)  /* b = a      */
+#define M_FMOVN(fa,fb)          M_FOP3 (0x17, 0x021, fa,fa,fb)  /* b = -a     */
+
+#define M_FNOP                  M_FMOV (31,31)
+
+#define M_FBEQZ(fa,disp)        M_BRA (0x31,fa,disp)            /* br a == 0.0*/
+
+/* macros for special commands (see an Alpha-manual for description) **********/ 
+
+#define M_TRAPB                 M_MEM (0x18,0,0,0x0000)        /* trap barrier*/
+
+#define M_S4ADDL(a,b,c)         M_OP3 (0x10,0x02, a,b,c,0)     /* c = a*4 + b */
+#define M_S4ADDQ(a,b,c)         M_OP3 (0x10,0x22, a,b,c,0)     /* c = a*4 + b */
+#define M_S4SUBL(a,b,c)         M_OP3 (0x10,0x0b, a,b,c,0)     /* c = a*4 - b */
+#define M_S4SUBQ(a,b,c)         M_OP3 (0x10,0x2b, a,b,c,0)     /* c = a*4 - b */
+#define M_S8ADDL(a,b,c)         M_OP3 (0x10,0x12, a,b,c,0)     /* c = a*8 + b */
+#define M_S8ADDQ(a,b,c)         M_OP3 (0x10,0x32, a,b,c,0)     /* c = a*8 + b */
+#define M_S8SUBL(a,b,c)         M_OP3 (0x10,0x1b, a,b,c,0)     /* c = a*8 - b */
+#define M_S8SUBQ(a,b,c)         M_OP3 (0x10,0x3b, a,b,c,0)     /* c = a*8 - b */
+#define M_SAADDQ(a,b,c)         M_S8ADDQ(a,b,c)                /* c = a*8 + b */
+
+#define M_S4ADDL_IMM(a,b,c)     M_OP3 (0x10,0x02, a,b,c,1)     /* c = a*4 + b */
+#define M_S4ADDQ_IMM(a,b,c)     M_OP3 (0x10,0x22, a,b,c,1)     /* c = a*4 + b */
+#define M_S4SUBL_IMM(a,b,c)     M_OP3 (0x10,0x0b, a,b,c,1)     /* c = a*4 - b */
+#define M_S4SUBQ_IMM(a,b,c)     M_OP3 (0x10,0x2b, a,b,c,1)     /* c = a*4 - b */
+#define M_S8ADDL_IMM(a,b,c)     M_OP3 (0x10,0x12, a,b,c,1)     /* c = a*8 + b */
+#define M_S8ADDQ_IMM(a,b,c)     M_OP3 (0x10,0x32, a,b,c,1)     /* c = a*8 + b */
+#define M_S8SUBL_IMM(a,b,c)     M_OP3 (0x10,0x1b, a,b,c,1)     /* c = a*8 - b */
+#define M_S8SUBQ_IMM(a,b,c)     M_OP3 (0x10,0x3b, a,b,c,1)     /* c = a*8 - b */
+
+#define M_LLD_U(a,b,disp)       M_MEM (0x0b,a,b,disp)          /* unalign ld  */
+#define M_LST_U(a,b,disp)       M_MEM (0x0f,a,b,disp)          /* unalign st  */
+
+#define M_ZAP(a,b,c)            M_OP3 (0x12,0x30, a,b,c,0)
+#define M_ZAPNOT(a,b,c)         M_OP3 (0x12,0x31, a,b,c,0)
+
+#define M_ZAP_IMM(a,b,c)        M_OP3 (0x12,0x30, a,b,c,1)
+#define M_ZAPNOT_IMM(a,b,c)     M_OP3 (0x12,0x31, a,b,c,1)
+
+#define M_BZEXT(a,b)            M_ZAPNOT_IMM(a, 0x01, b)       /*  8 zeroext  */
+#define M_CZEXT(a,b)            M_ZAPNOT_IMM(a, 0x03, b)       /* 16 zeroext  */
+#define M_IZEXT(a,b)            M_ZAPNOT_IMM(a, 0x0f, b)       /* 32 zeroext  */
+
+#define M_EXTBL(a,b,c)          M_OP3 (0x12,0x06, a,b,c,0)
+#define M_EXTWL(a,b,c)          M_OP3 (0x12,0x16, a,b,c,0)
+#define M_EXTLL(a,b,c)          M_OP3 (0x12,0x26, a,b,c,0)
+#define M_EXTQL(a,b,c)          M_OP3 (0x12,0x36, a,b,c,0)
+#define M_EXTWH(a,b,c)          M_OP3 (0x12,0x5a, a,b,c,0)
+#define M_EXTLH(a,b,c)          M_OP3 (0x12,0x6a, a,b,c,0)
+#define M_EXTQH(a,b,c)          M_OP3 (0x12,0x7a, a,b,c,0)
+#define M_INSBL(a,b,c)          M_OP3 (0x12,0x0b, a,b,c,0)
+#define M_INSWL(a,b,c)          M_OP3 (0x12,0x1b, a,b,c,0)
+#define M_INSLL(a,b,c)          M_OP3 (0x12,0x2b, a,b,c,0)
+#define M_INSQL(a,b,c)          M_OP3 (0x12,0x3b, a,b,c,0)
+#define M_INSWH(a,b,c)          M_OP3 (0x12,0x57, a,b,c,0)
+#define M_INSLH(a,b,c)          M_OP3 (0x12,0x67, a,b,c,0)
+#define M_INSQH(a,b,c)          M_OP3 (0x12,0x77, a,b,c,0)
+#define M_MSKBL(a,b,c)          M_OP3 (0x12,0x02, a,b,c,0)
+#define M_MSKWL(a,b,c)          M_OP3 (0x12,0x12, a,b,c,0)
+#define M_MSKLL(a,b,c)          M_OP3 (0x12,0x22, a,b,c,0)
+#define M_MSKQL(a,b,c)          M_OP3 (0x12,0x32, a,b,c,0)
+#define M_MSKWH(a,b,c)          M_OP3 (0x12,0x52, a,b,c,0)
+#define M_MSKLH(a,b,c)          M_OP3 (0x12,0x62, a,b,c,0)
+#define M_MSKQH(a,b,c)          M_OP3 (0x12,0x72, a,b,c,0)
+
+#define M_EXTBL_IMM(a,b,c)      M_OP3 (0x12,0x06, a,b,c,1)
+#define M_EXTWL_IMM(a,b,c)      M_OP3 (0x12,0x16, a,b,c,1)
+#define M_EXTLL_IMM(a,b,c)      M_OP3 (0x12,0x26, a,b,c,1)
+#define M_EXTQL_IMM(a,b,c)      M_OP3 (0x12,0x36, a,b,c,1)
+#define M_EXTWH_IMM(a,b,c)      M_OP3 (0x12,0x5a, a,b,c,1)
+#define M_EXTLH_IMM(a,b,c)      M_OP3 (0x12,0x6a, a,b,c,1)
+#define M_EXTQH_IMM(a,b,c)      M_OP3 (0x12,0x7a, a,b,c,1)
+#define M_INSBL_IMM(a,b,c)      M_OP3 (0x12,0x0b, a,b,c,1)
+#define M_INSWL_IMM(a,b,c)      M_OP3 (0x12,0x1b, a,b,c,1)
+#define M_INSLL_IMM(a,b,c)      M_OP3 (0x12,0x2b, a,b,c,1)
+#define M_INSQL_IMM(a,b,c)      M_OP3 (0x12,0x3b, a,b,c,1)
+#define M_INSWH_IMM(a,b,c)      M_OP3 (0x12,0x57, a,b,c,1)
+#define M_INSLH_IMM(a,b,c)      M_OP3 (0x12,0x67, a,b,c,1)
+#define M_INSQH_IMM(a,b,c)      M_OP3 (0x12,0x77, a,b,c,1)
+#define M_MSKBL_IMM(a,b,c)      M_OP3 (0x12,0x02, a,b,c,1)
+#define M_MSKWL_IMM(a,b,c)      M_OP3 (0x12,0x12, a,b,c,1)
+#define M_MSKLL_IMM(a,b,c)      M_OP3 (0x12,0x22, a,b,c,1)
+#define M_MSKQL_IMM(a,b,c)      M_OP3 (0x12,0x32, a,b,c,1)
+#define M_MSKWH_IMM(a,b,c)      M_OP3 (0x12,0x52, a,b,c,1)
+#define M_MSKLH_IMM(a,b,c)      M_OP3 (0x12,0x62, a,b,c,1)
+#define M_MSKQH_IMM(a,b,c)      M_OP3 (0x12,0x72, a,b,c,1)
+
+#define M_UMULH(a,b,c)          M_OP3 (0x13,0x30, a,b,c,0)     /* 64 umulh    */
+
+#define M_UMULH_IMM(a,b,c)      M_OP3 (0x13,0x30, a,b,c,1)     /* 64 umulh    */
+
+#define M_CMOVEQ(a,b,c)         M_OP3 (0x11,0x24, a,b,c,0)     /* a==0 ? c=b  */
+#define M_CMOVNE(a,b,c)         M_OP3 (0x11,0x26, a,b,c,0)     /* a!=0 ? c=b  */
+#define M_CMOVLT(a,b,c)         M_OP3 (0x11,0x44, a,b,c,0)     /* a< 0 ? c=b  */
+#define M_CMOVGE(a,b,c)         M_OP3 (0x11,0x46, a,b,c,0)     /* a>=0 ? c=b  */
+#define M_CMOVLE(a,b,c)         M_OP3 (0x11,0x64, a,b,c,0)     /* a<=0 ? c=b  */
+#define M_CMOVGT(a,b,c)         M_OP3 (0x11,0x66, a,b,c,0)     /* a> 0 ? c=b  */
+
+#define M_CMOVEQ_IMM(a,b,c)     M_OP3 (0x11,0x24, a,b,c,1)     /* a==0 ? c=b  */
+#define M_CMOVNE_IMM(a,b,c)     M_OP3 (0x11,0x26, a,b,c,1)     /* a!=0 ? c=b  */
+#define M_CMOVLT_IMM(a,b,c)     M_OP3 (0x11,0x44, a,b,c,1)     /* a< 0 ? c=b  */
+#define M_CMOVGE_IMM(a,b,c)     M_OP3 (0x11,0x46, a,b,c,1)     /* a>=0 ? c=b  */
+#define M_CMOVLE_IMM(a,b,c)     M_OP3 (0x11,0x64, a,b,c,1)     /* a<=0 ? c=b  */
+#define M_CMOVGT_IMM(a,b,c)     M_OP3 (0x11,0x66, a,b,c,1)     /* a> 0 ? c=b  */
+
+/* macros for unused commands (see an Alpha-manual for description) ***********/ 
+
+#define M_ANDNOT(a,b,c,const)   M_OP3 (0x11,0x08, a,b,c,const) /* c = a &~ b  */
+#define M_ORNOT(a,b,c,const)    M_OP3 (0x11,0x28, a,b,c,const) /* c = a |~ b  */
+#define M_XORNOT(a,b,c,const)   M_OP3 (0x11,0x48, a,b,c,const) /* c = a ^~ b  */
+
+#define M_CMPBGE(a,b,c,const)   M_OP3 (0x10,0x0f, a,b,c,const)
+
+#define M_FCMPUN(a,b,c)         M_FOP3 (0x16, 0x0a4, a,b,c)    /* unordered   */
+#define M_FCMPLE(a,b,c)         M_FOP3 (0x16, 0x0a7, a,b,c)    /* c = a<=b    */
+
+#define M_FCMPUNS(a,b,c)        M_FOP3 (0x16, 0x5a4, a,b,c)    /* unordered   */
+#define M_FCMPLES(a,b,c)        M_FOP3 (0x16, 0x5a7, a,b,c)    /* c = a<=b    */
+
+#define M_FBNEZ(fa,disp)        M_BRA (0x35,fa,disp)
+#define M_FBLEZ(fa,disp)        M_BRA (0x33,fa,disp)
+
+#define M_JMP_CO(a,b)           M_MEM (0x1a,a,b,0xc000)        /* call cosub  */
+
+
+/* function gen_resolvebranch **************************************************
+
+       backpatches a branch instruction; Alpha branch instructions are very
+       regular, so it is only necessary to overwrite some fixed bits in the
+       instruction.
+
+       parameters: ip ... pointer to instruction after branch (void*)
+                   so ... offset of instruction after branch  (s4)
+                   to ... offset of branch target             (s4)
+
+*******************************************************************************/
+
+#define gen_resolvebranch(ip,so,to) ((s4*)(ip))[-1]|=((s4)(to)-(so))>>2&0x1fffff
+
+#define SOFTNULLPTRCHECK       /* soft null pointer check supportet as option */
+
+#endif /* _CODEGEN_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/alpha/disass.c b/jit/alpha/disass.c
new file mode 100644 (file)
index 0000000..d3db0c3
--- /dev/null
@@ -0,0 +1,448 @@
+/* jit/alpha/disass.c - primitive disassembler for alpha machine code
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   $Id: disass.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "disass.h"
+
+/*  The disassembler uses two tables for decoding the instructions. The first
+       table (ops) is used to classify the instructions based on the op code and
+       contains the instruction names for instructions which don't used the
+       function codes. This table is indexed by the op code (6 bit, 64 entries).
+       The second table (op3s) contains instructions which contain both an op
+       code and a function code. This table is an unsorted list of instructions
+       which is terminated by op code and function code zero. This list is
+       searched linearly for a matching pair of opcode and function code.
+*/
+
+#define ITYPE_UNDEF 0           /* undefined instructions (illegal opcode)    */
+#define ITYPE_JMP   1           /* jump instructions                          */
+#define ITYPE_MEM   2           /* memory instructions                        */
+#define ITYPE_FMEM  3           /* floating point memory instructions         */
+#define ITYPE_BRA   4           /* branch instructions                        */
+#define ITYPE_OP    5           /* integer instructions                       */
+#define ITYPE_FOP   6           /* floating point instructions                */
+
+
+/* instruction decode table for 6 bit op codes                                */
+
+static struct {char *name; int itype;} ops[] = {
+       /* 0x00 */  {"",        ITYPE_UNDEF},
+       /* 0x01 */  {"",        ITYPE_UNDEF},
+       /* 0x02 */  {"",        ITYPE_UNDEF},
+       /* 0x03 */  {"",        ITYPE_UNDEF},
+       /* 0x04 */  {"",        ITYPE_UNDEF},
+       /* 0x05 */  {"",        ITYPE_UNDEF},
+       /* 0x06 */  {"",        ITYPE_UNDEF},
+       /* 0x07 */  {"",        ITYPE_UNDEF},
+       /* 0x08 */  {"lda    ",   ITYPE_MEM},
+       /* 0x09 */  {"ldah   ",   ITYPE_MEM},
+       /* 0x0a */  {"ldb    ",   ITYPE_MEM},
+       /* 0x0b */  {"ldq_u  ",   ITYPE_MEM},
+       /* 0x0c */  {"ldw    ",   ITYPE_MEM},
+       /* 0x0d */  {"stw    ",   ITYPE_MEM},
+       /* 0x0e */  {"stb    ",   ITYPE_MEM},
+       /* 0x0f */  {"stq_u  ",   ITYPE_MEM},
+       /* 0x10 */  {"op     ",    ITYPE_OP},
+       /* 0x11 */  {"op     ",    ITYPE_OP},
+       /* 0x12 */  {"op     ",    ITYPE_OP},
+       /* 0x13 */  {"op     ",    ITYPE_OP},
+       /* 0x14 */  {"",        ITYPE_UNDEF},
+       /* 0x15 */  {"",        ITYPE_UNDEF},
+       /* 0x16 */  {"fop    ",   ITYPE_FOP},
+       /* 0x17 */  {"fop    ",   ITYPE_FOP},
+       /* 0x18 */  {"memfmt ",   ITYPE_MEM},
+       /* 0x19 */  {"",        ITYPE_UNDEF},
+       /* 0x1a */  {"jmp    ",   ITYPE_JMP},
+       /* 0x1b */  {"",        ITYPE_UNDEF},
+       /* 0x1c */  {"op     ",    ITYPE_OP},
+       /* 0x1d */  {"",        ITYPE_UNDEF},
+       /* 0x1e */  {"",        ITYPE_UNDEF},
+       /* 0x1f */  {"",        ITYPE_UNDEF},
+       /* 0x20 */  {"ldf    ",  ITYPE_FMEM},
+       /* 0x21 */  {"ldg    ",  ITYPE_FMEM},
+       /* 0x22 */  {"lds    ",  ITYPE_FMEM},
+       /* 0x23 */  {"ldt    ",  ITYPE_FMEM},
+       /* 0x24 */  {"stf    ",  ITYPE_FMEM},
+       /* 0x25 */  {"stg    ",  ITYPE_FMEM},
+       /* 0x26 */  {"sts    ",  ITYPE_FMEM},
+       /* 0x27 */  {"stt    ",  ITYPE_FMEM},
+       /* 0x28 */  {"ldl    ",   ITYPE_MEM},
+       /* 0x29 */  {"ldq    ",   ITYPE_MEM},
+       /* 0x2a */  {"ldl_l  ",   ITYPE_MEM},
+       /* 0x2b */  {"ldq_l  ",   ITYPE_MEM},
+       /* 0x2c */  {"stl    ",   ITYPE_MEM},
+       /* 0x2d */  {"stq    ",   ITYPE_MEM},
+       /* 0x2e */  {"stl_c  ",   ITYPE_MEM},
+       /* 0x2f */  {"stq_c  ",   ITYPE_MEM},
+       /* 0x30 */  {"br     ",   ITYPE_BRA},
+       /* 0x31 */  {"fbeq   ",   ITYPE_BRA},
+       /* 0x32 */  {"fblt   ",   ITYPE_BRA},
+       /* 0x33 */  {"fble   ",   ITYPE_BRA},
+       /* 0x34 */  {"bsr    ",   ITYPE_BRA},
+       /* 0x35 */  {"fbne   ",   ITYPE_BRA},
+       /* 0x36 */  {"fbge   ",   ITYPE_BRA},
+       /* 0x37 */  {"fbgt   ",   ITYPE_BRA},
+       /* 0x38 */  {"blbc   ",   ITYPE_BRA},
+       /* 0x39 */  {"beq    ",   ITYPE_BRA},
+       /* 0x3a */  {"blt    ",   ITYPE_BRA},
+       /* 0x3b */  {"ble    ",   ITYPE_BRA},
+       /* 0x3c */  {"blbs   ",   ITYPE_BRA},
+       /* 0x3d */  {"bne    ",   ITYPE_BRA},
+       /* 0x3e */  {"bge    ",   ITYPE_BRA},
+       /* 0x3f */  {"bgt    ",   ITYPE_BRA}
+};
+
+
+/* instruction decode list for 6 bit op codes and 9 bit function codes        */
+static struct { u2 op, fun; char *name; }  op3s[] = {
+       { 0x10, 0x00,  "addl   " },
+       { 0x10, 0x40,  "addl/v " },
+       { 0x10, 0x20,  "addq   " },
+       { 0x10, 0x60,  "addq/v " },
+       { 0x10, 0x09,  "subl   " },
+       { 0x10, 0x49,  "subl/v " },
+       { 0x10, 0x29,  "subq   " },
+       { 0x10, 0x69,  "subq/v " },
+       { 0x10, 0x2D,  "cmpeq  " },
+       { 0x10, 0x4D,  "cmplt  " },
+       { 0x10, 0x6D,  "cmple  " },
+       { 0x10, 0x1D,  "cmpult " },
+       { 0x10, 0x3D,  "cmpule " },
+       { 0x10, 0x0F,  "cmpbge " },
+       { 0x10, 0x02,  "s4addl " },
+       { 0x10, 0x0b,  "s4subl " },
+       { 0x10, 0x22,  "s4addq " },
+       { 0x10, 0x2b,  "s4subq " },
+       { 0x10, 0x12,  "s8addl " },
+       { 0x10, 0x1b,  "s8subl " },
+       { 0x10, 0x32,  "s8addq " },
+       { 0x10, 0x3b,  "s8subq " },
+       { 0x11, 0x00,  "and    " },
+       { 0x11, 0x20,  "or     " },
+       { 0x11, 0x40,  "xor    " },
+       { 0x11, 0x08,  "andnot " },
+       { 0x11, 0x28,  "ornot  " },
+       { 0x11, 0x48,  "xornot " },
+       { 0x11, 0x24,  "cmoveq " },
+       { 0x11, 0x44,  "cmovlt " },
+       { 0x11, 0x64,  "cmovle " },
+       { 0x11, 0x26,  "cmovne " },
+       { 0x11, 0x46,  "cmovge " },
+       { 0x11, 0x66,  "cmovgt " },
+       { 0x11, 0x14,  "cmovlbs" },
+       { 0x11, 0x16,  "cmovlbc" },
+       { 0x12, 0x39,  "sll    " },
+       { 0x12, 0x3C,  "sra    " },
+       { 0x12, 0x34,  "srl    " },
+       { 0x12, 0x30,  "zap    " },
+       { 0x12, 0x31,  "zapnot " },
+       { 0x12, 0x06,  "extbl  " },
+       { 0x12, 0x16,  "extwl  " },
+       { 0x12, 0x26,  "extll  " },
+       { 0x12, 0x36,  "extql  " },
+       { 0x12, 0x5a,  "extwh  " },
+       { 0x12, 0x6a,  "extlh  " },
+       { 0x12, 0x7a,  "extqh  " },
+       { 0x12, 0x0b,  "insbl  " },
+       { 0x12, 0x1b,  "inswl  " },
+       { 0x12, 0x2b,  "insll  " },
+       { 0x12, 0x3b,  "insql  " },
+       { 0x12, 0x57,  "inswh  " },
+       { 0x12, 0x67,  "inslh  " },
+       { 0x12, 0x77,  "insqh  " },
+       { 0x12, 0x02,  "mskbl  " },
+       { 0x12, 0x12,  "mskwl  " },
+       { 0x12, 0x22,  "mskll  " },
+       { 0x12, 0x32,  "mskql  " },
+       { 0x12, 0x52,  "mskwh  " },
+       { 0x12, 0x62,  "msklh  " },
+       { 0x12, 0x72,  "mskqh  " },
+       { 0x13, 0x00,  "mull   " },
+       { 0x13, 0x20,  "mulq   " },
+       { 0x13, 0x40,  "mull/v " },
+       { 0x13, 0x60,  "mulq/v " },
+       { 0x13, 0x30,  "umulh  " },
+       { 0x16, 0x080, "fadd   " },
+       { 0x16, 0x0a0, "dadd   " },
+       { 0x16, 0x081, "fsub   " },
+       { 0x16, 0x0a1, "dsub   " },
+       { 0x16, 0x082, "fmul   " },
+       { 0x16, 0x0a2, "dmul   " },
+       { 0x16, 0x083, "fdiv   " },
+       { 0x16, 0x0a3, "ddiv   " },
+       { 0x16, 0x580, "fadds  " },
+       { 0x16, 0x5a0, "dadds  " },
+       { 0x16, 0x581, "fsubs  " },
+       { 0x16, 0x5a1, "dsubs  " },
+       { 0x16, 0x582, "fmuls  " },
+       { 0x16, 0x5a2, "dmuls  " },
+       { 0x16, 0x583, "fdivs  " },
+       { 0x16, 0x5a3, "ddivs  " },
+       { 0x16, 0x0ac, "cvtdf  " },
+       { 0x16, 0x0bc, "cvtlf  " },
+       { 0x16, 0x0be, "cvtld  " },
+       { 0x16, 0x0af, "cvtdl  " },
+       { 0x16, 0x02f, "cvtdlc " },
+       { 0x17, 0x030, "cvtli  " },
+       { 0x16, 0x1af, "cvtdlv " },
+       { 0x16, 0x12f, "cvtdlcv" },
+       { 0x17, 0x130, "cvtliv " },
+       { 0x16, 0x5ac, "cvtdfs " },
+       { 0x16, 0x5af, "cvtdls " },
+       { 0x16, 0x52f, "cvtdlcs" },
+       { 0x16, 0x0a4, "fcmpun " },
+       { 0x16, 0x0a5, "fcmpeq " },
+       { 0x16, 0x0a6, "fcmplt " },
+       { 0x16, 0x0a7, "fcmple " },
+       { 0x16, 0x5a4, "fcmpuns" },
+       { 0x16, 0x5a5, "fcmpeqs" },
+       { 0x16, 0x5a6, "fcmplts" },
+       { 0x16, 0x5a7, "fcmples" },
+       { 0x17, 0x020, "fmov   " },
+       { 0x17, 0x021, "fmovn  " },
+       { 0x1c, 0x0,   "bsext  " },
+       { 0x1c, 0x1,   "wsext  " },
+       
+       { 0x00, 0x00,  NULL }
+};
+
+
+/* name table for 32 integer registers                                        */
+
+char *regs[] = {
+       /* 0x00 */  "v0",   /*  "$0", */
+       /* 0x01 */  "t0",   /*  "$1", */
+       /* 0x02 */  "t1",   /*  "$2", */
+       /* 0x03 */  "t2",   /*  "$3", */
+       /* 0x04 */  "t3",   /*  "$4", */
+       /* 0x05 */  "t4",   /*  "$5", */
+       /* 0x06 */  "t5",   /*  "$6", */
+       /* 0x07 */  "t6",   /*  "$7", */
+
+       /* 0x08 */  "t7",   /*  "$8", */
+       /* 0x09 */  "s0",   /*  "$9", */
+       /* 0x0a */  "s1",   /* "$10", */
+       /* 0x0b */  "s2",   /* "$11", */
+       /* 0x0c */  "s3",   /* "$12", */
+       /* 0x0d */  "s4",   /* "$13", */
+       /* 0x0e */  "s5",   /* "$14", */
+       /* 0x0f */  "s6",   /* "$15", */
+
+       /* 0x10 */  "a0",   /* "$16", */
+       /* 0x11 */  "a1",   /* "$17", */
+       /* 0x12 */  "a2",   /* "$18", */
+       /* 0x13 */  "a3",   /* "$19", */
+       /* 0x14 */  "a4",   /* "$20", */
+       /* 0x15 */  "a5",   /* "$21", */
+       /* 0x16 */  "t8",   /* "$22", */
+       /* 0x17 */  "t9",   /* "$23", */
+
+       /* 0x18 */  "t10",  /* "$24", */
+       /* 0x19 */  "t11",  /* "$25", */
+       /* 0x1a */  "ra",   /* "$26", */
+       /* 0x1b */  "pv",   /* "$27", */
+       /* 0x1c */  "at",   /* "$28", */
+       /* 0x1d */  "gp",   /* "$29", */
+       /* 0x1e */  "sp",   /* "$30", */
+       /* 0x1f */  "zero"  /* "$31"  */
+};
+
+
+/* function disassinstr ********************************************************
+
+       outputs a disassembler listing of one machine code instruction on 'stdout'
+       c:   instructions machine code
+       pos: instructions address relative to method start
+
+*******************************************************************************/
+
+void disassinstr(int c, int pos)
+{
+       int op;                     /* 6 bit op code                              */
+       int opfun;                  /* 7 bit function code                        */
+       int ra, rb, rc;             /* 6 bit register specifiers                  */
+       int lit;                    /* 8 bit unsigned literal                     */
+       int i;                      /* loop counter                               */
+
+       op    = (c >> 26) & 0x3f;   /* 6 bit op code                              */
+       opfun = (c >> 5)  & 0x7f;   /* 7 bit function code                        */
+       ra    = (c >> 21) & 0x1f;   /* 6 bit source register specifier            */
+       rb    = (c >> 16) & 0x1f;   /* 6 bit source register specifier            */
+       rc    = (c >> 0)  & 0x1f;   /* 6 bit destination register specifiers      */
+       lit   = (c >> 13) & 0xff;   /* 8 bit unsigned literal                     */
+
+       printf ("%6x: %8x  ", pos, c);
+       
+       switch (ops[op].itype) {
+               case ITYPE_JMP:
+                       switch ((c >> 14) & 3) {  /* branch hint */
+                               case 0:
+                                       if (ra == 31) {
+                                               printf ("jmp     (%s)\n", regs[rb]); 
+                                               return;
+                                               }
+                                       printf ("jmp     "); 
+                                       break;
+                               case 1:
+                                       if (ra == 26) {
+                                               printf ("jsr     (%s)\n", regs[rb]); 
+                                               return;
+                                               }
+                                       printf ("jsr     "); 
+                                       break;
+                               case 2:
+                                       if (ra == 31 && rb == 26) {
+                                               printf ("ret\n"); 
+                                               return;
+                                               }
+                                       if (ra == 31) {
+                                               printf ("ret     (%s)\n", regs[rb]); 
+                                               return;
+                                               }
+                                       printf ("ret     ");
+                                       break;
+                               case 3:
+                                       printf ("jsr_co  "); 
+                                       break;
+                               }
+                       printf ("%s,(%s)\n", regs[ra], regs[rb]); 
+                       break;
+
+               case ITYPE_MEM: {
+                       int disp = (c << 16) >> 16; /* 16 bit signed displacement         */
+
+                       if (op == 0x18 && ra == 0 && ra == 0 && disp == 0)
+                               printf ("trapb\n"); 
+                       else
+                               printf ("%s %s,%d(%s)\n", ops[op].name, regs[ra], disp, regs[rb]); 
+                       break;
+                       }
+
+               case ITYPE_FMEM: {
+                       printf ("%s $f%d,%d(%s)\n", ops[op].name, ra, (c << 16) >> 16, regs[rb]); 
+                       break;
+                       }
+
+               case ITYPE_BRA:             /* 21 bit signed branch offset */
+                       if (op == 0x30 && ra == 31)
+                               printf("br      0x%x\n", pos + 4 + ((c << 11) >> 9));
+                       else if (op == 0x34 && ra == 26)
+                               printf("brs     0x%x\n", pos + 4 + ((c << 11) >> 9));
+                       else
+                               printf("%s %s,0x%x\n",
+                                      ops[op].name, regs[ra], pos + 4 + ((c << 11) >> 9));
+                       break;
+                       
+               case ITYPE_FOP: {
+                       int fopfun = (c >> 5) & 0x7ff;  /* 11 bit fp function code        */
+
+                       if (op == 0x17 && fopfun == 0x020 && ra == rb) {
+                               if (ra == 31 && rc == 31)
+                                       printf("fnop\n");
+                               else
+                                       printf("fmov    $f%d,$f%d\n", ra, rc);
+                               return;
+                               }
+                       for (i = 0; op3s[i].name; i++)
+                               if (op3s[i].op == op && op3s[i].fun == fopfun) {
+                                       printf("%s $f%d,$f%d,$f%d\n", op3s[i].name, ra, rb,  rc);
+                                       return;
+                                       }
+                       printf("%s%x $f%d,$f%d,$f%d\n", ops[op].name, fopfun, ra, rb, rc);
+                       break;
+                       }
+
+               case ITYPE_OP:
+                       if (op == 0x11 && opfun == 0x20 && ra == rb && ~(c&0x1000)) {
+                               if (ra == 31 && rc == 31)
+                                       printf("nop\n");
+                               else if (ra == 31)
+                                       printf("clr     %s\n", regs[rc]);
+                               else
+                                       printf("mov     %s,%s\n", regs[ra], regs[rc]);
+                               return;
+                               }
+                       for (i = 0; op3s[i].name; i++) {
+                               if (op3s[i].op == op && op3s[i].fun == opfun) {
+                                       if (c & 0x1000)                  /* immediate instruction */
+                                               printf("%s %s,%d,%s\n",
+                                                      op3s[i].name, regs[ra], lit, regs[rc]);
+                                       else
+                                               printf("%s %s,%s,%s\n",
+                                                      op3s[i].name, regs[ra], regs[rb], regs[rc]);
+                                       return;
+                                       }
+                               }
+                       /* fall through */
+               default:
+                       if (c & 0x1000)                          /* immediate instruction */
+                               printf("UNDEF  %x(%x) $%d,%d,$%d\n", op, opfun, ra, lit, rc);
+                       else
+                               printf("UNDEF  %x(%x) $%d,$%d,$%d\n", op, opfun, ra, rb,  rc);          
+               }
+}
+
+
+/* function disassemble ********************************************************
+
+       outputs a disassembler listing of some machine code on 'stdout'
+       code: pointer to first instruction
+       len:  code size (number of instructions * 4)
+
+*******************************************************************************/
+
+void disassemble(int *code, int len)
+{
+       int p;
+
+       printf ("  --- disassembler listing ---\n");    
+       for (p = 0; p < len; p += 4, code++)
+               disassinstr(*code, p); 
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/alpha/disass.h b/jit/alpha/disass.h
new file mode 100644 (file)
index 0000000..6dcb05e
--- /dev/null
@@ -0,0 +1,62 @@
+/* alpha/disass.h - disassembler header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: disass.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _DISASS_H
+#define _DISASS_H
+
+#include "types.h"
+
+
+extern char *regs[];
+
+
+/* function prototypes */
+void disassinstr(int c, int pos);
+void disassemble(int *code, int len);
+
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/alpha/native-math.h b/jit/alpha/native-math.h
new file mode 100644 (file)
index 0000000..2ad03a4
--- /dev/null
@@ -0,0 +1,43 @@
+/* alpha/native-math.h *********************************************************
+
+       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+
+       See file COPYRIGHT for information on usage and disclaimer of warranties
+
+       Contains the machine-specific floating point definitions.
+
+       Authors: Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
+                Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
+
+       Last Change: 1997/10/21
+
+*******************************************************************************/
+
+#ifndef _NATIVE_MATH_H
+#define _NATIVE_MATH_H
+
+/* include machine-specific math.h */
+
+#include <math.h>
+
+/* define infinity for floating point numbers */
+
+static u4 flt_nan    = 0xffffffff;
+static u4 flt_posinf = 0x7f800000;
+static u4 flt_neginf = 0xff800000;
+
+#define FLT_NAN    (*((float*) (&flt_nan)))
+#define FLT_POSINF (*((float*) (&flt_posinf)))
+#define FLT_NEGINF (*((float*) (&flt_neginf)))
+
+/* define infinity for double floating point numbers */
+
+static u8 dbl_nan    = 0xffffffffffffffffL ;
+static u8 dbl_posinf = 0x7ff0000000000000L ;
+static u8 dbl_neginf = 0xfff0000000000000L ;
+
+#define DBL_NAN    (*((double*) (&dbl_nan)))
+#define DBL_POSINF (*((double*) (&dbl_posinf)))
+#define DBL_NEGINF (*((double*) (&dbl_neginf)))
+
+#endif
diff --git a/jit/alpha/sigcontext.h b/jit/alpha/sigcontext.h
new file mode 100644 (file)
index 0000000..2b5f1b5
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef _ASMAXP_SIGCONTEXT_H
+#define _ASMAXP_SIGCONTEXT_H
+
+struct sigcontext_struct {
+
+       /*
+       * what should we have here? I'd probably better use the same
+       * stack layout as OSF/1, just in case we ever want to try
+       * running their binaries.. 
+       *
+       * This is the basic layout, but I don't know if we'll ever
+       * actually fill in all the values..
+       */
+
+       long          sc_onstack;    /* sigstack state to restore       */
+       long          sc_mask;       /* signal mask to restore          */
+       long          sc_pc;         /* pc at time of signal            */
+       long          sc_ps;         /* psl to retore                   */
+       long          sc_regs[32];   /* processor regs 0 to 31          */
+       long          sc_ownedfp;    /* fp has been used                */
+       long          sc_fpregs[32]; /* fp regs 0 to 31                 */
+       unsigned long sc_fpcr;       /* floating point control register */
+       unsigned long sc_fp_control; /* software fpcr                   */
+                                    /* rest is unused                  */
+       unsigned long sc_reserved1, sc_reserved2;
+       unsigned long sc_ssize;
+       char          *sc_sbase;
+       unsigned long sc_traparg_a0;
+       unsigned long sc_traparg_a1;
+       unsigned long sc_traparg_a2;
+       unsigned long sc_fp_trap_pc;
+       unsigned long sc_fp_trigger_sum;
+       unsigned long sc_fp_trigger_inst;
+       unsigned long sc_retcode[2];
+};
+
+#endif
diff --git a/jit/alpha/threads.h b/jit/alpha/threads.h
new file mode 100644 (file)
index 0000000..c35df86
--- /dev/null
@@ -0,0 +1,48 @@
+/****************************** threads.h **************************************
+
+       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+
+       See file COPYRIGHT for information on usage and disclaimer of warranties
+
+       System dependent part of thread header file.
+
+       Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
+                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
+
+       Last Change: 1998/11/19
+
+*******************************************************************************/
+
+
+#ifndef __sysdep_threads_h
+#define __sysdep_threads_h
+
+#include "config.h"
+#include "threads/thread.h"
+
+/* Thread handling */
+
+/* prototypes */
+
+void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
+u1*  asm_initialize_thread_stack (void *func, u1 *stack);
+void *asm_switchstackandcall (void *stack, void *func, void **stacktopsave, void *p);
+
+/* access macros */
+
+#define        THREADSTACKSIZE         (32 * 1024)
+
+#define        THREADSWITCH(to, from)  asm_perform_threadswitch(&(from)->restorePoint,\
+                                    &(to)->restorePoint, &(from)->usedStackTop)
+
+#define THREADINIT(to, func)    (to)->restorePoint =                         \
+                                    asm_initialize_thread_stack((u1*)(func), \
+                                                            (to)->stackEnd)
+
+#define        THREADINFO(e)                               \
+               do {                                        \
+                       (e)->restorePoint = 0;                  \
+                       (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
+               } while(0)
+
+#endif
diff --git a/jit/alpha/types.h b/jit/alpha/types.h
new file mode 100644 (file)
index 0000000..fac2f72
--- /dev/null
@@ -0,0 +1,94 @@
+/* jit/alpha/types.h - machine specific definitions for alpha processor
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas  Krall
+            Michael Gschwind
+
+   $Id: types.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _TYPES_H
+#define _TYPES_H
+
+#define POINTERSIZE         8
+#define WORDS_BIGENDIAN     0
+
+#define SUPPORT_DIVISION    0
+#define SUPPORT_LONG        1
+#define SUPPORT_FLOAT       1
+#define SUPPORT_DOUBLE      1
+
+#define SUPPORT_LONG_ADD    1
+#define SUPPORT_LONG_CMP    1
+#define SUPPORT_LONG_LOG    1
+#define SUPPORT_LONG_SHIFT  1
+#define SUPPORT_LONG_MULDIV 1
+#define SUPPORT_LONG_ICVT   1
+#define SUPPORT_LONG_FCVT   1
+
+#define CONDITIONAL_LOADCONST
+
+#define U8_AVAILABLE        1
+
+
+typedef signed char             s1;
+typedef unsigned char           u1;
+typedef signed short int        s2;
+typedef unsigned short int      u2;
+
+typedef signed int              s4;
+typedef unsigned int            u4;
+
+#if U8_AVAILABLE
+typedef signed long int         s8;
+typedef unsigned long int       u8; 
+#else
+typedef struct {u4 low, high;}  u8;
+#define s8 u8
+#endif
+
+#endif /* _TYPES_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+
+
diff --git a/jit/codegen.inc b/jit/codegen.inc
new file mode 100644 (file)
index 0000000..0e1dea2
--- /dev/null
@@ -0,0 +1,445 @@
+/* jit/codegen.inc - architecture independent code generator
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas  Krall
+
+   Changes: Michael Gschwind
+            Christian Thalinger
+
+   All functions assume the following code area / data area layout:
+
+   +-----------+
+   |           |
+   | code area | code area grows to higher addresses
+   |           |
+   +-----------+ <-- start of procedure
+   |           |
+   | data area | data area grows to lower addresses
+   |           |
+   +-----------+
+
+   The functions first write into a temporary code/data area allocated by
+   "codegen_init". "codegen_finish" copies the code and data area into permanent
+   memory. All functions writing values into the data area return the offset
+   relative the begin of the code area (start of procedure).   
+
+   $Id: codegen.inc 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include "toolbox/memory.h"
+#include "toolbox/loging.h"
+
+
+#define MCODEINITSIZE (1<<15)       /* 32 Kbyte code area initialization size */
+#define DSEGINITSIZE  (1<<12)       /*  4 Kbyte data area initialization size */
+
+static u1* mcodebase = NULL;        /* base pointer of code area              */
+static s4* mcodeend  = NULL;        /* pointer to end of code area            */
+static int mcodesize;               /* complete size of code area (bytes)     */
+
+static u1* dsegtop = NULL;          /* pointer to top (end) of data area      */
+static int dsegsize;                /* complete size of data area (bytes)     */
+int dseglen;                        /* used size of data area (bytes)         */
+                                    /* data area grows from top to bottom     */
+
+static jumpref *jumpreferences;     /* list of jumptable target addresses     */
+static dataref *datareferences;     /* list of data segment references        */
+static branchref *xboundrefs;       /* list of bound check branches           */
+static branchref *xcheckarefs;      /* list of array size check branches      */
+static branchref *xnullrefs;        /* list of null check branches            */
+static branchref *xcastrefs;        /* list of cast check branches            */
+static branchref *xdivrefs;         /* list of divide by zero branches        */
+
+void codegen_init();                /* allocates code and data area           */
+void codegen_close();               /* releases temporary storage             */
+static void codegen_finish();       /* makes code and data area permanent and */
+                                    /* updates branch references to code/data */
+
+static s4 dseg_adds4(s4 value);         /* adds an int to data area           */
+static s4 dseg_adds8(s8 value);         /* adds an long to data area          */
+static s4 dseg_addfloat (float value);  /* adds an float to data area         */
+static s4 dseg_adddouble(double value); /* adds an double to data area        */
+
+#if POINTERSIZE == 8
+#define dseg_addaddress(value)      dseg_adds8((s8)(value))
+#else
+#define dseg_addaddress(value)      dseg_adds4((s4)(value))
+#endif
+
+static void dseg_addtarget(basicblock *target);
+static void dseg_adddata(u1 *ptr);
+static void codegen_addreference(basicblock *target, void *branchptr);
+static void codegen_addxboundrefs(void *branchptr);
+static void codegen_addxnullrefs(void *branchptr);
+static void codegen_addxcastrefs(void *branchptr);
+static void codegen_addxdivrefs(void *branchptr);
+
+void dseg_display(s4 *s4ptr);
+
+
+
+/* codegen_init allocates and initialises code area, data area and references   */
+
+void codegen_init()
+{
+       if (!mcodebase) {
+               mcodebase = MNEW(u1, MCODEINITSIZE);
+               mcodesize = MCODEINITSIZE;
+       }
+
+       if (!dsegtop) {
+               dsegtop = MNEW(u1, DSEGINITSIZE);
+               dsegsize = DSEGINITSIZE;
+               dsegtop += dsegsize;
+       }
+
+       dseglen = 0;
+
+       jumpreferences = NULL;
+       datareferences = NULL;
+       xboundrefs = NULL;
+       xnullrefs = NULL;
+       xcastrefs = NULL;
+       xdivrefs = NULL;
+}
+
+
+
+/* codegen_close releases temporary code and data area                          */
+
+void codegen_close()
+{
+       if (mcodebase) {
+               MFREE(mcodebase, u1, mcodesize);
+               mcodebase = NULL;
+       }
+
+       if (dsegtop) {
+               MFREE(dsegtop - dsegsize, u1, dsegsize);
+               dsegtop = NULL;
+       }
+}
+
+
+
+/* codegen_increase doubles code area                                           */
+
+static s4 *codegen_increase(u1 *codeptr)
+{
+       long len;
+
+       len = codeptr - mcodebase;
+       mcodebase = MREALLOC(mcodebase, u1, mcodesize, mcodesize * 2);
+       mcodesize *= 2;
+       mcodeend = (s4*) (mcodebase + mcodesize);
+       return (s4*) (mcodebase + len);
+}
+
+
+
+/* desg_increase doubles data area                                            */
+
+static void dseg_increase()
+{
+       u1 *newstorage = MNEW(u1, dsegsize * 2);
+       memcpy(newstorage + dsegsize, dsegtop - dsegsize, dsegsize);
+       MFREE(dsegtop - dsegsize, u1, dsegsize);
+       dsegtop = newstorage;
+       dsegsize *= 2;
+       dsegtop += dsegsize;
+}
+
+
+
+static s4 dseg_adds4_increase(s4 value)
+{
+       dseg_increase();
+       *((s4 *) (dsegtop - dseglen)) = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adds4(s4 value)
+{
+       s4 *dataptr;
+
+       dseglen += 4;
+       dataptr = (s4 *) (dsegtop - dseglen);
+       if (dseglen > dsegsize)
+               return dseg_adds4_increase(value);
+       *dataptr = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adds8_increase(s8 value)
+{
+       dseg_increase();
+       *((s8 *) (dsegtop - dseglen)) = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adds8(s8 value)
+{
+       s8 *dataptr;
+
+       dseglen = ALIGN (dseglen + 8, 8);
+       dataptr = (s8 *) (dsegtop - dseglen);
+       if (dseglen > dsegsize)
+               return dseg_adds8_increase(value);
+       *dataptr = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_addfloat_increase(float value)
+{
+       dseg_increase();
+       *((float *) (dsegtop - dseglen)) = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_addfloat(float value)
+{
+       float *dataptr;
+
+       dseglen += 4;
+       dataptr = (float *) (dsegtop - dseglen);
+       if (dseglen > dsegsize)
+               return dseg_addfloat_increase(value);
+       *dataptr = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adddouble_increase(double value)
+{
+       dseg_increase();
+       *((double *) (dsegtop - dseglen)) = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adddouble(double value)
+{
+       double *dataptr;
+
+       dseglen = ALIGN (dseglen + 8, 8);
+       dataptr = (double *) (dsegtop - dseglen);
+       if (dseglen > dsegsize)
+               return dseg_adddouble_increase(value);
+       *dataptr = value;
+       return -dseglen;
+}
+
+
+
+static void dseg_addtarget(basicblock *target)
+{
+       jumpref *jr = DNEW(jumpref);
+
+       jr->tablepos = dseg_addaddress(NULL);
+       jr->target = target;
+       jr->next = jumpreferences;
+       jumpreferences = jr;
+}
+
+
+
+static void dseg_adddata(u1 *ptr)
+{
+       dataref *dr = DNEW(dataref);
+
+       dr->pos = (u1 *) (ptr - mcodebase);
+       dr->next = datareferences;
+       datareferences = dr;
+}
+
+
+
+static void codegen_addreference(basicblock *target, void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       if (target->mpc >= 0) {
+               gen_resolvebranch((u1*) mcodebase + branchpos, branchpos, target->mpc);
+       }
+       else {
+               branchref *br = DNEW(branchref);
+
+               br->branchpos = branchpos;
+               br->next = target->branchrefs;
+               target->branchrefs= br;
+       }
+}
+
+
+
+static void codegen_addxboundrefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xboundrefs;
+       xboundrefs = br;
+}
+
+
+
+static void codegen_addxcheckarefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xcheckarefs;
+       xcheckarefs = br;
+}
+
+
+
+static void codegen_addxnullrefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xnullrefs;
+       xnullrefs = br;
+}
+
+
+
+static void codegen_addxcastrefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xcastrefs;
+       xcastrefs = br;
+}
+
+
+
+static void codegen_addxdivrefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xdivrefs;
+       xdivrefs = br;
+}
+
+
+
+static void codegen_finish(int mcodelen)
+{
+       jumpref *jr;
+       u1 *epoint;
+
+       count_code_len += mcodelen;
+       count_data_len += dseglen;
+
+       dseglen = ALIGN(dseglen, MAX_ALIGN);
+
+       method -> mcodelength = mcodelen + dseglen;
+       method -> mcode = CNEW(u1, mcodelen + dseglen);
+
+       memcpy ( method->mcode, dsegtop - dseglen, dseglen);
+       memcpy ( method->mcode + dseglen, mcodebase, mcodelen);
+
+       method -> entrypoint = epoint = (u1*) (method->mcode + dseglen);
+
+       /* jump table resolving */
+       jr = jumpreferences;
+       while (jr != NULL) {
+           *((void**) (epoint + jr->tablepos)) = epoint + jr->target->mpc;
+           jr = jr->next;
+       }
+
+#if defined(__I386__) || defined(__X86_64__)
+       {
+               dataref *dr;
+               /* add method into datastructure to find the entrypoint */
+               addmethod(method->entrypoint, method->entrypoint + mcodelen);
+        
+               /* data segment references resolving */
+               dr = datareferences;
+               while (dr != NULL) {
+                       *((void**) ((long) epoint + (long) dr->pos - POINTERSIZE)) = epoint;
+                       dr = dr->next;
+               }
+       }
+#endif
+}
+
+
+
+void dseg_display(s4 *s4ptr)
+{
+       int i;
+       
+       printf("  --- dump of datasegment\n");
+       for (i = dseglen; i > 0 ; i -= 4) {
+               printf("-%6x: %8x\n", i, (int)(*s4ptr++));
+       }
+       printf("  --- begin of data segment: %p\n", s4ptr);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/i386/Makefile.am b/jit/i386/Makefile.am
new file mode 100644 (file)
index 0000000..c39bb7b
--- /dev/null
@@ -0,0 +1,36 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+
+INCLUDES = -I$(top_srcdir)/jit
+
+EXTRA_DIST = \
+       asmpart.S \
+       disass.c \
+       disass.h \
+       native-math.h \
+       codegen.c \
+       codegen.h \
+       methodtable.c \
+       methodtable.h \
+       types.h \
+       threads.h \
+       dis-asm.h \
+       bfd.h
+
+noinst_LIBRARIES = libarch.a
+
+libarch_a_SOURCES = asmpart.S codegen.c disass.c i386-dis.c dis-buf.c methodtable.c
+
+%.o: %.S
+       $(COMPILE) -c $<
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
diff --git a/jit/i386/ansidecl.h b/jit/i386/ansidecl.h
new file mode 100644 (file)
index 0000000..9a7c577
--- /dev/null
@@ -0,0 +1,295 @@
+/* ANSI and traditional C compatability macros
+   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* ANSI and traditional C compatibility macros
+
+   ANSI C is assumed if __STDC__ is #defined.
+
+   Macro               ANSI C definition       Traditional C definition
+   -----               ---- - ----------       ----------- - ----------
+   ANSI_PROTOTYPES     1                       not defined
+   PTR                 `void *'                `char *'
+   PTRCONST            `void *const'           `char *'
+   LONG_DOUBLE         `long double'           `double'
+   const               not defined             `'
+   volatile            not defined             `'
+   signed              not defined             `'
+   VA_START(ap, var)   va_start(ap, var)       va_start(ap)
+
+   Note that it is safe to write "void foo();" indicating a function
+   with no return value, in all K+R compilers we have been able to test.
+
+   For declaring functions with prototypes, we also provide these:
+
+   PARAMS ((prototype))
+   -- for functions which take a fixed number of arguments.  Use this
+   when declaring the function.  When defining the function, write a
+   K+R style argument list.  For example:
+
+       char *strcpy PARAMS ((char *dest, char *source));
+       ...
+       char *
+       strcpy (dest, source)
+            char *dest;
+            char *source;
+       { ... }
+
+
+   VPARAMS ((prototype, ...))
+   -- for functions which take a variable number of arguments.  Use
+   PARAMS to declare the function, VPARAMS to define it.  For example:
+
+       int printf PARAMS ((const char *format, ...));
+       ...
+       int
+       printf VPARAMS ((const char *format, ...))
+       {
+          ...
+       }
+
+   For writing functions which take variable numbers of arguments, we
+   also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros.  These
+   hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
+   thoroughly than the simple VA_START() macro mentioned above.
+
+   VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
+   Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
+   corresponding to the list of fixed arguments.  Then use va_arg
+   normally to get the variable arguments, or pass your va_list object
+   around.  You do not declare the va_list yourself; VA_OPEN does it
+   for you.
+
+   Here is a complete example:
+
+       int
+       printf VPARAMS ((const char *format, ...))
+       {
+          int result;
+
+          VA_OPEN (ap, format);
+          VA_FIXEDARG (ap, const char *, format);
+
+          result = vfprintf (stdout, format, ap);
+          VA_CLOSE (ap);
+
+          return result;
+       }
+
+
+   You can declare variables either before or after the VA_OPEN,
+   VA_FIXEDARG sequence.  Also, VA_OPEN and VA_CLOSE are the beginning
+   and end of a block.  They must appear at the same nesting level,
+   and any variables declared after VA_OPEN go out of scope at
+   VA_CLOSE.  Unfortunately, with a K+R compiler, that includes the
+   argument list.  You can have multiple instances of VA_OPEN/VA_CLOSE
+   pairs in a single function in case you need to traverse the
+   argument list more than once.
+
+   For ease of writing code which uses GCC extensions but needs to be
+   portable to other compilers, we provide the GCC_VERSION macro that
+   simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
+   wrappers around __attribute__.  Also, __extension__ will be #defined
+   to nothing if it doesn't work.  See below.
+
+   This header also defines a lot of obsolete macros:
+   CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
+   AND, DOTS, NOARGS.  Don't use them.  */
+
+#ifndef        _ANSIDECL_H
+#define _ANSIDECL_H    1
+
+/* Every source file includes this file,
+   so they will all get the switch for lint.  */
+/* LINTLIBRARY */
+
+/* Using MACRO(x,y) in cpp #if conditionals does not work with some
+   older preprocessors.  Thus we can't define something like this:
+
+#define HAVE_GCC_VERSION(MAJOR, MINOR) \
+  (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
+
+and then test "#if HAVE_GCC_VERSION(2,7)".
+
+So instead we use the macro below and test it against specific values.  */
+
+/* This macro simplifies testing whether we are using gcc, and if it
+   is of a particular minimum version. (Both major & minor numbers are
+   significant.)  This macro will evaluate to 0 if we are not using
+   gcc at all.  */
+#ifndef GCC_VERSION
+#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#endif /* GCC_VERSION */
+
+#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
+/* All known AIX compilers implement these things (but don't always
+   define __STDC__).  The RISC/OS MIPS compiler defines these things
+   in SVR4 mode, but does not define __STDC__.  */
+
+#define ANSI_PROTOTYPES        1
+#define PTR            void *
+#define PTRCONST       void *const
+#define LONG_DOUBLE    long double
+
+#define PARAMS(ARGS)           ARGS
+#define VPARAMS(ARGS)          ARGS
+#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
+
+/* variadic function helper macros */
+/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
+   use without inhibiting further decls and without declaring an
+   actual variable.  */
+#define VA_OPEN(AP, VAR)       { va_list AP; va_start(AP, VAR); { struct Qdmy
+#define VA_CLOSE(AP)           } va_end(AP); }
+#define VA_FIXEDARG(AP, T, N)  struct Qdmy
+#undef const
+#undef volatile
+#undef signed
+
+/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
+   it too, but it's not in C89.  */
+#undef inline
+#if __STDC_VERSION__ > 199901L
+/* it's a keyword */
+#else
+# if GCC_VERSION >= 2007
+#  define inline __inline__   /* __inline__ prevents -pedantic warnings */
+# else
+#  define inline  /* nothing */
+# endif
+#endif
+
+/* These are obsolete.  Do not use.  */
+#ifndef IN_GCC
+#define CONST          const
+#define VOLATILE       volatile
+#define SIGNED         signed
+
+#define PROTO(type, name, arglist)     type name arglist
+#define EXFUN(name, proto)             name proto
+#define DEFUN(name, arglist, args)     name(args)
+#define DEFUN_VOID(name)               name(void)
+#define AND            ,
+#define DOTS           , ...
+#define NOARGS         void
+#endif /* ! IN_GCC */
+
+#else  /* Not ANSI C.  */
+
+#undef  ANSI_PROTOTYPES
+#define PTR            char *
+#define PTRCONST       PTR
+#define LONG_DOUBLE    double
+
+#define PARAMS(args)           ()
+#define VPARAMS(args)          (va_alist) va_dcl
+#define VA_START(va_list, var) va_start(va_list)
+
+#define VA_OPEN(AP, VAR)               { va_list AP; va_start(AP); { struct Qdmy
+#define VA_CLOSE(AP)                   } va_end(AP); }
+#define VA_FIXEDARG(AP, TYPE, NAME)    TYPE NAME = va_arg(AP, TYPE)
+
+/* some systems define these in header files for non-ansi mode */
+#undef const
+#undef volatile
+#undef signed
+#undef inline
+#define const
+#define volatile
+#define signed
+#define inline
+
+#ifndef IN_GCC
+#define CONST
+#define VOLATILE
+#define SIGNED
+
+#define PROTO(type, name, arglist)     type name ()
+#define EXFUN(name, proto)             name()
+#define DEFUN(name, arglist, args)     name arglist args;
+#define DEFUN_VOID(name)               name()
+#define AND            ;
+#define DOTS
+#define NOARGS
+#endif /* ! IN_GCC */
+
+#endif /* ANSI C.  */
+
+/* Define macros for some gcc attributes.  This permits us to use the
+   macros freely, and know that they will come into play for the
+   version of gcc in which they are supported.  */
+
+#if (GCC_VERSION < 2007)
+# define __attribute__(x)
+#endif
+
+/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
+#ifndef ATTRIBUTE_MALLOC
+# if (GCC_VERSION >= 2096)
+#  define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define ATTRIBUTE_MALLOC
+# endif /* GNUC >= 2.96 */
+#endif /* ATTRIBUTE_MALLOC */
+
+/* Attributes on labels were valid as of gcc 2.93. */
+#ifndef ATTRIBUTE_UNUSED_LABEL
+# if (GCC_VERSION >= 2093)
+#  define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
+# else
+#  define ATTRIBUTE_UNUSED_LABEL
+# endif /* GNUC >= 2.93 */
+#endif /* ATTRIBUTE_UNUSED_LABEL */
+
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif /* ATTRIBUTE_UNUSED */
+
+#ifndef ATTRIBUTE_NORETURN
+#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif /* ATTRIBUTE_NORETURN */
+
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
+#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
+#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
+#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
+#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
+#endif /* ATTRIBUTE_PRINTF */
+
+/* We use __extension__ in some places to suppress -pedantic warnings
+   about GCC extensions.  This feature didn't work properly before
+   gcc 2.8.  */
+#if GCC_VERSION < 2008
+#define __extension__
+#endif
+
+/* Bootstrap support:  Adjust certain macros defined by Autoconf,
+   which are only valid for the stage1 compiler.  If we detect
+   a modern version of GCC, we are probably in stage2 or beyond,
+   so unconditionally reset the values.  Note that const, inline,
+   etc. have been dealt with above.  */
+#if (GCC_VERSION >= 2007)
+# ifndef HAVE_LONG_DOUBLE
+#  define HAVE_LONG_DOUBLE 1
+# endif
+#endif /* GCC >= 2.7 */
+
+#endif /* ansidecl.h   */
diff --git a/jit/i386/asmpart.S b/jit/i386/asmpart.S
new file mode 100644 (file)
index 0000000..b100b7c
--- /dev/null
@@ -0,0 +1,1079 @@
+/* -*- mode: asm; tab-width: 4 -*- */
+/****************************** asmpart.c **************************************
+*                                                                              *
+*   It contains the Java-C interface functions for i386 processors.            *
+*                                                                              *
+*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
+*                                                                              *
+*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
+*                                                                              *
+*   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
+*            Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
+*            Christian Thalinger                                               *
+*                                                                              *
+*   Last Change: $Id: asmpart.S 557 2003-11-02 22:51:59Z twisti $        *
+*                                                                              *
+*******************************************************************************/
+
+#include "offsets.h"
+
+       .text
+
+
+/********************* exported functions and variables ***********************/
+
+       .globl has_no_x_instr_set
+       .globl asm_calljavamethod
+       .globl asm_calljavafunction
+       .globl asm_call_jit_compiler
+       .globl asm_dumpregistersandcall
+       .globl asm_handle_exception
+       .globl asm_handle_nat_exception
+       .globl asm_builtin_checkcast    
+       .globl asm_builtin_checkarraycast
+       .globl asm_builtin_anewarray
+       .globl asm_builtin_newarray_array
+       .globl asm_builtin_aastore
+       .globl asm_builtin_monitorenter
+       .globl asm_builtin_monitorexit
+       .globl asm_builtin_ldiv
+       .globl asm_builtin_lrem
+    .globl asm_builtin_f2i
+    .globl asm_builtin_f2l
+    .globl asm_builtin_d2i
+    .globl asm_builtin_d2l
+       .globl asm_builtin_arrayinstanceof
+       .globl asm_perform_threadswitch
+       .globl asm_initialize_thread_stack
+       .globl asm_switchstackandcall
+       .globl asm_getcallingmethod
+    .globl asm_builtin_trace
+    .globl asm_builtin_exittrace
+    
+/*************************** imported functions *******************************/
+
+       .globl jit_compile
+       .globl builtin_monitorexit
+       .globl builtin_throw_exception
+       .globl builtin_trace_exception
+       .globl class_java_lang_Object
+       .globl findmethod
+
+/*********************** function has_no_x_instr_set ***************************
+*                                                                              *
+*   determines if the byte support instruction set (21164a and higher)         *
+*   is available.                                                              *
+*                                                                              *
+*   Use it on i386 architecture to init the fpu.                               *
+*                                                                              *
+*******************************************************************************/
+
+has_no_x_instr_set:
+               finit                         /* intitialize the fpu                  */
+
+               pushl   $0x027f   /* Round to nearest, 53-bit mode, exceptions masked */
+               fldcw   (%esp)
+               addl    $4,%esp
+               
+               xor             %eax,%eax                               /* result code 0 (not used for i386)  */
+               ret
+
+
+/********************* function asm_calljavamethod *****************************
+*                                                                              *
+*   This function calls a Java-method (which possibly needs compilation)       *
+*   with up to 4 parameters.                                                   *
+*                                                                              *
+*   This functions calls the JIT-compiler which eventually translates the      *
+*   method into machine code.                                                  *
+*                                                                              *
+*   An possibly throwed exception will be returned to the caller as function   *
+*   return value, so the java method cannot return a fucntion value (this      *
+*   function usually calls 'main' and '<clinit>' which do not return a         *
+*   function value).                                                           *
+*                                                                              *
+*   C-prototype:                                                               *
+*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
+*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
+*                                                                              *
+*******************************************************************************/
+
+#define        MethodPointer   -4
+#define        FrameSize       -8
+#define     IsSync          -12
+#define     IsLeaf          -16
+#define     IntSave         -20
+#define     FltSave         -24
+#define     ExTableSize     -28
+#define     ExTableStart    -28
+
+#define     ExEntrySize     -16
+#define     ExStartPC       -4
+#define     ExEndPC         -8
+#define     ExHandlerPC     -12
+#define     ExCatchType     -16
+
+call_name:
+       .ascii  "calljavamethod\0\0"
+
+/*     .align  3 */
+       .align  8
+       .long   0                         /* catch type all                       */
+       .long   calljava_xhandler         /* handler pc                           */
+       .long   calljava_xhandler         /* end pc                               */
+       .long   asm_calljavamethod        /* start pc                             */
+       .long   1                         /* extable size                         */
+       .long   0                         /* fltsave                              */
+       .long   0                         /* intsave                              */
+       .long   0                         /* isleaf                               */
+       .long   0                         /* IsSync                               */
+       .long   32                        /* frame size                           */
+       .long   0                         /* method pointer (pointer to name)     */
+
+asm_calljavamethod:
+               pushl   %ebp                  /* allocate stack space                 */
+               movl    %esp, %ebp
+
+               subl    $32,%esp              /* pass the remaining parameters        */
+               xorl    %edx,%edx
+
+               movl    %edx,28(%esp)         /* convert parms to 8 byte              */
+               movl    24(%ebp),%eax
+               movl    %eax,24(%esp)
+               
+               movl    %edx,20(%esp)
+               movl    20(%ebp),%eax
+               movl    %eax,16(%esp)
+
+               movl    %edx,12(%esp)
+               movl    16(%ebp),%eax
+               movl    %eax,8(%esp)
+
+               movl    %edx,4(%esp)
+               movl    12(%ebp),%eax
+               movl    %eax,(%esp)
+
+               movl    8(%ebp),%eax          /* move function pointer to %eax        */
+
+               lea             asm_call_jit_compiler,%ecx
+               call    *%ecx                 /* call JIT compiler                    */
+               
+calljava_jit:
+calljava_return:
+calljava_ret:
+               xorl    %eax,%eax
+               leave                                             /* free stack space                     */
+               ret
+
+calljava_xhandler:
+               pushl   %eax                              /* pass exception pointer               */
+               call    builtin_throw_exception
+               addl    $4,%esp
+               addl    $32,%esp
+               popl    %ebp
+               ret
+
+
+/********************* function asm_calljavafunction ***************************
+*                                                                              *
+*   This function calls a Java-method (which possibly needs compilation)       *
+*   with up to 4 address parameters.                                           *
+*                                                                              *
+*   This functions calls the JIT-compiler which eventually translates the      *
+*   method into machine code.                                                  *
+*                                                                              *
+*   C-prototype:                                                               *
+*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
+*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
+*                                                                              *
+*******************************************************************************/
+
+call_name2:
+       .ascii  "calljavafunction\0\0"
+
+/*     .align  3 */
+       .align  8
+       .long   0                         /* catch type all                       */
+       .long   calljava_xhandler2        /* handler pc                           */
+       .long   calljava_xhandler2        /* end pc                               */
+       .long   asm_calljavafunction      /* start pc                             */
+       .long   1                         /* extable size                         */
+       .long   0                         /* fltsave                              */
+       .long   0                         /* intsave                              */
+       .long   0                         /* isleaf                               */
+       .long   0                         /* IsSync                               */
+       .long   32                        /* frame size                           */
+       .long   0                         /* method pointer (pointer to name)     */
+
+asm_calljavafunction:
+               pushl   %ebp                  /* allocate stack space                 */
+               movl    %esp, %ebp
+
+               subl    $32,%esp              /* pass the remaining parameters        */
+               xorl    %edx,%edx
+
+               movl    %edx,28(%esp)         /* convert parms to 8 byte              */
+               movl    24(%ebp),%eax
+               movl    %eax,24(%esp)
+               
+               movl    %edx,20(%esp)
+               movl    20(%ebp),%eax
+               movl    %eax,16(%esp)
+
+               movl    %edx,12(%esp)
+               movl    16(%ebp),%eax
+               movl    %eax,8(%esp)
+
+               movl    %edx,4(%esp)
+               movl    12(%ebp),%eax
+               movl    %eax,(%esp)
+
+               movl    8(%ebp),%eax          /* move function pointer to %eax        */
+
+               lea             asm_call_jit_compiler,%ecx 
+               call    *%ecx                 /* call JIT compiler                    */
+       
+calljava_jit2:
+calljava_return2:
+calljava_ret2:
+               leave
+               ret
+
+calljava_xhandler2:
+               pushl   %eax                              /* pass exception pointer               */
+               call    builtin_throw_exception
+               addl    $4,%esp
+               addl    $32,%esp
+               popl    %ebp
+               ret
+                                               
+
+/****************** function asm_call_jit_compiler *****************************
+*                                                                              *
+*   invokes the compiler for untranslated JavaVM methods.                      *
+*                                                                              *
+*   Register R0 contains a pointer to the method info structure (prepared      *
+*   by createcompilerstub). Using the return address in R26 and the            *
+*   offset in the LDA instruction or using the value in methodptr R28 the      *
+*   patching address for storing the method address can be computed:           *
+*                                                                              *
+*   method address was either loaded using                                     *
+*                                                                              *
+*   i386_mov_imm_reg(a, REG_ITMP2)                ; invokestatic/special       *
+*   i386_call_reg(REG_ITMP2)                                                   *
+*                                                                              *
+*   or                                                                         *
+*                                                                              *
+*   i386_mov_membase_reg(REG_SP, 0, REG_ITMP1)    ; invokevirtual/interface    *
+*   i386_mov_membase_reg(REG_ITMP1, OFFSET(, vftbl), REG_ITMP2)                *
+*   i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + \                *
+*       sizeof(methodptr) * m->vftblindex, REG_ITMP1)                          *
+*   i386_call_reg(REG_ITMP1)                                                   *
+*                                                                              *
+*   in the static case the method pointer can be computed using the            *
+*   return address and the lda function following the jmp instruction          *
+*                                                                              *
+*******************************************************************************/
+
+
+asm_call_jit_compiler:
+        push    %ecx
+               push    %ebx            /* save register                              */
+        push    %ebp
+                               
+               mov     12(%esp),%ebp   /* get return address (2 push)                */
+               mov     -1(%ebp),%bl    /* get function code                          */
+               cmp     $0xd2,%bl               /* called with `call *REG_ITMP2' (%edx)?      */
+               jne             L_not_static_special
+
+               sub     $6,%ebp                 /* calculate address of immediate             */
+               jmp             L_call_jit_compile
+               
+L_not_static_special:
+               cmp     $0xd0,%bl               /* called with `call *REG_ITMP1' (%eax)       */
+               jne             L_not_virtual_interface
+               
+               sub     $6,%ebp         /* calculate address of offset                */
+               mov     (%ebp),%ebp     /* get offset                                 */
+               add     %edx,%ebp       /* add base address to get method address     */
+               jmp             L_call_jit_compile
+
+L_not_virtual_interface:        /* a call from asm_calljavamethod             */
+               xor     %ebp,%ebp
+               
+L_call_jit_compile:
+               push    %ebp            /* save address for method pointer            */
+
+               push    %eax                    /* push methodpointer on stack                */
+               call    jit_compile
+               add     $4,%esp
+
+               pop     %ebp            /* restore address for method pointer         */
+               test    %ebp,%ebp               /* is address == 0 (asm_calljavamethod)       */
+               je              L_call_method
+               
+               mov     %eax,(%ebp)             /* and now save the new pointer               */
+
+L_call_method:
+        pop     %ebp
+               pop     %ebx            /* restore registers                          */
+        pop     %ecx
+                       
+               jmp             *%eax                   /* ...and now call the new method             */
+
+
+
+/****************** function asm_dumpregistersandcall **************************
+*                                                                              *
+*   This funtion saves all callee saved registers and calls the function       *
+*   which is passed as parameter.                                              *
+*                                                                              *
+*   This function is needed by the garbage collector, which needs to access    *
+*   all registers which are stored on the stack. Unused registers are          *
+*   cleared to avoid interferances with the GC.                                *
+*                                                                              *
+*   void asm_dumpregistersandcall (functionptr f);                             *
+*                                                                              *
+*******************************************************************************/
+
+asm_dumpregistersandcall:
+        xor     %eax,%eax
+        mov     %eax,(%eax)
+        
+               push    %ebx
+               push    %ebp
+               push    %esi
+               push    %edi
+                               
+               mov     8(%ebp),%eax            /* load function pointer */
+               call    *%eax                           /* call function */
+
+               pop             %edi
+               pop             %esi
+               pop             %ebp
+               pop             %ebx
+               
+               ret
+        
+
+/********************* function asm_handle_exception ***************************
+*                                                                              *
+*   This function handles an exception. It does not use the usual calling      *
+*   conventions. The exception pointer is passed in REG_ITMP1 and the          *
+*   pc from the exception raising position is passed in REG_ITMP2. It searches *
+*   the local exception table for a handler. If no one is found, it unwinds    *
+*   stacks and continues searching the callers.                                *
+*                                                                              *
+*   void asm_handle_exception (exceptionptr, exceptionpc);                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_handle_nat_exception:
+               add     $4,%esp                                         /* clear return address of native stub */
+               
+asm_handle_exception:
+               push    %eax
+               push    %edx                                            /* get the data segment ptr       */
+               call    findmethod
+               mov     %eax,%ecx
+               pop     %edx
+               pop     %eax
+
+               push    %ebp
+               mov     %esp,%ebp
+
+               push    %eax                                            /* save exception pointer         */
+/*             subl    $2,%edx */
+               push    %edx                                            /* save exception pc              */
+               push    %ecx                                            /* save data segment pointer      */
+        
+               push    %ebx
+               push    %esi
+               push    %edi
+               
+ex_stack_loop:
+               sub     $16,%esp
+
+               movl    %eax,(%esp)                                     /* exception pointer */
+
+               movl    MethodPointer(%ecx),%eax        /* method pointer */
+               movl    %eax,4(%esp)
+               
+               movl    %edx,8(%esp)                            /* exception pc */
+               movl    $1,12(%esp)                                     /* set no unwind flag */
+               call    builtin_trace_exception
+
+               addl    $16,%esp
+
+               movl    -12(%ebp),%esi                          /* %esi = data segment pointer */
+               movl    ExTableSize(%esi),%ecx          /* %ecx = exception table size */
+               test    %ecx,%ecx                                       /* if empty table skip */
+               je              empty_table
+
+               lea             ExTableStart(%esi),%edi         /* %edi = start of exception table */
+               movl    -4(%ebp),%eax                           /* get xptr */
+               
+ex_table_loop:
+               movl    -8(%ebp),%edx                           /* get xpc */
+               
+               movl    ExStartPC(%edi),%ebx            /* %ebx = exception start pc */
+               cmpl    %edx,%ebx                                       /* %ebx = (startpc <= xpc) */
+               jg              ex_table_cont                           /* if (false) continue */
+               movl    ExEndPC(%edi),%ebx                      /* %ebx = exception end pc */
+               cmpl    %ebx,%edx                                       /* %ebx = (xpc < endpc) */
+               jge             ex_table_cont                           /* if (false) continue */
+               movl    ExCatchType(%edi),%ebx          /* arg1 = exception catch type */
+               test    %ebx,%ebx                                       /* NULL catches everything */
+               je              ex_handle_it
+
+               movl    offobjvftbl(%eax),%esi          /* %esi = vftblptr(xptr) */
+               movl    offobjvftbl(%ebx),%ebx          /* %ebx = vftblptr(catchtype) class (not obj) */
+               movl    offbaseval(%esi),%esi           /* %esi = baseval(xptr) */
+               movl    offbaseval(%ebx),%edx           /* %edx = baseval(catchtype) */
+               movl    offdiffval(%ebx),%ebx           /* %ebx = diffval(catchtype) */
+               subl    %edx,%esi                                       /* %esi = baseval(xptr) - baseval(catchtype) */
+               cmpl    %ebx,%esi                                       /* xptr is instanceof catchtype */
+               ja              ex_table_cont
+               
+ex_handle_it:
+               movl    ExHandlerPC(%edi),%edx
+               
+               popl    %edi
+               popl    %esi
+               popl    %ebx
+        
+        popl    %eax                        /* pop %ecx (dummy) */
+        popl    %eax                        /* pop %edx (dummy) */
+        popl    %eax                        /* pop %eax */
+        
+               leave
+
+               jmp             *%edx
+
+ex_table_cont:
+               lea             ExEntrySize(%edi),%edi
+               decl    %ecx
+               test    %ecx,%ecx
+               jg              ex_table_loop
+               
+empty_table:
+               popl    %edi
+               popl    %esi
+               popl    %ebx
+               popl    %ecx                                            /* restore data segment pointer   */
+               popl    %edx
+               popl    %eax                                            /* restore exception pointer      */
+               popl    %ebp
+
+               movl    %eax,%edi                                       /* save exception pointer         */
+                               
+ex_already_cleared:            
+               movl    IsSync(%ecx),%eax                       /* %eax = SyncOffset              */
+               test    %eax,%eax                                       /* if zero no monitorexit         */
+               je              no_monitor_exit
+               
+               addl    %esp,%eax
+               movl    -8(%eax),%eax
+        pusha                               /* save regs                      */
+               pushl   %eax
+               call    builtin_monitorexit
+               addl    $4,%esp
+        popa                                /* restore regs                   */
+        
+no_monitor_exit:
+               movl    FrameSize(%ecx),%eax            /* %eax = frame size              */
+               addl    %eax,%esp                                       /* unwind stack                   */
+               movl    %esp,%eax                                       /* %eax = pointer to save area    */
+
+               movl    IntSave(%ecx),%edx                      /* %edx = saved int register count */
+               test    %edx,%edx
+               je              noint
+               cmpl    $1,%edx
+               je              int1
+               
+int2:  
+               movl    -16(%eax),%ebx
+
+int1:  
+               movl    -8(%eax),%ebp
+
+               shll    $3,%edx                                         /* multiply by 8 bytes             */
+               subl    %edx,%eax
+               
+noint:
+               movl    FltSave(%ecx),%edx                      /* %edx = saved flt register count */
+               test    %edx,%edx
+               je              noflt
+               cmpl    $1,%edx
+               je              flt1
+               cmpl    $2,%edx
+               je              flt2
+               cmpl    $3,%edx
+               je              flt3
+               
+flt4:  
+               fldl    -32(%eax)
+               fstp    %st(1)
+
+flt3:  
+               fldl    -24(%eax)
+               fstp    %st(2)
+               
+flt2:  
+               fldl    -16(%eax)
+               fstp    %st(3)
+               
+flt1:  
+               fldl    -8(%eax)
+               fstp    %st(4)
+               
+noflt:                                 
+               popl    %edx                                            /* the new xpc is return address  */
+               subl    $2,%edx
+               
+               pushl   %edx
+               pushl   %ebx
+               pushl   %ebp
+               pushl   %esi
+               pushl   %edi
+                                                               
+               pushl   %edx                                            /* get the new data segment ptr   */
+               call    findmethod
+               movl    %eax,%ecx
+               addl    $4,%esp
+
+               popl    %edi
+               popl    %esi
+               popl    %ebp
+               popl    %ebx
+               popl    %edx
+               
+               movl    %edi,%eax                                       /* restore saved exception pointer */
+                               
+               pushl   %ebp
+               movl    %esp,%ebp
+
+               pushl   %eax                                            /* save exception pointer         */
+               pushl   %edx                                            /* save exception pc              */
+               pushl   %ecx                                            /* save data segment pointer      */
+               pushl   %ebx
+               pushl   %esi
+               pushl   %edi
+               
+               jmp             ex_stack_loop
+               
+
+/********************* function asm_builtin_monitorenter ***********************
+*                                                                              *
+*   Does null check and calls monitorenter or throws an exception              *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_monitorenter:
+               cmpl    $0,4(%esp)
+               je              nb_monitorenter                 /* if (null) throw exception          */
+               jmp             builtin_monitorenter    /* else call builtin_monitorenter     */
+
+nb_monitorenter:
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               movl    proto_java_lang_NullPointerException,%eax
+               jmp             asm_handle_exception
+               
+
+/********************* function asm_builtin_monitorexit ************************
+*                                                                              *
+*   Does null check and calls monitorexit or throws an exception               *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_monitorexit:
+               cmpl    $0,4(%esp)
+               je              nb_monitorexit                  /* if (null) throw exception          */
+               jmp             builtin_monitorexit             /* else call builtin_monitorenter     */
+
+nb_monitorexit:
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               movl    proto_java_lang_NullPointerException,%eax
+               jmp             asm_handle_exception
+
+
+/************************ function asm_builtin_ldiv ****************************
+*                                                                              *
+*   Does null check and calls ldiv or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_ldiv:
+               movl    12(%esp),%eax
+               orl             16(%esp),%eax
+               test    %eax,%eax                               /* if (null) throw exception */
+               je              nb_ldiv
+
+               jmp             builtin_ldiv
+
+nb_ldiv:
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ArithmeticException,%eax
+               jmp             asm_handle_exception
+                               
+
+/************************ function asm_builtin_lrem ****************************
+*                                                                              *
+*   Does null check and calls lrem or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_lrem:
+               movl    12(%esp),%eax
+               orl             16(%esp),%eax
+               test    %eax,%eax                               /* if (null) throw exception */
+               je              nb_lrem
+
+               jmp             builtin_lrem
+
+nb_lrem:
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ArithmeticException,%eax
+               jmp             asm_handle_exception
+               
+
+/************************ function asm_builtin_x2x *****************************
+*                                                                              *
+*   Wrapper functions for corner cases                                         *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_f2i:
+        sub     $4,%esp
+        fsts    (%esp)
+        call    builtin_f2i
+        add     $4,%esp
+        ret            
+
+asm_builtin_d2i:
+        sub     $8,%esp
+        fstl    (%esp)
+        call    builtin_d2i
+        add     $8,%esp
+        ret            
+
+asm_builtin_f2l:
+        sub     $4,%esp
+        fsts    (%esp)
+        call    builtin_f2l
+        add     $4,%esp
+        ret            
+
+asm_builtin_d2l:
+        sub     $8,%esp
+        fstl    (%esp)
+        call    builtin_d2l
+        add     $8,%esp
+        ret            
+
+        
+/*********************** function new_builtin_checkcast ************************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_checkcast:
+               xorl    %eax,%eax
+               movl    $0,(%eax)
+               ret
+
+               
+/******************* function asm_builtin_checkarraycast ***********************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_checkarraycast:
+               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes)    */
+
+               movl    12(%esp),%eax           /* 8 (frame) + 4 (return)             */
+               movl    %eax,(%esp)                             /* save object pointer                */
+
+               movl    20(%esp),%eax
+               movl    %eax,4(%esp)
+
+               call    builtin_checkarraycast  /* builtin_checkarraycast             */
+       
+               test    %eax,%eax               /* if (false) throw exception         */
+               je              nb_carray_throw
+
+               movl    12(%esp),%eax                   /* return object pointer              */
+               addl    $8,%esp
+               ret
+
+nb_carray_throw:
+               addl    $8,%esp
+               
+               popl    %edx                                    /* delete return address              */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ClassCastException,%eax
+               jmp             asm_handle_exception
+
+               
+/******************* function asm_builtin_anewarray ****************************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_anewarray:
+               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
+
+               movl    12(%esp),%eax
+               movl    %eax,(%esp)
+
+               movl    20(%esp),%eax
+               movl    %eax,4(%esp)
+
+               call    builtin_anewarray
+       
+               addl    $8,%esp
+               ret
+
+               
+/******************* function asm_builtin_newarray_array ***********************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_newarray_array:
+               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
+
+               movl    12(%esp),%eax
+               movl    %eax,(%esp)
+
+               movl    20(%esp),%eax
+               movl    %eax,4(%esp)
+
+               call    builtin_newarray_array
+       
+               addl    $8,%esp
+               ret
+
+               
+/******************* function asm_builtin_aastore ******************************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_aastore:
+               subl    $12,%esp                                /* build stack frame (3 * 4 bytes)    */
+
+               movl    16(%esp),%eax           /* 12 (frame) + 4 (return)            */
+               test    %eax,%eax                               /* if null pointer throw exception    */
+               je              nb_aastore_null
+
+               movl    offarraysize(%eax),%edx /* load size                          */
+               movl    24(%esp),%ecx                   /* index                              */
+               cmpl    %edx,%ecx                               /* do bound check                     */
+               ja              nb_aastore_bound                /* if out of bounds throw exception   */
+
+               shll    $2,%ecx                                 /* index * 4                          */
+               addl    %eax,%ecx                               /* add index * 4 to arrayref          */
+               
+               movl    %ecx,8(%esp)                    /* save store position                */
+               
+               movl    16(%esp),%eax           /* 12 (frame) + 4 (return)            */
+               movl    %eax,(%esp)
+
+               movl    32(%esp),%eax                   /* object is second argument          */
+               movl    %eax,4(%esp)
+               
+               call    builtin_canstore                /* builtin_canstore(arrayref,object)  */
+
+               test    %eax,%eax                               /* if (false) throw exception         */
+               je              nb_aastore_throw
+
+               movl    32(%esp),%eax
+               movl    8(%esp),%ecx
+               movl    %eax,offobjarrdata(%ecx)/* store objectptr in array           */
+               
+               addl    $12,%esp
+               ret
+
+nb_aastore_null:
+               addl    $12,%esp
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_NullPointerException,%eax
+               jmp             asm_handle_exception
+
+nb_aastore_bound:
+               addl    $12,%esp
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ArrayIndexOutOfBoundsException,%eax
+               jmp             asm_handle_exception
+               
+nb_aastore_throw:
+               addl    $12,%esp
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ArrayStoreException,%eax
+               jmp             asm_handle_exception
+
+               
+/******************* function asm_builtin_arrayinstanceof **********************
+*                                                                              *
+*   Does the instanceof check of arrays                                        *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_arrayinstanceof:
+               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
+
+               movl    12(%esp),%eax
+               movl    %eax,(%esp)
+
+               movl    20(%esp),%eax
+               movl    %eax,4(%esp)
+
+               call    builtin_arrayinstanceof
+       
+               addl    $8,%esp
+               ret
+
+               
+/******************* function asm_initialize_thread_stack **********************
+*                                                                              *
+* initialized a thread stack                                                   *
+* (to)->restorePoint = asm_initialize_thread_stack((u1*)(func), (to)->stackEnd)*
+*                                                                              *
+*******************************************************************************/
+
+asm_initialize_thread_stack:
+               movl    8(%esp),%eax            /* (to)->stackEnd                     */
+               subl    $36,%eax                                /* 4 bytes * 8 regs + 4 bytes func    */
+
+               xorl    %edx,%edx
+               movl    %edx,0(%eax)
+               movl    %edx,4(%eax)
+               movl    %edx,8(%eax)
+               movl    %edx,12(%eax)
+               movl    %edx,16(%eax)
+               movl    %edx,20(%eax)
+               movl    %edx,24(%eax)
+               movl    %edx,28(%eax)
+
+               movl    4(%esp),%edx            /* save (u1*) (func)                  */
+               movl    %edx,32(%eax)
+
+               ret                             /* return restorepoint in %eax        */
+
+
+/******************* function asm_perform_threadswitch *************************
+*                                                                              *
+*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
+*                                                                              *
+*   performs a threadswitch                                                    *
+*                                                                              *
+*******************************************************************************/
+
+asm_perform_threadswitch:
+               subl    $36,%esp
+
+               movl    %eax,0(%esp)
+               movl    %edx,4(%esp)
+               movl    %ecx,8(%esp)
+               movl    %ebx,12(%esp)
+               movl    %esp,16(%esp)
+               movl    %ebp,20(%esp)
+               movl    %esi,24(%esp)
+               movl    %edi,28(%esp)
+
+               movl    36(%esp),%eax                   /* save current return address */
+               movl    %eax,32(%esp)
+
+               movl    40(%esp),%eax                   /* first argument **from */
+               movl    %esp,0(%eax)
+
+               movl    48(%esp),%eax                   /* third argument **stackTop */
+               movl    %esp,0(%eax)
+
+               movl    44(%esp),%eax                   /* second argument **to */
+               movl    0(%eax),%esp                    /* load new stack pointer */
+
+               movl    0(%esp),%eax
+               movl    4(%esp),%edx
+               movl    8(%esp),%ecx
+               movl    12(%esp),%ebx
+                                                                               /* skip stack pointer */
+               movl    20(%esp),%ebp
+               movl    24(%esp),%esi
+               movl    28(%esp),%edi
+
+               addl    $32,%esp                /* leave return address on stack      */
+               ret
+               
+
+/********************* function asm_switchstackandcall *************************
+*                                                                              *
+*  int asm_switchstackandcall (void *stack, void *func, void **stacktopsave,   *
+*                                     void *p);                                       *
+*                                                                              *
+*   Switches to a new stack, calls a function and switches back.               *
+*       a0      new stack pointer                                              *
+*       a1      function pointer                                               *
+*              a2              pointer to variable where stack top should be stored           *
+*       a3      pointer to user data, is passed to the function                *
+*                                                                              *
+*******************************************************************************/
+
+asm_switchstackandcall:
+               movl    4(%esp),%edx                    /* first argument *stack */
+               subl    $8,%edx                                 /* allocate new stack */
+
+               movl    (%esp),%eax                             /* save return address on new stack */
+               movl    %eax,(%edx)
+
+               movl    %esp,4(%edx)                    /* save old stack pointer on new stack */
+
+               movl    12(%esp),%eax                   /* third argument **stacktopsave */
+               movl    %esp,(%eax)                             /* save old stack pointer to variable */
+
+               movl    8(%esp),%eax                    /* load function pointer */
+               movl    16(%esp),%ecx                   /* fourth argument *p */
+               
+               movl    %edx,%esp                               /* switch to new stack */
+
+               subl    $4,%esp
+               movl    %ecx,0(%esp)                    /* pass pointer */
+               call    *%eax                                   /* and call function */
+               addl    $4,%esp
+
+               movl    (%esp),%edx                             /* load return address */
+               movl    4(%esp),%esp                    /* switch to old stack */
+               movl    %edx,(%esp)
+               ret
+
+               
+/********************* function asm_getcallingmethod ***************************
+*                                                                              *
+*   classinfo *asm_getcallingmethod ();                                                                   *
+*                                                                                                                                                         *    
+*   goes back stack frames to get the calling method                                              *       
+*                                                                                                                                                         *    
+*                              t2 .. sp                                                                                                       *
+*                              t3 .. ra                                                                                                       *
+*                              t4 .. pv                                                                                                       *
+*                                                                              *
+*******************************************************************************/
+
+asm_getcallingmethod:
+               xorl    %eax,%eax
+/*             movl    $0,(%eax) */
+               ret
+
+
+/*********************** function asm_builtin_trace ****************************
+*                                                                              *
+*   Intended to be called from the native stub. Saves all argument registers   *
+*   and calls builtin_trace_args.                                              *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_trace:
+        pusha
+        subl    $68,%esp                /* 4 + 8 * 4 + 68 = 104 */
+
+        movl    104(%esp),%eax
+        movl    108(%esp),%edx
+        movl    %eax,(%esp)
+        movl    %edx,4(%esp)
+
+        movl    112(%esp),%eax
+        movl    116(%esp),%edx
+        movl    %eax,8(%esp)
+        movl    %edx,12(%esp)
+
+        movl    120(%esp),%eax
+        movl    124(%esp),%edx
+        movl    %eax,16(%esp)
+        movl    %edx,20(%esp)
+
+        movl    128(%esp),%eax
+        movl    132(%esp),%edx
+        movl    %eax,24(%esp)
+        movl    %edx,28(%esp)
+
+        movl    136(%esp),%eax
+        movl    140(%esp),%edx
+        movl    %eax,32(%esp)
+        movl    %edx,36(%esp)
+
+        movl    144(%esp),%eax
+        movl    148(%esp),%edx
+        movl    %eax,40(%esp)
+        movl    %edx,44(%esp)
+
+        movl    152(%esp),%eax
+        movl    156(%esp),%edx
+        movl    %eax,48(%esp)
+        movl    %edx,52(%esp)
+
+        movl    160(%esp),%eax
+        movl    164(%esp),%edx
+        movl    %eax,56(%esp)
+        movl    %edx,60(%esp)
+
+        movl    168(%esp),%eax
+        movl    %eax,64(%esp)
+        
+        call    builtin_trace_args
+        addl    $68,%esp
+
+        popa
+        ret
+
+
+/********************* function asm_builtin_exittrace **************************
+*                                                                              *
+*   Intended to be called from the native stub. Saves return value and calls   *
+*   builtin_displaymethodstop.                                                 *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_exittrace:
+        pusha
+        subl    $24,%esp
+        
+        movl    60(%esp),%eax           /* 4 + 8 * 4 + 24 = 60 */
+        movl    %eax,(%esp)
+
+        movl    64(%esp),%eax
+        movl    68(%esp),%edx
+        movl    %eax,4(%esp)
+        movl    %edx,8(%esp)
+
+        movl    72(%esp),%eax
+        movl    76(%esp),%edx
+        movl    %eax,12(%esp)
+        movl    %edx,16(%esp)
+
+        movl    80(%esp),%eax
+        movl    %eax,20(%esp)
+
+        call    builtin_displaymethodstop
+        addl    $24,%esp
+
+        popa
+        ret
diff --git a/jit/i386/bfd.h b/jit/i386/bfd.h
new file mode 100644 (file)
index 0000000..cd75aeb
--- /dev/null
@@ -0,0 +1,4177 @@
+/* DO NOT EDIT!  -*- buffer-read-only: t -*-  This file is automatically 
+   generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c", 
+   "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c", 
+   "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c", 
+   "linker.c" and "simple.c".
+   Run "make headers" in your build bfd/ to regenerate.  */
+
+/* Main header file for the bfd library -- portable access to object files.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001, 2002
+   Free Software Foundation, Inc.
+   Contributed by Cygnus Support.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef __BFD_H_SEEN__
+#define __BFD_H_SEEN__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ansidecl.h"
+#include "symcat.h"
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#ifndef SABER
+/* This hack is to avoid a problem with some strict ANSI C preprocessors.
+   The problem is, "32_" is not a valid preprocessing token, and we don't
+   want extra underscores (e.g., "nlm_32_").  The XCONCAT2 macro will
+   cause the inner CONCAT2 macros to be evaluated first, producing
+   still-valid pp-tokens.  Then the final concatenation can be done.  */
+#undef CONCAT4
+#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
+#endif
+#endif
+
+/* The word size used by BFD on the host.  This may be 64 with a 32
+   bit target if the host is 64 bit, or if other 64 bit targets have
+   been selected with --enable-targets, or if --enable-64-bit-bfd.  */
+#define BFD_ARCH_SIZE 32
+
+/* The word size of the default bfd target.  */
+#define BFD_DEFAULT_TARGET_SIZE 32
+
+#define BFD_HOST_64BIT_LONG 0
+#if 0
+#define BFD_HOST_64_BIT 
+#define BFD_HOST_U_64_BIT 
+#endif
+
+#if BFD_ARCH_SIZE >= 64
+#define BFD64
+#endif
+
+#ifndef INLINE
+#if __GNUC__ >= 2
+#define INLINE __inline__
+#else
+#define INLINE
+#endif
+#endif
+
+/* Forward declaration.  */
+typedef struct _bfd bfd;
+
+/* To squelch erroneous compiler warnings ("illegal pointer
+   combination") from the SVR3 compiler, we would like to typedef
+   boolean to int (it doesn't like functions which return boolean.
+   Making sure they are never implicitly declared to return int
+   doesn't seem to help).  But this file is not configured based on
+   the host.  */
+/* General rules: functions which are boolean return true on success
+   and false on failure (unless they're a predicate).   -- bfd.doc */
+/* I'm sure this is going to break something and someone is going to
+   force me to change it.  */
+/* typedef enum boolean {false, true} boolean; */
+/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
+/* It gets worse if the host also defines a true/false enum... -sts */
+/* And even worse if your compiler has built-in boolean types... -law */
+/* And even worse if your compiler provides a stdbool.h that conflicts
+   with these definitions... gcc 2.95 and later do.  If so, it must
+   be included first.  -drow */
+#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+#define TRUE_FALSE_ALREADY_DEFINED
+#else
+#if defined (__bool_true_false_are_defined)
+/* We have <stdbool.h>.  */
+#define TRUE_FALSE_ALREADY_DEFINED
+#endif
+#endif
+#ifdef MPW
+/* Pre-emptive strike - get the file with the enum.  */
+#include <Types.h>
+#define TRUE_FALSE_ALREADY_DEFINED
+#endif /* MPW */
+#ifndef TRUE_FALSE_ALREADY_DEFINED
+/*typedef enum bfd_boolean {false, true} boolean;*/
+typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
+#define BFD_TRUE_FALSE
+#else
+/* Use enum names that will appear nowhere else.  */
+typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
+#endif
+
+/* Support for different sizes of target format ints and addresses.
+   If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
+   set to 1 above.  Otherwise, if gcc is being used, this code will
+   use gcc's "long long" type.  Otherwise, BFD_HOST_64_BIT must be
+   defined above.  */
+
+#ifndef BFD_HOST_64_BIT
+# if BFD_HOST_64BIT_LONG
+#  define BFD_HOST_64_BIT long
+#  define BFD_HOST_U_64_BIT unsigned long
+# else
+#  ifdef __GNUC__
+#   if __GNUC__ >= 2
+#    define BFD_HOST_64_BIT long long
+#    define BFD_HOST_U_64_BIT unsigned long long
+#   endif /* __GNUC__ >= 2 */
+#  endif /* ! defined (__GNUC__) */
+# endif /* ! BFD_HOST_64BIT_LONG */
+#endif /* ! defined (BFD_HOST_64_BIT) */
+
+#ifdef BFD64
+
+#ifndef BFD_HOST_64_BIT
+ #error No 64 bit integer type available
+#endif /* ! defined (BFD_HOST_64_BIT) */
+
+typedef BFD_HOST_U_64_BIT bfd_vma;
+typedef BFD_HOST_64_BIT bfd_signed_vma;
+typedef BFD_HOST_U_64_BIT bfd_size_type;
+typedef BFD_HOST_U_64_BIT symvalue;
+
+#ifndef fprintf_vma
+#if BFD_HOST_64BIT_LONG
+#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
+#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
+#else
+#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
+#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
+#define fprintf_vma(s,x) \
+  fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
+#define sprintf_vma(s,x) \
+  sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
+#endif
+#endif
+
+#else /* not BFD64  */
+
+/* Represent a target address.  Also used as a generic unsigned type
+   which is guaranteed to be big enough to hold any arithmetic types
+   we need to deal with.  */
+typedef unsigned long bfd_vma;
+
+/* A generic signed type which is guaranteed to be big enough to hold any
+   arithmetic types we need to deal with.  Can be assumed to be compatible
+   with bfd_vma in the same way that signed and unsigned ints are compatible
+   (as parameters, in assignment, etc).  */
+typedef long bfd_signed_vma;
+
+typedef unsigned long symvalue;
+typedef unsigned long bfd_size_type;
+
+/* Print a bfd_vma x on stream s.  */
+#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
+#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
+
+#endif /* not BFD64  */
+
+/* A pointer to a position in a file.  */
+/* FIXME:  This should be using off_t from <sys/types.h>.
+   For now, try to avoid breaking stuff by not including <sys/types.h> here.
+   This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
+   Probably the best long-term answer is to avoid using file_ptr AND off_t
+   in this header file, and to handle this in the BFD implementation
+   rather than in its interface.  */
+/* typedef off_t       file_ptr; */
+typedef bfd_signed_vma file_ptr;
+typedef bfd_vma ufile_ptr;
+
+extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
+#define printf_vma(x) fprintf_vma(stdout,x)
+#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
+
+typedef unsigned int flagword; /* 32 bits of flags */
+typedef unsigned char bfd_byte;
+\f
+/* File formats.  */
+
+typedef enum bfd_format
+{
+  bfd_unknown = 0,     /* File format is unknown.  */
+  bfd_object,          /* Linker/assember/compiler output.  */
+  bfd_archive,         /* Object archive file.  */
+  bfd_core,            /* Core dump.  */
+  bfd_type_end         /* Marks the end; don't use it!  */
+}
+bfd_format;
+
+/* Values that may appear in the flags field of a BFD.  These also
+   appear in the object_flags field of the bfd_target structure, where
+   they indicate the set of flags used by that backend (not all flags
+   are meaningful for all object file formats) (FIXME: at the moment,
+   the object_flags values have mostly just been copied from backend
+   to another, and are not necessarily correct).  */
+
+/* No flags.  */
+#define BFD_NO_FLAGS           0x00
+
+/* BFD contains relocation entries.  */
+#define HAS_RELOC      0x01
+
+/* BFD is directly executable.  */
+#define EXEC_P         0x02
+
+/* BFD has line number information (basically used for F_LNNO in a
+   COFF header).  */
+#define HAS_LINENO     0x04
+
+/* BFD has debugging information.  */
+#define HAS_DEBUG      0x08
+
+/* BFD has symbols.  */
+#define HAS_SYMS       0x10
+
+/* BFD has local symbols (basically used for F_LSYMS in a COFF
+   header).  */
+#define HAS_LOCALS     0x20
+
+/* BFD is a dynamic object.  */
+#define DYNAMIC        0x40
+
+/* Text section is write protected (if D_PAGED is not set, this is
+   like an a.out NMAGIC file) (the linker sets this by default, but
+   clears it for -r or -N).  */
+#define WP_TEXT        0x80
+
+/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
+   linker sets this by default, but clears it for -r or -n or -N).  */
+#define D_PAGED        0x100
+
+/* BFD is relaxable (this means that bfd_relax_section may be able to
+   do something) (sometimes bfd_relax_section can do something even if
+   this is not set).  */
+#define BFD_IS_RELAXABLE 0x200
+
+/* This may be set before writing out a BFD to request using a
+   traditional format.  For example, this is used to request that when
+   writing out an a.out object the symbols not be hashed to eliminate
+   duplicates.  */
+#define BFD_TRADITIONAL_FORMAT 0x400
+
+/* This flag indicates that the BFD contents are actually cached in
+   memory.  If this is set, iostream points to a bfd_in_memory struct.  */
+#define BFD_IN_MEMORY 0x800
+/* The sections in this BFD specify a memory page.  */
+#define HAS_LOAD_PAGE 0x1000
+\f
+/* Symbols and relocation.  */
+
+/* A count of carsyms (canonical archive symbols).  */
+typedef unsigned long symindex;
+
+/* How to perform a relocation.  */
+typedef const struct reloc_howto_struct reloc_howto_type;
+
+#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
+
+/* General purpose part of a symbol X;
+   target specific parts are in libcoff.h, libaout.h, etc.  */
+
+#define bfd_get_section(x) ((x)->section)
+#define bfd_get_output_section(x) ((x)->section->output_section)
+#define bfd_set_section(x,y) ((x)->section) = (y)
+#define bfd_asymbol_base(x) ((x)->section->vma)
+#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
+#define bfd_asymbol_name(x) ((x)->name)
+/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
+#define bfd_asymbol_bfd(x) ((x)->the_bfd)
+#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
+
+/* A canonical archive symbol.  */
+/* This is a type pun with struct ranlib on purpose!  */
+typedef struct carsym
+{
+  char *name;
+  file_ptr file_offset;        /* Look here to find the file.  */
+}
+carsym;                        /* To make these you call a carsymogen.  */
+
+/* Used in generating armaps (archive tables of contents).
+   Perhaps just a forward definition would do?  */
+struct orl                     /* Output ranlib.  */
+{
+  char **name;         /* Symbol name.  */
+  union
+  {
+    file_ptr pos;
+    bfd *abfd;
+  } u;                 /* bfd* or file position.  */
+  int namidx;          /* Index into string table.  */
+};
+\f
+/* Linenumber stuff.  */
+typedef struct lineno_cache_entry
+{
+  unsigned int line_number;    /* Linenumber from start of function.  */
+  union
+  {
+    struct symbol_cache_entry *sym;    /* Function name.  */
+    bfd_vma offset;                    /* Offset into section.  */
+  } u;
+}
+alent;
+\f
+/* Object and core file sections.  */
+
+#define        align_power(addr, align)        \
+  (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
+
+typedef struct sec *sec_ptr;
+
+#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
+#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
+#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
+#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
+#define bfd_section_name(bfd, ptr) ((ptr)->name)
+#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
+#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
+#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
+#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
+#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
+#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
+
+#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
+
+#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)true), true)
+#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
+#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
+
+typedef struct stat stat_type;
+\f
+typedef enum bfd_print_symbol
+{
+  bfd_print_symbol_name,
+  bfd_print_symbol_more,
+  bfd_print_symbol_all
+} bfd_print_symbol_type;
+
+/* Information about a symbol that nm needs.  */
+
+typedef struct _symbol_info
+{
+  symvalue value;
+  char type;
+  const char *name;            /* Symbol name.  */
+  unsigned char stab_type;     /* Stab type.  */
+  char stab_other;             /* Stab other.  */
+  short stab_desc;             /* Stab desc.  */
+  const char *stab_name;       /* String for stab type.  */
+} symbol_info;
+
+/* Get the name of a stabs type code.  */
+
+extern const char *bfd_get_stab_name PARAMS ((int));
+\f
+/* Hash table routines.  There is no way to free up a hash table.  */
+
+/* An element in the hash table.  Most uses will actually use a larger
+   structure, and an instance of this will be the first field.  */
+
+struct bfd_hash_entry
+{
+  /* Next entry for this hash code.  */
+  struct bfd_hash_entry *next;
+  /* String being hashed.  */
+  const char *string;
+  /* Hash code.  This is the full hash code, not the index into the
+     table.  */
+  unsigned long hash;
+};
+
+/* A hash table.  */
+
+struct bfd_hash_table
+{
+  /* The hash array.  */
+  struct bfd_hash_entry **table;
+  /* The number of slots in the hash table.  */
+  unsigned int size;
+  /* A function used to create new elements in the hash table.  The
+     first entry is itself a pointer to an element.  When this
+     function is first invoked, this pointer will be NULL.  However,
+     having the pointer permits a hierarchy of method functions to be
+     built each of which calls the function in the superclass.  Thus
+     each function should be written to allocate a new block of memory
+     only if the argument is NULL.  */
+  struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
+                                            struct bfd_hash_table *,
+                                            const char *));
+   /* An objalloc for this hash table.  This is a struct objalloc *,
+     but we use PTR to avoid requiring the inclusion of objalloc.h.  */
+  PTR memory;
+};
+
+/* Initialize a hash table.  */
+extern boolean bfd_hash_table_init
+  PARAMS ((struct bfd_hash_table *,
+          struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+                                      struct bfd_hash_table *,
+                                      const char *)));
+
+/* Initialize a hash table specifying a size.  */
+extern boolean bfd_hash_table_init_n
+  PARAMS ((struct bfd_hash_table *,
+          struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+                                      struct bfd_hash_table *,
+                                      const char *),
+          unsigned int size));
+
+/* Free up a hash table.  */
+extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
+
+/* Look up a string in a hash table.  If CREATE is true, a new entry
+   will be created for this string if one does not already exist.  The
+   COPY argument must be true if this routine should copy the string
+   into newly allocated memory when adding an entry.  */
+extern struct bfd_hash_entry *bfd_hash_lookup
+  PARAMS ((struct bfd_hash_table *, const char *, boolean create,
+          boolean copy));
+
+/* Replace an entry in a hash table.  */
+extern void bfd_hash_replace
+  PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
+          struct bfd_hash_entry *nw));
+
+/* Base method for creating a hash table entry.  */
+extern struct bfd_hash_entry *bfd_hash_newfunc
+  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
+          const char *));
+
+/* Grab some space for a hash table entry.  */
+extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
+                                     unsigned int));
+
+/* Traverse a hash table in a random order, calling a function on each
+   element.  If the function returns false, the traversal stops.  The
+   INFO argument is passed to the function.  */
+extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
+                                      boolean (*) (struct bfd_hash_entry *,
+                                                   PTR),
+                                      PTR info));
+
+#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
+
+/* User program access to BFD facilities.  */
+
+/* Direct I/O routines, for programs which know more about the object
+   file than BFD does.  Use higher level routines if possible.  */
+
+extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *));
+extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *));
+extern int bfd_seek PARAMS ((bfd *, file_ptr, int));
+extern ufile_ptr bfd_tell PARAMS ((bfd *));
+extern int bfd_flush PARAMS ((bfd *));
+extern int bfd_stat PARAMS ((bfd *, struct stat *));
+
+/* Deprecated old routines.  */
+#if __GNUC__
+#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
+  (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__),     \
+   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
+  (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__),    \
+   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#else
+#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
+  (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
+   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
+  (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
+   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#endif
+extern void warn_deprecated
+  PARAMS ((const char *, const char *, int, const char *));
+
+/* Cast from const char * to char * so that caller can assign to
+   a char * without a warning.  */
+#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
+#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
+#define bfd_get_format(abfd) ((abfd)->format)
+#define bfd_get_target(abfd) ((abfd)->xvec->name)
+#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
+#define bfd_family_coff(abfd) \
+  (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
+   bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
+#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
+#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
+#define bfd_header_big_endian(abfd) \
+  ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
+#define bfd_header_little_endian(abfd) \
+  ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
+#define bfd_get_file_flags(abfd) ((abfd)->flags)
+#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
+#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
+#define bfd_my_archive(abfd) ((abfd)->my_archive)
+#define bfd_has_map(abfd) ((abfd)->has_armap)
+
+#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
+#define bfd_usrdata(abfd) ((abfd)->usrdata)
+
+#define bfd_get_start_address(abfd) ((abfd)->start_address)
+#define bfd_get_symcount(abfd) ((abfd)->symcount)
+#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
+#define bfd_count_sections(abfd) ((abfd)->section_count)
+
+#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
+
+#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
+
+#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
+
+extern boolean bfd_cache_close PARAMS ((bfd *abfd));
+/* NB: This declaration should match the autogenerated one in libbfd.h.  */
+
+extern boolean bfd_record_phdr
+  PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
+          boolean, boolean, unsigned int, struct sec **));
+
+/* Byte swapping routines.  */
+
+bfd_vma                bfd_getb64         PARAMS ((const unsigned char *));
+bfd_vma        bfd_getl64         PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
+bfd_vma                bfd_getb32         PARAMS ((const unsigned char *));
+bfd_vma                bfd_getl32         PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
+bfd_vma                bfd_getb16         PARAMS ((const unsigned char *));
+bfd_vma                bfd_getl16         PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
+void           bfd_putb64         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putl64         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putb32         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putl32         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putb16         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putl16         PARAMS ((bfd_vma, unsigned char *));
+
+/* Byte swapping routines which take size and endiannes as arguments.  */
+
+bfd_vma         bfd_get_bits       PARAMS ((bfd_byte *, int, boolean));
+void            bfd_put_bits       PARAMS ((bfd_vma, bfd_byte *, int, boolean));
+\f
+/* Externally visible ECOFF routines.  */
+
+#if defined(__STDC__) || defined(ALMOST_STDC)
+struct ecoff_debug_info;
+struct ecoff_debug_swap;
+struct ecoff_extr;
+struct symbol_cache_entry;
+struct bfd_link_info;
+struct bfd_link_hash_entry;
+struct bfd_elf_version_tree;
+#endif
+extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
+extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
+extern boolean bfd_ecoff_set_regmasks
+  PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
+          unsigned long *cprmask));
+extern PTR bfd_ecoff_debug_init
+  PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
+          const struct ecoff_debug_swap *output_swap,
+          struct bfd_link_info *));
+extern void bfd_ecoff_debug_free
+  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+          const struct ecoff_debug_swap *output_swap,
+          struct bfd_link_info *));
+extern boolean bfd_ecoff_debug_accumulate
+  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+          const struct ecoff_debug_swap *output_swap,
+          bfd *input_bfd, struct ecoff_debug_info *input_debug,
+          const struct ecoff_debug_swap *input_swap,
+          struct bfd_link_info *));
+extern boolean bfd_ecoff_debug_accumulate_other
+  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+          const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
+          struct bfd_link_info *));
+extern boolean bfd_ecoff_debug_externals
+  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap,
+          boolean relocateable,
+          boolean (*get_extr) (struct symbol_cache_entry *,
+                               struct ecoff_extr *),
+          void (*set_index) (struct symbol_cache_entry *,
+                             bfd_size_type)));
+extern boolean bfd_ecoff_debug_one_external
+  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap,
+          const char *name, struct ecoff_extr *esym));
+extern bfd_size_type bfd_ecoff_debug_size
+  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap));
+extern boolean bfd_ecoff_write_debug
+  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap, file_ptr where));
+extern boolean bfd_ecoff_write_accumulated_debug
+  PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap,
+          struct bfd_link_info *info, file_ptr where));
+extern boolean bfd_mips_ecoff_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+
+/* Externally visible ELF routines.  */
+
+struct bfd_link_needed_list
+{
+  struct bfd_link_needed_list *next;
+  bfd *by;
+  const char *name;
+};
+
+extern boolean bfd_elf32_record_link_assignment
+  PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
+extern boolean bfd_elf64_record_link_assignment
+  PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
+extern struct bfd_link_needed_list *bfd_elf_get_needed_list
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf_get_bfd_needed_list
+  PARAMS ((bfd *, struct bfd_link_needed_list **));
+extern boolean bfd_elf32_size_dynamic_sections
+  PARAMS ((bfd *, const char *, const char *, const char *,
+          const char * const *, struct bfd_link_info *, struct sec **,
+          struct bfd_elf_version_tree *));
+extern boolean bfd_elf64_size_dynamic_sections
+  PARAMS ((bfd *, const char *, const char *, const char *,
+          const char * const *, struct bfd_link_info *, struct sec **,
+          struct bfd_elf_version_tree *));
+extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
+extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
+extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
+extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf32_discard_info
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf64_discard_info
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* Return an upper bound on the number of bytes required to store a
+   copy of ABFD's program header table entries.  Return -1 if an error
+   occurs; bfd_get_error will return an appropriate code.  */
+extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
+
+/* Copy ABFD's program header table entries to *PHDRS.  The entries
+   will be stored as an array of Elf_Internal_Phdr structures, as
+   defined in include/elf/internal.h.  To find out how large the
+   buffer needs to be, call bfd_get_elf_phdr_upper_bound.
+
+   Return the number of program header table entries read, or -1 if an
+   error occurs; bfd_get_error will return an appropriate code.  */
+extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
+
+/* Return the arch_size field of an elf bfd, or -1 if not elf.  */
+extern int bfd_get_arch_size PARAMS ((bfd *));
+
+/* Return true if address "naturally" sign extends, or -1 if not elf.  */
+extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
+
+extern boolean bfd_m68k_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+extern boolean bfd_mips_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+
+/* SunOS shared library support routines for the linker.  */
+
+extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_sunos_record_link_assignment
+  PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_sunos_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
+          struct sec **));
+
+/* Linux shared library support routines for the linker.  */
+
+extern boolean bfd_i386linux_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_m68klinux_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_sparclinux_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* mmap hacks */
+
+struct _bfd_window_internal;
+typedef struct _bfd_window_internal bfd_window_internal;
+
+typedef struct _bfd_window
+{
+  /* What the user asked for.  */
+  PTR data;
+  bfd_size_type size;
+  /* The actual window used by BFD.  Small user-requested read-only
+     regions sharing a page may share a single window into the object
+     file.  Read-write versions shouldn't until I've fixed things to
+     keep track of which portions have been claimed by the
+     application; don't want to give the same region back when the
+     application wants two writable copies!  */
+  struct _bfd_window_internal *i;
+}
+bfd_window;
+
+extern void bfd_init_window PARAMS ((bfd_window *));
+extern void bfd_free_window PARAMS ((bfd_window *));
+extern boolean bfd_get_file_window
+  PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
+
+/* XCOFF support routines for the linker.  */
+
+extern boolean bfd_xcoff_link_record_set
+  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
+          bfd_size_type));
+extern boolean bfd_xcoff_import_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
+          bfd_vma, const char *, const char *, const char *, unsigned int));
+extern boolean bfd_xcoff_export_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
+extern boolean bfd_xcoff_link_count_reloc
+  PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_xcoff_record_link_assignment
+  PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_xcoff_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
+          unsigned long, unsigned long, unsigned long, boolean,
+          int, boolean, boolean, struct sec **, boolean));
+extern boolean bfd_xcoff_link_generate_rtinit
+  PARAMS ((bfd *, const char *, const char *, boolean));
+
+/* XCOFF support routines for ar.  */
+extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *));
+
+/* Externally visible COFF routines.  */
+
+#if defined(__STDC__) || defined(ALMOST_STDC)
+struct internal_syment;
+union internal_auxent;
+#endif
+
+extern boolean bfd_coff_get_syment
+  PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
+
+extern boolean bfd_coff_get_auxent
+  PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
+
+extern boolean bfd_coff_set_symbol_class
+  PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
+
+extern boolean bfd_m68k_coff_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+
+/* ARM Interworking support.  Called from linker.  */
+extern boolean bfd_arm_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_arm_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_arm_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* PE ARM Interworking support.  Called from linker.  */
+extern boolean bfd_arm_pe_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_arm_pe_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_arm_pe_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* ELF ARM Interworking support.  Called from linker.  */
+extern boolean bfd_elf32_arm_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_elf32_arm_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_elf32_arm_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* TI COFF load page support.  */
+extern void bfd_ticoff_set_section_load_page
+  PARAMS ((struct sec *, int));
+
+extern int bfd_ticoff_get_section_load_page
+  PARAMS ((struct sec *));
+
+/* Extracted from init.c.  */
+void
+bfd_init PARAMS ((void));
+
+/* Extracted from opncls.c.  */
+bfd *
+bfd_openr PARAMS ((const char *filename, const char *target));
+
+bfd *
+bfd_fdopenr PARAMS ((const char *filename, const char *target, int fd));
+
+bfd *
+bfd_openstreamr PARAMS ((const char *, const char *, PTR));
+
+bfd *
+bfd_openw PARAMS ((const char *filename, const char *target));
+
+boolean
+bfd_close PARAMS ((bfd *abfd));
+
+boolean
+bfd_close_all_done PARAMS ((bfd *));
+
+bfd *
+bfd_create PARAMS ((const char *filename, bfd *templ));
+
+boolean
+bfd_make_writable PARAMS ((bfd *abfd));
+
+boolean
+bfd_make_readable PARAMS ((bfd *abfd));
+
+/* Extracted from libbfd.c.  */
+
+/* Byte swapping macros for user section data.  */
+
+#define bfd_put_8(abfd, val, ptr) \
+                ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
+#define bfd_put_signed_8 \
+               bfd_put_8
+#define bfd_get_8(abfd, ptr) \
+                (*(unsigned char *) (ptr) & 0xff)
+#define bfd_get_signed_8(abfd, ptr) \
+               (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
+
+#define bfd_put_16(abfd, val, ptr) \
+                BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
+#define bfd_put_signed_16 \
+                bfd_put_16
+#define bfd_get_16(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx16, (ptr))
+#define bfd_get_signed_16(abfd, ptr) \
+                BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
+
+#define bfd_put_32(abfd, val, ptr) \
+                BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
+#define bfd_put_signed_32 \
+                bfd_put_32
+#define bfd_get_32(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx32, (ptr))
+#define bfd_get_signed_32(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
+
+#define bfd_put_64(abfd, val, ptr) \
+                BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
+#define bfd_put_signed_64 \
+                bfd_put_64
+#define bfd_get_64(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx64, (ptr))
+#define bfd_get_signed_64(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
+
+#define bfd_get(bits, abfd, ptr)                               \
+                ( (bits) ==  8 ? (bfd_vma) bfd_get_8 (abfd, ptr)       \
+                : (bits) == 16 ? bfd_get_16 (abfd, ptr)        \
+                : (bits) == 32 ? bfd_get_32 (abfd, ptr)        \
+                : (bits) == 64 ? bfd_get_64 (abfd, ptr)        \
+                : (abort (), (bfd_vma) - 1))
+
+#define bfd_put(bits, abfd, val, ptr)                          \
+                ( (bits) ==  8 ? bfd_put_8  (abfd, val, ptr)   \
+                : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)   \
+                : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)   \
+                : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)   \
+                : (abort (), (void) 0))
+
+
+/* Byte swapping macros for file header data.  */
+
+#define bfd_h_put_8(abfd, val, ptr) \
+  bfd_put_8 (abfd, val, ptr)
+#define bfd_h_put_signed_8(abfd, val, ptr) \
+  bfd_put_8 (abfd, val, ptr)
+#define bfd_h_get_8(abfd, ptr) \
+  bfd_get_8 (abfd, ptr)
+#define bfd_h_get_signed_8(abfd, ptr) \
+  bfd_get_signed_8 (abfd, ptr)
+
+#define bfd_h_put_16(abfd, val, ptr) \
+  BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
+#define bfd_h_put_signed_16 \
+  bfd_h_put_16
+#define bfd_h_get_16(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx16, (ptr))
+#define bfd_h_get_signed_16(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
+
+#define bfd_h_put_32(abfd, val, ptr) \
+  BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
+#define bfd_h_put_signed_32 \
+  bfd_h_put_32
+#define bfd_h_get_32(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx32, (ptr))
+#define bfd_h_get_signed_32(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
+
+#define bfd_h_put_64(abfd, val, ptr) \
+  BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
+#define bfd_h_put_signed_64 \
+  bfd_h_put_64
+#define bfd_h_get_64(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx64, (ptr))
+#define bfd_h_get_signed_64(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
+
+/* Refinements on the above, which should eventually go away.  Save
+   cluttering the source with (bfd_vma) and (bfd_byte *) casts.  */
+
+#define H_PUT_64(abfd, val, where) \
+  bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_32(abfd, val, where) \
+  bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_16(abfd, val, where) \
+  bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_8 bfd_h_put_8
+
+#define H_PUT_S64(abfd, val, where) \
+  bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S32(abfd, val, where) \
+  bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S16(abfd, val, where) \
+  bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S8 bfd_h_put_signed_8
+
+#define H_GET_64(abfd, where) \
+  bfd_h_get_64 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_32(abfd, where) \
+  bfd_h_get_32 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_16(abfd, where) \
+  bfd_h_get_16 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_8 bfd_h_get_8
+
+#define H_GET_S64(abfd, where) \
+  bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S32(abfd, where) \
+  bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S16(abfd, where) \
+  bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S8 bfd_h_get_signed_8
+
+
+/* Extracted from bfdio.c.  */
+long
+bfd_get_mtime PARAMS ((bfd *abfd));
+
+long
+bfd_get_size PARAMS ((bfd *abfd));
+
+/* Extracted from bfdwin.c.  */
+/* Extracted from section.c.  */
+/* This structure is used for a comdat section, as in PE.  A comdat
+   section is associated with a particular symbol.  When the linker
+   sees a comdat section, it keeps only one of the sections with a
+   given name and associated with a given symbol.  */
+
+struct bfd_comdat_info
+{
+  /* The name of the symbol associated with a comdat section.  */
+  const char *name;
+
+  /* The local symbol table index of the symbol associated with a
+     comdat section.  This is only meaningful to the object file format
+     specific code; it is not an index into the list returned by
+     bfd_canonicalize_symtab.  */
+  long symbol;
+};
+
+typedef struct sec
+{
+  /* The name of the section; the name isn't a copy, the pointer is
+     the same as that passed to bfd_make_section.  */
+  const char *name;
+
+  /* A unique sequence number.  */
+  int id;
+
+  /* Which section in the bfd; 0..n-1 as sections are created in a bfd.  */
+  int index;
+
+  /* The next section in the list belonging to the BFD, or NULL.  */
+  struct sec *next;
+
+  /* The field flags contains attributes of the section. Some
+     flags are read in from the object file, and some are
+     synthesized from other information.  */
+  flagword flags;
+
+#define SEC_NO_FLAGS   0x000
+
+  /* Tells the OS to allocate space for this section when loading.
+     This is clear for a section containing debug information only.  */
+#define SEC_ALLOC      0x001
+
+  /* Tells the OS to load the section from the file when loading.
+     This is clear for a .bss section.  */
+#define SEC_LOAD       0x002
+
+  /* The section contains data still to be relocated, so there is
+     some relocation information too.  */
+#define SEC_RELOC      0x004
+
+  /* ELF reserves 4 processor specific bits and 8 operating system
+     specific bits in sh_flags; at present we can get away with just
+     one in communicating between the assembler and BFD, but this
+     isn't a good long-term solution.  */
+#define SEC_ARCH_BIT_0 0x008
+
+  /* A signal to the OS that the section contains read only data.  */
+#define SEC_READONLY   0x010
+
+  /* The section contains code only.  */
+#define SEC_CODE       0x020
+
+  /* The section contains data only.  */
+#define SEC_DATA       0x040
+
+  /* The section will reside in ROM.  */
+#define SEC_ROM        0x080
+
+  /* The section contains constructor information. This section
+     type is used by the linker to create lists of constructors and
+     destructors used by <<g++>>. When a back end sees a symbol
+     which should be used in a constructor list, it creates a new
+     section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
+     the symbol to it, and builds a relocation. To build the lists
+     of constructors, all the linker has to do is catenate all the
+     sections called <<__CTOR_LIST__>> and relocate the data
+     contained within - exactly the operations it would peform on
+     standard data.  */
+#define SEC_CONSTRUCTOR 0x100
+
+  /* The section has contents - a data section could be
+     <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
+     <<SEC_HAS_CONTENTS>>  */
+#define SEC_HAS_CONTENTS 0x200
+
+  /* An instruction to the linker to not output the section
+     even if it has information which would normally be written.  */
+#define SEC_NEVER_LOAD 0x400
+
+  /* The section is a COFF shared library section.  This flag is
+     only for the linker.  If this type of section appears in
+     the input file, the linker must copy it to the output file
+     without changing the vma or size.  FIXME: Although this
+     was originally intended to be general, it really is COFF
+     specific (and the flag was renamed to indicate this).  It
+     might be cleaner to have some more general mechanism to
+     allow the back end to control what the linker does with
+     sections.  */
+#define SEC_COFF_SHARED_LIBRARY 0x800
+
+  /* The section contains thread local data.  */
+#define SEC_THREAD_LOCAL 0x1000
+
+  /* The section has GOT references.  This flag is only for the
+     linker, and is currently only used by the elf32-hppa back end.
+     It will be set if global offset table references were detected
+     in this section, which indicate to the linker that the section
+     contains PIC code, and must be handled specially when doing a
+     static link.  */
+#define SEC_HAS_GOT_REF 0x4000
+
+  /* The section contains common symbols (symbols may be defined
+     multiple times, the value of a symbol is the amount of
+     space it requires, and the largest symbol value is the one
+     used).  Most targets have exactly one of these (which we
+     translate to bfd_com_section_ptr), but ECOFF has two.  */
+#define SEC_IS_COMMON 0x8000
+
+  /* The section contains only debugging information.  For
+     example, this is set for ELF .debug and .stab sections.
+     strip tests this flag to see if a section can be
+     discarded.  */
+#define SEC_DEBUGGING 0x10000
+
+  /* The contents of this section are held in memory pointed to
+     by the contents field.  This is checked by bfd_get_section_contents,
+     and the data is retrieved from memory if appropriate.  */
+#define SEC_IN_MEMORY 0x20000
+
+  /* The contents of this section are to be excluded by the
+     linker for executable and shared objects unless those
+     objects are to be further relocated.  */
+#define SEC_EXCLUDE 0x40000
+
+  /* The contents of this section are to be sorted based on the sum of
+     the symbol and addend values specified by the associated relocation
+     entries.  Entries without associated relocation entries will be
+     appended to the end of the section in an unspecified order.  */
+#define SEC_SORT_ENTRIES 0x80000
+
+  /* When linking, duplicate sections of the same name should be
+     discarded, rather than being combined into a single section as
+     is usually done.  This is similar to how common symbols are
+     handled.  See SEC_LINK_DUPLICATES below.  */
+#define SEC_LINK_ONCE 0x100000
+
+  /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
+     should handle duplicate sections.  */
+#define SEC_LINK_DUPLICATES 0x600000
+
+  /* This value for SEC_LINK_DUPLICATES means that duplicate
+     sections with the same name should simply be discarded.  */
+#define SEC_LINK_DUPLICATES_DISCARD 0x0
+
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if there are any duplicate sections, although
+     it should still only link one copy.  */
+#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
+
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if any duplicate sections are a different size.  */
+#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
+
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if any duplicate sections contain different
+     contents.  */
+#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
+
+  /* This section was created by the linker as part of dynamic
+     relocation or other arcane processing.  It is skipped when
+     going through the first-pass output, trusting that someone
+     else up the line will take care of it later.  */
+#define SEC_LINKER_CREATED 0x800000
+
+  /* This section should not be subject to garbage collection.  */
+#define SEC_KEEP 0x1000000
+
+  /* This section contains "short" data, and should be placed
+     "near" the GP.  */
+#define SEC_SMALL_DATA 0x2000000
+
+  /* This section contains data which may be shared with other
+     executables or shared objects.  */
+#define SEC_SHARED 0x4000000
+
+  /* When a section with this flag is being linked, then if the size of
+     the input section is less than a page, it should not cross a page
+     boundary.  If the size of the input section is one page or more, it
+     should be aligned on a page boundary.  */
+#define SEC_BLOCK 0x8000000
+
+  /* Conditionally link this section; do not link if there are no
+     references found to any symbol in the section.  */
+#define SEC_CLINK 0x10000000
+
+  /* Attempt to merge identical entities in the section.
+     Entity size is given in the entsize field.  */
+#define SEC_MERGE 0x20000000
+
+  /* If given with SEC_MERGE, entities to merge are zero terminated
+     strings where entsize specifies character size instead of fixed
+     size entries.  */
+#define SEC_STRINGS 0x40000000
+
+  /* This section contains data about section groups.  */
+#define SEC_GROUP 0x80000000
+
+  /*  End of section flags.  */
+
+  /* Some internal packed boolean fields.  */
+
+  /* See the vma field.  */
+  unsigned int user_set_vma : 1;
+
+  /* Whether relocations have been processed.  */
+  unsigned int reloc_done : 1;
+
+  /* A mark flag used by some of the linker backends.  */
+  unsigned int linker_mark : 1;
+
+  /* Another mark flag used by some of the linker backends.  Set for
+     output sections that have an input section.  */
+  unsigned int linker_has_input : 1;
+
+  /* A mark flag used by some linker backends for garbage collection.  */
+  unsigned int gc_mark : 1;
+
+  /* Used by the ELF code to mark sections which have been allocated
+     to segments.  */
+  unsigned int segment_mark : 1;
+
+  /* End of internal packed boolean fields.  */
+
+  /*  The virtual memory address of the section - where it will be
+      at run time.  The symbols are relocated against this.  The
+      user_set_vma flag is maintained by bfd; if it's not set, the
+      backend can assign addresses (for example, in <<a.out>>, where
+      the default address for <<.data>> is dependent on the specific
+      target and various flags).  */
+  bfd_vma vma;
+
+  /*  The load address of the section - where it would be in a
+      rom image; really only used for writing section header
+      information.  */
+  bfd_vma lma;
+
+  /* The size of the section in octets, as it will be output.
+     Contains a value even if the section has no contents (e.g., the
+     size of <<.bss>>).  This will be filled in after relocation.  */
+  bfd_size_type _cooked_size;
+
+  /* The original size on disk of the section, in octets.  Normally this
+     value is the same as the size, but if some relaxing has
+     been done, then this value will be bigger.  */
+  bfd_size_type _raw_size;
+
+  /* If this section is going to be output, then this value is the
+     offset in *bytes* into the output section of the first byte in the
+     input section (byte ==> smallest addressable unit on the
+     target).  In most cases, if this was going to start at the
+     100th octet (8-bit quantity) in the output section, this value
+     would be 100.  However, if the target byte size is 16 bits
+     (bfd_octets_per_byte is "2"), this value would be 50.  */
+  bfd_vma output_offset;
+
+  /* The output section through which to map on output.  */
+  struct sec *output_section;
+
+  /* The alignment requirement of the section, as an exponent of 2 -
+     e.g., 3 aligns to 2^3 (or 8).  */
+  unsigned int alignment_power;
+
+  /* If an input section, a pointer to a vector of relocation
+     records for the data in this section.  */
+  struct reloc_cache_entry *relocation;
+
+  /* If an output section, a pointer to a vector of pointers to
+     relocation records for the data in this section.  */
+  struct reloc_cache_entry **orelocation;
+
+  /* The number of relocation records in one of the above.  */
+  unsigned reloc_count;
+
+  /* Information below is back end specific - and not always used
+     or updated.  */
+
+  /* File position of section data.  */
+  file_ptr filepos;
+
+  /* File position of relocation info.  */
+  file_ptr rel_filepos;
+
+  /* File position of line data.  */
+  file_ptr line_filepos;
+
+  /* Pointer to data for applications.  */
+  PTR userdata;
+
+  /* If the SEC_IN_MEMORY flag is set, this points to the actual
+     contents.  */
+  unsigned char *contents;
+
+  /* Attached line number information.  */
+  alent *lineno;
+
+  /* Number of line number records.  */
+  unsigned int lineno_count;
+
+  /* Entity size for merging purposes.  */
+  unsigned int entsize;
+
+  /* Optional information about a COMDAT entry; NULL if not COMDAT.  */
+  struct bfd_comdat_info *comdat;
+
+  /* When a section is being output, this value changes as more
+     linenumbers are written out.  */
+  file_ptr moving_line_filepos;
+
+  /* What the section number is in the target world.  */
+  int target_index;
+
+  PTR used_by_bfd;
+
+  /* If this is a constructor section then here is a list of the
+     relocations created to relocate items within it.  */
+  struct relent_chain *constructor_chain;
+
+  /* The BFD which owns the section.  */
+  bfd *owner;
+
+  /* A symbol which points at this section only.  */
+  struct symbol_cache_entry *symbol;
+  struct symbol_cache_entry **symbol_ptr_ptr;
+
+  struct bfd_link_order *link_order_head;
+  struct bfd_link_order *link_order_tail;
+} asection;
+
+/* These sections are global, and are managed by BFD.  The application
+   and target back end are not permitted to change the values in
+   these sections.  New code should use the section_ptr macros rather
+   than referring directly to the const sections.  The const sections
+   may eventually vanish.  */
+#define BFD_ABS_SECTION_NAME "*ABS*"
+#define BFD_UND_SECTION_NAME "*UND*"
+#define BFD_COM_SECTION_NAME "*COM*"
+#define BFD_IND_SECTION_NAME "*IND*"
+
+/* The absolute section.  */
+extern const asection bfd_abs_section;
+#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
+#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
+/* Pointer to the undefined section.  */
+extern const asection bfd_und_section;
+#define bfd_und_section_ptr ((asection *) &bfd_und_section)
+#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
+/* Pointer to the common section.  */
+extern const asection bfd_com_section;
+#define bfd_com_section_ptr ((asection *) &bfd_com_section)
+/* Pointer to the indirect section.  */
+extern const asection bfd_ind_section;
+#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
+#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
+
+#define bfd_is_const_section(SEC)              \
+ (   ((SEC) == bfd_abs_section_ptr)            \
+  || ((SEC) == bfd_und_section_ptr)            \
+  || ((SEC) == bfd_com_section_ptr)            \
+  || ((SEC) == bfd_ind_section_ptr))
+
+extern const struct symbol_cache_entry * const bfd_abs_symbol;
+extern const struct symbol_cache_entry * const bfd_com_symbol;
+extern const struct symbol_cache_entry * const bfd_und_symbol;
+extern const struct symbol_cache_entry * const bfd_ind_symbol;
+#define bfd_get_section_size_before_reloc(section) \
+     ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
+                            : (section)->_raw_size)
+#define bfd_get_section_size_after_reloc(section) \
+     ((section)->reloc_done ? (section)->_cooked_size \
+                            : (abort (), (bfd_size_type) 1))
+
+/* Macros to handle insertion and deletion of a bfd's sections.  These
+   only handle the list pointers, ie. do not adjust section_count,
+   target_index etc.  */
+#define bfd_section_list_remove(ABFD, PS) \
+  do                                                   \
+    {                                                  \
+      asection **_ps = PS;                             \
+      asection *_s = *_ps;                             \
+      *_ps = _s->next;                                 \
+      if (_s->next == NULL)                            \
+        (ABFD)->section_tail = _ps;                    \
+    }                                                  \
+  while (0)
+#define bfd_section_list_insert(ABFD, PS, S) \
+  do                                                   \
+    {                                                  \
+      asection **_ps = PS;                             \
+      asection *_s = S;                                \
+      _s->next = *_ps;                                 \
+      *_ps = _s;                                       \
+      if (_s->next == NULL)                            \
+        (ABFD)->section_tail = &_s->next;              \
+    }                                                  \
+  while (0)
+
+void
+bfd_section_list_clear PARAMS ((bfd *));
+
+asection *
+bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
+
+char *
+bfd_get_unique_section_name PARAMS ((bfd *abfd,
+    const char *templat,
+    int *count));
+
+asection *
+bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name));
+
+asection *
+bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name));
+
+asection *
+bfd_make_section PARAMS ((bfd *, const char *name));
+
+boolean
+bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
+
+void
+bfd_map_over_sections PARAMS ((bfd *abfd,
+    void (*func) (bfd *abfd,
+    asection *sect,
+    PTR obj),
+    PTR obj));
+
+boolean
+bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
+
+boolean
+bfd_set_section_contents PARAMS ((bfd *abfd, asection *section,
+    PTR data, file_ptr offset,
+    bfd_size_type count));
+
+boolean
+bfd_get_section_contents PARAMS ((bfd *abfd, asection *section,
+    PTR location, file_ptr offset,
+    bfd_size_type count));
+
+boolean
+bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec,
+    bfd *obfd, asection *osec));
+
+#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
+     BFD_SEND (obfd, _bfd_copy_private_section_data, \
+               (ibfd, isection, obfd, osection))
+void
+_bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section));
+
+boolean
+bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group));
+
+/* Extracted from archures.c.  */
+enum bfd_architecture
+{
+  bfd_arch_unknown,   /* File arch not known.  */
+  bfd_arch_obscure,   /* Arch known, not one of these.  */
+  bfd_arch_m68k,      /* Motorola 68xxx */
+#define bfd_mach_m68000 1
+#define bfd_mach_m68008 2
+#define bfd_mach_m68010 3
+#define bfd_mach_m68020 4
+#define bfd_mach_m68030 5
+#define bfd_mach_m68040 6
+#define bfd_mach_m68060 7
+#define bfd_mach_cpu32  8
+#define bfd_mach_mcf5200  9
+#define bfd_mach_mcf5206e 10
+#define bfd_mach_mcf5307  11
+#define bfd_mach_mcf5407  12
+  bfd_arch_vax,       /* DEC Vax */
+  bfd_arch_i960,      /* Intel 960 */
+    /* The order of the following is important.
+       lower number indicates a machine type that
+       only accepts a subset of the instructions
+       available to machines with higher numbers.
+       The exception is the "ca", which is
+       incompatible with all other machines except
+       "core".  */
+
+#define bfd_mach_i960_core      1
+#define bfd_mach_i960_ka_sa     2
+#define bfd_mach_i960_kb_sb     3
+#define bfd_mach_i960_mc        4
+#define bfd_mach_i960_xa        5
+#define bfd_mach_i960_ca        6
+#define bfd_mach_i960_jx        7
+#define bfd_mach_i960_hx        8
+
+  bfd_arch_or32,      /* OpenRISC 32 */
+
+  bfd_arch_a29k,      /* AMD 29000 */
+  bfd_arch_sparc,     /* SPARC */
+#define bfd_mach_sparc                 1
+/* The difference between v8plus and v9 is that v9 is a true 64 bit env.  */
+#define bfd_mach_sparc_sparclet        2
+#define bfd_mach_sparc_sparclite       3
+#define bfd_mach_sparc_v8plus          4
+#define bfd_mach_sparc_v8plusa         5 /* with ultrasparc add'ns.  */
+#define bfd_mach_sparc_sparclite_le    6
+#define bfd_mach_sparc_v9              7
+#define bfd_mach_sparc_v9a             8 /* with ultrasparc add'ns.  */
+#define bfd_mach_sparc_v8plusb         9 /* with cheetah add'ns.  */
+#define bfd_mach_sparc_v9b             10 /* with cheetah add'ns.  */
+/* Nonzero if MACH has the v9 instruction set.  */
+#define bfd_mach_sparc_v9_p(mach) \
+  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
+   && (mach) != bfd_mach_sparc_sparclite_le)
+  bfd_arch_mips,      /* MIPS Rxxxx */
+#define bfd_mach_mips3000              3000
+#define bfd_mach_mips3900              3900
+#define bfd_mach_mips4000              4000
+#define bfd_mach_mips4010              4010
+#define bfd_mach_mips4100              4100
+#define bfd_mach_mips4111              4111
+#define bfd_mach_mips4120              4120
+#define bfd_mach_mips4300              4300
+#define bfd_mach_mips4400              4400
+#define bfd_mach_mips4600              4600
+#define bfd_mach_mips4650              4650
+#define bfd_mach_mips5000              5000
+#define bfd_mach_mips5400              5400
+#define bfd_mach_mips5500              5500
+#define bfd_mach_mips6000              6000
+#define bfd_mach_mips8000              8000
+#define bfd_mach_mips10000             10000
+#define bfd_mach_mips12000             12000
+#define bfd_mach_mips16                16
+#define bfd_mach_mips5                 5
+#define bfd_mach_mips_sb1              12310201 /* octal 'SB', 01 */
+#define bfd_mach_mipsisa32             32
+#define bfd_mach_mipsisa64             64
+  bfd_arch_i386,      /* Intel 386 */
+#define bfd_mach_i386_i386 1
+#define bfd_mach_i386_i8086 2
+#define bfd_mach_i386_i386_intel_syntax 3
+#define bfd_mach_x86_64 64
+#define bfd_mach_x86_64_intel_syntax 65
+  bfd_arch_we32k,     /* AT&T WE32xxx */
+  bfd_arch_tahoe,     /* CCI/Harris Tahoe */
+  bfd_arch_i860,      /* Intel 860 */
+  bfd_arch_i370,      /* IBM 360/370 Mainframes */
+  bfd_arch_romp,      /* IBM ROMP PC/RT */
+  bfd_arch_alliant,   /* Alliant */
+  bfd_arch_convex,    /* Convex */
+  bfd_arch_m88k,      /* Motorola 88xxx */
+  bfd_arch_m98k,      /* Motorola 98xxx */
+  bfd_arch_pyramid,   /* Pyramid Technology */
+  bfd_arch_h8300,     /* Hitachi H8/300 */
+#define bfd_mach_h8300   1
+#define bfd_mach_h8300h  2
+#define bfd_mach_h8300s  3
+  bfd_arch_pdp11,     /* DEC PDP-11 */
+  bfd_arch_powerpc,   /* PowerPC */
+#define bfd_mach_ppc           32
+#define bfd_mach_ppc64         64
+#define bfd_mach_ppc_403       403
+#define bfd_mach_ppc_403gc     4030
+#define bfd_mach_ppc_505       505
+#define bfd_mach_ppc_601       601
+#define bfd_mach_ppc_602       602
+#define bfd_mach_ppc_603       603
+#define bfd_mach_ppc_ec603e    6031
+#define bfd_mach_ppc_604       604
+#define bfd_mach_ppc_620       620
+#define bfd_mach_ppc_630       630
+#define bfd_mach_ppc_750       750
+#define bfd_mach_ppc_860       860
+#define bfd_mach_ppc_a35       35
+#define bfd_mach_ppc_rs64ii    642
+#define bfd_mach_ppc_rs64iii   643
+#define bfd_mach_ppc_7400      7400
+#define bfd_mach_ppc_e500      500
+  bfd_arch_rs6000,    /* IBM RS/6000 */
+#define bfd_mach_rs6k          6000
+#define bfd_mach_rs6k_rs1      6001
+#define bfd_mach_rs6k_rsc      6003
+#define bfd_mach_rs6k_rs2      6002
+  bfd_arch_hppa,      /* HP PA RISC */
+  bfd_arch_d10v,      /* Mitsubishi D10V */
+#define bfd_mach_d10v          1
+#define bfd_mach_d10v_ts2      2
+#define bfd_mach_d10v_ts3      3
+  bfd_arch_d30v,      /* Mitsubishi D30V */
+  bfd_arch_dlx,       /* DLX */
+  bfd_arch_m68hc11,   /* Motorola 68HC11 */
+  bfd_arch_m68hc12,   /* Motorola 68HC12 */
+  bfd_arch_z8k,       /* Zilog Z8000 */
+#define bfd_mach_z8001         1
+#define bfd_mach_z8002         2
+  bfd_arch_h8500,     /* Hitachi H8/500 */
+  bfd_arch_sh,        /* Hitachi SH */
+#define bfd_mach_sh            1
+#define bfd_mach_sh2        0x20
+#define bfd_mach_sh_dsp     0x2d
+#define bfd_mach_sh3        0x30
+#define bfd_mach_sh3_dsp    0x3d
+#define bfd_mach_sh3e       0x3e
+#define bfd_mach_sh4        0x40
+#define bfd_mach_sh5        0x50
+  bfd_arch_alpha,     /* Dec Alpha */
+#define bfd_mach_alpha_ev4  0x10
+#define bfd_mach_alpha_ev5  0x20
+#define bfd_mach_alpha_ev6  0x30
+  bfd_arch_arm,       /* Advanced Risc Machines ARM.  */
+#define bfd_mach_arm_2         1
+#define bfd_mach_arm_2a        2
+#define bfd_mach_arm_3         3
+#define bfd_mach_arm_3M        4
+#define bfd_mach_arm_4         5
+#define bfd_mach_arm_4T        6
+#define bfd_mach_arm_5         7
+#define bfd_mach_arm_5T        8
+#define bfd_mach_arm_5TE       9
+#define bfd_mach_arm_XScale    10
+  bfd_arch_ns32k,     /* National Semiconductors ns32000 */
+  bfd_arch_w65,       /* WDC 65816 */
+  bfd_arch_tic30,     /* Texas Instruments TMS320C30 */
+  bfd_arch_tic4x,     /* Texas Instruments TMS320C3X/4X */
+#define bfd_mach_c3x           30
+#define bfd_mach_c4x           40
+  bfd_arch_tic54x,    /* Texas Instruments TMS320C54X */
+  bfd_arch_tic80,     /* TI TMS320c80 (MVP) */
+  bfd_arch_v850,      /* NEC V850 */
+#define bfd_mach_v850          1
+#define bfd_mach_v850e         'E'
+  bfd_arch_arc,       /* ARC Cores */
+#define bfd_mach_arc_5         5
+#define bfd_mach_arc_6         6
+#define bfd_mach_arc_7         7
+#define bfd_mach_arc_8         8
+  bfd_arch_m32r,      /* Mitsubishi M32R/D */
+#define bfd_mach_m32r          1 /* For backwards compatibility.  */
+#define bfd_mach_m32rx         'x'
+  bfd_arch_mn10200,   /* Matsushita MN10200 */
+  bfd_arch_mn10300,   /* Matsushita MN10300 */
+#define bfd_mach_mn10300               300
+#define bfd_mach_am33          330
+  bfd_arch_fr30,
+#define bfd_mach_fr30          0x46523330
+  bfd_arch_frv,
+#define bfd_mach_frv           1
+#define bfd_mach_frvsimple     2
+#define bfd_mach_fr300         300
+#define bfd_mach_fr400         400
+#define bfd_mach_frvtomcat     499     /* fr500 prototype */
+#define bfd_mach_fr500         500
+  bfd_arch_mcore,
+  bfd_arch_ia64,      /* HP/Intel ia64 */
+#define bfd_mach_ia64_elf64    64
+#define bfd_mach_ia64_elf32    32
+  bfd_arch_ip2k,      /* Ubicom IP2K microcontrollers. */
+#define bfd_mach_ip2022        1
+#define bfd_mach_ip2022ext     2
+  bfd_arch_pj,
+  bfd_arch_avr,       /* Atmel AVR microcontrollers.  */
+#define bfd_mach_avr1          1
+#define bfd_mach_avr2          2
+#define bfd_mach_avr3          3
+#define bfd_mach_avr4          4
+#define bfd_mach_avr5          5
+  bfd_arch_cris,      /* Axis CRIS */
+  bfd_arch_s390,      /* IBM s390 */
+#define bfd_mach_s390_31       31
+#define bfd_mach_s390_64       64
+  bfd_arch_openrisc,  /* OpenRISC */
+  bfd_arch_mmix,      /* Donald Knuth's educational processor.  */
+  bfd_arch_xstormy16,
+#define bfd_mach_xstormy16     1
+  bfd_arch_last
+  };
+
+typedef struct bfd_arch_info
+{
+  int bits_per_word;
+  int bits_per_address;
+  int bits_per_byte;
+  enum bfd_architecture arch;
+  unsigned long mach;
+  const char *arch_name;
+  const char *printable_name;
+  unsigned int section_align_power;
+  /* True if this is the default machine for the architecture.
+     The default arch should be the first entry for an arch so that
+     all the entries for that arch can be accessed via <<next>>.  */
+  boolean the_default;
+  const struct bfd_arch_info * (*compatible)
+       PARAMS ((const struct bfd_arch_info *a,
+                const struct bfd_arch_info *b));
+
+  boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
+
+  const struct bfd_arch_info *next;
+}
+bfd_arch_info_type;
+
+const char *
+bfd_printable_name PARAMS ((bfd *abfd));
+
+const bfd_arch_info_type *
+bfd_scan_arch PARAMS ((const char *string));
+
+const char **
+bfd_arch_list PARAMS ((void));
+
+const bfd_arch_info_type *
+bfd_arch_get_compatible PARAMS ((
+    const bfd *abfd,
+    const bfd *bbfd));
+
+void
+bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
+
+enum bfd_architecture
+bfd_get_arch PARAMS ((bfd *abfd));
+
+unsigned long
+bfd_get_mach PARAMS ((bfd *abfd));
+
+unsigned int
+bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
+
+unsigned int
+bfd_arch_bits_per_address PARAMS ((bfd *abfd));
+
+const bfd_arch_info_type *
+bfd_get_arch_info PARAMS ((bfd *abfd));
+
+const bfd_arch_info_type *
+bfd_lookup_arch PARAMS ((enum bfd_architecture
+    arch,
+    unsigned long machine));
+
+const char *
+bfd_printable_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long machine));
+
+unsigned int
+bfd_octets_per_byte PARAMS ((bfd *abfd));
+
+unsigned int
+bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
+    unsigned long machine));
+
+/* Extracted from reloc.c.  */
+typedef enum bfd_reloc_status
+{
+  /* No errors detected.  */
+  bfd_reloc_ok,
+
+  /* The relocation was performed, but there was an overflow.  */
+  bfd_reloc_overflow,
+
+  /* The address to relocate was not within the section supplied.  */
+  bfd_reloc_outofrange,
+
+  /* Used by special functions.  */
+  bfd_reloc_continue,
+
+  /* Unsupported relocation size requested.  */
+  bfd_reloc_notsupported,
+
+  /* Unused.  */
+  bfd_reloc_other,
+
+  /* The symbol to relocate against was undefined.  */
+  bfd_reloc_undefined,
+
+  /* The relocation was performed, but may not be ok - presently
+     generated only when linking i960 coff files with i960 b.out
+     symbols.  If this type is returned, the error_message argument
+     to bfd_perform_relocation will be set.  */
+  bfd_reloc_dangerous
+ }
+ bfd_reloc_status_type;
+
+
+typedef struct reloc_cache_entry
+{
+  /* A pointer into the canonical table of pointers.  */
+  struct symbol_cache_entry **sym_ptr_ptr;
+
+  /* offset in section.  */
+  bfd_size_type address;
+
+  /* addend for relocation value.  */
+  bfd_vma addend;
+
+  /* Pointer to how to perform the required relocation.  */
+  reloc_howto_type *howto;
+
+}
+arelent;
+
+enum complain_overflow
+{
+  /* Do not complain on overflow.  */
+  complain_overflow_dont,
+
+  /* Complain if the bitfield overflows, whether it is considered
+     as signed or unsigned.  */
+  complain_overflow_bitfield,
+
+  /* Complain if the value overflows when considered as signed
+     number.  */
+  complain_overflow_signed,
+
+  /* Complain if the value overflows when considered as an
+     unsigned number.  */
+  complain_overflow_unsigned
+};
+
+struct reloc_howto_struct
+{
+  /*  The type field has mainly a documentary use - the back end can
+      do what it wants with it, though normally the back end's
+      external idea of what a reloc number is stored
+      in this field.  For example, a PC relative word relocation
+      in a coff environment has the type 023 - because that's
+      what the outside world calls a R_PCRWORD reloc.  */
+  unsigned int type;
+
+  /*  The value the final relocation is shifted right by.  This drops
+      unwanted data from the relocation.  */
+  unsigned int rightshift;
+
+  /*  The size of the item to be relocated.  This is *not* a
+      power-of-two measure.  To get the number of bytes operated
+      on by a type of relocation, use bfd_get_reloc_size.  */
+  int size;
+
+  /*  The number of bits in the item to be relocated.  This is used
+      when doing overflow checking.  */
+  unsigned int bitsize;
+
+  /*  Notes that the relocation is relative to the location in the
+      data section of the addend.  The relocation function will
+      subtract from the relocation value the address of the location
+      being relocated.  */
+  boolean pc_relative;
+
+  /*  The bit position of the reloc value in the destination.
+      The relocated value is left shifted by this amount.  */
+  unsigned int bitpos;
+
+  /* What type of overflow error should be checked for when
+     relocating.  */
+  enum complain_overflow complain_on_overflow;
+
+  /* If this field is non null, then the supplied function is
+     called rather than the normal function.  This allows really
+     strange relocation methods to be accomodated (e.g., i960 callj
+     instructions).  */
+  bfd_reloc_status_type (*special_function)
+    PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
+             bfd *, char **));
+
+  /* The textual name of the relocation type.  */
+  char *name;
+
+  /* Some formats record a relocation addend in the section contents
+     rather than with the relocation.  For ELF formats this is the
+     distinction between USE_REL and USE_RELA (though the code checks
+     for USE_REL == 1/0).  The value of this field is TRUE if the
+     addend is recorded with the section contents; when performing a
+     partial link (ld -r) the section contents (the data) will be
+     modified.  The value of this field is FALSE if addends are
+     recorded with the relocation (in arelent.addend); when performing
+     a partial link the relocation will be modified.
+     All relocations for all ELF USE_RELA targets should set this field
+     to FALSE (values of TRUE should be looked on with suspicion).
+     However, the converse is not true: not all relocations of all ELF
+     USE_REL targets set this field to TRUE.  Why this is so is peculiar
+     to each particular target.  For relocs that aren't used in partial
+     links (e.g. GOT stuff) it doesn't matter what this is set to.  */
+  boolean partial_inplace;
+
+  /* The src_mask selects which parts of the read in data
+     are to be used in the relocation sum.  E.g., if this was an 8 bit
+     byte of data which we read and relocated, this would be
+     0x000000ff.  When we have relocs which have an addend, such as
+     sun4 extended relocs, the value in the offset part of a
+     relocating field is garbage so we never use it.  In this case
+     the mask would be 0x00000000.  */
+  bfd_vma src_mask;
+
+  /* The dst_mask selects which parts of the instruction are replaced
+     into the instruction.  In most cases src_mask == dst_mask,
+     except in the above special case, where dst_mask would be
+     0x000000ff, and src_mask would be 0x00000000.  */
+  bfd_vma dst_mask;
+
+  /* When some formats create PC relative instructions, they leave
+     the value of the pc of the place being relocated in the offset
+     slot of the instruction, so that a PC relative relocation can
+     be made just by adding in an ordinary offset (e.g., sun3 a.out).
+     Some formats leave the displacement part of an instruction
+     empty (e.g., m88k bcs); this flag signals the fact.  */
+  boolean pcrel_offset;
+};
+
+#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
+  { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
+#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
+  HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
+         NAME, false, 0, 0, IN)
+
+#define EMPTY_HOWTO(C) \
+  HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \
+         NULL, false, 0, 0, false)
+
+#define HOWTO_PREPARE(relocation, symbol)               \
+  {                                                     \
+    if (symbol != (asymbol *) NULL)                     \
+      {                                                 \
+        if (bfd_is_com_section (symbol->section))       \
+          {                                             \
+            relocation = 0;                             \
+          }                                             \
+        else                                            \
+          {                                             \
+            relocation = symbol->value;                 \
+          }                                             \
+      }                                                 \
+  }
+
+unsigned int
+bfd_get_reloc_size PARAMS ((reloc_howto_type *));
+
+typedef struct relent_chain
+{
+  arelent relent;
+  struct relent_chain *next;
+}
+arelent_chain;
+
+bfd_reloc_status_type
+bfd_check_overflow PARAMS ((enum complain_overflow how,
+    unsigned int bitsize,
+    unsigned int rightshift,
+    unsigned int addrsize,
+    bfd_vma relocation));
+
+bfd_reloc_status_type
+bfd_perform_relocation PARAMS ((bfd *abfd,
+    arelent *reloc_entry,
+    PTR data,
+    asection *input_section,
+    bfd *output_bfd,
+    char **error_message));
+
+bfd_reloc_status_type
+bfd_install_relocation PARAMS ((bfd *abfd,
+    arelent *reloc_entry,
+    PTR data, bfd_vma data_start,
+    asection *input_section,
+    char **error_message));
+
+enum bfd_reloc_code_real {
+  _dummy_first_bfd_reloc_code_real,
+
+
+/* Basic absolute relocations of N bits.  */
+  BFD_RELOC_64,
+  BFD_RELOC_32,
+  BFD_RELOC_26,
+  BFD_RELOC_24,
+  BFD_RELOC_16,
+  BFD_RELOC_14,
+  BFD_RELOC_8,
+
+/* PC-relative relocations.  Sometimes these are relative to the address
+of the relocation itself; sometimes they are relative to the start of
+the section containing the relocation.  It depends on the specific target.
+
+The 24-bit relocation is used in some Intel 960 configurations.  */
+  BFD_RELOC_64_PCREL,
+  BFD_RELOC_32_PCREL,
+  BFD_RELOC_24_PCREL,
+  BFD_RELOC_16_PCREL,
+  BFD_RELOC_12_PCREL,
+  BFD_RELOC_8_PCREL,
+
+/* For ELF.  */
+  BFD_RELOC_32_GOT_PCREL,
+  BFD_RELOC_16_GOT_PCREL,
+  BFD_RELOC_8_GOT_PCREL,
+  BFD_RELOC_32_GOTOFF,
+  BFD_RELOC_16_GOTOFF,
+  BFD_RELOC_LO16_GOTOFF,
+  BFD_RELOC_HI16_GOTOFF,
+  BFD_RELOC_HI16_S_GOTOFF,
+  BFD_RELOC_8_GOTOFF,
+  BFD_RELOC_64_PLT_PCREL,
+  BFD_RELOC_32_PLT_PCREL,
+  BFD_RELOC_24_PLT_PCREL,
+  BFD_RELOC_16_PLT_PCREL,
+  BFD_RELOC_8_PLT_PCREL,
+  BFD_RELOC_64_PLTOFF,
+  BFD_RELOC_32_PLTOFF,
+  BFD_RELOC_16_PLTOFF,
+  BFD_RELOC_LO16_PLTOFF,
+  BFD_RELOC_HI16_PLTOFF,
+  BFD_RELOC_HI16_S_PLTOFF,
+  BFD_RELOC_8_PLTOFF,
+
+/* Relocations used by 68K ELF.  */
+  BFD_RELOC_68K_GLOB_DAT,
+  BFD_RELOC_68K_JMP_SLOT,
+  BFD_RELOC_68K_RELATIVE,
+
+/* Linkage-table relative.  */
+  BFD_RELOC_32_BASEREL,
+  BFD_RELOC_16_BASEREL,
+  BFD_RELOC_LO16_BASEREL,
+  BFD_RELOC_HI16_BASEREL,
+  BFD_RELOC_HI16_S_BASEREL,
+  BFD_RELOC_8_BASEREL,
+  BFD_RELOC_RVA,
+
+/* Absolute 8-bit relocation, but used to form an address like 0xFFnn.  */
+  BFD_RELOC_8_FFnn,
+
+/* These PC-relative relocations are stored as word displacements --
+i.e., byte displacements shifted right two bits.  The 30-bit word
+displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
+SPARC.  (SPARC tools generally refer to this as <<WDISP30>>.)  The
+signed 16-bit displacement is used on the MIPS, and the 23-bit
+displacement is used on the Alpha.  */
+  BFD_RELOC_32_PCREL_S2,
+  BFD_RELOC_16_PCREL_S2,
+  BFD_RELOC_23_PCREL_S2,
+
+/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
+the target word.  These are used on the SPARC.  */
+  BFD_RELOC_HI22,
+  BFD_RELOC_LO10,
+
+/* For systems that allocate a Global Pointer register, these are
+displacements off that register.  These relocation types are
+handled specially, because the value the register will have is
+decided relatively late.  */
+  BFD_RELOC_GPREL16,
+  BFD_RELOC_GPREL32,
+
+/* Reloc types used for i960/b.out.  */
+  BFD_RELOC_I960_CALLJ,
+
+/* SPARC ELF relocations.  There is probably some overlap with other
+relocation types already defined.  */
+  BFD_RELOC_NONE,
+  BFD_RELOC_SPARC_WDISP22,
+  BFD_RELOC_SPARC22,
+  BFD_RELOC_SPARC13,
+  BFD_RELOC_SPARC_GOT10,
+  BFD_RELOC_SPARC_GOT13,
+  BFD_RELOC_SPARC_GOT22,
+  BFD_RELOC_SPARC_PC10,
+  BFD_RELOC_SPARC_PC22,
+  BFD_RELOC_SPARC_WPLT30,
+  BFD_RELOC_SPARC_COPY,
+  BFD_RELOC_SPARC_GLOB_DAT,
+  BFD_RELOC_SPARC_JMP_SLOT,
+  BFD_RELOC_SPARC_RELATIVE,
+  BFD_RELOC_SPARC_UA16,
+  BFD_RELOC_SPARC_UA32,
+  BFD_RELOC_SPARC_UA64,
+
+/* I think these are specific to SPARC a.out (e.g., Sun 4).  */
+  BFD_RELOC_SPARC_BASE13,
+  BFD_RELOC_SPARC_BASE22,
+
+/* SPARC64 relocations  */
+#define BFD_RELOC_SPARC_64 BFD_RELOC_64
+  BFD_RELOC_SPARC_10,
+  BFD_RELOC_SPARC_11,
+  BFD_RELOC_SPARC_OLO10,
+  BFD_RELOC_SPARC_HH22,
+  BFD_RELOC_SPARC_HM10,
+  BFD_RELOC_SPARC_LM22,
+  BFD_RELOC_SPARC_PC_HH22,
+  BFD_RELOC_SPARC_PC_HM10,
+  BFD_RELOC_SPARC_PC_LM22,
+  BFD_RELOC_SPARC_WDISP16,
+  BFD_RELOC_SPARC_WDISP19,
+  BFD_RELOC_SPARC_7,
+  BFD_RELOC_SPARC_6,
+  BFD_RELOC_SPARC_5,
+#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
+  BFD_RELOC_SPARC_PLT32,
+  BFD_RELOC_SPARC_PLT64,
+  BFD_RELOC_SPARC_HIX22,
+  BFD_RELOC_SPARC_LOX10,
+  BFD_RELOC_SPARC_H44,
+  BFD_RELOC_SPARC_M44,
+  BFD_RELOC_SPARC_L44,
+  BFD_RELOC_SPARC_REGISTER,
+
+/* SPARC little endian relocation  */
+  BFD_RELOC_SPARC_REV32,
+
+/* Alpha ECOFF and ELF relocations.  Some of these treat the symbol or
+"addend" in some special way.
+For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
+writing; when reading, it will be the absolute section symbol.  The
+addend is the displacement in bytes of the "lda" instruction from
+the "ldah" instruction (which is at the address of this reloc).  */
+  BFD_RELOC_ALPHA_GPDISP_HI16,
+
+/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
+with GPDISP_HI16 relocs.  The addend is ignored when writing the
+relocations out, and is filled in with the file's GP value on
+reading, for convenience.  */
+  BFD_RELOC_ALPHA_GPDISP_LO16,
+
+/* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
+relocation except that there is no accompanying GPDISP_LO16
+relocation.  */
+  BFD_RELOC_ALPHA_GPDISP,
+
+/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
+the assembler turns it into a LDQ instruction to load the address of
+the symbol, and then fills in a register in the real instruction.
+
+The LITERAL reloc, at the LDQ instruction, refers to the .lita
+section symbol.  The addend is ignored when writing, but is filled
+in with the file's GP value on reading, for convenience, as with the
+GPDISP_LO16 reloc.
+
+The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
+It should refer to the symbol to be referenced, as with 16_GOTOFF,
+but it generates output not based on the position within the .got
+section, but relative to the GP value chosen for the file during the
+final link stage.
+
+The LITUSE reloc, on the instruction using the loaded address, gives
+information to the linker that it might be able to use to optimize
+away some literal section references.  The symbol is ignored (read
+as the absolute section symbol), and the "addend" indicates the type
+of instruction using the register:
+1 - "memory" fmt insn
+2 - byte-manipulation (byte offset reg)
+3 - jsr (target of branch)  */
+  BFD_RELOC_ALPHA_LITERAL,
+  BFD_RELOC_ALPHA_ELF_LITERAL,
+  BFD_RELOC_ALPHA_LITUSE,
+
+/* The HINT relocation indicates a value that should be filled into the
+"hint" field of a jmp/jsr/ret instruction, for possible branch-
+prediction logic which may be provided on some processors.  */
+  BFD_RELOC_ALPHA_HINT,
+
+/* The LINKAGE relocation outputs a linkage pair in the object file,
+which is filled by the linker.  */
+  BFD_RELOC_ALPHA_LINKAGE,
+
+/* The CODEADDR relocation outputs a STO_CA in the object file,
+which is filled by the linker.  */
+  BFD_RELOC_ALPHA_CODEADDR,
+
+/* The GPREL_HI/LO relocations together form a 32-bit offset from the
+GP register.  */
+  BFD_RELOC_ALPHA_GPREL_HI16,
+  BFD_RELOC_ALPHA_GPREL_LO16,
+
+/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must
+share a common GP, and the target address is adjusted for 
+STO_ALPHA_STD_GPLOAD.  */
+  BFD_RELOC_ALPHA_BRSGP,
+
+/* Alpha thread-local storage relocations.  */
+  BFD_RELOC_ALPHA_TLSGD,
+  BFD_RELOC_ALPHA_TLSLDM,
+  BFD_RELOC_ALPHA_DTPMOD64,
+  BFD_RELOC_ALPHA_GOTDTPREL16,
+  BFD_RELOC_ALPHA_DTPREL64,
+  BFD_RELOC_ALPHA_DTPREL_HI16,
+  BFD_RELOC_ALPHA_DTPREL_LO16,
+  BFD_RELOC_ALPHA_DTPREL16,
+  BFD_RELOC_ALPHA_GOTTPREL16,
+  BFD_RELOC_ALPHA_TPREL64,
+  BFD_RELOC_ALPHA_TPREL_HI16,
+  BFD_RELOC_ALPHA_TPREL_LO16,
+  BFD_RELOC_ALPHA_TPREL16,
+
+/* Bits 27..2 of the relocation address shifted right 2 bits;
+simple reloc otherwise.  */
+  BFD_RELOC_MIPS_JMP,
+
+/* The MIPS16 jump instruction.  */
+  BFD_RELOC_MIPS16_JMP,
+
+/* MIPS16 GP relative reloc.  */
+  BFD_RELOC_MIPS16_GPREL,
+
+/* High 16 bits of 32-bit value; simple reloc.  */
+  BFD_RELOC_HI16,
+
+/* High 16 bits of 32-bit value but the low 16 bits will be sign
+extended and added to form the final result.  If the low 16
+bits form a negative number, we need to add one to the high value
+to compensate for the borrow when the low bits are added.  */
+  BFD_RELOC_HI16_S,
+
+/* Low 16 bits.  */
+  BFD_RELOC_LO16,
+
+/* Like BFD_RELOC_HI16_S, but PC relative.  */
+  BFD_RELOC_PCREL_HI16_S,
+
+/* Like BFD_RELOC_LO16, but PC relative.  */
+  BFD_RELOC_PCREL_LO16,
+
+/* Relocation against a MIPS literal section.  */
+  BFD_RELOC_MIPS_LITERAL,
+
+/* MIPS ELF relocations.  */
+  BFD_RELOC_MIPS_GOT16,
+  BFD_RELOC_MIPS_CALL16,
+  BFD_RELOC_MIPS_GOT_HI16,
+  BFD_RELOC_MIPS_GOT_LO16,
+  BFD_RELOC_MIPS_CALL_HI16,
+  BFD_RELOC_MIPS_CALL_LO16,
+  BFD_RELOC_MIPS_SUB,
+  BFD_RELOC_MIPS_GOT_PAGE,
+  BFD_RELOC_MIPS_GOT_OFST,
+  BFD_RELOC_MIPS_GOT_DISP,
+  BFD_RELOC_MIPS_SHIFT5,
+  BFD_RELOC_MIPS_SHIFT6,
+  BFD_RELOC_MIPS_INSERT_A,
+  BFD_RELOC_MIPS_INSERT_B,
+  BFD_RELOC_MIPS_DELETE,
+  BFD_RELOC_MIPS_HIGHEST,
+  BFD_RELOC_MIPS_HIGHER,
+  BFD_RELOC_MIPS_SCN_DISP,
+  BFD_RELOC_MIPS_REL16,
+  BFD_RELOC_MIPS_RELGOT,
+  BFD_RELOC_MIPS_JALR,
+
+/* Fujitsu Frv Relocations.  */
+  BFD_RELOC_FRV_LABEL16,
+  BFD_RELOC_FRV_LABEL24,
+  BFD_RELOC_FRV_LO16,
+  BFD_RELOC_FRV_HI16,
+  BFD_RELOC_FRV_GPREL12,
+  BFD_RELOC_FRV_GPRELU12,
+  BFD_RELOC_FRV_GPREL32,
+  BFD_RELOC_FRV_GPRELHI,
+  BFD_RELOC_FRV_GPRELLO,
+
+
+/* i386/elf relocations  */
+  BFD_RELOC_386_GOT32,
+  BFD_RELOC_386_PLT32,
+  BFD_RELOC_386_COPY,
+  BFD_RELOC_386_GLOB_DAT,
+  BFD_RELOC_386_JUMP_SLOT,
+  BFD_RELOC_386_RELATIVE,
+  BFD_RELOC_386_GOTOFF,
+  BFD_RELOC_386_GOTPC,
+  BFD_RELOC_386_TLS_TPOFF,
+  BFD_RELOC_386_TLS_IE,
+  BFD_RELOC_386_TLS_GOTIE,
+  BFD_RELOC_386_TLS_LE,
+  BFD_RELOC_386_TLS_GD,
+  BFD_RELOC_386_TLS_LDM,
+  BFD_RELOC_386_TLS_LDO_32,
+  BFD_RELOC_386_TLS_IE_32,
+  BFD_RELOC_386_TLS_LE_32,
+  BFD_RELOC_386_TLS_DTPMOD32,
+  BFD_RELOC_386_TLS_DTPOFF32,
+  BFD_RELOC_386_TLS_TPOFF32,
+
+/* x86-64/elf relocations  */
+  BFD_RELOC_X86_64_GOT32,
+  BFD_RELOC_X86_64_PLT32,
+  BFD_RELOC_X86_64_COPY,
+  BFD_RELOC_X86_64_GLOB_DAT,
+  BFD_RELOC_X86_64_JUMP_SLOT,
+  BFD_RELOC_X86_64_RELATIVE,
+  BFD_RELOC_X86_64_GOTPCREL,
+  BFD_RELOC_X86_64_32S,
+  BFD_RELOC_X86_64_DTPMOD64,
+  BFD_RELOC_X86_64_DTPOFF64,
+  BFD_RELOC_X86_64_TPOFF64,
+  BFD_RELOC_X86_64_TLSGD,
+  BFD_RELOC_X86_64_TLSLD,
+  BFD_RELOC_X86_64_DTPOFF32,
+  BFD_RELOC_X86_64_GOTTPOFF,
+  BFD_RELOC_X86_64_TPOFF32,
+
+/* ns32k relocations  */
+  BFD_RELOC_NS32K_IMM_8,
+  BFD_RELOC_NS32K_IMM_16,
+  BFD_RELOC_NS32K_IMM_32,
+  BFD_RELOC_NS32K_IMM_8_PCREL,
+  BFD_RELOC_NS32K_IMM_16_PCREL,
+  BFD_RELOC_NS32K_IMM_32_PCREL,
+  BFD_RELOC_NS32K_DISP_8,
+  BFD_RELOC_NS32K_DISP_16,
+  BFD_RELOC_NS32K_DISP_32,
+  BFD_RELOC_NS32K_DISP_8_PCREL,
+  BFD_RELOC_NS32K_DISP_16_PCREL,
+  BFD_RELOC_NS32K_DISP_32_PCREL,
+
+/* PDP11 relocations  */
+  BFD_RELOC_PDP11_DISP_8_PCREL,
+  BFD_RELOC_PDP11_DISP_6_PCREL,
+
+/* Picojava relocs.  Not all of these appear in object files.  */
+  BFD_RELOC_PJ_CODE_HI16,
+  BFD_RELOC_PJ_CODE_LO16,
+  BFD_RELOC_PJ_CODE_DIR16,
+  BFD_RELOC_PJ_CODE_DIR32,
+  BFD_RELOC_PJ_CODE_REL16,
+  BFD_RELOC_PJ_CODE_REL32,
+
+/* Power(rs6000) and PowerPC relocations.  */
+  BFD_RELOC_PPC_B26,
+  BFD_RELOC_PPC_BA26,
+  BFD_RELOC_PPC_TOC16,
+  BFD_RELOC_PPC_B16,
+  BFD_RELOC_PPC_B16_BRTAKEN,
+  BFD_RELOC_PPC_B16_BRNTAKEN,
+  BFD_RELOC_PPC_BA16,
+  BFD_RELOC_PPC_BA16_BRTAKEN,
+  BFD_RELOC_PPC_BA16_BRNTAKEN,
+  BFD_RELOC_PPC_COPY,
+  BFD_RELOC_PPC_GLOB_DAT,
+  BFD_RELOC_PPC_JMP_SLOT,
+  BFD_RELOC_PPC_RELATIVE,
+  BFD_RELOC_PPC_LOCAL24PC,
+  BFD_RELOC_PPC_EMB_NADDR32,
+  BFD_RELOC_PPC_EMB_NADDR16,
+  BFD_RELOC_PPC_EMB_NADDR16_LO,
+  BFD_RELOC_PPC_EMB_NADDR16_HI,
+  BFD_RELOC_PPC_EMB_NADDR16_HA,
+  BFD_RELOC_PPC_EMB_SDAI16,
+  BFD_RELOC_PPC_EMB_SDA2I16,
+  BFD_RELOC_PPC_EMB_SDA2REL,
+  BFD_RELOC_PPC_EMB_SDA21,
+  BFD_RELOC_PPC_EMB_MRKREF,
+  BFD_RELOC_PPC_EMB_RELSEC16,
+  BFD_RELOC_PPC_EMB_RELST_LO,
+  BFD_RELOC_PPC_EMB_RELST_HI,
+  BFD_RELOC_PPC_EMB_RELST_HA,
+  BFD_RELOC_PPC_EMB_BIT_FLD,
+  BFD_RELOC_PPC_EMB_RELSDA,
+  BFD_RELOC_PPC64_HIGHER,
+  BFD_RELOC_PPC64_HIGHER_S,
+  BFD_RELOC_PPC64_HIGHEST,
+  BFD_RELOC_PPC64_HIGHEST_S,
+  BFD_RELOC_PPC64_TOC16_LO,
+  BFD_RELOC_PPC64_TOC16_HI,
+  BFD_RELOC_PPC64_TOC16_HA,
+  BFD_RELOC_PPC64_TOC,
+  BFD_RELOC_PPC64_PLTGOT16,
+  BFD_RELOC_PPC64_PLTGOT16_LO,
+  BFD_RELOC_PPC64_PLTGOT16_HI,
+  BFD_RELOC_PPC64_PLTGOT16_HA,
+  BFD_RELOC_PPC64_ADDR16_DS,
+  BFD_RELOC_PPC64_ADDR16_LO_DS,
+  BFD_RELOC_PPC64_GOT16_DS,
+  BFD_RELOC_PPC64_GOT16_LO_DS,
+  BFD_RELOC_PPC64_PLT16_LO_DS,
+  BFD_RELOC_PPC64_SECTOFF_DS,
+  BFD_RELOC_PPC64_SECTOFF_LO_DS,
+  BFD_RELOC_PPC64_TOC16_DS,
+  BFD_RELOC_PPC64_TOC16_LO_DS,
+  BFD_RELOC_PPC64_PLTGOT16_DS,
+  BFD_RELOC_PPC64_PLTGOT16_LO_DS,
+
+/* IBM 370/390 relocations  */
+  BFD_RELOC_I370_D12,
+
+/* The type of reloc used to build a contructor table - at the moment
+probably a 32 bit wide absolute relocation, but the target can choose.
+It generally does map to one of the other relocation types.  */
+  BFD_RELOC_CTOR,
+
+/* ARM 26 bit pc-relative branch.  The lowest two bits must be zero and are
+not stored in the instruction.  */
+  BFD_RELOC_ARM_PCREL_BRANCH,
+
+/* ARM 26 bit pc-relative branch.  The lowest bit must be zero and is
+not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
+field in the instruction.  */
+  BFD_RELOC_ARM_PCREL_BLX,
+
+/* Thumb 22 bit pc-relative branch.  The lowest bit must be zero and is
+not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
+field in the instruction.  */
+  BFD_RELOC_THUMB_PCREL_BLX,
+
+/* These relocs are only used within the ARM assembler.  They are not
+(at present) written to any object files.  */
+  BFD_RELOC_ARM_IMMEDIATE,
+  BFD_RELOC_ARM_ADRL_IMMEDIATE,
+  BFD_RELOC_ARM_OFFSET_IMM,
+  BFD_RELOC_ARM_SHIFT_IMM,
+  BFD_RELOC_ARM_SWI,
+  BFD_RELOC_ARM_MULTI,
+  BFD_RELOC_ARM_CP_OFF_IMM,
+  BFD_RELOC_ARM_ADR_IMM,
+  BFD_RELOC_ARM_LDR_IMM,
+  BFD_RELOC_ARM_LITERAL,
+  BFD_RELOC_ARM_IN_POOL,
+  BFD_RELOC_ARM_OFFSET_IMM8,
+  BFD_RELOC_ARM_HWLITERAL,
+  BFD_RELOC_ARM_THUMB_ADD,
+  BFD_RELOC_ARM_THUMB_IMM,
+  BFD_RELOC_ARM_THUMB_SHIFT,
+  BFD_RELOC_ARM_THUMB_OFFSET,
+  BFD_RELOC_ARM_GOT12,
+  BFD_RELOC_ARM_GOT32,
+  BFD_RELOC_ARM_JUMP_SLOT,
+  BFD_RELOC_ARM_COPY,
+  BFD_RELOC_ARM_GLOB_DAT,
+  BFD_RELOC_ARM_PLT32,
+  BFD_RELOC_ARM_RELATIVE,
+  BFD_RELOC_ARM_GOTOFF,
+  BFD_RELOC_ARM_GOTPC,
+
+/* Hitachi SH relocs.  Not all of these appear in object files.  */
+  BFD_RELOC_SH_PCDISP8BY2,
+  BFD_RELOC_SH_PCDISP12BY2,
+  BFD_RELOC_SH_IMM4,
+  BFD_RELOC_SH_IMM4BY2,
+  BFD_RELOC_SH_IMM4BY4,
+  BFD_RELOC_SH_IMM8,
+  BFD_RELOC_SH_IMM8BY2,
+  BFD_RELOC_SH_IMM8BY4,
+  BFD_RELOC_SH_PCRELIMM8BY2,
+  BFD_RELOC_SH_PCRELIMM8BY4,
+  BFD_RELOC_SH_SWITCH16,
+  BFD_RELOC_SH_SWITCH32,
+  BFD_RELOC_SH_USES,
+  BFD_RELOC_SH_COUNT,
+  BFD_RELOC_SH_ALIGN,
+  BFD_RELOC_SH_CODE,
+  BFD_RELOC_SH_DATA,
+  BFD_RELOC_SH_LABEL,
+  BFD_RELOC_SH_LOOP_START,
+  BFD_RELOC_SH_LOOP_END,
+  BFD_RELOC_SH_COPY,
+  BFD_RELOC_SH_GLOB_DAT,
+  BFD_RELOC_SH_JMP_SLOT,
+  BFD_RELOC_SH_RELATIVE,
+  BFD_RELOC_SH_GOTPC,
+  BFD_RELOC_SH_GOT_LOW16,
+  BFD_RELOC_SH_GOT_MEDLOW16,
+  BFD_RELOC_SH_GOT_MEDHI16,
+  BFD_RELOC_SH_GOT_HI16,
+  BFD_RELOC_SH_GOTPLT_LOW16,
+  BFD_RELOC_SH_GOTPLT_MEDLOW16,
+  BFD_RELOC_SH_GOTPLT_MEDHI16,
+  BFD_RELOC_SH_GOTPLT_HI16,
+  BFD_RELOC_SH_PLT_LOW16,
+  BFD_RELOC_SH_PLT_MEDLOW16,
+  BFD_RELOC_SH_PLT_MEDHI16,
+  BFD_RELOC_SH_PLT_HI16,
+  BFD_RELOC_SH_GOTOFF_LOW16,
+  BFD_RELOC_SH_GOTOFF_MEDLOW16,
+  BFD_RELOC_SH_GOTOFF_MEDHI16,
+  BFD_RELOC_SH_GOTOFF_HI16,
+  BFD_RELOC_SH_GOTPC_LOW16,
+  BFD_RELOC_SH_GOTPC_MEDLOW16,
+  BFD_RELOC_SH_GOTPC_MEDHI16,
+  BFD_RELOC_SH_GOTPC_HI16,
+  BFD_RELOC_SH_COPY64,
+  BFD_RELOC_SH_GLOB_DAT64,
+  BFD_RELOC_SH_JMP_SLOT64,
+  BFD_RELOC_SH_RELATIVE64,
+  BFD_RELOC_SH_GOT10BY4,
+  BFD_RELOC_SH_GOT10BY8,
+  BFD_RELOC_SH_GOTPLT10BY4,
+  BFD_RELOC_SH_GOTPLT10BY8,
+  BFD_RELOC_SH_GOTPLT32,
+  BFD_RELOC_SH_SHMEDIA_CODE,
+  BFD_RELOC_SH_IMMU5,
+  BFD_RELOC_SH_IMMS6,
+  BFD_RELOC_SH_IMMS6BY32,
+  BFD_RELOC_SH_IMMU6,
+  BFD_RELOC_SH_IMMS10,
+  BFD_RELOC_SH_IMMS10BY2,
+  BFD_RELOC_SH_IMMS10BY4,
+  BFD_RELOC_SH_IMMS10BY8,
+  BFD_RELOC_SH_IMMS16,
+  BFD_RELOC_SH_IMMU16,
+  BFD_RELOC_SH_IMM_LOW16,
+  BFD_RELOC_SH_IMM_LOW16_PCREL,
+  BFD_RELOC_SH_IMM_MEDLOW16,
+  BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
+  BFD_RELOC_SH_IMM_MEDHI16,
+  BFD_RELOC_SH_IMM_MEDHI16_PCREL,
+  BFD_RELOC_SH_IMM_HI16,
+  BFD_RELOC_SH_IMM_HI16_PCREL,
+  BFD_RELOC_SH_PT_16,
+  BFD_RELOC_SH_TLS_GD_32,
+  BFD_RELOC_SH_TLS_LD_32,
+  BFD_RELOC_SH_TLS_LDO_32,
+  BFD_RELOC_SH_TLS_IE_32,
+  BFD_RELOC_SH_TLS_LE_32,
+  BFD_RELOC_SH_TLS_DTPMOD32,
+  BFD_RELOC_SH_TLS_DTPOFF32,
+  BFD_RELOC_SH_TLS_TPOFF32,
+
+/* Thumb 23-, 12- and 9-bit pc-relative branches.  The lowest bit must
+be zero and is not stored in the instruction.  */
+  BFD_RELOC_THUMB_PCREL_BRANCH9,
+  BFD_RELOC_THUMB_PCREL_BRANCH12,
+  BFD_RELOC_THUMB_PCREL_BRANCH23,
+
+/* ARC Cores relocs.
+ARC 22 bit pc-relative branch.  The lowest two bits must be zero and are
+not stored in the instruction.  The high 20 bits are installed in bits 26
+through 7 of the instruction.  */
+  BFD_RELOC_ARC_B22_PCREL,
+
+/* ARC 26 bit absolute branch.  The lowest two bits must be zero and are not
+stored in the instruction.  The high 24 bits are installed in bits 23
+through 0.  */
+  BFD_RELOC_ARC_B26,
+
+/* Mitsubishi D10V relocs.
+This is a 10-bit reloc with the right 2 bits
+assumed to be 0.  */
+  BFD_RELOC_D10V_10_PCREL_R,
+
+/* Mitsubishi D10V relocs.
+This is a 10-bit reloc with the right 2 bits
+assumed to be 0.  This is the same as the previous reloc
+except it is in the left container, i.e.,
+shifted left 15 bits.  */
+  BFD_RELOC_D10V_10_PCREL_L,
+
+/* This is an 18-bit reloc with the right 2 bits
+assumed to be 0.  */
+  BFD_RELOC_D10V_18,
+
+/* This is an 18-bit reloc with the right 2 bits
+assumed to be 0.  */
+  BFD_RELOC_D10V_18_PCREL,
+
+/* Mitsubishi D30V relocs.
+This is a 6-bit absolute reloc.  */
+  BFD_RELOC_D30V_6,
+
+/* This is a 6-bit pc-relative reloc with
+the right 3 bits assumed to be 0.  */
+  BFD_RELOC_D30V_9_PCREL,
+
+/* This is a 6-bit pc-relative reloc with
+the right 3 bits assumed to be 0. Same
+as the previous reloc but on the right side
+of the container.  */
+  BFD_RELOC_D30V_9_PCREL_R,
+
+/* This is a 12-bit absolute reloc with the
+right 3 bitsassumed to be 0.  */
+  BFD_RELOC_D30V_15,
+
+/* This is a 12-bit pc-relative reloc with
+the right 3 bits assumed to be 0.  */
+  BFD_RELOC_D30V_15_PCREL,
+
+/* This is a 12-bit pc-relative reloc with
+the right 3 bits assumed to be 0. Same
+as the previous reloc but on the right side
+of the container.  */
+  BFD_RELOC_D30V_15_PCREL_R,
+
+/* This is an 18-bit absolute reloc with
+the right 3 bits assumed to be 0.  */
+  BFD_RELOC_D30V_21,
+
+/* This is an 18-bit pc-relative reloc with
+the right 3 bits assumed to be 0.  */
+  BFD_RELOC_D30V_21_PCREL,
+
+/* This is an 18-bit pc-relative reloc with
+the right 3 bits assumed to be 0. Same
+as the previous reloc but on the right side
+of the container.  */
+  BFD_RELOC_D30V_21_PCREL_R,
+
+/* This is a 32-bit absolute reloc.  */
+  BFD_RELOC_D30V_32,
+
+/* This is a 32-bit pc-relative reloc.  */
+  BFD_RELOC_D30V_32_PCREL,
+
+/* DLX relocs  */
+  BFD_RELOC_DLX_HI16_S,
+
+/* DLX relocs  */
+  BFD_RELOC_DLX_LO16,
+
+/* DLX relocs  */
+  BFD_RELOC_DLX_JMP26,
+
+/* Mitsubishi M32R relocs.
+This is a 24 bit absolute address.  */
+  BFD_RELOC_M32R_24,
+
+/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0.  */
+  BFD_RELOC_M32R_10_PCREL,
+
+/* This is an 18-bit reloc with the right 2 bits assumed to be 0.  */
+  BFD_RELOC_M32R_18_PCREL,
+
+/* This is a 26-bit reloc with the right 2 bits assumed to be 0.  */
+  BFD_RELOC_M32R_26_PCREL,
+
+/* This is a 16-bit reloc containing the high 16 bits of an address
+used when the lower 16 bits are treated as unsigned.  */
+  BFD_RELOC_M32R_HI16_ULO,
+
+/* This is a 16-bit reloc containing the high 16 bits of an address
+used when the lower 16 bits are treated as signed.  */
+  BFD_RELOC_M32R_HI16_SLO,
+
+/* This is a 16-bit reloc containing the lower 16 bits of an address.  */
+  BFD_RELOC_M32R_LO16,
+
+/* This is a 16-bit reloc containing the small data area offset for use in
+add3, load, and store instructions.  */
+  BFD_RELOC_M32R_SDA16,
+
+/* This is a 9-bit reloc  */
+  BFD_RELOC_V850_9_PCREL,
+
+/* This is a 22-bit reloc  */
+  BFD_RELOC_V850_22_PCREL,
+
+/* This is a 16 bit offset from the short data area pointer.  */
+  BFD_RELOC_V850_SDA_16_16_OFFSET,
+
+/* This is a 16 bit offset (of which only 15 bits are used) from the
+short data area pointer.  */
+  BFD_RELOC_V850_SDA_15_16_OFFSET,
+
+/* This is a 16 bit offset from the zero data area pointer.  */
+  BFD_RELOC_V850_ZDA_16_16_OFFSET,
+
+/* This is a 16 bit offset (of which only 15 bits are used) from the
+zero data area pointer.  */
+  BFD_RELOC_V850_ZDA_15_16_OFFSET,
+
+/* This is an 8 bit offset (of which only 6 bits are used) from the
+tiny data area pointer.  */
+  BFD_RELOC_V850_TDA_6_8_OFFSET,
+
+/* This is an 8bit offset (of which only 7 bits are used) from the tiny
+data area pointer.  */
+  BFD_RELOC_V850_TDA_7_8_OFFSET,
+
+/* This is a 7 bit offset from the tiny data area pointer.  */
+  BFD_RELOC_V850_TDA_7_7_OFFSET,
+
+/* This is a 16 bit offset from the tiny data area pointer.  */
+  BFD_RELOC_V850_TDA_16_16_OFFSET,
+
+/* This is a 5 bit offset (of which only 4 bits are used) from the tiny
+data area pointer.  */
+  BFD_RELOC_V850_TDA_4_5_OFFSET,
+
+/* This is a 4 bit offset from the tiny data area pointer.  */
+  BFD_RELOC_V850_TDA_4_4_OFFSET,
+
+/* This is a 16 bit offset from the short data area pointer, with the
+bits placed non-contigously in the instruction.  */
+  BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
+
+/* This is a 16 bit offset from the zero data area pointer, with the
+bits placed non-contigously in the instruction.  */
+  BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
+
+/* This is a 6 bit offset from the call table base pointer.  */
+  BFD_RELOC_V850_CALLT_6_7_OFFSET,
+
+/* This is a 16 bit offset from the call table base pointer.  */
+  BFD_RELOC_V850_CALLT_16_16_OFFSET,
+
+/* Used for relaxing indirect function calls.  */
+  BFD_RELOC_V850_LONGCALL,
+
+/* Used for relaxing indirect jumps.  */
+  BFD_RELOC_V850_LONGJUMP,
+
+/* Used to maintain alignment whilst relaxing.  */
+  BFD_RELOC_V850_ALIGN,
+
+/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
+instruction.  */
+  BFD_RELOC_MN10300_32_PCREL,
+
+/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
+instruction.  */
+  BFD_RELOC_MN10300_16_PCREL,
+
+/* This is a 8bit DP reloc for the tms320c30, where the most
+significant 8 bits of a 24 bit word are placed into the least
+significant 8 bits of the opcode.  */
+  BFD_RELOC_TIC30_LDP,
+
+/* This is a 7bit reloc for the tms320c54x, where the least
+significant 7 bits of a 16 bit word are placed into the least
+significant 7 bits of the opcode.  */
+  BFD_RELOC_TIC54X_PARTLS7,
+
+/* This is a 9bit DP reloc for the tms320c54x, where the most
+significant 9 bits of a 16 bit word are placed into the least
+significant 9 bits of the opcode.  */
+  BFD_RELOC_TIC54X_PARTMS9,
+
+/* This is an extended address 23-bit reloc for the tms320c54x.  */
+  BFD_RELOC_TIC54X_23,
+
+/* This is a 16-bit reloc for the tms320c54x, where the least
+significant 16 bits of a 23-bit extended address are placed into
+the opcode.  */
+  BFD_RELOC_TIC54X_16_OF_23,
+
+/* This is a reloc for the tms320c54x, where the most
+significant 7 bits of a 23-bit extended address are placed into
+the opcode.  */
+  BFD_RELOC_TIC54X_MS7_OF_23,
+
+/* This is a 48 bit reloc for the FR30 that stores 32 bits.  */
+  BFD_RELOC_FR30_48,
+
+/* This is a 32 bit reloc for the FR30 that stores 20 bits split up into
+two sections.  */
+  BFD_RELOC_FR30_20,
+
+/* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
+4 bits.  */
+  BFD_RELOC_FR30_6_IN_4,
+
+/* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
+into 8 bits.  */
+  BFD_RELOC_FR30_8_IN_8,
+
+/* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
+into 8 bits.  */
+  BFD_RELOC_FR30_9_IN_8,
+
+/* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
+into 8 bits.  */
+  BFD_RELOC_FR30_10_IN_8,
+
+/* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
+short offset into 8 bits.  */
+  BFD_RELOC_FR30_9_PCREL,
+
+/* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
+short offset into 11 bits.  */
+  BFD_RELOC_FR30_12_PCREL,
+
+/* Motorola Mcore relocations.  */
+  BFD_RELOC_MCORE_PCREL_IMM8BY4,
+  BFD_RELOC_MCORE_PCREL_IMM11BY2,
+  BFD_RELOC_MCORE_PCREL_IMM4BY2,
+  BFD_RELOC_MCORE_PCREL_32,
+  BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
+  BFD_RELOC_MCORE_RVA,
+
+/* These are relocations for the GETA instruction.  */
+  BFD_RELOC_MMIX_GETA,
+  BFD_RELOC_MMIX_GETA_1,
+  BFD_RELOC_MMIX_GETA_2,
+  BFD_RELOC_MMIX_GETA_3,
+
+/* These are relocations for a conditional branch instruction.  */
+  BFD_RELOC_MMIX_CBRANCH,
+  BFD_RELOC_MMIX_CBRANCH_J,
+  BFD_RELOC_MMIX_CBRANCH_1,
+  BFD_RELOC_MMIX_CBRANCH_2,
+  BFD_RELOC_MMIX_CBRANCH_3,
+
+/* These are relocations for the PUSHJ instruction.  */
+  BFD_RELOC_MMIX_PUSHJ,
+  BFD_RELOC_MMIX_PUSHJ_1,
+  BFD_RELOC_MMIX_PUSHJ_2,
+  BFD_RELOC_MMIX_PUSHJ_3,
+
+/* These are relocations for the JMP instruction.  */
+  BFD_RELOC_MMIX_JMP,
+  BFD_RELOC_MMIX_JMP_1,
+  BFD_RELOC_MMIX_JMP_2,
+  BFD_RELOC_MMIX_JMP_3,
+
+/* This is a relocation for a relative address as in a GETA instruction or
+a branch.  */
+  BFD_RELOC_MMIX_ADDR19,
+
+/* This is a relocation for a relative address as in a JMP instruction.  */
+  BFD_RELOC_MMIX_ADDR27,
+
+/* This is a relocation for an instruction field that may be a general
+register or a value 0..255.  */
+  BFD_RELOC_MMIX_REG_OR_BYTE,
+
+/* This is a relocation for an instruction field that may be a general
+register.  */
+  BFD_RELOC_MMIX_REG,
+
+/* This is a relocation for two instruction fields holding a register and
+an offset, the equivalent of the relocation.  */
+  BFD_RELOC_MMIX_BASE_PLUS_OFFSET,
+
+/* This relocation is an assertion that the expression is not allocated as
+a global register.  It does not modify contents.  */
+  BFD_RELOC_MMIX_LOCAL,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
+short offset into 7 bits.  */
+  BFD_RELOC_AVR_7_PCREL,
+
+/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
+short offset into 12 bits.  */
+  BFD_RELOC_AVR_13_PCREL,
+
+/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
+program memory address) into 16 bits.  */
+  BFD_RELOC_AVR_16_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
+data memory address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_LO8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+of data memory address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_HI8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+of program memory address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_HH8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(usually data memory address) into 8 bit immediate value of SUBI insn.  */
+  BFD_RELOC_AVR_LO8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 8 bit of data memory address) into 8 bit immediate value of
+SUBI insn.  */
+  BFD_RELOC_AVR_HI8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(most high 8 bit of program memory address) into 8 bit immediate value
+of LDI or SUBI insn.  */
+  BFD_RELOC_AVR_HH8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
+command address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_LO8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+of command address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_HI8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+of command address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_HH8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(usually command address) into 8 bit immediate value of SUBI insn.  */
+  BFD_RELOC_AVR_LO8_LDI_PM_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 8 bit of 16 bit command address) into 8 bit immediate value
+of SUBI insn.  */
+  BFD_RELOC_AVR_HI8_LDI_PM_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 6 bit of 22 bit command address) into 8 bit immediate
+value of SUBI insn.  */
+  BFD_RELOC_AVR_HH8_LDI_PM_NEG,
+
+/* This is a 32 bit reloc for the AVR that stores 23 bit value
+into 22 bits.  */
+  BFD_RELOC_AVR_CALL,
+
+/* Direct 12 bit.  */
+  BFD_RELOC_390_12,
+
+/* 12 bit GOT offset.  */
+  BFD_RELOC_390_GOT12,
+
+/* 32 bit PC relative PLT address.  */
+  BFD_RELOC_390_PLT32,
+
+/* Copy symbol at runtime.  */
+  BFD_RELOC_390_COPY,
+
+/* Create GOT entry.  */
+  BFD_RELOC_390_GLOB_DAT,
+
+/* Create PLT entry.  */
+  BFD_RELOC_390_JMP_SLOT,
+
+/* Adjust by program base.  */
+  BFD_RELOC_390_RELATIVE,
+
+/* 32 bit PC relative offset to GOT.  */
+  BFD_RELOC_390_GOTPC,
+
+/* 16 bit GOT offset.  */
+  BFD_RELOC_390_GOT16,
+
+/* PC relative 16 bit shifted by 1.  */
+  BFD_RELOC_390_PC16DBL,
+
+/* 16 bit PC rel. PLT shifted by 1.  */
+  BFD_RELOC_390_PLT16DBL,
+
+/* PC relative 32 bit shifted by 1.  */
+  BFD_RELOC_390_PC32DBL,
+
+/* 32 bit PC rel. PLT shifted by 1.  */
+  BFD_RELOC_390_PLT32DBL,
+
+/* 32 bit PC rel. GOT shifted by 1.  */
+  BFD_RELOC_390_GOTPCDBL,
+
+/* 64 bit GOT offset.  */
+  BFD_RELOC_390_GOT64,
+
+/* 64 bit PC relative PLT address.  */
+  BFD_RELOC_390_PLT64,
+
+/* 32 bit rel. offset to GOT entry.  */
+  BFD_RELOC_390_GOTENT,
+
+/* Scenix IP2K - 9-bit register number / data address  */
+  BFD_RELOC_IP2K_FR9,
+
+/* Scenix IP2K - 4-bit register/data bank number  */
+  BFD_RELOC_IP2K_BANK,
+
+/* Scenix IP2K - low 13 bits of instruction word address  */
+  BFD_RELOC_IP2K_ADDR16CJP,
+
+/* Scenix IP2K - high 3 bits of instruction word address  */
+  BFD_RELOC_IP2K_PAGE3,
+
+/* Scenix IP2K - ext/low/high 8 bits of data address  */
+  BFD_RELOC_IP2K_LO8DATA,
+  BFD_RELOC_IP2K_HI8DATA,
+  BFD_RELOC_IP2K_EX8DATA,
+
+/* Scenix IP2K - low/high 8 bits of instruction word address  */
+  BFD_RELOC_IP2K_LO8INSN,
+  BFD_RELOC_IP2K_HI8INSN,
+
+/* Scenix IP2K - even/odd PC modifier to modify snb pcl.0  */
+  BFD_RELOC_IP2K_PC_SKIP,
+
+/* Scenix IP2K - 16 bit word address in text section.  */
+  BFD_RELOC_IP2K_TEXT,
+
+/* Scenix IP2K - 7-bit sp or dp offset  */
+  BFD_RELOC_IP2K_FR_OFFSET,
+
+/* Scenix VPE4K coprocessor - data/insn-space addressing  */
+  BFD_RELOC_VPE4KMATH_DATA,
+  BFD_RELOC_VPE4KMATH_INSN,
+
+/* These two relocations are used by the linker to determine which of
+the entries in a C++ virtual function table are actually used.  When
+the --gc-sections option is given, the linker will zero out the entries
+that are not used, so that the code for those functions need not be
+included in the output.
+
+VTABLE_INHERIT is a zero-space relocation used to describe to the
+linker the inheritence tree of a C++ virtual function table.  The
+relocation's symbol should be the parent class' vtable, and the
+relocation should be located at the child vtable.
+
+VTABLE_ENTRY is a zero-space relocation that describes the use of a
+virtual function table entry.  The reloc's symbol should refer to the
+table of the class mentioned in the code.  Off of that base, an offset
+describes the entry that is being used.  For Rela hosts, this offset
+is stored in the reloc's addend.  For Rel hosts, we are forced to put
+this offset in the reloc's section offset.  */
+  BFD_RELOC_VTABLE_INHERIT,
+  BFD_RELOC_VTABLE_ENTRY,
+
+/* Intel IA64 Relocations.  */
+  BFD_RELOC_IA64_IMM14,
+  BFD_RELOC_IA64_IMM22,
+  BFD_RELOC_IA64_IMM64,
+  BFD_RELOC_IA64_DIR32MSB,
+  BFD_RELOC_IA64_DIR32LSB,
+  BFD_RELOC_IA64_DIR64MSB,
+  BFD_RELOC_IA64_DIR64LSB,
+  BFD_RELOC_IA64_GPREL22,
+  BFD_RELOC_IA64_GPREL64I,
+  BFD_RELOC_IA64_GPREL32MSB,
+  BFD_RELOC_IA64_GPREL32LSB,
+  BFD_RELOC_IA64_GPREL64MSB,
+  BFD_RELOC_IA64_GPREL64LSB,
+  BFD_RELOC_IA64_LTOFF22,
+  BFD_RELOC_IA64_LTOFF64I,
+  BFD_RELOC_IA64_PLTOFF22,
+  BFD_RELOC_IA64_PLTOFF64I,
+  BFD_RELOC_IA64_PLTOFF64MSB,
+  BFD_RELOC_IA64_PLTOFF64LSB,
+  BFD_RELOC_IA64_FPTR64I,
+  BFD_RELOC_IA64_FPTR32MSB,
+  BFD_RELOC_IA64_FPTR32LSB,
+  BFD_RELOC_IA64_FPTR64MSB,
+  BFD_RELOC_IA64_FPTR64LSB,
+  BFD_RELOC_IA64_PCREL21B,
+  BFD_RELOC_IA64_PCREL21BI,
+  BFD_RELOC_IA64_PCREL21M,
+  BFD_RELOC_IA64_PCREL21F,
+  BFD_RELOC_IA64_PCREL22,
+  BFD_RELOC_IA64_PCREL60B,
+  BFD_RELOC_IA64_PCREL64I,
+  BFD_RELOC_IA64_PCREL32MSB,
+  BFD_RELOC_IA64_PCREL32LSB,
+  BFD_RELOC_IA64_PCREL64MSB,
+  BFD_RELOC_IA64_PCREL64LSB,
+  BFD_RELOC_IA64_LTOFF_FPTR22,
+  BFD_RELOC_IA64_LTOFF_FPTR64I,
+  BFD_RELOC_IA64_LTOFF_FPTR32MSB,
+  BFD_RELOC_IA64_LTOFF_FPTR32LSB,
+  BFD_RELOC_IA64_LTOFF_FPTR64MSB,
+  BFD_RELOC_IA64_LTOFF_FPTR64LSB,
+  BFD_RELOC_IA64_SEGREL32MSB,
+  BFD_RELOC_IA64_SEGREL32LSB,
+  BFD_RELOC_IA64_SEGREL64MSB,
+  BFD_RELOC_IA64_SEGREL64LSB,
+  BFD_RELOC_IA64_SECREL32MSB,
+  BFD_RELOC_IA64_SECREL32LSB,
+  BFD_RELOC_IA64_SECREL64MSB,
+  BFD_RELOC_IA64_SECREL64LSB,
+  BFD_RELOC_IA64_REL32MSB,
+  BFD_RELOC_IA64_REL32LSB,
+  BFD_RELOC_IA64_REL64MSB,
+  BFD_RELOC_IA64_REL64LSB,
+  BFD_RELOC_IA64_LTV32MSB,
+  BFD_RELOC_IA64_LTV32LSB,
+  BFD_RELOC_IA64_LTV64MSB,
+  BFD_RELOC_IA64_LTV64LSB,
+  BFD_RELOC_IA64_IPLTMSB,
+  BFD_RELOC_IA64_IPLTLSB,
+  BFD_RELOC_IA64_COPY,
+  BFD_RELOC_IA64_LTOFF22X,
+  BFD_RELOC_IA64_LDXMOV,
+  BFD_RELOC_IA64_TPREL14,
+  BFD_RELOC_IA64_TPREL22,
+  BFD_RELOC_IA64_TPREL64I,
+  BFD_RELOC_IA64_TPREL64MSB,
+  BFD_RELOC_IA64_TPREL64LSB,
+  BFD_RELOC_IA64_LTOFF_TPREL22,
+  BFD_RELOC_IA64_DTPMOD64MSB,
+  BFD_RELOC_IA64_DTPMOD64LSB,
+  BFD_RELOC_IA64_LTOFF_DTPMOD22,
+  BFD_RELOC_IA64_DTPREL14,
+  BFD_RELOC_IA64_DTPREL22,
+  BFD_RELOC_IA64_DTPREL64I,
+  BFD_RELOC_IA64_DTPREL32MSB,
+  BFD_RELOC_IA64_DTPREL32LSB,
+  BFD_RELOC_IA64_DTPREL64MSB,
+  BFD_RELOC_IA64_DTPREL64LSB,
+  BFD_RELOC_IA64_LTOFF_DTPREL22,
+
+/* Motorola 68HC11 reloc.
+This is the 8 bit high part of an absolute address.  */
+  BFD_RELOC_M68HC11_HI8,
+
+/* Motorola 68HC11 reloc.
+This is the 8 bit low part of an absolute address.  */
+  BFD_RELOC_M68HC11_LO8,
+
+/* Motorola 68HC11 reloc.
+This is the 3 bit of a value.  */
+  BFD_RELOC_M68HC11_3B,
+
+/* Motorola 68HC11 reloc.
+This reloc marks the beginning of a jump/call instruction.
+It is used for linker relaxation to correctly identify beginning
+of instruction and change some branchs to use PC-relative
+addressing mode.  */
+  BFD_RELOC_M68HC11_RL_JUMP,
+
+/* Motorola 68HC11 reloc.
+This reloc marks a group of several instructions that gcc generates
+and for which the linker relaxation pass can modify and/or remove
+some of them.  */
+  BFD_RELOC_M68HC11_RL_GROUP,
+
+/* Motorola 68HC11 reloc.
+This is the 16-bit lower part of an address.  It is used for 'call'
+instruction to specify the symbol address without any special
+transformation (due to memory bank window).  */
+  BFD_RELOC_M68HC11_LO16,
+
+/* Motorola 68HC11 reloc.
+This is a 8-bit reloc that specifies the page number of an address.
+It is used by 'call' instruction to specify the page number of
+the symbol.  */
+  BFD_RELOC_M68HC11_PAGE,
+
+/* Motorola 68HC11 reloc.
+This is a 24-bit reloc that represents the address with a 16-bit
+value and a 8-bit page number.  The symbol address is transformed
+to follow the 16K memory bank of 68HC12 (seen as mapped in the window).  */
+  BFD_RELOC_M68HC11_24,
+
+/* These relocs are only used within the CRIS assembler.  They are not
+(at present) written to any object files.  */
+  BFD_RELOC_CRIS_BDISP8,
+  BFD_RELOC_CRIS_UNSIGNED_5,
+  BFD_RELOC_CRIS_SIGNED_6,
+  BFD_RELOC_CRIS_UNSIGNED_6,
+  BFD_RELOC_CRIS_UNSIGNED_4,
+
+/* Relocs used in ELF shared libraries for CRIS.  */
+  BFD_RELOC_CRIS_COPY,
+  BFD_RELOC_CRIS_GLOB_DAT,
+  BFD_RELOC_CRIS_JUMP_SLOT,
+  BFD_RELOC_CRIS_RELATIVE,
+
+/* 32-bit offset to symbol-entry within GOT.  */
+  BFD_RELOC_CRIS_32_GOT,
+
+/* 16-bit offset to symbol-entry within GOT.  */
+  BFD_RELOC_CRIS_16_GOT,
+
+/* 32-bit offset to symbol-entry within GOT, with PLT handling.  */
+  BFD_RELOC_CRIS_32_GOTPLT,
+
+/* 16-bit offset to symbol-entry within GOT, with PLT handling.  */
+  BFD_RELOC_CRIS_16_GOTPLT,
+
+/* 32-bit offset to symbol, relative to GOT.  */
+  BFD_RELOC_CRIS_32_GOTREL,
+
+/* 32-bit offset to symbol with PLT entry, relative to GOT.  */
+  BFD_RELOC_CRIS_32_PLT_GOTREL,
+
+/* 32-bit offset to symbol with PLT entry, relative to this relocation.  */
+  BFD_RELOC_CRIS_32_PLT_PCREL,
+
+/* Intel i860 Relocations.  */
+  BFD_RELOC_860_COPY,
+  BFD_RELOC_860_GLOB_DAT,
+  BFD_RELOC_860_JUMP_SLOT,
+  BFD_RELOC_860_RELATIVE,
+  BFD_RELOC_860_PC26,
+  BFD_RELOC_860_PLT26,
+  BFD_RELOC_860_PC16,
+  BFD_RELOC_860_LOW0,
+  BFD_RELOC_860_SPLIT0,
+  BFD_RELOC_860_LOW1,
+  BFD_RELOC_860_SPLIT1,
+  BFD_RELOC_860_LOW2,
+  BFD_RELOC_860_SPLIT2,
+  BFD_RELOC_860_LOW3,
+  BFD_RELOC_860_LOGOT0,
+  BFD_RELOC_860_SPGOT0,
+  BFD_RELOC_860_LOGOT1,
+  BFD_RELOC_860_SPGOT1,
+  BFD_RELOC_860_LOGOTOFF0,
+  BFD_RELOC_860_SPGOTOFF0,
+  BFD_RELOC_860_LOGOTOFF1,
+  BFD_RELOC_860_SPGOTOFF1,
+  BFD_RELOC_860_LOGOTOFF2,
+  BFD_RELOC_860_LOGOTOFF3,
+  BFD_RELOC_860_LOPC,
+  BFD_RELOC_860_HIGHADJ,
+  BFD_RELOC_860_HAGOT,
+  BFD_RELOC_860_HAGOTOFF,
+  BFD_RELOC_860_HAPC,
+  BFD_RELOC_860_HIGH,
+  BFD_RELOC_860_HIGOT,
+  BFD_RELOC_860_HIGOTOFF,
+
+/* OpenRISC Relocations.  */
+  BFD_RELOC_OPENRISC_ABS_26,
+  BFD_RELOC_OPENRISC_REL_26,
+
+/* H8 elf Relocations.  */
+  BFD_RELOC_H8_DIR16A8,
+  BFD_RELOC_H8_DIR16R8,
+  BFD_RELOC_H8_DIR24A8,
+  BFD_RELOC_H8_DIR24R8,
+  BFD_RELOC_H8_DIR32A16,
+
+/* Sony Xstormy16 Relocations.  */
+  BFD_RELOC_XSTORMY16_REL_12,
+  BFD_RELOC_XSTORMY16_24,
+  BFD_RELOC_XSTORMY16_FPTR16,
+
+/* Relocations used by VAX ELF.  */
+  BFD_RELOC_VAX_GLOB_DAT,
+  BFD_RELOC_VAX_JMP_SLOT,
+  BFD_RELOC_VAX_RELATIVE,
+  BFD_RELOC_UNUSED };
+typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
+reloc_howto_type *
+bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+
+const char *
+bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
+
+/* Extracted from syms.c.  */
+
+typedef struct symbol_cache_entry
+{
+  /* A pointer to the BFD which owns the symbol. This information
+     is necessary so that a back end can work out what additional
+     information (invisible to the application writer) is carried
+     with the symbol.
+
+     This field is *almost* redundant, since you can use section->owner
+     instead, except that some symbols point to the global sections
+     bfd_{abs,com,und}_section.  This could be fixed by making
+     these globals be per-bfd (or per-target-flavor).  FIXME.  */
+  struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field.  */
+
+  /* The text of the symbol. The name is left alone, and not copied; the
+     application may not alter it.  */
+  const char *name;
+
+  /* The value of the symbol.  This really should be a union of a
+     numeric value with a pointer, since some flags indicate that
+     a pointer to another symbol is stored here.  */
+  symvalue value;
+
+  /* Attributes of a symbol.  */
+#define BSF_NO_FLAGS    0x00
+
+  /* The symbol has local scope; <<static>> in <<C>>. The value
+     is the offset into the section of the data.  */
+#define BSF_LOCAL      0x01
+
+  /* The symbol has global scope; initialized data in <<C>>. The
+     value is the offset into the section of the data.  */
+#define BSF_GLOBAL     0x02
+
+  /* The symbol has global scope and is exported. The value is
+     the offset into the section of the data.  */
+#define BSF_EXPORT     BSF_GLOBAL /* No real difference.  */
+
+  /* A normal C symbol would be one of:
+     <<BSF_LOCAL>>, <<BSF_FORT_COMM>>,  <<BSF_UNDEFINED>> or
+     <<BSF_GLOBAL>>.  */
+
+  /* The symbol is a debugging record. The value has an arbitary
+     meaning, unless BSF_DEBUGGING_RELOC is also set.  */
+#define BSF_DEBUGGING  0x08
+
+  /* The symbol denotes a function entry point.  Used in ELF,
+     perhaps others someday.  */
+#define BSF_FUNCTION    0x10
+
+  /* Used by the linker.  */
+#define BSF_KEEP        0x20
+#define BSF_KEEP_G      0x40
+
+  /* A weak global symbol, overridable without warnings by
+     a regular global symbol of the same name.  */
+#define BSF_WEAK        0x80
+
+  /* This symbol was created to point to a section, e.g. ELF's
+     STT_SECTION symbols.  */
+#define BSF_SECTION_SYM 0x100
+
+  /* The symbol used to be a common symbol, but now it is
+     allocated.  */
+#define BSF_OLD_COMMON  0x200
+
+  /* The default value for common data.  */
+#define BFD_FORT_COMM_DEFAULT_VALUE 0
+
+  /* In some files the type of a symbol sometimes alters its
+     location in an output file - ie in coff a <<ISFCN>> symbol
+     which is also <<C_EXT>> symbol appears where it was
+     declared and not at the end of a section.  This bit is set
+     by the target BFD part to convey this information.  */
+#define BSF_NOT_AT_END    0x400
+
+  /* Signal that the symbol is the label of constructor section.  */
+#define BSF_CONSTRUCTOR   0x800
+
+  /* Signal that the symbol is a warning symbol.  The name is a
+     warning.  The name of the next symbol is the one to warn about;
+     if a reference is made to a symbol with the same name as the next
+     symbol, a warning is issued by the linker.  */
+#define BSF_WARNING       0x1000
+
+  /* Signal that the symbol is indirect.  This symbol is an indirect
+     pointer to the symbol with the same name as the next symbol.  */
+#define BSF_INDIRECT      0x2000
+
+  /* BSF_FILE marks symbols that contain a file name.  This is used
+     for ELF STT_FILE symbols.  */
+#define BSF_FILE          0x4000
+
+  /* Symbol is from dynamic linking information.  */
+#define BSF_DYNAMIC       0x8000
+
+  /* The symbol denotes a data object.  Used in ELF, and perhaps
+     others someday.  */
+#define BSF_OBJECT        0x10000
+
+  /* This symbol is a debugging symbol.  The value is the offset
+     into the section of the data.  BSF_DEBUGGING should be set
+     as well.  */
+#define BSF_DEBUGGING_RELOC 0x20000
+
+  /* This symbol is thread local.  Used in ELF.  */
+#define BSF_THREAD_LOCAL  0x40000
+
+  flagword flags;
+
+  /* A pointer to the section to which this symbol is
+     relative.  This will always be non NULL, there are special
+     sections for undefined and absolute symbols.  */
+  struct sec *section;
+
+  /* Back end special data.  */
+  union
+    {
+      PTR p;
+      bfd_vma i;
+    }
+  udata;
+}
+asymbol;
+
+#define bfd_get_symtab_upper_bound(abfd) \
+     BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
+
+boolean
+bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
+
+boolean
+bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name));
+
+#define bfd_is_local_label_name(abfd, name) \
+     BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
+
+#define bfd_canonicalize_symtab(abfd, location) \
+     BFD_SEND (abfd, _bfd_canonicalize_symtab,\
+                  (abfd, location))
+
+boolean
+bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
+
+void
+bfd_print_symbol_vandf PARAMS ((bfd *abfd, PTR file, asymbol *symbol));
+
+#define bfd_make_empty_symbol(abfd) \
+     BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
+
+asymbol *
+_bfd_generic_make_empty_symbol PARAMS ((bfd *));
+
+#define bfd_make_debug_symbol(abfd,ptr,size) \
+        BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
+
+int
+bfd_decode_symclass PARAMS ((asymbol *symbol));
+
+boolean
+bfd_is_undefined_symclass PARAMS ((int symclass));
+
+void
+bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
+
+boolean
+bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
+
+#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
+     BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
+               (ibfd, isymbol, obfd, osymbol))
+
+/* Extracted from bfd.c.  */
+struct _bfd
+{
+  /* The filename the application opened the BFD with.  */
+  const char *filename;
+
+  /* A pointer to the target jump table.  */
+  const struct bfd_target *xvec;
+
+  /* To avoid dragging too many header files into every file that
+     includes `<<bfd.h>>', IOSTREAM has been declared as a "char *",
+     and MTIME as a "long".  Their correct types, to which they
+     are cast when used, are "FILE *" and "time_t".    The iostream
+     is the result of an fopen on the filename.  However, if the
+     BFD_IN_MEMORY flag is set, then iostream is actually a pointer
+     to a bfd_in_memory struct.  */
+  PTR iostream;
+
+  /* Is the file descriptor being cached?  That is, can it be closed as
+     needed, and re-opened when accessed later?  */
+  boolean cacheable;
+
+  /* Marks whether there was a default target specified when the
+     BFD was opened. This is used to select which matching algorithm
+     to use to choose the back end.  */
+  boolean target_defaulted;
+
+  /* The caching routines use these to maintain a
+     least-recently-used list of BFDs.  */
+  struct _bfd *lru_prev, *lru_next;
+
+  /* When a file is closed by the caching routines, BFD retains
+     state information on the file here...  */
+  ufile_ptr where;
+
+  /* ... and here: (``once'' means at least once).  */
+  boolean opened_once;
+
+  /* Set if we have a locally maintained mtime value, rather than
+     getting it from the file each time.  */
+  boolean mtime_set;
+
+  /* File modified time, if mtime_set is true.  */
+  long mtime;
+
+  /* Reserved for an unimplemented file locking extension.  */
+  int ifd;
+
+  /* The format which belongs to the BFD. (object, core, etc.)  */
+  bfd_format format;
+
+  /* The direction with which the BFD was opened.  */
+  enum bfd_direction
+    {
+      no_direction = 0,
+      read_direction = 1,
+      write_direction = 2,
+      both_direction = 3
+    }
+  direction;
+
+  /* Format_specific flags.  */
+  flagword flags;
+
+  /* Currently my_archive is tested before adding origin to
+     anything. I believe that this can become always an add of
+     origin, with origin set to 0 for non archive files.  */
+  ufile_ptr origin;
+
+  /* Remember when output has begun, to stop strange things
+     from happening.  */
+  boolean output_has_begun;
+
+  /* A hash table for section names.  */
+  struct bfd_hash_table section_htab;
+
+  /* Pointer to linked list of sections.  */
+  struct sec *sections;
+
+  /* The place where we add to the section list.  */
+  struct sec **section_tail;
+
+  /* The number of sections.  */
+  unsigned int section_count;
+
+  /* Stuff only useful for object files:
+     The start address.  */
+  bfd_vma start_address;
+
+  /* Used for input and output.  */
+  unsigned int symcount;
+
+  /* Symbol table for output BFD (with symcount entries).  */
+  struct symbol_cache_entry  **outsymbols;
+
+  /* Used for slurped dynamic symbol tables.  */
+  unsigned int dynsymcount;
+
+  /* Pointer to structure which contains architecture information.  */
+  const struct bfd_arch_info *arch_info;
+
+  /* Stuff only useful for archives.  */
+  PTR arelt_data;
+  struct _bfd *my_archive;     /* The containing archive BFD.  */
+  struct _bfd *next;           /* The next BFD in the archive.  */
+  struct _bfd *archive_head;   /* The first BFD in the archive.  */
+  boolean has_armap;
+
+  /* A chain of BFD structures involved in a link.  */
+  struct _bfd *link_next;
+
+  /* A field used by _bfd_generic_link_add_archive_symbols.  This will
+     be used only for archive elements.  */
+  int archive_pass;
+
+  /* Used by the back end to hold private data.  */
+  union
+    {
+      struct aout_data_struct *aout_data;
+      struct artdata *aout_ar_data;
+      struct _oasys_data *oasys_obj_data;
+      struct _oasys_ar_data *oasys_ar_data;
+      struct coff_tdata *coff_obj_data;
+      struct pe_tdata *pe_obj_data;
+      struct xcoff_tdata *xcoff_obj_data;
+      struct ecoff_tdata *ecoff_obj_data;
+      struct ieee_data_struct *ieee_data;
+      struct ieee_ar_data_struct *ieee_ar_data;
+      struct srec_data_struct *srec_data;
+      struct ihex_data_struct *ihex_data;
+      struct tekhex_data_struct *tekhex_data;
+      struct elf_obj_tdata *elf_obj_data;
+      struct nlm_obj_tdata *nlm_obj_data;
+      struct bout_data_struct *bout_data;
+      struct mmo_data_struct *mmo_data;
+      struct sun_core_struct *sun_core_data;
+      struct sco5_core_struct *sco5_core_data;
+      struct trad_core_struct *trad_core_data;
+      struct som_data_struct *som_data;
+      struct hpux_core_struct *hpux_core_data;
+      struct hppabsd_core_struct *hppabsd_core_data;
+      struct sgi_core_struct *sgi_core_data;
+      struct lynx_core_struct *lynx_core_data;
+      struct osf_core_struct *osf_core_data;
+      struct cisco_core_struct *cisco_core_data;
+      struct versados_data_struct *versados_data;
+      struct netbsd_core_struct *netbsd_core_data;
+      struct mach_o_data_struct *mach_o_data;
+      struct mach_o_fat_data_struct *mach_o_fat_data;
+      struct bfd_pef_data_struct *pef_data;
+      struct bfd_pef_xlib_data_struct *pef_xlib_data;
+      struct bfd_sym_data_struct *sym_data;
+      PTR any;
+    }
+  tdata;
+
+  /* Used by the application to hold private data.  */
+  PTR usrdata;
+
+  /* Where all the allocated stuff under this BFD goes.  This is a
+     struct objalloc *, but we use PTR to avoid requiring the inclusion of
+     objalloc.h.  */
+  PTR memory;
+};
+
+typedef enum bfd_error
+{
+  bfd_error_no_error = 0,
+  bfd_error_system_call,
+  bfd_error_invalid_target,
+  bfd_error_wrong_format,
+  bfd_error_wrong_object_format,
+  bfd_error_invalid_operation,
+  bfd_error_no_memory,
+  bfd_error_no_symbols,
+  bfd_error_no_armap,
+  bfd_error_no_more_archived_files,
+  bfd_error_malformed_archive,
+  bfd_error_file_not_recognized,
+  bfd_error_file_ambiguously_recognized,
+  bfd_error_no_contents,
+  bfd_error_nonrepresentable_section,
+  bfd_error_no_debug_section,
+  bfd_error_bad_value,
+  bfd_error_file_truncated,
+  bfd_error_file_too_big,
+  bfd_error_invalid_error_code
+}
+bfd_error_type;
+
+bfd_error_type
+bfd_get_error PARAMS ((void));
+
+void
+bfd_set_error PARAMS ((bfd_error_type error_tag));
+
+const char *
+bfd_errmsg PARAMS ((bfd_error_type error_tag));
+
+void
+bfd_perror PARAMS ((const char *message));
+
+typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
+
+bfd_error_handler_type
+bfd_set_error_handler PARAMS ((bfd_error_handler_type));
+
+void
+bfd_set_error_program_name PARAMS ((const char *));
+
+bfd_error_handler_type
+bfd_get_error_handler PARAMS ((void));
+
+const char *
+bfd_archive_filename PARAMS ((bfd *));
+
+long
+bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
+
+long
+bfd_canonicalize_reloc PARAMS ((bfd *abfd,
+    asection *sec,
+    arelent **loc,
+    asymbol **syms));
+
+void
+bfd_set_reloc PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count));
+
+boolean
+bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
+
+int
+bfd_get_arch_size PARAMS ((bfd *abfd));
+
+int
+bfd_get_sign_extend_vma PARAMS ((bfd *abfd));
+
+boolean
+bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
+
+unsigned int
+bfd_get_gp_size PARAMS ((bfd *abfd));
+
+void
+bfd_set_gp_size PARAMS ((bfd *abfd, unsigned int i));
+
+bfd_vma
+bfd_scan_vma PARAMS ((const char *string, const char **end, int base));
+
+boolean
+bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
+
+#define bfd_copy_private_bfd_data(ibfd, obfd) \
+     BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
+               (ibfd, obfd))
+boolean
+bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
+
+#define bfd_merge_private_bfd_data(ibfd, obfd) \
+     BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
+               (ibfd, obfd))
+boolean
+bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
+
+#define bfd_set_private_flags(abfd, flags) \
+     BFD_SEND (abfd, _bfd_set_private_flags, \
+               (abfd, flags))
+#define bfd_sizeof_headers(abfd, reloc) \
+     BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+
+#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
+     BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, sec, syms, off, file, func, line))
+
+       /* Do these three do anything useful at all, for any back end?  */
+#define bfd_debug_info_start(abfd) \
+        BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+
+#define bfd_debug_info_end(abfd) \
+        BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
+
+#define bfd_debug_info_accumulate(abfd, section) \
+        BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
+
+
+#define bfd_stat_arch_elt(abfd, stat) \
+        BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
+
+#define bfd_update_armap_timestamp(abfd) \
+        BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
+
+#define bfd_set_arch_mach(abfd, arch, mach)\
+        BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
+
+#define bfd_relax_section(abfd, section, link_info, again) \
+       BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
+
+#define bfd_gc_sections(abfd, link_info) \
+       BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
+
+#define bfd_merge_sections(abfd, link_info) \
+       BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
+
+#define bfd_discard_group(abfd, sec) \
+       BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
+
+#define bfd_link_hash_table_create(abfd) \
+       BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
+
+#define bfd_link_hash_table_free(abfd, hash) \
+       BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
+
+#define bfd_link_add_symbols(abfd, info) \
+       BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
+
+#define bfd_link_just_syms(sec, info) \
+       BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
+
+#define bfd_final_link(abfd, info) \
+       BFD_SEND (abfd, _bfd_final_link, (abfd, info))
+
+#define bfd_free_cached_info(abfd) \
+       BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
+
+#define bfd_get_dynamic_symtab_upper_bound(abfd) \
+       BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
+
+#define bfd_print_private_bfd_data(abfd, file)\
+       BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
+
+#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
+       BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
+
+#define bfd_get_dynamic_reloc_upper_bound(abfd) \
+       BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
+
+#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
+       BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
+
+extern bfd_byte *bfd_get_relocated_section_contents
+       PARAMS ((bfd *, struct bfd_link_info *,
+                 struct bfd_link_order *, bfd_byte *,
+                 boolean, asymbol **));
+
+boolean
+bfd_alt_mach_code PARAMS ((bfd *abfd, int alternative));
+
+struct bfd_preserve
+{
+  PTR marker;
+  PTR tdata;
+  flagword flags;
+  const struct bfd_arch_info *arch_info;
+  struct sec *sections;
+  struct sec **section_tail;
+  unsigned int section_count;
+  struct bfd_hash_table section_htab;
+};
+
+boolean
+bfd_preserve_save PARAMS ((bfd *, struct bfd_preserve *));
+
+void
+bfd_preserve_restore PARAMS ((bfd *, struct bfd_preserve *));
+
+void
+bfd_preserve_finish PARAMS ((bfd *, struct bfd_preserve *));
+
+/* Extracted from archive.c.  */
+symindex
+bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
+
+boolean
+bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
+
+bfd *
+bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
+
+/* Extracted from corefile.c.  */
+const char *
+bfd_core_file_failing_command PARAMS ((bfd *abfd));
+
+int
+bfd_core_file_failing_signal PARAMS ((bfd *abfd));
+
+boolean
+core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+
+/* Extracted from targets.c.  */
+#define BFD_SEND(bfd, message, arglist) \
+               ((*((bfd)->xvec->message)) arglist)
+
+#ifdef DEBUG_BFD_SEND
+#undef BFD_SEND
+#define BFD_SEND(bfd, message, arglist) \
+  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
+    ((*((bfd)->xvec->message)) arglist) : \
+    (bfd_assert (__FILE__,__LINE__), NULL))
+#endif
+#define BFD_SEND_FMT(bfd, message, arglist) \
+            (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
+
+#ifdef DEBUG_BFD_SEND
+#undef BFD_SEND_FMT
+#define BFD_SEND_FMT(bfd, message, arglist) \
+  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
+   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
+   (bfd_assert (__FILE__,__LINE__), NULL))
+#endif
+
+enum bfd_flavour
+{
+  bfd_target_unknown_flavour,
+  bfd_target_aout_flavour,
+  bfd_target_coff_flavour,
+  bfd_target_ecoff_flavour,
+  bfd_target_xcoff_flavour,
+  bfd_target_elf_flavour,
+  bfd_target_ieee_flavour,
+  bfd_target_nlm_flavour,
+  bfd_target_oasys_flavour,
+  bfd_target_tekhex_flavour,
+  bfd_target_srec_flavour,
+  bfd_target_ihex_flavour,
+  bfd_target_som_flavour,
+  bfd_target_os9k_flavour,
+  bfd_target_versados_flavour,
+  bfd_target_msdos_flavour,
+  bfd_target_ovax_flavour,
+  bfd_target_evax_flavour,
+  bfd_target_mmo_flavour,
+  bfd_target_mach_o_flavour,
+  bfd_target_pef_flavour,
+  bfd_target_pef_xlib_flavour,
+  bfd_target_sym_flavour
+};
+
+enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
+
+/* Forward declaration.  */
+typedef struct bfd_link_info _bfd_link_info;
+
+typedef struct bfd_target
+{
+  /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  */
+  char *name;
+
+ /* The "flavour" of a back end is a general indication about
+    the contents of a file.  */
+  enum bfd_flavour flavour;
+
+  /* The order of bytes within the data area of a file.  */
+  enum bfd_endian byteorder;
+
+ /* The order of bytes within the header parts of a file.  */
+  enum bfd_endian header_byteorder;
+
+  /* A mask of all the flags which an executable may have set -
+     from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.  */
+  flagword object_flags;
+
+ /* A mask of all the flags which a section may have set - from
+    the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.  */
+  flagword section_flags;
+
+ /* The character normally found at the front of a symbol.
+    (if any), perhaps `_'.  */
+  char symbol_leading_char;
+
+ /* The pad character for file names within an archive header.  */
+  char ar_pad_char;
+
+  /* The maximum number of characters in an archive header.  */
+  unsigned short ar_max_namelen;
+
+  /* Entries for byte swapping for data. These are different from the
+     other entry points, since they don't take a BFD asthe first argument.
+     Certain other handlers could do the same.  */
+  bfd_vma        (*bfd_getx64) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
+  void           (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
+  bfd_vma        (*bfd_getx32) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
+  void           (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
+  bfd_vma        (*bfd_getx16) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
+  void           (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
+
+  /* Byte swapping for the headers.  */
+  bfd_vma        (*bfd_h_getx64) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
+  void           (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
+  bfd_vma        (*bfd_h_getx32) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
+  void           (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
+  bfd_vma        (*bfd_h_getx16) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
+  void           (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
+
+  /* Format dependent routines: these are vectors of entry points
+     within the target vector structure, one for each format to check.  */
+
+  /* Check the format of a file being read.  Return a <<bfd_target *>> or zero.  */
+  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
+
+  /* Set the format of a file being written.  */
+  boolean  (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
+
+  /* Write cached information into a file being written, at <<bfd_close>>.  */
+  boolean  (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
+
+
+  /* Generic entry points.  */
+#define BFD_JUMP_TABLE_GENERIC(NAME) \
+CONCAT2 (NAME,_close_and_cleanup), \
+CONCAT2 (NAME,_bfd_free_cached_info), \
+CONCAT2 (NAME,_new_section_hook), \
+CONCAT2 (NAME,_get_section_contents), \
+CONCAT2 (NAME,_get_section_contents_in_window)
+
+  /* Called when the BFD is being closed to do any necessary cleanup.  */
+  boolean  (*_close_and_cleanup) PARAMS ((bfd *));
+  /* Ask the BFD to free all cached information.  */
+  boolean  (*_bfd_free_cached_info) PARAMS ((bfd *));
+  /* Called when a new section is created.  */
+  boolean  (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
+  /* Read the contents of a section.  */
+  boolean  (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+                                                 file_ptr, bfd_size_type));
+  boolean  (*_bfd_get_section_contents_in_window)
+    PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
+
+  /* Entry points to copy private data.  */
+#define BFD_JUMP_TABLE_COPY(NAME) \
+CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
+CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
+CONCAT2 (NAME,_bfd_copy_private_section_data), \
+CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
+CONCAT2 (NAME,_bfd_set_private_flags), \
+CONCAT2 (NAME,_bfd_print_private_bfd_data) \
+  /* Called to copy BFD general private data from one object file
+     to another.  */
+  boolean  (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
+  /* Called to merge BFD general private data from one object file
+     to a common output file when linking.  */
+  boolean  (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
+  /* Called to copy BFD private section data from one object file
+     to another.  */
+  boolean  (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
+                                                      bfd *, sec_ptr));
+  /* Called to copy BFD private symbol data from one symbol
+     to another.  */
+  boolean  (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
+                                                     bfd *, asymbol *));
+  /* Called to set private backend flags.  */
+  boolean  (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
+
+  /* Called to print private BFD data.  */
+  boolean  (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
+
+  /* Core file entry points.  */
+#define BFD_JUMP_TABLE_CORE(NAME) \
+CONCAT2 (NAME,_core_file_failing_command), \
+CONCAT2 (NAME,_core_file_failing_signal), \
+CONCAT2 (NAME,_core_file_matches_executable_p)
+  char *   (*_core_file_failing_command) PARAMS ((bfd *));
+  int      (*_core_file_failing_signal) PARAMS ((bfd *));
+  boolean  (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
+
+  /* Archive entry points.  */
+#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
+CONCAT2 (NAME,_slurp_armap), \
+CONCAT2 (NAME,_slurp_extended_name_table), \
+CONCAT2 (NAME,_construct_extended_name_table), \
+CONCAT2 (NAME,_truncate_arname), \
+CONCAT2 (NAME,_write_armap), \
+CONCAT2 (NAME,_read_ar_hdr), \
+CONCAT2 (NAME,_openr_next_archived_file), \
+CONCAT2 (NAME,_get_elt_at_index), \
+CONCAT2 (NAME,_generic_stat_arch_elt), \
+CONCAT2 (NAME,_update_armap_timestamp)
+  boolean  (*_bfd_slurp_armap) PARAMS ((bfd *));
+  boolean  (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
+  boolean  (*_bfd_construct_extended_name_table)
+    PARAMS ((bfd *, char **, bfd_size_type *, const char **));
+  void     (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
+  boolean  (*write_armap)
+    PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+  PTR      (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
+  bfd *    (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
+#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
+  bfd *    (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
+  int      (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
+  boolean  (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
+
+  /* Entry points used for symbols.  */
+#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
+CONCAT2 (NAME,_get_symtab_upper_bound), \
+CONCAT2 (NAME,_get_symtab), \
+CONCAT2 (NAME,_make_empty_symbol), \
+CONCAT2 (NAME,_print_symbol), \
+CONCAT2 (NAME,_get_symbol_info), \
+CONCAT2 (NAME,_bfd_is_local_label_name), \
+CONCAT2 (NAME,_get_lineno), \
+CONCAT2 (NAME,_find_nearest_line), \
+CONCAT2 (NAME,_bfd_make_debug_symbol), \
+CONCAT2 (NAME,_read_minisymbols), \
+CONCAT2 (NAME,_minisymbol_to_symbol)
+  long     (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
+  long     (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
+                                                struct symbol_cache_entry **));
+  struct symbol_cache_entry *
+           (*_bfd_make_empty_symbol) PARAMS ((bfd *));
+  void     (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
+                                         struct symbol_cache_entry *,
+                                         bfd_print_symbol_type));
+#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
+  void     (*_bfd_get_symbol_info) PARAMS ((bfd *,
+                                            struct symbol_cache_entry *,
+                                            symbol_info *));
+#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
+  boolean  (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
+
+  alent *  (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
+  boolean  (*_bfd_find_nearest_line)
+    PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
+             const char **, const char **, unsigned int *));
+ /* Back-door to allow format-aware applications to create debug symbols
+    while using BFD for everything else.  Currently used by the assembler
+    when creating COFF files.  */
+  asymbol *(*_bfd_make_debug_symbol) PARAMS ((bfd *, void *,
+                                              unsigned long size));
+#define bfd_read_minisymbols(b, d, m, s) \
+  BFD_SEND (b, _read_minisymbols, (b, d, m, s))
+  long     (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
+                                         unsigned int *));
+#define bfd_minisymbol_to_symbol(b, d, m, f) \
+  BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
+  asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
+                                             asymbol *));
+
+  /* Routines for relocs.  */
+#define BFD_JUMP_TABLE_RELOCS(NAME) \
+CONCAT2 (NAME,_get_reloc_upper_bound), \
+CONCAT2 (NAME,_canonicalize_reloc), \
+CONCAT2 (NAME,_bfd_reloc_type_lookup)
+  long     (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
+  long     (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
+                                               struct symbol_cache_entry **));
+  /* See documentation on reloc types.  */
+  reloc_howto_type *
+           (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type));
+
+  /* Routines used when writing an object file.  */
+#define BFD_JUMP_TABLE_WRITE(NAME) \
+CONCAT2 (NAME,_set_arch_mach), \
+CONCAT2 (NAME,_set_section_contents)
+  boolean  (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
+                                          unsigned long));
+  boolean  (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+                                                 file_ptr, bfd_size_type));
+
+  /* Routines used by the linker.  */
+#define BFD_JUMP_TABLE_LINK(NAME) \
+CONCAT2 (NAME,_sizeof_headers), \
+CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
+CONCAT2 (NAME,_bfd_relax_section), \
+CONCAT2 (NAME,_bfd_link_hash_table_create), \
+CONCAT2 (NAME,_bfd_link_hash_table_free), \
+CONCAT2 (NAME,_bfd_link_add_symbols), \
+CONCAT2 (NAME,_bfd_link_just_syms), \
+CONCAT2 (NAME,_bfd_final_link), \
+CONCAT2 (NAME,_bfd_link_split_section), \
+CONCAT2 (NAME,_bfd_gc_sections), \
+CONCAT2 (NAME,_bfd_merge_sections), \
+CONCAT2 (NAME,_bfd_discard_group)
+  int      (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
+  bfd_byte *(*_bfd_get_relocated_section_contents)
+    PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
+             bfd_byte *, boolean, struct symbol_cache_entry **));
+
+  boolean  (*_bfd_relax_section)
+    PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
+
+  /* Create a hash table for the linker.  Different backends store
+     different information in this table.  */
+  struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
+
+  /* Release the memory associated with the linker hash table.  */
+  void (*_bfd_link_hash_table_free) PARAMS ((struct bfd_link_hash_table *));
+
+  /* Add symbols from this object file into the hash table.  */
+  boolean  (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* Indicate that we are only retrieving symbol values from this section.  */
+  void     (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
+
+  /* Do a link based on the link_order structures attached to each
+     section of the BFD.  */
+  boolean  (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* Should this section be split up into smaller pieces during linking.  */
+  boolean  (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
+
+  /* Remove sections that are not referenced from the output.  */
+  boolean  (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* Attempt to merge SEC_MERGE sections.  */
+  boolean  (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* Discard members of a group.  */
+  boolean  (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
+
+  /* Routines to handle dynamic symbols and relocs.  */
+#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
+CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
+CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
+CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
+CONCAT2 (NAME,_canonicalize_dynamic_reloc)
+  /* Get the amount of memory required to hold the dynamic symbols.  */
+  long     (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
+  /* Read in the dynamic symbols.  */
+  long     (*_bfd_canonicalize_dynamic_symtab)
+    PARAMS ((bfd *, struct symbol_cache_entry **));
+  /* Get the amount of memory required to hold the dynamic relocs.  */
+  long     (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
+  /* Read in the dynamic relocs.  */
+  long     (*_bfd_canonicalize_dynamic_reloc)
+    PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
+
+  /* Opposite endian version of this target.  */
+  const struct bfd_target * alternative_target;
+
+  /* Data for use by back-end routines, which isn't
+     generic enough to belong in this structure.  */
+  PTR backend_data;
+
+} bfd_target;
+
+boolean
+bfd_set_default_target PARAMS ((const char *name));
+
+const bfd_target *
+bfd_find_target PARAMS ((const char *target_name, bfd *abfd));
+
+const char **
+bfd_target_list PARAMS ((void));
+
+const bfd_target *
+bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
+
+/* Extracted from format.c.  */
+boolean
+bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
+
+boolean
+bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
+
+boolean
+bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
+
+const char *
+bfd_format_string PARAMS ((bfd_format format));
+
+/* Extracted from linker.c.  */
+boolean
+bfd_link_split_section PARAMS ((bfd *abfd, asection *sec));
+
+#define bfd_link_split_section(abfd, sec) \
+       BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
+
+/* Extracted from simple.c.  */
+bfd_byte *
+bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf));
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/jit/i386/codegen.c b/jit/i386/codegen.c
new file mode 100644 (file)
index 0000000..6313258
--- /dev/null
@@ -0,0 +1,6019 @@
+/* jit/i386/codegen.c - machine code generator for i386
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Christian Thalinger
+
+   $Id: codegen.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include <signal.h>
+#include "types.h"
+#include "codegen.h"
+#include "jit.h"
+#include "reg.h"
+#include "builtin.h"
+#include "asmpart.h"
+#include "jni.h"
+#include "loader.h"
+#include "tables.h"
+#include "native.h"
+#include "methodtable.h"
+
+/* include independent code generation stuff */
+#include "codegen.inc"
+#include "reg.inc"
+
+
+/* additional functions and macros to generate code ***************************/
+
+#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
+
+
+#ifdef STATISTICS
+#define COUNT_SPILLS count_spills++
+#else
+#define COUNT_SPILLS
+#endif
+
+
+#define CALCOFFSETBYTES(var, val) \
+    if ((s4) (val) < -128 || (s4) (val) > 127) (var) += 4; \
+    else if ((s4) (val) != 0) (var) += 1;
+
+
+#define CALCREGOFFBYTES(var, val) \
+    if ((val) > 15) (var) += 4; \
+    else if ((val) != 0) (var) += 1;
+
+
+#define CALCIMMEDIATEBYTES(var, val) \
+    if ((s4) (val) < -128 || (s4) (val) > 127) (var) += 4; \
+    else (var) += 1;
+
+
+/* gen_nullptr_check(objreg) */
+
+#define gen_nullptr_check(objreg) \
+       if (checknull) { \
+        i386_test_reg_reg((objreg), (objreg)); \
+        i386_jcc(I386_CC_E, 0); \
+           codegen_addxnullrefs(mcodeptr); \
+       }
+
+
+/* MCODECHECK(icnt) */
+
+#define MCODECHECK(icnt) \
+       if ((mcodeptr + (icnt)) > (u1*) mcodeend) mcodeptr = (u1*) codegen_increase((u1*) mcodeptr)
+
+/* M_INTMOVE:
+     generates an integer-move from register a to b.
+     if a and b are the same int-register, no code will be generated.
+*/ 
+
+#define M_INTMOVE(reg,dreg) if ((reg) != (dreg)) { i386_mov_reg_reg((reg),(dreg)); }
+
+
+/* M_FLTMOVE:
+    generates a floating-point-move from register a to b.
+    if a and b are the same float-register, no code will be generated
+*/
+
+#define M_FLTMOVE(reg,dreg) panic("M_FLTMOVE");
+
+#define M_LNGMEMMOVE(reg,dreg) \
+    do { \
+        i386_mov_membase_reg(REG_SP, (reg) * 8, REG_ITMP1); \
+        i386_mov_membase_reg(REG_SP, (reg) * 8 + 4, REG_ITMP2); \
+        i386_mov_reg_membase(REG_ITMP1, REG_SP, (dreg) * 8); \
+        i386_mov_reg_membase(REG_ITMP2, REG_SP, (dreg) * 8 + 4); \
+    } while (0)
+
+
+/* var_to_reg_xxx:
+    this function generates code to fetch data from a pseudo-register
+    into a real register. 
+    If the pseudo-register has actually been assigned to a real 
+    register, no code will be emitted, since following operations
+    can use this register directly.
+    
+    v: pseudoregister to be fetched from
+    tempregnum: temporary register to be used if v is actually spilled to ram
+
+    return: the register number, where the operand can be found after 
+            fetching (this wil be either tempregnum or the register
+            number allready given to v)
+*/
+
+#define var_to_reg_int(regnr,v,tempnr) \
+    if ((v)->flags & INMEMORY) { \
+        COUNT_SPILLS; \
+        i386_mov_membase_reg(REG_SP, (v)->regoff * 8, tempnr); \
+        regnr = tempnr; \
+    } else { \
+        regnr = (v)->regoff; \
+    }
+
+
+
+#define var_to_reg_flt(regnr,v,tempnr) \
+    if ((v)->type == TYPE_FLT) { \
+        if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_flds_membase(REG_SP, (v)->regoff * 8); \
+            fpu_st_offset++; \
+            regnr = tempnr; \
+        } else { \
+            i386_fld_reg((v)->regoff + fpu_st_offset); \
+            fpu_st_offset++; \
+            regnr = (v)->regoff; \
+        } \
+    } else { \
+        if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_fldl_membase(REG_SP, (v)->regoff * 8); \
+            fpu_st_offset++; \
+            regnr = tempnr; \
+        } else { \
+            i386_fld_reg((v)->regoff + fpu_st_offset); \
+            fpu_st_offset++; \
+            regnr = (v)->regoff; \
+        } \
+    }
+
+#define NEW_var_to_reg_flt(regnr,v,tempnr) \
+    if ((v)->type == TYPE_FLT) { \
+       if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_flds_membase(REG_SP, (v)->regoff * 8); \
+            fpu_st_offset++; \
+            regnr = tempnr; \
+        } else { \
+            regnr = (v)->regoff; \
+        } \
+    } else { \
+        if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_fldl_membase(REG_SP, (v)->regoff * 8); \
+            fpu_st_offset++; \
+            regnr = tempnr; \
+        } else { \
+            regnr = (v)->regoff; \
+        } \
+    }
+
+
+/* reg_of_var:
+    This function determines a register, to which the result of an operation
+    should go, when it is ultimatively intended to store the result in
+    pseudoregister v.
+    If v is assigned to an actual register, this register will be returned.
+    Otherwise (when v is spilled) this function returns tempregnum.
+    If not already done, regoff and flags are set in the stack location.
+*/        
+
+static int reg_of_var(stackptr v, int tempregnum)
+{
+       varinfo      *var;
+
+       switch (v->varkind) {
+       case TEMPVAR:
+               if (!(v->flags & INMEMORY))
+                       return(v->regoff);
+               break;
+       case STACKVAR:
+               var = &(interfaces[v->varnum][v->type]);
+               v->regoff = var->regoff;
+               if (!(var->flags & INMEMORY))
+                       return(var->regoff);
+               break;
+       case LOCALVAR:
+               var = &(locals[v->varnum][v->type]);
+               v->regoff = var->regoff;
+               if (!(var->flags & INMEMORY))
+                       return(var->regoff);
+               break;
+       case ARGVAR:
+               v->regoff = v->varnum;
+               if (IS_FLT_DBL_TYPE(v->type)) {
+                       if (v->varnum < fltreg_argnum) {
+                               v->regoff = argfltregs[v->varnum];
+                               return(argfltregs[v->varnum]);
+                       }
+               }
+               else
+                       if (v->varnum < intreg_argnum) {
+                               v->regoff = argintregs[v->varnum];
+                               return(argintregs[v->varnum]);
+                       }
+               v->regoff -= intreg_argnum;
+               break;
+       }
+       v->flags |= INMEMORY;
+       return tempregnum;
+}
+
+
+/* store_reg_to_var_xxx:
+    This function generates the code to store the result of an operation
+    back into a spilled pseudo-variable.
+    If the pseudo-variable has not been spilled in the first place, this 
+    function will generate nothing.
+    
+    v ............ Pseudovariable
+    tempregnum ... Number of the temporary registers as returned by
+                   reg_of_var.
+*/     
+
+#define store_reg_to_var_int(sptr, tempregnum) \
+    if ((sptr)->flags & INMEMORY) { \
+        COUNT_SPILLS; \
+        i386_mov_reg_membase(tempregnum, REG_SP, (sptr)->regoff * 8); \
+    }
+
+
+#define store_reg_to_var_flt(sptr, tempregnum) \
+    if ((sptr)->type == TYPE_FLT) { \
+        if ((sptr)->flags & INMEMORY) { \
+             COUNT_SPILLS; \
+             i386_fstps_membase(REG_SP, (sptr)->regoff * 8); \
+             fpu_st_offset--; \
+        } else { \
+/*                  i386_fxch_reg((sptr)->regoff);*/ \
+             i386_fstp_reg((sptr)->regoff + fpu_st_offset); \
+             fpu_st_offset--; \
+        } \
+    } else { \
+        if ((sptr)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_fstpl_membase(REG_SP, (sptr)->regoff * 8); \
+            fpu_st_offset--; \
+        } else { \
+/*                  i386_fxch_reg((sptr)->regoff);*/ \
+            i386_fstp_reg((sptr)->regoff + fpu_st_offset); \
+            fpu_st_offset--; \
+        } \
+    }
+
+
+/* NullPointerException signal handler for hardware null pointer check */
+
+void catch_NullPointerException(int sig)
+{
+       sigset_t nsig;
+       int      instr;
+/*     long     faultaddr; */
+
+       void **_p = (void **) &sig;
+       struct sigcontext *sigctx = (struct sigcontext *) ++_p;
+
+       /* Reset signal handler - necessary for SysV, does no harm for BSD */
+
+       instr = *((int*)(sigctx->eip));
+/*     faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f]; */
+
+/*     fprintf(stderr, "null=%d %p addr=%p\n", sig, sigctx, sigctx->eip); */
+
+/*     if (faultaddr == 0) { */
+               signal(sig, (void *) catch_NullPointerException);          /* reinstall handler */
+               sigemptyset(&nsig);
+               sigaddset(&nsig, sig);
+               sigprocmask(SIG_UNBLOCK, &nsig, NULL);                     /* unblock signal    */
+               sigctx->eax = (long) proto_java_lang_NullPointerException; /* REG_ITMP1_XPTR    */
+               sigctx->edx = sigctx->eip;                                 /* REG_ITMP2_XPC     */
+               sigctx->eip = (long) asm_handle_exception;
+
+               return;
+
+/*     } else { */
+/*             faultaddr += (long) ((instr << 16) >> 16); */
+/*             fprintf(stderr, "faulting address: 0x%08x\n", faultaddr); */
+/*             panic("Stack overflow"); */
+/*     } */
+}
+
+/* ArithmeticException signal handler for hardware divide by zero check */
+
+void catch_ArithmeticException(int sig)
+{
+       sigset_t nsig;
+
+       void **_p = (void **) &sig;
+       struct sigcontext *sigctx = (struct sigcontext *) ++_p;
+
+       classinfo *c;
+       java_objectheader *p;
+       methodinfo *m;
+
+       /* Reset signal handler - necessary for SysV, does no harm for BSD        */
+
+       signal(sig, (void *) catch_ArithmeticException);     /* reinstall handler */
+       sigemptyset(&nsig);
+       sigaddset(&nsig, sig);
+       sigprocmask(SIG_UNBLOCK, &nsig, NULL);               /* unblock signal    */
+
+       c = loader_load(utf_new_char("java/lang/ArithmeticException"));
+       p = builtin_new(c);
+       m = class_findmethod(c, 
+                                                utf_new_char("<init>"), 
+                                                utf_new_char("(Ljava/lang/String;)V"));
+
+       asm_calljavamethod(m, p, javastring_new_char("/ by zero"), NULL, NULL);
+
+       sigctx->eax = (long) p;                              /* REG_ITMP1_XPTR    */
+       sigctx->edx = sigctx->eip;                           /* REG_ITMP2_XPC     */
+       sigctx->eip = (long) asm_handle_exception;
+
+       return;
+}
+
+void init_exceptions(void)
+{
+       /* install signal handlers we need to convert to exceptions */
+
+       if (!checknull) {
+
+#if defined(SIGSEGV)
+               signal(SIGSEGV, (void *) catch_NullPointerException);
+#endif
+
+#if defined(SIGBUS)
+               signal(SIGBUS, (void *) catch_NullPointerException);
+#endif
+       }
+
+       signal(SIGFPE, (void *) catch_ArithmeticException);
+}
+
+
+/* function gen_mcode **********************************************************
+
+       generates machine code
+
+*******************************************************************************/
+
+u1          *mcodeptr;
+
+void codegen()
+{
+       int  len, s1, s2, s3, d/*, bbs*/;
+       s4   a;
+       stackptr    src;
+       varinfo     *var;
+/*     varinfo     *dst; */
+       basicblock  *bptr;
+       instruction *iptr;
+
+       int fpu_st_offset = 0;
+
+       xtable *ex;
+
+       {
+       int p, pa, t, l, r;
+
+       savedregs_num = 0;
+
+       /* space to save used callee saved registers */
+
+       savedregs_num += (savintregcnt - maxsavintreguse);
+       savedregs_num += (savfltregcnt - maxsavfltreguse);
+
+       parentargs_base = maxmemuse + savedregs_num;
+
+#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
+
+       if (checksync && (method->flags & ACC_SYNCHRONIZED))
+               parentargs_base++;
+
+#endif
+
+       /* create method header */
+
+       (void) dseg_addaddress(method);                         /* MethodPointer  */
+       (void) dseg_adds4(parentargs_base * 8);                 /* FrameSize      */
+
+#ifdef USE_THREADS
+
+       /* IsSync contains the offset relative to the stack pointer for the
+          argument of monitor_exit used in the exception handler. Since the
+          offset could be zero and give a wrong meaning of the flag it is
+          offset by one.
+       */
+
+       if (checksync && (method->flags & ACC_SYNCHRONIZED))
+               (void) dseg_adds4((maxmemuse + 1) * 8);             /* IsSync         */
+       else
+
+#endif
+
+       (void) dseg_adds4(0);                                   /* IsSync         */
+                                              
+       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
+       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
+       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
+       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
+
+       /* create exception table */
+
+       for (ex = extable; ex != NULL; ex = ex->down) {
+
+#ifdef LOOP_DEBUG      
+               if (ex->start != NULL)
+                       printf("adding start - %d - ", ex->start->debug_nr);
+               else {
+                       printf("PANIC - start is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->start);
+
+#ifdef LOOP_DEBUG                      
+               if (ex->end != NULL)
+                       printf("adding end - %d - ", ex->end->debug_nr);
+               else {
+                       printf("PANIC - end is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->end);
+
+#ifdef LOOP_DEBUG              
+               if (ex->handler != NULL)
+                       printf("adding handler - %d\n", ex->handler->debug_nr);
+               else {
+                       printf("PANIC - handler is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->handler);
+          
+               (void) dseg_addaddress(ex->catchtype);
+       }
+       
+       /* initialize mcode variables */
+       
+       mcodeptr = (u1*) mcodebase;
+       mcodeend = (s4*) (mcodebase + mcodesize);
+       MCODECHECK(128 + mparamcount);
+
+       /* create stack frame (if necessary) */
+
+       if (parentargs_base) {
+               i386_alu_imm_reg(I386_SUB, parentargs_base * 8, REG_SP);
+       }
+
+       /* save return address and used callee saved registers */
+
+       p = parentargs_base;
+       for (r = savintregcnt - 1; r >= maxsavintreguse; r--) {
+               p--; i386_mov_reg_membase(savintregs[r], REG_SP, p * 8);
+       }
+       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--) {
+               p--; i386_fld_reg(savfltregs[r]); i386_fstpl_membase(REG_SP, p * 8);
+       }
+
+       /* save monitorenter argument */
+
+#ifdef USE_THREADS
+       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+               if (method->flags & ACC_STATIC) {
+                       i386_mov_imm_reg((s4) class, REG_ITMP1);
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, maxmemuse * 8);
+
+               } else {
+                       i386_mov_membase_reg(REG_SP, parentargs_base * 8 + 4, REG_ITMP1);
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, maxmemuse * 8);
+               }
+       }                       
+#endif
+
+       /* copy argument registers to stack and call trace function with pointer
+          to arguments on stack.
+       */
+
+       if (runverbose) {
+               i386_alu_imm_reg(I386_SUB, TRACE_ARGS_NUM * 8 + 4, REG_SP);
+
+               for (p = 0; p < mparamcount; p++) {
+                       t = mparamtypes[p];
+                       if (IS_INT_LNG_TYPE(t)) {
+                               if (IS_2_WORD_TYPE(t)) {
+                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4 + 4, REG_ITMP2);
+
+                               } else if (t == TYPE_ADR) {
+                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+
+                               } else {
+                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                                       i386_cltd();
+                               }
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
+
+                       } else {
+                               if (t == TYPE_FLT) {
+                                       i386_flds_membase(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4);
+                                       i386_fstps_membase(REG_SP, p * 8);
+                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
+
+                               } else {
+                                       i386_fldl_membase(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4);
+                                       i386_fstpl_membase(REG_SP, p * 8);
+                               }
+                       }
+               }
+
+               /* fill up the remaining arguments */
+               i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
+               for (p = mparamcount; p < TRACE_ARGS_NUM; p++) {
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8 + 4);
+               }
+
+               i386_mov_imm_membase((s4) method, REG_SP, TRACE_ARGS_NUM * 8);
+
+               i386_mov_imm_reg((s4) builtin_trace_args, REG_ITMP1);
+/*             i386_mov_imm_reg(asm_builtin_trace, REG_ITMP1); */
+               i386_call_reg(REG_ITMP1);
+
+               i386_alu_imm_reg(I386_ADD, TRACE_ARGS_NUM * 8 + 4, REG_SP);
+       }
+
+       /* take arguments out of register or stack frame */
+
+       for (p = 0, l = 0; p < mparamcount; p++) {
+               t = mparamtypes[p];
+               var = &(locals[l][t]);
+               l++;
+               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
+                       l++;
+               if (var->type < 0)
+                       continue;
+               r = var->regoff; 
+               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
+                       if (p < intreg_argnum) {                 /* register arguments    */
+                               panic("integer register argument");
+                               if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
+/*                                     M_INTMOVE (argintregs[p], r); */
+
+                               } else {                             /* reg arg -> spilled    */
+/*                                     M_LST (argintregs[p], REG_SP, 8 * r); */
+                               }
+                       } else {                                 /* stack arguments       */
+                               pa = p - intreg_argnum;
+                               if (!(var->flags & INMEMORY)) {      /* stack arg -> register */ 
+                                       i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, r);            /* + 4 for return address */
+                               } else {                             /* stack arg -> spilled  */
+                                       if (!IS_2_WORD_TYPE(t)) {
+                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1);    /* + 4 for return address */
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1);    /* + 4 for return address */
+                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4 + 4, REG_ITMP2);    /* + 4 for return address */
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, r * 8 + 4);
+                                       }
+                               }
+                       }
+               
+               } else {                                     /* floating args         */   
+                       if (p < fltreg_argnum) {                 /* register arguments    */
+                               if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
+                                       panic("There are no float argument registers!");
+
+                               } else {                                         /* reg arg -> spilled    */
+                                       panic("There are no float argument registers!");
+                               }
+
+                       } else {                                 /* stack arguments       */
+                               pa = p - fltreg_argnum;
+                               if (!(var->flags & INMEMORY)) {      /* stack-arg -> register */
+                                       if (t == TYPE_FLT) {
+                                               i386_flds_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
+                                               fpu_st_offset++;
+                                               i386_fstp_reg(r + fpu_st_offset);
+                                               fpu_st_offset--;
+
+                                       } else {
+                                               i386_fldl_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
+                                               fpu_st_offset++;
+                                               i386_fstp_reg(r + fpu_st_offset);
+                                               fpu_st_offset--;
+                                       }
+
+                               } else {                              /* stack-arg -> spilled  */
+/*                                     i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1); */
+/*                                     i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8); */
+                                       if (t == TYPE_FLT) {
+                                               i386_flds_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
+                                               i386_fstps_membase(REG_SP, r * 8);
+
+                                       } else {
+                                               i386_fldl_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
+                                               i386_fstpl_membase(REG_SP, r * 8);
+                                       }
+                               }
+                       }
+               }
+       }  /* end for */
+
+       /* call monitorenter function */
+
+#ifdef USE_THREADS
+       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+               i386_mov_membase_reg(REG_SP, maxmemuse * 8, REG_ITMP1);
+               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+               i386_mov_imm_reg((s4) builtin_monitorenter, REG_ITMP2);
+               i386_call_reg(REG_ITMP2);
+               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+       }                       
+#endif
+       }
+
+       /* end of header generation */
+
+       /* walk through all basic blocks */
+       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
+
+               bptr->mpc = (int)((u1*) mcodeptr - mcodebase);
+
+               if (bptr->flags >= BBREACHED) {
+
+               /* branch resolving */
+
+               branchref *brefs;
+               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
+                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
+                                         brefs->branchpos, bptr->mpc);
+               }
+
+               /* copy interface registers to their destination */
+
+               src = bptr->instack;
+               len = bptr->indepth;
+               MCODECHECK(64+len);
+               while (src != NULL) {
+                       len--;
+                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
+                               if (!IS_2_WORD_TYPE(src->type)) {
+                                       if (bptr->type == BBTYPE_SBR) {
+                                               d = reg_of_var(src, REG_ITMP1);
+                                               i386_pop_reg(d);
+                                               store_reg_to_var_int(src, d);
+
+                                       } else if (bptr->type == BBTYPE_EXH) {
+                                               d = reg_of_var(src, REG_ITMP1);
+                                               M_INTMOVE(REG_ITMP1, d);
+                                               store_reg_to_var_int(src, d);
+                                       }
+
+                               } else {
+                                       panic("copy interface registers: longs have to me in memory (begin 1)");
+                               }
+
+                       } else {
+                               d = reg_of_var(src, REG_ITMP1);
+                               if ((src->varkind != STACKVAR)) {
+                                       s2 = src->type;
+                                       if (IS_FLT_DBL_TYPE(s2)) {
+                                               s1 = interfaces[len][s2].regoff;
+                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                                       M_FLTMOVE(s1, d);
+
+                                               } else {
+                                                       if (s2 == TYPE_FLT) {
+                                                               i386_flds_membase(REG_SP, s1 * 8);
+
+                                                       } else {
+                                                               i386_fldl_membase(REG_SP, s1 * 8);
+                                                       }
+                                               }
+                                               store_reg_to_var_flt(src, d);
+
+                                       } else {
+                                               s1 = interfaces[len][s2].regoff;
+                                               if (!IS_2_WORD_TYPE(interfaces[len][s2].type)) {
+                                                       if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                                               M_INTMOVE(s1, d);
+
+                                                       } else {
+                                                               i386_mov_membase_reg(REG_SP, s1 * 8, d);
+                                                       }
+                                                       store_reg_to_var_int(src, d);
+
+                                               } else {
+                                                       if (interfaces[len][s2].flags & INMEMORY) {
+                                                               M_LNGMEMMOVE(s1, src->regoff);
+
+                                                       } else {
+                                                               panic("copy interface registers: longs have to be in memory (begin 2)");
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       src = src->prev;
+               }
+
+               /* walk through all instructions */
+               
+               src = bptr->instack;
+               len = bptr->icount;
+               for (iptr = bptr->iinstr;
+                   len > 0;
+                   src = iptr->dst, len--, iptr++) {
+
+       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
+       switch (iptr->opc) {
+
+               case ICMD_NOP:        /* ...  ==> ...                                 */
+                       break;
+
+               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_test_reg_reg(src->regoff, src->regoff);
+                       }
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addxnullrefs(mcodeptr);
+                       break;
+
+               /* constant operations ************************************************/
+
+               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.i = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_imm_membase(iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               if (iptr->val.i == 0) {
+                                       i386_alu_reg_reg(I386_XOR, d, d);
+
+                               } else {
+                                       i386_mov_imm_reg(iptr->val.i, d);
+                               }
+                       }
+                       break;
+
+               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.l = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_imm_membase(iptr->val.l, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_imm_membase(iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
+                               
+                       } else {
+                               panic("LCONST: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.f = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (iptr->val.f == 0.0) {
+                               i386_fldz();
+                               fpu_st_offset++;
+
+                               /* -0.0 */
+                               if (iptr->val.i == 0x80000000) {
+                                       i386_fchs();
+                               }
+
+                       } else if (iptr->val.f == 1.0) {
+                               i386_fld1();
+                               fpu_st_offset++;
+
+                       } else if (iptr->val.f == 2.0) {
+                               i386_fld1();
+                               i386_fld1();
+                               i386_faddp();
+                               fpu_st_offset++;
+
+                       } else {
+                               a = dseg_addfloat(iptr->val.f);
+                               i386_mov_imm_reg(0, REG_ITMP1);
+                               dseg_adddata(mcodeptr);
+                               i386_flds_membase(REG_ITMP1, a);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+               
+               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.d = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (iptr->val.d == 0.0) {
+                               i386_fldz();
+                               fpu_st_offset++;
+
+                               /* -0.0 */
+                               if (iptr->val.l == 0x8000000000000000LL) {
+                                       i386_fchs();
+                               }
+
+                       } else if (iptr->val.d == 1.0) {
+                               i386_fld1();
+                               fpu_st_offset++;
+
+                       } else if (iptr->val.d == 2.0) {
+                               i386_fld1();
+                               i386_fld1();
+                               i386_faddp();
+                               fpu_st_offset++;
+
+                       } else {
+                               a = dseg_adddouble(iptr->val.d);
+                               i386_mov_imm_reg(0, REG_ITMP1);
+                               dseg_adddata(mcodeptr);
+                               i386_fldl_membase(REG_ITMP1, a);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.a = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_imm_membase((s4) iptr->val.a, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               if ((s4) iptr->val.a == 0) {
+                                       i386_alu_reg_reg(I386_XOR, d, d);
+
+                               } else {
+                                       i386_mov_imm_reg((s4) iptr->val.a, d);
+                               }
+                       }
+                       break;
+
+
+               /* load/store operations **********************************************/
+
+               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_ALOAD:      /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (var->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, var->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_mov_reg_membase(var->regoff, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (var->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, var->regoff * 8, iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(var->regoff, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_LLOAD:      /* ...  ==> ..., content of local variable      */
+                                     /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (var->flags & INMEMORY) {
+                                       M_LNGMEMMOVE(var->regoff, iptr->dst->regoff);
+
+                               } else {
+                                       panic("LLOAD: longs have to be in memory");
+                               }
+
+                       } else {
+                               panic("LLOAD: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
+                                     /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (var->flags & INMEMORY) {
+                               i386_flds_membase(REG_SP, var->regoff * 8);
+                               fpu_st_offset++;
+                       } else {
+                               i386_fld_reg(var->regoff + fpu_st_offset);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DLOAD:      /* ...  ==> ..., content of local variable      */
+                                     /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (var->flags & INMEMORY) {
+                               i386_fldl_membase(REG_SP, var->regoff * 8);
+                               fpu_st_offset++;
+                       } else {
+                               i386_fld_reg(var->regoff + fpu_st_offset);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
+               case ICMD_ASTORE:     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, var->regoff * 8);
+                                       
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, var->regoff * 8);
+                               }
+
+                       } else {
+                               var_to_reg_int(s1, src, var->regoff);
+                               M_INTMOVE(s1, var->regoff);
+                       }
+                       break;
+
+               case ICMD_LSTORE:     /* ..., value  ==> ...                          */
+                                     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       M_LNGMEMMOVE(src->regoff, var->regoff);
+
+                               } else {
+                                       panic("LSTORE: longs have to be in memory");
+                               }
+
+                       } else {
+                               panic("LSTORE: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
+                                     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               i386_fstps_membase(REG_SP, var->regoff * 8);
+                               fpu_st_offset--;
+                       } else {
+                               var_to_reg_flt(s1, src, var->regoff);
+/*                             M_FLTMOVE(s1, var->regoff); */
+                               i386_fstp_reg(var->regoff + fpu_st_offset);
+                               fpu_st_offset--;
+                       }
+                       break;
+
+               case ICMD_DSTORE:     /* ..., value  ==> ...                          */
+                                     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               i386_fstpl_membase(REG_SP, var->regoff * 8);
+                               fpu_st_offset--;
+                       } else {
+                               var_to_reg_flt(s1, src, var->regoff);
+/*                             M_FLTMOVE(s1, var->regoff); */
+                               i386_fstp_reg(var->regoff + fpu_st_offset);
+                               fpu_st_offset--;
+                       }
+                       break;
+
+
+               /* pop/dup/swap operations ********************************************/
+
+               /* attention: double and longs are only one entry in CACAO ICMDs      */
+
+               case ICMD_POP:        /* ..., value  ==> ...                          */
+               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
+                       break;
+
+#define M_COPY(from,to) \
+               d = reg_of_var(to, REG_ITMP1); \
+                       if ((from->regoff != to->regoff) || \
+                           ((from->flags ^ to->flags) & INMEMORY)) { \
+                               if (IS_FLT_DBL_TYPE(from->type)) { \
+                                       var_to_reg_flt(s1, from, d); \
+/*                                     M_FLTMOVE(s1, d);*/ \
+                                       store_reg_to_var_flt(to, d); \
+                               } else { \
+                    if (!IS_2_WORD_TYPE(from->type)) { \
+                        if (to->flags & INMEMORY) { \
+                             if (from->flags & INMEMORY) { \
+                                 i386_mov_membase_reg(REG_SP, from->regoff * 8, REG_ITMP1); \
+                                 i386_mov_reg_membase(REG_ITMP1, REG_SP, to->regoff * 8); \
+                             } else { \
+                                 i386_mov_reg_membase(from->regoff, REG_SP, to->regoff * 8); \
+                             } \
+                        } else { \
+                             if (from->flags & INMEMORY) { \
+                                 i386_mov_membase_reg(REG_SP, from->regoff * 8, to->regoff); \
+                             } else { \
+                                 i386_mov_reg_reg(from->regoff, to->regoff); \
+                             } \
+                        } \
+                    } else { \
+                        M_LNGMEMMOVE(from->regoff, to->regoff); \
+                    } \
+                               } \
+                       }
+
+               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
+                       M_COPY(src, iptr->dst);
+                       break;
+
+               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
+
+                       M_COPY(src,       iptr->dst->prev->prev);
+
+               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
+
+                       M_COPY(src,       iptr->dst);
+                       M_COPY(src->prev, iptr->dst->prev);
+                       break;
+
+               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
+
+                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
+
+               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
+
+                       M_COPY(src,             iptr->dst);
+                       M_COPY(src->prev,       iptr->dst->prev);
+                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
+                       M_COPY(src, iptr->dst->prev->prev->prev);
+                       break;
+
+               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
+
+                       M_COPY(src,                   iptr->dst);
+                       M_COPY(src->prev,             iptr->dst->prev);
+                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
+                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
+                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
+                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
+                       break;
+
+               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
+
+                       M_COPY(src, iptr->dst->prev);
+                       M_COPY(src->prev, iptr->dst);
+                       break;
+
+
+               /* integer operations *************************************************/
+
+               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_neg_reg(REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       }
+
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                                       i386_neg_reg(iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_neg_reg(iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_imm_membase(I386_ADC, 0, REG_SP, iptr->dst->regoff * 8 + 4);
+                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_neg_reg(REG_ITMP1);
+                                               i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
+                                               i386_neg_reg(REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_EAX);
+                                       i386_cltd();
+                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, I386_EAX);
+                                       i386_cltd();
+                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SHL, 24, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, 24, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_shift_imm_membase(I386_SHL, 24, REG_SP, iptr->dst->regoff * 8);
+                                       i386_shift_imm_membase(I386_SAR, 24, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SHL, 24, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SAR, 24, iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SHL, 24, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SAR, 24, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_alu_imm_membase(I386_AND, 0x0000ffff, REG_SP, iptr->dst->regoff * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_alu_imm_reg(I386_AND, 0x0000ffff, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       }
+
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_alu_imm_membase(I386_AND, 0x0000ffff, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                                       i386_alu_imm_reg(I386_AND, 0x0000ffff, iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_alu_imm_reg(I386_AND, 0x0000ffff, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SHL, 16, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, 16, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_shift_imm_membase(I386_SHL, 16, REG_SP, iptr->dst->regoff * 8);
+                                       i386_shift_imm_membase(I386_SAR, 16, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SHL, 16, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SAR, 16, iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SHL, 16, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SAR, 16, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+
+               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialu(I386_ADD, src, iptr);
+                       break;
+
+               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       /* should we use a inc optimization for smaller code size? */
+                       i386_emit_ialuconst(I386_ADD, src, iptr);
+                       break;
+
+               case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_reg_membase(I386_ADD, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_reg_membase(I386_ADC, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else if (src->prev->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_reg_membase(I386_ADD, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_reg_membase(I386_ADC, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_membase_reg(I386_ADD, REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_alu_membase_reg(I386_ADC, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+
+                               }
+                       }
+                       break;
+
+               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_alu_imm_membase(I386_ADD, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_imm_membase(I386_ADC, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_imm_reg(I386_ADD, iptr->val.l, REG_ITMP1);
+                                               i386_alu_imm_reg(I386_ADC, iptr->val.l >> 32, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       if (src->prev->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_alu_reg_membase(I386_SUB, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       }
+
+                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                                       M_INTMOVE(src->prev->regoff, REG_ITMP1);
+                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       if (src->prev->regoff == iptr->dst->regoff) {
+                                               i386_alu_reg_membase(I386_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       }
+
+                               } else {
+                                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_alu_reg_membase(I386_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, d);
+                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, d);
+
+                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                                       M_INTMOVE(src->prev->regoff, d);
+                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, d);
+
+                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       /* workaround for reg alloc */
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
+                                               M_INTMOVE(REG_ITMP1, d);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, d);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, d);
+                                       }
+
+                               } else {
+                                       /* workaround for reg alloc */
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               M_INTMOVE(src->prev->regoff, REG_ITMP1);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
+                                               M_INTMOVE(REG_ITMP1, d);
+
+                                       } else {
+                                               M_INTMOVE(src->prev->regoff, d);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, d);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialuconst(I386_SUB, src, iptr);
+                       break;
+
+               case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       if (src->prev->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_reg_membase(I386_SUB, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_reg_membase(I386_SBB, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_alu_membase_reg(I386_SBB, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_alu_imm_membase(I386_SUB, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_imm_membase(I386_SBB, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               /* TODO: could be size optimized with lea -- see gcc output */
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_imm_reg(I386_SUB, iptr->val.l, REG_ITMP1);
+                                               i386_alu_imm_reg(I386_SBB, iptr->val.l >> 32, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_imul_reg_reg(src->prev->regoff, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                       i386_imul_reg_reg(src->regoff, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_mov_reg_reg(src->prev->regoff, REG_ITMP1);
+                                       i386_imul_reg_reg(src->regoff, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_imul_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+
+                               } else {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_imul_reg_reg(src->prev->regoff, iptr->dst->regoff);
+
+                                       } else {
+                                               M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                                               i386_imul_reg_reg(src->regoff, iptr->dst->regoff);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_imul_imm_membase_reg(iptr->val.i, REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_imul_imm_reg_reg(iptr->val.i, src->regoff, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_imul_imm_membase_reg(iptr->val.i, REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+                               } else {
+                                       i386_imul_imm_reg_reg(iptr->val.i, src->regoff, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_LMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);        /* mem -> EAX             */
+                                       /* optimize move EAX -> REG_ITMP3 is slower??? */
+/*                                     i386_mov_reg_reg(I386_EAX, REG_ITMP3); */
+                                       i386_mul_membase(REG_SP, src->regoff * 8);                            /* mem * EAX -> EDX:EAX   */
+
+                                       /* TODO: optimize move EAX -> REG_ITMP3 */
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP3);   /* mem -> ITMP3           */
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);            /* mem * ITMP3 -> ITMP3   */
+                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
+
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP3);       /* mem -> ITMP3           */
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);        /* mem * ITMP3 -> ITMP3   */
+
+                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
+                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+               case ICMD_LMULCONST:  /* ..., value  ==> ..., value * constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_imm_reg(iptr->val.l, I386_EAX);                              /* imm -> EAX             */
+                                       i386_mul_membase(REG_SP, src->regoff * 8);                            /* mem * EAX -> EDX:EAX   */
+                                       /* TODO: optimize move EAX -> REG_ITMP3 */
+                                       i386_mov_imm_reg(iptr->val.l >> 32, REG_ITMP3);                       /* imm -> ITMP3           */
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);            /* mem * ITMP3 -> ITMP3   */
+
+                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
+                                       i386_mov_imm_reg(iptr->val.l, REG_ITMP3);                             /* imm -> ITMP3           */
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);        /* mem * ITMP3 -> ITMP3   */
+
+                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
+                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+#define gen_div_check(v) \
+    if (checknull) { \
+        if ((v)->flags & INMEMORY) { \
+            i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8); \
+        } else { \
+            i386_test_reg_reg(src->regoff, src->regoff); \
+        } \
+        i386_jcc(I386_CC_E, 0); \
+        codegen_addxdivrefs(mcodeptr); \
+    }
+
+               case ICMD_IDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       var_to_reg_int(s1, src, REG_ITMP3);
+                       gen_div_check(src);
+               if (src->prev->flags & INMEMORY) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);
+
+                       } else {
+                               M_INTMOVE(src->prev->regoff, I386_EAX);
+                       }
+                       
+                       i386_alu_imm_reg(I386_CMP, 0x80000000, I386_EAX);    /* check as described in jvm spec */
+                       i386_jcc(I386_CC_NE, 3 + 6);
+                       i386_alu_imm_reg(I386_CMP, -1, s1);
+                       i386_jcc(I386_CC_E, 1 + 2);
+
+                       i386_cltd();
+                       i386_idiv_reg(s1);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               M_INTMOVE(I386_EAX, iptr->dst->regoff);
+                       }
+                       break;
+
+               case ICMD_IREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       var_to_reg_int(s1, src, REG_ITMP3);
+                       gen_div_check(src);
+                       if (src->prev->flags & INMEMORY) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);
+
+                       } else {
+                               M_INTMOVE(src->prev->regoff, I386_EAX);
+                       }
+                       
+                       i386_alu_imm_reg(I386_CMP, 0x80000000, I386_EAX);    /* check as described in jvm spec */
+                       i386_jcc(I386_CC_NE, 2 + 3 + 6);
+                       i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EDX);
+                       i386_alu_imm_reg(I386_CMP, -1, s1);
+                       i386_jcc(I386_CC_E, 1 + 2);
+
+                       i386_cltd();
+                       i386_idiv_reg(s1);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               M_INTMOVE(I386_EDX, iptr->dst->regoff);
+                       }
+                       break;
+
+               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       /* TODO: optimize for `/ 2' */
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       M_INTMOVE(s1, d);
+                       i386_test_reg_reg(d, d);
+                       a = 2;
+                       CALCIMMEDIATEBYTES(a, (1 << iptr->val.i) - 1);
+                       i386_jcc(I386_CC_NS, a);
+                       i386_alu_imm_reg(I386_ADD, (1 << iptr->val.i) - 1, d);
+                               
+                       i386_shift_imm_reg(I386_SAR, iptr->val.i, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LDIVPOW2:   /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       a = 2;
+                                       CALCIMMEDIATEBYTES(a, (1 << iptr->val.i) - 1);
+                                       a += 3;
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+
+                                       i386_test_reg_reg(REG_ITMP2, REG_ITMP2);
+                                       i386_jcc(I386_CC_NS, a);
+                                       i386_alu_imm_reg(I386_ADD, (1 << iptr->val.i) - 1, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
+                                       i386_shrd_imm_reg_reg(iptr->val.i, REG_ITMP2, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, iptr->val.i, REG_ITMP2);
+
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                       if (s1 == d) {
+                               M_INTMOVE(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                       } 
+
+                       a = 2;
+                       a += 2;
+                       a += 2;
+                       CALCIMMEDIATEBYTES(a, iptr->val.i);
+                       a += 2;
+
+                       /* TODO: optimize */
+                       M_INTMOVE(s1, d);
+                       i386_alu_imm_reg(I386_AND, iptr->val.i, d);
+                       i386_test_reg_reg(s1, s1);
+                       i386_jcc(I386_CC_GE, a);
+                       i386_mov_reg_reg(s1, d);
+                       i386_neg_reg(d);
+                       i386_alu_imm_reg(I386_AND, iptr->val.i, d);
+                       i386_neg_reg(d);
+
+/*                     M_INTMOVE(s1, I386_EAX); */
+/*                     i386_cltd(); */
+/*                     i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EAX); */
+/*                     i386_alu_reg_reg(I386_SUB, I386_EDX, I386_EAX); */
+/*                     i386_alu_reg_reg(I386_AND, iptr->val.i, I386_EAX); */
+/*                     i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EAX); */
+/*                     i386_alu_reg_reg(I386_SUB, I386_EDX, I386_EAX); */
+/*                     M_INTMOVE(I386_EAX, d); */
+
+/*                     i386_alu_reg_reg(I386_XOR, d, d); */
+/*                     i386_mov_imm_reg(iptr->val.i, I386_ECX); */
+/*                     i386_shrd_reg_reg(s1, d); */
+/*                     i386_shift_imm_reg(I386_SHR, 32 - iptr->val.i, d); */
+
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LREMPOW2:   /* ..., value  ==> ..., value % constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       /* Intel algorithm -- does not work, because constant is wrong */
+/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1); */
+/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3); */
+
+/*                                     M_INTMOVE(REG_ITMP1, REG_ITMP2); */
+/*                                     i386_test_reg_reg(REG_ITMP3, REG_ITMP3); */
+/*                                     i386_jcc(I386_CC_NS, offset); */
+/*                                     i386_alu_imm_reg(I386_ADD, (1 << iptr->val.l) - 1, REG_ITMP2); */
+/*                                     i386_alu_imm_reg(I386_ADC, 0, REG_ITMP3); */
+                                       
+/*                                     i386_shrd_imm_reg_reg(iptr->val.l, REG_ITMP3, REG_ITMP2); */
+/*                                     i386_shift_imm_reg(I386_SAR, iptr->val.l, REG_ITMP3); */
+/*                                     i386_shld_imm_reg_reg(iptr->val.l, REG_ITMP2, REG_ITMP3); */
+
+/*                                     i386_shift_imm_reg(I386_SHL, iptr->val.l, REG_ITMP2); */
+
+/*                                     i386_alu_reg_reg(I386_SUB, REG_ITMP2, REG_ITMP1); */
+/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2); */
+/*                                     i386_alu_reg_reg(I386_SBB, REG_ITMP3, REG_ITMP2); */
+
+/*                                     i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
+/*                                     i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
+
+                                       /* Alpha algorithm */
+                                       a = 3;
+                                       CALCOFFSETBYTES(a, src->regoff * 8);
+                                       a += 3;
+                                       CALCOFFSETBYTES(a, src->regoff * 8 + 4);
+
+                                       a += 2;
+                                       a += 3;
+                                       a += 2;
+
+                                       /* TODO: hmm, don't know if this is always correct */
+                                       a += 2;
+                                       CALCIMMEDIATEBYTES(a, iptr->val.l & 0x00000000ffffffff);
+                                       a += 2;
+                                       CALCIMMEDIATEBYTES(a, iptr->val.l >> 32);
+
+                                       a += 2;
+                                       a += 3;
+                                       a += 2;
+
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                       
+                                       i386_alu_imm_reg(I386_AND, iptr->val.l, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_AND, iptr->val.l >> 32, REG_ITMP2);
+                                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8 + 4);
+                                       i386_jcc(I386_CC_GE, a);
+
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                       
+                                       i386_neg_reg(REG_ITMP1);
+                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
+                                       i386_neg_reg(REG_ITMP2);
+                                       
+                                       i386_alu_imm_reg(I386_AND, iptr->val.l, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_AND, iptr->val.l >> 32, REG_ITMP2);
+                                       
+                                       i386_neg_reg(REG_ITMP1);
+                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
+                                       i386_neg_reg(REG_ITMP2);
+
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishift(I386_SHL, src, iptr);
+                       break;
+
+               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishiftconst(I386_SHL, src, iptr);
+                       break;
+
+               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishift(I386_SAR, src, iptr);
+                       break;
+
+               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishiftconst(I386_SAR, src, iptr);
+                       break;
+
+               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishift(I386_SHR, src, iptr);
+                       break;
+
+               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishiftconst(I386_SHR, src, iptr);
+                       break;
+
+               case ICMD_LSHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ){
+                               if (src->prev->flags & INMEMORY) {
+/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
+
+/*                                             if (src->flags & INMEMORY) { */
+/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
+/*                                             } else { */
+/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
+/*                                             } */
+
+/*                                             i386_test_imm_reg(32, I386_ECX); */
+/*                                             i386_jcc(I386_CC_E, 2 + 2); */
+/*                                             i386_mov_reg_reg(REG_ITMP1, REG_ITMP2); */
+/*                                             i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1); */
+                                               
+/*                                             i386_shld_reg_membase(REG_ITMP1, REG_SP, src->prev->regoff * 8 + 4); */
+/*                                             i386_shift_membase(I386_SHL, REG_SP, iptr->dst->regoff * 8); */
+
+/*                                     } else { */
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                                               
+                                               if (src->flags & INMEMORY) {
+                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                                               } else {
+                                                       M_INTMOVE(src->regoff, I386_ECX);
+                                               }
+                                               
+                                               i386_test_imm_reg(32, I386_ECX);
+                                               i386_jcc(I386_CC_E, 2 + 2);
+                                               i386_mov_reg_reg(REG_ITMP1, REG_ITMP2);
+                                               i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
+                                               
+                                               i386_shld_reg_reg(REG_ITMP1, REG_ITMP2);
+                                               i386_shift_reg(I386_SHL, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+/*                                     } */
+                               }
+                       }
+                       break;
+
+        case ICMD_LSHLCONST:  /* ..., value  ==> ..., value << constant       */
+                                         /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+
+                               if (iptr->val.i & 0x20) {
+                                       i386_mov_reg_reg(REG_ITMP1, REG_ITMP2);
+                                       i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
+                                       i386_shld_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP1, REG_ITMP2);
+
+                               } else {
+                                       i386_shld_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP1, REG_ITMP2);
+                                       i386_shift_imm_reg(I386_SHL, iptr->val.i & 0x3f, REG_ITMP1);
+                               }
+
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+                       break;
+
+               case ICMD_LSHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ){
+                               if (src->prev->flags & INMEMORY) {
+/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
+                                               /* TODO: optimize */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2); */
+
+/*                                             if (src->flags & INMEMORY) { */
+/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
+/*                                             } else { */
+/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
+/*                                             } */
+
+/*                                             i386_test_imm_reg(32, I386_ECX); */
+/*                                             i386_jcc(I386_CC_E, 2 + 3); */
+/*                                             i386_mov_reg_reg(REG_ITMP2, REG_ITMP1); */
+/*                                             i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2); */
+                                               
+/*                                             i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1); */
+/*                                             i386_shift_reg(I386_SAR, REG_ITMP2); */
+/*                                             i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
+/*                                             i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
+
+/*                                     } else { */
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+
+                                               if (src->flags & INMEMORY) {
+                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                                               } else {
+                                                       M_INTMOVE(src->regoff, I386_ECX);
+                                               }
+
+                                               i386_test_imm_reg(32, I386_ECX);
+                                               i386_jcc(I386_CC_E, 2 + 3);
+                                               i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
+                                               i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2);
+                                               
+                                               i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1);
+                                               i386_shift_reg(I386_SAR, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+/*                                     } */
+                               }
+                       }
+                       break;
+
+               case ICMD_LSHRCONST:  /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+
+                               if (iptr->val.i & 0x20) {
+                                       i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2);
+                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
+
+                               } else {
+                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, iptr->val.i & 0x3f, REG_ITMP2);
+                               }
+
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+                       break;
+
+               case ICMD_LUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ){
+                               if (src->prev->flags & INMEMORY) {
+/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
+                                               /* TODO: optimize */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2); */
+
+/*                                             if (src->flags & INMEMORY) { */
+/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
+/*                                             } else { */
+/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
+/*                                             } */
+
+/*                                             i386_test_imm_reg(32, I386_ECX); */
+/*                                             i386_jcc(I386_CC_E, 2 + 2); */
+/*                                             i386_mov_reg_reg(REG_ITMP2, REG_ITMP1); */
+/*                                             i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2); */
+                                               
+/*                                             i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1); */
+/*                                             i386_shift_reg(I386_SHR, REG_ITMP2); */
+/*                                             i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
+/*                                             i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
+
+/*                                     } else { */
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+
+                                               if (src->flags & INMEMORY) {
+                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                                               } else {
+                                                       M_INTMOVE(src->regoff, I386_ECX);
+                                               }
+
+                                               i386_test_imm_reg(32, I386_ECX);
+                                               i386_jcc(I386_CC_E, 2 + 2);
+                                               i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
+                                               i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+                                               
+                                               i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1);
+                                               i386_shift_reg(I386_SHR, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+/*                                     } */
+                               }
+                       }
+                       break;
+
+               case ICMD_LUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+
+                               if (iptr->val.i & 0x20) {
+                                       i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
+                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
+
+                               } else {
+                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SHR, iptr->val.i & 0x3f, REG_ITMP2);
+                               }
+
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+                       break;
+
+               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialu(I386_AND, src, iptr);
+                       break;
+
+               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialuconst(I386_AND, src, iptr);
+                       break;
+
+               case ICMD_LAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_lalu(I386_AND, src, iptr);
+                       break;
+
+               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_laluconst(I386_AND, src, iptr);
+                       break;
+
+               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialu(I386_OR, src, iptr);
+                       break;
+
+               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialuconst(I386_OR, src, iptr);
+                       break;
+
+               case ICMD_LOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_lalu(I386_OR, src, iptr);
+                       break;
+
+               case ICMD_LORCONST:   /* ..., value  ==> ..., value | constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_laluconst(I386_OR, src, iptr);
+                       break;
+
+               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialu(I386_XOR, src, iptr);
+                       break;
+
+               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialuconst(I386_XOR, src, iptr);
+                       break;
+
+               case ICMD_LXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_lalu(I386_XOR, src, iptr);
+                       break;
+
+               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_laluconst(I386_XOR, src, iptr);
+                       break;
+
+               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
+                                     /* op1 = variable, val.i = constant             */
+
+                       var = &(locals[iptr->op1][TYPE_INT]);
+                       if (var->flags & INMEMORY) {
+                               if (iptr->val.i == 1) {
+                                       i386_inc_membase(REG_SP, var->regoff * 8);
+                               } else if (iptr->val.i == -1) {
+                                       i386_dec_membase(REG_SP, var->regoff * 8);
+
+                               } else {
+                                       i386_alu_imm_membase(I386_ADD, iptr->val.i, REG_SP, var->regoff * 8);
+                               }
+
+                       } else {
+                               if (iptr->val.i == 1) {
+                                       i386_inc_reg(var->regoff);
+                               } else if (iptr->val.i == -1) {
+                                       i386_dec_reg(var->regoff);
+
+                               } else {
+                                       i386_alu_imm_reg(I386_ADD, iptr->val.i, var->regoff);
+                               }
+                       }
+                       break;
+
+
+               /* floating operations ************************************************/
+#if 0
+#define ROUND_TO_SINGLE \
+                       i386_fstps_membase(REG_SP, -8); \
+                       i386_flds_membase(REG_SP, -8);
+
+#define ROUND_TO_DOUBLE \
+                       i386_fstpl_membase(REG_SP, -8); \
+                       i386_fldl_membase(REG_SP, -8);
+
+#define FPU_SET_24BIT_MODE \
+                       if (!fpu_in_24bit_mode) { \
+                               i386_fldcw_mem(&fpu_ctrlwrd_24bit); \
+                               fpu_in_24bit_mode = 1; \
+                       }
+
+#define FPU_SET_53BIT_MODE \
+                       if (fpu_in_24bit_mode) { \
+                               i386_fldcw_mem(&fpu_ctrlwrd_53bit); \
+                               fpu_in_24bit_mode = 0; \
+                       }
+#else
+#define ROUND_TO_SINGLE
+#define ROUND_TO_DOUBLE
+#define FPU_SET_24BIT_MODE
+#define FPU_SET_53BIT_MODE
+#endif
+               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
+
+                       FPU_SET_24BIT_MODE;
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       i386_fchs();
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
+
+                       FPU_SET_53BIT_MODE;
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       i386_fchs();
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_faddp();
+                       fpu_st_offset--;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_faddp();
+                       fpu_st_offset--;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_fsubp();
+                       fpu_st_offset--;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_fsubp();
+                       fpu_st_offset--;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_fmulp();
+                       fpu_st_offset--;
+                       ROUND_TO_SINGLE;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+
+/*                     i386_fldt_mem(subnormal_bias1); */
+/*                     i386_fmulp(); */
+
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+
+                       i386_fmulp();
+                       fpu_st_offset--;
+
+/*                     i386_fldt_mem(subnormal_bias2); */
+/*                     i386_fmulp(); */
+
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_fdivp();
+                       fpu_st_offset--;
+                       ROUND_TO_SINGLE;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+
+/*                     i386_fldt_mem(subnormal_bias1); */
+/*                     i386_fmulp(); */
+
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+
+                       i386_fdivp();
+                       fpu_st_offset--;
+
+/*                     i386_fldt_mem(subnormal_bias2); */
+/*                     i386_fmulp(); */
+
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       /* exchanged to skip fxch */
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+/*                     i386_fxch(); */
+                       i386_fprem();
+                       i386_wait();
+                       i386_fnstsw();
+                       i386_sahf();
+                       i386_jcc(I386_CC_P, -(2 + 1 + 2 + 1 + 6));
+                       store_reg_to_var_flt(iptr->dst, d);
+                       i386_ffree_reg(0);
+                       i386_fincstp();
+                       fpu_st_offset--;
+                       break;
+
+               case ICMD_DREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       /* exchanged to skip fxch */
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+/*                     i386_fxch(); */
+                       i386_fprem();
+                       i386_wait();
+                       i386_fnstsw();
+                       i386_sahf();
+                       i386_jcc(I386_CC_P, -(2 + 1 + 2 + 1 + 6));
+                       store_reg_to_var_flt(iptr->dst, d);
+                       i386_ffree_reg(0);
+                       i386_fincstp();
+                       fpu_st_offset--;
+                       break;
+
+               case ICMD_I2F:       /* ..., value  ==> ..., (float) value            */
+               case ICMD_I2D:       /* ..., value  ==> ..., (double) value           */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (src->flags & INMEMORY) {
+                               i386_fildl_membase(REG_SP, src->regoff * 8);
+                               fpu_st_offset++;
+
+                       } else {
+                               a = dseg_adds4(0);
+                               i386_mov_imm_reg(0, REG_ITMP1);
+                               dseg_adddata(mcodeptr);
+                               i386_mov_reg_membase(src->regoff, REG_ITMP1, a);
+                               i386_fildl_membase(REG_ITMP1, a);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_L2F:       /* ..., value  ==> ..., (float) value            */
+               case ICMD_L2D:       /* ..., value  ==> ..., (double) value           */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (src->flags & INMEMORY) {
+                               i386_fildll_membase(REG_SP, src->regoff * 8);
+                               fpu_st_offset++;
+
+                       } else {
+                               panic("L2F: longs have to be in memory");
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+                       
+               case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
+                       i386_mov_imm_reg(0, REG_ITMP1);
+                       dseg_adddata(mcodeptr);
+                       i386_fldcw_membase(REG_ITMP1, a);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_fistpl_membase(REG_SP, iptr->dst->regoff * 8);
+                               fpu_st_offset--;
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+
+                       } else {
+                               a = dseg_adds4(0);
+                               i386_fistpl_membase(REG_ITMP1, a);
+                               fpu_st_offset--;
+                               i386_mov_membase_reg(REG_ITMP1, a, iptr->dst->regoff);
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_reg(I386_CMP, 0x80000000, iptr->dst->regoff);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + ((REG_RESULT == d) ? 0 : 2);
+                       }
+
+                       i386_jcc(I386_CC_NE, a);
+
+                               /* XXX: change this when we use registers */
+                       i386_flds_membase(REG_SP, src->regoff * 8);
+                       i386_mov_imm_reg((s4) asm_builtin_f2i, REG_ITMP2);
+                       i386_call_reg(REG_ITMP2);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               M_INTMOVE(REG_RESULT, d);
+                       }
+                       break;
+
+               case ICMD_D2I:       /* ..., value  ==> ..., (int) value              */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
+                       i386_mov_imm_reg(0, REG_ITMP1);
+                       dseg_adddata(mcodeptr);
+                       i386_fldcw_membase(REG_ITMP1, a);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_fistpl_membase(REG_SP, iptr->dst->regoff * 8);
+                               fpu_st_offset--;
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+
+                       } else {
+                               a = dseg_adds4(0);
+                               i386_fistpl_membase(REG_ITMP1, a);
+                               fpu_st_offset--;
+                               i386_mov_membase_reg(REG_ITMP1, a, iptr->dst->regoff);
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_reg(I386_CMP, 0x80000000, iptr->dst->regoff);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + ((REG_RESULT == d) ? 0 : 2);
+                       }
+
+                       i386_jcc(I386_CC_NE, a);
+
+                       /* XXX: change this when we use registers */
+                       i386_fldl_membase(REG_SP, src->regoff * 8);
+                       i386_mov_imm_reg((s4) asm_builtin_d2i, REG_ITMP2);
+                       i386_call_reg(REG_ITMP2);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+                       } else {
+                               M_INTMOVE(REG_RESULT, d);
+                       }
+                       break;
+
+               case ICMD_F2L:       /* ..., value  ==> ..., (long) value             */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
+                       i386_mov_imm_reg(0, REG_ITMP1);
+                       dseg_adddata(mcodeptr);
+                       i386_fldcw_membase(REG_ITMP1, a);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_fistpll_membase(REG_SP, iptr->dst->regoff * 8);
+                               fpu_st_offset--;
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                               a = 6 + 4;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+                               a += 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2;
+                               a += 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+                               a += 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8 + 4);
+
+                               i386_jcc(I386_CC_NE, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, iptr->dst->regoff * 8);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+
+                               i386_jcc(I386_CC_NE, a);
+
+                               /* XXX: change this when we use registers */
+                               i386_flds_membase(REG_SP, src->regoff * 8);
+                               i386_mov_imm_reg((s4) asm_builtin_f2l, REG_ITMP2);
+                               i386_call_reg(REG_ITMP2);
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else {
+                               panic("F2L: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_D2L:       /* ..., value  ==> ..., (long) value             */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
+                       i386_mov_imm_reg(0, REG_ITMP1);
+                       dseg_adddata(mcodeptr);
+                       i386_fldcw_membase(REG_ITMP1, a);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_fistpll_membase(REG_SP, iptr->dst->regoff * 8);
+                               fpu_st_offset--;
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                               a = 6 + 4;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+                               a += 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2;
+                               a += 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+                               a += 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8 + 4);
+
+                               i386_jcc(I386_CC_NE, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, iptr->dst->regoff * 8);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+
+                               i386_jcc(I386_CC_NE, a);
+
+                               /* XXX: change this when we use registers */
+                               i386_fldl_membase(REG_SP, src->regoff * 8);
+                               i386_mov_imm_reg((s4) asm_builtin_d2l, REG_ITMP2);
+                               i386_call_reg(REG_ITMP2);
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else {
+                               panic("D2L: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       /* nothing to do */
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_D2F:       /* ..., value  ==> ..., (float) value            */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       /* nothing to do */
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
+               case ICMD_DCMPL:
+
+                       /* exchanged to skip fxch */
+                       var_to_reg_flt(s2, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s1, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                       i386_alu_reg_reg(I386_XOR, d, d);
+/*                     i386_fxch(); */
+                       i386_fucompp();
+                       fpu_st_offset -= 2;
+                       i386_fnstsw();
+                       i386_test_imm_reg(0x400, I386_EAX);    /* unordered treat as GT */
+                       i386_jcc(I386_CC_E, 6);
+                       i386_alu_imm_reg(I386_AND, 0x000000ff, I386_EAX);
+                       i386_sahf();
+                       i386_jcc(I386_CC_E, 6 + 1 + 5 + 1);
+                       i386_jcc(I386_CC_B, 1 + 5);
+                       i386_dec_reg(d);
+                       i386_jmp_imm(1);
+                       i386_inc_reg(d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
+               case ICMD_DCMPG:
+
+                       /* exchanged to skip fxch */
+                       var_to_reg_flt(s2, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s1, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                       i386_alu_reg_reg(I386_XOR, d, d);
+/*                     i386_fxch(); */
+                       i386_fucompp();
+                       fpu_st_offset -= 2;
+                       i386_fnstsw();
+                       i386_test_imm_reg(0x400, I386_EAX);    /* unordered treat as LT */
+                       i386_jcc(I386_CC_E, 3);
+                       i386_movb_imm_reg(1, I386_AH);
+                       i386_sahf();
+                       i386_jcc(I386_CC_E, 6 + 1 + 5 + 1);
+                       i386_jcc(I386_CC_B, 1 + 5);
+                       i386_dec_reg(d);
+                       i386_jmp_imm(1);
+                       i386_inc_reg(d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               /* memory operations **************************************************/
+
+#define gen_bound_check \
+    if (checkbounds) { \
+        i386_alu_membase_reg(I386_CMP, s1, OFFSET(java_arrayheader, size), s2); \
+        i386_jcc(I386_CC_AE, 0); \
+        codegen_addxboundrefs(mcodeptr); \
+    }
+
+               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., length              */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                       gen_nullptr_check(s1);
+                       i386_mov_membase_reg(s1, OFFSET(java_arrayheader, size), d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_mov_memindex_reg(OFFSET(java_objectarray, data[0]), s1, s2, 2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_memindex_reg(OFFSET(java_longarray, data[0]), s1, s2, 3, REG_ITMP3);
+                               i386_mov_reg_membase(REG_ITMP3, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_memindex_reg(OFFSET(java_longarray, data[0]) + 4, s1, s2, 3, REG_ITMP3);
+                               i386_mov_reg_membase(REG_ITMP3, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+                       break;
+
+               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_mov_memindex_reg(OFFSET(java_intarray, data[0]), s1, s2, 2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_flds_memindex(OFFSET(java_floatarray, data[0]), s1, s2, 2);
+                       fpu_st_offset++;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_fldl_memindex(OFFSET(java_doublearray, data[0]), s1, s2, 3);
+                       fpu_st_offset++;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_movzwl_memindex_reg(OFFSET(java_chararray, data[0]), s1, s2, 1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;                  
+
+               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_movswl_memindex_reg(OFFSET(java_shortarray, data[0]), s1, s2, 1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_movsbl_memindex_reg(OFFSET(java_bytearray, data[0]), s1, s2, 0, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_AASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       i386_mov_reg_memindex(s3, OFFSET(java_objectarray, data[0]), s1, s2, 2);
+                       break;
+
+               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+
+                       if (src->flags & INMEMORY) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);
+                               i386_mov_reg_memindex(REG_ITMP3, OFFSET(java_longarray, data[0]), s1, s2, 3);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);
+                               i386_mov_reg_memindex(REG_ITMP3, OFFSET(java_longarray, data[0]) + 4, s1, s2, 3);
+                       }
+                       break;
+
+               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       i386_mov_reg_memindex(s3, OFFSET(java_intarray, data[0]), s1, s2, 2);
+                       break;
+
+               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_flt(s3, src, REG_FTMP1);
+                       i386_fstps_memindex(OFFSET(java_floatarray, data[0]), s1, s2, 2);
+                       fpu_st_offset--;
+                       break;
+
+               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_flt(s3, src, REG_FTMP1);
+                       i386_fstpl_memindex(OFFSET(java_doublearray, data[0]), s1, s2, 3);
+                       fpu_st_offset--;
+                       break;
+
+               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       i386_movw_reg_memindex(s3, OFFSET(java_chararray, data[0]), s1, s2, 1);
+                       break;
+
+               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       i386_movw_reg_memindex(s3, OFFSET(java_shortarray, data[0]), s1, s2, 1);
+                       break;
+
+               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       M_INTMOVE(s3, REG_ITMP3);    /* because EBP, ESI, EDI have no xH and xL bytes */
+                       i386_movb_reg_memindex(REG_ITMP3, OFFSET(java_bytearray, data[0]), s1, s2, 0);
+                       break;
+
+
+               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
+                                     /* op1 = type, val.a = field address            */
+
+                       a = dseg_addaddress(&(((fieldinfo *)(iptr->val.a))->value));
+                       /* here it's slightly slower */
+                       i386_mov_imm_reg(0, REG_ITMP2);
+                       dseg_adddata(mcodeptr);
+                       i386_mov_membase_reg(REG_ITMP2, a, REG_ITMP2);
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                               case TYPE_ADR:
+                                       var_to_reg_int(s2, src, REG_ITMP1);
+                                       i386_mov_reg_membase(s2, REG_ITMP2, 0);
+                                       break;
+                               case TYPE_LNG:
+                                       if (src->flags & INMEMORY) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_ITMP2, 0);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_ITMP2, 0 + 4);
+                                       } else {
+                                               panic("PUTSTATIC: longs have to be in memory");
+                                       }
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_flt(s2, src, REG_FTMP1);
+                                       i386_fstps_membase(REG_ITMP2, 0);
+                                       fpu_st_offset--;
+                                       break;
+                               case TYPE_DBL:
+                                       var_to_reg_flt(s2, src, REG_FTMP1);
+                                       i386_fstpl_membase(REG_ITMP2, 0);
+                                       fpu_st_offset--;
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
+                                     /* op1 = type, val.a = field address            */
+
+                       a = dseg_addaddress(&(((fieldinfo *)(iptr->val.a))->value));
+                       i386_mov_imm_reg(0, REG_ITMP2);
+                       dseg_adddata(mcodeptr);
+                       i386_mov_membase_reg(REG_ITMP2, a, REG_ITMP2);
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                               case TYPE_ADR:
+                                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP2, 0, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_LNG:
+                                       d = reg_of_var(iptr->dst, REG_NULL);
+                                       if (iptr->dst->flags & INMEMORY) {
+                                               i386_mov_membase_reg(REG_ITMP2, 0, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_membase_reg(REG_ITMP2, 0 + 4, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       } else {
+                                               panic("GETSTATIC: longs have to be in memory");
+                                       }
+                                       break;
+                               case TYPE_FLT:
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       i386_flds_membase(REG_ITMP2, 0);
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               case TYPE_DBL:                          
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       i386_fldl_membase(REG_ITMP2, 0);
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
+                                     /* op1 = type, val.i = field offset             */
+
+                       a = ((fieldinfo *)(iptr->val.a))->offset;
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                               case TYPE_ADR:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       i386_mov_reg_membase(s2, s1, a);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       gen_nullptr_check(s1);
+                                       if (src->flags & INMEMORY) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP2, s1, a);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP2, s1, a + 4);
+                                       } else {
+                                               panic("PUTFIELD: longs have to be in memory");
+                                       }
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_flt(s2, src, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       i386_fstps_membase(s1, a);
+                                       fpu_st_offset--;
+                                       break;
+                               case TYPE_DBL:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_flt(s2, src, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       i386_fstpl_membase(s1, a);
+                                       fpu_st_offset--;
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
+                                     /* op1 = type, val.i = field offset             */
+
+                       a = ((fieldinfo *)(iptr->val.a))->offset;
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                               case TYPE_ADR:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       i386_mov_membase_reg(s1, a, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_NULL);
+                                       gen_nullptr_check(s1);
+                                       i386_mov_membase_reg(s1, a, REG_ITMP2);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_membase_reg(s1, a + 4, REG_ITMP2);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       i386_flds_membase(s1, a);
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               case TYPE_DBL:                          
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       i386_fldl_membase(s1, a);
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+
+               /* branch operations **************************************************/
+
+                       /* TWISTI */
+/*  #define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}} */
+#define ALIGNCODENOP do {} while (0)
+
+               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_INTMOVE(s1, REG_ITMP1_XPTR);
+
+                       i386_call_imm(0);                    /* passing exception pointer */
+                       i386_pop_reg(REG_ITMP2_XPC);
+
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_GOTO:         /* ... ==> ...                                */
+                                       /* op1 = target JavaVM pc                     */
+
+                       i386_jmp_imm(0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_JSR:          /* ... ==> ...                                */
+                                       /* op1 = target JavaVM pc                     */
+
+                       i386_call_imm(0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+                       
+               case ICMD_RET:          /* ... ==> ...                                */
+                                       /* op1 = local variable                       */
+
+                       var = &(locals[iptr->op1][TYPE_ADR]);
+                       var_to_reg_int(s1, var, REG_ITMP1);
+                       i386_jmp_reg(s1);
+                       break;
+
+               case ICMD_IFNULL:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_test_reg_reg(src->regoff, src->regoff);
+                       }
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_test_reg_reg(src->regoff, src->regoff);
+                       }
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFEQ:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFLT:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_L, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFLE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_LE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFNE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFGT:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_G, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFGE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_GE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               if (iptr->val.l == 0) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_alu_membase_reg(I386_OR, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+
+                               } else if (iptr->val.l > 0 && iptr->val.l <= 0x00000000ffffffff) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_XOR, iptr->val.l, REG_ITMP1);
+                                       i386_alu_membase_reg(I386_OR, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                                       
+                               } else {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                       i386_alu_imm_reg(I386_XOR, iptr->val.l >> 32, REG_ITMP2);
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_XOR, iptr->val.l, REG_ITMP1);
+                                       i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
+                               }
+                       }
+                       i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize as in IF_LEQ */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 6;
+                               CALCREGOFFBYTES(a, src->regoff);
+                               CALCIMMEDIATEBYTES(a, iptr->val.l);
+
+                               i386_jcc(I386_CC_G, a);
+
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
+                               i386_jcc(I386_CC_B, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize as in IF_LEQ */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 6;
+                               CALCREGOFFBYTES(a, src->regoff);
+                               CALCIMMEDIATEBYTES(a, iptr->val.l);
+                               
+                               i386_jcc(I386_CC_G, a);
+
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
+                               i386_jcc(I386_CC_BE, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize for val.l == 0 */
+                       if (src->flags & INMEMORY) {
+                               i386_mov_imm_reg(iptr->val.l, REG_ITMP1);
+                               i386_mov_imm_reg(iptr->val.l >> 32, REG_ITMP2);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
+                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
+                       }                       
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize as in IF_LEQ */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
+                               i386_jcc(I386_CC_G, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 6;
+                               CALCREGOFFBYTES(a, src->regoff);
+                               CALCIMMEDIATEBYTES(a, iptr->val.l);
+
+                               i386_jcc(I386_CC_L, a);
+
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
+                               i386_jcc(I386_CC_A, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize as in IF_LEQ */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
+                               i386_jcc(I386_CC_G, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 6;
+                               CALCREGOFFBYTES(a, src->regoff);
+                               CALCIMMEDIATEBYTES(a, iptr->val.l);
+
+                               i386_jcc(I386_CC_L, a);
+
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
+                               i386_jcc(I386_CC_AE, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_ACMPEQ:    /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPEQ:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
+                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
+                       }                       
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_ACMPNE:    /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPNE:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
+                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
+                       }                       
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_L, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPLT:    /* ..., value, value ==> ...                  */
+                                   /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 3 + 6;
+                               CALCREGOFFBYTES(a, src->prev->regoff);
+                               CALCREGOFFBYTES(a, src->regoff);
+
+                               i386_jcc(I386_CC_G, a);
+
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_jcc(I386_CC_B, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_G, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPGT:    /* ..., value, value ==> ...                  */
+                                /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                               i386_jcc(I386_CC_G, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 3 + 6;
+                               CALCREGOFFBYTES(a, src->prev->regoff);
+                               CALCREGOFFBYTES(a, src->regoff);
+
+                               i386_jcc(I386_CC_L, a);
+
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_jcc(I386_CC_A, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_LE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPLE:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 3 + 6;
+                               CALCREGOFFBYTES(a, src->prev->regoff);
+                               CALCREGOFFBYTES(a, src->regoff);
+
+                               i386_jcc(I386_CC_G, a);
+
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_jcc(I386_CC_BE, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_GE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPGE:    /* ..., value, value ==> ...                  */
+                                   /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                               i386_jcc(I386_CC_G, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 3 + 6;
+                               CALCREGOFFBYTES(a, src->prev->regoff);
+                               CALCREGOFFBYTES(a, src->regoff);
+
+                               i386_jcc(I386_CC_L, a);
+
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_jcc(I386_CC_AE, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               /* (value xx 0) ? IFxx_ICONST : ELSE_ICONST                           */
+
+               case ICMD_ELSE_ICONST:  /* handled by IFxx_ICONST                     */
+                       break;
+
+               case ICMD_IFEQ_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_NE, src, iptr);
+                       break;
+
+               case ICMD_IFNE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_E, src, iptr);
+                       break;
+
+               case ICMD_IFLT_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_GE, src, iptr);
+                       break;
+
+               case ICMD_IFGE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_L, src, iptr);
+                       break;
+
+               case ICMD_IFGT_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_LE, src, iptr);
+                       break;
+
+               case ICMD_IFLE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_G, src, iptr);
+                       break;
+
+
+               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
+               case ICMD_ARETURN:
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+                       var_to_reg_int(s1, src, REG_RESULT);
+                       M_INTMOVE(s1, REG_RESULT);
+                       goto nowperformreturn;
+
+               case ICMD_LRETURN:      /* ..., retvalue ==> ...                      */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+                       if (src->flags & INMEMORY) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_RESULT);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_RESULT2);
+
+                       } else {
+                               panic("LRETURN: longs have to be in memory");
+                       }
+                       goto nowperformreturn;
+
+               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+                       var_to_reg_flt(s1, src, REG_FRESULT);
+                       /* this may be an early return -- keep the offset correct for the remaining code */
+                       fpu_st_offset--;
+                       goto nowperformreturn;
+
+               case ICMD_DRETURN:      /* ..., retvalue ==> ...                      */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+                       var_to_reg_flt(s1, src, REG_FRESULT);
+                       /* this may be an early return -- keep the offset correct for the remaining code */
+                       fpu_st_offset--;
+                       goto nowperformreturn;
+
+               case ICMD_RETURN:      /* ...  ==> ...                                */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+
+nowperformreturn:
+                       {
+                       int r, p;
+                       
+                       p = parentargs_base;
+                       
+                       /* restore saved registers                                        */
+                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--) {
+                               p--;
+                               i386_mov_membase_reg(REG_SP, p * 8, savintregs[r]);
+                       }
+                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--) {
+                               p--;
+                               i386_fldl_membase(REG_SP, p * 8);
+                               fpu_st_offset++;
+                               if (iptr->opc == ICMD_FRETURN || iptr->opc == ICMD_DRETURN) {
+                                       i386_fstp_reg(savfltregs[r] + fpu_st_offset + 1);
+                               } else {
+                                       i386_fstp_reg(savfltregs[r] + fpu_st_offset);
+                               }
+                               fpu_st_offset--;
+                       }
+
+                       /* deallocate stack                                               */
+                       if (parentargs_base) {
+                               i386_alu_imm_reg(I386_ADD, parentargs_base * 8, REG_SP);
+                       }
+
+                       /* call trace function */
+                       if (runverbose) {
+                               i386_alu_imm_reg(I386_SUB, 4 + 8 + 8 + 4, REG_SP);
+
+                               i386_mov_imm_membase((s4) method, REG_SP, 0);
+
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, 4);
+                               i386_mov_reg_membase(REG_RESULT2, REG_SP, 4 + 4);
+                               
+                               i386_fstl_membase(REG_SP, 4 + 8);
+                               i386_fsts_membase(REG_SP, 4 + 8 + 8);
+
+                               i386_mov_imm_reg((s4) builtin_displaymethodstop, REG_ITMP1);
+/*                             i386_mov_imm_reg(asm_builtin_exittrace, REG_ITMP1); */
+                               i386_call_reg(REG_ITMP1);
+
+                               i386_mov_membase_reg(REG_SP, 4, REG_RESULT);
+                               i386_mov_membase_reg(REG_SP, 4 + 4, REG_RESULT2);
+
+                               i386_alu_imm_reg(I386_ADD, 4 + 8 + 8 + 4, REG_SP);
+                       }
+
+                       i386_ret();
+                       ALIGNCODENOP;
+                       }
+                       break;
+
+
+               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
+                       {
+                               s4 i, l, *s4ptr;
+                               void **tptr;
+
+                               tptr = (void **) iptr->target;
+
+                               s4ptr = iptr->val.a;
+                               l = s4ptr[1];                          /* low     */
+                               i = s4ptr[2];                          /* high    */
+
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               M_INTMOVE(s1, REG_ITMP1);
+                               if (l != 0) {
+                                       i386_alu_imm_reg(I386_SUB, l, REG_ITMP1);
+                               }
+                               i = i - l + 1;
+
+                /* range check */
+
+                               i386_alu_imm_reg(I386_CMP, i - 1, REG_ITMP1);
+                               i386_jcc(I386_CC_A, 0);
+
+                /* codegen_addreference(BlockPtrOfPC(s4ptr[0]), mcodeptr); */
+                               codegen_addreference((basicblock *) tptr[0], mcodeptr);
+
+                               /* build jump table top down and use address of lowest entry */
+
+                /* s4ptr += 3 + i; */
+                               tptr += i;
+
+                               while (--i >= 0) {
+                                       /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
+                                       dseg_addtarget((basicblock *) tptr[0]); 
+                                       --tptr;
+                               }
+
+                               /* length of dataseg after last dseg_addtarget is used by load */
+
+                               i386_mov_imm_reg(0, REG_ITMP2);
+                               dseg_adddata(mcodeptr);
+                               i386_mov_memindex_reg(-dseglen, REG_ITMP2, REG_ITMP1, 2, REG_ITMP1);
+                               i386_jmp_reg(REG_ITMP1);
+                               ALIGNCODENOP;
+                       }
+                       break;
+
+
+               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
+                       {
+                               s4 i, l, val, *s4ptr;
+                               void **tptr;
+
+                               tptr = (void **) iptr->target;
+
+                               s4ptr = iptr->val.a;
+                               l = s4ptr[0];                          /* default  */
+                               i = s4ptr[1];                          /* count    */
+                       
+                               MCODECHECK((i<<2)+8);
+                               var_to_reg_int(s1, src, REG_ITMP1);    /* reg compare should always be faster */
+                               while (--i >= 0) {
+                                       s4ptr += 2;
+                                       ++tptr;
+
+                                       val = s4ptr[0];
+                                       i386_alu_imm_reg(I386_CMP, val, s1);
+                                       i386_jcc(I386_CC_E, 0);
+                                       /* codegen_addreference(BlockPtrOfPC(s4ptr[1]), mcodeptr); */
+                                       codegen_addreference((basicblock *) tptr[0], mcodeptr); 
+                               }
+
+                               i386_jmp_imm(0);
+                               /* codegen_addreference(BlockPtrOfPC(l), mcodeptr); */
+                       
+                               tptr = (void **) iptr->target;
+                               codegen_addreference((basicblock *) tptr[0], mcodeptr);
+
+                               ALIGNCODENOP;
+                       }
+                       break;
+
+
+               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 3;
+                       goto gen_method;
+
+               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 2;
+                       goto gen_method;
+
+               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 1;
+                       goto gen_method;
+
+               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+                       s3 = iptr->op1;
+
+gen_method: {
+                       methodinfo   *m;
+                       classinfo    *ci;
+
+                       MCODECHECK((s3 << 1) + 64);
+
+                       /* copy arguments to registers or stack location                  */
+
+                       for (; --s3 >= 0; src = src->prev) {
+                               if (src->varkind == ARGVAR) {
+                                       continue;
+                               }
+
+                               if (IS_INT_LNG_TYPE(src->type)) {
+                                       if (s3 < intreg_argnum) {
+                                               panic("No integer argument registers available!");
+
+                                       } else {
+                                               if (!IS_2_WORD_TYPE(src->type)) {
+                                                       if (src->flags & INMEMORY) {
+                                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, s3 * 8);
+
+                                                       } else {
+                                                               i386_mov_reg_membase(src->regoff, REG_SP, s3 * 8);
+                                                       }
+
+                                               } else {
+                                                       if (src->flags & INMEMORY) {
+                                                               M_LNGMEMMOVE(src->regoff, s3);
+
+                                                       } else {
+                                                               panic("copy arguments: longs have to be in memory");
+                                                       }
+                                               }
+                                       }
+
+                               } else {
+                                       if (s3 < fltreg_argnum) {
+                                               panic("No float argument registers available!");
+
+                                       } else {
+                                               var_to_reg_flt(d, src, REG_FTMP1);
+                                               if (src->type == TYPE_FLT) {
+                                                       i386_fstps_membase(REG_SP, s3 * 8);
+
+                                               } else {
+                                                       i386_fstpl_membase(REG_SP, s3 * 8);
+                                               }
+                                       }
+                               }
+                       } /* end of for */
+
+                       m = iptr->val.a;
+                       switch (iptr->opc) {
+                               case ICMD_BUILTIN3:
+                               case ICMD_BUILTIN2:
+                               case ICMD_BUILTIN1:
+
+                                       a = (s4) m;
+                                       d = iptr->op1;
+
+                                       i386_mov_imm_reg(a, REG_ITMP1);
+                                       i386_call_reg(REG_ITMP1);
+                                       break;
+
+                               case ICMD_INVOKESTATIC:
+
+                                       a = (s4) m->stubroutine;
+                                       d = m->returntype;
+
+                                       i386_mov_imm_reg(a, REG_ITMP2);
+                                       i386_call_reg(REG_ITMP2);
+                                       break;
+
+                               case ICMD_INVOKESPECIAL:
+
+                                       a = (s4) m->stubroutine;
+                                       d = m->returntype;
+
+                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
+                                       gen_nullptr_check(REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, 0, REG_ITMP1);    /* access memory for hardware nullptr */
+
+                                       i386_mov_imm_reg(a, REG_ITMP2);
+                                       i386_call_reg(REG_ITMP2);
+                                       break;
+
+                               case ICMD_INVOKEVIRTUAL:
+
+                                       d = m->returntype;
+
+                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
+                                       gen_nullptr_check(REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(java_objectheader, vftbl), REG_ITMP2);
+                                       i386_mov_membase32_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + sizeof(methodptr) * m->vftblindex, REG_ITMP1);
+
+                                       i386_call_reg(REG_ITMP1);
+                                       break;
+
+                               case ICMD_INVOKEINTERFACE:
+
+                                       ci = m->class;
+                                       d = m->returntype;
+
+                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
+                                       gen_nullptr_check(REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - sizeof(methodptr) * ci->index, REG_ITMP2);
+                                       i386_mov_membase32_reg(REG_ITMP2, sizeof(methodptr) * (m - ci->methods), REG_ITMP1);
+
+                                       i386_call_reg(REG_ITMP1);
+                                       break;
+
+                               default:
+                                       d = 0;
+                                       sprintf(logtext, "Unkown ICMD-Command: %d", iptr->opc);
+                                       error();
+                               }
+
+                       /* d contains return type */
+
+                       if (d != TYPE_VOID) {
+                               d = reg_of_var(iptr->dst, REG_NULL);
+
+                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
+                                       if (IS_2_WORD_TYPE(iptr->dst->type)) {
+                                               if (iptr->dst->flags & INMEMORY) {
+                                                       i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+                                                       i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                               } else {
+                                                       panic("RETURN: longs have to be in memory");
+                                               }
+
+                                       } else {
+                                               if (iptr->dst->flags & INMEMORY) {
+                                                       i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+
+                                               } else {
+                                                       M_INTMOVE(REG_RESULT, iptr->dst->regoff);
+                                               }
+                                       }
+
+                               } else {
+                                       /* fld from called function -- has other fpu_st_offset counter */
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                               }
+                       }
+                       }
+                       break;
+
+
+               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
+
+                                     /* op1:   0 == array, 1 == class                */
+                                     /* val.a: (classinfo*) superclass               */
+
+/*          superclass is an interface:
+ *
+ *          return (sub != NULL) &&
+ *                 (sub->vftbl->interfacetablelength > super->index) &&
+ *                 (sub->vftbl->interfacetable[-super->index] != NULL);
+ *
+ *          superclass is a class:
+ *
+ *          return ((sub != NULL) && (0
+ *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
+ *                  super->vftbl->diffvall));
+ */
+
+                       {
+                       classinfo *super = (classinfo*) iptr->val.a;
+                       
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_INTMOVE(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                       }
+                       i386_alu_reg_reg(I386_XOR, d, d);
+                       if (iptr->op1) {                               /* class/interface */
+                               if (super->flags & ACC_INTERFACE) {        /* interface       */
+                                       i386_test_reg_reg(s1, s1);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 2;
+                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetablelength));
+                                       
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, super->index);
+                                       
+                                       a += 3;
+                                       a += 6;
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
+
+                                       a += 3;
+
+                                       a += 6;    /* jcc */
+                                       a += 5;
+
+                                       i386_jcc(I386_CC_E, a);
+
+                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetablelength), REG_ITMP2);
+                                       i386_alu_imm_reg(I386_SUB, super->index, REG_ITMP2);
+                                       /* TODO: test */
+                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 0;
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
+
+                                       a += 3;
+
+                                       a += 6;    /* jcc */
+                                       a += 5;
+
+                                       i386_jcc(I386_CC_LE, a);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*), REG_ITMP1);
+                                       /* TODO: test */
+                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP1);
+/*                                     i386_setcc_reg(I386_CC_A, d); */
+/*                                     i386_jcc(I386_CC_BE, 5); */
+                                       i386_jcc(I386_CC_E, 5);
+                                       i386_mov_imm_reg(1, d);
+                                       
+
+                               } else {                                   /* class           */
+                                       i386_test_reg_reg(s1, s1);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 2;
+                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
+                                       a += 5;
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+                                       
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
+                                       
+                                       a += 2;
+                                       a += 2;    /* xor */
+
+                                       a += 2;
+
+                                       a += 6;    /* jcc */
+                                       a += 5;
+
+                                       i386_jcc(I386_CC_E, a);
+
+                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, baseval), REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP3);
+                                       i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
+                                       i386_alu_reg_reg(I386_SUB, REG_ITMP3, REG_ITMP1);
+                                       i386_alu_reg_reg(I386_XOR, d, d);
+                                       i386_alu_reg_reg(I386_CMP, REG_ITMP2, REG_ITMP1);
+                                       i386_jcc(I386_CC_A, 5);
+                                       i386_mov_imm_reg(1, d);
+                               }
+                       }
+                       else
+                               panic ("internal error: no inlined array instanceof");
+                       }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
+
+                                     /* op1:   0 == array, 1 == class                */
+                                     /* val.a: (classinfo*) superclass               */
+
+/*          superclass is an interface:
+ *
+ *          OK if ((sub == NULL) ||
+ *                 (sub->vftbl->interfacetablelength > super->index) &&
+ *                 (sub->vftbl->interfacetable[-super->index] != NULL));
+ *
+ *          superclass is a class:
+ *
+ *          OK if ((sub == NULL) || (0
+ *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
+ *                 super->vftbl->diffvall));
+ */
+
+                       {
+                       classinfo *super = (classinfo*) iptr->val.a;
+                       
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       var_to_reg_int(s1, src, d);
+                       if (iptr->op1) {                               /* class/interface */
+                               if (super->flags & ACC_INTERFACE) {        /* interface       */
+                                       i386_test_reg_reg(s1, s1);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 2;
+                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetablelength));
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, super->index);
+
+                                       a += 3;
+                                       a += 6;
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
+
+                                       a += 3;
+                                       a += 6;
+
+                                       i386_jcc(I386_CC_E, a);
+
+                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetablelength), REG_ITMP2);
+                                       i386_alu_imm_reg(I386_SUB, super->index, REG_ITMP2);
+                                       /* TODO: test */
+                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
+                                       i386_jcc(I386_CC_LE, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*), REG_ITMP2);
+                                       /* TODO: test */
+                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
+                                       i386_jcc(I386_CC_E, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+
+                               } else {                                     /* class           */
+                                       i386_test_reg_reg(s1, s1);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 2;
+                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
+
+                                       a += 5;
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+
+                                       if (d != REG_ITMP3) {
+                                               a += 2;
+                                               CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+                                               
+                                               a += 2;
+                                               CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
+
+                                               a += 2;
+                                               
+                                       } else {
+                                               a += 2;
+                                               CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+
+                                               a += 2;
+
+                                               a += 5;
+
+                                               a += 2;
+                                               CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
+                                       }
+
+                                       a += 2;
+
+                                       a += 6;
+
+                                       i386_jcc(I386_CC_E, a);
+
+                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, baseval), REG_ITMP1);
+                                       if (d != REG_ITMP3) {
+                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP3);
+                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
+                                               i386_alu_reg_reg(I386_SUB, REG_ITMP3, REG_ITMP1);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP2);
+                                               i386_alu_reg_reg(I386_SUB, REG_ITMP2, REG_ITMP1);
+                                               i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
+                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
+                                       }
+                                       i386_alu_reg_reg(I386_CMP, REG_ITMP2, REG_ITMP1);
+                                       i386_jcc(I386_CC_A, 0);    /* (u) REG_ITMP1 > (u) REG_ITMP2 -> jump */
+                                       codegen_addxcastrefs(mcodeptr);
+                               }
+
+                       } else
+                               panic ("internal error: no inlined array checkcast");
+                       }
+                       M_INTMOVE(s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+                               
+                       } else {
+                               i386_test_reg_reg(src->regoff, src->regoff);
+                       }
+                       i386_jcc(I386_CC_L, 0);
+                       codegen_addxcheckarefs(mcodeptr);
+                       break;
+
+               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
+                                     /* op1 = dimension, val.a = array descriptor    */
+
+                       /* check for negative sizes and copy sizes to stack if necessary  */
+
+                       MCODECHECK((iptr->op1 << 1) + 64);
+
+                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
+                               if (src->flags & INMEMORY) {
+                                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+                               } else {
+                                       i386_test_reg_reg(src->regoff, src->regoff);
+                               }
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addxcheckarefs(mcodeptr);
+
+                               /* 
+                                * copy sizes to new stack location, be cause native function
+                                * builtin_nmultianewarray access them as (int *)
+                                */
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, -(iptr->op1 - s1) * 4);
+
+                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
+
+                               if (src->varkind != ARGVAR) {
+                                       if (src->flags & INMEMORY) {
+                                               i386_mov_membase_reg(REG_SP, (src->regoff + intreg_argnum) * 8, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, (s1 + intreg_argnum) * 8);
+
+                                       } else {
+                                               i386_mov_reg_membase(src->regoff, REG_SP, (s1 + intreg_argnum) * 8);
+                                       }
+                               }
+                       }
+                       i386_alu_imm_reg(I386_SUB, iptr->op1 * 4, REG_SP);
+
+                       /* a0 = dimension count */
+
+                       /* save stack pointer */
+                       M_INTMOVE(REG_SP, REG_ITMP1);
+
+                       i386_alu_imm_reg(I386_SUB, 12, REG_SP);
+                       i386_mov_imm_membase(iptr->op1, REG_SP, 0);
+
+                       /* a1 = arraydescriptor */
+
+                       i386_mov_imm_membase((s4) iptr->val.a, REG_SP, 4);
+
+                       /* a2 = pointer to dimensions = stack pointer */
+
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, 8);
+
+                       i386_mov_imm_reg((s4) (builtin_nmultianewarray), REG_ITMP1);
+                       i386_call_reg(REG_ITMP1);
+                       i386_alu_imm_reg(I386_ADD, 12 + iptr->op1 * 4, REG_SP);
+
+                       s1 = reg_of_var(iptr->dst, REG_RESULT);
+                       M_INTMOVE(REG_RESULT, s1);
+                       store_reg_to_var_int(iptr->dst, s1);
+                       break;
+
+
+               default: sprintf (logtext, "Unknown pseudo command: %d", iptr->opc);
+                        error();
+       
+   
+
+       } /* switch */
+               
+       } /* for instruction */
+               
+       /* copy values to interface registers */
+
+       src = bptr->outstack;
+       len = bptr->outdepth;
+       MCODECHECK(64+len);
+       while (src) {
+               len--;
+               if ((src->varkind != STACKVAR)) {
+                       s2 = src->type;
+                       if (IS_FLT_DBL_TYPE(s2)) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                       M_FLTMOVE(s1,interfaces[len][s2].regoff);
+
+                               } else {
+                                       panic("double store");
+/*                                     M_DST(s1, REG_SP, 8 * interfaces[len][s2].regoff); */
+                               }
+
+                       } else {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               if (!IS_2_WORD_TYPE(interfaces[len][s2].type)) {
+                                       if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                               M_INTMOVE(s1, interfaces[len][s2].regoff);
+
+                                       } else {
+                                               i386_mov_reg_membase(s1, REG_SP, interfaces[len][s2].regoff * 8);
+                                       }
+
+                               } else {
+                                       if (interfaces[len][s2].flags & INMEMORY) {
+                                               M_LNGMEMMOVE(s1, interfaces[len][s2].regoff);
+
+                                       } else {
+                                               panic("copy interface registers: longs have to be in memory (end)");
+                                       }
+                               }
+                       }
+               }
+               src = src->prev;
+       }
+       } /* if (bptr -> flags >= BBREACHED) */
+       } /* for basic block */
+
+       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
+
+       {
+
+       /* generate bound check stubs */
+       u1 *xcodeptr = NULL;
+       
+       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
+                               xboundrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+                       }
+
+
+               gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
+                                 xboundrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xboundrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+
+               } else {
+                       xcodeptr = mcodeptr;
+
+                       i386_mov_imm_reg((s4) proto_java_lang_ArrayIndexOutOfBoundsException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+
+       /* generate negative array size check stubs */
+       xcodeptr = NULL;
+       
+       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
+                               xcheckarefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+                       }
+
+               gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
+                                 xcheckarefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xcheckarefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+
+               } else {
+                       xcodeptr = mcodeptr;
+
+                       i386_mov_imm_reg((s4) proto_java_lang_NegativeArraySizeException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+
+       /* generate cast check stubs */
+       xcodeptr = NULL;
+       
+       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
+                               xcastrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+               }
+
+               gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
+                                 xcastrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xcastrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+               
+               } else {
+                       xcodeptr = mcodeptr;
+
+                       i386_mov_imm_reg((s4) proto_java_lang_ClassCastException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+
+       /* generate divide by zero check stubs */
+       xcodeptr = NULL;
+       
+       for (; xdivrefs != NULL; xdivrefs = xdivrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xdivrefs->branchpos, 
+                               xdivrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+               }
+
+               gen_resolvebranch((u1*) mcodebase + xdivrefs->branchpos, 
+                                 xdivrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xdivrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+               
+               } else {
+                       xcodeptr = mcodeptr;
+
+                       i386_mov_imm_reg((s4) proto_java_lang_ArithmeticException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+
+       /* generate null pointer check stubs */
+       xcodeptr = NULL;
+       
+       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
+                                                         xnullrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+               }
+
+               gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
+                                                 xnullrefs->branchpos, (u1*) mcodeptr - mcodebase);
+               
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xnullrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+               
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+                       
+               } else {
+                       xcodeptr = mcodeptr;
+                       
+                       i386_mov_imm_reg((s4) proto_java_lang_NullPointerException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+       }
+
+       codegen_finish((int)((u1*) mcodeptr - mcodebase));
+}
+
+
+/* function createcompilerstub *************************************************
+
+   creates a stub routine which calls the compiler
+       
+*******************************************************************************/
+
+#define COMPSTUBSIZE 12
+
+u1 *createcompilerstub(methodinfo *m)
+{
+    u1 *s = CNEW(u1, COMPSTUBSIZE);     /* memory to hold the stub            */
+    mcodeptr = s;                       /* code generation pointer            */
+
+    /* code for the stub */
+    i386_mov_imm_reg((s4) m, REG_ITMP1);/* pass method pointer to compiler    */
+
+       /* we use EDI cause EDX (REG_ITMP2) is used for patching */
+    i386_mov_imm_reg((s4) asm_call_jit_compiler, I386_EDI);   /* load address */
+    i386_jmp_reg(I386_EDI);             /* jump to compiler                   */
+
+#ifdef STATISTICS
+    count_cstub_len += COMPSTUBSIZE;
+#endif
+
+    return (u1*) s;
+}
+
+
+/* function removecompilerstub *************************************************
+
+     deletes a compilerstub from memory  (simply by freeing it)
+
+*******************************************************************************/
+
+void removecompilerstub(u1 *stub) 
+{
+    CFREE(stub, COMPSTUBSIZE);
+}
+
+/* function: createnativestub **************************************************
+
+       creates a stub routine which calls a native method
+
+*******************************************************************************/
+
+#define NATIVESTUBSIZE 320
+
+u1 *createnativestub(functionptr f, methodinfo *m)
+{
+    u1 *s = CNEW(u1, NATIVESTUBSIZE);   /* memory to hold the stub            */
+
+    u1 *tptr;
+    int i;
+    int stackframesize = 4;           /* initial 4 bytes is space for jni env */
+    int stackframeoffset = 4;
+
+    int p, t;
+
+    mcodeptr = s;                       /* make macros work                   */
+
+    reg_init();
+    
+    descriptor2types(m);                     /* set paramcount and paramtypes */
+
+    if (runverbose) {
+        i386_alu_imm_reg(I386_SUB, TRACE_ARGS_NUM * 8 + 4, REG_SP);
+        
+        for (p = 0; p < m->paramcount; p++) {
+            t = m->paramtypes[p];
+            if (IS_INT_LNG_TYPE(t)) {
+                if (IS_2_WORD_TYPE(t)) {
+                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4 + 4, REG_ITMP2);
+
+                } else if (t == TYPE_ADR) {
+                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                    i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+
+                } else {
+                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                    i386_cltd();
+                }
+                i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
+                i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
+
+            } else {
+                if (t == TYPE_FLT) {
+                    i386_flds_membase(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4);
+                    i386_fstps_membase(REG_SP, p * 8);
+                    i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+                    i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
+
+                } else {
+                    i386_fldl_membase(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4);
+                    i386_fstpl_membase(REG_SP, p * 8);
+                }
+            }
+        }
+
+               
+        i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
+        for (p = m->paramcount; p < TRACE_ARGS_NUM; p++) {
+            i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
+            i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8 + 4);
+        }
+
+        i386_mov_imm_membase((s4) m, REG_SP, TRACE_ARGS_NUM * 8);
+
+        i386_mov_imm_reg((s4) asm_builtin_trace, REG_ITMP1);
+        i386_call_reg(REG_ITMP1);
+
+        i386_alu_imm_reg(I386_ADD, TRACE_ARGS_NUM * 8 + 4, REG_SP);
+    }
+
+    /*
+        * mark the whole fpu stack as free for native functions
+        * (only for saved register count == 0)
+        */
+    i386_ffree_reg(0);
+    i386_ffree_reg(1);
+    i386_ffree_reg(2);
+    i386_ffree_reg(3);
+    i386_ffree_reg(4);
+    i386_ffree_reg(5);
+    i386_ffree_reg(6);
+    i386_ffree_reg(7);
+
+       /*
+        * calculate stackframe size for native function
+        */
+    tptr = m->paramtypes;
+    for (i = 0; i < m->paramcount; i++) {
+        switch (*tptr++) {
+        case TYPE_INT:
+        case TYPE_FLT:
+        case TYPE_ADR:
+            stackframesize += 4;
+            break;
+
+        case TYPE_LNG:
+        case TYPE_DBL:
+            stackframesize += 8;
+            break;
+
+        default:
+            panic("unknown parameter type in native function");
+        }
+    }
+
+    i386_alu_imm_reg(I386_SUB, stackframesize, REG_SP);
+
+    tptr = m->paramtypes;
+    for (i = 0; i < m->paramcount; i++) {
+        switch (*tptr++) {
+        case TYPE_INT:
+        case TYPE_FLT:
+        case TYPE_ADR:
+            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8, REG_ITMP1);
+            i386_mov_reg_membase(REG_ITMP1, REG_SP, stackframeoffset);
+            stackframeoffset += 4;
+            break;
+
+        case TYPE_LNG:
+        case TYPE_DBL:
+            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8, REG_ITMP1);
+            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8 + 4, REG_ITMP2);
+            i386_mov_reg_membase(REG_ITMP1, REG_SP, stackframeoffset);
+            i386_mov_reg_membase(REG_ITMP2, REG_SP, stackframeoffset + 4);
+            stackframeoffset += 8;
+            break;
+
+        default:
+            panic("unknown parameter type in native function");
+        }
+    }
+
+    i386_mov_imm_membase((s4) &env, REG_SP, 0);
+    i386_mov_imm_reg((s4) f, REG_ITMP1);
+    i386_call_reg(REG_ITMP1);
+    i386_alu_imm_reg(I386_ADD, stackframesize, REG_SP);
+
+    if (runverbose) {
+        i386_alu_imm_reg(I386_SUB, 4 + 8 + 8 + 4, REG_SP);
+               
+        i386_mov_imm_membase((s4) m, REG_SP, 0);
+               
+        i386_mov_reg_membase(REG_RESULT, REG_SP, 4);
+        i386_mov_reg_membase(REG_RESULT2, REG_SP, 4 + 4);
+               
+        i386_fstl_membase(REG_SP, 4 + 8);
+        i386_fsts_membase(REG_SP, 4 + 8 + 8);
+               
+        i386_mov_imm_reg((s4) asm_builtin_exittrace, REG_ITMP1);
+        i386_call_reg(REG_ITMP1);
+               
+        i386_mov_membase_reg(REG_SP, 4, REG_RESULT);
+        i386_mov_membase_reg(REG_SP, 4 + 4, REG_RESULT2);
+               
+        i386_alu_imm_reg(I386_ADD, 4 + 8 + 8 + 4, REG_SP);
+    }
+
+       /* we can use EDI cause it's not preserved across function calls */
+       i386_mov_imm_reg((s4) &exceptionptr, I386_EDI);
+       i386_mov_membase_reg(I386_EDI, 0, I386_EDI);
+       i386_test_reg_reg(I386_EDI, I386_EDI);
+       i386_jcc(I386_CC_NE, 1);
+
+       i386_ret();
+
+       i386_mov_reg_reg(I386_EDI, REG_ITMP1_XPTR);
+       i386_mov_imm_reg((s4) &exceptionptr, I386_EDI);
+       i386_mov_imm_membase(0, I386_EDI, 0);
+       i386_mov_membase_reg(REG_SP, 0, REG_ITMP2_XPC);
+       i386_alu_imm_reg(I386_SUB, 2, REG_ITMP2_XPC);
+
+       i386_mov_imm_reg((s4) asm_handle_nat_exception, I386_EDI);
+       i386_jmp_reg(I386_EDI);
+
+#ifdef STATISTICS
+       count_nstub_len += NATIVESTUBSIZE;
+#endif
+
+       return (u1*) s;
+}
+
+/* function: removenativestub **************************************************
+
+    removes a previously created native-stub from memory
+    
+*******************************************************************************/
+
+void removenativestub(u1 *stub)
+{
+    CFREE(stub, NATIVESTUBSIZE);
+}
+
+
+
+void i386_emit_ialu(s4 alu_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                       } else if (src->prev->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_alu_reg_membase(alu_op, src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_reg(alu_op, src->prev->regoff, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->prev->regoff == iptr->dst->regoff) {
+                               i386_alu_reg_membase(alu_op, src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                               
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_reg(alu_op, src->regoff, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else {
+                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+                       i386_alu_reg_membase(alu_op, src->regoff, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+                       i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                       i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                       i386_alu_membase_reg(alu_op, REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+
+               } else {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_alu_reg_reg(alu_op, src->prev->regoff, iptr->dst->regoff);
+
+                       } else {
+                               M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                               i386_alu_reg_reg(alu_op, src->regoff, iptr->dst->regoff);
+                       }
+               }
+       }
+}
+
+
+
+void i386_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if (src->flags & INMEMORY) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_alu_imm_membase(alu_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_imm_reg(alu_op, iptr->val.i, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else {
+                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                       i386_alu_imm_membase(alu_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else {
+               if (src->flags & INMEMORY) {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                       i386_alu_imm_reg(alu_op, iptr->val.i, iptr->dst->regoff);
+
+               } else {
+                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                       i386_alu_imm_reg(alu_op, iptr->val.i, iptr->dst->regoff);
+               }
+       }
+}
+
+
+
+void i386_emit_lalu(s4 alu_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_alu_reg_membase(alu_op, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else if (src->prev->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_alu_reg_membase(alu_op, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+               }
+       }
+}
+
+
+
+void i386_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if (src->flags & INMEMORY) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_alu_imm_membase(alu_op, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
+                               i386_alu_imm_membase(alu_op, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_imm_reg(alu_op, iptr->val.l, REG_ITMP1);
+                               i386_alu_imm_reg(alu_op, iptr->val.l >> 32, REG_ITMP2);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+               }
+       }
+}
+
+
+
+void i386_emit_ishift(s4 shift_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->prev->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                               i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_shift_reg(shift_op, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+                       i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
+
+               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->prev->regoff == iptr->dst->regoff) {
+                               M_INTMOVE(src->regoff, I386_ECX);
+                               i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               M_INTMOVE(src->regoff, I386_ECX);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_shift_reg(shift_op, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else {
+                       M_INTMOVE(src->regoff, I386_ECX);
+                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+                       i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+                       i386_shift_reg(shift_op, iptr->dst->regoff);
+
+               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                       i386_shift_reg(shift_op, iptr->dst->regoff);
+
+               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       M_INTMOVE(src->regoff, I386_ECX);
+                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+                       i386_shift_reg(shift_op, iptr->dst->regoff);
+
+               } else {
+                       M_INTMOVE(src->regoff, I386_ECX);
+                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                       i386_shift_reg(shift_op, iptr->dst->regoff);
+               }
+       }
+}
+
+
+
+void i386_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr)
+{
+       if ((src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
+               if (src->regoff == iptr->dst->regoff) {
+                       i386_shift_imm_membase(shift_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+               } else {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                       i386_shift_imm_reg(shift_op, iptr->val.i, REG_ITMP1);
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else if ((src->flags & INMEMORY) && !(iptr->dst->flags & INMEMORY)) {
+               i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+               i386_shift_imm_reg(shift_op, iptr->val.i, iptr->dst->regoff);
+                               
+       } else if (!(src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
+               i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+               i386_shift_imm_membase(shift_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+       } else {
+               M_INTMOVE(src->regoff, iptr->dst->regoff);
+               i386_shift_imm_reg(shift_op, iptr->val.i, iptr->dst->regoff);
+       }
+}
+
+
+
+void i386_emit_ifcc_iconst(s4 if_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               int offset = 0;
+
+               if (src->flags & INMEMORY) {
+                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+               } else {
+                       i386_test_reg_reg(src->regoff, src->regoff);
+               }
+
+               offset += 7;
+               CALCOFFSETBYTES(offset, iptr->dst->regoff * 8);
+       
+               i386_jcc(if_op, offset + (iptr[1].opc == ICMD_ELSE_ICONST) ? 5 + offset : 0);
+               i386_mov_imm_membase(iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+               if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                       i386_jmp_imm(offset);
+                       i386_mov_imm_membase(iptr[1].val.i, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else {
+               if (src->flags & INMEMORY) {
+                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+               } else {
+                       i386_test_reg_reg(src->regoff, src->regoff);
+               }
+
+               i386_jcc(if_op, (iptr[1].opc == ICMD_ELSE_ICONST) ? 10 : 5);
+               i386_mov_imm_reg(iptr->val.i, iptr->dst->regoff);
+
+               if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                       i386_jmp_imm(5);
+                       i386_mov_imm_reg(iptr[1].val.i, iptr->dst->regoff);
+               }
+       }
+}
+
+
+
+#if 1
+
+/*
+ * mov ops
+ */
+void i386_mov_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x89;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_mov_imm_reg(s4 imm, s4 reg) {
+       *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07);
+       i386_emit_imm32((imm));
+}
+
+
+void i386_movb_imm_reg(s4 imm, s4 reg) {
+       *(mcodeptr++) = (u1) 0xc6;
+       i386_emit_reg(0,(reg));
+       i386_emit_imm8((imm));
+}
+
+
+void i386_mov_membase_reg(s4 basereg, s4 disp, s4 reg) {
+       *(mcodeptr++) = (u1) 0x8b;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+/*
+ * this one is for INVOKEVIRTUAL/INVOKEINTERFACE to have a
+ * constant membase immediate length of 32bit
+ */
+void i386_mov_membase32_reg(s4 basereg, s4 disp, s4 reg) {
+       *(mcodeptr++) = (u1) 0x8b;
+       i386_address_byte(2, (reg), (basereg));
+       i386_emit_imm32((disp));
+}
+
+
+void i386_mov_reg_membase(s4 reg, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0x89;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+void i386_mov_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
+       *(mcodeptr++) = (u1) 0x8b;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_mov_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0x89;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_movw_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0x66;
+       *(mcodeptr++) = (u1) 0x89;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_movb_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0x88;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_mov_imm_membase(s4 imm, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xc7;
+       i386_emit_membase((basereg),(disp),0);
+       i386_emit_imm32((imm));
+}
+
+
+void i386_movsbl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xbe;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_movswl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xbf;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_movzwl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xb7;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+
+/*
+ * alu operations
+ */
+void i386_alu_reg_reg(s4 opc, s4 reg, s4 dreg) {
+       *(mcodeptr++) = (((u1) (opc)) << 3) + 1;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_alu_reg_membase(s4 opc, s4 reg, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (((u1) (opc)) << 3) + 1;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+void i386_alu_membase_reg(s4 opc, s4 basereg, s4 disp, s4 reg) {
+       *(mcodeptr++) = (((u1) (opc)) << 3) + 3;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+void i386_alu_imm_reg(s4 opc, s4 imm, s4 dreg) {
+       if (i386_is_imm8(imm)) { 
+               *(mcodeptr++) = (u1) 0x83;
+               i386_emit_reg((opc),(dreg));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x81;
+               i386_emit_reg((opc),(dreg));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_alu_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp) {
+       if (i386_is_imm8(imm)) { 
+               *(mcodeptr++) = (u1) 0x83;
+               i386_emit_membase((basereg),(disp),(opc));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x81;
+               i386_emit_membase((basereg),(disp),(opc));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_test_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x85;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_test_imm_reg(s4 imm, s4 reg) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_reg(0,(reg));
+       i386_emit_imm32((imm));
+}
+
+
+
+/*
+ * inc, dec operations
+ */
+void i386_inc_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0x40 + ((reg) & 0x07);
+}
+
+
+void i386_inc_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xff;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_dec_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0x48 + ((reg) & 0x07);
+}
+
+                
+void i386_dec_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xff;
+       i386_emit_membase((basereg),(disp),1);
+}
+
+
+
+void i386_cltd() {
+       *(mcodeptr++) = (u1) 0x99;
+}
+
+
+
+void i386_imul_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xaf;
+       i386_emit_reg((dreg),(reg));
+}
+
+
+void i386_imul_membase_reg(s4 basereg, s4 disp, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xaf;
+       i386_emit_membase((basereg),(disp),(dreg));
+}
+
+
+void i386_imul_imm_reg(s4 imm, s4 dreg) {
+       if (i386_is_imm8((imm))) { 
+               *(mcodeptr++) = (u1) 0x6b;
+               i386_emit_reg(0,(dreg));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x69;
+               i386_emit_reg(0,(dreg));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_imul_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
+       if (i386_is_imm8((imm))) { 
+               *(mcodeptr++) = (u1) 0x6b;
+               i386_emit_reg((dreg),(reg));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x69;
+               i386_emit_reg((dreg),(reg));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_imul_imm_membase_reg(s4 imm, s4 basereg, s4 disp, s4 dreg) {
+       if (i386_is_imm8((imm))) { 
+               *(mcodeptr++) = (u1) 0x6b;
+               i386_emit_membase((basereg),(disp),(dreg));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x69;
+               i386_emit_membase((basereg),(disp),(dreg));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_mul_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_membase((basereg),(disp),4);
+}
+
+
+void i386_idiv_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_reg(7,(reg));
+}
+
+
+
+void i386_ret() {
+       *(mcodeptr++) = (u1) 0xc3;
+}
+
+
+
+/*
+ * shift ops
+ */
+void i386_shift_reg(s4 opc, s4 reg) {
+       *(mcodeptr++) = (u1) 0xd3;
+       i386_emit_reg((opc),(reg));
+}
+
+
+void i386_shift_membase(s4 opc, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd3;
+       i386_emit_membase((basereg),(disp),(opc));
+}
+
+
+void i386_shift_imm_reg(s4 opc, s4 imm, s4 dreg) {
+       if ((imm) == 1) { 
+               *(mcodeptr++) = (u1) 0xd1;
+               i386_emit_reg((opc),(dreg));
+       } else { 
+               *(mcodeptr++) = (u1) 0xc1;
+               i386_emit_reg((opc),(dreg));
+               i386_emit_imm8((imm));
+       } 
+}
+
+
+void i386_shift_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp) {
+       if ((imm) == 1) { 
+               *(mcodeptr++) = (u1) 0xd1;
+               i386_emit_membase((basereg),(disp),(opc));
+       } else { 
+               *(mcodeptr++) = (u1) 0xc1;
+               i386_emit_membase((basereg),(disp),(opc));
+               i386_emit_imm8((imm));
+       } 
+}
+
+
+void i386_shld_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xa5;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_shld_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xa4;
+       i386_emit_reg((reg),(dreg));
+       i386_emit_imm8((imm));
+}
+
+
+void i386_shld_reg_membase(s4 reg, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xa5;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+void i386_shrd_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xad;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_shrd_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xac;
+       i386_emit_reg((reg),(dreg));
+       i386_emit_imm8((imm));
+}
+
+
+void i386_shrd_reg_membase(s4 reg, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xad;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+
+/*
+ * jump operations
+ */
+void i386_jmp_imm(s4 imm) {
+       *(mcodeptr++) = (u1) 0xe9;
+       i386_emit_imm32((imm));
+}
+
+
+void i386_jmp_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xff;
+       i386_emit_reg(4,(reg));
+}
+
+
+void i386_jcc(s4 opc, s4 imm) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) (0x80 + i386_jcc_map[(opc)]);
+       i386_emit_imm32((imm));
+}
+
+
+
+/*
+ * conditional set operations
+ */
+void i386_setcc_reg(s4 opc, s4 reg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]);
+       i386_emit_reg(0,(reg));
+}
+
+
+void i386_setcc_membase(s4 opc, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]);
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+
+void i386_neg_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_reg(3,(reg));
+}
+
+
+void i386_neg_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_membase((basereg),(disp),3);
+}
+
+
+
+void i386_push_imm(s4 imm) {
+       *(mcodeptr++) = (u1) 0x68;
+       i386_emit_imm32((imm));
+}
+
+
+void i386_pop_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0x58 + (0x07 & (reg));
+}
+
+
+void i386_nop() {
+       *(mcodeptr++) = (u1) 0x90;
+}
+
+
+/*
+ * call instructions
+ */
+void i386_call_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xff;
+       i386_emit_reg(2,(reg));
+}
+
+
+void i386_call_imm(s4 imm) {
+       *(mcodeptr++) = (u1) 0xe8;
+       i386_emit_imm32((imm));
+}
+
+
+
+/*
+ * floating point instructions
+ */
+void i386_fld1() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xe8;
+}
+
+
+void i386_fldz() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xee;
+}
+
+
+void i386_fld_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg));
+}
+
+
+void i386_flds_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_fldl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_fldt_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),5);
+}
+
+
+void i386_flds_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fldl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale));
+}
+
+
+
+
+void i386_fildl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_fildll_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdf;
+       i386_emit_membase((basereg),(disp),5);
+}
+
+
+
+
+void i386_fst_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xd0 + (0x07 & (reg));
+}
+
+
+void i386_fsts_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_membase((basereg),(disp),2);
+}
+
+
+void i386_fstl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_membase((basereg),(disp),2);
+}
+
+
+void i386_fsts_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fstl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fstp_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xd8 + (0x07 & (reg));
+}
+
+
+void i386_fstps_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_membase((basereg),(disp),3);
+}
+
+
+void i386_fstpl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_membase((basereg),(disp),3);
+}
+
+
+void i386_fstpt_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),7);
+}
+
+
+void i386_fstps_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fstpl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fistl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),2);
+}
+
+
+void i386_fistpl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),3);
+}
+
+
+void i386_fistpll_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdf;
+       i386_emit_membase((basereg),(disp),7);
+}
+
+
+void i386_fchs() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xe0;
+}
+
+
+void i386_faddp() {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xc1;
+}
+
+
+void i386_fadd_reg_st(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd8;
+       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
+}
+
+
+void i386_fadd_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdc;
+       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
+}
+
+
+void i386_faddp_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
+}
+
+
+void i386_fadds_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd8;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_faddl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdc;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_fsub_reg_st(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd8;
+       *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg));
+}
+
+
+void i386_fsub_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdc;
+       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
+}
+
+
+void i386_fsubp_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
+}
+
+
+void i386_fsubp() {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xe9;
+}
+
+
+void i386_fsubs_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd8;
+       i386_emit_membase((basereg),(disp),4);
+}
+
+
+void i386_fsubl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdc;
+       i386_emit_membase((basereg),(disp),4);
+}
+
+
+void i386_fmul_reg_st(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd8;
+       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
+}
+
+
+void i386_fmul_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdc;
+       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
+}
+
+
+void i386_fmulp() {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xc9;
+}
+
+
+void i386_fmulp_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
+}
+
+
+void i386_fmuls_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd8;
+       i386_emit_membase((basereg),(disp),1);
+}
+
+
+void i386_fmull_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdc;
+       i386_emit_membase((basereg),(disp),1);
+}
+
+
+void i386_fdiv_reg_st(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd8;
+       *(mcodeptr++) = (u1) 0xf0 + (0x07 & (reg));
+}
+
+
+void i386_fdiv_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdc;
+       *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg));
+}
+
+
+void i386_fdivp() {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xf9;
+}
+
+
+void i386_fdivp_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg));
+}
+
+
+void i386_fxch() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xc9;
+}
+
+
+void i386_fxch_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
+}
+
+
+void i386_fprem() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xf8;
+}
+
+
+void i386_fprem1() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xf5;
+}
+
+
+void i386_fucom() {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xe1;
+}
+
+
+void i386_fucom_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg));
+}
+
+
+void i386_fucomp_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
+}
+
+
+void i386_fucompp() {
+       *(mcodeptr++) = (u1) 0xda;
+       *(mcodeptr++) = (u1) 0xe9;
+}
+
+
+void i386_fnstsw() {
+       *(mcodeptr++) = (u1) 0xdf;
+       *(mcodeptr++) = (u1) 0xe0;
+}
+
+
+void i386_sahf() {
+       *(mcodeptr++) = (u1) 0x9e;
+}
+
+
+void i386_finit() {
+       *(mcodeptr++) = (u1) 0x9b;
+       *(mcodeptr++) = (u1) 0xdb;
+       *(mcodeptr++) = (u1) 0xe3;
+}
+
+
+void i386_fldcw_mem(s4 mem) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_mem(5,(mem));
+}
+
+
+void i386_fldcw_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_membase((basereg),(disp),5);
+}
+
+
+void i386_wait() {
+       *(mcodeptr++) = (u1) 0x9b;
+}
+
+
+void i386_ffree_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg));
+}
+
+
+void i386_fdecstp() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xf6;
+}
+
+
+void i386_fincstp() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xf7;
+}
+
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/i386/codegen.h b/jit/i386/codegen.h
new file mode 100644 (file)
index 0000000..96f6c39
--- /dev/null
@@ -0,0 +1,1683 @@
+/* jit/i386/codegen.h - code generation macros and definitions for i386
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Christian Thalinger
+
+   $Id: codegen.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _CODEGEN_H
+#define _CODEGEN_H
+
+#include "jit.h"
+
+
+/* define x86 register numbers */
+#define I386_EAX    0
+#define I386_ECX    1
+#define I386_EDX    2
+#define I386_EBX    3
+#define I386_ESP    4
+#define I386_EBP    5
+#define I386_ESI    6
+#define I386_EDI    7
+
+
+/* preallocated registers *****************************************************/
+
+/* integer registers */
+  
+#define REG_RESULT      I386_EAX /* to deliver method results                 */
+#define REG_RESULT2     I386_EDX /* to deliver long method results            */
+
+#define REG_ITMP1       I386_EAX /* temporary register                        */
+#define REG_ITMP2       I386_EDX /* temporary register and method pointer     */
+#define REG_ITMP3       I386_ECX /* temporary register                        */
+
+#define REG_NULL        -1       /* used for reg_of_var where d is not needed */
+
+#define REG_ITMP1_XPTR  I386_EAX /* exception pointer = temporary register 1  */
+#define REG_ITMP2_XPC   I386_EDX /* exception pc = temporary register 2       */
+
+#define REG_SP          I386_ESP /* stack pointer                             */
+
+/* floating point registers */
+
+#define REG_FRESULT     0    /* to deliver floating point method results      */
+#define REG_FTMP1       6    /* temporary floating point register             */
+#define REG_FTMP2       7    /* temporary floating point register             */
+#define REG_FTMP3       7    /* temporary floating point register             */
+
+/* register descripton - array ************************************************/
+
+/* #define REG_RES   0         reserved register for OS or code generator     */
+/* #define REG_RET   1         return value register                          */
+/* #define REG_EXC   2         exception value register (only old jit)        */
+/* #define REG_SAV   3         (callee) saved register                        */
+/* #define REG_TMP   4         scratch temporary register (caller saved)      */
+/* #define REG_ARG   5         argument register (caller saved)               */
+
+/* #define REG_END   -1        last entry in tables */
+
+int nregdescint[] = {
+    REG_RET, REG_RES, REG_RES, REG_SAV, REG_RES, REG_SAV, REG_TMP, REG_TMP,
+    REG_END };
+
+/* for use of reserved registers, see comment above */
+
+int nregdescfloat[] = {
+  /* rounding problems with callee saved registers */
+/*      REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_RES, REG_RES, */
+/*      REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, */
+    REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
+    REG_END };
+
+/* for use of reserved registers, see comment above */
+
+
+/* stackframe-infos ***********************************************************/
+
+int parentargs_base; /* offset in stackframe for the parameter from the caller*/
+
+/* -> see file 'calling.doc' */
+
+
+static u1 fpu_in_24bit_mode = 0;
+
+static u2 fpu_ctrlwrd_24bit = 0x007f;    /* Round to nearest, 24-bit mode, exceptions masked */
+static u2 fpu_ctrlwrd_53bit = 0x027f;    /* Round to nearest, 53-bit mode, exceptions masked */
+
+static u4 subnormal_bias1[3] = { 0x00000000, 0x80000000, 0x03ff };    /* 2^(-15360) */
+static u4 subnormal_bias2[3] = { 0x00000000, 0x80000000, 0x7bff };    /* 2^(+15360) */
+
+
+/* macros to create code ******************************************************/
+
+/*
+ * immediate data union
+ */
+typedef union {
+    s4 i;
+    s8 l;
+    float f;
+    double d;
+    void *a;
+    u1 b[8];
+} i386_imm_buf;
+
+
+typedef enum {
+    I386_AL = 0,
+    I386_CL = 1,
+    I386_DL = 2,
+    I386_BL = 3,
+    I386_AH = 4,
+    I386_CH = 5,
+    I386_DH = 6,
+    I386_BH = 7,
+    I386_NREGB
+} I386_RegB_No;
+
+
+/*
+ * opcodes for alu instructions
+ */
+typedef enum {
+    I386_ADD = 0,
+    I386_OR  = 1,
+    I386_ADC = 2,
+    I386_SBB = 3,
+    I386_AND = 4,
+    I386_SUB = 5,
+    I386_XOR = 6,
+    I386_CMP = 7,
+    I386_NALU
+} I386_ALU_Opcode;
+
+typedef enum {
+    I386_ROL = 0,
+    I386_ROR = 1,
+    I386_RCL = 2,
+    I386_RCR = 3,
+    I386_SHL = 4,
+    I386_SHR = 5,
+    I386_SAR = 7,
+    I386_NSHIFT = 8
+} I386_Shift_Opcode;
+
+typedef enum {
+    I386_CC_O = 0,
+    I386_CC_NO = 1,
+    I386_CC_B = 2, I386_CC_C = 2, I386_CC_NAE = 2,
+    I386_CC_BE = 6, I386_CC_NA = 6,
+    I386_CC_AE = 3, I386_CC_NB = 3, I386_CC_NC = 3,
+    I386_CC_E = 4, I386_CC_Z = 4,
+    I386_CC_NE = 5, I386_CC_NZ = 5,
+    I386_CC_A = 7, I386_CC_NBE = 7,
+    I386_CC_S = 8, I386_CC_LZ = 8,
+    I386_CC_NS = 9, I386_CC_GEZ = 9,
+    I386_CC_P = 0x0a, I386_CC_PE = 0x0a,
+    I386_CC_NP = 0x0b, I386_CC_PO = 0x0b,
+    I386_CC_L = 0x0c, I386_CC_NGE = 0x0c,
+    I386_CC_GE = 0x0d, I386_CC_NL = 0x0d,
+    I386_CC_LE = 0x0e, I386_CC_NG = 0x0e,
+    I386_CC_G = 0x0f, I386_CC_NLE = 0x0f,
+    I386_NCC
+} I386_CC;
+
+static const unsigned char i386_jcc_map[] = {
+    0x00, /* o  */
+    0x01, /* no */
+    0x02, /* b, lt  */
+    0x03, /* ae */
+    0x04, /* e  */
+    0x05, /* ne */
+    0x06, /* be */
+    0x07, /* a  */
+    0x08, /* s  */
+    0x09, /* ns */
+    0x0a, /* p  */
+    0x0b, /* np */
+    0x0c, /* l  */
+    0x0d, /* ge */
+    0x0e, /* le */
+    0x0f  /* g  */
+};
+
+
+
+/*
+ * modrm and stuff
+ */
+#define i386_address_byte(mod, reg, rm) \
+    *(mcodeptr++) = ((((mod) & 0x03) << 6) | (((reg) & 0x07) << 3) | (((rm) & 0x07)));
+
+
+#define i386_emit_reg(reg,rm) \
+    i386_address_byte(3,(reg),(rm));
+
+
+#define i386_is_imm8(imm) \
+    (((int)(imm) >= -128 && (int)(imm) <= 127))
+
+
+#define i386_emit_imm8(imm) \
+    *(mcodeptr++) = (u1) ((imm) & 0xff);
+
+
+#define i386_emit_imm16(imm) \
+    do { \
+        i386_imm_buf imb; \
+        imb.i = (int) (imm); \
+        *(mcodeptr++) = imb.b[0]; \
+        *(mcodeptr++) = imb.b[1]; \
+    } while (0)
+
+
+#define i386_emit_imm32(imm) \
+    do { \
+        i386_imm_buf imb; \
+        imb.i = (int) (imm); \
+        *(mcodeptr++) = imb.b[0]; \
+        *(mcodeptr++) = imb.b[1]; \
+        *(mcodeptr++) = imb.b[2]; \
+        *(mcodeptr++) = imb.b[3]; \
+    } while (0)
+
+
+#define i386_emit_mem(r,disp) \
+    do { \
+        i386_address_byte(0,(r),5); \
+        i386_emit_imm32((disp)); \
+    } while (0)
+
+
+#define i386_emit_membase(basereg,disp,dreg) \
+    do { \
+        if ((basereg) == I386_ESP) { \
+            if ((disp) == 0) { \
+                i386_address_byte(0, (dreg), I386_ESP); \
+                i386_address_byte(0, I386_ESP, I386_ESP); \
+            } else if (i386_is_imm8((disp))) { \
+                i386_address_byte(1, (dreg), I386_ESP); \
+                i386_address_byte(0, I386_ESP, I386_ESP); \
+                i386_emit_imm8((disp)); \
+            } else { \
+                i386_address_byte(2, (dreg), I386_ESP); \
+                i386_address_byte(0, I386_ESP, I386_ESP); \
+                i386_emit_imm32((disp)); \
+            } \
+            break; \
+        } \
+        \
+        if ((disp) == 0 && (basereg) != I386_EBP) { \
+            i386_address_byte(0, (dreg), (basereg)); \
+            break; \
+        } \
+        \
+        if (i386_is_imm8((disp))) { \
+            i386_address_byte(1, (dreg), (basereg)); \
+            i386_emit_imm8((disp)); \
+        } else { \
+            i386_address_byte(2, (dreg), (basereg)); \
+            i386_emit_imm32((disp)); \
+        } \
+    } while (0)
+
+
+#define i386_emit_memindex(reg,disp,basereg,indexreg,scale) \
+    do { \
+        if ((basereg) == -1) { \
+            i386_address_byte(0, (reg), 4); \
+            i386_address_byte((scale), (indexreg), 5); \
+            i386_emit_imm32((disp)); \
+        \
+        } else if ((disp) == 0 && (basereg) != I386_EBP) { \
+            i386_address_byte(0, (reg), 4); \
+            i386_address_byte((scale), (indexreg), (basereg)); \
+        \
+        } else if (i386_is_imm8((disp))) { \
+            i386_address_byte(1, (reg), 4); \
+            i386_address_byte((scale), (indexreg), (basereg)); \
+            i386_emit_imm8 ((disp)); \
+        \
+        } else { \
+            i386_address_byte(2, (reg), 4); \
+            i386_address_byte((scale), (indexreg), (basereg)); \
+            i386_emit_imm32((disp)); \
+        }    \
+     } while (0)
+
+
+
+void i386_emit_ialu(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_lalu(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_ishift(s4 shift_op, stackptr src, instruction *iptr);
+void i386_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr);
+void i386_emit_ifcc_iconst(s4 if_op, stackptr src, instruction *iptr);
+
+
+
+#if 0
+
+/*
+ * mov ops
+ */
+#define i386_mov_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_mov_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_movb_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc6; \
+        i386_emit_reg(0,(reg)); \
+        i386_emit_imm8((imm)); \
+    } while (0)
+
+
+#define i386_mov_float_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
+        i386_emit_float32((imm)); \
+    } while (0)
+
+
+#define i386_mov_reg_mem(reg,mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_mem((reg),(mem)); \
+    } while (0)
+
+
+#define i386_mov_mem_reg(mem,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_emit_mem((reg),(mem)); \
+    } while (0)
+
+
+#define i386_mov_membase_reg(basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+/*
+ * this one is for INVOKEVIRTUAL/INVOKEINTERFACE to have a
+ * constant membase immediate length of 32bit
+ */
+#define i386_mov_membase32_reg(basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_address_byte(2, (reg), (basereg)); \
+        i386_emit_imm32((disp)); \
+    } while (0)
+
+
+#define i386_movw_membase_reg(basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        i386_mov_membase_reg((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_movb_membase_reg(basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8a; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_mov_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_movw_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_movb_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x88; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_mov_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movw_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movb_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8a; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_mov_reg_memindex(reg,disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movw_reg_memindex(reg,disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movb_reg_memindex(reg,disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0x88; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_mov_imm_membase(imm,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc7; \
+        i386_emit_membase((basereg),(disp),0); \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_mov_float_membase(imm,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc7; \
+        i386_emit_membase((basereg),(disp),0); \
+        i386_emit_float32((imm)); \
+    } while (0)
+
+
+#define i386_mov_double_low_membase(imm,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc7; \
+        i386_emit_membase((basereg),(disp),0); \
+        i386_emit_double64_low((imm)); \
+    } while (0)
+
+
+#define i386_mov_double_high_membase(imm,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc7; \
+        i386_emit_membase((basereg),(disp),0); \
+        i386_emit_double64_high((imm)); \
+    } while (0)
+
+
+#define i386_movsbl_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbe; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_movswl_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbf; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_movzbl_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb6; \
+        /* XXX: why do reg and dreg have to be exchanged */ \
+        i386_emit_reg((dreg),(reg)); \
+    } while (0)
+
+
+#define i386_movzwl_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb7; \
+        /* XXX: why do reg and dreg have to be exchanged */ \
+        i386_emit_reg((dreg),(reg)); \
+    } while (0)
+
+
+#define i386_movsbl_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbe; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movswl_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbf; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movzbl_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb6; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movzwl_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb7; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+
+/*
+ * alu operations
+ */
+#define i386_alu_reg_reg(opc,reg,dreg) \
+    do { \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_alu_reg_membase(opc,reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_alu_membase_reg(opc,basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 3; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_alu_imm_reg(opc,imm,dreg) \
+    do { \
+        if (i386_is_imm8(imm)) { \
+            *(mcodeptr++) = (u1) 0x83; \
+            i386_emit_reg((opc),(dreg)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x81; \
+            i386_emit_reg((opc),(dreg)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_alu_imm_membase(opc,imm,basereg,disp) \
+    do { \
+        if (i386_is_imm8(imm)) { \
+            *(mcodeptr++) = (u1) 0x83; \
+            i386_emit_membase((basereg),(disp),(opc)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x81; \
+            i386_emit_membase((basereg),(disp),(opc)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_test_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x85; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_test_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(0,(reg)); \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_testw_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(0,(reg)); \
+        i386_emit_imm16((imm)); \
+    } while (0)
+
+
+#define i386_testb_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf6; \
+        i386_emit_reg(0,(reg)); \
+        i386_emit_imm8((imm)); \
+    } while (0)
+
+
+
+/*
+ * inc, dec operations
+ */
+#define i386_inc_reg(reg) \
+    *(mcodeptr++) = (u1) 0x40 + ((reg) & 0x07);
+
+
+#define i386_inc_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_dec_reg(reg) \
+    *(mcodeptr++) = (u1) 0x48 + ((reg) & 0x07);
+
+        
+#define i386_dec_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_membase((basereg),(disp),1); \
+    } while (0)
+
+
+
+
+#define i386_cltd() \
+    *(mcodeptr++) = (u1) 0x99;
+
+
+
+#define i386_imul_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xaf; \
+        i386_emit_reg((dreg),(reg)); \
+    } while (0)
+
+
+#define i386_imul_membase_reg(basereg,disp,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xaf; \
+        i386_emit_membase((basereg),(disp),(dreg)); \
+    } while (0)
+
+
+#define i386_imul_imm_reg(imm,dreg) \
+    do { \
+        if (i386_is_imm8((imm))) { \
+            *(mcodeptr++) = (u1) 0x6b; \
+            i386_emit_reg(0,(dreg)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x69; \
+            i386_emit_reg(0,(dreg)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_imul_imm_reg_reg(imm,reg,dreg) \
+    do { \
+        if (i386_is_imm8((imm))) { \
+            *(mcodeptr++) = (u1) 0x6b; \
+            i386_emit_reg((dreg),(reg)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x69; \
+            i386_emit_reg((dreg),(reg)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_imul_imm_membase_reg(imm,basereg,disp,dreg) \
+    do { \
+        if (i386_is_imm8((imm))) { \
+            *(mcodeptr++) = (u1) 0x6b; \
+            i386_emit_membase((basereg),(disp),(dreg)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x69; \
+            i386_emit_membase((basereg),(disp),(dreg)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_mul_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(4,(reg)); \
+    } while (0)
+
+
+#define i386_mul_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_membase((basereg),(disp),4); \
+    } while (0)
+
+
+#define i386_idiv_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(7,(reg)); \
+    } while (0)
+
+
+#define i386_idiv_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_membase((basereg),(disp),7); \
+    } while (0)
+
+
+
+#define i386_ret() \
+    *(mcodeptr++) = (u1) 0xc3;
+
+
+#define i386_leave() \
+    *(mcodeptr++) = (u1) 0xc9;
+
+
+
+/*
+ * shift ops
+ */
+#define i386_shift_reg(opc,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd3; \
+        i386_emit_reg((opc),(reg)); \
+    } while (0)
+
+
+#define i386_shift_membase(opc,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd3; \
+        i386_emit_membase((basereg),(disp),(opc)); \
+    } while (0)
+
+
+#define i386_shift_imm_reg(opc,imm,dreg) \
+    do { \
+        if ((imm) == 1) { \
+            *(mcodeptr++) = (u1) 0xd1; \
+            i386_emit_reg((opc),(dreg)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0xc1; \
+            i386_emit_reg((opc),(dreg)); \
+            i386_emit_imm8((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_shift_imm_membase(opc,imm,basereg,disp) \
+    do { \
+        if ((imm) == 1) { \
+            *(mcodeptr++) = (u1) 0xd1; \
+            i386_emit_membase((basereg),(disp),(opc)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0xc1; \
+            i386_emit_membase((basereg),(disp),(opc)); \
+            i386_emit_imm8((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_shld_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa5; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_shld_imm_reg_reg(imm,reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa4; \
+        i386_emit_reg((reg),(dreg)); \
+        i386_emit_imm8((imm)); \
+    } while (0)
+
+
+#define i386_shld_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa5; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_shrd_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xad; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_shrd_imm_reg_reg(imm,reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xac; \
+        i386_emit_reg((reg),(dreg)); \
+        i386_emit_imm8((imm)); \
+    } while (0)
+
+
+#define i386_shrd_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xad; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+
+/*
+ * jump operations
+ */
+#define i386_jmp_imm(imm) \
+    do { \
+        *(mcodeptr++) = (u1) 0xe9; \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_jmp_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_reg(4,(reg)); \
+    } while (0)
+
+
+#define i386_jcc(opc,imm) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x80 + i386_jcc_map[(opc)]); \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+
+/*
+ * conditional set operations
+ */
+#define i386_setcc_reg(opc,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
+        i386_emit_reg(0,(reg)); \
+    } while (0)
+
+
+#define i386_setcc_membase(opc,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+
+#define i386_neg_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(3,(reg)); \
+    } while (0)
+
+
+#define i386_neg_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_mem(3,(mem)); \
+    } while (0)
+
+
+#define i386_neg_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_membase((basereg),(disp),3); \
+    } while (0)
+
+
+
+#define i386_push_reg(reg) \
+    *(mcodeptr++) = (u1) 0x50 + (0x07 & (reg));
+
+
+#define i386_push_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_membase((basereg),(disp),6); \
+    } while (0)
+
+
+#define i386_push_imm(imm) \
+    do { \
+        *(mcodeptr++) = (u1) 0x68; \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_pop_reg(reg) \
+    *(mcodeptr++) = (u1) 0x58 + (0x07 & (reg));
+
+
+#define i386_nop() \
+    *(mcodeptr++) = (u1) 0x90;
+
+
+
+/*
+ * call instructions
+ */
+#define i386_call_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_reg(2,(reg)); \
+    } while (0)
+
+
+#define i386_call_imm(imm) \
+    do { \
+        *(mcodeptr++) = (u1) 0xe8; \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+
+/*
+ * floating point instructions
+ */
+#define i386_fld1() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xe8; \
+    } while (0)
+
+
+#define i386_fldz() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xee; \
+    } while (0)
+
+
+#define i386_fld_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_flds_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_mem(0,(mem)); \
+    } while (0)
+
+
+#define i386_fldl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_mem(0,(mem)); \
+    } while (0)
+
+
+#define i386_fldt_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_mem(5,(mem)); \
+    } while (0)
+
+
+#define i386_flds_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_fldl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_fldt_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),5); \
+    } while (0)
+
+
+#define i386_flds_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_fldl_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+
+
+#define i386_fildl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_mem(0,(mem)); \
+    } while (0)
+
+
+#define i386_fildl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_fildll_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdf; \
+        i386_emit_membase((basereg),(disp),5); \
+    } while (0)
+
+
+
+
+#define i386_fst_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xd0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fsts_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_mem(2,(mem)); \
+    } while (0)
+
+
+#define i386_fstl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_mem(2,(mem)); \
+    } while (0)
+
+
+#define i386_fsts_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_membase((basereg),(disp),2); \
+    } while (0)
+
+
+#define i386_fstl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_membase((basereg),(disp),2); \
+    } while (0)
+
+
+#define i386_fsts_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_fstl_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+
+
+#define i386_fstp_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xd8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fstps_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_mem(3,(mem)); \
+    } while (0)
+
+
+#define i386_fstpl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_mem(3,(mem)); \
+    } while (0)
+
+
+#define i386_fstps_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_membase((basereg),(disp),3); \
+    } while (0)
+
+
+#define i386_fstpl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_membase((basereg),(disp),3); \
+    } while (0)
+
+
+#define i386_fstpt_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),7); \
+    } while (0)
+
+
+#define i386_fstps_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_fstpl_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+
+
+#define i386_fistpl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_mem(3,(mem)); \
+    } while (0)
+
+
+#define i386_fistpll_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdf; \
+        i386_emit_mem(7,(mem)); \
+    } while (0)
+
+
+#define i386_fistl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),2); \
+    } while (0)
+
+
+#define i386_fistpl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),3); \
+    } while (0)
+
+
+#define i386_fistpll_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdf; \
+        i386_emit_membase((basereg),(disp),7); \
+    } while (0)
+
+
+
+
+#define i386_fchs() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xe0; \
+    } while (0)
+
+
+#define i386_faddp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc1; \
+    } while (0)
+
+
+#define i386_fadd_reg_st(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
+    } while (0)
+
+
+#define i386_fadd_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
+    } while (0)
+
+
+#define i386_faddp_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
+    } while (0)
+
+
+#define i386_fadds_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_faddl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_fsub_reg_st(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fsub_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fsubp_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fsubp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xe9; \
+    } while (0)
+
+
+#define i386_fsubs_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        i386_emit_membase((basereg),(disp),4); \
+    } while (0)
+
+
+#define i386_fsubl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        i386_emit_membase((basereg),(disp),4); \
+    } while (0)
+
+
+#define i386_fmul_reg_st(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fmul_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fmulp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc9; \
+    } while (0)
+
+
+#define i386_fmulp_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fmuls_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        i386_emit_membase((basereg),(disp),1); \
+    } while (0)
+
+
+#define i386_fmull_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        i386_emit_membase((basereg),(disp),1); \
+    } while (0)
+
+
+#define i386_fdiv_reg_st(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xf0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fdiv_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fdivp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xf9; \
+    } while (0)
+
+
+#define i386_fdivp_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fxch() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc9; \
+    } while (0)
+
+
+#define i386_fxch_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fprem() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf8; \
+    } while (0)
+
+
+#define i386_fprem1() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf5; \
+    } while (0)
+
+
+#define i386_fucom() \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe1; \
+    } while (0)
+
+
+#define i386_fucom_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fucomp_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fucompp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xda; \
+        *(mcodeptr++) = (u1) 0xe9; \
+    } while (0)
+
+
+#define i386_fnstsw() \
+    do { \
+        *(mcodeptr++) = (u1) 0xdf; \
+        *(mcodeptr++) = (u1) 0xe0; \
+    } while (0)
+
+
+#define i386_sahf() \
+    *(mcodeptr++) = (u1) 0x9e;
+
+
+#define i386_finit() \
+    do { \
+        *(mcodeptr++) = (u1) 0x9b; \
+        *(mcodeptr++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xe3; \
+    } while (0)
+
+
+#define i386_fldcw_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_mem(5,(mem)); \
+    } while (0)
+
+
+#define i386_fldcw_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_membase((basereg),(disp),5); \
+    } while (0)
+
+
+#define i386_wait() \
+    *(mcodeptr++) = (u1) 0x9b;
+
+
+#define i386_ffree_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fdecstp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf6; \
+    } while (0)
+
+
+#define i386_fincstp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf7; \
+    } while (0)
+
+#else
+
+/*
+ * integer instructions
+ */
+void i386_mov_reg_reg(s4 reg, s4 dreg);
+void i386_mov_imm_reg(s4 imm, s4 dreg);
+void i386_movb_imm_reg(s4 imm, s4 dreg);
+void i386_mov_membase_reg(s4 basereg, s4 disp, s4 reg);
+void i386_mov_membase32_reg(s4 basereg, s4 disp, s4 reg);
+void i386_mov_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_mov_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_mov_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_movw_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_movb_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_mov_imm_membase(s4 imm, s4 basereg, s4 disp);
+void i386_movsbl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_movswl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_movzwl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_alu_reg_reg(s4 opc, s4 reg, s4 dreg);
+void i386_alu_reg_membase(s4 opc, s4 reg, s4 basereg, s4 disp);
+void i386_alu_membase_reg(s4 opc, s4 basereg, s4 disp, s4 reg);
+void i386_alu_imm_reg(s4 opc, s4 imm, s4 reg);
+void i386_alu_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp);
+void i386_test_reg_reg(s4 reg, s4 dreg);
+void i386_test_imm_reg(s4 imm, s4 dreg);
+void i386_inc_reg(s4 reg);
+void i386_inc_membase(s4 basereg, s4 disp);
+void i386_dec_reg(s4 reg);
+void i386_dec_membase(s4 basereg, s4 disp);
+void i386_cltd();
+void i386_imul_reg_reg(s4 reg, s4 dreg);
+void i386_imul_membase_reg(s4 basereg, s4 disp, s4 dreg);
+void i386_imul_imm_reg(s4 imm, s4 reg);
+void i386_imul_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_imul_imm_membase_reg(s4 imm, s4 basereg, s4 disp, s4 dreg);
+void i386_mul_membase(s4 basereg, s4 disp);
+void i386_idiv_reg(s4 reg);
+void i386_ret();
+void i386_shift_reg(s4 opc, s4 reg);
+void i386_shift_membase(s4 opc, s4 basereg, s4 disp);
+void i386_shift_imm_reg(s4 opc, s4 imm, s4 reg);
+void i386_shift_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp);
+void i386_shld_reg_reg(s4 reg, s4 dreg);
+void i386_shld_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_shld_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_shrd_reg_reg(s4 reg, s4 dreg);
+void i386_shrd_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_shrd_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_jmp_imm(s4 imm);
+void i386_jmp_reg(s4 reg);
+void i386_jcc(s4 opc, s4 imm);
+void i386_setcc_reg(s4 opc, s4 reg);
+void i386_setcc_membase(s4 opc, s4 basereg, s4 disp);
+void i386_neg_reg(s4 reg);
+void i386_neg_membase(s4 basereg, s4 disp);
+void i386_push_imm(s4 imm);
+void i386_pop_reg(s4 reg);
+void i386_nop();
+void i386_call_reg(s4 reg);
+void i386_call_imm(s4 imm);
+
+
+
+/*
+ * floating point instructions
+ */
+void i386_fld1();
+void i386_fldz();
+void i386_fld_reg(s4 reg);
+void i386_flds_membase(s4 basereg, s4 disp);
+void i386_fldl_membase(s4 basereg, s4 disp);
+void i386_fldt_membase(s4 basereg, s4 disp);
+void i386_flds_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fldl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fildl_membase(s4 basereg, s4 disp);
+void i386_fildll_membase(s4 basereg, s4 disp);
+void i386_fst_reg(s4 reg);
+void i386_fsts_membase(s4 basereg, s4 disp);
+void i386_fstl_membase(s4 basereg, s4 disp);
+void i386_fsts_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstp_reg(s4 reg);
+void i386_fstps_membase(s4 basereg, s4 disp);
+void i386_fstpl_membase(s4 basereg, s4 disp);
+void i386_fstpt_membase(s4 basereg, s4 disp);
+void i386_fstps_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstpl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fistl_membase(s4 basereg, s4 disp);
+void i386_fistpl_membase(s4 basereg, s4 disp);
+void i386_fistpll_membase(s4 basereg, s4 disp);
+void i386_fchs();
+void i386_faddp();
+void i386_fadd_reg_st(s4 reg);
+void i386_fadd_st_reg(s4 reg);
+void i386_faddp_st_reg(s4 reg);
+void i386_fadds_membase(s4 basereg, s4 disp);
+void i386_faddl_membase(s4 basereg, s4 disp);
+void i386_fsub_reg_st(s4 reg);
+void i386_fsub_st_reg(s4 reg);
+void i386_fsubp_st_reg(s4 reg);
+void i386_fsubp();
+void i386_fsubs_membase(s4 basereg, s4 disp);
+void i386_fsubl_membase(s4 basereg, s4 disp);
+void i386_fmul_reg_st(s4 reg);
+void i386_fmul_st_reg(s4 reg);
+void i386_fmulp();
+void i386_fmulp_st_reg(s4 reg);
+void i386_fmuls_membase(s4 basereg, s4 disp);
+void i386_fmull_membase(s4 basereg, s4 disp);
+void i386_fdiv_reg_st(s4 reg);
+void i386_fdiv_st_reg(s4 reg);
+void i386_fdivp();
+void i386_fdivp_st_reg(s4 reg);
+void i386_fxch();
+void i386_fxch_reg(s4 reg);
+void i386_fprem();
+void i386_fprem1();
+void i386_fucom();
+void i386_fucom_reg(s4 reg);
+void i386_fucomp_reg(s4 reg);
+void i386_fucompp();
+void i386_fnstsw();
+void i386_sahf();
+void i386_finit();
+void i386_fldcw_mem(s4 mem);
+void i386_fldcw_membase(s4 basereg, s4 disp);
+void i386_wait();
+void i386_ffree_reg(s4 reg);
+void i386_fdecstp();
+void i386_fincstp();
+
+#endif
+
+
+
+/* function gen_resolvebranch **************************************************
+
+    backpatches a branch instruction
+
+    parameters: ip ... pointer to instruction after branch (void*)
+                so ... offset of instruction after branch  (s4)
+                to ... offset of branch target             (s4)
+
+*******************************************************************************/
+
+#define gen_resolvebranch(ip,so,to) \
+    *((void **) ((ip) - 4)) = (void **) ((to) - (so));
+
+#endif /* _CODEGEN_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/i386/dis-asm.h b/jit/i386/dis-asm.h
new file mode 100644 (file)
index 0000000..2f3418e
--- /dev/null
@@ -0,0 +1,328 @@
+/* Interface between the opcode library and its callers.
+
+   Copyright 2001, 2002 Free Software Foundation, Inc.
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+   
+   Written by Cygnus Support, 1993.
+
+   The opcode library (libopcodes.a) provides instruction decoders for
+   a large variety of instruction sets, callable with an identical
+   interface, for making instruction-processing programs more independent
+   of the instruction set being processed.  */
+
+#ifndef DIS_ASM_H
+#define DIS_ASM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include "bfd.h"
+
+#include "types.h"
+#include "ansidecl.h"
+
+#define _(String) (String)
+
+typedef int (*fprintf_ftype) PARAMS((PTR, const char*, ...));
+
+enum dis_insn_type {
+  dis_noninsn,                 /* Not a valid instruction */
+  dis_nonbranch,               /* Not a branch instruction */
+  dis_branch,                  /* Unconditional branch */
+  dis_condbranch,              /* Conditional branch */
+  dis_jsr,                     /* Jump to subroutine */
+  dis_condjsr,                 /* Conditional jump to subroutine */
+  dis_dref,                    /* Data reference instruction */
+  dis_dref2                    /* Two data references in instruction */
+};
+
+/* This struct is passed into the instruction decoding routine, 
+   and is passed back out into each callback.  The various fields are used
+   for conveying information from your main routine into your callbacks,
+   for passing information into the instruction decoders (such as the
+   addresses of the callback functions), or for passing information
+   back from the instruction decoders to their callers.
+
+   It must be initialized before it is first passed; this can be done
+   by hand, or using one of the initialization macros below.  */
+
+typedef struct disassemble_info {
+  fprintf_ftype fprintf_func;
+  PTR stream;
+  PTR application_data;
+
+  /* Target description.  We could replace this with a pointer to the bfd,
+     but that would require one.  There currently isn't any such requirement
+     so to avoid introducing one we record these explicitly.  */
+  /* The bfd_flavour.  This can be bfd_target_unknown_flavour.  */
+  enum bfd_flavour flavour;
+  /* The bfd_arch value.  */
+  enum bfd_architecture arch;
+  /* The bfd_mach value.  */
+  unsigned long mach;
+  /* Endianness (for bi-endian cpus).  Mono-endian cpus can ignore this.  */
+  enum bfd_endian endian;
+  /* An arch/mach-specific bitmask of selected instruction subsets, mainly
+     for processors with run-time-switchable instruction sets.  The default,
+     zero, means that there is no constraint.  CGEN-based opcodes ports
+     may use ISA_foo masks.  */
+  unsigned long insn_sets;
+
+  /* Some targets need information about the current section to accurately
+     display insns.  If this is NULL, the target disassembler function
+     will have to make its best guess.  */
+  asection *section;
+
+  /* An array of pointers to symbols either at the location being disassembled
+     or at the start of the function being disassembled.  The array is sorted
+     so that the first symbol is intended to be the one used.  The others are
+     present for any misc. purposes.  This is not set reliably, but if it is
+     not NULL, it is correct.  */
+  asymbol **symbols;
+  /* Number of symbols in array.  */
+  int num_symbols;
+
+  /* For use by the disassembler.
+     The top 16 bits are reserved for public use (and are documented here).
+     The bottom 16 bits are for the internal use of the disassembler.  */
+  unsigned long flags;
+#define INSN_HAS_RELOC 0x80000000
+  PTR private_data;
+
+  /* Function used to get bytes to disassemble.  MEMADDR is the
+     address of the stuff to be disassembled, MYADDR is the address to
+     put the bytes in, and LENGTH is the number of bytes to read.
+     INFO is a pointer to this struct.
+     Returns an errno value or 0 for success.  */
+  int (*read_memory_func)
+    PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
+            struct disassemble_info *info));
+
+  /* Function which should be called if we get an error that we can't
+     recover from.  STATUS is the errno value from read_memory_func and
+     MEMADDR is the address that we were trying to read.  INFO is a
+     pointer to this struct.  */
+  void (*memory_error_func)
+    PARAMS ((int status, bfd_vma memaddr, struct disassemble_info *info));
+
+  /* Function called to print ADDR.  */
+  void (*print_address_func)
+    PARAMS ((bfd_vma addr, struct disassemble_info *info));
+
+  /* Function called to determine if there is a symbol at the given ADDR.
+     If there is, the function returns 1, otherwise it returns 0.
+     This is used by ports which support an overlay manager where
+     the overlay number is held in the top part of an address.  In
+     some circumstances we want to include the overlay number in the
+     address, (normally because there is a symbol associated with
+     that address), but sometimes we want to mask out the overlay bits.  */
+  int (* symbol_at_address_func)
+    PARAMS ((bfd_vma addr, struct disassemble_info * info));
+
+  /* These are for buffer_read_memory.  */
+  bfd_byte *buffer;
+  bfd_vma buffer_vma;
+  unsigned int buffer_length;
+
+  /* This variable may be set by the instruction decoder.  It suggests
+      the number of bytes objdump should display on a single line.  If
+      the instruction decoder sets this, it should always set it to
+      the same value in order to get reasonable looking output.  */
+  int bytes_per_line;
+
+  /* the next two variables control the way objdump displays the raw data */
+  /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */
+  /* output will look like this:
+     00:   00000000 00000000
+     with the chunks displayed according to "display_endian". */
+  int bytes_per_chunk;
+  enum bfd_endian display_endian;
+
+  /* Number of octets per incremented target address 
+     Normally one, but some DSPs have byte sizes of 16 or 32 bits.  */
+  unsigned int octets_per_byte;
+
+  /* Results from instruction decoders.  Not all decoders yet support
+     this information.  This info is set each time an instruction is
+     decoded, and is only valid for the last such instruction.
+
+     To determine whether this decoder supports this information, set
+     insn_info_valid to 0, decode an instruction, then check it.  */
+
+  char insn_info_valid;                /* Branch info has been set. */
+  char branch_delay_insns;     /* How many sequential insn's will run before
+                                  a branch takes effect.  (0 = normal) */
+  char data_size;              /* Size of data reference in insn, in bytes */
+  enum dis_insn_type insn_type;        /* Type of instruction */
+  bfd_vma target;              /* Target address of branch or dref, if known;
+                                  zero if unknown.  */
+  bfd_vma target2;             /* Second target address for dref2 */
+
+  /* Command line options specific to the target disassembler.  */
+  char * disassembler_options;
+
+} disassemble_info;
+
+\f
+/* Standard disassemblers.  Disassemble one instruction at the given
+   target address.  Return number of octets processed.  */
+typedef int (*disassembler_ftype)
+     PARAMS((bfd_vma, disassemble_info *));
+
+extern int print_insn_big_mips         PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_mips      PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i386             PARAMS ((bfd_vma, disassemble_info *));
+extern int print_insn_i386_att         PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i386_intel       PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_ia64             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i370             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m68hc11          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m68hc12          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m68k             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_z8001            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_z8002            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_h8300            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_h8300h           PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_h8300s           PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_h8500            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_alpha            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_big_arm          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_arm       PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_sparc            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_big_a29k         PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_a29k      PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_avr              PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_d10v             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_d30v             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_dlx              PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_fr30             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_hppa             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i860             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i960             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_ip2k             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m32r             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m88k             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mcore            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mmix             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mn10200          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mn10300          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_ns32k            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_openrisc         PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_big_or32          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_or32       PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_pdp11            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_pj               PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_big_powerpc      PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_powerpc   PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_rs6000           PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_s390              PARAMS ((bfd_vma, disassemble_info*)); 
+extern int print_insn_sh               PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_tic30            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_tic4x            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_tic54x           PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_tic80            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_v850             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_vax              PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_w65              PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_xstormy16                PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_sh64             PARAMS ((bfd_vma, disassemble_info *));
+extern int print_insn_sh64x_media      PARAMS ((bfd_vma, disassemble_info *));
+extern int print_insn_frv              PARAMS ((bfd_vma, disassemble_info *));
+
+extern disassembler_ftype arc_get_disassembler PARAMS ((void *));
+extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *));
+
+extern void print_arm_disassembler_options PARAMS ((FILE *));
+extern void parse_arm_disassembler_option  PARAMS ((char *));
+extern int  get_arm_regname_num_options    PARAMS ((void));
+extern int  set_arm_regname_option         PARAMS ((int));
+extern int  get_arm_regnames               PARAMS ((int, const char **, const char **, const char ***));
+
+/* Fetch the disassembler for a given BFD, if that support is available.  */
+extern disassembler_ftype disassembler PARAMS ((bfd *));
+
+/* Document any target specific options available from the disassembler.  */
+extern void disassembler_usage          PARAMS ((FILE *));
+
+\f
+/* This block of definitions is for particular callers who read instructions
+   into a buffer before calling the instruction decoder.  */
+
+/* Here is a function which callers may wish to use for read_memory_func.
+   It gets bytes from a buffer.  */
+extern int buffer_read_memory
+  PARAMS ((bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *));
+
+/* This function goes with buffer_read_memory.
+   It prints a message using info->fprintf_func and info->stream.  */
+extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *));
+
+
+/* Just print the address in hex.  This is included for completeness even
+   though both GDB and objdump provide their own (to print symbolic
+   addresses).  */
+extern void generic_print_address
+  PARAMS ((bfd_vma, struct disassemble_info *));
+
+/* Always true.  */
+extern int generic_symbol_at_address
+  PARAMS ((bfd_vma, struct disassemble_info *));
+
+/* Macro to initialize a disassemble_info struct.  This should be called
+   by all applications creating such a struct.  */
+#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
+  (INFO).flavour = bfd_target_unknown_flavour, \
+  (INFO).arch = bfd_arch_unknown, \
+  (INFO).mach = 0, \
+  (INFO).insn_sets = 0, \
+  (INFO).endian = BFD_ENDIAN_UNKNOWN, \
+  (INFO).octets_per_byte = 1, \
+  INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC)
+
+/* Call this macro to initialize only the internal variables for the
+   disassembler.  Architecture dependent things such as byte order, or machine
+   variant are not touched by this macro.  This makes things much easier for
+   GDB which must initialize these things separately.  */
+
+#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
+  (INFO).fprintf_func = (fprintf_ftype)(FPRINTF_FUNC), \
+  (INFO).stream = (PTR)(STREAM), \
+  (INFO).section = NULL, \
+  (INFO).symbols = NULL, \
+  (INFO).num_symbols = 0, \
+  (INFO).private_data = NULL, \
+  (INFO).buffer = NULL, \
+  (INFO).buffer_vma = 0, \
+  (INFO).buffer_length = 0, \
+  (INFO).read_memory_func = buffer_read_memory, \
+  (INFO).memory_error_func = perror_memory, \
+  (INFO).print_address_func = generic_print_address, \
+  (INFO).symbol_at_address_func = generic_symbol_at_address, \
+  (INFO).flags = 0, \
+  (INFO).bytes_per_line = 0, \
+  (INFO).bytes_per_chunk = 0, \
+  (INFO).display_endian = BFD_ENDIAN_UNKNOWN, \
+  (INFO).disassembler_options = NULL, \
+  (INFO).insn_info_valid = 0
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* ! defined (DIS_ASM_H) */
diff --git a/jit/i386/dis-buf.c b/jit/i386/dis-buf.c
new file mode 100644 (file)
index 0000000..de297b6
--- /dev/null
@@ -0,0 +1,121 @@
+/* Disassemble from a buffer, for GNU.
+   Copyright 1993, 1994, 1996, 1997, 1998, 1999, 2000
+   Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/*  #include "sysdep.h" */
+#include "dis-asm.h"
+#include <errno.h>
+/*  #include "opintl.h" */
+
+/* Get LENGTH bytes from info's buffer, at target address memaddr.
+   Transfer them to myaddr.  */
+#if 0
+int
+buffer_read_memory (memaddr, myaddr, length, info)
+     bfd_vma memaddr;
+     bfd_byte *myaddr;
+     unsigned int length;
+     struct disassemble_info *info;
+{
+  unsigned int opb = info->octets_per_byte;
+  unsigned int end_addr_offset = length / opb;
+  unsigned int max_addr_offset = info->buffer_length / opb; 
+  unsigned int octets = (memaddr - info->buffer_vma) * opb;
+
+  printf("%d %d\n", memaddr, info->buffer_vma);
+  if (memaddr < info->buffer_vma
+      || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
+    /* Out of bounds.  Use EIO because GDB uses it.  */
+    return EIO;
+  memcpy (myaddr, info->buffer + octets, length);
+
+  return 0;
+}
+#endif
+
+/* Print an error message.  We can assume that this is in response to
+   an error return from buffer_read_memory.  */
+void
+perror_memory (status, memaddr, info)
+     int status;
+     bfd_vma memaddr;
+     struct disassemble_info *info;
+{
+  if (status != EIO)
+    /* Can't happen.  */
+    info->fprintf_func (info->stream, _("Unknown error %d\n"), status);
+  else
+    /* Actually, address between memaddr and memaddr + len was
+       out of bounds.  */
+    info->fprintf_func (info->stream,
+                       _("Address 0x%x is out of bounds.\n"), memaddr);
+}
+
+/* This could be in a separate file, to save miniscule amounts of space
+   in statically linked executables.  */
+
+/* Just print the address is hex.  This is included for completeness even
+   though both GDB and objdump provide their own (to print symbolic
+   addresses).  */
+
+void
+generic_print_address (addr, info)
+     bfd_vma addr;
+     struct disassemble_info *info;
+{
+  char buf[30];
+
+  sprintf_vma (buf, addr);
+  (*info->fprintf_func) (info->stream, "0x%s", buf);
+}
+
+#if 0
+/* Just concatenate the address as hex.  This is included for
+   completeness even though both GDB and objdump provide their own (to
+   print symbolic addresses).  */
+
+void generic_strcat_address PARAMS ((bfd_vma, char *, int));
+
+void
+generic_strcat_address (addr, buf, len)
+     bfd_vma addr;
+     char *buf;
+     int len;
+{
+  if (buf != (char *)NULL && len > 0)
+    {
+      char tmpBuf[30];
+
+      sprintf_vma (tmpBuf, addr);
+      if ((strlen (buf) + strlen (tmpBuf)) <= (unsigned int) len)
+       strcat (buf, tmpBuf);
+      else
+       strncat (buf, tmpBuf, (len - strlen(buf)));
+    }
+  return;
+}
+#endif
+
+/* Just return the given address.  */
+
+int
+generic_symbol_at_address (addr, info)
+     bfd_vma addr ATTRIBUTE_UNUSED;
+     struct disassemble_info *info ATTRIBUTE_UNUSED;
+{
+  return 1;
+}
diff --git a/jit/i386/disass.c b/jit/i386/disass.c
new file mode 100644 (file)
index 0000000..f9cc6ac
--- /dev/null
@@ -0,0 +1,172 @@
+/* i386/disass.c - wrapper functions for GNU binutils disassembler
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas  Krall
+            Reinhard Grafl
+
+   Changes: Christian Thalinger
+
+   $Id: disass.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdarg.h>
+#include <string.h>
+#include "dis-asm.h"
+
+
+u1 *codestatic = 0;
+int pstatic = 0;
+
+char mylinebuf[512];
+int mylen;
+
+
+char *regs[] = {
+       "eax",
+       "ecx",
+       "edx",
+       "ebx",
+       "esp",
+       "ebp",
+       "esi",
+       "edi"
+};
+
+
+void myprintf(PTR p, const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       mylen += vsprintf(mylinebuf + mylen, fmt, ap);
+       va_end(ap);
+}
+
+int buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info)
+{
+       if (length == 1)
+               *myaddr = *((u1 *) memaddr);
+       else
+               memcpy(myaddr, (void *) memaddr, length);
+       return 0;
+}
+
+
+
+/* function disassinstr ********************************************************
+
+       outputs a disassembler listing of one machine code instruction on 'stdout'
+       c:   instructions machine code
+       pos: instructions address relative to method start
+
+*******************************************************************************/
+
+int disassinstr(u1 *code, int pos)
+{
+       static disassemble_info info;
+       static int dis_initialized;
+       int seqlen;
+       int i;
+
+       if (!dis_initialized) {
+               INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
+               info.mach = bfd_mach_i386_i386;
+               dis_initialized = 1;
+       }
+
+       printf("0x%08x:   ", (s4) code);
+       mylen = 0;
+       seqlen = print_insn_i386((bfd_vma) code, &info);
+
+       for (i = 0; i < seqlen; i++) {
+               printf("%02x ", *(code++));
+       }
+
+       for (; i < 8; i++) {
+               printf("   ");
+       }
+
+       printf("   %s\n", mylinebuf);
+
+       return (seqlen - 1);
+}
+
+
+
+/* function disassemble ********************************************************
+
+       outputs a disassembler listing of some machine code on 'stdout'
+       code: pointer to first instruction
+       len:  code size (number of instructions * 4)
+
+*******************************************************************************/
+
+void disassemble(u1 *code, int len)
+{
+       int p;
+       int seqlen;
+       int i;
+       disassemble_info info;
+
+       INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
+       info.mach = bfd_mach_i386_i386;
+
+       printf("  --- disassembler listing ---\n");
+       for (p = 0; p < len;) {
+               printf("0x%08x:   ", (s4) code);
+               mylen = 0;
+
+               seqlen = print_insn_i386((bfd_vma) code, &info);
+               p += seqlen;
+               /*              myprintf(NULL, "\n"); */
+
+               for (i = 0; i < seqlen; i++) {
+                       printf("%02x ", *(code++));
+               }
+
+               for (; i < 8; i++) {
+                       printf("   ");
+               }
+
+               printf("   %s\n", mylinebuf);
+       }
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/i386/disass.h b/jit/i386/disass.h
new file mode 100644 (file)
index 0000000..a16bf66
--- /dev/null
@@ -0,0 +1,65 @@
+/* i386/disass.h - wrapper functions for GNU binutils disassembler
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: disass.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _DISASS_H
+#define _DISASS_H
+
+#include "types.h"
+#include "dis-asm.h"
+
+
+extern char *regs[];
+
+
+/* function prototypes */
+void myprintf(PTR p, const char *fmt, ...);
+int buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info);
+int disassinstr(u1 *code, int pos);
+void disassemble(u1 *code, int len);
+
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/i386/i386-dis.c b/jit/i386/i386-dis.c
new file mode 100644 (file)
index 0000000..5b01e2f
--- /dev/null
@@ -0,0 +1,4147 @@
+/* Print i386 instructions for GDB, the GNU debugger.
+   Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2001
+   Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/*
+ * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
+ * July 1988
+ *  modified by John Hassey (hassey@dg-rtp.dg.com)
+ *  x86-64 support added by Jan Hubicka (jh@suse.cz)
+ */
+
+/*
+ * The main tables describing the instructions is essentially a copy
+ * of the "Opcode Map" chapter (Appendix A) of the Intel 80386
+ * Programmers Manual.  Usually, there is a capital letter, followed
+ * by a small letter.  The capital letter tell the addressing mode,
+ * and the small letter tells about the operand size.  Refer to
+ * the Intel manual for details.
+ */
+
+#include "dis-asm.h"
+/*  #include "sysdep.h" */
+/*  #include "opintl.h" */
+
+#define MAXLEN 20
+
+#include <setjmp.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifndef UNIXWARE_COMPAT
+/* Set non-zero for broken, compatible instructions.  Set to zero for
+   non-broken opcodes.  */
+#define UNIXWARE_COMPAT 1
+#endif
+
+static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *));
+static void ckprefix PARAMS ((void));
+static const char *prefix_name PARAMS ((int, int));
+static int print_insn PARAMS ((bfd_vma, disassemble_info *));
+static void dofloat PARAMS ((int));
+static void OP_ST PARAMS ((int, int));
+static void OP_STi  PARAMS ((int, int));
+static int putop PARAMS ((const char *, int));
+static void oappend PARAMS ((const char *));
+static void append_seg PARAMS ((void));
+static void OP_indirE PARAMS ((int, int));
+static void print_operand_value PARAMS ((char *, int, bfd_vma));
+static void OP_E PARAMS ((int, int));
+static void OP_G PARAMS ((int, int));
+static bfd_vma get64 PARAMS ((void));
+static bfd_signed_vma get32 PARAMS ((void));
+static bfd_signed_vma get32s PARAMS ((void));
+static int get16 PARAMS ((void));
+static void set_op PARAMS ((bfd_vma, int));
+static void OP_REG PARAMS ((int, int));
+static void OP_IMREG PARAMS ((int, int));
+static void OP_I PARAMS ((int, int));
+static void OP_I64 PARAMS ((int, int));
+static void OP_sI PARAMS ((int, int));
+static void OP_J PARAMS ((int, int));
+static void OP_SEG PARAMS ((int, int));
+static void OP_DIR PARAMS ((int, int));
+static void OP_OFF PARAMS ((int, int));
+static void OP_OFF64 PARAMS ((int, int));
+static void ptr_reg PARAMS ((int, int));
+static void OP_ESreg PARAMS ((int, int));
+static void OP_DSreg PARAMS ((int, int));
+static void OP_C PARAMS ((int, int));
+static void OP_D PARAMS ((int, int));
+static void OP_T PARAMS ((int, int));
+static void OP_Rd PARAMS ((int, int));
+static void OP_MMX PARAMS ((int, int));
+static void OP_XMM PARAMS ((int, int));
+static void OP_EM PARAMS ((int, int));
+static void OP_EX PARAMS ((int, int));
+static void OP_MS PARAMS ((int, int));
+static void OP_XS PARAMS ((int, int));
+static void OP_3DNowSuffix PARAMS ((int, int));
+static void OP_SIMD_Suffix PARAMS ((int, int));
+static void SIMD_Fixup PARAMS ((int, int));
+static void BadOp PARAMS ((void));
+
+struct dis_private {
+  /* Points to first byte not fetched.  */
+  bfd_byte *max_fetched;
+  bfd_byte the_buffer[MAXLEN];
+  bfd_vma insn_start;
+  int orig_sizeflag;
+  jmp_buf bailout;
+};
+
+/* The opcode for the fwait instruction, which we treat as a prefix
+   when we can.  */
+#define FWAIT_OPCODE (0x9b)
+
+/* Set to 1 for 64bit mode disassembly.  */
+static int mode_64bit;
+
+/* Flags for the prefixes for the current instruction.  See below.  */
+static int prefixes;
+
+/* REX prefix the current instruction.  See below.  */
+static int rex;
+/* Bits of REX we've already used.  */
+static int rex_used;
+#define REX_MODE64     8
+#define REX_EXTX       4
+#define REX_EXTY       2
+#define REX_EXTZ       1
+/* Mark parts used in the REX prefix.  When we are testing for
+   empty prefix (for 8bit register REX extension), just mask it
+   out.  Otherwise test for REX bit is excuse for existence of REX
+   only in case value is nonzero.  */
+#define USED_REX(value)                                        \
+  {                                                    \
+    if (value)                                         \
+      rex_used |= (rex & value) ? (value) | 0x40 : 0;  \
+    else                                               \
+      rex_used |= 0x40;                                        \
+  }
+
+/* Flags for prefixes which we somehow handled when printing the
+   current instruction.  */
+static int used_prefixes;
+
+/* Flags stored in PREFIXES.  */
+#define PREFIX_REPZ 1
+#define PREFIX_REPNZ 2
+#define PREFIX_LOCK 4
+#define PREFIX_CS 8
+#define PREFIX_SS 0x10
+#define PREFIX_DS 0x20
+#define PREFIX_ES 0x40
+#define PREFIX_FS 0x80
+#define PREFIX_GS 0x100
+#define PREFIX_DATA 0x200
+#define PREFIX_ADDR 0x400
+#define PREFIX_FWAIT 0x800
+
+/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
+   to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
+   on error.  */
+#define FETCH_DATA(info, addr) \
+  ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
+   ? 1 : fetch_data ((info), (addr)))
+
+static int
+fetch_data (info, addr)
+     struct disassemble_info *info;
+     bfd_byte *addr;
+{
+  int status;
+  struct dis_private *priv = (struct dis_private *) info->private_data;
+  bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer);
+
+  status = (*info->read_memory_func) (start,
+                                     priv->max_fetched,
+                                     addr - priv->max_fetched,
+                                     info);
+  if (status != 0)
+    {
+      /* If we did manage to read at least one byte, then
+         print_insn_i386 will do something sensible.  Otherwise, print
+         an error.  We do that here because this is where we know
+         STATUS.  */
+      if (priv->max_fetched == priv->the_buffer)
+       (*info->memory_error_func) (status, start, info);
+      longjmp (priv->bailout, 1);
+    }
+  else
+    priv->max_fetched = addr;
+  return 1;
+}
+
+#define XX NULL, 0
+
+#define Eb OP_E, b_mode
+#define Ev OP_E, v_mode
+#define Ed OP_E, d_mode
+#define indirEb OP_indirE, b_mode
+#define indirEv OP_indirE, v_mode
+#define Ew OP_E, w_mode
+#define Ma OP_E, v_mode
+#define M OP_E, 0              /* lea, lgdt, etc. */
+#define Mp OP_E, 0             /* 32 or 48 bit memory operand for LDS, LES etc */
+#define Gb OP_G, b_mode
+#define Gv OP_G, v_mode
+#define Gd OP_G, d_mode
+#define Gw OP_G, w_mode
+#define Rd OP_Rd, d_mode
+#define Rm OP_Rd, m_mode
+#define Ib OP_I, b_mode
+#define sIb OP_sI, b_mode      /* sign extened byte */
+#define Iv OP_I, v_mode
+#define Iq OP_I, q_mode
+#define Iv64 OP_I64, v_mode
+#define Iw OP_I, w_mode
+#define Jb OP_J, b_mode
+#define Jv OP_J, v_mode
+#define Cm OP_C, m_mode
+#define Dm OP_D, m_mode
+#define Td OP_T, d_mode
+
+#define RMeAX OP_REG, eAX_reg
+#define RMeBX OP_REG, eBX_reg
+#define RMeCX OP_REG, eCX_reg
+#define RMeDX OP_REG, eDX_reg
+#define RMeSP OP_REG, eSP_reg
+#define RMeBP OP_REG, eBP_reg
+#define RMeSI OP_REG, eSI_reg
+#define RMeDI OP_REG, eDI_reg
+#define RMrAX OP_REG, rAX_reg
+#define RMrBX OP_REG, rBX_reg
+#define RMrCX OP_REG, rCX_reg
+#define RMrDX OP_REG, rDX_reg
+#define RMrSP OP_REG, rSP_reg
+#define RMrBP OP_REG, rBP_reg
+#define RMrSI OP_REG, rSI_reg
+#define RMrDI OP_REG, rDI_reg
+#define RMAL OP_REG, al_reg
+#define RMAL OP_REG, al_reg
+#define RMCL OP_REG, cl_reg
+#define RMDL OP_REG, dl_reg
+#define RMBL OP_REG, bl_reg
+#define RMAH OP_REG, ah_reg
+#define RMCH OP_REG, ch_reg
+#define RMDH OP_REG, dh_reg
+#define RMBH OP_REG, bh_reg
+#define RMAX OP_REG, ax_reg
+#define RMDX OP_REG, dx_reg
+
+#define eAX OP_IMREG, eAX_reg
+#define eBX OP_IMREG, eBX_reg
+#define eCX OP_IMREG, eCX_reg
+#define eDX OP_IMREG, eDX_reg
+#define eSP OP_IMREG, eSP_reg
+#define eBP OP_IMREG, eBP_reg
+#define eSI OP_IMREG, eSI_reg
+#define eDI OP_IMREG, eDI_reg
+#define AL OP_IMREG, al_reg
+#define AL OP_IMREG, al_reg
+#define CL OP_IMREG, cl_reg
+#define DL OP_IMREG, dl_reg
+#define BL OP_IMREG, bl_reg
+#define AH OP_IMREG, ah_reg
+#define CH OP_IMREG, ch_reg
+#define DH OP_IMREG, dh_reg
+#define BH OP_IMREG, bh_reg
+#define AX OP_IMREG, ax_reg
+#define DX OP_IMREG, dx_reg
+#define indirDX OP_IMREG, indir_dx_reg
+
+#define Sw OP_SEG, w_mode
+#define Ap OP_DIR, 0
+#define Ob OP_OFF, b_mode
+#define Ob64 OP_OFF64, b_mode
+#define Ov OP_OFF, v_mode
+#define Ov64 OP_OFF64, v_mode
+#define Xb OP_DSreg, eSI_reg
+#define Xv OP_DSreg, eSI_reg
+#define Yb OP_ESreg, eDI_reg
+#define Yv OP_ESreg, eDI_reg
+#define DSBX OP_DSreg, eBX_reg
+
+#define es OP_REG, es_reg
+#define ss OP_REG, ss_reg
+#define cs OP_REG, cs_reg
+#define ds OP_REG, ds_reg
+#define fs OP_REG, fs_reg
+#define gs OP_REG, gs_reg
+
+#define MX OP_MMX, 0
+#define XM OP_XMM, 0
+#define EM OP_EM, v_mode
+#define EX OP_EX, v_mode
+#define MS OP_MS, v_mode
+#define XS OP_XS, v_mode
+#define None OP_E, 0
+#define OPSUF OP_3DNowSuffix, 0
+#define OPSIMD OP_SIMD_Suffix, 0
+
+#define cond_jump_flag NULL, cond_jump_mode
+#define loop_jcxz_flag NULL, loop_jcxz_mode
+
+/* bits in sizeflag */
+#define SUFFIX_ALWAYS 4
+#define AFLAG 2
+#define DFLAG 1
+
+#define b_mode 1  /* byte operand */
+#define v_mode 2  /* operand size depends on prefixes */
+#define w_mode 3  /* word operand */
+#define d_mode 4  /* double word operand  */
+#define q_mode 5  /* quad word operand */
+#define x_mode 6
+#define m_mode 7  /* d_mode in 32bit, q_mode in 64bit mode.  */
+#define cond_jump_mode 8
+#define loop_jcxz_mode 9
+
+#define es_reg 100
+#define cs_reg 101
+#define ss_reg 102
+#define ds_reg 103
+#define fs_reg 104
+#define gs_reg 105
+
+#define eAX_reg 108
+#define eCX_reg 109
+#define eDX_reg 110
+#define eBX_reg 111
+#define eSP_reg 112
+#define eBP_reg 113
+#define eSI_reg 114
+#define eDI_reg 115
+
+#define al_reg 116
+#define cl_reg 117
+#define dl_reg 118
+#define bl_reg 119
+#define ah_reg 120
+#define ch_reg 121
+#define dh_reg 122
+#define bh_reg 123
+
+#define ax_reg 124
+#define cx_reg 125
+#define dx_reg 126
+#define bx_reg 127
+#define sp_reg 128
+#define bp_reg 129
+#define si_reg 130
+#define di_reg 131
+
+#define rAX_reg 132
+#define rCX_reg 133
+#define rDX_reg 134
+#define rBX_reg 135
+#define rSP_reg 136
+#define rBP_reg 137
+#define rSI_reg 138
+#define rDI_reg 139
+
+#define indir_dx_reg 150
+
+#define FLOATCODE 1
+#define USE_GROUPS 2
+#define USE_PREFIX_USER_TABLE 3
+#define X86_64_SPECIAL 4
+
+#define FLOAT    NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
+
+#define GRP1b    NULL, NULL, USE_GROUPS, NULL,  0, NULL, 0
+#define GRP1S    NULL, NULL, USE_GROUPS, NULL,  1, NULL, 0
+#define GRP1Ss   NULL, NULL, USE_GROUPS, NULL,  2, NULL, 0
+#define GRP2b    NULL, NULL, USE_GROUPS, NULL,  3, NULL, 0
+#define GRP2S    NULL, NULL, USE_GROUPS, NULL,  4, NULL, 0
+#define GRP2b_one NULL, NULL, USE_GROUPS, NULL,  5, NULL, 0
+#define GRP2S_one NULL, NULL, USE_GROUPS, NULL,  6, NULL, 0
+#define GRP2b_cl  NULL, NULL, USE_GROUPS, NULL,  7, NULL, 0
+#define GRP2S_cl  NULL, NULL, USE_GROUPS, NULL,  8, NULL, 0
+#define GRP3b    NULL, NULL, USE_GROUPS, NULL,  9, NULL, 0
+#define GRP3S    NULL, NULL, USE_GROUPS, NULL, 10, NULL, 0
+#define GRP4     NULL, NULL, USE_GROUPS, NULL, 11, NULL, 0
+#define GRP5     NULL, NULL, USE_GROUPS, NULL, 12, NULL, 0
+#define GRP6     NULL, NULL, USE_GROUPS, NULL, 13, NULL, 0
+#define GRP7     NULL, NULL, USE_GROUPS, NULL, 14, NULL, 0
+#define GRP8     NULL, NULL, USE_GROUPS, NULL, 15, NULL, 0
+#define GRP9     NULL, NULL, USE_GROUPS, NULL, 16, NULL, 0
+#define GRP10    NULL, NULL, USE_GROUPS, NULL, 17, NULL, 0
+#define GRP11    NULL, NULL, USE_GROUPS, NULL, 18, NULL, 0
+#define GRP12    NULL, NULL, USE_GROUPS, NULL, 19, NULL, 0
+#define GRP13    NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0
+#define GRP14    NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0
+#define GRPAMD   NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0
+
+#define PREGRP0   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  0, NULL, 0
+#define PREGRP1   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  1, NULL, 0
+#define PREGRP2   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  2, NULL, 0
+#define PREGRP3   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  3, NULL, 0
+#define PREGRP4   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  4, NULL, 0
+#define PREGRP5   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  5, NULL, 0
+#define PREGRP6   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  6, NULL, 0
+#define PREGRP7   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  7, NULL, 0
+#define PREGRP8   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  8, NULL, 0
+#define PREGRP9   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  9, NULL, 0
+#define PREGRP10  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 10, NULL, 0
+#define PREGRP11  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 11, NULL, 0
+#define PREGRP12  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 12, NULL, 0
+#define PREGRP13  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 13, NULL, 0
+#define PREGRP14  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 14, NULL, 0
+#define PREGRP15  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 15, NULL, 0
+#define PREGRP16  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 16, NULL, 0
+#define PREGRP17  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 17, NULL, 0
+#define PREGRP18  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 18, NULL, 0
+#define PREGRP19  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 19, NULL, 0
+#define PREGRP20  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 20, NULL, 0
+#define PREGRP21  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 21, NULL, 0
+#define PREGRP22  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 22, NULL, 0
+#define PREGRP23  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 23, NULL, 0
+#define PREGRP24  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 24, NULL, 0
+#define PREGRP25  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 25, NULL, 0
+#define PREGRP26  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 26, NULL, 0
+
+#define X86_64_0  NULL, NULL, X86_64_SPECIAL, NULL,  0, NULL, 0
+
+typedef void (*op_rtn) PARAMS ((int bytemode, int sizeflag));
+
+struct dis386 {
+  const char *name;
+  op_rtn op1;
+  int bytemode1;
+  op_rtn op2;
+  int bytemode2;
+  op_rtn op3;
+  int bytemode3;
+};
+
+/* Upper case letters in the instruction names here are macros.
+   'A' => print 'b' if no register operands or suffix_always is true
+   'B' => print 'b' if suffix_always is true
+   'E' => print 'e' if 32-bit form of jcxz
+   'F' => print 'w' or 'l' depending on address size prefix (loop insns)
+   'H' => print ",pt" or ",pn" branch hint
+   'L' => print 'l' if suffix_always is true
+   'N' => print 'n' if instruction has no wait "prefix"
+   'O' => print 'd', or 'o'
+   'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
+   .      or suffix_always is true.  print 'q' if rex prefix is present.
+   'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always
+   .      is true
+   'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode)
+   'S' => print 'w', 'l' or 'q' if suffix_always is true
+   'T' => print 'q' in 64bit mode and behave as 'P' otherwise
+   'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
+   'X' => print 's', 'd' depending on data16 prefix (for XMM)
+   'W' => print 'b' or 'w' ("w" or "de" in intel mode)
+   'Y' => 'q' if instruction has an REX 64bit overwrite prefix
+
+   Many of the above letters print nothing in Intel mode.  See "putop"
+   for the details.
+
+   Braces '{' and '}', and vertical bars '|', indicate alternative
+   mnemonic strings for AT&T, Intel, X86_64 AT&T, and X86_64 Intel
+   modes.  In cases where there are only two alternatives, the X86_64
+   instruction is reserved, and "(bad)" is printed.
+*/
+
+static const struct dis386 dis386[] = {
+  /* 00 */
+  { "addB",            Eb, Gb, XX },
+  { "addS",            Ev, Gv, XX },
+  { "addB",            Gb, Eb, XX },
+  { "addS",            Gv, Ev, XX },
+  { "addB",            AL, Ib, XX },
+  { "addS",            eAX, Iv, XX },
+  { "push{T|}",                es, XX, XX },
+  { "pop{T|}",         es, XX, XX },
+  /* 08 */
+  { "orB",             Eb, Gb, XX },
+  { "orS",             Ev, Gv, XX },
+  { "orB",             Gb, Eb, XX },
+  { "orS",             Gv, Ev, XX },
+  { "orB",             AL, Ib, XX },
+  { "orS",             eAX, Iv, XX },
+  { "push{T|}",                cs, XX, XX },
+  { "(bad)",           XX, XX, XX },   /* 0x0f extended opcode escape */
+  /* 10 */
+  { "adcB",            Eb, Gb, XX },
+  { "adcS",            Ev, Gv, XX },
+  { "adcB",            Gb, Eb, XX },
+  { "adcS",            Gv, Ev, XX },
+  { "adcB",            AL, Ib, XX },
+  { "adcS",            eAX, Iv, XX },
+  { "push{T|}",                ss, XX, XX },
+  { "popT|}",          ss, XX, XX },
+  /* 18 */
+  { "sbbB",            Eb, Gb, XX },
+  { "sbbS",            Ev, Gv, XX },
+  { "sbbB",            Gb, Eb, XX },
+  { "sbbS",            Gv, Ev, XX },
+  { "sbbB",            AL, Ib, XX },
+  { "sbbS",            eAX, Iv, XX },
+  { "push{T|}",                ds, XX, XX },
+  { "pop{T|}",         ds, XX, XX },
+  /* 20 */
+  { "andB",            Eb, Gb, XX },
+  { "andS",            Ev, Gv, XX },
+  { "andB",            Gb, Eb, XX },
+  { "andS",            Gv, Ev, XX },
+  { "andB",            AL, Ib, XX },
+  { "andS",            eAX, Iv, XX },
+  { "(bad)",           XX, XX, XX },   /* SEG ES prefix */
+  { "daa{|}",          XX, XX, XX },
+  /* 28 */
+  { "subB",            Eb, Gb, XX },
+  { "subS",            Ev, Gv, XX },
+  { "subB",            Gb, Eb, XX },
+  { "subS",            Gv, Ev, XX },
+  { "subB",            AL, Ib, XX },
+  { "subS",            eAX, Iv, XX },
+  { "(bad)",           XX, XX, XX },   /* SEG CS prefix */
+  { "das{|}",          XX, XX, XX },
+  /* 30 */
+  { "xorB",            Eb, Gb, XX },
+  { "xorS",            Ev, Gv, XX },
+  { "xorB",            Gb, Eb, XX },
+  { "xorS",            Gv, Ev, XX },
+  { "xorB",            AL, Ib, XX },
+  { "xorS",            eAX, Iv, XX },
+  { "(bad)",           XX, XX, XX },   /* SEG SS prefix */
+  { "aaa{|}",          XX, XX, XX },
+  /* 38 */
+  { "cmpB",            Eb, Gb, XX },
+  { "cmpS",            Ev, Gv, XX },
+  { "cmpB",            Gb, Eb, XX },
+  { "cmpS",            Gv, Ev, XX },
+  { "cmpB",            AL, Ib, XX },
+  { "cmpS",            eAX, Iv, XX },
+  { "(bad)",           XX, XX, XX },   /* SEG DS prefix */
+  { "aas{|}",          XX, XX, XX },
+  /* 40 */
+  { "inc{S|}",         RMeAX, XX, XX },
+  { "inc{S|}",         RMeCX, XX, XX },
+  { "inc{S|}",         RMeDX, XX, XX },
+  { "inc{S|}",         RMeBX, XX, XX },
+  { "inc{S|}",         RMeSP, XX, XX },
+  { "inc{S|}",         RMeBP, XX, XX },
+  { "inc{S|}",         RMeSI, XX, XX },
+  { "inc{S|}",         RMeDI, XX, XX },
+  /* 48 */
+  { "dec{S|}",         RMeAX, XX, XX },
+  { "dec{S|}",         RMeCX, XX, XX },
+  { "dec{S|}",         RMeDX, XX, XX },
+  { "dec{S|}",         RMeBX, XX, XX },
+  { "dec{S|}",         RMeSP, XX, XX },
+  { "dec{S|}",         RMeBP, XX, XX },
+  { "dec{S|}",         RMeSI, XX, XX },
+  { "dec{S|}",         RMeDI, XX, XX },
+  /* 50 */
+  { "pushS",           RMrAX, XX, XX },
+  { "pushS",           RMrCX, XX, XX },
+  { "pushS",           RMrDX, XX, XX },
+  { "pushS",           RMrBX, XX, XX },
+  { "pushS",           RMrSP, XX, XX },
+  { "pushS",           RMrBP, XX, XX },
+  { "pushS",           RMrSI, XX, XX },
+  { "pushS",           RMrDI, XX, XX },
+  /* 58 */
+  { "popS",            RMrAX, XX, XX },
+  { "popS",            RMrCX, XX, XX },
+  { "popS",            RMrDX, XX, XX },
+  { "popS",            RMrBX, XX, XX },
+  { "popS",            RMrSP, XX, XX },
+  { "popS",            RMrBP, XX, XX },
+  { "popS",            RMrSI, XX, XX },
+  { "popS",            RMrDI, XX, XX },
+  /* 60 */
+  { "pusha{P|}",       XX, XX, XX },
+  { "popa{P|}",                XX, XX, XX },
+  { "bound{S|}",       Gv, Ma, XX },
+  { X86_64_0 },
+  { "(bad)",           XX, XX, XX },   /* seg fs */
+  { "(bad)",           XX, XX, XX },   /* seg gs */
+  { "(bad)",           XX, XX, XX },   /* op size prefix */
+  { "(bad)",           XX, XX, XX },   /* adr size prefix */
+  /* 68 */
+  { "pushT",           Iq, XX, XX },
+  { "imulS",           Gv, Ev, Iv },
+  { "pushT",           sIb, XX, XX },
+  { "imulS",           Gv, Ev, sIb },
+  { "ins{b||b|}",      Yb, indirDX, XX },
+  { "ins{R||R|}",      Yv, indirDX, XX },
+  { "outs{b||b|}",     indirDX, Xb, XX },
+  { "outs{R||R|}",     indirDX, Xv, XX },
+  /* 70 */
+  { "joH",             Jb, XX, cond_jump_flag },
+  { "jnoH",            Jb, XX, cond_jump_flag },
+  { "jbH",             Jb, XX, cond_jump_flag },
+  { "jaeH",            Jb, XX, cond_jump_flag },
+  { "jeH",             Jb, XX, cond_jump_flag },
+  { "jneH",            Jb, XX, cond_jump_flag },
+  { "jbeH",            Jb, XX, cond_jump_flag },
+  { "jaH",             Jb, XX, cond_jump_flag },
+  /* 78 */
+  { "jsH",             Jb, XX, cond_jump_flag },
+  { "jnsH",            Jb, XX, cond_jump_flag },
+  { "jpH",             Jb, XX, cond_jump_flag },
+  { "jnpH",            Jb, XX, cond_jump_flag },
+  { "jlH",             Jb, XX, cond_jump_flag },
+  { "jgeH",            Jb, XX, cond_jump_flag },
+  { "jleH",            Jb, XX, cond_jump_flag },
+  { "jgH",             Jb, XX, cond_jump_flag },
+  /* 80 */
+  { GRP1b },
+  { GRP1S },
+  { "(bad)",           XX, XX, XX },
+  { GRP1Ss },
+  { "testB",           Eb, Gb, XX },
+  { "testS",           Ev, Gv, XX },
+  { "xchgB",           Eb, Gb, XX },
+  { "xchgS",           Ev, Gv, XX },
+  /* 88 */
+  { "movB",            Eb, Gb, XX },
+  { "movS",            Ev, Gv, XX },
+  { "movB",            Gb, Eb, XX },
+  { "movS",            Gv, Ev, XX },
+  { "movQ",            Ev, Sw, XX },
+  { "leaS",            Gv, M, XX },
+  { "movQ",            Sw, Ev, XX },
+  { "popU",            Ev, XX, XX },
+  /* 90 */
+  { "nop",             XX, XX, XX },
+  /* FIXME: NOP with REPz prefix is called PAUSE.  */
+  { "xchgS",           RMeCX, eAX, XX },
+  { "xchgS",           RMeDX, eAX, XX },
+  { "xchgS",           RMeBX, eAX, XX },
+  { "xchgS",           RMeSP, eAX, XX },
+  { "xchgS",           RMeBP, eAX, XX },
+  { "xchgS",           RMeSI, eAX, XX },
+  { "xchgS",           RMeDI, eAX, XX },
+  /* 98 */
+  { "cW{tR||tR|}",     XX, XX, XX },
+  { "cR{tO||tO|}",     XX, XX, XX },
+  { "lcall{T|}",       Ap, XX, XX },
+  { "(bad)",           XX, XX, XX },   /* fwait */
+  { "pushfT",          XX, XX, XX },
+  { "popfT",           XX, XX, XX },
+  { "sahf{|}",         XX, XX, XX },
+  { "lahf{|}",         XX, XX, XX },
+  /* a0 */
+  { "movB",            AL, Ob64, XX },
+  { "movS",            eAX, Ov64, XX },
+  { "movB",            Ob64, AL, XX },
+  { "movS",            Ov64, eAX, XX },
+  { "movs{b||b|}",     Yb, Xb, XX },
+  { "movs{R||R|}",     Yv, Xv, XX },
+  { "cmps{b||b|}",     Xb, Yb, XX },
+  { "cmps{R||R|}",     Xv, Yv, XX },
+  /* a8 */
+  { "testB",           AL, Ib, XX },
+  { "testS",           eAX, Iv, XX },
+  { "stosB",           Yb, AL, XX },
+  { "stosS",           Yv, eAX, XX },
+  { "lodsB",           AL, Xb, XX },
+  { "lodsS",           eAX, Xv, XX },
+  { "scasB",           AL, Yb, XX },
+  { "scasS",           eAX, Yv, XX },
+  /* b0 */
+  { "movB",            RMAL, Ib, XX },
+  { "movB",            RMCL, Ib, XX },
+  { "movB",            RMDL, Ib, XX },
+  { "movB",            RMBL, Ib, XX },
+  { "movB",            RMAH, Ib, XX },
+  { "movB",            RMCH, Ib, XX },
+  { "movB",            RMDH, Ib, XX },
+  { "movB",            RMBH, Ib, XX },
+  /* b8 */
+  { "movS",            RMeAX, Iv64, XX },
+  { "movS",            RMeCX, Iv64, XX },
+  { "movS",            RMeDX, Iv64, XX },
+  { "movS",            RMeBX, Iv64, XX },
+  { "movS",            RMeSP, Iv64, XX },
+  { "movS",            RMeBP, Iv64, XX },
+  { "movS",            RMeSI, Iv64, XX },
+  { "movS",            RMeDI, Iv64, XX },
+  /* c0 */
+  { GRP2b },
+  { GRP2S },
+  { "retT",            Iw, XX, XX },
+  { "retT",            XX, XX, XX },
+  { "les{S|}",         Gv, Mp, XX },
+  { "ldsS",            Gv, Mp, XX },
+  { "movA",            Eb, Ib, XX },
+  { "movQ",            Ev, Iv, XX },
+  /* c8 */
+  { "enterT",          Iw, Ib, XX },
+  { "leaveT",          XX, XX, XX },
+  { "lretP",           Iw, XX, XX },
+  { "lretP",           XX, XX, XX },
+  { "int3",            XX, XX, XX },
+  { "int",             Ib, XX, XX },
+  { "into{|}",         XX, XX, XX },
+  { "iretP",           XX, XX, XX },
+  /* d0 */
+  { GRP2b_one },
+  { GRP2S_one },
+  { GRP2b_cl },
+  { GRP2S_cl },
+  { "aam{|}",          sIb, XX, XX },
+  { "aad{|}",          sIb, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "xlat",            DSBX, XX, XX },
+  /* d8 */
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  /* e0 */
+  { "loopneFH",                Jb, XX, loop_jcxz_flag },
+  { "loopeFH",         Jb, XX, loop_jcxz_flag },
+  { "loopFH",          Jb, XX, loop_jcxz_flag },
+  { "jEcxzH",          Jb, XX, loop_jcxz_flag },
+  { "inB",             AL, Ib, XX },
+  { "inS",             eAX, Ib, XX },
+  { "outB",            Ib, AL, XX },
+  { "outS",            Ib, eAX, XX },
+  /* e8 */
+  { "callT",           Jv, XX, XX },
+  { "jmpT",            Jv, XX, XX },
+  { "ljmp{T|}",                Ap, XX, XX },
+  { "jmp",             Jb, XX, XX },
+  { "inB",             AL, indirDX, XX },
+  { "inS",             eAX, indirDX, XX },
+  { "outB",            indirDX, AL, XX },
+  { "outS",            indirDX, eAX, XX },
+  /* f0 */
+  { "(bad)",           XX, XX, XX },   /* lock prefix */
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },   /* repne */
+  { "(bad)",           XX, XX, XX },   /* repz */
+  { "hlt",             XX, XX, XX },
+  { "cmc",             XX, XX, XX },
+  { GRP3b },
+  { GRP3S },
+  /* f8 */
+  { "clc",             XX, XX, XX },
+  { "stc",             XX, XX, XX },
+  { "cli",             XX, XX, XX },
+  { "sti",             XX, XX, XX },
+  { "cld",             XX, XX, XX },
+  { "std",             XX, XX, XX },
+  { GRP4 },
+  { GRP5 },
+};
+
+static const struct dis386 dis386_twobyte[] = {
+  /* 00 */
+  { GRP6 },
+  { GRP7 },
+  { "larS",            Gv, Ew, XX },
+  { "lslS",            Gv, Ew, XX },
+  { "(bad)",           XX, XX, XX },
+  { "syscall",         XX, XX, XX },
+  { "clts",            XX, XX, XX },
+  { "sysretP",         XX, XX, XX },
+  /* 08 */
+  { "invd",            XX, XX, XX },
+  { "wbinvd",          XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "ud2a",            XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { GRPAMD },
+  { "femms",           XX, XX, XX },
+  { "",                        MX, EM, OPSUF }, /* See OP_3DNowSuffix.  */
+  /* 10 */
+  { PREGRP8 },
+  { PREGRP9 },
+  { "movlpX",          XM, EX, SIMD_Fixup, 'h' }, /* really only 2 operands */
+  { "movlpX",          EX, XM, SIMD_Fixup, 'h' },
+  { "unpcklpX",                XM, EX, XX },
+  { "unpckhpX",                XM, EX, XX },
+  { "movhpX",          XM, EX, SIMD_Fixup, 'l' },
+  { "movhpX",          EX, XM, SIMD_Fixup, 'l' },
+  /* 18 */
+  { GRP14 },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  /* 20 */
+  { "movL",            Rm, Cm, XX },
+  { "movL",            Rm, Dm, XX },
+  { "movL",            Cm, Rm, XX },
+  { "movL",            Dm, Rm, XX },
+  { "movL",            Rd, Td, XX },
+  { "(bad)",           XX, XX, XX },
+  { "movL",            Td, Rd, XX },
+  { "(bad)",           XX, XX, XX },
+  /* 28 */
+  { "movapX",          XM, EX, XX },
+  { "movapX",          EX, XM, XX },
+  { PREGRP2 },
+  { "movntpX",         Ev, XM, XX },
+  { PREGRP4 },
+  { PREGRP3 },
+  { "ucomisX",         XM,EX, XX },
+  { "comisX",          XM,EX, XX },
+  /* 30 */
+  { "wrmsr",           XX, XX, XX },
+  { "rdtsc",           XX, XX, XX },
+  { "rdmsr",           XX, XX, XX },
+  { "rdpmc",           XX, XX, XX },
+  { "sysenter",                XX, XX, XX },
+  { "sysexit",         XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  /* 38 */
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  /* 40 */
+  { "cmovo",           Gv, Ev, XX },
+  { "cmovno",          Gv, Ev, XX },
+  { "cmovb",           Gv, Ev, XX },
+  { "cmovae",          Gv, Ev, XX },
+  { "cmove",           Gv, Ev, XX },
+  { "cmovne",          Gv, Ev, XX },
+  { "cmovbe",          Gv, Ev, XX },
+  { "cmova",           Gv, Ev, XX },
+  /* 48 */
+  { "cmovs",           Gv, Ev, XX },
+  { "cmovns",          Gv, Ev, XX },
+  { "cmovp",           Gv, Ev, XX },
+  { "cmovnp",          Gv, Ev, XX },
+  { "cmovl",           Gv, Ev, XX },
+  { "cmovge",          Gv, Ev, XX },
+  { "cmovle",          Gv, Ev, XX },
+  { "cmovg",           Gv, Ev, XX },
+  /* 50 */
+  { "movmskpX",                Gd, XS, XX },
+  { PREGRP13 },
+  { PREGRP12 },
+  { PREGRP11 },
+  { "andpX",           XM, EX, XX },
+  { "andnpX",          XM, EX, XX },
+  { "orpX",            XM, EX, XX },
+  { "xorpX",           XM, EX, XX },
+  /* 58 */
+  { PREGRP0 },
+  { PREGRP10 },
+  { PREGRP17 },
+  { PREGRP16 },
+  { PREGRP14 },
+  { PREGRP7 },
+  { PREGRP5 },
+  { PREGRP6 },
+  /* 60 */
+  { "punpcklbw",       MX, EM, XX },
+  { "punpcklwd",       MX, EM, XX },
+  { "punpckldq",       MX, EM, XX },
+  { "packsswb",                MX, EM, XX },
+  { "pcmpgtb",         MX, EM, XX },
+  { "pcmpgtw",         MX, EM, XX },
+  { "pcmpgtd",         MX, EM, XX },
+  { "packuswb",                MX, EM, XX },
+  /* 68 */
+  { "punpckhbw",       MX, EM, XX },
+  { "punpckhwd",       MX, EM, XX },
+  { "punpckhdq",       MX, EM, XX },
+  { "packssdw",                MX, EM, XX },
+  { PREGRP26 },
+  { PREGRP24 },
+  { "movd",            MX, Ed, XX },
+  { PREGRP19 },
+  /* 70 */
+  { PREGRP22 },
+  { GRP10 },
+  { GRP11 },
+  { GRP12 },
+  { "pcmpeqb",         MX, EM, XX },
+  { "pcmpeqw",         MX, EM, XX },
+  { "pcmpeqd",         MX, EM, XX },
+  { "emms",            XX, XX, XX },
+  /* 78 */
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { PREGRP23 },
+  { PREGRP20 },
+  /* 80 */
+  { "joH",             Jv, XX, cond_jump_flag },
+  { "jnoH",            Jv, XX, cond_jump_flag },
+  { "jbH",             Jv, XX, cond_jump_flag },
+  { "jaeH",            Jv, XX, cond_jump_flag },
+  { "jeH",             Jv, XX, cond_jump_flag },
+  { "jneH",            Jv, XX, cond_jump_flag },
+  { "jbeH",            Jv, XX, cond_jump_flag },
+  { "jaH",             Jv, XX, cond_jump_flag },
+  /* 88 */
+  { "jsH",             Jv, XX, cond_jump_flag },
+  { "jnsH",            Jv, XX, cond_jump_flag },
+  { "jpH",             Jv, XX, cond_jump_flag },
+  { "jnpH",            Jv, XX, cond_jump_flag },
+  { "jlH",             Jv, XX, cond_jump_flag },
+  { "jgeH",            Jv, XX, cond_jump_flag },
+  { "jleH",            Jv, XX, cond_jump_flag },
+  { "jgH",             Jv, XX, cond_jump_flag },
+  /* 90 */
+  { "seto",            Eb, XX, XX },
+  { "setno",           Eb, XX, XX },
+  { "setb",            Eb, XX, XX },
+  { "setae",           Eb, XX, XX },
+  { "sete",            Eb, XX, XX },
+  { "setne",           Eb, XX, XX },
+  { "setbe",           Eb, XX, XX },
+  { "seta",            Eb, XX, XX },
+  /* 98 */
+  { "sets",            Eb, XX, XX },
+  { "setns",           Eb, XX, XX },
+  { "setp",            Eb, XX, XX },
+  { "setnp",           Eb, XX, XX },
+  { "setl",            Eb, XX, XX },
+  { "setge",           Eb, XX, XX },
+  { "setle",           Eb, XX, XX },
+  { "setg",            Eb, XX, XX },
+  /* a0 */
+  { "pushT",           fs, XX, XX },
+  { "popT",            fs, XX, XX },
+  { "cpuid",           XX, XX, XX },
+  { "btS",             Ev, Gv, XX },
+  { "shldS",           Ev, Gv, Ib },
+  { "shldS",           Ev, Gv, CL },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  /* a8 */
+  { "pushT",           gs, XX, XX },
+  { "popT",            gs, XX, XX },
+  { "rsm",             XX, XX, XX },
+  { "btsS",            Ev, Gv, XX },
+  { "shrdS",           Ev, Gv, Ib },
+  { "shrdS",           Ev, Gv, CL },
+  { GRP13 },
+  { "imulS",           Gv, Ev, XX },
+  /* b0 */
+  { "cmpxchgB",                Eb, Gb, XX },
+  { "cmpxchgS",                Ev, Gv, XX },
+  { "lssS",            Gv, Mp, XX },
+  { "btrS",            Ev, Gv, XX },
+  { "lfsS",            Gv, Mp, XX },
+  { "lgsS",            Gv, Mp, XX },
+  { "movz{bR|x|bR|x}", Gv, Eb, XX },
+  { "movz{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movzww ! */
+  /* b8 */
+  { "(bad)",           XX, XX, XX },
+  { "ud2b",            XX, XX, XX },
+  { GRP8 },
+  { "btcS",            Ev, Gv, XX },
+  { "bsfS",            Gv, Ev, XX },
+  { "bsrS",            Gv, Ev, XX },
+  { "movs{bR|x|bR|x}", Gv, Eb, XX },
+  { "movs{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movsww ! */
+  /* c0 */
+  { "xaddB",           Eb, Gb, XX },
+  { "xaddS",           Ev, Gv, XX },
+  { PREGRP1 },
+  { "movntiS",         Ev, Gv, XX },
+  { "pinsrw",          MX, Ed, Ib },
+  { "pextrw",          Gd, MS, Ib },
+  { "shufpX",          XM, EX, Ib },
+  { GRP9 },
+  /* c8 */
+  { "bswap",           RMeAX, XX, XX },
+  { "bswap",           RMeCX, XX, XX },
+  { "bswap",           RMeDX, XX, XX },
+  { "bswap",           RMeBX, XX, XX },
+  { "bswap",           RMeSP, XX, XX },
+  { "bswap",           RMeBP, XX, XX },
+  { "bswap",           RMeSI, XX, XX },
+  { "bswap",           RMeDI, XX, XX },
+  /* d0 */
+  { "(bad)",           XX, XX, XX },
+  { "psrlw",           MX, EM, XX },
+  { "psrld",           MX, EM, XX },
+  { "psrlq",           MX, EM, XX },
+  { "paddq",           MX, EM, XX },
+  { "pmullw",          MX, EM, XX },
+  { PREGRP21 },
+  { "pmovmskb",                Gd, MS, XX },
+  /* d8 */
+  { "psubusb",         MX, EM, XX },
+  { "psubusw",         MX, EM, XX },
+  { "pminub",          MX, EM, XX },
+  { "pand",            MX, EM, XX },
+  { "paddusb",         MX, EM, XX },
+  { "paddusw",         MX, EM, XX },
+  { "pmaxub",          MX, EM, XX },
+  { "pandn",           MX, EM, XX },
+  /* e0 */
+  { "pavgb",           MX, EM, XX },
+  { "psraw",           MX, EM, XX },
+  { "psrad",           MX, EM, XX },
+  { "pavgw",           MX, EM, XX },
+  { "pmulhuw",         MX, EM, XX },
+  { "pmulhw",          MX, EM, XX },
+  { PREGRP15 },
+  { PREGRP25 },
+  /* e8 */
+  { "psubsb",          MX, EM, XX },
+  { "psubsw",          MX, EM, XX },
+  { "pminsw",          MX, EM, XX },
+  { "por",             MX, EM, XX },
+  { "paddsb",          MX, EM, XX },
+  { "paddsw",          MX, EM, XX },
+  { "pmaxsw",          MX, EM, XX },
+  { "pxor",            MX, EM, XX },
+  /* f0 */
+  { "(bad)",           XX, XX, XX },
+  { "psllw",           MX, EM, XX },
+  { "pslld",           MX, EM, XX },
+  { "psllq",           MX, EM, XX },
+  { "pmuludq",         MX, EM, XX },
+  { "pmaddwd",         MX, EM, XX },
+  { "psadbw",          MX, EM, XX },
+  { PREGRP18 },
+  /* f8 */
+  { "psubb",           MX, EM, XX },
+  { "psubw",           MX, EM, XX },
+  { "psubd",           MX, EM, XX },
+  { "psubq",           MX, EM, XX },
+  { "paddb",           MX, EM, XX },
+  { "paddw",           MX, EM, XX },
+  { "paddd",           MX, EM, XX },
+  { "(bad)",           XX, XX, XX }
+};
+
+static const unsigned char onebyte_has_modrm[256] = {
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
+  /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
+  /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
+  /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
+  /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
+  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
+  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
+  /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
+  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
+  /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
+  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
+  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
+  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
+  /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
+  /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
+  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
+  /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1  /* f0 */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+};
+
+static const unsigned char twobyte_has_modrm[256] = {
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
+  /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
+  /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
+  /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
+  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
+  /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
+  /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
+  /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
+  /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
+  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
+  /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
+  /* a0 */ 0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1, /* af */
+  /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
+  /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
+  /* d0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
+  /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
+  /* f0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+};
+
+static const unsigned char twobyte_uses_SSE_prefix[256] = {
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
+  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
+  /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
+  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
+  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
+  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
+  /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
+  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
+  /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
+  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
+  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
+  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
+  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
+  /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
+  /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
+  /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
+  /* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0  /* ff */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+};
+
+static char obuf[100];
+static char *obufp;
+static char scratchbuf[100];
+static unsigned char *start_codep;
+static unsigned char *insn_codep;
+static unsigned char *codep;
+static disassemble_info *the_info;
+static int mod;
+static int rm;
+static int reg;
+static unsigned char need_modrm;
+
+/* If we are accessing mod/rm/reg without need_modrm set, then the
+   values are stale.  Hitting this abort likely indicates that you
+   need to update onebyte_has_modrm or twobyte_has_modrm.  */
+#define MODRM_CHECK  if (!need_modrm) abort ()
+
+static const char **names64;
+static const char **names32;
+static const char **names16;
+static const char **names8;
+static const char **names8rex;
+static const char **names_seg;
+static const char **index16;
+
+static const char *intel_names64[] = {
+  "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
+  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
+};
+static const char *intel_names32[] = {
+  "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
+  "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
+};
+static const char *intel_names16[] = {
+  "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
+  "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
+};
+static const char *intel_names8[] = {
+  "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
+};
+static const char *intel_names8rex[] = {
+  "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
+  "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
+};
+static const char *intel_names_seg[] = {
+  "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
+};
+static const char *intel_index16[] = {
+  "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
+};
+
+static const char *att_names64[] = {
+  "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
+  "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
+};
+static const char *att_names32[] = {
+  "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
+  "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
+};
+static const char *att_names16[] = {
+  "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
+  "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
+};
+static const char *att_names8[] = {
+  "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
+};
+static const char *att_names8rex[] = {
+  "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
+  "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
+};
+static const char *att_names_seg[] = {
+  "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
+};
+static const char *att_index16[] = {
+  "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
+};
+
+static const struct dis386 grps[][8] = {
+  /* GRP1b */
+  {
+    { "addA",  Eb, Ib, XX },
+    { "orA",   Eb, Ib, XX },
+    { "adcA",  Eb, Ib, XX },
+    { "sbbA",  Eb, Ib, XX },
+    { "andA",  Eb, Ib, XX },
+    { "subA",  Eb, Ib, XX },
+    { "xorA",  Eb, Ib, XX },
+    { "cmpA",  Eb, Ib, XX }
+  },
+  /* GRP1S */
+  {
+    { "addQ",  Ev, Iv, XX },
+    { "orQ",   Ev, Iv, XX },
+    { "adcQ",  Ev, Iv, XX },
+    { "sbbQ",  Ev, Iv, XX },
+    { "andQ",  Ev, Iv, XX },
+    { "subQ",  Ev, Iv, XX },
+    { "xorQ",  Ev, Iv, XX },
+    { "cmpQ",  Ev, Iv, XX }
+  },
+  /* GRP1Ss */
+  {
+    { "addQ",  Ev, sIb, XX },
+    { "orQ",   Ev, sIb, XX },
+    { "adcQ",  Ev, sIb, XX },
+    { "sbbQ",  Ev, sIb, XX },
+    { "andQ",  Ev, sIb, XX },
+    { "subQ",  Ev, sIb, XX },
+    { "xorQ",  Ev, sIb, XX },
+    { "cmpQ",  Ev, sIb, XX }
+  },
+  /* GRP2b */
+  {
+    { "rolA",  Eb, Ib, XX },
+    { "rorA",  Eb, Ib, XX },
+    { "rclA",  Eb, Ib, XX },
+    { "rcrA",  Eb, Ib, XX },
+    { "shlA",  Eb, Ib, XX },
+    { "shrA",  Eb, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarA",  Eb, Ib, XX },
+  },
+  /* GRP2S */
+  {
+    { "rolQ",  Ev, Ib, XX },
+    { "rorQ",  Ev, Ib, XX },
+    { "rclQ",  Ev, Ib, XX },
+    { "rcrQ",  Ev, Ib, XX },
+    { "shlQ",  Ev, Ib, XX },
+    { "shrQ",  Ev, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarQ",  Ev, Ib, XX },
+  },
+  /* GRP2b_one */
+  {
+    { "rolA",  Eb, XX, XX },
+    { "rorA",  Eb, XX, XX },
+    { "rclA",  Eb, XX, XX },
+    { "rcrA",  Eb, XX, XX },
+    { "shlA",  Eb, XX, XX },
+    { "shrA",  Eb, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarA",  Eb, XX, XX },
+  },
+  /* GRP2S_one */
+  {
+    { "rolQ",  Ev, XX, XX },
+    { "rorQ",  Ev, XX, XX },
+    { "rclQ",  Ev, XX, XX },
+    { "rcrQ",  Ev, XX, XX },
+    { "shlQ",  Ev, XX, XX },
+    { "shrQ",  Ev, XX, XX },
+    { "(bad)", XX, XX, XX},
+    { "sarQ",  Ev, XX, XX },
+  },
+  /* GRP2b_cl */
+  {
+    { "rolA",  Eb, CL, XX },
+    { "rorA",  Eb, CL, XX },
+    { "rclA",  Eb, CL, XX },
+    { "rcrA",  Eb, CL, XX },
+    { "shlA",  Eb, CL, XX },
+    { "shrA",  Eb, CL, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarA",  Eb, CL, XX },
+  },
+  /* GRP2S_cl */
+  {
+    { "rolQ",  Ev, CL, XX },
+    { "rorQ",  Ev, CL, XX },
+    { "rclQ",  Ev, CL, XX },
+    { "rcrQ",  Ev, CL, XX },
+    { "shlQ",  Ev, CL, XX },
+    { "shrQ",  Ev, CL, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarQ",  Ev, CL, XX }
+  },
+  /* GRP3b */
+  {
+    { "testA", Eb, Ib, XX },
+    { "(bad)", Eb, XX, XX },
+    { "notA",  Eb, XX, XX },
+    { "negA",  Eb, XX, XX },
+    { "mulA",  Eb, XX, XX },   /* Don't print the implicit %al register,  */
+    { "imulA", Eb, XX, XX },   /* to distinguish these opcodes from other */
+    { "divA",  Eb, XX, XX },   /* mul/imul opcodes.  Do the same for div  */
+    { "idivA", Eb, XX, XX }    /* and idiv for consistency.               */
+  },
+  /* GRP3S */
+  {
+    { "testQ", Ev, Iv, XX },
+    { "(bad)", XX, XX, XX },
+    { "notQ",  Ev, XX, XX },
+    { "negQ",  Ev, XX, XX },
+    { "mulQ",  Ev, XX, XX },   /* Don't print the implicit register.  */
+    { "imulQ", Ev, XX, XX },
+    { "divQ",  Ev, XX, XX },
+    { "idivQ", Ev, XX, XX },
+  },
+  /* GRP4 */
+  {
+    { "incA",  Eb, XX, XX },
+    { "decA",  Eb, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP5 */
+  {
+    { "incQ",  Ev, XX, XX },
+    { "decQ",  Ev, XX, XX },
+    { "callT", indirEv, XX, XX },
+    { "lcallT",        indirEv, XX, XX },
+    { "jmpT",  indirEv, XX, XX },
+    { "ljmpT", indirEv, XX, XX },
+    { "pushU", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP6 */
+  {
+    { "sldtQ", Ev, XX, XX },
+    { "strQ",  Ev, XX, XX },
+    { "lldt",  Ew, XX, XX },
+    { "ltr",   Ew, XX, XX },
+    { "verr",  Ew, XX, XX },
+    { "verw",  Ew, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX }
+  },
+  /* GRP7 */
+  {
+    { "sgdtQ",  M, XX, XX },
+    { "sidtQ",  M, XX, XX },
+    { "lgdtQ",  M, XX, XX },
+    { "lidtQ",  M, XX, XX },
+    { "smswQ", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "lmsw",  Ew, XX, XX },
+    { "invlpg",        Ew, XX, XX },
+  },
+  /* GRP8 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "btQ",   Ev, Ib, XX },
+    { "btsQ",  Ev, Ib, XX },
+    { "btrQ",  Ev, Ib, XX },
+    { "btcQ",  Ev, Ib, XX },
+  },
+  /* GRP9 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "cmpxchg8b", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP10 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "psrlw", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "psraw", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "psllw", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP11 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "psrld", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "psrad", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "pslld", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP12 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "psrlq", MS, Ib, XX },
+    { "psrldq",        MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "psllq", MS, Ib, XX },
+    { "pslldq",        MS, Ib, XX },
+  },
+  /* GRP13 */
+  {
+    { "fxsave", Ev, XX, XX },
+    { "fxrstor", Ev, XX, XX },
+    { "ldmxcsr", Ev, XX, XX },
+    { "stmxcsr", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "lfence", None, XX, XX },
+    { "mfence", None, XX, XX },
+    { "sfence", None, XX, XX },
+    /* FIXME: the sfence with memory operand is clflush!  */
+  },
+  /* GRP14 */
+  {
+    { "prefetchnta", Ev, XX, XX },
+    { "prefetcht0", Ev, XX, XX },
+    { "prefetcht1", Ev, XX, XX },
+    { "prefetcht2", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRPAMD */
+  {
+    { "prefetch", Eb, XX, XX },
+    { "prefetchw", Eb, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  }
+};
+
+static const struct dis386 prefix_user_table[][4] = {
+  /* PREGRP0 */
+  {
+    { "addps", XM, EX, XX },
+    { "addss", XM, EX, XX },
+    { "addpd", XM, EX, XX },
+    { "addsd", XM, EX, XX },
+  },
+  /* PREGRP1 */
+  {
+    { "", XM, EX, OPSIMD },    /* See OP_SIMD_SUFFIX.  */
+    { "", XM, EX, OPSIMD },
+    { "", XM, EX, OPSIMD },
+    { "", XM, EX, OPSIMD },
+  },
+  /* PREGRP2 */
+  {
+    { "cvtpi2ps", XM, EM, XX },
+    { "cvtsi2ssY", XM, Ev, XX },
+    { "cvtpi2pd", XM, EM, XX },
+    { "cvtsi2sdY", XM, Ev, XX },
+  },
+  /* PREGRP3 */
+  {
+    { "cvtps2pi", MX, EX, XX },
+    { "cvtss2siY", Gv, EX, XX },
+    { "cvtpd2pi", MX, EX, XX },
+    { "cvtsd2siY", Gv, EX, XX },
+  },
+  /* PREGRP4 */
+  {
+    { "cvttps2pi", MX, EX, XX },
+    { "cvttss2siY", Gv, EX, XX },
+    { "cvttpd2pi", MX, EX, XX },
+    { "cvttsd2siY", Gv, EX, XX },
+  },
+  /* PREGRP5 */
+  {
+    { "divps", XM, EX, XX },
+    { "divss", XM, EX, XX },
+    { "divpd", XM, EX, XX },
+    { "divsd", XM, EX, XX },
+  },
+  /* PREGRP6 */
+  {
+    { "maxps", XM, EX, XX },
+    { "maxss", XM, EX, XX },
+    { "maxpd", XM, EX, XX },
+    { "maxsd", XM, EX, XX },
+  },
+  /* PREGRP7 */
+  {
+    { "minps", XM, EX, XX },
+    { "minss", XM, EX, XX },
+    { "minpd", XM, EX, XX },
+    { "minsd", XM, EX, XX },
+  },
+  /* PREGRP8 */
+  {
+    { "movups", XM, EX, XX },
+    { "movss", XM, EX, XX },
+    { "movupd", XM, EX, XX },
+    { "movsd", XM, EX, XX },
+  },
+  /* PREGRP9 */
+  {
+    { "movups", EX, XM, XX },
+    { "movss", EX, XM, XX },
+    { "movupd", EX, XM, XX },
+    { "movsd", EX, XM, XX },
+  },
+  /* PREGRP10 */
+  {
+    { "mulps", XM, EX, XX },
+    { "mulss", XM, EX, XX },
+    { "mulpd", XM, EX, XX },
+    { "mulsd", XM, EX, XX },
+  },
+  /* PREGRP11 */
+  {
+    { "rcpps", XM, EX, XX },
+    { "rcpss", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP12 */
+  {
+    { "rsqrtps", XM, EX, XX },
+    { "rsqrtss", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP13 */
+  {
+    { "sqrtps", XM, EX, XX },
+    { "sqrtss", XM, EX, XX },
+    { "sqrtpd", XM, EX, XX },
+    { "sqrtsd", XM, EX, XX },
+  },
+  /* PREGRP14 */
+  {
+    { "subps", XM, EX, XX },
+    { "subss", XM, EX, XX },
+    { "subpd", XM, EX, XX },
+    { "subsd", XM, EX, XX },
+  },
+  /* PREGRP15 */
+  {
+    { "(bad)", XM, EX, XX },
+    { "cvtdq2pd", XM, EX, XX },
+    { "cvttpd2dq", XM, EX, XX },
+    { "cvtpd2dq", XM, EX, XX },
+  },
+  /* PREGRP16 */
+  {
+    { "cvtdq2ps", XM, EX, XX },
+    { "cvttps2dq",XM, EX, XX },
+    { "cvtps2dq",XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP17 */
+  {
+    { "cvtps2pd", XM, EX, XX },
+    { "cvtss2sd", XM, EX, XX },
+    { "cvtpd2ps", XM, EX, XX },
+    { "cvtsd2ss", XM, EX, XX },
+  },
+  /* PREGRP18 */
+  {
+    { "maskmovq", MX, MS, XX },
+    { "(bad)", XM, EX, XX },
+    { "maskmovdqu", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP19 */
+  {
+    { "movq", MX, EM, XX },
+    { "movdqu", XM, EX, XX },
+    { "movdqa", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP20 */
+  {
+    { "movq", EM, MX, XX },
+    { "movdqu", EX, XM, XX },
+    { "movdqa", EX, XM, XX },
+    { "(bad)", EX, XM, XX },
+  },
+  /* PREGRP21 */
+  {
+    { "(bad)", EX, XM, XX },
+    { "movq2dq", XM, MS, XX },
+    { "movq", EX, XM, XX },
+    { "movdq2q", MX, XS, XX },
+  },
+  /* PREGRP22 */
+  {
+    { "pshufw", MX, EM, Ib },
+    { "pshufhw", XM, EX, Ib },
+    { "pshufd", XM, EX, Ib },
+    { "pshuflw", XM, EX, Ib },
+  },
+  /* PREGRP23 */
+  {
+    { "movd", Ed, MX, XX },
+    { "movq", XM, EX, XX },
+    { "movd", Ed, XM, XX },
+    { "(bad)", Ed, XM, XX },
+  },
+  /* PREGRP24 */
+  {
+    { "(bad)", MX, EX, XX },
+    { "(bad)", XM, EX, XX },
+    { "punpckhqdq", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP25 */
+  {
+  { "movntq", Ev, MX, XX },
+  { "(bad)", Ev, XM, XX },
+  { "movntdq", Ev, XM, XX },
+  { "(bad)", Ev, XM, XX },
+  },
+  /* PREGRP26 */
+  {
+    { "(bad)", MX, EX, XX },
+    { "(bad)", XM, EX, XX },
+    { "punpcklqdq", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+};
+
+static const struct dis386 x86_64_table[][2] = {
+  {
+    { "arpl", Ew, Gw, XX },
+    { "movs{||lq|xd}", Gv, Ed, XX },
+  },
+};
+
+#define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
+
+static void
+ckprefix ()
+{
+  int newrex;
+  rex = 0;
+  prefixes = 0;
+  used_prefixes = 0;
+  rex_used = 0;
+  while (1)
+    {
+      FETCH_DATA (the_info, codep + 1);
+      newrex = 0;
+      switch (*codep)
+       {
+       /* REX prefixes family.  */
+       case 0x40:
+       case 0x41:
+       case 0x42:
+       case 0x43:
+       case 0x44:
+       case 0x45:
+       case 0x46:
+       case 0x47:
+       case 0x48:
+       case 0x49:
+       case 0x4a:
+       case 0x4b:
+       case 0x4c:
+       case 0x4d:
+       case 0x4e:
+       case 0x4f:
+           if (mode_64bit)
+             newrex = *codep;
+           else
+             return;
+         break;
+       case 0xf3:
+         prefixes |= PREFIX_REPZ;
+         break;
+       case 0xf2:
+         prefixes |= PREFIX_REPNZ;
+         break;
+       case 0xf0:
+         prefixes |= PREFIX_LOCK;
+         break;
+       case 0x2e:
+         prefixes |= PREFIX_CS;
+         break;
+       case 0x36:
+         prefixes |= PREFIX_SS;
+         break;
+       case 0x3e:
+         prefixes |= PREFIX_DS;
+         break;
+       case 0x26:
+         prefixes |= PREFIX_ES;
+         break;
+       case 0x64:
+         prefixes |= PREFIX_FS;
+         break;
+       case 0x65:
+         prefixes |= PREFIX_GS;
+         break;
+       case 0x66:
+         prefixes |= PREFIX_DATA;
+         break;
+       case 0x67:
+         prefixes |= PREFIX_ADDR;
+         break;
+       case FWAIT_OPCODE:
+         /* fwait is really an instruction.  If there are prefixes
+            before the fwait, they belong to the fwait, *not* to the
+            following instruction.  */
+         if (prefixes)
+           {
+             prefixes |= PREFIX_FWAIT;
+             codep++;
+             return;
+           }
+         prefixes = PREFIX_FWAIT;
+         break;
+       default:
+         return;
+       }
+      /* Rex is ignored when followed by another prefix.  */
+      if (rex)
+       {
+         oappend (prefix_name (rex, 0));
+         oappend (" ");
+       }
+      rex = newrex;
+      codep++;
+    }
+}
+
+/* Return the name of the prefix byte PREF, or NULL if PREF is not a
+   prefix byte.  */
+
+static const char *
+prefix_name (pref, sizeflag)
+     int pref;
+     int sizeflag;
+{
+  switch (pref)
+    {
+    /* REX prefixes family.  */
+    case 0x40:
+      return "rex";
+    case 0x41:
+      return "rexZ";
+    case 0x42:
+      return "rexY";
+    case 0x43:
+      return "rexYZ";
+    case 0x44:
+      return "rexX";
+    case 0x45:
+      return "rexXZ";
+    case 0x46:
+      return "rexXY";
+    case 0x47:
+      return "rexXYZ";
+    case 0x48:
+      return "rex64";
+    case 0x49:
+      return "rex64Z";
+    case 0x4a:
+      return "rex64Y";
+    case 0x4b:
+      return "rex64YZ";
+    case 0x4c:
+      return "rex64X";
+    case 0x4d:
+      return "rex64XZ";
+    case 0x4e:
+      return "rex64XY";
+    case 0x4f:
+      return "rex64XYZ";
+    case 0xf3:
+      return "repz";
+    case 0xf2:
+      return "repnz";
+    case 0xf0:
+      return "lock";
+    case 0x2e:
+      return "cs";
+    case 0x36:
+      return "ss";
+    case 0x3e:
+      return "ds";
+    case 0x26:
+      return "es";
+    case 0x64:
+      return "fs";
+    case 0x65:
+      return "gs";
+    case 0x66:
+      return (sizeflag & DFLAG) ? "data16" : "data32";
+    case 0x67:
+      if (mode_64bit)
+        return (sizeflag & AFLAG) ? "addr32" : "addr64";
+      else
+        return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32";
+    case FWAIT_OPCODE:
+      return "fwait";
+    default:
+      return NULL;
+    }
+}
+
+static char op1out[100], op2out[100], op3out[100];
+static int op_ad, op_index[3];
+static bfd_vma op_address[3];
+static bfd_vma op_riprel[3];
+static bfd_vma start_pc;
+\f
+/*
+ *   On the 386's of 1988, the maximum length of an instruction is 15 bytes.
+ *   (see topic "Redundant prefixes" in the "Differences from 8086"
+ *   section of the "Virtual 8086 Mode" chapter.)
+ * 'pc' should be the address of this instruction, it will
+ *   be used to print the target address if this is a relative jump or call
+ * The function returns the length of this instruction in bytes.
+ */
+
+static char intel_syntax;
+static char open_char;
+static char close_char;
+static char separator_char;
+static char scale_char;
+
+/* Here for backwards compatibility.  When gdb stops using
+   print_insn_i386_att and print_insn_i386_intel these functions can
+   disappear, and print_insn_i386 be merged into print_insn.  */
+int
+print_insn_i386_att (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  intel_syntax = 0;
+
+  return print_insn (pc, info);
+}
+
+int
+print_insn_i386_intel (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  intel_syntax = 1;
+
+  return print_insn (pc, info);
+}
+
+int
+print_insn_i386 (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  intel_syntax = -1;
+
+  return print_insn (pc, info);
+}
+
+static int
+print_insn (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  const struct dis386 *dp;
+  int i;
+  int two_source_ops;
+  char *first, *second, *third;
+  int needcomma;
+  unsigned char uses_SSE_prefix;
+  int sizeflag;
+  const char *p;
+  struct dis_private priv;
+
+  mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
+               || info->mach == bfd_mach_x86_64);
+
+  if (intel_syntax == -1)
+    intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
+                   || info->mach == bfd_mach_x86_64_intel_syntax);
+
+  if (info->mach == bfd_mach_i386_i386
+      || info->mach == bfd_mach_x86_64
+      || info->mach == bfd_mach_i386_i386_intel_syntax
+      || info->mach == bfd_mach_x86_64_intel_syntax)
+    priv.orig_sizeflag = AFLAG | DFLAG;
+  else if (info->mach == bfd_mach_i386_i8086)
+    priv.orig_sizeflag = 0;
+  else
+    abort ();
+
+  for (p = info->disassembler_options; p != NULL; )
+    {
+      if (strncmp (p, "x86-64", 6) == 0)
+       {
+         mode_64bit = 1;
+         priv.orig_sizeflag = AFLAG | DFLAG;
+       }
+      else if (strncmp (p, "i386", 4) == 0)
+       {
+         mode_64bit = 0;
+         priv.orig_sizeflag = AFLAG | DFLAG;
+       }
+      else if (strncmp (p, "i8086", 5) == 0)
+       {
+         mode_64bit = 0;
+         priv.orig_sizeflag = 0;
+       }
+      else if (strncmp (p, "intel", 5) == 0)
+       {
+         intel_syntax = 1;
+       }
+      else if (strncmp (p, "att", 3) == 0)
+       {
+         intel_syntax = 0;
+       }
+      else if (strncmp (p, "addr", 4) == 0)
+       {
+         if (p[4] == '1' && p[5] == '6')
+           priv.orig_sizeflag &= ~AFLAG;
+         else if (p[4] == '3' && p[5] == '2')
+           priv.orig_sizeflag |= AFLAG;
+       }
+      else if (strncmp (p, "data", 4) == 0)
+       {
+         if (p[4] == '1' && p[5] == '6')
+           priv.orig_sizeflag &= ~DFLAG;
+         else if (p[4] == '3' && p[5] == '2')
+           priv.orig_sizeflag |= DFLAG;
+       }
+      else if (strncmp (p, "suffix", 6) == 0)
+       priv.orig_sizeflag |= SUFFIX_ALWAYS;
+
+      p = strchr (p, ',');
+      if (p != NULL)
+       p++;
+    }
+
+  if (intel_syntax)
+    {
+      names64 = intel_names64;
+      names32 = intel_names32;
+      names16 = intel_names16;
+      names8 = intel_names8;
+      names8rex = intel_names8rex;
+      names_seg = intel_names_seg;
+      index16 = intel_index16;
+      open_char = '[';
+      close_char = ']';
+      separator_char = '+';
+      scale_char = '*';
+    }
+  else
+    {
+      names64 = att_names64;
+      names32 = att_names32;
+      names16 = att_names16;
+      names8 = att_names8;
+      names8rex = att_names8rex;
+      names_seg = att_names_seg;
+      index16 = att_index16;
+      open_char = '(';
+      close_char =  ')';
+      separator_char = ',';
+      scale_char = ',';
+    }
+
+  /* The output looks better if we put 7 bytes on a line, since that
+     puts most long word instructions on a single line.  */
+  info->bytes_per_line = 7;
+
+  info->private_data = (PTR) &priv;
+  priv.max_fetched = priv.the_buffer;
+  priv.insn_start = pc;
+
+  obuf[0] = 0;
+  op1out[0] = 0;
+  op2out[0] = 0;
+  op3out[0] = 0;
+
+  op_index[0] = op_index[1] = op_index[2] = -1;
+
+  the_info = info;
+  start_pc = pc;
+  start_codep = priv.the_buffer;
+  codep = priv.the_buffer;
+
+  if (setjmp (priv.bailout) != 0)
+    {
+      const char *name;
+
+      /* Getting here means we tried for data but didn't get it.  That
+        means we have an incomplete instruction of some sort.  Just
+        print the first byte as a prefix or a .byte pseudo-op.  */
+      if (codep > priv.the_buffer)
+       {
+         name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
+         if (name != NULL)
+           (*info->fprintf_func) (info->stream, "%s", name);
+         else
+           {
+             /* Just print the first byte as a .byte instruction.  */
+             (*info->fprintf_func) (info->stream, ".byte 0x%x",
+                                    (unsigned int) priv.the_buffer[0]);
+           }
+
+         return 1;
+       }
+
+      return -1;
+    }
+
+  obufp = obuf;
+  ckprefix ();
+
+  insn_codep = codep;
+  sizeflag = priv.orig_sizeflag;
+
+  FETCH_DATA (info, codep + 1);
+  two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
+
+  if ((prefixes & PREFIX_FWAIT)
+      && ((*codep < 0xd8) || (*codep > 0xdf)))
+    {
+      const char *name;
+
+      /* fwait not followed by floating point instruction.  Print the
+         first prefix, which is probably fwait itself.  */
+      name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
+      if (name == NULL)
+       name = INTERNAL_DISASSEMBLER_ERROR;
+      (*info->fprintf_func) (info->stream, "%s", name);
+      return 1;
+    }
+
+  if (*codep == 0x0f)
+    {
+      FETCH_DATA (info, codep + 2);
+      dp = &dis386_twobyte[*++codep];
+      need_modrm = twobyte_has_modrm[*codep];
+      uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep];
+    }
+  else
+    {
+      dp = &dis386[*codep];
+      need_modrm = onebyte_has_modrm[*codep];
+      uses_SSE_prefix = 0;
+    }
+  codep++;
+
+  if (!uses_SSE_prefix && (prefixes & PREFIX_REPZ))
+    {
+      oappend ("repz ");
+      used_prefixes |= PREFIX_REPZ;
+    }
+  if (!uses_SSE_prefix && (prefixes & PREFIX_REPNZ))
+    {
+      oappend ("repnz ");
+      used_prefixes |= PREFIX_REPNZ;
+    }
+  if (prefixes & PREFIX_LOCK)
+    {
+      oappend ("lock ");
+      used_prefixes |= PREFIX_LOCK;
+    }
+
+  if (prefixes & PREFIX_ADDR)
+    {
+      sizeflag ^= AFLAG;
+      if (dp->bytemode3 != loop_jcxz_mode || intel_syntax)
+       {
+         if ((sizeflag & AFLAG) || mode_64bit)
+           oappend ("addr32 ");
+         else
+           oappend ("addr16 ");
+         used_prefixes |= PREFIX_ADDR;
+       }
+    }
+
+  if (!uses_SSE_prefix && (prefixes & PREFIX_DATA))
+    {
+      sizeflag ^= DFLAG;
+      if (dp->bytemode3 == cond_jump_mode
+         && dp->bytemode1 == v_mode
+         && !intel_syntax)
+       {
+         if (sizeflag & DFLAG)
+           oappend ("data32 ");
+         else
+           oappend ("data16 ");
+         used_prefixes |= PREFIX_DATA;
+       }
+    }
+
+  if (need_modrm)
+    {
+      FETCH_DATA (info, codep + 1);
+      mod = (*codep >> 6) & 3;
+      reg = (*codep >> 3) & 7;
+      rm = *codep & 7;
+    }
+
+  if (dp->name == NULL && dp->bytemode1 == FLOATCODE)
+    {
+      dofloat (sizeflag);
+    }
+  else
+    {
+      int index;
+      if (dp->name == NULL)
+       {
+         switch (dp->bytemode1)
+           {
+           case USE_GROUPS:
+             dp = &grps[dp->bytemode2][reg];
+             break;
+
+           case USE_PREFIX_USER_TABLE:
+             index = 0;
+             used_prefixes |= (prefixes & PREFIX_REPZ);
+             if (prefixes & PREFIX_REPZ)
+               index = 1;
+             else
+               {
+                 used_prefixes |= (prefixes & PREFIX_DATA);
+                 if (prefixes & PREFIX_DATA)
+                   index = 2;
+                 else
+                   {
+                     used_prefixes |= (prefixes & PREFIX_REPNZ);
+                     if (prefixes & PREFIX_REPNZ)
+                       index = 3;
+                   }
+               }
+             dp = &prefix_user_table[dp->bytemode2][index];
+             break;
+
+           case X86_64_SPECIAL:
+             dp = &x86_64_table[dp->bytemode2][mode_64bit];
+             break;
+
+           default:
+             oappend (INTERNAL_DISASSEMBLER_ERROR);
+             break;
+           }
+       }
+
+      if (putop (dp->name, sizeflag) == 0)
+       {
+         obufp = op1out;
+         op_ad = 2;
+         if (dp->op1)
+           (*dp->op1) (dp->bytemode1, sizeflag);
+
+         obufp = op2out;
+         op_ad = 1;
+         if (dp->op2)
+           (*dp->op2) (dp->bytemode2, sizeflag);
+
+         obufp = op3out;
+         op_ad = 0;
+         if (dp->op3)
+           (*dp->op3) (dp->bytemode3, sizeflag);
+       }
+    }
+
+  /* See if any prefixes were not used.  If so, print the first one
+     separately.  If we don't do this, we'll wind up printing an
+     instruction stream which does not precisely correspond to the
+     bytes we are disassembling.  */
+  if ((prefixes & ~used_prefixes) != 0)
+    {
+      const char *name;
+
+      name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
+      if (name == NULL)
+       name = INTERNAL_DISASSEMBLER_ERROR;
+      (*info->fprintf_func) (info->stream, "%s", name);
+      return 1;
+    }
+  if (rex & ~rex_used)
+    {
+      const char *name;
+      name = prefix_name (rex | 0x40, priv.orig_sizeflag);
+      if (name == NULL)
+       name = INTERNAL_DISASSEMBLER_ERROR;
+      (*info->fprintf_func) (info->stream, "%s ", name);
+    }
+
+  obufp = obuf + strlen (obuf);
+  for (i = strlen (obuf); i < 6; i++)
+    oappend (" ");
+  oappend (" ");
+  (*info->fprintf_func) (info->stream, "%s", obuf);
+
+  /* The enter and bound instructions are printed with operands in the same
+     order as the intel book; everything else is printed in reverse order.  */
+  if (intel_syntax || two_source_ops)
+    {
+      first = op1out;
+      second = op2out;
+      third = op3out;
+      op_ad = op_index[0];
+      op_index[0] = op_index[2];
+      op_index[2] = op_ad;
+    }
+  else
+    {
+      first = op3out;
+      second = op2out;
+      third = op1out;
+    }
+  needcomma = 0;
+  if (*first)
+    {
+      if (op_index[0] != -1 && !op_riprel[0])
+       (*info->print_address_func) ((bfd_vma) op_address[op_index[0]], info);
+      else
+       (*info->fprintf_func) (info->stream, "%s", first);
+      needcomma = 1;
+    }
+  if (*second)
+    {
+      if (needcomma)
+       (*info->fprintf_func) (info->stream, ",");
+      if (op_index[1] != -1 && !op_riprel[1])
+       (*info->print_address_func) ((bfd_vma) op_address[op_index[1]], info);
+      else
+       (*info->fprintf_func) (info->stream, "%s", second);
+      needcomma = 1;
+    }
+  if (*third)
+    {
+      if (needcomma)
+       (*info->fprintf_func) (info->stream, ",");
+      if (op_index[2] != -1 && !op_riprel[2])
+       (*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info);
+      else
+       (*info->fprintf_func) (info->stream, "%s", third);
+    }
+  for (i = 0; i < 3; i++)
+    if (op_index[i] != -1 && op_riprel[i])
+      {
+       (*info->fprintf_func) (info->stream, "        # ");
+       (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
+                                               + op_address[op_index[i]]), info);
+      }
+  return codep - priv.the_buffer;
+}
+
+static const char *float_mem[] = {
+  /* d8 */
+  "fadd{s||s|}",
+  "fmul{s||s|}",
+  "fcom{s||s|}",
+  "fcomp{s||s|}",
+  "fsub{s||s|}",
+  "fsubr{s||s|}",
+  "fdiv{s||s|}",
+  "fdivr{s||s|}",
+  /*  d9 */
+  "fld{s||s|}",
+  "(bad)",
+  "fst{s||s|}",
+  "fstp{s||s|}",
+  "fldenv",
+  "fldcw",
+  "fNstenv",
+  "fNstcw",
+  /* da */
+  "fiadd{l||l|}",
+  "fimul{l||l|}",
+  "ficom{l||l|}",
+  "ficomp{l||l|}",
+  "fisub{l||l|}",
+  "fisubr{l||l|}",
+  "fidiv{l||l|}",
+  "fidivr{l||l|}",
+  /* db */
+  "fild{l||l|}",
+  "(bad)",
+  "fist{l||l|}",
+  "fistp{l||l|}",
+  "(bad)",
+  "fld{t||t|}",
+  "(bad)",
+  "fstp{t||t|}",
+  /* dc */
+  "fadd{l||l|}",
+  "fmul{l||l|}",
+  "fcom{l||l|}",
+  "fcomp{l||l|}",
+  "fsub{l||l|}",
+  "fsubr{l||l|}",
+  "fdiv{l||l|}",
+  "fdivr{l||l|}",
+  /* dd */
+  "fld{l||l|}",
+  "(bad)",
+  "fst{l||l|}",
+  "fstp{l||l|}",
+  "frstor",
+  "(bad)",
+  "fNsave",
+  "fNstsw",
+  /* de */
+  "fiadd",
+  "fimul",
+  "ficom",
+  "ficomp",
+  "fisub",
+  "fisubr",
+  "fidiv",
+  "fidivr",
+  /* df */
+  "fild",
+  "(bad)",
+  "fist",
+  "fistp",
+  "fbld",
+  "fild{ll||ll|}",
+  "fbstp",
+  "fistpll",
+};
+
+#define ST OP_ST, 0
+#define STi OP_STi, 0
+
+#define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0
+#define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0
+#define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0
+#define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0
+#define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0
+#define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0
+#define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0
+#define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0
+#define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0
+
+static const struct dis386 float_reg[][8] = {
+  /* d8 */
+  {
+    { "fadd",  ST, STi, XX },
+    { "fmul",  ST, STi, XX },
+    { "fcom",  STi, XX, XX },
+    { "fcomp", STi, XX, XX },
+    { "fsub",  ST, STi, XX },
+    { "fsubr", ST, STi, XX },
+    { "fdiv",  ST, STi, XX },
+    { "fdivr", ST, STi, XX },
+  },
+  /* d9 */
+  {
+    { "fld",   STi, XX, XX },
+    { "fxch",  STi, XX, XX },
+    { FGRPd9_2 },
+    { "(bad)", XX, XX, XX },
+    { FGRPd9_4 },
+    { FGRPd9_5 },
+    { FGRPd9_6 },
+    { FGRPd9_7 },
+  },
+  /* da */
+  {
+    { "fcmovb",        ST, STi, XX },
+    { "fcmove",        ST, STi, XX },
+    { "fcmovbe",ST, STi, XX },
+    { "fcmovu",        ST, STi, XX },
+    { "(bad)", XX, XX, XX },
+    { FGRPda_5 },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* db */
+  {
+    { "fcmovnb",ST, STi, XX },
+    { "fcmovne",ST, STi, XX },
+    { "fcmovnbe",ST, STi, XX },
+    { "fcmovnu",ST, STi, XX },
+    { FGRPdb_4 },
+    { "fucomi",        ST, STi, XX },
+    { "fcomi", ST, STi, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* dc */
+  {
+    { "fadd",  STi, ST, XX },
+    { "fmul",  STi, ST, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+#if UNIXWARE_COMPAT
+    { "fsub",  STi, ST, XX },
+    { "fsubr", STi, ST, XX },
+    { "fdiv",  STi, ST, XX },
+    { "fdivr", STi, ST, XX },
+#else
+    { "fsubr", STi, ST, XX },
+    { "fsub",  STi, ST, XX },
+    { "fdivr", STi, ST, XX },
+    { "fdiv",  STi, ST, XX },
+#endif
+  },
+  /* dd */
+  {
+    { "ffree", STi, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "fst",   STi, XX, XX },
+    { "fstp",  STi, XX, XX },
+    { "fucom", STi, XX, XX },
+    { "fucomp",        STi, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* de */
+  {
+    { "faddp", STi, ST, XX },
+    { "fmulp", STi, ST, XX },
+    { "(bad)", XX, XX, XX },
+    { FGRPde_3 },
+#if UNIXWARE_COMPAT
+    { "fsubp", STi, ST, XX },
+    { "fsubrp",        STi, ST, XX },
+    { "fdivp", STi, ST, XX },
+    { "fdivrp",        STi, ST, XX },
+#else
+    { "fsubrp",        STi, ST, XX },
+    { "fsubp", STi, ST, XX },
+    { "fdivrp",        STi, ST, XX },
+    { "fdivp", STi, ST, XX },
+#endif
+  },
+  /* df */
+  {
+    { "ffreep",        STi, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { FGRPdf_4 },
+    { "fucomip",ST, STi, XX },
+    { "fcomip", ST, STi, XX },
+    { "(bad)", XX, XX, XX },
+  },
+};
+
+static char *fgrps[][8] = {
+  /* d9_2  0 */
+  {
+    "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
+  },
+
+  /* d9_4  1 */
+  {
+    "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
+  },
+
+  /* d9_5  2 */
+  {
+    "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
+  },
+
+  /* d9_6  3 */
+  {
+    "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
+  },
+
+  /* d9_7  4 */
+  {
+    "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
+  },
+
+  /* da_5  5 */
+  {
+    "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
+  },
+
+  /* db_4  6 */
+  {
+    "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
+    "fNsetpm(287 only)","(bad)","(bad)","(bad)",
+  },
+
+  /* de_3  7 */
+  {
+    "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
+  },
+
+  /* df_4  8 */
+  {
+    "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
+  },
+};
+
+static void
+dofloat (sizeflag)
+     int sizeflag;
+{
+  const struct dis386 *dp;
+  unsigned char floatop;
+
+  floatop = codep[-1];
+
+  if (mod != 3)
+    {
+      putop (float_mem[(floatop - 0xd8) * 8 + reg], sizeflag);
+      obufp = op1out;
+      if (floatop == 0xdb)
+        OP_E (x_mode, sizeflag);
+      else if (floatop == 0xdd)
+        OP_E (d_mode, sizeflag);
+      else
+        OP_E (v_mode, sizeflag);
+      return;
+    }
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+
+  dp = &float_reg[floatop - 0xd8][reg];
+  if (dp->name == NULL)
+    {
+      putop (fgrps[dp->bytemode1][rm], sizeflag);
+
+      /* Instruction fnstsw is only one with strange arg.  */
+      if (floatop == 0xdf && codep[-1] == 0xe0)
+       strcpy (op1out, names16[0]);
+    }
+  else
+    {
+      putop (dp->name, sizeflag);
+
+      obufp = op1out;
+      if (dp->op1)
+       (*dp->op1) (dp->bytemode1, sizeflag);
+      obufp = op2out;
+      if (dp->op2)
+       (*dp->op2) (dp->bytemode2, sizeflag);
+    }
+}
+
+static void
+OP_ST (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  oappend ("%st");
+}
+
+static void
+OP_STi (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  sprintf (scratchbuf, "%%st(%d)", rm);
+  oappend (scratchbuf + intel_syntax);
+}
+
+/* Capital letters in template are macros.  */
+static int
+putop (template, sizeflag)
+     const char *template;
+     int sizeflag;
+{
+  const char *p;
+  int alt;
+
+  for (p = template; *p; p++)
+    {
+      switch (*p)
+       {
+       default:
+         *obufp++ = *p;
+         break;
+       case '{':
+         alt = 0;
+         if (intel_syntax)
+           alt += 1;
+         if (mode_64bit)
+           alt += 2;
+         while (alt != 0)
+           {
+             while (*++p != '|')
+               {
+                 if (*p == '}')
+                   {
+                     /* Alternative not valid.  */
+                     strcpy (obuf, "(bad)");
+                     obufp = obuf + 5;
+                     return 1;
+                   }
+                 else if (*p == '\0')
+                   abort ();
+               }
+             alt--;
+           }
+         break;
+       case '|':
+         while (*++p != '}')
+           {
+             if (*p == '\0')
+               abort ();
+           }
+         break;
+       case '}':
+         break;
+       case 'A':
+          if (intel_syntax)
+            break;
+         if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
+           *obufp++ = 'b';
+         break;
+       case 'B':
+          if (intel_syntax)
+            break;
+         if (sizeflag & SUFFIX_ALWAYS)
+           *obufp++ = 'b';
+         break;
+       case 'E':               /* For jcxz/jecxz */
+         if (mode_64bit)
+           {
+             if (sizeflag & AFLAG)
+               *obufp++ = 'r';
+             else
+               *obufp++ = 'e';
+           }
+         else
+           if (sizeflag & AFLAG)
+             *obufp++ = 'e';
+         used_prefixes |= (prefixes & PREFIX_ADDR);
+         break;
+       case 'F':
+          if (intel_syntax)
+            break;
+         if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
+           {
+             if (sizeflag & AFLAG)
+               *obufp++ = mode_64bit ? 'q' : 'l';
+             else
+               *obufp++ = mode_64bit ? 'l' : 'w';
+             used_prefixes |= (prefixes & PREFIX_ADDR);
+           }
+         break;
+       case 'H':
+          if (intel_syntax)
+            break;
+         if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
+             || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
+           {
+             used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS);
+             *obufp++ = ',';
+             *obufp++ = 'p';
+             if (prefixes & PREFIX_DS)
+               *obufp++ = 't';
+             else
+               *obufp++ = 'n';
+           }
+         break;
+       case 'L':
+          if (intel_syntax)
+            break;
+         if (sizeflag & SUFFIX_ALWAYS)
+           *obufp++ = 'l';
+         break;
+       case 'N':
+         if ((prefixes & PREFIX_FWAIT) == 0)
+           *obufp++ = 'n';
+         else
+           used_prefixes |= PREFIX_FWAIT;
+         break;
+       case 'O':
+         USED_REX (REX_MODE64);
+         if (rex & REX_MODE64)
+           *obufp++ = 'o';
+         else
+           *obufp++ = 'd';
+         break;
+       case 'T':
+          if (intel_syntax)
+            break;
+         if (mode_64bit)
+           {
+             *obufp++ = 'q';
+             break;
+           }
+         /* Fall through.  */
+       case 'P':
+          if (intel_syntax)
+            break;
+         if ((prefixes & PREFIX_DATA)
+             || (rex & REX_MODE64)
+             || (sizeflag & SUFFIX_ALWAYS))
+           {
+             USED_REX (REX_MODE64);
+             if (rex & REX_MODE64)
+               *obufp++ = 'q';
+             else
+               {
+                  if (sizeflag & DFLAG)
+                     *obufp++ = 'l';
+                  else
+                    *obufp++ = 'w';
+                  used_prefixes |= (prefixes & PREFIX_DATA);
+               }
+           }
+         break;
+       case 'U':
+          if (intel_syntax)
+            break;
+         if (mode_64bit)
+           {
+             *obufp++ = 'q';
+             break;
+           }
+         /* Fall through.  */
+       case 'Q':
+          if (intel_syntax)
+            break;
+         USED_REX (REX_MODE64);
+         if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
+           {
+             if (rex & REX_MODE64)
+               *obufp++ = 'q';
+             else
+               {
+                 if (sizeflag & DFLAG)
+                   *obufp++ = 'l';
+                 else
+                   *obufp++ = 'w';
+                 used_prefixes |= (prefixes & PREFIX_DATA);
+               }
+           }
+         break;
+       case 'R':
+         USED_REX (REX_MODE64);
+          if (intel_syntax)
+           {
+             if (rex & REX_MODE64)
+               {
+                 *obufp++ = 'q';
+                 *obufp++ = 't';
+               }
+             else if (sizeflag & DFLAG)
+               {
+                 *obufp++ = 'd';
+                 *obufp++ = 'q';
+               }
+             else
+               {
+                 *obufp++ = 'w';
+                 *obufp++ = 'd';
+               }
+           }
+         else
+           {
+             if (rex & REX_MODE64)
+               *obufp++ = 'q';
+             else if (sizeflag & DFLAG)
+               *obufp++ = 'l';
+             else
+               *obufp++ = 'w';
+           }
+         if (!(rex & REX_MODE64))
+           used_prefixes |= (prefixes & PREFIX_DATA);
+         break;
+       case 'S':
+          if (intel_syntax)
+            break;
+         if (sizeflag & SUFFIX_ALWAYS)
+           {
+             if (rex & REX_MODE64)
+               *obufp++ = 'q';
+             else
+               {
+                 if (sizeflag & DFLAG)
+                   *obufp++ = 'l';
+                 else
+                   *obufp++ = 'w';
+                 used_prefixes |= (prefixes & PREFIX_DATA);
+               }
+           }
+         break;
+       case 'X':
+         if (prefixes & PREFIX_DATA)
+           *obufp++ = 'd';
+         else
+           *obufp++ = 's';
+          used_prefixes |= (prefixes & PREFIX_DATA);
+         break;
+       case 'Y':
+          if (intel_syntax)
+            break;
+         if (rex & REX_MODE64)
+           {
+             USED_REX (REX_MODE64);
+             *obufp++ = 'q';
+           }
+         break;
+         /* implicit operand size 'l' for i386 or 'q' for x86-64 */
+       case 'W':
+         /* operand size flag for cwtl, cbtw */
+         USED_REX (0);
+         if (rex)
+           *obufp++ = 'l';
+         else if (sizeflag & DFLAG)
+           *obufp++ = 'w';
+         else
+           *obufp++ = 'b';
+          if (intel_syntax)
+           {
+             if (rex)
+               {
+                 *obufp++ = 'q';
+                 *obufp++ = 'e';
+               }
+             if (sizeflag & DFLAG)
+               {
+                 *obufp++ = 'd';
+                 *obufp++ = 'e';
+               }
+             else
+               {
+                 *obufp++ = 'w';
+               }
+           }
+         if (!rex)
+           used_prefixes |= (prefixes & PREFIX_DATA);
+         break;
+       }
+    }
+  *obufp = 0;
+  return 0;
+}
+
+static void
+oappend (s)
+     const char *s;
+{
+  strcpy (obufp, s);
+  obufp += strlen (s);
+}
+
+static void
+append_seg ()
+{
+  if (prefixes & PREFIX_CS)
+    {
+      used_prefixes |= PREFIX_CS;
+      oappend ("%cs:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_DS)
+    {
+      used_prefixes |= PREFIX_DS;
+      oappend ("%ds:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_SS)
+    {
+      used_prefixes |= PREFIX_SS;
+      oappend ("%ss:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_ES)
+    {
+      used_prefixes |= PREFIX_ES;
+      oappend ("%es:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_FS)
+    {
+      used_prefixes |= PREFIX_FS;
+      oappend ("%fs:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_GS)
+    {
+      used_prefixes |= PREFIX_GS;
+      oappend ("%gs:" + intel_syntax);
+    }
+}
+
+static void
+OP_indirE (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (!intel_syntax)
+    oappend ("*");
+  OP_E (bytemode, sizeflag);
+}
+
+static void
+print_operand_value (buf, hex, disp)
+  char *buf;
+  int hex;
+  bfd_vma disp;
+{
+  if (mode_64bit)
+    {
+      if (hex)
+       {
+         char tmp[30];
+         int i;
+         buf[0] = '0';
+         buf[1] = 'x';
+         sprintf_vma (tmp, disp);
+         for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
+         strcpy (buf + 2, tmp + i);
+       }
+      else
+       {
+         bfd_signed_vma v = disp;
+         char tmp[30];
+         int i;
+         if (v < 0)
+           {
+             *(buf++) = '-';
+             v = -disp;
+             /* Check for possible overflow on 0x8000000000000000.  */
+             if (v < 0)
+               {
+                 strcpy (buf, "9223372036854775808");
+                 return;
+               }
+           }
+         if (!v)
+           {
+             strcpy (buf, "0");
+             return;
+           }
+
+         i = 0;
+         tmp[29] = 0;
+         while (v)
+           {
+             tmp[28 - i] = (v % 10) + '0';
+             v /= 10;
+             i++;
+           }
+         strcpy (buf, tmp + 29 - i);
+       }
+    }
+  else
+    {
+      if (hex)
+       sprintf (buf, "0x%x", (unsigned int) disp);
+      else
+       sprintf (buf, "%d", (int) disp);
+    }
+}
+
+static void
+OP_E (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_vma disp;
+  int add = 0;
+  int riprel = 0;
+  USED_REX (REX_EXTZ);
+  if (rex & REX_EXTZ)
+    add += 8;
+
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+
+  if (mod == 3)
+    {
+      switch (bytemode)
+       {
+       case b_mode:
+         USED_REX (0);
+         if (rex)
+           oappend (names8rex[rm + add]);
+         else
+           oappend (names8[rm + add]);
+         break;
+       case w_mode:
+         oappend (names16[rm + add]);
+         break;
+       case d_mode:
+         oappend (names32[rm + add]);
+         break;
+       case q_mode:
+         oappend (names64[rm + add]);
+         break;
+       case m_mode:
+         if (mode_64bit)
+           oappend (names64[rm + add]);
+         else
+           oappend (names32[rm + add]);
+         break;
+       case v_mode:
+         USED_REX (REX_MODE64);
+         if (rex & REX_MODE64)
+           oappend (names64[rm + add]);
+         else if (sizeflag & DFLAG)
+           oappend (names32[rm + add]);
+         else
+           oappend (names16[rm + add]);
+         used_prefixes |= (prefixes & PREFIX_DATA);
+         break;
+       case 0:
+         if (!(codep[-2] == 0xAE && codep[-1] == 0xF8 /* sfence */)
+             && !(codep[-2] == 0xAE && codep[-1] == 0xF0 /* mfence */)
+             && !(codep[-2] == 0xAE && codep[-1] == 0xe8 /* lfence */))
+           BadOp ();   /* bad sfence,lea,lds,les,lfs,lgs,lss modrm */
+         break;
+       default:
+         oappend (INTERNAL_DISASSEMBLER_ERROR);
+         break;
+       }
+      return;
+    }
+
+  disp = 0;
+  append_seg ();
+
+  if ((sizeflag & AFLAG) || mode_64bit) /* 32 bit address mode */
+    {
+      int havesib;
+      int havebase;
+      int base;
+      int index = 0;
+      int scale = 0;
+
+      havesib = 0;
+      havebase = 1;
+      base = rm;
+
+      if (base == 4)
+       {
+         havesib = 1;
+         FETCH_DATA (the_info, codep + 1);
+         scale = (*codep >> 6) & 3;
+         index = (*codep >> 3) & 7;
+         base = *codep & 7;
+         USED_REX (REX_EXTY);
+         USED_REX (REX_EXTZ);
+         if (rex & REX_EXTY)
+           index += 8;
+         if (rex & REX_EXTZ)
+           base += 8;
+         codep++;
+       }
+
+      switch (mod)
+       {
+       case 0:
+         if ((base & 7) == 5)
+           {
+             havebase = 0;
+             if (mode_64bit && !havesib && (sizeflag & AFLAG))
+               riprel = 1;
+             disp = get32s ();
+           }
+         break;
+       case 1:
+         FETCH_DATA (the_info, codep + 1);
+         disp = *codep++;
+         if ((disp & 0x80) != 0)
+           disp -= 0x100;
+         break;
+       case 2:
+         disp = get32s ();
+         break;
+       }
+
+      if (!intel_syntax)
+        if (mod != 0 || (base & 7) == 5)
+          {
+           print_operand_value (scratchbuf, !riprel, disp);
+            oappend (scratchbuf);
+           if (riprel)
+             {
+               set_op (disp, 1);
+               oappend ("(%rip)");
+             }
+          }
+
+      if (havebase || (havesib && (index != 4 || scale != 0)))
+       {
+          if (intel_syntax)
+            {
+              switch (bytemode)
+                {
+                case b_mode:
+                  oappend ("BYTE PTR ");
+                  break;
+                case w_mode:
+                  oappend ("WORD PTR ");
+                  break;
+                case v_mode:
+                  oappend ("DWORD PTR ");
+                  break;
+                case d_mode:
+                  oappend ("QWORD PTR ");
+                  break;
+                case m_mode:
+                 if (mode_64bit)
+                   oappend ("DWORD PTR ");
+                 else
+                   oappend ("QWORD PTR ");
+                 break;
+                case x_mode:
+                  oappend ("XWORD PTR ");
+                  break;
+                default:
+                  break;
+                }
+             }
+         *obufp++ = open_char;
+         if (intel_syntax && riprel)
+           oappend ("rip + ");
+          *obufp = '\0';
+         USED_REX (REX_EXTZ);
+         if (!havesib && (rex & REX_EXTZ))
+           base += 8;
+         if (havebase)
+           oappend (mode_64bit && (sizeflag & AFLAG)
+                    ? names64[base] : names32[base]);
+         if (havesib)
+           {
+             if (index != 4)
+               {
+                  if (intel_syntax)
+                    {
+                      if (havebase)
+                        {
+                          *obufp++ = separator_char;
+                          *obufp = '\0';
+                        }
+                      sprintf (scratchbuf, "%s",
+                              mode_64bit && (sizeflag & AFLAG)
+                              ? names64[index] : names32[index]);
+                    }
+                  else
+                   sprintf (scratchbuf, ",%s",
+                            mode_64bit && (sizeflag & AFLAG)
+                            ? names64[index] : names32[index]);
+                 oappend (scratchbuf);
+               }
+              if (!intel_syntax
+                  || (intel_syntax
+                      && bytemode != b_mode
+                      && bytemode != w_mode
+                      && bytemode != v_mode))
+                {
+                  *obufp++ = scale_char;
+                  *obufp = '\0';
+                 sprintf (scratchbuf, "%d", 1 << scale);
+                 oappend (scratchbuf);
+                }
+           }
+          if (intel_syntax)
+            if (mod != 0 || (base & 7) == 5)
+              {
+               /* Don't print zero displacements.  */
+                if (disp != 0)
+                  {
+                   if ((bfd_signed_vma) disp > 0)
+                     {
+                       *obufp++ = '+';
+                       *obufp = '\0';
+                     }
+
+                   print_operand_value (scratchbuf, 0, disp);
+                    oappend (scratchbuf);
+                  }
+              }
+
+         *obufp++ = close_char;
+          *obufp = '\0';
+       }
+      else if (intel_syntax)
+        {
+          if (mod != 0 || (base & 7) == 5)
+            {
+             if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
+                             | PREFIX_ES | PREFIX_FS | PREFIX_GS))
+               ;
+             else
+               {
+                 oappend (names_seg[ds_reg - es_reg]);
+                 oappend (":");
+               }
+             print_operand_value (scratchbuf, 1, disp);
+              oappend (scratchbuf);
+            }
+        }
+    }
+  else
+    { /* 16 bit address mode */
+      switch (mod)
+       {
+       case 0:
+         if ((rm & 7) == 6)
+           {
+             disp = get16 ();
+             if ((disp & 0x8000) != 0)
+               disp -= 0x10000;
+           }
+         break;
+       case 1:
+         FETCH_DATA (the_info, codep + 1);
+         disp = *codep++;
+         if ((disp & 0x80) != 0)
+           disp -= 0x100;
+         break;
+       case 2:
+         disp = get16 ();
+         if ((disp & 0x8000) != 0)
+           disp -= 0x10000;
+         break;
+       }
+
+      if (!intel_syntax)
+        if (mod != 0 || (rm & 7) == 6)
+          {
+           print_operand_value (scratchbuf, 0, disp);
+            oappend (scratchbuf);
+          }
+
+      if (mod != 0 || (rm & 7) != 6)
+       {
+         *obufp++ = open_char;
+          *obufp = '\0';
+         oappend (index16[rm + add]);
+          *obufp++ = close_char;
+          *obufp = '\0';
+       }
+    }
+}
+
+static void
+OP_G (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add += 8;
+  switch (bytemode)
+    {
+    case b_mode:
+      USED_REX (0);
+      if (rex)
+       oappend (names8rex[reg + add]);
+      else
+       oappend (names8[reg + add]);
+      break;
+    case w_mode:
+      oappend (names16[reg + add]);
+      break;
+    case d_mode:
+      oappend (names32[reg + add]);
+      break;
+    case q_mode:
+      oappend (names64[reg + add]);
+      break;
+    case v_mode:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       oappend (names64[reg + add]);
+      else if (sizeflag & DFLAG)
+       oappend (names32[reg + add]);
+      else
+       oappend (names16[reg + add]);
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      break;
+    }
+}
+
+static bfd_vma
+get64 ()
+{
+  bfd_vma x;
+#ifdef BFD64
+  unsigned int a;
+  unsigned int b;
+
+  FETCH_DATA (the_info, codep + 8);
+  a = *codep++ & 0xff;
+  a |= (*codep++ & 0xff) << 8;
+  a |= (*codep++ & 0xff) << 16;
+  a |= (*codep++ & 0xff) << 24;
+  b = *codep++ & 0xff;
+  b |= (*codep++ & 0xff) << 8;
+  b |= (*codep++ & 0xff) << 16;
+  b |= (*codep++ & 0xff) << 24;
+  x = a + ((bfd_vma) b << 32);
+#else
+  abort ();
+  x = 0;
+#endif
+  return x;
+}
+
+static bfd_signed_vma
+get32 ()
+{
+  bfd_signed_vma x = 0;
+
+  FETCH_DATA (the_info, codep + 4);
+  x = *codep++ & (bfd_signed_vma) 0xff;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
+  return x;
+}
+
+static bfd_signed_vma
+get32s ()
+{
+  bfd_signed_vma x = 0;
+
+  FETCH_DATA (the_info, codep + 4);
+  x = *codep++ & (bfd_signed_vma) 0xff;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
+
+  x = (x ^ ((bfd_signed_vma) 1 << 31)) - ((bfd_signed_vma) 1 << 31);
+
+  return x;
+}
+
+static int
+get16 ()
+{
+  int x = 0;
+
+  FETCH_DATA (the_info, codep + 2);
+  x = *codep++ & 0xff;
+  x |= (*codep++ & 0xff) << 8;
+  return x;
+}
+
+static void
+set_op (op, riprel)
+     bfd_vma op;
+     int riprel;
+{
+  op_index[op_ad] = op_ad;
+  if (mode_64bit)
+    {
+      op_address[op_ad] = op;
+      op_riprel[op_ad] = riprel;
+    }
+  else
+    {
+      /* Mask to get a 32-bit address.  */
+      op_address[op_ad] = op & 0xffffffff;
+      op_riprel[op_ad] = riprel & 0xffffffff;
+    }
+}
+
+static void
+OP_REG (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  const char *s;
+  int add = 0;
+  USED_REX (REX_EXTZ);
+  if (rex & REX_EXTZ)
+    add = 8;
+
+  switch (code)
+    {
+    case indir_dx_reg:
+      if (intel_syntax)
+        s = "[dx]";
+      else
+        s = "(%dx)";
+      break;
+    case ax_reg: case cx_reg: case dx_reg: case bx_reg:
+    case sp_reg: case bp_reg: case si_reg: case di_reg:
+      s = names16[code - ax_reg + add];
+      break;
+    case es_reg: case ss_reg: case cs_reg:
+    case ds_reg: case fs_reg: case gs_reg:
+      s = names_seg[code - es_reg + add];
+      break;
+    case al_reg: case ah_reg: case cl_reg: case ch_reg:
+    case dl_reg: case dh_reg: case bl_reg: case bh_reg:
+      USED_REX (0);
+      if (rex)
+       s = names8rex[code - al_reg + add];
+      else
+       s = names8[code - al_reg];
+      break;
+    case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
+    case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
+      if (mode_64bit)
+       {
+         s = names64[code - rAX_reg + add];
+         break;
+       }
+      code += eAX_reg - rAX_reg;
+      /* Fall through.  */
+    case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
+    case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       s = names64[code - eAX_reg + add];
+      else if (sizeflag & DFLAG)
+       s = names32[code - eAX_reg + add];
+      else
+       s = names16[code - eAX_reg + add];
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    default:
+      s = INTERNAL_DISASSEMBLER_ERROR;
+      break;
+    }
+  oappend (s);
+}
+
+static void
+OP_IMREG (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  const char *s;
+
+  switch (code)
+    {
+    case indir_dx_reg:
+      if (intel_syntax)
+        s = "[dx]";
+      else
+        s = "(%dx)";
+      break;
+    case ax_reg: case cx_reg: case dx_reg: case bx_reg:
+    case sp_reg: case bp_reg: case si_reg: case di_reg:
+      s = names16[code - ax_reg];
+      break;
+    case es_reg: case ss_reg: case cs_reg:
+    case ds_reg: case fs_reg: case gs_reg:
+      s = names_seg[code - es_reg];
+      break;
+    case al_reg: case ah_reg: case cl_reg: case ch_reg:
+    case dl_reg: case dh_reg: case bl_reg: case bh_reg:
+      USED_REX (0);
+      if (rex)
+       s = names8rex[code - al_reg];
+      else
+       s = names8[code - al_reg];
+      break;
+    case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
+    case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       s = names64[code - eAX_reg];
+      else if (sizeflag & DFLAG)
+       s = names32[code - eAX_reg];
+      else
+       s = names16[code - eAX_reg];
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    default:
+      s = INTERNAL_DISASSEMBLER_ERROR;
+      break;
+    }
+  oappend (s);
+}
+
+static void
+OP_I (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_signed_vma op;
+  bfd_signed_vma mask = -1;
+
+  switch (bytemode)
+    {
+    case b_mode:
+      FETCH_DATA (the_info, codep + 1);
+      op = *codep++;
+      mask = 0xff;
+      break;
+    case q_mode:
+      if (mode_64bit)
+       {
+         op = get32s ();
+         break;
+       }
+      /* Fall through.  */
+    case v_mode:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       op = get32s ();
+      else if (sizeflag & DFLAG)
+       {
+         op = get32 ();
+         mask = 0xffffffff;
+       }
+      else
+       {
+         op = get16 ();
+         mask = 0xfffff;
+       }
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    case w_mode:
+      mask = 0xfffff;
+      op = get16 ();
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      return;
+    }
+
+  op &= mask;
+  scratchbuf[0] = '$';
+  print_operand_value (scratchbuf + 1, 1, op);
+  oappend (scratchbuf + intel_syntax);
+  scratchbuf[0] = '\0';
+}
+
+static void
+OP_I64 (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_signed_vma op;
+  bfd_signed_vma mask = -1;
+
+  if (!mode_64bit)
+    {
+      OP_I (bytemode, sizeflag);
+      return;
+    }
+
+  switch (bytemode)
+    {
+    case b_mode:
+      FETCH_DATA (the_info, codep + 1);
+      op = *codep++;
+      mask = 0xff;
+      break;
+    case v_mode:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       op = get64 ();
+      else if (sizeflag & DFLAG)
+       {
+         op = get32 ();
+         mask = 0xffffffff;
+       }
+      else
+       {
+         op = get16 ();
+         mask = 0xfffff;
+       }
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    case w_mode:
+      mask = 0xfffff;
+      op = get16 ();
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      return;
+    }
+
+  op &= mask;
+  scratchbuf[0] = '$';
+  print_operand_value (scratchbuf + 1, 1, op);
+  oappend (scratchbuf + intel_syntax);
+  scratchbuf[0] = '\0';
+}
+
+static void
+OP_sI (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_signed_vma op;
+  bfd_signed_vma mask = -1;
+
+  switch (bytemode)
+    {
+    case b_mode:
+      FETCH_DATA (the_info, codep + 1);
+      op = *codep++;
+      if ((op & 0x80) != 0)
+       op -= 0x100;
+      mask = 0xffffffff;
+      break;
+    case v_mode:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       op = get32s ();
+      else if (sizeflag & DFLAG)
+       {
+         op = get32s ();
+         mask = 0xffffffff;
+       }
+      else
+       {
+         mask = 0xffffffff;
+         op = get16 ();
+         if ((op & 0x8000) != 0)
+           op -= 0x10000;
+       }
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    case w_mode:
+      op = get16 ();
+      mask = 0xffffffff;
+      if ((op & 0x8000) != 0)
+       op -= 0x10000;
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      return;
+    }
+
+  scratchbuf[0] = '$';
+  print_operand_value (scratchbuf + 1, 1, op);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_J (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_vma disp;
+  bfd_vma mask = -1;
+
+  switch (bytemode)
+    {
+    case b_mode:
+      FETCH_DATA (the_info, codep + 1);
+      disp = *codep++;
+      if ((disp & 0x80) != 0)
+       disp -= 0x100;
+      break;
+    case v_mode:
+      if (sizeflag & DFLAG)
+       disp = get32s ();
+      else
+       {
+         disp = get16 ();
+         /* For some reason, a data16 prefix on a jump instruction
+            means that the pc is masked to 16 bits after the
+            displacement is added!  */
+         mask = 0xffff;
+       }
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      return;
+    }
+  disp = (start_pc + codep - start_codep + disp) & mask;
+  set_op (disp, 0);
+  print_operand_value (scratchbuf, 1, disp);
+  oappend (scratchbuf);
+}
+
+static void
+OP_SEG (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  oappend (names_seg[reg]);
+}
+
+static void
+OP_DIR (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag;
+{
+  int seg, offset;
+
+  if (sizeflag & DFLAG)
+    {
+      offset = get32 ();
+      seg = get16 ();
+    }
+  else
+    {
+      offset = get16 ();
+      seg = get16 ();
+    }
+  used_prefixes |= (prefixes & PREFIX_DATA);
+  if (intel_syntax)
+    sprintf (scratchbuf, "0x%x,0x%x", seg, offset);
+  else
+    sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
+  oappend (scratchbuf);
+}
+
+static void
+OP_OFF (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag;
+{
+  bfd_vma off;
+
+  append_seg ();
+
+  if ((sizeflag & AFLAG) || mode_64bit)
+    off = get32 ();
+  else
+    off = get16 ();
+
+  if (intel_syntax)
+    {
+      if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
+                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
+       {
+         oappend (names_seg[ds_reg - es_reg]);
+         oappend (":");
+       }
+    }
+  print_operand_value (scratchbuf, 1, off);
+  oappend (scratchbuf);
+}
+
+static void
+OP_OFF64 (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  bfd_vma off;
+
+  if (!mode_64bit)
+    {
+      OP_OFF (bytemode, sizeflag);
+      return;
+    }
+
+  append_seg ();
+
+  off = get64 ();
+
+  if (intel_syntax)
+    {
+      if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
+                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
+       {
+         oappend (names_seg[ds_reg - es_reg]);
+         oappend (":");
+       }
+    }
+  print_operand_value (scratchbuf, 1, off);
+  oappend (scratchbuf);
+}
+
+static void
+ptr_reg (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  const char *s;
+  if (intel_syntax)
+    oappend ("[");
+  else
+    oappend ("(");
+
+  USED_REX (REX_MODE64);
+  if (rex & REX_MODE64)
+    {
+      if (!(sizeflag & AFLAG))
+        s = names32[code - eAX_reg];
+      else
+        s = names64[code - eAX_reg];
+    }
+  else if (sizeflag & AFLAG)
+    s = names32[code - eAX_reg];
+  else
+    s = names16[code - eAX_reg];
+  oappend (s);
+  if (intel_syntax)
+    oappend ("]");
+  else
+    oappend (")");
+}
+
+static void
+OP_ESreg (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  oappend ("%es:" + intel_syntax);
+  ptr_reg (code, sizeflag);
+}
+
+static void
+OP_DSreg (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  if ((prefixes
+       & (PREFIX_CS
+         | PREFIX_DS
+         | PREFIX_SS
+         | PREFIX_ES
+         | PREFIX_FS
+         | PREFIX_GS)) == 0)
+    prefixes |= PREFIX_DS;
+  append_seg ();
+  ptr_reg (code, sizeflag);
+}
+
+static void
+OP_C (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add = 8;
+  sprintf (scratchbuf, "%%cr%d", reg + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_D (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add = 8;
+  if (intel_syntax)
+    sprintf (scratchbuf, "db%d", reg + add);
+  else
+    sprintf (scratchbuf, "%%db%d", reg + add);
+  oappend (scratchbuf);
+}
+
+static void
+OP_T (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  sprintf (scratchbuf, "%%tr%d", reg);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_Rd (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (mod == 3)
+    OP_E (bytemode, sizeflag);
+  else
+    BadOp ();
+}
+
+static void
+OP_MMX (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add = 8;
+  used_prefixes |= (prefixes & PREFIX_DATA);
+  if (prefixes & PREFIX_DATA)
+    sprintf (scratchbuf, "%%xmm%d", reg + add);
+  else
+    sprintf (scratchbuf, "%%mm%d", reg + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_XMM (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add = 8;
+  sprintf (scratchbuf, "%%xmm%d", reg + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_EM (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  int add = 0;
+  if (mod != 3)
+    {
+      OP_E (bytemode, sizeflag);
+      return;
+    }
+  USED_REX (REX_EXTZ);
+  if (rex & REX_EXTZ)
+    add = 8;
+
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+  used_prefixes |= (prefixes & PREFIX_DATA);
+  if (prefixes & PREFIX_DATA)
+    sprintf (scratchbuf, "%%xmm%d", rm + add);
+  else
+    sprintf (scratchbuf, "%%mm%d", rm + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_EX (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  int add = 0;
+  if (mod != 3)
+    {
+      OP_E (bytemode, sizeflag);
+      return;
+    }
+  USED_REX (REX_EXTZ);
+  if (rex & REX_EXTZ)
+    add = 8;
+
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+  sprintf (scratchbuf, "%%xmm%d", rm + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_MS (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (mod == 3)
+    OP_EM (bytemode, sizeflag);
+  else
+    BadOp ();
+}
+
+static void
+OP_XS (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (mod == 3)
+    OP_EX (bytemode, sizeflag);
+  else
+    BadOp ();
+}
+
+static const char *Suffix3DNow[] = {
+/* 00 */       NULL,           NULL,           NULL,           NULL,
+/* 04 */       NULL,           NULL,           NULL,           NULL,
+/* 08 */       NULL,           NULL,           NULL,           NULL,
+/* 0C */       "pi2fw",        "pi2fd",        NULL,           NULL,
+/* 10 */       NULL,           NULL,           NULL,           NULL,
+/* 14 */       NULL,           NULL,           NULL,           NULL,
+/* 18 */       NULL,           NULL,           NULL,           NULL,
+/* 1C */       "pf2iw",        "pf2id",        NULL,           NULL,
+/* 20 */       NULL,           NULL,           NULL,           NULL,
+/* 24 */       NULL,           NULL,           NULL,           NULL,
+/* 28 */       NULL,           NULL,           NULL,           NULL,
+/* 2C */       NULL,           NULL,           NULL,           NULL,
+/* 30 */       NULL,           NULL,           NULL,           NULL,
+/* 34 */       NULL,           NULL,           NULL,           NULL,
+/* 38 */       NULL,           NULL,           NULL,           NULL,
+/* 3C */       NULL,           NULL,           NULL,           NULL,
+/* 40 */       NULL,           NULL,           NULL,           NULL,
+/* 44 */       NULL,           NULL,           NULL,           NULL,
+/* 48 */       NULL,           NULL,           NULL,           NULL,
+/* 4C */       NULL,           NULL,           NULL,           NULL,
+/* 50 */       NULL,           NULL,           NULL,           NULL,
+/* 54 */       NULL,           NULL,           NULL,           NULL,
+/* 58 */       NULL,           NULL,           NULL,           NULL,
+/* 5C */       NULL,           NULL,           NULL,           NULL,
+/* 60 */       NULL,           NULL,           NULL,           NULL,
+/* 64 */       NULL,           NULL,           NULL,           NULL,
+/* 68 */       NULL,           NULL,           NULL,           NULL,
+/* 6C */       NULL,           NULL,           NULL,           NULL,
+/* 70 */       NULL,           NULL,           NULL,           NULL,
+/* 74 */       NULL,           NULL,           NULL,           NULL,
+/* 78 */       NULL,           NULL,           NULL,           NULL,
+/* 7C */       NULL,           NULL,           NULL,           NULL,
+/* 80 */       NULL,           NULL,           NULL,           NULL,
+/* 84 */       NULL,           NULL,           NULL,           NULL,
+/* 88 */       NULL,           NULL,           "pfnacc",       NULL,
+/* 8C */       NULL,           NULL,           "pfpnacc",      NULL,
+/* 90 */       "pfcmpge",      NULL,           NULL,           NULL,
+/* 94 */       "pfmin",        NULL,           "pfrcp",        "pfrsqrt",
+/* 98 */       NULL,           NULL,           "pfsub",        NULL,
+/* 9C */       NULL,           NULL,           "pfadd",        NULL,
+/* A0 */       "pfcmpgt",      NULL,           NULL,           NULL,
+/* A4 */       "pfmax",        NULL,           "pfrcpit1",     "pfrsqit1",
+/* A8 */       NULL,           NULL,           "pfsubr",       NULL,
+/* AC */       NULL,           NULL,           "pfacc",        NULL,
+/* B0 */       "pfcmpeq",      NULL,           NULL,           NULL,
+/* B4 */       "pfmul",        NULL,           "pfrcpit2",     "pfmulhrw",
+/* B8 */       NULL,           NULL,           NULL,           "pswapd",
+/* BC */       NULL,           NULL,           NULL,           "pavgusb",
+/* C0 */       NULL,           NULL,           NULL,           NULL,
+/* C4 */       NULL,           NULL,           NULL,           NULL,
+/* C8 */       NULL,           NULL,           NULL,           NULL,
+/* CC */       NULL,           NULL,           NULL,           NULL,
+/* D0 */       NULL,           NULL,           NULL,           NULL,
+/* D4 */       NULL,           NULL,           NULL,           NULL,
+/* D8 */       NULL,           NULL,           NULL,           NULL,
+/* DC */       NULL,           NULL,           NULL,           NULL,
+/* E0 */       NULL,           NULL,           NULL,           NULL,
+/* E4 */       NULL,           NULL,           NULL,           NULL,
+/* E8 */       NULL,           NULL,           NULL,           NULL,
+/* EC */       NULL,           NULL,           NULL,           NULL,
+/* F0 */       NULL,           NULL,           NULL,           NULL,
+/* F4 */       NULL,           NULL,           NULL,           NULL,
+/* F8 */       NULL,           NULL,           NULL,           NULL,
+/* FC */       NULL,           NULL,           NULL,           NULL,
+};
+
+static void
+OP_3DNowSuffix (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  const char *mnemonic;
+
+  FETCH_DATA (the_info, codep + 1);
+  /* AMD 3DNow! instructions are specified by an opcode suffix in the
+     place where an 8-bit immediate would normally go.  ie. the last
+     byte of the instruction.  */
+  obufp = obuf + strlen (obuf);
+  mnemonic = Suffix3DNow[*codep++ & 0xff];
+  if (mnemonic)
+    oappend (mnemonic);
+  else
+    {
+      /* Since a variable sized modrm/sib chunk is between the start
+        of the opcode (0x0f0f) and the opcode suffix, we need to do
+        all the modrm processing first, and don't know until now that
+        we have a bad opcode.  This necessitates some cleaning up.  */
+      op1out[0] = '\0';
+      op2out[0] = '\0';
+      BadOp ();
+    }
+}
+
+static const char *simd_cmp_op[] = {
+  "eq",
+  "lt",
+  "le",
+  "unord",
+  "neq",
+  "nlt",
+  "nle",
+  "ord"
+};
+
+static void
+OP_SIMD_Suffix (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  unsigned int cmp_type;
+
+  FETCH_DATA (the_info, codep + 1);
+  obufp = obuf + strlen (obuf);
+  cmp_type = *codep++ & 0xff;
+  if (cmp_type < 8)
+    {
+      char suffix1 = 'p', suffix2 = 's';
+      used_prefixes |= (prefixes & PREFIX_REPZ);
+      if (prefixes & PREFIX_REPZ)
+       suffix1 = 's';
+      else
+       {
+         used_prefixes |= (prefixes & PREFIX_DATA);
+         if (prefixes & PREFIX_DATA)
+           suffix2 = 'd';
+         else
+           {
+             used_prefixes |= (prefixes & PREFIX_REPNZ);
+             if (prefixes & PREFIX_REPNZ)
+               suffix1 = 's', suffix2 = 'd';
+           }
+       }
+      sprintf (scratchbuf, "cmp%s%c%c",
+              simd_cmp_op[cmp_type], suffix1, suffix2);
+      used_prefixes |= (prefixes & PREFIX_REPZ);
+      oappend (scratchbuf);
+    }
+  else
+    {
+      /* We have a bad extension byte.  Clean up.  */
+      op1out[0] = '\0';
+      op2out[0] = '\0';
+      BadOp ();
+    }
+}
+
+static void
+SIMD_Fixup (extrachar, sizeflag)
+     int extrachar;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  /* Change movlps/movhps to movhlps/movlhps for 2 register operand
+     forms of these instructions.  */
+  if (mod == 3)
+    {
+      char *p = obuf + strlen (obuf);
+      *(p + 1) = '\0';
+      *p       = *(p - 1);
+      *(p - 1) = *(p - 2);
+      *(p - 2) = *(p - 3);
+      *(p - 3) = extrachar;
+    }
+}
+
+static void
+BadOp (void)
+{
+  /* Throw away prefixes and 1st. opcode byte.  */
+  codep = insn_codep + 1;
+  oappend ("(bad)");
+}
diff --git a/jit/i386/methodtable.c b/jit/i386/methodtable.c
new file mode 100644 (file)
index 0000000..a1e598b
--- /dev/null
@@ -0,0 +1,126 @@
+/* jit/i386/methodtable.c -
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authores: Christian Thalinger
+
+   $Id: methodtable.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "methodtable.h"
+#include "types.h"
+#include "asmpart.h"
+#include "toolbox/memory.h"
+
+
+static mtentry *mtroot = NULL;
+
+
+void addmethod(u1 *start, u1 *end)
+{
+  /* boehm makes problems with jvm98 db */
+#if 0
+    mtentry *mte = GCNEW(mtentry, 1);
+#else
+    mtentry *mte = NEW(mtentry);
+#endif
+
+/*      fprintf(stderr, "start=%lx end=%lx\n", start, end); */
+
+    if (mtroot == NULL) {
+#if 0
+        mtentry *tmp = GCNEW(mtentry, 1);
+#else
+        mtentry *tmp = NEW(mtentry);
+#endif
+       tmp->start = (u1 *) asm_calljavamethod;
+       tmp->end = (u1 *) asm_calljavafunction;    /* little hack, but should work */
+       tmp->next = mtroot;
+       mtroot = tmp;
+
+#if 0
+        tmp = GCNEW(mtentry, 1);
+#else
+        tmp = NEW(mtentry);
+#endif
+       tmp->start = (u1 *) asm_calljavafunction;
+       tmp->end = (u1 *) asm_call_jit_compiler;    /* little hack, but should work */
+       tmp->next = mtroot;
+       mtroot = tmp;
+    }
+
+    mte->start = start;
+    mte->end = end;
+    mte->next = mtroot;
+    mtroot = mte;
+}
+
+
+
+u1 *findmethod(u1 *pos)
+{
+    mtentry *mte = mtroot;
+
+/*      printf("findmethod: start\n"); */
+
+    while (mte != NULL) {
+/*          printf("%p <= %p <= %p\n", mte->start, pos, mte->end); */
+          
+       if (mte->start <= pos && pos <= mte->end) {
+           return mte->start;
+
+       } else {
+           mte = mte->next;
+       }
+    }
+       
+    return NULL;
+}
+
+
+
+void asmprintf(int x)
+{
+    printf("val=%x\n", x);
+    fflush(stdout);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/i386/methodtable.h b/jit/i386/methodtable.h
new file mode 100644 (file)
index 0000000..f6e5755
--- /dev/null
@@ -0,0 +1,66 @@
+/* jit/i386/methodtable.h -
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: methodtable.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _METHODTABLE_H
+#define _METHODTABLE_H
+
+#include "types.h"
+
+
+typedef struct _mtentry mtentry;
+
+struct _mtentry {
+    u1 *start;
+    u1 *end;
+    mtentry *next;
+};
+
+void addmethod(u1 *start, u1 *end);
+u1 *findmethod(u1 *pos);
+
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/i386/native-math.h b/jit/i386/native-math.h
new file mode 100644 (file)
index 0000000..fb24466
--- /dev/null
@@ -0,0 +1,44 @@
+/* i386/native-math.h **********************************************************
+
+    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+
+    See file COPYRIGHT for information on usage and disclaimer of warranties
+
+    Contains the machine-specific floating point definitions.
+
+    Authors: Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
+             Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
+             Christian Thalinger
+
+    $Id: native-math.h 557 2003-11-02 22:51:59Z twisti $
+
+*******************************************************************************/
+
+#ifndef _NATIVE_MATH_H
+#define _NATIVE_MATH_H
+
+/* include machine-specific math.h */
+
+#include <math.h>
+
+/* define infinity for floating point numbers */
+
+static u4 flt_nan    = 0x7fc00000;
+static u4 flt_posinf = 0x7f800000;
+static u4 flt_neginf = 0xff800000;
+
+#define FLT_NAN     (*((float*) (&flt_nan)))
+#define FLT_POSINF  (*((float*) (&flt_posinf)))
+#define FLT_NEGINF  (*((float*) (&flt_neginf)))
+
+/* define infinity for double floating point numbers */
+
+static u8 dbl_nan    = 0x7ff8000000000000LL;
+static u8 dbl_posinf = 0x7ff0000000000000LL;
+static u8 dbl_neginf = 0xfff0000000000000LL;
+
+#define DBL_NAN     (*((double*) (&dbl_nan)))
+#define DBL_POSINF  (*((double*) (&dbl_posinf)))
+#define DBL_NEGINF  (*((double*) (&dbl_neginf)))
+
+#endif
diff --git a/jit/i386/threads.h b/jit/i386/threads.h
new file mode 100644 (file)
index 0000000..0e64c5d
--- /dev/null
@@ -0,0 +1,47 @@
+/* i386/threads.h **************************************************************
+
+    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+
+    See file COPYRIGHT for information on usage and disclaimer of warranties
+
+    System dependent part of thread header file.
+
+    Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
+             Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
+
+    Last Change: $Id: threads.h 557 2003-11-02 22:51:59Z twisti $
+
+*******************************************************************************/
+
+
+#ifndef __sysdep_threads_h
+#define __sysdep_threads_h
+
+#include "config.h"
+#include "threads/thread.h"
+
+/* Thread handling */
+
+/* prototypes */
+
+void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
+u1*  asm_initialize_thread_stack (void *func, u1 *stack);
+
+/* access macros */
+
+#define        THREADSTACKSIZE         (32 * 1024)
+
+#define        THREADSWITCH(to, from)  asm_perform_threadswitch(&(from)->restorePoint,\
+                                    &(to)->restorePoint, &(from)->usedStackTop)
+
+#define THREADINIT(to, func)    (to)->restorePoint =                         \
+                                    asm_initialize_thread_stack((u1*)(func), \
+                                                            (to)->stackEnd)
+
+#define        THREADINFO(e) \
+    do { \
+        (e)->restorePoint = 0; \
+        (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
+    } while(0)
+
+#endif
diff --git a/jit/i386/types.h b/jit/i386/types.h
new file mode 100644 (file)
index 0000000..d083ee6
--- /dev/null
@@ -0,0 +1,95 @@
+/* jit/i386/types.h - machine specific definitions for i386 processor
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas  Krall
+            Michael Gschwind
+
+   Changes: Christan Thalinger
+
+   $Id: types.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _TYPES_H
+#define _TYPES_H
+
+#define POINTERSIZE         4
+#define WORDS_BIGENDIAN     0
+
+#define SUPPORT_DIVISION    1
+#define SUPPORT_LONG        1
+#define SUPPORT_FLOAT       1
+#define SUPPORT_DOUBLE      1
+
+#define SUPPORT_LONG_ADD    1
+#define SUPPORT_LONG_CMP    1
+#define SUPPORT_LONG_LOG    1
+#define SUPPORT_LONG_SHIFT  1
+#define SUPPORT_LONG_MULDIV 0
+#define SUPPORT_LONG_ICVT   1
+#define SUPPORT_LONG_FCVT   1
+
+#define CONDITIONAL_LOADCONST
+#define NO_DIV_OPT
+
+#define U8_AVAILABLE        1
+
+
+typedef signed char             s1;
+typedef unsigned char           u1;
+typedef signed short int        s2;
+typedef unsigned short int      u2;
+
+typedef signed int              s4;
+typedef unsigned int            u4;
+
+#if U8_AVAILABLE
+typedef signed long long int    s8;
+typedef unsigned long long int  u8;
+#else
+typedef struct {u4 low, high;}  u8;
+#define s8 u8
+#endif
+
+#endif /* _TYPES_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b5488f4107176a6e1d9ad1cd105027d30fb55114..6c486de3fbf56d838c4f119bc50c2b44393dcbc1 100644 (file)
@@ -1,59 +1,44 @@
-static void descriptor2types (methodinfo *m);
-
-/*typedef struct {
-        listnode linkage;
-        instruction *iptr;
-        } t_patchlistnode;*/
-
-
-typedef struct {
-        listnode linkage;
-
-        methodinfo *method;
-        int startgp;
-        int stopgp;
-        int firstlocal;
-
-        bool *readonly;
-        int  *label_index;
-        
-        list *inlinedmethods;
-} inlining_methodinfo;
-
-typedef struct {
-        listnode linkage;
-        
-       // saved static compiler variables
-        
-        methodinfo *method;
-        
-       // restored through method
-
-       // int jcodelength;
-       // u1 *jcode;
-       // classinfo *class;
-
-       // descriptor never used
-       // maxstack used outside of main for loop
-       // maxlocals never used
-       
-       // exceptiontablelength
-       // raw_extable used outside of main for loop
-       // mreturntype used outside of main for loop
-       // mparamcount used outside of main for loop
-       // mparamtypes used outside of main for loop
+/* jit/inline.c - code inliner
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       //local variables used in parse()  
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-       int  i;                     /* temporary for different uses (counters)    */
-       int  p;                     /* java instruction counter                   */
-       int  nextp;                 /* start of next java instruction             */
-       int  opcode;                /* java opcode                                */
+   Contact: cacao@complang.tuwien.ac.at
 
-       inlining_methodinfo *inlinfo;
+   Authors: Dieter Thuernbeck
+
+   $Id: inline.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "inline.h"
+#include "jit.h"
+#include "parse.h"
+#include "loader.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
 
-       /*      list *patchlist; */
-} t_inlining_stacknode;
 
 // checked functions and macros: LOADCONST code_get OP1 BUILTIN block_insert bound_check ALIGN
 
@@ -61,28 +46,16 @@ typedef struct {
 
 static list *inlining_stack;
 //static list *inlining_patchlist;
-static bool isinlinedmethod;
-static int cumjcodelength;         /* cumulative immediate intruction length      */
+bool isinlinedmethod;
+int cumjcodelength;         /* cumulative immediate intruction length      */
 static int cumlocals;
-static int cummaxstack;
-static int cumextablelength;
+int cummaxstack;
+int cumextablelength;
 static int cummethods;
-static inlining_methodinfo *inlining_rootinfo;
-
+inlining_methodinfo *inlining_rootinfo;
 
-void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlining_methodinfo* inlinfo);
-void inlining_pop_compiler_variables(int *i, int *p, int *nextp, int *opcode, inlining_methodinfo** inlinfo); 
-void inlining_init(void);
-inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp, int firstlocal, int maxstackdepth);
 
-#define inlining_save_compiler_variables() inlining_push_compiler_variables(i,p,nextp,opcode,inlinfo)
-#define inlining_restore_compiler_variables() inlining_pop_compiler_variables(&i,&p,&nextp,&opcode,&inlinfo)
-#define inlining_set_compiler_variables(i) p=nextp=0; inlining_set_compiler_variables_fun(i->method); inlinfo=i;
-#define INLINING_MAXDEPTH 1
-#define INLINING_MAXCODESIZE 32
-#define INLINING_MAXMETHODS 8
-
-void inlining_init(void) 
+void inlining_init()
 {
        inlining_stack = NULL;
        //      inlining_patchlist = NULL;
@@ -101,11 +74,13 @@ void inlining_init(void)
        maxstack = cummaxstack;
 }
 
+
 void inlining_cleanup(void)
 {
        FREE(inlining_stack, t_inlining_stacknode);
 }
 
+
 void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlining_methodinfo *inlinfo) 
 {
        t_inlining_stacknode *new = NEW(t_inlining_stacknode);
@@ -122,6 +97,7 @@ void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlin
        isinlinedmethod++;
 }
 
+
 void inlining_pop_compiler_variables(int *i, int *p, int *nextp, int *opcode, inlining_methodinfo **inlinfo) 
 {
        t_inlining_stacknode *tmp = (t_inlining_stacknode *) list_first(inlining_stack);
@@ -156,6 +132,7 @@ void inlining_set_compiler_variables_fun(methodinfo *m)
        //      list_init(inlining_patchlist, OFFSET(t_patchlistnode, linkage));
 }
 
+
 /*void inlining_addpatch(instruction *iptr)  
   {
   t_patchlistnode *patch = DNEW(t_patchlistnode);
@@ -175,6 +152,7 @@ classinfo *first_occurence(classinfo* class, utf* name, utf* desc) {
                return first;
 }
 
+
 bool is_unique_rec(classinfo *class, methodinfo *m, utf* name, utf* desc) {
        methodinfo *tmp = class_findmethod(class, name, desc);
        if ((tmp != NULL) && (tmp != m))
@@ -188,6 +166,7 @@ bool is_unique_rec(classinfo *class, methodinfo *m, utf* name, utf* desc) {
        return true;
 }
 
+
 bool is_unique_method(classinfo *class, methodinfo *m, utf* name, utf* desc) {
        classinfo *firstclass;
        
@@ -440,6 +419,7 @@ inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp, i
     return newnode;
 }
 
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
@@ -452,5 +432,3 @@ inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp, i
  * tab-width: 4
  * End:
  */
-
-       
diff --git a/jit/inline.h b/jit/inline.h
new file mode 100644 (file)
index 0000000..84cb4ae
--- /dev/null
@@ -0,0 +1,147 @@
+/* jit/inline.c - code inliner
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Dieter Thuernbeck
+
+   $Id: inline.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _INLINE_H
+#define _INLINE_H
+
+#include "global.h"
+#include "toolbox/list.h"
+
+#define INLINING_MAXDEPTH       1
+#define INLINING_MAXCODESIZE    32
+#define INLINING_MAXMETHODS     8
+
+
+/*typedef struct {
+        listnode linkage;
+        instruction *iptr;
+        } t_patchlistnode;*/
+
+
+typedef struct {
+    listnode linkage;
+
+    methodinfo *method;
+    int startgp;
+    int stopgp;
+    int firstlocal;
+
+    bool *readonly;
+    int  *label_index;
+        
+    list *inlinedmethods;
+} inlining_methodinfo;
+
+
+typedef struct {
+    listnode linkage;
+        
+    // saved static compiler variables
+        
+    methodinfo *method;
+        
+    // restored through method
+
+    // int jcodelength;
+    // u1 *jcode;
+    // classinfo *class;
+
+    // descriptor never used
+    // maxstack used outside of main for loop
+    // maxlocals never used
+       
+    // exceptiontablelength
+    // raw_extable used outside of main for loop
+    // mreturntype used outside of main for loop
+    // mparamcount used outside of main for loop
+    // mparamtypes used outside of main for loop
+
+    //local variables used in parse()  
+
+    int  i;                     /* temporary for different uses (counters)    */
+    int  p;                     /* java instruction counter                   */
+    int  nextp;                 /* start of next java instruction             */
+    int  opcode;                /* java opcode                                */
+
+    inlining_methodinfo *inlinfo;
+
+    /* list *patchlist; */
+} t_inlining_stacknode;
+
+
+/* extern variables */
+extern bool isinlinedmethod;
+extern int cumjcodelength;
+extern int cummaxstack;
+extern int cumextablelength;
+extern inlining_methodinfo *inlining_rootinfo;
+
+
+/* function prototypes*/
+void inlining_init();
+void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, 
+                                      inlining_methodinfo* inlinfo);
+void inlining_pop_compiler_variables(int *i, int *p, int *nextp, int *opcode, 
+                                     inlining_methodinfo** inlinfo); 
+void inlining_init(void);
+inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp,
+                                             int firstlocal, int maxstackdepth);
+
+
+#define inlining_save_compiler_variables() \
+    inlining_push_compiler_variables(i,p,nextp,opcode,inlinfo)
+
+#define inlining_restore_compiler_variables() \
+    inlining_pop_compiler_variables(&i,&p,&nextp,&opcode,&inlinfo)
+
+#define inlining_set_compiler_variables(i) \
+    do { \
+        p = nextp = 0; \
+        inlining_set_compiler_variables_fun(i->method); \
+        inlinfo = i; \
+    } while (0)
+
+#endif /* _INLINE_H */
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/jit.c b/jit/jit.c
new file mode 100644 (file)
index 0000000..768e1ac
--- /dev/null
+++ b/jit/jit.c
@@ -0,0 +1,1572 @@
+/* jit/jit.c - calls the code generation functions
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   $Id: jit.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <string.h>
+#include "global.h"    /* we define _GNU_SOURCE there */
+#include "tables.h"
+#include "loader.h"
+#include "jit.h"
+#include "parse.h"
+#include "stack.h"
+#include "reg.h"
+#include "inline.h"
+#include "builtin.h"
+#include "native.h"
+#include "asmpart.h"
+#include "threads/thread.h"
+#include "disass.h"
+#include "loop/loop.h"
+#include "loop/graph.h"
+#include "loop/analyze.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+
+/* global switches ************************************************************/
+bool compileverbose =  false;
+bool showstack = false;
+bool showdisassemble = false; 
+bool showddatasegment = false; 
+bool showintermediate = false;
+int  optimizelevel = 0;
+
+bool useinlining = false;
+bool inlinevirtuals = false;
+bool inlineexceptions = false;
+bool inlineparamopt = false;
+bool inlineoutsiders = false;
+
+bool checkbounds = true;
+bool checknull = true;
+bool opt_noieee = false;
+bool checksync = true;
+bool opt_loops = false;
+
+bool getcompilingtime = false;
+long compilingtime = 0;
+
+int  has_ext_instr_set = 0;
+
+bool statistics = false;         
+
+int count_jit_calls = 0;
+int count_methods = 0;
+int count_spills = 0;
+int count_pcmd_activ = 0;
+int count_pcmd_drop = 0;
+int count_pcmd_zero = 0;
+int count_pcmd_const_store = 0;
+int count_pcmd_const_alu = 0;
+int count_pcmd_const_bra = 0;
+int count_pcmd_load = 0;
+int count_pcmd_move = 0;
+int count_load_instruction = 0;
+int count_pcmd_store = 0;
+int count_pcmd_store_comb = 0;
+int count_dup_instruction = 0;
+int count_pcmd_op = 0;
+int count_pcmd_mem = 0;
+int count_pcmd_met = 0;
+int count_pcmd_bra = 0;
+int count_pcmd_table = 0;
+int count_pcmd_return = 0;
+int count_pcmd_returnx = 0;
+int count_check_null = 0;
+int count_check_bound = 0;
+int count_max_basic_blocks = 0;
+int count_basic_blocks = 0;
+int count_javainstr = 0;
+int count_max_javainstr = 0;
+int count_javacodesize = 0;
+int count_javaexcsize = 0;
+int count_calls = 0;
+int count_tryblocks = 0;
+int count_code_len = 0;
+int count_data_len = 0;
+int count_cstub_len = 0;
+int count_nstub_len = 0;
+int count_max_new_stack = 0;
+int count_upper_bound_new_stack = 0;
+static int count_block_stack_init[11] = {
+       0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 
+       0
+};
+int *count_block_stack = count_block_stack_init;
+static int count_analyse_iterations_init[5] = {
+       0, 0, 0, 0, 0
+};
+int *count_analyse_iterations = count_analyse_iterations_init;
+static int count_method_bb_distribution_init[9] = {
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0
+};
+int *count_method_bb_distribution = count_method_bb_distribution_init;
+static int count_block_size_distribution_init[18] = {
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0
+};
+int *count_block_size_distribution = count_block_size_distribution_init;
+static int count_store_length_init[21] = {
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0
+};
+int *count_store_length = count_store_length_init;
+static int count_store_depth_init[11] = {
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0
+};
+int *count_store_depth = count_store_depth_init;
+
+
+
+/* global compiler variables **************************************************/
+
+                                /* data about the currently compiled method   */
+
+classinfo  *class;              /* class the compiled method belongs to       */
+methodinfo *method;             /* pointer to method info of compiled method  */
+static utf        *descriptor;  /* type descriptor of compiled method         */
+int         mparamcount;        /* number of parameters (incl. this)          */
+u1         *mparamtypes;        /* types of all parameters (TYPE_INT, ...)    */
+static int         mreturntype; /* return type of method                      */
+       
+int maxstack;                   /* maximal JavaVM stack size                  */
+int maxlocals;                  /* maximal number of local JavaVM variables   */
+int jcodelength;                /* length of JavaVM-codes                     */
+u1 *jcode;                      /* pointer to start of JavaVM-code            */
+int exceptiontablelength;       /* length of exception table                  */
+xtable *extable;                /* pointer to start of exception table        */
+exceptiontable *raw_extable;
+
+int block_count;                /* number of basic blocks                     */
+basicblock *block;              /* points to basic block array                */
+int *block_index;               /* a table which contains for every byte of   */
+                                /* JavaVM code a basic block index if at this */
+                                /* byte there is the start of a basic block   */
+
+int instr_count;                /* number of JavaVM instructions              */
+instruction *instr;             /* points to intermediate code instructions   */
+
+int stack_count;                /* number of stack elements                   */
+stackelement *stack;            /* points to intermediate code instructions   */
+
+bool isleafmethod;              /* true if a method doesn't call subroutines  */
+
+basicblock *last_block;         /* points to the end of the BB list           */
+
+/* list of all classes used by the compiled method which have to be           */
+/* initialised (if not already done) before execution of this method          */
+chain *uninitializedclasses;
+
+int stackreq[256];
+                                
+
+int jcommandsize[256] = {
+
+#define JAVA_NOP               0
+#define ICMD_NOP               0
+       1,
+#define JAVA_ACONST_NULL       1
+#define ICMD_ACONST            1        /* val.a = constant                   */
+       1,
+#define JAVA_ICONST_M1         2
+#define ICMD_NULLCHECKPOP      2
+       1,
+#define JAVA_ICONST_0          3
+#define ICMD_ICONST            3        /* val.i = constant                   */
+       1,
+#define JAVA_ICONST_1          4
+#define ICMD_IREM0X10001       4
+       1,
+#define JAVA_ICONST_2          5
+#define ICMD_IDIVPOW2          5        /* val.i = constant                   */
+       1,
+#define JAVA_ICONST_3          6
+#define ICMD_LDIVPOW2          6        /* val.l = constant                   */
+       1,
+#define JAVA_ICONST_4          7
+       1,
+#define JAVA_ICONST_5          8
+#define ICMD_LREM0X10001       8
+       1,
+#define JAVA_LCONST_0          9
+#define ICMD_LCONST            9        /* val.l = constant                   */
+       1,
+#define JAVA_LCONST_1         10
+#define ICMD_LCMPCONST        10        /* val.l = constant                   */
+       1,
+#define JAVA_FCONST_0         11
+#define ICMD_FCONST           11        /* val.f = constant                   */
+       1,
+#define JAVA_FCONST_1         12
+       1,
+#define JAVA_FCONST_2         13
+#define ICMD_ELSE_ICONST      13
+       1,
+#define JAVA_DCONST_0         14
+#define ICMD_DCONST           14        /* val.d = constant                   */
+       1,
+#define JAVA_DCONST_1         15
+#define ICMD_IFEQ_ICONST      15
+       1,
+#define JAVA_BIPUSH           16
+#define ICMD_IFNE_ICONST      16
+       2,
+#define JAVA_SIPUSH           17
+#define ICMD_IFLT_ICONST      17
+       3,
+#define JAVA_LDC1             18
+#define ICMD_IFGE_ICONST      18
+       2,
+#define JAVA_LDC2             19
+#define ICMD_IFGT_ICONST      19
+       3,
+#define JAVA_LDC2W            20
+#define ICMD_IFLE_ICONST      20
+       3,
+                                           /* order of LOAD instructions must be */
+                                           /* equal to order of TYPE_XXX defines */
+#define JAVA_ILOAD            21
+#define ICMD_ILOAD            21        /* op1 = local variable               */
+       2,                      
+#define JAVA_LLOAD            22
+#define ICMD_LLOAD            22        /* op1 = local variable               */
+       2,
+#define JAVA_FLOAD            23
+#define ICMD_FLOAD            23        /* op1 = local variable               */
+       2,
+#define JAVA_DLOAD            24
+#define ICMD_DLOAD            24        /* op1 = local variable               */
+       2,
+#define JAVA_ALOAD            25
+#define ICMD_ALOAD            25        /* op1 = local variable               */
+       2,
+#define JAVA_ILOAD_0          26
+#define ICMD_IADDCONST        26        /* val.i = constant                   */
+       1,
+#define JAVA_ILOAD_1          27
+#define ICMD_ISUBCONST        27        /* val.i = constant                   */
+       1,
+#define JAVA_ILOAD_2          28
+#define ICMD_IMULCONST        28        /* val.i = constant                   */
+       1,
+#define JAVA_ILOAD_3          29
+#define ICMD_IANDCONST        29        /* val.i = constant                   */
+       1,
+#define JAVA_LLOAD_0          30
+#define ICMD_IORCONST         30        /* val.i = constant                   */
+       1,
+#define JAVA_LLOAD_1          31
+#define ICMD_IXORCONST        31        /* val.i = constant                   */
+       1,
+#define JAVA_LLOAD_2          32
+#define ICMD_ISHLCONST        32        /* val.i = constant                   */
+       1,
+#define JAVA_LLOAD_3          33
+#define ICMD_ISHRCONST        33        /* val.i = constant                   */
+       1,
+#define JAVA_FLOAD_0          34
+#define ICMD_IUSHRCONST       34        /* val.i = constant                   */
+       1,
+#define JAVA_FLOAD_1          35
+#define ICMD_IREMPOW2         35        /* val.i = constant                   */
+       1,
+#define JAVA_FLOAD_2          36
+#define ICMD_LADDCONST        36        /* val.l = constant                   */
+       1,
+#define JAVA_FLOAD_3          37
+#define ICMD_LSUBCONST        37        /* val.l = constant                   */
+       1,
+#define JAVA_DLOAD_0          38
+#define ICMD_LMULCONST        38        /* val.l = constant                   */
+       1,
+#define JAVA_DLOAD_1          39
+#define ICMD_LANDCONST        39        /* val.l = constant                   */
+       1,
+#define JAVA_DLOAD_2          40
+#define ICMD_LORCONST         40        /* val.l = constant                   */
+       1,
+#define JAVA_DLOAD_3          41
+#define ICMD_LXORCONST        41        /* val.l = constant                   */
+       1,
+#define JAVA_ALOAD_0          42
+#define ICMD_LSHLCONST        42        /* val.l = constant                   */
+       1,
+#define JAVA_ALOAD_1          43
+#define ICMD_LSHRCONST        43        /* val.l = constant                   */
+       1,
+#define JAVA_ALOAD_2          44
+#define ICMD_LUSHRCONST       44        /* val.l = constant                   */
+       1,
+#define JAVA_ALOAD_3          45
+#define ICMD_LREMPOW2         45        /* val.l = constant                   */
+       1,
+#define JAVA_IALOAD           46
+#define ICMD_IALOAD           46
+       1,
+#define JAVA_LALOAD           47
+#define ICMD_LALOAD           47
+       1,
+#define JAVA_FALOAD           48
+#define ICMD_FALOAD           48
+       1,
+#define JAVA_DALOAD           49
+#define ICMD_DALOAD           49
+       1,
+#define JAVA_AALOAD           50
+#define ICMD_AALOAD           50
+       1,
+#define JAVA_BALOAD           51
+#define ICMD_BALOAD           51
+       1,
+#define JAVA_CALOAD           52
+#define ICMD_CALOAD           52
+       1,
+#define JAVA_SALOAD           53
+#define ICMD_SALOAD           53
+       1,
+                                           /* order of STORE instructions must be*/
+                                           /* equal to order of TYPE_XXX defines */
+#define JAVA_ISTORE           54
+#define ICMD_ISTORE           54        /* op1 = local variable               */
+       2,
+#define JAVA_LSTORE           55
+#define ICMD_LSTORE           55        /* op1 = local variable               */
+       2,
+#define JAVA_FSTORE           56
+#define ICMD_FSTORE           56        /* op1 = local variable               */
+       2,
+#define JAVA_DSTORE           57
+#define ICMD_DSTORE           57        /* op1 = local variable               */
+       2,
+#define JAVA_ASTORE           58
+#define ICMD_ASTORE           58        /* op1 = local variable               */
+       2,
+#define JAVA_ISTORE_0         59
+#define ICMD_IF_LEQ           59        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_ISTORE_1         60
+#define ICMD_IF_LNE           60        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_ISTORE_2         61
+#define ICMD_IF_LLT           61        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_ISTORE_3         62
+#define ICMD_IF_LGE           62        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_LSTORE_0         63
+#define ICMD_IF_LGT           63        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_LSTORE_1         64
+#define ICMD_IF_LLE           64        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_LSTORE_2         65
+#define ICMD_IF_LCMPEQ        65        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_LSTORE_3         66
+#define ICMD_IF_LCMPNE        66        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_FSTORE_0         67
+#define ICMD_IF_LCMPLT        67        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_FSTORE_1         68
+#define ICMD_IF_LCMPGE        68        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_FSTORE_2         69
+#define ICMD_IF_LCMPGT        69        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_FSTORE_3         70
+#define ICMD_IF_LCMPLE        70        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_DSTORE_0         71
+       1,
+#define JAVA_DSTORE_1         72
+       1,
+#define JAVA_DSTORE_2         73
+       1,
+#define JAVA_DSTORE_3         74
+       1,
+#define JAVA_ASTORE_0         75
+       1,
+#define JAVA_ASTORE_1         76
+       1,
+#define JAVA_ASTORE_2         77
+       1,
+#define JAVA_ASTORE_3         78
+       1,
+#define JAVA_IASTORE          79
+#define ICMD_IASTORE          79
+       1,
+#define JAVA_LASTORE          80
+#define ICMD_LASTORE          80
+       1,
+#define JAVA_FASTORE          81
+#define ICMD_FASTORE          81
+       1,
+#define JAVA_DASTORE          82
+#define ICMD_DASTORE          82
+       1,
+#define JAVA_AASTORE          83
+#define ICMD_AASTORE          83
+       1,
+#define JAVA_BASTORE          84
+#define ICMD_BASTORE          84
+       1,
+#define JAVA_CASTORE          85
+#define ICMD_CASTORE          85
+       1,
+#define JAVA_SASTORE          86
+#define ICMD_SASTORE          86
+       1,
+#define JAVA_POP              87
+#define ICMD_POP              87
+       1,
+#define JAVA_POP2             88
+#define ICMD_POP2             88
+       1,
+#define JAVA_DUP              89
+#define ICMD_DUP              89
+       1,
+#define JAVA_DUP_X1           90
+#define ICMD_DUP_X1           90
+       1,
+#define JAVA_DUP_X2           91
+#define ICMD_DUP_X2           91
+       1,
+#define JAVA_DUP2             92
+#define ICMD_DUP2             92
+       1,
+#define JAVA_DUP2_X1          93
+#define ICMD_DUP2_X1          93
+       1,
+#define JAVA_DUP2_X2          94
+#define ICMD_DUP2_X2          94
+       1,
+#define JAVA_SWAP             95
+#define ICMD_SWAP             95
+       1,
+#define JAVA_IADD             96
+#define ICMD_IADD             96
+       1,
+#define JAVA_LADD             97
+#define ICMD_LADD             97
+       1,
+#define JAVA_FADD             98
+#define ICMD_FADD             98
+       1,
+#define JAVA_DADD             99
+#define ICMD_DADD             99
+       1,
+#define JAVA_ISUB             100
+#define ICMD_ISUB             100
+       1,
+#define JAVA_LSUB             101
+#define ICMD_LSUB             101
+       1,
+#define JAVA_FSUB             102
+#define ICMD_FSUB             102
+       1,
+#define JAVA_DSUB             103
+#define ICMD_DSUB             103
+       1,
+#define JAVA_IMUL             104
+#define ICMD_IMUL             104
+       1,
+#define JAVA_LMUL             105
+#define ICMD_LMUL             105
+       1,
+#define JAVA_FMUL             106
+#define ICMD_FMUL             106
+       1,
+#define JAVA_DMUL             107
+#define ICMD_DMUL             107
+       1,
+#define JAVA_IDIV             108
+#define ICMD_IDIV             108
+       1,
+#define JAVA_LDIV             109
+#define ICMD_LDIV             109
+       1,
+#define JAVA_FDIV             110
+#define ICMD_FDIV             110
+       1,
+#define JAVA_DDIV             111
+#define ICMD_DDIV             111
+       1,
+#define JAVA_IREM             112
+#define ICMD_IREM             112
+       1,
+#define JAVA_LREM             113
+#define ICMD_LREM             113
+       1,
+#define JAVA_FREM             114
+#define ICMD_FREM             114
+       1,
+#define JAVA_DREM             115
+#define ICMD_DREM             115
+       1,
+#define JAVA_INEG             116
+#define ICMD_INEG             116
+       1,
+#define JAVA_LNEG             117
+#define ICMD_LNEG             117
+       1,
+#define JAVA_FNEG             118
+#define ICMD_FNEG             118
+       1,
+#define JAVA_DNEG             119
+#define ICMD_DNEG             119
+       1,
+#define JAVA_ISHL             120
+#define ICMD_ISHL             120
+       1,
+#define JAVA_LSHL             121
+#define ICMD_LSHL             121
+       1,
+#define JAVA_ISHR             122
+#define ICMD_ISHR             122
+       1,
+#define JAVA_LSHR             123
+#define ICMD_LSHR             123
+       1,
+#define JAVA_IUSHR            124
+#define ICMD_IUSHR            124
+       1,
+#define JAVA_LUSHR            125
+#define ICMD_LUSHR            125
+       1,
+#define JAVA_IAND             126
+#define ICMD_IAND             126
+       1,
+#define JAVA_LAND             127
+#define ICMD_LAND             127
+       1,
+#define JAVA_IOR              128
+#define ICMD_IOR              128
+       1,
+#define JAVA_LOR              129
+#define ICMD_LOR              129
+       1,
+#define JAVA_IXOR             130
+#define ICMD_IXOR             130
+       1,
+#define JAVA_LXOR             131
+#define ICMD_LXOR             131
+       1,
+#define JAVA_IINC             132
+#define ICMD_IINC             132   /* op1 = local variable, val.i = constant */
+       3,
+#define JAVA_I2L              133
+#define ICMD_I2L              133
+       1,
+#define JAVA_I2F              134
+#define ICMD_I2F              134
+       1,
+#define JAVA_I2D              135
+#define ICMD_I2D              135
+       1,
+#define JAVA_L2I              136
+#define ICMD_L2I              136
+       1,
+#define JAVA_L2F              137
+#define ICMD_L2F              137
+       1,
+#define JAVA_L2D              138
+#define ICMD_L2D              138
+       1,
+#define JAVA_F2I              139
+#define ICMD_F2I              139
+       1,
+#define JAVA_F2L              140
+#define ICMD_F2L              140
+       1,
+#define JAVA_F2D              141
+#define ICMD_F2D              141
+       1,
+#define JAVA_D2I              142
+#define ICMD_D2I              142
+       1,
+#define JAVA_D2L              143
+#define ICMD_D2L              143
+       1,
+#define JAVA_D2F              144
+#define ICMD_D2F              144
+       1,
+#define JAVA_INT2BYTE         145
+#define ICMD_INT2BYTE         145
+       1,
+#define JAVA_INT2CHAR         146
+#define ICMD_INT2CHAR         146
+       1,
+#define JAVA_INT2SHORT        147
+#define ICMD_INT2SHORT        147
+       1,
+#define JAVA_LCMP             148
+#define ICMD_LCMP             148
+       1,
+#define JAVA_FCMPL            149
+#define ICMD_FCMPL            149
+       1,
+#define JAVA_FCMPG            150
+#define ICMD_FCMPG            150
+       1,
+#define JAVA_DCMPL            151
+#define ICMD_DCMPL            151
+       1,
+#define JAVA_DCMPG            152
+#define ICMD_DCMPG            152
+       1,
+#define JAVA_IFEQ             153
+#define ICMD_IFEQ             153       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFNE             154
+#define ICMD_IFNE             154       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFLT             155
+#define ICMD_IFLT             155       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFGE             156
+#define ICMD_IFGE             156       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFGT             157
+#define ICMD_IFGT             157       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFLE             158
+#define ICMD_IFLE             158       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IF_ICMPEQ        159
+#define ICMD_IF_ICMPEQ        159       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPNE        160
+#define ICMD_IF_ICMPNE        160       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPLT        161
+#define ICMD_IF_ICMPLT        161       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPGE        162
+#define ICMD_IF_ICMPGE        162       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPGT        163
+#define ICMD_IF_ICMPGT        163       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPLE        164
+#define ICMD_IF_ICMPLE        164       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ACMPEQ        165
+#define ICMD_IF_ACMPEQ        165       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ACMPNE        166
+#define ICMD_IF_ACMPNE        166       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_GOTO             167
+#define ICMD_GOTO             167       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_JSR              168
+#define ICMD_JSR              168       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_RET              169
+#define ICMD_RET              169       /* op1 = local variable               */
+       2,
+#define JAVA_TABLESWITCH      170
+#define ICMD_TABLESWITCH      170       /* val.a = pointer to s4 table        */
+       0,                                  /* length must be computed            */
+#define JAVA_LOOKUPSWITCH     171
+#define ICMD_LOOKUPSWITCH     171       /* val.a = pointer to s4 table        */
+       0,                                  /* length must be computed            */
+#define JAVA_IRETURN          172
+#define ICMD_IRETURN          172
+       1,
+#define JAVA_LRETURN          173
+#define ICMD_LRETURN          173
+       1,
+#define JAVA_FRETURN          174
+#define ICMD_FRETURN          174
+       1,
+#define JAVA_DRETURN          175
+#define ICMD_DRETURN          175
+       1,
+#define JAVA_ARETURN          176
+#define ICMD_ARETURN          176
+       1,
+#define JAVA_RETURN           177
+#define ICMD_RETURN           177
+       1,
+#define JAVA_GETSTATIC        178
+#define ICMD_GETSTATIC        178       /* op1 = type, val.a = field address  */
+       3,
+#define JAVA_PUTSTATIC        179
+#define ICMD_PUTSTATIC        179       /* op1 = type, val.a = field address  */
+       3,
+#define JAVA_GETFIELD         180
+#define ICMD_GETFIELD         180       /* op1 = type, val.i = field offset   */
+       3,
+#define JAVA_PUTFIELD         181
+#define ICMD_PUTFIELD         181       /* op1 = type, val.i = field offset   */
+       3,
+#define JAVA_INVOKEVIRTUAL    182
+#define ICMD_INVOKEVIRTUAL    182       /* val.a = method info pointer        */
+       3,
+#define JAVA_INVOKESPECIAL    183
+#define ICMD_INVOKESPECIAL    183       /* val.a = method info pointer        */
+       3,
+#define JAVA_INVOKESTATIC     184
+#define ICMD_INVOKESTATIC     184       /* val.a = method info pointer        */
+       3,
+#define JAVA_INVOKEINTERFACE  185
+#define ICMD_INVOKEINTERFACE  185       /* val.a = method info pointer        */
+       5,
+#define ICMD_CHECKASIZE       186       /*                                    */
+       1, /* unused */
+#define JAVA_NEW              187
+#define ICMD_NEW              187       /* op1 = 1, val.a = class pointer     */
+       3,
+#define JAVA_NEWARRAY         188
+#define ICMD_NEWARRAY         188       /* op1 = basic type                   */
+       2,
+#define JAVA_ANEWARRAY        189
+#define ICMD_ANEWARRAY        189       /* op1 = 0, val.a = array pointer     */
+       3,                                  /* op1 = 1, val.a = class pointer     */
+#define JAVA_ARRAYLENGTH      190
+#define ICMD_ARRAYLENGTH      190
+       1,
+#define JAVA_ATHROW           191
+#define ICMD_ATHROW           191
+       1,
+#define JAVA_CHECKCAST        192
+#define ICMD_CHECKCAST        192       /* op1 = 0, val.a = array pointer     */
+       3,                                  /* op1 = 1, val.a = class pointer     */
+#define JAVA_INSTANCEOF       193
+#define ICMD_INSTANCEOF       193       /* op1 = 0, val.a = array pointer     */
+       3,                                  /* op1 = 1, val.a = class pointer     */
+#define JAVA_MONITORENTER     194
+#define ICMD_MONITORENTER     194
+       1,
+#define JAVA_MONITOREXIT      195
+#define ICMD_MONITOREXIT      195
+       1,
+#define JAVA_WIDE             196
+       0, /* length must be computed */
+#define JAVA_MULTIANEWARRAY   197
+#define ICMD_MULTIANEWARRAY   197       /* op1 = dimension, val.a = array     */
+       4,                                  /* pointer                            */
+#define JAVA_IFNULL           198
+#define ICMD_IFNULL           198       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IFNONNULL        199
+#define ICMD_IFNONNULL        199       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_GOTO_W           200
+       5,
+#define JAVA_JSR_W            201
+       5,
+#define JAVA_BREAKPOINT       202
+       1,
+
+           1,1,1,1,1,1,1,1,            /* unused */
+       1,1,1,1,1,1,1,1,1,1,
+       1,1,1,1,1,1,1,1,1,1,
+       1,1,1,1,1,1,1,1,1,1,
+       1,1,1,1,1,1,1,1,1,1,
+       1,1,1,1,1
+};
+
+
+char *icmd_names[256] = {
+       "NOP          ", /*               0 */
+       "ACONST       ", /*               1 */
+       "NULLCHECKPOP ", /* ICONST_M1     2 */
+       "ICONST       ", /*               3 */
+       "IREM0X10001  ", /* ICONST_1      4 */
+       "IDIVPOW2     ", /* ICONST_2      5 */
+       "LDIVPOW2     ", /* ICONST_3      6 */
+       "UNDEF__7     ", /* ICONST_4      7 */
+       "LREM0X10001  ", /* ICONST_5      8 */
+       "LCONST       ", /*               9 */
+       "LCMPCONST    ", /* LCONST_1     10 */
+       "FCONST       ", /*              11 */
+       "UNDEF_12     ", /* FCONST_1     12 */
+       "ELSE_ICONST  ", /* FCONST_2     13 */
+       "DCONST       ", /*              14 */
+       "IFEQ_ICONST  ", /* DCONST_1     15 */
+       "IFNE_ICONST  ", /* BIPUSH       16 */
+       "IFLT_ICONST  ", /* SIPUSH       17 */
+       "IFGE_ICONST  ", /* LDC1         18 */
+       "IFGT_ICONST  ", /* LDC2         19 */
+       "IFLE_ICONST  ", /* LDC2W        20 */
+       "ILOAD        ", /*              21 */
+       "LLOAD        ", /*              22 */
+       "FLOAD        ", /*              23 */
+       "DLOAD        ", /*              24 */
+       "ALOAD        ", /*              25 */
+       "IADDCONST    ", /* ILOAD_0      26 */
+       "ISUBCONST    ", /* ILOAD_1      27 */
+       "IMULCONST    ", /* ILOAD_2      28 */
+       "IANDCONST    ", /* ILOAD_3      29 */
+       "IORCONST     ", /* LLOAD_0      30 */
+       "IXORCONST    ", /* LLOAD_1      31 */
+       "ISHLCONST    ", /* LLOAD_2      32 */
+       "ISHRCONST    ", /* LLOAD_3      33 */
+       "IUSHRCONST   ", /* FLOAD_0      34 */
+       "IREMPOW2     ", /* FLOAD_1      35 */
+       "LADDCONST    ", /* FLOAD_2      36 */
+       "LSUBCONST    ", /* FLOAD_3      37 */
+       "LMULCONST    ", /* DLOAD_0      38 */
+       "LANDCONST    ", /* DLOAD_1      39 */
+       "LORCONST     ", /* DLOAD_2      40 */
+       "LXORCONST    ", /* DLOAD_3      41 */
+       "LSHLCONST    ", /* ALOAD_0      42 */
+       "LSHRCONST    ", /* ALOAD_1      43 */
+       "LUSHRCONST   ", /* ALOAD_2      44 */
+       "LREMPOW2     ", /* ALOAD_3      45 */
+       "IALOAD       ", /*              46 */
+       "LALOAD       ", /*              47 */
+       "FALOAD       ", /*              48 */
+       "DALOAD       ", /*              49 */
+       "AALOAD       ", /*              50 */
+       "BALOAD       ", /*              51 */
+       "CALOAD       ", /*              52 */
+       "SALOAD       ", /*              53 */
+       "ISTORE       ", /*              54 */
+       "LSTORE       ", /*              55 */
+       "FSTORE       ", /*              56 */
+       "DSTORE       ", /*              57 */
+       "ASTORE       ", /*              58 */
+       "IF_LEQ       ", /* ISTORE_0     59 */
+       "IF_LNE       ", /* ISTORE_1     60 */
+       "IF_LLT       ", /* ISTORE_2     61 */
+       "IF_LGE       ", /* ISTORE_3     62 */
+       "IF_LGT       ", /* LSTORE_0     63 */
+       "IF_LLE       ", /* LSTORE_1     64 */
+       "IF_LCMPEQ    ", /* LSTORE_2     65 */
+       "IF_LCMPNE    ", /* LSTORE_3     66 */
+       "IF_LCMPLT    ", /* FSTORE_0     67 */
+       "IF_LCMPGE    ", /* FSTORE_1     68 */
+       "IF_LCMPGT    ", /* FSTORE_2     69 */
+       "IF_LCMPLE    ", /* FSTORE_3     70 */
+       "UNDEF_71     ", /* DSTORE_0     71 */
+       "UNDEF_72     ", /* DSTORE_1     72 */
+       "UNDEF_73     ", /* DSTORE_2     73 */
+       "UNDEF_74     ", /* DSTORE_3     74 */
+       "UNDEF_75     ", /* ASTORE_0     75 */
+       "UNDEF_76     ", /* ASTORE_1     76 */
+       "UNDEF_77     ", /* ASTORE_2     77 */
+       "UNDEF_78     ", /* ASTORE_3     78 */
+       "IASTORE      ", /*              79 */
+       "LASTORE      ", /*              80 */
+       "FASTORE      ", /*              81 */
+       "DASTORE      ", /*              82 */
+       "AASTORE      ", /*              83 */
+       "BASTORE      ", /*              84 */
+       "CASTORE      ", /*              85 */
+       "SASTORE      ", /*              86 */
+       "POP          ", /*              87 */
+       "POP2         ", /*              88 */
+       "DUP          ", /*              89 */
+       "DUP_X1       ", /*              90 */
+       "DUP_X2       ", /*              91 */
+       "DUP2         ", /*              92 */
+       "DUP2_X1      ", /*              93 */
+       "DUP2_X2      ", /*              94 */
+       "SWAP         ", /*              95 */
+       "IADD         ", /*              96 */
+       "LADD         ", /*              97 */
+       "FADD         ", /*              98 */
+       "DADD         ", /*              99 */
+       "ISUB         ", /*             100 */
+       "LSUB         ", /*             101 */
+       "FSUB         ", /*             102 */
+       "DSUB         ", /*             103 */
+       "IMUL         ", /*             104 */
+       "LMUL         ", /*             105 */
+       "FMUL         ", /*             106 */
+       "DMUL         ", /*             107 */
+       "IDIV         ", /*             108 */
+       "LDIV         ", /*             109 */
+       "FDIV         ", /*             110 */
+       "DDIV         ", /*             111 */
+       "IREM         ", /*             112 */
+       "LREM         ", /*             113 */
+       "FREM         ", /*             114 */
+       "DREM         ", /*             115 */
+       "INEG         ", /*             116 */
+       "LNEG         ", /*             117 */
+       "FNEG         ", /*             118 */
+       "DNEG         ", /*             119 */
+       "ISHL         ", /*             120 */
+       "LSHL         ", /*             121 */
+       "ISHR         ", /*             122 */
+       "LSHR         ", /*             123 */
+       "IUSHR        ", /*             124 */
+       "LUSHR        ", /*             125 */
+       "IAND         ", /*             126 */
+       "LAND         ", /*             127 */
+       "IOR          ", /*             128 */
+       "LOR          ", /*             129 */
+       "IXOR         ", /*             130 */
+       "LXOR         ", /*             131 */
+       "IINC         ", /*             132 */
+       "I2L          ", /*             133 */
+       "I2F          ", /*             134 */
+       "I2D          ", /*             135 */
+       "L2I          ", /*             136 */
+       "L2F          ", /*             137 */
+       "L2D          ", /*             138 */
+       "F2I          ", /*             139 */
+       "F2L          ", /*             140 */
+       "F2D          ", /*             141 */
+       "D2I          ", /*             142 */
+       "D2L          ", /*             143 */
+       "D2F          ", /*             144 */
+       "INT2BYTE     ", /*             145 */
+       "INT2CHAR     ", /*             146 */
+       "INT2SHORT    ", /*             147 */
+       "LCMP         ", /*             148 */
+       "FCMPL        ", /*             149 */
+       "FCMPG        ", /*             150 */
+       "DCMPL        ", /*             151 */
+       "DCMPG        ", /*             152 */
+       "IFEQ         ", /*             153 */
+       "IFNE         ", /*             154 */
+       "IFLT         ", /*             155 */
+       "IFGE         ", /*             156 */
+       "IFGT         ", /*             157 */
+       "IFLE         ", /*             158 */
+       "IF_ICMPEQ    ", /*             159 */
+       "IF_ICMPNE    ", /*             160 */
+       "IF_ICMPLT    ", /*             161 */
+       "IF_ICMPGE    ", /*             162 */
+       "IF_ICMPGT    ", /*             163 */
+       "IF_ICMPLE    ", /*             164 */
+       "IF_ACMPEQ    ", /*             165 */
+       "IF_ACMPNE    ", /*             166 */
+       "GOTO         ", /*             167 */
+       "JSR          ", /*             168 */
+       "RET          ", /*             169 */
+       "TABLESWITCH  ", /*             170 */
+       "LOOKUPSWITCH ", /*             171 */
+       "IRETURN      ", /*             172 */
+       "LRETURN      ", /*             173 */
+       "FRETURN      ", /*             174 */
+       "DRETURN      ", /*             175 */
+       "ARETURN      ", /*             176 */
+       "RETURN       ", /*             177 */
+       "GETSTATIC    ", /*             178 */
+       "PUTSTATIC    ", /*             179 */
+       "GETFIELD     ", /*             180 */
+       "PUTFIELD     ", /*             181 */
+       "INVOKEVIRTUAL", /*             182 */
+       "INVOKESPECIAL", /*             183 */
+       "INVOKESTATIC ", /*             184 */
+       "INVOKEINTERFACE",/*            185 */
+       "CHECKASIZE   ", /* UNDEF186    186 */
+       "NEW          ", /*             187 */
+       "NEWARRAY     ", /*             188 */
+       "ANEWARRAY    ", /*             189 */
+       "ARRAYLENGTH  ", /*             190 */
+       "ATHROW       ", /*             191 */
+       "CHECKCAST    ", /*             192 */
+       "INSTANCEOF   ", /*             193 */
+       "MONITORENTER ", /*             194 */
+       "MONITOREXIT  ", /*             195 */
+       "UNDEF196     ", /* WIDE        196 */
+       "MULTIANEWARRAY",/*             197 */
+       "IFNULL       ", /*             198 */
+       "IFNONNULL    ", /*             199 */
+       "UNDEF200     ", /* GOTO_W      200 */
+       "UNDEF201     ", /* JSR_W       201 */
+       "UNDEF202     ", /* BREAKPOINT  202 */
+
+                             "UNDEF203","UNDEF204","UNDEF205",
+       "UNDEF206","UNDEF207","UNDEF208","UNDEF209","UNDEF210",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF216","UNDEF217","UNDEF218","UNDEF219","UNDEF220",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF226","UNDEF227","UNDEF228","UNDEF229","UNDEF230",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
+       "UNDEF251","UNDEF252",
+
+       "BUILTIN3     ", /*             253 */
+       "BUILTIN2     ", /*             254 */
+       "BUILTIN1     "  /*             255 */
+};
+
+
+char *opcode_names[256] = {
+       "NOP          ", /*               0 */
+       "ACONST       ", /*               1 */
+       "ICONST_M1    ", /* ICONST_M1     2 */
+       "ICONST_0     ", /* ICONST_0      3 */
+       "ICONST_1     ", /* ICONST_1      4 */
+       "ICONST_2     ", /* ICONST_2      5 */
+       "ICONST_3     ", /* ICONST_3      6 */
+       "ICONST_4     ", /* ICONST_4      7 */
+       "ICONST_5     ", /* ICONST_5      8 */
+       "LCONST_0     ", /* LCONST_0      9 */
+       "LCONST_1     ", /* LCONST_1     10 */
+       "FCONST_0     ", /* FCONST_0     11 */
+       "FCONST_1     ", /* FCONST_1     12 */
+       "FCONST_2     ", /* FCONST_2     13 */
+       "DCONST_0     ", /* DCONST_0     14 */
+       "DCONST_1     ", /* DCONST_1     15 */
+       "BIPUSH       ", /* BIPUSH       16 */
+       "SIPUSH       ", /* SIPUSH       17 */
+       "LDC          ", /* LDC          18 */
+       "LDC_W        ", /* LDC_W        19 */
+       "LDC2_W       ", /* LDC2_W       20 */
+       "ILOAD        ", /*              21 */
+       "LLOAD        ", /*              22 */
+       "FLOAD        ", /*              23 */
+       "DLOAD        ", /*              24 */
+       "ALOAD        ", /*              25 */
+       "ILOAD_0      ", /* ILOAD_0      26 */
+       "ILOAD_1      ", /* ILOAD_1      27 */
+       "ILOAD_2      ", /* ILOAD_2      28 */
+       "ILOAD_3      ", /* ILOAD_3      29 */
+       "LLOAD_0      ", /* LLOAD_0      30 */
+       "LLOAD_1      ", /* LLOAD_1      31 */
+       "LLOAD_2      ", /* LLOAD_2      32 */
+       "LLOAD_3      ", /* LLOAD_3      33 */
+       "FLOAD_0      ", /* FLOAD_0      34 */
+       "FLOAD_1      ", /* FLOAD_1      35 */
+       "FLOAD_2      ", /* FLOAD_2      36 */
+       "FLOAD_3      ", /* FLOAD_3      37 */
+       "DLOAD_0      ", /* DLOAD_0      38 */
+       "DLOAD_1      ", /* DLOAD_1      39 */
+       "DLOAD_2      ", /* DLOAD_2      40 */ 
+       "DLOAD_3      ", /* DLOAD_3      41 */
+       "ALOAD_0      ", /* ALOAD_0      42 */
+       "ALOAD_1      ", /* ALOAD_1      43 */
+       "ALOAD_2      ", /* ALOAD_2      44 */
+       "ALOAD_3      ", /* ALOAD_3      45 */
+       "IALOAD       ", /*              46 */
+       "LALOAD       ", /*              47 */
+       "FALOAD       ", /*              48 */
+       "DALOAD       ", /*              49 */
+       "AALOAD       ", /*              50 */
+       "BALOAD       ", /*              51 */
+       "CALOAD       ", /*              52 */
+       "SALOAD       ", /*              53 */
+       "ISTORE       ", /*              54 */
+       "LSTORE       ", /*              55 */
+       "FSTORE       ", /*              56 */
+       "DSTORE       ", /*              57 */
+       "ASTORE       ", /*              58 */
+       "ISTORE_0     ", /* ISTORE_0     59 */
+       "ISTORE_1     ", /* ISTORE_1     60 */
+       "ISTORE_2     ", /* ISTORE_2     61 */
+       "ISTORE_3     ", /* ISTORE_3     62 */
+       "LSTORE_0     ", /* LSTORE_0     63 */
+       "LSTORE_1     ", /* LSTORE_1     64 */
+       "LSTORE_2     ", /* LSTORE_2     65 */
+       "LSTORE_3     ", /* LSTORE_3     66 */
+       "FSTORE_0     ", /* FSTORE_0     67 */
+       "FSTORE_1     ", /* FSTORE_1     68 */
+       "FSTORE_2     ", /* FSTORE_2     69 */
+       "FSTORE_3     ", /* FSTORE_3     70 */
+       "DSTORE_0     ", /* DSTORE_0     71 */
+       "DSTORE_1     ", /* DSTORE_1     72 */
+       "DSTORE_2     ", /* DSTORE_2     73 */
+       "DSTORE_3     ", /* DSTORE_3     74 */
+       "ASTORE_0     ", /* ASTORE_0     75 */
+       "ASTORE_1     ", /* ASTORE_1     76 */
+       "ASTORE_2     ", /* ASTORE_2     77 */
+       "ASTORE_3     ", /* ASTORE_3     78 */
+       "IASTORE      ", /*              79 */
+       "LASTORE      ", /*              80 */
+       "FASTORE      ", /*              81 */
+       "DASTORE      ", /*              82 */
+       "AASTORE      ", /*              83 */
+       "BASTORE      ", /*              84 */
+       "CASTORE      ", /*              85 */
+       "SASTORE      ", /*              86 */
+       "POP          ", /*              87 */
+       "POP2         ", /*              88 */
+       "DUP          ", /*              89 */
+       "DUP_X1       ", /*              90 */
+       "DUP_X2       ", /*              91 */
+       "DUP2         ", /*              92 */
+       "DUP2_X1      ", /*              93 */
+       "DUP2_X2      ", /*              94 */
+       "SWAP         ", /*              95 */
+       "IADD         ", /*              96 */
+       "LADD         ", /*              97 */
+       "FADD         ", /*              98 */
+       "DADD         ", /*              99 */
+       "ISUB         ", /*             100 */
+       "LSUB         ", /*             101 */
+       "FSUB         ", /*             102 */
+       "DSUB         ", /*             103 */
+       "IMUL         ", /*             104 */
+       "LMUL         ", /*             105 */
+       "FMUL         ", /*             106 */
+       "DMUL         ", /*             107 */
+       "IDIV         ", /*             108 */
+       "LDIV         ", /*             109 */
+       "FDIV         ", /*             110 */
+       "DDIV         ", /*             111 */
+       "IREM         ", /*             112 */
+       "LREM         ", /*             113 */
+       "FREM         ", /*             114 */
+       "DREM         ", /*             115 */
+       "INEG         ", /*             116 */
+       "LNEG         ", /*             117 */
+       "FNEG         ", /*             118 */
+       "DNEG         ", /*             119 */
+       "ISHL         ", /*             120 */
+       "LSHL         ", /*             121 */
+       "ISHR         ", /*             122 */
+       "LSHR         ", /*             123 */
+       "IUSHR        ", /*             124 */
+       "LUSHR        ", /*             125 */
+       "IAND         ", /*             126 */
+       "LAND         ", /*             127 */
+       "IOR          ", /*             128 */
+       "LOR          ", /*             129 */
+       "IXOR         ", /*             130 */
+       "LXOR         ", /*             131 */
+       "IINC         ", /*             132 */
+       "I2L          ", /*             133 */
+       "I2F          ", /*             134 */
+       "I2D          ", /*             135 */
+       "L2I          ", /*             136 */
+       "L2F          ", /*             137 */
+       "L2D          ", /*             138 */
+       "F2I          ", /*             139 */
+       "F2L          ", /*             140 */
+       "F2D          ", /*             141 */
+       "D2I          ", /*             142 */
+       "D2L          ", /*             143 */
+       "D2F          ", /*             144 */
+       "INT2BYTE     ", /*             145 */
+       "INT2CHAR     ", /*             146 */
+       "INT2SHORT    ", /*             147 */
+       "LCMP         ", /*             148 */
+       "FCMPL        ", /*             149 */
+       "FCMPG        ", /*             150 */
+       "DCMPL        ", /*             151 */
+       "DCMPG        ", /*             152 */
+       "IFEQ         ", /*             153 */
+       "IFNE         ", /*             154 */
+       "IFLT         ", /*             155 */
+       "IFGE         ", /*             156 */
+       "IFGT         ", /*             157 */
+       "IFLE         ", /*             158 */
+       "IF_ICMPEQ    ", /*             159 */
+       "IF_ICMPNE    ", /*             160 */
+       "IF_ICMPLT    ", /*             161 */
+       "IF_ICMPGE    ", /*             162 */
+       "IF_ICMPGT    ", /*             163 */
+       "IF_ICMPLE    ", /*             164 */
+       "IF_ACMPEQ    ", /*             165 */
+       "IF_ACMPNE    ", /*             166 */
+       "GOTO         ", /*             167 */
+       "JSR          ", /*             168 */
+       "RET          ", /*             169 */
+       "TABLESWITCH  ", /*             170 */
+       "LOOKUPSWITCH ", /*             171 */
+       "IRETURN      ", /*             172 */
+       "LRETURN      ", /*             173 */
+       "FRETURN      ", /*             174 */
+       "DRETURN      ", /*             175 */
+       "ARETURN      ", /*             176 */
+       "RETURN       ", /*             177 */
+       "GETSTATIC    ", /*             178 */
+       "PUTSTATIC    ", /*             179 */
+       "GETFIELD     ", /*             180 */
+       "PUTFIELD     ", /*             181 */
+       "INVOKEVIRTUAL", /*             182 */
+       "INVOKESPECIAL", /*             183 */
+       "INVOKESTATIC ", /*             184 */
+       "INVOKEINTERFACE",/*            185 */
+       "CHECKASIZE   ", /* UNDEF186    186 */
+       "NEW          ", /*             187 */
+       "NEWARRAY     ", /*             188 */
+       "ANEWARRAY    ", /*             189 */
+       "ARRAYLENGTH  ", /*             190 */
+       "ATHROW       ", /*             191 */
+       "CHECKCAST    ", /*             192 */
+       "INSTANCEOF   ", /*             193 */
+       "MONITORENTER ", /*             194 */
+       "MONITOREXIT  ", /*             195 */
+       "WIDE         ", /* WIDE        196 */
+       "MULTIANEWARRAY",/*             197 */
+       "IFNULL       ", /*             198 */
+       "IFNONNULL    ", /*             199 */
+       "GOTO_W       ", /* GOTO_W      200 */
+       "JSR_W        ", /* JSR_W       201 */
+       "BREAKPOINT   ", /* BREAKPOINT  202 */
+
+                             "UNDEF203","UNDEF204","UNDEF205",
+       "UNDEF206","UNDEF207","UNDEF208","UNDEF209","UNDEF210",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF216","UNDEF217","UNDEF218","UNDEF219","UNDEF220",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF226","UNDEF227","UNDEF228","UNDEF229","UNDEF230",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
+       "UNDEF251","UNDEF252",
+
+       "BUILTIN3     ", /*             253 */
+       "BUILTIN2     ", /*             254 */
+       "BUILTIN1     "  /*             255 */
+};
+
+
+/* include compiler subsystems ************************************************/
+
+/* from codegen.inc */
+extern int dseglen;
+
+
+/* dummy function, used when there is no JavaVM code available                */
+
+static void* do_nothing_function()
+{
+       return NULL;
+}
+
+
+/* jit_compile *****************************************************************
+
+       jit_compile, new version of compiler, translates one method to machine code
+
+*******************************************************************************/
+
+methodptr jit_compile(methodinfo *m)
+{
+       int dumpsize;
+       long starttime = 0;
+       long stoptime  = 0;
+
+       count_jit_calls++;
+
+       /* if method has been already compiled return immediately */
+
+       if (m->entrypoint)
+               return m->entrypoint;
+
+       count_methods++;
+
+       intsDisable();      /* disable interrupts */
+       
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size ();
+
+       /* measure time */
+
+       if (getcompilingtime)
+               starttime = getcputime();
+
+       /* if there is no javacode print error message and return empty method    */
+
+       if (!m->jcode) {
+               sprintf(logtext, "No code given for: ");
+               utf_sprint(logtext+strlen(logtext), m->class->name);
+               strcpy(logtext+strlen(logtext), ".");
+               utf_sprint(logtext+strlen(logtext), m->name);
+               utf_sprint(logtext+strlen(logtext), m->descriptor);
+               dolog();
+               intsRestore();                             /* enable interrupts again */
+               return (methodptr) do_nothing_function;    /* return empty method     */
+       }
+
+       /* print log message for compiled method */
+
+       if (compileverbose) {
+               sprintf(logtext, "Compiling: ");
+               utf_sprint(logtext+strlen(logtext), m->class->name);
+               strcpy(logtext+strlen(logtext), ".");
+               utf_sprint(logtext+strlen(logtext), m->name);
+               utf_sprint(logtext+strlen(logtext), m->descriptor);
+               dolog();
+       }
+
+
+       /* initialisation of variables and subsystems */
+
+       isleafmethod = true;
+
+       method = m;
+       class = m->class;
+       descriptor = m->descriptor;
+       maxstack = m->maxstack;
+       maxlocals = m->maxlocals;
+       jcodelength = m->jcodelength;
+       jcode = m->jcode;
+       exceptiontablelength = m->exceptiontablelength;
+       raw_extable = m->exceptiontable;
+
+#ifdef STATISTICS
+       count_tryblocks += exceptiontablelength;
+       count_javacodesize += jcodelength + 18;
+       count_javaexcsize += exceptiontablelength * POINTERSIZE;
+#endif
+
+       /* initialise parameter type descriptor */
+
+       descriptor2types(m);
+       mreturntype = m->returntype;
+       mparamcount = m->paramcount;
+       mparamtypes = m->paramtypes;
+
+       /* initialize class list with class the compiled method belongs to */
+
+       uninitializedclasses = chain_new(); 
+       compiler_addinitclass(m->class);
+
+
+       /* call the compiler passes ***********************************************/
+       
+       reg_init();
+
+       if (useinlining) inlining_init();
+
+       codegen_init();
+
+       parse();
+       analyse_stack();
+   
+       if (opt_loops) {
+               depthFirst();
+               analyseGraph();         
+               optimize_loops();
+       }
+   
+#ifdef SPECIALMEMUSE
+       preregpass();
+#endif
+
+       regalloc();
+       codegen();
+
+       /* intermediate and assembly code listings ********************************/
+               
+       if (showintermediate)
+               show_icmd_method();
+       else if (showdisassemble)
+               disassemble((void*) (m->mcode + dseglen), m->mcodelength - dseglen);
+
+       if (showddatasegment)
+               dseg_display((void*) (m->mcode));
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       /* measure time */
+
+       if (getcompilingtime) {
+               stoptime = getcputime();
+               compilingtime += (stoptime-starttime); 
+       }
+
+       /* initialize all used classes */
+       /* because of reentrant code global variables are not allowed here        */
+
+       {
+               chain *ul = uninitializedclasses;   /* list of uninitialized classes      */ 
+               classinfo *c;                       /* single class                       */
+
+               while ((c = chain_first(ul)) != NULL) {
+                       chain_remove (ul);
+                       class_init (c);                         /* may again call the compiler        */
+               }
+               chain_free (ul);
+       }
+
+       intsRestore();    /* enable interrupts again */
+
+       /* return pointer to the methods entry point */
+       
+       return m->entrypoint;
+} 
+
+
+
+/* functions for compiler initialisation and finalisation *********************/
+
+#ifdef USEBUILTINTABLE
+static int stdopcompare(const void *a, const void *b)
+{
+       stdopdescriptor *o1 = (stdopdescriptor *) a;
+       stdopdescriptor *o2 = (stdopdescriptor *) b;
+       return (o1->opcode < o2->opcode) ? -1 : (o1->opcode > o2->opcode);
+}
+
+
+
+static inline void testsort()
+{
+       int len;
+
+       len = sizeof(stdopdescriptortable) / sizeof(stdopdescriptor);
+       qsort(stdopdescriptortable, len, sizeof(stdopdescriptor), stdopcompare);
+       len = sizeof(builtintable) / sizeof(stdopdescriptor);
+       qsort(builtintable, len, sizeof(stdopdescriptor), stdopcompare);
+}
+#endif
+
+
+
+void jit_init()
+{
+       int i;
+
+#ifdef USEBUILTINTABLE
+       testsort();
+#endif
+
+#if defined(__ALPHA__)
+       has_ext_instr_set = ! has_no_x_instr_set();
+#endif
+
+       for (i = 0; i < 256; i++)
+               stackreq[i] = 1;
+
+       stackreq[JAVA_NOP]          = 0;
+       stackreq[JAVA_ISTORE]       = 0;
+       stackreq[JAVA_LSTORE]       = 0;
+       stackreq[JAVA_FSTORE]       = 0;
+       stackreq[JAVA_DSTORE]       = 0;
+       stackreq[JAVA_ASTORE]       = 0;
+       stackreq[JAVA_ISTORE_0]     = 0;
+       stackreq[JAVA_ISTORE_1]     = 0;
+       stackreq[JAVA_ISTORE_2]     = 0;
+       stackreq[JAVA_ISTORE_3]     = 0;
+       stackreq[JAVA_LSTORE_0]     = 0;
+       stackreq[JAVA_LSTORE_1]     = 0;
+       stackreq[JAVA_LSTORE_2]     = 0;
+       stackreq[JAVA_LSTORE_3]     = 0;
+       stackreq[JAVA_FSTORE_0]     = 0;
+       stackreq[JAVA_FSTORE_1]     = 0;
+       stackreq[JAVA_FSTORE_2]     = 0;
+       stackreq[JAVA_FSTORE_3]     = 0;
+       stackreq[JAVA_DSTORE_0]     = 0;
+       stackreq[JAVA_DSTORE_1]     = 0;
+       stackreq[JAVA_DSTORE_2]     = 0;
+       stackreq[JAVA_DSTORE_3]     = 0;
+       stackreq[JAVA_ASTORE_0]     = 0;
+       stackreq[JAVA_ASTORE_1]     = 0;
+       stackreq[JAVA_ASTORE_2]     = 0;
+       stackreq[JAVA_ASTORE_3]     = 0;
+       stackreq[JAVA_IASTORE]      = 0;
+       stackreq[JAVA_LASTORE]      = 0;
+       stackreq[JAVA_FASTORE]      = 0;
+       stackreq[JAVA_DASTORE]      = 0;
+       stackreq[JAVA_AASTORE]      = 0;
+       stackreq[JAVA_BASTORE]      = 0;
+       stackreq[JAVA_CASTORE]      = 0;
+       stackreq[JAVA_SASTORE]      = 0;
+       stackreq[JAVA_POP]          = 0;
+       stackreq[JAVA_POP2]         = 0;
+       stackreq[JAVA_IINC]         = 0;
+       stackreq[JAVA_IFEQ]         = 0;
+       stackreq[JAVA_IFNE]         = 0;
+       stackreq[JAVA_IFLT]         = 0;
+       stackreq[JAVA_IFGE]         = 0;
+       stackreq[JAVA_IFGT]         = 0;
+       stackreq[JAVA_IFLE]         = 0;
+       stackreq[JAVA_IF_ICMPEQ]    = 0;
+       stackreq[JAVA_IF_ICMPNE]    = 0;
+       stackreq[JAVA_IF_ICMPLT]    = 0;
+       stackreq[JAVA_IF_ICMPGE]    = 0;
+       stackreq[JAVA_IF_ICMPGT]    = 0;
+       stackreq[JAVA_IF_ICMPLE]    = 0;
+       stackreq[JAVA_IF_ACMPEQ]    = 0;
+       stackreq[JAVA_IF_ACMPNE]    = 0;
+       stackreq[JAVA_GOTO]         = 0;
+       stackreq[JAVA_RET]          = 0;
+       stackreq[JAVA_TABLESWITCH]  = 0;
+       stackreq[JAVA_LOOKUPSWITCH] = 0;
+       stackreq[JAVA_IRETURN]      = 0;
+       stackreq[JAVA_LRETURN]      = 0;
+       stackreq[JAVA_FRETURN]      = 0;
+       stackreq[JAVA_DRETURN]      = 0;
+       stackreq[JAVA_ARETURN]      = 0;
+       stackreq[JAVA_RETURN]       = 0;
+       stackreq[JAVA_PUTSTATIC]    = 0;
+       stackreq[JAVA_PUTFIELD]     = 0;
+       stackreq[JAVA_MONITORENTER] = 0;
+       stackreq[JAVA_MONITOREXIT]  = 0;
+       stackreq[JAVA_WIDE]         = 0;
+       stackreq[JAVA_IFNULL]       = 0;
+       stackreq[JAVA_IFNONNULL]    = 0;
+       stackreq[JAVA_GOTO_W]       = 0;
+       stackreq[JAVA_BREAKPOINT]   = 0;
+
+       stackreq[JAVA_SWAP] = 2;
+       stackreq[JAVA_DUP2] = 2;
+       stackreq[JAVA_DUP_X1] = 3;
+       stackreq[JAVA_DUP_X2] = 4;
+       stackreq[JAVA_DUP2_X1] = 3;
+       stackreq[JAVA_DUP2_X2] = 4;
+       
+       init_exceptions();
+}
+
+
+
+void jit_close()
+{
+       codegen_close();
+       reg_close();
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/jit.h b/jit/jit.h
new file mode 100644 (file)
index 0000000..f69a365
--- /dev/null
+++ b/jit/jit.h
@@ -0,0 +1,1024 @@
+/* jit/jit.h - code generation header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   Changes: Christian Thalinger
+
+   $Id: jit.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _JIT_H
+#define _JIT_H
+
+#include "global.h"
+#include "toolbox/chain.h"
+
+
+/**************************** resolve typedef-cycles **************************/
+
+typedef struct stackelement stackelement;
+typedef stackelement *stackptr;
+typedef struct basicblock basicblock;
+typedef struct instruction instruction;
+typedef struct subroutineinfo subroutineinfo;
+typedef struct varinfo varinfo;
+typedef struct branchref branchref;
+typedef struct jumpref jumpref;
+typedef struct dataref dataref;
+typedef varinfo *varinfoptr;
+
+
+/************************** stack element structure ***************************/
+
+/* slot types */
+
+#define TYPE_INT   0            /* the stack slot types must numbered in the  */
+#define TYPE_LNG   1            /* same order as the ICMD_Ixxx to ICMD_Axxx   */
+#define TYPE_FLT   2            /* instructions (LOAD and STORE)              */
+#define TYPE_DBL   3            /* integer, long, float, double, address      */
+#define TYPE_ADR   4
+
+#define IS_INT_LNG_TYPE(a)      (!((a)&TYPE_FLT))
+#define IS_FLT_DBL_TYPE(a)      ((a)&TYPE_FLT)
+#define IS_2_WORD_TYPE(a)       ((a)&TYPE_LNG)
+
+
+/* flags */
+
+#define SAVEDVAR   1            /* variable has to survive method invocations */
+#define INMEMORY   2            /* variable stored in memory                  */
+#define SAVEDTMP   4            /* temporary variable using a saved register  */
+
+/* variable kinds */
+
+#define UNDEFVAR   0            /* stack slot will become temp during regalloc*/
+#define TEMPVAR    1            /* stack slot is temp register                */
+#define STACKVAR   2            /* stack slot is numbered stack slot          */
+#define LOCALVAR   3            /* stack slot is local variable               */
+#define ARGVAR     4            /* stack slot is argument variable            */
+
+
+struct stackelement {
+       stackptr prev;              /* pointer to next element towards bottom     */
+       int type;                   /* slot type of stack element                 */
+       int flags;                  /* flags (SAVED, INMEMORY)                    */
+       int varkind;                /* kind of variable or register               */
+       int varnum;                 /* number of variable                         */
+       int regoff;                 /* register number or memory offset           */
+};
+
+
+/**************************** instruction structure ***************************/
+
+struct instruction {
+       stackptr dst;               /* stack index of destination operand stack   */
+       u2  opc;                    /* opcode of intermediate code command        */
+       s4  op1;                    /* first operand, usually variable number     */
+
+       union {
+               s4 i;                   /* integer operand    */
+               s8 l;                   /* long operand       */
+               float f;                /* float operand      */
+               double d;               /* double operand     */
+               void *a;                /* address operand    */
+       } val;                  /* immediate constant */
+
+       void *target;                           /* used for targets of branches and jumps         */
+                                                               /* and as address for list of targets for         */
+                                                               /* statements                                                             */
+};
+
+
+/**************************** basic block structure ***************************/
+/*                    flags                                                   */
+
+#define BBDELETED  -2
+#define BBUNDEF    -1
+#define BBREACHED  0
+#define BBFINISHED 1
+
+#define BBTYPE_STD 0            /* standard basic block type                  */
+#define BBTYPE_EXH 1            /* exception handler basic block type         */
+#define BBTYPE_SBR 2            /* subroutine basic block type                */
+
+struct basicblock { 
+       int          flags;         /* used during stack analysis, init with -1   */
+       int          type;          /* basic block type (std, xhandler, subroutine*/
+       instruction *iinstr;        /* pointer to intermediate code instructions  */
+       int          icount;        /* number of intermediate code instructions   */
+       int          mpc;           /* machine code pc at start of block          */
+       stackptr     instack;       /* stack at begin of basic block              */
+       stackptr     outstack;      /* stack at end of basic block                */
+       int          indepth;       /* stack depth at begin of basic block        */
+       int          outdepth;      /* stack depth end of basic block             */
+       int          pre_count;     /* count of predecessor basic blocks          */
+       branchref   *branchrefs;    /* list of branches to be patched             */
+
+       basicblock  *next;          /* used to build a BB list (instead of array) */
+       int          lflags;        /* used during loop copying, init with 0      */
+       basicblock  *copied_to;     /* points to the copy of this basic block     */
+                                /* when loop nodes are copied                 */
+       int debug_nr;
+};
+
+
+/************************* pseudo variable structure **************************/
+
+struct varinfo {
+       int type;                   /* basic type of variable                     */
+       int flags;                  /* flags (SAVED, INMEMORY)                    */
+       int regoff;                 /* register number or memory offset           */
+};
+
+typedef varinfo varinfo5[5];
+
+
+/***************** forward references in branch instructions ******************/
+
+struct branchref {
+       s4 branchpos;               /* patching position in code segment          */
+       branchref *next;            /* next element in branchref list             */
+};
+
+
+/******************** forward references in tables  ***************************/
+
+struct jumpref {
+       s4 tablepos;                /* patching position in data segment          */
+       basicblock *target;         /* target basic block                         */
+       jumpref *next;              /* next element in jumpref list               */
+};
+
+
+struct dataref {
+       u1 *pos;                    /* patching position in generated code        */
+       dataref *next;              /* next element in dataref list               */
+};
+
+
+/********** JavaVM operation codes (sorted) and instruction lengths ***********/
+
+extern char *icmd_names[256];
+extern char *opcode_names[256];
+extern int jcommandsize[256];
+
+#define JAVA_NOP               0
+#define ICMD_NOP               0
+
+#define JAVA_ACONST_NULL       1
+#define ICMD_ACONST            1        /* val.a = constant                   */
+
+#define JAVA_ICONST_M1         2
+#define ICMD_NULLCHECKPOP      2
+
+#define JAVA_ICONST_0          3
+#define ICMD_ICONST            3        /* val.i = constant                   */
+
+#define JAVA_ICONST_1          4
+#define ICMD_IREM0X10001       4
+
+#define JAVA_ICONST_2          5
+#define ICMD_IDIVPOW2          5        /* val.i = constant                   */
+
+#define JAVA_ICONST_3          6
+#define ICMD_LDIVPOW2          6        /* val.l = constant                   */
+
+#define JAVA_ICONST_4          7
+
+#define JAVA_ICONST_5          8
+#define ICMD_LREM0X10001       8
+
+#define JAVA_LCONST_0          9
+#define ICMD_LCONST            9        /* val.l = constant                   */
+
+#define JAVA_LCONST_1         10
+#define ICMD_LCMPCONST        10        /* val.l = constant                   */
+
+#define JAVA_FCONST_0         11
+#define ICMD_FCONST           11        /* val.f = constant                   */
+
+#define JAVA_FCONST_1         12
+
+#define JAVA_FCONST_2         13
+#define ICMD_ELSE_ICONST      13
+
+#define JAVA_DCONST_0         14
+#define ICMD_DCONST           14        /* val.d = constant                   */
+
+#define JAVA_DCONST_1         15
+#define ICMD_IFEQ_ICONST      15
+
+#define JAVA_BIPUSH           16
+#define ICMD_IFNE_ICONST      16
+
+#define JAVA_SIPUSH           17
+#define ICMD_IFLT_ICONST      17
+
+#define JAVA_LDC1             18
+#define ICMD_IFGE_ICONST      18
+
+#define JAVA_LDC2             19
+#define ICMD_IFGT_ICONST      19
+
+#define JAVA_LDC2W            20
+#define ICMD_IFLE_ICONST      20
+
+                                           /* order of LOAD instructions must be */
+                                           /* equal to order of TYPE_XXX defines */
+#define JAVA_ILOAD            21
+#define ICMD_ILOAD            21        /* op1 = local variable               */
+
+#define JAVA_LLOAD            22
+#define ICMD_LLOAD            22        /* op1 = local variable               */
+
+#define JAVA_FLOAD            23
+#define ICMD_FLOAD            23        /* op1 = local variable               */
+
+#define JAVA_DLOAD            24
+#define ICMD_DLOAD            24        /* op1 = local variable               */
+
+#define JAVA_ALOAD            25
+#define ICMD_ALOAD            25        /* op1 = local variable               */
+
+#define JAVA_ILOAD_0          26
+#define ICMD_IADDCONST        26        /* val.i = constant                   */
+
+#define JAVA_ILOAD_1          27
+#define ICMD_ISUBCONST        27        /* val.i = constant                   */
+
+#define JAVA_ILOAD_2          28
+#define ICMD_IMULCONST        28        /* val.i = constant                   */
+
+#define JAVA_ILOAD_3          29
+#define ICMD_IANDCONST        29        /* val.i = constant                   */
+
+#define JAVA_LLOAD_0          30
+#define ICMD_IORCONST         30        /* val.i = constant                   */
+
+#define JAVA_LLOAD_1          31
+#define ICMD_IXORCONST        31        /* val.i = constant                   */
+
+#define JAVA_LLOAD_2          32
+#define ICMD_ISHLCONST        32        /* val.i = constant                   */
+
+#define JAVA_LLOAD_3          33
+#define ICMD_ISHRCONST        33        /* val.i = constant                   */
+
+#define JAVA_FLOAD_0          34
+#define ICMD_IUSHRCONST       34        /* val.i = constant                   */
+
+#define JAVA_FLOAD_1          35
+#define ICMD_IREMPOW2         35        /* val.i = constant                   */
+
+#define JAVA_FLOAD_2          36
+#define ICMD_LADDCONST        36        /* val.l = constant                   */
+
+#define JAVA_FLOAD_3          37
+#define ICMD_LSUBCONST        37        /* val.l = constant                   */
+
+#define JAVA_DLOAD_0          38
+#define ICMD_LMULCONST        38        /* val.l = constant                   */
+
+#define JAVA_DLOAD_1          39
+#define ICMD_LANDCONST        39        /* val.l = constant                   */
+
+#define JAVA_DLOAD_2          40
+#define ICMD_LORCONST         40        /* val.l = constant                   */
+
+#define JAVA_DLOAD_3          41
+#define ICMD_LXORCONST        41        /* val.l = constant                   */
+
+#define JAVA_ALOAD_0          42
+#define ICMD_LSHLCONST        42        /* val.l = constant                   */
+
+#define JAVA_ALOAD_1          43
+#define ICMD_LSHRCONST        43        /* val.l = constant                   */
+
+#define JAVA_ALOAD_2          44
+#define ICMD_LUSHRCONST       44        /* val.l = constant                   */
+
+#define JAVA_ALOAD_3          45
+#define ICMD_LREMPOW2         45        /* val.l = constant                   */
+
+#define JAVA_IALOAD           46
+#define ICMD_IALOAD           46
+
+#define JAVA_LALOAD           47
+#define ICMD_LALOAD           47
+
+#define JAVA_FALOAD           48
+#define ICMD_FALOAD           48
+
+#define JAVA_DALOAD           49
+#define ICMD_DALOAD           49
+
+#define JAVA_AALOAD           50
+#define ICMD_AALOAD           50
+
+#define JAVA_BALOAD           51
+#define ICMD_BALOAD           51
+
+#define JAVA_CALOAD           52
+#define ICMD_CALOAD           52
+
+#define JAVA_SALOAD           53
+#define ICMD_SALOAD           53
+
+                                           /* order of STORE instructions must be*/
+                                           /* equal to order of TYPE_XXX defines */
+#define JAVA_ISTORE           54
+#define ICMD_ISTORE           54        /* op1 = local variable               */
+
+#define JAVA_LSTORE           55
+#define ICMD_LSTORE           55        /* op1 = local variable               */
+
+#define JAVA_FSTORE           56
+#define ICMD_FSTORE           56        /* op1 = local variable               */
+
+#define JAVA_DSTORE           57
+#define ICMD_DSTORE           57        /* op1 = local variable               */
+
+#define JAVA_ASTORE           58
+#define ICMD_ASTORE           58        /* op1 = local variable               */
+
+#define JAVA_ISTORE_0         59
+#define ICMD_IF_LEQ           59        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_ISTORE_1         60
+#define ICMD_IF_LNE           60        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_ISTORE_2         61
+#define ICMD_IF_LLT           61        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_ISTORE_3         62
+#define ICMD_IF_LGE           62        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_LSTORE_0         63
+#define ICMD_IF_LGT           63        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_LSTORE_1         64
+#define ICMD_IF_LLE           64        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_LSTORE_2         65
+#define ICMD_IF_LCMPEQ        65        /* op1 = target JavaVM pc             */
+
+#define JAVA_LSTORE_3         66
+#define ICMD_IF_LCMPNE        66        /* op1 = target JavaVM pc             */
+
+#define JAVA_FSTORE_0         67
+#define ICMD_IF_LCMPLT        67        /* op1 = target JavaVM pc             */
+
+#define JAVA_FSTORE_1         68
+#define ICMD_IF_LCMPGE        68        /* op1 = target JavaVM pc             */
+
+#define JAVA_FSTORE_2         69
+#define ICMD_IF_LCMPGT        69        /* op1 = target JavaVM pc             */
+
+#define JAVA_FSTORE_3         70
+#define ICMD_IF_LCMPLE        70        /* op1 = target JavaVM pc             */
+
+#define JAVA_DSTORE_0         71
+
+#define JAVA_DSTORE_1         72
+
+#define JAVA_DSTORE_2         73
+
+#define JAVA_DSTORE_3         74
+
+#define JAVA_ASTORE_0         75
+
+#define JAVA_ASTORE_1         76
+
+#define JAVA_ASTORE_2         77
+
+#define JAVA_ASTORE_3         78
+
+#define JAVA_IASTORE          79
+#define ICMD_IASTORE          79
+
+#define JAVA_LASTORE          80
+#define ICMD_LASTORE          80
+
+#define JAVA_FASTORE          81
+#define ICMD_FASTORE          81
+
+#define JAVA_DASTORE          82
+#define ICMD_DASTORE          82
+
+#define JAVA_AASTORE          83
+#define ICMD_AASTORE          83
+
+#define JAVA_BASTORE          84
+#define ICMD_BASTORE          84
+
+#define JAVA_CASTORE          85
+#define ICMD_CASTORE          85
+
+#define JAVA_SASTORE          86
+#define ICMD_SASTORE          86
+
+#define JAVA_POP              87
+#define ICMD_POP              87
+
+#define JAVA_POP2             88
+#define ICMD_POP2             88
+
+#define JAVA_DUP              89
+#define ICMD_DUP              89
+
+#define JAVA_DUP_X1           90
+#define ICMD_DUP_X1           90
+
+#define JAVA_DUP_X2           91
+#define ICMD_DUP_X2           91
+
+#define JAVA_DUP2             92
+#define ICMD_DUP2             92
+
+#define JAVA_DUP2_X1          93
+#define ICMD_DUP2_X1          93
+
+#define JAVA_DUP2_X2          94
+#define ICMD_DUP2_X2          94
+
+#define JAVA_SWAP             95
+#define ICMD_SWAP             95
+
+#define JAVA_IADD             96
+#define ICMD_IADD             96
+
+#define JAVA_LADD             97
+#define ICMD_LADD             97
+
+#define JAVA_FADD             98
+#define ICMD_FADD             98
+
+#define JAVA_DADD             99
+#define ICMD_DADD             99
+
+#define JAVA_ISUB             100
+#define ICMD_ISUB             100
+
+#define JAVA_LSUB             101
+#define ICMD_LSUB             101
+
+#define JAVA_FSUB             102
+#define ICMD_FSUB             102
+
+#define JAVA_DSUB             103
+#define ICMD_DSUB             103
+
+#define JAVA_IMUL             104
+#define ICMD_IMUL             104
+
+#define JAVA_LMUL             105
+#define ICMD_LMUL             105
+
+#define JAVA_FMUL             106
+#define ICMD_FMUL             106
+
+#define JAVA_DMUL             107
+#define ICMD_DMUL             107
+
+#define JAVA_IDIV             108
+#define ICMD_IDIV             108
+
+#define JAVA_LDIV             109
+#define ICMD_LDIV             109
+
+#define JAVA_FDIV             110
+#define ICMD_FDIV             110
+
+#define JAVA_DDIV             111
+#define ICMD_DDIV             111
+
+#define JAVA_IREM             112
+#define ICMD_IREM             112
+
+#define JAVA_LREM             113
+#define ICMD_LREM             113
+
+#define JAVA_FREM             114
+#define ICMD_FREM             114
+
+#define JAVA_DREM             115
+#define ICMD_DREM             115
+
+#define JAVA_INEG             116
+#define ICMD_INEG             116
+
+#define JAVA_LNEG             117
+#define ICMD_LNEG             117
+
+#define JAVA_FNEG             118
+#define ICMD_FNEG             118
+
+#define JAVA_DNEG             119
+#define ICMD_DNEG             119
+
+#define JAVA_ISHL             120
+#define ICMD_ISHL             120
+
+#define JAVA_LSHL             121
+#define ICMD_LSHL             121
+
+#define JAVA_ISHR             122
+#define ICMD_ISHR             122
+
+#define JAVA_LSHR             123
+#define ICMD_LSHR             123
+
+#define JAVA_IUSHR            124
+#define ICMD_IUSHR            124
+
+#define JAVA_LUSHR            125
+#define ICMD_LUSHR            125
+
+#define JAVA_IAND             126
+#define ICMD_IAND             126
+
+#define JAVA_LAND             127
+#define ICMD_LAND             127
+
+#define JAVA_IOR              128
+#define ICMD_IOR              128
+
+#define JAVA_LOR              129
+#define ICMD_LOR              129
+
+#define JAVA_IXOR             130
+#define ICMD_IXOR             130
+
+#define JAVA_LXOR             131
+#define ICMD_LXOR             131
+
+#define JAVA_IINC             132
+#define ICMD_IINC             132   /* op1 = local variable, val.i = constant */
+
+#define JAVA_I2L              133
+#define ICMD_I2L              133
+
+#define JAVA_I2F              134
+#define ICMD_I2F              134
+
+#define JAVA_I2D              135
+#define ICMD_I2D              135
+
+#define JAVA_L2I              136
+#define ICMD_L2I              136
+
+#define JAVA_L2F              137
+#define ICMD_L2F              137
+
+#define JAVA_L2D              138
+#define ICMD_L2D              138
+
+#define JAVA_F2I              139
+#define ICMD_F2I              139
+
+#define JAVA_F2L              140
+#define ICMD_F2L              140
+
+#define JAVA_F2D              141
+#define ICMD_F2D              141
+
+#define JAVA_D2I              142
+#define ICMD_D2I              142
+
+#define JAVA_D2L              143
+#define ICMD_D2L              143
+
+#define JAVA_D2F              144
+#define ICMD_D2F              144
+
+#define JAVA_INT2BYTE         145
+#define ICMD_INT2BYTE         145
+
+#define JAVA_INT2CHAR         146
+#define ICMD_INT2CHAR         146
+
+#define JAVA_INT2SHORT        147
+#define ICMD_INT2SHORT        147
+
+#define JAVA_LCMP             148
+#define ICMD_LCMP             148
+
+#define JAVA_FCMPL            149
+#define ICMD_FCMPL            149
+
+#define JAVA_FCMPG            150
+#define ICMD_FCMPG            150
+
+#define JAVA_DCMPL            151
+#define ICMD_DCMPL            151
+
+#define JAVA_DCMPG            152
+#define ICMD_DCMPG            152
+
+#define JAVA_IFEQ             153
+#define ICMD_IFEQ             153       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFNE             154
+#define ICMD_IFNE             154       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFLT             155
+#define ICMD_IFLT             155       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFGE             156
+#define ICMD_IFGE             156       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFGT             157
+#define ICMD_IFGT             157       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFLE             158
+#define ICMD_IFLE             158       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IF_ICMPEQ        159
+#define ICMD_IF_ICMPEQ        159       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPNE        160
+#define ICMD_IF_ICMPNE        160       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPLT        161
+#define ICMD_IF_ICMPLT        161       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPGE        162
+#define ICMD_IF_ICMPGE        162       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPGT        163
+#define ICMD_IF_ICMPGT        163       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPLE        164
+#define ICMD_IF_ICMPLE        164       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ACMPEQ        165
+#define ICMD_IF_ACMPEQ        165       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ACMPNE        166
+#define ICMD_IF_ACMPNE        166       /* op1 = target JavaVM pc             */
+
+#define JAVA_GOTO             167
+#define ICMD_GOTO             167       /* op1 = target JavaVM pc             */
+
+#define JAVA_JSR              168
+#define ICMD_JSR              168       /* op1 = target JavaVM pc             */
+
+#define JAVA_RET              169
+#define ICMD_RET              169       /* op1 = local variable               */
+
+#define JAVA_TABLESWITCH      170
+#define ICMD_TABLESWITCH      170       /* val.a = pointer to s4 table        */
+                                        /* length must be computed            */
+#define JAVA_LOOKUPSWITCH     171
+#define ICMD_LOOKUPSWITCH     171       /* val.a = pointer to s4 table        */
+                                        /* length must be computed            */
+#define JAVA_IRETURN          172
+#define ICMD_IRETURN          172
+
+#define JAVA_LRETURN          173
+#define ICMD_LRETURN          173
+
+#define JAVA_FRETURN          174
+#define ICMD_FRETURN          174
+
+#define JAVA_DRETURN          175
+#define ICMD_DRETURN          175
+
+#define JAVA_ARETURN          176
+#define ICMD_ARETURN          176
+
+#define JAVA_RETURN           177
+#define ICMD_RETURN           177
+
+#define JAVA_GETSTATIC        178
+#define ICMD_GETSTATIC        178       /* op1 = type, val.a = field address  */
+
+#define JAVA_PUTSTATIC        179
+#define ICMD_PUTSTATIC        179       /* op1 = type, val.a = field address  */
+
+#define JAVA_GETFIELD         180
+#define ICMD_GETFIELD         180       /* op1 = type, val.i = field offset   */
+
+#define JAVA_PUTFIELD         181
+#define ICMD_PUTFIELD         181       /* op1 = type, val.i = field offset   */
+
+#define JAVA_INVOKEVIRTUAL    182
+#define ICMD_INVOKEVIRTUAL    182       /* val.a = method info pointer        */
+
+#define JAVA_INVOKESPECIAL    183
+#define ICMD_INVOKESPECIAL    183       /* val.a = method info pointer        */
+
+#define JAVA_INVOKESTATIC     184
+#define ICMD_INVOKESTATIC     184       /* val.a = method info pointer        */
+
+#define JAVA_INVOKEINTERFACE  185
+#define ICMD_INVOKEINTERFACE  185       /* val.a = method info pointer        */
+
+#define ICMD_CHECKASIZE       186       /*                                    */
+
+#define JAVA_NEW              187
+#define ICMD_NEW              187       /* op1 = 1, val.a = class pointer     */
+
+#define JAVA_NEWARRAY         188
+#define ICMD_NEWARRAY         188       /* op1 = basic type                   */
+
+#define JAVA_ANEWARRAY        189
+#define ICMD_ANEWARRAY        189       /* op1 = 0, val.a = array pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
+#define JAVA_ARRAYLENGTH      190
+#define ICMD_ARRAYLENGTH      190
+
+#define JAVA_ATHROW           191
+#define ICMD_ATHROW           191
+
+#define JAVA_CHECKCAST        192
+#define ICMD_CHECKCAST        192       /* op1 = 0, val.a = array pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
+#define JAVA_INSTANCEOF       193
+#define ICMD_INSTANCEOF       193       /* op1 = 0, val.a = array pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
+#define JAVA_MONITORENTER     194
+#define ICMD_MONITORENTER     194
+
+#define JAVA_MONITOREXIT      195
+#define ICMD_MONITOREXIT      195
+
+#define JAVA_WIDE             196
+
+#define JAVA_MULTIANEWARRAY   197
+#define ICMD_MULTIANEWARRAY   197       /* op1 = dimension, val.a = array     */
+                                        /* pointer                            */
+#define JAVA_IFNULL           198
+#define ICMD_IFNULL           198       /* op1 = target JavaVM pc             */
+
+#define JAVA_IFNONNULL        199
+#define ICMD_IFNONNULL        199       /* op1 = target JavaVM pc             */
+
+#define JAVA_GOTO_W           200
+
+#define JAVA_JSR_W            201
+
+#define JAVA_BREAKPOINT       202
+
+
+#define ICMD_BUILTIN3         253       /* internal opcode */
+#define ICMD_BUILTIN2         254       /* internal opcode */
+#define ICMD_BUILTIN1         255       /* internal opcode */
+#define ICMD_READONLY_ARG     1024      /* used for inlining, opcodes 1024-1028 are used */
+#define ICMD_CLEAR_ARGREN     1029      /* indicates the start of a new inlined method argument renaming must be reset */
+
+
+/******************* description of JavaVM instructions ***********************/
+
+#if defined(USEBUILTINTABLE)
+typedef struct {
+       u1 opcode;
+       u1 type_s1;
+       u1 type_s2;
+       u1 type_d;      
+       int icmd;
+       functionptr builtin;
+       bool supported;
+       bool isfloat;
+} stdopdescriptor;
+
+static stdopdescriptor builtintable[] = {
+       { ICMD_LCMP,   TYPE_LONG, TYPE_LONG, TYPE_INT, ICMD_BUILTIN2,
+              (functionptr) builtin_lcmp , SUPPORT_LONG && SUPPORT_LONG_CMP, false },
+       { ICMD_LAND,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_land , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+       { ICMD_LOR,    TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+       { ICMD_LXOR,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lxor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+       { ICMD_LSHL,   TYPE_LONG, TYPE_INT,  TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lshl , SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
+       { ICMD_LSHR,   TYPE_LONG, TYPE_INT,  TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lshr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
+       { ICMD_LUSHR,  TYPE_LONG, TYPE_INT,  TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lushr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
+       { ICMD_LADD,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_ladd , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
+       { ICMD_LSUB,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lsub , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
+       { ICMD_LNEG,   TYPE_LONG, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1, 
+              (functionptr) builtin_lneg, SUPPORT_LONG && SUPPORT_LONG_ADD, true },
+       { ICMD_LMUL,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lmul , SUPPORT_LONG && SUPPORT_LONG_MULDIV, false },
+       { ICMD_FREM,   TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, ICMD_BUILTIN2,
+              (functionptr) builtin_frem, SUPPORT_FLOAT && SUPPORT_FMOD, true },
+       { ICMD_DREM,   TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, ICMD_BUILTIN2,
+              (functionptr) builtin_drem, SUPPORT_DOUBLE && SUPPORT_FMOD, true },
+       { ICMD_I2F,    TYPE_INT, TYPE_VOID, TYPE_FLOAT, ICMD_BUILTIN1,
+              (functionptr) builtin_i2f, SUPPORT_FLOAT && SUPPORT_IFCVT, true },
+       { ICMD_I2D,    TYPE_INT, TYPE_VOID, TYPE_DOUBLE, ICMD_BUILTIN1, 
+              (functionptr) builtin_i2d, SUPPORT_DOUBLE && SUPPORT_IFCVT, true },
+       { ICMD_L2F,    TYPE_LONG, TYPE_VOID, TYPE_FLOAT, ICMD_BUILTIN1,
+              (functionptr) builtin_l2f, SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_LONG_FCVT, true },
+       { ICMD_L2D,    TYPE_LONG, TYPE_VOID, TYPE_DOUBLE, ICMD_BUILTIN1, 
+              (functionptr) builtin_l2d, SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_LONG_FCVT, true },
+       { ICMD_F2L,    TYPE_FLOAT, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1,
+              (functionptr) builtin_f2l, SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_LONG_FCVT, true },
+       { ICMD_D2L,    TYPE_DOUBLE, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1,
+              (functionptr) builtin_d2l, SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_LONG_FCVT, true },
+       { ICMD_F2I,    TYPE_FLOAT, TYPE_VOID, TYPE_INT, ICMD_BUILTIN1,
+              (functionptr) builtin_f2i, SUPPORT_FLOAT && SUPPORT_FICVT, true },
+       { ICMD_D2I,    TYPE_DOUBLE, TYPE_VOID, TYPE_INT, ICMD_BUILTIN1,
+              (functionptr) builtin_d2i, SUPPORT_DOUBLE && SUPPORT_FICVT, true },
+};
+
+#endif /* USEBUILTINTABLE */
+
+
+/***************************** register types *********************************/
+
+#define REG_RES   0         /* reserved register for OS or code generator     */
+#define REG_RET   1         /* return value register                          */
+#define REG_EXC   2         /* exception value register                       */
+#define REG_SAV   3         /* (callee) saved register                        */
+#define REG_TMP   4         /* scratch temporary register (caller saved)      */
+#define REG_ARG   5         /* argument register (caller saved)               */
+
+#define REG_END   -1        /* last entry in tables                           */
+#define PARAMMODE_NUMBERED  0 
+#define PARAMMODE_STUFFED   1
+
+
+/***************************** register info block ****************************/
+
+extern int nregdescint[];   /* description of integer registers               */
+extern int nregdescfloat[]; /* description of floating point registers        */
+
+extern int nreg_parammode;
+
+
+/* compiler switches (set by main function) ***********************************/
+
+extern bool runverbose;         /* trace all method invocation                */
+extern bool compileverbose;     /* trace compiler actions                     */
+extern bool showdisassemble;    /* generate disassembler listing              */
+extern bool showddatasegment;   /* generate data segment listing              */
+extern bool showintermediate;   /* generate intermediate code listing         */
+extern int  optimizelevel;      /* optimzation level  (0 = no optimization)   */
+
+extern bool useinlining;        /* use method inlining                        */
+extern bool inlinevirtuals;     /* inline unique virtual methods              */
+extern bool inlineexceptions;   /* inline methods, that contain excptions     */
+extern bool inlineparamopt;     /* optimize parameter passing to inlined methods */
+extern bool inlineoutsiders;    /* inline methods, that are not member of the invoker's class */
+
+
+extern bool checkbounds;        /* check array bounds                         */
+extern bool opt_loops;          /* optimize array accesses in loops           */
+extern bool checknull;          /* check null pointers                        */
+extern bool opt_noieee;         /* don't implement ieee compliant floats      */
+extern bool checksync;          /* do synchronization                         */
+
+extern bool getcompilingtime;   /* compute compile time                       */
+extern long compilingtime;      /* accumulated compile time                   */
+
+extern int  has_ext_instr_set;  /* has instruction set extensions */
+
+extern bool statistics;         
+
+extern int count_jit_calls;
+extern int count_methods;
+extern int count_spills;
+extern int count_pcmd_activ;
+extern int count_pcmd_drop;
+extern int count_pcmd_zero;
+extern int count_pcmd_const_store;
+extern int count_pcmd_const_alu;
+extern int count_pcmd_const_bra;
+extern int count_pcmd_load;
+extern int count_pcmd_move;
+extern int count_load_instruction;
+extern int count_pcmd_store;
+extern int count_pcmd_store_comb;
+extern int count_dup_instruction;
+extern int count_pcmd_op;
+extern int count_pcmd_mem;
+extern int count_pcmd_met;
+extern int count_pcmd_bra;
+extern int count_pcmd_table;
+extern int count_pcmd_return;
+extern int count_pcmd_returnx;
+extern int count_check_null;
+extern int count_check_bound;
+extern int count_max_basic_blocks;
+extern int count_basic_blocks;
+extern int count_max_javainstr;
+extern int count_javainstr;
+extern int count_javacodesize;
+extern int count_javaexcsize;
+extern int count_calls;
+extern int count_tryblocks;
+extern int count_code_len;
+extern int count_data_len;
+extern int count_cstub_len;
+extern int count_nstub_len;
+extern int count_max_new_stack;
+extern int count_upper_bound_new_stack;
+extern int *count_block_stack;
+extern int *count_analyse_iterations;
+extern int *count_method_bb_distribution;
+extern int *count_block_size_distribution;
+extern int *count_store_length;
+extern int *count_store_depth;
+
+
+/* global compiler variables */
+
+extern classinfo  *class;       /* class the compiled method belongs to       */
+extern methodinfo *method;      /* pointer to method info of compiled method  */
+extern int         mparamcount; /* number of parameters (incl. this)          */
+extern u1         *mparamtypes; /* types of all parameters (TYPE_INT, ...)    */
+       
+extern int maxstack;            /* maximal JavaVM stack size                  */
+extern int maxlocals;           /* maximal number of local JavaVM variables   */
+extern int jcodelength;         /* length of JavaVM-codes                     */
+extern u1 *jcode;               /* pointer to start of JavaVM-code            */
+extern int exceptiontablelength;/* length of exception table                  */
+extern xtable *extable;         /* pointer to start of exception table        */
+extern exceptiontable *raw_extable;
+
+extern int block_count;         /* number of basic blocks                     */
+extern basicblock *block;       /* points to basic block array                */
+extern int *block_index;        /* a table which contains for every byte of   */
+                                /* JavaVM code a basic block index if at this */
+                                /* byte there is the start of a basic block   */
+
+extern int instr_count;         /* number of JavaVM instructions              */
+extern instruction *instr;      /* points to intermediate code instructions   */
+
+extern int stack_count;         /* number of stack elements                   */
+extern stackelement *stack;     /* points to intermediate code instructions   */
+
+extern bool isleafmethod;       /* true if a method doesn't call subroutines  */
+
+extern basicblock *last_block;  /* points to the end of the BB list           */
+
+/* list of all classes used by the compiled method which have to be           */
+/* initialised (if not already done) before execution of this method          */
+extern chain *uninitializedclasses;
+
+extern int stackreq[256];
+
+
+/* function prototypes */
+
+methodptr jit_compile (methodinfo *m);  /* compile a method with jit compiler */
+
+void jit_init();                        /* compiler initialisation            */
+void jit_close();                       /* compiler finalisation              */
+
+u1 *createcompilerstub(methodinfo *m);
+u1 *createnativestub(functionptr f, methodinfo *m);
+
+void removecompilerstub(u1 *stub);
+void removenativestub(u1 *stub);
+
+#endif /* _JIT_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 16676ee8b790609eca8117e8f9a442d558b52949..a841eda839525eebf9288236be7a307ceafeb417 100644 (file)
@@ -1,19 +1,41 @@
-/******************************* ncomp/compdef.h *******************************
+/* jit/jitdef.h - constants and data structures for the compiler
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       defines all the constants and data structures of the compiler 
-       
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                  
-       Last Change: 1998/11/03
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-*******************************************************************************/
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+
+   $Id: jitdef.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _JITDEF_H
+#define _JITDEF_H
+
+#include "types.h"
 
-#ifndef __jitdef__
-#define __jitdef__
 
 /**************************** resolve typedef-cycles **************************/
 
@@ -31,7 +53,7 @@ typedef varinfo *varinfoptr;
 
 /************************** stack element structure ***************************/
 
-/*                    slot types                                              */
+/* slot types */
 
 #define TYPE_INT   0            /* the stack slot types must numbered in the  */
 #define TYPE_LNG   1            /* same order as the ICMD_Ixxx to ICMD_Axxx   */
@@ -44,13 +66,13 @@ typedef varinfo *varinfoptr;
 #define IS_2_WORD_TYPE(a)       ((a)&TYPE_LNG)
 
 
-/*                    flags                                                   */
+/* flags */
 
 #define SAVEDVAR   1            /* variable has to survive method invocations */
 #define INMEMORY   2            /* variable stored in memory                  */
 #define SAVEDTMP   4            /* temporary variable using a saved register  */
 
-/*                    variable kinds                                          */
+/* variable kinds */
 
 #define UNDEFVAR   0            /* stack slot will become temp during regalloc*/
 #define TEMPVAR    1            /* stack slot is temp register                */
@@ -58,6 +80,7 @@ typedef varinfo *varinfoptr;
 #define LOCALVAR   3            /* stack slot is local variable               */
 #define ARGVAR     4            /* stack slot is argument variable            */
 
+
 struct stackelement {
        stackptr prev;              /* pointer to next element towards bottom     */
        int type;                   /* slot type of stack element                 */
@@ -65,7 +88,7 @@ struct stackelement {
        int varkind;                /* kind of variable or register               */
        int varnum;                 /* number of variable                         */
        int regoff;                 /* register number or memory offset           */
-       };
+};
 
 
 /**************************** instruction structure ***************************/
@@ -81,12 +104,12 @@ struct instruction {
                float f;                /* float operand      */
                double d;               /* double operand     */
                void *a;                /* address operand    */
-               } val;                  /* immediate constant */
+       } val;                  /* immediate constant */
 
        void *target;                           /* used for targets of branches and jumps         */
                                                                /* and as address for list of targets for         */
                                                                /* statements                                                             */
-       };
+};
 
 
 /**************************** basic block structure ***************************/
@@ -118,9 +141,9 @@ struct basicblock {
        basicblock  *next;          /* used to build a BB list (instead of array) */
        int          lflags;        /* used during loop copying, init with 0      */
        basicblock  *copied_to;     /* points to the copy of this basic block     */
-                                    /* when loop nodes are copied                 */
-        int debug_nr;
-       };
+                                /* when loop nodes are copied                 */
+       int debug_nr;
+};
 
 
 /************************* pseudo variable structure **************************/
@@ -129,7 +152,7 @@ struct varinfo {
        int type;                   /* basic type of variable                     */
        int flags;                  /* flags (SAVED, INMEMORY)                    */
        int regoff;                 /* register number or memory offset           */
-       };
+};
 
 typedef varinfo varinfo5[5];
 
@@ -139,7 +162,7 @@ typedef varinfo varinfo5[5];
 struct branchref {
        s4 branchpos;               /* patching position in code segment          */
        branchref *next;            /* next element in branchref list             */
-       };
+};
 
 
 /******************** forward references in tables  ***************************/
@@ -148,634 +171,626 @@ struct jumpref {
        s4 tablepos;                /* patching position in data segment          */
        basicblock *target;         /* target basic block                         */
        jumpref *next;              /* next element in jumpref list               */
-       };
+};
 
 
 struct dataref {
-        u1 *pos;                    /* patching position in generated code        */
+       u1 *pos;                    /* patching position in generated code        */
        dataref *next;              /* next element in dataref list               */
-       };
+};
 
 
 /********** JavaVM operation codes (sorted) and instruction lengths ***********/
 
-static int stackreq[256];
-
-static int jcommandsize[256] = {
+extern char *icmd_names[256];
+extern char *opcode_names[256];
+extern int jcommandsize[256];
 
 #define JAVA_NOP               0
 #define ICMD_NOP               0
-        1,
+
 #define JAVA_ACONST_NULL       1
 #define ICMD_ACONST            1        /* val.a = constant                   */
-        1,
+
 #define JAVA_ICONST_M1         2
 #define ICMD_NULLCHECKPOP      2
-        1,
+
 #define JAVA_ICONST_0          3
 #define ICMD_ICONST            3        /* val.i = constant                   */
-        1,
+
 #define JAVA_ICONST_1          4
 #define ICMD_IREM0X10001       4
-        1,
+
 #define JAVA_ICONST_2          5
 #define ICMD_IDIVPOW2          5        /* val.i = constant                   */
-        1,
+
 #define JAVA_ICONST_3          6
 #define ICMD_LDIVPOW2          6        /* val.l = constant                   */
-        1,
+
 #define JAVA_ICONST_4          7
-        1,
+
 #define JAVA_ICONST_5          8
 #define ICMD_LREM0X10001       8
-        1,
+
 #define JAVA_LCONST_0          9
 #define ICMD_LCONST            9        /* val.l = constant                   */
-        1,
+
 #define JAVA_LCONST_1         10
 #define ICMD_LCMPCONST        10        /* val.l = constant                   */
-        1,
+
 #define JAVA_FCONST_0         11
 #define ICMD_FCONST           11        /* val.f = constant                   */
-        1,
+
 #define JAVA_FCONST_1         12
-        1,
+
 #define JAVA_FCONST_2         13
 #define ICMD_ELSE_ICONST      13
-        1,
+
 #define JAVA_DCONST_0         14
 #define ICMD_DCONST           14        /* val.d = constant                   */
-        1,
+
 #define JAVA_DCONST_1         15
 #define ICMD_IFEQ_ICONST      15
-        1,
+
 #define JAVA_BIPUSH           16
 #define ICMD_IFNE_ICONST      16
-        2,
+
 #define JAVA_SIPUSH           17
 #define ICMD_IFLT_ICONST      17
-        3,
+
 #define JAVA_LDC1             18
 #define ICMD_IFGE_ICONST      18
-        2,
+
 #define JAVA_LDC2             19
 #define ICMD_IFGT_ICONST      19
-        3,
+
 #define JAVA_LDC2W            20
 #define ICMD_IFLE_ICONST      20
-        3,
-                                        /* order of LOAD instructions must be */
-                                        /* equal to order of TYPE_XXX defines */
+
+                                           /* order of LOAD instructions must be */
+                                           /* equal to order of TYPE_XXX defines */
 #define JAVA_ILOAD            21
 #define ICMD_ILOAD            21        /* op1 = local variable               */
-        2,                      
+
 #define JAVA_LLOAD            22
 #define ICMD_LLOAD            22        /* op1 = local variable               */
-        2,
+
 #define JAVA_FLOAD            23
 #define ICMD_FLOAD            23        /* op1 = local variable               */
-        2,
+
 #define JAVA_DLOAD            24
 #define ICMD_DLOAD            24        /* op1 = local variable               */
-        2,
+
 #define JAVA_ALOAD            25
 #define ICMD_ALOAD            25        /* op1 = local variable               */
-        2,
+
 #define JAVA_ILOAD_0          26
 #define ICMD_IADDCONST        26        /* val.i = constant                   */
-        1,
+
 #define JAVA_ILOAD_1          27
 #define ICMD_ISUBCONST        27        /* val.i = constant                   */
-        1,
+
 #define JAVA_ILOAD_2          28
 #define ICMD_IMULCONST        28        /* val.i = constant                   */
-        1,
+
 #define JAVA_ILOAD_3          29
 #define ICMD_IANDCONST        29        /* val.i = constant                   */
-        1,
+
 #define JAVA_LLOAD_0          30
 #define ICMD_IORCONST         30        /* val.i = constant                   */
-        1,
+
 #define JAVA_LLOAD_1          31
 #define ICMD_IXORCONST        31        /* val.i = constant                   */
-        1,
+
 #define JAVA_LLOAD_2          32
 #define ICMD_ISHLCONST        32        /* val.i = constant                   */
-        1,
+
 #define JAVA_LLOAD_3          33
 #define ICMD_ISHRCONST        33        /* val.i = constant                   */
-        1,
+
 #define JAVA_FLOAD_0          34
 #define ICMD_IUSHRCONST       34        /* val.i = constant                   */
-        1,
+
 #define JAVA_FLOAD_1          35
 #define ICMD_IREMPOW2         35        /* val.i = constant                   */
-        1,
+
 #define JAVA_FLOAD_2          36
 #define ICMD_LADDCONST        36        /* val.l = constant                   */
-        1,
+
 #define JAVA_FLOAD_3          37
 #define ICMD_LSUBCONST        37        /* val.l = constant                   */
-        1,
+
 #define JAVA_DLOAD_0          38
 #define ICMD_LMULCONST        38        /* val.l = constant                   */
-        1,
+
 #define JAVA_DLOAD_1          39
 #define ICMD_LANDCONST        39        /* val.l = constant                   */
-        1,
+
 #define JAVA_DLOAD_2          40
 #define ICMD_LORCONST         40        /* val.l = constant                   */
-        1,
+
 #define JAVA_DLOAD_3          41
 #define ICMD_LXORCONST        41        /* val.l = constant                   */
-        1,
+
 #define JAVA_ALOAD_0          42
 #define ICMD_LSHLCONST        42        /* val.l = constant                   */
-        1,
+
 #define JAVA_ALOAD_1          43
 #define ICMD_LSHRCONST        43        /* val.l = constant                   */
-        1,
+
 #define JAVA_ALOAD_2          44
 #define ICMD_LUSHRCONST       44        /* val.l = constant                   */
-        1,
+
 #define JAVA_ALOAD_3          45
 #define ICMD_LREMPOW2         45        /* val.l = constant                   */
-        1,
+
 #define JAVA_IALOAD           46
 #define ICMD_IALOAD           46
-        1,
+
 #define JAVA_LALOAD           47
 #define ICMD_LALOAD           47
-        1,
+
 #define JAVA_FALOAD           48
 #define ICMD_FALOAD           48
-        1,
+
 #define JAVA_DALOAD           49
 #define ICMD_DALOAD           49
-        1,
+
 #define JAVA_AALOAD           50
 #define ICMD_AALOAD           50
-        1,
+
 #define JAVA_BALOAD           51
 #define ICMD_BALOAD           51
-        1,
+
 #define JAVA_CALOAD           52
 #define ICMD_CALOAD           52
-        1,
+
 #define JAVA_SALOAD           53
 #define ICMD_SALOAD           53
-        1,
-                                        /* order of STORE instructions must be*/
-                                        /* equal to order of TYPE_XXX defines */
+
+                                           /* order of STORE instructions must be*/
+                                           /* equal to order of TYPE_XXX defines */
 #define JAVA_ISTORE           54
 #define ICMD_ISTORE           54        /* op1 = local variable               */
-        2,
+
 #define JAVA_LSTORE           55
 #define ICMD_LSTORE           55        /* op1 = local variable               */
-        2,
+
 #define JAVA_FSTORE           56
 #define ICMD_FSTORE           56        /* op1 = local variable               */
-        2,
+
 #define JAVA_DSTORE           57
 #define ICMD_DSTORE           57        /* op1 = local variable               */
-        2,
+
 #define JAVA_ASTORE           58
 #define ICMD_ASTORE           58        /* op1 = local variable               */
-        2,
+
 #define JAVA_ISTORE_0         59
 #define ICMD_IF_LEQ           59        /* op1 = target JavaVM pc, val.l      */
-        1,
+
 #define JAVA_ISTORE_1         60
 #define ICMD_IF_LNE           60        /* op1 = target JavaVM pc, val.l      */
-        1,
+
 #define JAVA_ISTORE_2         61
 #define ICMD_IF_LLT           61        /* op1 = target JavaVM pc, val.l      */
-        1,
+
 #define JAVA_ISTORE_3         62
 #define ICMD_IF_LGE           62        /* op1 = target JavaVM pc, val.l      */
-        1,
+
 #define JAVA_LSTORE_0         63
 #define ICMD_IF_LGT           63        /* op1 = target JavaVM pc, val.l      */
-        1,
+
 #define JAVA_LSTORE_1         64
 #define ICMD_IF_LLE           64        /* op1 = target JavaVM pc, val.l      */
-        1,
+
 #define JAVA_LSTORE_2         65
 #define ICMD_IF_LCMPEQ        65        /* op1 = target JavaVM pc             */
-        1,
+
 #define JAVA_LSTORE_3         66
 #define ICMD_IF_LCMPNE        66        /* op1 = target JavaVM pc             */
-        1,
+
 #define JAVA_FSTORE_0         67
 #define ICMD_IF_LCMPLT        67        /* op1 = target JavaVM pc             */
-        1,
+
 #define JAVA_FSTORE_1         68
 #define ICMD_IF_LCMPGE        68        /* op1 = target JavaVM pc             */
-        1,
+
 #define JAVA_FSTORE_2         69
 #define ICMD_IF_LCMPGT        69        /* op1 = target JavaVM pc             */
-        1,
+
 #define JAVA_FSTORE_3         70
 #define ICMD_IF_LCMPLE        70        /* op1 = target JavaVM pc             */
-        1,
+
 #define JAVA_DSTORE_0         71
-        1,
+
 #define JAVA_DSTORE_1         72
-        1,
+
 #define JAVA_DSTORE_2         73
-        1,
+
 #define JAVA_DSTORE_3         74
-        1,
+
 #define JAVA_ASTORE_0         75
-        1,
+
 #define JAVA_ASTORE_1         76
-        1,
+
 #define JAVA_ASTORE_2         77
-        1,
+
 #define JAVA_ASTORE_3         78
-        1,
+
 #define JAVA_IASTORE          79
 #define ICMD_IASTORE          79
-        1,
+
 #define JAVA_LASTORE          80
 #define ICMD_LASTORE          80
-        1,
+
 #define JAVA_FASTORE          81
 #define ICMD_FASTORE          81
-        1,
+
 #define JAVA_DASTORE          82
 #define ICMD_DASTORE          82
-        1,
+
 #define JAVA_AASTORE          83
 #define ICMD_AASTORE          83
-        1,
+
 #define JAVA_BASTORE          84
 #define ICMD_BASTORE          84
-        1,
+
 #define JAVA_CASTORE          85
 #define ICMD_CASTORE          85
-        1,
+
 #define JAVA_SASTORE          86
 #define ICMD_SASTORE          86
-        1,
+
 #define JAVA_POP              87
 #define ICMD_POP              87
-        1,
+
 #define JAVA_POP2             88
 #define ICMD_POP2             88
-        1,
+
 #define JAVA_DUP              89
 #define ICMD_DUP              89
-        1,
+
 #define JAVA_DUP_X1           90
 #define ICMD_DUP_X1           90
-        1,
+
 #define JAVA_DUP_X2           91
 #define ICMD_DUP_X2           91
-        1,
+
 #define JAVA_DUP2             92
 #define ICMD_DUP2             92
-        1,
+
 #define JAVA_DUP2_X1          93
 #define ICMD_DUP2_X1          93
-        1,
+
 #define JAVA_DUP2_X2          94
 #define ICMD_DUP2_X2          94
-        1,
+
 #define JAVA_SWAP             95
 #define ICMD_SWAP             95
-        1,
+
 #define JAVA_IADD             96
 #define ICMD_IADD             96
-        1,
+
 #define JAVA_LADD             97
 #define ICMD_LADD             97
-        1,
+
 #define JAVA_FADD             98
 #define ICMD_FADD             98
-        1,
+
 #define JAVA_DADD             99
 #define ICMD_DADD             99
-        1,
+
 #define JAVA_ISUB             100
 #define ICMD_ISUB             100
-        1,
+
 #define JAVA_LSUB             101
 #define ICMD_LSUB             101
-        1,
+
 #define JAVA_FSUB             102
 #define ICMD_FSUB             102
-        1,
+
 #define JAVA_DSUB             103
 #define ICMD_DSUB             103
-        1,
+
 #define JAVA_IMUL             104
 #define ICMD_IMUL             104
-        1,
+
 #define JAVA_LMUL             105
 #define ICMD_LMUL             105
-        1,
+
 #define JAVA_FMUL             106
 #define ICMD_FMUL             106
-        1,
+
 #define JAVA_DMUL             107
 #define ICMD_DMUL             107
-        1,
+
 #define JAVA_IDIV             108
 #define ICMD_IDIV             108
-        1,
+
 #define JAVA_LDIV             109
 #define ICMD_LDIV             109
-        1,
+
 #define JAVA_FDIV             110
 #define ICMD_FDIV             110
-        1,
+
 #define JAVA_DDIV             111
 #define ICMD_DDIV             111
-        1,
+
 #define JAVA_IREM             112
 #define ICMD_IREM             112
-        1,
+
 #define JAVA_LREM             113
 #define ICMD_LREM             113
-        1,
+
 #define JAVA_FREM             114
 #define ICMD_FREM             114
-        1,
+
 #define JAVA_DREM             115
 #define ICMD_DREM             115
-        1,
+
 #define JAVA_INEG             116
 #define ICMD_INEG             116
-        1,
+
 #define JAVA_LNEG             117
 #define ICMD_LNEG             117
-        1,
+
 #define JAVA_FNEG             118
 #define ICMD_FNEG             118
-        1,
+
 #define JAVA_DNEG             119
 #define ICMD_DNEG             119
-        1,
+
 #define JAVA_ISHL             120
 #define ICMD_ISHL             120
-        1,
+
 #define JAVA_LSHL             121
 #define ICMD_LSHL             121
-        1,
+
 #define JAVA_ISHR             122
 #define ICMD_ISHR             122
-        1,
+
 #define JAVA_LSHR             123
 #define ICMD_LSHR             123
-        1,
+
 #define JAVA_IUSHR            124
 #define ICMD_IUSHR            124
-        1,
+
 #define JAVA_LUSHR            125
 #define ICMD_LUSHR            125
-        1,
+
 #define JAVA_IAND             126
 #define ICMD_IAND             126
-        1,
+
 #define JAVA_LAND             127
 #define ICMD_LAND             127
-        1,
+
 #define JAVA_IOR              128
 #define ICMD_IOR              128
-        1,
+
 #define JAVA_LOR              129
 #define ICMD_LOR              129
-        1,
+
 #define JAVA_IXOR             130
 #define ICMD_IXOR             130
-        1,
+
 #define JAVA_LXOR             131
 #define ICMD_LXOR             131
-        1,
+
 #define JAVA_IINC             132
 #define ICMD_IINC             132   /* op1 = local variable, val.i = constant */
-        3,
+
 #define JAVA_I2L              133
 #define ICMD_I2L              133
-        1,
+
 #define JAVA_I2F              134
 #define ICMD_I2F              134
-        1,
+
 #define JAVA_I2D              135
 #define ICMD_I2D              135
-        1,
+
 #define JAVA_L2I              136
 #define ICMD_L2I              136
-        1,
+
 #define JAVA_L2F              137
 #define ICMD_L2F              137
-        1,
+
 #define JAVA_L2D              138
 #define ICMD_L2D              138
-        1,
+
 #define JAVA_F2I              139
 #define ICMD_F2I              139
-        1,
+
 #define JAVA_F2L              140
 #define ICMD_F2L              140
-        1,
+
 #define JAVA_F2D              141
 #define ICMD_F2D              141
-        1,
+
 #define JAVA_D2I              142
 #define ICMD_D2I              142
-        1,
+
 #define JAVA_D2L              143
 #define ICMD_D2L              143
-        1,
+
 #define JAVA_D2F              144
 #define ICMD_D2F              144
-        1,
+
 #define JAVA_INT2BYTE         145
 #define ICMD_INT2BYTE         145
-        1,
+
 #define JAVA_INT2CHAR         146
 #define ICMD_INT2CHAR         146
-        1,
+
 #define JAVA_INT2SHORT        147
 #define ICMD_INT2SHORT        147
-        1,
+
 #define JAVA_LCMP             148
 #define ICMD_LCMP             148
-        1,
+
 #define JAVA_FCMPL            149
 #define ICMD_FCMPL            149
-        1,
+
 #define JAVA_FCMPG            150
 #define ICMD_FCMPG            150
-        1,
+
 #define JAVA_DCMPL            151
 #define ICMD_DCMPL            151
-        1,
+
 #define JAVA_DCMPG            152
 #define ICMD_DCMPG            152
-        1,
+
 #define JAVA_IFEQ             153
 #define ICMD_IFEQ             153       /* op1 = target JavaVM pc, val.i      */
-        3,
+
 #define JAVA_IFNE             154
 #define ICMD_IFNE             154       /* op1 = target JavaVM pc, val.i      */
-        3,
+
 #define JAVA_IFLT             155
 #define ICMD_IFLT             155       /* op1 = target JavaVM pc, val.i      */
-        3,
+
 #define JAVA_IFGE             156
 #define ICMD_IFGE             156       /* op1 = target JavaVM pc, val.i      */
-        3,
+
 #define JAVA_IFGT             157
 #define ICMD_IFGT             157       /* op1 = target JavaVM pc, val.i      */
-        3,
+
 #define JAVA_IFLE             158
 #define ICMD_IFLE             158       /* op1 = target JavaVM pc, val.i      */
-        3,
+
 #define JAVA_IF_ICMPEQ        159
 #define ICMD_IF_ICMPEQ        159       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_IF_ICMPNE        160
 #define ICMD_IF_ICMPNE        160       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_IF_ICMPLT        161
 #define ICMD_IF_ICMPLT        161       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_IF_ICMPGE        162
 #define ICMD_IF_ICMPGE        162       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_IF_ICMPGT        163
 #define ICMD_IF_ICMPGT        163       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_IF_ICMPLE        164
 #define ICMD_IF_ICMPLE        164       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_IF_ACMPEQ        165
 #define ICMD_IF_ACMPEQ        165       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_IF_ACMPNE        166
 #define ICMD_IF_ACMPNE        166       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_GOTO             167
 #define ICMD_GOTO             167       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_JSR              168
 #define ICMD_JSR              168       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_RET              169
 #define ICMD_RET              169       /* op1 = local variable               */
-        2,
+
 #define JAVA_TABLESWITCH      170
 #define ICMD_TABLESWITCH      170       /* val.a = pointer to s4 table        */
-        0,                              /* length must be computed            */
+                                        /* length must be computed            */
 #define JAVA_LOOKUPSWITCH     171
 #define ICMD_LOOKUPSWITCH     171       /* val.a = pointer to s4 table        */
-        0,                              /* length must be computed            */
+                                        /* length must be computed            */
 #define JAVA_IRETURN          172
 #define ICMD_IRETURN          172
-        1,
+
 #define JAVA_LRETURN          173
 #define ICMD_LRETURN          173
-        1,
+
 #define JAVA_FRETURN          174
 #define ICMD_FRETURN          174
-        1,
+
 #define JAVA_DRETURN          175
 #define ICMD_DRETURN          175
-        1,
+
 #define JAVA_ARETURN          176
 #define ICMD_ARETURN          176
-        1,
+
 #define JAVA_RETURN           177
 #define ICMD_RETURN           177
-        1,
+
 #define JAVA_GETSTATIC        178
 #define ICMD_GETSTATIC        178       /* op1 = type, val.a = field address  */
-        3,
+
 #define JAVA_PUTSTATIC        179
 #define ICMD_PUTSTATIC        179       /* op1 = type, val.a = field address  */
-        3,
+
 #define JAVA_GETFIELD         180
 #define ICMD_GETFIELD         180       /* op1 = type, val.i = field offset   */
-        3,
+
 #define JAVA_PUTFIELD         181
 #define ICMD_PUTFIELD         181       /* op1 = type, val.i = field offset   */
-        3,
+
 #define JAVA_INVOKEVIRTUAL    182
 #define ICMD_INVOKEVIRTUAL    182       /* val.a = method info pointer        */
-        3,
+
 #define JAVA_INVOKESPECIAL    183
 #define ICMD_INVOKESPECIAL    183       /* val.a = method info pointer        */
-        3,
+
 #define JAVA_INVOKESTATIC     184
 #define ICMD_INVOKESTATIC     184       /* val.a = method info pointer        */
-        3,
+
 #define JAVA_INVOKEINTERFACE  185
 #define ICMD_INVOKEINTERFACE  185       /* val.a = method info pointer        */
-        5,
+
 #define ICMD_CHECKASIZE       186       /*                                    */
-        1, /* unused */
+
 #define JAVA_NEW              187
 #define ICMD_NEW              187       /* op1 = 1, val.a = class pointer     */
-        3,
+
 #define JAVA_NEWARRAY         188
 #define ICMD_NEWARRAY         188       /* op1 = basic type                   */
-        2,
+
 #define JAVA_ANEWARRAY        189
 #define ICMD_ANEWARRAY        189       /* op1 = 0, val.a = array pointer     */
-        3,                              /* op1 = 1, val.a = class pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
 #define JAVA_ARRAYLENGTH      190
 #define ICMD_ARRAYLENGTH      190
-        1,
+
 #define JAVA_ATHROW           191
 #define ICMD_ATHROW           191
-        1,
+
 #define JAVA_CHECKCAST        192
 #define ICMD_CHECKCAST        192       /* op1 = 0, val.a = array pointer     */
-        3,                              /* op1 = 1, val.a = class pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
 #define JAVA_INSTANCEOF       193
 #define ICMD_INSTANCEOF       193       /* op1 = 0, val.a = array pointer     */
-        3,                              /* op1 = 1, val.a = class pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
 #define JAVA_MONITORENTER     194
 #define ICMD_MONITORENTER     194
-        1,
+
 #define JAVA_MONITOREXIT      195
 #define ICMD_MONITOREXIT      195
-        1,
+
 #define JAVA_WIDE             196
-        0,       /* length must be computed */
+
 #define JAVA_MULTIANEWARRAY   197
 #define ICMD_MULTIANEWARRAY   197       /* op1 = dimension, val.a = array     */
-        4,                              /* pointer                            */
+                                        /* pointer                            */
 #define JAVA_IFNULL           198
 #define ICMD_IFNULL           198       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_IFNONNULL        199
 #define ICMD_IFNONNULL        199       /* op1 = target JavaVM pc             */
-        3,
+
 #define JAVA_GOTO_W           200
-        5,
+
 #define JAVA_JSR_W            201
-        5,
+
 #define JAVA_BREAKPOINT       202
-        1,
 
-            1,1,1,1,1,1,1,1,            /* unused */
-        1,1,1,1,1,1,1,1,1,1,
-        1,1,1,1,1,1,1,1,1,1,
-        1,1,1,1,1,1,1,1,1,1,
-        1,1,1,1,1,1,1,1,1,1,
-        1,1,1,1,1
-    };
 
 #define ICMD_BUILTIN3         253       /* internal opcode */
 #define ICMD_BUILTIN2         254       /* internal opcode */
 #define ICMD_BUILTIN1         255       /* internal opcode */
 #define ICMD_READONLY_ARG     1024      /* used for inlining, opcodes 1024-1028 are used */
-#define ICMD_CLEAR_ARGREN     1029      /* indicates the start of a new inlined method 
-                                          argument renaming must be reset */
+#define ICMD_CLEAR_ARGREN     1029      /* indicates the start of a new inlined method argument renaming must be reset */
+
 
 /******************* description of JavaVM instructions ***********************/
 
@@ -836,453 +851,7 @@ static stdopdescriptor builtintable[] = {
               (functionptr) builtin_d2i, SUPPORT_DOUBLE && SUPPORT_FICVT, true },
 };
 
-#endif
-
-static char *icmd_names[256] = {
-       "NOP          ", /*               0 */
-       "ACONST       ", /*               1 */
-       "NULLCHECKPOP ", /* ICONST_M1     2 */
-       "ICONST       ", /*               3 */
-       "IREM0X10001  ", /* ICONST_1      4 */
-       "IDIVPOW2     ", /* ICONST_2      5 */
-       "LDIVPOW2     ", /* ICONST_3      6 */
-       "UNDEF__7     ", /* ICONST_4      7 */
-       "LREM0X10001  ", /* ICONST_5      8 */
-       "LCONST       ", /*               9 */
-       "LCMPCONST    ", /* LCONST_1     10 */
-       "FCONST       ", /*              11 */
-       "UNDEF_12     ", /* FCONST_1     12 */
-       "ELSE_ICONST  ", /* FCONST_2     13 */
-       "DCONST       ", /*              14 */
-       "IFEQ_ICONST  ", /* DCONST_1     15 */
-       "IFNE_ICONST  ", /* BIPUSH       16 */
-       "IFLT_ICONST  ", /* SIPUSH       17 */
-       "IFGE_ICONST  ", /* LDC1         18 */
-       "IFGT_ICONST  ", /* LDC2         19 */
-       "IFLE_ICONST  ", /* LDC2W        20 */
-       "ILOAD        ", /*              21 */
-       "LLOAD        ", /*              22 */
-       "FLOAD        ", /*              23 */
-       "DLOAD        ", /*              24 */
-       "ALOAD        ", /*              25 */
-       "IADDCONST    ", /* ILOAD_0      26 */
-       "ISUBCONST    ", /* ILOAD_1      27 */
-       "IMULCONST    ", /* ILOAD_2      28 */
-       "IANDCONST    ", /* ILOAD_3      29 */
-       "IORCONST     ", /* LLOAD_0      30 */
-       "IXORCONST    ", /* LLOAD_1      31 */
-       "ISHLCONST    ", /* LLOAD_2      32 */
-       "ISHRCONST    ", /* LLOAD_3      33 */
-       "IUSHRCONST   ", /* FLOAD_0      34 */
-       "IREMPOW2     ", /* FLOAD_1      35 */
-       "LADDCONST    ", /* FLOAD_2      36 */
-       "LSUBCONST    ", /* FLOAD_3      37 */
-       "LMULCONST    ", /* DLOAD_0      38 */
-       "LANDCONST    ", /* DLOAD_1      39 */
-       "LORCONST     ", /* DLOAD_2      40 */
-       "LXORCONST    ", /* DLOAD_3      41 */
-       "LSHLCONST    ", /* ALOAD_0      42 */
-       "LSHRCONST    ", /* ALOAD_1      43 */
-       "LUSHRCONST   ", /* ALOAD_2      44 */
-       "LREMPOW2     ", /* ALOAD_3      45 */
-       "IALOAD       ", /*              46 */
-       "LALOAD       ", /*              47 */
-       "FALOAD       ", /*              48 */
-       "DALOAD       ", /*              49 */
-       "AALOAD       ", /*              50 */
-       "BALOAD       ", /*              51 */
-       "CALOAD       ", /*              52 */
-       "SALOAD       ", /*              53 */
-       "ISTORE       ", /*              54 */
-       "LSTORE       ", /*              55 */
-       "FSTORE       ", /*              56 */
-       "DSTORE       ", /*              57 */
-       "ASTORE       ", /*              58 */
-       "IF_LEQ       ", /* ISTORE_0     59 */
-       "IF_LNE       ", /* ISTORE_1     60 */
-       "IF_LLT       ", /* ISTORE_2     61 */
-       "IF_LGE       ", /* ISTORE_3     62 */
-       "IF_LGT       ", /* LSTORE_0     63 */
-       "IF_LLE       ", /* LSTORE_1     64 */
-       "IF_LCMPEQ    ", /* LSTORE_2     65 */
-       "IF_LCMPNE    ", /* LSTORE_3     66 */
-       "IF_LCMPLT    ", /* FSTORE_0     67 */
-       "IF_LCMPGE    ", /* FSTORE_1     68 */
-       "IF_LCMPGT    ", /* FSTORE_2     69 */
-       "IF_LCMPLE    ", /* FSTORE_3     70 */
-       "UNDEF_71     ", /* DSTORE_0     71 */
-       "UNDEF_72     ", /* DSTORE_1     72 */
-       "UNDEF_73     ", /* DSTORE_2     73 */
-       "UNDEF_74     ", /* DSTORE_3     74 */
-       "UNDEF_75     ", /* ASTORE_0     75 */
-       "UNDEF_76     ", /* ASTORE_1     76 */
-       "UNDEF_77     ", /* ASTORE_2     77 */
-       "UNDEF_78     ", /* ASTORE_3     78 */
-       "IASTORE      ", /*              79 */
-       "LASTORE      ", /*              80 */
-       "FASTORE      ", /*              81 */
-       "DASTORE      ", /*              82 */
-       "AASTORE      ", /*              83 */
-       "BASTORE      ", /*              84 */
-       "CASTORE      ", /*              85 */
-       "SASTORE      ", /*              86 */
-       "POP          ", /*              87 */
-       "POP2         ", /*              88 */
-       "DUP          ", /*              89 */
-       "DUP_X1       ", /*              90 */
-       "DUP_X2       ", /*              91 */
-       "DUP2         ", /*              92 */
-       "DUP2_X1      ", /*              93 */
-       "DUP2_X2      ", /*              94 */
-       "SWAP         ", /*              95 */
-       "IADD         ", /*              96 */
-       "LADD         ", /*              97 */
-       "FADD         ", /*              98 */
-       "DADD         ", /*              99 */
-       "ISUB         ", /*             100 */
-       "LSUB         ", /*             101 */
-       "FSUB         ", /*             102 */
-       "DSUB         ", /*             103 */
-       "IMUL         ", /*             104 */
-       "LMUL         ", /*             105 */
-       "FMUL         ", /*             106 */
-       "DMUL         ", /*             107 */
-       "IDIV         ", /*             108 */
-       "LDIV         ", /*             109 */
-       "FDIV         ", /*             110 */
-       "DDIV         ", /*             111 */
-       "IREM         ", /*             112 */
-       "LREM         ", /*             113 */
-       "FREM         ", /*             114 */
-       "DREM         ", /*             115 */
-       "INEG         ", /*             116 */
-       "LNEG         ", /*             117 */
-       "FNEG         ", /*             118 */
-       "DNEG         ", /*             119 */
-       "ISHL         ", /*             120 */
-       "LSHL         ", /*             121 */
-       "ISHR         ", /*             122 */
-       "LSHR         ", /*             123 */
-       "IUSHR        ", /*             124 */
-       "LUSHR        ", /*             125 */
-       "IAND         ", /*             126 */
-       "LAND         ", /*             127 */
-       "IOR          ", /*             128 */
-       "LOR          ", /*             129 */
-       "IXOR         ", /*             130 */
-       "LXOR         ", /*             131 */
-       "IINC         ", /*             132 */
-       "I2L          ", /*             133 */
-       "I2F          ", /*             134 */
-       "I2D          ", /*             135 */
-       "L2I          ", /*             136 */
-       "L2F          ", /*             137 */
-       "L2D          ", /*             138 */
-       "F2I          ", /*             139 */
-       "F2L          ", /*             140 */
-       "F2D          ", /*             141 */
-       "D2I          ", /*             142 */
-       "D2L          ", /*             143 */
-       "D2F          ", /*             144 */
-       "INT2BYTE     ", /*             145 */
-       "INT2CHAR     ", /*             146 */
-       "INT2SHORT    ", /*             147 */
-       "LCMP         ", /*             148 */
-       "FCMPL        ", /*             149 */
-       "FCMPG        ", /*             150 */
-       "DCMPL        ", /*             151 */
-       "DCMPG        ", /*             152 */
-       "IFEQ         ", /*             153 */
-       "IFNE         ", /*             154 */
-       "IFLT         ", /*             155 */
-       "IFGE         ", /*             156 */
-       "IFGT         ", /*             157 */
-       "IFLE         ", /*             158 */
-       "IF_ICMPEQ    ", /*             159 */
-       "IF_ICMPNE    ", /*             160 */
-       "IF_ICMPLT    ", /*             161 */
-       "IF_ICMPGE    ", /*             162 */
-       "IF_ICMPGT    ", /*             163 */
-       "IF_ICMPLE    ", /*             164 */
-       "IF_ACMPEQ    ", /*             165 */
-       "IF_ACMPNE    ", /*             166 */
-       "GOTO         ", /*             167 */
-       "JSR          ", /*             168 */
-       "RET          ", /*             169 */
-       "TABLESWITCH  ", /*             170 */
-       "LOOKUPSWITCH ", /*             171 */
-       "IRETURN      ", /*             172 */
-       "LRETURN      ", /*             173 */
-       "FRETURN      ", /*             174 */
-       "DRETURN      ", /*             175 */
-       "ARETURN      ", /*             176 */
-       "RETURN       ", /*             177 */
-       "GETSTATIC    ", /*             178 */
-       "PUTSTATIC    ", /*             179 */
-       "GETFIELD     ", /*             180 */
-       "PUTFIELD     ", /*             181 */
-       "INVOKEVIRTUAL", /*             182 */
-       "INVOKESPECIAL", /*             183 */
-       "INVOKESTATIC ", /*             184 */
-       "INVOKEINTERFACE",/*            185 */
-       "CHECKASIZE   ", /* UNDEF186    186 */
-       "NEW          ", /*             187 */
-       "NEWARRAY     ", /*             188 */
-       "ANEWARRAY    ", /*             189 */
-       "ARRAYLENGTH  ", /*             190 */
-       "ATHROW       ", /*             191 */
-       "CHECKCAST    ", /*             192 */
-       "INSTANCEOF   ", /*             193 */
-       "MONITORENTER ", /*             194 */
-       "MONITOREXIT  ", /*             195 */
-       "UNDEF196     ", /* WIDE        196 */
-       "MULTIANEWARRAY",/*             197 */
-       "IFNULL       ", /*             198 */
-       "IFNONNULL    ", /*             199 */
-       "UNDEF200     ", /* GOTO_W      200 */
-       "UNDEF201     ", /* JSR_W       201 */
-       "UNDEF202     ", /* BREAKPOINT  202 */
-
-                             "UNDEF203","UNDEF204","UNDEF205",
-       "UNDEF206","UNDEF207","UNDEF208","UNDEF209","UNDEF210",
-       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
-       "UNDEF216","UNDEF217","UNDEF218","UNDEF219","UNDEF220",
-       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
-       "UNDEF226","UNDEF227","UNDEF228","UNDEF229","UNDEF230",
-       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
-       "UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
-       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
-       "UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
-       "UNDEF251","UNDEF252",
-
-       "BUILTIN3     ", /*             253 */
-       "BUILTIN2     ", /*             254 */
-       "BUILTIN1     "  /*             255 */
-    };
-
-
-static char *opcode_names[256] = {
-       "NOP          ", /*               0 */
-       "ACONST       ", /*               1 */
-       "ICONST_M1    ", /* ICONST_M1     2 */
-       "ICONST_0     ", /* ICONST_0      3 */
-       "ICONST_1     ", /* ICONST_1      4 */
-       "ICONST_2     ", /* ICONST_2      5 */
-       "ICONST_3     ", /* ICONST_3      6 */
-       "ICONST_4     ", /* ICONST_4      7 */
-       "ICONST_5     ", /* ICONST_5      8 */
-       "LCONST_0     ", /* LCONST_0      9 */
-       "LCONST_1     ", /* LCONST_1     10 */
-       "FCONST_0     ", /* FCONST_0     11 */
-       "FCONST_1     ", /* FCONST_1     12 */
-       "FCONST_2     ", /* FCONST_2     13 */
-       "DCONST_0     ", /* DCONST_0     14 */
-       "DCONST_1     ", /* DCONST_1     15 */
-       "BIPUSH       ", /* BIPUSH       16 */
-       "SIPUSH       ", /* SIPUSH       17 */
-       "LDC          ", /* LDC          18 */
-       "LDC_W        ", /* LDC_W        19 */
-       "LDC2_W       ", /* LDC2_W       20 */
-       "ILOAD        ", /*              21 */
-       "LLOAD        ", /*              22 */
-       "FLOAD        ", /*              23 */
-       "DLOAD        ", /*              24 */
-       "ALOAD        ", /*              25 */
-       "ILOAD_0      ", /* ILOAD_0      26 */
-       "ILOAD_1      ", /* ILOAD_1      27 */
-       "ILOAD_2      ", /* ILOAD_2      28 */
-       "ILOAD_3      ", /* ILOAD_3      29 */
-       "LLOAD_0      ", /* LLOAD_0      30 */
-       "LLOAD_1      ", /* LLOAD_1      31 */
-       "LLOAD_2      ", /* LLOAD_2      32 */
-       "LLOAD_3      ", /* LLOAD_3      33 */
-       "FLOAD_0      ", /* FLOAD_0      34 */
-       "FLOAD_1      ", /* FLOAD_1      35 */
-       "FLOAD_2      ", /* FLOAD_2      36 */
-       "FLOAD_3      ", /* FLOAD_3      37 */
-       "DLOAD_0      ", /* DLOAD_0      38 */
-       "DLOAD_1      ", /* DLOAD_1      39 */
-       "DLOAD_2      ", /* DLOAD_2      40 */ 
-       "DLOAD_3      ", /* DLOAD_3      41 */
-       "ALOAD_0      ", /* ALOAD_0      42 */
-       "ALOAD_1      ", /* ALOAD_1      43 */
-       "ALOAD_2      ", /* ALOAD_2      44 */
-       "ALOAD_3      ", /* ALOAD_3      45 */
-       "IALOAD       ", /*              46 */
-       "LALOAD       ", /*              47 */
-       "FALOAD       ", /*              48 */
-       "DALOAD       ", /*              49 */
-       "AALOAD       ", /*              50 */
-       "BALOAD       ", /*              51 */
-       "CALOAD       ", /*              52 */
-       "SALOAD       ", /*              53 */
-       "ISTORE       ", /*              54 */
-       "LSTORE       ", /*              55 */
-       "FSTORE       ", /*              56 */
-       "DSTORE       ", /*              57 */
-       "ASTORE       ", /*              58 */
-       "ISTORE_0     ", /* ISTORE_0     59 */
-       "ISTORE_1     ", /* ISTORE_1     60 */
-       "ISTORE_2     ", /* ISTORE_2     61 */
-       "ISTORE_3     ", /* ISTORE_3     62 */
-       "LSTORE_0     ", /* LSTORE_0     63 */
-       "LSTORE_1     ", /* LSTORE_1     64 */
-       "LSTORE_2     ", /* LSTORE_2     65 */
-       "LSTORE_3     ", /* LSTORE_3     66 */
-       "FSTORE_0     ", /* FSTORE_0     67 */
-       "FSTORE_1     ", /* FSTORE_1     68 */
-       "FSTORE_2     ", /* FSTORE_2     69 */
-       "FSTORE_3     ", /* FSTORE_3     70 */
-       "DSTORE_0     ", /* DSTORE_0     71 */
-       "DSTORE_1     ", /* DSTORE_1     72 */
-       "DSTORE_2     ", /* DSTORE_2     73 */
-       "DSTORE_3     ", /* DSTORE_3     74 */
-       "ASTORE_0     ", /* ASTORE_0     75 */
-       "ASTORE_1     ", /* ASTORE_1     76 */
-       "ASTORE_2     ", /* ASTORE_2     77 */
-       "ASTORE_3     ", /* ASTORE_3     78 */
-       "IASTORE      ", /*              79 */
-       "LASTORE      ", /*              80 */
-       "FASTORE      ", /*              81 */
-       "DASTORE      ", /*              82 */
-       "AASTORE      ", /*              83 */
-       "BASTORE      ", /*              84 */
-       "CASTORE      ", /*              85 */
-       "SASTORE      ", /*              86 */
-       "POP          ", /*              87 */
-       "POP2         ", /*              88 */
-       "DUP          ", /*              89 */
-       "DUP_X1       ", /*              90 */
-       "DUP_X2       ", /*              91 */
-       "DUP2         ", /*              92 */
-       "DUP2_X1      ", /*              93 */
-       "DUP2_X2      ", /*              94 */
-       "SWAP         ", /*              95 */
-       "IADD         ", /*              96 */
-       "LADD         ", /*              97 */
-       "FADD         ", /*              98 */
-       "DADD         ", /*              99 */
-       "ISUB         ", /*             100 */
-       "LSUB         ", /*             101 */
-       "FSUB         ", /*             102 */
-       "DSUB         ", /*             103 */
-       "IMUL         ", /*             104 */
-       "LMUL         ", /*             105 */
-       "FMUL         ", /*             106 */
-       "DMUL         ", /*             107 */
-       "IDIV         ", /*             108 */
-       "LDIV         ", /*             109 */
-       "FDIV         ", /*             110 */
-       "DDIV         ", /*             111 */
-       "IREM         ", /*             112 */
-       "LREM         ", /*             113 */
-       "FREM         ", /*             114 */
-       "DREM         ", /*             115 */
-       "INEG         ", /*             116 */
-       "LNEG         ", /*             117 */
-       "FNEG         ", /*             118 */
-       "DNEG         ", /*             119 */
-       "ISHL         ", /*             120 */
-       "LSHL         ", /*             121 */
-       "ISHR         ", /*             122 */
-       "LSHR         ", /*             123 */
-       "IUSHR        ", /*             124 */
-       "LUSHR        ", /*             125 */
-       "IAND         ", /*             126 */
-       "LAND         ", /*             127 */
-       "IOR          ", /*             128 */
-       "LOR          ", /*             129 */
-       "IXOR         ", /*             130 */
-       "LXOR         ", /*             131 */
-       "IINC         ", /*             132 */
-       "I2L          ", /*             133 */
-       "I2F          ", /*             134 */
-       "I2D          ", /*             135 */
-       "L2I          ", /*             136 */
-       "L2F          ", /*             137 */
-       "L2D          ", /*             138 */
-       "F2I          ", /*             139 */
-       "F2L          ", /*             140 */
-       "F2D          ", /*             141 */
-       "D2I          ", /*             142 */
-       "D2L          ", /*             143 */
-       "D2F          ", /*             144 */
-       "INT2BYTE     ", /*             145 */
-       "INT2CHAR     ", /*             146 */
-       "INT2SHORT    ", /*             147 */
-       "LCMP         ", /*             148 */
-       "FCMPL        ", /*             149 */
-       "FCMPG        ", /*             150 */
-       "DCMPL        ", /*             151 */
-       "DCMPG        ", /*             152 */
-       "IFEQ         ", /*             153 */
-       "IFNE         ", /*             154 */
-       "IFLT         ", /*             155 */
-       "IFGE         ", /*             156 */
-       "IFGT         ", /*             157 */
-       "IFLE         ", /*             158 */
-       "IF_ICMPEQ    ", /*             159 */
-       "IF_ICMPNE    ", /*             160 */
-       "IF_ICMPLT    ", /*             161 */
-       "IF_ICMPGE    ", /*             162 */
-       "IF_ICMPGT    ", /*             163 */
-       "IF_ICMPLE    ", /*             164 */
-       "IF_ACMPEQ    ", /*             165 */
-       "IF_ACMPNE    ", /*             166 */
-       "GOTO         ", /*             167 */
-       "JSR          ", /*             168 */
-       "RET          ", /*             169 */
-       "TABLESWITCH  ", /*             170 */
-       "LOOKUPSWITCH ", /*             171 */
-       "IRETURN      ", /*             172 */
-       "LRETURN      ", /*             173 */
-       "FRETURN      ", /*             174 */
-       "DRETURN      ", /*             175 */
-       "ARETURN      ", /*             176 */
-       "RETURN       ", /*             177 */
-       "GETSTATIC    ", /*             178 */
-       "PUTSTATIC    ", /*             179 */
-       "GETFIELD     ", /*             180 */
-       "PUTFIELD     ", /*             181 */
-       "INVOKEVIRTUAL", /*             182 */
-       "INVOKESPECIAL", /*             183 */
-       "INVOKESTATIC ", /*             184 */
-       "INVOKEINTERFACE",/*            185 */
-       "CHECKASIZE   ", /* UNDEF186    186 */
-       "NEW          ", /*             187 */
-       "NEWARRAY     ", /*             188 */
-       "ANEWARRAY    ", /*             189 */
-       "ARRAYLENGTH  ", /*             190 */
-       "ATHROW       ", /*             191 */
-       "CHECKCAST    ", /*             192 */
-       "INSTANCEOF   ", /*             193 */
-       "MONITORENTER ", /*             194 */
-       "MONITOREXIT  ", /*             195 */
-       "WIDE         ", /* WIDE        196 */
-       "MULTIANEWARRAY",/*             197 */
-       "IFNULL       ", /*             198 */
-       "IFNONNULL    ", /*             199 */
-       "GOTO_W       ", /* GOTO_W      200 */
-       "JSR_W        ", /* JSR_W       201 */
-       "BREAKPOINT  ", /* BREAKPOINT  202 */
-
-                             "UNDEF203","UNDEF204","UNDEF205",
-       "UNDEF206","UNDEF207","UNDEF208","UNDEF209","UNDEF210",
-       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
-       "UNDEF216","UNDEF217","UNDEF218","UNDEF219","UNDEF220",
-       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
-       "UNDEF226","UNDEF227","UNDEF228","UNDEF229","UNDEF230",
-       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
-       "UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
-       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
-       "UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
-       "UNDEF251","UNDEF252",
-
-       "BUILTIN3     ", /*             253 */
-       "BUILTIN2     ", /*             254 */
-       "BUILTIN1     "  /*             255 */
-    };
-
+#endif /* USEBUILTINTABLE */
 
 
 /***************************** register types *********************************/
@@ -1299,6 +868,7 @@ static char *opcode_names[256] = {
 #define PARAMMODE_NUMBERED  0 
 #define PARAMMODE_STUFFED   1
 
+
 /***************************** register info block ****************************/
 
 extern int nregdescint[];   /* description of integer registers               */
@@ -1306,15 +876,24 @@ extern int nregdescfloat[]; /* description of floating point registers        */
 
 extern int nreg_parammode;
 
-void asm_handle_exception();
-void asm_handle_nat_exception();
-
 #if defined(__I386__) || defined(__X86_64__)
-static void disassinstr(u1 *code, int pos);     /* disassemble an instruction */
-static void disassemble(u1 *code, int len);     /* disassemble a code block   */
 #else
 static void disassinstr (int c, int pos);       /* disassemble an instruction */
 static void disassemble (int *code, int len);   /* disassemble a code block   */
 #endif
 
-#endif
+#endif /* _JITDEF_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/loop/Makefile.am b/jit/loop/Makefile.am
new file mode 100644 (file)
index 0000000..23dc941
--- /dev/null
@@ -0,0 +1,25 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+INCLUDES = -I$(top_srcdir)/jit/@ARCH_DIR@ -I$(top_srcdir)/jit
+
+EXTRA_DIST = \
+       graph.c \
+       loop.c \
+       loop.h \
+       analyze.c \
+       tracing.c
+
+noinst_LIBRARIES = libloop.a
+
+libloop_a_SOURCES = loop.c analyze.c graph.c tracing.c
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
diff --git a/jit/loop/analyze.c b/jit/loop/analyze.c
new file mode 100644 (file)
index 0000000..ede8b50
--- /dev/null
@@ -0,0 +1,3607 @@
+/* jit/loop/analyze.c - bound check removal functions
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel
+
+   Contains the functions which perform the bound check removals. With
+   the loops identified, these functions scan the code for array
+   accesses that take place in loops and try to guarantee that their
+   bounds are never violated. The function to call is
+   optimize_loops().
+
+   $Id: analyze.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdlib.h>
+#include "analyze.h"
+#include "loop.h"
+#include "graph.h"
+#include "tracing.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+#ifdef LOOP_DEBUG
+
+/*     Test functions -> will be removed in final release
+*/
+
+void show_trace(struct Trace *trace)
+{
+       if (trace != NULL) {
+               switch (trace->type) {
+               case TRACE_IVAR:
+                       printf("int-var");
+                       printf("\nNr.:\t%d", trace->var);
+                       printf("\nValue:\t%d", trace->constant);
+                       break;
+      
+               case TRACE_AVAR:
+                       printf("object-var");
+                       printf("\nNr.:\t%d", trace->var);
+                       break;
+      
+               case TRACE_ALENGTH:
+                       printf("array-length");
+                       printf("\nNr.:\t%d", trace->var);
+                       printf("\nValue:\t%d", trace->constant);
+                       break;
+
+               case TRACE_ICONST:
+                       printf("int-const");
+                       printf("\nValue:\t%d", trace->constant);
+                       break;
+      
+               case TRACE_UNKNOWN:
+                       printf("unknown");
+                       break;
+                       }
+               }
+       else
+               printf("Trace is null");
+       
+       printf("\n");
+}
+
+
+void show_change(struct Changes *c)
+{
+       printf("*** Changes ***\n");
+       if (c != NULL)
+               printf("Lower/Upper Bound:\t%d/%d\n", c->lower_bound, c->upper_bound);
+       else
+               printf("Unrestricted\n");
+}
+
+show_varinfo(struct LoopVar *lv)
+{
+       printf("   *** Loop Info ***\n");
+       printf("Value:\t%d\n", lv->value);
+       printf("Static:\t\t%d/%d\n", lv->static_l, lv->static_u);
+       printf("D-Valid:\t%d/%d\n", lv->dynamic_l_v, lv->dynamic_u_v);
+       printf("Dynamic\t\t%d/%d\n", lv->dynamic_l, lv->dynamic_u);
+}
+
+void show_right_side()
+{
+       int i;
+       printf("\n   *** Head ***   \nType:\t");
+       show_trace(c_rightside);
+
+       printf("\n   *** Nested Loops: ***\n");
+       for (i=0; i<block_count; ++i) 
+               printf("%d\t", c_nestedLoops[i]);
+       printf("\n");
+
+       printf("\n   *** Hierarchie: ***\n");   
+       for (i=0; i<block_count; ++i) 
+               printf("%d\t", c_hierarchie[i]);
+       printf("\n");
+       
+
+       printf("\n   *** Current Loop ***\n");
+       for (i=0; i<block_count; ++i)
+           printf("%d\t", c_current_loop[i]);
+       printf("\n");
+}
+
+void resultPass3()
+{
+       int i;
+       struct LoopContainer *lc = c_allLoops;
+  
+       printf("\n\n****** PASS 3 ******\n\n");
+  
+       while (lc != NULL) {
+               printf("Loop Analysis:\n");
+               printf("Optimize:\t%d\n", lc->toOpt);
+               printf("Modified Vars: ");
+               /*
+               for (i=0; i<lc->num_vars; ++i)
+                 printf("%d ", lc->vars[i]);
+               printf("\n\n");
+               */
+               lc = lc->next;
+               }
+
+       printf("\nNested Loops:\n");
+       for (i=0; i<block_count; ++i)
+           printf("%d ", c_nestedLoops[i]);
+       printf("\n");
+       for (i=0; i<block_count; ++i) 
+               printf("%d ", c_hierarchie[i]);
+       printf("\n");
+       fflush(stdout);
+}
+
+void show_tree(struct LoopContainer *lc, int tabs) 
+{
+       int cnt;
+
+       while (lc != NULL) {
+               for (cnt = 0; cnt < tabs; ++cnt)
+                       printf("  ");
+               printf("%d\n", lc->loop_head);
+
+               show_tree(lc->tree_down, tabs+1);
+
+               lc = lc->tree_right;
+       }
+}
+
+#endif
+
+#ifdef STATISTICS
+
+void show_loop_statistics()
+{
+       printf("\n\n****** LOOP STATISTICS ****** \n\n");
+       if (c_stat_or) 
+           printf("Optimization cancelled by or\n");
+       else if (c_stat_exception)
+           printf("Optimization cancelled by exception\n");
+       else {
+               printf("Number of array accesses:\t%d\n", c_stat_array_accesses);
+               if (c_stat_array_accesses) {
+                       printf("\nFully optimized:\t%d\n", c_stat_full_opt);
+                       printf("Not optimized:\t\t%d\n", c_stat_no_opt);
+                       printf("Upper optimized:\t%d\n", c_stat_upper_opt);
+                       printf("Lower optimized:\t%d\n", c_stat_lower_opt);
+                       }
+               }
+}
+
+void show_procedure_statistics()
+{
+       printf("\n\n****** PROCEDURE STATISTICS ****** \n\n");
+       printf("Number of loops:\t\t%d\n", c_stat_num_loops);
+       printf("Number of array accesses:\t%d\n", c_stat_sum_accesses);
+       if (c_stat_sum_accesses) {
+               printf("\nFully optimized:\t%d\n", c_stat_sum_full);
+               printf("Not optimized:\t\t%d\n", c_stat_sum_no);
+               printf("Upper optimized:\t%d\n", c_stat_sum_upper);
+               printf("Lower optimized:\t%d\n", c_stat_sum_lower);
+               }
+       printf("Opt. cancelled by or:\t\t%d\n", c_stat_sum_or);
+       printf("Opt. cancelled by exception:\t%d\n", c_stat_sum_exception);
+}
+
+#endif
+
+
+/*     This function is used to merge two loops with the same header together.
+       A simple merge sort of the lists nodes of both loops is performed.
+*/
+void analyze_merge(struct LoopContainer *l1, struct LoopContainer *l2)
+{
+       struct LoopElement *start, *last, *le1, *le2; 
+       /* start and last are pointers to the newly built list, le1 and le2 step  */
+       /* step through the lists, that have to be merged.                        */
+
+       le1 = l1->nodes;
+       le2 = l2->nodes;
+
+       /* start a simple merge sort of the nodes of both loops. These lists are  */
+       /* already sorted, so merging is easy.                                    */
+       if (le1->node < le2->node) {
+               start = last = le1;
+               le1 = le1->next;
+               }
+       else if (le1->node == le2->node) {
+               start = last = le1;
+               le1 = le1->next;
+               le2 = le2->next;
+               }
+       else {
+               start = last = le2;
+               le2 = le2->next;
+               }
+
+       /* while the first loop != NULL, depending of the first element of second */
+       /* loop, add new node to result list                                      */
+       while (le1 != NULL) {
+
+               if (le2 == NULL) {
+                       last->next = le1;
+                       break;
+                       }
+               if (le1->node < le2->node) {
+                       last->next = le1;
+                       le1 = le1->next;
+                       }
+               else if (le1->node == le2->node) {
+                       last->next = le1;
+                       le1 = le1->next;
+                       le2 = le2->next;
+                       last = last->next;
+                       }
+               else {
+                       last->next = le2;
+                       le2 = le2->next;
+                       last = last->next;
+                       }
+               }
+
+       last->next = le2;                       
+}
+
+
+/*     This function is used to merge loops with the same header node to a single 
+       one. O(n^2) of number of loops. This merginig is necessary, because the loop
+       finding algorith sometimes (eg. when loopbody ends with a if-else construct)
+       reports a single loop as two loops with the same header node.
+*/
+void analyze_double_headers()
+{
+       int toCheck;
+       struct LoopContainer *t1, *t2, *t3;
+
+       t1 = c_allLoops;
+
+       while (t1 != NULL)      {                       /* for all loops do                                                     */
+               toCheck = t1->loop_head;        /* get header node                                                      */
+               t2 = t1->next;
+
+               while (t2 != NULL) {            /* compare it to headers of rest                        */
+                       if (t2->loop_head == toCheck) {
+
+                               /* found overlapping loops -> merge them together                               */
+                               /* printf("C_INFO: found overlapping loops - merging");         */
+                               analyze_merge(t1, t2);
+                               
+                               /* remove second loop from the list     of all loops                            */
+                               t3 = t1;       
+                               while (t3->next != t2)
+                                       t3 = t3->next;
+                               t3->next = t2->next;
+                               }
+                       t2 = t2->next;
+                   }
+
+               t1 = t1->next;
+           }
+}
+
+
+/* After the hierarchie of loops has been built, we have to insert the exceptions
+   into this tree. The exception ex is inserted into the subtree pointed to by
+   LoopContainer lc.
+*/
+void insert_exception(struct LoopContainer *lc, xtable *ex)
+{
+       struct LoopContainer *temp;
+       struct LoopElement *le;
+
+#ifdef LOOP_DEBUG
+       /* printf("insert_exception called with %d-%d and loop %d\n", ex->start->debug_nr, ex->end->debug_nr, lc->loop_head); */
+#endif
+       
+       /* if child node is reached immediately insert exception into the tree    */
+       if (lc->tree_down == NULL) {
+               ex->next = lc->exceptions;
+               lc->exceptions = ex;
+           }
+       else {
+       /* if we are inside the tree, there are two possibilities:                */
+       /* 1. the exception is inside a nested loop or                            */
+       /* 2. in the loop body of the current loop                                */
+
+               /* check all children (= nested loops)                                */
+               temp = lc->tree_down;
+               
+               while (temp != NULL) {
+                       
+                       le = temp->nodes;
+                       while (le != NULL) {
+
+#ifdef LOOP_DEBUG
+                               printf("%d.%d\n", le->node, block_index[ex->startpc]);
+#endif
+                               /* if the start of the exception is part of the loop, the     */
+                               /* whole exception must be part of the loop                   */
+                               if (le->node == block_index[ex->startpc])
+                                       break;
+                               le = le->next;
+                           }
+                       
+                       /* Exception is part of a nested loop (Case 1) -> insert it there */
+                       if (le != NULL) {
+                               insert_exception(temp, ex);
+                               return;
+                           }
+                       else if ((temp->loop_head >= block_index[ex->startpc]) && (temp->loop_head < block_index[ex->endpc])) {
+                               
+                               /* optimization: if nested loop is part of the exception, the */
+                               /* exception cannot be part of a differnet nested loop.       */
+                               ex->next = lc->exceptions;
+                               lc->exceptions = ex;
+                               return;
+                           }
+                       else
+                               temp = temp->tree_right;
+                   }
+                   
+               /* Exception is not contained in any nested loop (Case 2)             */
+               if (temp == NULL) {
+                       ex->next = lc->exceptions;
+                       lc->exceptions = ex;
+                   }
+           } 
+}
+
+
+/*     This function builds a loop hierarchie. The header node of the innermost loop,
+       each basic block belongs to, is stored in the array c_nestedLoops. The array
+       c_hierarchie stores the relationship between differnt loops in as follows: 
+    Each loop, that is a nested loop, stores its direct surrounding loop as a 
+    parent. Top level loops have no parents.
+*/
+void analyze_nested()
+{
+       /* i/count/tmp are counters                                               */
+       /* toOverwrite is used while loop hierarchie is built (see below)         */
+       int i, header, toOverwrite, tmp, len;
+
+       /* first/last are used during topological sort to build ordered loop list */
+       struct LoopContainer *first, *last, *start, *t, *temp;
+
+       /* Used to step through all nodes of a loop.                              */
+       struct LoopElement *le; 
+
+       /* init global structures                                                 */
+       c_nestedLoops = DMNEW(int, block_count);
+       c_hierarchie = DMNEW(int, block_count);         
+       for (i=0; i<block_count; ++i) {
+               c_nestedLoops[i] = -1;
+               c_hierarchie[i] = -1;
+           }
+
+       /* if there are no optimizable loops -> return                            */
+       if (c_allLoops == NULL)
+               return;
+
+       temp = c_allLoops;
+       while (temp != NULL) {              /* for all loops, do                  */
+               header = temp->loop_head;
+
+               /* toOverwrite is number of current parent loop (-1 if none)          */
+               toOverwrite = c_nestedLoops[header];    
+
+               c_hierarchie[header] = toOverwrite;
+
+               if (toOverwrite == header)      /* check for loops with same header   */
+                       printf("C_ERROR: Loops have same header\n");
+
+               le = temp->nodes;
+               while (le != NULL) {            /* for all loop nodes, do             */
+                       tmp = c_nestedLoops[le->node];
+
+                   /* if node is part of parent loop -> overwrite it with nested     */
+                       if (tmp == toOverwrite)
+                               c_nestedLoops[le->node] = header;
+                       else {
+                               c_hierarchie[tmp] = header;
+#ifdef LOOP_DEBUG
+                               /* printf("set head of %d to %d", tmp, header);               */
+#endif
+                           }
+
+                       le = le->next;
+                       }
+
+               temp = temp->next;
+               }
+
+       /* init root of hierarchie tree                                           */
+       root = DMNEW(struct LoopContainer, 1);
+       LoopContainerInit(root, -1);
+
+    /* obtain parent pointer and build hierarchie tree                        */
+    start = c_allLoops;    
+    while (start != NULL) {
+               
+               /* look for parent of loop pointed at by start                        */
+               first = c_allLoops;
+               while (first != NULL) {
+
+                       /* the parent of the loop, pointed at by start has been found     */
+                       if (first->loop_head == c_hierarchie[start->loop_head]) {
+#ifdef LOOP_DEBUG
+                               /* printf("set parent to pointer\n");                         */
+#endif
+
+                               start->parent = first;
+                               start->tree_right = first->tree_down;
+                               first->tree_down = start;
+
+                               break;
+                           }
+                       first = first->next;
+                   }
+
+               /* no parent loop found, set parent to root                           */
+               if (first == NULL) {
+#ifdef LOOP_DEBUG
+                       /* printf("set parent to root\n");                                */
+#endif
+                       start->parent = root;
+                       start->tree_right = root->tree_down;
+                       root->tree_down = start;                
+                   }
+               /* if a parent exists, increase this nodes indegree                   */
+               else
+                       start->parent->in_degree += 1;
+
+               start = start->next;
+           }
+
+       /* insert exceptions into tree                                            */
+#ifdef LOOP_DEBUG
+       printf("--- Showing tree ---\n");
+       show_tree(root, 0);
+       printf(" --- End ---\n");
+#endif
+       for (len = 0; len < exceptiontablelength; ++len) 
+               insert_exception(root, extable + len);
+
+
+       /* determine sequence of loops for optimization by topological sort       */
+
+       /* init queue                                                             */
+       start = NULL;
+       temp = c_allLoops;
+       while (temp != NULL) {
+
+               /* a loops with indegree == 0 are pushed onto the stack               */
+               if (temp->in_degree == 0) {
+                       t = temp->next;
+                       temp->next = start;
+                       start = temp;
+                       }
+               else 
+                       t = temp->next;
+                   
+               temp = t;
+               }
+
+       /* sort loops                                                             */
+       first = last = start;
+       start = start->next;
+
+       if (last == NULL) {
+               printf("C_ERROR: loops are looped\n");
+               exit(-1);
+           }
+
+       /* pop each node from the stack and decrease its parents indegree by one  */
+       /* when the parents indegree reaches zero, push it onto the stack as well */
+       if ((last->parent != root) && (--last->parent->in_degree == 0)) {
+               last->parent->next = start;
+               start = last->parent;
+               }
+       while (start != NULL) {
+
+               last->next = start;
+
+               start = start->next;
+               last = last->next;
+               
+               if ((last->parent != root) && (--last->parent->in_degree == 0)) {
+                       last->parent->next = start;
+                       start = last->parent;
+                       }
+               }
+
+       last->next = NULL;
+       c_allLoops = first;
+
+#ifdef LOOP_DEBUG
+       printf("*** Hierarchie Results \n");
+       while (first != NULL) {
+               printf("%d ", first->loop_head);
+               first = first->next;
+           }
+       printf("\n");
+       fflush(stdout);
+#endif 
+}
+
+/*     This function is used to add variables that occur as index variables in
+       array accesses (ARRAY_INDEX) or as variables, that change their value (VAR_MOD)
+       to the list of interesting vars (c_loopvars) for the current loop.
+*/
+void add_to_vars(int var, int type, int direction)
+{
+       struct LoopVar *lv;     
+
+       /* printf("Added to vars %d %d %d\n", var, type, direction);              */
+       lv = c_loopvars;
+       while (lv != NULL) {            /* check if var has been previously added */
+               if (lv->value == var) {
+                       if (type == ARRAY_INDEX)
+                               lv->index = 1;              /* var is used as index           */
+                       else if (type == VAR_MOD) {
+                               lv->modified = 1;           /* var is used in assignment      */
+                               switch (direction) {        /* how was var modified ?         */
+                               case D_UP:
+                                       lv->static_u = 0;       /* incremented, no static upper   */
+                                       break;                  /* bound can be guaranteeed       */
+                               case D_DOWN:
+                                       lv->static_l = 0;       /* decremented, no static lower   */
+                                       break;                  /* bound can be guaranteeed       */
+                               case D_UNKNOWN:
+                                       lv->static_u = lv->static_l = 0;
+                                       break;                  /* no info at all                 */
+                               default:
+                                       printf("C_ERROR: unknown direction\n");
+                                       break;
+                                       }
+                               }
+                       return;
+                       }
+               lv = lv->next;
+               }
+
+       /* variable is not found in list -> add variable to list                                        */
+       lv = DNEW(struct LoopVar);
+
+       lv->modified = lv->index = 0;
+       lv->value = var;
+
+       if (type == ARRAY_INDEX) {
+               lv->index = 1;
+               lv->static_u = lv->static_l = 1;    /* arrayindex -> var not modified */
+               }
+       else if (type == VAR_MOD) {
+               lv->modified = 1;
+               switch (direction) {                /* var used in assignment -> set  */
+               case D_UP:                          /* proper static bounds           */
+                       lv->static_u = 0; lv->static_l = 1;
+                       break;
+               case D_DOWN:
+                       lv->static_u = 1; lv->static_l = 0;
+                       break;
+               case D_UNKNOWN:
+                       lv->static_u = lv->static_l = 0;
+                       break;
+               default:
+                       printf("C_ERROR: unknown direction\n");
+                       break;
+                       }
+               }
+
+       /* no dynamic bounds have been determined so far                          */
+       lv->dynamic_l = lv->dynamic_l_v = lv->dynamic_u = lv->dynamic_u_v = 0;
+
+       lv->next = c_loopvars;                  /* add var to list                */
+       c_loopvars = lv;
+}
+
+/*     This function checks, whether a given loop with header node contains array
+       accesses. If so, it returns 1, else it returns 0 and the loops needs no
+       further consideration in the optimization process. When array accesses are 
+       found, a list of all variables, that are used as array index, is built and 
+       stored in c_loopvars. For all variables (integer), which values are changed, 
+       a flag in c_var_modified is set.
+*/
+int analyze_for_array_access(int node)
+{
+       basicblock bp;
+       instruction *ip;
+       int ic, i, access;
+       struct depthElement *d;
+       struct Trace *t;
+
+       if (c_toVisit[node] > 0) {          /* node has not been visited yet      */
+               c_toVisit[node] = 0;
+   
+               bp = block[node];               /* prepare an instruction scan        */
+               ip = bp.iinstr;
+               ic = bp.icount;
+
+               access = 0;                     /* number of array accesses in loop   */
+
+               for (i=0; i<ic; ++i, ++ip) {    /* for each instruction, check opcode */
+                       switch (ip->opc) {
+                       case ICMD_IASTORE:          /* array store                        */
+                       case ICMD_LASTORE:          
+                       case ICMD_FASTORE:          
+                       case ICMD_DASTORE:          
+                       case ICMD_AASTORE:          
+                       case ICMD_BASTORE:          
+                       case ICMD_CASTORE:          
+                       case ICMD_SASTORE:
+                               t = tracing(&bp, i-1, 1);   /* try to identify index variable */
+
+                               if (t->type == TRACE_IVAR) {
+                                       /* if it is a variable, add it to list of index variables */
+                                       add_to_vars(t->var, ARRAY_INDEX, D_UNKNOWN);
+                                       access++;                               
+                               }
+                               else if (t->type == TRACE_ICONST)
+                                       access++;
+                               break;
+      
+                       case ICMD_IALOAD:                               /* array load                                           */
+                   case ICMD_LALOAD:       
+                       case ICMD_FALOAD:
+                       case ICMD_DALOAD:
+                       case ICMD_AALOAD:
+                       case ICMD_BALOAD:
+                       case ICMD_CALOAD:
+                       case ICMD_SALOAD:
+                               t = tracing(&bp, i-1, 0);   /* try to identify index variable */
+               
+                               if (t->type == TRACE_IVAR) {
+                                       /* if it is a variable, add it to list of index variables */
+                                       add_to_vars(t->var, ARRAY_INDEX, D_UNKNOWN);
+                                       access++;
+                                       }
+                               else if (t->type == TRACE_ICONST)
+                                       access++;
+                               break;
+
+                       case ICMD_ISTORE:                               /* integer store                                        */
+                               c_var_modified[ip->op1] = 1;
+
+                               /* try to find out, how it was modified                                                 */
+                               t = tracing(&bp, i-1, 0);       
+                               if (t->type == TRACE_IVAR) {
+                                       if ((t->constant > 0) && (t->var == ip->op1))
+                                               /* a constant was added to the same var                                 */
+                                               add_to_vars(t->var, VAR_MOD, D_UP);
+                                       else if (t->var == ip->op1)     
+                                               /* a constant was subtracted from the same var                  */
+                                               add_to_vars(t->var, VAR_MOD, D_DOWN);
+                                       else
+                                               add_to_vars(t->var, VAR_MOD, D_UNKNOWN);
+                                       }
+                               else
+                                       add_to_vars(ip->op1, VAR_MOD, D_UNKNOWN);
+                               break;
+
+                       case ICMD_IINC:                                 /* simple add/sub of a constant         */
+                               c_var_modified[ip->op1] = 1;
+               
+                               if (ip->val.i > 0)
+                                       add_to_vars(ip->op1, VAR_MOD, D_UP);
+                               else
+                                       add_to_vars(ip->op1, VAR_MOD, D_DOWN);
+                               break;
+
+                       case ICMD_LSTORE:
+                       case ICMD_FSTORE:
+                       case ICMD_DSTORE:
+                       case ICMD_ASTORE:
+                               c_var_modified[ip->op1] = 1;
+                               break;
+                       }
+               }
+
+               d = c_dTable[node];
+               while (d != NULL) {                                     /* check all successors of block        */
+                       access += analyze_for_array_access(d->value);
+                       d = d->next;
+                       }
+
+               return access;
+               }
+       else
+               return 0;
+}
+
+/*     This function scans the exception graph structure to find modifications of
+       array index variables of the current loop. If any modifications are found,
+       1 is returned, else 0.
+*/
+int quick_scan(int node)
+{
+       basicblock bp;
+       instruction *ip;
+       int count, i;
+       struct LoopVar *lv;
+       struct depthElement *d;
+  
+       /*  printf("QS: %d - %d\n", node, c_exceptionVisit[node]);                                      */
+   
+
+       if (c_exceptionVisit[node] > 0) {       /* node is part of exception graph              */
+               c_exceptionVisit[node] = -1;
+               
+               bp = block[node];                               /* setup scan of all instructions               */
+               ip = bp.iinstr;
+               count = bp.icount;                              
+
+               for (i=0; i<count; ++i, ++ip) { /* for each instruction do                              */
+                       switch (ip->opc) {
+                       case ICMD_ISTORE:
+                       case ICMD_IINC:                         /* a variable is modified                               */
+       
+                               lv = c_loopvars;                /* is it an array index var ?                   */
+                               while (lv != NULL) {
+                                       if ((lv->index) && (lv->value == ip->op1))
+                                               return 1;               /* yes, so return 1                                             */
+                                       lv = lv->next;
+                                       }
+                               break;
+                               }
+                       }
+  
+           d = c_exceptionGraph[node];         /* check all successor nodes                    */
+               while (d != NULL) {
+                       if (quick_scan(d->value) > 0)
+                               return 1;                               /* if an access is found return 1               */
+                       d = d->next;
+                       }
+
+               return 0;                                               /* nothing found, so return 0                   */
+               }
+       else
+               return 0;
+}
+
+/*     This function returns 1, when the condition of the loop contains 
+       or statements or when an array index variable is modified in any
+       catch block within the loop.
+*/
+int analyze_or_exceptions(int head, struct LoopContainer *lc)
+{
+       struct depthElement *d;
+       int i, k, value, flag, count;
+       struct LoopElement *le;
+
+       d = c_dTable[head];
+       count = flag = 0;
+
+       /* analyze for or-statements                                                                                            */
+#ifdef LOOP_DEBUG
+       printf("*** Analyze for OR ... ");                                                                              
+       fflush(stdout);
+#endif
+
+       while (d != NULL) {                             /* for all successor nodes check if they        */
+               value = d->value;                       /* are part of the loop                                         */
+
+               le = lc->nodes;
+
+               while (le != NULL) {
+                       if (le->node == value)
+                               break;
+                       le = le->next;
+                       }
+
+               if (le == NULL)                         /* node is not part of the loop                         */
+                       ++flag;                                 
+
+               d = d->next;
+               ++count;
+               }
+
+       if ((count > 1) && (flag == 0)){/* if all successors part of the loop, exit */
+#ifdef STATISTICS
+               c_stat_or++;
+#endif
+               return 0;
+               }
+
+       /* check for exceptions */
+       /* printf("done\n*** Analyze for EXCEPTIONS(%d) . ", exceptiontablelength);     */
+
+       if (!exceptiontablelength)              /* when there are no exceptions, exit           */
+               return 1;
+
+       if ((c_exceptionGraph = (struct depthElement **) malloc(sizeof(struct depthElement *) * block_count)) == NULL)
+               c_mem_error();
+       if ((c_exceptionVisit = (int *) malloc(sizeof(int) * block_count)) == NULL)
+               c_mem_error();
+       
+       for (k=0; k<block_count; ++k) {
+               c_exceptionVisit[k] = -1;
+               c_exceptionGraph[k] = NULL;
+               }
+
+
+       /* for all nodes that start catch block check whether they are part of loop     */
+       for (i = 0; i < c_old_xtablelength; i++) {      
+               value = block_index[extable[i].startpc];
+   
+               le = lc->nodes;
+               while (le != NULL) {
+
+                       if (le->node == value)  {                       /* exception is in loop                 */
+#ifdef LOOP_DEBUG
+                               printf("C_INFO: Loop contains exception\n");                                    
+                               fflush(stdout);
+#endif
+
+                               /* build a graph structure, that contains all nodes that are    */
+                               /* part of the catc block                                                                               */
+                               dF_Exception(-1, block_index[extable[i].handlerpc]);
+
+                               /* if array index variables are modified there, return 0                */
+                               if (quick_scan(block_index[extable[i].handlerpc]) > 0) {
+#ifdef STATISTICS
+                                       c_stat_exception++;
+#endif
+                                       /* printf("C_INFO: loopVar modified in exception\n");           */
+                                       return 0;
+                                       }
+                               }
+                       le = le->next;
+                       }
+               }
+
+#ifdef LOOP_DEBUG
+       printf("none ... done\n");                                                                                              
+       fflush(stdout);
+#endif
+       return 1;
+}
+
+/*     This function sets a flag in c_var_modified for all variables that have
+       been found as part of an assigment in the loop.
+*/
+void scan_global_list()
+{
+       struct LoopVar *lv;
+       lv = c_loopvars;
+
+       while (lv != NULL) {
+               if (lv->modified)
+                       c_var_modified[lv->value] = 1;
+               lv = lv->next;
+               }
+}
+
+/*     This function analyses the condition in the loop header and trys to find
+       out, whether some dynamic guarantees can be set up.
+*/
+void init_constraints(int head)
+{
+       basicblock bp;
+       instruction *ip;
+       int ic, l_mod, r_mod, changed, operand;
+       struct Trace *left, *right, *th;
+       struct LoopVar *lv_left, *lv_right, *lh;
+
+       bp = block[head];
+       ic = bp.icount;
+       ip = bp.iinstr+(ic-1);  /* set ip to last instruction in header node            */
+
+       switch (ip->opc) {              /* check op-code                                                                        */
+               
+       /* comparison against constant value                                                                            */
+       case ICMD_IFEQ:                 /* ..., value ==> ...                                                           */
+       case ICMD_IFLT:         /* ..., value ==> ...                                                           */
+       case ICMD_IFLE:         /* ..., value ==> ...                                                           */
+       case ICMD_IFGT:         /* ..., value ==> ...                                                           */
+       case ICMD_IFGE:         /* ..., value ==> ...                                                           */
+                                                       /* op1 = target JavaVM pc, val.i = constant                     */
+
+               left = tracing(&bp, ic-2, 0);   /* analyse left arg., right is constant */
+               right = create_trace(TRACE_ICONST, -1, ip->val.i, 0);
+               break;
+
+       /* standard comparison                                                                                                          */
+       case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                                            */
+       case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                                            */
+       case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                                            */
+       case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                                            */
+       case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                                            */
+               
+               left = tracing(&bp, ic-2, 1);   /* get left and right argument                  */
+               right = tracing(&bp, ic-2, 0);
+               break;
+       
+       /* other condition                                                                                                                      */
+       default:
+               left = create_trace(TRACE_UNKNOWN, -1, 0, 0);
+               right = create_trace(TRACE_UNKNOWN, -1, 0, 0);
+               break;
+               }
+
+       /* analyse left and right side of comparison                                                            */
+       l_mod = r_mod = 0;
+
+       if (left->type == TRACE_IVAR) { /* is a loop variable on left side ?            */
+               lv_left = c_loopvars;
+               while (lv_left != NULL) {
+                       if (lv_left->value == left->var) {
+                               l_mod = lv_left->modified;      /* yes, but has it been modified ?      */       
+                               break;                          
+                               }
+                       lv_left = lv_left->next;
+                       }
+               }
+
+       if (right->type == TRACE_IVAR){ /* is a loop variable on right side ?           */
+               lv_right = c_loopvars;
+               while (lv_right != NULL) {
+                       if (lv_right->value == right->var) {
+                               r_mod = lv_right->modified;     /* yes, but has it been modified ?      */
+                               break;
+                               }
+                       lv_right = lv_right->next;
+                       }
+               }
+
+       if ((l_mod - r_mod) == 0) {             /* both 1 or both 0 -> no dynamic contraints*/
+               c_rightside = NULL;                     /* possible                                                                     */
+               return;
+               }
+
+       /* to simplify processing, make the left side the one, that contains the        */
+       /* modified variable                                                                                                            */
+       if (r_mod > l_mod) {
+               th = left;    left = right;        right = th;
+               lh = lv_left; lv_left = lv_right;  lv_right = lh;
+               changed = 1;                            /* set changed to true                                          */
+               }
+       else
+               changed = 0;                            /* no change needed                                                     */ 
+
+       /* make sure that right side's value does not change during loop execution      */ 
+       if (right->type == TRACE_UNKNOWN) {
+               c_rightside = NULL;
+               return;
+               }
+
+       /* determine operands:                                                                                                          */
+       /* for further explaination a is modified, b nonmodified var                            */
+       switch (ip->opc) {              /* check opcode again                                                           */      
+       case ICMD_IFEQ:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                                            */
+               operand = OP_EQ;                                /* a == b                                                               */
+               break;
+
+       case ICMD_IFLE:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                                            */
+               if (changed)
+                       operand = OP_GE;                        /* b<=a         -> a>=b                                         */
+               else {
+                       operand = OP_LT;                        /* a<=b         -> a<(b+1)                                      */ 
+                       if (left->constant != 0)
+                               left->constant -= 1;
+                       else
+                               right->constant += 1;   
+                       }
+               break;
+
+       case ICMD_IFLT:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                                            */
+               if (changed) {
+                       operand = OP_GE;                        /* b<a          -> a>=(b+1)                                     */
+                       if (left->constant != 0)
+                               left->constant -= 1;
+                       else
+                               right->constant += 1;   
+                       }
+               else
+                       operand = OP_LT;                        /* a<b          -> a<b                                          */
+               break;
+
+       case ICMD_IFGT:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                                            */
+               if (changed)
+                       operand = OP_LT;                        /* b>a          -> a<b                                          */
+               else {
+                       operand = OP_GE;                        /* a>b          ->      a>=(b+1)                                */
+                       if (left->constant != 0)
+                               left->constant -= 1;
+                       else
+                               right->constant += 1;
+                       }
+               break;
+               
+       case ICMD_IFGE:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                                            */
+               if (changed) {
+                       operand = OP_LT;                        /* b>=a         -> a<(b+1)                                      */
+                       if (left->constant != 0)
+                               left->constant -= 1;
+                       else
+                               right->constant += 1;
+                       }
+               else
+                       operand = OP_GE;                        /* a>=b         -> a>=b                                         */
+               break;
+
+       default:
+               printf("C_ERROR: debugging error 0x00\n");
+               }
+
+
+       /* NOW: left/lv_left -> loopVar                                                                                         */
+       /*              right/lv_right -> const, nonmod. var, arraylength                                       */
+       switch (operand) {                                      /* check operand                                                */
+       case OP_EQ:
+               lv_left->dynamic_u_v = 1;               /* upper + lower bound tested                   */
+               lv_left->dynamic_l_v = 1;
+       
+               lv_left->dynamic_l = lv_left->dynamic_u = left->constant;
+               break;
+
+       case OP_LT:
+               lv_left->dynamic_u_v = 1;               /* upper bound tested                                   */
+       
+               lv_left->dynamic_u = left->constant;
+               break;
+
+       case OP_GE:
+               lv_left->dynamic_l_v = 1;               /* lower bound tested                                   */
+       
+               lv_left->dynamic_l = left->constant;
+               break;
+
+       default:
+               printf("C_ERROR: debugging error 0x01\n");
+               }
+
+       c_rightside = right;
+
+       switch (c_rightside->type) {
+       case TRACE_ICONST:
+               c_rs_needed_instr = 1;
+               break;
+       case TRACE_ALENGTH:
+               c_rs_needed_instr = 2;
+               break;
+       case TRACE_IVAR:
+               c_rs_needed_instr = 3;
+               break;
+       default:
+               printf("C_ERROR: wrong right-side type\n");
+               }
+}
+
+/*     This function is needed to add and record new static tests (before loop
+       entry) of variables to make guaratees for index variables. type states
+       the kind of the test. arrayRef is the array, which length is tested
+       against, varRef is the variable, that is testes and constant is the
+       constant value, that is tested.
+*/
+void add_new_constraint(int type, int arrayRef, int varRef, int constant)
+{
+       struct Constraint *tc;
+
+       switch (type) {
+       case TEST_ZERO:                                 /* a variable is tested against a const         */
+
+               tc = c_constraints[varRef];     /* does a test already exist for this var ?     */
+               while (tc != NULL) {
+                       if (tc->type == TEST_ZERO) {
+                               if (constant < tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes. update constant and return                      */
+                               }
+                               tc = tc->next;
+                       }
+
+               /* insert a new test for this variable                                                                  */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type     = TEST_ZERO;
+               tc->varRef   = varRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[varRef];
+               c_constraints[varRef] = tc;
+               c_needed_instr += 3;
+
+               break;
+
+       case TEST_ALENGTH:                              /* variable is tested against array length      */
+
+               tc = c_constraints[varRef];     /* does a test already exist for this var ?     */
+               while (tc != NULL) {
+                       if ((tc->type == TEST_ALENGTH) && (tc->arrayRef == arrayRef)) {
+                               if (constant > tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes. update constant and return                      */
+                               }
+                       tc = tc->next;
+                       }
+
+               /* insert a new test for this variable                                                                  */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_ALENGTH;
+               tc->arrayRef = arrayRef;
+               tc->varRef   = varRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[varRef];
+               c_constraints[varRef] = tc;
+               c_needed_instr += 6;
+
+               /* if arrayRef is not already tested against null, insert that test     */
+               if (!(c_null_check[arrayRef])) {
+                       c_null_check[arrayRef] = 1;
+                       c_needed_instr +=2;
+                   }
+                       
+               break;
+
+       case TEST_CONST_ZERO:           
+               /* done earlier                                                                                                                 */
+               break;
+
+       case TEST_CONST_ALENGTH:                /* a const is tested against array length       */
+
+               /* does a test already exist for this array                                                             */
+               tc = c_constraints[maxlocals];
+               while (tc != NULL) {
+                       if ((tc->type == TEST_CONST_ALENGTH) && (tc->arrayRef == arrayRef)) {
+                               if (constant > tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes. update constant and return                      */
+                               }
+                       tc = tc->next;
+                       }
+               
+               /* insert a new test for this array                                                                             */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_CONST_ALENGTH;
+               tc->arrayRef = arrayRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[maxlocals];
+               c_constraints[maxlocals] = tc;
+               c_needed_instr += 4;
+
+               /* if arrayRef is not already tested against null, insert that test     */
+               if (!(c_null_check[arrayRef])) {
+                       c_null_check[arrayRef] = 1;
+                       c_needed_instr +=2;
+                   }
+
+               break;
+
+       case TEST_UNMOD_ZERO:                   /* test unmodified var against constant         */
+
+               /* search if test already exists                                                                                */
+               tc = c_constraints[varRef];
+               while (tc != NULL) {
+                       if (tc->type == TEST_UNMOD_ZERO) {
+                               if (constant < tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes, so update constant                                      */
+                               }
+                       tc = tc->next;
+                       }
+               
+               /* else, a new test is inserted                                                                                 */              
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_UNMOD_ZERO;
+               tc->varRef   = varRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[varRef];
+               c_constraints[varRef] = tc;
+               c_needed_instr += 3;
+
+               break;
+       
+       case TEST_UNMOD_ALENGTH:                /* test unmodified var against array length     */
+
+               /* search if test alreay exists                                                                                 */
+               tc = c_constraints[varRef];
+               while (tc != NULL) {
+                       if ((tc->type == TEST_UNMOD_ALENGTH) && (tc->arrayRef == arrayRef)) {
+                               if (constant > tc->constant)
+                                       tc->constant = constant;        
+                               return;                         /* yes, so modify constants                                     */
+                               }
+                       tc = tc->next;
+                       }
+               
+               /* create new entry                                                                                                             */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_UNMOD_ALENGTH;
+               tc->varRef   = varRef;
+               tc->arrayRef = arrayRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[varRef];
+               c_constraints[varRef] = tc;
+               c_needed_instr += 6;
+
+               /* if arrayRef is not already tested against null, insert that test     */
+               if (!(c_null_check[arrayRef])) {
+                       c_null_check[arrayRef] = 1;
+                       c_needed_instr +=2;
+                   }
+
+               break;
+       
+       case TEST_RS_ZERO:                              /* test right side of the loop condition        */
+                                                                       /* against a constant - needed by dynamic       */
+                                                                       /* checks                                                                       */
+               /*!! varRef -> maxlocals */
+               /* search if test already exists                                                                                */
+               tc = c_constraints[maxlocals];
+               while (tc != NULL) {
+                       if (tc->type == TEST_RS_ZERO) {
+                               if (constant < tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes, so modify constants                                     */
+                               }
+                       tc = tc->next;
+                       }
+
+               /* create new entry                                                                                                             */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type     = TEST_RS_ZERO;
+               tc->constant = constant;
+               tc->next     = c_constraints[maxlocals];
+               c_constraints[maxlocals] = tc;
+               c_needed_instr += (2 + c_rs_needed_instr);
+
+               /* if arrayRef on right side is not already tested against null,        */
+               /* insert that test                                                     */
+               if ((c_rightside->type == TRACE_ALENGTH) && (!(c_null_check[c_rightside->var]))) {
+                       c_null_check[c_rightside->var] = 1;
+                       c_needed_instr +=2;
+                   }
+
+               break;
+               
+       case TEST_RS_ALENGTH:                   /* test right side of the loop condition        */
+                                                                       /* against array length - needed by dynamic     */
+                                                                       /* checks                                                                       */
+               /*!! varRef -> maxlocals */
+               /* search if test already exists                                                                                */
+               tc = c_constraints[maxlocals];
+               while (tc != NULL)
+               {
+                       if ((tc->type == TEST_RS_ALENGTH) && (tc->arrayRef == arrayRef))
+                       {
+                               if (constant > tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes, so modify constants                                     */
+                       }
+                       tc = tc->next;
+               }
+
+               /* create new entry                                                                                                             */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_RS_ALENGTH;
+               tc->arrayRef = arrayRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[maxlocals];
+               c_constraints[maxlocals] = tc;
+               c_needed_instr += (3 + c_rs_needed_instr);
+
+               /* if arrayRef is not already tested against null, insert that test     */
+               if (!(c_null_check[arrayRef])) {
+                       c_null_check[arrayRef] = 1;
+                       c_needed_instr +=2;
+                   }
+
+               /* if arrayRef on right side is not already tested against null,        */
+               /* insert that test                                                     */
+               if ((c_rightside->type == TRACE_ALENGTH) && (!(c_null_check[c_rightside->var]))) {
+                       c_null_check[c_rightside->var] = 1;
+                       c_needed_instr +=2;
+                   }
+               break;
+
+       }
+}
+
+/*     This functions adds new static (before loop enry) tests of variables to the
+       program to be able to guarantee certain values for index variables in array
+       access (to safely remove bound checks).
+*/
+int insert_static(int arrayRef, struct Trace *index, struct Changes *varChanges, int special)
+{
+       struct LoopVar *lv;
+       int varRef;
+       int high, low;
+       
+       /* printf("insert static check - %d\n", arrayRef);
+          show_trace(index);
+          show_change(varChanges);
+       */
+
+       if (varChanges == NULL) {                       /* the variable hasn't changed / const  */
+               if ((varChanges = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                       c_mem_error();
+               varChanges->lower_bound = varChanges->upper_bound = 0;
+               }
+
+       switch (index->type) {                          /* check index type                                             */
+       case TRACE_IVAR:                                        /* it is a variable                                             */
+               if (index->neg < 0) {                   /* if it's a negated var, return                */
+#ifdef STATISTICS
+                       c_stat_no_opt++;                        
+#endif
+                       return OPT_NONE;
+                       }
+
+               varRef = index->var;
+               high = low = 0;
+
+               if (c_var_modified[varRef])     {       /* volatile var                                                 */
+                       
+                       lv = c_loopvars;                        /* get reference to loop variable               */
+
+                       while ((lv != NULL) && (lv->value != varRef))
+                               lv = lv->next;
+                       if (lv == NULL)
+                         printf("C_ERROR: debugging error 0x02\n");
+
+                       /* show_varinfo(lv);                                                                                            */
+                       
+                       /* check existing static bounds and add new contraints on variable      */
+                       /* to possibly remove bound checks                                                                      */
+                       if (lv->static_l) {
+                               /* the var is never decremented, so we add a static test againt */
+                               /* constant                                                                                                             */
+                               if (varChanges->lower_bound > varChanges->upper_bound)
+                                       add_new_constraint(TEST_ZERO, arrayRef, varRef, index->constant);
+                               else
+                                       add_new_constraint(TEST_ZERO, arrayRef, varRef, varChanges->lower_bound+index->constant);
+                               low = 1;
+                               }
+                       else if ((lv->dynamic_l_v) && (!special)) {
+                               /* the variable is decremented, but it is checked against a             */
+                               /* bound in the loop condition                                                                  */
+                               if (varChanges->lower_bound <= varChanges->upper_bound) {
+                                       add_new_constraint(TEST_RS_ZERO, arrayRef, varRef, varChanges->lower_bound+index->constant+lv->dynamic_l);
+                                       low = 1;
+                                       }
+                               }
+
+                       if (lv->static_u) {
+                               /* the var is never incremented, so we add a static test againt */
+                               /* constant                                                                                                             */
+                               if (varChanges->lower_bound > varChanges->upper_bound)
+                                       add_new_constraint(TEST_ALENGTH, arrayRef, varRef, index->constant);
+                               else
+                                       add_new_constraint(TEST_ALENGTH, arrayRef, varRef, varChanges->upper_bound+index->constant);
+                               high = 1;
+                               }
+                       else if ((lv->dynamic_u_v) &&  (!special)) {
+                               /* the variable is decremented, but it is checked against a             */
+                               /* bound in the loop condition                                                                  */
+                               if (varChanges->lower_bound <= varChanges->upper_bound) {
+                                       add_new_constraint(TEST_RS_ALENGTH, arrayRef, varRef, varChanges->upper_bound+index->constant+lv->dynamic_u);
+                                       high = 1;
+                                       }
+                               }
+                       }
+               else {                                                  /* the var is never modified at all             */
+                       add_new_constraint(TEST_UNMOD_ZERO, arrayRef, index->var, index->constant);
+                       add_new_constraint(TEST_UNMOD_ALENGTH, arrayRef, index->var, index->constant);
+                       low = high = 1;
+                       }
+               
+               /* if the addition of new variable tests made guarantees possible,              */
+               /* return the best possible optimization                                                                */
+               if ((high > 0) && (low > 0)) {
+                       /* printf("fully optimzed\n");                                                                          */
+#ifdef STATISTICS
+                       c_stat_full_opt++;                      
+#endif
+                       return OPT_FULL;
+                       }
+               else if (high > 0) {
+                       /* printf("upper optimzed\n");                                                                          */
+#ifdef STATISTICS
+                       c_stat_upper_opt++;                     
+#endif
+                       return OPT_UPPER;
+                       }
+               else if (low > 0) {
+                       /* printf("lower optimzed\n");                                                                          */
+#ifdef STATISTICS
+                       c_stat_lower_opt++;                     
+#endif
+                       return OPT_LOWER;
+                       }
+               else {
+                       /* printf("not optimzed\n");                                                                            */
+#ifdef STATISTICS
+                       c_stat_no_opt++;                        
+#endif
+                       return OPT_NONE;
+                       }
+               break;
+
+       case TRACE_ICONST:                      /* if it is a constant, optimization is easy    */
+               if (index->constant < 0) {
+#ifdef STATISTICS
+                       c_stat_no_opt++;                        
+#endif
+                       return OPT_NONE;        /* negative index -> bad                                                */
+                       }
+               else {
+                       add_new_constraint(TEST_CONST_ALENGTH, arrayRef, 0, index->constant);
+#ifdef STATISTICS
+                       c_stat_full_opt++;                      
+#endif
+                       return OPT_FULL;        /* else just test constant against array length */
+                       }
+               break;
+
+       case TRACE_ALENGTH:                     /* else, no optimizations possible                              */
+       case TRACE_UNKNOWN: 
+       case TRACE_AVAR:    
+#ifdef STATISTICS
+               c_stat_no_opt++;                        
+#endif
+               return OPT_NONE;
+       }
+
+       /* keep compiler happy */
+       return 0;
+}
+
+
+
+/*     copy a stack and return the start pointer of the newly created one
+*/
+stackptr copy_stack_from(stackptr source) { 
+       stackptr current, top;
+
+       if (source == NULL)
+               return NULL;
+
+       /* copy first element                                                       */
+       current = DMNEW(stackelement, 1);
+       current->type = source->type;
+       current->flags = source->flags;
+       current->varkind = source->varkind;
+       current->varnum = source->varnum;
+       current->regoff = source->regoff;
+       
+       top = current;
+
+       /* if there exist more, then copy the rest                                  */
+       while (source->prev != NULL) {
+               source = source->prev;
+               current->prev = DMNEW(stackelement, 1);
+               current->type = source->type;
+               current->flags = source->flags;
+               current->varkind = source->varkind;
+               current->varnum = source->varnum;
+               current->regoff = source->regoff;
+               current = current->prev;
+               }
+
+       current->prev = NULL;
+       return top;
+}
+
+
+/* The following defines are used in the procedure void create_static_checks(...)
+   They add a new instruction with its corresponding stack manipulation and
+   are used to build the new loop header of an optimized loop, where we have
+   to check certain variables and constants against values to guarantee that 
+   index values in array accesses remain with array bounds.
+
+   inst: pointer to the new instruction
+   tos: stackpointer before this operation is executed
+   newstack: temporary stackptr
+   stackdepth: counts the current stackdepth
+   original start: blockpointer to the head of the new, optimized loop 
+*/
+
+/* Load a local integer variable v                                              */
+#define LOAD_VAR(v) { \
+       inst->opc = ICMD_ILOAD; \
+       inst->op1 = v; \
+       newstack = DMNEW(stackelement, 1); \
+    inst->dst = newstack; \
+       newstack->prev = tos; \
+       newstack->type = TYPE_INT; \
+       newstack->flags = 0; \
+       newstack->varkind = LOCALVAR; \
+       newstack->varnum = v; \
+       tos = newstack; \
+       inst++; \
+       stackdepth++; \
+       }
+
+/* Load a constant with value c                                                 */
+#define LOAD_CONST(c) { \
+       inst->opc = ICMD_ICONST; \
+       inst->op1 = 0; \
+       inst->val.i = (c); \
+       newstack = DMNEW(stackelement, 1); \
+       newstack->prev = tos; \
+       newstack->type = TYPE_INT; \
+       newstack->flags = 0; \
+       newstack->varkind = UNDEFVAR; \
+       newstack->varnum = stackdepth; \
+       tos = newstack; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth++; \
+       }
+
+/* Load a local reference (adress) variable a                                   */
+#define LOAD_ADDR(a) { \
+       inst->opc = ICMD_ALOAD; \
+       inst->op1 = a; \
+       newstack = DMNEW(stackelement, 1); \
+       newstack->prev = tos; \
+       newstack->type = TYPE_ADR; \
+       newstack->flags = 0; \
+       newstack->varkind = LOCALVAR; \
+       newstack->varnum = a; \
+       tos = newstack; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth++; \
+       }
+
+/* Insert a compare greater-or-equal and jump to the unoptimized loop, if the   */
+/* comparison is true                                                           */
+#define GOTO_NOOPT_IF_GE { \
+       inst->opc = ICMD_IF_ICMPGE; \
+    inst->target = original_start->copied_to; \
+       if (tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+    if (tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth -= 2; \
+       }
+
+/* Insert a compare greater than and jump to the unoptimized loop, if the       */
+/* comparison is true                                                           */
+#define GOTO_NOOPT_IF_GT { \
+       inst->opc = ICMD_IF_ICMPGT; \
+    inst->target = original_start->copied_to; \
+       if (tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+    if (tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth -= 2; \
+       }
+
+
+/* Insert a compare less-than and jump to the unoptimized loop, if the          */
+/* comparison is true                                                           */
+#define GOTO_NOOPT_IF_LT { \
+       inst->opc = ICMD_IF_ICMPLT; \
+    inst->target = original_start->copied_to; \
+       if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+    if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth -= 2; \
+       }
+
+/* Insert a compare if-not-null and jump to the unoptimized loop, if the        */
+/* comparison is true                                                           */
+#define GOTO_NOOPT_IF_NULL { \
+       inst->opc = ICMD_IFNULL; \
+    inst->target = original_start->copied_to; \
+    if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth -= 1; \
+       }
+
+/* Insert an add instruction, that adds two integer values on top of the stack  */
+/* together                                                                     */
+#define ADD { \
+       inst->opc = ICMD_IADD; \
+       if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+    if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       newstack = DMNEW(stackelement, 1); \
+       newstack->prev = tos; \
+       newstack->type = TYPE_INT; \
+       newstack->flags = 0; \
+       newstack->varkind = UNDEFVAR; \
+       newstack->varnum = stackdepth; \
+       tos = newstack; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth--; \
+       }
+               
+/* Insert instructions to load the arraylength of an array with reference a     */
+/* fisrt, the reference must be loaded, then a null-pointer check is inserted   */
+/* if not already done earlier. Finally an arraylength instruction is added     */
+#define LOAD_ARRAYLENGTH(a) { \
+    if (c_null_check[a]) { \
+               LOAD_ADDR(a); \
+               GOTO_NOOPT_IF_NULL; \
+               c_null_check[a] = 0; \
+           }  \
+       LOAD_ADDR(a); \
+    inst->opc = ICMD_ARRAYLENGTH; \
+       if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       newstack = DMNEW(stackelement, 1); \
+       newstack->prev = tos; \
+       newstack->type = TYPE_INT; \
+       newstack->flags = 0; \
+       newstack->varkind = UNDEFVAR; \
+       newstack->varnum = stackdepth; \
+       tos = newstack; \
+       inst->dst = tos; \
+       inst++; \
+       }       
+
+
+/* Inserts the instructions to load the value of the right side of comparison   */
+/* Depending of the type of the right side, the apropriate instructions are     */
+/* created.                                                                     */
+#define LOAD_RIGHT_SIDE { \
+       switch (c_rightside->type) { \
+       case TRACE_ICONST: \
+               LOAD_CONST(c_rightside->constant); \
+               break; \
+       case TRACE_IVAR: \
+               LOAD_VAR(c_rightside->var); \
+               LOAD_CONST(c_rightside->constant); \
+               ADD; \
+               break; \
+       case TRACE_ALENGTH: \
+               LOAD_ARRAYLENGTH(c_rightside->var); \
+               break; \
+       default: \
+               panic("C_ERROR: illegal trace on rightside of loop-header"); \
+       } \
+}
+
+/*     Patch jumps in original loop and in copied loop, add gotos in copied loop.
+       All jumps in the original loop to the loop head have to be redirected to
+       the newly inserted one. For the copied loop, it is necessay to redirect all
+       jumps inside that loop to the copied nodes. lc points to the current loop, 
+       loop_head is a pointer to the newly inserted head and original start was
+       the old head and is now the head of the optimized variant of the loop.
+*/
+void patch_jumps(basicblock *original_start, basicblock *loop_head, struct LoopContainer *lc)
+{
+       /* step through all nodes of a loop                                         */
+       struct LoopElement *le;
+       basicblock *bptr;
+       instruction *inst, *temp_instr;
+       int i;
+
+       le = lc->nodes;
+       while (le != NULL) {
+
+               /* do nothing for new loop head                                         */
+               if (le->block == loop_head) {
+                       le = le->next;
+                       continue;
+                   }
+
+               /* for original version                                                 */
+               bptr = le->block;
+               inst = bptr->iinstr;
+               for (i = 0; i < bptr->icount; ++i, ++inst) {
+                       switch (inst->opc) {
+
+                       case ICMD_IF_ICMPEQ:
+                       case ICMD_IF_ICMPLT:
+                       case ICMD_IF_ICMPLE:
+                       case ICMD_IF_ICMPNE:
+                       case ICMD_IF_ICMPGT:
+                       case ICMD_IF_ICMPGE:
+
+                       case ICMD_IF_LCMPEQ:
+                       case ICMD_IF_LCMPLT:
+                       case ICMD_IF_LCMPLE:
+                       case ICMD_IF_LCMPNE:
+                       case ICMD_IF_LCMPGT:
+                       case ICMD_IF_LCMPGE:
+
+                       case ICMD_IF_ACMPEQ:
+                       case ICMD_IF_ACMPNE:
+
+                       case ICMD_IFEQ:
+                       case ICMD_IFNE:
+                       case ICMD_IFLT:
+                       case ICMD_IFGE:
+                       case ICMD_IFGT:
+                       case ICMD_IFLE:
+
+                       case ICMD_IF_LEQ:
+                       case ICMD_IF_LNE:
+                       case ICMD_IF_LLT:
+                       case ICMD_IF_LGE:
+                       case ICMD_IF_LGT:
+                       case ICMD_IF_LLE:
+
+                       case ICMD_GOTO:
+                       case ICMD_JSR:
+                       case ICMD_IFNULL:
+                       case ICMD_IFNONNULL:
+
+                               /* jump to newly inserted loopheader has to be redirected       */
+                               if (((basicblock *) inst->target) == loop_head)
+                                       inst->target = (void *) original_start;
+                               break;
+
+                       case ICMD_TABLESWITCH:
+                               {
+                                       s4 *s4ptr, l, i;
+                                       void **tptr;
+
+                                       tptr = (void **) inst->target;
+
+                                       s4ptr = inst->val.a;
+                                       l = s4ptr[1];                          /* low     */
+                                       i = s4ptr[2];                          /* high    */
+
+                                       i = i - l + 1;
+
+                                       /* jump to newly inserted loopheader has to be redirected   */
+                                       for (tptr = inst->target; i >= 0; --i, ++tptr) {
+                                               if (((basicblock *) *tptr) == loop_head)
+                                                       tptr[0] = (void *) original_start;
+                                               }
+                               }
+                               break;
+
+                       case ICMD_LOOKUPSWITCH:
+                               {
+                                       s4 i, l, *s4ptr;
+                                       void **tptr;
+
+                                       tptr = (void **) inst->target;
+
+                                       s4ptr = inst->val.a;
+                                       l = s4ptr[0];                          /* default  */
+                                       i = s4ptr[1];                          /* count    */
+
+                                       /* jump to newly inserted loopheader has to be redirected   */
+                                       for (tptr = inst->target; i >= 0; --i, ++tptr) {
+                                               if (((basicblock *) *tptr) == loop_head)
+                                                       tptr[0] = (void *) original_start;
+                                               }
+                               }
+                               break;
+                       }
+               }
+
+               /* if node is part of loop and has fall through to original start, that */
+               /* must be redirected. Unfortunately the instructions have to be copied */
+
+               if (bptr->next == loop_head) {
+                       temp_instr = DMNEW(instruction, bptr->icount + 1);
+                       memcpy(temp_instr, bptr->iinstr, sizeof(instruction)*bptr->icount);
+                       bptr->iinstr = temp_instr;
+
+                       bptr->iinstr[bptr->icount].opc = ICMD_GOTO;
+                       bptr->iinstr[bptr->icount].target = original_start;
+                       bptr->iinstr[bptr->icount].dst = NULL;
+                       ++bptr->icount;
+                       }       
+               
+               /* for copied version - which gets the unoptimized variant              */
+               bptr = le->block->copied_to;
+               inst = bptr->iinstr;
+               for (i = 0; i < bptr->icount; ++i, ++inst) {
+
+                       switch (inst->opc) {
+
+                       case ICMD_IASTORE:                      /* array store                                                  */
+                       case ICMD_LASTORE:          
+                       case ICMD_FASTORE:          
+                       case ICMD_DASTORE:          
+                       case ICMD_AASTORE:          
+                       case ICMD_BASTORE:          
+                       case ICMD_CASTORE:          
+                       case ICMD_SASTORE:
+                       case ICMD_IALOAD:                       /* array load                                               */
+                   case ICMD_LALOAD:       
+                       case ICMD_FALOAD:
+                       case ICMD_DALOAD:
+                       case ICMD_AALOAD:
+                       case ICMD_BALOAD:
+                       case ICMD_CALOAD:
+                       case ICMD_SALOAD:
+
+                               /* undo previous optimizations in new loop                      */
+                               inst->op1 = 0;
+                               break;
+
+                       case ICMD_IF_ICMPEQ:
+                       case ICMD_IF_ICMPLT:
+                       case ICMD_IF_ICMPLE:
+                       case ICMD_IF_ICMPNE:
+                       case ICMD_IF_ICMPGT:
+                       case ICMD_IF_ICMPGE:
+
+                       case ICMD_IF_LCMPEQ:
+                       case ICMD_IF_LCMPLT:
+                       case ICMD_IF_LCMPLE:
+                       case ICMD_IF_LCMPNE:
+                       case ICMD_IF_LCMPGT:
+                       case ICMD_IF_LCMPGE:
+
+                       case ICMD_IF_ACMPEQ:
+                       case ICMD_IF_ACMPNE:
+
+                       case ICMD_IFEQ:
+                       case ICMD_IFNE:
+                       case ICMD_IFLT:
+                       case ICMD_IFGE:
+                       case ICMD_IFGT:
+                       case ICMD_IFLE:
+
+                       case ICMD_IF_LEQ:
+                       case ICMD_IF_LNE:
+                       case ICMD_IF_LLT:
+                       case ICMD_IF_LGE:
+                       case ICMD_IF_LGT:
+                       case ICMD_IF_LLE:
+
+                       case ICMD_GOTO:
+                       case ICMD_JSR:
+                       case ICMD_IFNULL:
+                       case ICMD_IFNONNULL:
+
+                               /* jump to newly inserted loopheader has to be redirected       */
+                               if (((basicblock *) inst->target) == loop_head)
+                                       inst->target = (void *) original_start->copied_to;
+                               /* jump to loop internal nodes has to be redirected             */
+                               else if (((basicblock *) inst->target)->lflags & LOOP_PART)
+                                       inst->target = (void *) ((basicblock *) inst->target)->copied_to;
+                               break;
+                               
+                       case ICMD_TABLESWITCH:
+                               {
+                                       s4 *s4ptr, l, i;
+                                       
+                                       void **copy_ptr, *base_ptr;
+                                       void **tptr;
+
+                                       tptr = (void **) inst->target;
+
+                                       s4ptr = inst->val.a;
+                                       l = s4ptr[1];                          /* low     */
+                                       i = s4ptr[2];                          /* high    */
+
+                                       i = i - l + 1;
+                                       
+                                       copy_ptr = (void**) DMNEW(void*, i+1);
+                                       base_ptr = (void*) copy_ptr;
+
+                                       /* Targets for switch instructions are stored in an extra   */
+                                       /* that must be copied for new inserted loop.               */
+
+                                       for (tptr = inst->target; i >= 0; --i, ++tptr, ++copy_ptr) {
+                                               /* jump to newly inserted loopheader must be redirected */
+                                               if (((basicblock *) *tptr) == loop_head)
+                                                       copy_ptr[0] = (void *) original_start->copied_to;
+                                               /* jump to loop internal nodes has to be redirected     */
+                                               else if (((basicblock *) *tptr)->lflags & LOOP_PART)
+                                                       copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                               else
+                                                       copy_ptr[0] = tptr[0];
+                                               }
+
+                                       inst->target = base_ptr;
+                               }
+                               break;
+
+                       case ICMD_LOOKUPSWITCH:
+                               {
+                                       s4 i, l, *s4ptr;
+
+                                       void **copy_ptr, **base_ptr;
+                                       void **tptr;
+
+                                       tptr = (void **) inst->target;
+
+                                       s4ptr = inst->val.a;
+                                       l = s4ptr[0];                          /* default  */
+                                       i = s4ptr[1];                          /* count    */
+
+                                       copy_ptr = (void**) DMNEW(void*, i+1);
+                                       base_ptr = (void*) copy_ptr;
+
+                                       /* Targets for switch instructions are stored in an extra   */
+                                       /* that must be copied for new inserted loop.               */
+
+                                       for (tptr = inst->target; i >= 0; --i, ++tptr, ++copy_ptr) {
+                                               /* jump to newly inserted loopheader must be redirected */
+                                               if (((basicblock *) *tptr) == loop_head)
+                                                       copy_ptr[0] = (void *) original_start->copied_to;
+                                               /* jump to loop internal nodes has to be redirected     */
+                                               else if (((basicblock *) *tptr)->lflags & LOOP_PART)
+                                                       copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                               else 
+                                                       copy_ptr[0] = tptr[0];
+                                               }
+
+                                       inst->target = base_ptr;
+                               }
+                               break;
+                               
+                               }
+                       }
+
+               /* if fall through exits loop, goto is needed                           */
+               if (!(le->block->next->lflags & LOOP_PART)) {
+                       bptr->iinstr[bptr->icount].opc = ICMD_GOTO;
+                       bptr->iinstr[bptr->icount].dst = NULL;
+                       bptr->iinstr[bptr->icount].target = le->block->next;
+                       bptr->icount++;
+                       }
+               
+               le = le->next;
+               }
+}
+
+/*     Add the new header node of a loop that has been duplicated to all parent 
+    loops in nesting hierarchie.
+*/
+void header_into_parent_loops(struct LoopContainer *lc, basicblock *to_insert, basicblock *replace, basicblock *after)
+{
+       /* we have to insert the node to_insert before the node after and replace   */
+       /* the pointer of to_insert by the node replace                             */
+
+       struct LoopElement *le, *t;
+
+       /* if the top of the tree is reached, then return                           */
+       if ((lc == NULL) || (lc == root))
+               return;
+
+       /* create new node, that should be inserted                                 */
+       t = DMNEW(struct LoopElement, 1);
+       t->block = to_insert;
+       t->node = -1;
+
+       /* first, find the node, that has to be replaced (= "to_insert") and        */
+       /* replace it by the node "replace"                                         */
+       le = lc->nodes;
+       while (le->block != to_insert)
+               le = le->next;
+       le->block = replace;
+
+       /* BUGFIX                                                                   */
+       if (after == to_insert)
+               after = replace;
+
+       /* now find the node after and insert the newly create node before "after"  */
+       le = lc->nodes;
+       if (le->block == after) {
+               t->next = lc->nodes;
+               lc->nodes = t;
+           }
+       else {
+               while (le->next->block != after)
+                       le = le->next;
+
+               t->next = le->next;
+               le->next = t;
+           }
+
+       /* go up one hierarchie level                                               */
+       header_into_parent_loops(lc->parent, to_insert, replace, after);
+}
+
+/*     Add a new node (not header) of a duplicated loop to all parent loops in 
+    nesting hierarchie
+*/
+void node_into_parent_loops(struct LoopContainer *lc, basicblock *to_insert)
+{
+       struct LoopElement *le, *t;
+
+       /* if the top of the tree is reached, then return                           */
+       if ((lc == NULL) || (lc == root))
+               return;
+
+       /* create new node, that should be inserted                                 */
+       t = DMNEW(struct LoopElement, 1);
+       t->block = to_insert;
+       t->node = -1;
+
+       le = lc->nodes;
+
+       /* append new node to node list of loop                                     */
+       while (le->next != NULL)
+               le = le->next;
+
+       t->next = le->next;
+       le->next = t;
+
+       /* go up one hierarchie level                                               */
+       node_into_parent_loops(NULL, to_insert);
+}
+
+
+/* void patch_handler(...) is very similar to parts of the function patch_jumps. 
+   Its task is to redirect all jumps from the original head to the new head and
+   to redirect internal jumps inside the exception handler to the newly
+   created (copied) nodes.
+*/
+void patch_handler(struct LoopContainer *lc, basicblock *bptr, basicblock *original_head, basicblock *new_head)
+{
+       instruction *ip;
+       int i;
+
+       /* If node is not part of exception handler or has been visited, exit       */
+       if (!(bptr->lflags & HANDLER_PART) || (bptr->lflags & HANDLER_VISITED))
+               return;
+
+       /* mark block as visited                                                    */
+       bptr->lflags |= HANDLER_VISITED;
+
+       /* for all instructions in the copied block, do                             */
+       for (i = 0, ip = bptr->copied_to->iinstr; i < bptr->copied_to->icount; ++i, ++ip) {
+               switch (ip->opc) {
+               case ICMD_RETURN:
+               case ICMD_IRETURN:
+               case ICMD_LRETURN:
+               case ICMD_FRETURN:
+               case ICMD_DRETURN:
+               case ICMD_ARETURN:
+               case ICMD_ATHROW:
+                       break;                                 
+
+               case ICMD_IF_ICMPEQ:
+               case ICMD_IF_ICMPLT:
+               case ICMD_IF_ICMPLE:
+               case ICMD_IF_ICMPNE:
+               case ICMD_IF_ICMPGT:
+               case ICMD_IF_ICMPGE:
+                       
+               case ICMD_IF_LCMPEQ:
+               case ICMD_IF_LCMPLT:
+               case ICMD_IF_LCMPLE:
+               case ICMD_IF_LCMPNE:
+               case ICMD_IF_LCMPGT:
+               case ICMD_IF_LCMPGE:
+
+               case ICMD_IF_ACMPEQ:
+               case ICMD_IF_ACMPNE:
+
+               case ICMD_IFEQ:
+               case ICMD_IFNE:
+               case ICMD_IFLT:
+               case ICMD_IFGE:
+               case ICMD_IFGT:
+               case ICMD_IFLE:
+                               
+               case ICMD_IF_LEQ:
+               case ICMD_IF_LNE:
+               case ICMD_IF_LLT:
+               case ICMD_IF_LGE:
+               case ICMD_IF_LGT:
+               case ICMD_IF_LLE:
+
+               case ICMD_JSR:
+               case ICMD_IFNULL:
+               case ICMD_IFNONNULL:
+
+                       patch_handler(lc, bptr->next, original_head, new_head); 
+
+                       /* fall through */
+
+               case ICMD_GOTO:
+
+                       patch_handler(lc, ip->target, original_head, new_head);
+
+                       /* jumps to old header have to be redirected                        */
+                       if (((basicblock *) ip->target) == original_head)
+                               ip->target = (void *) new_head->copied_to;
+                       /* jumps to handler internal nodes have to be redirected            */
+                       else if (((basicblock *) ip->target)->lflags & HANDLER_PART)
+                               ip->target = (void *) ((basicblock *) ip->target)->copied_to;
+                       /* jumps to loop internal nodes have to be redirected               */
+                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
+                               ip->target = (void *) ((basicblock *) ip->target)->copied_to;
+                  
+                  
+                       break;
+                               
+               case ICMD_TABLESWITCH:
+                       {
+                               s4 *s4ptr, l, i;
+                               void **tptr;
+                               void **copy_ptr, **base_ptr;
+                               tptr = (void **) ip->target;
+                               s4ptr = ip->val.a;
+                               l = s4ptr[1];                          /* low                   */
+                               i = s4ptr[2];                          /* high                  */
+                               i = i - l + 1;
+                               
+                               copy_ptr = (void**) DMNEW(void*, i+1);
+                               base_ptr = (void*) copy_ptr;
+
+                               for (tptr = ip->target; i >= 0; --i, ++tptr, ++copy_ptr) {
+                                       patch_handler(lc, ((basicblock *) *tptr), original_head, new_head);
+                                       /* jumps to old header have to be redirected                */
+                                       if (((basicblock *) *tptr) == original_head)
+                                               copy_ptr[0] = (void *) new_head->copied_to;
+                                       /* jumps to handler internal nodes have to be redirected    */
+                                       else if (((basicblock *) *tptr)->lflags & HANDLER_PART)
+                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                       /* jumps to loop internal nodes have to be redirected       */
+                                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
+                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                       else
+                                               copy_ptr[0] = tptr[0];
+                                   }
+
+                               ip->target = base_ptr;
+                       }
+                       break;
+
+               case ICMD_LOOKUPSWITCH:
+                       {
+                               s4 i, l, *s4ptr;
+
+                               void **tptr;
+                               void **copy_ptr, **base_ptr;
+
+                               tptr = (void **) ip->target;
+                               s4ptr = ip->val.a;
+                               l = s4ptr[0];                          /* default               */
+                               i = s4ptr[1];                          /* count                 */
+
+                               copy_ptr = (void**) DMNEW(void*, i+1);
+                               base_ptr = (void*) copy_ptr;
+
+                               for (tptr = ip->target; i >= 0; --i, ++tptr, ++copy_ptr) {
+
+                                       patch_handler(lc, ((basicblock *) *tptr), original_head, new_head);
+                                       /* jumps to old header have to be redirected                */
+                                       if (((basicblock *) *tptr) == original_head)
+                                               copy_ptr[0] = (void *) new_head->copied_to;
+                                       /* jumps to handler internal nodes have to be redirected    */
+                                       else if (((basicblock *) *tptr)->lflags & HANDLER_PART)
+                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                       /* jumps to loop internal nodes have to be redirected       */
+                                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
+                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                       else
+                                               copy_ptr[0] = tptr[0];
+                                   }
+
+                               ip->target = base_ptr;
+                       }
+                       break;
+                               
+                   }   /* switch */
+                  
+           }       /* for    */
+
+               /* if fall through exits loop, goto is needed                           */
+               if (!(bptr->next->lflags & HANDLER_PART)) {
+                       bptr->copied_to->iinstr[bptr->copied_to->icount].opc = ICMD_GOTO;
+                       bptr->copied_to->iinstr[bptr->copied_to->icount].dst = NULL;
+                       bptr->copied_to->iinstr[bptr->copied_to->icount].target = bptr->next;
+                       bptr->copied_to->icount++;
+                       }               
+}
+
+
+/* This function copys the exception handler and redirects all jumps from the
+   original head to the new head in the original exception handler. All
+   redirection in the copied exception handler is done in patch_handler(...).
+*/
+void copy_handler(struct LoopContainer *lc, basicblock *bptr, basicblock *original_head, basicblock *new_head)
+{
+       instruction *ip;
+       s4 *s4ptr;
+       void **tptr;
+       int high, low, count;
+       struct LoopElement *le;
+       basicblock *new;
+
+       /* If this node has already been copied, return                             */
+       if (bptr->lflags & HANDLER_PART)
+               return;
+
+       /* The exception handler exists, when control flow enters loop again        */
+
+       if (bptr->lflags & LOOP_PART)
+               return;
+       for (le = lc->nodes; le != NULL; le = le->next) {
+               if (le->block == bptr) {
+                       printf("C_PANIC: should not happen\n");
+                       exit(-1);
+            }
+           }
+
+       /* mark block as part of handler                                            */
+       bptr->lflags |= HANDLER_PART;
+
+       /* copy node                                                                */
+       new = DMNEW(basicblock, 1);    
+       memcpy(new, bptr, sizeof(basicblock));
+       new->debug_nr = c_debug_nr++;
+
+       c_last_block_copied = new;
+
+       /* copy instructions and allow one more slot for possible GOTO              */
+       new->iinstr = DMNEW(instruction, bptr->icount + 1);
+       memcpy(new->iinstr, bptr->iinstr, bptr->icount*sizeof(instruction));
+
+       /* update original block                                                    */
+       bptr->copied_to = new;
+
+       /* append block to global list of basic blocks                              */
+       last_block->next = new;
+       last_block = new;
+       new->next = NULL;
+
+
+       /* find next block to copy, depending on last instruction of BB             */
+       if (bptr->icount == 0) {
+               copy_handler(lc, bptr->next, original_head, new_head);
+               return;
+           }
+
+       ip = bptr->iinstr + (bptr->icount - 1);
+       
+               switch (ip->opc) {
+               case ICMD_RETURN:
+               case ICMD_IRETURN:
+               case ICMD_LRETURN:
+               case ICMD_FRETURN:
+               case ICMD_DRETURN:
+               case ICMD_ARETURN:
+               case ICMD_ATHROW:
+                       break;                                 
+               
+               case ICMD_IFEQ:
+               case ICMD_IFNE:
+               case ICMD_IFLT:
+               case ICMD_IFGE:
+               case ICMD_IFGT:
+               case ICMD_IFLE:
+                       
+               case ICMD_IF_LCMPEQ:
+               case ICMD_IF_LCMPLT:
+               case ICMD_IF_LCMPLE:
+               case ICMD_IF_LCMPNE:
+               case ICMD_IF_LCMPGT:
+               case ICMD_IF_LCMPGE:
+                       
+               case ICMD_IF_LEQ:
+               case ICMD_IF_LNE:
+               case ICMD_IF_LLT:
+               case ICMD_IF_LGE:
+               case ICMD_IF_LGT:
+               case ICMD_IF_LLE:
+                       
+               case ICMD_IFNULL:
+               case ICMD_IFNONNULL:
+                       
+               case ICMD_IF_ICMPEQ:
+               case ICMD_IF_ICMPNE:
+               case ICMD_IF_ICMPLT:
+               case ICMD_IF_ICMPGE:
+               case ICMD_IF_ICMPGT:
+               case ICMD_IF_ICMPLE:
+               case ICMD_IF_ACMPEQ:
+               case ICMD_IF_ACMPNE:
+                       copy_handler(lc, bptr->next, original_head, new_head);
+                       /* fall through */
+         
+               case ICMD_GOTO:
+
+                       /* redirect jump from original_head to new_head                    */
+                       if ((basicblock *) ip->target == original_head)
+                               ip->target = (void *) new_head;
+                               
+                       copy_handler(lc, (basicblock *) (ip->target), original_head, new_head);
+                       
+                       break;
+         
+               case ICMD_TABLESWITCH:
+                       s4ptr = ip->val.a;
+                       tptr = (void **) ip->target;
+                       
+                       /* default branch */
+                       if (((basicblock *) *tptr) == original_head)
+                               tptr[0] = (void *) new_head;
+                       
+                       copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
+                       
+                       s4ptr++;
+                       low = *s4ptr;
+                       s4ptr++;
+                       high = *s4ptr;
+                       
+                       count = (high-low+1);
+                       
+                       while (--count >= 0) {
+                               tptr++;
+                               /* redirect jump from original_head to new_head                 */
+                               if (((basicblock *) *tptr) == original_head)
+                                       tptr[0] = (void *) new_head;
+                               copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
+                       }
+                       break;
+
+               case ICMD_LOOKUPSWITCH:
+                       s4ptr = ip->val.a;
+                       tptr = (void **) ip->target;
+                       
+                       /* default branch */
+                       if (((basicblock *) *tptr) == original_head)
+                               tptr[0] = (void *) new_head;
+                       
+                       copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
+                       
+                       ++s4ptr;
+                       count = *s4ptr;
+                       
+                       while (--count >= 0) {
+                               ++tptr;
+                               /* redirect jump from original_head to new_head                 */
+                               if (((basicblock *) *tptr) == original_head)
+                                       tptr[0] = (void *) new_head;
+                               copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
+                       }  
+                       break;
+
+               case ICMD_JSR:
+                       c_last_target = bptr;
+                       copy_handler(lc, (basicblock *) (ip->target), original_head, new_head);         
+                       break;
+                       
+               case ICMD_RET:
+                       copy_handler(lc, c_last_target->next, original_head, new_head);
+                       break;
+                       
+               default:
+                       copy_handler(lc, bptr->next, original_head, new_head);
+                       break;  
+                   } 
+           
+}           
+
+
+/* If a loop is duplicated, all exceptions, that are contained in this loops' body
+   have to be duplicated as well. The following function together with the
+   two helper functions copy_handler and patch_handler perform this task.
+*/
+void update_internal_exceptions(struct LoopContainer *lc, basicblock *original_head, basicblock *new_head)
+{
+       xtable *ex, *new;
+       struct LoopContainer *l;
+
+       /* Bottom of tree reached -> return                                         */
+       if (lc == NULL)
+               return;
+
+       /* Call update_internal for all nested (=child) loops                       */
+       l = lc->tree_down;
+       while (l != NULL) {
+               update_internal_exceptions(l, original_head, new_head);
+               l = l->tree_right;
+           }
+
+       /* For all exceptions of this loop, do                                      */
+       ex = lc->exceptions;
+       while (ex != NULL) {
+               
+               /* Copy the exception and patch the jumps                               */
+               copy_handler(lc, ex->handler, original_head, new_head);
+               patch_handler(lc, ex->handler, original_head, new_head);                
+
+               /* Insert a new exception into the global exception table               */
+               new = DMNEW(xtable, 1);
+               memcpy(new, ex, sizeof(xtable));
+
+               /* Increase number of exceptions                                        */
+               ++exceptiontablelength;
+
+               ex->next = new;
+               ex->down = new;
+
+               /* Set new start and end point of this exception                        */
+               new->start = ex->start->copied_to;
+               new->end = ex->end->copied_to;
+
+               /* Set handler pointer to copied exception handler                      */
+               new->handler = ex->handler->copied_to;
+
+               ex = new->next;
+           }
+
+}
+
+/* If a loop is duplicated, all exceptions that contain this loop have to be
+   extended to the copied nodes as well. The following function checks for
+   all exceptions of all parent loops, whether they contain the loop pointed to
+   by lc. If so, the exceptions are extended to contain all newly created nodes.
+*/
+void update_external_exceptions(struct LoopContainer *lc, int loop_head)
+{
+       xtable *ex, *new;
+
+       /* Top of tree reached -> return                                            */
+       if (lc == NULL)
+               return;
+       
+       ex = lc->exceptions;
+
+       /* For all exceptions of this loop do                                       */
+       while (ex != NULL) {
+                  
+               /* It is possible that the loop contains exceptions that do not protect */
+               /* the loop just duplicated. It must be checked, if this is the case    */
+               if ((loop_head >= block_index[ex->startpc]) && (loop_head < block_index[ex->endpc])) {
+
+                       /* loop is really inside exception, so create new exception entry   */
+                       /* in global exception list                                         */
+                       new = DMNEW(xtable, 1);
+                       memcpy(new, ex, sizeof(xtable));
+
+
+                       /* Increase number of exceptions                                    */
+                       ++exceptiontablelength;
+
+                       ex->next = new;
+                       ex->down = new;
+
+                       /* Set new start and end point of this exception                    */
+                       new->start = c_first_block_copied;
+                       new->end = c_last_block_copied;
+
+                       ex = new->next;
+               }
+               /* exception does not contain the duplicated loop -> do nothing         */
+               else
+                       ex = ex->next;
+           }
+
+       /* Call update_external for parent node                                     */
+       update_external_exceptions(lc->parent, loop_head);
+}
+       
+
+
+/*     This function is needed to insert the static checks, stored in c_constraints
+       into the intermediate code.
+*/
+void create_static_checks(struct LoopContainer *lc)
+{
+       int i, stackdepth, cnt;
+       struct Constraint *tc1;
+       struct LoopElement *le; 
+
+       /* loop_head points to the newly inserted loop_head, original_start to      */
+       /* the old loop header                                                      */
+       basicblock *bptr, *loop_head, *original_start, *temp;
+       instruction *inst, *tiptr;
+
+       /* tos and newstack are needed by the macros, that insert instructions into */
+       /* the new loop head                                                        */
+       stackptr newstack, tos;
+       xtable *ex;
+
+#ifdef STATISTICS
+       /* show_loop_statistics(); */ 
+#endif
+
+       loop_head = &block[c_current_head];
+       c_first_block_copied = c_last_block_copied = NULL;
+
+       /* the loop nodes are copied                                                */
+       le = lc->nodes;
+       while (le != NULL)
+       {
+               bptr = DMNEW(basicblock, 1);    
+               memcpy(bptr, le->block, sizeof(basicblock));
+               bptr->debug_nr = c_debug_nr++;
+
+               /* determine beginning of copied loop to extend exception handler, that */
+               /* protect this loop                                                    */
+               if (c_first_block_copied == NULL)
+                       c_first_block_copied = bptr;
+
+               /* copy instructions and add one more slot for possible GOTO            */
+               bptr->iinstr = DMNEW(instruction, bptr->icount + 1);
+
+               memcpy(bptr->iinstr, le->block->iinstr, (bptr->icount+1)*sizeof(instruction));
+
+               le->block->copied_to = bptr;
+
+               /* add block to global list of BBs                                      */
+               last_block->next = bptr;
+               last_block = bptr;
+               bptr->next = NULL;
+
+               node_into_parent_loops(lc->parent, bptr);
+               le = le->next;
+       }
+
+       c_last_block_copied = bptr;
+
+       /* create an additional basicblock for dynamic checks                       */
+       original_start = bptr = DMNEW(basicblock, 1);    
+
+       /* copy current loop header to new basic block                              */
+       memcpy(bptr, loop_head, sizeof(basicblock));
+    bptr->debug_nr = c_debug_nr++;
+
+       /* insert the new basic block and move header before first loop node        */
+       le = lc->nodes;
+       temp = le->block;
+
+       /* if header is first node of loop, insert original header after it         */
+       if (temp == loop_head)
+               loop_head->next = bptr;
+       else {
+       /* else, we have to find the predecessor of loop header                     */
+               while (temp->next != loop_head)
+                       temp = temp->next;
+
+               /* insert original header after newly created block                     */
+               temp->next = bptr;
+
+               /* if predecessor is not loop part, insert a goto                       */
+               if (!(temp->lflags & LOOP_PART)) {
+
+                       /* copy instructions and add an additional slot                     */
+                       tiptr = DMNEW(instruction, temp->icount + 1);
+                       memcpy(tiptr, temp->iinstr, sizeof(instruction)*temp->icount);
+                       
+                       temp->iinstr = tiptr;
+                       tiptr = temp->iinstr + temp->icount;
+                       
+                       /* add goto to loop header. If node is part of exception handler    */
+                       /* jmp is automagically redirected during patch_handler and works   */
+                       /* correct                                                          */
+                       tiptr->opc = ICMD_GOTO;
+                       tiptr->dst = NULL;
+                       tiptr->target = (void*) loop_head;
+                       
+                       ++temp->icount;
+                   }
+               
+               
+               temp = block;
+               /* if first loop block is first BB of global list, insert loop_head at  */
+               /* beginning of global BB list                                          */
+               if (temp == le->block) {
+                       if (c_newstart == NULL) {
+                               c_needs_redirection = true;
+                               c_newstart = loop_head;
+                               loop_head->next = block;
+                           }
+                       else {
+                               loop_head->next = c_newstart;
+                               c_newstart = loop_head;
+                           }
+                   }
+               else {
+          
+                       while (temp->next != le->block)
+                               temp = temp->next;
+
+                       loop_head->next = temp->next;
+                       temp->next = loop_head;
+               
+                       /* to be on the safe side insert a jump from the previous instr     */
+                       /* over thr new inserted node                                       */
+       
+                       /* special case - jump from node to loop_head: then remove          */
+                       /* goto / happens rather often due to loop layout                   */
+                       tiptr = temp->iinstr + (temp->icount-1);
+               
+                       if ((tiptr->opc == ICMD_GOTO) && (tiptr->target == loop_head)) {
+                               tiptr->opc = ICMD_NOP;
+                               tiptr->dst = NULL;
+                       }
+                       else {
+
+                               tiptr = DMNEW(instruction, temp->icount + 1);
+                               memcpy(tiptr, temp->iinstr, sizeof(instruction)*temp->icount);
+
+                               temp->iinstr = tiptr;
+                               tiptr = temp->iinstr + temp->icount;
+
+                               tiptr->opc = ICMD_GOTO;
+                               tiptr->dst = NULL;
+                               tiptr->target = (void*) loop_head->next;
+
+                               ++temp->icount;
+                   }
+                   }
+           }
+
+       /* adjust exceptions                                                        */
+       ex = extable;
+       while (ex != NULL) {
+
+               /* if an exception covers whole loop and starts at first loop node, it  */
+               /* has to be extended to cover the new first node as well               */
+               if (ex->start == le->block) {
+                       
+                       if ((lc->loop_head >= block_index[ex->startpc]) && (lc->loop_head < block_index[ex->endpc])) 
+                               ex->start = loop_head;
+                   }
+
+               /* an exception that ended at the old loop header now must contains the */
+               /* new loop header as well                                              */
+               if (ex->end == loop_head)
+                       ex->end = original_start;
+
+               ex = ex->down;
+           }
+       
+
+       /* insert new header node into nodelists of all enclosing loops             */
+       header_into_parent_loops(lc, loop_head, original_start, le->block);
+
+       /* prepare instruction array to insert checks                               */
+       inst = loop_head->iinstr = DMNEW(instruction, c_needed_instr + 2); 
+       loop_head->icount = c_needed_instr + 1;
+
+       /* init instruction array                                                   */
+       for (cnt=0; cnt<c_needed_instr + 1; ++cnt) {
+               inst[0].opc = ICMD_NOP;
+               inst[0].dst = NULL;
+           }
+
+       loop_head->copied_to = NULL; 
+
+       /* prepare stack                                                            */
+       loop_head->instack = copy_stack_from(bptr->instack);
+       loop_head->outstack = copy_stack_from(bptr->instack);
+       
+       tos = loop_head->instack;
+       stackdepth = loop_head->indepth;
+       
+       /* step through all inserted checks and create instructions for them        */
+       for (i=0; i<maxlocals+1; ++i)
+       {
+               tc1 = c_constraints[i];
+               while (tc1 != NULL)
+               {
+                       switch (tc1->type)
+                       {
+                       
+                               /* check a variable against a constant                          */
+                       case TEST_ZERO:
+                       case TEST_UNMOD_ZERO: 
+
+#ifdef LOOP_DEBUG
+                               printf("insert ZERO-test\n");
+                               fflush(stdout);
+#endif
+
+                               /* optimize if tc1->varRef >= tc1->constant                     */
+                               LOAD_VAR(tc1->varRef);
+                               LOAD_CONST(tc1->constant);
+                               GOTO_NOOPT_IF_LT;
+                               break;
+
+                               /* check a variable against an array length                     */
+                       case TEST_ALENGTH:       
+                       case TEST_UNMOD_ALENGTH:
+                               
+                               /* optimize if                                                  */
+                               /* tc1->varRef + tc1->constant < lengthOf(tc1->arrayRef)        */
+#ifdef LOOP_DEBUG
+                               printf("insert ALENGTH-test\n");
+                               fflush(stdout);
+#endif
+
+                               LOAD_VAR(tc1->varRef);
+                               LOAD_CONST(tc1->constant);
+                               ADD;
+                               LOAD_ARRAYLENGTH(tc1->arrayRef);
+                               GOTO_NOOPT_IF_GE;
+                               break;
+                               
+                               /* test right side of comparison against constant               */
+                       case TEST_RS_ZERO:      
+
+#ifdef LOOP_DEBUG
+                               printf("insert RS-ZERO-test\n");
+                               fflush(stdout);
+#endif
+
+                               /* optimize if right-side >= tc1->constant                      */
+                               LOAD_RIGHT_SIDE;
+                               LOAD_CONST(tc1->constant);
+                               GOTO_NOOPT_IF_LT;
+                               break;
+                               
+                               /* test right side of comparison against array length           */
+                       case TEST_RS_ALENGTH: 
+
+#ifdef LOOP_DEBUG
+                               printf("insert RS-ALENGTH-test\n");
+                               fflush(stdout);
+#endif
+                               /* optimize if right-side < lengthOf(arrayRef)                  */
+                               LOAD_RIGHT_SIDE;
+                               LOAD_ARRAYLENGTH(tc1->arrayRef);
+                               GOTO_NOOPT_IF_GT;
+                               break;
+                               
+                               /* test unmodified variable against arraylength                 */
+                       case TEST_CONST_ALENGTH:
+
+#ifdef LOOP_DEBUG
+                               printf("insert CONST ALENGTH-test\n");
+                               fflush(stdout);
+#endif
+
+                               /* optimize if tc1->constant < lengthOf(tc1->arrayRef)          */
+                               LOAD_CONST(tc1->constant);
+                               LOAD_ARRAYLENGTH(tc1->arrayRef);
+                               GOTO_NOOPT_IF_GE;
+                               break;              
+                       }
+                       
+                       tc1 = tc1->next;
+               }
+               c_constraints[i] = NULL;
+       }
+   
+       /* if all tests succeed, jump to optimized loop header                      */
+       if (loop_head->next != original_start) {
+               inst->opc = ICMD_GOTO;
+               inst->dst = NULL;
+               inst->target = original_start;
+           }
+
+       /* redirect jumps from original loop head to newly inserted one             */
+       patch_jumps(original_start, loop_head, lc); 
+
+       /* if exceptions have to be correct due to loop duplication these two       */
+       /* functions perform this task.                                             */
+       update_internal_exceptions(lc, loop_head, original_start);
+       update_external_exceptions(lc->parent, lc->loop_head);
+}
+
+
+/*     This function performs an update between two arrays of struct Changes (that
+       reflect variable changes). The merge is performed unrstricted in the way, that
+       all variable changes in c1 took place in a nested loop and therefore are
+       considered to be without limit. Beside that, the merge is a simple union of the
+       changes recorded in both arrays. A variable, which limits are undefinied, is
+       represented by its lower bound being higher than the upper bound. The result 
+       of the union is stored in c1.
+*/
+struct Changes ** constraints_unrestricted_merge(struct Changes **c1, struct Changes **c2)
+{
+       int i, changed;
+
+       if ((c1 == NULL) || (c2 == NULL))
+               printf("C_ERROR: debugging error 0x03\n");
+
+       changed = 0;
+       for (i=0; i<maxlocals; ++i) {
+               if (c1[i] == NULL) {
+                       if (c2[i] != NULL) {            /* a change in c2 is updated in c1              */
+                               changed = 1;
+                               c1[i] = c2[i];
+                               c1[i]->lower_bound = c1[i]->upper_bound+1;
+                               }
+                       }
+               else {
+                       if (c1[i]->lower_bound > c1[i]->upper_bound)
+                               continue;                               /* variable's bounds already undefined  */
+
+                       if (c2[i] == NULL) {            /* variable changed in c1 -> now undef. */
+                               changed = 1;
+                               c1[i]->lower_bound = c1[i]->upper_bound+1;
+                               }
+                       else {
+                               if ((c1[i]->lower_bound == c2[i]->lower_bound) &&
+                                       (c1[i]->upper_bound == c2[i]->upper_bound))
+                                       continue;                       /* variable's bounds remain the same    */
+                               else {
+                                       changed = 1;
+                                       c1[i]->lower_bound = c1[i]->upper_bound+1;
+                                       }                                       /* variable changed in c1 -> now undef. */
+                               }
+                       }
+               }
+       
+       if (changed)
+               return c1;
+       else
+               return NULL;
+}
+
+/*     This function performs an update between two arrays of struct Changes (that
+       reflect variable changes). The merge is a simple union of the bounds
+       changes recorded in both arrays. A variable, which limits are undefinied, is
+       represented by its lower bound being higher than the upper bound. The result 
+       of the union is stored in c1.
+*/
+struct Changes ** constraints_merge(struct Changes **c1, struct Changes **c2)
+{
+       int i, changed;
+
+       if ((c1 == NULL) || (c2 == NULL))
+               printf("C_ERROR: debugging error 0x04\n");
+
+       changed = 0;
+
+       for (i=0; i<maxlocals; ++i) {
+               if (c1[i] == NULL) {
+                       if (c2[i] != NULL) {            /* update changes in c2 in c1                   */
+                               if ((c1[i] = (struct Changes *) malloc (sizeof(struct Changes))) == NULL)
+                                       c_mem_error();
+
+                                       c1[i]->lower_bound = c2[i]->lower_bound; 
+                                       c1[i]->upper_bound = c2[i]->upper_bound;
+                                       changed = 1;
+                               }       
+               }
+               else {
+                       if (c2[i] != NULL) {
+
+                               if (c1[i]->lower_bound > c1[i]->upper_bound)
+                                       continue;                       /* var in c1 is unrestricted                    */
+
+                               if (c1[i]->lower_bound > c2[i]->lower_bound) {
+                                       c1[i]->lower_bound = c2[i]->lower_bound;
+                                       changed = 1;            /* write new lower bound                                */
+                                       }
+                               if (c1[i]->upper_bound < c2[i]->upper_bound) {
+                                       c1[i]->upper_bound = c2[i]->upper_bound;
+                                       changed = 1;            /* write new higher bound                               */
+                                       }
+                               }
+                       }
+               }
+
+       if (changed)
+               return c1;
+       else
+               return NULL;
+}
+
+
+/*     This function simply copies an array of changes 
+*/
+struct Changes** constraints_clone(struct Changes **c)
+{
+       int i;
+       struct Changes **t;
+       
+       if ((t = (struct Changes **) malloc(maxlocals * sizeof(struct Changes *))) == NULL)
+               c_mem_error();
+
+       for (i=0; i<maxlocals; ++i) {           /* for all array elements (vars) do             */
+               if (c[i] == NULL)
+                       t[i] = NULL;
+               else {
+                       if ((t[i] = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                               c_mem_error();
+                       t[i]->lower_bound = c[i]->lower_bound;
+                       t[i]->upper_bound = c[i]->upper_bound;
+                       }
+               }
+       
+       return t;
+}
+
+/*     This function is used to reset the changes of a variable to the time, it was
+       pushed onto the stack. If a variable has been modified between an instruction
+       and a previous push onto the stack, its value in the changes array does not
+       correctly reflect its bounds the time, it was pushed onto the stack. This 
+       function corrects the situation.
+       */
+struct Changes* backtrack_var(int node, int from, int to, int varRef, struct Changes *changes)
+{
+       struct Changes *tmp;
+       basicblock bp;
+       instruction *ip;
+       struct Trace *t;
+
+       if (changes == NULL)    /* if there are no changes, immediately return          */
+               return NULL;
+       else {                                  /* init a Changes structure with current values         */
+               if ((tmp = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                       c_mem_error();
+               
+               tmp->upper_bound = changes->upper_bound;
+               tmp->lower_bound = changes->lower_bound;
+               }
+
+       if (tmp->upper_bound < tmp->lower_bound)
+               return tmp;                     /* if it is unrestricted no backtracking can happen     */
+
+       bp = block[node];
+       ip = bp.iinstr + to;
+
+       for (; from < to; --to, --ip) {         /* scan instructions backwards                  */
+               switch (ip->opc) {
+               case ICMD_IINC:                                 /* a var has been modified                              */
+                       if (varRef != ip->op1)          /* not the one, we are interested in    */
+                               break;
+                       tmp->upper_bound -= ip->val.i;          /* take back modifications              */
+                       tmp->lower_bound -= ip->val.i;
+                       break;
+
+               case ICMD_ISTORE:                               /* a var has been modified                              */
+                       if (varRef != ip->op1)          /* not the one, we are interested in    */
+                               break;
+
+                       /* it is our variable, so trace its origin                                                      */
+                       t = tracing(&block[node],to, 0);                
+       
+                       switch (t->type) {
+                               case TRACE_IVAR:  
+                                       if ((t->var = ip->op1) && (t->neg > 0)) {
+                                               /* it was the same var -> take back modifications               */
+                                               tmp->upper_bound -= t->constant;
+                                               tmp->lower_bound -= t->constant;
+                                               }               
+                                       else
+                                               tmp->lower_bound = tmp->upper_bound+1;  /* unknown              */
+                                       break;
+
+                               /* cannot restore it -> invalidate t                                                    */
+                               case TRACE_ICONST:
+                               case TRACE_ALENGTH:   
+                               case TRACE_UNKNOWN: 
+                               case TRACE_AVAR: 
+                                       tmp->lower_bound = tmp->upper_bound+1;   
+                                       break;
+                               }
+
+                       break;
+                       }
+               }
+       return tmp;
+}
+
+/*     This function performs the main task of bound check removal. It removes
+       all bound-checks in node. change is a pointer to an array of struct Changes
+       that reflect for all local variables, how their values have changed from
+       the start of the loop. The special flag is needed to deal with the header
+       node.
+*/
+void remove_boundchecks(int node, int from, struct Changes **change, int special)
+{
+       basicblock bp;
+       instruction *ip;
+       int i, count, ignore, degrade_checks, opt_level;
+       struct depthElement *d;
+       struct Changes **t1, **tmp, *t;
+       struct Trace *t_array, *t_index;
+
+       /* printf("remove_bc called: %d - %d - %d\n", node, from, special);                     */
+          
+       /* a flag, that is set, when previous optimzations have to be taken back        */
+       degrade_checks = 0;                     
+
+       if (c_current_loop[node] > 0) {         /* this node is part of the loop                */
+               if (c_current_loop[node] > 1) { /* it is not the header node                    */
+
+                       /* get variable changes, already recorded for this node                         */
+                       t1 = c_dTable[node]->changes;
+                       
+                       if (t1 != NULL) {                       /* it is not the first visit                    */
+                               if ((c_nestedLoops[node] != c_current_head) && (c_nestedLoops[node] == c_nestedLoops[from])) {
+                               /* we are looping in a nested loop, so made optimizations               */
+                               /* need to be reconsidered                                                                              */
+                                       degrade_checks = 1;
+                                       if (constraints_unrestricted_merge(t1, change) == NULL) 
+                                               return;                 /* no changes since previous visit              */
+                                               /* if there have been changes, they are updated by              */
+                                               /* constraints_unrestricted_merge in t1                                 */
+                                       }
+                               else {
+                                       if (constraints_merge(t1, change) == NULL)
+                                               return;                 /* no changes since previous visit              */
+                                               /* if there have been changes, they are updated by              */
+                                               /* constraints_merge in t1                                                              */
+                                       }
+                               }
+                       else {                                          /* first visit                                                  */
+                               /* printf("first visit - constraints cloned\n");                                */
+                               c_dTable[node]->changes = constraints_clone(change);
+                               }
+
+                       /* tmp now holds a copy of the updated variable changes                         */
+                       tmp = constraints_clone(c_dTable[node]->changes);       
+                       }
+               else if (special) {                             /* header and need special traetment    */
+                       /* printf("special treatment called\n");                                                        */
+                       /* tmp now holds a copy of the current new variable changes                     */
+                       tmp = constraints_clone(change);
+                       }
+               else
+                       return;
+
+               bp = block[node];                               /* scan all instructions                                */
+               count = bp.icount;
+               ip = bp.iinstr;
+               ignore = 0;
+
+               for (i=0; i<count; ++i, ++ip) {
+                       switch (ip->opc) {
+                       case ICMD_IASTORE:                      /* found an array store                                 */
+                       case ICMD_LASTORE:          
+                       case ICMD_FASTORE:          
+                       case ICMD_DASTORE:          
+                       case ICMD_AASTORE:          
+                       case ICMD_BASTORE:          
+                       case ICMD_CASTORE:          
+                       case ICMD_SASTORE:
+
+                               t_index = tracing(&bp, i-1, 1); /* get index                                    */
+                               t_array = tracing(&bp, i-1, 2); /* get array refernce                   */
+                               ignore = 1;
+                               /* fall through */
+
+                       case ICMD_IALOAD:                       /* found an array load                                  */
+                       case ICMD_LALOAD:       
+                       case ICMD_FALOAD:
+                       case ICMD_DALOAD:
+                       case ICMD_AALOAD:
+                       case ICMD_BALOAD:
+                       case ICMD_CALOAD:
+                       case ICMD_SALOAD:
+                               if (!ignore) {
+                                       t_index = tracing(&bp, i-1, 0); /* get index                            */
+                                       t_array = tracing(&bp, i-1, 1); /* get array refernce           */
+                                       ignore = 0;
+                                       }
+
+                               /* printf("Array access with params:\n");
+                               printf("Array:\n");
+                               show_trace(t_array);
+                               printf("Index:\n");
+                               show_trace(t_index);
+                               */
+
+#ifdef STATISTICS
+                               if (ip->op1 == OPT_UNCHECKED) {         /* found new access                     */
+                                  c_stat_array_accesses++;
+                                  ip->op1 = OPT_NONE;
+                                  c_stat_no_opt++;
+                                  }
+#endif
+
+                               /* can only optimize known arrays that do not change                    */
+                               if ((t_array->type != TRACE_AVAR) || (c_var_modified[t_array->var])) 
+                                       break;
+                               
+                               switch (t_index->type) {        /* now we look at the index                     */
+                               case TRACE_ICONST:                      /* it is a constant value or an         */
+                               case TRACE_ALENGTH:                     /* array length                                         */
+#ifdef STATISTICS
+                                       switch (ip->op1) {              /* take back old optimzation            */
+                                       case OPT_UNCHECKED:
+                                               break;
+                                       case OPT_NONE:
+                                               c_stat_no_opt--;
+                                               break;
+                                       case OPT_FULL:
+                                               c_stat_full_opt--;
+                                               break;
+                                       case OPT_UPPER:
+                                               c_stat_upper_opt--;
+                                               break;
+                                       case OPT_LOWER:
+                                               c_stat_lower_opt--;
+                                               break;
+                                               }
+#endif
+                                       if (degrade_checks)             /* replace existing optimization        */
+                                               ip->op1 = insert_static(t_array->var, t_index, NULL, special);
+                                       else {
+                                               /* Check current optimization and try to improve it     by      */
+                                               /* inserting new checks                                                                 */
+                                               switch (ip->op1) {      
+                                               case OPT_UNCHECKED:
+                                                       ip->op1 = insert_static(t_array->var, t_index, NULL, special);
+                                                       break;
+                                               case OPT_NONE:          
+                                                       ip->op1 = insert_static(t_array->var, t_index, NULL, special);
+                                                       break;
+                                               case OPT_UPPER:         
+                                                       opt_level = insert_static(t_array->var, t_index, NULL, special);
+                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_LOWER))
+                                                               ip->op1 = OPT_FULL;
+                                                       break;
+                                               case OPT_LOWER: 
+                                                       opt_level = insert_static(t_array->var, t_index, NULL, special);
+                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_UPPER))
+                                                               ip->op1 = OPT_FULL;
+                                                       break;
+                                               case OPT_FULL:
+#ifdef STATISTICS
+                                                       c_stat_full_opt++;
+#endif
+                                                       break;
+                                                       }
+                                               }
+                                       break;
+
+                               case TRACE_IVAR:                        /* it's a variable                                      */
+
+                                       /* if the variable is changed between its usage as an index     */
+                                       /* of the array access and its push onto the stack, we have     */
+                                       /* to set the changes back to the time, it is pushed onto       */
+                                       /* the stack as an index variable.                                                      */
+                                       t = backtrack_var(node, t_index->nr, i-1, t_index->var, tmp[t_index->var]);
+#ifdef STATISTICS
+                                       switch (ip->op1) {              /* take back old optimzation            */
+                                       case OPT_UNCHECKED:
+                                               break;
+                                       case OPT_NONE:
+                                               c_stat_no_opt--;
+                                               break;
+                                       case OPT_FULL:
+                                               c_stat_full_opt--;
+                                               break;
+                                       case OPT_UPPER:
+                                               c_stat_upper_opt--;
+                                               break;
+                                       case OPT_LOWER:
+                                               c_stat_lower_opt--;
+                                               break;
+                                               }
+#endif
+                                       if (degrade_checks)
+                                               ip->op1 = insert_static(t_array->var, t_index, t, special);
+                                       else {
+                                               /* Check current optimization and try to improve it     by      */
+                                               /* insert new check. t reflects var changes for index   */
+                                               switch (ip->op1) {
+                                               case OPT_UNCHECKED:
+                                                       ip->op1 = insert_static(t_array->var, t_index, t, special);
+                                                       break;
+                                               case OPT_NONE:
+                                                       ip->op1 = insert_static(t_array->var, t_index, t, special);
+                                                       break;
+                                               case OPT_UPPER:
+                                                       opt_level = insert_static(t_array->var, t_index, t, special);
+                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_LOWER))
+                                                               ip->op1 = OPT_FULL;
+                                                       break;
+                                               case OPT_LOWER: 
+                                                       opt_level = insert_static(t_array->var, t_index, t, special);
+                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_UPPER))
+                                                               ip->op1 = OPT_FULL;
+                                                       break;
+                                               case OPT_FULL:
+#ifdef STATISTICS
+                                                       c_stat_full_opt++;
+#endif
+                                                       break;
+                                                       }
+                                               }
+                                       break;
+
+                               case TRACE_UNKNOWN: 
+                               case TRACE_AVAR:    
+                                       break;
+                                       }
+                               break;
+               
+                       case ICMD_ISTORE:               /* an integer value is stored                           */
+                               t_index = tracing(&bp, i-1, 0); /* trace back its origin                */
+
+                               /* the struct Changes for this variable needs to be updated             */
+                               t = tmp[ip->op1];
+                               if (t == NULL) {        /* if it's the first one, create new entry      */
+                                       if ((t = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                                               c_mem_error();
+                                       t->upper_bound = t->lower_bound = 0;
+                                       tmp[ip->op1] = t;
+                                       }
+
+                               switch (t_index->type) {                /* check origin of store                */
+
+                               case TRACE_ICONST:      /* constant -> set bounds to const value        */
+                                       t->upper_bound = t->lower_bound = t_index->constant;
+                                       break;  
+
+                               case TRACE_IVAR:        /* if it's the same variable, update consts     */  
+                                       if ((t_index->var = ip->op1) && (t_index->neg > 0)) {
+                                               t->upper_bound += t_index->constant;
+                                               t->lower_bound += t_index->constant;
+                                               }
+                                       else
+                                               t->lower_bound = t->upper_bound+1;
+                                       break;
+
+                               case TRACE_ALENGTH:   /* else -> unknown                                                */
+                               case TRACE_UNKNOWN: 
+                               case TRACE_AVAR: 
+                                       t->lower_bound = t->upper_bound+1;   
+                                       break;
+                                       }
+
+                               break;
+
+                       case ICMD_IINC:                 
+
+                               /* the struct Changes for this variable needs to be updated             */
+                               if ((t = tmp[ip->op1]) == NULL) {       /* first one -> create new      */
+                                       if ((t = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                                               c_mem_error();
+                                       t->upper_bound = t->lower_bound = ip->val.i;
+                                       tmp[ip->op1] = t;
+                                       }  
+                               else {                          /* update changes, made by iinc                         */
+                                       t->upper_bound += ip->val.i;
+                                       t->lower_bound += ip->val.i;
+                                       }
+                               break;
+                               }       /* switch */
+                       }               /* for    */
+               
+               if (!special) {                         /* we are not interested in only the header     */
+                       d = c_dTable[node];
+                       while (d != NULL) {             /* check all sucessors of current node          */
+                               remove_boundchecks(d->value, node, tmp, special);       
+                               d = d->next;
+                               }
+                       }
+           }   /* if */
+}
+
+/*     This function calls the bound-check removal function for the header node
+       with a special flag. It is important to notice, that no dynamic 
+       constraint hold in the header node (because the comparison is done at
+       block end).
+*/
+void remove_header_boundchecks(int node, struct Changes **changes)
+{
+       remove_boundchecks(node, -1, changes, BOUNDCHECK_SPECIAL);
+}
+
+/*     Marks all basicblocks that are part of the loop
+*/
+void mark_loop_nodes(struct LoopContainer *lc)
+{
+       struct LoopElement *le = lc->nodes;
+
+       while (le != NULL) {
+               le->block->lflags |= LOOP_PART;
+               le = le->next;
+               }
+}
+
+/*     Clears mark for all basicblocks that are part of the loop
+*/
+void unmark_loop_nodes(struct LoopContainer *lc)
+{
+       struct LoopElement *le = lc->nodes;
+
+       while (le != NULL) {
+               le->block->lflags = 0;
+               le = le->next;
+               }
+}
+
+
+/*     This function performs the analysis of code in detected loops and trys to
+       identify array accesses suitable for optimization (bound check removal). The
+       intermediate code is then modified to reflect these optimizations.
+*/
+void optimize_single_loop(struct LoopContainer *lc)
+{
+       struct LoopElement *le;
+       struct depthElement *d;
+       int i, head, node;
+       struct Changes **changes;
+
+       if ((changes = (struct Changes **) malloc(maxlocals * sizeof(struct Changes *))) == NULL)
+               c_mem_error();
+
+    head = c_current_head = lc->loop_head;
+       c_needed_instr = c_rs_needed_instr = 0;
+
+       /* init array for null ptr checks */
+       for (i=0; i<maxlocals; ++i) 
+               c_null_check[i] = 0;
+
+
+       /* don't optimize root node (it is the main procedure, not a loop)                      */
+       if (head < 0)
+               return;
+
+       /* setup variables with initial values                                                                          */
+       c_loopvars = NULL;
+       for (i=0; i < block_count; ++i) {
+               c_toVisit[i] = 0;
+               c_current_loop[i] = -1;
+               if ((d = c_dTable[i]) != NULL)
+                       d->changes = NULL;
+               }
+
+       for (i=0; i < maxlocals; ++i) {
+               c_var_modified[i] = 0;
+               if (changes[i] != NULL) {
+                       changes[i] = NULL;
+                       }
+               }
+
+       for (i=0; i < (maxlocals+1); ++i) {
+               if (c_constraints[i] != NULL) {
+                   c_constraints[i] = NULL;
+                       }
+               }
+
+       le = lc->nodes;
+       while (le != NULL) {
+               node = le->node;
+
+               if (node == head)
+                       c_current_loop[node] = 1;   /* the header node gets 1               */
+               else if (c_nestedLoops[node] == head)
+                       c_current_loop[node] = 2;       /* top level nodes get 2                                */
+               else
+                       c_current_loop[node] = 3;       /* nodes, part of nested loop get 3             */
+               
+               c_toVisit[node] = 1;
+               le = le->next;
+               }
+
+       /* After setup work has been performed, start to analyse                                        */
+#ifdef LOOP_DEBUG
+       printf("****** Starting analysis (%d)******\n", head);                  
+       fflush(stdout);
+#endif
+
+       if (analyze_for_array_access(head) > 0) {/* loop contains array access          */
+
+#ifdef LOOP_DEBUG
+               struct LoopVar *lv;
+
+               printf("analyze for array access finished and found\n");        
+               fflush(stdout);
+               lv = c_loopvars;
+               while (lv != NULL) {
+                       if (lv->modified)
+                               printf("Var --> %d\n", lv->value);
+                       lv = lv->next;
+               }
+#endif
+
+               /* for performance reasons the list of all interesting loop vars is             */
+               /* scaned and for all modified vars a flag in c_var_modified is set             */
+               scan_global_list();                                     
+
+#ifdef LOOP_DEBUG
+               printf("global list scanned\n");
+               fflush(stdout);
+#endif
+
+               /* if the loop header contains or-conditions or an index variable               */
+               /* is modified in the catch-block within the loop, a conservative               */
+               /* approach is taken and optimizations are cancelled                                    */
+               if (analyze_or_exceptions(head, lc) > 0) {
+
+#ifdef LOOP_DEBUG
+                       printf("Analyzed for or/exception - no problems \n");            
+                       fflush(stdout);
+#endif
+
+                       init_constraints(head); /* analyze dynamic bounds in header                     */
+
+#ifdef LOOP_DEBUG                      
+                       show_right_side();
+#endif                                                                                         
+
+                       if (c_rightside == NULL)
+                               return;
+
+                       /* single pass bound check removal - for all successors, do                     */
+                       remove_header_boundchecks(head, changes);
+
+                       d = c_dTable[head];
+                       while (d != NULL) {
+                               remove_boundchecks(d->value, -1, changes, BOUNDCHECK_REGULAR);
+                               d = d->next;
+                               }
+           
+#ifdef LOOP_DEBUG
+                       printf("Array-bound checks finished\n");                                                        
+                       fflush(stdout);
+#endif
+
+                       mark_loop_nodes(lc);
+
+#ifdef LOOP_DEBUG                      
+                       printf("START: create static checks\n");
+                       fflush(stdout);
+#endif
+
+                       create_static_checks(lc);       /* create checks                                                */
+
+#ifdef LOOP_DEBUG
+                       printf("END: create static checks\n");
+                       fflush(stdout);
+#endif
+                       unmark_loop_nodes(lc);
+                       }
+               }
+       /* else
+               printf("No array accesses found\n");                                                                    */
+
+#ifdef STATISTICS
+       c_stat_num_loops++;             /* increase number of loops                                                     */      
+
+       c_stat_sum_accesses += c_stat_array_accesses;
+       c_stat_sum_full += c_stat_full_opt;
+       c_stat_sum_no += c_stat_no_opt;
+       c_stat_sum_lower += c_stat_lower_opt;
+       c_stat_sum_upper += c_stat_upper_opt;
+       c_stat_sum_or += c_stat_or;
+       c_stat_sum_exception += c_stat_exception;
+
+       c_stat_array_accesses = 0;              
+       c_stat_full_opt = 0;
+       c_stat_no_opt = 0;
+       c_stat_lower_opt = 0;
+       c_stat_upper_opt = 0;   
+       c_stat_or = c_stat_exception = 0;
+#endif
+       
+}
+
+/*     This function preforms necessary setup work, before the recursive function
+       optimize_single loop can be called.
+*/
+void optimize_loops()
+{
+       struct LoopContainer *lc = c_allLoops;
+
+       /* first, merge loops with same header node - all loops with the same           */
+       /* header node are optimizied in one pass, because they all depend on the       */
+       /* same dynamic loop condition                                                                                          */
+
+#ifdef LOOP_DEBUG
+       printf("start analyze_double_headers\n");
+       fflush(stdout);
+#endif
+
+       analyze_double_headers();
+
+       /* create array with loop nesting levels - nested loops cause problems,         */
+       /* especially, when they modify index variables used in surrounding     loops   */
+       /* store results in array c_nestedLoops and c_hierarchie                                        */
+
+#ifdef LOOP_DEBUG
+       printf("double done\n");
+       fflush(stdout);
+#endif
+
+       analyze_nested();
+
+#ifdef LOOP_DEBUG
+       printf("analyze nested done\n");
+       fflush(stdout);
+#endif
+
+       /* create array with entries for current loop                                                           */
+       c_current_loop = DMNEW(int, block_count);       
+       c_toVisit = DMNEW(int, block_count);
+       c_var_modified = DMNEW(int, maxlocals);
+       c_null_check = DMNEW(int, maxlocals);
+
+       if ((c_constraints = (struct Constraint **) malloc((maxlocals+1) * sizeof(struct Constraint *))) == NULL)
+               c_mem_error();
+
+#ifdef STATISTICS
+       c_stat_num_loops = 0;           /* set statistic vars to zero                                   */
+       c_stat_array_accesses = c_stat_sum_accesses = 0;                
+       c_stat_full_opt = c_stat_sum_full = 0;
+       c_stat_no_opt = c_stat_sum_no = 0;
+       c_stat_lower_opt = c_stat_sum_lower = 0;
+       c_stat_upper_opt = c_stat_sum_upper = 0;
+       c_stat_or = c_stat_sum_or = 0;
+       c_stat_exception = c_stat_sum_exception = 0;
+#endif
+       /* init vars needed by all loops                                            */
+       c_needs_redirection = false;
+       c_newstart = NULL;
+       c_old_xtablelength = exceptiontablelength;
+
+       /* loops have been topologically sorted                                     */
+       lc = c_allLoops;
+       while (lc != NULL) {
+               optimize_single_loop(lc);
+
+#ifdef LOOP_DEBUG
+               printf(" *** Optimized loop *** \n");
+               fflush(stdout);
+#endif
+
+               lc = lc->next;
+               }
+#ifdef LOOP_DEBUG
+       printf("---*** All loops finished ***---\n");
+       fflush(stdout);
+#endif
+
+       /* if global BB list start is modified, set block to new start              */
+       if (c_needs_redirection == true)
+               block = c_newstart;
+
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/loop/analyze.h b/jit/loop/analyze.h
new file mode 100644 (file)
index 0000000..3daa949
--- /dev/null
@@ -0,0 +1,53 @@
+/* jit/loop/analyze.h - bound check removal header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: analyze.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _ANALYZE_H
+#define _ANALYZE_H
+
+void optimize_loops();
+
+#endif /* _ANALYZE_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/loop/graph.c b/jit/loop/graph.c
new file mode 100644 (file)
index 0000000..e8acc0c
--- /dev/null
@@ -0,0 +1,434 @@
+/* jit/loop/graph.c - control flow graph
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel
+
+   Changes: Christian Thalinger
+
+   Contains the functions which build a list, that represents the
+   control flow graph of the procedure, that is being analyzed.
+
+   $Id: graph.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "graph.h"
+#include "loop.h"
+#include "jit.h"
+#include "toolbox/memory.h"
+
+
+void LoopContainerInit(struct LoopContainer *lc, int i)
+{
+       struct LoopElement *le = DMNEW(struct LoopElement, 1);
+
+       le->next = NULL;
+
+       lc->parent = NULL;
+
+       lc->tree_right = NULL;
+       lc->tree_down = NULL;
+
+       lc->exceptions = NULL;
+
+       lc->in_degree = 0;
+       le->node = lc->loop_head = i;
+       le->block = &block[i];
+
+       /* lc->nodes = (int *) malloc(sizeof(int)*block_count);
+       lc->nodes[0] = i; */
+
+       lc->nodes = le;
+}
+       
+
+/*
+   depthFirst() builds the control flow graph out of the intermediate code of  
+   the procedure, that is to be optimized and stores the list in the global 
+   variable c_dTable 
+*/                                                                     
+void depthFirst()
+{
+       int i;
+
+/*     allocate memory and init gobal variables needed by function dF(int, int)        */
+  
+       if ((c_defnum = (int *) malloc(block_count * sizeof(int))) == NULL)             
+               c_mem_error();
+       if ((c_numPre = (int *) malloc(block_count * sizeof(int))) == NULL)
+               c_mem_error();
+       if ((c_parent = (int *) malloc(block_count * sizeof(int))) == NULL)
+               c_mem_error();
+       if ((c_reverse = (int *) malloc(block_count * sizeof(int))) == NULL)
+               c_mem_error();
+       
+       if ((c_pre = (int **) malloc(block_count * sizeof(int *))) == NULL)
+               c_mem_error(); 
+
+       if ((c_dTable = (struct depthElement **) malloc(block_count * sizeof(struct depthElement *))) == NULL)
+               c_mem_error();
+       
+       for (i = 0; i < block_count; ++i) {
+               c_defnum[i] = c_parent[i] = -1;
+               c_numPre[i] = c_reverse[i] = 0;
+
+               if ((c_pre[i] = (int *) malloc(block_count * sizeof(int))) == NULL)
+                       c_mem_error();
+               c_dTable[i] = NULL;
+           }
+  
+       c_globalCount = 0;
+       c_allLoops = NULL;
+  
+       dF(-1, 0);      /* call helper function dF that traverses basic block structure */
+}
+
+
+/*     
+   dF starts from the first block of the given procedure and traverses the 
+   control flow graph in a depth-first order, thereby building up the adeacency
+   list c_dTable
+*/ 
+void dF(int from, int blockIndex)
+{
+       instruction *ip;
+       s4 *s4ptr;
+       int high, low, count;
+       struct depthElement *hp;
+       struct LoopContainer *tmp; 
+       int cnt, *ptr;
+       
+       if (from >= 0) {        
+/*     the current basic block has a predecessor (ie. is not the first one)            */
+               if ((hp = (struct depthElement *) malloc(sizeof(struct depthElement))) == NULL)
+                       c_mem_error();                  /* cretae new depth element                                     */
+
+               hp->next = c_dTable[from];      /* insert values                                                        */
+               hp->value = blockIndex;
+               hp->changes = NULL;
+               
+               c_dTable[from] = hp;    /* insert into table                                                    */
+           }
+  
+       if (from == blockIndex) {       /* insert one node loops into loop container    */
+               if ((tmp = (struct LoopContainer *) malloc(sizeof(struct LoopContainer))) == NULL)
+                       c_mem_error();
+               LoopContainerInit(tmp, blockIndex);
+               tmp->next = c_allLoops;
+               c_allLoops = tmp;
+           }
+
+#ifdef C_DEBUG
+       if (blockIndex > block_count) {
+               fprintf(stderr, "DepthFirst: BlockIndex exceeded\n");
+               exit(1);
+               }               
+#endif
+
+       ip = block[blockIndex].iinstr + block[blockIndex].icount -1;
+                                                                               /* set ip to last instruction                   */
+                                                                       
+       if (c_defnum[blockIndex] == -1) {       /* current block has not been visited   */
+           c_defnum[blockIndex] = c_globalCount;       /* update global count                  */
+           c_parent[blockIndex] = from;        /* write parent block of current one    */
+               c_reverse[c_globalCount] = blockIndex;
+               ++c_globalCount;
+               
+               if (!block[blockIndex].icount) {
+                                                                               /* block does not contain instructions  */
+                       dF(blockIndex, blockIndex+1);
+                   }
+               else {                                                  /* for all successors, do                               */
+                       switch (ip->opc) {                      /* check type of last instruction               */
+                       case ICMD_RETURN:
+                       case ICMD_IRETURN:
+                       case ICMD_LRETURN:
+                       case ICMD_FRETURN:
+                       case ICMD_DRETURN:
+                       case ICMD_ARETURN:
+                       case ICMD_ATHROW:
+                               break;                                  /* function returns -> end of graph             */        
+                               
+                       case ICMD_IFEQ:
+                       case ICMD_IFNE:
+                       case ICMD_IFLT:
+                       case ICMD_IFGE:
+                       case ICMD_IFGT:
+                       case ICMD_IFLE:
+                       case ICMD_IFNULL:
+                       case ICMD_IFNONNULL:
+                       case ICMD_IF_ICMPEQ:
+                       case ICMD_IF_ICMPNE:
+                       case ICMD_IF_ICMPLT:
+                       case ICMD_IF_ICMPGE:
+                       case ICMD_IF_ICMPGT:
+                       case ICMD_IF_ICMPLE:
+                       case ICMD_IF_ACMPEQ:
+                       case ICMD_IF_ACMPNE:                            /* branch -> check next block   */
+                          dF(blockIndex, blockIndex + 1);
+                          /* fall throu */
+                          
+                       case ICMD_GOTO:
+                               dF(blockIndex, block_index[ip->op1]);         
+                               break;                                                  /* visit branch (goto) target   */
+                               
+                       case ICMD_TABLESWITCH:                          /* switch statement                             */
+                               s4ptr = ip->val.a;
+                               
+                               dF(blockIndex, block_index[*s4ptr]);    /* default branch               */
+                               
+                               s4ptr++;
+                               low = *s4ptr;
+                               s4ptr++;
+                               high = *s4ptr;
+                               
+                               count = (high-low+1);
+                               
+                               while (--count >= 0) {
+                                       s4ptr++;
+                                       dF(blockIndex, block_index[*s4ptr]);
+                                   }
+                               break;
+                               
+                       case ICMD_LOOKUPSWITCH:                         /* switch statement                             */
+                               s4ptr = ip->val.a;
+                          
+                               dF(blockIndex, block_index[*s4ptr]);    /* default branch               */
+                               
+                               ++s4ptr;
+                               count = *s4ptr++;
+                               
+                               while (--count >= 0) {
+                                       dF(blockIndex, block_index[s4ptr[1]]);
+                                       s4ptr += 2;
+                                   }
+                               break;
+
+                       case ICMD_JSR:
+                               c_last_jump = blockIndex;
+                               dF(blockIndex, block_index[ip->op1]);         
+                               break;
+                               
+                       case ICMD_RET:
+                               dF(blockIndex, c_last_jump+1);
+                               break;
+                               
+                       default:
+                               dF(blockIndex, blockIndex + 1);
+                               break;  
+                           }                         
+                   }
+           } 
+
+       for (ptr = c_pre[blockIndex], cnt = 0; cnt < c_numPre[blockIndex]; ++cnt, ++ptr)
+       {
+               if (*ptr == from)
+                       break;
+       }
+
+       if (cnt >= c_numPre[blockIndex]) {      
+               c_pre[blockIndex][c_numPre[blockIndex]] = from;
+                                                   /* add predeccessors to list c_pre          */
+               c_numPre[blockIndex]++;                         /* increase number of predecessors      */              
+           }
+    
+}
+
+/* 
+   a slightly modified version of dF(int, int) that is used to traverse the part 
+   of the control graph that is not reached by normal program flow but by the 
+   raising of exceptions (code of catch blocks)
+*/
+void dF_Exception(int from, int blockIndex)
+{
+       instruction *ip;
+       s4 *s4ptr;
+       int high, low, count;
+       struct depthElement *hp;
+
+       if (c_exceptionVisit[blockIndex] < 0)   /* has block been visited, return       */
+               c_exceptionVisit[blockIndex] = 1;
+       else
+               return;
+
+       if (c_dTable[blockIndex] != NULL)               /* back to regular code section         */
+               return;
+
+       if (from >= 0) {                /* build exception graph (in c_exceptionGraph)          */
+           if ((hp = (struct depthElement *) malloc(sizeof(struct depthElement))) == NULL)
+                       c_mem_error();
+
+               hp->next = c_exceptionGraph[from];              
+               hp->value = blockIndex;
+               hp->changes = NULL;
+
+               c_exceptionGraph[from] = hp;
+           }
+       
+#ifdef C_DEBUG
+       if (blockIndex > block_count) {
+               fprintf(stderr, "DepthFirst: BlockIndex exceeded\n");
+               exit(1);
+        }
+#endif
+
+       ip = block[blockIndex].iinstr + block[blockIndex].icount -1;
+       
+       if (!block[blockIndex].icount)
+               dF_Exception(blockIndex, blockIndex+1);
+       else {
+               switch (ip->opc) {
+               case ICMD_RETURN:
+               case ICMD_IRETURN:
+               case ICMD_LRETURN:
+               case ICMD_FRETURN:
+               case ICMD_DRETURN:
+               case ICMD_ARETURN:
+               case ICMD_ATHROW:
+                       break;                                 
+               
+               case ICMD_IFEQ:
+               case ICMD_IFNE:
+               case ICMD_IFLT:
+               case ICMD_IFGE:
+               case ICMD_IFGT:
+               case ICMD_IFLE:
+               case ICMD_IFNULL:
+               case ICMD_IFNONNULL:
+               case ICMD_IF_ICMPEQ:
+               case ICMD_IF_ICMPNE:
+               case ICMD_IF_ICMPLT:
+               case ICMD_IF_ICMPGE:
+               case ICMD_IF_ICMPGT:
+               case ICMD_IF_ICMPLE:
+               case ICMD_IF_ACMPEQ:
+               case ICMD_IF_ACMPNE:
+                       dF_Exception(blockIndex, blockIndex + 1);
+                       /* fall throu */
+         
+               case ICMD_GOTO:
+                       dF_Exception(blockIndex, block_index[ip->op1]);         
+                       break;
+         
+               case ICMD_TABLESWITCH:
+                       s4ptr = ip->val.a;
+                       
+                       /* default branch */
+                       dF_Exception(blockIndex, block_index[*s4ptr]);
+                       
+                       s4ptr++;
+                       low = *s4ptr;
+                       s4ptr++;
+                       high = *s4ptr;
+                       
+                       count = (high-low+1);
+
+                       while (--count >= 0) {
+                               s4ptr++;
+                               dF_Exception(blockIndex, block_index[*s4ptr]);
+                           }
+                       break;
+
+               case ICMD_LOOKUPSWITCH:
+                       s4ptr = ip->val.a;
+                       /* default branch */
+                       dF_Exception(blockIndex, block_index[*s4ptr]);
+                       
+                       ++s4ptr;
+                       count = *s4ptr++;
+
+                       while (--count >= 0) {
+                               dF_Exception(blockIndex, block_index[s4ptr[1]]);
+                               s4ptr += 2;
+                           }  
+                       break;
+
+               case ICMD_JSR:
+                       c_last_jump = blockIndex;
+                       dF_Exception(blockIndex, block_index[ip->op1]);         
+                       break;
+       
+               case ICMD_RET:
+                       dF_Exception(blockIndex, c_last_jump+1);
+                       break;
+                       
+               default:
+                       dF_Exception(blockIndex, blockIndex + 1);
+                       break;  
+                   }                         
+        }
+}
+
+
+/*
+  Test function -> will be removed in final release
+*/
+void resultPass1()
+{
+       int i, j;
+       struct depthElement *hp;
+       
+       printf("\n\n****** PASS 1 ******\n\n");
+       printf("Number of Nodes: %d\n\n", c_globalCount);
+       printf("Predecessors:\n");
+       for (i=0; i<block_count; ++i) {
+               printf("Block %d:\t", i);
+               for (j=0; j<c_numPre[i]; ++j)
+                       printf("%d ", c_pre[i][j]);
+               printf("\n");
+       }
+       printf("\n");
+
+       printf("Graph:\n");
+       for (i=0; i<block_count; ++i) {
+               printf("Block %d:\t", i);
+               hp = c_dTable[i];
+               
+               while (hp != NULL) {
+                       printf("%d ", hp->value);
+                       hp = hp->next;
+                   }
+               printf("\n");
+           }
+       printf("\n");
+}
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/loop/graph.h b/jit/loop/graph.h
new file mode 100644 (file)
index 0000000..139ff28
--- /dev/null
@@ -0,0 +1,47 @@
+/* jit/loop/graph.h - control flow graph header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: graph.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _GRAPH_H
+#define _GRAPH_H
+
+#include "loop.h"
+
+void LoopContainerInit(struct LoopContainer *lc, int i);
+void depthFirst();
+void dF(int from, int blockIndex);
+void dF_Exception(int from, int blockIndex);
+
+void resultPass1();
+
+#endif /* _GRAPH_H */
+
diff --git a/jit/loop/loop.c b/jit/loop/loop.c
new file mode 100644 (file)
index 0000000..8f5b111
--- /dev/null
@@ -0,0 +1,478 @@
+/* jit/loop/loop.c - array bound removal
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel      EMAIL: cacao@complang.tuwien.ac.at
+
+   The loop detection is performed according to Lengauer-Tarjan
+   algorithm that uses dominator trees (found eg. in modern compiler
+   implementation by a.w. appel)
+
+   $Id: loop.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "loop.h"
+#include "graph.h"
+#include "tracing.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+
+/* GLOBAL VARS                                                                                                                         */
+
+int c_debug_nr;                 /* a counter to number all BB with an unique    */
+                                /* value                                        */
+
+/* modified by graph.c                                                                                                                 */
+
+int *c_defnum;                                 /* array that stores a number for each node     when*/
+                                                               /* control flow graph is traveres depth first   */
+int *c_parent;                                 /* for each node that array stores its parent   */
+int *c_reverse;                                        /* for each def number that array stores the    */
+                                                               /* corresponding node                                                   */
+int c_globalCount;                             /* counter for def numbering                                    */
+int *c_numPre;                                 /* array that stores for each node its number   */
+                                                               /* predecessors                                                                 */
+int **c_pre;                                   /* array of array that stores predecessors              */
+int c_last_jump;                               /* stores the source node of the last jsr instr */
+basicblock *c_last_target;      /* stores the source BB of the last jsr instr  */
+
+struct depthElement **c_dTable;        /* adjacency list for control flow graph                */
+struct depthElement **c_exceptionGraph;        /* adjacency list for exception graph   */
+
+struct LoopContainer *c_allLoops;              /* list of all loops                                    */
+struct LoopContainer *c_loop_root;             /* root of loop hierarchie tree                 */
+
+int *c_exceptionVisit;                 /* array that stores a flag for each node part  */
+                                                               /* of the exception graph                                               */
+
+/* modified by loop.c                                                                                                                  */
+
+int *c_semi_dom;                               /* store for each node its semi dominator               */
+int *c_idom;                                   /* store for each node its dominator                    */
+int *c_same_dom;                               /* temp array to hold nodes with same dominator */
+int *c_ancestor;                               /* store for each node its ancestor with lowest */
+                                                               /* semi dominator                                                               */
+int *c_numBucket;                              
+int **c_bucket;
+
+int *c_contains;                               /* store for each node whether it's part of loop*/
+int *c_stack;                                  /* a simple stack as array                                              */
+int c_stackPointer;                            /* stackpointer                                                                 */
+
+
+/* modified by analyze.c                                                                                                               */
+
+struct LoopContainer *root;     /* the root pointer for the hierarchie tree of  */
+                                /* all loops in that procedure                  */
+
+int c_needed_instr;                            /* number of instructions that have to be               */
+                                                               /* inserted before loop header to make sure             */
+                                                               /* array optimization is legal                                  */
+int c_rs_needed_instr;                 /* number of instructions needed to load the    */
+                                                               /* value ofthe right side of the loop condition */
+int *c_nestedLoops;                            /* store for each node the header node of the   */
+                                                               /* loop this node belongs to, -1 for none               */
+int *c_hierarchie;              /* store a loop hierarchie                      */
+int *c_toVisit;                                        /* set for each node that is part of the loop   */
+
+int *c_current_loop;                   /* for each node:                               */
+                                                               /* store 0:     node is not part of loop                        */
+                                                               /* store 1:     node is loop header                                     */
+                                                               /* store 2:     node is in loop but not part of any     */
+                                                               /*                      nested loop                         */
+                                                               /* store 3:     node is part of nested loop                     */
+
+int c_current_head;                            /* store number of node that is header of loop  */
+int *c_var_modified;                   /* store for each local variable whether its    */
+                                                               /* value is changed in the loop                                 */
+
+struct Trace *c_rightside;             /* right side of loop condition                                 */
+struct Constraint **c_constraints;
+                                                               /* array that stores for each variable a list   */
+                                                               /* static tests (constraints) that have to be   */
+                                                               /* performed before loop entry                                  */
+                                                               /* IMPORTANT: c_constraints[maxlocals] stores   */
+                                                               /*                        the tests for constants and the       */
+                                                               /*                        right side of loop condition          */
+       
+struct LoopVar *c_loopvars;            /* a list of all intersting variables of the    */
+                                                               /* current loop (variables that are modified or */
+                                                               /* used as array index                                                  */
+
+basicblock *c_first_block_copied; /* pointer to the first block, that is copied */
+                                  /* during loop duplication                    */
+
+basicblock *c_last_block_copied;  /* last block, that is copied during loop     */
+                                  /* duplication                                */
+
+int *c_null_check;              /* array to store for local vars, whether they  */
+                                /* need to be checked against the null reference*/
+                                /* in the loop head                             */
+
+bool c_needs_redirection;       /* if a loop header is inserted as first block  */
+                                /* into the global BB list, this is set to true */
+                                 
+basicblock *c_newstart;         /* if a loop header is inserted as first block  */
+                                /* into the gloal BB list, this pointer is the  */
+                                /* new start                                    */
+int c_old_xtablelength;         /* used to store the original tablelength       */
+
+/* set debug mode                                                                                                                              */
+#define C_DEBUG
+
+
+/* declare statistic variables                                                                                                 */
+#ifdef STATISTICS
+
+int c_stat_num_loops;                  /* number of loops                                                              */
+
+/* statistics per loop                                                                                                                 */
+int c_stat_array_accesses;             /* number of array accesses                                             */
+
+int c_stat_full_opt;                   /* number of fully optimized accesses                   */
+int c_stat_no_opt;                             /* number of not optimized accesses                             */
+int c_stat_lower_opt;                  /* number of accesses where check against zero  */
+                                                               /* is removed                                                                   */
+int c_stat_upper_opt;                  /* number of accesses where check against array */
+                                                               /* lengh is removed                                                             */
+int c_stat_or;                                 /* set if optimization is cancelled because of  */
+                                                               /* or in loop condition                                                 */
+int c_stat_exception;                  /* set if optimization is cancelled because of  */
+                                                               /* index var modified in catch block                    */
+
+/* statistics per procedure                                                                                                            */
+int c_stat_sum_accesses;               /* number of array accesses                                             */
+
+int c_stat_sum_full;                   /* number of fully optimized accesses                   */
+int c_stat_sum_no;                             /* number of not optimized accesses                             */
+int c_stat_sum_lower;                  /* number of accesses where check against zero  */
+                                                               /* is removed                                                                   */
+int c_stat_sum_upper;                  /* number of accesses where check against array */
+                                                               /* lengh is removed                                                             */
+int c_stat_sum_or;                             /* set if optimization is cancelled because of  */
+                                                               /* or in loop condition                                                 */
+int c_stat_sum_exception;              /* set if optimization is cancelled because of  */
+
+#endif
+
+
+/*     
+   This function allocates and initializes variables, that are used by the
+   loop detection algorithm
+*/
+void setup()
+{
+       int i;
+
+       c_semi_dom = DMNEW(int, block_count);
+       c_idom = DMNEW(int, block_count);
+       c_same_dom = DMNEW(int, block_count);
+       c_numBucket = DMNEW(int, block_count);
+       c_ancestor = DMNEW(int, block_count);
+       c_contains = DMNEW(int, block_count);
+       c_stack = DMNEW(int, block_count);
+       c_bucket = DMNEW(int*, block_count);
+  
+       for (i = 0; i < block_count; ++i) {
+               c_numBucket[i] = 0;
+               c_stack[i] = c_ancestor[i] = c_semi_dom[i] = c_same_dom[i] = c_idom[i] = -1;
+         
+               c_bucket[i] = DMNEW(int, block_count);
+       }
+}
+
+
+/*     This function is a helper function for dominators and has to find the 
+       ancestor of the node v in the control graph, which semi-dominator has the  
+       lowest def-num.
+*/
+int findLowAnc(int v)
+{
+       int u = v;                      /* u is the node which has the current lowest semi-dom  */
+  
+       while (c_ancestor[v] != -1) {   /* as long as v has an ancestor, continue       */
+               if (c_defnum[c_semi_dom[v]] < c_defnum[c_semi_dom[u]])  
+                                                                       /* if v's semi-dom is smaller                           */
+                       u = v;                                  /* it gets the new current node u                       */
+               v = c_ancestor[v];                      /* climb one step up in the tree                        */
+               }
+       return u;                       /* return node with the lowest semi-dominator def-num   */
+}
+
+
+/*     This function builds the dominator tree out of a given control flow graph and 
+       stores its results in c_idom[]. It first calculates the number of possible
+       dominators in c_bucket and eventually determines the single dominator in a 
+       final pass.
+*/
+void dominators()
+{
+       int i, j, semi, s, n, v, actual, p, y;
+  
+       for (n=(c_globalCount-1); n>0; --n) {   /* for all nodes (except last), do      */
+               actual = c_reverse[n];
+               semi = p = c_parent[actual];            
+       
+               /* for all predecessors of current node, do                                                             */
+               for (i=0; i<c_numPre[actual]; ++i) {
+                       v = c_pre[actual][i];
+      
+                       if (c_defnum[v] <= c_defnum[actual])
+                               s = v;                  /* if predecessor has lower def-num     than node       */
+                                                               /* it becomes candidate for semi dominator              */
+                       else
+                               s = c_semi_dom[findLowAnc(v)];
+                                                               /* else the semi-dominator of it's ancestor             */
+                                                               /* with lowest def-num becomes candidate                */
+                       
+                       if (c_defnum[s] < c_defnum[semi])
+                               semi = s;               /* if the def-num of the new candidate is lower */
+                                                               /* than old one, it gets new semi dominator             */
+                       }
+    
+               /* write semi dominator -> according to SEMIDOMINATOR THEOREM                   */
+               c_semi_dom[actual] = semi;                              
+               c_ancestor[actual] = p;                                 
+    
+               c_bucket[semi][c_numBucket[semi]] = actual;
+               c_numBucket[semi]++;    /* defer calculation of dominator to final pass */
+      
+
+               /* first clause of DOMINATOR THEOREM, try to find dominator now                 */
+               for (j=0; j<c_numBucket[p]; ++j) {
+                       v = c_bucket[p][j];
+                       y = findLowAnc(v);
+      
+                       if (c_semi_dom[y] == c_semi_dom[v])     
+                               c_idom[v] = p;                  /* if y's dominator is already known    */
+                                                                               /* found it and write to c_idom                 */
+                       else
+                               c_same_dom[v] = y;              /* wait till final pass                                 */
+                       }
+               
+               c_numBucket[p] = 0;
+               }
+  
+       /* final pass to get missing dominators ->second clause of DOMINATOR THEORM     */
+       for (j=1; j<(c_globalCount-1); ++j) {           
+               if (c_same_dom[c_reverse[j]] != -1)     
+                       c_idom[c_reverse[j]] = c_idom[c_same_dom[c_reverse[j]]];
+               }
+}
+
+
+/*     
+   A helper function needed by detectLoops() that checks, whether a given 
+   connection between two nodes in the control flow graph is possibly part
+   of a loop (is a backEdge).
+*/
+int isBackEdge(int from, int to)
+{
+       int tmp = c_idom[to];   /* speed optimization: if the to-node is dominated      */
+       while (tmp != -1) {             /* by the from node as it is most of the time,          */
+               if (tmp == from)        /* there is no backEdge                                                         */
+                       return 0;
+               tmp = c_idom[tmp];
+               }
+
+       tmp = c_idom[from];             /* if from-node doesn't dominate to-node, we have       */
+       while (tmp != -1) {             /* to climb all the way up from the from-node to        */
+               if (tmp == to)          /* the top to check, whether it is dominated by to      */
+                       return 1;               /* if so, return a backedge                                                     */
+               tmp = c_idom[tmp];
+               }
+
+       return 0;                               /* else, there is no backedge                                           */
+}
+
+
+/*     
+   These stack functions are helper functions for createLoop(int, int)  
+   to manage the set of nodes in the current loop.
+*/
+void push(int i, struct LoopContainer *lc)
+{
+       struct LoopElement *le = lc->nodes, *t;
+
+       if (!c_contains[i])     {
+               t = DMNEW(struct LoopElement, 1);
+               
+               t->node = i;
+               t->block = &block[i];
+
+               c_contains[i] = 1;
+
+               if (i < le->node)
+               {
+                       t->next = lc->nodes;
+                       lc->nodes = t;
+               }
+               else
+               {
+                       while ((le->next != NULL) && (le->next->node < i))
+                               le = le->next;
+
+                       t->next = le->next;
+                       le->next = t;
+               }
+
+               c_stack[c_stackPointer++] = i;
+       }
+}
+
+
+int pop()
+{
+       return (c_stack[--c_stackPointer]);
+}
+
+
+int isFull()
+{
+       return (c_stackPointer);
+}
+
+
+/*     
+   This function is a helper function, that finds all nodes, that belong to 
+   the loop with a known header node and a member node of the loop (and a 
+   back edge between these two nodes).
+*/
+void createLoop(int header, int member)
+{
+       int i, nextMember;
+
+       struct LoopContainer *currentLoop = (struct LoopContainer *) malloc(sizeof(struct LoopContainer));
+       LoopContainerInit(currentLoop, header);         /* set up loop structure                */
+       
+       for (i=0; i<block_count; ++i)
+               c_contains[i] = 0;
+       c_contains[header] = 1;
+
+       c_stackPointer = 0;                             /* init stack with first node of the loop       */
+       push(member, currentLoop);
+
+       while (isFull()) {                              /* while there are still unvisited nodes        */
+               nextMember = pop();
+               
+               /* push all predecessors, while they are not equal to loop header               */
+               for (i=0; i<c_numPre[nextMember]; ++i)                  
+                       push(c_pre[nextMember][i], currentLoop);                
+               }
+
+       currentLoop->next = c_allLoops;
+       c_allLoops = currentLoop;
+}
+
+
+/*     After all dominators have been calculated, the loops can be detected and
+        added to the global list c_allLoops.
+*/
+void detectLoops()
+{
+       int i;
+       struct depthElement *h;
+       
+       /* for all edges in the control flow graph do                                                           */
+       for (i=0; i<block_count; ++i) {                 
+               h = c_dTable[i];
+
+               while (h != NULL) {
+                       /* if it's a backedge, than add a new loop to list                                      */
+                       if (isBackEdge(i, h->value))     
+                               createLoop(h->value, i);
+                       h = h->next;
+                       }
+               }
+}
+
+
+/*     
+   This function is called by higher level routines to perform the loop 
+   detection and set up the c_allLoops list.
+*/
+void analyseGraph()
+{
+  setup();
+  dominators();
+  detectLoops();
+}
+
+
+/*
+   Test function -> will be removed in final release
+*/
+void resultPass2()
+{
+  int i;
+  struct LoopContainer *lc = c_allLoops;
+  struct LoopElement *le;
+  
+  printf("\n\n****** PASS 2 ******\n\n");
+  
+  printf("Loops:\n\n");
+  
+  i = 0;
+  while (lc != NULL) {
+         printf("Loop [%d]: ", ++i);
+
+         le = lc->nodes;
+         while (le != NULL) {
+           printf("%d ", le->node);
+               printf("\n");
+               le = le->next;
+         }
+
+         lc = lc->next;
+  }
+
+  printf("\n");
+
+}
+
+
+void c_mem_error()
+{
+  panic("C_ERROR: Not enough memeory");
+} 
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/loop/loop.h b/jit/loop/loop.h
new file mode 100644 (file)
index 0000000..69fa377
--- /dev/null
@@ -0,0 +1,264 @@
+/* jit/loop/loop.h - array bound removal header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel
+
+   $Id: loop.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _LOOP_H
+#define _LOOP_H
+
+#include "jit.h"
+
+
+/*     Different types for struct Trace                                                                                */
+#define TRACE_UNKNOWN 0                        /* unknown                                                                      */
+#define TRACE_ICONST  1                        /* integer constant value                                       */
+#define TRACE_ALENGTH 2                        /* array length value                                           */
+#define TRACE_IVAR    3                        /* integer variable reference                           */
+#define TRACE_AVAR    4                        /* object (array) reference                                     */
+
+/*     The ways a variable can be used in a loop                                                               */
+#define ARRAY_INDEX      0                     /* var used as array index                                      */
+#define VAR_MOD                  1                     /* var changes its value                                        */
+
+/*     The way, integer variables change their values                                                  */
+#define D_UP             0                     /* var is only increased                                        */
+#define D_DOWN           1                     /* var is only decreased                                        */
+#define D_UNKNOWN        2                     /* not known                                                            */
+
+/*     The different types of operators in loop conditions                                             */
+#define OP_EQ            0                     /* operator:    ==                                                      */
+#define OP_LT         1                        /* operator:    <                                                       */
+#define OP_GE        2                 /* operator:    >=                                                      */
+#define OP_UNKNOWN       3                     /* operator:    unknown                                         */
+
+/*     Possible types of static tests (constraints) in struct Constraint               */
+#define TEST_ZERO                      0       /* check variable against const. lower bound*/
+#define TEST_ALENGTH           1       /* check variable against array length          */
+#define TEST_CONST_ZERO                2       /* check constant against const. lower bound*/
+#define TEST_CONST_ALENGTH     3       /* check variable against array length          */
+#define TEST_UNMOD_ZERO                4       /* check var. that is constant in loop against*/
+                                                               /* constant lower bound                                         */
+#define TEST_UNMOD_ALENGTH     5       /* check var. that is constant in loop against*/
+                                                               /* array length                                                         */
+#define TEST_RS_ZERO           6       /* check constant part of loop condition against*/
+                                                               /* constant lower bound                                                 */
+#define TEST_RS_ALENGTH                7       /* check constant part of loop condition against*/
+                                                               /* array length                                                                 */
+
+/*     Possible types of bound check optimizations                                                                     */
+#define OPT_UNCHECKED  0               /* access not checked yet - first visit                 */
+#define OPT_NONE               1               /* no optimization                                                              */
+#define OPT_FULL               2               /* fully remove bound check                                             */
+#define OPT_LOWER              3               /* remove check againt zero                                             */
+#define OPT_UPPER              4               /* remove check against array length                    */
+
+/*     The different ways, remove_boundcheck(.) can be called                                          */ 
+#define BOUNDCHECK_REGULAR     0       /* perform regular optimization                                 */
+#define BOUNDCHECK_SPECIAL     1       /* only optimize header node - and ignore               */
+                                                               /* information from loop condition                              */
+
+#define LOOP_PART       0x1     /* a flag that marks a BB part of a loop        */
+#define HANDLER_PART    0x2     /* a flag that marks a BB part of ex-handler    */
+#define HANDLER_VISITED 0x4     /* flag to prevent loop if copying catch blocks */
+
+
+
+/*     This struct records information about interesting vars (vars that are modified
+       or used as an array index in loops.
+*/
+struct LoopVar {
+       int value;                                      /* reference to array of local variables                */
+       int modified;                           /* set if value of var is changed                               */
+       int index;                                      /* set if var is used as array index                    */
+       int static_l;                           /* var is never decremented -> static lower             */
+                                                               /* bound possible                                                               */
+       int static_u;                           /* var is never incremented -> static upper             */
+                                                               /* bound possible                                                               */
+       int dynamic_l;
+       int dynamic_l_v;                        /* variable is left side of loop condition in   */
+                                                               /* variable + dynamic_l >= right side                   */
+       int dynamic_u;
+       int dynamic_u_v;                        /* variable is left side of loop condition in   */
+                                                               /* variable + dynamic_u < right side                    */
+       struct LoopVar *next;           /* list pointer                                                                 */
+};
+
+
+/*     This struct records the needed static test of variables before loop entry.      */
+struct Constraint {
+       int type;                                       /* type of test to perform                                              */
+       int arrayRef;                           /* array reference involved in test (if any)    */
+       int varRef;                                     /* which variable to test (if involved)                 */
+       int constant;                           /* which constant to test (if involved)                 */
+       struct Constraint *next;        /* list pointer                                                                 */
+};
+
+
+/* This structure is used to record variables that change their value in loops.        */
+struct Changes {
+       int var;                                        /* variable involved                                                    */
+       int lower_bound;                        /* a minimum lower bound that is guaranteed             */
+       int upper_bound;                        /* a maximum upper bound that is guaranteed             */
+                                                               /* IMPORTANT: if lower_bound > upper_bound              */
+                                                               /* there are no guarantees at all                               */
+};
+
+
+/*     This struct is used to build the control flow graph and stores the variable     
+       changes at the beginning of each basic block.
+*/
+struct depthElement {
+       int value;                                      /* number of successor of this block                    */
+       struct depthElement *next;      /* list pointer                                                                 */
+       struct Changes **changes;       /* pointer to array of variable changes                 */
+};
+
+
+/*     Used to build a list of all basicblock, the loop consists of                            
+*/
+struct LoopElement {
+       int node;
+       basicblock      *block;                 
+       struct LoopElement *next;
+};
+
+
+/*
+   This structure stores informations about a single loop
+*/
+struct LoopContainer {
+       int toOpt;                                                      /* does this loop need optimization             */
+       struct LoopElement *nodes;          /* list of BBs this loop consists of    */
+       int loop_head;                      
+       int in_degree;                      /* needed to topological sort loops to  */
+                                           /* get the order of optimizing them     */
+       struct LoopContainer *next;                     /* list pointer                                                 */
+       struct LoopContainer *parent;           /* points to parent loop, if this BB    */
+                                                                               /* is head of a loop                                    */
+       struct LoopContainer *tree_right;   /* used for tree hierarchie of loops    */
+       struct LoopContainer *tree_down;
+       xtable *exceptions;                 /* list of exception in that loop       */
+};
+
+
+/* global variables */
+extern int c_debug_nr;
+extern int *c_defnum;
+extern int *c_parent;
+extern int *c_reverse;
+extern int c_globalCount;
+extern int *c_numPre;
+extern int **c_pre;
+extern int c_last_jump;
+extern basicblock *c_last_target;
+extern struct depthElement **c_dTable;
+extern struct depthElement **c_exceptionGraph;
+extern struct LoopContainer *c_allLoops;
+extern struct LoopContainer *c_loop_root;
+extern int *c_exceptionVisit;
+
+
+/* global loop variables */
+extern int *c_semi_dom;
+extern int *c_idom;
+extern int *c_same_dom;
+extern int *c_ancestor;
+extern int *c_numBucket;                               
+extern int **c_bucket;
+extern int *c_contains;
+extern int *c_stack;
+extern int c_stackPointer;
+
+
+/* global analyze variables    */
+extern struct LoopContainer *root;
+extern int c_needed_instr;
+extern int c_rs_needed_instr;
+extern int *c_nestedLoops;
+extern int *c_hierarchie;
+extern int *c_toVisit;
+extern int *c_current_loop;
+extern int c_current_head;
+extern int *c_var_modified;
+extern struct Trace *c_rightside;
+extern struct Constraint **c_constraints;
+extern struct LoopVar *c_loopvars;
+extern basicblock *c_first_block_copied;
+extern basicblock *c_last_block_copied;
+extern int *c_null_check;
+extern bool c_needs_redirection;
+extern basicblock *c_newstart;
+extern int c_old_xtablelength;
+
+
+/* global statistic variables */
+#ifdef STATISTICS
+
+extern int c_stat_num_loops;
+extern int c_stat_array_accesses;
+extern int c_stat_full_opt;
+extern int c_stat_no_opt;
+extern int c_stat_lower_opt;
+extern int c_stat_upper_opt;
+extern int c_stat_or;
+extern int c_stat_exception;
+extern int c_stat_sum_accesses;
+extern int c_stat_sum_full;
+extern int c_stat_sum_no;
+extern int c_stat_sum_lower;
+extern int c_stat_sum_upper;
+extern int c_stat_sum_or;
+extern int c_stat_sum_exception;
+
+#endif
+
+
+/* function prototypes */
+void analyseGraph();
+void c_mem_error();
+
+#endif /* _LOOP_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+
diff --git a/jit/loop/tracing.c b/jit/loop/tracing.c
new file mode 100644 (file)
index 0000000..7df83eb
--- /dev/null
@@ -0,0 +1,679 @@
+/* jit/loop/tracing.c - trace functions
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel
+
+   Contains the functions which create a trace. A trace is a
+   structure, that contains the source of the arguments of a given
+   instruction. For more details see function tracing(basicblock, int,
+   int) below.
+
+   $Id: tracing.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "tracing.h"
+#include "loop.h"
+
+
+/*     Test function -> will be removed in final release
+*/
+void printTraceResult(struct Trace *p)
+{
+       printf("TRACE: ");
+
+       switch (p->type) {
+       case TRACE_UNKNOWN:
+               printf("\tUnknown");
+               break;
+       case TRACE_ICONST:
+               printf("\tconst - %d", p->constant);
+               break;
+       case TRACE_ALENGTH:
+               printf("\tarray - (%d)%d - %d", p->neg, p->var, p->constant);
+               break;
+       case TRACE_IVAR:
+               printf("\tivar - (%d)%d - %d", p->neg, p->var, p->constant);
+               break;
+       case TRACE_AVAR:
+               printf("\tavar - %d", p->var);
+               break;
+               }
+       
+       printf("\n");
+}
+
+    
+/*     A function that creates a new trace structure and initializes its values
+*/
+struct Trace* create_trace(int type, int var, int constant, int nr)
+{
+       struct Trace *t;
+       if ((t = (struct Trace *) malloc(sizeof(struct Trace))) == NULL)
+               c_mem_error();
+
+       t->type = type;
+
+       t->neg = 1;
+       t->var = var;
+       t->nr = nr;
+
+       t->constant = constant;
+
+       return t;
+}
+
+
+/*     When the function tracing(...) encounters an add instruction during its 
+       backward scan over the instructions, it trys to identify the source of the
+       arguments of this add function. The following function performs this task.
+*/
+struct Trace* add(struct Trace* a, struct Trace* b)
+{
+       switch (a->type) {                      /* check the first argument of add. when it             */
+       case TRACE_UNKNOWN:                     /* is unknown or array-address, return unknown  */
+       case TRACE_AVAR:
+               return create_trace(TRACE_UNKNOWN, -1, 0, 0);
+
+       case TRACE_ICONST:                      /* when it is constant, check second argument   */
+               switch (b->type) {
+               case TRACE_IVAR:                        /* when second argument is a variable value */
+               case TRACE_ALENGTH:                     /* or array length, just add the constant       */
+                       a->type = b->type;
+                       a->var  = b->var;
+                       a->neg  = b->neg;
+                       a->constant += b->constant;
+                       break;
+               case TRACE_UNKNOWN:                     /* when unknown/array ref. return unknown       */
+               case TRACE_AVAR:
+                     return create_trace(TRACE_UNKNOWN, -1, 0, 0);
+           case TRACE_ICONST:                  /* when both are constant, just add them        */
+                       a->constant += b->constant;
+                       break;
+                       }
+               break;
+
+       case TRACE_IVAR:                        /* when it is a variable value or array length, */
+       case TRACE_ALENGTH:                     /* check second argument                                                */
+               switch (b->type) {
+               case TRACE_IVAR:                        /* when it is not a constant return unknown     */
+               case TRACE_ALENGTH:
+               case TRACE_UNKNOWN:
+               case TRACE_AVAR:
+                       return create_trace(TRACE_UNKNOWN, -1, 0, 0);
+               case TRACE_ICONST:                      /* when it is a constant, just add it           */
+                       a->constant += b->constant;
+                       break;
+                       }
+               break;
+               }
+
+       return a;
+}
+
+
+/*     When the function tracing(...) encounters a neg instruction during its 
+       backward scan over the instructions, it trys to identify the source of the
+       argument of this neg function. The following function performs this task.
+*/
+struct Trace* negate(struct Trace* a)
+{
+       switch (a->type) {                              /* check argument type                                          */
+       case TRACE_IVAR:                                /* when it is variable/array length value       */
+       case TRACE_ALENGTH:                                     
+               a->neg = -(a->neg);                             /* invert negate flag                                   */
+               a->constant = -(a->constant);   /* and negate constant                                  */
+               break;
+       
+       case TRACE_ICONST:                              /* when it is a constant, negate it                     */
+               a->constant = -(a->constant);
+               break;
+
+       default:
+               a->type = TRACE_UNKNOWN;        /* else return unknown                                          */
+               break;
+               }
+
+  return a;
+}
+
+
+/*     When the function tracing(...) encounters a sub instruction during its backward
+       scan over the instructions, it trys to identify the source of the arguments of
+       this sub function. The following function performs this task, by applaying the
+       negate function on the second argument and then adds the values.
+*/
+struct Trace* sub(struct Trace* a, struct Trace* b)
+{
+       struct Trace *c = negate(b);
+       return add(a, c);
+}
+
+
+/*     When the function tracing(...) encounters an array length instruction during
+       its backward scan over the instructions, it trys to identify the source of 
+       the argument ofthis array length function. The following function performs 
+       this task.
+*/
+struct Trace* array_length(struct Trace* a)
+{
+       if (a->type == TRACE_AVAR)      /* if argument is an array ref., mark the type  */
+               a->type = TRACE_ALENGTH;        /* as array length of this array reference      */
+       else
+               a->type = TRACE_UNKNOWN;        /* else it's unknown                                    */
+
+       return a;
+}
+
+
+/*     This function is used to identify the types of operands of an intermediate 
+       code instruction.It is needed by functions, that analyze array accesses. If 
+       something is stored into or loaded from an array, we have to find out, which 
+       array really has been accessed. When a compare instruction is encountered at
+       a loop header, the type of its operands have to be detected to construct
+       dynamic bounds for some variables in the loop. This function returns a struct
+       Trace (see loop.h for more details about this structure). block is the basic
+       block to be examined, index holds the offset of the examined instruction in
+       this block. The arguments are retrieved by using the stack structure, the 
+       compilation process sets up. During the backwards scan of the code, it is 
+       possible, that other instructions temporaray put or get values from the stack
+       and hide the value, we are interested in below them. The value temp counts
+       the number of values on the stack, the are located beyond the target value.
+*/
+struct Trace* tracing(basicblock *block, int index, int temp)
+{
+       int args, retval;
+       instruction *ip;
+       methodinfo *m;
+
+       if (index >= 0) {
+               ip = block->iinstr+index;
+
+/*     printf("TRACING with %d %d %d\n", index, temp, ip->opc);
+*/
+               switch (ip->opc) {
+               
+               /* nop, nullcheckpop                                                                                                    */
+               case ICMD_NOP:                          /* ...  ==> ...                                                         */
+                       return tracing(block, index-1, temp);
+                       break;
+      
+               case ICMD_NULLCHECKPOP:         /* ..., objectref  ==> ...                                      */
+                       return tracing(block, index-1, temp+1);
+                       break;
+
+               /* Constants                                                                                                                    */
+               case ICMD_LCONST:                               
+               case ICMD_DCONST:
+               case ICMD_FCONST:
+               case ICMD_ACONST:
+                       if (temp > 0)                           
+                               return tracing(block, index-1, temp-1);         
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;                                          
+
+               case ICMD_ICONST:
+                       if (temp > 0)           /* if the target argument is not on top                 */
+                               return tracing(block, index-1, temp-1); /* look further                 */
+                       else
+                               return create_trace(TRACE_ICONST, -1, ip->val.i, index);
+                       break;                          /* else, return the value, found at this instr. */
+
+               /* Load/Store                                                                                                                   */
+        case ICMD_LLOAD:               
+               case ICMD_DLOAD:    
+               case ICMD_FLOAD:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+    
+               case ICMD_ILOAD:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                   else
+                               return create_trace(TRACE_IVAR, ip->op1, 0, index);
+                       break;
+
+               case ICMD_ALOAD:    
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                       else
+                               return create_trace(TRACE_AVAR, ip->op1, 0, index);                     
+                       break;
+               
+               case ICMD_LSTORE:    
+               case ICMD_DSTORE:    
+               case ICMD_FSTORE:
+               case ICMD_ISTORE:
+               case ICMD_ASTORE:    
+                       return tracing(block, index-1, temp+1);
+                       break;
+       
+
+               /* pop/dup/swap                                                                                                                 */
+               case ICMD_POP:      
+                       return tracing(block, index-1, temp+1);
+                       break;
+     
+               case ICMD_POP2:  
+                       return tracing(block, index-1, temp+2);
+                       break;
+
+               case ICMD_DUP:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                       else
+                               return tracing(block, index-1, temp);
+                       break;
+
+               case ICMD_DUP_X1:                       /* ..., a, b ==> ..., b, a, b                           */
+                       switch (temp) {
+                       case 0:                                 /* when looking for top or third element,       */
+                       case 2:                                 /* just return top element                                      */
+                               return tracing(block, index-1, 0);
+                       case 1:
+                               return tracing(block, index-1, 1);
+                       default:
+                               return tracing(block, index-1, temp-1);
+                               }
+                       break;
+
+               case ICMD_DUP2:                         /* ..., a, b ==> ..., a, b, a, b                        */
+                       switch (temp) { 
+                       case 0:                                 /* when looking for top or third element        */
+                       case 2:                                 /* just return top element                                      */
+                               return tracing(block, index-1, 0);
+                       case 1:                                 /* when looking for second or fourth element*/
+                       case 3:                                 /* just return second element                           */
+                               return tracing(block, index-1, 1);
+                       default:
+                               return tracing(block, index-1, temp-2);
+                               }
+                       break;
+
+               case ICMD_DUP2_X1:                      /* ..., a, b, c ==> ..., b, c, a, b, c          */
+                       switch (temp) {
+                       case 0:
+                       case 3:
+                               return tracing(block, index-1, 0);
+                       case 1:
+                       case 4:
+                               return tracing(block, index-1, 1);
+                       case 2:
+                               return tracing(block, index-1, 2);
+                       default:
+                               return tracing(block, index-1, temp-2);
+                               }
+                       break;
+
+               case ICMD_DUP_X2:                       /* ..., a, b, c ==> ..., c, a, b, c                     */
+                       switch (temp) {    
+                       case 0:
+                       case 3:
+                               return tracing(block, index-1, 0);
+                       case 1:
+                       case 4:
+                               return tracing(block, index-1, 1);
+                       case 2:
+                               return tracing(block, index-1, 2);
+                       default:
+                               return tracing(block, index-1, temp-2);
+                               }
+                       break;
+
+               case ICMD_DUP2_X2:                      /* .., a, b, c, d ==> ..., c, d, a, b, c, d     */
+                       switch (temp) {
+                       case 0:
+                       case 4:
+                               return tracing(block, index-1, 0);
+                       case 1:
+                       case 5:
+                               return tracing(block, index-1, 1);
+                       case 2:
+                               return tracing(block, index-1, 2);
+                       case 3:
+                               return tracing(block, index-1, 3);
+                       default:
+                               return tracing(block, index-1, temp-2);
+                               }
+                       break;
+
+               case ICMD_SWAP:                         /* ..., a, b ==> ..., b, a                                      */
+                       switch (temp) {
+                       case 0:
+                               return tracing(block, index-1, 1);
+                       case 1:
+                               return tracing(block, index-1, 0);
+                       default:
+                               return tracing(block, index-1, temp);
+                               }
+                       break;
+      
+               /* Interger operations                                                                                                  */
+           case ICMD_INEG:                             /* ..., value  ==> ..., - value                         */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else                                    /* if an inter neg. operation is found,         */
+                                                                       /* invokethe negate function                            */
+                               return negate(tracing(block, index-1, temp));
+                       break;
+
+               case ICMD_LNEG:                         /* ..., value  ==> ..., - value                         */
+               case ICMD_I2L:                          /* ..., value  ==> ..., value                           */
+               case ICMD_L2I:                          /* ..., value  ==> ..., value                           */
+               case ICMD_INT2BYTE:                     /* ..., value  ==> ..., value                           */
+               case ICMD_INT2CHAR:                     /* ..., value  ==> ..., value                           */
+               case ICMD_INT2SHORT:            /* ..., value  ==> ..., value                           */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_IADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+1);
+                       else                                    /* when add is encountered, invoke add func     */
+                               return add(tracing(block, index-1, 0), tracing(block, index-1, 1));
+                       break;
+
+               case ICMD_IADDCONST:            /* ..., value  ==> ..., value + constant        */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else                                    /* when a constant is added, create a           */
+                                                                       /* constant-trace and use add function          */
+                               return add(tracing(block, index-1, 0), create_trace(TRACE_ICONST, -1, ip->val.i, index));
+                       break;
+
+               case ICMD_ISUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+1);
+                       else                                    /* use sub function for sub instructions        */
+                               return sub(tracing(block, index-1, 1), tracing(block, index-1, 0));
+                       break;
+
+               case ICMD_ISUBCONST:            /* ..., value  ==> ..., value + constant        */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return sub(tracing(block, index-1, 0), create_trace(TRACE_ICONST, -1, ip->val.i, index));
+                       break;
+
+               case ICMD_LADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
+               case ICMD_LSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
+               case ICMD_IMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
+               case ICMD_LMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
+               case ICMD_ISHL:                         /* ..., val1, val2  ==> ..., val1 << val2       */
+               case ICMD_ISHR:                         /* ..., val1, val2  ==> ..., val1 >> val2       */
+               case ICMD_IUSHR:                        /* ..., val1, val2  ==> ..., val1 >>> val2      */
+               case ICMD_LSHL:                         /* ..., val1, val2  ==> ..., val1 << val2       */
+               case ICMD_LSHR:                         /* ..., val1, val2  ==> ..., val1 >> val2       */
+               case ICMD_LUSHR:                        /* ..., val1, val2  ==> ..., val1 >>> val2      */
+               case ICMD_IAND:                         /* ..., val1, val2  ==> ..., val1 & val2        */
+               case ICMD_LAND:  
+               case ICMD_IOR:                          /* ..., val1, val2  ==> ..., val1 | val2        */
+               case ICMD_LOR:
+               case ICMD_IXOR:                         /* ..., val1, val2  ==> ..., val1 ^ val2        */
+               case ICMD_LXOR:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+     
+               case ICMD_LADDCONST:            /* ..., value  ==> ..., value + constant        */
+               case ICMD_LSUBCONST:            /* ..., value  ==> ..., value - constant        */
+               case ICMD_IMULCONST:            /* ..., value  ==> ..., value * constant        */
+               case ICMD_LMULCONST:            /* ..., value  ==> ..., value * constant        */
+               case ICMD_IDIVPOW2:                     /* ..., value  ==> ..., value << constant       */
+               case ICMD_LDIVPOW2:                     /* val.i = constant                                                     */
+               case ICMD_ISHLCONST:            /* ..., value  ==> ..., value << constant       */
+               case ICMD_ISHRCONST:            /* ..., value  ==> ..., value >> constant       */
+               case ICMD_IUSHRCONST:           /* ..., value  ==> ..., value >>> constant      */
+               case ICMD_LSHLCONST:            /* ..., value  ==> ..., value << constant       */
+               case ICMD_LSHRCONST:            /* ..., value  ==> ..., value >> constant       */
+               case ICMD_LUSHRCONST:           /* ..., value  ==> ..., value >>> constant      */
+               case ICMD_IANDCONST:            /* ..., value  ==> ..., value & constant        */
+               case ICMD_IREMPOW2:                     /* ..., value  ==> ..., value % constant        */
+               case ICMD_IREM0X10001:          /* ..., value  ==> ..., value % 0x100001        */
+               case ICMD_LANDCONST:            /* ..., value  ==> ..., value & constant        */
+               case ICMD_LREMPOW2:                     /* ..., value  ==> ..., value % constant        */
+               case ICMD_LREM0X10001:          /* ..., value  ==> ..., value % 0x10001         */
+               case ICMD_IORCONST:                     /* ..., value  ==> ..., value | constant        */
+               case ICMD_LORCONST:                     /* ..., value  ==> ..., value | constant        */  
+               case ICMD_IXORCONST:            /* ..., value  ==> ..., value ^ constant        */
+               case ICMD_LXORCONST:            /* ..., value  ==> ..., value ^ constant        */
+               case ICMD_LCMP:                         /* ..., val1, val2  ==> ..., val1 cmp val2      */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_IINC:                         /* ..., value  ==> ..., value + constant        */
+                       return tracing(block, index-1, temp);
+                       break;
+
+
+               /* floating operations                                                                                                  */
+               case ICMD_FADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
+               case ICMD_DADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
+               case ICMD_FSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
+               case ICMD_DSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
+               case ICMD_FMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
+               case ICMD_DMUL:                         /* ..., val1, val2  ==> ..., val1 *** val2      */
+               case ICMD_FDIV:                         /* ..., val1, val2  ==> ..., val1 / val2        */
+               case ICMD_DDIV:                         /* ..., val1, val2  ==> ..., val1 / val2        */
+               case ICMD_FREM:                         /* ..., val1, val2  ==> ..., val1 % val2        */
+               case ICMD_DREM:                         /* ..., val1, val2  ==> ..., val1 % val2        */
+               case ICMD_FCMPL:                        /* .., val1, val2  ==> ..., val1 fcmpl val2     */
+               case ICMD_DCMPL:
+               case ICMD_FCMPG:                        /* .., val1, val2  ==> ..., val1 fcmpg val2     */
+               case ICMD_DCMPG:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_FNEG:                         /* ..., value  ==> ..., - value                         */
+               case ICMD_DNEG:                         /* ..., value  ==> ..., - value                         */  
+               case ICMD_I2F:                          /* ..., value  ==> ..., (float) value           */
+               case ICMD_L2F:
+               case ICMD_I2D:                          /* ..., value  ==> ..., (double) value          */
+               case ICMD_L2D:
+               case ICMD_F2I:                          /* ..., value  ==> ..., (int) value                     */
+               case ICMD_D2I:
+               case ICMD_F2L:                          /* ..., value  ==> ..., (long) value            */
+               case ICMD_D2L:  
+               case ICMD_F2D:                          /* ..., value  ==> ..., (double) value          */
+               case ICMD_D2F:                          /* ..., value  ==> ..., (double) value          */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+   
+               /* memory operations                                                                                                    */
+                case ICMD_ARRAYLENGTH:         /* ..., arrayref  ==> ..., length                       */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return array_length(tracing(block, index-1, 0));
+                       break;
+
+               case ICMD_AALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_LALOAD:                       /* ..., arrayref, index  ==> ..., value         */  
+               case ICMD_IALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_FALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_DALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_CALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_SALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_BALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+                       if (temp > 0)           
+                               return tracing(block, index-1, temp+1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_AASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_LASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_IASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_FASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_DASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_CASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_SASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_BASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+                       return tracing(block, index-1, temp+3);
+                       break;
+               case ICMD_PUTSTATIC:            /* ..., value  ==> ...                                          */
+               case ICMD_PUTFIELD:                     /* ..., value  ==> ...                                          */
+                       return tracing(block, index-1, temp+1);
+                       break;
+               case ICMD_GETSTATIC:            /* ...  ==> ..., value                                          */
+               case ICMD_GETFIELD:                     /* ...  ==> ..., value                                          */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+
+               /* branch: should not be encountered, but function calls possible               */
+               case ICMD_INVOKESTATIC:         /* ..., [arg1, [arg2 ...]] ==> ...                      */
+                       m = ip->val.a;                  /* get method pointer and                                       */
+                       args = ip->op1;                 /* number of arguments                                          */
+                       if (m->returntype != TYPE_VOID)
+                               retval = 1;                     /* if function returns a value, it is on        */
+                       else                                    /* top of stack                                                         */
+                               retval = 0;
+      
+                       if (temp > 0)                   /* temp is increased by number of arguments     */
+                                                                       /* less a possible result value                         */
+                               return tracing(block, index-1, temp+(args-retval));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_INVOKESPECIAL:        /* ..., objectref, [arg1, [arg2 ...]] ==> .     */
+               case ICMD_INVOKEVIRTUAL:        /* ..., objectref, [arg1, [arg2 ...]] ==> .     */
+               case ICMD_INVOKEINTERFACE:      /* ..., objectref, [arg1, [arg2 ...]] ==> . */
+                       m = ip->val.a;
+                       args = ip->op1; 
+                       if (m->returntype != TYPE_VOID)
+                               retval = 1;
+                       else
+                               retval = 0;
+                       
+                       if (temp > 0)                   /* same as above but add 1 for object ref       */
+                               return tracing(block, index-1, temp+(args-retval+1));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+               /* special                                                                                                                              */  
+               case ICMD_INSTANCEOF:           /* ..., objectref ==> ..., intresult            */
+               case ICMD_CHECKCAST:            /* ..., objectref ==> ..., objectref            */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+      
+               case ICMD_MULTIANEWARRAY:       /* ..., cnt1, [cnt2, ...] ==> ..., arrayref     */
+                                                                       /* op1 = dimension                                                      */ 
+
+                       if (temp > 0)                   /* temp increased by number of dimensions       */
+                                                                       /* minus one for array ref                                      */
+                               return tracing(block, index-1, temp+(ip->op1 - 1));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+       
+               case ICMD_BUILTIN3:                     /* ..., arg1, arg2, arg3 ==> ...                        */
+                       if (ip->op1 != TYPE_VOID)
+                               retval = 1;
+                       else
+                               retval = 0;
+      
+                       if (temp > 0)                   /* increase temp by 3 minus possible return     */
+                                                                       /* value                                                                        */
+                               return tracing(block, index-1, temp+(3-retval));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_BUILTIN2:                     /* ..., arg1, arg2 ==> ...                                      */
+                       if (ip->op1 != TYPE_VOID)
+                               retval = 1;
+                       else
+                               retval = 0;
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+(2-retval));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                                                    */
+                       if (ip->op1 != TYPE_VOID)
+                               retval = 1;
+                       else
+                               retval = 0;
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+(1-retval));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               /* others                                                                                                                               */
+               default:
+                       return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       }       /* switch       */
+               }               /* if           */
+       else
+               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/loop/tracing.h b/jit/loop/tracing.h
new file mode 100644 (file)
index 0000000..5117c70
--- /dev/null
@@ -0,0 +1,79 @@
+/* jit/loop/tracing.h - trace functions header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: tracing.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _TRACING_H
+#define _TRACING_H
+
+#include "jit.h"
+
+/*     
+   This struct is needed to record the source of operands of intermediate code
+   instructions. The instructions are scanned backwards and the stack is 
+   analyzed in order to determine the type of operand.
+*/
+struct Trace {
+       int type;                  /* the type of the operand                                           */
+       int neg;                   /* set if negated                                                            */
+       int var;                   /* variable reference        for IVAR                                */
+                                          /* array reference           for AVAR/ARRAY                  */
+       int nr;                    /* instruction number in the basic block, where */
+                                          /* the trace is defined                                                      */
+       int constant;              /* constant value            for ICONST                              */
+                                              /* modifiers                     for IVAR                                */
+};
+
+
+
+/* function protoypes */
+struct Trace* create_trace(int type, int var, int constant, int nr);
+struct Trace* add(struct Trace* a, struct Trace* b);
+struct Trace* negate(struct Trace* a);
+struct Trace* sub(struct Trace* a, struct Trace* b);
+struct Trace* array_length(struct Trace* a);
+struct Trace* tracing(basicblock *block, int index, int temp);
+
+#endif /* _TRACING_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/mcode.c b/jit/mcode.c
deleted file mode 100644 (file)
index 2da470f..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-/***************************** comp/mcode.c ************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       This file is an include file for "compiler.c" . It contains (mostly)
-       architecture independent functions for writing instructions into the
-       code area and constants into the data area.
-
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Micheal Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/08/10
-
-
-       All functions assume the following code area / data area layout:
-
-       +-----------+
-       |           |
-       | code area | code area grows to higher addresses
-       |           |
-       +-----------+ <-- start of procedure
-       |           |
-       | data area | data area grows to lower addresses
-       |           |
-       +-----------+
-
-       The functions first write into a temporary code/data area allocated by
-       "mcode_init". "mcode_finish" copies the code and data area into permanent
-       memory. All functions writing values into the data area return the offset
-       relative the begin of the code area (start of procedure).       
-
-*******************************************************************************/
-
-#define MCODEINITSIZE (1<<15)       /* 32 Kbyte code area initialization size */
-#define DSEGINITSIZE  (1<<12)       /*  4 Kbyte data area initialization size */
-
-static u1* mcodebase = NULL;        /* base pointer of code area              */
-static s4* mcodeend  = NULL;        /* pointer to end of code area            */
-static int mcodesize;               /* complete size of code area (bytes)     */
-
-static u1* dsegtop = NULL;          /* pointer to top (end) of data area      */
-static int dsegsize;                /* complete size of data area (bytes)     */
-static int dseglen;                 /* used size of data area (bytes)         */
-                                    /* data area grows from top to bottom     */
-
-static jumpref *jumpreferences;     /* list of jumptable target addresses     */
-static dataref *datareferences;     /* list of data segment references        */
-static branchref *xboundrefs;       /* list of bound check branches           */
-static branchref *xcheckarefs;      /* list of array size check branches      */
-static branchref *xnullrefs;        /* list of null check branches            */
-static branchref *xcastrefs;        /* list of cast check branches            */
-static branchref *xdivrefs;         /* list of divide by zero branches        */
-
-static void mcode_init();           /* allocates code and data area           */
-static void mcode_close();          /* releases temporary storage             */
-static void mcode_finish();         /* makes code and data area permanent and */
-                                    /* updates branch references to code/data */
-
-static s4 dseg_adds4(s4 value);         /* adds an int to data area           */
-static s4 dseg_adds8(s8 value);         /* adds an long to data area          */
-static s4 dseg_addfloat (float value);  /* adds an float to data area         */
-static s4 dseg_adddouble(double value); /* adds an double to data area        */
-
-#if POINTERSIZE==8
-#define dseg_addaddress(value)      dseg_adds8((s8)(value))
-#else
-#define dseg_addaddress(value)      dseg_adds4((s4)(value))
-#endif
-
-static void dseg_addtarget(basicblock *target);
-static void dseg_adddata(u1 *ptr);
-static void mcode_addreference(basicblock *target, void *branchptr);
-static void mcode_addxboundrefs(void *branchptr);
-static void mcode_addxnullrefs(void *branchptr);
-static void mcode_addxcastrefs(void *branchptr);
-static void mcode_addxdivrefs(void *branchptr);
-
-static void dseg_display(s4 *s4ptr);
-
-/* mcode_init allocates and initialises code area, data area and references   */
-
-static void mcode_init()
-{
-       if (!mcodebase) {
-               mcodebase = MNEW (u1, MCODEINITSIZE);
-               mcodesize = MCODEINITSIZE;
-               }
-
-       if (!dsegtop) {
-               dsegtop = MNEW (u1, DSEGINITSIZE);
-               dsegsize = DSEGINITSIZE;
-               dsegtop += dsegsize;
-               }
-
-       dseglen = 0;
-
-       jumpreferences = NULL;
-       datareferences = NULL;
-       xboundrefs = NULL;
-       xnullrefs = NULL;
-       xcastrefs = NULL;
-       xdivrefs = NULL;
-}
-
-
-/* mcode_close releases temporary code and data area                          */
-
-static void mcode_close()
-{
-       if (mcodebase) {
-               MFREE (mcodebase, u1, mcodesize);
-               mcodebase = NULL;
-               }
-       if (dsegtop) {
-               MFREE (dsegtop - dsegsize, u1, dsegsize);
-               dsegtop = NULL;
-               }
-}
-
-
-/* mcode_increase doubles code area                                           */
-
-static s4 *mcode_increase(u1 *codeptr)
-{
-       long len;
-
-       len = codeptr - mcodebase;
-       mcodebase = MREALLOC(mcodebase, u1, mcodesize, mcodesize * 2);
-       mcodesize *= 2;
-       mcodeend = (s4*) (mcodebase + mcodesize);
-       return (s4*) (mcodebase + len);
-}
-
-
-/* desg_increase doubles data area                                            */
-
-static void dseg_increase() {
-       u1 *newstorage = MNEW (u1, dsegsize * 2);
-       memcpy ( newstorage + dsegsize, dsegtop - dsegsize, dsegsize);
-       MFREE (dsegtop - dsegsize, u1, dsegsize);
-       dsegtop = newstorage;
-       dsegsize *= 2;
-       dsegtop += dsegsize;
-}
-
-
-static s4 dseg_adds4_increase(s4 value)
-{
-       dseg_increase();
-       *((s4 *) (dsegtop - dseglen)) = value;
-       return -dseglen;
-}
-
-
-static s4 dseg_adds4(s4 value)
-{
-       s4 *dataptr;
-
-       dseglen += 4;
-       dataptr = (s4 *) (dsegtop - dseglen);
-       if (dseglen > dsegsize)
-               return dseg_adds4_increase(value);
-       *dataptr = value;
-       return -dseglen;
-}
-
-
-static s4 dseg_adds8_increase(s8 value)
-{
-       dseg_increase();
-       *((s8 *) (dsegtop - dseglen)) = value;
-       return -dseglen;
-}
-
-
-static s4 dseg_adds8(s8 value)
-{
-       s8 *dataptr;
-
-       dseglen = ALIGN (dseglen + 8, 8);
-       dataptr = (s8 *) (dsegtop - dseglen);
-       if (dseglen > dsegsize)
-               return dseg_adds8_increase(value);
-       *dataptr = value;
-       return -dseglen;
-}
-
-
-static s4 dseg_addfloat_increase(float value)
-{
-       dseg_increase();
-       *((float *) (dsegtop - dseglen)) = value;
-       return -dseglen;
-}
-
-
-static s4 dseg_addfloat(float value)
-{
-       float *dataptr;
-
-       dseglen += 4;
-       dataptr = (float *) (dsegtop - dseglen);
-       if (dseglen > dsegsize)
-               return dseg_addfloat_increase(value);
-       *dataptr = value;
-       return -dseglen;
-}
-
-
-static s4 dseg_adddouble_increase(double value)
-{
-       dseg_increase();
-       *((double *) (dsegtop - dseglen)) = value;
-       return -dseglen;
-}
-
-
-static s4 dseg_adddouble(double value)
-{
-       double *dataptr;
-
-       dseglen = ALIGN (dseglen + 8, 8);
-       dataptr = (double *) (dsegtop - dseglen);
-       if (dseglen > dsegsize)
-               return dseg_adddouble_increase(value);
-       *dataptr = value;
-       return -dseglen;
-}
-
-
-static void dseg_addtarget(basicblock *target)
-{
-       jumpref *jr = DNEW(jumpref);
-
-       jr->tablepos = dseg_addaddress(NULL);
-       jr->target = target;
-       jr->next = jumpreferences;
-       jumpreferences = jr;
-}
-
-
-static void dseg_adddata(u1 *ptr)
-{
-       dataref *dr = DNEW(dataref);
-
-       dr->pos = (u1 *) (ptr - mcodebase);
-       dr->next = datareferences;
-       datareferences = dr;
-}
-
-
-static void mcode_addreference(basicblock *target, void *branchptr)
-{
-       s4 branchpos = (u1*) branchptr - mcodebase;
-
-       if (target->mpc >= 0) {
-               gen_resolvebranch((u1*) mcodebase + branchpos, branchpos, target->mpc);
-               }
-       else {
-               branchref *br = DNEW(branchref);
-
-               br->branchpos = branchpos;
-               br->next = target->branchrefs;
-               target->branchrefs= br;
-               }
-}
-
-
-static void mcode_addxboundrefs(void *branchptr)
-{
-       s4 branchpos = (u1*) branchptr - mcodebase;
-
-       branchref *br = DNEW(branchref);
-
-       br->branchpos = branchpos;
-       br->next = xboundrefs;
-       xboundrefs = br;
-}
-
-
-static void mcode_addxcheckarefs(void *branchptr)
-{
-       s4 branchpos = (u1*) branchptr - mcodebase;
-
-       branchref *br = DNEW(branchref);
-
-       br->branchpos = branchpos;
-       br->next = xcheckarefs;
-       xcheckarefs = br;
-}
-
-
-static void mcode_addxnullrefs(void *branchptr)
-{
-       s4 branchpos = (u1*) branchptr - mcodebase;
-
-       branchref *br = DNEW(branchref);
-
-       br->branchpos = branchpos;
-       br->next = xnullrefs;
-       xnullrefs = br;
-}
-
-
-static void mcode_addxcastrefs(void *branchptr)
-{
-       s4 branchpos = (u1*) branchptr - mcodebase;
-
-       branchref *br = DNEW(branchref);
-
-       br->branchpos = branchpos;
-       br->next = xcastrefs;
-       xcastrefs = br;
-}
-
-
-static void mcode_addxdivrefs(void *branchptr)
-{
-       s4 branchpos = (u1*) branchptr - mcodebase;
-
-       branchref *br = DNEW(branchref);
-
-       br->branchpos = branchpos;
-       br->next = xdivrefs;
-       xdivrefs = br;
-}
-
-
-static void mcode_finish(int mcodelen)
-{
-       jumpref *jr;
-       u1 *epoint;
-
-       count_code_len += mcodelen;
-       count_data_len += dseglen;
-
-       dseglen = ALIGN(dseglen, MAX_ALIGN);
-
-       method -> mcodelength = mcodelen + dseglen;
-       method -> mcode = CNEW(u1, mcodelen + dseglen);
-
-       memcpy ( method->mcode, dsegtop - dseglen, dseglen);
-       memcpy ( method->mcode + dseglen, mcodebase, mcodelen);
-
-       method -> entrypoint = epoint = (u1*) (method->mcode + dseglen);
-
-       /* jump table resolving */
-       jr = jumpreferences;
-       while (jr != NULL) {
-           *((void**) (epoint + jr->tablepos)) = epoint + jr->target->mpc;
-           jr = jr->next;
-           }
-
-#if defined(__I386__) || defined(__X86_64__)
-        {
-            dataref *dr;
-            /* add method into datastructure to find the entrypoint */
-            (void) addmethod(method->entrypoint, method->entrypoint + mcodelen);
-        
-            /* data segment references resolving */
-            dr = datareferences;
-            while (dr != NULL) {
-                *((void**) ((long) epoint + (long) dr->pos - POINTERSIZE)) = epoint;
-                dr = dr->next;
-            }
-        }
-#endif
-}
-
-
-static void dseg_display(s4 *s4ptr)
-{
-       int i;
-       
-       printf("  --- dump of datasegment\n");
-       for (i = dseglen; i > 0 ; i -= 4) {
-               printf("-%6x: %8x\n", i, (int)(*s4ptr++));
-               }
-       printf("  --- begin of data segment: %p\n", s4ptr);
-}
index 3b0b4fa377a45bc9426797c0a7b2a9270eea3b1f..baf6147853694b1e45ec0a544b98c025d8138b55 100644 (file)
@@ -1,59 +1,77 @@
-/* jit/parse.c *****************************************************************
+/* jit/parse.c - parser for JavaVM to intermediate code translation
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Parser for JavaVM to intermediate code translation
-       
-       Author: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Last Change: $Id: parse.c 553 2003-11-01 20:50:03Z twisti $
-                     include Rapid Type Analysis parse - 5/2003 - carolyn
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-#include "math.h"
-#include "sets.h"
-                                /* data about the currently parsed   method   */
+   Author: Andreas Krall
 
-static classinfo  *rt_class;    /* class the compiled method belongs to       */
-static methodinfo *rt_method;   /* pointer to method info of compiled method  */
-static utf      *rt_descriptor; /* type descriptor of compiled method         */
-static int       rt_jcodelength; /*length of JavaVM-codes                     */
-static u1       *rt_jcode;      /* pointer to start of JavaVM-code            */
+   Changes: Carolyn Oates
 
+   $Id: parse.c 557 2003-11-02 22:51:59Z twisti $
 
-/* macros for byte code fetching ***********************************************
+*/
 
-       fetch a byte code of given size from position p in code array jcode
 
-*******************************************************************************/
+#include <string.h>
+#include "parse.h"
+#include "global.h"
+#include "jit.h"
+#include "inline.h"
+#include "loop/loop.h"
+#include "types.h"
+#include "builtin.h"
+#include "tables.h"
+#include "native.h"
+#include "loader.h"
+#include "toolbox/memory.h"
+#include "toolbox/loging.h"
+
+
+/* data about the currently parsed method */
 
-#define code_get_u1(p)  jcode[p]
-#define code_get_s1(p)  ((s1)jcode[p])
-#define code_get_u2(p)  ((((u2)jcode[p])<<8)+jcode[p+1])
-#define code_get_s2(p)  ((s2)((((u2)jcode[p])<<8)+jcode[p+1]))
-#define code_get_u4(p)  ((((u4)jcode[p])<<24)+(((u4)jcode[p+1])<<16)\
-                           +(((u4)jcode[p+2])<<8)+jcode[p+3])
-#define code_get_s4(p)  ((s4)((((u4)jcode[p])<<24)+(((u4)jcode[p+1])<<16)\
-                           +(((u4)jcode[p+2])<<8)+jcode[p+3]))
+classinfo  *rt_class;    /* class the compiled method belongs to       */
+methodinfo *rt_method;   /* pointer to method info of compiled method  */
+utf *rt_descriptor;      /* type descriptor of compiled method         */
+int rt_jcodelength;      /*length of JavaVM-codes                      */
+u1  *rt_jcode;           /* pointer to start of JavaVM-code            */
 
 
 
 /*INLINING*/
-#include "inline.c"
+//#include "inline.c"
 /*#define debug_writebranch printf("op: %s i: %d label_index[i]: %d\n",icmd_names[opcode], i, label_index[i]);*/
 #define debug_writebranch
 
+
+
 /* functionc compiler_addinitclass *********************************************
 
        add class into the list of classes to initialize
 
 *******************************************************************************/
                                 
-static void compiler_addinitclass (classinfo *c)
+void compiler_addinitclass(classinfo *c)
 {
        classinfo *cl;
 
@@ -73,24 +91,25 @@ static void compiler_addinitclass (classinfo *c)
                                sprintf(logtext, "compiler_addinitclass: ");
                                utf_sprint(logtext+strlen(logtext), c->name);
                                dolog();
-                               }
+                       }
                        chain_addlast(uninitializedclasses, c);
                        return;
-                       }
+               }
                if (c < cl) {
                        if (runverbose) {
                                sprintf(logtext, "compiler_addinitclass: ");
                                utf_sprint(logtext+strlen(logtext), c->name);
                                dolog();
-                               }
+                       }
                        chain_addbefore(uninitializedclasses, c);
                        return;
-                       }
-               cl = chain_next(uninitializedclasses);
                }
+               cl = chain_next(uninitializedclasses);
+       }
 }                       
 
 
+
 /* function descriptor2typesL ***************************************************
 
        decodes a already checked method descriptor. The parameter count, the
@@ -99,9 +118,9 @@ static void compiler_addinitclass (classinfo *c)
 
 *******************************************************************************/               
 
-classSetNode * descriptor2typesL (methodinfo *m)
+classSetNode *descriptor2typesL(methodinfo *m)
 {
-int debugInfo = 0;
+       int debugInfo = 0;
        int i;
        u1 *types, *tptr;
        int pcount, c;
@@ -110,10 +129,10 @@ int debugInfo = 0;
        char *class; 
        char *desc;
        classSetNode *p=NULL;
-if (debugInfo >= 1) {
-       printf("In descriptor2typesL >>>\t"); fflush(stdout);
-       utf_display(m->class->name); printf(".");
-       method_display(m);fflush(stdout);
+       if (debugInfo >= 1) {
+               printf("In descriptor2typesL >>>\t"); fflush(stdout);
+               utf_display(m->class->name); printf(".");
+               method_display(m);fflush(stdout);
        }
 
        pcount = 0;
@@ -126,11 +145,11 @@ if (debugInfo >= 1) {
                *tptr++ = TYPE_ADR;
                if (debugInfo >= 1) {
                        printf("param #0 (this?) method class =");utf_display(m->class->name);printf("\n");
-                       }
+               }
                classtypes[pcount] = m->class;
                p = addClassCone(p,  m->class);
                pcount++;
-               }
+       }
 
        utf_ptr = m->descriptor->text + 1;
        strcpy (desc,utf_ptr);
@@ -138,123 +157,125 @@ if (debugInfo >= 1) {
        while ((c = *desc++) != ')') {
                pcount++;
                switch (c) {
-                       case 'B':
-                       case 'C':
-                       case 'I':
-                       case 'S':
-                       case 'Z':  *tptr++ = TYPE_INT;
-                                  break;
-                       case 'J':  *tptr++ = TYPE_LNG;
-                                  break;
-                       case 'F':  *tptr++ = TYPE_FLT;
-                                  break;
-                       case 'D':  *tptr++ = TYPE_DBL;
-                                  break;
-                       case 'L':  *tptr++ = TYPE_ADR;
-                                   /* get class string */
-                                   class = strtok(desc,";");
-                                  desc = strtok(NULL,"\0");
-                                   /* get/save classinfo ptr */
-                                  classtypes[pcount-1] = class_get(utf_new_char(class));
-                                  p = addClassCone(p,  class_get(utf_new_char(class)));
-                                       if (debugInfo >= 1) {
-                                               printf("LParam#%i 's class type is: %s\n",pcount-1,class);fflush(stdout);
-                                               printf("Lclasstypes[%i]=",pcount-1);fflush(stdout);
-                                               utf_display(classtypes[pcount-1]->name);
-                                               }
-                                  break;
-                       case '[':  *tptr++ = TYPE_ADR;
-                                  while (c == '[')
-                                      c = *desc++;
-                                   /* get class string */
-                                  if (c == 'L') {
-                                       class = strtok(desc,";");
-                                       desc = strtok(NULL,"\0");
-                                       /* get/save classinfo ptr */
-                                       classtypes[pcount-1] = class_get(utf_new_char(class));
-                                       p= addClassCone(p,  class_get(utf_new_char(class)));
-                                       if (debugInfo >= 1) {
-                                               printf("[Param#%i 's class type is: %s\n",pcount-1,class);
-                                               printf("[classtypes[%i]=",pcount-1);fflush(stdout);
-                                               utf_display(classtypes[pcount-1]->name);
-                                               printf("\n");
-                                               }
-                                       }
-                                  else
-                                       classtypes[pcount-1] = NULL;
-                                  break;
-                       default:   
-                               panic("Ill formed methodtype-descriptor");
+               case 'B':
+               case 'C':
+               case 'I':
+               case 'S':
+               case 'Z':  *tptr++ = TYPE_INT;
+                       break;
+               case 'J':  *tptr++ = TYPE_LNG;
+                       break;
+               case 'F':  *tptr++ = TYPE_FLT;
+                       break;
+               case 'D':  *tptr++ = TYPE_DBL;
+                       break;
+               case 'L':  *tptr++ = TYPE_ADR;
+                       /* get class string */
+                       class = strtok(desc,";");
+                       desc = strtok(NULL,"\0");
+                       /* get/save classinfo ptr */
+                       classtypes[pcount-1] = class_get(utf_new_char(class));
+                       p = addClassCone(p,  class_get(utf_new_char(class)));
+                       if (debugInfo >= 1) {
+                               printf("LParam#%i 's class type is: %s\n",pcount-1,class);fflush(stdout);
+                               printf("Lclasstypes[%i]=",pcount-1);fflush(stdout);
+                               utf_display(classtypes[pcount-1]->name);
+                       }
+                       break;
+               case '[':  *tptr++ = TYPE_ADR;
+                       while (c == '[')
+                               c = *desc++;
+                       /* get class string */
+                       if (c == 'L') {
+                               class = strtok(desc,";");
+                               desc = strtok(NULL,"\0");
+                               /* get/save classinfo ptr */
+                               classtypes[pcount-1] = class_get(utf_new_char(class));
+                               p= addClassCone(p,  class_get(utf_new_char(class)));
+                               if (debugInfo >= 1) {
+                                       printf("[Param#%i 's class type is: %s\n",pcount-1,class);
+                                       printf("[classtypes[%i]=",pcount-1);fflush(stdout);
+                                       utf_display(classtypes[pcount-1]->name);
+                                       printf("\n");
+                               }
                        }
+                       else
+                               classtypes[pcount-1] = NULL;
+                       break;
+               default:   
+                       panic("Ill formed methodtype-descriptor");
                }
+       }
 
        /* compute return type */
        switch (*desc++) {
-               case 'B':
-               case 'C':
-               case 'I':
-               case 'S':
-               case 'Z':  m->returntype = TYPE_INT;
-                          break;
-               case 'J':  m->returntype = TYPE_LNG;
-                          break;
-               case 'F':  m->returntype = TYPE_FLT;
-                          break;
-               case 'D':  m->returntype = TYPE_DBL;
-                          break;
-               case '[':
-                          m->returntype = TYPE_ADR;
-                          c = *desc;
-                          while (c == '[')
-                              c = *desc++;
-                          if (c != 'L') break;
-                          *(desc++);
+       case 'B':
+       case 'C':
+       case 'I':
+       case 'S':
+       case 'Z':  m->returntype = TYPE_INT;
+               break;
+       case 'J':  m->returntype = TYPE_LNG;
+               break;
+       case 'F':  m->returntype = TYPE_FLT;
+               break;
+       case 'D':  m->returntype = TYPE_DBL;
+               break;
+       case '[':
+               m->returntype = TYPE_ADR;
+               c = *desc;
+               while (c == '[')
+                       c = *desc++;
+               if (c != 'L') break;
+               *(desc++);
                           
-               case 'L':  
-                          m->returntype = TYPE_ADR;
+       case 'L':  
+               m->returntype = TYPE_ADR;
                          
-                            /* get class string */
-                           class = strtok(desc,";");
-                           m->returnclass = class_get(utf_new_char(class));
-                           if (m->returnclass == NULL) {
-                               printf("class=%s :\t",class);
-                               panic ("return class not found");
-                               }
-                          break;
-               case 'V':  m->returntype = TYPE_VOID;
-                          break;
+               /* get class string */
+               class = strtok(desc,";");
+               m->returnclass = class_get(utf_new_char(class));
+               if (m->returnclass == NULL) {
+                       printf("class=%s :\t",class);
+                       panic ("return class not found");
+               }
+               break;
+       case 'V':  m->returntype = TYPE_VOID;
+               break;
 
        default:   panic("Ill formed methodtype-descriptor-ReturnType");
-               }
+       }
 
        m->paramcount = pcount;
        m->paramtypes = types;
        m->paramclass = classtypes;
 
-if (debugInfo >=1) {
-       if (pcount > 0) {
-               for (i=0; i< m->paramcount; i++) {
+       if (debugInfo >=1) {
+               if (pcount > 0) {
+                       for (i=0; i< m->paramcount; i++) {
                        if ((m->paramtypes[i] == TYPE_ADR) && (m->paramclass[i] != NULL)) {
-                             printf("Param #%i is:\t",i);
-                             utf_display(m->paramclass[i]->name);
-                             printf("\n");
-                             }
-                        }
-               }
-       if ((m->returntype == TYPE_ADR) && (m->returnclass != NULL)) { 
-                 printf("\tReturn Type is:\t"); fflush(stdout);
-                 utf_display(m->returnclass->name);
-                 printf("\n");
-                 }
-
-       printf("params2types: START  results in a set \n");
-       printf("param2types: A Set size=%i=\n",sizeOfSet(p));
-       printSet(p);
+                                       printf("Param #%i is:\t",i);
+                                       utf_display(m->paramclass[i]->name);
+                                       printf("\n");
+                               }
+                       }
+               }
+               if ((m->returntype == TYPE_ADR) && (m->returnclass != NULL)) { 
+                       printf("\tReturn Type is:\t"); fflush(stdout);
+                       utf_display(m->returnclass->name);
+                       printf("\n");
+               }
+
+               printf("params2types: START  results in a set \n");
+               printf("param2types: A Set size=%i=\n",sizeOfSet(p));
+               printSet(p);
        }
 
-return p;
+       return p;
 }
 
+
+
 /* function descriptor2types ***************************************************
 
        decodes a already checked method descriptor. The parameter count, the
@@ -262,79 +283,80 @@ return p;
 
 *******************************************************************************/               
 
-static void descriptor2types (methodinfo *m)
+void descriptor2types(methodinfo *m)
 {
        u1 *types, *tptr;
        int pcount, c;
        char *utf_ptr;
        pcount = 0;
-       types = DMNEW (u1, m->descriptor->blength); 
+       types = DMNEW(u1, m->descriptor->blength); 
        
        tptr = types;
        if (!(m->flags & ACC_STATIC)) {
                *tptr++ = TYPE_ADR;
                pcount++;
-               }
+       }
 
        utf_ptr = m->descriptor->text + 1;
    
        while ((c = *utf_ptr++) != ')') {
                pcount++;
                switch (c) {
-                       case 'B':
-                       case 'C':
-                       case 'I':
-                       case 'S':
-                       case 'Z':  *tptr++ = TYPE_INT;
-                                  break;
-                       case 'J':  *tptr++ = TYPE_LNG;
-                                  break;
-                       case 'F':  *tptr++ = TYPE_FLT;
-                                  break;
-                       case 'D':  *tptr++ = TYPE_DBL;
-                                  break;
-                       case 'L':  *tptr++ = TYPE_ADR;
-                                  while (*utf_ptr++ != ';');
-                                  break;
-                       case '[':  *tptr++ = TYPE_ADR;
-                                  while (c == '[')
-                                      c = *utf_ptr++;
-                                  if (c == 'L')
-                                      while (*utf_ptr++ != ';') /* skip */;
-                                  break;
-                       default:   panic ("Ill formed methodtype-descriptor");
-                       }
-               }
-
-       /* compute return type */
-
-       switch (*utf_ptr++) {
                case 'B':
                case 'C':
                case 'I':
                case 'S':
-               case 'Z':  m->returntype = TYPE_INT;
-                          break;
-               case 'J':  m->returntype = TYPE_LNG;
-                          break;
-               case 'F':  m->returntype = TYPE_FLT;
-                          break;
-               case 'D':  m->returntype = TYPE_DBL;
-                          break;
-               case '[':
-               case 'L':  m->returntype = TYPE_ADR;
-                          break;
-               case 'V':  m->returntype = TYPE_VOID;
-                          break;
-
+               case 'Z':  *tptr++ = TYPE_INT;
+                       break;
+               case 'J':  *tptr++ = TYPE_LNG;
+                       break;
+               case 'F':  *tptr++ = TYPE_FLT;
+                       break;
+               case 'D':  *tptr++ = TYPE_DBL;
+                       break;
+               case 'L':  *tptr++ = TYPE_ADR;
+                       while (*utf_ptr++ != ';');
+                       break;
+               case '[':  *tptr++ = TYPE_ADR;
+                       while (c == '[')
+                               c = *utf_ptr++;
+                       if (c == 'L')
+                               while (*utf_ptr++ != ';') /* skip */;
+                       break;
                default:   panic ("Ill formed methodtype-descriptor");
                }
+       }
+
+       /* compute return type */
+
+       switch (*utf_ptr++) {
+       case 'B':
+       case 'C':
+       case 'I':
+       case 'S':
+       case 'Z':  m->returntype = TYPE_INT;
+               break;
+       case 'J':  m->returntype = TYPE_LNG;
+               break;
+       case 'F':  m->returntype = TYPE_FLT;
+               break;
+       case 'D':  m->returntype = TYPE_DBL;
+               break;
+       case '[':
+       case 'L':  m->returntype = TYPE_ADR;
+               break;
+       case 'V':  m->returntype = TYPE_VOID;
+               break;
+
+       default:   panic ("Ill formed methodtype-descriptor");
+       }
 
        m->paramcount = pcount;
        m->paramtypes = types;
 }
 
 
+
 /*******************************************************************************
 
        function 'parse' scans the JavaVM code and generates intermediate code
@@ -369,15 +391,34 @@ static void descriptor2types (methodinfo *m)
 
 /* block generating and checking macros */
 
-#define block_insert(i)    {if(!(block_index[i]&1))\
-                               {b_count++;block_index[i] |= 1;}}
-#define bound_check(i)     {if((i< 0) || (i>=cumjcodelength)) \
-                               panic("branch target out of code-boundary");}
-#define bound_check1(i)    {if((i< 0) || (i>cumjcodelength)) \
-                               panic("branch target out of code-boundary");}
+#define block_insert(i) \
+    do { \
+        if (!(block_index[(i)] & 1)) { \
+            b_count++; \
+            block_index[(i)] |= 1; \
+        } \
+    } while (0)
+
+
 /* FIXME really use cumjcodelength for the bound_checkers ? */
 
-static xtable* fillextable (xtable* extable, exceptiontable *raw_extable, int exceptiontablelength, int *label_index, int *block_count)
+#define bound_check(i) \
+    do { \
+        if (i < 0 || i >= cumjcodelength) { \
+            panic("branch target out of code-boundary"); \
+        } \
+    } while (0)
+
+#define bound_check1(i) \
+    do { \
+        if (i < 0 || i > cumjcodelength) { \
+            panic("branch target out of code-boundary"); \
+        } \
+    } while (0)
+
+
+
+static xtable* fillextable(xtable* extable, exceptiontable *raw_extable, int exceptiontablelength, int *label_index, int *block_count)
 {
        int b_count, i, p;
        
@@ -415,7 +456,9 @@ static xtable* fillextable (xtable* extable, exceptiontable *raw_extable, int ex
        return &extable[i];  /* return the next free xtable* */
 }
 
-static void parse()
+
+
+void parse()
 {
        int  p;                     /* java instruction counter                   */
        int  nextp;                 /* start of next java instruction             */
@@ -428,8 +471,9 @@ static void parse()
        bool iswide = false;        /* true if last instruction was a wide        */
        instruction *iptr;          /* current pointer into instruction array     */
        int gp;                     /* global java instruction counter            */
-                                   /* inlining info for current method           */
-       inlining_methodinfo *inlinfo = inlining_rootinfo, *tmpinlinf; 
+                                   /* inlining info for current method           */
+       inlining_methodinfo *inlinfo = inlining_rootinfo;
+       inlining_methodinfo *tmpinlinf;
        int nextgp = -1;            /* start of next method to be inlined         */
        int *label_index = NULL;    /* label redirection table                    */
        int firstlocal = 0;         /* first local variable of method             */
@@ -437,35 +481,40 @@ static void parse()
 
        bool useinltmp;
 
-/*INLINING*/
-       if (useinlining)
-               {
-                       label_index = inlinfo->label_index;
-                       maxstack = cummaxstack;
-                       exceptiontablelength=cumextablelength;
-               }
+       /* INLINING */
+       if (useinlining) {
+               label_index = inlinfo->label_index;
+               maxstack = cummaxstack;
+               exceptiontablelength = cumextablelength;
+       }
        
-       useinltmp = useinlining; /*FIXME remove this after debugging */
+       useinltmp = useinlining; /* FIXME remove this after debugging */
     /*useinlining = false;*/    /* and merge the if-statements  */
        
        if (!useinlining) {
-         cumjcodelength = jcodelength;
+               cumjcodelength = jcodelength;
+
        } else {
-         tmpinlinf = (inlining_methodinfo*) list_first(inlinfo->inlinedmethods);
-         if (tmpinlinf != NULL) nextgp = tmpinlinf->startgp;
+               tmpinlinf = (inlining_methodinfo*) list_first(inlinfo->inlinedmethods);
+               if (tmpinlinf != NULL) nextgp = tmpinlinf->startgp;
        }
 
-                /*RTAprint*/ if  ( ((opt_rt) ||(opt_xta) || (opt_vta)) && ((pOpcodes == 2) || (pOpcodes == 3)) )
-                /*RTAprint*/    {printf("PARSE method name =");
-                /*RTAprint*/    utf_display(method->class->name);printf(".");
-                /*RTAprint*/    method_display(method); printf(">\n\n");fflush(stdout);}
-       if ((opt_rt) || (opt_xta)) { 
-            RT_jit_parse(method);
-           }
-       else    {
+       if ((opt_rt || opt_xta || opt_vta) && (pOpcodes == 2 || pOpcodes == 3)) {
+               printf("PARSE method name =");
+               utf_display(method->class->name);
+               printf(".");
+               method_display(method);
+               printf(">\n\n");
+               fflush(stdout);
+       }
+
+       if (opt_rt || opt_xta) { 
+               RT_jit_parse(method);
+
+       } else {
                if (opt_vta) 
                        printf("VTA requested, but not yet implemented\n");
-               }
+       }
         
 
        /* allocate instruction array and block index table */
@@ -477,18 +526,18 @@ static void parse()
        /* 1 additional for TRACEBUILTIN and 4 for MONITORENTER/EXIT */
        /* additional MONITOREXITS are reached by branches which are 3 bytes */
        
-       iptr = instr = DMNEW(instruction, cumjcodelength + 5); 
+       iptr = instr = DMNEW(instruction, cumjcodelength + 5);
        
        /* initialize block_index table (unrolled four times) */
 
        {
-       int *ip;
+               int *ip;
        
-       for (i = 0, ip = block_index; i <= cumjcodelength; i += 4, ip += 4) {
-               ip[0] = 0;
-               ip[1] = 0;
-               ip[2] = 0;
-               ip[3] = 0;
+               for (i = 0, ip = block_index; i <= cumjcodelength; i += 4, ip += 4) {
+                       ip[0] = 0;
+                       ip[1] = 0;
+                       ip[2] = 0;
+                       ip[3] = 0;
                }
        }
 
@@ -496,28 +545,28 @@ static void parse()
 
        extable = DMNEW(xtable, exceptiontablelength + 1);
        /*
-       for (i = 0; i < method->exceptiontablelength; i++) {
+         for (i = 0; i < method->exceptiontablelength; i++) {
 
-               p = extable[i].startpc = raw_extable[i].startpc;
-               if (useinlining) p = label_index[p];
-               bound_check(p);
-               block_insert(p);
+         p = extable[i].startpc = raw_extable[i].startpc;
+         if (useinlining) p = label_index[p];
+         bound_check(p);
+         block_insert(p);
 
-               p = extable[i].endpc = raw_extable[i].endpc;
-               if (useinlining) p = label_index[p];
-               bound_check1(p);
-               if (p < cumjcodelength)
-                       block_insert(p);
+         p = extable[i].endpc = raw_extable[i].endpc;
+         if (useinlining) p = label_index[p];
+         bound_check1(p);
+         if (p < cumjcodelength)
+         block_insert(p);
 
-               p = extable[i].handlerpc = raw_extable[i].handlerpc;
-               bound_check(p);
-               block_insert(p);
+         p = extable[i].handlerpc = raw_extable[i].handlerpc;
+         bound_check(p);
+         block_insert(p);
 
-               extable[i].catchtype  = raw_extable[i].catchtype;
+         extable[i].catchtype  = raw_extable[i].catchtype;
 
-               extable[i].next = NULL;
-               extable[i].down = &extable[i+1];
-               }
+         extable[i].next = NULL;
+         extable[i].down = &extable[i+1];
+         }
        */
 
        nextex = fillextable(extable, raw_extable, method->exceptiontablelength, label_index, &b_count);
@@ -527,444 +576,446 @@ static void parse()
 #ifdef USE_THREADS
        if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
                isleafmethod=false;
-               }                       
+       }                       
 #endif
 
        /* scan all java instructions */
 
        for (p = 0, gp = 0; p < jcodelength; gp += (nextp - p), p = nextp) {
          
-         /* DEBUG        printf("p:%d gp:%d ",p,gp); */
+               /* DEBUG          printf("p:%d gp:%d ",p,gp); */
+
+               /*INLINING*/
+               if ((useinlining) && (gp == nextgp)) {
+                       u1 *tptr;
+                       bool *readonly = NULL;
+
+                       opcode = code_get_u1 (p);
+                       nextp = p += jcommandsize[opcode];
+                       tmpinlinf = list_first(inlinfo->inlinedmethods);
+                       firstlocal = tmpinlinf->firstlocal;
+                       label_index = tmpinlinf->label_index;
+                       readonly = tmpinlinf->readonly;
+                       for (i=0, tptr=tmpinlinf->method->paramtypes + tmpinlinf->method->paramcount - 1 ; i<tmpinlinf->method->paramcount; i++, tptr--) {
+                               int op;
+
+                               if ( (i==0) && inlineparamopt) {
+                                       OP1(ICMD_CLEAR_ARGREN, firstlocal);
+                               }
 
-/*INLINING*/
-         if ((useinlining) && (gp == nextgp)) {
-                 u1 *tptr;
-                 bool *readonly = NULL;
-
-                 opcode = code_get_u1 (p);
-                 nextp = p += jcommandsize[opcode];
-                 tmpinlinf = list_first(inlinfo->inlinedmethods);
-                 firstlocal = tmpinlinf->firstlocal;
-                 label_index = tmpinlinf->label_index;
-                 readonly = tmpinlinf->readonly;
-                 for (i=0, tptr=tmpinlinf->method->paramtypes + tmpinlinf->method->paramcount - 1 ; i<tmpinlinf->method->paramcount; i++, tptr--)
-                         {
-                                 int op;
-
-                                 if ( (i==0) && inlineparamopt) {
-                                         OP1(ICMD_CLEAR_ARGREN, firstlocal);
-                                 }
-
-                                 if ( !inlineparamopt || !readonly[i] )
-                                         op = ICMD_ISTORE;
-                                 else op = ICMD_READONLY_ARG;   
-
-                                 op += *tptr;
-                                 OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i);
-
-                                 /* block_index[gp] |= (ipc << 1);*/  /*FIXME: necessary ? */
-                         }
-                 inlining_save_compiler_variables();
-                 inlining_set_compiler_variables(tmpinlinf);
-                 if (inlinfo->inlinedmethods == NULL) gp = -1;
-                 else {
-                         tmpinlinf = list_first(inlinfo->inlinedmethods);
-                         nextgp = (tmpinlinf != NULL) ? tmpinlinf->startgp : -1;
-                 }
-                 if (method->exceptiontablelength > 0) 
-                         nextex = fillextable(nextex, method->exceptiontable, method->exceptiontablelength, label_index, &b_count);
-                 continue;
-         }
+                               if ( !inlineparamopt || !readonly[i] )
+                                       op = ICMD_ISTORE;
+                               else op = ICMD_READONLY_ARG;   
+
+                               op += *tptr;
+                               OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i);
+
+                               /* block_index[gp] |= (ipc << 1);*/  /*FIXME: necessary ? */
+                       }
+
+                       inlining_save_compiler_variables();
+                       inlining_set_compiler_variables(tmpinlinf);
+
+                       if (inlinfo->inlinedmethods == NULL) {
+                               gp = -1;
+                       } else {
+                               tmpinlinf = list_first(inlinfo->inlinedmethods);
+                               nextgp = (tmpinlinf != NULL) ? tmpinlinf->startgp : -1;
+                       }
+                       if (method->exceptiontablelength > 0) 
+                               nextex = fillextable(nextex, method->exceptiontable, method->exceptiontablelength, label_index, &b_count);
+                       continue;
+               }
          
-         opcode = code_get_u1 (p);           /* fetch op code                  */
+               opcode = code_get_u1(p);            /* fetch op code                  */
 
          
-         /*RTAprint*/ if  ((opt_rt) && ((pOpcodes == 2) || (pOpcodes == 3)) )
-         /*RTAprint*/    {printf("Parse<%i> p=%i<%i<   opcode=<%i> %s\n",
-         /*RTAprint*/            pOpcodes, p,rt_jcodelength,opcode,icmd_names[opcode]);}
+               if (opt_rt && (pOpcodes == 2) || (pOpcodes == 3)) {
+                       printf("Parse<%i> p=%i<%i<   opcode=<%i> %s\n",
+                                  pOpcodes, p, rt_jcodelength, opcode, icmd_names[opcode]);
+               }
          
-         block_index[gp] |= (ipc << 1);       /* store intermediate count       */
+               block_index[gp] |= (ipc << 1);      /* store intermediate count       */
 
-         if (blockend) {
-                 block_insert(gp);                /* start new block                */
-                 blockend = false;
-         }
+               if (blockend) {
+                       block_insert(gp);               /* start new block                */
+                       blockend = false;
+               }
 
                nextp = p + jcommandsize[opcode];   /* compute next instruction start */
                s_count += stackreq[opcode];            /* compute stack element count    */
 
                switch (opcode) {
-
-                       case JAVA_NOP:
-                               break;
+               case JAVA_NOP:
+                       break;
 
                        /* pushing constants onto the stack p */
 
-                       case JAVA_BIPUSH:
-                               LOADCONST_I(code_get_s1(p+1));
-                               break;
+               case JAVA_BIPUSH:
+                       LOADCONST_I(code_get_s1(p+1));
+                       break;
 
-                       case JAVA_SIPUSH:
-                               LOADCONST_I(code_get_s2(p+1));
-                               break;
+               case JAVA_SIPUSH:
+                       LOADCONST_I(code_get_s2(p+1));
+                       break;
 
-                       case JAVA_LDC1:
-                               i = code_get_u1(p+1);
-                               goto pushconstantitem;
-                       case JAVA_LDC2:
-                       case JAVA_LDC2W:
-                               i = code_get_u2(p + 1);
-
-                       pushconstantitem:
-
-                               if (i >= class->cpcount) 
-                                       panic ("Attempt to access constant outside range");
-
-                               switch (class->cptags[i]) {
-                                       case CONSTANT_Integer:
-                                               LOADCONST_I(((constant_integer*)
-                                                            (class->cpinfos[i]))->value);
-                                               break;
-                                       case CONSTANT_Long:
-                                               LOADCONST_L(((constant_long*)
-                                                            (class->cpinfos[i]))->value);
-                                               break;
-                                       case CONSTANT_Float:
-                                               LOADCONST_F(((constant_float*)
-                                                            (class->cpinfos[i]))->value);
-                                               break;
-                                       case CONSTANT_Double:
-                                               LOADCONST_D(((constant_double*)
-                                                            (class->cpinfos[i]))->value);
-                                               break;
-                                       case CONSTANT_String:
-                                               LOADCONST_A(literalstring_new((utf*)
-                                                                             (class->cpinfos[i])));
-                                               break;
-                                       default: panic("Invalid constant type to push");
-                                       }
-                               break;
-
-                       case JAVA_ACONST_NULL:
-                               LOADCONST_A(NULL);
-                               break;
-
-                       case JAVA_ICONST_M1:
-                       case JAVA_ICONST_0:
-                       case JAVA_ICONST_1:
-                       case JAVA_ICONST_2:
-                       case JAVA_ICONST_3:
-                       case JAVA_ICONST_4:
-                       case JAVA_ICONST_5:
-                               LOADCONST_I(opcode - JAVA_ICONST_0);
-                               break;
+               case JAVA_LDC1:
+                       i = code_get_u1(p+1);
+                       goto pushconstantitem;
+               case JAVA_LDC2:
+               case JAVA_LDC2W:
+                       i = code_get_u2(p + 1);
 
-                       case JAVA_LCONST_0:
-                       case JAVA_LCONST_1:
-                               LOADCONST_L(opcode - JAVA_LCONST_0);
-                               break;
+               pushconstantitem:
 
-                       case JAVA_FCONST_0:
-                       case JAVA_FCONST_1:
-                       case JAVA_FCONST_2:
-                               LOADCONST_F(opcode - JAVA_FCONST_0);
-                               break;
+                       if (i >= class->cpcount) 
+                               panic ("Attempt to access constant outside range");
 
-                       case JAVA_DCONST_0:
-                       case JAVA_DCONST_1:
-                               LOADCONST_D(opcode - JAVA_DCONST_0);
+                       switch (class->cptags[i]) {
+                       case CONSTANT_Integer:
+                               LOADCONST_I(((constant_integer*)
+                                                        (class->cpinfos[i]))->value);
                                break;
-
-                       /* loading variables onto the stack */
-
-                       case JAVA_ILOAD:
-                       case JAVA_LLOAD:
-                       case JAVA_FLOAD:
-                       case JAVA_DLOAD:
-                       case JAVA_ALOAD:
-                               if (!iswide)
-                                       i = code_get_u1(p+1);
-                               else {
-                                       i = code_get_u2(p+1);
-                                       nextp = p+3;
-                                       iswide = false;
-                                       }
-                               OP1(opcode, i + firstlocal);
+                       case CONSTANT_Long:
+                               LOADCONST_L(((constant_long*)
+                                                        (class->cpinfos[i]))->value);
                                break;
-
-                       case JAVA_ILOAD_0:
-                       case JAVA_ILOAD_1:
-                       case JAVA_ILOAD_2:
-                       case JAVA_ILOAD_3:
-                               OP1(ICMD_ILOAD, opcode - JAVA_ILOAD_0 + firstlocal);
+                       case CONSTANT_Float:
+                               LOADCONST_F(((constant_float*)
+                                                        (class->cpinfos[i]))->value);
                                break;
-
-                       case JAVA_LLOAD_0:
-                       case JAVA_LLOAD_1:
-                       case JAVA_LLOAD_2:
-                       case JAVA_LLOAD_3:
-                               OP1(ICMD_LLOAD, opcode - JAVA_LLOAD_0 + firstlocal);
+                       case CONSTANT_Double:
+                               LOADCONST_D(((constant_double*)
+                                                        (class->cpinfos[i]))->value);
                                break;
-
-                       case JAVA_FLOAD_0:
-                       case JAVA_FLOAD_1:
-                       case JAVA_FLOAD_2:
-                       case JAVA_FLOAD_3:
-                               OP1(ICMD_FLOAD, opcode - JAVA_FLOAD_0 + firstlocal);
+                       case CONSTANT_String:
+                               LOADCONST_A(literalstring_new((utf*)
+                                                                                         (class->cpinfos[i])));
                                break;
+                       default: panic("Invalid constant type to push");
+                       }
+                       break;
+
+               case JAVA_ACONST_NULL:
+                       LOADCONST_A(NULL);
+                       break;
+
+               case JAVA_ICONST_M1:
+               case JAVA_ICONST_0:
+               case JAVA_ICONST_1:
+               case JAVA_ICONST_2:
+               case JAVA_ICONST_3:
+               case JAVA_ICONST_4:
+               case JAVA_ICONST_5:
+                       LOADCONST_I(opcode - JAVA_ICONST_0);
+                       break;
+
+               case JAVA_LCONST_0:
+               case JAVA_LCONST_1:
+                       LOADCONST_L(opcode - JAVA_LCONST_0);
+                       break;
+
+               case JAVA_FCONST_0:
+               case JAVA_FCONST_1:
+               case JAVA_FCONST_2:
+                       LOADCONST_F(opcode - JAVA_FCONST_0);
+                       break;
+
+               case JAVA_DCONST_0:
+               case JAVA_DCONST_1:
+                       LOADCONST_D(opcode - JAVA_DCONST_0);
+                       break;
 
-                       case JAVA_DLOAD_0:
-                       case JAVA_DLOAD_1:
-                       case JAVA_DLOAD_2:
-                       case JAVA_DLOAD_3:
-                               OP1(ICMD_DLOAD, opcode - JAVA_DLOAD_0 + firstlocal);
-                               break;
+                       /* loading variables onto the stack */
 
-                       case JAVA_ALOAD_0:
-                       case JAVA_ALOAD_1:
-                       case JAVA_ALOAD_2:
-                       case JAVA_ALOAD_3:
-                               OP1(ICMD_ALOAD, opcode - JAVA_ALOAD_0 + firstlocal);
-                               break;
+               case JAVA_ILOAD:
+               case JAVA_LLOAD:
+               case JAVA_FLOAD:
+               case JAVA_DLOAD:
+               case JAVA_ALOAD:
+                       if (!iswide)
+                               i = code_get_u1(p+1);
+                       else {
+                               i = code_get_u2(p+1);
+                               nextp = p+3;
+                               iswide = false;
+                       }
+                       OP1(opcode, i + firstlocal);
+                       break;
+
+               case JAVA_ILOAD_0:
+               case JAVA_ILOAD_1:
+               case JAVA_ILOAD_2:
+               case JAVA_ILOAD_3:
+                       OP1(ICMD_ILOAD, opcode - JAVA_ILOAD_0 + firstlocal);
+                       break;
+
+               case JAVA_LLOAD_0:
+               case JAVA_LLOAD_1:
+               case JAVA_LLOAD_2:
+               case JAVA_LLOAD_3:
+                       OP1(ICMD_LLOAD, opcode - JAVA_LLOAD_0 + firstlocal);
+                       break;
+
+               case JAVA_FLOAD_0:
+               case JAVA_FLOAD_1:
+               case JAVA_FLOAD_2:
+               case JAVA_FLOAD_3:
+                       OP1(ICMD_FLOAD, opcode - JAVA_FLOAD_0 + firstlocal);
+                       break;
+
+               case JAVA_DLOAD_0:
+               case JAVA_DLOAD_1:
+               case JAVA_DLOAD_2:
+               case JAVA_DLOAD_3:
+                       OP1(ICMD_DLOAD, opcode - JAVA_DLOAD_0 + firstlocal);
+                       break;
+
+               case JAVA_ALOAD_0:
+               case JAVA_ALOAD_1:
+               case JAVA_ALOAD_2:
+               case JAVA_ALOAD_3:
+                       OP1(ICMD_ALOAD, opcode - JAVA_ALOAD_0 + firstlocal);
+                       break;
 
                        /* storing stack values into local variables */
 
-                       case JAVA_ISTORE:
-                       case JAVA_LSTORE:
-                       case JAVA_FSTORE:
-                       case JAVA_DSTORE:
-                       case JAVA_ASTORE:
-                               if (!iswide)
-                                       i = code_get_u1(p+1);
-                               else {
-                                       i = code_get_u2(p+1);
-                                       iswide=false;
-                                       nextp = p+3;
-                                       }
-                               OP1(opcode, i + firstlocal);
-                               break;
-
-                       case JAVA_ISTORE_0:
-                       case JAVA_ISTORE_1:
-                       case JAVA_ISTORE_2:
-                       case JAVA_ISTORE_3:
-                               OP1(ICMD_ISTORE, opcode - JAVA_ISTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_LSTORE_0:
-                       case JAVA_LSTORE_1:
-                       case JAVA_LSTORE_2:
-                       case JAVA_LSTORE_3:
-                               OP1(ICMD_LSTORE, opcode - JAVA_LSTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_FSTORE_0:
-                       case JAVA_FSTORE_1:
-                       case JAVA_FSTORE_2:
-                       case JAVA_FSTORE_3:
-                               OP1(ICMD_FSTORE, opcode - JAVA_FSTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_DSTORE_0:
-                       case JAVA_DSTORE_1:
-                       case JAVA_DSTORE_2:
-                       case JAVA_DSTORE_3:
-                               OP1(ICMD_DSTORE, opcode - JAVA_DSTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_ASTORE_0:
-                       case JAVA_ASTORE_1:
-                       case JAVA_ASTORE_2:
-                       case JAVA_ASTORE_3:
-                               OP1(ICMD_ASTORE, opcode - JAVA_ASTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_IINC:
-                               {
+               case JAVA_ISTORE:
+               case JAVA_LSTORE:
+               case JAVA_FSTORE:
+               case JAVA_DSTORE:
+               case JAVA_ASTORE:
+                       if (!iswide)
+                               i = code_get_u1(p+1);
+                       else {
+                               i = code_get_u2(p+1);
+                               iswide=false;
+                               nextp = p+3;
+                       }
+                       OP1(opcode, i + firstlocal);
+                       break;
+
+               case JAVA_ISTORE_0:
+               case JAVA_ISTORE_1:
+               case JAVA_ISTORE_2:
+               case JAVA_ISTORE_3:
+                       OP1(ICMD_ISTORE, opcode - JAVA_ISTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_LSTORE_0:
+               case JAVA_LSTORE_1:
+               case JAVA_LSTORE_2:
+               case JAVA_LSTORE_3:
+                       OP1(ICMD_LSTORE, opcode - JAVA_LSTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_FSTORE_0:
+               case JAVA_FSTORE_1:
+               case JAVA_FSTORE_2:
+               case JAVA_FSTORE_3:
+                       OP1(ICMD_FSTORE, opcode - JAVA_FSTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_DSTORE_0:
+               case JAVA_DSTORE_1:
+               case JAVA_DSTORE_2:
+               case JAVA_DSTORE_3:
+                       OP1(ICMD_DSTORE, opcode - JAVA_DSTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_ASTORE_0:
+               case JAVA_ASTORE_1:
+               case JAVA_ASTORE_2:
+               case JAVA_ASTORE_3:
+                       OP1(ICMD_ASTORE, opcode - JAVA_ASTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_IINC:
+                       {
                                int v;
                                
                                if (!iswide) {
                                        i = code_get_u1(p + 1);
                                        v = code_get_s1(p + 2);
-                                       }
-                               else {
+
+                               else {
                                        i = code_get_u2(p + 1);
                                        v = code_get_s2(p + 3);
                                        iswide = false;
-                                       nextp = p+5;
-                                       }
-                               OP2I(opcode, i + firstlocal, v);
+                                       nextp = p + 5;
                                }
-                               break;
+                               OP2I(opcode, i + firstlocal, v);
+                       }
+                       break;
 
                        /* wider index for loading, storing and incrementing */
 
-                       case JAVA_WIDE:
-                               iswide = true;
-                               nextp = p + 1;
-                               break;
+               case JAVA_WIDE:
+                       iswide = true;
+                       nextp = p + 1;
+                       break;
 
                        /* managing arrays ************************************************/
 
-                       case JAVA_NEWARRAY:
-                               OP2I(ICMD_CHECKASIZE, 0, 0);
-                               switch (code_get_s1(p+1)) {
-                                       case 4:
-                                               BUILTIN1((functionptr)builtin_newarray_boolean, TYPE_ADR);
-                                               break;
-                                       case 5:
-                                               BUILTIN1((functionptr)builtin_newarray_char, TYPE_ADR);
-                                               break;
-                                       case 6:
-                                               BUILTIN1((functionptr)builtin_newarray_float, TYPE_ADR);
-                                               break;
-                                       case 7:
-                                               BUILTIN1((functionptr)builtin_newarray_double, TYPE_ADR);
-                                               break;
-                                       case 8:
-                                               BUILTIN1((functionptr)builtin_newarray_byte, TYPE_ADR);
-                                               break;
-                                       case 9:
-                                               BUILTIN1((functionptr)builtin_newarray_short, TYPE_ADR);
-                                               break;
-                                       case 10:
-                                               BUILTIN1((functionptr)builtin_newarray_int, TYPE_ADR);
-                                               break;
-                                       case 11:
-                                               BUILTIN1((functionptr)builtin_newarray_long, TYPE_ADR);
-                                               break;
-                                       default: panic("Invalid array-type to create");
-                                       }
+               case JAVA_NEWARRAY:
+                       OP2I(ICMD_CHECKASIZE, 0, 0);
+                       switch (code_get_s1(p + 1)) {
+                       case 4:
+                               BUILTIN1((functionptr)builtin_newarray_boolean, TYPE_ADR);
+                               break;
+                       case 5:
+                               BUILTIN1((functionptr)builtin_newarray_char, TYPE_ADR);
+                               break;
+                       case 6:
+                               BUILTIN1((functionptr)builtin_newarray_float, TYPE_ADR);
+                               break;
+                       case 7:
+                               BUILTIN1((functionptr)builtin_newarray_double, TYPE_ADR);
+                               break;
+                       case 8:
+                               BUILTIN1((functionptr)builtin_newarray_byte, TYPE_ADR);
+                               break;
+                       case 9:
+                               BUILTIN1((functionptr)builtin_newarray_short, TYPE_ADR);
+                               break;
+                       case 10:
+                               BUILTIN1((functionptr)builtin_newarray_int, TYPE_ADR);
+                               break;
+                       case 11:
+                               BUILTIN1((functionptr)builtin_newarray_long, TYPE_ADR);
                                break;
+                       default: panic("Invalid array-type to create");
+                       }
+                       break;
 
-                       case JAVA_ANEWARRAY:
-                               OP2I(ICMD_CHECKASIZE, 0, 0);
-                               i = code_get_u2(p+1);
-                               /* array or class type ? */
-                               if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
-                                       s_count++;
-                                       LOADCONST_A(class_getconstant(class, i,
-                                                                     CONSTANT_Arraydescriptor));
+               case JAVA_ANEWARRAY:
+                       OP2I(ICMD_CHECKASIZE, 0, 0);
+                       i = code_get_u2(p+1);
+                       /* array or class type ? */
+                       if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
+                               s_count++;
+                               LOADCONST_A(class_getconstant(class, i,
+                                                                                         CONSTANT_Arraydescriptor));
 #if defined(__I386__)
-                                       BUILTIN2((functionptr) asm_builtin_newarray_array, TYPE_ADR);
+                               BUILTIN2((functionptr) asm_builtin_newarray_array, TYPE_ADR);
 #else
-                                       BUILTIN2((functionptr)builtin_newarray_array, TYPE_ADR);
+                               BUILTIN2((functionptr) builtin_newarray_array, TYPE_ADR);
 #endif
-                                       }
-                               else {
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
-                                       s_count++;
+                       }
+                       else {
+                               LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                               s_count++;
 #if defined(__I386__)
-                                       BUILTIN2((functionptr) asm_builtin_anewarray, TYPE_ADR);
+                               BUILTIN2((functionptr) asm_builtin_anewarray, TYPE_ADR);
 #else
-                                       BUILTIN2((functionptr)builtin_anewarray, TYPE_ADR);
+                               BUILTIN2((functionptr) builtin_anewarray, TYPE_ADR);
 #endif
-                                       }
-                               break;
+                       }
+                       break;
 
-                       case JAVA_MULTIANEWARRAY:
-                               isleafmethod=false;
-                               i = code_get_u2(p+1);
-                               {
-                               int v = code_get_u1(p+3);
+               case JAVA_MULTIANEWARRAY:
+                       isleafmethod=false;
+                       i = code_get_u2(p + 1);
+                       {
+                               int v = code_get_u1(p + 3);
                                constant_arraydescriptor *desc =
                                    class_getconstant (class, i, CONSTANT_Arraydescriptor);
                                OP2A(opcode, v, desc);
-                               }
-                               break;
-
-                       case JAVA_IFEQ:
-                       case JAVA_IFLT:
-                       case JAVA_IFLE:
-                       case JAVA_IFNE:
-                       case JAVA_IFGT:
-                       case JAVA_IFGE:
-                       case JAVA_IFNULL:
-                       case JAVA_IFNONNULL:
-                       case JAVA_IF_ICMPEQ:
-                       case JAVA_IF_ICMPNE:
-                       case JAVA_IF_ICMPLT:
-                       case JAVA_IF_ICMPGT:
-                       case JAVA_IF_ICMPLE:
-                       case JAVA_IF_ICMPGE:
-                       case JAVA_IF_ACMPEQ:
-                       case JAVA_IF_ACMPNE:
-                       case JAVA_GOTO:
-                       case JAVA_JSR:
-                               i = p + code_get_s2(p+1);
-                               if (useinlining) { 
-                                 debug_writebranch
-                                 i = label_index[i];
-                               }
-                               bound_check(i);
-                               block_insert(i);
-                               blockend = true;
-                               OP1(opcode, i);
-                               break;
-                       case JAVA_GOTO_W:
-                       case JAVA_JSR_W:
-                               i = p + code_get_s4(p+1);
-                               if (useinlining) { 
-                                 debug_writebranch
-                                 i = label_index[i];
-                               }
-                               bound_check(i);
-                               block_insert(i);
-                               blockend = true;
-                               OP1(opcode, i);
-                               break;
-
-                       case JAVA_RET:
-                               if (!iswide)
-                                       i = code_get_u1(p+1);
-                               else {
-                                       i = code_get_u2(p+1);
-                                       nextp = p+3;
-                                       iswide = false;
-                                       }
-                               blockend = true;
+                       }
+                       break;
+
+               case JAVA_IFEQ:
+               case JAVA_IFLT:
+               case JAVA_IFLE:
+               case JAVA_IFNE:
+               case JAVA_IFGT:
+               case JAVA_IFGE:
+               case JAVA_IFNULL:
+               case JAVA_IFNONNULL:
+               case JAVA_IF_ICMPEQ:
+               case JAVA_IF_ICMPNE:
+               case JAVA_IF_ICMPLT:
+               case JAVA_IF_ICMPGT:
+               case JAVA_IF_ICMPLE:
+               case JAVA_IF_ICMPGE:
+               case JAVA_IF_ACMPEQ:
+               case JAVA_IF_ACMPNE:
+               case JAVA_GOTO:
+               case JAVA_JSR:
+                       i = p + code_get_s2(p+1);
+                       if (useinlining) { 
+                               debug_writebranch
+                                       i = label_index[i];
+                       }
+                       bound_check(i);
+                       block_insert(i);
+                       blockend = true;
+                       OP1(opcode, i);
+                       break;
+               case JAVA_GOTO_W:
+               case JAVA_JSR_W:
+                       i = p + code_get_s4(p+1);
+                       if (useinlining) { 
+                               debug_writebranch
+                                       i = label_index[i];
+                       }
+                       bound_check(i);
+                       block_insert(i);
+                       blockend = true;
+                       OP1(opcode, i);
+                       break;
+
+               case JAVA_RET:
+                       if (!iswide)
+                               i = code_get_u1(p+1);
+                       else {
+                               i = code_get_u2(p+1);
+                               nextp = p+3;
+                               iswide = false;
+                       }
+                       blockend = true;
                                
-                               /*
-                               if (isinlinedmethod) {
-                                 OP1(ICMD_GOTO, inlinfo->stopgp);
-                                 break;
-                                 }*/
-
-                               OP1(opcode, i + firstlocal);
-                               break;
-
-                       case JAVA_IRETURN:
-                       case JAVA_LRETURN:
-                       case JAVA_FRETURN:
-                       case JAVA_DRETURN:
-                       case JAVA_ARETURN:
-                       case JAVA_RETURN:
-
-
-                               if (isinlinedmethod) {
-/*                                     if (p==jcodelength-1) {*/ /* return is at end of inlined method */
-/*                                             OP(ICMD_NOP); */
-/*                                             break; */
-/*                                     } */
-                                       blockend = true;
-                                       OP1(ICMD_GOTO, inlinfo->stopgp);
-                                       break;
-                               }
-
+                       /*
+                         if (isinlinedmethod) {
+                         OP1(ICMD_GOTO, inlinfo->stopgp);
+                         break;
+                         }*/
+
+                       OP1(opcode, i + firstlocal);
+                       break;
+
+               case JAVA_IRETURN:
+               case JAVA_LRETURN:
+               case JAVA_FRETURN:
+               case JAVA_DRETURN:
+               case JAVA_ARETURN:
+               case JAVA_RETURN:
+
+
+                       if (isinlinedmethod) {
+                               /*                                      if (p==jcodelength-1) {*/ /* return is at end of inlined method */
+                               /*                                              OP(ICMD_NOP); */
+                               /*                                              break; */
+                               /*                                      } */
                                blockend = true;
-                               OP(opcode);
+                               OP1(ICMD_GOTO, inlinfo->stopgp);
                                break;
+                       }
 
-                       case JAVA_ATHROW:
-                               blockend = true;
-                               OP(opcode);
-                               break;
+                       blockend = true;
+                       OP(opcode);
+                       break;
+
+               case JAVA_ATHROW:
+                       blockend = true;
+                       OP(opcode);
+                       break;
                                
 
                        /* table jumps ********************************/
 
-                       case JAVA_LOOKUPSWITCH:
-                               {
+               case JAVA_LOOKUPSWITCH:
+                       {
                                s4 num, j;
                                s4 *tablep;
 
@@ -1015,14 +1066,14 @@ static void parse()
                                        nextp += 4;
                                        bound_check(j);
                                        block_insert(j);
-                                       }
+                               }
 
                                break;
-                               }
+                       }
 
 
-                       case JAVA_TABLESWITCH:
-                               {
+               case JAVA_TABLESWITCH:
+                       {
                                s4 num, j;
                                s4 *tablep;
 
@@ -1072,92 +1123,94 @@ static void parse()
                                        nextp += 4;
                                        bound_check(j);
                                        block_insert(j);
-                                       }
+                               }
 
                                break;
-                               }
+                       }
 
 
                        /* load and store of object fields *******************/
 
-                       case JAVA_AASTORE:
-                               BUILTIN3((functionptr) asm_builtin_aastore, TYPE_VOID);
-                               break;
+               case JAVA_AASTORE:
+                       BUILTIN3((functionptr) asm_builtin_aastore, TYPE_VOID);
+                       break;
 
-                       case JAVA_PUTSTATIC:
-                       case JAVA_GETSTATIC:
-                               i = code_get_u2(p + 1);
-                               {
+               case JAVA_PUTSTATIC:
+               case JAVA_GETSTATIC:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *fr;
                                fieldinfo *fi;
                                fr = class_getconstant (class, i, CONSTANT_Fieldref);
                                fi = class_findfield (fr->class, fr->name, fr->descriptor);
                                compiler_addinitclass (fr->class);
                                OP2A(opcode, fi->type, fi);
-                               }
-                               break;
-                       case JAVA_PUTFIELD:
-                       case JAVA_GETFIELD:
-                               i = code_get_u2(p + 1);
-                               {
+                       }
+                       break;
+               case JAVA_PUTFIELD:
+               case JAVA_GETFIELD:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *fr;
                                fieldinfo *fi;
                                fr = class_getconstant (class, i, CONSTANT_Fieldref);
                                fi = class_findfield (fr->class, fr->name, fr->descriptor);
                                OP2A(opcode, fi->type, fi);
-                               }
-                               break;
+                       }
+                       break;
 
 
                        /* method invocation *****/
 
-                       case JAVA_INVOKESTATIC:
-                               i = code_get_u2(p + 1);
-                               {
+               case JAVA_INVOKESTATIC:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *mr;
                                methodinfo *mi;
                                
                                mr = class_getconstant (class, i, CONSTANT_Methodref);
                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-                                       /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
-                                        /*RTAprint*/    {printf(" method name =");
-                                        /*RTAprint*/    utf_display(mi->class->name); printf(".");
-                                        /*RTAprint*/    utf_display(mi->name);printf("\tINVOKE STATIC\n");
-                                        /*RTAprint*/    fflush(stdout);}
+                               /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
+                                       /*RTAprint*/    {printf(" method name =");
+                                       /*RTAprint*/    utf_display(mi->class->name); printf(".");
+                                       /*RTAprint*/    utf_display(mi->name);printf("\tINVOKE STATIC\n");
+                                       /*RTAprint*/    fflush(stdout);}
                                if (! (mi->flags & ACC_STATIC))
                                        panic ("Static/Nonstatic mismatch calling static method");
                                descriptor2types(mi);
 
                                isleafmethod=false;
                                OP2A(opcode, mi->paramcount, mi);
-                               }
-                               break;
-                       case JAVA_INVOKESPECIAL:
-                       case JAVA_INVOKEVIRTUAL:
-                               i = code_get_u2(p + 1);
-                               {
+                       }
+                       break;
+
+               case JAVA_INVOKESPECIAL:
+               case JAVA_INVOKEVIRTUAL:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *mr;
                                methodinfo *mi;
                                
                                mr = class_getconstant (class, i, CONSTANT_Methodref);
                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-                                       /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
-                                        /*RTAprint*/    {printf(" method name =");
-                                                       method_display(mi);
-                                        /*RTAprint*/    utf_display(mi->class->name); printf(".");
-                                        /*RTAprint*/    utf_display(mi->name);printf("\tINVOKE SPECIAL/VIRTUAL\n");
-                                        /*RTAprint*/    fflush(stdout);}
+                               /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
+                                       /*RTAprint*/    {printf(" method name =");
+                                       method_display(mi);
+                                       /*RTAprint*/    utf_display(mi->class->name); printf(".");
+                                       /*RTAprint*/    utf_display(mi->name);printf("\tINVOKE SPECIAL/VIRTUAL\n");
+                                       /*RTAprint*/    fflush(stdout);}
 
                                if (mi->flags & ACC_STATIC)
                                        panic ("Static/Nonstatic mismatch calling static method");
                                descriptor2types(mi);
                                isleafmethod=false;
                                OP2A(opcode, mi->paramcount, mi);
-                               }
-                               break;
-                       case JAVA_INVOKEINTERFACE:
-                               i = code_get_u2(p + 1);
-                               {
+                       }
+                       break;
+
+               case JAVA_INVOKEINTERFACE:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *mr;
                                methodinfo *mi;
                                
@@ -1168,247 +1221,247 @@ static void parse()
                                descriptor2types(mi);
                                isleafmethod=false;
                                OP2A(opcode, mi->paramcount, mi);
-                               }
-                               break;
+                       }
+                       break;
 
                        /* miscellaneous object operations *******/
 
-                       case JAVA_NEW:
-                               i = code_get_u2 (p+1);
+               case JAVA_NEW:
+                       i = code_get_u2 (p+1);
 
-                               LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
-                               s_count++;
-                               BUILTIN1((functionptr) builtin_new, TYPE_ADR);
-                               break;
+                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                       s_count++;
+                       BUILTIN1((functionptr) builtin_new, TYPE_ADR);
+                       break;
 
-                       case JAVA_CHECKCAST:
-                               i = code_get_u2(p+1);
+               case JAVA_CHECKCAST:
+                       i = code_get_u2(p+1);
 
-                               /* array type cast-check */
-                               if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Arraydescriptor));
-                                       s_count++;
-                                       BUILTIN2((functionptr) asm_builtin_checkarraycast, TYPE_ADR);
-                                       }
-                               else { /* object type cast-check */
-                                       /*
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
-                                       s_count++;
-                                       BUILTIN2((functionptr) asm_builtin_checkcast, TYPE_ADR);
-                                       */
-                                       OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
-                                       }
-                               break;
+                       /* array type cast-check */
+                       if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
+                               LOADCONST_A(class_getconstant(class, i, CONSTANT_Arraydescriptor));
+                               s_count++;
+                               BUILTIN2((functionptr) asm_builtin_checkarraycast, TYPE_ADR);
+                       }
+                       else { /* object type cast-check */
+                               /*
+                                 LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                                 s_count++;
+                                 BUILTIN2((functionptr) asm_builtin_checkcast, TYPE_ADR);
+                               */
+                               OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
+                       }
+                       break;
 
-                       case JAVA_INSTANCEOF:
-                               i = code_get_u2(p+1);
+               case JAVA_INSTANCEOF:
+                       i = code_get_u2(p+1);
 
-                               /* array type cast-check */
-                               if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Arraydescriptor));
-                                       s_count++;
+                       /* array type cast-check */
+                       if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
+                               LOADCONST_A(class_getconstant(class, i, CONSTANT_Arraydescriptor));
+                               s_count++;
 #if defined(__I386__)
-                                       BUILTIN2((functionptr) asm_builtin_arrayinstanceof, TYPE_INT);
+                               BUILTIN2((functionptr) asm_builtin_arrayinstanceof, TYPE_INT);
 #else
-                                       BUILTIN2((functionptr) builtin_arrayinstanceof, TYPE_INT);
+                               BUILTIN2((functionptr) builtin_arrayinstanceof, TYPE_INT);
 #endif
-                                       }
-                               else { /* object type cast-check */
-                                       /*
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
-                                       s_count++;
-                                       BUILTIN2((functionptr) builtin_instanceof, TYPE_INT);
-                                       */
-                                       OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
-                                       }
-                               break;
+                       }
+                       else { /* object type cast-check */
+                               /*
+                                 LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                                 s_count++;
+                                 BUILTIN2((functionptr) builtin_instanceof, TYPE_INT);
+                               */
+                               OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
+                       }
+                       break;
 
-                       case JAVA_MONITORENTER:
+               case JAVA_MONITORENTER:
 #ifdef USE_THREADS
-                               if (checksync) {
-                                       BUILTIN1((functionptr) asm_builtin_monitorenter, TYPE_VOID);
-                               } else
+                       if (checksync) {
+                               BUILTIN1((functionptr) asm_builtin_monitorenter, TYPE_VOID);
+                       } else
 #endif
-                                       {
+                               {
                                        OP(ICMD_NULLCHECKPOP);
-                                       }
-                               break;
+                               }
+                       break;
 
-                       case JAVA_MONITOREXIT:
+               case JAVA_MONITOREXIT:
 #ifdef USE_THREADS
-                               if (checksync) {
-                                       BUILTIN1((functionptr) asm_builtin_monitorexit, TYPE_VOID);
-                                       }
-                               else
+                       if (checksync) {
+                               BUILTIN1((functionptr) asm_builtin_monitorexit, TYPE_VOID);
+                       }
+                       else
 #endif
-                                       {
+                               {
                                        OP(ICMD_POP);
-                                       }
-                               break;
+                               }
+                       break;
 
                        /* any other basic operation **************************************/
 
-                       case JAVA_IDIV:
-                               OP(opcode);
-                               break;
+               case JAVA_IDIV:
+                       OP(opcode);
+                       break;
 
-                       case JAVA_IREM:
-                               OP(opcode);
-                               break;
+               case JAVA_IREM:
+                       OP(opcode);
+                       break;
 
-                       case JAVA_LDIV:
-                               OP(opcode);
-                               break;
+               case JAVA_LDIV:
+                       OP(opcode);
+                       break;
 
-                       case JAVA_LREM:
-                               OP(opcode);
-                               break;
+               case JAVA_LREM:
+                       OP(opcode);
+                       break;
 
-                       case JAVA_FREM:
+               case JAVA_FREM:
 #if defined(__I386__)
-                               OP(opcode);
+                       OP(opcode);
 #else
-                               BUILTIN2((functionptr) builtin_frem, TYPE_FLOAT);
+                       BUILTIN2((functionptr) builtin_frem, TYPE_FLOAT);
 #endif
-                               break;
+                       break;
 
-                       case JAVA_DREM:
+               case JAVA_DREM:
 #if defined(__I386__)
-                               OP(opcode);
+                       OP(opcode);
 #else
-                               BUILTIN2((functionptr) builtin_drem, TYPE_DOUBLE);
+                       BUILTIN2((functionptr) builtin_drem, TYPE_DOUBLE);
 #endif
-                               break;
+                       break;
 
-                       case JAVA_F2I:
+               case JAVA_F2I:
 #if defined(__ALPHA__)
-                               if (!opt_noieee) {
-                                       BUILTIN1((functionptr) builtin_f2i, TYPE_INT);
-                               } else
+                       if (!opt_noieee) {
+                               BUILTIN1((functionptr) builtin_f2i, TYPE_INT);
+                       } else
 #endif
                                {
                                        OP(opcode);
                                }
-                               break;
+                       break;
 
-                       case JAVA_F2L:
+               case JAVA_F2L:
 #if defined(__ALPHA__)
-                               if (!opt_noieee) {
-                                       BUILTIN1((functionptr) builtin_f2l, TYPE_LONG);
-                               } else 
+                       if (!opt_noieee) {
+                               BUILTIN1((functionptr) builtin_f2l, TYPE_LONG);
+                       } else 
 #endif
                                {
                                        OP(opcode);
                                }
-                               break;
+                       break;
 
-                       case JAVA_D2I:
+               case JAVA_D2I:
 #if defined(__ALPHA__)
-                               if (!opt_noieee) {
-                                       BUILTIN1((functionptr) builtin_d2i, TYPE_INT);
-                               } else
+                       if (!opt_noieee) {
+                               BUILTIN1((functionptr) builtin_d2i, TYPE_INT);
+                       } else
 #endif
                                {
                                        OP(opcode);
                                }
-                               break;
+                       break;
 
-                       case JAVA_D2L:
+               case JAVA_D2L:
 #if defined(__ALPHA__)
-                               if (!opt_noieee) {
-                                       BUILTIN1((functionptr) builtin_d2l, TYPE_LONG);
-                               } else
+                       if (!opt_noieee) {
+                               BUILTIN1((functionptr) builtin_d2l, TYPE_LONG);
+                       } else
 #endif
                                {
                                        OP(opcode);
                                }
-                               break;
-
-                       case JAVA_BREAKPOINT:
-                               panic("Illegal opcode Breakpoint encountered");
-                               break;
-
-                       case 203:
-                       case 204:
-                       case 205:
-                       case 206:
-                       case 207:
-                       case 208:
-                       case 209:
-                       case 210:
-                       case 211:
-                       case 212:
-                       case 213:
-                       case 214:
-                       case 215:
-                       case 216:
-                       case 217:
-                       case 218:
-                       case 219:
-                       case 220:
-                       case 221:
-                       case 222:
-                       case 223:
-                       case 224:
-                       case 225:
-                       case 226:
-                       case 227:
-                       case 228:
-                       case 229:
-                       case 230:
-                       case 231:
-                       case 232:
-                       case 233:
-                       case 234:
-                       case 235:
-                       case 236:
-                       case 237:
-                       case 238:
-                       case 239:
-                       case 240:
-                       case 241:
-                       case 242:
-                       case 243:
-                       case 244:
-                       case 245:
-                       case 246:
-                       case 247:
-                       case 248:
-                       case 249:
-                       case 250:
-                       case 251:
-                       case 252:
-                       case 253:
-                       case 254:
-                       case 255:
-                               printf("Illegal opcode %d at instr %d", opcode, ipc);
-                               panic("encountered");
-                               break;
-
-                       default:
-                               OP(opcode);
-                               break;
+                       break;
+
+               case JAVA_BREAKPOINT:
+                       panic("Illegal opcode Breakpoint encountered");
+                       break;
+
+               case 203:
+               case 204:
+               case 205:
+               case 206:
+               case 207:
+               case 208:
+               case 209:
+               case 210:
+               case 211:
+               case 212:
+               case 213:
+               case 214:
+               case 215:
+               case 216:
+               case 217:
+               case 218:
+               case 219:
+               case 220:
+               case 221:
+               case 222:
+               case 223:
+               case 224:
+               case 225:
+               case 226:
+               case 227:
+               case 228:
+               case 229:
+               case 230:
+               case 231:
+               case 232:
+               case 233:
+               case 234:
+               case 235:
+               case 236:
+               case 237:
+               case 238:
+               case 239:
+               case 240:
+               case 241:
+               case 242:
+               case 243:
+               case 244:
+               case 245:
+               case 246:
+               case 247:
+               case 248:
+               case 249:
+               case 250:
+               case 251:
+               case 252:
+               case 253:
+               case 254:
+               case 255:
+                       printf("Illegal opcode %d at instr %d", opcode, ipc);
+                       panic("encountered");
+                       break;
+
+               default:
+                       OP(opcode);
+                       break;
                                
-                   } /* end switch */
+               } /* end switch */
                
                /* INLINING */
                  
-               if ((isinlinedmethod) && (p==jcodelength-1)) { /*end of an inlined method */
-                 /*              printf("setting gp from %d to %d\n",gp, inlinfo->stopgp); */
-                 gp = inlinfo->stopgp; 
-                 inlining_restore_compiler_variables();
-                 list_remove(inlinfo->inlinedmethods, list_first(inlinfo->inlinedmethods));
-                 if (inlinfo->inlinedmethods == NULL) nextgp = -1;
-                 else {
-                         tmpinlinf = list_first(inlinfo->inlinedmethods);
-                         nextgp = (tmpinlinf != NULL) ? tmpinlinf->startgp : -1;
-                 }
-                 /*              printf("nextpgp: %d\n", nextgp); */
-                 label_index=inlinfo->label_index;
-                 firstlocal = inlinfo->firstlocal;
+               if (isinlinedmethod && p == jcodelength - 1) { /* end of an inlined method */
+                       /*                printf("setting gp from %d to %d\n",gp, inlinfo->stopgp); */
+                       gp = inlinfo->stopgp; 
+                       inlining_restore_compiler_variables();
+                       list_remove(inlinfo->inlinedmethods, list_first(inlinfo->inlinedmethods));
+                       if (inlinfo->inlinedmethods == NULL) nextgp = -1;
+                       else {
+                               tmpinlinf = list_first(inlinfo->inlinedmethods);
+                               nextgp = (tmpinlinf != NULL) ? tmpinlinf->startgp : -1;
+                       }
+                       /*                printf("nextpgp: %d\n", nextgp); */
+                       label_index=inlinfo->label_index;
+                       firstlocal = inlinfo->firstlocal;
                }
+       } /* end for */
 
-               } /* end for */
        if (p != jcodelength)
                panic("Command-sequence crosses code-boundary");
 
@@ -1431,95 +1484,89 @@ static void parse()
        stack = DMNEW(stackelement, stack_count);
 
        {
-       basicblock  *bptr;
+               basicblock  *bptr;
 
-       bptr = block = DMNEW(basicblock, b_count + 1);    /* one more for end ipc */
+               bptr = block = DMNEW(basicblock, b_count + 1);    /* one more for end ipc */
 
-       b_count = 0;
-       c_debug_nr = 0;
+               b_count = 0;
+               c_debug_nr = 0;
        
-       /* additional block if target 0 is not first intermediate instruction     */
+               /* additional block if target 0 is not first intermediate instruction     */
+
+               if (!block_index[0] || (block_index[0] > 1)) {
+                       bptr->iinstr = instr;
+                       bptr->mpc = -1;
+                       bptr->flags = -1;
+                       bptr->type = BBTYPE_STD;
+                       bptr->branchrefs = NULL;
+                       bptr->pre_count = 0;
+                       bptr->debug_nr = c_debug_nr++;
+                       bptr++;
+                       b_count++;
+                       (bptr - 1)->next = bptr;
+               }
+
+               /* allocate blocks */
+
+               for (p = 0; p < cumjcodelength; p++) {
+                       if (block_index[p] & 1) {
+                               bptr->iinstr = instr + (block_index[p] >> 1);
+                               bptr->debug_nr = c_debug_nr++;
+                               if (b_count != 0)
+                                       (bptr - 1)->icount = bptr->iinstr - (bptr - 1)->iinstr;
+                               bptr->mpc = -1;
+                               bptr->flags = -1;
+                               bptr->lflags = 0;
+                               bptr->type = BBTYPE_STD;
+                               bptr->branchrefs = NULL;
+                               block_index[p] = b_count;
+                               bptr->pre_count = 0;
+                               bptr++;
+                               b_count++;
+                               (bptr - 1)->next = bptr;
+                       }
+               }
+
+               /* allocate additional block at end */
 
-       if (!block_index[0] || (block_index[0] > 1)) {
-               bptr->iinstr = instr;
+               bptr->instack = bptr->outstack = NULL;
+               bptr->indepth = bptr->outdepth = 0;
+               bptr->iinstr = NULL;
+               (bptr - 1)->icount = (instr + instr_count) - (bptr - 1)->iinstr;
+               bptr->icount = 0;
                bptr->mpc = -1;
                bptr->flags = -1;
+               bptr->lflags = 0;
                bptr->type = BBTYPE_STD;
                bptr->branchrefs = NULL;
                bptr->pre_count = 0;
                bptr->debug_nr = c_debug_nr++;
-               bptr++;
-               b_count++;
                (bptr - 1)->next = bptr;
-       
-               }
+               bptr->next = NULL;
 
-       /* allocate blocks */
+               last_block = bptr;
 
+               if (exceptiontablelength > 0)
+                       extable[exceptiontablelength - 1].down = NULL;
+               else
+                       extable = NULL;
 
-       for (p = 0; p < cumjcodelength; p++)
-               
-               if (block_index[p] & 1) {
-                       bptr->iinstr = instr + (block_index[p] >> 1);
-                       bptr->debug_nr = c_debug_nr++;
-                       if (b_count != 0)
-                               (bptr - 1)->icount = bptr->iinstr - (bptr - 1)->iinstr;
-                       bptr->mpc = -1;
-                       bptr->flags = -1;
-                       bptr->lflags = 0;
-                       bptr->type = BBTYPE_STD;
-                       bptr->branchrefs = NULL;
-                       block_index[p] = b_count;
-                       bptr->pre_count = 0;
-                       bptr++;
-                       b_count++;
+               for (i = 0; i < exceptiontablelength; ++i) {
+                       p = extable[i].startpc;
+                       extable[i].start = block + block_index[p];
 
-                       (bptr - 1)->next = bptr;
-                       }
-
-       /* allocate additional block at end */
+                       p = extable[i].endpc;
+                       extable[i].end = block + block_index[p]; 
 
-       
-       bptr->instack = bptr->outstack = NULL;
-       bptr->indepth = bptr->outdepth = 0;
-       bptr->iinstr = NULL;
-       (bptr - 1)->icount = (instr + instr_count) - (bptr - 1)->iinstr;
-       bptr->icount = 0;
-       bptr->mpc = -1;
-       bptr->flags = -1;
-       bptr->lflags = 0;
-       bptr->type = BBTYPE_STD;
-       bptr->branchrefs = NULL;
-       bptr->pre_count = 0;
-       bptr->debug_nr = c_debug_nr++;
-                       
-       (bptr - 1)->next = bptr;
-       bptr->next = NULL;
-
-       last_block = bptr;
-
-       if (exceptiontablelength > 0)
-               extable[exceptiontablelength-1].down = NULL;
-       else
-               extable = NULL;
-
-       for (i = 0; i < exceptiontablelength; ++i) {
-               p = extable[i].startpc;
-               extable[i].start = block + block_index[p];
-
-               p = extable[i].endpc;
-               extable[i].end = block + block_index[p]; 
-
-               p = extable[i].handlerpc;
-               extable[i].handler = block + block_index[p];
+                       p = extable[i].handlerpc;
+                       extable[i].handler = block + block_index[p];
            }
        }
        
        if (useinlining) inlining_cleanup();
        useinlining = useinltmp;
 }
-#include "sets.c"
-#include "parseRT.h"
+
 
 /*
  * These are local overrides for various environment variables in Emacs.
diff --git a/jit/parse.h b/jit/parse.h
new file mode 100644 (file)
index 0000000..f6b8d8f
--- /dev/null
@@ -0,0 +1,84 @@
+/* jit/parse.h - parser header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Author: Christian Thalinger
+
+   $Id: parse.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _PARSE_H
+#define _PARSE_H
+
+#include "global.h"
+
+/* macros for byte code fetching ***********************************************
+
+       fetch a byte code of given size from position p in code array jcode
+
+*******************************************************************************/
+
+#define code_get_u1(p)  jcode[p]
+#define code_get_s1(p)  ((s1)jcode[p])
+#define code_get_u2(p)  ((((u2)jcode[p]) << 8) + jcode[p + 1])
+#define code_get_s2(p)  ((s2)((((u2)jcode[p]) << 8) + jcode[p + 1]))
+#define code_get_u4(p)  ((((u4)jcode[p]) << 24) + (((u4)jcode[p + 1]) << 16) \
+                        +(((u4)jcode[p + 2]) << 8) + jcode[p + 3])
+#define code_get_s4(p)  ((s4)((((u4)jcode[p]) << 24) + (((u4)jcode[p + 1]) << 16) \
+                             +(((u4)jcode[p + 2]) << 8) + jcode[p + 3]))
+
+
+extern classinfo  *rt_class;
+extern methodinfo *rt_method;
+extern utf *rt_descriptor;
+extern int rt_jcodelength;
+extern u1  *rt_jcode;
+
+
+/* function prototypes */
+void compiler_addinitclass(classinfo *c);
+classSetNode * descriptor2typesL(methodinfo *m);
+void descriptor2types(methodinfo *m);
+void parse();
+
+#endif /* _PARSE_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+
+
diff --git a/jit/parseRT.c b/jit/parseRT.c
new file mode 100644 (file)
index 0000000..f0bf40b
--- /dev/null
@@ -0,0 +1,1686 @@
+/* jit/parseRT.c - parser and print functions for Rapid Type Analyis
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: parseRT.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include <string.h>
+#include "jit.h"
+#include "parse.h"
+#include "loader.h"
+#include "natcalls.h"
+#include "parseRTprint.h"
+#include "parseRTstats.h"
+#include "sets.h"
+#include "tables.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+/*------------ global variables -----------------------------------------*/
+#define MAXCALLGRAPH 5000
+
+bool XTAOPTbypass = false;
+bool XTAOPTbypass2 = false;   /* for now  invokeinterface     */
+bool XTAOPTbypass3 = false;   /* print XTA classsets in stats */
+int  XTAdebug = 0;
+int  XTAfld = 0;
+
+int methRT = 0;
+int methRTlast = -1;
+int methRTmax = MAXCALLGRAPH;
+methodinfo **callgraph;
+/*methodinfo *callgraph[MAXCALLGRAPH];*/ 
+
+int methXTA = 0;            
+int methXTAlast = -1;;      
+int methXTAmax=MAXCALLGRAPH;        
+methodinfo **XTAcallgraph;
+/*methodinfo *XTAcallgraph[MAXCALLGRAPH];*/
+
+static bool nativecallcompdone=0 ;
+
+static bool firstCall= true;
+static bool AfterMain = false;
+static FILE *rtMissed;   /* Methods missed during RTA parse of Main  */
+/*   so easier to build dynmanic calls file */
+
+static utf *utf_MAIN;   /*  utf_new_char("main"); */
+static utf *INIT    ;   /*  utf_new_char("<init>"); */
+static utf *CLINIT  ;   /*  utf_new_char("<clinit>"); */
+static utf *FINALIZE;   /*  utf_new_char("finalize"); */
+static utf *EMPTY_DESC; /*  utf_new_char("V()");  */
+static int missedCnt = 0;
+
+
+/*--------------------------------------------------------------*/
+/* addToCallgraph - adds to RTA callgraph and                   */ 
+/*                  sets  meth->methodUsed  to USED             */
+/*--------------------------------------------------------------*/  
+#define ADDTOCALLGRAPH(meth)  if ((meth->methodUsed != USED) && (!(meth->flags & ACC_ABSTRACT)) ) { \
+       callgraph[++methRTlast] = meth ; \
+       meth->methodUsed = USED; \
+                       if(pWhenMarked>=1) \
+                               {printf("\n Added to Call Graph #%i:",  \
+                               methRTlast); \
+                               printf("\t <used flags c/m> <%i/%i> %i\t",  \
+                                 meth->class->classUsed, \
+                                 meth->methodUsed, \
+                                 USED);  \
+                               printf(" method name =");   \
+                               utf_display(meth->class->name);printf("."); \
+                               method_display(meth);fflush(stdout);} \
+       }
+
+
+/*--------------------------------------------------------------*/
+bool rtaSubUsed(classinfo *class, methodinfo *meth) {
+       classinfo *subs;
+
+       for (subs=class->sub; subs != NULL; subs = subs->nextsub) {
+               if (subs->classUsed == USED) {
+                       if (class_findmethod(class, meth->name, meth->descriptor) == NULL)
+                               return false;
+                       else    
+                               return true;
+               }
+               if (rtaSubUsed(subs, meth)) 
+                       return false;
+       }
+       return false;
+}
+
+
+/*--------------------------------------------------------------*/
+/* Mark the method with same name /descriptor in topmethod      */
+/* in class                                                     */
+/*                                                              */
+/* Class not marked USED and method defined in this class ->    */
+/*    -> if Method NOTUSED mark method as MARKED                */
+/* Class marked USED and method defined in this class ->        */
+/*    -> mark method as USED                                    */
+/*                                                              */
+/* Class USED, but method not defined in this class ->          */
+/*    -> search up the heirarchy and mark method where defined  */
+/*       if class where method is defined is not USED ->        */
+/*      -> mark class with defined method as PARTUSED          */
+/*--------------------------------------------------------------*/
+
+void rtaMarkMethod(classinfo *class, methodinfo *topmethod) {
+
+       utf *name = topmethod -> name; 
+       utf *descriptor = topmethod -> descriptor;
+       methodinfo *submeth;
+
+       submeth = class_resolvemethod(class, name, descriptor); 
+       if (submeth == NULL)
+               panic("parse RT: Method not found in class hierarchy");
+       if (submeth->methodUsed == USED) return;
+  
+       if (submeth->class == class) { 
+
+               /*--- Method defined in class -----------------------------*/
+       if (submeth->class->classUsed != USED) { 
+                       if (submeth->methodUsed == NOTUSED) { 
+
+                /* Class NOT marked USED and method defined in this class -> */
+                               /*    -> if Method NOTUSED mark method as  MARKED            */
+                               if (pWhenMarked >= 1) {
+                                       printf("MARKED class.method\t"); 
+                                       utf_display(submeth->class->name);printf(".");method_display(submeth);
+                               }
+                               if (rtaSubUsed(submeth->class,submeth)) {
+                                       submeth->class->classUsed = PARTUSED;
+                                       ADDTOCALLGRAPH(submeth) 
+                                               }
+                               else    {
+                                       submeth->methodUsed = MARKED;
+                                       RTAPRINTmarkMethod1
+                                               }
+               } }
+       else    {
+                       /* Class IS  marked USED and method defined in this class -> */
+                       /*    -> mark method as USED  */
+                       ADDTOCALLGRAPH(submeth) 
+                               }
+       } /* end defined in class */
+
+       else {
+               /*--- Method NOT defined in class -----------------------------*/
+               if (submeth->class->classUsed == NOTUSED) {
+                       submeth->class->classUsed = PARTUSED;
+                       if (class->classUsed != USED) {
+                               submeth->methodUsed = MARKED;
+                       }
+               }
+               if ( (submeth->class->classUsed == USED) 
+                        || (class->classUsed == USED)) {
+                       ADDTOCALLGRAPH(submeth)
+                               }
+       } /* end NOT defined in class */
+} 
+
+/*-------------------------------------------------------------------------------*/
+/* Mark the method with the same name and descriptor as topmethod                */
+/*   and any subclass where the method is defined and/or class is used           */
+/*                                                                               */
+/*-------------------------------------------------------------------------------*/
+void rtaMarkSubs(classinfo *class, methodinfo *topmethod) {
+       RTAPRINTmarkSubs1
+               rtaMarkMethod(class, topmethod);   /* Mark method in class where it was found */
+       if (class->sub != NULL) {
+               classinfo *subs;
+       
+               if (!(topmethod->flags & ACC_FINAL )) {
+                       for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
+                               RTAPRINTmarkSubs1
+                                       rtaMarkSubs(subs, topmethod); 
+                       }
+               }
+    }
+       return;
+}
+
+/*-------------------------------------------------------------------------------*/
+/* Add Marked methods for input class ci                                         */
+/* Add methods with the same name and descriptor as implemented interfaces       */
+/*   with the same method name                                                   */
+/*                                                                               */
+/*-------------------------------------------------------------------------------*/
+void addMarkedMethods(classinfo *ci) {
+       int ii,jj,mm;
+
+       /* add marked methods to callgraph */ 
+       for (ii=0; ii<ci->methodscount; ii++) { 
+               methodinfo *mi = &(ci->methods[ii]);
+               if (mi->methodUsed == MARKED) { 
+                       if (pWhenMarked >= 1) {
+                               printf("ADDED a method that was MARKED\n");
+                       }
+                       ADDTOCALLGRAPH(mi)  
+                               }
+               else {
+       
+                       for (jj=0; jj < ci -> interfacescount; jj++) {
+                               classinfo *ici = ci -> interfaces [jj];
+                               /*  use resolve method....!!!! */
+                               if (ici -> classUsed != NOTUSED) {
+                                       for (mm=0; mm< ici->methodscount; mm++) {
+                                               methodinfo *imi = &(ici->methods[mm]);
+
+                                               if  (      (imi->methodUsed == USED) 
+                                                                  &&    ( (imi->name == mi->name) 
+                                                                                  &&      (imi->descriptor == mi->descriptor))) {
+                                                       if (pWhenMarked >= 1) 
+                                                               printf("ADDED a method that was used by an interface\n");
+                                                       ADDTOCALLGRAPH(mi)  
+                                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+}    
+/*-------------------------------------------------------------------------------*/
+/*  XTA Functions                                                                */
+/*-------------------------------------------------------------------------------*/
+
+xtainfo * xtainfoInit (methodinfo *m) {
+
+       if (m->xta != NULL) return m->xta;
+       m ->xta = (xtainfo *)malloc(sizeof(xtainfo));
+       m ->xta-> XTAmethodUsed = NOTUSED;
+       m ->xta-> XTAclassSet   = NULL;
+       /* PartClassSet */
+       m ->xta-> paramClassSet = NULL;
+       m ->xta-> calls         = NULL;
+       m ->xta-> calledBy      = NULL;
+
+       m ->xta-> marked       = NULL;
+       /*m ->xta-> markedBy     = NULL */
+       m ->xta-> fldsUsed     = NULL;
+       /*m ->xta-> interfaceCalls    = NULL*/
+       m ->xta-> chgdSinceLastParse = false;
+       return m->xta;
+}
+
+xtafldinfo * xtafldinfoInit (fieldinfo *f) {
+
+       if (f->xta != NULL) return f->xta;
+
+       f ->xta = (xtafldinfo *)malloc(sizeof(xtafldinfo));
+       f -> xta-> fieldChecked = false;   /*XTA*/
+       f -> xta-> fldClassType = NULL;    /*XTA*/
+       f -> xta-> XTAclassSet = NULL;     /*XTA*/
+       return f->xta;
+
+}
+bool xtaPassParams (methodinfo *SmCalled, methodinfo *SmCalls, methSetNode *lastptrInto) {
+
+       classSetNode *p;
+       classSetNode *c;
+       classSetNode *c1;
+       classSetNode *cprev;
+       bool          rc = false;
+
+       if (XTAdebug >= 1) {
+               printf("\n>>>>>>>>>>>>>>>>><<<xtaPassParams \n");fflush(stdout);
+
+               printf("\tIN SmCalled set : "); 
+               utf_display(SmCalled->class->name);printf("."); method_display(SmCalled);
+               printClassSet(SmCalled->xta->XTAclassSet); printf("\n"); 
+
+               printf("\tIN SmCalls set: "); 
+               utf_display(SmCalls->class->name);printf("."); method_display(SmCalls);
+               printClassSet(SmCalls->xta->XTAclassSet); printf("\n"); 
+               
+               printf("\tIN lastptrInto : (");
+               if (lastptrInto->lastptrIntoClassSet2 != NULL) {
+                       utf_display(lastptrInto->lastptrIntoClassSet2->classType->name); printf(") ");
+               }
+               else {printf("NULL) ");}
+               fflush(stdout);
+               utf_display(lastptrInto->methRef->class->name);printf("."); fflush(stdout);
+               method_display(lastptrInto->methRef); fflush(stdout);
+               printf("\n");fflush(stdout);
+       }
+
+       /* Get SmCalled ParamType set if null */
+       if (SmCalled->xta->paramClassSet == NULL) {
+               SmCalled->xta->paramClassSet = descriptor2typesL(SmCalled); 
+       }
+       if (XTAdebug >= 1) {
+               printf("\tParamPassed\n"); fflush(stdout);
+               printSet(SmCalled->xta->paramClassSet);fflush(stdout);
+               printf("\n"); fflush(stdout);
+       }
+
+       if (lastptrInto->lastptrIntoClassSet2 == NULL) {
+               if (SmCalls->xta->XTAclassSet != NULL) 
+                       c1 = SmCalls->xta->XTAclassSet->head;
+               else
+                       c1 = NULL;
+       }
+       else    {
+               /* start with type where left off */
+               c1 = lastptrInto->lastptrIntoClassSet2;  
+               c1 = c1 -> nextClass;  /* even if NULL */
+       }
+       cprev = NULL;
+       if (XTAdebug >= 1) {
+               if (c1 == NULL){
+                       printf("\tIN SmCalls ... start with NULL\n"); fflush(stdout);
+               }
+               else    {
+                       printf("\tIN SmCalls ... start with :");fflush(stdout);
+                       utf_display(c1->classType->name); printf("\n");
+               }
+       }
+
+       /* for each Param Class */
+       for (   p=SmCalled->xta->paramClassSet; p != NULL; p = p->nextClass) {
+
+               /* for each SmCalls class */
+               for (c=c1; c != NULL; c = c->nextClass) {
+                       vftbl *p_cl_vt = p->classType->vftbl; 
+                       vftbl *c_cl_vt = c->classType->vftbl; 
+
+                       /* if SmCalls class is in the Params Class range */
+                       if (  (p_cl_vt->baseval <=  c_cl_vt->baseval)
+                                 && (c_cl_vt->baseval <= (p_cl_vt->baseval+p_cl_vt->diffval)) ) {
+
+                               /*    add SmCalls class to SmCalledBy Class set */
+                               SmCalled->xta->XTAclassSet = SmCalled->xta->XTAclassSet = add2ClassSet(SmCalled->xta->XTAclassSet, c->classType); 
+                               rc = true;
+                       }
+                       cprev = c;
+               }       
+       }
+       lastptrInto->lastptrIntoClassSet2 = cprev;
+       if (XTAdebug >= 1) {
+               printf("\tOUT SmCalled set: ");fflush(stdout);
+               printClassSet(SmCalled->xta->XTAclassSet);fflush(stdout);
+
+               printf("\tOUT SmCalls set: ");fflush(stdout);
+               printClassSet(SmCalls->xta->XTAclassSet);fflush(stdout);
+
+               printf("\tOUT  lastptrInto="); fflush(stdout);
+               if (lastptrInto->lastptrIntoClassSet2 != NULL)
+                       utf_display(lastptrInto->lastptrIntoClassSet2->classType->name);
+
+               printf("<rc=%i>\n",rc);fflush(stdout);
+       }
+       return rc;
+}
+
+/*-------------------------------------------------------------------------------*/
+bool xtaPassReturnType(methodinfo *SmCalled, methodinfo *SmCalls) {
+
+       classSetNode* cs;
+       classSetNode* cs1;
+       bool          rc = false;
+
+       if (XTAdebug >= 1)
+               printf("xtaPassReturnType \n");
+
+       /* Get SmCalled return class is null */
+       if ((SmCalled->returnclass == NULL) && (SmCalled->xta->paramClassSet == NULL)) {
+               SmCalled->xta->paramClassSet = descriptor2typesL(SmCalled); 
+       }
+
+       if (SmCalled->returnclass == NULL) {
+               if (XTAdebug >= 1)
+                       printf("\tReturn type is NULL\n");
+               return rc;
+       }
+       
+       if (XTAdebug >= 1) {
+               printf("\tReturn type is: ");
+               utf_display(SmCalled->returnclass->name);
+               printf("\n");
+
+               printf("\tIN SmCalls set: ");
+               utf_display(SmCalls->class->name); printf("."); method_display(SmCalls);
+               printClassSet(SmCalls->xta->XTAclassSet);
+
+               printf("\tIN SmCalled set: ");
+               utf_display(SmCalled->class->name); printf("."); method_display(SmCalled);
+               printClassSet(SmCalled->xta->XTAclassSet);
+       }
+
+
+       if (SmCalled->xta->XTAclassSet == NULL) 
+               cs1 = NULL;
+       else
+               cs1 =  SmCalled->xta->XTAclassSet->head;
+       for (cs =cs1; cs != NULL; cs = cs->nextClass) {
+               classinfo *c = cs->classType;
+               vftbl *r_cl_vt = SmCalled->returnclass->vftbl; 
+               vftbl *c_cl_vt = c->vftbl; 
+
+               /* if class is a subtype of the return type, then add to SmCalls class set (ie.interscection)*/
+               if (  (r_cl_vt->baseval <=  r_cl_vt->baseval)
+                         && (c_cl_vt->baseval <= (r_cl_vt->baseval+r_cl_vt->diffval)) ) {
+                       SmCalls->xta->XTAclassSet = add2ClassSet(SmCalls->xta->XTAclassSet, c);  
+                       rc = true;
+               }
+       } 
+
+       if (XTAdebug >= 1) {
+               printf("\tOUT SmCalls set: ");
+               printClassSet(SmCalls->xta->XTAclassSet);
+       }
+       return rc;
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaAddCallEdges(methodinfo *mi, s4 monoPoly) {
+
+       if (mi->xta == NULL)
+               mi->xta = xtainfoInit(mi);
+       if (mi->xta->XTAmethodUsed  != USED) {  /* if static method not in callgraph */
+               XTAcallgraph[++methXTAlast] = mi;
+               mi->xta->XTAmethodUsed = USED;
+               //                              XTAPRINTcallgraph2
+
+               if(pWhenMarked>=1) {  
+                       printf("\n XTA Added to Call Graph #%i:", 
+                                  methXTAlast); 
+                       printf(" method name ="); fflush(stdout);
+                       if (mi == NULL) panic ("Method ptr NULL!!!");
+                       if (mi->class == NULL) panic ("Method class ptr NULL!!!");
+                       if (mi->class->name == NULL) panic ("Method class name ptr NULL!!!");
+                       utf_display(mi->class->name);fflush(stdout); printf(".");fflush(stdout); 
+                       method_display(mi);fflush(stdout); 
+        }
+
+       }
+       /* add call edges */
+       printf("AA1 "); fflush(stdout);
+       rt_method->xta->calls = add2MethSet(rt_method->xta->calls, mi);
+       rt_method->xta->calls->tail->monoPoly = monoPoly;
+       mi->xta->calledBy     = add2MethSet(mi->xta->calledBy,     rt_method); 
+       if (mi->xta->calledBy     == NULL) panic("mi->xta->calledBy is NULL!!!");
+       if (rt_method->xta->calls == NULL) panic("rt_method->xta->calls is NULL!!!");
+}
+
+
+/*--------------------------------------------------------------*/
+bool xtaSubUsed(classinfo *class, methodinfo *meth, classSetNode *subtypesUsedSet) {
+       classinfo *subs;
+
+       for (subs=class->sub; subs != NULL; subs = subs->nextsub) {
+               /* if class used */
+               if (inSet(subtypesUsedSet,subs)) {
+                       if (class_findmethod(class, meth->name, meth->descriptor) == NULL) 
+                               return false;
+                       else    
+                               return true;
+               }
+               if (xtaSubUsed(subs, meth,  subtypesUsedSet)) 
+                       return false;
+       }
+       return false;
+}
+
+
+/*-------------------------------------------------------------------------------*/
+void xtaMarkMethod(classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet)
+{
+       methodinfo *submeth;
+
+       utf *name = topmethod -> name;
+       utf *descriptor = topmethod -> descriptor;
+       /****
+                printf("xtaMarkMethod for:"); utf_display(class->name);fflush(stdout); 
+                method_display(topmethod);
+       **/
+
+       submeth = class_resolvemethod(class, name, descriptor);
+
+       /***
+               printf(" def: "); utf_display(submeth->class->name);fflush(stdout);
+               method_display(submeth);
+       ****/
+
+       /* Basic checks */
+       if (submeth == NULL)
+        panic("parse XTA: Method not found in class hierarchy");
+       if (submeth->xta == NULL) 
+               submeth->xta = xtainfoInit(submeth);
+
+       if (rt_method->xta->calls != NULL) {
+               if (inMethSet(rt_method->xta->calls->head,submeth)) return;
+       }
+       /*----*/
+       if (submeth->class == class) {
+
+        /*--- Method defined in class -----------------------------*/
+               if (inSet(subtypesUsedSet,submeth->class)) {
+                       xtaAddCallEdges(submeth,POLY);  
+               }
+               else    {
+                       if (subtypesUsedSet != NULL) {  
+                               if (xtaSubUsed (class,submeth,subtypesUsedSet)) {
+                                       xtaAddCallEdges(submeth,POLY);
+                               }
+                       }
+                       else    {
+                               rt_method->xta->marked = add2MethSet(rt_method->xta->marked, submeth);
+                       }
+               }
+       }
+       else  {
+        /*--- Method NOT defined in class -----------------------------*/
+               if (!(inSet(subtypesUsedSet,submeth->class) )){  /* class with method def     is not used */
+                       if (!(inSet(subtypesUsedSet,class) )) { /* class currently resolving is not used */ 
+                               rt_method->xta->marked = add2MethSet(rt_method->xta->marked, submeth);
+                               /*printf("Added to marked Set: "); fflush(stdout);printMethodSet(rt_method->xta->marked);*/
+                       }
+               }
+               if ( (inSet(subtypesUsedSet,submeth->class))  /* class with method def     is used */
+                        || (inSet(subtypesUsedSet,class)) ) {       /* class currently resolving is used */ 
+                       xtaAddCallEdges(submeth,POLY);
+               }
+
+       } /* end defined in class */
+
+}
+/*-------------------------------------------------------------------------------*/
+void xtaMarkSubs(classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet) {
+       /* xtaPRINTmarkSubs1*/
+       xtaMarkMethod(class, topmethod,subtypesUsedSet);   /* Mark method in class where it was found */
+       if (class->sub != NULL) {
+               classinfo *subs;
+
+               if (!(topmethod->flags & ACC_FINAL )) {
+                       for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
+                               /* xtaPRINTmarkSubs1 */
+                               xtaMarkSubs(subs, topmethod, subtypesUsedSet);
+                       }
+               }
+    }
+       return;
+}
+
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+
+int addClassInit(classinfo *ci) {
+       /* CHANGE to a kind of table look-up for a list of class/methods (currently 3)
+        */
+
+       utf* utf_java_lang_system = utf_new_char("java/lang/System"); 
+       utf* utf_initializeSystemClass = utf_new_char("initializeSystemClass"); 
+       utf* utf_java_lang_Object = utf_new_char("java/lang/Object"); 
+
+       int m, m1=-1, m2=-1, mf=-1;
+       methodinfo *mi;
+
+       for  (m=0; m < ci->methodscount; m++) {
+               /*<clnit> class init method */
+               if (ci->methods[m].name == CLINIT) {
+                       m1=m;
+               }
+               /* Special case: System class has an extra initializer method */
+               if        ((utf_java_lang_system == ci->name) 
+                          && (utf_initializeSystemClass == ci->methods[m].name)) {
+                       m2=m;  
+        }
+
+               /* Finalize methods */
+               if    ((ci->methods[m].name == FINALIZE) 
+                          && (ci->name != utf_java_lang_Object)) {
+                       mf=m;  
+        }
+
+    }
+
+       if (m1 >= 0) { /* No <clinit>  available - ignore */  
+
+               /* Get clinit methodinfo ptr */
+               mi = class_findmethod (ci,ci->methods[m1].name , NULL); 
+
+               /*--- RTA ---*/
+               if ( mi->methodUsed != USED) {
+                       mi->class->classUsed = PARTUSED;  
+                       ADDTOCALLGRAPH(mi)  
+                               }
+
+               /*--- XTA ---*/
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       xtaAddCallEdges(mi,MONO); 
+               }
+
+       }
+
+       if (mf >= 0) {   
+
+               /* Get finalize methodinfo ptr */
+               mi = class_findmethod (ci,ci->methods[mf].name , NULL); 
+
+               /*--- RTA ---*/
+               if ( mi->methodUsed != USED) {
+                       mi->class->classUsed = PARTUSED;  
+                       ADDTOCALLGRAPH(mi)  
+                               }
+
+               /*--- XTA ---*/
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       xtaAddCallEdges(mi,MONO); 
+               }
+       }
+
+       /*Special Case for System class init:  
+       add java/lang/initializeSystemClass to callgraph */
+       if (m2 >= 0) {
+               /* Get clinit methodinfo ptr */
+               mi = class_findmethod (ci,ci->methods[m2].name , NULL); 
+
+               /*--- RTA ---*/
+               if ( mi->methodUsed != USED) {
+                       mi->class->classUsed = PARTUSED;
+                       ADDTOCALLGRAPH(mi)  
+                               }
+
+               /*--- XTA ---*/
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       xtaAddCallEdges(mi,MONO);
+               }
+       }
+
+       /* add marked methods to callgraph */ 
+       addMarkedMethods(ci); 
+               
+       return m;
+} 
+
+
+#define rt_code_get_u1(p)  rt_jcode[p]
+#define rt_code_get_s1(p)  ((s1)rt_jcode[p])
+#define rt_code_get_u2(p)  ((((u2)rt_jcode[p])<<8)+rt_jcode[p+1])
+#define rt_code_get_s2(p)  ((s2)((((u2)rt_jcode[p])<<8)+rt_jcode[p+1]))
+#define rt_code_get_u4(p)  ((((u4)rt_jcode[p])<<24)+(((u4)rt_jcode[p+1])<<16)\
+                           +(((u4)rt_jcode[p+2])<<8)+rt_jcode[p+3])
+#define rt_code_get_s4(p)  ((s4)((((u4)rt_jcode[p])<<24)+(((u4)rt_jcode[p+1])<<16)\
+                           +(((u4)rt_jcode[p+2])<<8)+rt_jcode[p+3]))
+
+
+
+/*-------------------------------------------------------------------------------*/
+/*xx*/ void addUsedInterfaceMethods(classinfo *ci) {
+       int jj,mm;
+
+       /* add used interfaces methods to callgraph */
+       for (jj=0; jj < ci -> interfacescount; jj++) {
+               classinfo *ici = ci -> interfaces [jj];
+       
+               if (pWhenMarked >= 1) { 
+                       printf("BInterface used: ");fflush(stdout); 
+                       utf_display(ici->name);
+                       printf("<%i>\t",ici -> classUsed ); fflush(stdout); 
+                       if (ici -> classUsed == NOTUSED) printf("\t classUsed=NOTUSED\n" );
+                       if (ici -> classUsed == USED) printf("\t classUsed=USED\n");
+                       if (ici -> classUsed == PARTUSED) printf("\t classUsed=PARTUSED\n");
+                       fflush(stdout);
+               }
+               /* add class to interfaces list of classes that implement it */
+               ici -> impldBy =  addElement(ici -> impldBy,  ci);
+
+               /* if interface class is used */
+        if (ici -> classUsed != NOTUSED) {
+
+                       /* for each interface method implementation that has already been used */
+                       for (mm=0; mm< ici->methodscount; mm++) {
+                               methodinfo *imi = &(ici->methods[mm]);
+                               if (pWhenMarked >= 1) { 
+                                       if  (imi->methodUsed != USED) {
+                                               if (imi->methodUsed == NOTUSED) printf("Interface Method notused: "); 
+                                               if (imi->methodUsed == MARKED) printf("Interface Method marked: "); 
+                                               utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+                                       }
+                               } 
+                               if  (imi->methodUsed == USED) {
+                                       if (pWhenMarked >= 1) { 
+                                               printf("Interface Method used: "); utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+
+                                               /* Mark this method used in the (used) implementing class and its subclasses */
+                                               printf("MAY ADD methods that was used by an interface\n");
+                                       }
+                                       rtaMarkSubs(ci,imi);
+                               }
+                       }
+               }
+       }
+
+}
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------------------*/
+void xtaMarkInterfaceSubs(methodinfo *mCalled) {
+       classSetNode * Si;
+       
+       /* for every class that implements the interface of the method called */
+       for (Si = mCalled->class->impldBy; Si != NULL; Si = Si->nextClass) {
+               /* add all definitions of this method for this interface */
+               methodinfo *submeth;
+
+               submeth = class_findmethod(Si->classType, mCalled->name, mCalled->descriptor); 
+               if (submeth == NULL) ; /* search up the heir - ignore for now!!! */
+               else    {
+                       classSetNode *subtypesUsedSet = NULL;
+                                       
+                       if (rt_method->xta->XTAclassSet != NULL)
+                               subtypesUsedSet = intersectSubtypesWithSet(submeth->class, rt_method->xta->XTAclassSet->head);
+                               
+                       printf(" \nXTA subtypesUsedSet: "); fflush(stdout);
+                       printSet(subtypesUsedSet);
+                       xtaMarkSubs(submeth->class, submeth, subtypesUsedSet);   
+               }
+       }
+}
+
+/*-------------------------------------------------------------------------------*/
+bool xtaAddFldClassTypeInfo(fieldinfo *fi) {
+
+       bool rc = false;
+
+       if (fi->xta->fieldChecked) {
+               if (fi->xta->fldClassType != NULL)
+                       return true;  /* field has a class type */
+               else
+                       return false;
+       }
+       fi->xta->fieldChecked = true;
+
+       if (fi->type == TYPE_ADDRESS) {
+               char *utf_ptr = fi->descriptor->text;  /* current position in utf text */
+
+               if (*utf_ptr != 'L') {
+                       while (*utf_ptr++ =='[') ;
+               }
+
+               if (*utf_ptr =='L') {
+                       rc = true;
+                       if  (fi->xta->fldClassType== NULL) {
+                               char *desc;
+                               char *cname;
+                               classinfo * class;
+
+                               desc = MNEW(char, 256);
+                               strcpy(desc,++utf_ptr);
+                               cname = strtok(desc,";");
+                               if (XTAdebug >= 1) {
+                                       printf("STATIC field's type is: %s\n",cname);
+                                       fflush(stdout);
+                               }
+                               class = class_get(utf_new_char(cname));
+                               fi->xta->fldClassType= class;    /* save field's type class ptr */      
+                       } 
+               }
+       }
+       return rc;
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaPassFldPUT(fldSetNode *fN)
+{
+       /* Field type is a class */
+       classSetNode *c;
+       classSetNode *c1 = NULL;
+       classSetNode *cp = NULL;
+       classSetNode *cprev= NULL;
+
+       fieldinfo *fi;
+       if (fN != NULL)
+               fi = fN->fldRef;
+       else
+               return;
+
+/* Use lastptr  so don't check whole XTA class set each time */
+       cp = fN->lastptrPUT;
+       if (cp != NULL) {
+               if (cp->nextClass != NULL)
+                       c1 = cp -> nextClass;
+       } 
+       else    {
+               if (rt_method->xta->XTAclassSet != NULL)
+                       c1  = rt_method->xta->XTAclassSet->head;
+
+               if (XTAfld >=1 ) {
+                       printf("rt XTA class set =");fflush(stdout);
+                       printClassSet(rt_method->xta->XTAclassSet);
+                       printf("\t\tField class type = ");fflush(stdout);
+                       utf_display(fi->xta->fldClassType->name); printf("\n");
+               }
+       }
+
+       /*--- PUTSTATIC specific ---*/
+       /* Sx = intersection of type+subtypes(field x)   */
+       /*   and Sm (where putstatic code is)            */
+       for (c=c1; c != NULL; c=c->nextClass) {
+               vftbl *f_cl_vt = fi->xta->fldClassType->vftbl;
+               vftbl *c_cl_vt =  c->   classType->vftbl;
+               if (XTAfld >=2 ) {
+                       printf("\tXTA class = ");fflush(stdout);
+                       utf_display(c->classType->name);
+                       printf("<b=%i> ",c_cl_vt->baseval); fflush(stdout);
+                       if (c->nextClass == NULL) {
+                               printf("next=NULL ");fflush(stdout);
+                       }
+                       else    {
+                               printf("next="); fflush(stdout);
+                               utf_display(c->nextClass->classType->name);
+                               printf("\n"); fflush(stdout);
+                       }
+
+                       printf("\t\tField class type = ");fflush(stdout);
+                       utf_display(fi->xta->fldClassType->name);
+                       printf("<b=%i/+d=%i> \n",f_cl_vt->baseval,(f_cl_vt->baseval+f_cl_vt->diffval)); fflush(stdout);
+               }
+
+               if ((f_cl_vt->baseval <= c_cl_vt->baseval)
+                       && (c_cl_vt->baseval <= (f_cl_vt->baseval+f_cl_vt->diffval)) ) {
+                       fi->xta->XTAclassSet = add2ClassSet(fi->xta->XTAclassSet,c->classType);
+               }
+               cprev = c;
+       }
+       fN->lastptrPUT = cprev;
+}
+/*-------------------------------------------------------------------------------*/
+void xtaPassFldGET(fldSetNode *fN)
+{
+       /* Field type is a class */
+       classSetNode *c;
+       classSetNode *c1 = NULL;
+       classSetNode *cp = NULL;
+       classSetNode *cprev= NULL;
+
+       fieldinfo *fi;
+       if (fN != NULL)
+               fi = fN->fldRef;
+       else
+               return;
+
+/* Use lastptr  so don't check whole XTA class set each time */
+       cp = fN->lastptrGET;
+       if (cp != NULL) {
+               if (cp->nextClass != NULL)
+                       c1 = cp -> nextClass;
+       } 
+       else    {
+               if (fi->xta->XTAclassSet != NULL)
+                       c1  = fi->xta->XTAclassSet->head;
+
+               if (XTAfld >=1 ) {
+                       printf("fld XTA class set =");fflush(stdout);
+                       printClassSet(fi->xta->XTAclassSet);
+                       printf("\t\tField class type = ");fflush(stdout);
+                       utf_display(fi->xta->fldClassType->name); printf("\n");
+               }
+       }
+
+       /*--- GETSTATIC specific ---*/
+       /* Sm = union of Sm and Sx */
+       for (c=c1; c != NULL; c=c->nextClass) {
+               bool addFlg = false;
+               if (rt_method->xta->XTAclassSet ==NULL) 
+                       addFlg = true;
+               else    {
+                       if (!(inSet (rt_method->xta->XTAclassSet->head, c->classType) )) 
+                               addFlg = true;
+               }
+               if (addFlg) {
+                       rt_method->xta->XTAclassSet 
+                               = add2ClassSet(rt_method->xta->XTAclassSet,c->classType);
+               }
+               cprev = c;
+       }
+
+       fN->lastptrGET = cprev;
+
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaPassAllCalledByParams () {
+       methSetNode *SmCalled;
+       methSetNode *s1;
+       if (XTAdebug >= 1) {
+               printf("xta->calledBy method set: "); fflush(stdout);
+               printMethodSet(rt_method->xta->calledBy); fflush(stdout);
+       }
+       if (rt_method->xta->calledBy == NULL)
+               s1 = NULL;
+       else
+               s1 = rt_method->xta->calledBy->head;
+       for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
+               if (XTAdebug >= 1) {
+                       printf("SmCalled = "); fflush(stdout);
+                       utf_display(SmCalled->methRef->class->name); fflush(stdout);
+                       printf(".");fflush(stdout); method_display(SmCalled->methRef);
+               }
+                               
+               rt_method->xta->chgdSinceLastParse = false;             
+               xtaPassParams(rt_method, SmCalled->methRef,SmCalled);   /* chg flag output ignored for 1st regular parse */
+       }
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaAllFldsUsed ( ){
+       fldSetNode  *f;
+       fldSetNode *f1=NULL; 
+       /*      bool chgd = false */
+
+       if (rt_method->xta->fldsUsed == NULL) return;
+
+       /* for each field that this method uses */
+       f1 = rt_method->xta->fldsUsed->head;
+
+       for (f=f1; f != NULL; f = f->nextfldRef) {
+
+               if (f->writePUT)
+                       xtaPassFldPUT(f);
+               if (f->readGET)
+                       xtaPassFldGET(f);
+       }
+}
+/*-------------------------------------------------------------------------------*/
+void  xtaMethodCalls_and_sendReturnType() 
+{
+       methSetNode *SmCalled;  /* for return type       */
+       methSetNode *SmCalls;   /* for calls param types */
+       methSetNode *s1=NULL; 
+       bool chgd = false;
+       if (XTAdebug >= 1) {
+               printf("calls method set Return type: ");
+               printMethodSet(rt_method->xta->calls);
+               printf("AAAAAAAAAAAAAAFTER printMethSett(rt_method->xta->calls)\n");fflush(stdout);
+       }
+       xtaAllFldsUsed ( );
+
+       /* for each method that this method calls */
+       if (rt_method->xta->calls == NULL)
+               s1 = NULL;
+       else
+               s1 = SmCalls=rt_method->xta->calls->head;
+
+       for (SmCalls=s1; SmCalls != NULL; SmCalls = SmCalls->nextmethRef) {
+               /*    pass param types  */
+               bool chgd = false;
+               chgd = xtaPassParams (SmCalls->methRef, rt_method, SmCalls);  
+               /* if true chgd after its own parse */
+               if (!(SmCalls->methRef->xta->chgdSinceLastParse)) {
+                       SmCalls->methRef->xta->chgdSinceLastParse = true;
+               }
+       }
+
+       /* for each calledBy method */
+       /*    send return type */
+       if (rt_method->xta->calledBy == NULL)
+               s1 = NULL;
+       else
+               s1 = rt_method->xta->calledBy->head;
+       for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
+
+               if (XTAdebug >= 1) {
+                       printf("\tSmCalled = ");fflush(stdout); utf_display(SmCalled->methRef->class->name);
+                       printf("."); method_display(SmCalled->methRef);
+               }
+                               
+               chgd = xtaPassReturnType(rt_method, SmCalled->methRef); 
+               if (!(SmCalled->methRef->xta->chgdSinceLastParse)) {
+                       SmCalled->methRef->xta->chgdSinceLastParse = chgd;              
+               }
+       }
+}
+
+
+/*-------------------------------------------------------------------------------*/
+static void parseRT()
+{
+       int  p;                     /* java instruction counter                   */
+       int  nextp;                 /* start of next java instruction             */
+       int  opcode;                /* java opcode                                */
+       int  i;                     /* temporary for different uses (counters)    */
+       bool iswide = false;        /* true if last instruction was a wide        */
+
+       RTAPRINT01method
+
+               if ( ((XTAOPTbypass) || (opt_xta)) && (rt_method->name != utf_MAIN)) {
+
+                       xtaPassAllCalledByParams (); 
+               }
+
+       /* scan all java instructions */
+
+       for (p = 0; p < rt_jcodelength; p = nextp) {
+               opcode = rt_code_get_u1 (p);           /* fetch op code                  */
+               RTAPRINT02opcode
+                       fflush(stdout); 
+               nextp = p + jcommandsize[opcode];   /* compute next instruction start */
+               switch (opcode) {
+
+                       /*--------------------------------*/
+                       /* Code just to get the correct  next instruction */
+                       /* 21- 25 */
+               case JAVA_ILOAD:
+               case JAVA_LLOAD:
+               case JAVA_FLOAD:
+               case JAVA_DLOAD:
+
+               case JAVA_ALOAD:
+                       if (iswide)
+                               {
+                                       nextp = p+3;
+                                       iswide = false;
+                               }
+                       break;
+
+                       /* 54 -58 */
+               case JAVA_ISTORE:
+               case JAVA_LSTORE:
+               case JAVA_FSTORE:
+               case JAVA_DSTORE:
+
+               case JAVA_ASTORE:
+                       if (iswide)
+                               {
+                                       iswide=false;
+                                       nextp = p+3;
+                               }
+                       break;
+
+                       /* 132 */
+               case JAVA_IINC:
+                       {
+                               if (iswide) {
+                                       iswide = false;
+                                       nextp = p+5;
+                               }
+                       }
+                       break;
+
+                       /* wider index for loading, storing and incrementing */
+                       /* 196 */
+               case JAVA_WIDE:
+                       iswide = true;
+                       nextp = p + 1;
+                       break;
+                       /* 169 */
+               case JAVA_RET:
+                       if (iswide) {
+                               nextp = p+3;
+                               iswide = false;
+                       }
+                       break;
+
+                       /* table jumps ********************************/
+
+               case JAVA_LOOKUPSWITCH:
+                       {
+                               s4 num;
+                               nextp = ALIGN((p + 1), 4);
+                               num = rt_code_get_u4(nextp + 4);
+                               nextp = nextp + 8 + 8 * num;
+                               break;
+                       }
+
+
+               case JAVA_TABLESWITCH:
+                       {
+                               s4 num;
+                               nextp = ALIGN ((p + 1),4);
+                               num = rt_code_get_s4(nextp + 4);
+                               num = rt_code_get_s4(nextp + 8) - num;
+                               nextp = nextp + 16 + 4 * num;
+                               break;
+                       }
+
+                       /*-------------------------------*/
+               case JAVA_PUTSTATIC:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *fr;
+                               fieldinfo *fi;
+
+                               fr = class_getconstant (rt_class, i, CONSTANT_Fieldref);
+                               /* descr has type of field ref'd  */
+                               fi = class_findfield (fr->class,fr->name, fr->descriptor);
+                               RTAPRINT03putstatic1
+
+                                       /*--- RTA ---*/
+                                /* class with field - marked in addClassinit */
+                                       addClassInit(fr->class);
+
+                               /*--- XTA ---*/
+                               if   ((XTAOPTbypass) || (opt_xta))
+                                       {
+                                               if (fi->xta == NULL)
+                                                       fi->xta = xtafldinfoInit(fi);
+                                               if (xtaAddFldClassTypeInfo(fi)) {  
+                                                       rt_method->xta->fldsUsed = add2FldSet(rt_method->xta->fldsUsed, fi, true,false);
+                                               }
+                                       }
+                       }
+                       break;
+
+               case JAVA_GETSTATIC:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *fr;
+                               fieldinfo *fi;
+
+                               fr = class_getconstant (rt_class, i, CONSTANT_Fieldref);
+                               /* descr has type of field ref'd  */
+                               fi = class_findfield (fr->class,fr->name, fr->descriptor);
+                               RTAPRINT03putstatic1
+
+                                       /*--- RTA ---*/
+                                /* class with field - marked in addClassinit */
+                                       addClassInit(fr->class);
+
+                               /*--- XTA ---*/
+                               if  ((XTAOPTbypass) || (opt_xta) ) 
+                                       {
+                                               if (fi->xta == NULL)
+                                                       fi->xta = xtafldinfoInit(fi);
+                                               if (xtaAddFldClassTypeInfo(fi)) {
+                                                       rt_method->xta->fldsUsed = add2FldSet(rt_method->xta->fldsUsed, fi, false, true);
+                                               }
+                                       }
+
+                       }
+                       break;
+
+
+                       /*--------------------  method invocation ---------------------*/
+
+               case JAVA_INVOKESTATIC:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *mr;
+                               methodinfo *mi;
+
+                               mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
+                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
+                               /*-- RTA --*/
+                               RTAPRINT04invokestatic1
+                                       if (mi->class->classUsed == NOTUSED) {
+                                               mi->class->classUsed = USED;
+                                               RTAPRINT05invokestatic2
+                                                       }
+                               addClassInit(mi->class);
+       
+                               ADDTOCALLGRAPH(mi)  
+                                       fflush(stdout);
+                               /*-- XTA --*/
+                               if ((XTAOPTbypass) || (opt_xta)) {
+                                       xtaAddCallEdges(mi,MONO); 
+                               } /* end XTA */
+                       }
+                       break;
+
+               case JAVA_INVOKESPECIAL:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *mr;
+                               methodinfo *mi;
+                               classinfo  *ci;
+                               
+                               mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
+                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
+                               ci = mi->class;
+                               RTAPRINT06invoke_spec_virt1
+                                       /*--- PRIVATE Method -----------------------------------------------------*/ 
+                                       if (mi->name        != INIT) {     /* if method called is PRIVATE */ 
+                                               RTAPRINT07invoke_spec_virt2
+                                                       RTAPRINT04invokestatic1
+                                                       /*-- RTA --*/   /* was just markSubs(mi); */
+                                                       ADDTOCALLGRAPH(mi)  
+
+                                                       /*--- XTA ---*/
+                                                       if ((XTAOPTbypass) || (opt_xta)) {
+                                                               xtaAddCallEdges(mi,MONO);
+                                                       } /* end XTA */
+                                       }
+
+                                       else    {
+                                               /*--- Test for super <init> which is: <init> calling its super class <init> -*/
+
+                                               /* new class so add marked methods */
+                                               if (( mi->methodUsed != USED) || (mi->class->classUsed == PARTUSED))  {
+                                                       /*--- process NORMAL <init> method ---------------------------------------------*/
+                                                       if ( mi->methodUsed != USED) {
+                                                               /* Normal <init> 
+                                                                  - mark class as USED and <init> to callgraph */
+                               
+                                                               /*-- RTA --*/
+                                                               ci->classUsed = USED;
+                                                               addMarkedMethods(ci);    /* add to callgraph marked methods */
+                                                               RTAPRINT06Binvoke_spec_init
+                                                                       addUsedInterfaceMethods(ci); 
+                                                       ADDTOCALLGRAPH(mi)  
+
+                                                                       /*-- XTA --*/
+                                                                       if ((XTAOPTbypass) || (opt_xta)) { 
+                                                                               rt_method->xta->XTAclassSet = add2ClassSet(rt_method->xta->XTAclassSet,ci ); 
+                                                                               xtaAddCallEdges(mi,MONO);
+                                                                               RTAPRINT06CXTAinvoke_spec_init1
+                                                                                       } /* end XTA */
+                                                       }
+                                               }
+                                       }
+
+                       }                                                
+                       break;
+
+
+               case JAVA_INVOKEVIRTUAL:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *mr;
+                               methodinfo *mi;
+                               
+                               mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
+                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
+
+                               /*--- RTA ---*/
+                               RTAPRINT07invoke_spec_virt2
+                                       mi->monoPoly = POLY;
+                               rtaMarkSubs(mi->class,mi); 
+
+                               /*--- XTA ---*/
+                               if ((XTAOPTbypass) || (opt_xta)) { 
+                                       classSetNode *subtypesUsedSet = NULL;
+                                       if (rt_method->xta->XTAclassSet != NULL)
+                                               subtypesUsedSet = intersectSubtypesWithSet(mi->class, rt_method->xta->XTAclassSet->head);
+                                       /*****  
+                                                       printf(" \nXTA subtypesUsedSet: "); fflush(stdout);
+                                                       printSet(subtypesUsedSet);
+                                       *****/
+                                       xtaMarkSubs(mi->class, mi, subtypesUsedSet);   
+                               } /* end XTA */
+                       }
+                       break;
+
+               case JAVA_INVOKEINTERFACE:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *mr;
+                               methodinfo *mi;
+                               classSetNode *subs;
+                               
+                               mr = class_getconstant (rt_class, i, CONSTANT_InterfaceMethodref);
+                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
+
+                               if (mi->flags & ACC_STATIC)
+                                       panic ("Static/Nonstatic mismatch calling static method");
+
+                               /*--- RTA ---*/
+                               RTAPRINT08AinvokeInterface0
+                                       if (mi->class->classUsed == NOTUSED) {
+                                               mi->class->classUsed = USED; /*??PARTUSED;*/
+                                               class_java_lang_Object->impldBy =  addElement(class_java_lang_Object -> impldBy,  mi->class);
+                                       }
+
+                               /* add interface class to list kept in Object */
+                               mi->methodUsed = USED;
+                               mi->monoPoly   = POLY;
+
+                               subs =  mi->class->impldBy; 
+                               RTAPRINT08invokeInterface1
+                                       while (subs != NULL) { 
+                                               classinfo * isubs = subs->classType;
+                                               RTAPRINT09invokeInterface2
+                                                       /* Mark method (mark/used) in classes that implement the method */
+                                                       if (isubs->classUsed != NOTUSED) {
+                                                               methodinfo *submeth;
+                                               
+                                                               submeth = class_findmethod(isubs,mi->name, mi->descriptor); 
+                                                               if (submeth != NULL)
+                                                                       submeth->monoPoly = POLY; /*  poly even if nosubs */
+                                                               rtaMarkSubs(isubs, mi);  
+                                                       }
+                                               subs = subs->nextClass;
+                                       }
+
+                               /*--- XTA ---*/
+                               if ((XTAOPTbypass2) || (opt_xta))
+                                       {
+                                               xtaMarkInterfaceSubs(mi);
+                                       }
+                       }
+                       break;
+
+                       /* miscellaneous object operations *******/
+
+               case JAVA_NEW:
+                       i = rt_code_get_u2 (p+1);
+                       {
+                               classinfo *ci;
+
+                               ci = class_getconstant (rt_class, i, CONSTANT_Class); 
+                               if (pWhenMarked >= 1) {
+                                       printf("\tclass=");fflush(stdout);
+                                       utf_display(ci->name); fflush(stdout);
+                                       printf("=\n");fflush(stdout);
+                               }
+                               /*--- RTA ---*/
+                               if (ci->classUsed != USED) {
+                                       RTAPRINT10new
+                                               ci->classUsed = USED;    /* add to heirarchy    */
+                                       /* Add this class to the implemented by list of the abstract interface */
+                                       addUsedInterfaceMethods(ci);
+                                       addClassInit(ci);
+                               } 
+                               /*--- XTA ---*/
+                               if ((XTAOPTbypass) || (opt_xta))
+                                       {
+                                               rt_method->xta->XTAclassSet = add2ClassSet(rt_method->xta->XTAclassSet,ci ); /*XTA*/
+                                               RTAPRINT10newXTA
+                                                       }
+                       }
+                       break;
+
+               default:
+                       break;
+
+               } /* end switch */
+
+
+       } /* end for */
+
+       if (p != rt_jcodelength)
+               panic("Command-sequence crosses code-boundary");
+
+       if ((XTAOPTbypass) || (opt_xta))
+               xtaMethodCalls_and_sendReturnType();
+
+
+}
+
+/*-------------------------------------------------------------------------------*/
+/* RTA add Native Methods/ Class functions  */
+/*-------------------------------------------------------------------------------*/
+void   findMarkNativeUsedMeth (utf * c1, utf* m1, utf* d1) {
+
+       classinfo  *class;
+       methodinfo *meth;
+
+       class = class_get(c1);
+       if (class == NULL)  {
+               return;    /*Note: Since NativeCalls is for mult programs some may not be loaded - that's ok */
+       }
+
+       if (class->classUsed == NOTUSED) {
+               class->classUsed = USED; /* MARK CLASS USED */
+               /* add marked methods to callgraph */ 
+               addMarkedMethods(class);
+       }
+
+       meth = class_findmethod (class, m1, d1);
+       if (meth == NULL) {
+               utf_display(class->name);printf(".");utf_display(m1);printf(" ");utf_display(d1);
+               printf("WARNING from parseRT:  Method given is used by Native method call, but NOT FOUND\n");
+       }
+       else
+               rtaMarkSubs(class,meth);
+}
+
+/*-------------------------------------------------------------------------------*/
+
+void   findMarkNativeUsedClass (utf * c) {
+       classinfo  *class;
+
+       class = class_get(c);
+       if (class == NULL)  panic("parseRT: Class used by Native method called not loaded!!!");
+       class->classUsed = USED;
+
+       /* add marked methods to callgraph */
+       addMarkedMethods(class);
+}
+
+
+/*-------------------------------------------------------------------------------*/
+
+void markNativeMethodsRT(utf *rt_class, utf* rt_method, utf* rt_descriptor) {
+       int i,j,k;
+       bool found = false;
+
+       nativecallcompdone = natcall2utf(nativecallcompdone); 
+
+       for (i=0; i<NATIVECALLSSIZE; i++) {
+               if (rt_class  == nativeCompCalls[i].classname) {
+       
+                       /* find native class.method invoked */
+                       for (j=0; (!(found) && (j<nativeCompCalls[i].methCnt)); j++) {
+
+                               if ( (rt_method     == nativeCompCalls[i].methods[j].methodname)
+                                        && (rt_descriptor == nativeCompCalls[i].methods[j].descriptor)) {
+
+                                       found=true;
+
+                                       /* mark methods and classes used by this native class.method */
+                                       for (k=0; k < nativeCompCalls[i].callCnt[j]; k++) {
+                                               if (nativeCompCalls[i].methods[j].methodCalls[k].methodname != NULL) {
+                                                       /* mark method used */
+                                                       findMarkNativeUsedMeth(
+                                                                                                  nativeCompCalls[i].methods[j].methodCalls[k].classname,
+                                                                                                  nativeCompCalls[i].methods[j].methodCalls[k].methodname,
+                                                                                                  nativeCompCalls[i].methods[j].methodCalls[k].descriptor); 
+
+                                                       /*RTprint 
+                                                         printf("\nmark method used: "); fflush(stdout);
+                                                         utf_display(nativeCompCalls[i].methods[j].methodCalls[k].classname); printf(".");fflush(stdout);
+                                                         utf_display(nativeCompCalls[i].methods[j].methodCalls[k].methodname); printf("=="); fflush(stdout);
+                                                         utf_display(nativeCompCalls[i].methods[j].methodCalls[k].descriptor); printf("==\n"); fflush(stdout);
+                                                       */
+                                               }
+                                               else {
+                                                       /* mark class used */
+                                                       findMarkNativeUsedClass( nativeCompCalls[i].methods[j].methodCalls[k].classname);
+                                               } /* if-else k  */ 
+
+                                       }  /* for k */ 
+
+                               }  /* if j */
+                       }  /* for j */
+
+               }  /* if i */  
+       }  /* for i */
+
+}
+
+
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+void mainRTAparseInit (methodinfo *m )
+{
+       /*printf("MAIN_NOT_STARTED \n");*/ 
+       if (class_java_lang_Object->sub != NULL) { 
+               RTAPRINT16stats1;
+       }
+
+       if (firstCall) {
+               firstCall=false;
+
+               utf_MAIN  = utf_new_char("main");
+               INIT      = utf_new_char("<init>");
+               CLINIT    = utf_new_char("<clinit>");
+               FINALIZE  = utf_new_char("finalize");
+               EMPTY_DESC= utf_new_char("()V");
+
+               if ( (rtMissed = fopen("rtMissed", "w")) == NULL) {
+               printf("CACAO - rtMissed file: can't open file to write\n");
+               }
+               else {
+                       fprintf(rtMissed,"To Help User create a dymLoad file \n");
+                       fprintf(rtMissed,
+                                       "Not parsed in the static analysis parse of Main: #rt parse / #missed class.method (descriptor) \n");
+                       fprintf(rtMissed,"\n\tBEFORE MAIN RT PARSE\n");
+                       fflush(rtMissed);
+                       fclose(rtMissed);
+               }
+               callgraph = MNEW (methodinfo*, MAXCALLGRAPH);   /****/
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       printf("XTAXTA  CALLGRAPHS allocated\n");
+                       XTAcallgraph = MNEW (methodinfo*, MAXCALLGRAPH);
+               }
+       }
+
+       if (m->name == utf_MAIN) {
+               rtMissed = fopen("rtMissed","a");
+               fprintf(rtMissed,"\n\n\tAFTER MAIN RT PARSE\n");
+               fclose(rtMissed);
+               AfterMain = true;
+       }
+       else {  
+               if ( (rtMissed = fopen("rtMissed", "a")) == NULL) {
+                       printf("CACAO - rtMissed file: can't open file to write\n");
+               }
+               else {
+                       fprintf(rtMissed,"#%i/#%i ",methRTlast+1,missedCnt++ );
+                       utf_fprint(rtMissed,m->class->name);
+                       fprintf(rtMissed," ");
+                       fprintflags(rtMissed,m->flags);
+                       fprintf(rtMissed," ");
+                       utf_fprint(rtMissed,m->name);
+                       fprintf(rtMissed," ");
+                       utf_fprint(rtMissed,m->descriptor);
+                       fprintf(rtMissed,"\n");
+                       fflush(rtMissed);
+                       fclose(rtMissed);
+               }
+               if (AfterMain) {
+                       printf("#%i : ",methRT);
+                       printf("Method missed by static analysis Main parse. See rtMissed file");
+                       /***    panic ("Method missed by static analysis Main parse. See rtMissed file");**/
+               }
+       }
+
+       /* At moment start RTA before main when parsed                      */
+       /* Will definitely use flag with to know if ok to apply in-lining.  */
+}
+
+
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+/* still need to look at field sets in 2nd pass and clinit .....  */
+void XTA_jit_parse2(methodinfo *m)
+{
+       if (XTAdebug >= 1) 
+               printf("\n\nStarting Round 2 XTA !!!!!!!!!!!!!!\n");
+
+       /* for each method in XTA worklist = callgraph (use RTA for now) */
+       methRT=0;
+       while (methRT <= methRTlast) {
+               rt_method      = callgraph[methRT];
+               rt_class       = rt_method->class;
+               rt_descriptor  = rt_method->descriptor;
+               rt_jcodelength = rt_method->jcodelength;
+               rt_jcode       = rt_method->jcode;
+
+               if (! (  (rt_method->flags & ACC_NATIVE  )
+                                ||   (rt_method->flags & ACC_ABSTRACT) ) ) {
+                       if (XTAdebug >= 1) {
+                               printf("\n!!!!! XTA Round 2 Parse of #%i:",methRT);fflush(stdout);
+                               utf_display(rt_class->name); printf("."); fflush(stdout);
+                               method_display(rt_method);
+                       }
+                       /*   if XTA type set changed since last parse */
+                       if (rt_method->xta->chgdSinceLastParse) {
+
+                               /*     get types from methods it is calledBy */
+                               xtaPassAllCalledByParams ();
+
+                               /* Pass parameter types to methods it calls and  send the return type those called by  */
+                               xtaMethodCalls_and_sendReturnType();
+                       }
+               }
+               methRT++;
+       }
+       if (XTAdebug >= 1) {
+
+               printf("\n\nEND_OF Round 2 XTA !!!!!!!!!!!!!!\n");
+               printXTACallgraph ();
+       }
+       
+       RTAPRINT14CallgraphLast  /*was >=2 */
+               RTAPRINT15HeirarchyiLast /*was >= 2 */
+               }
+
+
+/*-------------------------------------------------------------------------------*/
+
+void RT_jit_parse(methodinfo *m)
+{
+       /*-- RTA --*/
+       if (m->methodUsed == USED) return;
+       mainRTAparseInit (m);
+               
+       /* initialise parameter type descriptor */
+       callgraph[++methRTlast] = m;          /*-- RTA --*/
+       m->methodUsed = USED;
+       RTAPRINT11addedtoCallgraph 
+               /* <init> then like a new class so add marked methods to callgraph */
+               if (m->name == INIT)  {  /* need for <init>s parsed efore Main */
+                       classinfo *ci;
+                       ci = m->class;
+                       ci->classUsed = USED;
+                       if (pWhenMarked >= 1) {
+                               printf("Class=");utf_display(ci->name);
+                       }
+                       /* add marked methods to callgraph */
+                       RTAPRINT11addedtoCallgraph2
+                               addMarkedMethods(ci);
+               } /* if */
+
+       /*-- XTA --*/
+       if ((XTAOPTbypass) || (opt_xta)) {
+               XTAcallgraph[++methXTAlast] = m;
+               if (m->xta == NULL) {
+                       m->xta = xtainfoInit(m);
+               }
+               m->xta->XTAmethodUsed = USED;
+               {methodinfo *mi = m;
+               XTAPRINTcallgraph2
+                       }
+       }
+
+       /*-- Call graph work list loop -----------------*/
+
+       while (methRT <= methRTlast) {
+               rt_method      = callgraph[methRT];
+           rt_class       = rt_method->class;
+           rt_descriptor  = rt_method->descriptor;
+           rt_jcodelength = rt_method->jcodelength;
+           rt_jcode       = rt_method->jcode;
+
+               if (! (  (rt_method->flags & ACC_NATIVE  )
+                                ||   (rt_method->flags & ACC_ABSTRACT) ) ) {
+                       parseRT();
+               }
+           else {
+                       RTAPRINT12bAbstractNative
+               if (rt_method->flags & ACC_NATIVE ) {
+                                       RTAPRINT12aNative
+                                               /* mark used and add to callgraph methods and classes used by NATIVE method */
+                                               markNativeMethodsRT(rt_class->name,rt_method->name,rt_descriptor);                
+                               }
+                       if (rt_method->flags & ACC_ABSTRACT) {
+                               panic("ABSTRACT_SHOULD not ever get into the callgraph!!!!!****!!!****!!!!****!!!!\n"); 
+                       }
+               }
+               methRT++;
+               RTAPRINT12Callgraph 
+                       RTAPRINT13Heirarchy 
+                       } /* while */
+
+
+       if (m->class->classUsed == NOTUSED)
+               m->class->classUsed = USED; /* say Main's class has a method used ??*/ 
+       printXTACallgraph ();
+       RTAPRINT14CallgraphLast  /*  was >=2*/
+               //RTAPRINT15HeirarchyiLast /*was >= 2 */
+
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       /*--- XTA round 2+ "parse" - use info structures only so not a real parse */
+                       XTA_jit_parse2(m);
+               }
+       /**** DO NOT free if RTA or XTA for now
+if (m->name == utf_MAIN) {
+       MFREE(callgraph,methodinfo*,MAXCALLGRAPH);
+       if ((XTAOPTbypass) || (opt_xta)) {
+               printf("XTAXTA  CALLGRAPHS returned \n");
+               MFREE(XTAcallgraph,methodinfo*,MAXCALLGRAPH);
+               }
+       }
+****/
+
+       return;
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 8af2b4dadf26712060204bd2f969f0f600c7d37e..d9527a3f78711261617fd90c011d15f58909c3f8 100644 (file)
-/********************** parseRT.h ******************************************
-  Parser and print functions for Rapid Type Analyis
-  used to only compile methods that may actually be used.
-***************************************************************************/
-#include "natcalls.h"
+/* jit/parseRT.h - RTA parser header
 
-#include "parseRTprint.h"    /* RTAPRINT trace/info/debug prints  */
-#include "sets.h"
-/*------------ global variables -----------------------------------------*/
-#define MAXCALLGRAPH 5000
-
-bool XTAOPTbypass = false;
-bool XTAOPTbypass2 = false;   /* for now  invokeinterface     */
-bool XTAOPTbypass3 = false;   /* print XTA classsets in stats */
-int  XTAdebug = 0; 
-int  XTAfld = 0; 
-
-int methRT = 0;            
-int methRTlast = -1;;      
-int methRTmax=MAXCALLGRAPH;        
-static methodinfo **callgraph;
-/*methodinfo *callgraph[MAXCALLGRAPH];*/ 
-
-int methXTA = 0;            
-int methXTAlast = -1;;      
-int methXTAmax=MAXCALLGRAPH;        
-static methodinfo **XTAcallgraph;
-/*methodinfo *XTAcallgraph[MAXCALLGRAPH];*/
-
-static bool nativecallcompdone=0 ;
-
-static bool firstCall= true;
-static bool AfterMain = false;
-static FILE *rtMissed;   /* Methods missed during RTA parse of Main  */
-                        /*   so easier to build dynmanic calls file */
-
-static utf *utf_MAIN;   /*  utf_new_char("main"); */
-static utf *INIT    ;   /*  utf_new_char("<init>"); */
-static utf *CLINIT  ;   /*  utf_new_char("<clinit>"); */
-static utf *FINALIZE;   /*  utf_new_char("finalize"); */
-static utf *EMPTY_DESC; /*  utf_new_char("V()");  */
-static int missedCnt = 0;
-
-#include "jit/parseRTstats.h"
-
-/*--------------------------------------------------------------*/
-/* addToCallgraph - adds to RTA callgraph and                   */ 
-/*                  sets  meth->methodUsed  to USED             */
-/*--------------------------------------------------------------*/  
-#define ADDTOCALLGRAPH(meth)  if ((meth->methodUsed != USED) && (!(meth->flags & ACC_ABSTRACT)) ) { \
-       callgraph[++methRTlast] = meth ; \
-       meth->methodUsed = USED; \
-                       if(pWhenMarked>=1) \
-                               {printf("\n Added to Call Graph #%i:",  \
-                               methRTlast); \
-                               printf("\t <used flags c/m> <%i/%i> %i\t",  \
-                                 meth->class->classUsed, \
-                                 meth->methodUsed, \
-                                 USED);  \
-                               printf(" method name =");   \
-                               utf_display(meth->class->name);printf("."); \
-                               method_display(meth);fflush(stdout);} \
-       }
-
-
-/*--------------------------------------------------------------*/
-bool rtaSubUsed(classinfo *class, methodinfo *meth) {
-       classinfo *subs;
-
-       for (subs=class->sub; subs != NULL; subs = subs->nextsub) {
-               if (subs->classUsed == USED) {
-                       if (class_findmethod(class, meth->name, meth->descriptor) == NULL) 
-                               return false;
-                       else    
-                               return true;
-                       }
-               if (rtaSubUsed(subs, meth)) 
-                       return false;
-               }
-       return false;
-}
-
-
-/*--------------------------------------------------------------*/
-/* Mark the method with same name /descriptor in topmethod      */
-/* in class                                                     */
-/*                                                              */
-/* Class not marked USED and method defined in this class ->    */
-/*    -> if Method NOTUSED mark method as MARKED                */
-/* Class marked USED and method defined in this class ->        */
-/*    -> mark method as USED                                    */
-/*                                                              */
-/* Class USED, but method not defined in this class ->          */
-/*    -> search up the heirarchy and mark method where defined  */
-/*       if class where method is defined is not USED ->        */
-/*      -> mark class with defined method as PARTUSED          */
-/*--------------------------------------------------------------*/
-
-void rtaMarkMethod(classinfo *class, methodinfo *topmethod) {
-
-  utf *name = topmethod -> name; 
-  utf *descriptor = topmethod -> descriptor;
-  methodinfo *submeth;
-
-  submeth = class_resolvemethod(class, name, descriptor); 
-  if (submeth == NULL)
-       panic("parse RT: Method not found in class hierarchy");
-  if (submeth->methodUsed == USED) return;
-  
-  if (submeth->class == class) { 
-
-       /*--- Method defined in class -----------------------------*/
-       if (submeth->class->classUsed != USED) { 
-               if (submeth->methodUsed == NOTUSED) { 
-
-                /* Class NOT marked USED and method defined in this class -> */
-               /*    -> if Method NOTUSED mark method as  MARKED            */
-                               if (pWhenMarked >= 1) {
-                                       printf("MARKED class.method\t"); 
-                                       utf_display(submeth->class->name);printf(".");method_display(submeth);
-                                       }
-                       if (rtaSubUsed(submeth->class,submeth)) {
-                               submeth->class->classUsed = PARTUSED;
-                               ADDTOCALLGRAPH(submeth) 
-                               }
-                       else    {
-                               submeth->methodUsed = MARKED;
-                                       RTAPRINTmarkMethod1
-                               }
-               } }
-       else    {
-                /* Class IS  marked USED and method defined in this class -> */
-               /*    -> mark method as USED  */
-               ADDTOCALLGRAPH(submeth) 
-               }
-       } /* end defined in class */
-
-  else {
-       /*--- Method NOT defined in class -----------------------------*/
-       if (submeth->class->classUsed == NOTUSED) {
-               submeth->class->classUsed = PARTUSED;
-               if (class->classUsed != USED) {
-                       submeth->methodUsed = MARKED;
-                       }
-               }
-       if ( (submeth->class->classUsed == USED) 
-         || (class->classUsed == USED)) {
-               ADDTOCALLGRAPH(submeth)
-               }
-               } /* end NOT defined in class */
-} 
-
-/*-------------------------------------------------------------------------------*/
-/* Mark the method with the same name and descriptor as topmethod                */
-/*   and any subclass where the method is defined and/or class is used           */
-/*                                                                               */
-/*-------------------------------------------------------------------------------*/
-void rtaMarkSubs(classinfo *class, methodinfo *topmethod) {
-               RTAPRINTmarkSubs1
-  rtaMarkMethod(class, topmethod);   /* Mark method in class where it was found */
-  if (class->sub != NULL) {
-     classinfo *subs;
-       
-    if (!(topmethod->flags & ACC_FINAL )) {
-       for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
-               RTAPRINTmarkSubs1
-         rtaMarkSubs(subs, topmethod); 
-         }
-       }
-    }
-return;
-}
-
-/*-------------------------------------------------------------------------------*/
-/* Add Marked methods for input class ci                                         */
-/* Add methods with the same name and descriptor as implemented interfaces       */
-/*   with the same method name                                                   */
-/*                                                                               */
-/*-------------------------------------------------------------------------------*/
-void addMarkedMethods(classinfo *ci) {
-int ii,jj,mm;
-
-/* add marked methods to callgraph */ 
-for (ii=0; ii<ci->methodscount; ii++) { 
-       methodinfo *mi = &(ci->methods[ii]);
-       if (mi->methodUsed == MARKED) { 
-                       if (pWhenMarked >= 1) {
-                       printf("ADDED a method that was MARKED\n");
-                       }
-               ADDTOCALLGRAPH(mi)  
-               }
-       else {
-       
-               for (jj=0; jj < ci -> interfacescount; jj++) {
-                       classinfo *ici = ci -> interfaces [jj];
-/*  use resolve method....!!!! */
-                       if (ici -> classUsed != NOTUSED) {
-                               for (mm=0; mm< ici->methodscount; mm++) {
-                                       methodinfo *imi = &(ici->methods[mm]);
-
-                                       if  (      (imi->methodUsed == USED) 
-                                       &&       ( (imi->name == mi->name) 
-                                       &&         (imi->descriptor == mi->descriptor))) {
-                                                       if (pWhenMarked >= 1) 
-                                                               printf("ADDED a method that was used by an interface\n");
-                                               ADDTOCALLGRAPH(mi)  
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-}    
-/*-------------------------------------------------------------------------------*/
-/*  XTA Functions                                                                */
-/*-------------------------------------------------------------------------------*/
-
-xtainfo * xtainfoInit (methodinfo *m) {
-
-if (m->xta != NULL) return m->xta;
-       m ->xta = (xtainfo *)malloc(sizeof(xtainfo));
-       m ->xta-> XTAmethodUsed = NOTUSED;
-       m ->xta-> XTAclassSet   = NULL;
-       /* PartClassSet */
-       m ->xta-> paramClassSet = NULL;
-       m ->xta-> calls         = NULL;
-       m ->xta-> calledBy      = NULL;
-
-       m ->xta-> marked       = NULL;
-       /*m ->xta-> markedBy     = NULL */
-       m ->xta-> fldsUsed     = NULL;
-       /*m ->xta-> interfaceCalls    = NULL*/
-       m ->xta-> chgdSinceLastParse = false;
-       return m->xta;
-}
-
-xtafldinfo * xtafldinfoInit (fieldinfo *f) {
-
-if (f->xta != NULL) return f->xta;
-
-       f ->xta = (xtafldinfo *)malloc(sizeof(xtafldinfo));
-       f -> xta-> fieldChecked = false;   /*XTA*/
-       f -> xta-> fldClassType = NULL;    /*XTA*/
-       f -> xta-> XTAclassSet = NULL;     /*XTA*/
-       return f->xta;
-
-}
-bool xtaPassParams (methodinfo *SmCalled, methodinfo *SmCalls, methSetNode *lastptrInto) {
-
-classSetNode *p;
-classSetNode *c;
-classSetNode *c1;
-classSetNode *cprev;
-bool          rc = false;
-
-       if (XTAdebug >= 1) {
-               printf("\n>>>>>>>>>>>>>>>>><<<xtaPassParams \n");fflush(stdout);
-
-               printf("\tIN SmCalled set : "); 
-               utf_display(SmCalled->class->name);printf("."); method_display(SmCalled);
-               printClassSet(SmCalled->xta->XTAclassSet); printf("\n"); 
-
-               printf("\tIN SmCalls set: "); 
-               utf_display(SmCalls->class->name);printf("."); method_display(SmCalls);
-               printClassSet(SmCalls->xta->XTAclassSet); printf("\n"); 
-               
-               printf("\tIN lastptrInto : (");
-               if (lastptrInto->lastptrIntoClassSet2 != NULL) {
-                       utf_display(lastptrInto->lastptrIntoClassSet2->classType->name); printf(") ");
-                       }
-               else {printf("NULL) ");}
-               fflush(stdout);
-               utf_display(lastptrInto->methRef->class->name);printf("."); fflush(stdout);
-                       method_display(lastptrInto->methRef); fflush(stdout);
-               printf("\n");fflush(stdout);
-               }
-
-/* Get SmCalled ParamType set if null */
-if (SmCalled->xta->paramClassSet == NULL) {
-       SmCalled->xta->paramClassSet = descriptor2typesL(SmCalled); 
-       }
-       if (XTAdebug >= 1) {
-               printf("\tParamPassed\n"); fflush(stdout);
-               printSet(SmCalled->xta->paramClassSet);fflush(stdout);
-               printf("\n"); fflush(stdout);
-               }
-
-if (lastptrInto->lastptrIntoClassSet2 == NULL) {
-       if (SmCalls->xta->XTAclassSet != NULL) 
-               c1 = SmCalls->xta->XTAclassSet->head;
-       else
-               c1 = NULL;
-       }
-else   {
-       /* start with type where left off */
-       c1 = lastptrInto->lastptrIntoClassSet2;  
-       c1 = c1 -> nextClass;  /* even if NULL */
-       }
-cprev = NULL;
-       if (XTAdebug >= 1) {
-               if (c1 == NULL){
-                       printf("\tIN SmCalls ... start with NULL\n"); fflush(stdout);
-                       }
-               else    {
-                       printf("\tIN SmCalls ... start with :");fflush(stdout);
-                       utf_display(c1->classType->name); printf("\n");
-                       }
-               }
-
-/* for each Param Class */
-for (  p=SmCalled->xta->paramClassSet; p != NULL; p = p->nextClass) {
-
-       /* for each SmCalls class */
-       for (c=c1; c != NULL; c = c->nextClass) {
-               vftbl *p_cl_vt = p->classType->vftbl; 
-               vftbl *c_cl_vt = c->classType->vftbl; 
-
-               /* if SmCalls class is in the Params Class range */
-               if (  (p_cl_vt->baseval <=  c_cl_vt->baseval)
-                  && (c_cl_vt->baseval <= (p_cl_vt->baseval+p_cl_vt->diffval)) ) {
-
-                       /*    add SmCalls class to SmCalledBy Class set */
-                       SmCalled->xta->XTAclassSet = SmCalled->xta->XTAclassSet = add2ClassSet(SmCalled->xta->XTAclassSet, c->classType); 
-                       rc = true;
-                       }
-               cprev = c;
-               }       
-       }
-lastptrInto->lastptrIntoClassSet2 = cprev;
-                       if (XTAdebug >= 1) {
-                               printf("\tOUT SmCalled set: ");fflush(stdout);
-                               printClassSet(SmCalled->xta->XTAclassSet);fflush(stdout);
-
-                               printf("\tOUT SmCalls set: ");fflush(stdout);
-                               printClassSet(SmCalls->xta->XTAclassSet);fflush(stdout);
-
-                               printf("\tOUT  lastptrInto="); fflush(stdout);
-                               if (lastptrInto->lastptrIntoClassSet2 != NULL)
-                                       utf_display(lastptrInto->lastptrIntoClassSet2->classType->name);
-
-                               printf("<rc=%i>\n",rc);fflush(stdout);
-                               }
-return rc;
-}
-
-/*-------------------------------------------------------------------------------*/
-bool xtaPassReturnType(methodinfo *SmCalled, methodinfo *SmCalls) {
-
-classSetNode* cs;
-classSetNode* cs1;
-bool          rc = false;
-
-       if (XTAdebug >= 1)
-               printf("xtaPassReturnType \n");
-
-/* Get SmCalled return class is null */
-if ((SmCalled->returnclass == NULL) && (SmCalled->xta->paramClassSet == NULL)) {
-       SmCalled->xta->paramClassSet = descriptor2typesL(SmCalled); 
-       }
-
-if (SmCalled->returnclass == NULL) {
-               if (XTAdebug >= 1)
-                       printf("\tReturn type is NULL\n");
-       return rc;
-       }
-       
-       if (XTAdebug >= 1) {
-               printf("\tReturn type is: ");
-               utf_display(SmCalled->returnclass->name);
-               printf("\n");
-
-               printf("\tIN SmCalls set: ");
-               utf_display(SmCalls->class->name); printf("."); method_display(SmCalls);
-               printClassSet(SmCalls->xta->XTAclassSet);
-
-               printf("\tIN SmCalled set: ");
-               utf_display(SmCalled->class->name); printf("."); method_display(SmCalled);
-               printClassSet(SmCalled->xta->XTAclassSet);
-               }
-
-
-if (SmCalled->xta->XTAclassSet == NULL) 
-       cs1 = NULL;
-else
-       cs1 =  SmCalled->xta->XTAclassSet->head;
-for (cs =cs1; cs != NULL; cs = cs->nextClass) {
-       classinfo *c = cs->classType;
-       vftbl *r_cl_vt = SmCalled->returnclass->vftbl; 
-       vftbl *c_cl_vt = c->vftbl; 
-
-       /* if class is a subtype of the return type, then add to SmCalls class set (ie.interscection)*/
-       if (  (r_cl_vt->baseval <=  r_cl_vt->baseval)
-          && (c_cl_vt->baseval <= (r_cl_vt->baseval+r_cl_vt->diffval)) ) {
-               SmCalls->xta->XTAclassSet = add2ClassSet(SmCalls->xta->XTAclassSet, c);  
-               rc = true;
-               }
-       } 
-
-       if (XTAdebug >= 1) {
-               printf("\tOUT SmCalls set: ");
-               printClassSet(SmCalls->xta->XTAclassSet);
-               }
-return rc;
-}
-
-/*-------------------------------------------------------------------------------*/
-void xtaAddCallEdges(methodinfo *mi, s4 monoPoly) {
-
-       if (mi->xta == NULL)
-               mi->xta = xtainfoInit(mi);
-       if (mi->xta->XTAmethodUsed  != USED) {  /* if static method not in callgraph */
-               XTAcallgraph[++methXTAlast] = mi;
-               mi->xta->XTAmethodUsed = USED;
-//                             XTAPRINTcallgraph2
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-if(pWhenMarked>=1) {  
-        printf("\n XTA Added to Call Graph #%i:", 
-                methXTAlast); 
-        printf(" method name ="); fflush(stdout);
-if (mi == NULL) panic ("Method ptr NULL!!!");
-if (mi->class == NULL) panic ("Method class ptr NULL!!!");
-if (mi->class->name == NULL) panic ("Method class name ptr NULL!!!");
-        utf_display(mi->class->name);fflush(stdout); printf(".");fflush(stdout); 
-        method_display(mi);fflush(stdout); 
-        }
+   This file is part of CACAO.
 
-               }
-       /* add call edges */
-printf("AA1 "); fflush(stdout);
-       rt_method->xta->calls = add2MethSet(rt_method->xta->calls, mi);
-       rt_method->xta->calls->tail->monoPoly = monoPoly;
-       mi->xta->calledBy     = add2MethSet(mi->xta->calledBy,     rt_method); 
-if (mi->xta->calledBy     == NULL) panic("mi->xta->calledBy is NULL!!!");
-if (rt_method->xta->calls == NULL) panic("rt_method->xta->calls is NULL!!!");
-}
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-/*--------------------------------------------------------------*/
-bool xtaSubUsed(classinfo *class, methodinfo *meth, classSetNode *subtypesUsedSet) {
-       classinfo *subs;
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-       for (subs=class->sub; subs != NULL; subs = subs->nextsub) {
-               /* if class used */
-               if (inSet(subtypesUsedSet,subs)) {
-                       if (class_findmethod(class, meth->name, meth->descriptor) == NULL) 
-                               return false;
-                       else    
-                               return true;
-                       }
-               if (xtaSubUsed(subs, meth,  subtypesUsedSet)) 
-                       return false;
-               }
-       return false;
-}
+   Contact: cacao@complang.tuwien.ac.at
 
+   Authors: Carolyn Oates
 
-/*-------------------------------------------------------------------------------*/
-void xtaMarkMethod(classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet)
-{
-  methodinfo *submeth;
+   $Id: parseRT.h 557 2003-11-02 22:51:59Z twisti $
 
-  utf *name = topmethod -> name;
-  utf *descriptor = topmethod -> descriptor;
-/****
-printf("xtaMarkMethod for:"); utf_display(class->name);fflush(stdout); 
-  method_display(topmethod);
-**/
-
-  submeth = class_resolvemethod(class, name, descriptor);
-
-/***
-printf(" def: "); utf_display(submeth->class->name);fflush(stdout);
-  method_display(submeth);
-****/
-
-  /* Basic checks */
-  if (submeth == NULL)
-        panic("parse XTA: Method not found in class hierarchy");
-  if (submeth->xta == NULL) 
-       submeth->xta = xtainfoInit(submeth);
-
-  if (rt_method->xta->calls != NULL) {
-       if (inMethSet(rt_method->xta->calls->head,submeth)) return;
-       }
-  /*----*/
-  if (submeth->class == class) {
-
-        /*--- Method defined in class -----------------------------*/
-       if (inSet(subtypesUsedSet,submeth->class)) {
-               xtaAddCallEdges(submeth,POLY);  
-               }
-       else    {
-               if (subtypesUsedSet != NULL) {  
-                       if (xtaSubUsed (class,submeth,subtypesUsedSet)) {
-                               xtaAddCallEdges(submeth,POLY);
-                               }
-                       }
-               else    {
-                       rt_method->xta->marked = add2MethSet(rt_method->xta->marked, submeth);
-                       }
-               }
-       }
-  else  {
-        /*--- Method NOT defined in class -----------------------------*/
-       if (!(inSet(subtypesUsedSet,submeth->class) )){  /* class with method def     is not used */
-               if (!(inSet(subtypesUsedSet,class) )) { /* class currently resolving is not used */ 
-                       rt_method->xta->marked = add2MethSet(rt_method->xta->marked, submeth);
-                       /*printf("Added to marked Set: "); fflush(stdout);printMethodSet(rt_method->xta->marked);*/
-                        }
-                }
-       if ( (inSet(subtypesUsedSet,submeth->class))  /* class with method def     is used */
-         || (inSet(subtypesUsedSet,class)) ) {       /* class currently resolving is used */ 
-               xtaAddCallEdges(submeth,POLY);
-                }
-
-        } /* end defined in class */
-
-}
-/*-------------------------------------------------------------------------------*/
-void xtaMarkSubs(classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet) {
-               /* xtaPRINTmarkSubs1*/
-  xtaMarkMethod(class, topmethod,subtypesUsedSet);   /* Mark method in class where it was found */
-  if (class->sub != NULL) {
-     classinfo *subs;
-
-    if (!(topmethod->flags & ACC_FINAL )) {
-       for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
-               /* xtaPRINTmarkSubs1 */
-         xtaMarkSubs(subs, topmethod, subtypesUsedSet);
-         }
-       }
-    }
-return;
-}
-
-/*-------------------------------------------------------------------------------*/
-/*-------------------------------------------------------------------------------*/
-
-int addClassInit(classinfo *ci) {
-/* CHANGE to a kind of table look-up for a list of class/methods (currently 3)
 */
 
-utf* utf_java_lang_system = utf_new_char("java/lang/System"); 
-utf* utf_initializeSystemClass = utf_new_char("initializeSystemClass"); 
-utf* utf_java_lang_Object = utf_new_char("java/lang/Object"); 
-
-int m, m1=-1, m2=-1, mf=-1;
-methodinfo *mi;
-
-for  (m=0; m < ci->methodscount; m++) {
-    /*<clnit> class init method */
-    if (ci->methods[m].name == CLINIT) {
-       m1=m;
-       }
-    /* Special case: System class has an extra initializer method */
-    if           ((utf_java_lang_system == ci->name) 
-       && (utf_initializeSystemClass == ci->methods[m].name)) {
-        m2=m;  
-        }
-
-    /* Finalize methods */
-    if    ((ci->methods[m].name == FINALIZE) 
-       && (ci->name != utf_java_lang_Object)) {
-        mf=m;  
-        }
-
-    }
-
-if (m1 >= 0) { /* No <clinit>  available - ignore */  
-
-       /* Get clinit methodinfo ptr */
-       mi = class_findmethod (ci,ci->methods[m1].name , NULL); 
-
-       /*--- RTA ---*/
-       if ( mi->methodUsed != USED) {
-               mi->class->classUsed = PARTUSED;  
-               ADDTOCALLGRAPH(mi)  
-               }
-
-       /*--- XTA ---*/
-       if ((XTAOPTbypass) || (opt_xta)) {
-               xtaAddCallEdges(mi,MONO); 
-       }
-
-       }
-
-if (mf >= 0) {   
-
-       /* Get finalize methodinfo ptr */
-       mi = class_findmethod (ci,ci->methods[mf].name , NULL); 
-
-       /*--- RTA ---*/
-       if ( mi->methodUsed != USED) {
-               mi->class->classUsed = PARTUSED;  
-               ADDTOCALLGRAPH(mi)  
-               }
-
-       /*--- XTA ---*/
-       if ((XTAOPTbypass) || (opt_xta)) {
-       xtaAddCallEdges(mi,MONO); 
-       }
-       }
-
-/*Special Case for System class init:  
-       add java/lang/initializeSystemClass to callgraph */
-if (m2 >= 0) {
-       /* Get clinit methodinfo ptr */
-       mi = class_findmethod (ci,ci->methods[m2].name , NULL); 
-
-       /*--- RTA ---*/
-       if ( mi->methodUsed != USED) {
-               mi->class->classUsed = PARTUSED;
-               ADDTOCALLGRAPH(mi)  
-               }
-
-       /*--- XTA ---*/
-       if ((XTAOPTbypass) || (opt_xta)) {
-       xtaAddCallEdges(mi,MONO);
-       }
-       }
-
-/* add marked methods to callgraph */ 
-addMarkedMethods(ci); 
-               
-return m;
-} 
-
-
-#define rt_code_get_u1(p)  rt_jcode[p]
-#define rt_code_get_s1(p)  ((s1)rt_jcode[p])
-#define rt_code_get_u2(p)  ((((u2)rt_jcode[p])<<8)+rt_jcode[p+1])
-#define rt_code_get_s2(p)  ((s2)((((u2)rt_jcode[p])<<8)+rt_jcode[p+1]))
-#define rt_code_get_u4(p)  ((((u4)rt_jcode[p])<<24)+(((u4)rt_jcode[p+1])<<16)\
-                           +(((u4)rt_jcode[p+2])<<8)+rt_jcode[p+3])
-#define rt_code_get_s4(p)  ((s4)((((u4)rt_jcode[p])<<24)+(((u4)rt_jcode[p+1])<<16)\
-                           +(((u4)rt_jcode[p+2])<<8)+rt_jcode[p+3]))
-
-
-
-/*-------------------------------------------------------------------------------*/
-/*xx*/ void addUsedInterfaceMethods(classinfo *ci) {
-int jj,mm;
-
-/* add used interfaces methods to callgraph */
-for (jj=0; jj < ci -> interfacescount; jj++) {
-       classinfo *ici = ci -> interfaces [jj];
-       
-if (pWhenMarked >= 1) { 
- printf("BInterface used: ");fflush(stdout); 
-               utf_display(ici->name);
-               printf("<%i>\t",ici -> classUsed ); fflush(stdout); 
- if (ici -> classUsed == NOTUSED) printf("\t classUsed=NOTUSED\n" );
- if (ici -> classUsed == USED) printf("\t classUsed=USED\n");
- if (ici -> classUsed == PARTUSED) printf("\t classUsed=PARTUSED\n");
- fflush(stdout);
- }
-       /* add class to interfaces list of classes that implement it */
-       ici -> impldBy =  addElement(ici -> impldBy,  ci);
-
-       /* if interface class is used */
-        if (ici -> classUsed != NOTUSED) {
-
-               /* for each interface method implementation that has already been used */
-               for (mm=0; mm< ici->methodscount; mm++) {
-                               methodinfo *imi = &(ici->methods[mm]);
-if (pWhenMarked >= 1) { 
-       if  (imi->methodUsed != USED) {
-               if (imi->methodUsed == NOTUSED) printf("Interface Method notused: "); 
-               if (imi->methodUsed == MARKED) printf("Interface Method marked: "); 
-               utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
-               }
-       } 
-                       if  (imi->methodUsed == USED) {
-if (pWhenMarked >= 1) { 
-       printf("Interface Method used: "); utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
-
-       /* Mark this method used in the (used) implementing class and its subclasses */
-       printf("MAY ADD methods that was used by an interface\n");
-       }
-                               rtaMarkSubs(ci,imi);
-                                }
-                        }
-                }
-       }
-
-}
-/*-------------------------------------------------------------------------------*/
-/*-------------------------------------------------------------------------------*/
-
-
-/*-------------------------------------------------------------------------------*/
-void xtaMarkInterfaceSubs(methodinfo *mCalled) {
-       classSetNode * Si;
-       
-       /* for every class that implements the interface of the method called */
-       for (Si = mCalled->class->impldBy; Si != NULL; Si = Si->nextClass) {
-               /* add all definitions of this method for this interface */
-               methodinfo *submeth;
-
-               submeth = class_findmethod(Si->classType, mCalled->name, mCalled->descriptor); 
-               if (submeth == NULL) ; /* search up the heir - ignore for now!!! */
-               else    {
-                       classSetNode *subtypesUsedSet = NULL;
-                                       
-                       if (rt_method->xta->XTAclassSet != NULL)
-                               subtypesUsedSet = intersectSubtypesWithSet(submeth->class, rt_method->xta->XTAclassSet->head);
-                               
-                                               printf(" \nXTA subtypesUsedSet: "); fflush(stdout);
-                                               printSet(subtypesUsedSet);
-                       xtaMarkSubs(submeth->class, submeth, subtypesUsedSet);   
-                       }
-               }
-}
-
-/*-------------------------------------------------------------------------------*/
-bool xtaAddFldClassTypeInfo(fieldinfo *fi) {
-
-bool rc = false;
-
-if (fi->xta->fieldChecked) {
-       if (fi->xta->fldClassType != NULL)
-               return true;  /* field has a class type */
-       else
-               return false;
-       }
-fi->xta->fieldChecked = true;
-
-if (fi->type == TYPE_ADDRESS) {
-       char *utf_ptr = fi->descriptor->text;  /* current position in utf text */
-
-       if (*utf_ptr != 'L') {
-               while (*utf_ptr++ =='[') ;
-                       }
-
-       if (*utf_ptr =='L') {
-               rc = true;
-               if  (fi->xta->fldClassType== NULL) {
-                       char *desc;
-                       char *cname;
-                       classinfo * class;
-
-                       desc =       MNEW (char, 256);
-                       strcpy (desc,++utf_ptr);
-                       cname = strtok(desc,";");
-                                       if (XTAdebug >= 1) {
-                                               printf("STATIC field's type is: %s\n",cname);
-                                               fflush(stdout);
-                                               }
-                       class = class_get(utf_new_char(cname));
-                       fi->xta->fldClassType= class;    /* save field's type class ptr */      
-                       } 
-               }
-       }
-return rc;
-}
-
-/*-------------------------------------------------------------------------------*/
-void xtaPassFldPUT(fldSetNode *fN)
-{
-/* Field type is a class */
-classSetNode *c;
-classSetNode *c1 = NULL;
-classSetNode *cp = NULL;
-classSetNode *cprev= NULL;
-
-fieldinfo *fi;
-if (fN != NULL)
-       fi = fN->fldRef;
-else
-       return;
-
-/* Use lastptr  so don't check whole XTA class set each time */
-cp = fN->lastptrPUT;
-if (cp != NULL) {
-       if (cp->nextClass != NULL)
-               c1 = cp -> nextClass;
-       } 
-else   {
-       if (rt_method->xta->XTAclassSet != NULL)
-               c1  = rt_method->xta->XTAclassSet->head;
-
-                       if (XTAfld >=1 ) {
-                               printf("rt XTA class set =");fflush(stdout);
-                               printClassSet(rt_method->xta->XTAclassSet);
-                               printf("\t\tField class type = ");fflush(stdout);
-                               utf_display(fi->xta->fldClassType->name); printf("\n");
-                               }
-               }
-
-/*--- PUTSTATIC specific ---*/
-/* Sx = intersection of type+subtypes(field x)   */
-/*   and Sm (where putstatic code is)            */
-for (c=c1; c != NULL; c=c->nextClass) {
-       vftbl *f_cl_vt = fi->xta->fldClassType->vftbl;
-       vftbl *c_cl_vt =  c->   classType->vftbl;
-               if (XTAfld >=2 ) {
-                       printf("\tXTA class = ");fflush(stdout);
-                       utf_display(c->classType->name);
-                       printf("<b=%i> ",c_cl_vt->baseval); fflush(stdout);
-                       if (c->nextClass == NULL) {
-                               printf("next=NULL ");fflush(stdout);
-                               }
-                       else    {
-                               printf("next="); fflush(stdout);
-                               utf_display(c->nextClass->classType->name);
-                               printf("\n"); fflush(stdout);
-                               }
-
-                       printf("\t\tField class type = ");fflush(stdout);
-                       utf_display(fi->xta->fldClassType->name);
-                       printf("<b=%i/+d=%i> \n",f_cl_vt->baseval,(f_cl_vt->baseval+f_cl_vt->diffval)); fflush(stdout);
-                       }
-
-       if ((f_cl_vt->baseval <= c_cl_vt->baseval)
-       && (c_cl_vt->baseval <= (f_cl_vt->baseval+f_cl_vt->diffval)) ) {
-               fi->xta->XTAclassSet = add2ClassSet(fi->xta->XTAclassSet,c->classType);
-               }
-       cprev = c;
-       }
-fN->lastptrPUT = cprev;
-}
-/*-------------------------------------------------------------------------------*/
-void xtaPassFldGET(fldSetNode *fN)
-{
-/* Field type is a class */
-classSetNode *c;
-classSetNode *c1 = NULL;
-classSetNode *cp = NULL;
-classSetNode *cprev= NULL;
-
-fieldinfo *fi;
-if (fN != NULL)
-       fi = fN->fldRef;
-else
-       return;
-
-/* Use lastptr  so don't check whole XTA class set each time */
-cp = fN->lastptrGET;
-if (cp != NULL) {
-       if (cp->nextClass != NULL)
-               c1 = cp -> nextClass;
-       } 
-else   {
-       if (fi->xta->XTAclassSet != NULL)
-               c1  = fi->xta->XTAclassSet->head;
-
-                       if (XTAfld >=1 ) {
-                               printf("fld XTA class set =");fflush(stdout);
-                               printClassSet(fi->xta->XTAclassSet);
-                               printf("\t\tField class type = ");fflush(stdout);
-                               utf_display(fi->xta->fldClassType->name); printf("\n");
-                               }
-       }
 
-/*--- GETSTATIC specific ---*/
-/* Sm = union of Sm and Sx */
-for (c=c1; c != NULL; c=c->nextClass) {
-       bool addFlg = false;
-       if (rt_method->xta->XTAclassSet ==NULL) 
-               addFlg = true;
-       else    {
-               if (!(inSet (rt_method->xta->XTAclassSet->head, c->classType) )) 
-                       addFlg = true;
-               }
-       if (addFlg) {
-               rt_method->xta->XTAclassSet 
-                       = add2ClassSet(rt_method->xta->XTAclassSet,c->classType);
-               }
-       cprev = c;
-       }
+#ifndef _PARSERT_H
+#define _PARSERT_H
 
-fN->lastptrGET = cprev;
+#include "global.h"
 
-}
+extern bool XTAOPTbypass;
+extern bool XTAOPTbypass2;
+extern bool XTAOPTbypass3;
+extern int XTAdebug;
+extern int XTAfld;
 
-/*-------------------------------------------------------------------------------*/
-void xtaPassAllCalledByParams () {
-methSetNode *SmCalled;
-methSetNode *s1;
-               if (XTAdebug >= 1) {
-                       printf("xta->calledBy method set: "); fflush(stdout);
-                       printMethodSet(rt_method->xta->calledBy); fflush(stdout);
-                       }
-if (rt_method->xta->calledBy == NULL)
-       s1 = NULL;
-else
-       s1 = rt_method->xta->calledBy->head;
-for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
-               if (XTAdebug >= 1) {
-                       printf("SmCalled = "); fflush(stdout);
-                       utf_display(SmCalled->methRef->class->name); fflush(stdout);
-                       printf(".");fflush(stdout); method_display(SmCalled->methRef);
-                       }
-                               
-       rt_method->xta->chgdSinceLastParse = false;             
-       xtaPassParams(rt_method, SmCalled->methRef,SmCalled);   /* chg flag output ignored for 1st regular parse */
-       }
-}
-
-/*-------------------------------------------------------------------------------*/
-void xtaAllFldsUsed ( ){
-       fldSetNode  *f;
-       fldSetNode *f1=NULL; 
-/*     bool chgd = false */
-
-if (rt_method->xta->fldsUsed == NULL) return;
-
-/* for each field that this method uses */
-f1 = rt_method->xta->fldsUsed->head;
-
-for (f=f1; f != NULL; f = f->nextfldRef) {
-
-       if (f->writePUT)
-               xtaPassFldPUT(f);
-       if (f->readGET)
-               xtaPassFldGET(f);
-       }
-}
-/*-------------------------------------------------------------------------------*/
-void  xtaMethodCalls_and_sendReturnType() 
-{
-       methSetNode *SmCalled;  /* for return type       */
-       methSetNode *SmCalls;   /* for calls param types */
-       methSetNode *s1=NULL; 
-       bool chgd = false;
-               if (XTAdebug >= 1) {
-                       printf("calls method set Return type: ");
-                       printMethodSet(rt_method->xta->calls);
-                       printf("AAAAAAAAAAAAAAFTER printMethSett(rt_method->xta->calls)\n");fflush(stdout);
-                       }
-xtaAllFldsUsed ( );
-
-/* for each method that this method calls */
-if (rt_method->xta->calls == NULL)
-       s1 = NULL;
-else
-       s1 = SmCalls=rt_method->xta->calls->head;
-
-for (SmCalls=s1; SmCalls != NULL; SmCalls = SmCalls->nextmethRef) {
-       /*    pass param types  */
-       bool chgd = false;
-       chgd = xtaPassParams (SmCalls->methRef, rt_method, SmCalls);  
-       /* if true chgd after its own parse */
-       if (!(SmCalls->methRef->xta->chgdSinceLastParse)) {
-               SmCalls->methRef->xta->chgdSinceLastParse = true;
-               }
-       }
-
-/* for each calledBy method */
-/*    send return type */
-if (rt_method->xta->calledBy == NULL)
-       s1 = NULL;
-else
-       s1 = rt_method->xta->calledBy->head;
-for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
-
-               if (XTAdebug >= 1) {
-                       printf("\tSmCalled = ");fflush(stdout); utf_display(SmCalled->methRef->class->name);
-                       printf("."); method_display(SmCalled->methRef);
-                       }
-                               
-       chgd = xtaPassReturnType(rt_method, SmCalled->methRef); 
-       if (!(SmCalled->methRef->xta->chgdSinceLastParse)) {
-               SmCalled->methRef->xta->chgdSinceLastParse = chgd;              
-               }
-       }
-}
-
-
-/*-------------------------------------------------------------------------------*/
-static void parseRT()
-{
-       int  p;                     /* java instruction counter                   */
-       int  nextp;                 /* start of next java instruction             */
-       int  opcode;                /* java opcode                                */
-       int  i;                     /* temporary for different uses (counters)    */
-        bool iswide = false;        /* true if last instruction was a wide        */
-
-               RTAPRINT01method
-
-       if ( ((XTAOPTbypass) || (opt_xta)) && (rt_method->name != utf_MAIN)) {
-
-               xtaPassAllCalledByParams (); 
-               }
-
-       /* scan all java instructions */
-
-       for (p = 0; p < rt_jcodelength; p = nextp) {
-               opcode = rt_code_get_u1 (p);           /* fetch op code                  */
-       RTAPRINT02opcode
-       fflush(stdout); 
-               nextp = p + jcommandsize[opcode];   /* compute next instruction start */
-   switch (opcode) {
-
-/*--------------------------------*/
-/* Code just to get the correct  next instruction */
-                       /* 21- 25 */
-                        case JAVA_ILOAD:
-                        case JAVA_LLOAD:
-                        case JAVA_FLOAD:
-                        case JAVA_DLOAD:
-
-                        case JAVA_ALOAD:
-                                if (iswide)
-                                  {
-                                  nextp = p+3;
-                                  iswide = false;
-                                  }
-                                break;
-
-                       /* 54 -58 */
-                       case JAVA_ISTORE:
-                        case JAVA_LSTORE:
-                        case JAVA_FSTORE:
-                        case JAVA_DSTORE:
-
-                        case JAVA_ASTORE:
-                                if (iswide)
-                                  {
-                                  iswide=false;
-                                  nextp = p+3;
-                                  }
-                               break;
-
-                       /* 132 */
-                       case JAVA_IINC:
-                                {
-                                if (iswide) {
-                                        iswide = false;
-                                        nextp = p+5;
-                                        }
-                                }
-                                break;
-
-                        /* wider index for loading, storing and incrementing */
-                       /* 196 */
-                        case JAVA_WIDE:
-                                iswide = true;
-                                nextp = p + 1;
-                                break;
-                       /* 169 */
-                       case JAVA_RET:
-                                if (iswide) {
-                                        nextp = p+3;
-                                        iswide = false;
-                                        }
-                                break;
-
-   /* table jumps ********************************/
-
-                        case JAVA_LOOKUPSWITCH:
-                                {
-                               s4 num;
-                               nextp = ALIGN((p + 1), 4);
-                                num = rt_code_get_u4(nextp + 4);
-                                nextp = nextp + 8 + 8 * num;
-                                break;
-                                }
-
-
-                       case JAVA_TABLESWITCH:
-                                {
-                               s4 num;
-                               nextp = ALIGN ((p + 1),4);
-                                num = rt_code_get_s4(nextp + 4);
-                                num = rt_code_get_s4(nextp + 8) - num;
-                                nextp = nextp + 16 + 4 * num;
-                                break;
-                                }
-
-/*-------------------------------*/
-                        case JAVA_PUTSTATIC:
-                                i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *fr;
-                                fieldinfo *fi;
-
-                                fr = class_getconstant (rt_class, i, CONSTANT_Fieldref);
-                                                                          /* descr has type of field ref'd  */
-                                fi = class_findfield (fr->class,fr->name, fr->descriptor);
-                                        RTAPRINT03putstatic1
-
-                               /*--- RTA ---*/
-                                /* class with field - marked in addClassinit */
-                                addClassInit(fr->class);
-
-                               /*--- XTA ---*/
-                               if   ((XTAOPTbypass) || (opt_xta))
-                               {
-                               if (fi->xta == NULL)
-                                       fi->xta = xtafldinfoInit(fi);
-                               if (xtaAddFldClassTypeInfo(fi)) {  
-                                       rt_method->xta->fldsUsed = add2FldSet(rt_method->xta->fldsUsed, fi, true,false);
-                                       }
-                               }
-                               }
-                                break;
-
-                        case JAVA_GETSTATIC:
-                                i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *fr;
-                                fieldinfo *fi;
-
-                                fr = class_getconstant (rt_class, i, CONSTANT_Fieldref);
-                                                                          /* descr has type of field ref'd  */
-                                fi = class_findfield (fr->class,fr->name, fr->descriptor);
-                                       RTAPRINT03putstatic1
-
-                               /*--- RTA ---*/
-                                /* class with field - marked in addClassinit */
-                                addClassInit(fr->class);
-
-                               /*--- XTA ---*/
-                               if  ((XTAOPTbypass) || (opt_xta) ) 
-                               {
-                               if (fi->xta == NULL)
-                                       fi->xta = xtafldinfoInit(fi);
-                               if (xtaAddFldClassTypeInfo(fi)) {
-                                       rt_method->xta->fldsUsed = add2FldSet(rt_method->xta->fldsUsed, fi, false, true);
-                                       }
-                               }
-
-                                }
-                                break;
-
-
-                        /*--------------------  method invocation ---------------------*/
-
-                        case JAVA_INVOKESTATIC:
-                                i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *mr;
-                                methodinfo *mi;
-
-                                mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-                               /*-- RTA --*/
-                                       RTAPRINT04invokestatic1
-                                if (mi->class->classUsed == NOTUSED) {
-                                    mi->class->classUsed = USED;
-                                       RTAPRINT05invokestatic2
-                                    }
-                               addClassInit(mi->class);
-       
-                               ADDTOCALLGRAPH(mi)  
-fflush(stdout);
-                               /*-- XTA --*/
-                               if ((XTAOPTbypass) || (opt_xta)) {
-                               xtaAddCallEdges(mi,MONO); 
-                               } /* end XTA */
-                                }
-                                break;
-
-                        case JAVA_INVOKESPECIAL:
-                                       i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *mr;
-                                methodinfo *mi;
-                               classinfo  *ci;
-                               
-                                       mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-                               ci = mi->class;
-                                                               RTAPRINT06invoke_spec_virt1
-                               /*--- PRIVATE Method -----------------------------------------------------*/ 
-                                       if (mi->name        != INIT) {     /* if method called is PRIVATE */ 
-                                                               RTAPRINT07invoke_spec_virt2
-                                                               RTAPRINT04invokestatic1
-                                       /*-- RTA --*/   /* was just markSubs(mi); */
-                                       ADDTOCALLGRAPH(mi)  
-
-                                       /*--- XTA ---*/
-                                       if ((XTAOPTbypass) || (opt_xta)) {
-                                       xtaAddCallEdges(mi,MONO);
-                                       } /* end XTA */
-                                       }
-
-                               else    {
-                               /*--- Test for super <init> which is: <init> calling its super class <init> -*/
-
-                                       /* new class so add marked methods */
-                                       if (( mi->methodUsed != USED) || (mi->class->classUsed == PARTUSED))  {
-                               /*--- process NORMAL <init> method ---------------------------------------------*/
-                                               if ( mi->methodUsed != USED) {
-                                                       /* Normal <init> 
-                                                               - mark class as USED and <init> to callgraph */
-                               
-                                                       /*-- RTA --*/
-                                                       ci->classUsed = USED;
-                                                       addMarkedMethods(ci);    /* add to callgraph marked methods */
-                                                                       RTAPRINT06Binvoke_spec_init
-                                                       addUsedInterfaceMethods(ci); 
-                                                       ADDTOCALLGRAPH(mi)  
-
-                                                       /*-- XTA --*/
-                                                       if ((XTAOPTbypass) || (opt_xta)) { 
-                                                       rt_method->xta->XTAclassSet = add2ClassSet(rt_method->xta->XTAclassSet,ci ); 
-                                                       xtaAddCallEdges(mi,MONO);
-                                                                               RTAPRINT06CXTAinvoke_spec_init1
-                                                       } /* end XTA */
-                                                       }
-                                               }
-                                       }
-
-                               }                                                
-                                break;
-
-
-                        case JAVA_INVOKEVIRTUAL:
-                               i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *mr;
-                                methodinfo *mi;
-                               
-                               mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-
-                               /*--- RTA ---*/
-                                               RTAPRINT07invoke_spec_virt2
-                               mi->monoPoly = POLY;
-                               rtaMarkSubs(mi->class,mi); 
-
-                               /*--- XTA ---*/
-                               if ((XTAOPTbypass) || (opt_xta)) { 
-                               classSetNode *subtypesUsedSet = NULL;
-                               if (rt_method->xta->XTAclassSet != NULL)
-                                       subtypesUsedSet = intersectSubtypesWithSet(mi->class, rt_method->xta->XTAclassSet->head);
-                                               /*****  
-                                               printf(" \nXTA subtypesUsedSet: "); fflush(stdout);
-                                               printSet(subtypesUsedSet);
-                                               *****/
-                               xtaMarkSubs(mi->class, mi, subtypesUsedSet);   
-                               } /* end XTA */
-                               }
-                                break;
-
-                        case JAVA_INVOKEINTERFACE:
-                                i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *mr;
-                                methodinfo *mi;
-                               classSetNode *subs;
-                               
-                                mr = class_getconstant (rt_class, i, CONSTANT_InterfaceMethodref);
-                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-
-                                if (mi->flags & ACC_STATIC)
-                                        panic ("Static/Nonstatic mismatch calling static method");
-
-                               /*--- RTA ---*/
-                                               RTAPRINT08AinvokeInterface0
-                               if (mi->class->classUsed == NOTUSED) {
-                                       mi->class->classUsed = USED; /*??PARTUSED;*/
-                                       class_java_lang_Object->impldBy =  addElement(class_java_lang_Object -> impldBy,  mi->class);
-                                       }
-
-                               /* add interface class to list kept in Object */
-                               mi->methodUsed = USED;
-                               mi->monoPoly   = POLY;
-
-                               subs =  mi->class->impldBy; 
-                                                                       RTAPRINT08invokeInterface1
-                               while (subs != NULL) { 
-                                       classinfo * isubs = subs->classType;
-                                                                       RTAPRINT09invokeInterface2
-                                       /* Mark method (mark/used) in classes that implement the method */
-                                       if (isubs->classUsed != NOTUSED) {
-                                               methodinfo *submeth;
-                                               
-                                               submeth = class_findmethod(isubs,mi->name, mi->descriptor); 
-                                               if (submeth != NULL)
-                                                       submeth->monoPoly = POLY; /*  poly even if nosubs */
-                                               rtaMarkSubs(isubs, mi);  
-                                               }
-                                       subs = subs->nextClass;
-                                       }
-
-                               /*--- XTA ---*/
-                               if ((XTAOPTbypass2) || (opt_xta))
-                               {
-                               xtaMarkInterfaceSubs(mi);
-                               }
-                                }
-                                break;
-
-                       /* miscellaneous object operations *******/
-
-                        case JAVA_NEW:
-                                i = rt_code_get_u2 (p+1);
-                                {
-                                classinfo *ci;
-
-                                ci = class_getconstant (rt_class, i, CONSTANT_Class); 
-if (pWhenMarked >= 1) {
-       printf("\tclass=");fflush(stdout);
-       utf_display(ci->name); fflush(stdout);
-       printf("=\n");fflush(stdout);
-       }
-                               /*--- RTA ---*/
-                               if (ci->classUsed != USED) {
-                                               RTAPRINT10new
-                                        ci->classUsed = USED;    /* add to heirarchy    */
-                                       /* Add this class to the implemented by list of the abstract interface */
-                                       addUsedInterfaceMethods(ci);
-                                       addClassInit(ci);
-                                       } 
-                               /*--- XTA ---*/
-                               if ((XTAOPTbypass) || (opt_xta))
-                               {
-                               rt_method->xta->XTAclassSet = add2ClassSet(rt_method->xta->XTAclassSet,ci ); /*XTA*/
-                                               RTAPRINT10newXTA
-                               }
-                                }
-                                break;
-
-                        default:
-                                break;
-
-                        } /* end switch */
-
-
-               } /* end for */
-
-       if (p != rt_jcodelength)
-               panic("Command-sequence crosses code-boundary");
-
-if ((XTAOPTbypass) || (opt_xta))
-       xtaMethodCalls_and_sendReturnType();
-
-
-}
-
-/*-------------------------------------------------------------------------------*/
-/* RTA add Native Methods/ Class functions  */
-/*-------------------------------------------------------------------------------*/
-void   findMarkNativeUsedMeth (utf * c1, utf* m1, utf* d1) {
-
-classinfo  *class;
-methodinfo *meth;
-
-class = class_get(c1);
-if (class == NULL)  {
-       return;    /*Note: Since NativeCalls is for mult programs some may not be loaded - that's ok */
-       }
-
-if (class->classUsed == NOTUSED) {
-       class->classUsed = USED; /* MARK CLASS USED */
-       /* add marked methods to callgraph */ 
-       addMarkedMethods(class);
-       }
-
-meth = class_findmethod (class, m1, d1);
-if (meth == NULL) {
-       utf_display(class->name);printf(".");utf_display(m1);printf(" ");utf_display(d1);
-       printf("WARNING from parseRT:  Method given is used by Native method call, but NOT FOUND\n");
-       }
-else
-       rtaMarkSubs(class,meth);
-}
-
-/*-------------------------------------------------------------------------------*/
-
-void   findMarkNativeUsedClass (utf * c) {
-classinfo  *class;
-
-class = class_get(c);
-if (class == NULL)  panic("parseRT: Class used by Native method called not loaded!!!");
-class->classUsed = USED;
-
-/* add marked methods to callgraph */
-addMarkedMethods(class);
-}
-
-
-/*-------------------------------------------------------------------------------*/
-
-void markNativeMethodsRT(utf *rt_class, utf* rt_method, utf* rt_descriptor) {
-int i,j,k;
-bool found = false;
-
-nativecallcompdone = natcall2utf(nativecallcompdone); 
-
-for (i=0; i<NATIVECALLSSIZE; i++) {
-  if (rt_class  == nativeCompCalls[i].classname) {
-       
-    /* find native class.method invoked */
-    for (j=0; (!(found) && (j<nativeCompCalls[i].methCnt)); j++) {
-
-      if ( (rt_method     == nativeCompCalls[i].methods[j].methodname)
-        && (rt_descriptor == nativeCompCalls[i].methods[j].descriptor)) {
-
-        found=true;
-
-        /* mark methods and classes used by this native class.method */
-        for (k=0; k < nativeCompCalls[i].callCnt[j]; k++) {
-          if (nativeCompCalls[i].methods[j].methodCalls[k].methodname != NULL) {
-            /* mark method used */
-            findMarkNativeUsedMeth(
-                       nativeCompCalls[i].methods[j].methodCalls[k].classname,
-                       nativeCompCalls[i].methods[j].methodCalls[k].methodname,
-                       nativeCompCalls[i].methods[j].methodCalls[k].descriptor); 
-
-               /*RTprint 
-                       printf("\nmark method used: "); fflush(stdout);
-                       utf_display(nativeCompCalls[i].methods[j].methodCalls[k].classname); printf(".");fflush(stdout);
-                       utf_display(nativeCompCalls[i].methods[j].methodCalls[k].methodname); printf("=="); fflush(stdout);
-                       utf_display(nativeCompCalls[i].methods[j].methodCalls[k].descriptor); printf("==\n"); fflush(stdout);
-               */
-            }
-          else {
-            /* mark class used */
-            findMarkNativeUsedClass( nativeCompCalls[i].methods[j].methodCalls[k].classname);
-            } /* if-else k  */ 
-
-          }  /* for k */ 
-
-        }  /* if j */
-      }  /* for j */
-
-    }  /* if i */  
-  }  /* for i */
-
-}
-
-
-/*-------------------------------------------------------------------------------*/
-/*-------------------------------------------------------------------------------*/
-void mainRTAparseInit (methodinfo *m )
-{
-/*printf("MAIN_NOT_STARTED \n");*/ 
-if (class_java_lang_Object->sub != NULL) { 
-       RTAPRINT16stats1
-       }
-
-if (firstCall) {
-       firstCall=false;
-
-       utf_MAIN  = utf_new_char("main");
-       INIT      = utf_new_char("<init>");
-       CLINIT    = utf_new_char("<clinit>");
-       FINALIZE  = utf_new_char("finalize");
-       EMPTY_DESC= utf_new_char("()V");
-
-       if ( (rtMissed = fopen("rtMissed", "w")) == NULL) {
-               printf("CACAO - rtMissed file: can't open file to write\n");
-                }
-       else {
-               fprintf(rtMissed,"To Help User create a dymLoad file \n");
-               fprintf(rtMissed,
-                 "Not parsed in the static analysis parse of Main: #rt parse / #missed class.method (descriptor) \n");
-               fprintf(rtMissed,"\n\tBEFORE MAIN RT PARSE\n");
-               fflush(rtMissed);
-               fclose(rtMissed);
-               }
-       callgraph = MNEW (methodinfo*, MAXCALLGRAPH);   /****/
-       if ((XTAOPTbypass) || (opt_xta)) {
-               printf("XTAXTA  CALLGRAPHS allocated\n");
-               XTAcallgraph = MNEW (methodinfo*, MAXCALLGRAPH);
-               }
-       }
-
-if (m->name == utf_MAIN) {
-       rtMissed = fopen("rtMissed","a");
-       fprintf(rtMissed,"\n\n\tAFTER MAIN RT PARSE\n");
-       fclose(rtMissed);
-       AfterMain = true;
-       }
-else {  
-       if ( (rtMissed = fopen("rtMissed", "a")) == NULL) {
-               printf("CACAO - rtMissed file: can't open file to write\n");
-               }
-       else {
-               fprintf(rtMissed,"#%i/#%i ",methRTlast+1,missedCnt++ );
-               utf_fprint(rtMissed,m->class->name);
-               fprintf(rtMissed," ");
-               fprintflags(rtMissed,m->flags);
-               fprintf(rtMissed," ");
-               utf_fprint(rtMissed,m->name);
-               fprintf(rtMissed," ");
-               utf_fprint(rtMissed,m->descriptor);
-               fprintf(rtMissed,"\n");
-               fflush(rtMissed);
-               fclose(rtMissed);
-               }
-       if (AfterMain) {
-               printf("#%i : ",methRT);
-               printf("Method missed by static analysis Main parse. See rtMissed file");
-       /***    panic ("Method missed by static analysis Main parse. See rtMissed file");**/
-               }
-       }
-
-       /* At moment start RTA before main when parsed                      */
-       /* Will definitely use flag with to know if ok to apply in-lining.  */
-}
-
-
-/*-------------------------------------------------------------------------------*/
-/*-------------------------------------------------------------------------------*/
-/* still need to look at field sets in 2nd pass and clinit .....  */
-void XTA_jit_parse2(methodinfo *m)
-{
-                       if (XTAdebug >= 1) 
-                               printf("\n\nStarting Round 2 XTA !!!!!!!!!!!!!!\n");
-
-/* for each method in XTA worklist = callgraph (use RTA for now) */
-methRT=0;
-while (methRT <= methRTlast) {
-       rt_method      = callgraph[methRT];
-       rt_class       = rt_method->class;
-       rt_descriptor  = rt_method->descriptor;
-       rt_jcodelength = rt_method->jcodelength;
-       rt_jcode       = rt_method->jcode;
-
-       if (! (  (rt_method->flags & ACC_NATIVE  )
-           ||   (rt_method->flags & ACC_ABSTRACT) ) ) {
-if (XTAdebug >= 1) {
-       printf("\n!!!!! XTA Round 2 Parse of #%i:",methRT);fflush(stdout);
-       utf_display(rt_class->name); printf("."); fflush(stdout);
-       method_display(rt_method);
-       }
-               /*   if XTA type set changed since last parse */
-               if (rt_method->xta->chgdSinceLastParse) {
-
-                       /*     get types from methods it is calledBy */
-                       xtaPassAllCalledByParams ();
-
-                       /* Pass parameter types to methods it calls and  send the return type those called by  */
-                       xtaMethodCalls_and_sendReturnType();
-                       }
-               }
-       methRT++;
-       }
-               if (XTAdebug >= 1) {
-
-                               printf("\n\nEND_OF Round 2 XTA !!!!!!!!!!!!!!\n");
-                               printXTACallgraph ();
-                               }
-       
-                               RTAPRINT14CallgraphLast  /*was >=2 */
-                               RTAPRINT15HeirarchyiLast /*was >= 2 */
-}
-
-
-/*-------------------------------------------------------------------------------*/
-
-void RT_jit_parse(methodinfo *m)
-{
-       /*-- RTA --*/
-       if (m->methodUsed == USED) return;
-       mainRTAparseInit (m);
-               
-       /* initialise parameter type descriptor */
-        callgraph[++methRTlast] = m;          /*-- RTA --*/
-       m->methodUsed = USED;
-                       RTAPRINT11addedtoCallgraph 
-       /* <init> then like a new class so add marked methods to callgraph */
-       if (m->name == INIT)  {  /* need for <init>s parsed efore Main */
-         classinfo *ci;
-               ci = m->class;
-               ci->classUsed = USED;
-               if (pWhenMarked >= 1) {
-                       printf("Class=");utf_display(ci->name);
-                       }
-               /* add marked methods to callgraph */
-                       RTAPRINT11addedtoCallgraph2
-               addMarkedMethods(ci);
-         } /* if */
-
-       /*-- XTA --*/
-       if ((XTAOPTbypass) || (opt_xta)) {
-                XTAcallgraph[++methXTAlast] = m;
-               if (m->xta == NULL) {
-                       m->xta = xtainfoInit(m);
-                       }
-                m->xta->XTAmethodUsed = USED;
-                       {methodinfo *mi = m;
-                       XTAPRINTcallgraph2
-                       }
-       }
-
-       /*-- Call graph work list loop -----------------*/
-
-        while (methRT <= methRTlast) {
-            rt_method      = callgraph[methRT];
-           rt_class       = rt_method->class;
-           rt_descriptor  = rt_method->descriptor;
-           rt_jcodelength = rt_method->jcodelength;
-           rt_jcode       = rt_method->jcode;
-
-            if (! (  (rt_method->flags & ACC_NATIVE  )
-               ||   (rt_method->flags & ACC_ABSTRACT) ) ) {
-             parseRT();
-               }
-           else {
-                                               RTAPRINT12bAbstractNative
-               if (rt_method->flags & ACC_NATIVE ) {
-                                               RTAPRINT12aNative
-                 /* mark used and add to callgraph methods and classes used by NATIVE method */
-                 markNativeMethodsRT(rt_class->name,rt_method->name,rt_descriptor);              
-                 }
-               if (rt_method->flags & ACC_ABSTRACT) {
-                 panic("ABSTRACT_SHOULD not ever get into the callgraph!!!!!****!!!****!!!!****!!!!\n"); 
-                 }
-               }
-             methRT++;
-                       RTAPRINT12Callgraph 
-                       RTAPRINT13Heirarchy 
-        } /* while */
-
-
-       if (m->class->classUsed == NOTUSED)
-               m->class->classUsed = USED; /* say Main's class has a method used ??*/ 
-                       printXTACallgraph ();
-                       RTAPRINT14CallgraphLast  /*  was >=2*/
-                       //RTAPRINT15HeirarchyiLast /*was >= 2 */
-
-       if ((XTAOPTbypass) || (opt_xta)) {
-               /*--- XTA round 2+ "parse" - use info structures only so not a real parse */
-               XTA_jit_parse2(m);
-               }
-/**** DO NOT free if RTA or XTA for now
-if (m->name == utf_MAIN) {
-       MFREE(callgraph,methodinfo*,MAXCALLGRAPH);
-       if ((XTAOPTbypass) || (opt_xta)) {
-               printf("XTAXTA  CALLGRAPHS returned \n");
-               MFREE(XTAcallgraph,methodinfo*,MAXCALLGRAPH);
-               }
-       }
-****/
-
-return;
-}
+extern int methRT;
+extern int methRTlast;
+extern int methRTmax;
+extern methodinfo **callgraph;
+extern int methXTA;
+extern int methXTAlast;
+extern int methXTAmax;
+extern methodinfo **XTAcallgraph;
+
+#endif /* _PARSERT_H */
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b9d5c90beccc2437f51e52d1d9ddf879edfc7cc1..4d473cb435fa39ba8a8932804ca077bfc5760d4f 100644 (file)
@@ -7,6 +7,8 @@
  */
 
 
+#include "parseRTstats.h"
+
 
 #define XTAPRINTcallgraph1  if(pWhenMarked>=1) \
         {printf("\n XTA Added to Call Graph #%i:",  \
diff --git a/jit/parseRTstats.c b/jit/parseRTstats.c
new file mode 100644 (file)
index 0000000..34124c4
--- /dev/null
@@ -0,0 +1,558 @@
+/* jit/parseRTstats.c -
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: parseRTstats.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "parseRT.h"
+#include "loader.h"
+#include "toolbox/loging.h"
+
+
+/*--- Statistics ----------------------------------------------------------*/
+
+int unRTclassHeirCnt=0;
+int unRTmethodCnt = 0;
+
+/*-----*/
+int RTclassHeirNotUsedCnt=0; 
+int RTclassHeirUsedCnt=0;    
+int RTclassHeirPartUsedCnt=0;
+int RTclassHeirSuperCnt=0;
+
+int RTmethodNotUsedCnt = 0;
+int RTmethodNotUsedCnt1= 0;
+int RTmethodNotUsedCnt2= 0;
+int RTmethodUsedCnt = 0;
+int RTmethodMarkedCnt= 0;
+
+/* What might be inlined of the Used Methods */
+int RTmethodFinal  = 0;
+int RTmethodStatic = 0;
+int RTmethodFinalStatic = 0;
+int RTmethodNoSubs = 0;
+
+int RTmethodMono; 
+int RTmethodPossiblePoly;
+int RTmethodPolyReallyMono;
+int RTmethodPoly;
+
+int RTmethodFinal100  = 0;
+int RTmethodStatic100 = 0;
+int RTmethodFinalStatic100 = 0;
+int RTmethodNoSubs100 = 0;
+
+#define MAXCODLEN 10
+
+int RTmethodNoSubsAbstract = 0;
+int RTmethod1Used  = 0;
+
+int RTmethodAbstract = 0;
+
+int subRedefsCnt =0;
+int subRedefsCntUsed =0;
+
+/*------------- RTAprint flags ------------------------------------------------------------------*/
+int pCallgraph  = 0;    /* 0 - dont print 1 - print at end from main                             */ 
+/* 2 - print at end of RT parse call                                     */
+/* 3- print after each method RT parse                                   */
+int pClassHeir  = 1;    /* 0 - dont print 1 - print at end from main                             */
+/* 2 - print at end of RT parse call  3-print after each method RT parse */
+int pClassHeirStatsOnly = 1;  /* usually 2 Print only the statistical summary info for class heirarchy     */
+
+int pOpcodes    = 0;    /* 0 - don't print 1- print in parse RT 2- print in parse                */
+/* 3 - print in both                                                     */
+int pWhenMarked = 0;    /* 0 - don't print 1 - print when added to callgraph + when native parsed*/
+/* 2 - print when marked+methods called                                  */
+/* 3 - print when class/method looked at                                 */
+int pStats = 0;         /* 0 - don't print; 1= analysis only; 2= whole unanalysed class heirarchy*/
+
+/*-----------------------------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------------------------------*/
+void printXTACallgraph ()
+{ 
+       int i;
+
+       if (XTAdebug >= 1) {
+               printf("----- XTA Callgraph Worklist:<%i>\n",methXTAlast);
+               for (i=0;i<=methXTAlast;i++) {
+                       printf("  (%i): ",i);
+                       utf_display(XTAcallgraph[i]->class->name);
+                       printf(":");
+                       method_display(XTAcallgraph[i]);
+               }
+
+               printf("\n\n");
+       }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------------------------------*/
+
+void printCallgraph ()
+{ int i;
+
+ printf("----- RTA Callgraph Worklist:<%i>\n",methRTlast);
+ for (i=0;i<=methRTlast;i++) {
+        printf("  (%i): ",i);
+        utf_display(callgraph[i]->class->name);
+        printf(":");
+        method_display(callgraph[i]);
+ }
+
+ printf("\n\n");
+}
+/*--------------------------------------------------------------*/
+void printObjectClassHeirarchy1() {
+       if (pStats >= 1) {
+        unRTclassHeirCnt=0;
+        unRTmethodCnt = 0;
+               printObjectClassHeirarchy(class_java_lang_Object);
+        printf("\n >>>>>>>>>>>>>>>>>>>>  END of unanalysed Class Heirarchy: #%i classes /  #%i methods\n\n",
+                          unRTclassHeirCnt,unRTmethodCnt);
+       }
+
+}
+/*--------------------------------------------------------------*/
+void printObjectClassHeirarchy(classinfo  *class) {
+  
+       classinfo  *subs;
+       methodinfo *meth;
+       int t,m,cnt;
+
+       if (class == NULL) {return;}
+       unRTclassHeirCnt++; unRTmethodCnt += class->methodscount;
+       if (pStats == 2) {
+               printf("\n");
+               /* Class Name */
+               for (t=0;t<class->index;t++) printf("\t"); 
+               if (class->flags & ACC_INTERFACE) printf("ABSTRACT ");
+
+               printf("Class: "); 
+               utf_display(class->name);    
+               printf(" <%i> (depth=%i) \n",class->classUsed,class->index);
+               /* Print methods used */
+               cnt=0; 
+               for (m=0; m < class->methodscount; m++) {
+            meth = &class->methods[m];
+                       if (cnt == 0) {
+                               for (t=0;t<class->index;t++) printf("\t");
+                               printf("aMethods used:\n");
+                       }
+                       for (t=0;t<class->index;t++) printf("\t");
+                       printf("\t");
+                       utf_display(meth->class->name); 
+                       printf(".");
+                       method_display(meth);
+                       cnt++;
+           }
+               if (cnt > 0) printf("> %i of %i methods\n",cnt, class->methodscount);
+    }
+
+    for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
+               printObjectClassHeirarchy(subs);
+       }
+
+}
+/*--------------------------------------------------------------*/
+/*--------------------------------------------------------------*/
+int subdefd(methodinfo *meth) {
+    classinfo *subs;
+    methodinfo *submeth;
+
+       /*printf("subdefd for:");utf_display(meth->class->name);printf(".");method_display(meth); fflush(stdout);*/
+
+    if (  (meth->flags & ACC_STATIC) && (meth->flags & ACC_FINAL ) )  
+       panic("Possible Poly call for FINAL or STATIC\n");
+
+    if ((meth->class->sub == NULL)  && (!(meth->flags & ACC_ABSTRACT )) ) { 
+               return 0;
+       }
+    if (meth->flags & ACC_ABSTRACT ) ; /*printf("AB\n"); fflush(stdout); */
+
+       /*printf("s exist for:");utf_display(meth->class->name);printf(".");method_display(meth);*/
+
+    for (subs = meth->class->sub;subs != NULL;subs = subs->nextsub) {
+               submeth = class_findmethod(subs, meth->name, meth->descriptor); 
+               if (submeth != NULL) {
+                       subRedefsCnt++;
+                       if (submeth->methodUsed == USED) {
+                               subRedefsCntUsed++;
+                               /*return 1;*/
+                       }
+                       else {
+                               if (subdefd(submeth) > 0)
+                                       ; /*return 1;*/
+                       }
+               }
+       }
+    if (subRedefsCntUsed > 0) return 1;
+    return 0;
+}
+/*--------------------------------------------------------------*/
+
+void printRTClassHeirarchy(classinfo  *class) {
+  
+       classinfo  *subs;
+       methodinfo *meth;
+       int m,cnt;
+
+       if (class == NULL) {return;}
+    /* Class Name */
+    if (class->classUsed == NOTUSED) {
+               RTclassHeirNotUsedCnt++;
+               RTmethodNotUsedCnt = RTmethodNotUsedCnt + class->methodscount;
+               RTmethodNotUsedCnt1 = RTmethodNotUsedCnt1 + class->methodscount;
+               for (m=0; m < class->methodscount; m++) {
+                       meth = &class->methods[m];
+                       if (meth->methodUsed == USED) {
+                               if (pClassHeirStatsOnly >= 2) {
+                                       printf("METHOD marked used in CLASS marked NOTUSED: "); 
+                                       utf_display(class->name);
+                                       printf(".");
+                                       method_display(meth);
+                                       printf("<%i>\n\t",meth->methodUsed);
+                                       fflush(stdout);
+                                       printf("\n\n\n\nMETHOD marked used in CLASS marked NOTUSED\n\n\n\n"); 
+                               }
+                       }
+               }
+       }
+
+    if (class->classUsed != NOTUSED) {
+        if (pClassHeirStatsOnly >= 2) {
+                       printf("\nClass: "); 
+                       utf_display(class->name);    
+                       printf(" <%i> (depth=%i) ",class->classUsed,class->index);
+
+                       printf("\tbase/diff =%3d/%3d\n",
+                                  class->vftbl->baseval,
+                                  class->vftbl->diffval);
+               }
+
+        if (class->classUsed == PARTUSED) {
+            if (pClassHeirStatsOnly >= 2) {
+                               printf("\tClass not instanciated - but  methods/fields resolved to this class' code (static,inits,fields,super)\n");
+                       }
+                       RTclassHeirPartUsedCnt++;
+           }   
+        else {
+                       if (pClassHeirStatsOnly >= 2) {
+                printf("\n");
+                       }
+                       RTclassHeirUsedCnt++;
+               }
+
+
+               /* Print methods used */
+               cnt=0;
+        for (m=0; m < class->methodscount; m++) {
+
+            meth = &class->methods[m];
+               
+                       if (meth->methodUsed == NOTUSED)        RTmethodNotUsedCnt2++; 
+                       if (meth->methodUsed == MARKED)   RTmethodMarkedCnt++;
+                       if (meth->methodUsed == USED) {
+                               RTmethodUsedCnt++;
+                               if (  (meth->flags & ACC_FINAL ) && (!(meth->flags & ACC_STATIC)) ) { 
+                                       RTmethodFinal++;
+                                       if (meth->jcodelength < MAXCODLEN)  RTmethodFinal100++;
+                               }
+
+                               if (  (meth->flags & ACC_STATIC) && (!(meth->flags & ACC_FINAL )) ) { 
+                                       RTmethodStatic++;
+                                       if (meth->jcodelength < MAXCODLEN)  RTmethodStatic100++;
+                               }
+
+                               if (  (meth->flags & ACC_STATIC) && (meth->flags & ACC_FINAL ) ) { 
+                                       RTmethodFinalStatic++;
+                                       if (meth->jcodelength < MAXCODLEN)  RTmethodFinalStatic100++;
+                               }
+
+                               if ((! ((meth->flags & ACC_FINAL ) && (meth->flags & ACC_STATIC)) ) 
+                                       && ((meth->class->sub == NULL)  && (!(meth->flags & ACC_ABSTRACT)) ))    {
+                                       RTmethodNoSubs++;
+                                       if (meth->jcodelength < MAXCODLEN)  RTmethodNoSubs100++;
+                               }
+
+                               if ((! ((meth->flags & ACC_FINAL ) && (meth->flags & ACC_STATIC)) ) 
+                                       && ((meth->class->sub == NULL)  &&   (meth->flags & ACC_ABSTRACT)  ))    RTmethodNoSubsAbstract++;
+
+                               if (meth->flags & ACC_ABSTRACT) RTmethodAbstract++;
+                                                       
+                               if (meth->monoPoly == MONO) RTmethodMono++;
+                               if (meth->monoPoly == POLY) {
+                                       RTmethodPossiblePoly++;
+                                       subRedefsCnt = 0;
+                                       subRedefsCntUsed = 0;
+                                       if (meth->flags & ACC_ABSTRACT ) {
+                                               if (pClassHeirStatsOnly >= 2) {
+                                                       printf("STATS: abstract_method=");
+                                                       utf_display(meth->class->name);printf(".");
+                                                       method_display(meth);
+                                               }
+                                       }
+                                       else    {
+                                               if (subdefd(meth) == 0) {
+                                                       meth->monoPoly = MONO1;
+                                                       RTmethodPolyReallyMono++;
+                                               }                       
+                                               else    {
+                                                       RTmethodPoly++;
+                                                       meth->subRedefs = subRedefsCnt;
+                                                       meth->subRedefsUsed = subRedefsCntUsed;
+                                               }
+                                       }
+                               }
+
+                               if (pClassHeirStatsOnly >= 2) {
+                                       if (cnt == 0) {
+                                               printf("bMethods used:\n");
+                                       }
+                                       cnt++;
+                                       printf("\t");
+                                       utf_display(meth->class->name); 
+                                       printf(".");
+                                       method_display(meth);
+                                       printf("\t\t");
+                                       if (meth->monoPoly != MONO) printf("\t\tRedefs used/total<%i/%i>\t", meth->subRedefsUsed, meth->subRedefs);
+                                       if ( (XTAOPTbypass3) || (opt_xta)) {
+                                               if (meth->xta->XTAclassSet == NULL)
+                                                       printf("class set never created\n");
+                                               else
+                                                       printSet(meth->xta->XTAclassSet->head);
+                                       }
+                               }
+                       }
+               }
+               if (pClassHeirStatsOnly >= 2) {
+                       if (cnt > 0) printf("> %i of %i methods used\n",cnt, class->methodscount);
+               }
+       }
+
+    for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
+               printRTClassHeirarchy(subs);
+       }
+}
+/*--------------------------------------------------------------*/
+void printRTInterfaceClasses() {
+       int mm;
+       classinfo *ci = class_java_lang_Object;
+       classSetNode *subs;
+
+       int RTmethodInterfaceClassImplementedCnt        = 0;
+       int RTmethodInterfaceClassUsedCnt               = 0;
+
+       int RTmethodInterfaceMethodTotalCnt             = 0;
+       int RTmethodInterfaceMethodNotUsedCnt   = 0;
+       int RTmethodInterfaceMethodUsedCnt              = 0;
+
+       int RTmethodClassesImpldByTotalCnt              = 0;
+
+       int RTmethodInterfaceMonoCnt                    = 0;
+       int RTmethodInterfacePolyReallyMonoCnt=0;  /* look at every method that implments and see if its poly or mono1*/
+
+       int RTmethodNoSubsAbstractCnt = 0;
+
+       for (subs = ci->impldBy; subs != NULL; subs = subs->nextClass) {
+        classinfo * ici = subs->classType;
+               classinfo * isubs = subs->classType;
+               classSetNode * inBy;
+               int impldBycnt;
+
+               if (isubs->sub == NULL) RTmethodNoSubsAbstractCnt++;
+               if (pClassHeir >= 2) {
+                       printf("Interface class: ");fflush(stdout);
+                       utf_display(ici->name); printf("\t#Methods=%i",ici->methodscount);
+               }
+               RTmethodInterfaceClassImplementedCnt++;
+               if (ici -> classUsed == USED)     {RTmethodInterfaceClassUsedCnt++;}
+               if (pClassHeir >= 2) {
+                       printf("\n\t\t\tImplemented by classes:\n");
+               }
+               impldBycnt = 0;
+               /* get the total impldBy classes Used */
+               for (inBy = ici->impldBy; inBy != NULL; inBy = inBy->nextClass) {
+                       impldBycnt++;
+                       RTmethodClassesImpldByTotalCnt++;
+                       if (pClassHeir >= 2) {
+                               printf("\t\t\t");utf_display(inBy->classType->name);
+                               printf("\n");
+                       }
+                       if (inBy->classType->classUsed == NOTUSED) 
+                               panic("printRTInterfaceClasses: class in the implemented list without being used!!!??");
+               }
+               if (pClassHeir >= 2) {
+                       printf("\t\t\tImpld by: %i\n",impldBycnt);
+               }
+               if (impldBycnt== 1) RTmethodInterfaceMonoCnt++;
+
+        /* if interface class is used */
+        if (ici -> classUsed != NOTUSED) {
+                       if (pClassHeir >= 2) {
+                       printf("    cMethods used:\n");
+                       }
+
+                       /* for each interface method implementation that has been used */
+                       for (mm=0; mm< ici->methodscount; mm++) {
+                               methodinfo *imi = &(ici->methods[mm]);
+                               RTmethodInterfaceMethodTotalCnt++;
+                               if  (imi->methodUsed != USED) {
+                                       RTmethodInterfaceMethodNotUsedCnt++;
+                               }
+                               if  (imi->methodUsed == USED) {
+                                       RTmethodInterfaceMethodUsedCnt++;
+                                       if (pClassHeirStatsOnly >= 2) {
+                                               printf("\t\t"); 
+                                               utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+                                       }
+                                       if (impldBycnt == 1) {
+                                               classinfo  *cii;
+                                               methodinfo *mii;
+
+                                               /* if only 1 implementing class then possibly really mono call */
+                                       inBy = ici->impldBy;
+                                               cii = inBy->classType;
+                                               
+                                               mii = class_findmethod(cii, imi->name, imi->descriptor); 
+                                               if (mii == NULL) {
+                                                       /* assume its resolved up the heirarchy and just 1 possiblity so MONO1 */
+                                                       imi->monoPoly = MONO1;
+                                                       RTmethodInterfacePolyReallyMonoCnt++;
+                                               }
+                                               else    {
+                                                       if (imi->monoPoly != POLY) 
+                                                               panic ("interface monopoly not POLY");
+
+                                                       if (mii->monoPoly != POLY) {
+                                                               imi->monoPoly = MONO1;
+                                                               RTmethodInterfacePolyReallyMonoCnt++;
+                                                       }
+                                                       else    {
+                                                               imi->monoPoly = POLY;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       if (pClassHeir >= 2) {
+                               printf("\n");
+                       }
+               }
+       }
+       if (pClassHeirStatsOnly >= 1) {
+               printf("\n\n  >>>>>>>>>>>>>>>>>>>>  Interface Statistics Summary: \n");
+               printf("Classes:  Total:   %i \tUSED:      %i \tIMPLD BY:   \t%i \tJUST 1 IMPLD BY:  %i \tNOSUB:     %i \n",
+                          RTmethodInterfaceClassImplementedCnt,
+                          RTmethodInterfaceClassUsedCnt,RTmethodClassesImpldByTotalCnt, RTmethodInterfaceMonoCnt,
+                          RTmethodNoSubsAbstractCnt);
+               printf("Methods:  Total:   %i \tNOTUSED:   %i  \tUSED:      \t%i \tPoly that resolves to Mono  %i \n",
+                          RTmethodInterfaceMethodTotalCnt,
+                          RTmethodInterfaceMethodNotUsedCnt,RTmethodInterfaceMethodUsedCnt, RTmethodInterfacePolyReallyMonoCnt);
+       }
+}
+/*--------------------------------------------------------------*/
+
+void printRThierarchyInfo(methodinfo *m) {
+
+       /*-- init for statistics --*/
+       RTclassHeirNotUsedCnt=0; 
+       RTclassHeirUsedCnt=0;    
+       RTclassHeirPartUsedCnt=0;   
+       RTclassHeirSuperCnt=0;   
+       RTmethodNotUsedCnt = 0; 
+       RTmethodNotUsedCnt1 = 0; 
+       RTmethodNotUsedCnt2 = 0;  
+       RTmethodUsedCnt = 0;   
+       RTmethodMarkedCnt= 0;  
+
+
+       /*-- --*/
+       if (pClassHeirStatsOnly >= 2) {
+               printf("\nRT Class Hierarchy for ");
+               printf("--- start of RT info --------------- after :\n");
+               if (m != NULL) {
+                       utf_display(m->class->name); 
+                       printf(".");
+                       method_display(m);
+                       printf("\n");
+               }
+    }
+       printRTClassHeirarchy(class_java_lang_Object);
+       if (pClassHeirStatsOnly >= 2) {
+               printf("--- end  of RT info ---------------\n");
+    }
+       if (pClassHeirStatsOnly >= 1) {
+
+               /*--  statistic results --*/
+               printRTInterfaceClasses();
+       
+               printf("\n  >>>>>>>>>>>>>>>>>>>>  Analysed Class Hierarchy Statistics:\n"); 
+               printf(" Used            \t%i \tclasses\t/ Used       \t%i methods \t of USED: %i%% \t  of ALL: %i%% \n",
+                          RTclassHeirUsedCnt,RTmethodUsedCnt,
+                          ((100*RTmethodUsedCnt)/(RTmethodUsedCnt + RTmethodNotUsedCnt2)) ,
+                          ((100*RTmethodUsedCnt)/ (RTmethodNotUsedCnt    + RTmethodUsedCnt    + RTmethodMarkedCnt)) );
+               printf(" Part Used       \t%i \tclasses\t/\n",RTclassHeirPartUsedCnt); 
+               printf(" Not Used        \t%i \tclasses\t/\n\n",RTclassHeirNotUsedCnt); 
+               printf("                 \t    \t       \t/ Just Marked \t%i methods\n\n",RTmethodMarkedCnt); 
+               printf(" In Not Used     \t    \tclasses\t/ Not Used    \t%i methods\n",RTmethodNotUsedCnt1); 
+               printf(" In Used         \t    \tclasses\t/ Not Used    \t%i methods\n",RTmethodNotUsedCnt2);
+               printf(" Total           \t%i \tclasses\t/ Total       \t%i methods\n\n",
+                          RTclassHeirNotUsedCnt + RTclassHeirUsedCnt + RTclassHeirPartUsedCnt,  
+                          RTmethodNotUsedCnt1 + RTmethodNotUsedCnt2    + RTmethodUsedCnt    + RTmethodMarkedCnt ); 
+
+               printf(" Mono vs. Polymorphic calls:\n");
+               printf(" Mono calls     \t%i   \tPoly that resolves to Mono \t%i \tPoly calls     \t%i\n\n",
+                          RTmethodMono, RTmethodPolyReallyMono, RTmethodPoly);
+
+               printf(" No Subs: Total=\t%i   \tAbstract No Subs=           \t%i \tAbstract methods used =\t%i\n",
+                          RTmethodNoSubs, RTmethodNoSubsAbstract, RTmethodAbstract);
+
+               printf(" Inlining possible:  \tFINALs %i \tSTATICs %i \t FINAL & STATIC %i \t Class has No Subs %i \n",
+                          RTmethodFinal, RTmethodStatic,RTmethodFinalStatic,  RTmethodNoSubs);
+               printf("    Code size < 100  \tFINALs %i \tSTATICs %i \t FINAL & STATIC %i \t Class has No Subs %i \n",
+                          RTmethodFinal100, RTmethodStatic100,RTmethodFinalStatic100,  RTmethodNoSubs100);
+       }
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 5d2fec633d1acaa1c0799e115b41b9212225871d..2a3167ce7b02e852590f9a643957593d360cfd0f 100644 (file)
+/* jit/parseRTstats.c -
 
-/*--- Statistics ----------------------------------------------------------*/
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-int unRTclassHeirCnt=0;
-int unRTmethodCnt = 0;
+   This file is part of CACAO.
 
-/*-----*/
-int RTclassHeirNotUsedCnt=0; 
-int RTclassHeirUsedCnt=0;    
-int RTclassHeirPartUsedCnt=0;
-int RTclassHeirSuperCnt=0;
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-int RTmethodNotUsedCnt = 0;
-int RTmethodNotUsedCnt1= 0;
-int RTmethodNotUsedCnt2= 0;
-int RTmethodUsedCnt = 0;
-int RTmethodMarkedCnt= 0;
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-/* What might be inlined of the Used Methods */
-int RTmethodFinal  = 0;
-int RTmethodStatic = 0;
-int RTmethodFinalStatic = 0;
-int RTmethodNoSubs = 0;
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-int RTmethodMono; 
-int RTmethodPossiblePoly;
-int RTmethodPolyReallyMono;
-int RTmethodPoly;
+   Contact: cacao@complang.tuwien.ac.at
 
-int RTmethodFinal100  = 0;
-int RTmethodStatic100 = 0;
-int RTmethodFinalStatic100 = 0;
-int RTmethodNoSubs100 = 0;
+   Authors: Carolyn Oates
 
-#define MAXCODLEN 10
+   $Id: parseRTstats.h 557 2003-11-02 22:51:59Z twisti $
 
-int RTmethodNoSubsAbstract = 0;
-int RTmethod1Used  = 0;
+*/
 
-int RTmethodAbstract = 0;
 
-int subRedefsCnt =0;
-int subRedefsCntUsed =0;
+#ifndef _PARSERTSTATS_H
+#define _PARSERTSTATS_H
 
-/*------------- RTAprint flags ------------------------------------------------------------------*/
-int pCallgraph  = 0;    /* 0 - dont print 1 - print at end from main                             */ 
-                        /* 2 - print at end of RT parse call                                     */
-                        /* 3- print after each method RT parse                                   */
-int pClassHeir  = 1;    /* 0 - dont print 1 - print at end from main                             */
-                        /* 2 - print at end of RT parse call  3-print after each method RT parse */
-int pClassHeirStatsOnly = 1;  /* usually 2 Print only the statistical summary info for class heirarchy     */
+extern int unRTclassHeirCnt;
+extern int unRTmethodCnt;
+extern int pWhenMarked;
 
-int pOpcodes    = 0;    /* 0 - don't print 1- print in parse RT 2- print in parse                */
-                        /* 3 - print in both                                                     */
-int pWhenMarked = 0;    /* 0 - don't print 1 - print when added to callgraph + when native parsed*/
-                        /* 2 - print when marked+methods called                                  */
-                        /* 3 - print when class/method looked at                                 */
-int pStats = 0;         /* 0 - don't print; 1= analysis only; 2= whole unanalysed class heirarchy*/
+#endif /* _PARSERTSTATS_H */
 
-/*-----------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------------*/
-void printXTACallgraph ()
-  { int i;
-if (XTAdebug >= 1) {
-printf("----- XTA Callgraph Worklist:<%i>\n",methXTAlast);
-  for (i=0;i<=methXTAlast;i++) {
-    printf("  (%i): ",i);
-    utf_display(XTAcallgraph[i]->class->name);
-    printf(":");
-    method_display(XTAcallgraph[i]);
-    }
-
-  printf("\n\n");
-  }
-  }
-
-/*-----------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------------*/
-
-void printCallgraph ()
-  { int i;
-
-printf("----- RTA Callgraph Worklist:<%i>\n",methRTlast);
-  for (i=0;i<=methRTlast;i++) {
-    printf("  (%i): ",i);
-    utf_display(callgraph[i]->class->name);
-    printf(":");
-    method_display(callgraph[i]);
-    }
-
-  printf("\n\n");
-  }
-/*--------------------------------------------------------------*/
-void printObjectClassHeirarchy1() {
-if (pStats >= 1) {
-        unRTclassHeirCnt=0;
-        unRTmethodCnt = 0;
-                printObjectClassHeirarchy(class_java_lang_Object);
-        printf("\n >>>>>>>>>>>>>>>>>>>>  END of unanalysed Class Heirarchy: #%i classes /  #%i methods\n\n",
-                unRTclassHeirCnt,unRTmethodCnt);
-        }
-
-}
-/*--------------------------------------------------------------*/
-void printObjectClassHeirarchy(classinfo  *class) {
-  
-classinfo  *subs;
-methodinfo *meth;
-int t,m,cnt;
-
-if (class == NULL) {return;}
-  unRTclassHeirCnt++; unRTmethodCnt += class->methodscount;
-  if (pStats == 2) {
-    printf("\n");
-    /* Class Name */
-    for (t=0;t<class->index;t++) printf("\t"); 
-    if (class->flags & ACC_INTERFACE) printf("ABSTRACT ");
-
-    printf("Class: "); 
-    utf_display(class->name);    
-    printf(" <%i> (depth=%i) \n",class->classUsed,class->index);
-    /* Print methods used */
-    cnt=0; 
-    for (m=0; m < class->methodscount; m++) {
-            meth = &class->methods[m];
-           if (cnt == 0) {
-             for (t=0;t<class->index;t++) printf("\t");
-                printf("aMethods used:\n");
-                }
-            for (t=0;t<class->index;t++) printf("\t");
-            printf("\t");
-            utf_display(meth->class->name); 
-            printf(".");
-            method_display(meth);
-            cnt++;
-           }
-    if (cnt > 0) printf("> %i of %i methods\n",cnt, class->methodscount);
-    }
-
-    for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
-       printObjectClassHeirarchy(subs);
-        }
-
-}
-/*--------------------------------------------------------------*/
-/*--------------------------------------------------------------*/
-int subdefd(methodinfo *meth) {
-    classinfo *subs;
-    methodinfo *submeth;
-
-/*printf("subdefd for:");utf_display(meth->class->name);printf(".");method_display(meth); fflush(stdout);*/
-
-    if (  (meth->flags & ACC_STATIC) && (meth->flags & ACC_FINAL ) )  
-       panic("Possible Poly call for FINAL or STATIC\n");
-
-    if ((meth->class->sub == NULL)  && (!(meth->flags & ACC_ABSTRACT )) ) { 
-       return 0;
-       }
-    if (meth->flags & ACC_ABSTRACT ) ; /*printf("AB\n"); fflush(stdout); */
-
-/*printf("s exist for:");utf_display(meth->class->name);printf(".");method_display(meth);*/
-
-    for (subs = meth->class->sub;subs != NULL;subs = subs->nextsub) {
-       submeth = class_findmethod(subs, meth->name, meth->descriptor); 
-       if (submeth != NULL) {
-               subRedefsCnt++;
-               if (submeth->methodUsed == USED) {
-                       subRedefsCntUsed++;
-                       /*return 1;*/
-                       }
-               else {
-                  if (subdefd(submeth) > 0)
-                       ; /*return 1;*/
-                  }
-               }
-       }
-    if (subRedefsCntUsed > 0) return 1;
-    return 0;
-}
-/*--------------------------------------------------------------*/
-
-void printRTClassHeirarchy(classinfo  *class) {
-  
-classinfo  *subs;
-methodinfo *meth;
-int m,cnt;
-
-if (class == NULL) {return;}
-    /* Class Name */
-    if (class->classUsed == NOTUSED) {
-       RTclassHeirNotUsedCnt++;
-       RTmethodNotUsedCnt = RTmethodNotUsedCnt + class->methodscount;
-       RTmethodNotUsedCnt1 = RTmethodNotUsedCnt1 + class->methodscount;
-       for (m=0; m < class->methodscount; m++) {
-         meth = &class->methods[m];
-         if (meth->methodUsed == USED) {
-           if (pClassHeirStatsOnly >= 2) {
-               printf("METHOD marked used in CLASS marked NOTUSED: "); 
-               utf_display(class->name);
-               printf(".");
-               method_display(meth);
-               printf("<%i>\n\t",meth->methodUsed);
-               fflush(stdout);
-               printf("\n\n\n\nMETHOD marked used in CLASS marked NOTUSED\n\n\n\n"); 
-               }
-            }
-         }
-       }
-
-    if (class->classUsed != NOTUSED) {
-        if (pClassHeirStatsOnly >= 2) {
-         printf("\nClass: "); 
-          utf_display(class->name);    
-         printf(" <%i> (depth=%i) ",class->classUsed,class->index);
-
-                 printf("\tbase/diff =%3d/%3d\n",
-                       class->vftbl->baseval,
-                       class->vftbl->diffval);
-         }
-
-        if (class->classUsed == PARTUSED) {
-            if (pClassHeirStatsOnly >= 2) {
-  printf("\tClass not instanciated - but  methods/fields resolved to this class' code (static,inits,fields,super)\n");
-             }
-           RTclassHeirPartUsedCnt++;
-           }   
-        else {
-              if (pClassHeirStatsOnly >= 2) {
-                printf("\n");
-               }
-             RTclassHeirUsedCnt++;
-              }
-
-
-       /* Print methods used */
-       cnt=0;
-        for (m=0; m < class->methodscount; m++) {
-
-            meth = &class->methods[m];
-               
-           if (meth->methodUsed == NOTUSED)    RTmethodNotUsedCnt2++; 
-           if (meth->methodUsed == MARKED)   RTmethodMarkedCnt++;
-           if (meth->methodUsed == USED) {
-               RTmethodUsedCnt++;
-               if (  (meth->flags & ACC_FINAL ) && (!(meth->flags & ACC_STATIC)) ) { 
-                       RTmethodFinal++;
-                       if (meth->jcodelength < MAXCODLEN)  RTmethodFinal100++;
-                       }
-
-               if (  (meth->flags & ACC_STATIC) && (!(meth->flags & ACC_FINAL )) ) { 
-                       RTmethodStatic++;
-                       if (meth->jcodelength < MAXCODLEN)  RTmethodStatic100++;
-                       }
-
-               if (  (meth->flags & ACC_STATIC) && (meth->flags & ACC_FINAL ) ) { 
-                       RTmethodFinalStatic++;
-                       if (meth->jcodelength < MAXCODLEN)  RTmethodFinalStatic100++;
-                       }
-
-               if ((! ((meth->flags & ACC_FINAL ) && (meth->flags & ACC_STATIC)) ) 
-                  && ((meth->class->sub == NULL)  && (!(meth->flags & ACC_ABSTRACT)) ))    {
-                       RTmethodNoSubs++;
-                       if (meth->jcodelength < MAXCODLEN)  RTmethodNoSubs100++;
-                       }
-
-               if ((! ((meth->flags & ACC_FINAL ) && (meth->flags & ACC_STATIC)) ) 
-                  && ((meth->class->sub == NULL)  &&   (meth->flags & ACC_ABSTRACT)  ))    RTmethodNoSubsAbstract++;
-
-               if (meth->flags & ACC_ABSTRACT) RTmethodAbstract++;
-                                                       
-               if (meth->monoPoly == MONO) RTmethodMono++;
-               if (meth->monoPoly == POLY) {
-                       RTmethodPossiblePoly++;
-                               subRedefsCnt = 0;
-                               subRedefsCntUsed = 0;
-                       if (meth->flags & ACC_ABSTRACT ) {
-                               if (pClassHeirStatsOnly >= 2) {
-                                       printf("STATS: abstract_method=");
-                                       utf_display(meth->class->name);printf(".");
-                                       method_display(meth);
-                                       }
-                               }
-                       else    {
-                               if (subdefd(meth) == 0) {
-                                       meth->monoPoly = MONO1;
-                                       RTmethodPolyReallyMono++;
-                                       }                       
-                               else    {
-                                       RTmethodPoly++;
-                                       meth->subRedefs = subRedefsCnt;
-                                       meth->subRedefsUsed = subRedefsCntUsed;
-                                       }
-                               }
-                       }
-
-               if (pClassHeirStatsOnly >= 2) {
-                 if (cnt == 0) {
-                    printf("bMethods used:\n");
-                    }
-                 cnt++;
-                 printf("\t");
-                 utf_display(meth->class->name); 
-                 printf(".");
-                 method_display(meth);
-                       printf("\t\t");
-                 if (meth->monoPoly != MONO) printf("\t\tRedefs used/total<%i/%i>\t", meth->subRedefsUsed, meth->subRedefs);
-                    if ( (XTAOPTbypass3) || (opt_xta)) {
-                       if (meth->xta->XTAclassSet == NULL)
-                               printf("class set never created\n");
-                       else
-                               printSet(meth->xta->XTAclassSet->head);
-                       }
-                 }
-              }
-            }
-         if (pClassHeirStatsOnly >= 2) {
-          if (cnt > 0) printf("> %i of %i methods used\n",cnt, class->methodscount);
-          }
-         }
-
-    for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
-       printRTClassHeirarchy(subs);
-        }
-}
-/*--------------------------------------------------------------*/
-void printRTInterfaceClasses() {
-  int mm;
-  classinfo *ci = class_java_lang_Object;
-  classSetNode *subs;
-
-  int RTmethodInterfaceClassImplementedCnt     = 0;
-  int RTmethodInterfaceClassUsedCnt            = 0;
-
-  int RTmethodInterfaceMethodTotalCnt          = 0;
-  int RTmethodInterfaceMethodNotUsedCnt        = 0;
-  int RTmethodInterfaceMethodUsedCnt           = 0;
-
-  int RTmethodClassesImpldByTotalCnt           = 0;
-
-  int RTmethodInterfaceMonoCnt                 = 0;
-  int RTmethodInterfacePolyReallyMonoCnt=0;  /* look at every method that implments and see if its poly or mono1*/
-
-  int RTmethodNoSubsAbstractCnt = 0;
-
-for (subs = ci->impldBy; subs != NULL; subs = subs->nextClass) {
-        classinfo * ici = subs->classType;
-       classinfo * isubs = subs->classType;
-       classSetNode * inBy;
-       int impldBycnt;
-
-       if (isubs->sub == NULL) RTmethodNoSubsAbstractCnt++;
-       if (pClassHeir >= 2) {
-               printf("Interface class: ");fflush(stdout);
-                       utf_display(ici->name); printf("\t#Methods=%i",ici->methodscount);
-               }
-       RTmethodInterfaceClassImplementedCnt++;
-       if (ici -> classUsed == USED)     {RTmethodInterfaceClassUsedCnt++;}
-       if (pClassHeir >= 2) {
-               printf("\n\t\t\tImplemented by classes:\n");
-               }
-       impldBycnt = 0;
-       /* get the total impldBy classes Used */
-       for (inBy = ici->impldBy; inBy != NULL; inBy = inBy->nextClass) {
-               impldBycnt++;
-               RTmethodClassesImpldByTotalCnt++;
-               if (pClassHeir >= 2) {
-                       printf("\t\t\t");utf_display(inBy->classType->name);
-                       printf("\n");
-                       }
-               if (inBy->classType->classUsed == NOTUSED) 
-                       panic("printRTInterfaceClasses: class in the implemented list without being used!!!??");
-               }
-       if (pClassHeir >= 2) {
-               printf("\t\t\tImpld by: %i\n",impldBycnt);
-               }
-       if (impldBycnt== 1) RTmethodInterfaceMonoCnt++;
-
-        /* if interface class is used */
-        if (ici -> classUsed != NOTUSED) {
-               if (pClassHeir >= 2) {
-                       printf("    cMethods used:\n");
-                       }
-
-                /* for each interface method implementation that has been used */
-                for (mm=0; mm< ici->methodscount; mm++) {
-                        methodinfo *imi = &(ici->methods[mm]);
-                       RTmethodInterfaceMethodTotalCnt++;
-                       if  (imi->methodUsed != USED) {
-                               RTmethodInterfaceMethodNotUsedCnt++;
-                               }
-                        if  (imi->methodUsed == USED) {
-                       RTmethodInterfaceMethodUsedCnt++;
-                               if (pClassHeirStatsOnly >= 2) {
-                                       printf("\t\t"); 
-                                       utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
-                                       }
-                               if (impldBycnt == 1) {
-                                       classinfo  *cii;
-                                       methodinfo *mii;
-
-                                       /* if only 1 implementing class then possibly really mono call */
-                                       inBy = ici->impldBy;
-                                       cii = inBy->classType;
-                                               
-                                       mii = class_findmethod(cii, imi->name, imi->descriptor); 
-                                       if (mii == NULL) {
-                                               /* assume its resolved up the heirarchy and just 1 possiblity so MONO1 */
-                                               imi->monoPoly = MONO1;
-                                               RTmethodInterfacePolyReallyMonoCnt++;
-                                               }
-                                       else    {
-                                               if (imi->monoPoly != POLY) 
-                                                       panic ("interface monopoly not POLY");
-
-                                               if (mii->monoPoly != POLY) {
-                                                       imi->monoPoly = MONO1;
-                                                       RTmethodInterfacePolyReallyMonoCnt++;
-                                                       }
-                                               else    {
-                                                       imi->monoPoly = POLY;
-                                                       }
-                                               }
-                                       }
-                                }
-                        }
-               if (pClassHeir >= 2) {
-                       printf("\n");
-                       }
-                }
-        }
-if (pClassHeirStatsOnly >= 1) {
-       printf("\n\n  >>>>>>>>>>>>>>>>>>>>  Interface Statistics Summary: \n");
-       printf("Classes:  Total:   %i \tUSED:      %i \tIMPLD BY:   \t%i \tJUST 1 IMPLD BY:  %i \tNOSUB:     %i \n",
-               RTmethodInterfaceClassImplementedCnt,
-               RTmethodInterfaceClassUsedCnt,RTmethodClassesImpldByTotalCnt, RTmethodInterfaceMonoCnt,
-               RTmethodNoSubsAbstractCnt);
-       printf("Methods:  Total:   %i \tNOTUSED:   %i  \tUSED:      \t%i \tPoly that resolves to Mono  %i \n",
-               RTmethodInterfaceMethodTotalCnt,
-               RTmethodInterfaceMethodNotUsedCnt,RTmethodInterfaceMethodUsedCnt, RTmethodInterfacePolyReallyMonoCnt);
-       }
-}
-/*--------------------------------------------------------------*/
-
-void printRThierarchyInfo(methodinfo *m) {
-
-  /*-- init for statistics --*/
-  RTclassHeirNotUsedCnt=0; 
-  RTclassHeirUsedCnt=0;    
-  RTclassHeirPartUsedCnt=0;   
-  RTclassHeirSuperCnt=0;   
-  RTmethodNotUsedCnt = 0; 
-  RTmethodNotUsedCnt1 = 0; 
-  RTmethodNotUsedCnt2 = 0;  
-  RTmethodUsedCnt = 0;   
-  RTmethodMarkedCnt= 0;  
-
-
-  /*-- --*/
-  if (pClassHeirStatsOnly >= 2) {
-    printf("\nRT Class Hierarchy for ");
-    printf("--- start of RT info --------------- after :\n");
-    if (m != NULL) {
-       utf_display(m->class->name); 
-        printf(".");
-        method_display(m);
-       printf("\n");
-       }
-    }
-  printRTClassHeirarchy(class_java_lang_Object);
-  if (pClassHeirStatsOnly >= 2) {
-    printf("--- end  of RT info ---------------\n");
-    }
- if (pClassHeirStatsOnly >= 1) {
-
-  /*--  statistic results --*/
-  printRTInterfaceClasses();
-       
-  printf("\n  >>>>>>>>>>>>>>>>>>>>  Analysed Class Hierarchy Statistics:\n"); 
-  printf(" Used            \t%i \tclasses\t/ Used       \t%i methods \t of USED: %i%% \t  of ALL: %i%% \n",
-               RTclassHeirUsedCnt,RTmethodUsedCnt,
-               ((100*RTmethodUsedCnt)/(RTmethodUsedCnt + RTmethodNotUsedCnt2)) ,
-               ((100*RTmethodUsedCnt)/ (RTmethodNotUsedCnt    + RTmethodUsedCnt    + RTmethodMarkedCnt)) );
-  printf(" Part Used       \t%i \tclasses\t/\n",RTclassHeirPartUsedCnt); 
-  printf(" Not Used        \t%i \tclasses\t/\n\n",RTclassHeirNotUsedCnt); 
-  printf("                 \t    \t       \t/ Just Marked \t%i methods\n\n",RTmethodMarkedCnt); 
-  printf(" In Not Used     \t    \tclasses\t/ Not Used    \t%i methods\n",RTmethodNotUsedCnt1); 
-  printf(" In Used         \t    \tclasses\t/ Not Used    \t%i methods\n",RTmethodNotUsedCnt2);
-  printf(" Total           \t%i \tclasses\t/ Total       \t%i methods\n\n",
-       RTclassHeirNotUsedCnt + RTclassHeirUsedCnt + RTclassHeirPartUsedCnt,  
-       RTmethodNotUsedCnt1 + RTmethodNotUsedCnt2    + RTmethodUsedCnt    + RTmethodMarkedCnt ); 
-
-  printf(" Mono vs. Polymorphic calls:\n");
-  printf(" Mono calls     \t%i   \tPoly that resolves to Mono \t%i \tPoly calls     \t%i\n\n",
-          RTmethodMono, RTmethodPolyReallyMono, RTmethodPoly);
-
-  printf(" No Subs: Total=\t%i   \tAbstract No Subs=           \t%i \tAbstract methods used =\t%i\n",
-         RTmethodNoSubs, RTmethodNoSubsAbstract, RTmethodAbstract);
-
-  printf(" Inlining possible:  \tFINALs %i \tSTATICs %i \t FINAL & STATIC %i \t Class has No Subs %i \n",
-       RTmethodFinal, RTmethodStatic,RTmethodFinalStatic,  RTmethodNoSubs);
-  printf("    Code size < 100  \tFINALs %i \tSTATICs %i \t FINAL & STATIC %i \t Class has No Subs %i \n",
-       RTmethodFinal100, RTmethodStatic100,RTmethodFinalStatic100,  RTmethodNoSubs100);
-  }
-}
 
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/reg.c b/jit/reg.c
deleted file mode 100644 (file)
index 744c943..0000000
--- a/jit/reg.c
+++ /dev/null
@@ -1,1269 +0,0 @@
-/* jit/reg.c *******************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       The register-manager.
-
-       Authors:  Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/09
-
-*******************************************************************************/
-
-static varinfo5 *locals;
-static varinfo5 *interfaces;
-
-static int intregsnum;              /* absolute number of integer registers   */
-static int floatregsnum;            /* absolute number of float registers     */
-
-static int intreg_ret;              /* register to return integer values      */
-static int intreg_argnum;           /* number of integer argument registers   */
-
-static int floatreg_ret;            /* register for return float values       */
-static int fltreg_argnum;           /* number of float argument registers     */
-
-
-static int *argintregs;             /* scratch integer registers              */
-static int *tmpintregs = NULL;      /* scratch integer registers              */
-static int *savintregs;             /* saved integer registers                */
-static int *argfltregs;             /* scratch float registers                */
-static int *tmpfltregs;             /* scratch float registers                */
-static int *savfltregs;             /* saved float registers                  */
-static int *freeargintregs;         /* free argument integer registers        */
-static int *freetmpintregs;         /* free scratch integer registers         */
-static int *freesavintregs;         /* free saved integer registers           */
-static int *freeargfltregs;         /* free argument float registers          */
-static int *freetmpfltregs;         /* free scratch float registers           */
-static int *freesavfltregs;         /* free saved float registers             */
-
-#ifdef USETWOREGS
-static int *secondregs;             /* used for longs in 2 32 bit registers   */
-#endif
-
-static int *freemem;                /* free scratch memory                    */
-static int memuse;                  /* used memory count                      */
-static int ifmemuse;                /* interface used memory count            */
-static int maxmemuse;               /* maximal used memory count (spills)     */
-static int freememtop;              /* free memory count                      */
-
-static int tmpintregcnt;            /* scratch integer register count         */
-static int savintregcnt;            /* saved integer register count           */
-static int tmpfltregcnt;            /* scratch float register count           */
-static int savfltregcnt;            /* saved float register count             */
-
-static int iftmpintregcnt;          /* iface scratch integer register count   */
-static int ifsavintregcnt;          /* iface saved integer register count     */
-static int iftmpfltregcnt;          /* iface scratch float register count     */
-static int ifsavfltregcnt;          /* iface saved float register count       */
-
-static int argintreguse;            /* used argument integer register count   */
-static int tmpintreguse;            /* used scratch integer register count    */
-static int savintreguse;            /* used saved integer register count      */
-static int argfltreguse;            /* used argument float register count     */
-static int tmpfltreguse;            /* used scratch float register count      */
-static int savfltreguse;            /* used saved float register count        */
-
-static int maxargintreguse;         /* max used argument int register count   */
-static int maxtmpintreguse;         /* max used scratch int register count    */
-static int maxsavintreguse;         /* max used saved int register count      */
-static int maxargfltreguse;         /* max used argument float register count */
-static int maxtmpfltreguse;         /* max used scratch float register count  */
-static int maxsavfltreguse;         /* max used saved float register count    */
-
-static int freearginttop;           /* free argument integer register count   */
-static int freetmpinttop;           /* free scratch integer register count    */
-static int freesavinttop;           /* free saved integer register count      */
-static int freeargflttop;           /* free argument float register count     */
-static int freetmpflttop;           /* free scratch float register count      */
-static int freesavflttop;           /* free saved float register count        */
-
-static int savedregs_num;              /* total number of registers to be saved      */
-static int arguments_num;       /* size of parameter field in the stackframe  */
-
-
-
-/* function reg_init ***********************************************************
-
-       initialises the register-allocator
-       
-*******************************************************************************/
-
-static void reg_init()
-{
-       int n;
-       
-       if (!tmpintregs) {
-
-               if (TYPE_INT != 0 || TYPE_ADR != 4) 
-                       panic ("JAVA-Basictypes have been changed");
-
-               intreg_argnum = 0;
-               tmpintregcnt = 0;
-               savintregcnt = 0;
-
-               for (intregsnum = 0; nregdescint[intregsnum] != REG_END; intregsnum++) {
-                       switch (nregdescint[intregsnum]) {
-                               case REG_SAV: savintregcnt++;
-                                             break;
-                               case REG_TMP: tmpintregcnt++;
-                                             break;
-                               case REG_ARG: intreg_argnum++;
-                               }
-                       }
-
-               argintregs = MNEW (int, intreg_argnum);
-               tmpintregs = MNEW (int, tmpintregcnt);
-               savintregs = MNEW (int, savintregcnt);
-               freeargintregs = MNEW (int, intreg_argnum);
-               freetmpintregs = MNEW (int, tmpintregcnt);
-               freesavintregs = MNEW (int, savintregcnt);
-#ifdef USETWOREGS
-               secondregs = MNEW (int, intregsnum);
-#endif
-
-               intreg_argnum = 0;
-               argintreguse = 0;
-               tmpintreguse = 0;
-               savintreguse = 0;
-
-               for (n = 0; n < intregsnum; n++) {
-                       switch (nregdescint[n]) {
-                               case REG_RET: intreg_ret = n; 
-                                             break;
-                               case REG_SAV: savintregs[savintreguse++] = n;
-                                             break;
-                               case REG_TMP: tmpintregs[tmpintreguse++] = n;
-                                             break;
-                               case REG_ARG: argintregs[intreg_argnum++] = n;
-                                                            argintreguse++;
-                                             break;
-                               }
-                       }
-
-#if defined(__X86_64__)
-               /* 
-                * on x86_64 the argument registers are not in ascending order 
-                * a00 (%rdi) <-> a03 (%rcx) and a01 (%rsi) <-> a02 (%rdx)
-                */
-
-               n = argintregs[3];
-               argintregs[3] = argintregs[0];
-               argintregs[0] = n;
-
-               n = argintregs[2];
-               argintregs[2] = argintregs[1];
-               argintregs[1] = n;
-#endif
-               
-#ifdef USETWOREGS
-               for (n = 1; n < intreg_argnum; n++)
-                       secondregs[argintregs[n-1]] = argintregs[n];
-               for (n = 1; n < tmpintregcnt; n++)
-                       secondregs[tmpintregs[n-1]] = tmpintregs[n];
-               for (n = 1; n < savintregcnt; n++)
-                       secondregs[savintregs[n-1]] = savintregs[n];
-               secondregs[REG_ITMP1] = REG_ITMP2;
-               secondregs[REG_ITMP3] = REG_ITMP2;
-               secondregs[REG_RESULT] = REG_RESULT+1;
-               secondregs[argintregs[intreg_argnum-1]] = REG_ITMP3;
-#endif
-
-               fltreg_argnum = 0;
-               tmpfltregcnt = 0;
-               savfltregcnt = 0;
-
-               for (floatregsnum = 0; nregdescfloat[floatregsnum] != REG_END; floatregsnum++) {
-                       switch (nregdescfloat[floatregsnum]) {
-                               case REG_SAV: savfltregcnt++;
-                                             break;
-                               case REG_TMP: tmpfltregcnt++;
-                                             break;
-                               case REG_ARG: fltreg_argnum++;
-                                             break;
-                               }
-                       }
-
-               argfltregs = MNEW (int, fltreg_argnum);
-               tmpfltregs = MNEW (int, tmpfltregcnt);
-               savfltregs = MNEW (int, savfltregcnt);
-               freeargfltregs = MNEW (int, fltreg_argnum);
-               freetmpfltregs = MNEW (int, tmpfltregcnt);
-               freesavfltregs = MNEW (int, savfltregcnt);
-
-               fltreg_argnum = 0;
-               argfltreguse = 0;
-               tmpfltreguse = 0;
-               savfltreguse = 0;
-
-               for (n = 0; n < floatregsnum; n++) {
-                       switch (nregdescfloat[n]) {
-                               case REG_RET: floatreg_ret = n; 
-                                             break;
-                               case REG_SAV: savfltregs[savfltreguse++] = n;
-                                             break;
-                               case REG_TMP: tmpfltregs[tmpfltreguse++] = n;
-                                             break;
-                               case REG_ARG: argfltregs[fltreg_argnum++] = n;
-                                         argfltreguse++;
-                                             break;
-                               }
-                       }
-                                       
-               }
-
-}
-
-
-/* function reg_close **********************************************************
-
-       releases all allocated space for registers
-
-*******************************************************************************/
-
-static void reg_close ()
-{
-       if (argintregs) MFREE (argintregs, int, intreg_argnum);
-       if (argfltregs) MFREE (argfltregs, int, fltreg_argnum);
-       if (tmpintregs) MFREE (tmpintregs, int, tmpintregcnt);
-       if (savintregs) MFREE (savintregs, int, savintregcnt);
-       if (tmpfltregs) MFREE (tmpfltregs, int, tmpfltregcnt);
-       if (savfltregs) MFREE (savfltregs, int, savfltregcnt);
-
-       if (freeargintregs) MFREE (freeargintregs, int, intreg_argnum);
-       if (freeargfltregs) MFREE (freeargfltregs, int, fltreg_argnum);
-       if (freetmpintregs) MFREE (freetmpintregs, int, tmpintregcnt);
-       if (freesavintregs) MFREE (freesavintregs, int, savintregcnt);
-       if (freetmpfltregs) MFREE (freetmpfltregs, int, tmpfltregcnt);
-       if (freesavfltregs) MFREE (freesavfltregs, int, savfltregcnt);
-
-#ifdef USETWOREGS
-       if (secondregs) MFREE (secondregs, int, intregsnum);
-#endif
-}
-
-
-/* function local_init *********************************************************
-
-       initialises the local variable and interfaces table
-       
-*******************************************************************************/
-
-static void local_init()
-{
-       int i;
-       varinfo5 *v;
-
-       freemem    = DMNEW(int, maxstack);
-       locals     = DMNEW(varinfo5, maxlocals);
-       interfaces = DMNEW(varinfo5, maxstack);
-
-       for (v = locals, i = maxlocals; i > 0; v++, i--) {
-               v[0][TYPE_INT].type = -1;
-               v[0][TYPE_LNG].type = -1;
-               v[0][TYPE_FLT].type = -1;
-               v[0][TYPE_DBL].type = -1;
-               v[0][TYPE_ADR].type = -1;
-               }
-
-       for (v = interfaces, i = maxstack; i > 0; v++, i--) {
-               v[0][TYPE_INT].type = -1;
-               v[0][TYPE_INT].flags = 0;
-               v[0][TYPE_LNG].type = -1;
-               v[0][TYPE_LNG].flags = 0;
-               v[0][TYPE_FLT].type = -1;
-               v[0][TYPE_FLT].flags = 0;
-               v[0][TYPE_DBL].type = -1;
-               v[0][TYPE_DBL].flags = 0;
-               v[0][TYPE_ADR].type = -1;
-               v[0][TYPE_ADR].flags = 0;
-               }
-}
-
-
-/* function interface_regalloc *************************************************
-
-       allocates registers for all interface variables
-       
-*******************************************************************************/
-       
-static void interface_regalloc ()
-{
-       int     s, t, saved;
-       int     intalloc, fltalloc;
-       varinfo *v;
-       int             regsneeded = 0;
-       
-       /* allocate stack space for passing arguments to called methods */
-
-#ifndef SPECIALMEMUSE
-#if defined(__X86_64__)
-       /*
-        * XXX: we have a problem here, but allocating a little more stack space
-        *      is better than having a bug
-        */
-/*     if (arguments_num > (intreg_argnum + fltreg_argnum)) */
-/*             ifmemuse = arguments_num - (intreg_argnum + fltreg_argnum); */
-       if (arguments_num > fltreg_argnum)
-               ifmemuse = arguments_num - fltreg_argnum;
-#else
-       if (arguments_num > intreg_argnum)
-               ifmemuse = arguments_num - intreg_argnum;
-#endif
-       else
-               ifmemuse = 0;
-#endif
-
-       iftmpintregcnt = tmpintregcnt;
-       ifsavintregcnt = savintregcnt;
-       iftmpfltregcnt = tmpfltregcnt;
-       ifsavfltregcnt = savfltregcnt;
-
-       for (s = 0; s < maxstack; s++) {
-               intalloc = -1; fltalloc = -1;
-               saved = (interfaces[s][TYPE_INT].flags | interfaces[s][TYPE_LNG].flags |
-                        interfaces[s][TYPE_FLT].flags | interfaces[s][TYPE_DBL].flags |
-                        interfaces[s][TYPE_ADR].flags) & SAVEDVAR;
-               for (t = TYPE_INT; t <= TYPE_ADR; t++) {
-                       v = &interfaces[s][t];
-                       if (v->type >= 0) {
-#ifdef USETWOREGS
-                               regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
-#endif
-                               if (!saved) {
-                                       if (IS_FLT_DBL_TYPE(t)) {
-                                               if (fltalloc >= 0) {
-                                                       v->flags |= interfaces[s][fltalloc].flags & INMEMORY;
-                                                       v->regoff = interfaces[s][fltalloc].regoff;
-                                                       }
-                                               else if (iftmpfltregcnt > 0) {
-                                                       iftmpfltregcnt--;
-                                                       v->regoff = tmpfltregs[iftmpfltregcnt];
-                                                       }
-                                               else if (ifsavfltregcnt > 0) {
-                                                       ifsavfltregcnt--;
-                                                       v->regoff = savfltregs[ifsavfltregcnt];
-                                                       }
-                                               else {
-                                                       v->flags |= INMEMORY;
-                                                       v->regoff = ifmemuse;
-                                                       ifmemuse += regsneeded+1;
-                                                       }
-                                               fltalloc = t;
-                                               }
-                                       else {
-#if defined(__I386__)
-                                               /*
-                                                * for i386 put all longs in memory
-                                                */
-                                               if (IS_2_WORD_TYPE(t)) {
-                                                       v->flags |= INMEMORY;
-                                                       v->regoff = ifmemuse++;
-                                               } else {
-#endif
-                                               if (intalloc >= 0) {
-                                                       v->flags |= interfaces[s][intalloc].flags & INMEMORY;
-                                                       v->regoff = interfaces[s][intalloc].regoff;
-                                                       }
-                                               else if (iftmpintregcnt > regsneeded) {
-                                                       iftmpintregcnt -= regsneeded+1;
-                                                       v->regoff = tmpintregs[iftmpintregcnt];
-                                                       }
-                                               else if (ifsavintregcnt > regsneeded) {
-                                                       ifsavintregcnt -= regsneeded+1;
-                                                       v->regoff = savintregs[ifsavintregcnt];
-                                                       }
-                                               else {
-                                                       v->flags |= INMEMORY;
-                                                       v->regoff = ifmemuse;
-                                                       ifmemuse += regsneeded+1;
-                                                       }
-#if defined(__I386__)
-                                               }
-#endif
-                                               intalloc = t;
-                                               }
-                                       }
-                               else {
-                                       if (IS_FLT_DBL_TYPE(t)) {
-                                               if (fltalloc >= 0) {
-                                                       v->flags |= interfaces[s][fltalloc].flags & INMEMORY;
-                                                       v->regoff = interfaces[s][fltalloc].regoff;
-                                                       }
-                                               else if (ifsavfltregcnt > 0) {
-                                                       ifsavfltregcnt--;
-                                                       v->regoff = savfltregs[ifsavfltregcnt];
-                                                       }
-                                               else {
-                                                       v->flags |= INMEMORY;
-                                                       v->regoff = ifmemuse;
-                                                       ifmemuse += regsneeded+1;
-                                                       }
-                                               fltalloc = t;
-                                               }
-                                       else {
-#if defined(__I386__)
-                                               /*
-                                                * for i386 put all longs in memory
-                                                */
-                                               if (IS_2_WORD_TYPE(t)) {
-                                                       v->flags |= INMEMORY;
-                                                       v->regoff = ifmemuse++;
-                                               } else {
-#endif
-                                               if (intalloc >= 0) {
-                                                       v->flags |= interfaces[s][intalloc].flags & INMEMORY;
-                                                       v->regoff = interfaces[s][intalloc].regoff;
-                                                       }
-                                               else if (ifsavintregcnt > regsneeded) {
-                                                       ifsavintregcnt -= regsneeded+1;
-                                                       v->regoff = savintregs[ifsavintregcnt];
-                                                       }
-                                               else {
-                                                       v->flags |= INMEMORY;
-                                                       v->regoff = ifmemuse;
-                                                       ifmemuse += regsneeded+1;
-                                                       }
-#if defined(__I386__)
-                                               }
-#endif
-                                               intalloc = t;
-                                               }
-                                       }
-                               } /* if (type >= 0) */
-                       }     /* for t */
-               }         /* for s */
-
-       maxmemuse = ifmemuse;
-       maxtmpintreguse = iftmpintregcnt;
-       maxsavintreguse = ifsavintregcnt;
-       maxtmpfltreguse = iftmpfltregcnt;
-       maxsavfltreguse = ifsavfltregcnt;
-
-}
-
-
-/* function local_regalloc *****************************************************
-
-       allocates registers for all local variables
-       
-*******************************************************************************/
-       
-static void local_regalloc ()
-{
-       int      s, t, tt;
-       int      intalloc, fltalloc;
-       varinfo *v;
-       int      regsneeded = 0;
-       int typeloop[] = { TYPE_LNG, TYPE_DBL, TYPE_INT, TYPE_FLT, TYPE_ADR };
-       
-       if (isleafmethod) {
-               int arg, doublewordarg, iargcnt, fargcnt;
-
-               arg = 0, iargcnt = 0, fargcnt = 0;
-               doublewordarg = 0;
-               for (s = 0; s < maxlocals; s++) {
-                       intalloc = -1; fltalloc = -1;
-                       for (tt = 0; tt <= 4; tt++) {
-                               t = typeloop[tt];
-                               v = &locals[s][t];
-
-                               if (v->type >= 0) {
-#ifdef USETWOREGS
-                                       regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
-#endif
-                                       if (IS_FLT_DBL_TYPE(t)) {
-#if !defined(CONSECUTIVE_FLOATARGS)
-                                               fargcnt = arg;
-#endif
-                                               if (fltalloc >= 0) {
-                                                       v->flags = locals[s][fltalloc].flags;
-                                                       v->regoff = locals[s][fltalloc].regoff;
-                                               }
-                                               else if (!doublewordarg && (arg < mparamcount)
-                                                                && (fargcnt < fltreg_argnum)) {
-                                                       v->flags = 0;
-                                                       v->regoff = argfltregs[fargcnt];
-                                               }
-                                               else if (maxtmpfltreguse > 0) {
-                                                       maxtmpfltreguse--;
-                                                       v->flags = 0;
-                                                       v->regoff = tmpfltregs[maxtmpfltreguse];
-                                               }
-                                               else if (maxsavfltreguse > 0) {
-                                                       maxsavfltreguse--;
-                                                       v->flags = 0;
-                                                       v->regoff = savfltregs[maxsavfltreguse];
-                                               }
-                                               else {
-                                                       v->flags = INMEMORY;
-                                                       v->regoff = maxmemuse;
-                                                       maxmemuse += regsneeded+1;
-                                               }
-                                               fltalloc = t;
-
-                                       } else {
-                                               int regtouse;
-#if defined(__I386__)
-                                               /*
-                                                * for i386 put all longs in memory
-                                                */
-                                               if (IS_2_WORD_TYPE(t)) {
-                                                       v->flags = INMEMORY;
-                                                       v->regoff = maxmemuse++;
-                                               } else {
-#endif
-#if !defined(CONSECUTIVE_INTARGS)
-                                                       iargcnt = arg;
-#endif
-                                                       if (intalloc >= 0) {
-                                                               v->flags = locals[s][intalloc].flags;
-                                                               v->regoff = locals[s][intalloc].regoff;
-                                                       }
-                                                       else if (!doublewordarg && (arg < mparamcount)
-#ifndef USETWOREGS
-                                                                        && ((regtouse = iargcnt) < intreg_argnum)
-#else
-                                                                        && ((regtouse = s) < intreg_argnum - regsneeded)
-#endif
-                                                                        ) {
-                                                               v->flags = 0;
-                                                               v->regoff = argintregs[regtouse];
-                                                       }
-                                                       else if (maxtmpintreguse > regsneeded) {
-                                                               maxtmpintreguse -= regsneeded + 1;
-                                                               v->flags = 0;
-                                                               v->regoff = tmpintregs[maxtmpintreguse];
-                                                       }
-                                                       else if (maxsavintreguse > regsneeded) {
-                                                               maxsavintreguse -= regsneeded + 1;
-                                                               v->flags = 0;
-                                                               v->regoff = savintregs[maxsavintreguse];
-                                                       }
-                                                       /*
-                                                        * use unused argument registers as local registers
-                                                        */
-                                                       else if (!doublewordarg && (arg >= mparamcount)
-                                                                        && (iargcnt < intreg_argnum)) {
-                                                               v->flags = 0;
-                                                               v->regoff = argintregs[iargcnt];
-                                                               iargcnt++;
-                                                               arg++;
-                                                       }
-                                                       else {
-                                                               v->flags = INMEMORY;
-                                                               v->regoff = maxmemuse;
-                                                               maxmemuse += regsneeded+1;
-                                                       }
-#if defined(__I386__)
-                                               }
-#endif
-                                               intalloc = t;
-                                       }
-                               }
-                       }
-                       if (arg < mparamcount) {
-                               if (doublewordarg) {
-                                       doublewordarg = 0;
-                                       /* what type was the double arg? */
-                                       if (IS_FLT_DBL_TYPE(mparamtypes[arg])) {
-                                               fargcnt++;
-
-                                       } else {
-                                               iargcnt++;
-                                       }
-                                       arg++;
-
-                               } else if (IS_2_WORD_TYPE(mparamtypes[arg])) {
-                                       doublewordarg = 1;
-
-                               } else {
-                                       if (IS_FLT_DBL_TYPE(mparamtypes[arg])) {
-                                               fargcnt++;
-
-                                       } else {
-                                               iargcnt++;
-                                       }
-                                       arg++;
-                               }
-                       }
-               }
-               return;
-       }
-
-       for (s = 0; s < maxlocals; s++) {
-               intalloc = -1; fltalloc = -1;
-               for (tt=0; tt<=4; tt++) {
-                       t = typeloop[tt];
-                       v = &locals[s][t];
-                       if (v->type >= 0) {
-#ifdef USETWOREGS
-                               regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
-#endif
-                               if (IS_FLT_DBL_TYPE(t)) {
-                                       if (fltalloc >= 0) {
-                                               v->flags = locals[s][fltalloc].flags;
-                                               v->regoff = locals[s][fltalloc].regoff;
-                                               }
-                                       else if (maxsavfltreguse > 0) {
-                                               maxsavfltreguse--;
-                                               v->flags = 0;
-                                               v->regoff = savfltregs[maxsavfltreguse];
-                                               }
-                                       else {
-                                               v->flags = INMEMORY;
-                                               v->regoff = maxmemuse;
-                                               maxmemuse += regsneeded+1;
-                                               }
-                                       fltalloc = t;
-                                       }
-                               else {
-#if defined(__I386__)
-                                       /*
-                                        * for i386 put all longs in memory
-                                        */
-                                       if (IS_2_WORD_TYPE(t)) {
-                                               v->flags = INMEMORY;
-                                               v->regoff = maxmemuse++;
-                                       } else {
-#endif
-                                       if (intalloc >= 0) {
-                                               v->flags = locals[s][intalloc].flags;
-                                               v->regoff = locals[s][intalloc].regoff;
-                                               }
-                                       else if (maxsavintreguse > regsneeded) {
-                                               maxsavintreguse -= regsneeded+1;
-                                               v->flags = 0;
-                                               v->regoff = savintregs[maxsavintreguse];
-                                               }
-                                       else {
-                                               v->flags = INMEMORY;
-                                               v->regoff = maxmemuse;
-                                               maxmemuse += regsneeded+1;
-                                               }
-#if defined(__I386__)
-                                       }
-#endif
-                                       intalloc = t;
-                                       }
-                               }
-                       }
-               }
-}
-
-
-static void reg_init_temp()
-{
-       freememtop = 0;
-       memuse = ifmemuse;
-
-       freearginttop = 0;
-       freetmpinttop = 0;
-       freesavinttop = 0;
-       freeargflttop = 0;
-       freetmpflttop = 0;
-       freesavflttop = 0;
-
-       tmpintreguse = iftmpintregcnt;
-       savintreguse = ifsavintregcnt;
-       tmpfltreguse = iftmpfltregcnt;
-       savfltreguse = ifsavfltregcnt;
-
-       /*
-        * all argument registers are available
-        */
-       argintreguse = intreg_argnum;
-       argfltreguse = fltreg_argnum;
-}
-
-
-#define reg_new_temp(s) if (s->varkind == TEMPVAR) reg_new_temp_func(s)
-
-static void reg_new_temp_func(stackptr s)
-{
-       int regsneeded = 0;
-
-       /* Try to allocate a saved register if there is no temporary one available.   */
-       /* This is what happens during the second run.                                */
-       int tryagain = (s->flags & SAVEDVAR) ? 1 : 2;
-
-#ifdef USETWOREGS
-       regsneeded = (IS_2_WORD_TYPE(s->type)) ? 1 : 0;
-#endif
-
-       for(; tryagain; --tryagain) {
-               if (tryagain == 1) {
-                       if (!(s->flags & SAVEDVAR))
-                               s->flags |= SAVEDTMP;
-                       if (IS_FLT_DBL_TYPE(s->type)) {
-                               if (freesavflttop > 0) {
-                                       freesavflttop--;
-                                       s->regoff = freesavfltregs[freesavflttop];
-                                       return;
-                               }
-                               else if (savfltreguse > 0) {
-                                       savfltreguse--;
-                                       if (savfltreguse < maxsavfltreguse)
-                                               maxsavfltreguse = savfltreguse;
-                                       s->regoff = savfltregs[savfltreguse];
-                                       return;
-                               }
-                       }
-                       else {
-#if defined(__I386__)
-                               /*
-                                * for i386 put all longs in memory
-                                */
-                               if (!IS_2_WORD_TYPE(s->type)) {
-#endif
-                                       if (freesavinttop > regsneeded) {
-                                               freesavinttop -= regsneeded + 1;
-                                               s->regoff = freesavintregs[freesavinttop];
-                                               return;
-                                       }
-                                       else if (savintreguse > regsneeded) {
-                                               savintreguse -= regsneeded + 1;
-                                               if (savintreguse < maxsavintreguse)
-                                                       maxsavintreguse = savintreguse;
-                                               s->regoff = savintregs[savintreguse];
-                                               return;
-                                       }
-#if defined(__I386__)
-                               }
-#endif
-                       }
-               }
-               else {
-                       if (IS_FLT_DBL_TYPE(s->type)) {
-                               if (freetmpflttop > 0) {
-                                       freetmpflttop--;
-                                       s->regoff = freetmpfltregs[freetmpflttop];
-                                       return;
-                               }
-                               else if (tmpfltreguse > 0) {
-                                       tmpfltreguse--;
-                                       if (tmpfltreguse < maxtmpfltreguse)
-                                               maxtmpfltreguse = tmpfltreguse;
-                                       s->regoff = tmpfltregs[tmpfltreguse];
-                                       return;
-                               }
-                       }
-                       else {
-#if defined(__I386__)
-                               /*
-                                * for i386 put all longs in memory
-                                */
-                               if (!IS_2_WORD_TYPE(s->type)) {
-#endif
-                                       if (freetmpinttop > regsneeded) {
-                                               freetmpinttop -= regsneeded + 1;
-                                               s->regoff = freetmpintregs[freetmpinttop];
-                                               return;
-                                       }
-                                       else if (tmpintreguse > regsneeded) {
-                                               tmpintreguse -= regsneeded + 1;
-                                               if (tmpintreguse < maxtmpintreguse)
-                                                       maxtmpintreguse = tmpintreguse;
-                                               s->regoff = tmpintregs[tmpintreguse];
-                                               return;
-                                       }
-#if defined(__I386__)
-                               }
-#endif
-                       }
-               }
-       }
-
-       if (freememtop > regsneeded) {
-               freememtop -= regsneeded+1;
-               s->regoff = freemem[freememtop];
-       }
-       else {
-               s->regoff = memuse;
-               memuse += regsneeded+1;
-               if (memuse > maxmemuse)
-                       maxmemuse = memuse;
-       }
-       s->flags |= INMEMORY;
-}
-
-
-#define reg_free_temp(s) if (s->varkind == TEMPVAR) reg_free_temp_func(s)
-
-static void reg_free_temp_func(stackptr s)
-{
-       int regsneeded = 0;
-
-#ifdef USETWOREGS
-       regsneeded = (IS_2_WORD_TYPE(s->type)) ? 1 : 0;
-#endif
-
-       if (s->flags & INMEMORY) {
-               freemem[freememtop] = s->regoff;
-               if (regsneeded)
-                       freemem[freememtop + 1] = s->regoff + 1;
-               freememtop += regsneeded + 1;
-       }
-       else if (IS_FLT_DBL_TYPE(s->type)) {
-               if (s->flags & (SAVEDVAR | SAVEDTMP)) {
-                       s->flags &= ~SAVEDTMP;
-                       freesavfltregs[freesavflttop++] = s->regoff;
-               } else
-                       freetmpfltregs[freetmpflttop++] = s->regoff;
-       }
-       else {
-               if (s->flags & (SAVEDVAR | SAVEDTMP)) {
-                       s->flags &= ~SAVEDTMP;
-                       freesavintregs[freesavinttop] = s->regoff;
-#ifdef USETWOREGS
-                       if (regsneeded)
-                               freesavintregs[freesavinttop + 1] = secondregs[s->regoff];
-#endif
-                       freesavinttop += regsneeded + 1;
-               } else {
-                       freetmpintregs[freetmpinttop] = s->regoff;
-#ifdef USETWOREGS
-                       if (regsneeded)
-                               freetmpintregs[freetmpinttop + 1] = secondregs[s->regoff];
-#endif
-                       freetmpinttop += regsneeded + 1;
-               }
-       }
-}
-
-
-static void allocate_scratch_registers()
-{
-       int opcode, i, len;
-       stackptr    src, dst;
-       instruction *iptr = instr;
-       basicblock  *bptr;
-
-       /* b_count = block_count; */
-
-       bptr = block;
-       while (bptr != NULL) {
-
-               if (bptr->flags >= BBREACHED) {
-                       dst = bptr->instack;
-                       reg_init_temp();
-                       iptr = bptr->iinstr;
-                       len = bptr->icount;
-  
-                       while (--len >= 0)  {
-                               src = dst;
-                               dst = iptr->dst;
-                               opcode = iptr->opc;
-
-                               switch (opcode) {
-
-                                       /* pop 0 push 0 */
-
-                                       case ICMD_NOP:
-                                       case ICMD_ELSE_ICONST:
-                                       case ICMD_CHECKASIZE:
-                                       case ICMD_IINC:
-                                       case ICMD_JSR:
-                                       case ICMD_RET:
-                                       case ICMD_RETURN:
-                                       case ICMD_GOTO:
-                                               break;
-
-                                       /* pop 0 push 1 const */
-                                       
-                                       case ICMD_ICONST:
-                                       case ICMD_LCONST:
-                                       case ICMD_FCONST:
-                                       case ICMD_DCONST:
-                                       case ICMD_ACONST:
-
-                                       /* pop 0 push 1 load */
-                                       
-                                       case ICMD_ILOAD:
-                                       case ICMD_LLOAD:
-                                       case ICMD_FLOAD:
-                                       case ICMD_DLOAD:
-                                       case ICMD_ALOAD:
-                                               reg_new_temp(dst);
-                                               break;
-
-                                       /* pop 2 push 1 */
-
-                                       case ICMD_IALOAD:
-                                       case ICMD_LALOAD:
-                                       case ICMD_FALOAD:
-                                       case ICMD_DALOAD:
-                                       case ICMD_AALOAD:
-
-                                       case ICMD_BALOAD:
-                                       case ICMD_CALOAD:
-                                       case ICMD_SALOAD:
-
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               reg_new_temp(dst);
-                                               break;
-
-                                       /* pop 3 push 0 */
-
-                                       case ICMD_IASTORE:
-                                       case ICMD_LASTORE:
-                                       case ICMD_FASTORE:
-                                       case ICMD_DASTORE:
-                                       case ICMD_AASTORE:
-
-                                       case ICMD_BASTORE:
-                                       case ICMD_CASTORE:
-                                       case ICMD_SASTORE:
-
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               reg_free_temp(src->prev->prev);
-                                               break;
-
-                                       /* pop 1 push 0 store */
-
-                                       case ICMD_ISTORE:
-                                       case ICMD_LSTORE:
-                                       case ICMD_FSTORE:
-                                       case ICMD_DSTORE:
-                                       case ICMD_ASTORE:
-
-                                       /* pop 1 push 0 */
-
-                                       case ICMD_POP:
-
-                                       case ICMD_IRETURN:
-                                       case ICMD_LRETURN:
-                                       case ICMD_FRETURN:
-                                       case ICMD_DRETURN:
-                                       case ICMD_ARETURN:
-
-                                       case ICMD_ATHROW:
-
-                                       case ICMD_PUTSTATIC:
-
-                                       /* pop 1 push 0 branch */
-
-                                       case ICMD_IFNULL:
-                                       case ICMD_IFNONNULL:
-
-                                       case ICMD_IFEQ:
-                                       case ICMD_IFNE:
-                                       case ICMD_IFLT:
-                                       case ICMD_IFGE:
-                                       case ICMD_IFGT:
-                                       case ICMD_IFLE:
-
-                                       case ICMD_IF_LEQ:
-                                       case ICMD_IF_LNE:
-                                       case ICMD_IF_LLT:
-                                       case ICMD_IF_LGE:
-                                       case ICMD_IF_LGT:
-                                       case ICMD_IF_LLE:
-
-                                       /* pop 1 push 0 table branch */
-
-                                       case ICMD_TABLESWITCH:
-                                       case ICMD_LOOKUPSWITCH:
-
-                                       case ICMD_NULLCHECKPOP:
-                                       case ICMD_MONITORENTER:
-                                       case ICMD_MONITOREXIT:
-                                               reg_free_temp(src);
-                                               break;
-
-                                       /* pop 2 push 0 branch */
-
-                                       case ICMD_IF_ICMPEQ:
-                                       case ICMD_IF_ICMPNE:
-                                       case ICMD_IF_ICMPLT:
-                                       case ICMD_IF_ICMPGE:
-                                       case ICMD_IF_ICMPGT:
-                                       case ICMD_IF_ICMPLE:
-
-                                       case ICMD_IF_LCMPEQ:
-                                       case ICMD_IF_LCMPNE:
-                                       case ICMD_IF_LCMPLT:
-                                       case ICMD_IF_LCMPGE:
-                                       case ICMD_IF_LCMPGT:
-                                       case ICMD_IF_LCMPLE:
-
-                                       case ICMD_IF_ACMPEQ:
-                                       case ICMD_IF_ACMPNE:
-
-                                       /* pop 2 push 0 */
-
-                                       case ICMD_POP2:
-
-                                       case ICMD_PUTFIELD:
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               break;
-
-                                       /* pop 0 push 1 dup */
-                                       
-                                       case ICMD_DUP:
-                                               reg_new_temp(dst);
-                                               break;
-
-                                       /* pop 0 push 2 dup */
-                                       
-                                       case ICMD_DUP2:
-                                               reg_new_temp(dst->prev);
-                                               reg_new_temp(dst);
-                                               break;
-
-                                       /* pop 2 push 3 dup */
-                                       
-                                       case ICMD_DUP_X1:
-                                               reg_new_temp(dst->prev->prev);
-                                               reg_new_temp(dst->prev);
-                                               reg_new_temp(dst);
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               break;
-
-                                       /* pop 3 push 4 dup */
-                                       
-                                       case ICMD_DUP_X2:
-                                               reg_new_temp(dst->prev->prev->prev);
-                                               reg_new_temp(dst->prev->prev);
-                                               reg_new_temp(dst->prev);
-                                               reg_new_temp(dst);
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               reg_free_temp(src->prev->prev);
-                                               break;
-
-                                       /* pop 3 push 5 dup */
-                                       
-                                       case ICMD_DUP2_X1:
-                                               reg_new_temp(dst->prev->prev->prev->prev);
-                                               reg_new_temp(dst->prev->prev->prev);
-                                               reg_new_temp(dst->prev->prev);
-                                               reg_new_temp(dst->prev);
-                                               reg_new_temp(dst);
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               reg_free_temp(src->prev->prev);
-                                               break;
-
-                                       /* pop 4 push 6 dup */
-                                       
-                                       case ICMD_DUP2_X2:
-                                               reg_new_temp(dst->prev->prev->prev->prev->prev);
-                                               reg_new_temp(dst->prev->prev->prev->prev);
-                                               reg_new_temp(dst->prev->prev->prev);
-                                               reg_new_temp(dst->prev->prev);
-                                               reg_new_temp(dst->prev);
-                                               reg_new_temp(dst);
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               reg_free_temp(src->prev->prev);
-                                               reg_free_temp(src->prev->prev->prev);
-                                               break;
-
-                                       /* pop 2 push 2 swap */
-                                       
-                                       case ICMD_SWAP:
-                                               reg_new_temp(dst->prev);
-                                               reg_new_temp(dst);
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               break;
-
-                                       /* pop 2 push 1 */
-                                       
-                                       case ICMD_IADD:
-                                       case ICMD_ISUB:
-                                       case ICMD_IMUL:
-                                       case ICMD_IDIV:
-                                       case ICMD_IREM:
-
-                                       case ICMD_ISHL:
-                                       case ICMD_ISHR:
-                                       case ICMD_IUSHR:
-                                       case ICMD_IAND:
-                                       case ICMD_IOR:
-                                       case ICMD_IXOR:
-
-                                       case ICMD_LADD:
-                                       case ICMD_LSUB:
-                                       case ICMD_LMUL:
-                                       case ICMD_LDIV:
-                                       case ICMD_LREM:
-
-                                       case ICMD_LOR:
-                                       case ICMD_LAND:
-                                       case ICMD_LXOR:
-
-                                       case ICMD_LSHL:
-                                       case ICMD_LSHR:
-                                       case ICMD_LUSHR:
-
-                                       case ICMD_FADD:
-                                       case ICMD_FSUB:
-                                       case ICMD_FMUL:
-                                       case ICMD_FDIV:
-                                       case ICMD_FREM:
-
-                                       case ICMD_DADD:
-                                       case ICMD_DSUB:
-                                       case ICMD_DMUL:
-                                       case ICMD_DDIV:
-                                       case ICMD_DREM:
-
-                                       case ICMD_LCMP:
-                                       case ICMD_FCMPL:
-                                       case ICMD_FCMPG:
-                                       case ICMD_DCMPL:
-                                       case ICMD_DCMPG:
-                                               reg_free_temp(src);
-                                               reg_free_temp(src->prev);
-                                               reg_new_temp(dst);
-                                               break;
-
-                                       /* pop 1 push 1 */
-                                       
-                                       case ICMD_IADDCONST:
-                                       case ICMD_ISUBCONST:
-                                       case ICMD_IMULCONST:
-                                       case ICMD_IDIVPOW2:
-                                       case ICMD_IREMPOW2:
-                                       case ICMD_IREM0X10001:
-                                       case ICMD_IANDCONST:
-                                       case ICMD_IORCONST:
-                                       case ICMD_IXORCONST:
-                                       case ICMD_ISHLCONST:
-                                       case ICMD_ISHRCONST:
-                                       case ICMD_IUSHRCONST:
-
-                                       case ICMD_LADDCONST:
-                                       case ICMD_LSUBCONST:
-                                       case ICMD_LMULCONST:
-                                       case ICMD_LDIVPOW2:
-                                       case ICMD_LREMPOW2:
-                                       case ICMD_LREM0X10001:
-                                       case ICMD_LANDCONST:
-                                       case ICMD_LORCONST:
-                                       case ICMD_LXORCONST:
-                                       case ICMD_LSHLCONST:
-                                       case ICMD_LSHRCONST:
-                                       case ICMD_LUSHRCONST:
-
-                                       case ICMD_IFEQ_ICONST:
-                                       case ICMD_IFNE_ICONST:
-                                       case ICMD_IFLT_ICONST:
-                                       case ICMD_IFGE_ICONST:
-                                       case ICMD_IFGT_ICONST:
-                                       case ICMD_IFLE_ICONST:
-
-                                       case ICMD_INEG:
-                                       case ICMD_INT2BYTE:
-                                       case ICMD_INT2CHAR:
-                                       case ICMD_INT2SHORT:
-                                       case ICMD_LNEG:
-                                       case ICMD_FNEG:
-                                       case ICMD_DNEG:
-
-                                       case ICMD_I2L:
-                                       case ICMD_I2F:
-                                       case ICMD_I2D:
-                                       case ICMD_L2I:
-                                       case ICMD_L2F:
-                                       case ICMD_L2D:
-                                       case ICMD_F2I:
-                                       case ICMD_F2L:
-                                       case ICMD_F2D:
-                                       case ICMD_D2I:
-                                       case ICMD_D2L:
-                                       case ICMD_D2F:
-
-                                       case ICMD_CHECKCAST:
-
-                                       case ICMD_ARRAYLENGTH:
-                                       case ICMD_INSTANCEOF:
-
-                                       case ICMD_NEWARRAY:
-                                       case ICMD_ANEWARRAY:
-
-                                       case ICMD_GETFIELD:
-                                               reg_free_temp(src);
-                                               reg_new_temp(dst);
-                                               break;
-
-                                       /* pop 0 push 1 */
-                                       
-                                       case ICMD_GETSTATIC:
-
-                                       case ICMD_NEW:
-
-                                               reg_new_temp(dst);
-                                               break;
-
-                                       /* pop many push any */
-                                       
-                                       case ICMD_INVOKEVIRTUAL:
-                                       case ICMD_INVOKESPECIAL:
-                                       case ICMD_INVOKESTATIC:
-                                       case ICMD_INVOKEINTERFACE:
-                                               {
-                                               i = iptr->op1;
-                                               while (--i >= 0) {
-                                                       reg_free_temp(src);
-                                                       src = src->prev;
-                                                       }
-                                               if (((methodinfo*)iptr->val.a)->returntype != TYPE_VOID)
-                                                       reg_new_temp(dst);
-                                               break;
-                                               }
-
-                                       case ICMD_BUILTIN3:
-                                               reg_free_temp(src);
-                                               src = src->prev;
-                                       case ICMD_BUILTIN2:
-                                               reg_free_temp(src);
-                                               src = src->prev;
-                                       case ICMD_BUILTIN1:
-                                               reg_free_temp(src);
-                                               src = src->prev;
-                                               if (iptr->op1 != TYPE_VOID)
-                                                       reg_new_temp(dst);
-                                               break;
-
-                                       case ICMD_MULTIANEWARRAY:
-                                               i = iptr->op1;
-                                               while (--i >= 0) {
-                                                       reg_free_temp(src);
-                                                       src = src->prev;
-                                                       }
-                                               reg_new_temp(dst);
-                                               break;
-
-                                       default:
-                                               printf("ICMD %d at %d\n", iptr->opc, (int)(iptr-instr));
-                                               panic("Missing ICMD code during register allocation");
-                                       } /* switch */
-                               iptr++;
-                               } /* while instructions */
-                       } /* if */
-               bptr = bptr->next;
-       } /* while blocks */
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/jit/reg.h b/jit/reg.h
new file mode 100644 (file)
index 0000000..bbd454f
--- /dev/null
+++ b/jit/reg.h
@@ -0,0 +1,68 @@
+/* jit/reg.h - register allocator header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: reg.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _REG_H
+#define _REG_H
+
+/* global variables */
+extern varinfo5 *locals;
+extern varinfo5 *interfaces;
+extern int intreg_argnum;
+extern int arguments_num;
+
+
+/* function prototypes */
+void reg_init();
+void reg_close();
+void local_init();
+void regalloc();
+static void interface_regalloc();
+static void local_regalloc();
+static void allocate_scratch_registers();
+
+#endif /* _REG_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jit/reg.inc b/jit/reg.inc
new file mode 100644 (file)
index 0000000..009bbfc
--- /dev/null
@@ -0,0 +1,1307 @@
+/* jit/reg.inc - register allocator
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+
+   Changes: Stefan Ring
+            Christian Thalinger
+
+   $Id: reg.inc 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include "toolbox/memory.h"
+
+
+varinfo5 *locals;
+varinfo5 *interfaces;
+
+static int intregsnum;              /* absolute number of integer registers   */
+static int floatregsnum;            /* absolute number of float registers     */
+
+static int intreg_ret;              /* register to return integer values      */
+int intreg_argnum;                  /* number of integer argument registers   */
+
+static int floatreg_ret;            /* register for return float values       */
+static int fltreg_argnum;           /* number of float argument registers     */
+
+
+static int *argintregs;             /* scratch integer registers              */
+static int *tmpintregs;             /* scratch integer registers              */
+static int *savintregs;             /* saved integer registers                */
+static int *argfltregs;             /* scratch float registers                */
+static int *tmpfltregs;             /* scratch float registers                */
+static int *savfltregs;             /* saved float registers                  */
+static int *freeargintregs;         /* free argument integer registers        */
+static int *freetmpintregs;         /* free scratch integer registers         */
+static int *freesavintregs;         /* free saved integer registers           */
+static int *freeargfltregs;         /* free argument float registers          */
+static int *freetmpfltregs;         /* free scratch float registers           */
+static int *freesavfltregs;         /* free saved float registers             */
+
+#ifdef USETWOREGS
+static int *secondregs;             /* used for longs in 2 32 bit registers   */
+#endif
+
+static int *freemem;                /* free scratch memory                    */
+static int memuse;                  /* used memory count                      */
+static int ifmemuse;                /* interface used memory count            */
+static int maxmemuse;               /* maximal used memory count (spills)     */
+static int freememtop;              /* free memory count                      */
+
+static int tmpintregcnt;            /* scratch integer register count         */
+static int savintregcnt;            /* saved integer register count           */
+static int tmpfltregcnt;            /* scratch float register count           */
+static int savfltregcnt;            /* saved float register count             */
+
+static int iftmpintregcnt;          /* iface scratch integer register count   */
+static int ifsavintregcnt;          /* iface saved integer register count     */
+static int iftmpfltregcnt;          /* iface scratch float register count     */
+static int ifsavfltregcnt;          /* iface saved float register count       */
+
+static int argintreguse;            /* used argument integer register count   */
+static int tmpintreguse;            /* used scratch integer register count    */
+static int savintreguse;            /* used saved integer register count      */
+static int argfltreguse;            /* used argument float register count     */
+static int tmpfltreguse;            /* used scratch float register count      */
+static int savfltreguse;            /* used saved float register count        */
+
+static int maxargintreguse;         /* max used argument int register count   */
+static int maxtmpintreguse;         /* max used scratch int register count    */
+static int maxsavintreguse;         /* max used saved int register count      */
+static int maxargfltreguse;         /* max used argument float register count */
+static int maxtmpfltreguse;         /* max used scratch float register count  */
+static int maxsavfltreguse;         /* max used saved float register count    */
+
+static int freearginttop;           /* free argument integer register count   */
+static int freetmpinttop;           /* free scratch integer register count    */
+static int freesavinttop;           /* free saved integer register count      */
+static int freeargflttop;           /* free argument float register count     */
+static int freetmpflttop;           /* free scratch float register count      */
+static int freesavflttop;           /* free saved float register count        */
+
+static int savedregs_num;              /* total number of registers to be saved      */
+int arguments_num;              /* size of parameter field in the stackframe  */
+
+
+
+/* function reg_init ***********************************************************
+
+       initialises the register-allocator
+       
+*******************************************************************************/
+
+void reg_init()
+{
+       int n;
+       int i;
+       varinfo5 *v;
+       
+       if (!tmpintregs) {
+               if (TYPE_INT != 0 || TYPE_ADR != 4) 
+                       panic ("JAVA-Basictypes have been changed");
+
+               intreg_argnum = 0;
+               tmpintregcnt = 0;
+               savintregcnt = 0;
+
+               for (intregsnum = 0; nregdescint[intregsnum] != REG_END; intregsnum++) {
+                       switch (nregdescint[intregsnum]) {
+                       case REG_SAV: savintregcnt++;
+                               break;
+                       case REG_TMP: tmpintregcnt++;
+                               break;
+                       case REG_ARG: intreg_argnum++;
+                       }
+               }
+
+               argintregs = MNEW(int, intreg_argnum);
+               tmpintregs = MNEW(int, tmpintregcnt);
+               savintregs = MNEW(int, savintregcnt);
+               freeargintregs = MNEW(int, intreg_argnum);
+               freetmpintregs = MNEW(int, tmpintregcnt);
+               freesavintregs = MNEW(int, savintregcnt);
+#ifdef USETWOREGS
+               secondregs = MNEW(int, intregsnum);
+#endif
+
+               intreg_argnum = 0;
+               argintreguse = 0;
+               tmpintreguse = 0;
+               savintreguse = 0;
+
+               for (n = 0; n < intregsnum; n++) {
+                       switch (nregdescint[n]) {
+                       case REG_RET: intreg_ret = n; 
+                               break;
+                       case REG_SAV: savintregs[savintreguse++] = n;
+                               break;
+                       case REG_TMP: tmpintregs[tmpintreguse++] = n;
+                               break;
+                       case REG_ARG: argintregs[intreg_argnum++] = n;
+                               argintreguse++;
+                               break;
+                       }
+               }
+
+#if defined(__X86_64__)
+               /* 
+                * on x86_64 the argument registers are not in ascending order 
+                * a00 (%rdi) <-> a03 (%rcx) and a01 (%rsi) <-> a02 (%rdx)
+                */
+
+               n = argintregs[3];
+               argintregs[3] = argintregs[0];
+               argintregs[0] = n;
+
+               n = argintregs[2];
+               argintregs[2] = argintregs[1];
+               argintregs[1] = n;
+#endif
+               
+#ifdef USETWOREGS
+               for (n = 1; n < intreg_argnum; n++)
+                       secondregs[argintregs[n - 1]] = argintregs[n];
+               for (n = 1; n < tmpintregcnt; n++)
+                       secondregs[tmpintregs[n - 1]] = tmpintregs[n];
+               for (n = 1; n < savintregcnt; n++)
+                       secondregs[savintregs[n - 1]] = savintregs[n];
+
+               secondregs[REG_ITMP1] = REG_ITMP2;
+               secondregs[REG_ITMP3] = REG_ITMP2;
+               secondregs[REG_RESULT] = REG_RESULT + 1;
+               secondregs[argintregs[intreg_argnum - 1]] = REG_ITMP3;
+#endif
+
+               fltreg_argnum = 0;
+               tmpfltregcnt = 0;
+               savfltregcnt = 0;
+
+               for (floatregsnum = 0; nregdescfloat[floatregsnum] != REG_END; floatregsnum++) {
+                       switch (nregdescfloat[floatregsnum]) {
+                       case REG_SAV: savfltregcnt++;
+                               break;
+                       case REG_TMP: tmpfltregcnt++;
+                               break;
+                       case REG_ARG: fltreg_argnum++;
+                               break;
+                       }
+               }
+
+               argfltregs = MNEW(int, fltreg_argnum);
+               tmpfltregs = MNEW(int, tmpfltregcnt);
+               savfltregs = MNEW(int, savfltregcnt);
+               freeargfltregs = MNEW(int, fltreg_argnum);
+               freetmpfltregs = MNEW(int, tmpfltregcnt);
+               freesavfltregs = MNEW(int, savfltregcnt);
+
+               fltreg_argnum = 0;
+               argfltreguse = 0;
+               tmpfltreguse = 0;
+               savfltreguse = 0;
+
+               for (n = 0; n < floatregsnum; n++) {
+                       switch (nregdescfloat[n]) {
+                       case REG_RET:
+                               floatreg_ret = n; 
+                               break;
+                       case REG_SAV: savfltregs[savfltreguse++] = n;
+                               break;
+                       case REG_TMP: tmpfltregs[tmpfltreguse++] = n;
+                               break;
+                       case REG_ARG: argfltregs[fltreg_argnum++] = n;
+                               argfltreguse++;
+                               break;
+                       }
+               }
+                                       
+       }
+
+
+       freemem    = DMNEW(int, maxstack);
+       locals     = DMNEW(varinfo5, maxlocals);
+       interfaces = DMNEW(varinfo5, maxstack);
+
+       for (v = locals, i = maxlocals; i > 0; v++, i--) {
+               v[0][TYPE_INT].type = -1;
+               v[0][TYPE_LNG].type = -1;
+               v[0][TYPE_FLT].type = -1;
+               v[0][TYPE_DBL].type = -1;
+               v[0][TYPE_ADR].type = -1;
+       }
+
+       for (v = interfaces, i = maxstack; i > 0; v++, i--) {
+               v[0][TYPE_INT].type = -1;
+               v[0][TYPE_INT].flags = 0;
+               v[0][TYPE_LNG].type = -1;
+               v[0][TYPE_LNG].flags = 0;
+               v[0][TYPE_FLT].type = -1;
+               v[0][TYPE_FLT].flags = 0;
+               v[0][TYPE_DBL].type = -1;
+               v[0][TYPE_DBL].flags = 0;
+               v[0][TYPE_ADR].type = -1;
+               v[0][TYPE_ADR].flags = 0;
+       }
+}
+
+
+
+/* function reg_close **********************************************************
+
+       releases all allocated space for registers
+
+*******************************************************************************/
+
+void reg_close()
+{
+       if (argintregs) MFREE(argintregs, int, intreg_argnum);
+       if (argfltregs) MFREE(argfltregs, int, fltreg_argnum);
+       if (tmpintregs) MFREE(tmpintregs, int, tmpintregcnt);
+       if (savintregs) MFREE(savintregs, int, savintregcnt);
+       if (tmpfltregs) MFREE(tmpfltregs, int, tmpfltregcnt);
+       if (savfltregs) MFREE(savfltregs, int, savfltregcnt);
+
+       if (freeargintregs) MFREE(freeargintregs, int, intreg_argnum);
+       if (freeargfltregs) MFREE(freeargfltregs, int, fltreg_argnum);
+       if (freetmpintregs) MFREE(freetmpintregs, int, tmpintregcnt);
+       if (freesavintregs) MFREE(freesavintregs, int, savintregcnt);
+       if (freetmpfltregs) MFREE(freetmpfltregs, int, tmpfltregcnt);
+       if (freesavfltregs) MFREE(freesavfltregs, int, savfltregcnt);
+
+#ifdef USETWOREGS
+       if (secondregs) MFREE(secondregs, int, intregsnum);
+#endif
+}
+
+
+/* function interface_regalloc *************************************************
+
+       allocates registers for all interface variables
+       
+*******************************************************************************/
+       
+void regalloc()
+{
+       interface_regalloc();
+       allocate_scratch_registers();
+       local_regalloc();
+}
+
+
+/* function interface_regalloc *************************************************
+
+       allocates registers for all interface variables
+       
+*******************************************************************************/
+       
+static void interface_regalloc ()
+{
+       int     s, t, saved;
+       int     intalloc, fltalloc;
+       varinfo *v;
+       int             regsneeded = 0;
+       
+       /* allocate stack space for passing arguments to called methods */
+
+#ifndef SPECIALMEMUSE
+#if defined(__X86_64__)
+       /*
+        * XXX: we have a problem here, but allocating a little more stack space
+        *      is better than having a bug
+        */
+       /*      if (arguments_num > (intreg_argnum + fltreg_argnum)) */
+       /*              ifmemuse = arguments_num - (intreg_argnum + fltreg_argnum); */
+       if (arguments_num > fltreg_argnum)
+               ifmemuse = arguments_num - fltreg_argnum;
+#else
+       if (arguments_num > intreg_argnum)
+               ifmemuse = arguments_num - intreg_argnum;
+#endif
+       else
+               ifmemuse = 0;
+#endif
+
+       iftmpintregcnt = tmpintregcnt;
+       ifsavintregcnt = savintregcnt;
+       iftmpfltregcnt = tmpfltregcnt;
+       ifsavfltregcnt = savfltregcnt;
+
+       for (s = 0; s < maxstack; s++) {
+               intalloc = -1; fltalloc = -1;
+               saved = (interfaces[s][TYPE_INT].flags | interfaces[s][TYPE_LNG].flags |
+                        interfaces[s][TYPE_FLT].flags | interfaces[s][TYPE_DBL].flags |
+                        interfaces[s][TYPE_ADR].flags) & SAVEDVAR;
+               for (t = TYPE_INT; t <= TYPE_ADR; t++) {
+                       v = &interfaces[s][t];
+                       if (v->type >= 0) {
+#ifdef USETWOREGS
+                               regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
+#endif
+                               if (!saved) {
+                                       if (IS_FLT_DBL_TYPE(t)) {
+                                               if (fltalloc >= 0) {
+                                                       v->flags |= interfaces[s][fltalloc].flags & INMEMORY;
+                                                       v->regoff = interfaces[s][fltalloc].regoff;
+                                               }
+                                               else if (iftmpfltregcnt > 0) {
+                                                       iftmpfltregcnt--;
+                                                       v->regoff = tmpfltregs[iftmpfltregcnt];
+                                               }
+                                               else if (ifsavfltregcnt > 0) {
+                                                       ifsavfltregcnt--;
+                                                       v->regoff = savfltregs[ifsavfltregcnt];
+                                               }
+                                               else {
+                                                       v->flags |= INMEMORY;
+                                                       v->regoff = ifmemuse;
+                                                       ifmemuse += regsneeded+1;
+                                               }
+                                               fltalloc = t;
+                                       }
+                                       else {
+#if defined(__I386__)
+                                               /*
+                                                * for i386 put all longs in memory
+                                                */
+                                               if (IS_2_WORD_TYPE(t)) {
+                                                       v->flags |= INMEMORY;
+                                                       v->regoff = ifmemuse++;
+                                               } else {
+#endif
+                                                       if (intalloc >= 0) {
+                                                               v->flags |= interfaces[s][intalloc].flags & INMEMORY;
+                                                               v->regoff = interfaces[s][intalloc].regoff;
+                                                       }
+                                                       else if (iftmpintregcnt > regsneeded) {
+                                                               iftmpintregcnt -= regsneeded+1;
+                                                               v->regoff = tmpintregs[iftmpintregcnt];
+                                                       }
+                                                       else if (ifsavintregcnt > regsneeded) {
+                                                               ifsavintregcnt -= regsneeded+1;
+                                                               v->regoff = savintregs[ifsavintregcnt];
+                                                       }
+                                                       else {
+                                                               v->flags |= INMEMORY;
+                                                               v->regoff = ifmemuse;
+                                                               ifmemuse += regsneeded+1;
+                                                       }
+#if defined(__I386__)
+                                               }
+#endif
+                                               intalloc = t;
+                                       }
+                               }
+                               else {
+                                       if (IS_FLT_DBL_TYPE(t)) {
+                                               if (fltalloc >= 0) {
+                                                       v->flags |= interfaces[s][fltalloc].flags & INMEMORY;
+                                                       v->regoff = interfaces[s][fltalloc].regoff;
+                                               }
+                                               else if (ifsavfltregcnt > 0) {
+                                                       ifsavfltregcnt--;
+                                                       v->regoff = savfltregs[ifsavfltregcnt];
+                                               }
+                                               else {
+                                                       v->flags |= INMEMORY;
+                                                       v->regoff = ifmemuse;
+                                                       ifmemuse += regsneeded+1;
+                                               }
+                                               fltalloc = t;
+                                       }
+                                       else {
+#if defined(__I386__)
+                                               /*
+                                                * for i386 put all longs in memory
+                                                */
+                                               if (IS_2_WORD_TYPE(t)) {
+                                                       v->flags |= INMEMORY;
+                                                       v->regoff = ifmemuse++;
+                                               } else {
+#endif
+                                                       if (intalloc >= 0) {
+                                                               v->flags |= interfaces[s][intalloc].flags & INMEMORY;
+                                                               v->regoff = interfaces[s][intalloc].regoff;
+                                                       }
+                                                       else if (ifsavintregcnt > regsneeded) {
+                                                               ifsavintregcnt -= regsneeded+1;
+                                                               v->regoff = savintregs[ifsavintregcnt];
+                                                       }
+                                                       else {
+                                                               v->flags |= INMEMORY;
+                                                               v->regoff = ifmemuse;
+                                                               ifmemuse += regsneeded+1;
+                                                       }
+#if defined(__I386__)
+                                               }
+#endif
+                                               intalloc = t;
+                                       }
+                               }
+                       } /* if (type >= 0) */
+               } /* for t */
+       } /* for s */
+
+       maxmemuse = ifmemuse;
+       maxtmpintreguse = iftmpintregcnt;
+       maxsavintreguse = ifsavintregcnt;
+       maxtmpfltreguse = iftmpfltregcnt;
+       maxsavfltreguse = ifsavfltregcnt;
+}
+
+
+
+/* function local_regalloc *****************************************************
+
+       allocates registers for all local variables
+       
+*******************************************************************************/
+       
+static void local_regalloc()
+{
+       int      s, t, tt;
+       int      intalloc, fltalloc;
+       varinfo *v;
+       int      regsneeded = 0;
+       int typeloop[] = { TYPE_LNG, TYPE_DBL, TYPE_INT, TYPE_FLT, TYPE_ADR };
+       
+       if (isleafmethod) {
+               int arg, doublewordarg, iargcnt, fargcnt;
+
+               arg = 0, iargcnt = 0, fargcnt = 0;
+               doublewordarg = 0;
+               for (s = 0; s < maxlocals; s++) {
+                       intalloc = -1; fltalloc = -1;
+                       for (tt = 0; tt <= 4; tt++) {
+                               t = typeloop[tt];
+                               v = &locals[s][t];
+
+                               if (v->type >= 0) {
+#ifdef USETWOREGS
+                                       regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
+#endif
+                                       if (IS_FLT_DBL_TYPE(t)) {
+#if !defined(CONSECUTIVE_FLOATARGS)
+                                               fargcnt = arg;
+#endif
+                                               if (fltalloc >= 0) {
+                                                       v->flags = locals[s][fltalloc].flags;
+                                                       v->regoff = locals[s][fltalloc].regoff;
+                                               }
+                                               else if (!doublewordarg && (arg < mparamcount)
+                                                                && (fargcnt < fltreg_argnum)) {
+                                                       v->flags = 0;
+                                                       v->regoff = argfltregs[fargcnt];
+                                               }
+                                               else if (maxtmpfltreguse > 0) {
+                                                       maxtmpfltreguse--;
+                                                       v->flags = 0;
+                                                       v->regoff = tmpfltregs[maxtmpfltreguse];
+                                               }
+                                               else if (maxsavfltreguse > 0) {
+                                                       maxsavfltreguse--;
+                                                       v->flags = 0;
+                                                       v->regoff = savfltregs[maxsavfltreguse];
+                                               }
+                                               else {
+                                                       v->flags = INMEMORY;
+                                                       v->regoff = maxmemuse;
+                                                       maxmemuse += regsneeded+1;
+                                               }
+                                               fltalloc = t;
+
+                                       } else {
+                                               int regtouse;
+#if defined(__I386__)
+                                               /*
+                                                * for i386 put all longs in memory
+                                                */
+                                               if (IS_2_WORD_TYPE(t)) {
+                                                       v->flags = INMEMORY;
+                                                       v->regoff = maxmemuse++;
+                                               } else {
+#endif
+#if !defined(CONSECUTIVE_INTARGS)
+                                                       iargcnt = arg;
+#endif
+                                                       if (intalloc >= 0) {
+                                                               v->flags = locals[s][intalloc].flags;
+                                                               v->regoff = locals[s][intalloc].regoff;
+                                                       }
+                                                       else if (!doublewordarg && (arg < mparamcount)
+#ifndef USETWOREGS
+                                                                        && ((regtouse = iargcnt) < intreg_argnum)
+#else
+                                                                        && ((regtouse = s) < intreg_argnum - regsneeded)
+#endif
+                                                                        ) {
+                                                               v->flags = 0;
+                                                               v->regoff = argintregs[regtouse];
+                                                       }
+                                                       else if (maxtmpintreguse > regsneeded) {
+                                                               maxtmpintreguse -= regsneeded + 1;
+                                                               v->flags = 0;
+                                                               v->regoff = tmpintregs[maxtmpintreguse];
+                                                       }
+                                                       else if (maxsavintreguse > regsneeded) {
+                                                               maxsavintreguse -= regsneeded + 1;
+                                                               v->flags = 0;
+                                                               v->regoff = savintregs[maxsavintreguse];
+                                                       }
+                                                       /*
+                                                        * use unused argument registers as local registers
+                                                        */
+                                                       else if (!doublewordarg && (arg >= mparamcount)
+                                                                        && (iargcnt < intreg_argnum)) {
+                                                               v->flags = 0;
+                                                               v->regoff = argintregs[iargcnt];
+                                                               iargcnt++;
+                                                               arg++;
+                                                       }
+                                                       else {
+                                                               v->flags = INMEMORY;
+                                                               v->regoff = maxmemuse;
+                                                               maxmemuse += regsneeded+1;
+                                                       }
+#if defined(__I386__)
+                                               }
+#endif
+                                               intalloc = t;
+                                       }
+                               }
+                       }
+                       if (arg < mparamcount) {
+                               if (doublewordarg) {
+                                       doublewordarg = 0;
+                                       /* what type was the double arg? */
+                                       if (IS_FLT_DBL_TYPE(mparamtypes[arg])) {
+                                               fargcnt++;
+
+                                       } else {
+                                               iargcnt++;
+                                       }
+                                       arg++;
+
+                               } else if (IS_2_WORD_TYPE(mparamtypes[arg])) {
+                                       doublewordarg = 1;
+
+                               } else {
+                                       if (IS_FLT_DBL_TYPE(mparamtypes[arg])) {
+                                               fargcnt++;
+
+                                       } else {
+                                               iargcnt++;
+                                       }
+                                       arg++;
+                               }
+                       }
+               }
+               return;
+       }
+
+       for (s = 0; s < maxlocals; s++) {
+               intalloc = -1; fltalloc = -1;
+               for (tt=0; tt<=4; tt++) {
+                       t = typeloop[tt];
+                       v = &locals[s][t];
+                       if (v->type >= 0) {
+#ifdef USETWOREGS
+                               regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
+#endif
+                               if (IS_FLT_DBL_TYPE(t)) {
+                                       if (fltalloc >= 0) {
+                                               v->flags = locals[s][fltalloc].flags;
+                                               v->regoff = locals[s][fltalloc].regoff;
+                                       }
+                                       else if (maxsavfltreguse > 0) {
+                                               maxsavfltreguse--;
+                                               v->flags = 0;
+                                               v->regoff = savfltregs[maxsavfltreguse];
+                                       }
+                                       else {
+                                               v->flags = INMEMORY;
+                                               v->regoff = maxmemuse;
+                                               maxmemuse += regsneeded+1;
+                                       }
+                                       fltalloc = t;
+                               }
+                               else {
+#if defined(__I386__)
+                                       /*
+                                        * for i386 put all longs in memory
+                                        */
+                                       if (IS_2_WORD_TYPE(t)) {
+                                               v->flags = INMEMORY;
+                                               v->regoff = maxmemuse++;
+                                       } else {
+#endif
+                                               if (intalloc >= 0) {
+                                                       v->flags = locals[s][intalloc].flags;
+                                                       v->regoff = locals[s][intalloc].regoff;
+                                               }
+                                               else if (maxsavintreguse > regsneeded) {
+                                                       maxsavintreguse -= regsneeded+1;
+                                                       v->flags = 0;
+                                                       v->regoff = savintregs[maxsavintreguse];
+                                               }
+                                               else {
+                                                       v->flags = INMEMORY;
+                                                       v->regoff = maxmemuse;
+                                                       maxmemuse += regsneeded+1;
+                                               }
+#if defined(__I386__)
+                                       }
+#endif
+                                       intalloc = t;
+                               }
+                       }
+               }
+       }
+}
+
+
+
+static void reg_init_temp()
+{
+       freememtop = 0;
+       memuse = ifmemuse;
+
+       freearginttop = 0;
+       freetmpinttop = 0;
+       freesavinttop = 0;
+       freeargflttop = 0;
+       freetmpflttop = 0;
+       freesavflttop = 0;
+
+       tmpintreguse = iftmpintregcnt;
+       savintreguse = ifsavintregcnt;
+       tmpfltreguse = iftmpfltregcnt;
+       savfltreguse = ifsavfltregcnt;
+
+       /*
+        * all argument registers are available
+        */
+       argintreguse = intreg_argnum;
+       argfltreguse = fltreg_argnum;
+}
+
+
+
+#define reg_new_temp(s) if (s->varkind == TEMPVAR) reg_new_temp_func(s)
+
+static void reg_new_temp_func(stackptr s)
+{
+       int regsneeded = 0;
+
+       /* Try to allocate a saved register if there is no temporary one available.   */
+       /* This is what happens during the second run.                                */
+       int tryagain = (s->flags & SAVEDVAR) ? 1 : 2;
+
+#ifdef USETWOREGS
+       regsneeded = (IS_2_WORD_TYPE(s->type)) ? 1 : 0;
+#endif
+
+       for(; tryagain; --tryagain) {
+               if (tryagain == 1) {
+                       if (!(s->flags & SAVEDVAR))
+                               s->flags |= SAVEDTMP;
+                       if (IS_FLT_DBL_TYPE(s->type)) {
+                               if (freesavflttop > 0) {
+                                       freesavflttop--;
+                                       s->regoff = freesavfltregs[freesavflttop];
+                                       return;
+                               }
+                               else if (savfltreguse > 0) {
+                                       savfltreguse--;
+                                       if (savfltreguse < maxsavfltreguse)
+                                               maxsavfltreguse = savfltreguse;
+                                       s->regoff = savfltregs[savfltreguse];
+                                       return;
+                               }
+                       }
+                       else {
+#if defined(__I386__)
+                               /*
+                                * for i386 put all longs in memory
+                                */
+                               if (!IS_2_WORD_TYPE(s->type)) {
+#endif
+                                       if (freesavinttop > regsneeded) {
+                                               freesavinttop -= regsneeded + 1;
+                                               s->regoff = freesavintregs[freesavinttop];
+                                               return;
+                                       }
+                                       else if (savintreguse > regsneeded) {
+                                               savintreguse -= regsneeded + 1;
+                                               if (savintreguse < maxsavintreguse)
+                                                       maxsavintreguse = savintreguse;
+                                               s->regoff = savintregs[savintreguse];
+                                               return;
+                                       }
+#if defined(__I386__)
+                               }
+#endif
+                       }
+               }
+               else {
+                       if (IS_FLT_DBL_TYPE(s->type)) {
+                               if (freetmpflttop > 0) {
+                                       freetmpflttop--;
+                                       s->regoff = freetmpfltregs[freetmpflttop];
+                                       return;
+                               }
+                               else if (tmpfltreguse > 0) {
+                                       tmpfltreguse--;
+                                       if (tmpfltreguse < maxtmpfltreguse)
+                                               maxtmpfltreguse = tmpfltreguse;
+                                       s->regoff = tmpfltregs[tmpfltreguse];
+                                       return;
+                               }
+                       }
+                       else {
+#if defined(__I386__)
+                               /*
+                                * for i386 put all longs in memory
+                                */
+                               if (!IS_2_WORD_TYPE(s->type)) {
+#endif
+                                       if (freetmpinttop > regsneeded) {
+                                               freetmpinttop -= regsneeded + 1;
+                                               s->regoff = freetmpintregs[freetmpinttop];
+                                               return;
+                                       }
+                                       else if (tmpintreguse > regsneeded) {
+                                               tmpintreguse -= regsneeded + 1;
+                                               if (tmpintreguse < maxtmpintreguse)
+                                                       maxtmpintreguse = tmpintreguse;
+                                               s->regoff = tmpintregs[tmpintreguse];
+                                               return;
+                                       }
+#if defined(__I386__)
+                               }
+#endif
+                       }
+               }
+       }
+
+       if (freememtop > regsneeded) {
+               freememtop -= regsneeded+1;
+               s->regoff = freemem[freememtop];
+       }
+       else {
+               s->regoff = memuse;
+               memuse += regsneeded+1;
+               if (memuse > maxmemuse)
+                       maxmemuse = memuse;
+       }
+       s->flags |= INMEMORY;
+}
+
+
+
+#define reg_free_temp(s) if (s->varkind == TEMPVAR) reg_free_temp_func(s)
+
+static void reg_free_temp_func(stackptr s)
+{
+       int regsneeded = 0;
+
+#ifdef USETWOREGS
+       regsneeded = (IS_2_WORD_TYPE(s->type)) ? 1 : 0;
+#endif
+
+       if (s->flags & INMEMORY) {
+               freemem[freememtop] = s->regoff;
+               if (regsneeded)
+                       freemem[freememtop + 1] = s->regoff + 1;
+               freememtop += regsneeded + 1;
+       }
+       else if (IS_FLT_DBL_TYPE(s->type)) {
+               if (s->flags & (SAVEDVAR | SAVEDTMP)) {
+                       s->flags &= ~SAVEDTMP;
+                       freesavfltregs[freesavflttop++] = s->regoff;
+               } else
+                       freetmpfltregs[freetmpflttop++] = s->regoff;
+       }
+       else {
+               if (s->flags & (SAVEDVAR | SAVEDTMP)) {
+                       s->flags &= ~SAVEDTMP;
+                       freesavintregs[freesavinttop] = s->regoff;
+#ifdef USETWOREGS
+                       if (regsneeded)
+                               freesavintregs[freesavinttop + 1] = secondregs[s->regoff];
+#endif
+                       freesavinttop += regsneeded + 1;
+               } else {
+                       freetmpintregs[freetmpinttop] = s->regoff;
+#ifdef USETWOREGS
+                       if (regsneeded)
+                               freetmpintregs[freetmpinttop + 1] = secondregs[s->regoff];
+#endif
+                       freetmpinttop += regsneeded + 1;
+               }
+       }
+}
+
+
+
+static void allocate_scratch_registers()
+{
+       int opcode;
+       int i;
+       int len;
+       stackptr    src;
+       stackptr    dst;
+       instruction *iptr;
+       basicblock  *bptr;
+
+       /* b_count = block_count; */
+
+       bptr = block;
+       while (bptr != NULL) {
+
+               if (bptr->flags >= BBREACHED) {
+                       dst = bptr->instack;
+                       reg_init_temp();
+                       iptr = bptr->iinstr;
+                       len = bptr->icount;
+  
+                       while (--len >= 0)  {
+                               src = dst;
+                               dst = iptr->dst;
+                               opcode = iptr->opc;
+
+                               switch (opcode) {
+
+                                       /* pop 0 push 0 */
+
+                               case ICMD_NOP:
+                               case ICMD_ELSE_ICONST:
+                               case ICMD_CHECKASIZE:
+                               case ICMD_IINC:
+                               case ICMD_JSR:
+                               case ICMD_RET:
+                               case ICMD_RETURN:
+                               case ICMD_GOTO:
+                                       break;
+
+                                       /* pop 0 push 1 const */
+                                       
+                               case ICMD_ICONST:
+                               case ICMD_LCONST:
+                               case ICMD_FCONST:
+                               case ICMD_DCONST:
+                               case ICMD_ACONST:
+
+                                       /* pop 0 push 1 load */
+                                       
+                               case ICMD_ILOAD:
+                               case ICMD_LLOAD:
+                               case ICMD_FLOAD:
+                               case ICMD_DLOAD:
+                               case ICMD_ALOAD:
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 2 push 1 */
+
+                               case ICMD_IALOAD:
+                               case ICMD_LALOAD:
+                               case ICMD_FALOAD:
+                               case ICMD_DALOAD:
+                               case ICMD_AALOAD:
+
+                               case ICMD_BALOAD:
+                               case ICMD_CALOAD:
+                               case ICMD_SALOAD:
+
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 3 push 0 */
+
+                               case ICMD_IASTORE:
+                               case ICMD_LASTORE:
+                               case ICMD_FASTORE:
+                               case ICMD_DASTORE:
+                               case ICMD_AASTORE:
+
+                               case ICMD_BASTORE:
+                               case ICMD_CASTORE:
+                               case ICMD_SASTORE:
+
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_free_temp(src->prev->prev);
+                                       break;
+
+                                       /* pop 1 push 0 store */
+
+                               case ICMD_ISTORE:
+                               case ICMD_LSTORE:
+                               case ICMD_FSTORE:
+                               case ICMD_DSTORE:
+                               case ICMD_ASTORE:
+
+                                       /* pop 1 push 0 */
+
+                               case ICMD_POP:
+
+                               case ICMD_IRETURN:
+                               case ICMD_LRETURN:
+                               case ICMD_FRETURN:
+                               case ICMD_DRETURN:
+                               case ICMD_ARETURN:
+
+                               case ICMD_ATHROW:
+
+                               case ICMD_PUTSTATIC:
+
+                                       /* pop 1 push 0 branch */
+
+                               case ICMD_IFNULL:
+                               case ICMD_IFNONNULL:
+
+                               case ICMD_IFEQ:
+                               case ICMD_IFNE:
+                               case ICMD_IFLT:
+                               case ICMD_IFGE:
+                               case ICMD_IFGT:
+                               case ICMD_IFLE:
+
+                               case ICMD_IF_LEQ:
+                               case ICMD_IF_LNE:
+                               case ICMD_IF_LLT:
+                               case ICMD_IF_LGE:
+                               case ICMD_IF_LGT:
+                               case ICMD_IF_LLE:
+
+                                       /* pop 1 push 0 table branch */
+
+                               case ICMD_TABLESWITCH:
+                               case ICMD_LOOKUPSWITCH:
+
+                               case ICMD_NULLCHECKPOP:
+                               case ICMD_MONITORENTER:
+                               case ICMD_MONITOREXIT:
+                                       reg_free_temp(src);
+                                       break;
+
+                                       /* pop 2 push 0 branch */
+
+                               case ICMD_IF_ICMPEQ:
+                               case ICMD_IF_ICMPNE:
+                               case ICMD_IF_ICMPLT:
+                               case ICMD_IF_ICMPGE:
+                               case ICMD_IF_ICMPGT:
+                               case ICMD_IF_ICMPLE:
+
+                               case ICMD_IF_LCMPEQ:
+                               case ICMD_IF_LCMPNE:
+                               case ICMD_IF_LCMPLT:
+                               case ICMD_IF_LCMPGE:
+                               case ICMD_IF_LCMPGT:
+                               case ICMD_IF_LCMPLE:
+
+                               case ICMD_IF_ACMPEQ:
+                               case ICMD_IF_ACMPNE:
+
+                                       /* pop 2 push 0 */
+
+                               case ICMD_POP2:
+
+                               case ICMD_PUTFIELD:
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       break;
+
+                                       /* pop 0 push 1 dup */
+                                       
+                               case ICMD_DUP:
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 0 push 2 dup */
+                                       
+                               case ICMD_DUP2:
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 2 push 3 dup */
+                                       
+                               case ICMD_DUP_X1:
+                                       reg_new_temp(dst->prev->prev);
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       break;
+
+                                       /* pop 3 push 4 dup */
+                                       
+                               case ICMD_DUP_X2:
+                                       reg_new_temp(dst->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev);
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_free_temp(src->prev->prev);
+                                       break;
+
+                                       /* pop 3 push 5 dup */
+                                       
+                               case ICMD_DUP2_X1:
+                                       reg_new_temp(dst->prev->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev);
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_free_temp(src->prev->prev);
+                                       break;
+
+                                       /* pop 4 push 6 dup */
+                                       
+                               case ICMD_DUP2_X2:
+                                       reg_new_temp(dst->prev->prev->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev);
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_free_temp(src->prev->prev);
+                                       reg_free_temp(src->prev->prev->prev);
+                                       break;
+
+                                       /* pop 2 push 2 swap */
+                                       
+                               case ICMD_SWAP:
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       break;
+
+                                       /* pop 2 push 1 */
+                                       
+                               case ICMD_IADD:
+                               case ICMD_ISUB:
+                               case ICMD_IMUL:
+                               case ICMD_IDIV:
+                               case ICMD_IREM:
+
+                               case ICMD_ISHL:
+                               case ICMD_ISHR:
+                               case ICMD_IUSHR:
+                               case ICMD_IAND:
+                               case ICMD_IOR:
+                               case ICMD_IXOR:
+
+                               case ICMD_LADD:
+                               case ICMD_LSUB:
+                               case ICMD_LMUL:
+                               case ICMD_LDIV:
+                               case ICMD_LREM:
+
+                               case ICMD_LOR:
+                               case ICMD_LAND:
+                               case ICMD_LXOR:
+
+                               case ICMD_LSHL:
+                               case ICMD_LSHR:
+                               case ICMD_LUSHR:
+
+                               case ICMD_FADD:
+                               case ICMD_FSUB:
+                               case ICMD_FMUL:
+                               case ICMD_FDIV:
+                               case ICMD_FREM:
+
+                               case ICMD_DADD:
+                               case ICMD_DSUB:
+                               case ICMD_DMUL:
+                               case ICMD_DDIV:
+                               case ICMD_DREM:
+
+                               case ICMD_LCMP:
+                               case ICMD_FCMPL:
+                               case ICMD_FCMPG:
+                               case ICMD_DCMPL:
+                               case ICMD_DCMPG:
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 1 push 1 */
+                                       
+                               case ICMD_IADDCONST:
+                               case ICMD_ISUBCONST:
+                               case ICMD_IMULCONST:
+                               case ICMD_IDIVPOW2:
+                               case ICMD_IREMPOW2:
+                               case ICMD_IREM0X10001:
+                               case ICMD_IANDCONST:
+                               case ICMD_IORCONST:
+                               case ICMD_IXORCONST:
+                               case ICMD_ISHLCONST:
+                               case ICMD_ISHRCONST:
+                               case ICMD_IUSHRCONST:
+
+                               case ICMD_LADDCONST:
+                               case ICMD_LSUBCONST:
+                               case ICMD_LMULCONST:
+                               case ICMD_LDIVPOW2:
+                               case ICMD_LREMPOW2:
+                               case ICMD_LREM0X10001:
+                               case ICMD_LANDCONST:
+                               case ICMD_LORCONST:
+                               case ICMD_LXORCONST:
+                               case ICMD_LSHLCONST:
+                               case ICMD_LSHRCONST:
+                               case ICMD_LUSHRCONST:
+
+                               case ICMD_IFEQ_ICONST:
+                               case ICMD_IFNE_ICONST:
+                               case ICMD_IFLT_ICONST:
+                               case ICMD_IFGE_ICONST:
+                               case ICMD_IFGT_ICONST:
+                               case ICMD_IFLE_ICONST:
+
+                               case ICMD_INEG:
+                               case ICMD_INT2BYTE:
+                               case ICMD_INT2CHAR:
+                               case ICMD_INT2SHORT:
+                               case ICMD_LNEG:
+                               case ICMD_FNEG:
+                               case ICMD_DNEG:
+
+                               case ICMD_I2L:
+                               case ICMD_I2F:
+                               case ICMD_I2D:
+                               case ICMD_L2I:
+                               case ICMD_L2F:
+                               case ICMD_L2D:
+                               case ICMD_F2I:
+                               case ICMD_F2L:
+                               case ICMD_F2D:
+                               case ICMD_D2I:
+                               case ICMD_D2L:
+                               case ICMD_D2F:
+
+                               case ICMD_CHECKCAST:
+
+                               case ICMD_ARRAYLENGTH:
+                               case ICMD_INSTANCEOF:
+
+                               case ICMD_NEWARRAY:
+                               case ICMD_ANEWARRAY:
+
+                               case ICMD_GETFIELD:
+                                       reg_free_temp(src);
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 0 push 1 */
+                                       
+                               case ICMD_GETSTATIC:
+
+                               case ICMD_NEW:
+
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop many push any */
+                                       
+                               case ICMD_INVOKEVIRTUAL:
+                               case ICMD_INVOKESPECIAL:
+                               case ICMD_INVOKESTATIC:
+                               case ICMD_INVOKEINTERFACE:
+                                       {
+                                               i = iptr->op1;
+                                               while (--i >= 0) {
+                                                       reg_free_temp(src);
+                                                       src = src->prev;
+                                               }
+                                               if (((methodinfo*)iptr->val.a)->returntype != TYPE_VOID)
+                                                       reg_new_temp(dst);
+                                               break;
+                                       }
+
+                               case ICMD_BUILTIN3:
+                                       reg_free_temp(src);
+                                       src = src->prev;
+                               case ICMD_BUILTIN2:
+                                       reg_free_temp(src);
+                                       src = src->prev;
+                               case ICMD_BUILTIN1:
+                                       reg_free_temp(src);
+                                       src = src->prev;
+                                       if (iptr->op1 != TYPE_VOID)
+                                               reg_new_temp(dst);
+                                       break;
+
+                               case ICMD_MULTIANEWARRAY:
+                                       i = iptr->op1;
+                                       while (--i >= 0) {
+                                               reg_free_temp(src);
+                                               src = src->prev;
+                                       }
+                                       reg_new_temp(dst);
+                                       break;
+
+                               default:
+                                       printf("ICMD %d at %d\n", iptr->opc, (int)(iptr-instr));
+                                       panic("Missing ICMD code during register allocation");
+                               } /* switch */
+                               iptr++;
+                       } /* while instructions */
+               } /* if */
+               bptr = bptr->next;
+       } /* while blocks */
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b240bebef5444c309e29b63bb52e060ab82e5e54..fe658d55a2328062be55d6bb8877ea578324005e 100644 (file)
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+/* jit/sets.c -
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: sets.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
 #include "sets.h"
+#include "types.h"
+#include "global.h"
 
 
 /*
  * set.c - functions to manipulate ptr sets.
  */
+
  
 /*------------------------------------------------------------*/
 /*-- fieldinfo call set fns */
 /*------------------------------------------------------------*/
-fldSetNode  *inFldSet    (fldSetNode *s, fieldinfo *f)
- {
- fldSetNode* i;
- for (i=s; i != NULL; i = i->nextfldRef) {
-   if (i->fldRef == f) {
-      return i; /* true = found */
-      }
-   }
- return NULL;
- }
+fldSetNode *inFldSet(fldSetNode *s, fieldinfo *f)
+{
+       fldSetNode* i;
+       for (i=s; i != NULL; i = i->nextfldRef) {
+               if (i->fldRef == f) {
+                       return i; /* true = found */
+               }
+       }
+       return NULL;
+}
+
 
 /*------------------------------------------------------------*/
 /* */
-fldSetNode *addFldRef(fldSetNode *s,  fieldinfo *f)
- {
- fldSetNode *s1 = s;
- if (!inFldSet(s,f)) {
-   s1 = (fldSetNode *)malloc(sizeof(fldSetNode));
-   s1->nextfldRef  = s;
-   s1->fldRef      = f;
-   s1->writePUT     = false;
-   s1->readGET    = false;
-   s1->lastptrPUT = NULL;
-   s1->lastptrGET = NULL;
-
-   if (s == NULL)
-     s1->index = 1;
-   else
-     s1->index = s->index+1; 
-   }
- return s1;
- }
+fldSetNode *addFldRef(fldSetNode *s, fieldinfo *f)
+{
+       fldSetNode *s1 = s;
+       if (!inFldSet(s,f)) {
+               s1 = (fldSetNode *)malloc(sizeof(fldSetNode));
+               s1->nextfldRef  = s;
+               s1->fldRef      = f;
+               s1->writePUT     = false;
+               s1->readGET    = false;
+               s1->lastptrPUT = NULL;
+               s1->lastptrGET = NULL;
+
+               if (s == NULL)
+                       s1->index = 1;
+               else
+                       s1->index = s->index+1; 
+       }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 fldSet *add2FldSet(fldSet *sf,  fieldinfo *f, bool wput, bool rget)
- {
- fldSetNode *s1;
- fldSetNode *s;
+{
      fldSetNode *s1;
      fldSetNode *s;
  
- if (sf == NULL) {
-       sf = createFldSet();
      if (sf == NULL) {
+               sf = createFldSet();
        }
- s = sf->head;
- s1 = inFldSet(s,f);
- if (s1 == NULL) {
-   s1 = (fldSetNode *)malloc(sizeof(fldSetNode));
-   if (sf->head == NULL) {
-       sf->head  = s1;
-       sf->pos   = s1;
-       s1->index = 1;
-       }        
-   else {
-       sf->tail->nextfldRef  = s1;
-       sf->length++;
-       s1->index = sf->length;
      s = sf->head;
      s1 = inFldSet(s,f);
      if (s1 == NULL) {
+               s1 = (fldSetNode *)malloc(sizeof(fldSetNode));
+               if (sf->head == NULL) {
+                       sf->head  = s1;
+                       sf->pos   = s1;
+                       s1->index = 1;
+               }        
+               else {
+                       sf->tail->nextfldRef  = s1;
+                       sf->length++;
+                       s1->index = sf->length;
        } 
-   s1->nextfldRef  = NULL;
-   s1->fldRef      = f;
-   s1->writePUT    = wput;
-   s1->readGET     = rget;
-   s1->lastptrPUT = NULL;
-   s1->lastptrGET = NULL;
-   sf->tail = s1;
-   }
- else  {
-       if ((s1->writePUT == false) && (wput)) 
-               s1->writePUT = wput;
-       if ((s1->readGET == false)  && (rget)) 
-               s1->readGET  = rget;
+               s1->nextfldRef  = NULL;
+               s1->fldRef      = f;
+               s1->writePUT    = wput;
+               s1->readGET     = rget;
+               s1->lastptrPUT = NULL;
+               s1->lastptrGET = NULL;
+               sf->tail = s1;
        }
- return sf;
- }
+       else    {
+               if ((s1->writePUT == false) && (wput)) 
+                       s1->writePUT = wput;
+               if ((s1->readGET == false)  && (rget)) 
+                       s1->readGET  = rget;
+       }
+       return sf;
+}
+
 
 /*------------------------------------------------------------*/
 fldSet *createFldSet( )
- {
- fldSet *s;
- s = (fldSet *)malloc(sizeof(fldSet));
- s->head = NULL;
- s->tail = NULL;
- s->pos  = NULL;
- s->length = 0;
- return s;
- }
+{
+       fldSet *s;
+       s = (fldSet *)malloc(sizeof(fldSet));
+       s->head = NULL;
+       s->tail = NULL;
+       s->pos  = NULL;
+       s->length = 0;
+       return s;
+}
+
 
 /*------------------------------------------------------------*/
 /*-- methodinfo call set fns */
 /*------------------------------------------------------------*/
 int  inMethSet    (methSetNode *s, methodinfo *m)
- {
- methSetNode* i;
- for (i=s; i != NULL; i = i->nextmethRef) {
-   if (i->methRef == m) {
-      return (int)1; /* true = found */
-      }
-   }
- return (int)0;
- }
+{
+       methSetNode* i;
+       for (i=s; i != NULL; i = i->nextmethRef) {
+               if (i->methRef == m) {
+                       return (int)1; /* true = found */
+               }
+       }
+       return (int)0;
+}
+
 
 /*------------------------------------------------------------*/
 methSetNode *addMethRef(methSetNode *s,  methodinfo *m)
- {
- methSetNode *s1 = s;
- if (!inMethSet(s,m)) {
-   s1 = (methSetNode *)malloc(sizeof(methSetNode));
-   s1->nextmethRef= s;
-   s1->methRef = m;
-   s1->lastptrIntoClassSet2 = NULL;
-   if (s == NULL)
-     s1->index = 1;
-   else
-     s1->index = s->index+1; 
-   s1->monoPoly = MONO; 
-   }
+{
      methSetNode *s1 = s;
      if (!inMethSet(s,m)) {
+               s1 = (methSetNode *)malloc(sizeof(methSetNode));
+               s1->nextmethRef= s;
+               s1->methRef = m;
+               s1->lastptrIntoClassSet2 = NULL;
+               if (s == NULL)
+                       s1->index = 1;
+               else
+                       s1->index = s->index+1; 
+               s1->monoPoly = MONO; 
+       }
   
- return s1;
- }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 methSet *add2MethSet(methSet *sm,  methodinfo *m)
- {
- methSetNode *s1;
- methSetNode *s;
+{
      methSetNode *s1;
      methSetNode *s;
  
- if (sm == NULL) {
-       sm = createMethSet();
      if (sm == NULL) {
+               sm = createMethSet();
        }
- s = sm->head;
- if (!inMethSet(s,m)) {
-   s1 = (methSetNode *)malloc(sizeof(methSetNode));
-   if (sm->head == NULL) {
-       sm->head = s1;
-       sm->pos   = s1;
-       s1->index = 1;
-       }        
-   else {
-       sm->tail->nextmethRef  = s1;
-       sm->length++;
-       s1->index = sm->length;
      s = sm->head;
      if (!inMethSet(s,m)) {
+               s1 = (methSetNode *)malloc(sizeof(methSetNode));
+               if (sm->head == NULL) {
+                       sm->head = s1;
+                       sm->pos   = s1;
+                       s1->index = 1;
+               }        
+               else {
+                       sm->tail->nextmethRef  = s1;
+                       sm->length++;
+                       s1->index = sm->length;
        }
-   s1->monoPoly = MONO; 
-   s1->nextmethRef= NULL;
-   s1->methRef = m;
-   s1->lastptrIntoClassSet2 = NULL;
-   sm->tail = s1;
-   }
- return sm;
- }
+               s1->monoPoly = MONO; 
+               s1->nextmethRef= NULL;
+               s1->methRef = m;
+               s1->lastptrIntoClassSet2 = NULL;
+               sm->tail = s1;
+       }
+       return sm;
+}
+
  
 /*------------------------------------------------------------*/
 methSet *createMethSet( )
- {
- methSet *s;
- s = (methSet *)malloc(sizeof(methSet));
- s->head = NULL;
- s->tail = NULL;
- s->pos  = NULL;
- s->length = 0;
- return s;
- }
+{
+       methSet *s;
+       s = (methSet *)malloc(sizeof(methSet));
+       s->head = NULL;
+       s->tail = NULL;
+       s->pos  = NULL;
+       s->length = 0;
+       return s;
+}
+
 
 /*------------------------------------------------------------*/
 /*-- classinfo XTA set fns  */
 /*------------------------------------------------------------*/
 int  inSet    (classSetNode *s, classinfo *c)
- {
- classSetNode* i;
- for (i=s; i != NULL; i = i->nextClass) {
-   if (i->classType == c) {
-      return  ((i->index)+1); /* true = found */
-      }
-   }
- return (int)0;
- }
+{
+       classSetNode* i;
+       for (i=s; i != NULL; i = i->nextClass) {
+               if (i->classType == c) {
+                       return  ((i->index)+1); /* true = found */
+               }
+       }
+       return (int)0;
+}
+
 
 /*------------------------------------------------------------*/
 classSetNode *addElement(classSetNode *s,  classinfo *c)
- {
- classSetNode *s1 = s;
- if (!inSet(s,c)) {
-   s1 = (classSetNode *)malloc(sizeof(classSetNode));
-   s1->nextClass= s;
-   s1->classType = c;
-   if (s == NULL)
-     s1->index = 1;
-   else
-     s1->index = s->index+1; 
-   }
- return s1;
- }
+{
+       classSetNode *s1 = s;
+       if (!inSet(s,c)) {
+               s1 = (classSetNode *)malloc(sizeof(classSetNode));
+               s1->nextClass= s;
+               s1->classType = c;
+               if (s == NULL)
+                       s1->index = 1;
+               else
+                       s1->index = s->index+1; 
+       }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 classSet *add2ClassSet(classSet *sc,  classinfo *c)
- {
- classSetNode *s1;
- classSetNode *s;
+{
      classSetNode *s1;
      classSetNode *s;
  
- if (sc == NULL) {
-       sc = createClassSet();
      if (sc == NULL) {
+               sc = createClassSet();
        }
- s = sc->head;
      s = sc->head;
        
- if (!inSet(s,c)) {
-   s1 = (classSetNode *)malloc(sizeof(classSetNode));
-   if (sc->head == NULL) {
-       sc->head  = s1;
-       sc->pos   = s1;
-       s1->index = 1;
-       }        
-   else {
-       sc->tail->nextClass  = s1;
-       sc->length++;
-       s1->index = sc->length;
      if (!inSet(s,c)) {
+               s1 = (classSetNode *)malloc(sizeof(classSetNode));
+               if (sc->head == NULL) {
+                       sc->head  = s1;
+                       sc->pos   = s1;
+                       s1->index = 1;
+               }        
+               else {
+                       sc->tail->nextClass  = s1;
+                       sc->length++;
+                       s1->index = sc->length;
        } 
-   s1->classType = c;
-   s1->nextClass= NULL;
-   sc->tail  = s1;
-   }
- return sc;
- }
+               s1->classType = c;
+               s1->nextClass= NULL;
+               sc->tail  = s1;
+       }
+       return sc;
+}
+
 
 /*------------------------------------------------------------*/
 classSet *createClassSet( )
- {
- classSet *s;
- s = (classSet *)malloc(sizeof(classSet));
- s->head = NULL;
- s->tail = NULL;
- s->pos  = NULL;
- s->length = 0;
- return s;
- }
+{
+       classSet *s;
+       s = (classSet *)malloc(sizeof(classSet));
+       s->head = NULL;
+       s->tail = NULL;
+       s->pos  = NULL;
+       s->length = 0;
+       return s;
+}
+
 
 /*------------------------------------------------------------*/
 /* Returns:                                                   */
@@ -253,26 +298,27 @@ classSet *createClassSet( )
 /*     1  c is a superclass of an existing set element        */
 
 int inRange (classSetNode *s, classinfo *c)
- {
- classSetNode* i;
- int rc=0;
-
- for (i=s; i != NULL; i = i->nextClass) {
-    classinfo *cs = i->classType;
-    if (cs->vftbl->baseval <= c->vftbl->baseval) {
-       if (c->vftbl->baseval <= (cs->vftbl->baseval+cs->vftbl->diffval)) {
-               rc = -1;  /* subtype */
+{
+       classSetNode* i;
+       int rc=0;
+
+       for (i=s; i != NULL; i = i->nextClass) {
+               classinfo *cs = i->classType;
+               if (cs->vftbl->baseval <= c->vftbl->baseval) {
+                       if (c->vftbl->baseval <= (cs->vftbl->baseval+cs->vftbl->diffval)) {
+                               rc = -1;  /* subtype */
+                       }
                }
-       }
-    else {
-       if (cs->vftbl->baseval < (c->vftbl->baseval+c->vftbl->diffval)) {
-               i->classType = c;   /* replace element with its new super */
-               rc  = 1; /* super */
+               else {
+                       if (cs->vftbl->baseval < (c->vftbl->baseval+c->vftbl->diffval)) {
+                               i->classType = c;   /* replace element with its new super */
+                               rc  = 1; /* super */
+                       }
                }
-       }
     }
- return rc;
- }
+       return rc;
+}
+
 
 /*------------------------------------------------------------*/
 /* adds class if not subtype of an existing set element       */
@@ -280,165 +326,189 @@ int inRange (classSetNode *s, classinfo *c)
 /* then replace the existing element with the "new" class     */
 
 classSetNode *addClassCone(classSetNode *s,  classinfo *c)
- {
- classSetNode *s1 = s;
+{
      classSetNode *s1 = s;
  
-if (inRange(s,c) == 0) {
-       /* not in set nor cone of an existing element so add */
-       s1 = (classSetNode *)malloc(sizeof(classSetNode));
-       s1->nextClass= s;
-       s1->classType = c;
-       if (s == NULL)
-               s1->index = 1;
-       else
-               s1->index = s->index+1; 
+       if (inRange(s,c) == 0) {
+               /* not in set nor cone of an existing element so add */
+               s1 = (classSetNode *)malloc(sizeof(classSetNode));
+               s1->nextClass= s;
+               s1->classType = c;
+               if (s == NULL)
+                       s1->index = 1;
+               else
+                       s1->index = s->index+1; 
        }
- return s1;
- }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 classSetNode * intersectSubtypesWithSet(classinfo *t, classSetNode *s) {
- classSetNode *s1 = NULL;
- classSetNode *c;
      classSetNode *s1 = NULL;
      classSetNode *c;
 
- /* for each s class */
- for (c=s; c != NULL; c = c->nextClass) {
-       vftbl *t_cl_vt = t->vftbl;
-       vftbl *c_cl_vt = c->classType->vftbl;
      /* for each s class */
      for (c=s; c != NULL; c = c->nextClass) {
+               vftbl *t_cl_vt = t->vftbl;
+               vftbl *c_cl_vt = c->classType->vftbl;
 
-       /* if s class is in the t Class range */
-       if (  (t_cl_vt->baseval <=  c_cl_vt->baseval)
-       && (c_cl_vt->baseval <= (t_cl_vt->baseval+t_cl_vt->diffval)) ) {
+               /* if s class is in the t Class range */
+               if (  (t_cl_vt->baseval <=  c_cl_vt->baseval)
+                         && (c_cl_vt->baseval <= (t_cl_vt->baseval+t_cl_vt->diffval)) ) {
 
-               /*    add s class to return class set */
-               s1 = addElement(s1,c->classType);
+                       /*    add s class to return class set */
+                       s1 = addElement(s1,c->classType);
                }
        }
- return s1;
- }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 int sizeOfSet(classSetNode *s) {
-/*** need to update */
-  int cnt=0;
-  classSetNode * i;
-  for (i=s; i != NULL; i = i->nextClass) cnt++;
-  return cnt;
-  }
+       /*** need to update */
+       int cnt=0;
+       classSetNode * i;
+       for (i=s; i != NULL; i = i->nextClass) cnt++;
+       return cnt;
+}
+
   
 /*------------------------------------------------------------*/
 int printSet(classSetNode *s)
-  {
-  classSetNode* i;
-  int cnt=0;
+{
+       classSetNode* i;
+       int cnt=0;
 
-  if (s == NULL) {
-       printf("Set of types: <");
-       printf("\t\tEmpty Set\n");
+       if (s == NULL) {
+               printf("Set of types: <");
+               printf("\t\tEmpty Set\n");
        }
-  else         {
-       printf("<%i>Set of types: ",s->index);
-       for (i=s; i != NULL; i = i->nextClass) {
+       else    {
+               printf("<%i>Set of types: ",s->index);
+               for (i=s; i != NULL; i = i->nextClass) {
                printf("\t#%i: ",cnt);
-               if (i->classType == NULL)  {
-                       printf("NULL CLASS");
-                       fflush(stdout);
+                       if (i->classType == NULL)  {
+                               printf("NULL CLASS");
+                               fflush(stdout);
                        }
-               else    {
-                       utf_display(i->classType->name);
-                       fflush(stdout); 
-                       printf("<b%i/d%i> ",i->classType->vftbl->baseval,i->classType->vftbl->diffval); 
-                       fflush(stdout);
+                       else    {
+                               utf_display(i->classType->name);
+                               fflush(stdout); 
+                               printf("<b%i/d%i> ",i->classType->vftbl->baseval,i->classType->vftbl->diffval); 
+                               fflush(stdout);
                        }
-               cnt++;
+                       cnt++;
                }
-       printf(">\n");
+               printf(">\n");
        }
-  return cnt;
-  }
+       return cnt;
+}
+
+
 /*------------------------------------------------------------*/
 int printClassSet(classSet *sc) {
-if (sc == NULL) {
-       printf("Class Set not yet created\n");
-       return 0;
+       if (sc == NULL) {
+               printf("Class Set not yet created\n");
+               return 0;
        }
-else
-       return (printSet(sc->head));
+       else
+               return (printSet(sc->head));
 }
 
+
 /*------------------------------------------------------------*/
 int printMethSet(methSetNode *s)
-  {
-  methSetNode* i;
-  int cnt=0;
+{
+       methSetNode* i;
+       int cnt=0;
 
-  if (s == NULL) {
-       printf("Set of Methods: "); fflush(stdout);
+       if (s == NULL) {
+               printf("Set of Methods: "); fflush(stdout);
        printf("\t\tEmpty Set\n"); fflush(stdout);
-        }
-  else         {
-       printf("<%i>Set of Methods: ",s->index);fflush(stdout); 
-       for (i=s; i != NULL; i = i->nextmethRef) {
+       }
+       else    {
+               printf("<%i>Set of Methods: ",s->index);fflush(stdout); 
+               for (i=s; i != NULL; i = i->nextmethRef) {
                printf("\t#%i: ",cnt);
 
-               /* class.method */
-               utf_display(i->methRef->class->name);
-               printf(".");
-               method_display(i->methRef);
+                       /* class.method */
+                       utf_display(i->methRef->class->name);
+                       printf(".");
+                       method_display(i->methRef);
 
-               /* lastptr <class> */
-               printf("\t<");
-               if (i->lastptrIntoClassSet2 != NULL)
-                       utf_display(i->lastptrIntoClassSet2->classType->name);
-               printf(">\n");
+                       /* lastptr <class> */
+                       printf("\t<");
+                       if (i->lastptrIntoClassSet2 != NULL)
+                               utf_display(i->lastptrIntoClassSet2->classType->name);
+                       printf(">\n");
 
-               cnt++;
+                       cnt++;
                }
-       printf("\n");
+               printf("\n");
        }
-  return cnt;
-  }
+       return cnt;
+}
+
+
 /*------------------------------------------------------------*/
 int printMethodSet(methSet *sm) {
-if (sm == NULL) {
-       printf("Method Set not yet created\n");
-       return 0;
+       if (sm == NULL) {
+               printf("Method Set not yet created\n");
+               return 0;
        }
-else
-       return (printMethSet(sm->head));
+       else
+               return (printMethSet(sm->head));
 }
+
+
 /*------------------------------------------------------------*/
 int printFldSet(fldSetNode *s)
-  {
-  fldSetNode* i;
-  int cnt=0;
+{
+       fldSetNode* i;
+       int cnt=0;
 
-  if (s == NULL) {
-       printf("Set of Fields: ");
-       printf("\tEmpty Set\n");
+       if (s == NULL) {
+               printf("Set of Fields: ");
+               printf("\tEmpty Set\n");
        }
-  else         {
-       printf("<%i>Set of Fields: ",s->index);
-       for (i=s; i != NULL; i = i->nextfldRef) {
+       else    {
+               printf("<%i>Set of Fields: ",s->index);
+               for (i=s; i != NULL; i = i->nextfldRef) {
                printf("\t#%i: ",cnt);
-               printf("(%ir/%iw)",i->writePUT,i->readGET);
-               field_display(i->fldRef);
-               cnt++;
+                       printf("(%ir/%iw)",i->writePUT,i->readGET);
+                       field_display(i->fldRef);
+                       cnt++;
                }
-       printf("\n");
+               printf("\n");
        }
-  return cnt;
-  }
+       return cnt;
+}
+
 
 /*------------------------------------------------------------*/
 int printFieldSet(fldSet *sf) {
-if (sf == NULL) {
-       printf("Field Set not yet created\n");
-       return 0;
+       if (sf == NULL) {
+               printf("Field Set not yet created\n");
+               return 0;
        }
-else
-       return (printFldSet(sf->head));
+       else
+               return (printFldSet(sf->head));
 }
 /*------------------------------------------------------------*/
 /*void destroy_set */
 
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index aee298f3c6775395a471fa4f2e39df9c0fa80287..aff16c52e4c2c63fc451af90b25653fdc668df51 100644 (file)
-#ifndef __SET__
-#define __SET__
+/* jit/sets.h -
 
-typedef struct methSet     methSet;
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: sets.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _SET_H
+#define _SET_H
+
+#include "types.h"
+
+typedef struct methSet      methSet;
 typedef struct methSetNode  methSetNode;
-typedef struct fldSet      fldSet;
+typedef struct fldSet       fldSet;
 typedef struct fldSetNode   fldSetNode;
-typedef struct classSet    classSet;
+typedef struct classSet     classSet;
 typedef struct classSetNode classSetNode;
 
 
+#include "global.h"
+
+
+/*------------ Method /Class Used Markers -------------------------------*/                 
+
+/* Class flags =
+   USED all methods and fields are available; 
+   PARTUSED = specific methods (static, <init>, <clinit>, inherited def used, special) used, 
+             but not instanciated
+   NOTUSED = nothing used in class - not needed 
+*/
+
+/* Method Flags =
+   USED = method definition is used
+   PARTUSED = method definition will be used if class instanciated
+   NOTUSED  = method defintion never used
+*/
+
+#define USED      2
+#define PARTUSED  1
+#define MARKED    1
+#define NOTUSED   0
+
+#define MONO      0
+#define MONO1    1 /* potential poly that is really mono */
+#define POLY      2
+
+
 /*------------------------------------------------------------*/
 /*-- flds used by a method set fns */
 /*------------------------------------------------------------*/
 struct fldSet {
-  fldSetNode *head;
-  fldSetNode *tail;
-  fldSetNode *pos;
-  s4 length;
-  };
+       fldSetNode *head;
+       fldSetNode *tail;
+       fldSetNode *pos;
+       s4 length;
+};
 
 
 struct fldSetNode {
-  fieldinfo *fldRef;
-  fldSetNode *nextfldRef;
-  bool writePUT;
-  bool readGET;
-  classSetNode *lastptrPUT; 
-  classSetNode *lastptrGET; 
-  s2 index;
-  };
-fldSetNode      *inFldSet (fldSetNode *, fieldinfo *);
-fldSetNode     *addFldRef(fldSetNode *, fieldinfo *);
-fldSet          *add2FldSet(fldSet    *, fieldinfo *, bool, bool);
-fldSet          *createFldSet();
-int             printFldSet  (fldSetNode *);
-int             printFieldSet (fldSet *);
+       fieldinfo *fldRef;
+       fldSetNode *nextfldRef;
+       bool writePUT;
+       bool readGET;
+       classSetNode *lastptrPUT; 
+       classSetNode *lastptrGET; 
+       s2 index;
+};
+
+
+fldSetNode *inFldSet (fldSetNode *, fieldinfo *);
+fldSetNode *addFldRef(fldSetNode *, fieldinfo *);
+fldSet *add2FldSet(fldSet *, fieldinfo *, bool, bool);
+fldSet *createFldSet();
+int printFldSet(fldSetNode *);
+int printFieldSet(fldSet *);
 
 
 /*------------------------------------------------------------*/
 /*-- methodinfo call set fns */
 /*------------------------------------------------------------*/
 struct methSet {
-  methSetNode *head;
-  methSetNode *tail;
-  methSetNode *pos;
-  s4 length;
-  };
+       methSetNode *head;
+       methSetNode *tail;
+       methSetNode *pos;
+       s4 length;
+};
+
 
 struct methSetNode {
-  methodinfo   *methRef;
-  methSetNode  *nextmethRef;
-  classSetNode *lastptrIntoClassSet2;
-  s2            index;
-  s4            monoPoly;
-  };
-
-int             inMethSet (methSetNode *, methodinfo *);
-methSetNode    *addMethRef(methSetNode *, methodinfo *);
-methSet         *add2MethSet(methSet    *, methodinfo *);
-methSet         *createMethSet();
-int             printMethSet   (methSetNode *);
-int             printMethodSet (methSet *);
+       methodinfo   *methRef;
+       methSetNode  *nextmethRef;
+       classSetNode *lastptrIntoClassSet2;
+       s2            index;
+       s4            monoPoly;
+};
+
+
+int inMethSet (methSetNode *, methodinfo *);
+methSetNode *addMethRef(methSetNode *, methodinfo *);
+methSet *add2MethSet(methSet    *, methodinfo *);
+methSet *createMethSet();
+int printMethSet   (methSetNode *);
+int printMethodSet (methSet *);
+
 
 /*------------------------------------------------------------*/
 /*-- classinfo XTA set fns  */
 /*------------------------------------------------------------*/
 
 struct classSet {
-  classSetNode *head;
-  classSetNode *tail;
-  classSetNode *pos;
-  s4 length;
-  };
+       classSetNode *head;
+       classSetNode *tail;
+       classSetNode *pos;
+       s4 length;
+};
+
 
 struct classSetNode {
-  classinfo *classType;
-  classSetNode *nextClass;
-  s2 index;
-  };
-
-int            inSet    (classSetNode *, classinfo *);
-classSetNode * addElement(classSetNode *,  classinfo *);
-classSet     *  add2ClassSet(classSet *,  classinfo *);
-classSet     *  createClassSet();
-int             inRange (classSetNode *, classinfo *);
-classSetNode * addClassCone(classSetNode *,  classinfo *);
-classSetNode *   intersectSubtypesWithSet(classinfo *, classSetNode *); 
-int             sizeOfSet(classSetNode *s);
-int            setSize(classSetNode *);
-int            printSet(classSetNode *);
-int            printClassSet(classSet *);
-
-#endif
+       classinfo *classType;
+       classSetNode *nextClass;
+       s2 index;
+};
+
+
+int inSet(classSetNode *, classinfo *);
+classSetNode *addElement(classSetNode *,  classinfo *);
+classSet *add2ClassSet(classSet *,  classinfo *);
+classSet *createClassSet();
+int inRange(classSetNode *, classinfo *);
+classSetNode *addClassCone(classSetNode *,  classinfo *);
+classSetNode *intersectSubtypesWithSet(classinfo *, classSetNode *); 
+int sizeOfSet(classSetNode *s);
+int setSize(classSetNode *);
+int printSet(classSetNode *);
+int printClassSet(classSet *);
+
+#endif /* _SETS_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index ccdc20131108dc3cd012476d50793a657f43964a..536754d06bbb0da3375ad635e415ba6ff3940ae0 100644 (file)
@@ -1,16 +1,49 @@
-/* jit/stack.c *****************************************************************
+/* jit/stack.c - stack analysis
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+
+   $Id: stack.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-       Parser for JavaVM to intermediate code translation
-       
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: 1997/11/18
+#include <stdio.h>
+#include "stack.h"
+#include "jit.h"
+#include "builtin.h"
+#include "disass.h"
+#include "reg.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+
+/* from codegen.inc */
+extern int dseglen;
 
-*******************************************************************************/
 
 #ifdef STATISTICS
 #define COUNT(cnt) cnt++
 
 #ifdef USEBUILTINTABLE
 static stdopdescriptor *find_builtin(stdopdescriptor *first, stdopdescriptor *last,
-               int icmd)
+                                                                        int icmd)
 {
        int len = last - first;
        int half;
@@ -173,24 +206,27 @@ static stdopdescriptor *find_builtin(stdopdescriptor *first, stdopdescriptor *la
 }
 #endif
 
-static void show_icmd_method();
 
-static void analyse_stack()
+void analyse_stack()
 {
-       int b_count, b_index;
+       int b_count;
+       int b_index;
        int stackdepth;
-       stackptr curstack, new, copy;
+       stackptr curstack;
+       stackptr new;
+       stackptr copy;
        int opcode, i, len, loops;
        int superblockend, repeat, deadcode;
-       instruction *iptr = instr;
-       basicblock *bptr, *tbptr;
+       instruction *iptr;
+       basicblock *bptr;
+       basicblock *tbptr;
        s4 *s4ptr;
        void* *tptr;
 
        //      int *argren = DMNEW(int, maxlocals); 
        int *argren = (int *)alloca(maxlocals * sizeof(int)); /* table for argument renaming */
        for (i = 0; i < maxlocals; i++)
-               argren[i]=i;
+               argren[i] = i;
        
        arguments_num = 0;
        new = stack;
@@ -208,7 +244,7 @@ static void analyse_stack()
                bptr->pre_count = 10000;
                STACKRESET;
                NEWXSTACK;
-               }
+       }
 
 #ifdef CONDITIONAL_LOADCONST
        b_count = block_count;
@@ -217,66 +253,66 @@ static void analyse_stack()
                if (bptr->icount != 0) {
                        iptr = bptr->iinstr + bptr->icount - 1;
                        switch (iptr->opc) {
-                               case ICMD_RET:
-                               case ICMD_RETURN:
-                               case ICMD_IRETURN:
-                               case ICMD_LRETURN:
-                               case ICMD_FRETURN:
-                               case ICMD_DRETURN:
-                               case ICMD_ARETURN:
-                               case ICMD_ATHROW:
-                                       break;
-
-                               case ICMD_IFEQ:
-                               case ICMD_IFNE:
-                               case ICMD_IFLT:
-                               case ICMD_IFGE:
-                               case ICMD_IFGT:
-                               case ICMD_IFLE:
-
-                               case ICMD_IFNULL:
-                               case ICMD_IFNONNULL:
-
-                               case ICMD_IF_ICMPEQ:
-                               case ICMD_IF_ICMPNE:
-                               case ICMD_IF_ICMPLT:
-                               case ICMD_IF_ICMPGE:
-                               case ICMD_IF_ICMPGT:
-                               case ICMD_IF_ICMPLE:
-
-                               case ICMD_IF_ACMPEQ:
-                               case ICMD_IF_ACMPNE:
-                                       bptr[1].pre_count++;
-                               case ICMD_GOTO:
-                                       block[block_index[iptr->op1]].pre_count++;
-                                       break;
-
-                               case ICMD_TABLESWITCH:
-                                       s4ptr = iptr->val.a;
-                                       block[block_index[*s4ptr++]].pre_count++;   /* default */
-                                       i = *s4ptr++;                               /* low     */
-                                       i = *s4ptr++ - i + 1;                       /* high    */
-                                       while (--i >= 0) {
-                                               block[block_index[*s4ptr++]].pre_count++;
-                                               }
-                                       break;
+                       case ICMD_RET:
+                       case ICMD_RETURN:
+                       case ICMD_IRETURN:
+                       case ICMD_LRETURN:
+                       case ICMD_FRETURN:
+                       case ICMD_DRETURN:
+                       case ICMD_ARETURN:
+                       case ICMD_ATHROW:
+                               break;
+
+                       case ICMD_IFEQ:
+                       case ICMD_IFNE:
+                       case ICMD_IFLT:
+                       case ICMD_IFGE:
+                       case ICMD_IFGT:
+                       case ICMD_IFLE:
+
+                       case ICMD_IFNULL:
+                       case ICMD_IFNONNULL:
+
+                       case ICMD_IF_ICMPEQ:
+                       case ICMD_IF_ICMPNE:
+                       case ICMD_IF_ICMPLT:
+                       case ICMD_IF_ICMPGE:
+                       case ICMD_IF_ICMPGT:
+                       case ICMD_IF_ICMPLE:
+
+                       case ICMD_IF_ACMPEQ:
+                       case ICMD_IF_ACMPNE:
+                               bptr[1].pre_count++;
+                       case ICMD_GOTO:
+                               block[block_index[iptr->op1]].pre_count++;
+                               break;
+
+                       case ICMD_TABLESWITCH:
+                               s4ptr = iptr->val.a;
+                               block[block_index[*s4ptr++]].pre_count++;   /* default */
+                               i = *s4ptr++;                               /* low     */
+                               i = *s4ptr++ - i + 1;                       /* high    */
+                               while (--i >= 0) {
+                                       block[block_index[*s4ptr++]].pre_count++;
+                               }
+                               break;
                                        
-                               case ICMD_LOOKUPSWITCH:
-                                       s4ptr = iptr->val.a;
-                                       block[block_index[*s4ptr++]].pre_count++;   /* default */
-                                       i = *s4ptr++;                               /* count   */
-                                       while (--i >= 0) {
-                                               block[block_index[s4ptr[1]]].pre_count++;
-                                               s4ptr += 2;
-                                               }
-                                       break;
-                               default:
-                                       bptr[1].pre_count++;
-                                       break;
+                       case ICMD_LOOKUPSWITCH:
+                               s4ptr = iptr->val.a;
+                               block[block_index[*s4ptr++]].pre_count++;   /* default */
+                               i = *s4ptr++;                               /* count   */
+                               while (--i >= 0) {
+                                       block[block_index[s4ptr[1]]].pre_count++;
+                                       s4ptr += 2;
                                }
+                               break;
+                       default:
+                               bptr[1].pre_count++;
+                               break;
                        }
-               bptr++;
                }
+               bptr++;
+       }
 #endif
 
 
@@ -291,7 +327,7 @@ static void analyse_stack()
                while (--b_count >= 0) {
                        if (bptr->flags == BBDELETED) {
                                /* do nothing */
-                               }
+                       }
                        else if (superblockend && (bptr->flags < BBREACHED))
                                repeat = true;
                        else if (bptr->flags <= BBREACHED) {
@@ -301,12 +337,12 @@ static void analyse_stack()
                                        COPYCURSTACK(copy);
                                        bptr->instack = copy;
                                        bptr->indepth = stackdepth;
-                                       }
+                               }
                                else if (bptr->indepth != stackdepth) {
                                        show_icmd_method();
                                        panic("Stack depth mismatch");
                                        
-                                       }
+                               }
                                curstack = bptr->instack;
                                deadcode = false;
                                superblockend = false;
@@ -342,608 +378,608 @@ static void analyse_stack()
 
                                                /* pop 0 push 0 */
 
-                                               case ICMD_NOP:
-                                               case ICMD_CHECKASIZE:
-
-                                               case ICMD_IFEQ_ICONST:
-                                               case ICMD_IFNE_ICONST:
-                                               case ICMD_IFLT_ICONST:
-                                               case ICMD_IFGE_ICONST:
-                                               case ICMD_IFGT_ICONST:
-                                               case ICMD_IFLE_ICONST:
-                                               case ICMD_ELSE_ICONST:
-                                                       SETDST;
-                                                       break;
-
-                                               case ICMD_RET:
-                                                       locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
-                                               case ICMD_RETURN:
-                                                       COUNT(count_pcmd_return);
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
+                                       case ICMD_NOP:
+                                       case ICMD_CHECKASIZE:
+
+                                       case ICMD_IFEQ_ICONST:
+                                       case ICMD_IFNE_ICONST:
+                                       case ICMD_IFLT_ICONST:
+                                       case ICMD_IFGE_ICONST:
+                                       case ICMD_IFGT_ICONST:
+                                       case ICMD_IFLE_ICONST:
+                                       case ICMD_ELSE_ICONST:
+                                               SETDST;
+                                               break;
+
+                                       case ICMD_RET:
+                                               locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
+                                       case ICMD_RETURN:
+                                               COUNT(count_pcmd_return);
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
 
                                                /* pop 0 push 1 const */
                                                
-                                               case ICMD_ICONST:
-                                                       COUNT(count_pcmd_load);
-                                                       if (len > 0) {
-                                                               switch (iptr[1].opc) {
-                                                                       case ICMD_IADD:
-                                                                               iptr[0].opc = ICMD_IADDCONST;
-icmd_iconst_tail:
-                                                                               iptr[1].opc = ICMD_NOP;
-                                                                               OP1_1(TYPE_INT,TYPE_INT);
-                                                                               COUNT(count_pcmd_op);
-                                                                               break;
-                                                                       case ICMD_ISUB:
-                                                                               iptr[0].opc = ICMD_ISUBCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IMUL:
-                                                                               iptr[0].opc = ICMD_IMULCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IDIV:
-                                                                               if (iptr[0].val.i == 0x00000002)
-                                                                                       iptr[0].val.i = 1;
-                                                                               else if (iptr[0].val.i == 0x00000004)
-                                                                                       iptr[0].val.i = 2;
-                                                                               else if (iptr[0].val.i == 0x00000008)
-                                                                                       iptr[0].val.i = 3;
-                                                                               else if (iptr[0].val.i == 0x00000010)
-                                                                                       iptr[0].val.i = 4;
-                                                                               else if (iptr[0].val.i == 0x00000020)
-                                                                                       iptr[0].val.i = 5;
-                                                                               else if (iptr[0].val.i == 0x00000040)
-                                                                                       iptr[0].val.i = 6;
-                                                                               else if (iptr[0].val.i == 0x00000080)
-                                                                                       iptr[0].val.i = 7;
-                                                                               else if (iptr[0].val.i == 0x00000100)
-                                                                                       iptr[0].val.i = 8;
-                                                                               else if (iptr[0].val.i == 0x00000200)
-                                                                                       iptr[0].val.i = 9;
-                                                                               else if (iptr[0].val.i == 0x00000400)
-                                                                                       iptr[0].val.i = 10;
-                                                                               else if (iptr[0].val.i == 0x00000800)
-                                                                                       iptr[0].val.i = 11;
-                                                                               else if (iptr[0].val.i == 0x00001000)
-                                                                                       iptr[0].val.i = 12;
-                                                                               else if (iptr[0].val.i == 0x00002000)
-                                                                                       iptr[0].val.i = 13;
-                                                                               else if (iptr[0].val.i == 0x00004000)
-                                                                                       iptr[0].val.i = 14;
-                                                                               else if (iptr[0].val.i == 0x00008000)
-                                                                                       iptr[0].val.i = 15;
-                                                                               else if (iptr[0].val.i == 0x00010000)
-                                                                                       iptr[0].val.i = 16;
-                                                                               else if (iptr[0].val.i == 0x00020000)
-                                                                                       iptr[0].val.i = 17;
-                                                                               else if (iptr[0].val.i == 0x00040000)
-                                                                                       iptr[0].val.i = 18;
-                                                                               else if (iptr[0].val.i == 0x00080000)
-                                                                                       iptr[0].val.i = 19;
-                                                                               else if (iptr[0].val.i == 0x00100000)
-                                                                                       iptr[0].val.i = 20;
-                                                                               else if (iptr[0].val.i == 0x00200000)
-                                                                                       iptr[0].val.i = 21;
-                                                                               else if (iptr[0].val.i == 0x00400000)
-                                                                                       iptr[0].val.i = 22;
-                                                                               else if (iptr[0].val.i == 0x00800000)
-                                                                                       iptr[0].val.i = 23;
-                                                                               else if (iptr[0].val.i == 0x01000000)
-                                                                                       iptr[0].val.i = 24;
-                                                                               else if (iptr[0].val.i == 0x02000000)
-                                                                                       iptr[0].val.i = 25;
-                                                                               else if (iptr[0].val.i == 0x04000000)
-                                                                                       iptr[0].val.i = 26;
-                                                                               else if (iptr[0].val.i == 0x08000000)
-                                                                                       iptr[0].val.i = 27;
-                                                                               else if (iptr[0].val.i == 0x10000000)
-                                                                                       iptr[0].val.i = 28;
-                                                                               else if (iptr[0].val.i == 0x20000000)
-                                                                                       iptr[0].val.i = 29;
-                                                                               else if (iptr[0].val.i == 0x40000000)
-                                                                                       iptr[0].val.i = 30;
-                                                                               else if (iptr[0].val.i == 0x80000000)
-                                                                                       iptr[0].val.i = 31;
-                                                                               else {
-                                                                                       PUSHCONST(TYPE_INT);
-                                                                                       break;
-                                                                                       }
-                                                                               iptr[0].opc = ICMD_IDIVPOW2;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IREM:
+                                       case ICMD_ICONST:
+                                               COUNT(count_pcmd_load);
+                                               if (len > 0) {
+                                                       switch (iptr[1].opc) {
+                                                       case ICMD_IADD:
+                                                               iptr[0].opc = ICMD_IADDCONST;
+                                                       icmd_iconst_tail:
+                                                               iptr[1].opc = ICMD_NOP;
+                                                               OP1_1(TYPE_INT,TYPE_INT);
+                                                               COUNT(count_pcmd_op);
+                                                               break;
+                                                       case ICMD_ISUB:
+                                                               iptr[0].opc = ICMD_ISUBCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IMUL:
+                                                               iptr[0].opc = ICMD_IMULCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IDIV:
+                                                               if (iptr[0].val.i == 0x00000002)
+                                                                       iptr[0].val.i = 1;
+                                                               else if (iptr[0].val.i == 0x00000004)
+                                                                       iptr[0].val.i = 2;
+                                                               else if (iptr[0].val.i == 0x00000008)
+                                                                       iptr[0].val.i = 3;
+                                                               else if (iptr[0].val.i == 0x00000010)
+                                                                       iptr[0].val.i = 4;
+                                                               else if (iptr[0].val.i == 0x00000020)
+                                                                       iptr[0].val.i = 5;
+                                                               else if (iptr[0].val.i == 0x00000040)
+                                                                       iptr[0].val.i = 6;
+                                                               else if (iptr[0].val.i == 0x00000080)
+                                                                       iptr[0].val.i = 7;
+                                                               else if (iptr[0].val.i == 0x00000100)
+                                                                       iptr[0].val.i = 8;
+                                                               else if (iptr[0].val.i == 0x00000200)
+                                                                       iptr[0].val.i = 9;
+                                                               else if (iptr[0].val.i == 0x00000400)
+                                                                       iptr[0].val.i = 10;
+                                                               else if (iptr[0].val.i == 0x00000800)
+                                                                       iptr[0].val.i = 11;
+                                                               else if (iptr[0].val.i == 0x00001000)
+                                                                       iptr[0].val.i = 12;
+                                                               else if (iptr[0].val.i == 0x00002000)
+                                                                       iptr[0].val.i = 13;
+                                                               else if (iptr[0].val.i == 0x00004000)
+                                                                       iptr[0].val.i = 14;
+                                                               else if (iptr[0].val.i == 0x00008000)
+                                                                       iptr[0].val.i = 15;
+                                                               else if (iptr[0].val.i == 0x00010000)
+                                                                       iptr[0].val.i = 16;
+                                                               else if (iptr[0].val.i == 0x00020000)
+                                                                       iptr[0].val.i = 17;
+                                                               else if (iptr[0].val.i == 0x00040000)
+                                                                       iptr[0].val.i = 18;
+                                                               else if (iptr[0].val.i == 0x00080000)
+                                                                       iptr[0].val.i = 19;
+                                                               else if (iptr[0].val.i == 0x00100000)
+                                                                       iptr[0].val.i = 20;
+                                                               else if (iptr[0].val.i == 0x00200000)
+                                                                       iptr[0].val.i = 21;
+                                                               else if (iptr[0].val.i == 0x00400000)
+                                                                       iptr[0].val.i = 22;
+                                                               else if (iptr[0].val.i == 0x00800000)
+                                                                       iptr[0].val.i = 23;
+                                                               else if (iptr[0].val.i == 0x01000000)
+                                                                       iptr[0].val.i = 24;
+                                                               else if (iptr[0].val.i == 0x02000000)
+                                                                       iptr[0].val.i = 25;
+                                                               else if (iptr[0].val.i == 0x04000000)
+                                                                       iptr[0].val.i = 26;
+                                                               else if (iptr[0].val.i == 0x08000000)
+                                                                       iptr[0].val.i = 27;
+                                                               else if (iptr[0].val.i == 0x10000000)
+                                                                       iptr[0].val.i = 28;
+                                                               else if (iptr[0].val.i == 0x20000000)
+                                                                       iptr[0].val.i = 29;
+                                                               else if (iptr[0].val.i == 0x40000000)
+                                                                       iptr[0].val.i = 30;
+                                                               else if (iptr[0].val.i == 0x80000000)
+                                                                       iptr[0].val.i = 31;
+                                                               else {
+                                                                       PUSHCONST(TYPE_INT);
+                                                                       break;
+                                                               }
+                                                               iptr[0].opc = ICMD_IDIVPOW2;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IREM:
 #if !defined(NO_DIV_OPT)
-                                                                               if (iptr[0].val.i == 0x10001) {
-                                                                                       iptr[0].opc = ICMD_IREM0X10001;
-                                                                                       goto icmd_iconst_tail;
-                                                                                       }
+                                                               if (iptr[0].val.i == 0x10001) {
+                                                                       iptr[0].opc = ICMD_IREM0X10001;
+                                                                       goto icmd_iconst_tail;
+                                                               }
 #endif
-                                                                               if ((iptr[0].val.i == 0x00000002) ||
-                                                                                   (iptr[0].val.i == 0x00000004) ||
-                                                                                   (iptr[0].val.i == 0x00000008) ||
-                                                                                   (iptr[0].val.i == 0x00000010) ||
-                                                                                   (iptr[0].val.i == 0x00000020) ||
-                                                                                   (iptr[0].val.i == 0x00000040) ||
-                                                                                   (iptr[0].val.i == 0x00000080) ||
-                                                                                   (iptr[0].val.i == 0x00000100) ||
-                                                                                   (iptr[0].val.i == 0x00000200) ||
-                                                                                   (iptr[0].val.i == 0x00000400) ||
-                                                                                   (iptr[0].val.i == 0x00000800) ||
-                                                                                   (iptr[0].val.i == 0x00001000) ||
-                                                                                   (iptr[0].val.i == 0x00002000) ||
-                                                                                   (iptr[0].val.i == 0x00004000) ||
-                                                                                   (iptr[0].val.i == 0x00008000) ||
-                                                                                   (iptr[0].val.i == 0x00010000) ||
-                                                                                   (iptr[0].val.i == 0x00020000) ||
-                                                                                   (iptr[0].val.i == 0x00040000) ||
-                                                                                   (iptr[0].val.i == 0x00080000) ||
-                                                                                   (iptr[0].val.i == 0x00100000) ||
-                                                                                   (iptr[0].val.i == 0x00200000) ||
-                                                                                   (iptr[0].val.i == 0x00400000) ||
-                                                                                   (iptr[0].val.i == 0x00800000) ||
-                                                                                   (iptr[0].val.i == 0x01000000) ||
-                                                                                   (iptr[0].val.i == 0x02000000) ||
-                                                                                   (iptr[0].val.i == 0x04000000) ||
-                                                                                   (iptr[0].val.i == 0x08000000) ||
-                                                                                   (iptr[0].val.i == 0x10000000) ||
-                                                                                   (iptr[0].val.i == 0x20000000) ||
-                                                                                   (iptr[0].val.i == 0x40000000) ||
-                                                                                   (iptr[0].val.i == 0x80000000)) {
-                                                                                       iptr[0].opc = ICMD_IREMPOW2;
-                                                                                       iptr[0].val.i -= 1;
-                                                                                       goto icmd_iconst_tail;
-                                                                                       }
-                                                                               PUSHCONST(TYPE_INT);
-                                                                               break;
-                                                                       case ICMD_IAND:
-                                                                               iptr[0].opc = ICMD_IANDCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IOR:
-                                                                               iptr[0].opc = ICMD_IORCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IXOR:
-                                                                               iptr[0].opc = ICMD_IXORCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_ISHL:
-                                                                               iptr[0].opc = ICMD_ISHLCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_ISHR:
-                                                                               iptr[0].opc = ICMD_ISHRCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IUSHR:
-                                                                               iptr[0].opc = ICMD_IUSHRCONST;
-                                                                               goto icmd_iconst_tail;
+                                                               if ((iptr[0].val.i == 0x00000002) ||
+                                                                       (iptr[0].val.i == 0x00000004) ||
+                                                                       (iptr[0].val.i == 0x00000008) ||
+                                                                       (iptr[0].val.i == 0x00000010) ||
+                                                                       (iptr[0].val.i == 0x00000020) ||
+                                                                       (iptr[0].val.i == 0x00000040) ||
+                                                                       (iptr[0].val.i == 0x00000080) ||
+                                                                       (iptr[0].val.i == 0x00000100) ||
+                                                                       (iptr[0].val.i == 0x00000200) ||
+                                                                       (iptr[0].val.i == 0x00000400) ||
+                                                                       (iptr[0].val.i == 0x00000800) ||
+                                                                       (iptr[0].val.i == 0x00001000) ||
+                                                                       (iptr[0].val.i == 0x00002000) ||
+                                                                       (iptr[0].val.i == 0x00004000) ||
+                                                                       (iptr[0].val.i == 0x00008000) ||
+                                                                       (iptr[0].val.i == 0x00010000) ||
+                                                                       (iptr[0].val.i == 0x00020000) ||
+                                                                       (iptr[0].val.i == 0x00040000) ||
+                                                                       (iptr[0].val.i == 0x00080000) ||
+                                                                       (iptr[0].val.i == 0x00100000) ||
+                                                                       (iptr[0].val.i == 0x00200000) ||
+                                                                       (iptr[0].val.i == 0x00400000) ||
+                                                                       (iptr[0].val.i == 0x00800000) ||
+                                                                       (iptr[0].val.i == 0x01000000) ||
+                                                                       (iptr[0].val.i == 0x02000000) ||
+                                                                       (iptr[0].val.i == 0x04000000) ||
+                                                                       (iptr[0].val.i == 0x08000000) ||
+                                                                       (iptr[0].val.i == 0x10000000) ||
+                                                                       (iptr[0].val.i == 0x20000000) ||
+                                                                       (iptr[0].val.i == 0x40000000) ||
+                                                                       (iptr[0].val.i == 0x80000000)) {
+                                                                       iptr[0].opc = ICMD_IREMPOW2;
+                                                                       iptr[0].val.i -= 1;
+                                                                       goto icmd_iconst_tail;
+                                                               }
+                                                               PUSHCONST(TYPE_INT);
+                                                               break;
+                                                       case ICMD_IAND:
+                                                               iptr[0].opc = ICMD_IANDCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IOR:
+                                                               iptr[0].opc = ICMD_IORCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IXOR:
+                                                               iptr[0].opc = ICMD_IXORCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_ISHL:
+                                                               iptr[0].opc = ICMD_ISHLCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_ISHR:
+                                                               iptr[0].opc = ICMD_ISHRCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IUSHR:
+                                                               iptr[0].opc = ICMD_IUSHRCONST;
+                                                               goto icmd_iconst_tail;
 #if SUPPORT_LONG_SHIFT
-                                                                       case ICMD_LSHL:
-                                                                               iptr[0].opc = ICMD_LSHLCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LSHR:
-                                                                               iptr[0].opc = ICMD_LSHRCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LUSHR:
-                                                                               iptr[0].opc = ICMD_LUSHRCONST;
-                                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LSHL:
+                                                               iptr[0].opc = ICMD_LSHLCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LSHR:
+                                                               iptr[0].opc = ICMD_LSHRCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LUSHR:
+                                                               iptr[0].opc = ICMD_LUSHRCONST;
+                                                               goto icmd_lconst_tail;
 #endif
-                                                                       case ICMD_IF_ICMPEQ:
-                                                                               iptr[0].opc = ICMD_IFEQ;
-icmd_if_icmp_tail:
-                                                                               iptr[0].op1 = iptr[1].op1;
-                                                                               bptr->icount--;
-                                                                               len--;
-                                                                               /* iptr[1].opc = ICMD_NOP; */
-                                                                               OP1_0(TYPE_INT);
-                                                                               tbptr = block + block_index[iptr->op1];
-
-                                                                               iptr[0].target = (void *) tbptr;
+                                                       case ICMD_IF_ICMPEQ:
+                                                               iptr[0].opc = ICMD_IFEQ;
+                                                       icmd_if_icmp_tail:
+                                                               iptr[0].op1 = iptr[1].op1;
+                                                               bptr->icount--;
+                                                               len--;
+                                                               /* iptr[1].opc = ICMD_NOP; */
+                                                               OP1_0(TYPE_INT);
+                                                               tbptr = block + block_index[iptr->op1];
+
+                                                               iptr[0].target = (void *) tbptr;
 
-                                                                               MARKREACHED(tbptr, copy);
-                                                                               COUNT(count_pcmd_bra);
-                                                                               break;
-                                                                       case ICMD_IF_ICMPLT:
-                                                                               iptr[0].opc = ICMD_IFLT;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       case ICMD_IF_ICMPLE:
-                                                                               iptr[0].opc = ICMD_IFLE;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       case ICMD_IF_ICMPNE:
-                                                                               iptr[0].opc = ICMD_IFNE;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       case ICMD_IF_ICMPGT:
-                                                                               iptr[0].opc = ICMD_IFGT;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       case ICMD_IF_ICMPGE:
-                                                                               iptr[0].opc = ICMD_IFGE;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       default:
-                                                                               PUSHCONST(TYPE_INT);
-                                                                       }
-                                                               }
-                                                       else
+                                                               MARKREACHED(tbptr, copy);
+                                                               COUNT(count_pcmd_bra);
+                                                               break;
+                                                       case ICMD_IF_ICMPLT:
+                                                               iptr[0].opc = ICMD_IFLT;
+                                                               goto icmd_if_icmp_tail;
+                                                       case ICMD_IF_ICMPLE:
+                                                               iptr[0].opc = ICMD_IFLE;
+                                                               goto icmd_if_icmp_tail;
+                                                       case ICMD_IF_ICMPNE:
+                                                               iptr[0].opc = ICMD_IFNE;
+                                                               goto icmd_if_icmp_tail;
+                                                       case ICMD_IF_ICMPGT:
+                                                               iptr[0].opc = ICMD_IFGT;
+                                                               goto icmd_if_icmp_tail;
+                                                       case ICMD_IF_ICMPGE:
+                                                               iptr[0].opc = ICMD_IFGE;
+                                                               goto icmd_if_icmp_tail;
+                                                       default:
                                                                PUSHCONST(TYPE_INT);
-                                                       break;
-                                               case ICMD_LCONST:
-                                                       COUNT(count_pcmd_load);
-                                                       if (len > 0) {
-                                                               switch (iptr[1].opc) {
+                                                       }
+                                               }
+                                               else
+                                                       PUSHCONST(TYPE_INT);
+                                               break;
+                                       case ICMD_LCONST:
+                                               COUNT(count_pcmd_load);
+                                               if (len > 0) {
+                                                       switch (iptr[1].opc) {
 #if SUPPORT_LONG_ADD
-                                                                       case ICMD_LADD:
-                                                                               iptr[0].opc = ICMD_LADDCONST;
-icmd_lconst_tail:
-                                                                               iptr[1].opc = ICMD_NOP;
-                                                                               OP1_1(TYPE_LNG,TYPE_LNG);
-                                                                               COUNT(count_pcmd_op);
-                                                                               break;
-                                                                       case ICMD_LSUB:
-                                                                               iptr[0].opc = ICMD_LSUBCONST;
-                                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LADD:
+                                                               iptr[0].opc = ICMD_LADDCONST;
+                                                       icmd_lconst_tail:
+                                                               iptr[1].opc = ICMD_NOP;
+                                                               OP1_1(TYPE_LNG,TYPE_LNG);
+                                                               COUNT(count_pcmd_op);
+                                                               break;
+                                                       case ICMD_LSUB:
+                                                               iptr[0].opc = ICMD_LSUBCONST;
+                                                               goto icmd_lconst_tail;
 #endif
 #if SUPPORT_LONG_MULDIV
-                                                                       case ICMD_LMUL:
-                                                                               iptr[0].opc = ICMD_LMULCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LDIV:
-                                                                               if (iptr[0].val.l == 0x00000002)
-                                                                                       iptr[0].val.i = 1;
-                                                                               else if (iptr[0].val.l == 0x00000004)
-                                                                                       iptr[0].val.i = 2;
-                                                                               else if (iptr[0].val.l == 0x00000008)
-                                                                                       iptr[0].val.i = 3;
-                                                                               else if (iptr[0].val.l == 0x00000010)
-                                                                                       iptr[0].val.i = 4;
-                                                                               else if (iptr[0].val.l == 0x00000020)
-                                                                                       iptr[0].val.i = 5;
-                                                                               else if (iptr[0].val.l == 0x00000040)
-                                                                                       iptr[0].val.i = 6;
-                                                                               else if (iptr[0].val.l == 0x00000080)
-                                                                                       iptr[0].val.i = 7;
-                                                                               else if (iptr[0].val.l == 0x00000100)
-                                                                                       iptr[0].val.i = 8;
-                                                                               else if (iptr[0].val.l == 0x00000200)
-                                                                                       iptr[0].val.i = 9;
-                                                                               else if (iptr[0].val.l == 0x00000400)
-                                                                                       iptr[0].val.i = 10;
-                                                                               else if (iptr[0].val.l == 0x00000800)
-                                                                                       iptr[0].val.i = 11;
-                                                                               else if (iptr[0].val.l == 0x00001000)
-                                                                                       iptr[0].val.i = 12;
-                                                                               else if (iptr[0].val.l == 0x00002000)
-                                                                                       iptr[0].val.i = 13;
-                                                                               else if (iptr[0].val.l == 0x00004000)
-                                                                                       iptr[0].val.i = 14;
-                                                                               else if (iptr[0].val.l == 0x00008000)
-                                                                                       iptr[0].val.i = 15;
-                                                                               else if (iptr[0].val.l == 0x00010000)
-                                                                                       iptr[0].val.i = 16;
-                                                                               else if (iptr[0].val.l == 0x00020000)
-                                                                                       iptr[0].val.i = 17;
-                                                                               else if (iptr[0].val.l == 0x00040000)
-                                                                                       iptr[0].val.i = 18;
-                                                                               else if (iptr[0].val.l == 0x00080000)
-                                                                                       iptr[0].val.i = 19;
-                                                                               else if (iptr[0].val.l == 0x00100000)
-                                                                                       iptr[0].val.i = 20;
-                                                                               else if (iptr[0].val.l == 0x00200000)
-                                                                                       iptr[0].val.i = 21;
-                                                                               else if (iptr[0].val.l == 0x00400000)
-                                                                                       iptr[0].val.i = 22;
-                                                                               else if (iptr[0].val.l == 0x00800000)
-                                                                                       iptr[0].val.i = 23;
-                                                                               else if (iptr[0].val.l == 0x01000000)
-                                                                                       iptr[0].val.i = 24;
-                                                                               else if (iptr[0].val.l == 0x02000000)
-                                                                                       iptr[0].val.i = 25;
-                                                                               else if (iptr[0].val.l == 0x04000000)
-                                                                                       iptr[0].val.i = 26;
-                                                                               else if (iptr[0].val.l == 0x08000000)
-                                                                                       iptr[0].val.i = 27;
-                                                                               else if (iptr[0].val.l == 0x10000000)
-                                                                                       iptr[0].val.i = 28;
-                                                                               else if (iptr[0].val.l == 0x20000000)
-                                                                                       iptr[0].val.i = 29;
-                                                                               else if (iptr[0].val.l == 0x40000000)
-                                                                                       iptr[0].val.i = 30;
-                                                                               else if (iptr[0].val.l == 0x80000000)
-                                                                                       iptr[0].val.i = 31;
-                                                                               else {
-                                                                                       PUSHCONST(TYPE_LNG);
-                                                                                       break;
-                                                                                       }
-                                                                               iptr[0].opc = ICMD_LDIVPOW2;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LREM:
+                                                       case ICMD_LMUL:
+                                                               iptr[0].opc = ICMD_LMULCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LDIV:
+                                                               if (iptr[0].val.l == 0x00000002)
+                                                                       iptr[0].val.i = 1;
+                                                               else if (iptr[0].val.l == 0x00000004)
+                                                                       iptr[0].val.i = 2;
+                                                               else if (iptr[0].val.l == 0x00000008)
+                                                                       iptr[0].val.i = 3;
+                                                               else if (iptr[0].val.l == 0x00000010)
+                                                                       iptr[0].val.i = 4;
+                                                               else if (iptr[0].val.l == 0x00000020)
+                                                                       iptr[0].val.i = 5;
+                                                               else if (iptr[0].val.l == 0x00000040)
+                                                                       iptr[0].val.i = 6;
+                                                               else if (iptr[0].val.l == 0x00000080)
+                                                                       iptr[0].val.i = 7;
+                                                               else if (iptr[0].val.l == 0x00000100)
+                                                                       iptr[0].val.i = 8;
+                                                               else if (iptr[0].val.l == 0x00000200)
+                                                                       iptr[0].val.i = 9;
+                                                               else if (iptr[0].val.l == 0x00000400)
+                                                                       iptr[0].val.i = 10;
+                                                               else if (iptr[0].val.l == 0x00000800)
+                                                                       iptr[0].val.i = 11;
+                                                               else if (iptr[0].val.l == 0x00001000)
+                                                                       iptr[0].val.i = 12;
+                                                               else if (iptr[0].val.l == 0x00002000)
+                                                                       iptr[0].val.i = 13;
+                                                               else if (iptr[0].val.l == 0x00004000)
+                                                                       iptr[0].val.i = 14;
+                                                               else if (iptr[0].val.l == 0x00008000)
+                                                                       iptr[0].val.i = 15;
+                                                               else if (iptr[0].val.l == 0x00010000)
+                                                                       iptr[0].val.i = 16;
+                                                               else if (iptr[0].val.l == 0x00020000)
+                                                                       iptr[0].val.i = 17;
+                                                               else if (iptr[0].val.l == 0x00040000)
+                                                                       iptr[0].val.i = 18;
+                                                               else if (iptr[0].val.l == 0x00080000)
+                                                                       iptr[0].val.i = 19;
+                                                               else if (iptr[0].val.l == 0x00100000)
+                                                                       iptr[0].val.i = 20;
+                                                               else if (iptr[0].val.l == 0x00200000)
+                                                                       iptr[0].val.i = 21;
+                                                               else if (iptr[0].val.l == 0x00400000)
+                                                                       iptr[0].val.i = 22;
+                                                               else if (iptr[0].val.l == 0x00800000)
+                                                                       iptr[0].val.i = 23;
+                                                               else if (iptr[0].val.l == 0x01000000)
+                                                                       iptr[0].val.i = 24;
+                                                               else if (iptr[0].val.l == 0x02000000)
+                                                                       iptr[0].val.i = 25;
+                                                               else if (iptr[0].val.l == 0x04000000)
+                                                                       iptr[0].val.i = 26;
+                                                               else if (iptr[0].val.l == 0x08000000)
+                                                                       iptr[0].val.i = 27;
+                                                               else if (iptr[0].val.l == 0x10000000)
+                                                                       iptr[0].val.i = 28;
+                                                               else if (iptr[0].val.l == 0x20000000)
+                                                                       iptr[0].val.i = 29;
+                                                               else if (iptr[0].val.l == 0x40000000)
+                                                                       iptr[0].val.i = 30;
+                                                               else if (iptr[0].val.l == 0x80000000)
+                                                                       iptr[0].val.i = 31;
+                                                               else {
+                                                                       PUSHCONST(TYPE_LNG);
+                                                                       break;
+                                                               }
+                                                               iptr[0].opc = ICMD_LDIVPOW2;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LREM:
 #if !defined(NO_DIV_OPT)
-                                                                               if (iptr[0].val.l == 0x10001) {
-                                                                                       iptr[0].opc = ICMD_LREM0X10001;
-                                                                                       goto icmd_lconst_tail;
-                                                                                       }
+                                                               if (iptr[0].val.l == 0x10001) {
+                                                                       iptr[0].opc = ICMD_LREM0X10001;
+                                                                       goto icmd_lconst_tail;
+                                                               }
 #endif
-                                                                               if ((iptr[0].val.l == 0x00000002) ||
-                                                                                   (iptr[0].val.l == 0x00000004) ||
-                                                                                   (iptr[0].val.l == 0x00000008) ||
-                                                                                   (iptr[0].val.l == 0x00000010) ||
-                                                                                   (iptr[0].val.l == 0x00000020) ||
-                                                                                   (iptr[0].val.l == 0x00000040) ||
-                                                                                   (iptr[0].val.l == 0x00000080) ||
-                                                                                   (iptr[0].val.l == 0x00000100) ||
-                                                                                   (iptr[0].val.l == 0x00000200) ||
-                                                                                   (iptr[0].val.l == 0x00000400) ||
-                                                                                   (iptr[0].val.l == 0x00000800) ||
-                                                                                   (iptr[0].val.l == 0x00001000) ||
-                                                                                   (iptr[0].val.l == 0x00002000) ||
-                                                                                   (iptr[0].val.l == 0x00004000) ||
-                                                                                   (iptr[0].val.l == 0x00008000) ||
-                                                                                   (iptr[0].val.l == 0x00010000) ||
-                                                                                   (iptr[0].val.l == 0x00020000) ||
-                                                                                   (iptr[0].val.l == 0x00040000) ||
-                                                                                   (iptr[0].val.l == 0x00080000) ||
-                                                                                   (iptr[0].val.l == 0x00100000) ||
-                                                                                   (iptr[0].val.l == 0x00200000) ||
-                                                                                   (iptr[0].val.l == 0x00400000) ||
-                                                                                   (iptr[0].val.l == 0x00800000) ||
-                                                                                   (iptr[0].val.l == 0x01000000) ||
-                                                                                   (iptr[0].val.l == 0x02000000) ||
-                                                                                   (iptr[0].val.l == 0x04000000) ||
-                                                                                   (iptr[0].val.l == 0x08000000) ||
-                                                                                   (iptr[0].val.l == 0x10000000) ||
-                                                                                   (iptr[0].val.l == 0x20000000) ||
-                                                                                   (iptr[0].val.l == 0x40000000) ||
-                                                                                   (iptr[0].val.l == 0x80000000)) {
-                                                                                       iptr[0].opc = ICMD_LREMPOW2;
-                                                                                       iptr[0].val.l -= 1;
-                                                                                       goto icmd_lconst_tail;
-                                                                                       }
-                                                                               PUSHCONST(TYPE_LNG);
-                                                                               break;
+                                                               if ((iptr[0].val.l == 0x00000002) ||
+                                                                       (iptr[0].val.l == 0x00000004) ||
+                                                                       (iptr[0].val.l == 0x00000008) ||
+                                                                       (iptr[0].val.l == 0x00000010) ||
+                                                                       (iptr[0].val.l == 0x00000020) ||
+                                                                       (iptr[0].val.l == 0x00000040) ||
+                                                                       (iptr[0].val.l == 0x00000080) ||
+                                                                       (iptr[0].val.l == 0x00000100) ||
+                                                                       (iptr[0].val.l == 0x00000200) ||
+                                                                       (iptr[0].val.l == 0x00000400) ||
+                                                                       (iptr[0].val.l == 0x00000800) ||
+                                                                       (iptr[0].val.l == 0x00001000) ||
+                                                                       (iptr[0].val.l == 0x00002000) ||
+                                                                       (iptr[0].val.l == 0x00004000) ||
+                                                                       (iptr[0].val.l == 0x00008000) ||
+                                                                       (iptr[0].val.l == 0x00010000) ||
+                                                                       (iptr[0].val.l == 0x00020000) ||
+                                                                       (iptr[0].val.l == 0x00040000) ||
+                                                                       (iptr[0].val.l == 0x00080000) ||
+                                                                       (iptr[0].val.l == 0x00100000) ||
+                                                                       (iptr[0].val.l == 0x00200000) ||
+                                                                       (iptr[0].val.l == 0x00400000) ||
+                                                                       (iptr[0].val.l == 0x00800000) ||
+                                                                       (iptr[0].val.l == 0x01000000) ||
+                                                                       (iptr[0].val.l == 0x02000000) ||
+                                                                       (iptr[0].val.l == 0x04000000) ||
+                                                                       (iptr[0].val.l == 0x08000000) ||
+                                                                       (iptr[0].val.l == 0x10000000) ||
+                                                                       (iptr[0].val.l == 0x20000000) ||
+                                                                       (iptr[0].val.l == 0x40000000) ||
+                                                                       (iptr[0].val.l == 0x80000000)) {
+                                                                       iptr[0].opc = ICMD_LREMPOW2;
+                                                                       iptr[0].val.l -= 1;
+                                                                       goto icmd_lconst_tail;
+                                                               }
+                                                               PUSHCONST(TYPE_LNG);
+                                                               break;
 #endif
 #if SUPPORT_LONG_LOG
-                                                                       case ICMD_LAND:
-                                                                               iptr[0].opc = ICMD_LANDCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LOR:
-                                                                               iptr[0].opc = ICMD_LORCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LXOR:
-                                                                               iptr[0].opc = ICMD_LXORCONST;
-                                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LAND:
+                                                               iptr[0].opc = ICMD_LANDCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LOR:
+                                                               iptr[0].opc = ICMD_LORCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LXOR:
+                                                               iptr[0].opc = ICMD_LXORCONST;
+                                                               goto icmd_lconst_tail;
 #endif
 #if defined(NOLONG_CONDITIONAL)
-                                                                       case ICMD_LCMP:
-                                                                               if ((len > 1) && (iptr[2].val.i == 0)) {
-                                                                                       switch (iptr[2].opc) {
-                                                                                       case ICMD_IFEQ:
-                                                                                               iptr[0].opc = ICMD_IF_LEQ;
-icmd_lconst_lcmp_tail:
-                                                                                               iptr[0].op1 = iptr[2].op1;
-                                                                                               bptr->icount -= 2;
-                                                                                               len -= 2;
-                                                                                               /* iptr[1].opc = ICMD_NOP;
-                                                                                               iptr[2].opc = ICMD_NOP; */
-                                                                                               OP1_0(TYPE_LNG);
-                                                                                               tbptr = block + block_index[iptr->op1];
-
-                                                                                               iptr[0].target = (void *) tbptr;
-
-                                                                                               MARKREACHED(tbptr, copy);
-                                                                                               COUNT(count_pcmd_bra);
-                                                                                               COUNT(count_pcmd_op);
-                                                                                               break;
-                                                                                       case ICMD_IFNE:
-                                                                                               iptr[0].opc = ICMD_IF_LNE;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       case ICMD_IFLT:
-                                                                                               iptr[0].opc = ICMD_IF_LLT;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       case ICMD_IFGT:
-                                                                                               iptr[0].opc = ICMD_IF_LGT;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       case ICMD_IFLE:
-                                                                                               iptr[0].opc = ICMD_IF_LLE;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       case ICMD_IFGE:
-                                                                                               iptr[0].opc = ICMD_IF_LGE;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       default:
-                                                                                               PUSHCONST(TYPE_LNG);
-                                                                                       } /* switch (iptr[2].opc) */
-                                                                                       } /* if (iptr[2].val.i == 0) */
-                                                                               else
-                                                                                       PUSHCONST(TYPE_LNG);
+                                                       case ICMD_LCMP:
+                                                               if ((len > 1) && (iptr[2].val.i == 0)) {
+                                                                       switch (iptr[2].opc) {
+                                                                       case ICMD_IFEQ:
+                                                                               iptr[0].opc = ICMD_IF_LEQ;
+                                                                       icmd_lconst_lcmp_tail:
+                                                                               iptr[0].op1 = iptr[2].op1;
+                                                                               bptr->icount -= 2;
+                                                                               len -= 2;
+                                                                               /* iptr[1].opc = ICMD_NOP;
+                                                                                  iptr[2].opc = ICMD_NOP; */
+                                                                               OP1_0(TYPE_LNG);
+                                                                               tbptr = block + block_index[iptr->op1];
+
+                                                                               iptr[0].target = (void *) tbptr;
+
+                                                                               MARKREACHED(tbptr, copy);
+                                                                               COUNT(count_pcmd_bra);
+                                                                               COUNT(count_pcmd_op);
                                                                                break;
-#endif
+                                                                       case ICMD_IFNE:
+                                                                               iptr[0].opc = ICMD_IF_LNE;
+                                                                               goto icmd_lconst_lcmp_tail;
+                                                                       case ICMD_IFLT:
+                                                                               iptr[0].opc = ICMD_IF_LLT;
+                                                                               goto icmd_lconst_lcmp_tail;
+                                                                       case ICMD_IFGT:
+                                                                               iptr[0].opc = ICMD_IF_LGT;
+                                                                               goto icmd_lconst_lcmp_tail;
+                                                                       case ICMD_IFLE:
+                                                                               iptr[0].opc = ICMD_IF_LLE;
+                                                                               goto icmd_lconst_lcmp_tail;
+                                                                       case ICMD_IFGE:
+                                                                               iptr[0].opc = ICMD_IF_LGE;
+                                                                               goto icmd_lconst_lcmp_tail;
                                                                        default:
                                                                                PUSHCONST(TYPE_LNG);
-                                                                       }
-                                                               }
-                                                       else
+                                                                       } /* switch (iptr[2].opc) */
+                                                               } /* if (iptr[2].val.i == 0) */
+                                                               else
+                                                                       PUSHCONST(TYPE_LNG);
+                                                               break;
+#endif
+                                                       default:
                                                                PUSHCONST(TYPE_LNG);
-                                                       break;
-                                               case ICMD_FCONST:
-                                                       COUNT(count_pcmd_load);
-                                                       PUSHCONST(TYPE_FLT);
-                                                       break;
-                                               case ICMD_DCONST:
-                                                       COUNT(count_pcmd_load);
-                                                       PUSHCONST(TYPE_DBL);
-                                                       break;
-                                               case ICMD_ACONST:
-                                                       COUNT(count_pcmd_load);
-                                                       PUSHCONST(TYPE_ADR);
-                                                       break;
+                                                       }
+                                               }
+                                               else
+                                                       PUSHCONST(TYPE_LNG);
+                                               break;
+                                       case ICMD_FCONST:
+                                               COUNT(count_pcmd_load);
+                                               PUSHCONST(TYPE_FLT);
+                                               break;
+                                       case ICMD_DCONST:
+                                               COUNT(count_pcmd_load);
+                                               PUSHCONST(TYPE_DBL);
+                                               break;
+                                       case ICMD_ACONST:
+                                               COUNT(count_pcmd_load);
+                                               PUSHCONST(TYPE_ADR);
+                                               break;
 
                                                /* pop 0 push 1 load */
                                                
-                                               case ICMD_ILOAD:
-                                               case ICMD_LLOAD:
-                                               case ICMD_FLOAD:
-                                               case ICMD_DLOAD:
-                                               case ICMD_ALOAD:
-                                                       COUNT(count_load_instruction);
-                                                       i = opcode-ICMD_ILOAD;
-                                                       iptr->op1 = argren[iptr->op1];
-                                                       locals[ iptr->op1 ][i].type = i;
-                                                       LOAD(i, LOCALVAR, iptr->op1);
-                                                       break;
+                                       case ICMD_ILOAD:
+                                       case ICMD_LLOAD:
+                                       case ICMD_FLOAD:
+                                       case ICMD_DLOAD:
+                                       case ICMD_ALOAD:
+                                               COUNT(count_load_instruction);
+                                               i = opcode-ICMD_ILOAD;
+                                               iptr->op1 = argren[iptr->op1];
+                                               locals[iptr->op1][i].type = i;
+                                               LOAD(i, LOCALVAR, iptr->op1);
+                                               break;
 
                                                /* pop 2 push 1 */
 
-                                               case ICMD_IALOAD:
-                                               case ICMD_LALOAD:
-                                               case ICMD_FALOAD:
-                                               case ICMD_DALOAD:
-                                               case ICMD_AALOAD:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_check_bound);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP2IAT_1(opcode-ICMD_IALOAD);
-                                                       break;
-
-                                               case ICMD_BALOAD:
-                                               case ICMD_CALOAD:
-                                               case ICMD_SALOAD:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_check_bound);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP2IAT_1(TYPE_INT);
-                                                       break;
+                                       case ICMD_IALOAD:
+                                       case ICMD_LALOAD:
+                                       case ICMD_FALOAD:
+                                       case ICMD_DALOAD:
+                                       case ICMD_AALOAD:
+                                               COUNT(count_check_null);
+                                               COUNT(count_check_bound);
+                                               COUNT(count_pcmd_mem);
+                                               OP2IAT_1(opcode-ICMD_IALOAD);
+                                               break;
+
+                                       case ICMD_BALOAD:
+                                       case ICMD_CALOAD:
+                                       case ICMD_SALOAD:
+                                               COUNT(count_check_null);
+                                               COUNT(count_check_bound);
+                                               COUNT(count_pcmd_mem);
+                                               OP2IAT_1(TYPE_INT);
+                                               break;
 
                                                /* pop 0 push 0 iinc */
 
-                                               case ICMD_IINC:
+                                       case ICMD_IINC:
 #ifdef STATISTICS
-                                                       i = stackdepth;
-                                                       if (i >= 10)
-                                                               count_store_depth[10]++;
-                                                       else
-                                                               count_store_depth[i]++;
+                                               i = stackdepth;
+                                               if (i >= 10)
+                                                       count_store_depth[10]++;
+                                               else
+                                                       count_store_depth[i]++;
 #endif
-                                                       copy = curstack;
-                                                       i = stackdepth - 1;
-                                                       while (copy) {
-                                                               if ((copy->varkind == LOCALVAR) &&
-                                                                   (copy->varnum == iptr->op1)) {
-                                                                       copy->varkind = TEMPVAR;
-                                                                       copy->varnum = i;
-                                                                       }
-                                                               i--;
-                                                               copy = copy->prev;
-                                                               }
-                                                       SETDST;
-                                                       break;
+                                               copy = curstack;
+                                               i = stackdepth - 1;
+                                               while (copy) {
+                                                       if ((copy->varkind == LOCALVAR) &&
+                                                               (copy->varnum == iptr->op1)) {
+                                                               copy->varkind = TEMPVAR;
+                                                               copy->varnum = i;
+                                                       }
+                                                       i--;
+                                                       copy = copy->prev;
+                                               }
+                                               SETDST;
+                                               break;
 
                                                /* pop 1 push 0 store */
 
-                                               case ICMD_ISTORE:
-                                               case ICMD_LSTORE:
-                                               case ICMD_FSTORE:
-                                               case ICMD_DSTORE:
-                                               case ICMD_ASTORE:
-icmd_store:
+                                       case ICMD_ISTORE:
+                                       case ICMD_LSTORE:
+                                       case ICMD_FSTORE:
+                                       case ICMD_DSTORE:
+                                       case ICMD_ASTORE:
+                                       icmd_store:
 
-                                               i = opcode-ICMD_ISTORE;
-                                                       locals[iptr->op1][i].type = i;
+                                       i = opcode-ICMD_ISTORE;
+                                       locals[iptr->op1][i].type = i;
 #ifdef STATISTICS
-                                                       count_pcmd_store++;
-                                                       i = new - curstack;
-                                                       if (i >= 20)
-                                                               count_store_length[20]++;
-                                                       else
-                                                               count_store_length[i]++;
-                                                       i = stackdepth - 1;
-                                                       if (i >= 10)
-                                                               count_store_depth[10]++;
-                                                       else
-                                                               count_store_depth[i]++;
+                                       count_pcmd_store++;
+                                       i = new - curstack;
+                                       if (i >= 20)
+                                               count_store_length[20]++;
+                                       else
+                                               count_store_length[i]++;
+                                       i = stackdepth - 1;
+                                       if (i >= 10)
+                                               count_store_depth[10]++;
+                                       else
+                                               count_store_depth[i]++;
 #endif
-                                                       copy = curstack->prev;
-                                                       i = stackdepth - 2;
-                                                       while (copy) {
-                                                               if ((copy->varkind == LOCALVAR) &&
-                                                                   (copy->varnum == iptr->op1)) {
-                                                                       copy->varkind = TEMPVAR;
-                                                                       copy->varnum = i;
-                                                                       }
-                                                               i--;
-                                                               copy = copy->prev;
-                                                               }
-                                                       if ((new - curstack) == 1) {
-                                                               curstack->varkind = LOCALVAR;
-                                                               curstack->varnum = iptr->op1;
-                                                               };
-                                                       STORE(opcode-ICMD_ISTORE);
-                                                       break;
+                                       copy = curstack->prev;
+                                       i = stackdepth - 2;
+                                       while (copy) {
+                                               if ((copy->varkind == LOCALVAR) &&
+                                                       (copy->varnum == iptr->op1)) {
+                                                       copy->varkind = TEMPVAR;
+                                                       copy->varnum = i;
+                                               }
+                                               i--;
+                                               copy = copy->prev;
+                                       }
+                                       if ((new - curstack) == 1) {
+                                               curstack->varkind = LOCALVAR;
+                                               curstack->varnum = iptr->op1;
+                                       };
+                                       STORE(opcode-ICMD_ISTORE);
+                                       break;
 
-                                               /* pop 3 push 0 */
-
-                                               case ICMD_IASTORE:
-                                               case ICMD_LASTORE:
-                                               case ICMD_FASTORE:
-                                               case ICMD_DASTORE:
-                                               case ICMD_AASTORE:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_check_bound);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP3TIA_0(opcode-ICMD_IASTORE);
-                                                       break;
-                                               case ICMD_BASTORE:
-                                               case ICMD_CASTORE:
-                                               case ICMD_SASTORE:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_check_bound);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP3TIA_0(TYPE_INT);
-                                                       break;
+                                       /* pop 3 push 0 */
+
+                                       case ICMD_IASTORE:
+                                       case ICMD_LASTORE:
+                                       case ICMD_FASTORE:
+                                       case ICMD_DASTORE:
+                                       case ICMD_AASTORE:
+                                               COUNT(count_check_null);
+                                               COUNT(count_check_bound);
+                                               COUNT(count_pcmd_mem);
+                                               OP3TIA_0(opcode-ICMD_IASTORE);
+                                               break;
+                                       case ICMD_BASTORE:
+                                       case ICMD_CASTORE:
+                                       case ICMD_SASTORE:
+                                               COUNT(count_check_null);
+                                               COUNT(count_check_bound);
+                                               COUNT(count_pcmd_mem);
+                                               OP3TIA_0(TYPE_INT);
+                                               break;
 
                                                /* pop 1 push 0 */
 
-                                               case ICMD_POP:
-                                                       OP1_0ANY;
-                                                       break;
-
-                                               case ICMD_IRETURN:
-                                               case ICMD_LRETURN:
-                                               case ICMD_FRETURN:
-                                               case ICMD_DRETURN:
-                                               case ICMD_ARETURN:
-                                                       COUNT(count_pcmd_return);
-                                                       OP1_0(opcode-ICMD_IRETURN);
-                                                       superblockend = true;
-                                                       break;
-
-                                               case ICMD_ATHROW:
-                                                       COUNT(count_check_null);
-                                                       OP1_0(TYPE_ADR);
-                                                       STACKRESET;
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
-
-                                               case ICMD_PUTSTATIC:
-                                                       COUNT(count_pcmd_mem);
-                                                       OP1_0(iptr->op1);
-                                                       break;
+                                       case ICMD_POP:
+                                               OP1_0ANY;
+                                               break;
+
+                                       case ICMD_IRETURN:
+                                       case ICMD_LRETURN:
+                                       case ICMD_FRETURN:
+                                       case ICMD_DRETURN:
+                                       case ICMD_ARETURN:
+                                               COUNT(count_pcmd_return);
+                                               OP1_0(opcode-ICMD_IRETURN);
+                                               superblockend = true;
+                                               break;
+
+                                       case ICMD_ATHROW:
+                                               COUNT(count_check_null);
+                                               OP1_0(TYPE_ADR);
+                                               STACKRESET;
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
+
+                                       case ICMD_PUTSTATIC:
+                                               COUNT(count_pcmd_mem);
+                                               OP1_0(iptr->op1);
+                                               break;
 
                                                /* pop 1 push 0 branch */
 
-                                               case ICMD_IFNULL:
-                                               case ICMD_IFNONNULL:
-                                                       COUNT(count_pcmd_bra);
-                                                       OP1_0(TYPE_ADR);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_IFNULL:
+                                       case ICMD_IFNONNULL:
+                                               COUNT(count_pcmd_bra);
+                                               OP1_0(TYPE_ADR);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               break;
 
-                                               case ICMD_IFEQ:
-                                               case ICMD_IFNE:
-                                               case ICMD_IFLT:
-                                               case ICMD_IFGE:
-                                               case ICMD_IFGT:
-                                               case ICMD_IFLE:
-                                                       COUNT(count_pcmd_bra);
+                                       case ICMD_IFEQ:
+                                       case ICMD_IFNE:
+                                       case ICMD_IFLT:
+                                       case ICMD_IFGE:
+                                       case ICMD_IFGT:
+                                       case ICMD_IFLE:
+                                               COUNT(count_pcmd_bra);
 #ifdef CONDITIONAL_LOADCONST
-                                                       {
+                                               {
                                                        tbptr = block + b_index;
                                                        if ((b_count >= 3) &&
                                                            ((b_index + 2) == block_index[iptr[0].op1]) &&
@@ -955,25 +991,25 @@ icmd_store:
                                                            (iptr[3].opc == ICMD_ICONST)) {
                                                                OP1_1(TYPE_INT, TYPE_INT);
                                                                switch (iptr[0].opc) {
-                                                                       case ICMD_IFEQ:
-                                                                               iptr[0].opc = ICMD_IFNE_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFNE:
-                                                                               iptr[0].opc = ICMD_IFEQ_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFLT:
-                                                                               iptr[0].opc = ICMD_IFGE_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFGE:
-                                                                               iptr[0].opc = ICMD_IFLT_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFGT:
-                                                                               iptr[0].opc = ICMD_IFLE_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFLE:
-                                                                               iptr[0].opc = ICMD_IFGT_ICONST;
-                                                                               break;
-                                                                       }
+                                                               case ICMD_IFEQ:
+                                                                       iptr[0].opc = ICMD_IFNE_ICONST;
+                                                                       break;
+                                                               case ICMD_IFNE:
+                                                                       iptr[0].opc = ICMD_IFEQ_ICONST;
+                                                                       break;
+                                                               case ICMD_IFLT:
+                                                                       iptr[0].opc = ICMD_IFGE_ICONST;
+                                                                       break;
+                                                               case ICMD_IFGE:
+                                                                       iptr[0].opc = ICMD_IFLT_ICONST;
+                                                                       break;
+                                                               case ICMD_IFGT:
+                                                                       iptr[0].opc = ICMD_IFLE_ICONST;
+                                                                       break;
+                                                               case ICMD_IFLE:
+                                                                       iptr[0].opc = ICMD_IFGT_ICONST;
+                                                                       break;
+                                                               }
                                                                iptr[0].val.i = iptr[1].val.i;
                                                                iptr[1].opc = ICMD_ELSE_ICONST;
                                                                iptr[1].val.i = iptr[3].val.i;
@@ -989,488 +1025,488 @@ icmd_store:
                                                                        tbptr[3].flags = BBDELETED;
                                                                        tbptr[3].icount = 0;
                                                                        b_index++;
-                                                                       }
+                                                               }
                                                                else {
                                                                        bptr->icount++;
                                                                        len ++;
-                                                                       }
+                                                               }
                                                                b_index += 2;
                                                                break;
-                                                               }
                                                        }
+                                               }
 #endif
-                                                       OP1_0(TYPE_INT);
-                                                       tbptr = block + block_index[iptr->op1];
+                                               OP1_0(TYPE_INT);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               break;
 
                                                /* pop 0 push 0 branch */
 
-                                               case ICMD_GOTO:
-                                                       COUNT(count_pcmd_bra);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_GOTO:
+                                               COUNT(count_pcmd_bra);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
 
                                                /* pop 1 push 0 table branch */
 
-                                               case ICMD_TABLESWITCH:
-                                                       COUNT(count_pcmd_table);
-                                                       OP1_0(TYPE_INT);
-                                                       s4ptr = iptr->val.a;
-                                                       tbptr = block + block_index[*s4ptr++]; /* default */
-                                                       MARKREACHED(tbptr, copy);
-                                                       i = *s4ptr++;                          /* low     */
-                                                       i = *s4ptr++ - i + 1;                  /* high    */
+                                       case ICMD_TABLESWITCH:
+                                               COUNT(count_pcmd_table);
+                                               OP1_0(TYPE_INT);
+                                               s4ptr = iptr->val.a;
+                                               tbptr = block + block_index[*s4ptr++]; /* default */
+                                               MARKREACHED(tbptr, copy);
+                                               i = *s4ptr++;                          /* low     */
+                                               i = *s4ptr++ - i + 1;                  /* high    */
 
-                                                       tptr = DMNEW(void*, i+1);
-                                                       iptr->target = (void *) tptr;
+                                               tptr = DMNEW(void*, i+1);
+                                               iptr->target = (void *) tptr;
 
-                                                       tptr[0] = (void *) tbptr;
-                                                       tptr++;
+                                               tptr[0] = (void *) tbptr;
+                                               tptr++;
 
-                                                       while (--i >= 0) {
-                                                               tbptr = block + block_index[*s4ptr++];
+                                               while (--i >= 0) {
+                                                       tbptr = block + block_index[*s4ptr++];
 
-                                                               tptr[0] = (void *) tbptr;
-                                                               tptr++;
+                                                       tptr[0] = (void *) tbptr;
+                                                       tptr++;
 
-                                                               MARKREACHED(tbptr, copy);
-                                                               }
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
+                                                       MARKREACHED(tbptr, copy);
+                                               }
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
                                                        
                                                /* pop 1 push 0 table branch */
 
-                                               case ICMD_LOOKUPSWITCH:
-                                                       COUNT(count_pcmd_table);
-                                                       OP1_0(TYPE_INT);
-                                                       s4ptr = iptr->val.a;
-                                                       tbptr = block + block_index[*s4ptr++]; /* default */
-                                                       MARKREACHED(tbptr, copy);
-                                                       i = *s4ptr++;                          /* count   */
+                                       case ICMD_LOOKUPSWITCH:
+                                               COUNT(count_pcmd_table);
+                                               OP1_0(TYPE_INT);
+                                               s4ptr = iptr->val.a;
+                                               tbptr = block + block_index[*s4ptr++]; /* default */
+                                               MARKREACHED(tbptr, copy);
+                                               i = *s4ptr++;                          /* count   */
 
-                                                       tptr = DMNEW(void*, i+1);
-                                                       iptr->target = (void *) tptr;
+                                               tptr = DMNEW(void*, i+1);
+                                               iptr->target = (void *) tptr;
 
-                                                       tptr[0] = (void *) tbptr;
-                                                       tptr++;
+                                               tptr[0] = (void *) tbptr;
+                                               tptr++;
 
-                                                       while (--i >= 0) {
-                                                               tbptr = block + block_index[s4ptr[1]];
+                                               while (--i >= 0) {
+                                                       tbptr = block + block_index[s4ptr[1]];
 
-                                                               tptr[0] = (void *) tbptr;
-                                                               tptr++;
+                                                       tptr[0] = (void *) tbptr;
+                                                       tptr++;
                                                                
-                                                               MARKREACHED(tbptr, copy);
-                                                               s4ptr += 2;
-                                                               }
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
+                                                       MARKREACHED(tbptr, copy);
+                                                       s4ptr += 2;
+                                               }
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
 
-                                               case ICMD_NULLCHECKPOP:
-                                               case ICMD_MONITORENTER:
-                                                       COUNT(count_check_null);
-                                               case ICMD_MONITOREXIT:
-                                                       OP1_0(TYPE_ADR);
-                                                       break;
+                                       case ICMD_NULLCHECKPOP:
+                                       case ICMD_MONITORENTER:
+                                               COUNT(count_check_null);
+                                       case ICMD_MONITOREXIT:
+                                               OP1_0(TYPE_ADR);
+                                               break;
 
                                                /* pop 2 push 0 branch */
 
-                                               case ICMD_IF_ICMPEQ:
-                                               case ICMD_IF_ICMPNE:
-                                               case ICMD_IF_ICMPLT:
-                                               case ICMD_IF_ICMPGE:
-                                               case ICMD_IF_ICMPGT:
-                                               case ICMD_IF_ICMPLE:
-                                                       COUNT(count_pcmd_bra);
-                                                       OP2_0(TYPE_INT);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_IF_ICMPEQ:
+                                       case ICMD_IF_ICMPNE:
+                                       case ICMD_IF_ICMPLT:
+                                       case ICMD_IF_ICMPGE:
+                                       case ICMD_IF_ICMPGT:
+                                       case ICMD_IF_ICMPLE:
+                                               COUNT(count_pcmd_bra);
+                                               OP2_0(TYPE_INT);
+                                               tbptr = block + block_index[iptr->op1];
                                                        
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               break;
 
-                                               case ICMD_IF_ACMPEQ:
-                                               case ICMD_IF_ACMPNE:
-                                                       COUNT(count_pcmd_bra);
-                                                       OP2_0(TYPE_ADR);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_IF_ACMPEQ:
+                                       case ICMD_IF_ACMPNE:
+                                               COUNT(count_pcmd_bra);
+                                               OP2_0(TYPE_ADR);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               break;
 
                                                /* pop 2 push 0 */
 
-                                               case ICMD_PUTFIELD:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_pcmd_mem);
-                                                       OPTT2_0(iptr->op1,TYPE_ADR);
-                                                       break;
+                                       case ICMD_PUTFIELD:
+                                               COUNT(count_check_null);
+                                               COUNT(count_pcmd_mem);
+                                               OPTT2_0(iptr->op1,TYPE_ADR);
+                                               break;
 
-                                               case ICMD_POP2:
-                                                       if (! IS_2_WORD_TYPE(curstack->type)) {
-                                                               OP1_0ANY;                /* second pop */
-                                                               }
-                                                       else
-                                                               iptr->opc = ICMD_POP;
-                                                       OP1_0ANY;
-                                                       break;
+                                       case ICMD_POP2:
+                                               if (! IS_2_WORD_TYPE(curstack->type)) {
+                                                       OP1_0ANY;                /* second pop */
+                                               }
+                                               else
+                                                       iptr->opc = ICMD_POP;
+                                               OP1_0ANY;
+                                               break;
 
                                                /* pop 0 push 1 dup */
                                                
-                                               case ICMD_DUP:
-                                                       COUNT(count_dup_instruction);
+                                       case ICMD_DUP:
+                                               COUNT(count_dup_instruction);
+                                               DUP;
+                                               break;
+
+                                       case ICMD_DUP2:
+                                               if (IS_2_WORD_TYPE(curstack->type)) {
+                                                       iptr->opc = ICMD_DUP;
                                                        DUP;
-                                                       break;
-
-                                               case ICMD_DUP2:
-                                                       if (IS_2_WORD_TYPE(curstack->type)) {
-                                                               iptr->opc = ICMD_DUP;
-                                                               DUP;
-                                                               }
-                                                       else {
-                                                               copy = curstack;
-                                                               NEWSTACK(copy->prev->type, copy->prev->varkind,
-                                                                        copy->prev->varnum);
-                                                               NEWSTACK(copy->type, copy->varkind,
-                                                                        copy->varnum);
-                                                               SETDST;
-                                                               stackdepth+=2;
-                                                               }
-                                                       break;
+                                               }
+                                               else {
+                                                       copy = curstack;
+                                                       NEWSTACK(copy->prev->type, copy->prev->varkind,
+                                                                        copy->prev->varnum);
+                                                       NEWSTACK(copy->type, copy->varkind,
+                                                                        copy->varnum);
+                                                       SETDST;
+                                                       stackdepth+=2;
+                                               }
+                                               break;
 
                                                /* pop 2 push 3 dup */
                                                
-                                               case ICMD_DUP_X1:
-                                                       DUP_X1;
-                                                       break;
+                                       case ICMD_DUP_X1:
+                                               DUP_X1;
+                                               break;
 
-                                               case ICMD_DUP2_X1:
-                                                       if (IS_2_WORD_TYPE(curstack->type)) {
-                                                               iptr->opc = ICMD_DUP_X1;
-                                                               DUP_X1;
-                                                               }
-                                                       else {
-                                                               DUP2_X1;
-                                                               }
-                                                       break;
+                                       case ICMD_DUP2_X1:
+                                               if (IS_2_WORD_TYPE(curstack->type)) {
+                                                       iptr->opc = ICMD_DUP_X1;
+                                                       DUP_X1;
+                                               }
+                                               else {
+                                                       DUP2_X1;
+                                               }
+                                               break;
 
                                                /* pop 3 push 4 dup */
                                                
-                                               case ICMD_DUP_X2:
+                                       case ICMD_DUP_X2:
+                                               if (IS_2_WORD_TYPE(curstack->prev->type)) {
+                                                       iptr->opc = ICMD_DUP_X1;
+                                                       DUP_X1;
+                                               }
+                                               else {
+                                                       DUP_X2;
+                                               }
+                                               break;
+
+                                       case ICMD_DUP2_X2:
+                                               if (IS_2_WORD_TYPE(curstack->type)) {
                                                        if (IS_2_WORD_TYPE(curstack->prev->type)) {
                                                                iptr->opc = ICMD_DUP_X1;
                                                                DUP_X1;
-                                                               }
+                                                       }
                                                        else {
+                                                               iptr->opc = ICMD_DUP_X2;
                                                                DUP_X2;
-                                                               }
-                                                       break;
-
-                                               case ICMD_DUP2_X2:
-                                                       if (IS_2_WORD_TYPE(curstack->type)) {
-                                                               if (IS_2_WORD_TYPE(curstack->prev->type)) {
-                                                                       iptr->opc = ICMD_DUP_X1;
-                                                                       DUP_X1;
-                                                                       }
-                                                               else {
-                                                                       iptr->opc = ICMD_DUP_X2;
-                                                                       DUP_X2;
-                                                                       }
-                                                               }
-                                                       else
-                                                               if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
-                                                                       iptr->opc = ICMD_DUP2_X1;
-                                                                       DUP2_X1;
-                                                                       }
-                                                               else {
-                                                                       DUP2_X2;
-                                                                       }
-                                                       break;
+                                                       }
+                                               }
+                                               else
+                                                       if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
+                                                               iptr->opc = ICMD_DUP2_X1;
+                                                               DUP2_X1;
+                                                       }
+                                                       else {
+                                                               DUP2_X2;
+                                                       }
+                                               break;
 
                                                /* pop 2 push 2 swap */
                                                
-                                               case ICMD_SWAP:
-                                                       SWAP;
-                                                       break;
+                                       case ICMD_SWAP:
+                                               SWAP;
+                                               break;
 
                                                /* pop 2 push 1 */
                                                
-                                               case ICMD_IDIV:
+                                       case ICMD_IDIV:
 #if !SUPPORT_DIVISION
-                                                       iptr[0].opc = ICMD_BUILTIN2;
-                                                       iptr[0].op1 = TYPE_INT;
-                                                       iptr[0].val.a = (functionptr) asm_builtin_idiv;
-                                                       isleafmethod = false;
-                                                       goto builtin2;
+                                               iptr[0].opc = ICMD_BUILTIN2;
+                                               iptr[0].op1 = TYPE_INT;
+                                               iptr[0].val.a = (functionptr) asm_builtin_idiv;
+                                               isleafmethod = false;
+                                               goto builtin2;
 #endif
 
-                                               case ICMD_IREM:
+                                       case ICMD_IREM:
 #if !SUPPORT_DIVISION
-                                                       iptr[0].opc = ICMD_BUILTIN2;
-                                                       iptr[0].op1 = TYPE_INT;
-                                                       iptr[0].val.a = (functionptr) asm_builtin_irem;
-                                                       isleafmethod = false;
-                                                       goto builtin2;
+                                               iptr[0].opc = ICMD_BUILTIN2;
+                                               iptr[0].op1 = TYPE_INT;
+                                               iptr[0].val.a = (functionptr) asm_builtin_irem;
+                                               isleafmethod = false;
+                                               goto builtin2;
 #endif
 
-                                               case ICMD_IADD:
-                                               case ICMD_ISUB:
-                                               case ICMD_IMUL:
-
-                                               case ICMD_ISHL:
-                                               case ICMD_ISHR:
-                                               case ICMD_IUSHR:
-                                               case ICMD_IAND:
-                                               case ICMD_IOR:
-                                               case ICMD_IXOR:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2_1(TYPE_INT);
-                                                       break;
-
-                                               case ICMD_LDIV:
+                                       case ICMD_IADD:
+                                       case ICMD_ISUB:
+                                       case ICMD_IMUL:
+
+                                       case ICMD_ISHL:
+                                       case ICMD_ISHR:
+                                       case ICMD_IUSHR:
+                                       case ICMD_IAND:
+                                       case ICMD_IOR:
+                                       case ICMD_IXOR:
+                                               COUNT(count_pcmd_op);
+                                               OP2_1(TYPE_INT);
+                                               break;
+
+                                       case ICMD_LDIV:
 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_MULDIV)
-                                                       iptr[0].opc = ICMD_BUILTIN2;
-                                                       iptr[0].op1 = TYPE_LNG;
-                                                       iptr[0].val.a = (functionptr) asm_builtin_ldiv;
-                                                       isleafmethod = false;
-                                                       goto builtin2;
+                                               iptr[0].opc = ICMD_BUILTIN2;
+                                               iptr[0].op1 = TYPE_LNG;
+                                               iptr[0].val.a = (functionptr) asm_builtin_ldiv;
+                                               isleafmethod = false;
+                                               goto builtin2;
 #endif
 
-                                               case ICMD_LREM:
+                                       case ICMD_LREM:
 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_MULDIV)
-                                                       iptr[0].opc = ICMD_BUILTIN2;
-                                                       iptr[0].op1 = TYPE_LNG;
-                                                       iptr[0].val.a = (functionptr) asm_builtin_lrem;
-                                                       isleafmethod = false;
-                                                       goto builtin2;
+                                               iptr[0].opc = ICMD_BUILTIN2;
+                                               iptr[0].op1 = TYPE_LNG;
+                                               iptr[0].val.a = (functionptr) asm_builtin_lrem;
+                                               isleafmethod = false;
+                                               goto builtin2;
 #endif
 
-                                               case ICMD_LADD:
-                                               case ICMD_LSUB:
-                                               case ICMD_LMUL:
-
-                                               case ICMD_LOR:
-                                               case ICMD_LAND:
-                                               case ICMD_LXOR:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2_1(TYPE_LNG);
-                                                       break;
-
-                                               case ICMD_LSHL:
-                                               case ICMD_LSHR:
-                                               case ICMD_LUSHR:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2IT_1(TYPE_LNG);
-                                                       break;
-
-                                               case ICMD_FADD:
-                                               case ICMD_FSUB:
-                                               case ICMD_FMUL:
-                                               case ICMD_FDIV:
-                                               case ICMD_FREM:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2_1(TYPE_FLT);
-                                                       break;
-
-                                               case ICMD_DADD:
-                                               case ICMD_DSUB:
-                                               case ICMD_DMUL:
-                                               case ICMD_DDIV:
-                                               case ICMD_DREM:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2_1(TYPE_DBL);
-                                                       break;
-
-                                               case ICMD_LCMP:
-                                                       COUNT(count_pcmd_op);
+                                       case ICMD_LADD:
+                                       case ICMD_LSUB:
+                                       case ICMD_LMUL:
+
+                                       case ICMD_LOR:
+                                       case ICMD_LAND:
+                                       case ICMD_LXOR:
+                                               COUNT(count_pcmd_op);
+                                               OP2_1(TYPE_LNG);
+                                               break;
+
+                                       case ICMD_LSHL:
+                                       case ICMD_LSHR:
+                                       case ICMD_LUSHR:
+                                               COUNT(count_pcmd_op);
+                                               OP2IT_1(TYPE_LNG);
+                                               break;
+
+                                       case ICMD_FADD:
+                                       case ICMD_FSUB:
+                                       case ICMD_FMUL:
+                                       case ICMD_FDIV:
+                                       case ICMD_FREM:
+                                               COUNT(count_pcmd_op);
+                                               OP2_1(TYPE_FLT);
+                                               break;
+
+                                       case ICMD_DADD:
+                                       case ICMD_DSUB:
+                                       case ICMD_DMUL:
+                                       case ICMD_DDIV:
+                                       case ICMD_DREM:
+                                               COUNT(count_pcmd_op);
+                                               OP2_1(TYPE_DBL);
+                                               break;
+
+                                       case ICMD_LCMP:
+                                               COUNT(count_pcmd_op);
 #ifndef NOLONG_CONDITIONAL
-                                                       if ((len > 0) && (iptr[1].val.i == 0)) {
-                                                               switch (iptr[1].opc) {
-                                                                       case ICMD_IFEQ:
-                                                                               iptr[0].opc = ICMD_IF_LCMPEQ;
-icmd_lcmp_if_tail:
-                                                                               iptr[0].op1 = iptr[1].op1;
-                                                                               len--;
-                                                                               bptr->icount--;
-                                                                               /* iptr[1].opc = ICMD_NOP; */
-                                                                               OP2_0(TYPE_LNG);
-                                                                               tbptr = block + block_index[iptr->op1];
+                                               if ((len > 0) && (iptr[1].val.i == 0)) {
+                                                       switch (iptr[1].opc) {
+                                                       case ICMD_IFEQ:
+                                                               iptr[0].opc = ICMD_IF_LCMPEQ;
+                                                       icmd_lcmp_if_tail:
+                                                               iptr[0].op1 = iptr[1].op1;
+                                                               len--;
+                                                               bptr->icount--;
+                                                               /* iptr[1].opc = ICMD_NOP; */
+                                                               OP2_0(TYPE_LNG);
+                                                               tbptr = block + block_index[iptr->op1];
                        
-                                                                               iptr[0].target = (void *) tbptr;
+                                                               iptr[0].target = (void *) tbptr;
 
-                                                                               MARKREACHED(tbptr, copy);
-                                                                               COUNT(count_pcmd_bra);
-                                                                               break;
-                                                                       case ICMD_IFNE:
-                                                                               iptr[0].opc = ICMD_IF_LCMPNE;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       case ICMD_IFLT:
-                                                                               iptr[0].opc = ICMD_IF_LCMPLT;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       case ICMD_IFGT:
-                                                                               iptr[0].opc = ICMD_IF_LCMPGT;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       case ICMD_IFLE:
-                                                                               iptr[0].opc = ICMD_IF_LCMPLE;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       case ICMD_IFGE:
-                                                                               iptr[0].opc = ICMD_IF_LCMPGE;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       default:
-                                                                               OPTT2_1(TYPE_LNG, TYPE_INT);
-                                                                       }
-                                                               }
-                                                       else
-#endif
+                                                               MARKREACHED(tbptr, copy);
+                                                               COUNT(count_pcmd_bra);
+                                                               break;
+                                                       case ICMD_IFNE:
+                                                               iptr[0].opc = ICMD_IF_LCMPNE;
+                                                               goto icmd_lcmp_if_tail;
+                                                       case ICMD_IFLT:
+                                                               iptr[0].opc = ICMD_IF_LCMPLT;
+                                                               goto icmd_lcmp_if_tail;
+                                                       case ICMD_IFGT:
+                                                               iptr[0].opc = ICMD_IF_LCMPGT;
+                                                               goto icmd_lcmp_if_tail;
+                                                       case ICMD_IFLE:
+                                                               iptr[0].opc = ICMD_IF_LCMPLE;
+                                                               goto icmd_lcmp_if_tail;
+                                                       case ICMD_IFGE:
+                                                               iptr[0].opc = ICMD_IF_LCMPGE;
+                                                               goto icmd_lcmp_if_tail;
+                                                       default:
                                                                OPTT2_1(TYPE_LNG, TYPE_INT);
-                                                       break;
-                                               case ICMD_FCMPL:
-                                               case ICMD_FCMPG:
-                                                       COUNT(count_pcmd_op);
-                                                       OPTT2_1(TYPE_FLT, TYPE_INT);
-                                                       break;
-                                               case ICMD_DCMPL:
-                                               case ICMD_DCMPG:
-                                                       COUNT(count_pcmd_op);
-                                                       OPTT2_1(TYPE_DBL, TYPE_INT);
-                                                       break;
+                                                       }
+                                               }
+                                               else
+#endif
+                                                       OPTT2_1(TYPE_LNG, TYPE_INT);
+                                               break;
+                                       case ICMD_FCMPL:
+                                       case ICMD_FCMPG:
+                                               COUNT(count_pcmd_op);
+                                               OPTT2_1(TYPE_FLT, TYPE_INT);
+                                               break;
+                                       case ICMD_DCMPL:
+                                       case ICMD_DCMPG:
+                                               COUNT(count_pcmd_op);
+                                               OPTT2_1(TYPE_DBL, TYPE_INT);
+                                               break;
 
                                                /* pop 1 push 1 */
                                                
-                                               case ICMD_INEG:
-                                               case ICMD_INT2BYTE:
-                                               case ICMD_INT2CHAR:
-                                               case ICMD_INT2SHORT:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_INT, TYPE_INT);
-                                                       break;
-                                               case ICMD_LNEG:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_LNG, TYPE_LNG);
-                                                       break;
-                                               case ICMD_FNEG:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_FLT, TYPE_FLT);
-                                                       break;
-                                               case ICMD_DNEG:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_DBL, TYPE_DBL);
-                                                       break;
-
-                                               case ICMD_I2L:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_INT, TYPE_LNG);
-                                                       break;
-                                               case ICMD_I2F:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_INT, TYPE_FLT);
-                                                       break;
-                                               case ICMD_I2D:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_INT, TYPE_DBL);
-                                                       break;
-                                               case ICMD_L2I:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_LNG, TYPE_INT);
-                                                       break;
-                                               case ICMD_L2F:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_LNG, TYPE_FLT);
-                                                       break;
-                                               case ICMD_L2D:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_LNG, TYPE_DBL);
-                                                       break;
-                                               case ICMD_F2I:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_FLT, TYPE_INT);
-                                                       break;
-                                               case ICMD_F2L:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_FLT, TYPE_LNG);
-                                                       break;
-                                               case ICMD_F2D:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_FLT, TYPE_DBL);
-                                                       break;
-                                               case ICMD_D2I:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_DBL, TYPE_INT);
-                                                       break;
-                                               case ICMD_D2L:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_DBL, TYPE_LNG);
-                                                       break;
-                                               case ICMD_D2F:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_DBL, TYPE_FLT);
-                                                       break;
-
-                                               case ICMD_CHECKCAST:
-                                                       OP1_1(TYPE_ADR, TYPE_ADR);
-                                                       break;
-
-                                               case ICMD_ARRAYLENGTH:
-                                               case ICMD_INSTANCEOF:
-                                                       OP1_1(TYPE_ADR, TYPE_INT);
-                                                       break;
-
-                                               case ICMD_NEWARRAY:
-                                               case ICMD_ANEWARRAY:
-                                                       OP1_1(TYPE_INT, TYPE_ADR);
-                                                       break;
-
-                                               case ICMD_GETFIELD:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP1_1(TYPE_ADR, iptr->op1);
-                                                       break;
+                                       case ICMD_INEG:
+                                       case ICMD_INT2BYTE:
+                                       case ICMD_INT2CHAR:
+                                       case ICMD_INT2SHORT:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_INT, TYPE_INT);
+                                               break;
+                                       case ICMD_LNEG:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_LNG, TYPE_LNG);
+                                               break;
+                                       case ICMD_FNEG:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_FLT, TYPE_FLT);
+                                               break;
+                                       case ICMD_DNEG:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_DBL, TYPE_DBL);
+                                               break;
+
+                                       case ICMD_I2L:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_INT, TYPE_LNG);
+                                               break;
+                                       case ICMD_I2F:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_INT, TYPE_FLT);
+                                               break;
+                                       case ICMD_I2D:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_INT, TYPE_DBL);
+                                               break;
+                                       case ICMD_L2I:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_LNG, TYPE_INT);
+                                               break;
+                                       case ICMD_L2F:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_LNG, TYPE_FLT);
+                                               break;
+                                       case ICMD_L2D:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_LNG, TYPE_DBL);
+                                               break;
+                                       case ICMD_F2I:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_FLT, TYPE_INT);
+                                               break;
+                                       case ICMD_F2L:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_FLT, TYPE_LNG);
+                                               break;
+                                       case ICMD_F2D:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_FLT, TYPE_DBL);
+                                               break;
+                                       case ICMD_D2I:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_DBL, TYPE_INT);
+                                               break;
+                                       case ICMD_D2L:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_DBL, TYPE_LNG);
+                                               break;
+                                       case ICMD_D2F:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_DBL, TYPE_FLT);
+                                               break;
+
+                                       case ICMD_CHECKCAST:
+                                               OP1_1(TYPE_ADR, TYPE_ADR);
+                                               break;
+
+                                       case ICMD_ARRAYLENGTH:
+                                       case ICMD_INSTANCEOF:
+                                               OP1_1(TYPE_ADR, TYPE_INT);
+                                               break;
+
+                                       case ICMD_NEWARRAY:
+                                       case ICMD_ANEWARRAY:
+                                               OP1_1(TYPE_INT, TYPE_ADR);
+                                               break;
+
+                                       case ICMD_GETFIELD:
+                                               COUNT(count_check_null);
+                                               COUNT(count_pcmd_mem);
+                                               OP1_1(TYPE_ADR, iptr->op1);
+                                               break;
 
                                                /* pop 0 push 1 */
                                                
-                                               case ICMD_GETSTATIC:
-                                                       COUNT(count_pcmd_mem);
-                                                       OP0_1(iptr->op1);
-                                                       break;
+                                       case ICMD_GETSTATIC:
+                                               COUNT(count_pcmd_mem);
+                                               OP0_1(iptr->op1);
+                                               break;
 
-                                               case ICMD_NEW:
-                                                       OP0_1(TYPE_ADR);
-                                                       break;
+                                       case ICMD_NEW:
+                                               OP0_1(TYPE_ADR);
+                                               break;
 
-                                               case ICMD_JSR:
-                                                       OP0_1(TYPE_ADR);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_JSR:
+                                               OP0_1(TYPE_ADR);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       tbptr->type=BBTYPE_SBR;
-                                                       MARKREACHED(tbptr, copy);
-                                                       OP1_0ANY;
-                                                       break;
+                                               tbptr->type=BBTYPE_SBR;
+                                               MARKREACHED(tbptr, copy);
+                                               OP1_0ANY;
+                                               break;
 
                                                /* pop many push any */
                                                
-                                               case ICMD_INVOKEVIRTUAL:
-                                               case ICMD_INVOKESPECIAL:
-                                               case ICMD_INVOKEINTERFACE:
-                                               case ICMD_INVOKESTATIC:
-                                                       COUNT(count_pcmd_met);
-                                                       {
+                                       case ICMD_INVOKEVIRTUAL:
+                                       case ICMD_INVOKESPECIAL:
+                                       case ICMD_INVOKEINTERFACE:
+                                       case ICMD_INVOKESTATIC:
+                                               COUNT(count_pcmd_met);
+                                               {
                                                        methodinfo *m = iptr->val.a;
                                                        if (m->flags & ACC_STATIC)
                                                                {COUNT(count_check_null);}
@@ -1522,120 +1558,120 @@ icmd_lcmp_if_tail:
                                                                if (! (copy->flags & SAVEDVAR)) {
                                                                        copy->varkind = ARGVAR;
                                                                        copy->varnum = i;
-                                                                       }
-                                                               copy = copy->prev;
                                                                }
+                                                               copy = copy->prev;
+                                                       }
 #endif
                                                        while (copy) {
                                                                copy->flags |= SAVEDVAR;
                                                                copy = copy->prev;
-                                                               }
+                                                       }
                                                        i = iptr->op1;
                                                        POPMANY(i);
                                                        if (m->returntype != TYPE_VOID) {
                                                                OP0_1(m->returntype);
-                                                               }
-                                                       break;
                                                        }
+                                                       break;
+                                               }
 
-                                               case ICMD_BUILTIN3:
-                                                       if (! (curstack->flags & SAVEDVAR)) {
-                                                               curstack->varkind = ARGVAR;
-                                                               curstack->varnum = 2;
-                                                               }
-                                                       if (3 > arguments_num) {
-                                                               arguments_num = 3;
-                                                       }
-                                                       OP1_0ANY;
+                                       case ICMD_BUILTIN3:
+                                               if (! (curstack->flags & SAVEDVAR)) {
+                                                       curstack->varkind = ARGVAR;
+                                                       curstack->varnum = 2;
+                                               }
+                                               if (3 > arguments_num) {
+                                                       arguments_num = 3;
+                                               }
+                                               OP1_0ANY;
 
-                                               case ICMD_BUILTIN2:
-builtin2:
-                                                       if (! (curstack->flags & SAVEDVAR)) {
-                                                               curstack->varkind = ARGVAR;
-                                                               curstack->varnum = 1;
-                                                               }
-                                                       if (2 > arguments_num) {
-                                                               arguments_num = 2;
-                                                       }
-                                                       OP1_0ANY;
+                                       case ICMD_BUILTIN2:
+                                       builtin2:
+                                       if (! (curstack->flags & SAVEDVAR)) {
+                                               curstack->varkind = ARGVAR;
+                                               curstack->varnum = 1;
+                                       }
+                                       if (2 > arguments_num) {
+                                               arguments_num = 2;
+                                       }
+                                       OP1_0ANY;
 
-                                               case ICMD_BUILTIN1:
-                                                       if (! (curstack->flags & SAVEDVAR)) {
-                                                               curstack->varkind = ARGVAR;
-                                                               curstack->varnum = 0;
-                                                               }
-                                                       if (1 > arguments_num) {
-                                                               arguments_num = 1;
+                                       case ICMD_BUILTIN1:
+                                               if (! (curstack->flags & SAVEDVAR)) {
+                                                       curstack->varkind = ARGVAR;
+                                                       curstack->varnum = 0;
+                                               }
+                                               if (1 > arguments_num) {
+                                                       arguments_num = 1;
+                                               }
+                                               OP1_0ANY;
+                                               copy = curstack;
+                                               while (copy) {
+                                                       copy->flags |= SAVEDVAR;
+                                                       copy = copy->prev;
+                                               }
+                                               if (iptr->op1 != TYPE_VOID)
+                                                       OP0_1(iptr->op1);
+                                               break;
+
+                                       case ICMD_MULTIANEWARRAY:
+                                               i = iptr->op1;
+                                               if ((i + intreg_argnum) > arguments_num)
+                                                       arguments_num = i + intreg_argnum;
+                                               copy = curstack;
+                                               while (--i >= 0) {
+                                                       if (! (copy->flags & SAVEDVAR)) {
+                                                               copy->varkind = ARGVAR;
+                                                               copy->varnum = i + intreg_argnum;
                                                        }
-                                                       OP1_0ANY;
-                                                       copy = curstack;
-                                                       while (copy) {
-                                                               copy->flags |= SAVEDVAR;
-                                                               copy = copy->prev;
-                                                               }
-                                                       if (iptr->op1 != TYPE_VOID)
-                                                               OP0_1(iptr->op1);
-                                                       break;
-
-                                               case ICMD_MULTIANEWARRAY:
-                                                       i = iptr->op1;
-                                                       if ((i + intreg_argnum) > arguments_num)
-                                                               arguments_num = i + intreg_argnum;
-                                                       copy = curstack;
-                                                       while (--i >= 0) {
-                                                               if (! (copy->flags & SAVEDVAR)) {
-                                                                       copy->varkind = ARGVAR;
-                                                                       copy->varnum = i + intreg_argnum;
-                                                                       }
-                                                               copy = copy->prev;
-                                                               }
-                                                       while (copy) {
-                                                               copy->flags |= SAVEDVAR;
-                                                               copy = copy->prev;
-                                                               }
-                                                       i = iptr->op1;
-                                                       POPMANY(i);
-                                                       OP0_1(TYPE_ADR);
-                                                       break;
-
-                                           case ICMD_CLEAR_ARGREN:
-                                                       for (i = iptr->op1; i<maxlocals; i++) 
-                                                               argren[i] = i;
-                                                       iptr->opc = opcode = ICMD_NOP;
-                                                       SETDST;
-                                                       break;
+                                                       copy = copy->prev;
+                                               }
+                                               while (copy) {
+                                                       copy->flags |= SAVEDVAR;
+                                                       copy = copy->prev;
+                                               }
+                                               i = iptr->op1;
+                                               POPMANY(i);
+                                               OP0_1(TYPE_ADR);
+                                               break;
+
+                                       case ICMD_CLEAR_ARGREN:
+                                               for (i = iptr->op1; i<maxlocals; i++) 
+                                                       argren[i] = i;
+                                               iptr->opc = opcode = ICMD_NOP;
+                                               SETDST;
+                                               break;
                                                
-                                           case ICMD_READONLY_ARG:
-                                           case ICMD_READONLY_ARG+1:
-                                           case ICMD_READONLY_ARG+2:
-                                           case ICMD_READONLY_ARG+3:
-                                           case ICMD_READONLY_ARG+4:
-
-                                                       if (curstack->varkind == LOCALVAR) {
-                                                               i = curstack->varnum;
-                                                               argren[iptr->op1] = i;
-                                                               iptr->op1 = i;
-                                                       }
-                                                       opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
-                                                       goto icmd_store;
+                                       case ICMD_READONLY_ARG:
+                                       case ICMD_READONLY_ARG+1:
+                                       case ICMD_READONLY_ARG+2:
+                                       case ICMD_READONLY_ARG+3:
+                                       case ICMD_READONLY_ARG+4:
+
+                                               if (curstack->varkind == LOCALVAR) {
+                                                       i = curstack->varnum;
+                                                       argren[iptr->op1] = i;
+                                                       iptr->op1 = i;
+                                               }
+                                               opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
+                                               goto icmd_store;
 
-                                                       break;
+                                               break;
 
-                                           default:
-                                                       printf("ICMD %d at %d\n", iptr->opc, (int)(iptr-instr));
-                                                       panic("Missing ICMD code during stack analysis");
-                                               } /* switch */
+                                       default:
+                                               printf("ICMD %d at %d\n", iptr->opc, (int)(iptr-instr));
+                                               panic("Missing ICMD code during stack analysis");
+                                       } /* switch */
                                        iptr++;
-                                       } /* while instructions */
+                               } /* while instructions */
                                bptr->outstack = curstack;
                                bptr->outdepth = stackdepth;
                                BBEND(curstack, i);
-                               } /* if */
+                       } /* if */
                        else
                                superblockend = true;
                        bptr++;
                } /* while blocks */
-       } while (repeat && ! deadcode);
+       } while (repeat && !deadcode);
 
 #ifdef STATISTICS
        if (block_count > count_max_basic_blocks)
@@ -1676,9 +1712,9 @@ builtin2:
                                count_block_size_distribution[16]++;
                        else
                                count_block_size_distribution[17]++;
-                       }
-               bptr++;
                }
+               bptr++;
+       }
 
        if (loops == 1)
                count_analyse_iterations[0]++;
@@ -1713,7 +1749,8 @@ builtin2:
 }
 
 
-static void print_stack(stackptr s) {
+static void print_stack(stackptr s)
+{
        int i, j;
        stackptr t;
 
@@ -1723,7 +1760,7 @@ static void print_stack(stackptr s) {
        while (t) {
                i--;
                t = t->prev;
-               }
+       }
        j = maxstack - i;
        while (--i >= 0)
                printf("    ");
@@ -1731,50 +1768,50 @@ static void print_stack(stackptr s) {
                j--;
                if (s->flags & SAVEDVAR)
                        switch (s->varkind) {
-                               case TEMPVAR:
-                                       if (s->flags & INMEMORY)
-                                               printf(" M%02d", s->regoff);
-                                       else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
-                                               printf(" F%02d", s->regoff);
-                                       else
-                                               printf(" %3s", regs[s->regoff]);
-                                       break;
-                               case STACKVAR:
-                                       printf(" I%02d", s->varnum);
-                                       break;
-                               case LOCALVAR:
-                                       printf(" L%02d", s->varnum);
-                                       break;
-                               case ARGVAR:
-                                       printf(" A%02d", s->varnum);
-                                       break;
-                               default:
-                                       printf(" !%02d", j);
-                               }
+                       case TEMPVAR:
+                               if (s->flags & INMEMORY)
+                                       printf(" M%02d", s->regoff);
+                               else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
+                                       printf(" F%02d", s->regoff);
+                               else
+                                       printf(" %3s", regs[s->regoff]);
+                               break;
+                       case STACKVAR:
+                               printf(" I%02d", s->varnum);
+                               break;
+                       case LOCALVAR:
+                               printf(" L%02d", s->varnum);
+                               break;
+                       case ARGVAR:
+                               printf(" A%02d", s->varnum);
+                               break;
+                       default:
+                               printf(" !%02d", j);
+                       }
                else
                        switch (s->varkind) {
-                               case TEMPVAR:
-                                       if (s->flags & INMEMORY)
-                                               printf(" m%02d", s->regoff);
-                                       else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
-                                               printf(" f%02d", s->regoff);
-                                       else
-                                               printf(" %3s", regs[s->regoff]);
-                                       break;
-                               case STACKVAR:
-                                       printf(" i%02d", s->varnum);
-                                       break;
-                               case LOCALVAR:
-                                       printf(" l%02d", s->varnum);
-                                       break;
-                               case ARGVAR:
-                                       printf(" a%02d", s->varnum);
-                                       break;
-                               default:
-                                       printf(" ?%02d", j);
-                               }
+                       case TEMPVAR:
+                               if (s->flags & INMEMORY)
+                                       printf(" m%02d", s->regoff);
+                               else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
+                                       printf(" f%02d", s->regoff);
+                               else
+                                       printf(" %3s", regs[s->regoff]);
+                               break;
+                       case STACKVAR:
+                               printf(" i%02d", s->varnum);
+                               break;
+                       case LOCALVAR:
+                               printf(" l%02d", s->varnum);
+                               break;
+                       case ARGVAR:
+                               printf(" a%02d", s->varnum);
+                               break;
+                       default:
+                               printf(" ?%02d", j);
+                       }
                s = s->prev;
-               }
+       }
 }
 
 
@@ -1783,45 +1820,45 @@ static void print_reg(stackptr s) {
        if (s) {
                if (s->flags & SAVEDVAR)
                        switch (s->varkind) {
-                               case TEMPVAR:
-                                       if (s->flags & INMEMORY)
-                                               printf(" tm%02d", s->regoff);
-                                       else
-                                               printf(" tr%02d", s->regoff);
-                                       break;
-                               case STACKVAR:
-                                       printf(" s %02d", s->varnum);
-                                       break;
-                               case LOCALVAR:
-                                       printf(" l %02d", s->varnum);
-                                       break;
-                               case ARGVAR:
-                                       printf(" a %02d", s->varnum);
-                                       break;
-                               default:
-                                       printf(" ! %02d", s->varnum);
-                               }
+                       case TEMPVAR:
+                               if (s->flags & INMEMORY)
+                                       printf(" tm%02d", s->regoff);
+                               else
+                                       printf(" tr%02d", s->regoff);
+                               break;
+                       case STACKVAR:
+                               printf(" s %02d", s->varnum);
+                               break;
+                       case LOCALVAR:
+                               printf(" l %02d", s->varnum);
+                               break;
+                       case ARGVAR:
+                               printf(" a %02d", s->varnum);
+                               break;
+                       default:
+                               printf(" ! %02d", s->varnum);
+                       }
                else
                        switch (s->varkind) {
-                               case TEMPVAR:
-                                       if (s->flags & INMEMORY)
-                                               printf(" Tm%02d", s->regoff);
-                                       else
-                                               printf(" Tr%02d", s->regoff);
-                                       break;
-                               case STACKVAR:
-                                       printf(" S %02d", s->varnum);
-                                       break;
-                               case LOCALVAR:
-                                       printf(" L %02d", s->varnum);
-                                       break;
-                               case ARGVAR:
-                                       printf(" A %02d", s->varnum);
-                                       break;
-                               default:
-                                       printf(" ? %02d", s->varnum);
-                               }
-               }
+                       case TEMPVAR:
+                               if (s->flags & INMEMORY)
+                                       printf(" Tm%02d", s->regoff);
+                               else
+                                       printf(" Tr%02d", s->regoff);
+                               break;
+                       case STACKVAR:
+                               printf(" S %02d", s->varnum);
+                               break;
+                       case LOCALVAR:
+                               printf(" L %02d", s->varnum);
+                               break;
+                       case ARGVAR:
+                               printf(" A %02d", s->varnum);
+                               break;
+                       default:
+                               printf(" ? %02d", s->varnum);
+                       }
+       }
        else
                printf("     ");
                
@@ -1847,7 +1884,7 @@ static char *jit_type[] = {
 };
 
 
-static void show_icmd_method()
+void show_icmd_method()
 {
        int i, j;
        int deadcode;
@@ -1871,7 +1908,7 @@ static void show_icmd_method()
                printf("    L%03d ... ", ex->start->debug_nr );
                printf("L%03d  = ", ex->end->debug_nr);
                printf("L%03d\n", ex->handler->debug_nr);
-               }
+       }
        
        printf ("Local Table:\n");
        for (i = 0; i < maxlocals; i++) {
@@ -1885,9 +1922,9 @@ static void show_icmd_method()
                                        printf("f%02d", locals[i][j].regoff);
                                else
                                        printf("%3s", regs[locals[i][j].regoff]);
-                               }
+                       }
                printf("\n");
-               }
+       }
        printf("\n");
 
        printf ("Interface Table:\n");
@@ -1906,7 +1943,7 @@ static void show_icmd_method()
                                                        printf("F%02d", interfaces[i][j].regoff);
                                                else
                                                        printf("%3s", regs[interfaces[i][j].regoff]);
-                                               }
+                                       }
                                        else {
                                                if (interfaces[i][j].flags & INMEMORY)
                                                        printf("m%2d", interfaces[i][j].regoff);
@@ -1914,56 +1951,57 @@ static void show_icmd_method()
                                                        printf("f%02d", interfaces[i][j].regoff);
                                                else
                                                        printf("%3s", regs[interfaces[i][j].regoff]);
-                                               }
                                        }
+                               }
                        printf("\n");
-                       }
                }
+       }
        printf("\n");
 
        if (showdisassemble) {
 #if defined(__I386__) || defined(__X86_64__)
                u1 *u1ptr;
+               int a;
 
                u1ptr = method->mcode + dseglen;
                for (i = 0; i < block[0].mpc; i++, u1ptr++) {
-                       disassinstr(u1ptr, i);
-                       i = pstatic;
-                       u1ptr = codestatic;
+                       a = disassinstr(u1ptr, i);
+                       i += a;
+                       u1ptr += a;
                }
                printf("\n");
 #else
                s4ptr = (s4 *) (method->mcode + dseglen);
                for (i = 0; i < block[0].mpc; i += 4, s4ptr++) {
                        disassinstr(*s4ptr, i); 
-                       }
+               }
                printf("\n");
 #endif
-               }
+       }
 
        
-       for (bptr = block; bptr != NULL; bptr = bptr->next)
+       for (bptr = block; bptr != NULL; bptr = bptr->next) {
                if (bptr->flags != BBDELETED) {
-               deadcode = bptr->flags <= BBREACHED;
-               printf("[");
-               if (deadcode)
-                       for (j = maxstack; j > 0; j--)
-                               printf(" ?  ");
-               else
-                       print_stack(bptr->instack);
-               printf("] L%03d(%d - %d):\n", bptr->debug_nr, bptr->icount, bptr->pre_count);
-               iptr = bptr->iinstr;
-
-               for (i=0; i < bptr->icount; i++, iptr++) {
+                       deadcode = bptr->flags <= BBREACHED;
                        printf("[");
-                       if (deadcode) {
+                       if (deadcode)
                                for (j = maxstack; j > 0; j--)
                                        printf(" ?  ");
-                               }
                        else
-                               print_stack(iptr->dst);
-                       printf("]     %4d  %s", i, icmd_names[iptr->opc]);
-                       switch ((int) iptr->opc) {
+                               print_stack(bptr->instack);
+                       printf("] L%03d(%d - %d):\n", bptr->debug_nr, bptr->icount, bptr->pre_count);
+                       iptr = bptr->iinstr;
+
+                       for (i=0; i < bptr->icount; i++, iptr++) {
+                               printf("[");
+                               if (deadcode) {
+                                       for (j = maxstack; j > 0; j--)
+                                               printf(" ?  ");
+                               }
+                               else
+                                       print_stack(iptr->dst);
+                               printf("]     %4d  %s", i, icmd_names[iptr->opc]);
+                               switch ((int) iptr->opc) {
                                case ICMD_IADDCONST:
                                case ICMD_ISUBCONST:
                                case ICMD_IMULCONST:
@@ -2020,7 +2058,7 @@ static void show_icmd_method()
                                case ICMD_GETSTATIC:
                                        printf(" ");
                                        utf_fprint(stdout,
-                                                       ((fieldinfo *) iptr->val.a)->name);
+                                                          ((fieldinfo *) iptr->val.a)->name);
                                        break;
                                case ICMD_IINC:
                                        printf(" %d + %d", iptr->op1, iptr->val.i);
@@ -2063,42 +2101,42 @@ static void show_icmd_method()
                                case ICMD_NEW:
                                        printf(" ");
                                        utf_fprint(stdout,
-                                                      ((classinfo *) iptr->val.a)->name);
+                                                          ((classinfo *) iptr->val.a)->name);
                                        break;
                                case ICMD_NEWARRAY:
                                        switch (iptr->op1) {
-                                               case 4:
-                                                       printf(" boolean");
-                                                       break;
-                                               case 5:
-                                                       printf(" char");
-                                                       break;
-                                               case 6:
-                                                       printf(" float");
-                                                       break;
-                                               case 7:
-                                                       printf(" double");
-                                                       break;
-                                               case 8:
-                                                       printf(" byte");
-                                                       break;
-                                               case 9:
-                                                       printf(" short");
-                                                       break;
-                                               case 10:
-                                                       printf(" int");
-                                                       break;
-                                               case 11:
-                                                       printf(" long");
-                                                       break;
-                                               }
+                                       case 4:
+                                               printf(" boolean");
+                                               break;
+                                       case 5:
+                                               printf(" char");
+                                               break;
+                                       case 6:
+                                               printf(" float");
+                                               break;
+                                       case 7:
+                                               printf(" double");
+                                               break;
+                                       case 8:
+                                               printf(" byte");
+                                               break;
+                                       case 9:
+                                               printf(" short");
+                                               break;
+                                       case 10:
+                                               printf(" int");
+                                               break;
+                                       case 11:
+                                               printf(" long");
+                                               break;
+                                       }
                                        break;
                                case ICMD_ANEWARRAY:
                                        if (iptr->op1) {
                                                printf(" ");
                                                utf_fprint(stdout,
-                                                              ((classinfo *) iptr->val.a)->name);
-                                               }
+                                                                  ((classinfo *) iptr->val.a)->name);
+                                       }
                                        break;
                                case ICMD_CHECKCAST:
                                case ICMD_INSTANCEOF:
@@ -2109,7 +2147,7 @@ static void show_icmd_method()
                                                else
                                                        printf(" (CLASS,%3d) ", c->vftbl->diffval);
                                                utf_fprint(stdout, c->name);
-                                               }
+                                       }
                                        break;
                                case ICMD_BUILTIN3:
                                case ICMD_BUILTIN2:
@@ -2122,10 +2160,10 @@ static void show_icmd_method()
                                case ICMD_INVOKEINTERFACE:
                                        printf(" ");
                                        utf_fprint(stdout,
-                                                      ((methodinfo *) iptr->val.a)->class->name);
+                                                          ((methodinfo *) iptr->val.a)->class->name);
                                        printf(".");
                                        utf_fprint(stdout,
-                                                      ((methodinfo *) iptr->val.a)->name);
+                                                          ((methodinfo *) iptr->val.a)->name);
                                        break;
                                case ICMD_IFEQ:
                                case ICMD_IFNE:
@@ -2169,7 +2207,7 @@ static void show_icmd_method()
                                        tptr = (void **) iptr->target;
 
                                        printf(" L%03d;", ((basicblock *) *tptr)->debug_nr); 
-                                                                                   /* default */
+                                       /* default */
 
                                        s4ptr++;
                                        tptr++;
@@ -2180,7 +2218,7 @@ static void show_icmd_method()
                                                printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
                                                tptr++;
                                                j--;
-                                               }
+                                       }
                                        break;
                                case ICMD_LOOKUPSWITCH:
                                        s4ptr = iptr->val.a;
@@ -2194,68 +2232,58 @@ static void show_icmd_method()
                                        while (--j >= 0) {
                                                printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
                                                tptr++;
-                                               }
+                                       }
                                        break;
                                }
-                       printf("\n");
+                               printf("\n");
                        }
 
-               if (showdisassemble && (!deadcode)) {
+                       if (showdisassemble && (!deadcode)) {
 #if defined(__I386__) || defined(__X86_64__)
-                       u1 *u1ptr;
+                               u1 *u1ptr;
+                               int a;
 
-                       printf("\n");
-                       i = bptr->mpc;
-                       u1ptr = method->mcode + dseglen + i;
-
-                       if (bptr->next != NULL) {
-                               for (; i < bptr->next->mpc; i++, u1ptr++) {
-                                       disassinstr(u1ptr, i);
-                                       i = pstatic;
-                                       u1ptr = codestatic;
-                               }
                                printf("\n");
+                               i = bptr->mpc;
+                               u1ptr = method->mcode + dseglen + i;
+
+                               if (bptr->next != NULL) {
+                                       for (; i < bptr->next->mpc; i++, u1ptr++) {
+                                               a = disassinstr(u1ptr, i);
+                                               i += a;
+                                               u1ptr += a;
+                                       }
+                                       printf("\n");
 
-                       } else {
-                               for (; u1ptr < (u1 *) (method->mcode + method->mcodelength); i++, u1ptr++) {
-                                       disassinstr(u1ptr, i); 
-                                       i = pstatic;
-                                       u1ptr = codestatic;
+                               } else {
+                                       for (; u1ptr < (u1 *) (method->mcode + method->mcodelength); i++, u1ptr++) {
+                                               a = disassinstr(u1ptr, i); 
+                                               i += a;
+                                               u1ptr += a;
+                                       }
+                                       printf("\n");
                                }
-                               printf("\n");
-                       }
 #else
-                       printf("\n");
-                       i = bptr->mpc;
-                       s4ptr = (s4 *) (method->mcode + dseglen + i);
+                               printf("\n");
+                               i = bptr->mpc;
+                               s4ptr = (s4 *) (method->mcode + dseglen + i);
 
-                       if (bptr->next != NULL) {
-                               for (; i < bptr->next->mpc; i += 4, s4ptr++) {
-                                       disassinstr(*s4ptr, i); 
+                               if (bptr->next != NULL) {
+                                       for (; i < bptr->next->mpc; i += 4, s4ptr++) {
+                                               disassinstr(*s4ptr, i); 
                                    }
-                               printf("\n");
+                                       printf("\n");
                            }
-                       else {
-                               for (; s4ptr < (s4 *) (method->mcode + method->mcodelength); i += 4, s4ptr++) {
-                                       disassinstr(*s4ptr, i); 
+                               else {
+                                       for (; s4ptr < (s4 *) (method->mcode + method->mcodelength); i += 4, s4ptr++) {
+                                               disassinstr(*s4ptr, i); 
                                    }
-                               printf("\n");
+                                       printf("\n");
                            }
 #endif
                    }
-       }
-
-       /*
-       i = bptr->mpc;
-       s4ptr = (s4 *) (method->mcode + dseglen + i);
-       if (showdisassemble && (s4ptr < (s4 *) (method->mcode + method->mcodelength))) {
-               printf("\n");
-               for (; s4ptr < (s4 *) (method->mcode + method->mcodelength); i += 4, s4ptr++) {
-                       disassinstr(*s4ptr, i); 
-                       }
-               printf("\n");
                }
-       */
+       }
 }
 
 
diff --git a/jit/stack.h b/jit/stack.h
new file mode 100644 (file)
index 0000000..a09eac3
--- /dev/null
@@ -0,0 +1,55 @@
+/* jit/stack.h - stack analysis header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: stack.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _STACK_H
+#define _STACK_H
+
+/* function prototypes */
+void analyse_stack();
+void show_icmd_method();
+
+#endif /* _STACK_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/jni.c b/jni.c
index bedd4b8f88a3f19577dcbc72a97a01c23351c32d..d504479b89f425c304ec0b481ab62735cb66e068 100644 (file)
--- a/jni.c
+++ b/jni.c
@@ -1,9 +1,38 @@
-/********************************** jni.c *****************************************
+/* jni.c - implementation of JNI functions
 
-       implementation of the Java Native Interface functions                             
-       which are used in the JNI function table                                         
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-***********************************************************************************/
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: ?
+
+   $Id: jni.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include "types.h"
+#include "toolbox/memory.h"
 
 
 #define JNI_VERSION       0x00010002
@@ -1940,8 +1969,7 @@ jboolean ExceptionCheck (JNIEnv* env)
        
 /********************************* JNI function table ******************************/
 
-JNIEnv env =     
-   {   
+JNIEnv env = {   
     NULL,
     NULL,
     NULL,
@@ -2171,7 +2199,8 @@ JNIEnv env =
     &NewWeakGlobalRef,
     &DeleteWeakGlobalRef,
     &ExceptionCheck
-    };
+};
+
 
 /*
  * These are local overrides for various environment variables in Emacs.
diff --git a/jni.h b/jni.h
index 183fcda5c0751e0f795795b1805be3b7d64fc905..140c1737c90034bbe5d81b1fc63b146a0fa5235b 100644 (file)
--- a/jni.h
+++ b/jni.h
@@ -1,9 +1,38 @@
-/******************************** jni.h ***************************************
+/* jni.h - JNI types and data structures
 
-       contains Java Native Interface types and data structures 
-       includes layout of the JNI function table
-       
-*******************************************************************************/
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: ?
+
+   $Id: jni.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _JNI_H
+#define _JNI_H
 
 #include <stdarg.h>
 
@@ -421,5 +450,18 @@ struct JNI_Table {
 
 extern JNIEnv env;
 
-
-
+#endif /* _JNI_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 016054bb82500aaa8fafbcfca66f2fa2a4b2f120..a13cd4ed9eda8bb2d4693f3cb2ceff454b2061f4 100644 (file)
--- a/loader.c
+++ b/loader.c
@@ -1,20 +1,38 @@
+/* loader.c - class loader functions
 
-/* loader.c ********************************************************************
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       Copyright (c) 1999 A. Krall, R. Grafl, R. Obermaiser, M. Probst
+   This file is part of CACAO.
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Contains the functions of the class loader.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
-                Roman Obermaiser    EMAIL: cacao@complang.tuwien.ac.at
-                Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-       Last Change: 1999/11/08
+   Contact: cacao@complang.tuwien.ac.at
 
-*******************************************************************************/
+   Authors: Reinhard Grafl
+
+   Changes: Andreas Krall
+            Roman Obermaiser
+            Mark Probst
+
+   $Id: loader.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
 
 #include <assert.h>
@@ -105,15 +123,16 @@ static classinfo *class_java_lang_ThreadDeath;
  ******************************************************************************/
  
 primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = { 
-               { NULL, NULL, "java/lang/Integer",   'I', "int"     },
-               { NULL, NULL, "java/lang/Long",      'J', "long"    },
-               { NULL, NULL, "java/lang/Float",     'F', "float"   },
-               { NULL, NULL, "java/lang/Double",    'D', "double"  },
-               { NULL, NULL, "java/lang/Byte",      'B', "byte"    },
-               { NULL, NULL, "java/lang/Character", 'C', "char"    },
-               { NULL, NULL, "java/lang/Short",     'S', "short"   },
-               { NULL, NULL, "java/lang/Boolean",   'Z', "boolean" },
-               { NULL, NULL, "java/lang/Void",      'V', "void"    }};
+       { NULL, NULL, "java/lang/Integer",   'I', "int"     },
+       { NULL, NULL, "java/lang/Long",      'J', "long"    },
+       { NULL, NULL, "java/lang/Float",     'F', "float"   },
+       { NULL, NULL, "java/lang/Double",    'D', "double"  },
+       { NULL, NULL, "java/lang/Byte",      'B', "byte"    },
+       { NULL, NULL, "java/lang/Character", 'C', "char"    },
+       { NULL, NULL, "java/lang/Short",     'S', "short"   },
+       { NULL, NULL, "java/lang/Boolean",   'Z', "boolean" },
+       { NULL, NULL, "java/lang/Void",      'V', "void"    }
+};
 
 
 /* instances of important system classes **************************************/
@@ -2538,7 +2557,7 @@ classinfo *create_array_class(utf *u)
 
 *******************************************************************************/
  
-void loader_init ()
+void loader_init()
 {
        utf *string_class;
        interfaceindex = 0;
@@ -2777,4 +2796,3 @@ void loader_close ()
  * tab-width: 4
  * End:
  */
-
index e732a1482c45e88aa73d7bd0ea3126cd311b2983..afb29456f4be614076ca42911ffe2f8e3b544803 100644 (file)
--- a/loader.h
+++ b/loader.h
@@ -1,18 +1,38 @@
-/******************************* loader.h **************************************
+/* loader.c - class loader header
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains the prototypes for the class loader.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1997/11/14
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
+   Authors: Reinhard Grafl
 
+   $Id: loader.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _LOADER_H
+#define _LOADER_H
 
 /************************* program switches ***********************************/
 
@@ -69,8 +89,10 @@ bool class_issubclass (classinfo *sub, classinfo *super);
 void class_init (classinfo *c);
 
 /* debug purposes */
-void class_showmethods (classinfo *c);
 void class_showconstantpool (classinfo *c);
+void class_showmethods (classinfo *c);
+
+classinfo *loader_load(utf *topname);
 
 /* set buffer for reading classdata */
 void classload_buffer(u1 *buf,int len);
@@ -86,3 +108,19 @@ extern void class_link (classinfo *c);
 void field_display (fieldinfo *f);
 
 void method_display(methodinfo *m);
+
+#endif /* _LOADER_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/main.c b/main.c
index 006ad6720f575ec0a7e5bd75a873cfb3dc5af610..bb08526da2d1156e5d9dbbe956dab52f5631f8b6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,36 +1,59 @@
-/* main.c **********************************************************************
+/* main.c - contains main() and variables for the global options
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains main() and variables for the global options.
-       This module does the following tasks:
-          - Command line option handling
-          - Calling initialization routines
-          - Calling the class loader
-          - Running the main method
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Andi Krall          EMAIL: cacao@complang.tuwien.ac.at
-                Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                        Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: $Id: main.c 552 2003-11-01 20:47:35Z twisti $
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-#include "global.h"
+   Authors: Reinhard Grafl
+
+   Changes: Andi Krall
+            Mark Probst
+            Philipp Tomsich
+
+   This module does the following tasks:
+     - Command line option handling
+     - Calling initialization routines
+     - Calling the class loader
+     - Running the main method
+
+   $Id: main.c 557 2003-11-02 22:51:59Z twisti $
 
+*/
+
+
+#include <stdlib.h>
+#include "global.h"
 #include "tables.h"
 #include "loader.h"
 #include "jit.h"
-
 #include "asmpart.h"
 #include "builtin.h"
 #include "native.h"
-
 #include "threads/thread.h"
+#include "toolbox/loging.h"
+#include "parseRTstats.h"
+
 
 bool compileall = false;
 bool verbose =  false;
@@ -170,42 +193,44 @@ Prints the correct usage syntax to stdout.
 
 static void print_usage()
 {
-       printf ("USAGE: cacao [options] classname [program arguments]\n");
-       printf ("Options:\n");
-       printf ("          -classpath path ...... specify a path to look for classes\n");
-       printf ("          -Dpropertyname=value . add an entry to the property list\n");
-       printf ("          -mx maxmem[k|m] ...... specify the size for the heap\n");
-       printf ("          -ms initmem[k|m] ..... specify the initial size for the heap\n");
-       printf ("          -v ................... write state-information\n");
-       printf ("          -verbose ............. write more information\n");
-       printf ("          -verbosegc ........... write message for each GC\n");
-       printf ("          -verbosecall ......... write message for each call\n");
-       printf ("          -noieee .............. don't use ieee compliant arithmetic\n");
-       printf ("          -softnull ............ use software nullpointer check\n");
-       printf ("          -time ................ measure the runtime\n");
-       printf ("          -stat ................ detailed compiler statistics\n");
-       printf ("          -log logfile ......... specify a name for the logfile\n");
-       printf ("          -c(heck)b(ounds) ..... don't check array bounds\n");
-       printf ("                  s(ync) ....... don't check for synchronization\n");
-       printf ("          -oloop ............... optimize array accesses in loops\n"); 
-       printf ("          -l ................... don't start the class after loading\n");
-       printf ("          -all ................. compile all methods, no execution\n");
-       printf ("          -m ................... compile only a specific method\n");
-       printf ("          -sig ................. specify signature for a specific method\n");
-       printf ("          -s(how)a(ssembler) ... show disassembled listing\n");
-       printf ("                 c(onstants) ... show the constant pool\n");
-       printf ("                 d(atasegment).. show data segment listing\n");
-       printf ("                 i(ntermediate). show intermediate representation\n");
-       printf ("                 m(ethods)...... show class fields and methods\n");
-       printf ("                 u(tf) ......... show the utf - hash\n");
-       printf ("          -i     n ............. activate inlining\n");
-       printf ("                 v ............. inline virtual methods\n");
-       printf ("                 e ............. inline methods with exceptions\n");
-       printf ("                 p ............. optimize argument renaming\n");
-       printf ("                 o ............. inline methods of foreign classes\n");
-       printf ("          -rt .................. use rapid type analysis\n");
-       printf ("          -xta ................. use x type analysis\n");
-       printf ("          -vta ................. use variable type analysis\n");
+       printf("USAGE: cacao [options] classname [program arguments]\n");
+       printf("Options:\n");
+       printf("          -classpath path ...... specify a path to look for classes\n");
+       printf("          -Dpropertyname=value . add an entry to the property list\n");
+       printf("          -mx maxmem[k|m] ...... specify the size for the heap\n");
+       printf("          -ms initmem[k|m] ..... specify the initial size for the heap\n");
+       printf("          -v ................... write state-information\n");
+       printf("          -verbose ............. write more information\n");
+       printf("          -verbosegc ........... write message for each GC\n");
+       printf("          -verbosecall ......... write message for each call\n");
+#if defined(__ALPHA__)
+       printf("          -noieee .............. don't use ieee compliant arithmetic\n");
+#endif
+       printf("          -softnull ............ use software nullpointer check\n");
+       printf("          -time ................ measure the runtime\n");
+       printf("          -stat ................ detailed compiler statistics\n");
+       printf("          -log logfile ......... specify a name for the logfile\n");
+       printf("          -c(heck)b(ounds) ..... don't check array bounds\n");
+       printf("                  s(ync) ....... don't check for synchronization\n");
+       printf("          -oloop ............... optimize array accesses in loops\n"); 
+       printf("          -l ................... don't start the class after loading\n");
+       printf("          -all ................. compile all methods, no execution\n");
+       printf("          -m ................... compile only a specific method\n");
+       printf("          -sig ................. specify signature for a specific method\n");
+       printf("          -s(how)a(ssembler) ... show disassembled listing\n");
+       printf("                 c(onstants) ... show the constant pool\n");
+       printf("                 d(atasegment).. show data segment listing\n");
+       printf("                 i(ntermediate). show intermediate representation\n");
+       printf("                 m(ethods)...... show class fields and methods\n");
+       printf("                 u(tf) ......... show the utf - hash\n");
+       printf("          -i     n ............. activate inlining\n");
+       printf("                 v ............. inline virtual methods\n");
+       printf("                 e ............. inline methods with exceptions\n");
+       printf("                 p ............. optimize argument renaming\n");
+       printf("                 o ............. inline methods of foreign classes\n");
+       printf("          -rt .................. use rapid type analysis\n");
+       printf("          -xta ................. use x type analysis\n");
+       printf("          -vta ................. use variable type analysis\n");
 }   
 
 
@@ -221,17 +246,17 @@ static void print_times()
        long int totaltime = getcputime();
        long int runtime = totaltime - loadingtime - compilingtime;
 
-       sprintf (logtext, "Time for loading classes: %ld secs, %ld millis",
-            loadingtime / 1000000, (loadingtime % 1000000) / 1000);
+       sprintf(logtext, "Time for loading classes: %ld secs, %ld millis",
+                       loadingtime / 1000000, (loadingtime % 1000000) / 1000);
        dolog();
-       sprintf (logtext, "Time for compiling code:  %ld secs, %ld millis",
-            compilingtime / 1000000, (compilingtime % 1000000) / 1000);
+       sprintf(logtext, "Time for compiling code:  %ld secs, %ld millis",
+                       compilingtime / 1000000, (compilingtime % 1000000) / 1000);
        dolog();
-       sprintf (logtext, "Time for running program: %ld secs, %ld millis",
-            runtime / 1000000, (runtime % 1000000) / 1000);
+       sprintf(logtext, "Time for running program: %ld secs, %ld millis",
+                       runtime / 1000000, (runtime % 1000000) / 1000);
        dolog();
-       sprintf (logtext, "Total time: %ld secs, %ld millis",
-            totaltime / 1000000, (totaltime % 1000000) / 1000);
+       sprintf(logtext, "Total time: %ld secs, %ld millis",
+                       totaltime / 1000000, (totaltime % 1000000) / 1000);
        dolog();
 }
 
@@ -248,169 +273,170 @@ static void print_times()
 
 static void print_stats()
 {
-       sprintf (logtext, "Number of JitCompiler Calls: %d", count_jit_calls);
+       sprintf(logtext, "Number of JitCompiler Calls: %d", count_jit_calls);
        dolog();
-       sprintf (logtext, "Number of compiled Methods: %d", count_methods);
+       sprintf(logtext, "Number of compiled Methods: %d", count_methods);
        dolog();
-       sprintf (logtext, "Number of max basic blocks per method: %d", count_max_basic_blocks);
+       sprintf(logtext, "Number of max basic blocks per method: %d", count_max_basic_blocks);
        dolog();
-       sprintf (logtext, "Number of compiled basic blocks: %d", count_basic_blocks);
+       sprintf(logtext, "Number of compiled basic blocks: %d", count_basic_blocks);
        dolog();
-       sprintf (logtext, "Number of max JavaVM-Instructions per method: %d", count_max_javainstr);
+       sprintf(logtext, "Number of max JavaVM-Instructions per method: %d", count_max_javainstr);
        dolog();
-       sprintf (logtext, "Number of compiled JavaVM-Instructions: %d", count_javainstr);
+       sprintf(logtext, "Number of compiled JavaVM-Instructions: %d", count_javainstr);
        dolog();
-       sprintf (logtext, "Size of compiled JavaVM-Instructions:   %d(%d)", count_javacodesize,
-                                                     count_javacodesize - count_methods * 18);
+       sprintf(logtext, "Size of compiled JavaVM-Instructions:   %d(%d)", count_javacodesize,
+                       count_javacodesize - count_methods * 18);
        dolog();
-       sprintf (logtext, "Size of compiled Exception Tables:      %d", count_javaexcsize);
+       sprintf(logtext, "Size of compiled Exception Tables:      %d", count_javaexcsize);
        dolog();
-       sprintf (logtext, "Value of extended instruction set var:  %d", has_ext_instr_set);
+       sprintf(logtext, "Value of extended instruction set var:  %d", has_ext_instr_set);
        dolog();
-       sprintf (logtext, "Number of Machine-Instructions: %d", count_code_len >> 2);
+       sprintf(logtext, "Number of Machine-Instructions: %d", count_code_len >> 2);
        dolog();
-       sprintf (logtext, "Number of Spills: %d", count_spills);
+       sprintf(logtext, "Number of Spills: %d", count_spills);
        dolog();
-       sprintf (logtext, "Number of Activ    Pseudocommands: %5d", count_pcmd_activ);
+       sprintf(logtext, "Number of Activ    Pseudocommands: %5d", count_pcmd_activ);
        dolog();
-       sprintf (logtext, "Number of Drop     Pseudocommands: %5d", count_pcmd_drop);
+       sprintf(logtext, "Number of Drop     Pseudocommands: %5d", count_pcmd_drop);
        dolog();
-       sprintf (logtext, "Number of Const    Pseudocommands: %5d (zero:%5d)", count_pcmd_load, count_pcmd_zero);
+       sprintf(logtext, "Number of Const    Pseudocommands: %5d (zero:%5d)", count_pcmd_load, count_pcmd_zero);
        dolog();
-       sprintf (logtext, "Number of ConstAlu Pseudocommands: %5d (cmp: %5d, store:%5d)", count_pcmd_const_alu, count_pcmd_const_bra, count_pcmd_const_store);
+       sprintf(logtext, "Number of ConstAlu Pseudocommands: %5d (cmp: %5d, store:%5d)", count_pcmd_const_alu, count_pcmd_const_bra, count_pcmd_const_store);
        dolog();
-       sprintf (logtext, "Number of Move     Pseudocommands: %5d", count_pcmd_move);
+       sprintf(logtext, "Number of Move     Pseudocommands: %5d", count_pcmd_move);
        dolog();
-       sprintf (logtext, "Number of Load     Pseudocommands: %5d", count_load_instruction);
+       sprintf(logtext, "Number of Load     Pseudocommands: %5d", count_load_instruction);
        dolog();
-       sprintf (logtext, "Number of Store    Pseudocommands: %5d (combined: %5d)", count_pcmd_store, count_pcmd_store - count_pcmd_store_comb);
+       sprintf(logtext, "Number of Store    Pseudocommands: %5d (combined: %5d)", count_pcmd_store, count_pcmd_store - count_pcmd_store_comb);
        dolog();
-       sprintf (logtext, "Number of OP       Pseudocommands: %5d", count_pcmd_op);
+       sprintf(logtext, "Number of OP       Pseudocommands: %5d", count_pcmd_op);
        dolog();
-       sprintf (logtext, "Number of DUP      Pseudocommands: %5d", count_dup_instruction);
+       sprintf(logtext, "Number of DUP      Pseudocommands: %5d", count_dup_instruction);
        dolog();
-       sprintf (logtext, "Number of Mem      Pseudocommands: %5d", count_pcmd_mem);
+       sprintf(logtext, "Number of Mem      Pseudocommands: %5d", count_pcmd_mem);
        dolog();
-       sprintf (logtext, "Number of Method   Pseudocommands: %5d", count_pcmd_met);
+       sprintf(logtext, "Number of Method   Pseudocommands: %5d", count_pcmd_met);
        dolog();
-       sprintf (logtext, "Number of Branch   Pseudocommands: %5d (rets:%5d, Xrets: %5d)",
-                         count_pcmd_bra, count_pcmd_return, count_pcmd_returnx);
+       sprintf(logtext, "Number of Branch   Pseudocommands: %5d (rets:%5d, Xrets: %5d)",
+                       count_pcmd_bra, count_pcmd_return, count_pcmd_returnx);
        dolog();
-       sprintf (logtext, "Number of Table    Pseudocommands: %5d", count_pcmd_table);
+       sprintf(logtext, "Number of Table    Pseudocommands: %5d", count_pcmd_table);
        dolog();
-       sprintf (logtext, "Number of Useful   Pseudocommands: %5d", count_pcmd_table +
-                count_pcmd_bra + count_pcmd_load + count_pcmd_mem + count_pcmd_op);
+       sprintf(logtext, "Number of Useful   Pseudocommands: %5d", count_pcmd_table +
+                       count_pcmd_bra + count_pcmd_load + count_pcmd_mem + count_pcmd_op);
        dolog();
-       sprintf (logtext, "Number of Null Pointer Checks:     %5d", count_check_null);
+       sprintf(logtext, "Number of Null Pointer Checks:     %5d", count_check_null);
        dolog();
-       sprintf (logtext, "Number of Array Bound Checks:      %5d", count_check_bound);
+       sprintf(logtext, "Number of Array Bound Checks:      %5d", count_check_bound);
        dolog();
-       sprintf (logtext, "Number of Try-Blocks: %d", count_tryblocks);
+       sprintf(logtext, "Number of Try-Blocks: %d", count_tryblocks);
        dolog();
-       sprintf (logtext, "Maximal count of stack elements:   %d", count_max_new_stack);
+       sprintf(logtext, "Maximal count of stack elements:   %d", count_max_new_stack);
        dolog();
-       sprintf (logtext, "Upper bound of max stack elements: %d", count_upper_bound_new_stack);
+       sprintf(logtext, "Upper bound of max stack elements: %d", count_upper_bound_new_stack);
        dolog();
-       sprintf (logtext, "Distribution of stack sizes at block boundary");
+       sprintf(logtext, "Distribution of stack sizes at block boundary");
        dolog();
-       sprintf (logtext, "    0    1    2    3    4    5    6    7    8    9    >=10");
+       sprintf(logtext, "    0    1    2    3    4    5    6    7    8    9    >=10");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_block_stack[0],
-               count_block_stack[1],count_block_stack[2],count_block_stack[3],count_block_stack[4],
-               count_block_stack[5],count_block_stack[6],count_block_stack[7],count_block_stack[8],
-               count_block_stack[9],count_block_stack[10]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_block_stack[0],
+                       count_block_stack[1], count_block_stack[2], count_block_stack[3], count_block_stack[4],
+                       count_block_stack[5], count_block_stack[6], count_block_stack[7], count_block_stack[8],
+                       count_block_stack[9], count_block_stack[10]);
        dolog();
-       sprintf (logtext, "Distribution of store stack depth");
+       sprintf(logtext, "Distribution of store stack depth");
        dolog();
-       sprintf (logtext, "    0    1    2    3    4    5    6    7    8    9    >=10");
+       sprintf(logtext, "    0    1    2    3    4    5    6    7    8    9    >=10");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_depth[0],
-               count_store_depth[1],count_store_depth[2],count_store_depth[3],count_store_depth[4],
-               count_store_depth[5],count_store_depth[6],count_store_depth[7],count_store_depth[8],
-               count_store_depth[9],count_store_depth[10]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_depth[0],
+                       count_store_depth[1], count_store_depth[2], count_store_depth[3], count_store_depth[4],
+                       count_store_depth[5], count_store_depth[6], count_store_depth[7], count_store_depth[8],
+                       count_store_depth[9], count_store_depth[10]);
        dolog();
-       sprintf (logtext, "Distribution of store creator chains first part");
+       sprintf(logtext, "Distribution of store creator chains first part");
        dolog();
-       sprintf (logtext, "    0    1    2    3    4    5    6    7    8    9  ");
+       sprintf(logtext, "    0    1    2    3    4    5    6    7    8    9  ");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_length[0],
-               count_store_length[1],count_store_length[2],count_store_length[3],count_store_length[4],
-               count_store_length[5],count_store_length[6],count_store_length[7],count_store_length[8],
-               count_store_length[9]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_length[0],
+                       count_store_length[1], count_store_length[2], count_store_length[3], count_store_length[4],
+                       count_store_length[5], count_store_length[6], count_store_length[7], count_store_length[8],
+                       count_store_length[9]);
        dolog();
-       sprintf (logtext, "Distribution of store creator chains second part");
+       sprintf(logtext, "Distribution of store creator chains second part");
        dolog();
-       sprintf (logtext, "   10   11   12   13   14   15   16   17   18   19  >=20");
+       sprintf(logtext, "   10   11   12   13   14   15   16   17   18   19  >=20");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_length[10],
-               count_store_length[11],count_store_length[12],count_store_length[13],count_store_length[14],
-               count_store_length[15],count_store_length[16],count_store_length[17],count_store_length[18],
-               count_store_length[19],count_store_length[20]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_length[10],
+                       count_store_length[11], count_store_length[12], count_store_length[13], count_store_length[14],
+                       count_store_length[15], count_store_length[16], count_store_length[17], count_store_length[18],
+                       count_store_length[19], count_store_length[20]);
        dolog();
-       sprintf (logtext, "Distribution of analysis iterations");
+       sprintf(logtext, "Distribution of analysis iterations");
        dolog();
-       sprintf (logtext, "    1    2    3    4    >=5");
+       sprintf(logtext, "    1    2    3    4    >=5");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d", count_analyse_iterations[0],count_analyse_iterations[1],
-               count_analyse_iterations[2],count_analyse_iterations[3],count_analyse_iterations[4]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d", count_analyse_iterations[0], count_analyse_iterations[1],
+                       count_analyse_iterations[2], count_analyse_iterations[3], count_analyse_iterations[4]);
        dolog();
-       sprintf (logtext, "Distribution of basic blocks per method");
+       sprintf(logtext, "Distribution of basic blocks per method");
        dolog();
-       sprintf (logtext, " <= 5 <=10 <=15 <=20 <=30 <=40 <=50 <=75  >75");
+       sprintf(logtext, " <= 5 <=10 <=15 <=20 <=30 <=40 <=50 <=75  >75");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_method_bb_distribution[0],
-               count_method_bb_distribution[1],count_method_bb_distribution[2],count_method_bb_distribution[3],
-               count_method_bb_distribution[4],count_method_bb_distribution[5],count_method_bb_distribution[6],
-               count_method_bb_distribution[7],count_method_bb_distribution[8]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_method_bb_distribution[0],
+                       count_method_bb_distribution[1], count_method_bb_distribution[2], count_method_bb_distribution[3],
+                       count_method_bb_distribution[4], count_method_bb_distribution[5], count_method_bb_distribution[6],
+                       count_method_bb_distribution[7], count_method_bb_distribution[8]);
        dolog();
-       sprintf (logtext, "Distribution of basic block sizes");
+       sprintf(logtext, "Distribution of basic block sizes");
        dolog();
-       sprintf (logtext,
-       "  0    1    2    3    4   5   6   7   8   9 <13 <15 <17 <19 <21 <26 <31 >30");
+       sprintf(logtext,
+                        "  0    1    2    3    4   5   6   7   8   9 <13 <15 <17 <19 <21 <26 <31 >30");
        dolog();
-       sprintf (logtext, "%3d%5d%5d%5d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d",
-               count_block_size_distribution[0], count_block_size_distribution[1], count_block_size_distribution[2],
-               count_block_size_distribution[3], count_block_size_distribution[4], count_block_size_distribution[5],
-               count_block_size_distribution[6], count_block_size_distribution[7], count_block_size_distribution[8],
-               count_block_size_distribution[9], count_block_size_distribution[10],count_block_size_distribution[11],
-               count_block_size_distribution[12],count_block_size_distribution[13],count_block_size_distribution[14],
-               count_block_size_distribution[15],count_block_size_distribution[16],count_block_size_distribution[17]);
+       sprintf(logtext, "%3d%5d%5d%5d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d",
+                       count_block_size_distribution[0], count_block_size_distribution[1], count_block_size_distribution[2],
+                       count_block_size_distribution[3], count_block_size_distribution[4], count_block_size_distribution[5],
+                       count_block_size_distribution[6], count_block_size_distribution[7], count_block_size_distribution[8],
+                       count_block_size_distribution[9], count_block_size_distribution[10], count_block_size_distribution[11],
+                       count_block_size_distribution[12], count_block_size_distribution[13], count_block_size_distribution[14],
+                       count_block_size_distribution[15], count_block_size_distribution[16], count_block_size_distribution[17]);
        dolog();
-       sprintf (logtext, "Size of Code Area (Kb):  %10.3f", (float) count_code_len / 1024);
+       sprintf(logtext, "Size of Code Area (Kb):  %10.3f", (float) count_code_len / 1024);
        dolog();
-       sprintf (logtext, "Size of data Area (Kb):  %10.3f", (float) count_data_len / 1024);
+       sprintf(logtext, "Size of data Area (Kb):  %10.3f", (float) count_data_len / 1024);
        dolog();
-       sprintf (logtext, "Size of Class Infos (Kb):%10.3f", (float) (count_class_infos) / 1024);
+       sprintf(logtext, "Size of Class Infos (Kb):%10.3f", (float) (count_class_infos) / 1024);
        dolog();
-       sprintf (logtext, "Size of Const Pool (Kb): %10.3f", (float) (count_const_pool_len + count_utf_len) / 1024);
+       sprintf(logtext, "Size of Const Pool (Kb): %10.3f", (float) (count_const_pool_len + count_utf_len) / 1024);
        dolog();
-       sprintf (logtext, "Size of Vftbl (Kb):      %10.3f", (float) count_vftbl_len / 1024);
+       sprintf(logtext, "Size of Vftbl (Kb):      %10.3f", (float) count_vftbl_len / 1024);
        dolog();
-       sprintf (logtext, "Size of comp stub (Kb):  %10.3f", (float) count_cstub_len / 1024);
+       sprintf(logtext, "Size of comp stub (Kb):  %10.3f", (float) count_cstub_len / 1024);
        dolog();
-       sprintf (logtext, "Size of native stub (Kb):%10.3f", (float) count_nstub_len / 1024);
+       sprintf(logtext, "Size of native stub (Kb):%10.3f", (float) count_nstub_len / 1024);
        dolog();
-       sprintf (logtext, "Size of Utf (Kb):        %10.3f", (float) count_utf_len / 1024);
+       sprintf(logtext, "Size of Utf (Kb):        %10.3f", (float) count_utf_len / 1024);
        dolog();
-       sprintf (logtext, "Size of VMCode (Kb):     %10.3f(%d)", (float) count_vmcode_len / 1024,
-                                                     count_vmcode_len - 18 * count_all_methods);
+       sprintf(logtext, "Size of VMCode (Kb):     %10.3f(%d)", (float) count_vmcode_len / 1024,
+                       count_vmcode_len - 18 * count_all_methods);
        dolog();
-       sprintf (logtext, "Size of ExTable (Kb):    %10.3f", (float) count_extable_len / 1024);
+       sprintf(logtext, "Size of ExTable (Kb):    %10.3f", (float) count_extable_len / 1024);
        dolog();
-       sprintf (logtext, "Number of class loads:   %d", count_class_loads);
+       sprintf(logtext, "Number of class loads:   %d", count_class_loads);
        dolog();
-       sprintf (logtext, "Number of class inits:   %d", count_class_inits);
+       sprintf(logtext, "Number of class inits:   %d", count_class_inits);
        dolog();
-       sprintf (logtext, "Number of loaded Methods: %d\n\n", count_all_methods);
+       sprintf(logtext, "Number of loaded Methods: %d\n\n", count_all_methods);
        dolog();
 
-       sprintf (logtext, "Calls of utf_new: %22d", count_utf_new);
+       sprintf(logtext, "Calls of utf_new: %22d", count_utf_new);
        dolog();
-       sprintf (logtext, "Calls of utf_new (element found): %6d\n\n", count_utf_new_found);
+       sprintf(logtext, "Calls of utf_new (element found): %6d\n\n", count_utf_new_found);
        dolog();
 }
 
 
+
 /********** Function: class_compile_methods   (debugging only) ********/
 
 void class_compile_methods ()
@@ -425,19 +451,20 @@ void class_compile_methods ()
                        m = &(c->methods[i]);
                        if (m->jcode) {
                                (void) jit_compile(m);
-                               }
                        }
-               c = list_next (&linkedclasses, c);
                }
+               c = list_next (&linkedclasses, c);
+       }
 }
 
+
+
 /*
  * void exit_handler(void)
  * -----------------------
  * The exit_handler function is called upon program termination to shutdown
  * the various subsystems and release the resources allocated to the VM.
  */
-
 void exit_handler(void)
 {
        /********************* Print debug tables ************************/
@@ -470,6 +497,8 @@ void exit_handler(void)
        }
 }
 
+
+
 /************************** Function: main *******************************
 
    The main program.
@@ -502,9 +531,9 @@ int main(int argc, char **argv)
 
        /************ Collect info from the environment ************************/
 
-       cp = getenv ("CLASSPATH");
+       cp = getenv("CLASSPATH");
        if (cp) {
-               strcpy (classpath, cp);
+               strcpy(classpath, cp);
        }
 
        /***************** Interpret the command line *****************/
@@ -512,8 +541,7 @@ int main(int argc, char **argv)
        checknull = false;
        opt_noieee = false;
 
-       while ( (i = get_opt(argc,argv)) != OPT_DONE) {
-
+       while ((i = get_opt(argc,argv)) != OPT_DONE) {
                switch (i) {
                case OPT_IGNORE: break;
                        
@@ -524,11 +552,12 @@ int main(int argc, char **argv)
                                
                case OPT_D:
                        {
-                               int n,l=strlen(opt_arg);
-                               for (n=0; n<l; n++) {
+                               int n;
+                               int l = strlen(opt_arg);
+                               for (n = 0; n < l; n++) {
                                        if (opt_arg[n]=='=') {
                                                opt_arg[n] = '\0';
-                                               attach_property (opt_arg, opt_arg+n+1);
+                                               attach_property(opt_arg, opt_arg + n + 1);
                                                goto didit;
                                        }
                                }
@@ -537,19 +566,19 @@ int main(int argc, char **argv)
                                        
                        didit: ;
                        }       
-               break;
+                       break;
                                
                case OPT_MS:
                case OPT_MX:
-                       if (opt_arg[strlen(opt_arg)-1] == 'k') {
+                       if (opt_arg[strlen(opt_arg) - 1] == 'k') {
                                j = 1024 * atoi(opt_arg);
                        }
-                       else if (opt_arg[strlen(opt_arg)-1] == 'm') {
+                       else if (opt_arg[strlen(opt_arg) - 1] == 'm') {
                                j = 1024 * 1024 * atoi(opt_arg);
                        }
                        else j = atoi(opt_arg);
                                
-                       if (i==OPT_MX) heapsize = j;
+                       if (i == OPT_MX) heapsize = j;
                        else heapstartsize = j;
                        break;
 
@@ -590,15 +619,20 @@ int main(int argc, char **argv)
                        break;
                                        
                case OPT_LOG:
-                       strcpy (logfilename, opt_arg);
+                       strcpy(logfilename, opt_arg);
                        break;
                        
                case OPT_CHECK:
-                       for (j=0; j<strlen(opt_arg); j++) {
+                       for (j = 0; j < strlen(opt_arg); j++) {
                                switch (opt_arg[j]) {
-                               case 'b': checkbounds=false; break;
-                               case 's': checksync=false; break;
-                               default:  print_usage();
+                               case 'b':
+                                       checkbounds = false;
+                                       break;
+                               case 's':
+                                       checksync = false;
+                                       break;
+                               default:
+                                       print_usage();
                                        exit(10);
                                }
                        }
@@ -626,15 +660,30 @@ int main(int argc, char **argv)
                        break;
                        
                case OPT_SHOW:       /* Display options */
-                       for (j=0; j<strlen(opt_arg); j++) {             
+                       for (j = 0; j < strlen(opt_arg); j++) {         
                                switch (opt_arg[j]) {
-                               case 'a':  showdisassemble=true; compileverbose=true; break;
-                               case 'c':  showconstantpool=true; break;
-                               case 'd':  showddatasegment=true; break;
-                               case 'i':  showintermediate=true; compileverbose=true; break;
-                               case 'm':  showmethods=true; break;
-                               case 'u':  showutf=true; break;
-                               default:   print_usage();
+                               case 'a':
+                                       showdisassemble = true;
+                                       compileverbose=true;
+                                       break;
+                               case 'c':
+                                       showconstantpool = true;
+                                       break;
+                               case 'd':
+                                       showddatasegment = true;
+                                       break;
+                               case 'i':
+                                       showintermediate = true;
+                                       compileverbose = true;
+                                       break;
+                               case 'm':
+                                       showmethods = true;
+                                       break;
+                               case 'u':
+                                       showutf = true;
+                                       break;
+                               default:
+                                       print_usage();
                                        exit(10);
                                }
                        }
@@ -645,14 +694,25 @@ int main(int argc, char **argv)
                        break;
 
                case OPT_INLINING:
-                       for (j=0; j<strlen(opt_arg); j++) {             
+                       for (j = 0; j < strlen(opt_arg); j++) {         
                                switch (opt_arg[j]) {
-                               case 'n':  useinlining = true; break;
-                               case 'v':  inlinevirtuals = true; break;
-                               case 'e':  inlineexceptions = true; break;
-                               case 'p':  inlineparamopt = true; break;
-                               case 'o':  inlineoutsiders = true; break;
-                               default:   print_usage();
+                               case 'n':
+                                       useinlining = true;
+                                       break;
+                               case 'v':
+                                       inlinevirtuals = true;
+                                       break;
+                               case 'e':
+                                       inlineexceptions = true;
+                                       break;
+                               case 'p':
+                                       inlineparamopt = true;
+                                       break;
+                               case 'o':
+                                       inlineoutsiders = true;
+                                       break;
+                               default:
+                                       print_usage();
                                        exit(10);
                                }
                        }
@@ -678,50 +738,47 @@ int main(int argc, char **argv)
    
    
        if (opt_ind >= argc) {
-               print_usage ();
+               print_usage();
                exit(10);
        }
 
 
        /**************************** Program start *****************************/
 
-       log_init (logfilename);
+       log_init(logfilename);
        if (verbose) {
-               log_text (
-                                 "CACAO started -------------------------------------------------------");
+               log_text("CACAO started -------------------------------------------------------");
        }
        
-       suck_init (classpath);
-       native_setclasspath (classpath);
+       suck_init(classpath);
+       native_setclasspath(classpath);
                
        tables_init();
        heap_init(heapsize, heapstartsize, &dummy);
        jit_init();
        loader_init();
 
-       native_loadclasses ();
+       native_loadclasses();
 
 
        /*********************** Load JAVA classes  ***************************/
    
        cp = argv[opt_ind++];
-       for (i=strlen(cp)-1; i>=0; i--) {     /* Transform dots into slashes */
-               if (cp[i]=='.') cp[i]='/';        /* in the class name */
+       for (i = strlen(cp) - 1; i >= 0; i--) {     /* Transform dots into slashes */
+               if (cp[i] == '.') cp[i] = '/';        /* in the class name */
        }
 
-       topclass = loader_load ( utf_new_char (cp) );
+       topclass = loader_load( utf_new_char (cp) );
 
-       if (exceptionptr != 0)
-       {
-               printf ("#### Class loader has thrown: ");
-               utf_display (exceptionptr->vftbl->class->name);
-               printf ("\n");
+       if (exceptionptr != 0) {
+               printf("#### Class loader has thrown: ");
+               utf_display(exceptionptr->vftbl->class->name);
+               printf("\n");
 
                exceptionptr = 0;
        }
 
-       if (topclass == 0)
-       {
+       if (topclass == 0) {
                printf("#### Could not find top class - exiting\n");
                exit(1);
        }
@@ -729,7 +786,7 @@ int main(int argc, char **argv)
        gc_init();
 
 #ifdef USE_THREADS
-       initThreads((u1*)&dummy);                   /* schani */
+       initThreads((u1*) &dummy);                   /* schani */
 #endif
 
        /************************* Start worker routines ********************/
@@ -745,28 +802,28 @@ int main(int argc, char **argv)
                                                                           utf_new_char ("main"), 
                                                                           utf_new_char ("([Ljava/lang/String;)V")
                                                                           );
-               if (!mainmethod) panic ("Can not find method 'void main(String[])'");
-               if ((mainmethod->flags & ACC_STATIC) != ACC_STATIC) panic ("main is not static!");
+               if (!mainmethod) panic("Can not find method 'void main(String[])'");
+               if ((mainmethod->flags & ACC_STATIC) != ACC_STATIC) panic("main is not static!");
                        
-               a = builtin_anewarray (argc - opt_ind, class_java_lang_String);
-               for (i=opt_ind; i<argc; i++) {
-                       a->data[i-opt_ind] = javastring_new (utf_new_char (argv[i]) );
+               a = builtin_anewarray(argc - opt_ind, class_java_lang_String);
+               for (i = opt_ind; i < argc; i++) {
+                       a->data[i - opt_ind] = javastring_new(utf_new_char(argv[i]));
                }
-               local_exceptionptr = asm_calljavamethod (mainmethod, a, NULL, NULL, NULL );
+               local_exceptionptr = asm_calljavamethod(mainmethod, a, NULL, NULL, NULL);
        
                if (local_exceptionptr) {
-                       printf ("#### Program has thrown: ");
-                       utf_display (local_exceptionptr->vftbl->class->name);
-                       printf ("\n");
+                       printf("#### Program has thrown: ");
+                       utf_display(local_exceptionptr->vftbl->class->name);
+                       printf("\n");
                }
-                                        /*RTAprint*/ if ((pCallgraph >= 1) && (opt_rt)) {
-                                        /*RTAprint*/    printCallgraph (); }
+               /*RTAprint*/ if ((pCallgraph >= 1) && (opt_rt)) {
+                       /*RTAprint*/    printCallgraph (); }
 
-                                        /*RTprint*/ if ((pClassHeir >= 1) && (opt_rt)) {
-                                        /*RTprint*/     printf("Last RTA Info -");
-                                        /*RTprint*/     printRThierarchyInfo(mainmethod); 
-                                       /*RTprint*/     }
-                                       /*RTprint*/     printObjectClassHeirarchy1( );
+               /*RTprint*/ if ((pClassHeir >= 1) && (opt_rt)) {
+                       /*RTprint*/     printf("Last RTA Info -");
+                       /*RTprint*/     printRThierarchyInfo(mainmethod); 
+                       /*RTprint*/     }
+               /*RTprint*/     printObjectClassHeirarchy1( );
 
 
 #ifdef USE_THREADS
@@ -794,7 +851,7 @@ int main(int argc, char **argv)
                        m = class_findmethod(topclass, 
                                                                 utf_new_char(specificmethodname), NULL);
                if (!m) panic ("Specific method not found");
-                       (void) jit_compile(m);
+               (void) jit_compile(m);
        }
 
        exit(0);
@@ -811,23 +868,25 @@ int main(int argc, char **argv)
 
 void cacao_shutdown(s4 status)
 {
-                                        /*RTAprint*/ if ((pCallgraph >= 1) && (opt_rt)) {
-                                        /*RTAprint*/    printCallgraph (NULL); }
+       if ((pCallgraph >= 1) && (opt_rt)) {
+               printCallgraph(NULL);
+       }
 
-                                        /*RTprint*/ if ((pClassHeir >= 1) && (opt_rt)) {
-                                        /*RTprint*/     printf("RTA Information -");
-                                        /*RTprint*/     printRThierarchyInfo(NULL); }
+       if ((pClassHeir >= 1) && (opt_rt)) {
+               printf("RTA Information -");
+               printRThierarchyInfo(NULL);
+       }
 
        if (verbose || getcompilingtime || statistics) {
                log_text ("CACAO terminated by shutdown");
                if (statistics)
-                       print_stats ();
+                       print_stats();
                if (getcompilingtime)
-                       print_times ();
+                       print_times();
                mem_usagelog(0);
-               sprintf (logtext, "Exit status: %d\n", (int) status);
+               sprintf(logtext, "Exit status: %d\n", (int) status);
                dolog();
-               }
+       }
 
        exit(status);
 }
diff --git a/mips/Makefile.am b/mips/Makefile.am
deleted file mode 100644 (file)
index 841fb78..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTRA_DIST = asmpart.S calling.doc defines.h disass.c \
-            native-math.h ngen.c ngen.h threads.h types.h
diff --git a/mips/asmpart.S b/mips/asmpart.S
deleted file mode 100644 (file)
index e8eec97..0000000
+++ /dev/null
@@ -1,971 +0,0 @@
-/* -*- mode: asm; tab-width: 4 -*- */
-/****************************** asmpart.c **************************************
-*                                                                              *
-*   is an assembly language file, but called .c to fake the preprocessor.      *
-*   It contains the Java-C interface functions for Alpha processors.           *
-*                                                                              *
-*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
-*                                                                              *
-*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
-*                                                                              *
-*   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
-*                                                                              *
-*   Last Change: 1998/11/23                                                    *
-*                                                                              *
-*******************************************************************************/
-
-#include "offsets.h"
-
-#define zero    $0
-#define itmp1   $1
-#define v0      $2
-#define itmp2   $3
-#define a0      $4
-#define a1      $5
-#define a2      $6
-#define a3      $7
-
-#define a4      $8
-#define        a5      $9
-#define        a6      $10
-#define        a7      $11
-#define        t0      $12
-#define        t1      $13
-#define        t2      $14
-#define        t3      $15
-
-#define s0      $16
-#define s1      $17
-#define s2      $18
-#define s3      $19
-#define s4      $20
-#define s5      $21
-#define s6      $22
-#define s7      $23
-
-#define t4      $24
-#define itmp3   $25
-#define k0      $26
-#define k1      $27
-
-#define gp      $28
-#define sp      $29
-#define s8      $30
-#define ra      $31
-
-#define pv      s8
-#define t9      itmp3
-
-#define xptr    itmp1
-#define xpc     itmp2
-#define mptr    itmp3
-#define mptrreg 25
-
-#define fv0     $f0
-#define ft0     $f1
-#define ft1     $f2
-#define ft2     $f3
-#define ft3     $f4
-#define ft4     $f5
-#define ft5     $f6
-#define ft6     $f7
-
-#define ft7     $f8
-#define        ft8     $f9
-#define        ft9     $f10
-#define        ft10    $f11
-#define        fa0     $f12
-#define        fa1     $f13
-#define        fa2     $f14
-#define        fa3     $f15
-
-#define fa4     $f16
-#define fa5     $f17
-#define fa6     $f18
-#define fa7     $f19
-#define ft11    $f20
-#define ft12    $f21
-#define ft13    $f22
-#define ft14    $f23
-
-#define fs0     $f24
-#define ft15    $f25
-#define fs1     $f26
-#define ft16    $f27
-#define fs2     $f28
-#define ft17    $f29
-#define fs3     $f30
-#define ft18    $f31
-
-#define fss0    $f20
-#define fss1    $f22
-#define fss2    $f25
-#define fss3    $f27
-#define fss4    $f29
-#define fss5    $f31
-
-#define aaddu   daddu
-#define asubu   dsubu
-#define aaddiu  daddiu
-#define ald     ld
-#define ast     sd
-#define ala     dla
-#define asll    dsll
-#define ashift  3
-
-#define MethodPointer   -8
-#define FrameSize       -12
-#define IsSync          -16
-#define IsLeaf          -20
-#define IntSave         -24
-#define FltSave         -28
-#define ExTableSize     -32
-#define ExTableStart    -32
-
-#define ExEntrySize     -32
-#define ExStartPC       -8
-#define ExEndPC         -16
-#define ExHandlerPC     -24
-#define ExCatchType     -32
-
-
-       .text
-       .set    noat
-
-
-/********************* exported functions and variables ***********************/
-
-       .globl has_no_x_instr_set
-       .globl synchronize_caches
-       .globl asm_calljavafunction
-       .globl asm_call_jit_compiler
-       .globl asm_dumpregistersandcall
-       .globl asm_handle_exception
-       .globl asm_handle_nat_exception
-       .globl asm_builtin_checkarraycast
-       .globl asm_builtin_checkcast
-       .globl asm_builtin_aastore
-       .globl asm_builtin_monitorenter
-       .globl asm_builtin_monitorexit
-       .globl asm_builtin_idiv
-       .globl asm_builtin_irem
-       .globl asm_builtin_ldiv
-       .globl asm_builtin_lrem
-       .globl asm_perform_threadswitch
-       .globl asm_initialize_thread_stack
-       .globl asm_switchstackandcall
-       .globl asm_getcallingmethod
-
-
-/*************************** imported functions *******************************/
-
-       .globl jit_compile
-       .globl builtin_monitorexit
-       .globl builtin_throw_exception
-       .globl builtin_trace_exception
-       .globl class_java_lang_Object
-
-
-/*********************** function has_no_x_instr_set ***************************
-*                                                                              *
-*   determines if the byte support instruction set (21164a and higher)         *
-*   is available.                                                              *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    has_no_x_instr_set
-has_no_x_instr_set:
-
-       move    v0,zero                   /* result code 0 (not used for MIPS)    */
-       j       ra                        /* return                               */
-
-       .end    has_no_x_instr_set
-
-
-/********************* function synchronize_caches ****************************/
-
-       .ent    synchronize_caches
-synchronize_caches:
-
-/*     li      a0,BCACHE          */     /* flush both caches                    */
-/*     li      v0,SYS_cacheflush  */     /* Syscall number for cacheflush()      */
-/*     syscall                    */     /* call cacheflush()                    */
-       j       ra                        /* return                               */
-
-       .end    synchronize_caches
-
-
-#if 0
-
-/********************* function asm_calljavafunction ****************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 address parameters.                                           *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   A possibly throwed exception will be returned to the caller as function    *
-*   return value, so the java method cannot return a fucntion value (this      *
-*   function usually calls 'main' and '<clinit>' which do not return a         *
-*   function value).                                                           *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavafunction (methodinfo *m,                   *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_calljavafunction
-
-call_name:
-
-       .ascii  "calljavafunction\0\0"
-
-       .align  3
-       .dword  0                         /* catch type all                       */
-       .dword  calljava_xhandler         /* handler pc                           */
-       .dword  calljava_xhandler         /* end pc                               */
-       .dword  asm_calljavafunction        /* start pc                             */
-       .word   1                         /* extable size                         */
-       .word   0                         /* fltsave                              */
-       .word   0                         /* intsave                              */
-       .word   0                         /* isleaf                               */
-       .word   0                         /* IsSync                               */
-       .word   80                        /* frame size                           */
-       .dword  0                         /* method pointer (pointer to name)     */
-
-asm_calljavafunction:
-
-       aaddiu  sp,sp,-10*8               /* allocate stack space                 */
-       sd      ra,0(sp)                  /* save return address                  */
-
-       .set    noreorder
-       bal     call_java_pc
-       sd      pv,3*8(sp)                /* procedure vector                     */
-call_java_pc:
-       aaddiu  pv,ra,-4*4
-
-       .set    reorder
-       
-       sdc1    fss0,4*8(sp)              /* save non JavaABI saved flt registers */
-       sdc1    fss1,5*8(sp)
-       sdc1    fss2,6*8(sp)
-       sdc1    fss3,7*8(sp)
-       sdc1    fss4,8*8(sp)
-       sdc1    fss5,9*8(sp)
-       sd      a0,2*8(sp)                /* save method pointer for compiler     */
-       aaddiu  itmp1,sp,16               /* pass pointer to methodptr via itmp1  */
-
-       move    a0,a1                     /* pass the remaining parameters        */
-       move    a1,a2
-       move    a2,a3
-       move    a3,a4
-
-       ala     mptr,asm_call_jit_compiler/* fake virtual function call (2 instr) */
-       ast     mptr,1*8(sp)              /* store function address               */
-       move    mptr,sp                   /* set method pointer                   */
-
-       .set    noreorder
-       
-       ald     pv,1*8(mptr)              /* method call as in Java               */
-       jalr    pv                        /* call JIT compiler                    */
-       nop
-       aaddiu  pv,ra,-23*4               /* recompute procedure vector           */
-       move    v0,zero                   /* clear return value (exception ptr)   */
-
-       .set    reorder
-       
-calljava_return:
-
-       ld      ra,0(sp)                  /* restore return address               */
-       ld      pv,3*8(sp)                /* restore procedure vector             */
-
-       ldc1    fss0,4*8(sp)              /* restore non JavaABI saved flt regs   */
-       ldc1    fss1,5*8(sp)
-       ldc1    fss2,6*8(sp)
-       ldc1    fss3,7*8(sp)
-       ldc1    fss4,8*8(sp)
-       ldc1    fss5,9*8(sp)
-       aaddiu  sp,sp,10*8                /* free stack space                     */
-       j       ra                        /* return                               */
-
-calljava_xhandler:
-
-       move    a0,itmp1                  
-       jal     builtin_throw_exception
-       b       calljava_return
-
-       .end    asm_calljavafunction
-
-#endif
-
-
-/****************** function asm_call_jit_compiler *****************************
-*                                                                              *
-*   invokes the compiler for untranslated JavaVM methods.                      *
-*                                                                              *
-*   Register REG_ITEMP1 contains a pointer to the method info structure        *
-*   (prepared by createcompilerstub). Using the return address in R31 and the  *
-*   offset in the LDA instruction or using the value in methodptr R25 the      *
-*   patching address for storing the method address can be computed:           *
-*                                                                              *
-*   method address was either loaded using                                     *
-*   M_ALD (REG_PV, REG_PV, a)        ; invokestatic/special    ($28)           *
-*   M_JSR (REG_RA, REG_PV);                                                    *
-*   M_NOP                                                                      *
-*   M_LDA (REG_PV, REG_RA, val)                                                *
-*   or                                                                         *
-*   M_ALD (REG_PV, REG_METHODPTR, m) ; invokevirtual/interface ($25)           *
-*   M_JSR (REG_RA, REG_PV);                                                    *
-*   M_NOP                                                                      *
-*   in the static case the method pointer can be computed using the            *
-*   return address and the lda function following the jmp instruction          *
-*                                                                              *
-*******************************************************************************/
-
-
-       .ent    asm_call_jit_compiler
-asm_call_jit_compiler:
-
-       lw      t0,-12(ra)            /* load instruction LD PV,xxx($y)           */
-       srl     t0,t0,21              /* shift right register number $y           */
-       and     t0,t0,31              /* isolate register number                  */
-       addiu   t0,t0,-mptrreg        /* test for REG_METHODPTR                   */
-       beqz    t0,noregchange       
-
-       lw      t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,t0,16
-       sra     t0,t0,16              /* isolate offset                           */
-       aaddu   mptr,t0,ra            /* compute update address                   */
-
-noregchange:
-
-       aaddiu  sp,sp,-18*8           /* allocate stack space                     */
-       sd      a0,0*8(sp)            /* save all argument registers              */
-       sd      a1,1*8(sp)            /* they could be used by method             */
-       sd      a2,2*8(sp)
-       sd      a3,3*8(sp)
-       sd      a4,4*8(sp)
-       sd      a5,5*8(sp)
-       sd      a6,6*8(sp)
-       sd      a7,7*8(sp)
-       sdc1    fa0,8*8(sp)
-       sdc1    fa1,9*8(sp)
-       sdc1    fa2,10*8(sp)
-       sdc1    fa3,11*8(sp)
-       sdc1    fa4,12*8(sp)
-       sdc1    fa5,13*8(sp)
-       sdc1    fa6,14*8(sp)
-       sdc1    fa7,15*8(sp)
-       sd      mptr,16*8(sp)         /* save method pointer                      */
-       sd      ra,17*8(sp)           /* save return address                      */
-
-       ald     a0,0(itmp1)           /* pass 'methodinfo' pointer to             */
-       jal     jit_compile           /* jit compiler                             */
-
-       ld      a0,0*8(sp)            /* restore argument registers               */
-       ld      a1,1*8(sp)            /* they could be used by method             */
-       ld      a2,2*8(sp)
-       ld      a3,3*8(sp)
-       ld      a4,4*8(sp)
-       ld      a5,5*8(sp)
-       ld      a6,6*8(sp)
-       ld      a7,7*8(sp)
-       ldc1    fa0,8*8(sp)
-       ldc1    fa1,9*8(sp)
-       ldc1    fa2,10*8(sp)
-       ldc1    fa3,11*8(sp)
-       ldc1    fa4,12*8(sp)
-       ldc1    fa5,13*8(sp)
-       ldc1    fa6,14*8(sp)
-       ldc1    fa7,15*8(sp)
-       ld      mptr,16*8(sp)         /* restore method pointer                   */
-       ld      ra,17*8(sp)           /* restore return address                      */
-       aaddiu  sp,sp,18*8            /* deallocate stack area                    */
-
-       lw      t0,-12(ra)            /* load instruction LDQ PV,xxx($yy)         */
-       sll     t0,t0,16
-       sra     t0,t0,16              /* isolate offset                           */
-
-       aaddu   t0,t0,mptr            /* compute update address via method pointer*/
-       ast     v0,0(t0)              /* save new method address there            */
-
-       move    pv,v0                 /* move method address into pv              */
-
-       jr      pv                    /* and call method. The method returns      */
-                                     /* directly to the caller (ra).             */
-
-       .end    asm_call_jit_compiler
-
-
-/****************** function asm_dumpregistersandcall **************************
-*                                                                              *
-*   This funtion saves all callee saved (address) registers and calls the      *
-*   function which is passed as parameter.                                     *
-*                                                                              *
-*   This function is needed by the garbage collector, which needs to access    *
-*   all registers which are stored on the stack. Unused registers are          *
-*   cleared to avoid interferances with the GC.                                *
-*                                                                              *
-*   void asm_dumpregistersandcall (functionptr f);                             *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_dumpregistersandcall
-asm_dumpregistersandcall:
-       aaddiu  sp,sp,-10*8           /* allocate stack                           */
-       sd      ra,0(sp)              /* save return address                      */
-
-       sd      s0,1*8(sp)            /* save all callee saved registers          */
-       sd      s1,2*8(sp)
-       sd      s2,3*8(sp)
-       sd      s3,4*8(sp)
-       sd      s4,5*8(sp)
-       sd      s5,6*8(sp)
-       sd      s6,7*8(sp)
-       sd      s7,8*8(sp)
-       sd      s8,9*8(sp)
-
-       move    itmp3,a0
-       jalr    itmp3                 /* and call function                        */
-
-       ld      ra,0(sp)              /* restore return address                   */
-       aaddiu  sp,sp,10*8            /* deallocate stack                         */
-       j       ra                    /* return                                   */
-
-       .end    asm_dumpregistersandcall
-
-
-/********************* function asm_handle_exception ***************************
-*                                                                              *
-*   This function handles an exception. It does not use the usual calling      *
-*   conventions. The exception pointer is passed in REG_ITMP1 and the          *
-*   pc from the exception raising position is passed in REG_ITMP2. It searches *
-*   the local exception table for a handler. If no one is found, it unwinds    *
-*   stacks and continues searching the callers.                                *
-*                                                                              *
-*   void asm_handle_exception (exceptionptr, exceptionpc);                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_handle_nat_exception
-asm_handle_nat_exception:
-
-       lw      t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,t0,16
-       sra     t0,t0,16              /* isolate offset                           */
-       aaddu   pv,t0,ra              /* compute update address                   */
-
-       .aent    asm_handle_exception
-asm_handle_exception:
-
-       aaddiu  sp,sp,-14*8           /* allocate stack                           */
-       sd      v0,0*8(sp)            /* save possible used registers             */
-       sd      t0,1*8(sp)            /* also registers used by trace_exception   */
-       sd      t1,2*8(sp)
-       sd      t2,3*8(sp)
-       sd      t3,4*8(sp)
-       sd      t4,5*8(sp)
-       sd      a0,6*8(sp)
-       sd      a1,7*8(sp)
-       sd      a2,8*8(sp)
-       sd      a3,9*8(sp)
-       sd      a4,10*8(sp)
-       sd      a5,11*8(sp)
-       sd      a6,12*8(sp)
-       sd      a7,13*8(sp)
-
-       addu    t3,zero,1             /* set no unwind flag                       */
-ex_stack_loop:
-       aaddiu  sp,sp,-6*8            /* allocate stack                           */
-       sd      xptr,0*8(sp)          /* save used registers                      */
-       sd      xpc,1*8(sp)
-       sd      pv,2*8(sp)
-       sd      ra,3*8(sp)
-       sd      t3,4*8(sp)
-
-       move    a0,xptr
-       ald     a1,MethodPointer(pv)
-       move    a2,xpc
-       move    a3,t3
-       jal     builtin_trace_exception /* trace_exception(xptr,methodptr)        */
-       
-       ld      xptr,0*8(sp)          /* restore used register                    */
-       ld      xpc,1*8(sp)
-       ld      pv,2*8(sp)
-       ld      ra,3*8(sp)
-       ld      t3,4*8(sp)
-       aaddiu  sp,sp,6*8             /* deallocate stack                         */
-       
-       lw      t0,ExTableSize(pv)    /* t0 = exception table size                */
-       beqz    t0,empty_table        /* if empty table skip                      */
-       aaddiu  t1,pv,ExTableStart    /* t1 = start of exception table            */
-
-ex_table_loop:
-       ald     t2,ExStartPC(t1)      /* t2 = exception start pc                  */
-       slt     t2,xpc,t2             /* t2 = (xpc < startpc)                     */
-       bnez    t2,ex_table_cont      /* if (true) continue                       */
-       ald     t2,ExEndPC(t1)        /* t2 = exception end pc                    */
-       slt     t2,xpc,t2             /* t2 = (xpc < endpc)                       */
-       beqz    t2,ex_table_cont      /* if (false) continue                      */
-       ald     a1,ExCatchType(t1)    /* arg1 = exception catch type              */
-       beqz    a1,ex_handle_it       /* NULL catches everything                  */
-
-       ald     a0,offobjvftbl(xptr)  /* a0 = vftblptr(xptr)                      */
-       ald     a1,offobjvftbl(a1)    /* a1 = vftblptr(catchtype) class (not obj) */
-       lw      a0,offbaseval(a0)     /* a0 = baseval(xptr)                       */
-       lw      v0,offbaseval(a1)     /* a2 = baseval(catchtype)                  */
-       lw      a1,offdiffval(a1)     /* a1 = diffval(catchtype)                  */
-       subu    a0,a0,v0              /* a0 = baseval(xptr) - baseval(catchtype)  */
-       sltu    v0,a1,a0              /* v0 = xptr is instanceof catchtype        */
-       bnez    v0,ex_table_cont      /* if (false) continue                      */
-
-ex_handle_it:
-
-       ald     xpc,ExHandlerPC(t1)   /* xpc = exception handler pc               */
-
-       beqz    t3,ex_jump            /* if (!(no stack unwinding) skip           */
-
-       ld      v0,0*8(sp)            /* restore possible used registers          */
-       ld      t0,1*8(sp)            /* also registers used by trace_exception   */
-       ld      t1,2*8(sp)
-       ld      t2,3*8(sp)
-       ld      t3,4*8(sp)
-       ld      t4,5*8(sp)
-       ld      a0,6*8(sp)
-       ld      a1,7*8(sp)
-       ld      a2,8*8(sp)
-       ld      a3,9*8(sp)
-       ld      a4,10*8(sp)
-       ld      a5,11*8(sp)
-       ld      a6,12*8(sp)
-       ld      a7,13*8(sp)
-       
-       aaddiu  sp,sp,14*8            /* deallocate stack                         */
-
-ex_jump:
-       jr      xpc                   /* jump to the handler                      */
-
-ex_table_cont:
-       aaddiu  t1,t1,ExEntrySize     /* next exception table entry               */
-       addiu   t0,t0,-1              /* decrement entry counter                  */
-       bgtz    t0,ex_table_loop      /* if (t0 > 0) next entry                   */
-
-empty_table:
-       beqz    t3,ex_already_cleared /* if here the first time, then             */
-       aaddiu  sp,sp,14*8            /* deallocate stack and                     */
-       move    t3,zero               /* clear the no unwind flag                 */
-ex_already_cleared:
-       lw      t0,IsSync(pv)         /* t0 = SyncOffset                          */
-       beqz    t0,no_monitor_exit    /* if zero no monitorexit                   */
-       aaddu   t0,sp,t0              /* add stackptr to Offset                   */
-       ald     a0,-8(t0)             /* load monitorexit pointer                 */
-
-       aaddiu  sp,sp,-8*8            /* allocate stack                           */
-       sd      t0,0*8(sp)            /* save used register                       */
-       sd      t1,1*8(sp)
-       sd      t3,2*8(sp)
-       sd      xptr,3*8(sp)
-       sd      xpc,4*8(sp)
-       sd      pv,5*8(sp)
-       sd      ra,6*8(sp)
-
-       jal     builtin_monitorexit   /* builtin_monitorexit(objectptr)           */
-       
-       ld      t0,0*8(sp)            /* restore used register                    */
-       ld      t1,1*8(sp)
-       ld      t3,2*8(sp)
-       ld      xptr,3*8(sp)
-       ld      xpc,4*8(sp)
-       ld      pv,5*8(sp)
-       ld      ra,6*8(sp)
-       aaddiu  sp,sp,8*8             /* deallocate stack                         */
-
-no_monitor_exit:
-       lw      t0,FrameSize(pv)      /* t0 = frame size                          */
-       aaddu   sp,sp,t0              /* unwind stack                             */
-       move    t0,sp                 /* t0 = pointer to save area                */
-       lw      t1,IsLeaf(pv)         /* t1 = is leaf procedure                   */
-       bnez    t1,ex_no_restore      /* if (leaf) skip                           */
-       ld      ra,-8(t0)             /* restore ra                               */
-       aaddiu  t0,t0,-8              /* t0--                                     */
-ex_no_restore:
-       move    xpc,ra                /* the new xpc is ra                        */
-       lw      t1,IntSave(pv)        /* t1 = saved int register count            */
-       ala     t2,ex_int2            /* t2 = current pc                          */
-       sll     t1,t1,2               /* t1 = register count * 4                  */
-       asubu   t2,t2,t1              /* t2 = ex_int_sav - 4 * register count     */
-       jr      t2                    /* jump to save position                    */
-       ld      s0,-8*8(t0)
-       ld      s1,-7*8(t0)
-       ld      s2,-6*8(t0)
-       ld      s3,-5*8(t0)
-       ld      s4,-4*8(t0)
-       ld      s5,-3*8(t0)
-       ld      s6,-2*8(t0)
-       ld      s7,-1*8(t0)
-ex_int2:
-       sll     t1,t1,1               /* t1 = register count * 4 * 2              */
-       asubu   t0,t0,t1              /* t0 = t0 - 8 * register count             */
-
-       lw      t1,FltSave(pv)        /* t1 = saved flt register count            */
-       ala     t2,ex_flt2            /* t2 = current pc                          */
-       sll     t1,t1,2               /* t1 = register count * 4                  */
-       asubu   t2,t2,t1              /* t2 = ex_int_sav - 4 * register count     */
-       jr      t2                    /* jump to save position                    */
-       ldc1    fs0,-4*8(t0)
-       ldc1    fs1,-3*8(t0)
-       ldc1    fs2,-2*8(t0)
-       ldc1    fs3,-1*8(t0)
-ex_flt2:
-       lw      t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
-       sll     t0,t0,16
-       sra     t0,t0,16              /* isolate offset                           */
-       aaddu   pv,t0,ra              /* compute update address                   */
-       b       ex_stack_loop
-
-       .end    asm_handle_nat_exception
-
-
-/********************* function asm_builtin_monitorenter ***********************
-*                                                                              *
-*   Does null check and calls monitorenter or throws an exception              *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_monitorenter
-asm_builtin_monitorenter:
-
-       beqz    a0,nb_monitorenter        /* if (null) throw exception            */
-       ala     t9,builtin_monitorenter   /* else call builtin_monitorenter       */
-       j       t9
-
-nb_monitorenter:
-       ald     xptr,proto_java_lang_NullPointerException
-       aaddiu  xpc,ra,-4                 /* faulting address is return adress - 4*/
-       b       asm_handle_nat_exception
-       .end    asm_builtin_monitorenter
-
-
-/********************* function asm_builtin_monitorexit ************************
-*                                                                              *
-*   Does null check and calls monitorexit or throws an exception               *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_monitorexit
-asm_builtin_monitorexit:
-
-       beqz    a0,nb_monitorexit         /* if (null) throw exception            */
-       ala     t9,builtin_monitorexit    /* else call builtin_monitorexit        */
-       j       t9
-
-nb_monitorexit:
-       ald     xptr,proto_java_lang_NullPointerException
-       aaddiu  xpc,ra,-4                 /* faulting address is return adress - 4*/
-       b       asm_handle_nat_exception
-       .end    asm_builtin_monitorexit
-
-
-/************************ function asm_builtin_idiv ****************************
-*                                                                              *
-*   Does null check and calls idiv or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_idiv
-asm_builtin_idiv:
-
-       beqz    a1,nb_idiv                /* if (null) throw exception            */
-       ala     itmp3,builtin_idiv        /* else call builtin_idiv               */
-       j       itmp3
-
-nb_idiv:
-       ald     xptr,proto_java_lang_ArithmeticException
-       aaddiu  xpc,ra,-4                 /* faulting address is return adress - 4*/
-       b       asm_handle_nat_exception
-       .end    asm_builtin_idiv
-
-
-/************************ function asm_builtin_ldiv ****************************
-*                                                                              *
-*   Does null check and calls ldiv or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_ldiv
-asm_builtin_ldiv:
-
-       beqz    a1,nb_ldiv                /* if (null) throw exception            */
-       ala     itmp3,builtin_ldiv        /* else call builtin_ldiv               */
-       j       itmp3
-
-nb_ldiv:
-       ald     xptr,proto_java_lang_ArithmeticException
-       aaddiu  xpc,ra,-4                 /* faulting address is return adress - 4*/
-       b       asm_handle_nat_exception
-       .end    asm_builtin_ldiv
-
-
-/************************ function asm_builtin_irem ****************************
-*                                                                              *
-*   Does null check and calls irem or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_irem
-asm_builtin_irem:
-
-       beqz    a1,nb_irem                /* if (null) throw exception            */
-       ala     t9,builtin_irem           /* else call builtin_irem               */
-       j       t9
-
-nb_irem:
-       ald     xptr,proto_java_lang_ArithmeticException
-       aaddiu  xpc,ra,-4                 /* faulting address is return adress - 4*/
-       b       asm_handle_nat_exception
-       .end    asm_builtin_irem
-
-
-/************************ function asm_builtin_lrem ****************************
-*                                                                              *
-*   Does null check and calls lrem or throws an exception                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_lrem
-asm_builtin_lrem:
-
-       beqz    a1,nb_lrem                /* if (null) throw exception            */
-       ala     t9,builtin_lrem           /* else call builtin_lrem               */
-       j       t9
-
-nb_lrem:
-       ald     xptr,proto_java_lang_ArithmeticException
-       aaddiu  xpc,ra,-4                 /* faulting address is return adress - 4*/
-       b       asm_handle_nat_exception
-       .end    asm_builtin_lrem
-
-
-/******************* function asm_builtin_checkarraycast ***********************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_checkarraycast
-asm_builtin_checkarraycast:
-
-       aaddiu  sp,sp,-16                 /* allocate stack space                 */
-       sd      ra,0(sp)                  /* save return address                  */
-       sd      a0,8(sp)                  /* save object pointer                  */
-       jal     builtin_checkarraycast    /* builtin_checkarraycast               */
-       beqz    v0,nb_carray_throw        /* if (false) throw exception           */
-       ld      ra,0(sp)                  /* restore return address               */
-       ld      v0,8(sp)                  /* return object pointer                */
-       aaddiu  sp,sp,16                  /* deallocate stack                     */
-       j       ra                        /* return                               */
-
-nb_carray_throw:
-       ald     xptr,proto_java_lang_ClassCastException
-       ld      ra,0(sp)                  /* restore return address               */
-       aaddiu  sp,sp,16                  /* free stack space                     */
-       aaddiu  xpc,ra,-4                 /* faulting address is return adress - 4*/
-       b       asm_handle_nat_exception
-       .end    asm_builtin_checkarraycast
-
-
-/********************* function asm_builtin_checkcast **************************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_checkcast
-asm_builtin_checkcast:
-
-       aaddiu  sp,sp,-16                 /* allocate stack space                 */
-       sd      ra,0(sp)                  /* save return address                  */
-       sd      a0,8(sp)                  /* save object pointer                  */
-       jal     builtin_checkcast         /* builtin_checkcast                    */
-       beqz    v0,nb_ccast_throw         /* if (false) throw exception           */
-       ld      ra,0(sp)                  /* restore return address               */
-       ld      v0,8(sp)                  /* return object pointer                */
-       aaddiu  sp,sp,16                  /* deallocate stack                     */
-       j       ra                        /* return                               */
-
-nb_ccast_throw:
-       ald     xptr,proto_java_lang_ClassCastException
-       ld      ra,0(sp)                  /* restore return address               */
-       aaddiu  sp,sp,16                  /* free stack space                     */
-       aaddiu  xpc,ra,-4                 /* faulting address is return adress - 4*/
-       b       asm_handle_nat_exception
-       .end    asm_builtin_checkcast
-
-
-/******************* function asm_builtin_aastore ******************************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*   a0 = arrayref, a1 = index, a2 = value                                      *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_builtin_aastore
-asm_builtin_aastore:
-
-       beqz    a0,nb_aastore_null        /* if null pointer throw exception      */
-       lw      t0,offarraysize(a0)       /* load size                            */
-       aaddiu  sp,sp,-32                 /* allocate stack space                 */
-       sd      ra,0(sp)                  /* save return address                  */
-       asll    t1,a1,ashift              /* add index*8 to arrayref              */
-       aaddu   t1,a0,t1                  /* add index * ashift to arrayref       */
-       sltu    t0,a1,t0                  /* do bound check                       */
-       beqz    t0,nb_aastore_bound       /* if out of bounds throw exception     */
-       move    a1,a2                     /* object is second argument            */
-       sd      t1,8(sp)                  /* save store position                  */
-       sd      a1,16(sp)                 /* save object                          */
-       jal     builtin_canstore          /* builtin_canstore(arrayref,object)    */
-       ld      ra,0(sp)                  /* restore return address               */
-       ld      a0,8(sp)                  /* restore store position               */
-       ld      a1,16(sp)                 /* restore object                       */
-       aaddiu  sp,sp,32                  /* free stack space                     */
-       beqz    v0,nb_aastore_throw       /* if (false) throw exception           */
-       ast     a1,offobjarrdata(a0)      /* store objectptr in array             */
-       j       ra                        /* return                               */
-
-nb_aastore_null:
-       ald     xptr,proto_java_lang_NullPointerException
-       move    xpc,ra                    /* faulting address is return adress    */
-       b       asm_handle_nat_exception
-
-nb_aastore_bound:
-       ald     xptr,proto_java_lang_ArrayIndexOutOfBoundsException
-       aaddiu  sp,sp,32                  /* free stack space                     */
-       move    xpc,ra                    /* faulting address is return adress    */
-       b       asm_handle_nat_exception
-
-nb_aastore_throw:
-       ald     xptr,proto_java_lang_ArrayStoreException
-       move    xpc,ra                    /* faulting address is return adress    */
-       b       asm_handle_nat_exception
-
-       .end    asm_builtin_aastore
-
-
-/******************* function asm_initialize_thread_stack **********************
-*                                                                              *
-*   u1* asm_initialize_thread_stack (void *func, u1 *stack);                   *
-*                                                                              *
-*   initialize a thread stack                                                  *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_initialize_thread_stack
-asm_initialize_thread_stack:
-
-       aaddiu  a1,a1,-14*8     /* allocate save area                             */
-       sd      zero, 0*8(a1)   /* s0 initalize thread area                       */
-       sd      zero, 1*8(a1)   /* s1                                             */
-       sd      zero, 2*8(a1)   /* s2                                             */
-       sd      zero, 3*8(a1)   /* s3                                             */
-       sd      zero, 4*8(a1)   /* s4                                             */
-       sd      zero, 5*8(a1)   /* s5                                             */
-       sd      zero, 6*8(a1)   /* s6                                             */
-       sd      zero, 7*8(a1)   /* s7                                             */
-       sd      zero, 8*8(a1)   /* s8                                             */
-       sd      zero, 9*8(a1)   /* fs0                                            */
-       sd      zero,10*8(a1)   /* fs1                                            */
-       sd      zero,11*8(a1)   /* fs2                                            */
-       sd      zero,12*8(a1)   /* fs3                                            */
-       sd      a0, 13*8(a1)
-       move    v0,a1
-       j       ra              /* return                                         */
-       .end    asm_initialize_thread_stack
-
-
-/******************* function asm_perform_threadswitch *************************
-*                                                                              *
-*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
-*                                                                              *
-*   performs a threadswitch                                                    *
-*                                                                              *
-*******************************************************************************/
-
-       .ent    asm_perform_threadswitch
-asm_perform_threadswitch:
-
-       aaddiu  sp,sp,-14*8     /* allocate new stack                             */
-       sd      s0,  0*8(sp)    /* save saved registers of old thread             */
-       sd      s1,  1*8(sp)
-       sd      s2,  2*8(sp)
-       sd      s3,  3*8(sp)
-       sd      s4,  4*8(sp)
-       sd      s5,  5*8(sp)
-       sd      s6,  6*8(sp)
-       sd      s7,  7*8(sp)
-       sd      s8,  8*8(sp)
-       sdc1    fs0, 9*8(sp)
-       sdc1    fs1,10*8(sp)
-       sdc1    fs2,11*8(sp)
-       sdc1    fs3,12*8(sp)
-       sd      ra, 13*8(sp)
-       ast     sp,0(a0)        /* save old stack pointer                         */
-       ast     sp,0(a2)        /* stackTop = old stack pointer                   */
-       ald     sp,0(a1)        /* load new stack pointer                         */
-       ld      s0,  0*8(sp)    /* load saved registers of new thread             */
-       ld      s1,  1*8(sp)
-       ld      s2,  2*8(sp)
-       ld      s3,  3*8(sp)
-       ld      s4,  4*8(sp)
-       ld      s5,  5*8(sp)
-       ld      s6,  6*8(sp)
-       ld      s7,  7*8(sp)
-       ld      s8,  8*8(sp)
-       ldc1    fs0, 9*8(sp)
-       ldc1    fs1,10*8(sp)
-       ldc1    fs2,11*8(sp)
-       ldc1    fs3,12*8(sp)
-       ld      ra, 13*8(sp)
-       aaddiu  sp,sp,14*8      /* deallocate new stack                           */
-       move    itmp3, ra
-       j       ra              /* return                                         */
-       .end    asm_perform_threadswitch
-
-
-/********************* function asm_switchstackandcall *************************
-*                                                                              *
-*  void asm_switchstackandcall (void *stack, void *func, void **stacktopsave); *
-*                                                                              *
-*   Switches to a new stack, calls a function and switches back.               *
-*       a0      new stack pointer                                              *
-*       a1      function pointer                                               *
-*              a2              pointer to variable where stack top should be stored           *
-*                                                                              *
-*******************************************************************************/
-
-
-       .ent    asm_switchstackandcall
-asm_switchstackandcall:
-       aaddiu  a0,a0,-16       /* allocate new stack                             */
-       sd      ra,0(a0)        /* save return address on new stack               */
-       sd      sp,8(a0)        /* save old stack pointer on new stack            */
-       sd      sp,0(a2)        /* save old stack pointer to variable             */
-       move    sp,a0           /* switch to new stack                            */
-       
-       move    itmp3,a1
-       move    a0,a3
-       jalr    itmp3           /* and call function                              */
-
-       ld      ra,0(sp)        /* load return address                            */
-       ld      sp,8(sp)        /* switch to old stack                            */
-
-       j       ra              /* return                                         */
-
-       .end    asm_switchstackandcall
-
-       .ent    asm_getcallingmethod
-asm_getcallingmethod:
-       li      v0,0
-       j       ra
-       .end    asm_getcallingmethod
diff --git a/mips/calling.doc b/mips/calling.doc
deleted file mode 100644 (file)
index f3840ff..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/* calling.doc *****************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       A short description of MIPS calling conventions and register usage.
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/05
-
-*******************************************************************************/
-
-Short documentation of the Java calling conventions for the MIPS.
-
---------------------------------------------------------------------------------
-
-
-Die Aufrufskonventionen halten sich weitgehende an die Konventionen
-f"ur normale C-Funktionen, allerdings mit einigen zus"atzlichen
-Registerbelegungen:
-
-R28 ..... enth"alt bei einem Methodenaufruf auf jeden Fall den Zeiger 
-          auf die zugeh"orige 'methodinfo'-Struktur, die gegebenenfalls an
-          den JIT-Compiler weitergegeben werden muss. 
-
-          Wenn von Java-Methoden aus direkt C-Funktionen aufgerufen werden,
-          (f"ur die nat"urlich auch keine 'methodinfo'-Struktur existiert),
-          dann hat dieses Register keinen definierten Wert (Alle von der
-          JavaVM verwendeten Funktionen, z. B. 'builtin_new', etc. werden
-          so aufgerufen)
-
-Die restlichen Register folgen den normalen Konventionen, aber ich gebe
-hier noch einmal eine kurze "Ubersicht:
-
-integer registers:
-
-R0 ........ always contains zero
-
-R1 ........ code generator temporary register (destroyed by called method)
-
-R2 ........ method result value for types INT, LONG and ADDRESS
-
-R3 ........ code generator temporary register (destroyed by called method)
-
-R4 -R11 ... argument registers 0 - 7 (contain the first six method arguments
-            of type INT, LONG and ADDRESS. Argument registers are destroyed
-            by called method)
-
-R12-R15 ... temporary registers (destroyed by called method)
-
-R16-R23 ... saved registers (left unchanged by called method)
-
-R24 ....... temporary register (destroyed by called method)
-
-R25 ....... pointer to 'methodinfo' structure. This register has to be set
-            correctly, because it is needed in the case the jit is invoked.
-            Also used as code generator temporary register. It is destroyed
-            by called method)
-
-R26-R27 ... reserved register (reserved for kernel)
-
-R28 (gp) .. global pointer (left unchanged by called method). Used for the
-            addressing of global variables in C functions.
-
-R29 (sp) .. stack pointer. The stack grows from high to low.
-
-R28 (pv) .. procedure vector, points to the first instruction of the called
-            method. This vector is used for addressing the entries in the
-            data segment. The pv of the caller is recomputed from the ra in
-            Java methods. R30 is callee saved in the MIPS ABI. So pv is not
-            recomputed if builtin functions are called. For Java methods it
-            is necessary that a return is always done using ra.
-
-R31 (ra) .. return address (left unchanged by called method)
-
-
-floating point registers:
-
-F0 ........ method result value for types FLOAT and DOUBLE
-
-F1-F3 ..... code generator temporary register (destroyed by called method)
-
-F4 -F11 ... temporary register (destroyed by called method)
-                                
-F12-F19 ... argument registers 0 - 7 (contain the first 8 method arguments
-            of type FLOAT and DOUBLE. Argument registers are destroyed
-            by called method)
-
-F20-F23 ... temporary registers (destroyed by called method)
-
-F24 ....... saved register (left unchanged by called method)
-
-F25 ....... temporary register (destroyed by called method)
-
-F26 ....... saved register (left unchanged by called method)
-
-F27 ....... temporary register (destroyed by called method)
-
-F28 ....... saved register (left unchanged by called method)
-
-F29 ....... temporary register (destroyed by called method)
-
-F30 ....... saved register (left unchanged by called method)
-
-F31 ....... temporary register (destroyed by called method)
-
-
-PARAMETER"UBERGABE AM STACK:
-
-Bei mehr als sechs Parametern reicht der Platz in den Registern nicht mehr
-aus, daf"ur werden alle Parameter ab dem Siebenten am Stack "ubergeben,
-und zwar nach folgendem Muster:
-
-
-                  | .....                                          |
-                                 --------------------------------------------------
-                  |  Parameter 9  ( 64 bit, egal bei welchem Typ)  |
-                  --------------------------------------------------
-                                 |  Parameter 8  ( 64 bit, egal bei welchem Typ   |
-                  --------------------------------------------------
-   R30 (sp) --->  |  Parameter 7  ( 64 bit, egal bei welchem Typ)  |
-                  --------------------------------------------------
-  
-Der Stackpointer zeigt dabei auf die Untergrenze des Parameterbereichs.
-
-
-
-
-
-VOLLST"ANDIGES LAYOUT EINES STACKFRAMES:
-
-Jede Methode muss (wenn es keine Leaf-Methode ist, auf jeden Fall) gewisse
-Registerinhalte am Stack sichern.
-Eventuell werden auch noch lokale Werte, die nicht mehr in Registern
-Platz finden, ebenfalls am Stack aufbewahrt, und die Parameter"ubergabe
-bei mehr als 6 Parametern ben"otigt ebenfalls Platz am Stack.
-
-Ein vollst"andiger Stackframe hat also dieses Aussehen (jeder Eintrag
-im Stackframe ist unabh"angig vom Typ auf jedem Fall 64 bit lang, die
-Gr"ossenangaben der Bereiche sind in solchen Einheiten von 64 Bit 
-angegeben):
-       
-            ---------------------------------------------
-            |  parameter n (passed from caller)         |
-            ---------------------------------------------      
-            |  parameter n-1                            |
-            ---------------------------------------------
-            | ...                                       |
-            ---------------------------------------------
-            |  parameter 7                              |
-old SP ---> ============================================= --- parentargs_base
-            |  saved RA                                 |
-            ---------------------------------------------     savedregs_num
-            |  others saved registers                   |
-            ============================================= --- maxmemuse + 1
-            |  optional monitor_exit argument           |
-            ============================================= --- maxmemuse
-            |  area for spilled registers               |
-            =============================================
-            |  ....                                     |
-            ---------------------------------------------
-            |  parameter 8                              |
-            ---------------------------------------------
-            |  parameter 7 (passed to called method)    |
-new SP ---> =============================================
diff --git a/mips/defines.h b/mips/defines.h
deleted file mode 100644 (file)
index dc60708..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* alpha/defines.h *************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       system-dependent definitions
-
-       Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/09/11
-
-*******************************************************************************/
-
-#define USE_INTERNAL_THREADS
-
-#define HAVE_FCNTL
-#define HAVE_IOCTL
diff --git a/mips/disass.c b/mips/disass.c
deleted file mode 100644 (file)
index 1f1c9e3..0000000
+++ /dev/null
@@ -1,624 +0,0 @@
-/* disass.c ********************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       A very primitive disassembler for MIPS machine code for easy debugging.
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/12
-
-*******************************************************************************/
-
-/*  The disassembler uses four tables for decoding the instructions. The first
-       table (ops) is used to classify the instructions based on the op code and
-       contains the instruction names for instructions which don't used the
-       function codes. This table is indexed by the op code (6 bit, 64 entries).
-       The other tables are either indexed by the function code or some special
-       format and branch codes.
-*/
-
-#define ITYPE_UNDEF  0          /* undefined instructions (illegal opcode)    */
-#define ITYPE_JMP    1          /* jump instructions                          */
-#define ITYPE_IMM    2          /* immediate instructions                     */
-#define ITYPE_MEM    3          /* memory instructions                        */
-#define ITYPE_FMEM   4          /* floating point memory instructions         */
-#define ITYPE_BRA    5          /* branch instructions                        */
-#define ITYPE_RIMM   6          /* special/branch instructions                */
-#define ITYPE_OP     7          /* integer instructions                       */
-#define ITYPE_TRAP   8          /* trap instructions                          */
-#define ITYPE_DIVMUL 9          /* integer divide/multiply instructions       */
-#define ITYPE_MTOJR 10          /* move to and jump register instructions     */
-#define ITYPE_MFROM 11          /* move from instructions                     */
-#define ITYPE_SYS   12          /* operating system instructions              */
-#define ITYPE_FOP   13          /* floating point instructions                */
-#define ITYPE_FOP2  14          /* 2 operand floating point instructions      */
-#define ITYPE_FCMP  15          /* floating point compare instructions        */
-
-
-/* instruction decode table for 6 bit op codes                                */
-
-static struct {char *name; int itype;} ops[] = {
-
-       /* 0x00 */  {"special ",    ITYPE_OP},
-       /* 0x01 */  {"regimm  ",  ITYPE_RIMM},
-       /* 0x02 */  {"j       ",   ITYPE_JMP},
-       /* 0x03 */  {"jal     ",   ITYPE_JMP},
-       /* 0x04 */  {"beq     ",   ITYPE_BRA},
-       /* 0x05 */  {"bne     ",   ITYPE_BRA},
-       /* 0x06 */  {"blez    ",   ITYPE_BRA},
-       /* 0x07 */  {"bgtz    ",   ITYPE_BRA},
-
-       /* 0x08 */  {"addi    ",   ITYPE_IMM},
-       /* 0x09 */  {"addiu   ",   ITYPE_IMM},
-       /* 0x0a */  {"slti    ",   ITYPE_IMM},
-       /* 0x0b */  {"sltiu   ",   ITYPE_IMM},
-       /* 0x0c */  {"andi    ",   ITYPE_IMM},
-       /* 0x0d */  {"ori     ",   ITYPE_IMM},
-       /* 0x0e */  {"xori    ",   ITYPE_IMM},
-       /* 0x0f */  {"lui     ",   ITYPE_IMM},
-
-       /* 0x10 */  {"cop0    ",    ITYPE_OP},
-       /* 0x11 */  {"cop1    ",   ITYPE_FOP},
-       /* 0x12 */  {"cop2    ",    ITYPE_OP},
-       /* 0x13 */  {"",         ITYPE_UNDEF},
-       /* 0x14 */  {"beql    ",   ITYPE_BRA},
-       /* 0x15 */  {"bnel    ",   ITYPE_BRA},
-       /* 0x16 */  {"blezl   ",   ITYPE_BRA},
-       /* 0x17 */  {"bgtzl   ",   ITYPE_BRA},
-
-       /* 0x18 */  {"daddi   ",   ITYPE_IMM},
-       /* 0x19 */  {"daddiu  ",   ITYPE_IMM},
-       /* 0x1a */  {"ldl     ",   ITYPE_MEM},
-       /* 0x1b */  {"ldr     ",   ITYPE_MEM},
-       /* 0x1c */  {"",         ITYPE_UNDEF},
-       /* 0x1d */  {"",         ITYPE_UNDEF},
-       /* 0x1e */  {"",         ITYPE_UNDEF},
-       /* 0x1f */  {"",         ITYPE_UNDEF},
-
-       /* 0x20 */  {"lb      ",   ITYPE_MEM},
-       /* 0x21 */  {"lh      ",   ITYPE_MEM},
-       /* 0x22 */  {"lwl     ",   ITYPE_MEM},
-       /* 0x23 */  {"lw      ",   ITYPE_MEM},
-       /* 0x24 */  {"lbu     ",   ITYPE_MEM},
-       /* 0x25 */  {"lhu     ",   ITYPE_MEM},
-       /* 0x26 */  {"lwr     ",   ITYPE_MEM},
-       /* 0x27 */  {"lwu     ",   ITYPE_MEM},
-
-       /* 0x28 */  {"sb      ",   ITYPE_MEM},
-       /* 0x29 */  {"sh      ",   ITYPE_MEM},
-       /* 0x2a */  {"swl     ",   ITYPE_MEM},
-       /* 0x2b */  {"sw      ",   ITYPE_MEM},
-       /* 0x2c */  {"sdl     ",   ITYPE_MEM},
-       /* 0x2d */  {"sdr     ",   ITYPE_MEM},
-       /* 0x2e */  {"swr     ",   ITYPE_MEM},
-       /* 0x2f */  {"cache   ",   ITYPE_MEM},
-
-       /* 0x30 */  {"ll      ",   ITYPE_MEM},
-       /* 0x31 */  {"lwc1    ",  ITYPE_FMEM},
-       /* 0x32 */  {"lwc2    ",   ITYPE_MEM},
-       /* 0x33 */  {"",         ITYPE_UNDEF},
-       /* 0x34 */  {"lld     ",   ITYPE_MEM},
-       /* 0x35 */  {"ldc1    ",  ITYPE_FMEM},
-       /* 0x36 */  {"ldc2    ",   ITYPE_MEM},
-       /* 0x37 */  {"ld      ",   ITYPE_MEM},
-
-       /* 0x38 */  {"sc      ",   ITYPE_MEM},
-       /* 0x39 */  {"swc1    ",  ITYPE_FMEM},
-       /* 0x3a */  {"swc2    ",   ITYPE_MEM},
-       /* 0x3b */  {"",         ITYPE_UNDEF},
-       /* 0x3c */  {"sld     ",   ITYPE_MEM},
-       /* 0x3d */  {"sdc1    ",  ITYPE_FMEM},
-       /* 0x3e */  {"sdc2    ",   ITYPE_MEM},
-       /* 0x3f */  {"sd      ",   ITYPE_MEM}
-};
-
-
-/* instruction decode table for 6 bit special function codes                  */
-
-static struct {char *name; int ftype;} regops[] = {
-
-       /* 0x00 */  {"sll     ",   ITYPE_IMM},
-       /* 0x01 */  {""        , ITYPE_UNDEF},
-       /* 0x02 */  {"srl     ",   ITYPE_IMM},
-       /* 0x03 */  {"sra     ",   ITYPE_IMM},
-       /* 0x04 */  {"sllv    ",    ITYPE_OP},
-       /* 0x05 */  {""        , ITYPE_UNDEF},
-       /* 0x06 */  {"srlv    ",    ITYPE_OP},
-       /* 0x07 */  {"srav    ",    ITYPE_OP},
-
-       /* 0x08 */  {"jr      ", ITYPE_MTOJR},
-       /* 0x09 */  {"jalr    ",   ITYPE_JMP},
-       /* 0x0a */  {""        , ITYPE_UNDEF},
-       /* 0x0b */  {""        , ITYPE_UNDEF},
-       /* 0x0c */  {"syscall ",   ITYPE_SYS},
-       /* 0x0d */  {"break   ",   ITYPE_SYS},
-       /* 0x0e */  {""        , ITYPE_UNDEF},
-       /* 0x0f */  {"sync    ",   ITYPE_SYS},
-
-       /* 0x10 */  {"mfhi    ", ITYPE_MFROM},
-       /* 0x11 */  {"mthi    ", ITYPE_MTOJR},
-       /* 0x12 */  {"mflo    ", ITYPE_MFROM},
-       /* 0x13 */  {"mtlo    ", ITYPE_MTOJR},
-       /* 0x14 */  {"dsllv   ",    ITYPE_OP},
-       /* 0x15 */  {""        , ITYPE_UNDEF},
-       /* 0x16 */  {"dslrv   ",    ITYPE_OP},
-       /* 0x17 */  {"dsrav   ",    ITYPE_OP},
-
-       /* 0x18 */  {"mult    ",ITYPE_DIVMUL},
-       /* 0x19 */  {"multu   ",ITYPE_DIVMUL},
-       /* 0x1a */  {"div     ",ITYPE_DIVMUL},
-       /* 0x1b */  {"divu    ",ITYPE_DIVMUL},
-       /* 0x1c */  {"dmult   ",ITYPE_DIVMUL},
-       /* 0x1d */  {"dmultu  ",ITYPE_DIVMUL},
-       /* 0x1e */  {"ddiv    ",ITYPE_DIVMUL},
-       /* 0x1f */  {"ddivu   ",ITYPE_DIVMUL},
-
-       /* 0x20 */  {"add     ",    ITYPE_OP},
-       /* 0x21 */  {"addu    ",    ITYPE_OP},
-       /* 0x22 */  {"sub     ",    ITYPE_OP},
-       /* 0x23 */  {"subu    ",    ITYPE_OP},
-       /* 0x24 */  {"and     ",    ITYPE_OP},
-       /* 0x25 */  {"or      ",    ITYPE_OP},
-       /* 0x26 */  {"xor     ",    ITYPE_OP},
-       /* 0x27 */  {"nor     ",    ITYPE_OP},
-
-       /* 0x28 */  {""        , ITYPE_UNDEF},
-       /* 0x29 */  {""        , ITYPE_UNDEF},
-       /* 0x2a */  {"slt     ",    ITYPE_OP},
-       /* 0x2b */  {"sltu    ",    ITYPE_OP},
-       /* 0x2c */  {"dadd    ",    ITYPE_OP},
-       /* 0x2d */  {"daddu   ",    ITYPE_OP},
-       /* 0x2e */  {"dsub    ",    ITYPE_OP},
-       /* 0x2f */  {"dsubu   ",    ITYPE_OP},
-
-       /* 0x30 */  {"tge     ",  ITYPE_TRAP},
-       /* 0x31 */  {"tgeu    ",  ITYPE_TRAP},
-       /* 0x32 */  {"tlt     ",  ITYPE_TRAP},
-       /* 0x33 */  {"tltu    ",  ITYPE_TRAP},
-       /* 0x34 */  {"teq     ",  ITYPE_TRAP},
-       /* 0x35 */  {""        , ITYPE_UNDEF},
-       /* 0x36 */  {"tne     ",  ITYPE_TRAP},
-       /* 0x37 */  {""        , ITYPE_UNDEF},
-
-       /* 0x38 */  {"dsll    ",   ITYPE_IMM},
-       /* 0x39 */  {""        , ITYPE_UNDEF},
-       /* 0x3a */  {"dsrl    ",   ITYPE_IMM},
-       /* 0x3b */  {"dsra    ",   ITYPE_IMM},
-       /* 0x3c */  {"dsll32  ",   ITYPE_IMM},
-       /* 0x3d */  {""        , ITYPE_UNDEF},
-       /* 0x3e */  {"dsrl32  ",   ITYPE_IMM},
-       /* 0x3f */  {"dsra32  ",   ITYPE_IMM}
-};
-
-
-/* instruction decode table for 5 bit reg immediate function codes            */
-
-static struct {char *name; int ftype;} regimms[] = {
-
-       /* 0x00 */  {"bltz    ",   ITYPE_BRA},
-       /* 0x01 */  {"bgez    ",   ITYPE_BRA},
-       /* 0x02 */  {"bltzl   ",   ITYPE_BRA},
-       /* 0x03 */  {"bgezl   ",   ITYPE_BRA},
-       /* 0x04 */  {"",         ITYPE_UNDEF},
-       /* 0x05 */  {"",         ITYPE_UNDEF},
-       /* 0x06 */  {"",         ITYPE_UNDEF},
-       /* 0x07 */  {"",         ITYPE_UNDEF},
-
-       /* 0x08 */  {"tgei    ",   ITYPE_IMM},
-       /* 0x09 */  {"dgeiu   ",   ITYPE_IMM},
-       /* 0x0a */  {"tlti    ",   ITYPE_IMM},
-       /* 0x0b */  {"tltiu   ",   ITYPE_IMM},
-       /* 0x0c */  {"teqi    ",   ITYPE_IMM},
-       /* 0x0d */  {"",         ITYPE_UNDEF},
-       /* 0x0e */  {"tnei    ",   ITYPE_IMM},
-       /* 0x0f */  {"",         ITYPE_UNDEF},
-
-       /* 0x10 */  {"bltzal  ",   ITYPE_BRA},
-       /* 0x11 */  {"bgezal  ",   ITYPE_BRA},
-       /* 0x12 */  {"bltzall ",   ITYPE_BRA},
-       /* 0x13 */  {"bgezall ",   ITYPE_BRA},
-       /* 0x14 */  {"",         ITYPE_UNDEF},
-       /* 0x15 */  {"",         ITYPE_UNDEF},
-       /* 0x16 */  {"",         ITYPE_UNDEF},
-       /* 0x17 */  {"",         ITYPE_UNDEF},
-
-       /* 0x18 */  {"",         ITYPE_UNDEF},
-       /* 0x19 */  {"",         ITYPE_UNDEF},
-       /* 0x1a */  {"",         ITYPE_UNDEF},
-       /* 0x1b */  {"",         ITYPE_UNDEF},
-       /* 0x1c */  {"",         ITYPE_UNDEF},
-       /* 0x1d */  {"",         ITYPE_UNDEF},
-       /* 0x1e */  {"",         ITYPE_UNDEF},
-       /* 0x1f */  {"",         ITYPE_UNDEF}
-};
-
-
-/* instruction decode table for 6 bit floating point op codes                 */
-
-static struct {char *name; char *fill; int ftype;} fops[] = {
-
-       /* 0x00 */  {"add", "   ",   ITYPE_FOP},
-       /* 0x01 */  {"sub", "   ",   ITYPE_FOP},
-       /* 0x02 */  {"mul", "   ",   ITYPE_FOP},
-       /* 0x03 */  {"div", "   ",   ITYPE_FOP},
-       /* 0x04 */  {"sqrt", "  ",   ITYPE_FOP},
-       /* 0x05 */  {"abs", "   ",  ITYPE_FOP2},
-       /* 0x06 */  {"mov", "   ",  ITYPE_FOP2},
-       /* 0x07 */  {"neg", "   ",  ITYPE_FOP2},
-
-       /* 0x08 */  {"roundl", "",  ITYPE_FOP2},
-       /* 0x09 */  {"truncl", "",  ITYPE_FOP2},
-       /* 0x0a */  {"ceill", " ",  ITYPE_FOP2},
-       /* 0x0b */  {"floorl", "",  ITYPE_FOP2},
-       /* 0x0c */  {"round", " ",  ITYPE_FOP2},
-       /* 0x0d */  {"trunc", " ",  ITYPE_FOP2},
-       /* 0x0e */  {"ceil", "  ",  ITYPE_FOP2},
-       /* 0x0f */  {"floor", " ",  ITYPE_FOP2},
-
-       /* 0x10 */  {"",       "", ITYPE_UNDEF},
-       /* 0x11 */  {"",       "", ITYPE_UNDEF},
-       /* 0x12 */  {"",       "", ITYPE_UNDEF},
-       /* 0x13 */  {"",       "", ITYPE_UNDEF},
-       /* 0x14 */  {"",       "", ITYPE_UNDEF},
-       /* 0x15 */  {"",       "", ITYPE_UNDEF},
-       /* 0x16 */  {"",       "", ITYPE_UNDEF},
-       /* 0x17 */  {"",       "", ITYPE_UNDEF},
-
-       /* 0x18 */  {"",       "", ITYPE_UNDEF},
-       /* 0x19 */  {"recip", " ",  ITYPE_FOP2},
-       /* 0x1a */  {"rsqrt", " ",  ITYPE_FOP2},
-       /* 0x1b */  {"",       "", ITYPE_UNDEF},
-       /* 0x1c */  {"",       "", ITYPE_UNDEF},
-       /* 0x1d */  {"",       "", ITYPE_UNDEF},
-       /* 0x1e */  {"",       "", ITYPE_UNDEF},
-       /* 0x1f */  {"",       "", ITYPE_UNDEF},
-
-       /* 0x20 */  {"cvts", "  ",  ITYPE_FOP2},
-       /* 0x21 */  {"cvtd", "  ",  ITYPE_FOP2},
-       /* 0x22 */  {"cvtx", "  ",  ITYPE_FOP2},
-       /* 0x23 */  {"cvtq", "  ",  ITYPE_FOP2},
-       /* 0x24 */  {"cvtw", "  ",  ITYPE_FOP2},
-       /* 0x25 */  {"cvtl", "  ",  ITYPE_FOP2},
-       /* 0x26 */  {"",       "", ITYPE_UNDEF},
-       /* 0x27 */  {"",       "", ITYPE_UNDEF},
-
-       /* 0x28 */  {"",       "", ITYPE_UNDEF},
-       /* 0x29 */  {"",       "", ITYPE_UNDEF},
-       /* 0x2a */  {"",       "", ITYPE_UNDEF},
-       /* 0x2b */  {"",       "", ITYPE_UNDEF},
-       /* 0x2c */  {"",       "", ITYPE_UNDEF},
-       /* 0x2d */  {"",       "", ITYPE_UNDEF},
-       /* 0x2e */  {"",       "", ITYPE_UNDEF},
-       /* 0x2f */  {"",       "", ITYPE_UNDEF},
-
-       /* 0x30 */  {"c.f", "   ",  ITYPE_FCMP},
-       /* 0x31 */  {"c.un", "  ",  ITYPE_FCMP},
-       /* 0x32 */  {"c.eq", "  ",  ITYPE_FCMP},
-       /* 0x33 */  {"c.ueq", " ",  ITYPE_FCMP},
-       /* 0x34 */  {"c.olt", " ",  ITYPE_FCMP},
-       /* 0x35 */  {"c.ult", " ",  ITYPE_FCMP},
-       /* 0x36 */  {"c.ole", " ",  ITYPE_FCMP},
-       /* 0x37 */  {"c.ule", " ",  ITYPE_FCMP},
-
-       /* 0x38 */  {"c.sf", "  ",  ITYPE_FCMP},
-       /* 0x39 */  {"c.ngle", "",  ITYPE_FCMP},
-       /* 0x3a */  {"c.seq", " ",  ITYPE_FCMP},
-       /* 0x3b */  {"c.ngl", " ",  ITYPE_FCMP},
-       /* 0x3c */  {"c.lt", "  ",  ITYPE_FCMP},
-       /* 0x3d */  {"c.nge", " ",  ITYPE_FCMP},
-       /* 0x3e */  {"c.le", "  ",  ITYPE_FCMP},
-       /* 0x3f */  {"c.ngt", " ",  ITYPE_FCMP}
-};
-
-
-/* format decode table for 3 bit floating point format codes                  */
-
-static char *fmt[] = {
-       /* 0x00 */  ".s",
-       /* 0x01 */  ".d",
-       /* 0x02 */  ".x",
-       /* 0x03 */  ".q",
-       /* 0x04 */  ".w",
-       /* 0x05 */  ".l",
-       /* 0x06 */  ".?",
-       /* 0x07 */  ".?"
-};
-
-
-/* format decode table for 2 bit floating point branch codes                  */
-
-static char *fbra[] = {
-       /* 0x00 */  "bc1f    ",
-       /* 0x01 */  "bc1t    ",
-       /* 0x02 */  "bc1fl   ",
-       /* 0x03 */  "bc1tl   "
-};
-
-
-/* instruction decode table for 32 integer registers                          */
-
-static char *regs[] = {
-
-       /* 0x00 */  "zero", /*  "$0", */
-       /* 0x01 */  "at",   /*  "$1", */
-       /* 0x02 */  "v0",   /*  "$2", */
-       /* 0x03 */  "v1",   /*  "$3", */
-       /* 0x04 */  "a0",   /*  "$4", */
-       /* 0x05 */  "a1",   /*  "$5", */
-       /* 0x06 */  "a2",   /*  "$6", */
-       /* 0x07 */  "a3",   /*  "$7", */
-
-       /* 0x08 */  "a4",   /*  "$8", */
-       /* 0x09 */  "a5",   /*  "$9", */
-       /* 0x0a */  "a6",   /* "$10", */
-       /* 0x0b */  "a7",   /* "$11", */
-       /* 0x0c */  "t4",   /* "$12", */
-       /* 0x0d */  "t5",   /* "$13", */
-       /* 0x0e */  "t6",   /* "$14", */
-       /* 0x0f */  "t7",   /* "$15", */
-
-       /* 0x10 */  "s0",   /* "$16", */
-       /* 0x11 */  "s1",   /* "$17", */
-       /* 0x12 */  "s2",   /* "$18", */
-       /* 0x13 */  "s3",   /* "$19", */
-       /* 0x14 */  "s4",   /* "$20", */
-       /* 0x15 */  "s5",   /* "$21", */
-       /* 0x16 */  "s6",   /* "$22", */
-       /* 0x17 */  "s7",   /* "$23", */
-
-       /* 0x18 */  "t8",   /* "$24", */
-       /* 0x19 */  "t9",   /* "$25", */
-       /* 0x1a */  "k0",   /* "$26", */
-       /* 0x1b */  "k1",   /* "$27", */
-       /* 0x1c */  "gp",   /* "$28", */
-       /* 0x1d */  "sp",   /* "$29", */
-       /* 0x1e */  "s8",   /* "$30", */
-       /* 0x1f */  "ra"    /* "$31"  */
-};
-
-
-/* instruction decode table for 32 floating point registers                   */
-
-#if 0
-static char *fregs[] = {
-
-       /* 0x00 */  "fv0",   /*  "$f0", */
-       /* 0x01 */  "ft16",  /*  "$f1", */
-       /* 0x02 */  "fv1",   /*  "$f2", */
-       /* 0x03 */  "ft17",  /*  "$f3", */
-       /* 0x04 */  "ft0",   /*  "$f4", */
-       /* 0x05 */  "ft1",   /*  "$f5", */
-       /* 0x06 */  "ft2",   /*  "$f6", */
-       /* 0x07 */  "ft3",   /*  "$f7", */
-
-       /* 0x08 */  "ft4",   /*  "$f8", */
-       /* 0x09 */  "ft5",   /*  "$f9", */
-       /* 0x0a */  "ft6",   /* "$f10", */
-       /* 0x0b */  "ft7",   /* "$f11", */
-       /* 0x0c */  "fa0",   /* "$f12", */
-       /* 0x0d */  "fa1",   /* "$f13", */
-       /* 0x0e */  "fa2",   /* "$f14", */
-       /* 0x0f */  "fa3",   /* "$f15", */
-
-       /* 0x10 */  "fa4",   /* "$f16", */
-       /* 0x11 */  "fa5",   /* "$f17", */
-       /* 0x12 */  "fa6",   /* "$f18", */
-       /* 0x13 */  "fa7",   /* "$f19", */
-       /* 0x14 */  "ft8",   /* "$f20", */
-       /* 0x15 */  "ft9",   /* "$f21", */
-       /* 0x16 */  "ft10",  /* "$f22", */
-       /* 0x17 */  "ft11",  /* "$f23", */
-
-       /* 0x18 */  "fs0",   /* "$f24", */
-       /* 0x19 */  "ft12",  /* "$f25", */
-       /* 0x1a */  "fs1",   /* "$f26", */
-       /* 0x1b */  "ft13",  /* "$f27", */
-       /* 0x1c */  "fs2",   /* "$f28", */
-       /* 0x1d */  "ft14",  /* "$f29", */
-       /* 0x1e */  "fs3",   /* "$f30", */
-       /* 0x1f */  "ft15"   /* "$f31"  */
-};
-#endif
-
-
-/* function disassinstr ********************************************************
-
-       outputs a disassembler listing of one machine code instruction on 'stdout'
-       c:   instructions machine code
-       pos: instructions address relative to method start
-
-*******************************************************************************/
-
-static void disassinstr(int c, int pos)
-{
-       int op;                     /* 6 bit op code                              */
-       int opfun;                  /* 6 bit function code                        */
-       int rs, rt, rd;             /* 5 bit integer register specifiers          */
-       int fs, ft, fd;             /* 5 bit floating point register specifiers   */
-       int shift;                  /* 5 bit unsigned shift amount                */
-
-       op    = (c >> 26) & 0x3f;   /* 6 bit op code                              */
-       opfun = (c >>  0) & 0x3f;   /* 6 bit function code                        */
-       rs    = (c >> 21) & 0x1f;   /* 5 bit source register specifier            */
-       rt    = (c >> 16) & 0x1f;   /* 5 bit source/destination register specifier*/
-       rd    = (c >> 11) & 0x1f;   /* 5 bit destination register specifier       */
-       shift = (c >>  6) & 0x1f;   /* 5 bit unsigned shift amount                */
-
-       printf ("%6x: 0x%08x  ", pos, c);
-       
-       switch (ops[op].itype) {
-               case ITYPE_JMP:                      /* 26 bit unsigned jump offset   */
-                       printf ("%s %#09x\n", ops[op].name, (c & 0x3ffffff) << 2); 
-                       break;
-
-               case ITYPE_IMM:                      /* 16 bit signed immediate value */
-                       printf ("%s %s,%s,%d\n", ops[op].name, regs[rt],
-                                                regs[rs], (c << 16) >> 16); 
-                       break;
-
-               case ITYPE_MEM:                      /* 16 bit signed memory offset   */
-                       printf ("%s %s,%d(%s)\n", ops[op].name, regs[rt],
-                                                 (c << 16) >> 16, regs[rs]); 
-                       break;
-
-               case ITYPE_FMEM:                     /* 16 bit signed memory offset   */
-                       printf ("%s $f%d,%d(%s)\n", ops[op].name, rt,
-                                                   (c << 16) >> 16, regs[rs]); 
-                       break;
-
-               case ITYPE_BRA:                      /* 16 bit signed branch offset   */
-                       if (op == 0x04 && rs == 0 && rt == 0) {
-                               printf("b        0x%x\n", pos + 4 + ((c << 16) >> 14)); 
-                               break;
-                               }       
-                       printf("%s %s,%s,0x%x\n", ops[op].name, regs[rs], regs[rt], 
-                                                 pos + 4 + ((c << 16) >> 14));
-                       break;
-                       
-               case ITYPE_RIMM:
-                       if (regimms[rt].ftype == ITYPE_IMM)
-                               printf("%s %s,%d\n", regimms[rt].name, regs[rs],
-                                      (c << 16) >> 16);
-                       else if (regimms[rt].ftype == ITYPE_BRA)
-                               printf("%s %s,%x\n", regimms[rt].name, regs[rs],
-                                      pos + 4 + ((c << 16) >> 14));
-                       else
-                               printf("regimm   %#04x,$%d,%d\n", rt, rs, (c << 16) >> 16);             
-                       break;
-
-               case ITYPE_OP:
-                       if (c == 0) {
-                               printf("nop\n");
-                               return;
-                               }
-                       if (opfun == 0x25 && rt == 0) {
-                               if (rs == 0)
-                                       printf("clr      %s\n", regs[rd]);
-                               else
-                                       printf("move     %s,%s\n", regs[rd], regs[rs]);
-                               return;
-                               }
-                       switch (regops[opfun].ftype) {
-                               case ITYPE_OP:
-                                       printf("%s %s,%s,%s\n", regops[opfun].name, regs[rd],
-                                              regs[rs], regs[rt]);
-                                       break;
-                               case ITYPE_IMM:  /* immediate instruction */
-                                       printf("%s %s,%s,%d\n",
-                                              regops[opfun].name, regs[rd], regs[rt], shift);
-                                       break;
-                               case ITYPE_TRAP:
-                                       printf("%s %s,%s,%d\n", regops[opfun].name,
-                                              regs[rs], regs[rt], (c << 16) >> 22);
-                                       break;
-                               case ITYPE_DIVMUL: /* div/mul instruction */
-                                       printf("%s %s,%s\n", regops[opfun].name, regs[rs], regs[rt]);
-                                       break;
-                               case ITYPE_JMP:
-                                       if (rd == 31) {
-                                               printf("%s %s\n", regops[opfun].name, regs[rs]);
-                                               break;
-                                               }
-                                       printf("%s %s,%s\n", regops[opfun].name, regs[rd], regs[rs]);
-                                       break;
-                               case ITYPE_MTOJR:
-                                       if (opfun == 8 && rs == 31) {
-                                               printf("ret\n");
-                                               break;
-                                               }
-                                       printf("%s %s\n", regops[opfun].name, regs[rs]);
-                                       break;
-                               case ITYPE_MFROM:
-                                       printf("%s %s\n", regops[opfun].name, regs[rd]);
-                                       break;
-                               case ITYPE_SYS:
-                                       printf("%s\n", regops[opfun].name);
-                               default:
-                                       printf("special  (%#04x) $%d,$%d,$%d\n", opfun, rd, rs, rt);
-                               }               
-                       break;
-               case ITYPE_FOP:
-                       fs    = (c >> 11) & 0x1f;   /* 5 bit source register              */
-                       ft    = (c >> 16) & 0x1f;   /* 5 bit source/destination register  */
-                       fd    = (c >>  6) & 0x1f;   /* 5 bit destination register         */
-
-                       if (rs == 8) {              /* floating point branch              */
-                               printf("%s %x\n", fbra[ft&3], pos + 4 + ((c << 16) >> 14));
-                               break;
-                               }
-
-                       if (rs == 0) {              /* move from                          */
-                               printf("mfc1     %s,$f%d\n", regs[rt], fs);             
-                               break;
-                               }
-
-                       if (rs == 1) {              /* double move from                   */
-                               printf("dmfc1    %s,$f%d\n", regs[rt], fs);             
-                               break;
-                               }
-
-                       if (rs == 4) {              /* move to                            */
-                               printf("mtc1     %s,$f%d\n", regs[rt], fs);             
-                               break;
-                               }
-
-                       if (rs == 5) {              /* double move to                     */
-                               printf("dmtc1    %s,$f%d\n", regs[rt], fs);             
-                               break;
-                               }
-
-                       rs    = rs & 7;             /* truncate to 3 bit format specifier */
-
-                       if (fops[opfun].ftype == ITYPE_FOP)
-                               printf("%s%s%s $f%d,$f%d,$f%d\n", fops[opfun].name, fmt[rs],
-                                                              fops[opfun].fill, fd, fs, ft);
-                       else if (fops[opfun].ftype == ITYPE_FOP2)
-                               printf("%s%s%s $f%d,$f%d\n", fops[opfun].name, fmt[rs],
-                                                          fops[opfun].fill, fd, fs);
-                       else if (fops[opfun].ftype == ITYPE_FCMP)
-                               printf("%s%s%s $f%d,$f%d\n", fops[opfun].name, fmt[rs],
-                                                          fops[opfun].fill, fs, ft);
-                       else
-                               printf("cop1     (%#04x) $f%d,$f%d,$f%d\n", opfun, fd, fs, ft);         
-
-                       break;
-
-               default:
-                       printf("undef    %#04x(%#04x) $%d,$%d,$%d\n", op, opfun, rd, rs, rt);           
-               }
-}
-
-
-/* function disassemble ********************************************************
-
-       outputs a disassembler listing of some machine code on 'stdout'
-       code: pointer to first instruction
-       len:  code size (number of instructions * 4)
-
-*******************************************************************************/
-
-static void disassemble(int *code, int len)
-{
-       int p;
-
-       printf ("  --- disassembler listing ---\n");    
-       for (p = 0; p < len; p += 4, code++)
-               disassinstr(*code, p); 
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/mips/native-math.h b/mips/native-math.h
deleted file mode 100644 (file)
index 49b4c70..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/* alpha/native-math.h *********************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the machine-specific floating point definitions.
-
-       Authors: Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-                Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/10/21
-
-*******************************************************************************/
-
-#ifndef _NATIVE_MATH_H
-#define _NATIVE_MATH_H
-
-/* include machine-specific math.h */
-
-#include <math.h>
-
-#define finitef finite
-#define copysignf copysign
-
-/* define infinity for floating point numbers */
-
-static u4 flt_nan    = 0xffffffff;
-static u4 flt_posinf = 0x7f800000;
-static u4 flt_neginf = 0xff800000;
-
-#define FLT_NAN    (*((float*) (&flt_nan)))
-#define FLT_POSINF (*((float*) (&flt_posinf)))
-#define FLT_NEGINF (*((float*) (&flt_neginf)))
-
-/* define infinity for double floating point numbers */
-
-static u8 dbl_nan    = 0xffffffffffffffffL ;
-static u8 dbl_posinf = 0x7ff0000000000000L ;
-static u8 dbl_neginf = 0xfff0000000000000L ;
-
-#define DBL_NAN    (*((double*) (&dbl_nan)))
-#define DBL_POSINF (*((double*) (&dbl_posinf)))
-#define DBL_NEGINF (*((double*) (&dbl_neginf)))
-
-#endif
diff --git a/mips/ngen.c b/mips/ngen.c
deleted file mode 100644 (file)
index 68e72c5..0000000
+++ /dev/null
@@ -1,3901 +0,0 @@
-/* mips/ngen.c *****************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the codegenerator for an MIPS (R4000 or higher) processor.
-       This module generates MIPS machine code for a sequence of intermediate
-       code commands (ICMDs).
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: $Id: ngen.c 543 2003-11-01 10:54:10Z stefan $
-
-*******************************************************************************/
-
-#include "jitdef.h"   /* phil */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* *****************************************************************************
-
-Datatypes and Register Allocations:
------------------------------------ 
-
-On 64-bit-machines (like the MIPS) all operands are stored in the
-registers in a 64-bit form, even when the correspondig JavaVM operands
-only need 32 bits. This is done by a canonical representation:
-
-32-bit integers are allways stored as sign-extended 64-bit values (this
-approach is directly supported by the MIPS architecture and is very easy
-to implement).
-
-32-bit-floats are stored in a 64-bit double precision register by simply
-expanding the exponent and mantissa with zeroes. (also supported by the
-architecture)
-
-
-Stackframes:
-
-The calling conventions and the layout of the stack is  explained in detail
-in the documention file: calling.doc
-
-*******************************************************************************/
-
-
-/* additional functions and macros to generate code ***************************/
-
-/* #define BlockPtrOfPC(pc)        block+block_index[pc] */
-#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
-
-
-#ifdef STATISTICS
-#define COUNT_SPILLS count_spills++
-#else
-#define COUNT_SPILLS
-#endif
-
-
-/* gen_nullptr_check(objreg) */
-
-#ifdef SOFTNULLPTRCHECK
-#define gen_nullptr_check(objreg) \
-       if (checknull) {\
-       M_BEQZ((objreg), 0);\
-       mcode_addxnullrefs(mcodeptr);\
-       M_NOP;\
-       }
-#else
-#define gen_nullptr_check(objreg)
-#endif
-
-
-/* MCODECHECK(icnt) */
-
-#define MCODECHECK(icnt) \
-       if((mcodeptr+(icnt))>mcodeend)mcodeptr=mcode_increase((u1*)mcodeptr)
-
-/* M_INTMOVE:
-     generates an integer-move from register a to b.
-     if a and b are the same int-register, no code will be generated.
-*/ 
-
-#define M_INTMOVE(a,b) if(a!=b){M_MOV(a,b);}
-
-
-/* M_FLTMOVE:
-    generates a floating-point-move from register a to b.
-    if a and b are the same float-register, no code will be generated
-*/ 
-
-#define M_FLTMOVE(a,b) {if(a!=b){M_DMOV(a,b);}}
-
-#define M_TFLTMOVE(t,a,b) \
-       {if(a!=b) \
-               if ((t)==TYPE_DBL) \
-                   {M_DMOV(a,b);} \
-               else {M_FMOV(a,b);} \
-       }
-
-#define M_TFLD(t,a,b,disp) \
-    if ((t)==TYPE_DBL) \
-         {M_DLD(a,b,disp);} \
-    else \
-         {M_FLD(a,b,disp);}
-
-#define M_TFST(t,a,b,disp) \
-    if ((t)==TYPE_DBL) \
-         {M_DST(a,b,disp);} \
-    else \
-         {M_FST(a,b,disp);}
-
-#define M_CCFLTMOVE(t1,t2,a,b) \
-       if ((t1)==(t2)) \
-         {M_TFLTMOVE(t1,a,b);} \
-       else \
-         if ((t1)==TYPE_DBL) \
-               {M_CVTDF(a,b);} \
-         else \
-               {M_CVTFD(a,b);}
-
-#define M_CCFLD(t1,t2,a,b,disp) \
-    if ((t1)==(t2)) \
-         {M_DLD(a,b,disp);} \
-       else { \
-         M_DLD(REG_FTMP1,b,disp); \
-         if ((t1)==TYPE_DBL) \
-           {M_CVTDF(REG_FTMP1,a);} \
-         else \
-           {M_CVTFD(REG_FTMP1,a);} \
-       }
-         
-#define M_CCFST(t1,t2,a,b,disp) \
-    if ((t1)==(t2)) \
-         {M_DST(a,b,disp);} \
-       else { \
-         if ((t1)==TYPE_DBL) \
-           {M_CVTDF(a,REG_FTMP1);} \
-         else \
-           {M_CVTFD(a,REG_FTMP1);} \
-         M_DST(REG_FTMP1,b,disp); \
-       }
-         
-
-/* var_to_reg_xxx:
-    this function generates code to fetch data from a pseudo-register
-    into a real register. 
-    If the pseudo-register has actually been assigned to a real 
-    register, no code will be emitted, since following operations
-    can use this register directly.
-    
-    v: pseudoregister to be fetched from
-    tempregnum: temporary register to be used if v is actually spilled to ram
-
-    return: the register number, where the operand can be found after 
-            fetching (this wil be either tempregnum or the register
-            number allready given to v)
-*/
-
-#define var_to_reg_int(regnr,v,tempnr) { \
-       if ((v)->flags & INMEMORY) \
-               {COUNT_SPILLS;M_LLD(tempnr,REG_SP,8*(v)->regoff);regnr=tempnr;} \
-       else regnr=(v)->regoff; \
-}
-
-
-#define var_to_reg_flt(regnr,v,tempnr) { \
-       if ((v)->flags & INMEMORY) \
-               {COUNT_SPILLS;M_DLD(tempnr,REG_SP,8*(v)->regoff);regnr=tempnr;} \
-       else regnr=(v)->regoff; \
-}
-
-
-/* reg_of_var:
-    This function determines a register, to which the result of an operation
-    should go, when it is ultimatively intended to store the result in
-    pseudoregister v.
-    If v is assigned to an actual register, this register will be returned.
-    Otherwise (when v is spilled) this function returns tempregnum.
-    If not already done, regoff and flags are set in the stack location.
-*/        
-
-static int reg_of_var(stackptr v, int tempregnum)
-{
-       varinfo      *var;
-
-       switch (v->varkind) {
-               case TEMPVAR:
-                       if (!(v->flags & INMEMORY))
-                               return(v->regoff);
-                       break;
-               case STACKVAR:
-                       var = &(interfaces[v->varnum][v->type]);
-                       v->regoff = var->regoff;
-                       if (!(var->flags & INMEMORY))
-                               return(var->regoff);
-                       break;
-               case LOCALVAR:
-                       var = &(locals[v->varnum][v->type]);
-                       v->regoff = var->regoff;
-                       if (!(var->flags & INMEMORY))
-                               return(var->regoff);
-                       break;
-               case ARGVAR:
-                       v->regoff = v->varnum;
-                       if (IS_FLT_DBL_TYPE(v->type)) {
-                               if (v->varnum < fltreg_argnum) {
-                                       v->regoff = argfltregs[v->varnum];
-                                       return(argfltregs[v->varnum]);
-                                       }
-                               }
-                       else
-                               if (v->varnum < intreg_argnum) {
-                                       v->regoff = argintregs[v->varnum];
-                                       return(argintregs[v->varnum]);
-                                       }
-                       v->regoff -= intreg_argnum;
-                       break;
-               }
-       v->flags |= INMEMORY;
-       return tempregnum;
-}
-
-
-/* store_reg_to_var_xxx:
-    This function generates the code to store the result of an operation
-    back into a spilled pseudo-variable.
-    If the pseudo-variable has not been spilled in the first place, this 
-    function will generate nothing.
-    
-    v ............ Pseudovariable
-    tempregnum ... Number of the temporary registers as returned by
-                   reg_of_var.
-*/     
-
-#define store_reg_to_var_int(sptr, tempregnum) {       \
-       if ((sptr)->flags & INMEMORY) {                    \
-               COUNT_SPILLS;                                  \
-               M_LST(tempregnum, REG_SP, 8 * (sptr)->regoff); \
-               }                                              \
-       }
-
-#define store_reg_to_var_flt(sptr, tempregnum) {       \
-       if ((sptr)->flags & INMEMORY) {                    \
-               COUNT_SPILLS;                                  \
-               M_DST(tempregnum, REG_SP, 8 * (sptr)->regoff); \
-               }                                              \
-       }
-
-
-void docacheflush(u1 *p, long bytelen, int dummy);
-
-/* NullPointerException handlers and exception handling initialisation        */
-
-/* NullPointerException signal handler for hardware null pointer check */
-
-void catch_NullPointerException(int sig, int code, struct sigcontext *sigctx)
-{
-       sigset_t nsig;
-       int      instr;
-       long     faultaddr;
-
-       /* Reset signal handler - necessary for SysV, does no harm for BSD */
-
-       instr = *((int*)(sigctx->sc_pc));
-       faultaddr = sigctx->sc_regs[(instr >> 21) & 0x1f];
-
-       if (faultaddr == 0) {
-               sigemptyset(&nsig);
-               sigaddset(&nsig, sig);
-               sigprocmask(SIG_UNBLOCK, &nsig, NULL);           /* unblock signal    */
-               sigctx->sc_regs[REG_ITMP1_XPTR] =
-                                           (long) proto_java_lang_NullPointerException;
-               sigctx->sc_regs[REG_ITMP2_XPC] = sigctx->sc_pc;
-               sigctx->sc_pc = (long) asm_handle_exception;
-               }
-       else {
-        faultaddr += (long) ((instr << 16) >> 16);
-               fprintf(stderr, "faulting address: 0x%lx at 0x%lx\n", (long) faultaddr, (long) sigctx->sc_pc);
-               panic("Stack overflow");
-               }
-}
-
-void createcalljava ();
-
-
-void init_exceptions(void)
-{
-       struct sigaction sa;
-       sigset_t unblockmask;
-
-       createcalljava();
-       
-       /* The Boehm GC initialization blocks the SIGSEGV signal. So we do a
-          dummy allocation here to ensure that the GC is initialized.
-       */
-       heap_allocate(1, 0, NULL);
-
-       /* install signal handlers we need to convert to exceptions */
-
-       sigemptyset(&unblockmask);
-       sa.sa_flags = 0;
-       sa.sa_sigaction = catch_NullPointerException;
-       sigemptyset(&sa.sa_mask);
-
-       if (!checknull) {
-
-#if defined(SIGSEGV)
-               sigaction(SIGSEGV, &sa, NULL);
-               sigaddset(&unblockmask, SIGSEGV);
-#endif
-
-#if defined(SIGBUS)
-               sigaction(SIGBUS, &sa, NULL);
-               sigaddset(&unblockmask, SIGBUS);
-#endif
-       }
-
-       sigprocmask(SIG_UNBLOCK, &unblockmask, NULL);
-}
-
-
-/* function gen_mcode **********************************************************
-
-       generates machine code
-
-*******************************************************************************/
-
-#define        MethodPointer   -8
-#define        FrameSize       -12
-#define     IsSync          -16
-#define     IsLeaf          -20
-#define     IntSave         -24
-#define     FltSave         -28
-#define     ExTableSize     -32
-#define     ExTableStart    -32
-
-#if POINTERSIZE==8
-#define     ExEntrySize     -32
-#define     ExStartPC       -8
-#define     ExEndPC         -16
-#define     ExHandlerPC     -24
-#define     ExCatchType     -32
-#else
-#define     ExEntrySize     -16
-#define     ExStartPC       -4
-#define     ExEndPC         -8
-#define     ExHandlerPC     -12
-#define     ExCatchType     -16
-#endif
-
-static void gen_mcode()
-{
-       int  len, s1, s2, s3, d, bbs;
-       s4   a;
-       s4          *mcodeptr;
-       stackptr    src;
-       varinfo     *var;
-       basicblock  *bptr;
-       instruction *iptr;
-       xtable *ex;
-
-       {
-       int p, pa, t, l, r;
-
-       savedregs_num = (isleafmethod) ? 0 : 1;           /* space to save the RA */
-
-       /* space to save used callee saved registers */
-
-       savedregs_num += (savintregcnt - maxsavintreguse);
-       savedregs_num += (savfltregcnt - maxsavfltreguse);
-
-       parentargs_base = maxmemuse + savedregs_num;
-
-#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               parentargs_base++;
-
-#endif
-
-       /* adjust frame size for 16 byte alignment */
-
-       if (parentargs_base & 1)
-               parentargs_base++;
-
-       /* create method header */
-
-#if POINTERSIZE==4
-       (void) dseg_addaddress(method);                         /* Filler         */
-#endif
-       (void) dseg_addaddress(method);                         /* MethodPointer  */
-       (void) dseg_adds4(parentargs_base * 8);                 /* FrameSize      */
-
-#ifdef USE_THREADS
-
-       /* IsSync contains the offset relative to the stack pointer for the
-          argument of monitor_exit used in the exception handler. Since the
-          offset could be zero and give a wrong meaning of the flag it is
-          offset by one.
-       */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               (void) dseg_adds4((maxmemuse + 1) * 8);             /* IsSync         */
-       else
-
-#endif
-
-       (void) dseg_adds4(0);                                   /* IsSync         */
-                                              
-       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
-       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
-       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
-       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
-
-       /* create exception table */
-
-       for (ex = extable; ex != NULL; ex = ex->down) {
-
-#ifdef LOOP_DEBUG      
-               if (ex->start != NULL)
-                       printf("adding start - %d - ", ex->start->debug_nr);
-               else {
-                       printf("PANIC - start is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->start);
-
-#ifdef LOOP_DEBUG                      
-               if (ex->end != NULL)
-                       printf("adding end - %d - ", ex->end->debug_nr);
-               else {
-                       printf("PANIC - end is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->end);
-
-#ifdef LOOP_DEBUG              
-               if (ex->handler != NULL)
-                       printf("adding handler - %d\n", ex->handler->debug_nr);
-               else {
-                       printf("PANIC - handler is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->handler);
-          
-               (void) dseg_addaddress(ex->catchtype);
-               }
-       
-       /* initialize mcode variables */
-       
-       mcodeptr = (s4*) mcodebase;
-       mcodeend = (s4*) (mcodebase + mcodesize);
-       MCODECHECK(128 + mparamcount);
-
-       /* create stack frame (if necessary) */
-
-       if (parentargs_base)
-               {M_LDA (REG_SP, REG_SP, -parentargs_base * 8);}
-
-       /* save return address and used callee saved registers */
-
-       p = parentargs_base;
-       if (!isleafmethod)
-               {p--;  M_LST (REG_RA, REG_SP, 8*p);}
-       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
-               {p--; M_LST (savintregs[r], REG_SP, 8 * p);}
-       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
-               {p--; M_DST (savfltregs[r], REG_SP, 8 * p);}
-
-       /* save monitorenter argument */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               if (method->flags & ACC_STATIC) {
-                       p = dseg_addaddress (class);
-                       M_ALD(REG_ITMP1, REG_PV, p);
-                       M_AST(REG_ITMP1, REG_SP, 8 * maxmemuse);
-                       } 
-               else {
-                       M_AST (argintregs[0], REG_SP, 8 * maxmemuse);
-                       }
-               }                       
-#endif
-
-       /* copy argument registers to stack and call trace function with pointer
-          to arguments on stack. ToDo: save floating point registers !!!!!!!!!
-       */
-
-       if (runverbose) {
-               M_LDA (REG_SP, REG_SP, -(18*8));
-
-               M_LST(REG_RA,        REG_SP,  1*8);
-
-               M_LST(argintregs[0], REG_SP,  2*8);
-               M_LST(argintregs[1], REG_SP,  3*8);
-               M_LST(argintregs[2], REG_SP,  4*8);
-               M_LST(argintregs[3], REG_SP,  5*8);
-               M_LST(argintregs[4], REG_SP,  6*8);
-               M_LST(argintregs[5], REG_SP,  7*8);
-               M_LST(argintregs[6], REG_SP,  8*8);
-               M_LST(argintregs[7], REG_SP,  9*8);
-
-               M_DST(argfltregs[0], REG_SP, 10*8);
-               M_DST(argfltregs[1], REG_SP, 11*8);
-               M_DST(argfltregs[2], REG_SP, 12*8);
-               M_DST(argfltregs[3], REG_SP, 13*8);
-               M_DST(argfltregs[4], REG_SP, 14*8);
-               M_DST(argfltregs[5], REG_SP, 15*8);
-               M_DST(argfltregs[6], REG_SP, 16*8);
-               M_DST(argfltregs[7], REG_SP, 17*8);
-
-               p = dseg_addaddress (method);
-               M_ALD(REG_ITMP1, REG_PV, p);
-               M_LST(REG_ITMP1, REG_SP, 0);
-               p = dseg_addaddress ((void*) (builtin_trace_args));
-               M_ALD(REG_ITMP3, REG_PV, p);
-               M_JSR(REG_RA, REG_ITMP3);
-               M_NOP;
-
-               M_LLD(REG_RA,        REG_SP,  1*8);
-
-               M_LLD(argintregs[0], REG_SP,  2*8);
-               M_LLD(argintregs[1], REG_SP,  3*8);
-               M_LLD(argintregs[2], REG_SP,  4*8);
-               M_LLD(argintregs[3], REG_SP,  5*8);
-               M_LLD(argintregs[4], REG_SP,  6*8);
-               M_LLD(argintregs[5], REG_SP,  7*8);
-               M_LLD(argintregs[6], REG_SP,  8*8);
-               M_LLD(argintregs[7], REG_SP,  9*8);
-
-               M_DLD(argfltregs[0], REG_SP, 10*8);
-               M_DLD(argfltregs[1], REG_SP, 11*8);
-               M_DLD(argfltregs[2], REG_SP, 12*8);
-               M_DLD(argfltregs[3], REG_SP, 13*8);
-               M_DLD(argfltregs[4], REG_SP, 14*8);
-               M_DLD(argfltregs[5], REG_SP, 15*8);
-               M_DLD(argfltregs[6], REG_SP, 16*8);
-               M_DLD(argfltregs[7], REG_SP, 17*8);
-
-               M_LDA (REG_SP, REG_SP, 18*8);
-               }
-
-       /* take arguments out of register or stack frame */
-
-       for (p = 0, l = 0; p < mparamcount; p++) {
-               t = mparamtypes[p];
-               var = &(locals[l][t]);
-               l++;
-               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
-                       l++;
-               if (var->type < 0)
-                       continue;
-               r = var->regoff; 
-               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
-                       if (p < INT_ARG_CNT) {                   /* register arguments    */
-                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
-                                       {M_INTMOVE (argintregs[p], r);}
-                               else                                 /* reg arg -> spilled    */
-                                       M_LST (argintregs[p], REG_SP, 8 * r);
-                               }
-                       else {                                   /* stack arguments       */
-                               pa = p - INT_ARG_CNT;
-                               if (!(var->flags & INMEMORY))        /* stack arg -> register */ 
-                                       M_LLD (r, REG_SP, 8 * (parentargs_base + pa));
-                               else {                               /* stack arg -> spilled  */
-                                       M_LLD (REG_ITMP1, REG_SP, 8 * (parentargs_base + pa));
-                                       M_LST (REG_ITMP1, REG_SP, 8 * r);
-                                       }
-                               }
-                       }
-               else {                                       /* floating args         */   
-                       if (p < FLT_ARG_CNT) {                   /* register arguments    */
-                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
-                                       {M_TFLTMOVE (var->type, argfltregs[p], r);}
-                               else                                             /* reg arg -> spilled    */
-                                       M_DST (argfltregs[p], REG_SP, 8 * r);
-                               }
-                       else {                                   /* stack arguments       */
-                               pa = p - FLT_ARG_CNT;
-                               if (!(var->flags & INMEMORY)) {      /* stack-arg -> register */
-                                       M_DLD (r, REG_SP, 8 * (parentargs_base + pa) );
-                               } else {                             /* stack-arg -> spilled  */
-                                       M_DLD (REG_FTMP1, REG_SP, 8 * (parentargs_base + pa));
-                                       M_DST (REG_FTMP1, REG_SP, 8 * r);
-                                       }
-                               }
-                       }
-               }  /* end for */
-
-       /* call trace function */
-
-#if 0
-       if (runverbose && !isleafmethod) {
-               M_LDA (REG_SP, REG_SP, -8);
-               p = dseg_addaddress (method);
-               M_ALD(REG_ITMP1, REG_PV, p);
-               M_AST(REG_ITMP1, REG_SP, 0);
-               p = dseg_addaddress ((void*) (builtin_trace_args));
-               M_ALD(REG_ITMP3, REG_PV, p);
-               M_JSR(REG_RA, REG_ITMP3);
-               M_NOP;
-               M_LDA(REG_SP, REG_SP, 8);
-               }
-#endif
-
-       /* call monitorenter function */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               int disp;
-               p = dseg_addaddress ((void*) (builtin_monitorenter));
-               M_ALD(REG_ITMP3, REG_PV, p);
-               M_JSR(REG_RA, REG_ITMP3);
-               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
-               disp = -(int)((u1*) mcodeptr - mcodebase);
-               M_LDA(REG_PV, REG_RA, disp);
-               }                       
-#endif
-       }
-
-       /* end of header generation */
-
-       /* walk through all basic blocks */
-       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
-
-               bptr -> mpc = (int)((u1*) mcodeptr - mcodebase);
-
-               if (bptr->flags >= BBREACHED) {
-
-               /* branch resolving */
-
-               {
-               branchref *brefs;
-               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
-                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
-                                         brefs->branchpos, bptr->mpc);
-                       }
-               }
-
-               /* copy interface registers to their destination */
-
-               src = bptr->instack;
-               len = bptr->indepth;
-               MCODECHECK(64+len);
-               while (src != NULL) {
-                       len--;
-                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
-                               d = reg_of_var(src, REG_ITMP1);
-                               M_INTMOVE(REG_ITMP1, d);
-                               store_reg_to_var_int(src, d);
-                               }
-                       else {
-                               d = reg_of_var(src, REG_IFTMP);
-                               if ((src->varkind != STACKVAR)) {
-                                       s2 = src->type;
-                                       if (IS_FLT_DBL_TYPE(s2)) {
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       s1 = interfaces[len][s2].regoff;
-                                                       M_TFLTMOVE(s2,s1,d);
-                                                       }
-                                               else {
-                                                       M_DLD(d, REG_SP, 8 * interfaces[len][s2].regoff);
-                                                       }
-                                               store_reg_to_var_flt(src, d);
-                                               }
-                                       else {
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       s1 = interfaces[len][s2].regoff;
-                                                       M_INTMOVE(s1,d);
-                                                       }
-                                               else {
-                                                       M_LLD(d, REG_SP, 8 * interfaces[len][s2].regoff);
-                                                       }
-                                               store_reg_to_var_int(src, d);
-                                               }
-                                       }
-                               }
-                       src = src->prev;
-                       }
-
-               /* walk through all instructions */
-               
-               src = bptr->instack;
-               len = bptr->icount;
-               for (iptr = bptr->iinstr;
-                   len > 0;
-                   src = iptr->dst, len--, iptr++) {
-
-       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
-       switch (iptr->opc) {
-
-               case ICMD_NOP:        /* ...  ==> ...                                 */
-                       break;
-
-               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_BEQZ(s1, 0);
-                       mcode_addxnullrefs(mcodeptr);
-                       M_NOP;
-                       break;
-
-               /* constant operations ************************************************/
-
-#define ICONST(r,c) if(((c)>=-32768)&&((c)<= 32767)){M_IADD_IMM(REG_ZERO,c,r);} \
-                    else if(((c)>=0)&&((c)<=0xffff)){M_OR_IMM(REG_ZERO,c,r);} \
-                    else{a=dseg_adds4(c);M_ILD(r,REG_PV,a);}
-
-#define LCONST(r,c) if(((c)>=-32768)&&((c)<= 32767)){M_LADD_IMM(REG_ZERO,c,r);} \
-                    else if(((c)>=0)&&((c)<=0xffff)){M_OR_IMM(REG_ZERO,c,r);} \
-                    else{a=dseg_adds8(c);M_LLD(r,REG_PV,a);}
-
-               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.i = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       ICONST(d, iptr->val.i);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.l = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       LCONST(d, iptr->val.l);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.f = constant                    */
-
-                       d = reg_of_var (iptr->dst, REG_FTMP1);
-                       a = dseg_addfloat (iptr->val.f);
-                       M_FLD(d, REG_PV, a);
-                       store_reg_to_var_flt (iptr->dst, d);
-                       break;
-                       
-               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.d = constant                    */
-
-                       d = reg_of_var (iptr->dst, REG_FTMP1);
-                       a = dseg_adddouble (iptr->val.d);
-                       M_DLD(d, REG_PV, a);
-                       store_reg_to_var_flt (iptr->dst, d);
-                       break;
-
-               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.a = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->val.a) {
-                               a = dseg_addaddress (iptr->val.a);
-                               M_ALD(d, REG_PV, a);
-                               }
-                       else {
-                               M_INTMOVE(REG_ZERO, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               /* load/store operations **********************************************/
-
-               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_LLOAD:      /* op1 = local variable                         */
-               case ICMD_ALOAD:
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY)
-                               M_LLD(d, REG_SP, 8 * var->regoff);
-                       else
-                               {M_INTMOVE(var->regoff,d);}
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_DLOAD:      /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       {
-                               int t2 = ((iptr->opc == ICMD_FLOAD) ? TYPE_FLT : TYPE_DBL);
-                               if (var->flags & INMEMORY)
-                                       {M_CCFLD(var->type,t2,d, REG_SP, 8 * var->regoff);}
-                               else
-                                       {M_CCFLTMOVE(var->type,t2,var->regoff,d);}
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-
-               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
-               case ICMD_LSTORE:     /* op1 = local variable                         */
-               case ICMD_ASTORE:
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               M_LST(s1, REG_SP, 8 * var->regoff);
-                               }
-                       else {
-                               var_to_reg_int(s1, src, var->regoff);
-                               M_INTMOVE(s1, var->regoff);
-                               }
-                       break;
-
-               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_DSTORE:     /* op1 = local variable                         */
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       {
-                               int t1 = ((iptr->opc == ICMD_FSTORE) ? TYPE_FLT : TYPE_DBL);
-                               if (var->flags & INMEMORY) {
-                                       var_to_reg_flt(s1, src, REG_FTMP1);
-                                       M_CCFST(t1,var->type,s1, REG_SP, 8 * var->regoff);
-                                       }
-                               else {
-                                       var_to_reg_flt(s1, src, var->regoff);
-                                       M_CCFLTMOVE(t1,var->type,s1, var->regoff);
-                                       }
-                       }
-                       break;
-
-
-               /* pop/dup/swap operations ********************************************/
-
-               /* attention: double and longs are only one entry in CACAO ICMDs      */
-
-               case ICMD_POP:        /* ..., value  ==> ...                          */
-               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
-                       break;
-
-#define M_COPY(from,to) \
-                       d = reg_of_var(to, REG_IFTMP); \
-                       if ((from->regoff != to->regoff) || \
-                           ((from->flags ^ to->flags) & INMEMORY)) { \
-                               if (IS_FLT_DBL_TYPE(from->type)) { \
-                                       var_to_reg_flt(s1, from, d); \
-                                       M_TFLTMOVE(from->type,s1,d); \
-                                       store_reg_to_var_flt(to, d); \
-                                       }\
-                               else { \
-                                       var_to_reg_int(s1, from, d); \
-                                       M_INTMOVE(s1,d); \
-                                       store_reg_to_var_int(to, d); \
-                                       }\
-                               }
-
-               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
-                       M_COPY(src, iptr->dst);
-                       break;
-
-               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
-
-                       M_COPY(src,       iptr->dst->prev->prev);
-
-               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
-
-                       M_COPY(src,       iptr->dst);
-                       M_COPY(src->prev, iptr->dst->prev);
-                       break;
-
-               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
-
-                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
-
-               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
-
-                       M_COPY(src,             iptr->dst);
-                       M_COPY(src->prev,       iptr->dst->prev);
-                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
-                       M_COPY(src, iptr->dst->prev->prev->prev);
-                       break;
-
-               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
-
-                       M_COPY(src,                   iptr->dst);
-                       M_COPY(src->prev,             iptr->dst->prev);
-                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
-                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
-                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
-                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
-                       break;
-
-               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
-
-                       M_COPY(src, iptr->dst->prev);
-                       M_COPY(src->prev, iptr->dst);
-                       break;
-
-
-               /* integer operations *************************************************/
-
-               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_int(s1, src, REG_ITMP1); 
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISUB(REG_ZERO, s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSUB(REG_ZERO, s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISLL_IMM(s1, 0, d );
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSLL_IMM(s1, 56, d);
-                       M_LSRA_IMM( d, 56, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_CZEXT(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSLL_IMM(s1, 48, d);
-                       M_LSRA_IMM( d, 48, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IADD(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= -32768) && (iptr->val.i <= 32767)) {
-                               M_IADD_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_IADD(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LADD(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= -32768) && (iptr->val.l <= 32767)) {
-                               M_LADD_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_LADD(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISUB(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= -32767) && (iptr->val.i <= 32768)) {
-                               M_IADD_IMM(s1, -iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_ISUB(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSUB(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= -32767) && (iptr->val.l <= 32768)) {
-                               M_LADD_IMM(s1, -iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_LSUB(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IMUL(s1, s2);
-                       M_MFLO(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       ICONST(REG_ITMP2, iptr->val.i);
-                       M_IMUL(s1, REG_ITMP2);
-                       M_MFLO(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LMUL(s1, s2);
-                       M_MFLO(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       LCONST(REG_ITMP2, iptr->val.l);
-                       M_LMUL(s1, REG_ITMP2);
-                       M_MFLO(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IDIV(s1, s2);
-                       M_MFLO(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#if 0
-               case ICMD_IDIVCONST:  /* ..., value  ==> ..., value / constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       ICONST(REG_ITMP2, iptr->val.i);
-                       M_IDIV(s1, REG_ITMP2);
-                       M_MFLO(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#endif
-               case ICMD_LDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LDIV(s1, s2);
-                       M_MFLO(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#if 0
-               case ICMD_LDIVCONST:  /* ..., value  ==> ..., value / constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       LCONST(REG_ITMP2, iptr->val.l);
-                       M_LDIV(s1, REG_ITMP2);
-                       M_MFLO(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#endif
-               case ICMD_IREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IDIV(s1, s2);
-                       M_MFHI(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#if 0
-               case ICMD_IREMCONST:  /* ..., value  ==> ..., value % constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       ICONST(REG_ITMP2, iptr->val.i);
-                       M_IDIV(s1, REG_ITMP2);
-                       M_MFHI(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#endif
-               case ICMD_LREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LDIV(s1, s2);
-                       M_MFHI(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#if 0
-               case ICMD_LREMCONST:  /* ..., value  ==> ..., value % constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       LCONST(REG_ITMP2, iptr->val.l);
-                       M_LDIV(s1, REG_ITMP2);
-                       M_MFHI(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#endif
-               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value << constant       */
-               case ICMD_LDIVPOW2:   /* val.i = constant                             */
-                                     
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSRA_IMM(s1, 63, REG_ITMP2);
-                       M_LSRL_IMM(REG_ITMP2, 64 - iptr->val.i, REG_ITMP2);
-                       M_LADD(s1, REG_ITMP2, REG_ITMP2);
-                       M_LSRA_IMM(REG_ITMP2, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISLL(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISLL_IMM(s1, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISRA(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISRA_IMM(s1, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISRL(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISRL_IMM(s1, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSLL(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSLL_IMM(s1, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSRA(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LSHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSRA_IMM(s1, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSRL(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LSRL_IMM(s1, iptr->val.i, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
-               case ICMD_LAND:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 0xffff)) {
-                               M_AND_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_AND(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                               }
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 0xffff)) {
-                               M_AND_IMM(s1, iptr->val.i, d);
-                               M_BGEZ(s1, 4);
-                               M_NOP;
-                               M_ISUB(REG_ZERO, s1, d);
-                               M_AND_IMM(d, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_AND(s1, REG_ITMP2, d);
-                               M_BGEZ(s1, 4);
-                               M_NOP;
-                               M_ISUB(REG_ZERO, s1, d);
-                               M_AND(d, REG_ITMP2, d);
-                               }
-                       M_ISUB(REG_ZERO, d, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IREM0X10001:  /* ..., value  ==> ..., value % 0x100001      */
-               
-/*          b = value & 0xffff;
-                       a = value >> 16;
-                       a = ((b - a) & 0xffff) + (b < a);
-*/
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP3);
-                               s1 = REG_ITMP3;
-                               }
-                       M_BLTZ(s1, 7);
-            M_CZEXT(s1, REG_ITMP2);                             /* delay slot */
-                       M_ISRA_IMM(s1, 16, d);
-                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
-                       M_ISUB(REG_ITMP2, d, d);
-            M_CZEXT(d, d);
-                       M_BR(7);
-                       M_IADD(d, REG_ITMP1, d);                            /* delay slot */
-
-                       M_LUI(REG_ITMP2, 1);
-                       M_IADD_IMM(REG_ITMP2, 1, REG_ITMP2);
-                       M_IDIV(s1, REG_ITMP2);
-                       M_MFHI(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 0xffff)) {
-                               M_AND_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_AND(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                               }
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 0xffff)) {
-                               M_AND_IMM(s1, iptr->val.l, d);
-                               M_BGEZ(s1, 4);
-                               M_NOP;
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_AND_IMM(d, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_AND(s1, REG_ITMP2, d);
-                               M_BGEZ(s1, 4);
-                               M_NOP;
-                               M_LSUB(REG_ZERO, s1, d);
-                               M_AND(d, REG_ITMP2, d);
-                               }
-                       M_LSUB(REG_ZERO, d, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LREM0X10001:/* ..., value  ==> ..., value % 0x10001         */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_LUI(REG_ITMP2, 1);
-                       M_LADD_IMM(REG_ITMP2, 1, REG_ITMP2);
-                       M_LDIV(s1, REG_ITMP2);
-                       M_MFHI(d);
-                       M_NOP;
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
-               case ICMD_LOR:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_OR( s1,s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 0xffff)) {
-                               M_OR_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_OR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 0xffff)) {
-                               M_OR_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_OR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
-               case ICMD_LXOR:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_XOR(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 0xffff)) {
-                               M_XOR_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_XOR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.l >= 0) && (iptr->val.l <= 0xffff)) {
-                               M_XOR_IMM(s1, iptr->val.l, d);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_XOR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_LCMP:       /* ..., val1, val2  ==> ..., val1 cmp val2      */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_CMPLT(s1, s2, REG_ITMP3);
-                       M_CMPLT(s2, s1, REG_ITMP1);
-                       M_LSUB (REG_ITMP1, REG_ITMP3, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
-                                     /* op1 = variable, val.i = constant             */
-
-                       var = &(locals[iptr->op1][TYPE_INT]);
-                       if (var->flags & INMEMORY) {
-                               s1 = REG_ITMP1;
-                               M_LLD(s1, REG_SP, 8 * var->regoff);
-                               }
-                       else
-                               s1 = var->regoff;
-                       M_IADD_IMM(s1, iptr->val.i, s1);
-                       if (var->flags & INMEMORY)
-                               M_LST(s1, REG_SP, 8 * var->regoff);
-                       break;
-
-
-               /* floating operations ************************************************/
-
-               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FNEG(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DNEG(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FADD(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DADD(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FSUB(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DSUB(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FMUL(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 *** val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DMUL(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FDIV(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DDIV(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-               
-               case ICMD_FREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-                       panic("FREM");
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FDIV(s1,s2, REG_FTMP3);
-                       M_FLOORFL(REG_FTMP3, REG_FTMP3);
-                       M_CVTLF(REG_FTMP3, REG_FTMP3);
-                       M_FMUL(REG_FTMP3, s2, REG_FTMP3);
-                       M_FSUB(s1, REG_FTMP3, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                   break;
-
-               case ICMD_DREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DDIV(s1,s2, REG_FTMP3);
-                       M_FLOORDL(REG_FTMP3, REG_FTMP3);
-                       M_CVTLD(REG_FTMP3, REG_FTMP3);
-                       M_DMUL(REG_FTMP3, s2, REG_FTMP3);
-                       M_DSUB(s1, REG_FTMP3, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                   break;
-
-               case ICMD_I2F:       /* ..., value  ==> ..., (float) value            */
-               case ICMD_L2F:
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_MOVLD(s1, d);
-                       M_CVTLF(d, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_I2D:       /* ..., value  ==> ..., (double) value           */
-               case ICMD_L2D:
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_MOVLD(s1, d);
-                       M_CVTLD(d, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-                       
-               case ICMD_F2I:       /* ..., (float) value  ==> ..., (int) value      */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_TRUNCFI(s1, REG_FTMP1);
-                       M_MOVDI(REG_FTMP1, d);
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-               
-               case ICMD_D2I:       /* ..., (double) value  ==> ..., (int) value     */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_TRUNCDI(s1, REG_FTMP1);
-                       M_MOVDI(REG_FTMP1, d);
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-               
-               case ICMD_F2L:       /* ..., (float) value  ==> ..., (long) value     */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_TRUNCFL(s1, REG_FTMP1);
-                       M_MOVDL(REG_FTMP1, d);
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_D2L:       /* ..., (double) value  ==> ..., (long) value    */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_TRUNCDL(s1, REG_FTMP1);
-                       M_MOVDL(REG_FTMP1, d);
-                       M_NOP;
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_CVTFD(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-                                       
-               case ICMD_D2F:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_CVTDF(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-               
-               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_FCMPUEQF(s1, s2);
-                       M_NOP;                             /* compare delay               */
-                       M_FBF(2);                          /* jump over next instructions */
-                       M_LSUB_IMM(REG_ZERO, 1, d);        /* delay slot                  */
-                       M_CLR(d);
-                       M_FCMPULTF(s2, s1);
-                       M_NOP;                             /* compare delay               */
-                       M_FBF(2);                          /* jump over next instruction  */
-                       M_NOP;
-                       M_LADD_IMM(REG_ZERO, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-                       
-               case ICMD_DCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_FCMPUEQD(s1, s2);
-                       M_NOP;                             /* compare delay               */
-                       M_FBF(2);                          /* jump over next instructions */
-                       M_LSUB_IMM(REG_ZERO, 1, d);        /* delay slot                  */
-                       M_CLR(d);
-                       M_FCMPULTD(s2, s1);
-                       M_NOP;                             /* compare delay               */
-                       M_FBF(2);                          /* jump over next instruction  */
-                       M_NOP;
-                       M_LADD_IMM(REG_ZERO, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-                       
-               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_FCMPUEQF(s1, s2);
-                       M_NOP;                             /* compare delay               */
-                       M_FBF(2);                          /* jump over next instruction  */
-                       M_LADD_IMM(REG_ZERO, 1, d);        /* delay slot                  */
-                       M_CLR(d);
-                       M_FCMPULTF(s1, s2);
-                       M_NOP;                             /* compare delay               */
-                       M_FBF(2);                          /* jump over next instruction  */
-                       M_NOP;
-                       M_LSUB_IMM(REG_ZERO, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_DCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_FCMPUEQD(s1, s2);
-                       M_NOP;                             /* compare delay               */
-                       M_FBF(2);                          /* jump over next instruction  */
-                       M_LADD_IMM(REG_ZERO, 1, d);        /* delay slot                  */
-                       M_CLR(d);
-                       M_FCMPULTD(s1, s2);
-                       M_NOP;                             /* compare delay               */
-                       M_FBF(2);                          /* jump over next instruction  */
-                       M_NOP;
-                       M_LSUB_IMM(REG_ZERO, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               /* memory operations **************************************************/
-
-#define gen_bound_check \
-                       if (checkbounds) {\
-                               M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));\
-                               M_CMPULT(s2, REG_ITMP3, REG_ITMP3);\
-                               M_BEQZ(REG_ITMP3, 0);\
-                               mcode_addxboundrefs(mcodeptr);\
-                               M_NOP;\
-                               }
-
-               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., length              */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       gen_nullptr_check(s1);
-                       M_ILD(d, s1, OFFSET(java_arrayheader, size));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_ASLL_IMM(s2, POINTERSHIFT, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_ALD(d, REG_ITMP1, OFFSET(java_objectarray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_ASLL_IMM(s2, 2, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_ILD(d, REG_ITMP1, OFFSET(java_intarray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_ASLL_IMM(s2, 3, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_LLD(d, REG_ITMP1, OFFSET(java_longarray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_ASLL_IMM(s2, 2, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_FLD(d, REG_ITMP1, OFFSET(java_floatarray, data[0]));
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_ASLL_IMM(s2, 3, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_DLD(d, REG_ITMP1, OFFSET(java_doublearray, data[0]));
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_AADD(s2, s1, REG_ITMP1);
-                       M_AADD(s2, REG_ITMP1, REG_ITMP1);
-                       M_SLDU(d, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;                  
-
-               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_AADD(s2, s1, REG_ITMP1);
-                       M_AADD(s2, REG_ITMP1, REG_ITMP1);
-                       M_SLDS(d, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_AADD(s2, s1, REG_ITMP1);
-                       M_BLDS(d, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_AASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_ASLL_IMM(s2, POINTERSHIFT, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_AST(s3, REG_ITMP1, OFFSET(java_objectarray, data[0]));
-                       break;
-
-               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_ASLL_IMM(s2, 2, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_IST(s3, REG_ITMP1, OFFSET(java_intarray, data[0]));
-                       break;
-
-               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_ASLL_IMM(s2, 3, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_LST(s3, REG_ITMP1, OFFSET(java_longarray, data[0]));
-                       break;
-
-               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_flt(s3, src, REG_FTMP3);
-                       M_ASLL_IMM(s2, 2, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_FST(s3, REG_ITMP1, OFFSET(java_floatarray, data[0]));
-                       break;
-
-               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_flt(s3, src, REG_FTMP3);
-                       M_ASLL_IMM(s2, 3, REG_ITMP2);
-                       M_AADD(REG_ITMP2, s1, REG_ITMP1);
-                       M_DST(s3, REG_ITMP1, OFFSET(java_doublearray, data[0]));
-                       break;
-
-               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
-               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_AADD(s2, s1, REG_ITMP1);
-                       M_AADD(s2, REG_ITMP1, REG_ITMP1);
-                       M_SST(s3, REG_ITMP1, OFFSET(java_chararray, data[0]));
-                       break;
-
-               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_AADD(s2, s1, REG_ITMP1);
-                       M_BST(s3, REG_ITMP1, OFFSET(java_bytearray, data[0]));
-                       break;
-
-
-               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
-                       M_ALD(REG_ITMP1, REG_PV, a);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       M_IST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       M_LST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       M_AST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       M_FST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       M_DST(s2, REG_ITMP1, 0);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
-                       M_ALD(REG_ITMP1, REG_PV, a);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_ILD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_LLD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_ADR:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_ALD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_FLT:
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       M_FLD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       M_DLD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       M_IST(s2, s1, a);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       M_LST(s2, s1, a);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       M_AST(s2, s1, a);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       gen_nullptr_check(s1);
-                                       M_FST(s2, s1, a);
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       gen_nullptr_check(s1);
-                                       M_DST(s2, s1, a);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_ILD(d, s1, a);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_LLD(d, s1, a);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_ALD(d, s1, a);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       M_FLD(d, s1, a);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       M_DLD(d, s1, a);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               /* branch operations **************************************************/
-
-#define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}}
-
-               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_INTMOVE(s1, REG_ITMP1_XPTR);
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP2, REG_PV, a);
-                       M_JSR(REG_ITMP2_XPC, REG_ITMP2);
-                       M_NOP;
-                       M_NOP;              /* nop ensures that XPC is less than the end */
-                                           /* of basic block                            */
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_GOTO:         /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-                       M_BR(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_JSR:          /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-
-                       dseg_addtarget(BlockPtrOfPC(iptr->op1));
-                       M_ALD(REG_ITMP1, REG_PV, -dseglen);
-                       M_JSR(REG_ITMP1, REG_ITMP1);        /* REG_ITMP1 = return address */
-                       M_NOP;
-                       break;
-                       
-               case ICMD_RET:          /* ... ==> ...                                */
-                                       /* op1 = local variable                       */
-                       var = &(locals[iptr->op1][TYPE_ADR]);
-                       if (var->flags & INMEMORY) {
-                               M_ALD(REG_ITMP1, REG_SP, 8 * var->regoff);
-                               M_RET(REG_ITMP1);
-                               }
-                       else
-                               M_RET(var->regoff);
-                       M_NOP;
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_IFNULL:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_BEQZ(s1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_BNEZ(s1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IFEQ:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BEQZ(s1, 0);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_BEQ(s1, REG_ITMP2, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IFLT:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BLTZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i >= -32768) && (iptr->val.i <= 32767)) {
-                                       M_CMPLT_IMM(s1, iptr->val.i, REG_ITMP1);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BNEZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IFLE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BLEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i >= -32769) && (iptr->val.i <= 32766)) {
-                                       M_CMPLT_IMM(s1, iptr->val.i + 1, REG_ITMP1);
-                                       M_BNEZ(REG_ITMP1, 0);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPGT(s1, REG_ITMP2, REG_ITMP1);
-                                       M_BEQZ(REG_ITMP1, 0);
-                                       }
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IFNE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BNEZ(s1, 0);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_BNE(s1, REG_ITMP2, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IFGT:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BGTZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i >= -32769) && (iptr->val.i <= 32766)) {
-                                       M_CMPLT_IMM(s1, iptr->val.i + 1, REG_ITMP1);
-                                       M_BEQZ(REG_ITMP1, 0);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPGT(s1, REG_ITMP2, REG_ITMP1);
-                                       M_BNEZ(REG_ITMP1, 0);
-                                       }
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IFGE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               M_BGEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.i >= -32768) && (iptr->val.i <= 32767)) {
-                                       M_CMPLT_IMM(s1, iptr->val.i, REG_ITMP1);
-                                       }
-                               else {
-                                       ICONST(REG_ITMP2, iptr->val.i);
-                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BEQZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BEQZ(s1, 0);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_BEQ(s1, REG_ITMP2, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BLTZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l >= -32768) && (iptr->val.l <= 32767)) {
-                                       M_CMPLT_IMM(s1, iptr->val.l, REG_ITMP1);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BNEZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BLEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l >= -32769) && (iptr->val.l <= 32766)) {
-                                       M_CMPLT_IMM(s1, iptr->val.l + 1, REG_ITMP1);
-                                       M_BNEZ(REG_ITMP1, 0);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPGT(s1, REG_ITMP2, REG_ITMP1);
-                                       M_BEQZ(REG_ITMP1, 0);
-                                       }
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BNEZ(s1, 0);
-                               }
-                       else {
-                               LCONST(REG_ITMP2, iptr->val.l);
-                               M_BNE(s1, REG_ITMP2, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BGTZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l >= -32769) && (iptr->val.l <= 32766)) {
-                                       M_CMPLT_IMM(s1, iptr->val.l + 1, REG_ITMP1);
-                                       M_BEQZ(REG_ITMP1, 0);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPGT(s1, REG_ITMP2, REG_ITMP1);
-                                       M_BNEZ(REG_ITMP1, 0);
-                                       }
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               M_BGEZ(s1, 0);
-                               }
-                       else {
-                               if ((iptr->val.l >= -32768) && (iptr->val.l <= 32767)) {
-                                       M_CMPLT_IMM(s1, iptr->val.l, REG_ITMP1);
-                                       }
-                               else {
-                                       LCONST(REG_ITMP2, iptr->val.l);
-                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
-                                       }
-                               M_BEQZ(REG_ITMP1, 0);
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPEQ:    /* op1 = target JavaVM pc                     */
-               case ICMD_IF_ACMPEQ:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_BEQ(s1, s2, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPNE:    /* op1 = target JavaVM pc                     */
-               case ICMD_IF_ACMPNE:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_BNE(s1, s2, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPLT:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPLT(s1, s2, REG_ITMP1);
-                       M_BNEZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPGT:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPGT(s1, s2, REG_ITMP1);
-                       M_BNEZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPLE:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPGT(s1, s2, REG_ITMP1);
-                       M_BEQZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPGE:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMPLT(s1, s2, REG_ITMP1);
-                       M_BEQZ(REG_ITMP1, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       M_NOP;
-                       break;
-
-#ifdef CONDITIONAL_LOADCONST
-               /* (value xx 0) ? IFxx_ICONST : ELSE_ICONST                           */
-
-               case ICMD_ELSE_ICONST:  /* handled by IFxx_ICONST                     */
-                       break;
-
-               case ICMD_IFEQ_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPEQ(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPEQ(s1, REG_ZERO, d);
-                                       M_XOR_IMM(d, 1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVEQ_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVEQ(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFNE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPEQ(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPEQ(s1, REG_ZERO, d);
-                                       M_XOR_IMM(d, 1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVNE_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVNE(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFLT_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPLT(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPLE(REG_ZERO, s1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVLT_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVLT(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFGE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPLE(REG_ZERO, s1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPLT(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVGE_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVGE(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFGT_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPLT(REG_ZERO, s1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPLE(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVGT_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVGT(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFLE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
-                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
-                                       M_CMPLE(s1, REG_ZERO, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
-                                       M_CMPLT(REG_ZERO, s1, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                                       }
-                               if (s1 == d) {
-                                       M_MOV(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                                       }
-                               ICONST(d, iptr[1].val.i);
-                               }
-                       if ((s3 >= 0) && (s3 <= 255)) {
-                               M_CMOVLE_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_CMOVLE(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-#endif
-
-
-               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_LRETURN:
-               case ICMD_ARETURN:
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               int disp;
-                               a = dseg_addaddress ((void*) (builtin_monitorexit));
-                               M_ALD(REG_ITMP3, REG_PV, a);
-                               M_JSR(REG_RA, REG_ITMP3);
-                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);    /* delay slot */
-                               disp = -(int)((u1*) mcodeptr - mcodebase);
-                               M_LDA(REG_PV, REG_RA, disp);
-                               }                       
-#endif
-                       var_to_reg_int(s1, src, REG_RESULT);
-                       M_INTMOVE(s1, REG_RESULT);
-                       goto nowperformreturn;
-
-               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_DRETURN:
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               int disp;
-                               a = dseg_addaddress ((void*) (builtin_monitorexit));
-                               M_ALD(REG_ITMP3, REG_PV, a);
-                               M_JSR(REG_RA, REG_ITMP3);
-                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);    /* delay slot */
-                               disp = -(int)((u1*) mcodeptr - mcodebase);
-                               M_LDA(REG_PV, REG_RA, disp);
-                               }                       
-#endif
-                       var_to_reg_flt(s1, src, REG_FRESULT);
-                       {
-                               int t = ((iptr->opc == ICMD_FRETURN) ? TYPE_FLT : TYPE_DBL);
-                               M_TFLTMOVE(t, s1, REG_FRESULT);
-                       }
-                       goto nowperformreturn;
-
-               case ICMD_RETURN:      /* ...  ==> ...                                */
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               int disp;
-                               a = dseg_addaddress ((void*) (builtin_monitorexit));
-                               M_ALD(REG_ITMP3, REG_PV, a);
-                               M_JSR(REG_RA, REG_ITMP3);
-                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);    /* delay slot */
-                               disp = -(int)((u1*) mcodeptr - mcodebase);
-                               M_LDA(REG_PV, REG_RA, disp);
-                               }                       
-#endif
-
-nowperformreturn:
-                       {
-                       int r, p;
-                       
-                       p = parentargs_base;
-                       
-                       /* restore return address                                         */
-
-                       if (!isleafmethod)
-                               {p--;  M_LLD (REG_RA, REG_SP, 8 * p);}
-
-                       /* restore saved registers                                        */
-
-                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
-                                       {p--; M_LLD(savintregs[r], REG_SP, 8 * p);}
-                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
-                                       {p--; M_DLD(savfltregs[r], REG_SP, 8 * p);}
-
-                       /* call trace function */
-
-                       if (runverbose) {
-                               M_LDA (REG_SP, REG_SP, -24);
-                               M_LST(REG_RA, REG_SP, 0);
-                               M_LST(REG_RESULT, REG_SP, 8);
-                               M_DST(REG_FRESULT, REG_SP,16);
-                               a = dseg_addaddress (method);
-                               M_ALD(argintregs[0], REG_PV, a);
-                               M_MOV(REG_RESULT, argintregs[1]);
-                               M_FLTMOVE(REG_FRESULT, argfltregs[2]);
-                               M_FMOV(REG_FRESULT, argfltregs[3]);
-                               a = dseg_addaddress ((void*) (builtin_displaymethodstop));
-                               M_ALD(REG_ITMP3, REG_PV, a);
-                               M_JSR (REG_RA, REG_ITMP3);
-                               M_NOP;
-                               M_DLD(REG_FRESULT, REG_SP,16);
-                               M_LLD(REG_RESULT, REG_SP, 8);
-                               M_LLD(REG_RA, REG_SP, 0);
-                               M_LDA (REG_SP, REG_SP, 24);
-                               }
-
-                       M_RET(REG_RA);
-
-                       /* deallocate stack                                               */
-
-                       if (parentargs_base)
-                               {M_LDA(REG_SP, REG_SP, parentargs_base*8);}
-                       else
-                               {M_NOP;}
-                       ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
-                       {
-                       s4 i, l, *s4ptr;
-                       void **tptr;
-
-                       tptr = (void **) iptr->target;
-
-                       s4ptr = iptr->val.a;
-                       l = s4ptr[1];                          /* low     */
-                       i = s4ptr[2];                          /* high    */
-                       
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (l == 0)
-                               {M_INTMOVE(s1, REG_ITMP1);}
-                       else if (l <= 32768) {
-                               M_IADD_IMM(s1, -l, REG_ITMP1);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, l);
-                               M_ISUB(s1, REG_ITMP2, REG_ITMP1);
-                               }
-                       i = i - l + 1;
-
-                       /* range check */
-
-                       M_CMPULT_IMM(REG_ITMP1, i, REG_ITMP2);
-                       M_BEQZ(REG_ITMP2, 0);
-                       mcode_addreference((basicblock *) tptr[0], mcodeptr);
-                       M_ASLL_IMM(REG_ITMP1, POINTERSHIFT, REG_ITMP1);      /* delay slot*/
-
-                       /* build jump table top down and use address of lowest entry */
-
-                       /* s4ptr += 3 + i; */
-                       tptr += i;
-
-                       while (--i >= 0) {
-                               /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
-                               dseg_addtarget((basicblock *) tptr[0]); 
-                               --tptr;
-                               }
-                       }
-
-                       /* length of dataseg after last dseg_addtarget is used by load */
-
-                       M_AADD(REG_ITMP1, REG_PV, REG_ITMP2);
-                       M_ALD(REG_ITMP2, REG_ITMP2, -dseglen);
-                       M_JMP(REG_ITMP2);
-                       M_NOP;
-                       ALIGNCODENOP;
-                       break;
-
-
-               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
-                       {
-                       s4 i, l, val, *s4ptr;
-                       void **tptr;
-
-                       tptr = (void **) iptr->target;
-
-                       s4ptr = iptr->val.a;
-                       l = s4ptr[0];                          /* default  */
-                       i = s4ptr[1];                          /* count    */
-                       
-                       MCODECHECK((i<<2)+8);
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       while (--i >= 0) {
-                               s4ptr += 2;
-                               ++tptr;
-
-                               val = s4ptr[0];
-                               ICONST(REG_ITMP2, val);
-                               M_BEQ(s1, REG_ITMP2, 0);
-                               mcode_addreference((basicblock *) tptr[0], mcodeptr); 
-                               M_NOP;
-                               }
-
-                       M_BR(0);
-                       tptr = (void **) iptr->target;
-                       mcode_addreference((basicblock *) tptr[0], mcodeptr);
-                       M_NOP;
-                       ALIGNCODENOP;
-                       break;
-                       }
-
-
-               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 3;
-                       goto gen_method;
-
-               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 2;
-                       goto gen_method;
-
-               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 1;
-                       goto gen_method;
-
-               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-                       s3 = iptr->op1;
-
-gen_method: {
-                       methodinfo   *m;
-                       classinfo    *ci;
-
-                       MCODECHECK((s3 << 1) + 64);
-
-                       /* copy arguments to registers or stack location                  */
-
-                       for (; --s3 >= 0; src = src->prev) {
-                               if (src->varkind == ARGVAR)
-                                       continue;
-                               if (IS_INT_LNG_TYPE(src->type)) {
-                                       if (s3 < INT_ARG_CNT) {
-                                               s1 = argintregs[s3];
-                                               var_to_reg_int(d, src, s1);
-                                               M_INTMOVE(d, s1);
-                                               }
-                                       else  {
-                                               var_to_reg_int(d, src, REG_ITMP1);
-                                               M_LST(d, REG_SP, 8 * (s3 - INT_ARG_CNT));
-                                               }
-                                       }
-                               else
-                                       if (s3 < FLT_ARG_CNT) {
-                                               s1 = argfltregs[s3];
-                                               var_to_reg_flt(d, src, s1);
-                                               M_TFLTMOVE(src->type,d, s1);
-                                               }
-                                       else {
-                                               var_to_reg_flt(d, src, REG_FTMP1);
-                                               M_DST(d, REG_SP, 8 * (s3 - FLT_ARG_CNT));
-                                               }
-                               } /* end of for */
-
-                       m = iptr->val.a;
-                       switch (iptr->opc) {
-                               case ICMD_BUILTIN3:
-                               case ICMD_BUILTIN2:
-                               case ICMD_BUILTIN1:
-                                       a = dseg_addaddress ((void*) (m));
-                                       M_ALD(REG_ITMP3, REG_PV, a); /* built-in-function pointer */
-                                       M_JSR (REG_RA, REG_ITMP3);
-                                       M_NOP;
-                                       d = iptr->op1;                             /* return type */
-                                       goto afteractualcall;
-
-                               case ICMD_INVOKESTATIC:
-                               case ICMD_INVOKESPECIAL:
-                                       a = dseg_addaddress (m->stubroutine);
-
-                                       M_ALD(REG_PV, REG_PV, a );        /* method pointer in pv */
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               case ICMD_INVOKEVIRTUAL:
-
-                                       gen_nullptr_check(argintregs[0]);
-                                       M_ALD(REG_METHODPTR, argintregs[0],
-                                                                OFFSET(java_objectheader, vftbl));
-                                       M_ALD(REG_PV, REG_METHODPTR, OFFSET(vftbl, table[0]) +
-                                                               sizeof(methodptr) * m->vftblindex);
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               case ICMD_INVOKEINTERFACE:
-                                       ci = m->class;
-                                       
-                                       gen_nullptr_check(argintregs[0]);
-                                       M_ALD(REG_METHODPTR, argintregs[0],
-                                                                OFFSET(java_objectheader, vftbl));    
-                                       M_ALD(REG_METHODPTR, REG_METHODPTR,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             sizeof(methodptr*) * ci->index);
-                                       M_ALD(REG_PV, REG_METHODPTR,
-                                                           sizeof(methodptr) * (m - ci->methods));
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               default:
-                                       d = 0;
-                                       sprintf (logtext, "Unkown ICMD-Command: %d", iptr->opc);
-                                       error ();
-                               }
-
-makeactualcall:
-
-                       M_JSR (REG_RA, REG_PV);
-                       M_NOP;
-
-                       /* recompute pv */
-
-afteractualcall:
-
-                       s1 = (int)((u1*) mcodeptr - mcodebase);
-                       if (s1<=32768) M_LDA (REG_PV, REG_RA, -s1);
-                       else {
-                                       s4 ml=-s1, mh=0;
-                                       while (ml<-32768) { ml+=65536; mh--; }
-                                       M_LUI(REG_PV, mh);
-                                       M_IADD_IMM(REG_PV, ml, REG_PV);
-                                       M_LADD(REG_PV, REG_RA, REG_PV);
-                               }
-
-                       /* d contains return type */
-
-                       if (d != TYPE_VOID) {
-                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
-                                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                                       M_INTMOVE(REG_RESULT, s1);
-                                       store_reg_to_var_int(iptr->dst, s1);
-                                       }
-                               else {
-                                       s1 = reg_of_var(iptr->dst, REG_FRESULT);
-                                       M_TFLTMOVE(iptr->dst->type, REG_FRESULT, s1);
-                                       store_reg_to_var_flt(iptr->dst, s1);
-                                       }
-                               }
-                       }
-                       break;
-
-
-               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          return (sub != NULL) &&
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL);
- *
- *          superclass is a class:
- *
- *          return ((sub != NULL) && (0
- *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                  super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                               }
-                       M_CLR(d);
-                       if (iptr->op1) {                               /* class/interface */
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       M_BEQZ(s1, 8);
-                                       M_NOP;
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
-                                       M_IADD_IMM(REG_ITMP2, - super->index, REG_ITMP2);
-                                       M_BLEZ(REG_ITMP2, 3);
-                                       M_NOP;
-                                       M_ALD(REG_ITMP1, REG_ITMP1,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             super->index * sizeof(methodptr*));
-                                       M_CMPULT(REG_ZERO, REG_ITMP1, d);      /* REG_ITMP1 != 0  */
-                                       }
-                               else {                                     /* class           */
-                                       /*
-                                       s2 = super->vftbl->diffval;
-                                       M_BEQZ(s1, 5);
-                                       M_NOP;
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       M_IADD_IMM(REG_ITMP1, - super->vftbl->baseval, REG_ITMP1);
-                                       M_CMPULT_IMM(REG_ITMP1, s2 + 1, d);
-                                       */
-
-                                       M_BEQZ(s1, 9);
-                                       M_NOP;
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                    a = dseg_addaddress ((void*) super->vftbl);
-                    M_ALD(REG_ITMP2, REG_PV, a);
-                    M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                    M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
-                    M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                    M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1); 
-                    M_CMPULT(REG_ITMP2, REG_ITMP1, d);
-                                       M_XOR_IMM(d, 1, d);
-
-                                       }
-                               }
-                       else
-                               panic ("internal error: no inlined array instanceof");
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          OK if ((sub == NULL) ||
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL));
- *
- *          superclass is a class:
- *
- *          OK if ((sub == NULL) || (0
- *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                 super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       var_to_reg_int(s1, src, d);
-                       if (iptr->op1) {                               /* class/interface */
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       M_BEQZ(s1, 9);
-                                       M_NOP;
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
-                                       M_IADD_IMM(REG_ITMP2, - super->index, REG_ITMP2);
-                                       M_BLEZ(REG_ITMP2, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       M_NOP;
-                                       M_ALD(REG_ITMP2, REG_ITMP1,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             super->index * sizeof(methodptr*));
-                                       M_BEQZ(REG_ITMP2, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       M_NOP;
-                                       }
-                               else {                                     /* class           */
-
-                                       /*
-                                       s2 = super->vftbl->diffval;
-                                       M_BEQZ(s1, 6 + (s2 != 0));
-                                       M_NOP;
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       M_IADD_IMM(REG_ITMP1, - super->vftbl->baseval, REG_ITMP1);
-                                       if (s2 == 0) {
-                                               M_BNEZ(REG_ITMP1, 0);
-                                               }
-                                       else{
-                                               M_CMPULT_IMM(REG_ITMP1, s2 + 1, REG_ITMP2);
-                                               M_BEQZ(REG_ITMP2, 0);
-                                               }
-                                       */
-
-                                       M_BEQZ(s1, 10 + (d == REG_ITMP3));
-                                       M_NOP;
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                    a = dseg_addaddress ((void*) super->vftbl);
-                    M_ALD(REG_ITMP2, REG_PV, a);
-                    M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       if (d != REG_ITMP3) {
-                                               M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
-                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                                               M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1); 
-                                       } else {
-                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, baseval));
-                                               M_ISUB(REG_ITMP1, REG_ITMP2, REG_ITMP1); 
-                                               M_ALD(REG_ITMP2, REG_PV, a);
-                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                                       }
-                    M_CMPULT(REG_ITMP2, REG_ITMP1, REG_ITMP2);
-                                       M_BNEZ(REG_ITMP2, 0);
-
-                                       mcode_addxcastrefs(mcodeptr);
-                                       M_NOP;
-                                       }
-                               }
-                       else
-                               panic ("internal error: no inlined array checkcast");
-                       }
-                       M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_BLTZ(s1, 0);
-                       mcode_addxcheckarefs(mcodeptr);
-                       M_NOP;
-                       break;
-
-               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
-                                     /* op1 = dimension, val.a = array descriptor    */
-
-                       /* check for negative sizes and copy sizes to stack if necessary  */
-
-                       MCODECHECK((iptr->op1 << 1) + 64);
-
-                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
-                               var_to_reg_int(s2, src, REG_ITMP1);
-                               M_BLTZ(s2, 0);
-                               mcode_addxcheckarefs(mcodeptr);
-                               M_NOP;
-
-                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
-
-                               if (src->varkind != ARGVAR) {
-                                       M_LST(s2, REG_SP, 8 * (s1 + INT_ARG_CNT));
-                                       }
-                               }
-
-                       /* a0 = dimension count */
-
-                       ICONST(argintregs[0], iptr->op1);
-
-                       /* a1 = arraydescriptor */
-
-                       a = dseg_addaddress(iptr->val.a);
-                       M_ALD(argintregs[1], REG_PV, a);
-
-                       /* a2 = pointer to dimensions = stack pointer */
-
-                       M_INTMOVE(REG_SP, argintregs[2]);
-
-                       a = dseg_addaddress((void*) (builtin_nmultianewarray));
-                       M_ALD(REG_ITMP3, REG_PV, a);
-                       M_JSR(REG_RA, REG_ITMP3);
-                       M_NOP;
-                       s1 = (int)((u1*) mcodeptr - mcodebase);
-                       if (s1 <= 32768)
-                               M_LDA (REG_PV, REG_RA, -s1);
-                       else {
-                               panic("To big");
-                           }
-                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                       M_INTMOVE(REG_RESULT, s1);
-                       store_reg_to_var_int(iptr->dst, s1);
-                       break;
-
-
-               default: sprintf (logtext, "Unknown pseudo command: %d", iptr->opc);
-                        error();
-       
-   
-
-       } /* switch */
-               
-       } /* for instruction */
-               
-       /* copy values to interface registers */
-
-       src = bptr->outstack;
-       len = bptr->outdepth;
-       MCODECHECK(64+len);
-       while (src) {
-               len--;
-               if ((src->varkind != STACKVAR)) {
-                       s2 = src->type;
-                       if (IS_FLT_DBL_TYPE(s2)) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_TFLTMOVE(s2,s1,interfaces[len][s2].regoff);
-                                       }
-                               else {
-                                       M_DST(s1, REG_SP, 8 * interfaces[len][s2].regoff);
-                                       }
-                               }
-                       else {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_INTMOVE(s1,interfaces[len][s2].regoff);
-                                       }
-                               else {
-                                       M_LST(s1, REG_SP, 8 * interfaces[len][s2].regoff);
-                                       }
-                               }
-                       }
-               src = src->prev;
-               }
-       } /* if (bptr -> flags >= BBREACHED) */
-       } /* for basic block */
-
-       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
-
-       {
-       /* generate bound check stubs */
-
-       s4 *xcodeptr = NULL;
-       
-       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
-                               xboundrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-
-               gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
-                                 xboundrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xboundrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       int disp = xcodeptr-mcodeptr;
-                       M_BR(disp-1);
-                       M_NOP;
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_JMP(REG_ITMP3);
-                       a = dseg_addaddress(proto_java_lang_ArrayIndexOutOfBoundsException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-                       }
-               }
-
-       /* generate negative array size check stubs */
-
-       xcodeptr = NULL;
-       
-       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
-                               xcheckarefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
-                                 xcheckarefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xcheckarefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       int disp = xcodeptr-mcodeptr;
-                       M_BR(disp-1);
-                       M_NOP;
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_JMP(REG_ITMP3);
-                       a = dseg_addaddress(proto_java_lang_NegativeArraySizeException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-                       }
-               }
-
-       /* generate cast check stubs */
-
-       xcodeptr = NULL;
-       
-       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
-                               xcastrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
-                                 xcastrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xcastrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       int disp = xcodeptr-mcodeptr;
-                       M_BR(disp-1);
-                       M_NOP;
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_JMP(REG_ITMP3);
-                       a = dseg_addaddress(proto_java_lang_ClassCastException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-                       }
-               }
-
-
-#ifdef SOFTNULLPTRCHECK
-
-       /* generate null pointer check stubs */
-
-       xcodeptr = NULL;
-
-       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
-                               xnullrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
-                                 xnullrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xnullrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       int disp = xcodeptr-mcodeptr;
-                       M_BR(disp-1);
-                       M_NOP;
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_JMP(REG_ITMP3);
-                       a = dseg_addaddress(proto_java_lang_NullPointerException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-                       }
-               }
-
-#endif
-       }
-
-       mcode_finish((int)((u1*) mcodeptr - mcodebase));
-
-       docacheflush((void*) method->entrypoint,
-                         ((u1*) mcodeptr - mcodebase), ICACHE);
-}
-
-
-/* redefinition of code generation macros (compiling into array) **************/
-
-/* 
-These macros are newly defined to allow code generation into an array.
-This is necessary, because the original M_.. macros generate code by
-calling 'mcode_adds4' that uses an additional data structure to
-receive the code.
-
-For a faster (but less flexible) version to generate code, these
-macros directly use the (s4* p) - pointer to put the code directly
-in a locally defined array.
-This makes sense only for the stub-generation-routines below.
-*/
-
-#undef M_ITYPE
-#define M_ITYPE(op, rs, rt, imm)\
-  *(p++) = (((op)<<26)|((rs)<<21)|((rt)<<16)|((imm)&0xffff))
-
-#undef M_JTYPE
-#define M_JTYPE(op, imm)\
-  *(p++) = (((op)<<26)|((off)&0x3ffffff))
-
-#undef M_RTYPE
-#define M_RTYPE(op, rs, rt, rd, sa, fu)\
-  *(p++) = (((op)<<26)|((rs)<<21)|((rt)<<16)|((rd)<<11)|((sa)<<6)|(fu))
-
-
-/* function createcompilerstub *************************************************
-
-       creates a stub routine which calls the compiler
-       
-*******************************************************************************/
-
-#define COMPSTUBSIZE 4
-
-u1 *createcompilerstub (methodinfo *m)
-{
-       u8 *s = CNEW (u8, COMPSTUBSIZE);    /* memory to hold the stub            */
-       s4 *p = (s4*) s;                    /* code generation pointer            */
-       
-                                           /* code for the stub                  */
-       M_ALD(REG_PV, REG_PV, 24);          /* load pointer to the compiler       */
-       M_NOP;
-       M_JSR(REG_ITMP1, REG_PV);           /* jump to the compiler, return address
-                                              in itmp1 is used as method pointer */
-       M_NOP;
-
-       s[2] = (u8) m;                      /* literals to be adressed            */  
-       s[3] = (u8) asm_call_jit_compiler;  /* jump directly via PV from above    */
-
-       (void) docacheflush((void*) s, (char*) p - (char*) s, ICACHE);
-
-#ifdef STATISTICS
-       count_cstub_len += COMPSTUBSIZE * 8;
-#endif
-
-       return (u1*) s;
-}
-
-
-/* function removecompilerstub *************************************************
-
-     deletes a compilerstub from memory  (simply by freeing it)
-
-*******************************************************************************/
-
-void removecompilerstub (u1 *stub) 
-{
-       CFREE (stub, COMPSTUBSIZE * 8);
-}
-
-/* function: createnativestub **************************************************
-
-       creates a stub routine which calls a native method
-
-*******************************************************************************/
-
-#define NATIVESTUBSIZE 20
-
-u1 *createnativestub (functionptr f, methodinfo *m)
-{
-       u8 *s = CNEW (u8, NATIVESTUBSIZE);  /* memory to hold the stub            */
-       s4 *p = (s4*) s;                    /* code generation pointer            */
-
-       reg_init();
-
-       M_MOV  (argintregs[4], argintregs[5]);
-       M_DMFC1 (REG_ITMP1, argfltregs[4]);
-
-       M_MOV  (argintregs[3], argintregs[4]);
-       M_DMTC1 (REG_ITMP1, argfltregs[5]);
-
-       M_MOV  (argintregs[2], argintregs[3]);
-       M_DMFC1 (REG_ITMP1, argfltregs[3]);
-
-       M_MOV  (argintregs[1], argintregs[2]);
-       M_DMTC1 (REG_ITMP1, argfltregs[4]);
-
-       M_MOV  (argintregs[0], argintregs[1]);
-       M_DMFC1 (REG_ITMP1, argfltregs[2]);
-
-       M_ALD  (argintregs[0], REG_PV, 19*8); /* load adress of jni_environement  */
-       M_DMTC1 (REG_ITMP1, argfltregs[3]);
-
-       M_DMFC1 (REG_ITMP1, argfltregs[1]);
-       M_DMFC1 (REG_ITMP2, argfltregs[0]);
-
-       M_DMTC1 (REG_ITMP1, argfltregs[2]);
-       M_DMTC1 (REG_ITMP2, argfltregs[1]);
-
-       M_ALD  (REG_ITMP3, REG_PV, 16*8);   /* load adress of native method       */
-       M_LDA  (REG_SP, REG_SP, -8);        /* build up stackframe                */
-
-       M_LST  (REG_RA, REG_SP, 0);         /* store return address               */
-       M_JSR  (REG_RA, REG_ITMP3);         /* call native method                 */
-
-       M_NOP;                              /* delay slot                         */
-       M_ALD  (REG_ITMP3, REG_PV, 17*8);   /* get address of exceptionptr        */
-
-       M_LLD  (REG_RA, REG_SP, 0);         /* load return address                */
-       M_ALD  (REG_ITMP1, REG_ITMP3, 0);   /* load exception into reg. itmp1     */
-
-       M_BNEZ (REG_ITMP1, 2);              /* if no exception then return        */
-       M_LDA  (REG_SP, REG_SP, 8);         /* remove stackframe, delay slot      */
-
-       M_RET  (REG_RA);                    /* return to caller                   */
-       M_NOP;                              /* delay slot                         */
-       
-       M_AST  (REG_ZERO, REG_ITMP3, 0);    /* store NULL into exceptionptr       */
-       M_ALD  (REG_ITMP3, REG_PV,18*8);    /* load asm exception handler address */
-
-       M_JMP  (REG_ITMP3);                 /* jump to asm exception handler      */
-       M_LDA  (REG_ITMP2, REG_RA, -4);     /* move fault address into reg. itmp2 */
-                                           /* delay slot                         */
-
-       s[16] = (u8) f;                     /* address of native method           */
-       s[17] = (u8) (&exceptionptr);       /* address of exceptionptr            */
-       s[18]= (u8) (asm_handle_nat_exception); /* addr of asm exception handler  */
-       s[19] = (u8) (&env);                  /* addr of jni_environement         */
-
-       (void) docacheflush((void*) s, (char*) p - (char*) s, ICACHE);
-
-#ifdef STATISTICS
-       count_nstub_len += NATIVESTUBSIZE * 8;
-#endif
-
-       return (u1*) s;
-}
-
-/* function: removenativestub **************************************************
-
-    removes a previously created native-stub from memory
-    
-*******************************************************************************/
-
-void removenativestub (u1 *stub)
-{
-       CFREE (stub, NATIVESTUBSIZE * 8);
-}
-
-
-/* function: createcalljava ****************************************************
-
-       creates the asm_calljavamethod (MIPS assembler does not like data in the
-       text segment). Documentation can be found in asmpart.c.
-       
-*******************************************************************************/
-
-#define REG_FSS0    20
-#define REG_FSS1    22
-#define REG_FSS2    25
-#define REG_FSS3    27
-#define REG_FSS4    29
-#define REG_FSS5    31
-
-#define CALL_JAVA_MEM_SIZE 60
-#define CALL_JAVA_ENTRY    20
-#define CALL_JAVA_XHANDLER 55
-
-static s4 calljavamem[CALL_JAVA_MEM_SIZE];
-
-void createcalljava ()
-{
-       s4 *p;
-       
-       *((void**)(calljavamem + 0)) = (void*) asm_call_jit_compiler;
-       *((void**)(calljavamem + 2)) = (void*) builtin_throw_exception;
-#if POINTERSIZE==8
-       *((void**)(calljavamem + 4)) = NULL;
-       *((void**)(calljavamem + 6)) = (void*) (calljavamem + CALL_JAVA_XHANDLER);
-       *((void**)(calljavamem + 8)) = (void*) (calljavamem + CALL_JAVA_XHANDLER);
-       *((void**)(calljavamem +10)) = (void*) (calljavamem + CALL_JAVA_ENTRY);
-#else
-       *((void**)(calljavamem + 8)) = NULL;
-       *((void**)(calljavamem + 9)) = (void*) (calljavamem + CALL_JAVA_XHANDLER);
-       *((void**)(calljavamem +10)) = (void*) (calljavamem + CALL_JAVA_XHANDLER);
-       *((void**)(calljavamem +11)) = (void*) (calljavamem + CALL_JAVA_ENTRY);
-#endif
-       
-       calljavamem[12] = 1;                /* extable size                       */
-       calljavamem[13] = 0;                /* fltsave                            */
-       calljavamem[14] = 0;                /* intsave                            */
-       calljavamem[15] = 0;                /* isleaf                             */
-       calljavamem[16] = 0;                /* IsSync                             */
-       calljavamem[17] = 80;               /* frame size                         */
-       calljavamem[18] = 0;                /* method pointer (NULL)              */
-       calljavamem[19] = 0;                /* method pointer (NULL)              */
-
-       p = calljavamem + CALL_JAVA_ENTRY;  /* code generation pointer            */
-
-/*  20 */
-       M_LDA (REG_SP, REG_SP, -10*8);      /* allocate stackframe                */
-       M_LST (REG_RA, REG_SP, 0);          /* save return address                */
-
-       M_BRS(1);                           /* compute current program counter    */
-       M_LST (REG_PV, REG_SP, 3*8);        /* save procedure vector              */
-/*  24 */
-       M_LDA (REG_PV, REG_RA, -4*4);       /* compute procedure vector           */
-       M_DST (REG_FSS0, REG_SP, 4*8);      /* save non JavaABI saved flt regs    */
-
-       M_DST (REG_FSS1, REG_SP, 5*8);
-       M_DST (REG_FSS2, REG_SP, 6*8);
-/*  28 */
-       M_DST (REG_FSS3, REG_SP, 7*8);
-       M_DST (REG_FSS4, REG_SP, 8*8);
-
-       M_DST (REG_FSS5, REG_SP, 9*8);
-       M_LST (REG_ARG_0, REG_SP, 2*8);     /* save method pointer for compiler   */
-/*  32 */
-       M_LDA (REG_ITMP1, REG_SP, 2*8);     /* pass pointer to methodptr via itmp1*/
-       M_MOV (REG_ARG_1, REG_ARG_0);       /* pass the remaining parameters      */
-
-       M_MOV (REG_ARG_2, REG_ARG_1);
-       M_MOV (REG_ARG_3, REG_ARG_2);
-/*  36 */
-       M_MOV (REG_ARG_4, REG_ARG_3);
-       M_ALD (REG_METHODPTR, REG_PV, -80); /* address of asm_call_jit_compiler   */
-
-       M_AST (REG_METHODPTR, REG_SP, 8);   /* store function address             */
-       M_MOV (REG_SP, REG_METHODPTR);      /* set method pointer                 */
-/*  40 */
-       M_ALD (REG_PV, REG_METHODPTR, 8);   /* method call as in Java             */
-       M_JSR (REG_RA, REG_PV);             /* call JIT compiler                  */
-
-       M_NOP;                              /* delay slot                         */
-       M_LDA (REG_PV, REG_RA, -23*4);      /* recompute procedure vector         */
-
-/*  44 */
-#if 0
-       M_CLR (REG_RESULT);                 /* clear return value (exception ptr) */
-#else
-       M_NOP;
-#endif
-/*  calljava_return: */
-       M_LLD (REG_RA, REG_SP, 0);          /* restore return address             */
-
-       M_LLD (REG_PV, REG_SP, 3*8);        /* restore procedure vector           */
-       M_DLD (REG_FSS0, REG_SP, 4*8);      /* restore non JavaABI saved flt regs */
-/*  48 */
-       M_DLD (REG_FSS1, REG_SP, 5*8);
-       M_DLD (REG_FSS2, REG_SP, 6*8);
-
-       M_DLD (REG_FSS3, REG_SP, 7*8);
-       M_DLD (REG_FSS4, REG_SP, 8*8);
-/*  52 */
-       M_DLD (REG_FSS5, REG_SP, 9*8);
-       M_RET(REG_RA);                      /* return                             */
-
-       M_LDA (REG_SP, REG_SP, 10*8);       /* deallocate stackframe (delay slot) */
-
-/*  55 */
-/*  calljava_xhandler: */
-
-       M_ALD (REG_ITMP3, REG_PV, -72);     /* address of builtin_throw_exception */
-
-       M_JSR (REG_RA, REG_ITMP3);          /* call builtin                       */
-       M_MOV (REG_ITMP1, REG_ARG_0);       /* pass parameter (delay slot)        */
-/*  58 */
-       M_BR(-14);                          /* branch calljava_return             */
-       M_NOP;                              /* delay slot                         */
-
-       (void) cacheflush((void*)(calljavamem + CALL_JAVA_ENTRY),
-              (CALL_JAVA_MEM_SIZE - CALL_JAVA_ENTRY) * (int) sizeof(s4), ICACHE);
-}
-
-
-typedef java_objectheader* (*asm_fptr)(methodinfo*, void*, void*, void*, void*);
-
-java_objectheader *asm_calljavamethod (methodinfo *m, void *arg1, void *arg2,
-                                                      void *arg3, void *arg4)
-{
-       java_objectheader *r = ((asm_fptr)(calljavamem + 20))(m, arg1, arg2, arg3, arg4);
-       return (exceptionptr ? r : NULL);
-}
-
-java_objectheader *asm_calljavafunction (methodinfo *m, void *arg1, void *arg2,
-                                                      void *arg3, void *arg4)
-{
-       return ((asm_fptr)(calljavamem + 20))(m, arg1, arg2, arg3, arg4);
-}
-
-void ngen_init()
-{
-       createcalljava();
-}
-
-void docacheflush(u1 *p, long bytelen, int dummy)
-{
-       u1 *e = p + bytelen;
-       long psize = sysconf(_SC_PAGESIZE);
-       p -= (long) p & (psize-1);
-       e += psize - ((((long) e - 1) & (psize-1)) + 1);
-       bytelen = e-p;
-       mprotect(p, bytelen, PROT_READ|PROT_WRITE|PROT_EXEC);
-}
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/mips/ngen.h b/mips/ngen.h
deleted file mode 100644 (file)
index 9c64230..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-/* mips/ngen.h *****************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the machine dependent code generator definitions and macros for an
-       Alpha processor.
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/12
-
-*******************************************************************************/
-
-#include <sys/cachectl.h>
-#include <sys/mman.h>
-
-/* see also file calling.doc for explanation of calling conventions           */
-
-/* preallocated registers *****************************************************/
-
-/* integer registers */
-  
-#define REG_ZERO        0    /* allways zero                                  */
-
-#define REG_RESULT      2    /* to deliver method results                     */ 
-
-#define REG_ITMP1       1    /* temporary register                            */
-#define REG_ITMP2       3    /* temporary register and method pointer         */
-#define REG_ITMP3       25   /* temporary register                            */
-
-#define REG_ARG_0       4    /* argument register                             */
-#define REG_ARG_1       5    /* argument register                             */
-#define REG_ARG_2       6    /* argument register                             */
-#define REG_ARG_3       7    /* argument register                             */
-#define REG_ARG_4       8    /* argument register                             */
-#define REG_ARG_5       9    /* argument register                             */
-
-#define REG_RA          31   /* return address                                */
-#define REG_SP          29   /* stack pointer                                 */
-#define REG_GP          28   /* global pointer                                */
-
-#define REG_PV          30   /* procedure vector, must be provided by caller  */
-#define REG_METHODPTR   25   /* pointer to the place from where the procedure */
-                             /* vector has been fetched                       */
-#define REG_ITMP1_XPTR  1    /* exception pointer = temporary register 1      */
-#define REG_ITMP2_XPC   3    /* exception pc = temporary register 2           */
-
-/* floating point registers */
-
-#define REG_FRESULT     0    /* to deliver floating point method results      */ 
-#define REG_FTMP1       1    /* temporary floating point register             */
-#define REG_FTMP2       2    /* temporary floating point register             */
-#define REG_FTMP3       3    /* temporary floating point register             */
-
-#define REG_IFTMP       1    /* temporary integer and floating point register */
-
-/* register descripton - array ************************************************/
-
-/* #define REG_RES   0         reserved register for OS or code generator     */
-/* #define REG_RET   1         return value register                          */
-/* #define REG_EXC   2         exception value register (only old jit)        */
-/* #define REG_SAV   3         (callee) saved register                        */
-/* #define REG_TMP   4         scratch temporary register (caller saved)      */
-/* #define REG_ARG   5         argument register (caller saved)               */
-
-/* #define REG_END   -1        last entry in tables */
-int nregdescint[] = {
-       REG_RES, REG_RES, REG_RET, REG_RES, REG_ARG, REG_ARG, REG_ARG, REG_ARG, 
-       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
-       REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
-       REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
-       REG_END };
-
-#define INT_SAV_CNT      8   /* number of int callee saved registers          */
-#define INT_ARG_CNT      8   /* number of int argument registers              */
-
-/* for use of reserved registers, see comment above */
-       
-int nregdescfloat[] = {
-       REG_RET, REG_RES, REG_RES, REG_RES, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
-       REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_ARG, REG_ARG, REG_ARG, REG_ARG, 
-       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
-       REG_SAV, REG_TMP, REG_SAV, REG_TMP, REG_SAV, REG_TMP, REG_SAV, REG_TMP,
-       REG_END };
-
-#define FLT_SAV_CNT      4   /* number of flt callee saved registers          */
-#define FLT_ARG_CNT      8   /* number of flt argument registers              */
-
-/* for use of reserved registers, see comment above */
-
-
-/* parameter allocation mode */
-
-int nreg_parammode = PARAMMODE_NUMBERED;  
-
-   /* parameter-registers will be allocated by assigning the
-      1. parameter:   int/float-reg a0
-      2. parameter:   int/float-reg a1  
-      3. parameter:   int/float-reg a2 ....
-   */
-
-
-/* stackframe-infos ***********************************************************/
-
-int parentargs_base; /* offset in stackframe for the parameter from the caller*/
-
-/* -> see file 'calling.doc' */
-
-
-/* macros to create code ******************************************************/
-
-/* code generation macros operands:
-      op ..... opcode
-      fu ..... function-number
-      rs ..... register number source 1
-      rt ..... register number or constant integer source 2
-      rd ..... register number destination
-      imm .... immediate/offset
-      sa ..... shift amount
-*/
-
-
-#define M_ITYPE(op, rs, rt, imm)\
-  *(mcodeptr++) = (((op)<<26)|((rs)<<21)|((rt)<<16)|((imm)&0xffff))
-
-#define M_JTYPE(op, imm)\
-  *(mcodeptr++) = (((op)<<26)|((off)&0x3ffffff))
-
-#define M_RTYPE(op, rs, rt, rd, sa, fu)\
-  *(mcodeptr++) = (((op)<<26)|((rs)<<21)|((rt)<<16)|((rd)<<11)|((sa)<<6)|(fu))
-
-#define M_FP2(fu, fmt, fs, fd)       M_RTYPE(0x11, fmt,  0, fs, fd, fu)
-#define M_FP3(fu, fmt, fs, ft, fd)   M_RTYPE(0x11, fmt, ft, fs, fd, fu)
-
-#define FMT_F  16
-#define FMT_D  17
-#define FMT_I  20
-#define FMT_L  21
-
-/* macros for all used commands (see a MIPS-manual for description) ***********/ 
-
-/* load/store macros use the form OPERATION(source/dest, base, offset)        */
-
-#define M_BLDS(a,b,disp)        M_ITYPE(0x20,b,a,disp)          /*  8 load    */
-#define M_BLDU(a,b,disp)        M_ITYPE(0x24,b,a,disp)          /*  8 load    */
-#define M_SLDS(a,b,disp)        M_ITYPE(0x21,b,a,disp)          /* 16 load    */
-#define M_SLDU(a,b,disp)        M_ITYPE(0x25,b,a,disp)          /* 16 load    */
-#define M_ILD(a,b,disp)         M_ITYPE(0x23,b,a,disp)          /* 32 load    */
-#define M_LLD(a,b,disp)         M_ITYPE(0x37,b,a,disp)          /* 64 load    */
-#define M_BST(a,b,disp)         M_ITYPE(0x28,b,a,disp)          /*  8 store   */
-#define M_SST(a,b,disp)         M_ITYPE(0x29,b,a,disp)          /* 16 store   */
-#define M_IST(a,b,disp)         M_ITYPE(0x2b,b,a,disp)          /* 32 store   */
-#define M_LST(a,b,disp)         M_ITYPE(0x3f,b,a,disp)          /* 64 store   */
-
-#define M_FLD(a,b,disp)         M_ITYPE(0x31,b,a,disp)          /* load flt   */
-#define M_DLD(a,b,disp)         M_ITYPE(0x35,b,a,disp)          /* load dbl   */
-#define M_FST(a,b,disp)         M_ITYPE(0x39,b,a,disp)          /* store flt  */
-#define M_DST(a,b,disp)         M_ITYPE(0x3d,b,a,disp)          /* store dbl  */
-
-#define M_BEQ(a,b,disp)         M_ITYPE(0x04,a,b,disp)          /* br a == b  */
-#define M_BNE(a,b,disp)         M_ITYPE(0x05,a,b,disp)          /* br a != b  */
-#define M_BEQZ(a,disp)          M_ITYPE(0x04,a,0,disp)          /* br a == 0  */
-#define M_BLTZ(a,disp)          M_ITYPE(0x01,a,0,disp)          /* br a <  0  */
-#define M_BLEZ(a,disp)          M_ITYPE(0x06,a,0,disp)          /* br a <= 0  */
-#define M_BNEZ(a,disp)          M_ITYPE(0x05,a,0,disp)          /* br a != 0  */
-#define M_BGEZ(a,disp)          M_ITYPE(0x01,a,1,disp)          /* br a >= 0  */
-#define M_BGTZ(a,disp)          M_ITYPE(0x07,a,0,disp)          /* br a >  0  */
-
-#define M_BEQL(a,b,disp)        M_ITYPE(0x14,a,b,disp)          /* br a == b  */
-#define M_BNEL(a,b,disp)        M_ITYPE(0x15,a,b,disp)          /* br a != b  */
-#define M_BEQZL(a,disp)         M_ITYPE(0x14,a,0,disp)          /* br a == 0  */
-#define M_BLTZL(a,disp)         M_ITYPE(0x01,a,2,disp)          /* br a <  0  */
-#define M_BLEZL(a,disp)         M_ITYPE(0x16,a,0,disp)          /* br a <= 0  */
-#define M_BNEZL(a,disp)         M_ITYPE(0x15,a,0,disp)          /* br a != 0  */
-#define M_BGEZL(a,disp)         M_ITYPE(0x01,a,3,disp)          /* br a >= 0  */
-#define M_BGTZL(a,disp)         M_ITYPE(0x17,a,0,disp)          /* br a >  0  */
-
-#define M_BR(disp)              M_ITYPE(0x04,0,0,disp)          /* branch     */
-#define M_BRS(disp)             M_ITYPE(0x01,0,17,disp)         /* branch sbr */
-
-#define M_JMP(a)                M_RTYPE(0,a,0,0,0,0x08)         /* jump       */
-#define M_JSR(r,a)              M_RTYPE(0,a,0,r,0,0x09)         /* call       */
-#define M_RET(a)                M_RTYPE(0,a,0,0,0,0x08)         /* return     */
-
-#define M_TGE(a,b,code)         M_RTYPE(0,a,b,0,code&3ff,0x30)  /* trp a >= b */
-#define M_TGEU(a,b,code)        M_RTYPE(0,a,b,0,code&3ff,0x31)  /* trp a >= b */
-#define M_TLT(a,b,code)         M_RTYPE(0,a,b,0,code&3ff,0x32)  /* trp a <  b */
-#define M_TLTU(a,b,code)        M_RTYPE(0,a,b,0,code&3ff,0x33)  /* trp a <  b */
-#define M_TEQ(a,b,code)         M_RTYPE(0,a,b,0,code&3ff,0x34)  /* trp a == b */
-#define M_TNE(a,b,code)         M_RTYPE(0,a,b,0,code&3ff,0x36)  /* trp a != b */
-#define M_TLE(a,b,code)         M_RTYPE(0,b,a,0,code&3ff,0x30)  /* trp a <= b */
-#define M_TLEU(a,b,code)        M_RTYPE(0,b,a,0,code&3ff,0x31)  /* trp a <= b */
-#define M_TGT(a,b,code)         M_RTYPE(0,b,a,0,code&3ff,0x32)  /* trp a >  b */
-#define M_TGTU(a,b,code)        M_RTYPE(0,b,a,0,code&3ff,0x33)  /* trp a >  b */
-
-#define M_TGE_IMM(a,b)          M_ITYPE(1,a,0x08,b)             /* trp a >= b */
-#define M_TGEU_IMM(a,b)         M_ITYPE(1,a,0x09,b)             /* trp a >= b */
-#define M_TLT_IMM(a,b)          M_ITYPE(1,a,0x0a,b)             /* trp a <  b */
-#define M_TLTU_IMM(a,b)         M_ITYPE(1,a,0x0b,b)             /* trp a <  b */
-#define M_TEQ_IMM(a,b)          M_ITYPE(1,a,0x0c,b)             /* trp a == b */
-#define M_TNE_IMM(a,b)          M_ITYPE(1,a,0x0e,b)             /* trp a != b */
-#if 0
-#define M_TGT_IMM(a,b)          M_ITYPE(1,a,0x08,b+1)           /* trp a >  b */
-#define M_TGTU_IMM(a,b)         M_ITYPE(1,a,0x09,b+1)           /* trp a >  b */
-#define M_TLE_IMM(a,b)          M_ITYPE(1,a,0x0a,b+1)           /* trp a <= b */
-#define M_TLEU_IMM(a,b)         M_ITYPE(1,a,0x0b,b+1)           /* trp a <= b */
-#endif
-
-/* arithmetic macros use the form OPERATION(source, source/immediate, dest)   */
-
-#define M_IADD(a,b,c)           M_RTYPE(0,a,b,c,0,0x21)         /* 32 add     */
-#define M_LADD(a,b,c)           M_RTYPE(0,a,b,c,0,0x2d)         /* 64 add     */
-#define M_ISUB(a,b,c)           M_RTYPE(0,a,b,c,0,0x23)         /* 32 sub     */
-#define M_LSUB(a,b,c)           M_RTYPE(0,a,b,c,0,0x2f)         /* 64 sub     */
-#define M_IMUL(a,b)             M_ITYPE(0,a,b,0x18)             /* 32 mul     */
-#define M_LMUL(a,b)             M_ITYPE(0,a,b,0x1c)             /* 64 mul     */
-#define M_IDIV(a,b)             M_ITYPE(0,a,b,0x1a)             /* 32 div     */
-#define M_LDIV(a,b)             M_ITYPE(0,a,b,0x1e)             /* 64 div     */
-
-#define M_MFLO(a)                      M_RTYPE(0,0,0,a,0,0x12)         /* quotient   */
-#define M_MFHI(a)                      M_RTYPE(0,0,0,a,0,0x10)         /* remainder  */
-
-#define M_IADD_IMM(a,b,c)       M_ITYPE(0x09,a,c,b)             /* 32 add     */
-#define M_LADD_IMM(a,b,c)       M_ITYPE(0x19,a,c,b)             /* 64 add     */
-#define M_ISUB_IMM(a,b,c)       M_ITYPE(0x09,a,c,-(b))          /* 32 sub     */
-#define M_LSUB_IMM(a,b,c)       M_ITYPE(0x19,a,c,-(b))          /* 64 sub     */
-
-#define M_LUI(a,imm)            M_ITYPE(0x0f,0,a,imm)           /* a = imm<<16*/
-
-#define M_CMPLT(a,b,c)          M_RTYPE(0,a,b,c,0,0x2a)         /* c = a <  b */
-#define M_CMPGT(a,b,c)          M_RTYPE(0,b,a,c,0,0x2a)         /* c = a >  b */
-
-#define M_CMPULT(a,b,c)         M_RTYPE(0,a,b,c,0,0x2b)         /* c = a <  b */
-#define M_CMPUGT(a,b,c)         M_RTYPE(0,b,a,c,0,0x2b)         /* c = a >  b */
-
-#define M_CMPLT_IMM(a,b,c)      M_ITYPE(0x0a,a,c,b)             /* c = a <  b */
-#define M_CMPULT_IMM(a,b,c)     M_ITYPE(0x0b,a,c,b)             /* c = a <  b */
-
-#define M_AND(a,b,c)            M_RTYPE(0,a,b,c,0,0x24)         /* c = a &  b */
-#define M_OR( a,b,c)            M_RTYPE(0,a,b,c,0,0x25)         /* c = a |  b */
-#define M_XOR(a,b,c)            M_RTYPE(0,a,b,c,0,0x26)         /* c = a ^  b */
-
-#define M_AND_IMM(a,b,c)        M_ITYPE(0x0c,a,c,b)             /* c = a &  b */
-#define M_OR_IMM( a,b,c)        M_ITYPE(0x0d,a,c,b)             /* c = a |  b */
-#define M_XOR_IMM(a,b,c)        M_ITYPE(0x0e,a,c,b)             /* c = a ^  b */
-
-#define M_CZEXT(a,c)            M_AND_IMM(a,0xffff,c)           /* c = zext(a)*/
-
-#define M_ISLL(a,b,c)           M_RTYPE(0,b,a,c,0,0x04)         /* c = a << b */
-#define M_ISRL(a,b,c)           M_RTYPE(0,b,a,c,0,0x06)         /* c = a >>>b */
-#define M_ISRA(a,b,c)           M_RTYPE(0,b,a,c,0,0x07)         /* c = a >> b */
-#define M_LSLL(a,b,c)           M_RTYPE(0,b,a,c,0,0x14)         /* c = a << b */
-#define M_LSRL(a,b,c)           M_RTYPE(0,b,a,c,0,0x16)         /* c = a >>>b */
-#define M_LSRA(a,b,c)           M_RTYPE(0,b,a,c,0,0x17)         /* c = a >> b */
-
-#define M_ISLL_IMM(a,b,c)       M_RTYPE(0,0,a,c,(b)&31,0x00)    /* c = a << b */
-#define M_ISRL_IMM(a,b,c)       M_RTYPE(0,0,a,c,(b)&31,0x02)    /* c = a >>>b */
-#define M_ISRA_IMM(a,b,c)       M_RTYPE(0,0,a,c,(b)&31,0x03)    /* c = a >> b */
-#define M_LSLL_IMM(a,b,c) M_RTYPE(0,0,a,c,(b)&31,0x38+((b)>>3&4)) /*c = a << b*/
-#define M_LSRL_IMM(a,b,c) M_RTYPE(0,0,a,c,(b)&31,0x3a+((b)>>3&4)) /*c = a >>>b*/
-#define M_LSRA_IMM(a,b,c) M_RTYPE(0,0,a,c,(b)&31,0x3b+((b)>>3&4)) /*c = a >> b*/
-
-#define M_MOV(a,c)              M_OR(a,0,c)                     /* c = a      */
-#define M_CLR(c)                M_OR(0,0,c)                     /* c = 0      */
-#define M_NOP                   M_ISLL_IMM(0,0,0)               /* ;          */
-
-/* floating point macros use the form OPERATION(source, source, dest)         */
-
-#define M_FADD(a,b,c)           M_FP3(0x00,FMT_F,a,b,c)         /* flt add    */
-#define M_DADD(a,b,c)           M_FP3(0x00,FMT_D,a,b,c)         /* dbl add    */
-#define M_FSUB(a,b,c)           M_FP3(0x01,FMT_F,a,b,c)         /* flt sub    */
-#define M_DSUB(a,b,c)           M_FP3(0x01,FMT_D,a,b,c)         /* dbl sub    */
-#define M_FMUL(a,b,c)           M_FP3(0x02,FMT_F,a,b,c)         /* flt mul    */
-#define M_DMUL(a,b,c)           M_FP3(0x02,FMT_D,a,b,c)         /* dbl mul    */
-#define M_FDIV(a,b,c)           M_FP3(0x03,FMT_F,a,b,c)         /* flt div    */
-#define M_DDIV(a,b,c)           M_FP3(0x03,FMT_D,a,b,c)         /* dbl div    */
-
-#define M_FSQRT(a,c)            M_FP2(0x04,FMT_F,a,c)           /* flt sqrt   */
-#define M_DSQRT(a,c)            M_FP2(0x04,FMT_D,a,c)           /* dbl sqrt   */
-#define M_FABS(a,c)             M_FP2(0x05,FMT_F,a,c)           /* flt abs    */
-#define M_DABS(a,c)             M_FP2(0x05,FMT_D,a,c)           /* dbl abs    */
-#define M_FMOV(a,c)             M_FP2(0x06,FMT_F,a,c)           /* flt mov    */
-#define M_DMOV(a,c)             M_FP2(0x06,FMT_D,a,c)           /* dbl mov    */
-#define M_FNEG(a,c)             M_FP2(0x07,FMT_F,a,c)           /* flt neg    */
-#define M_DNEG(a,c)             M_FP2(0x07,FMT_D,a,c)           /* dbl neg    */
-
-#define M_ROUNDFI(a,c)          M_FP2(0x0c,FMT_F,a,c)           /* flt roundi */
-#define M_ROUNDDI(a,c)          M_FP2(0x0c,FMT_D,a,c)           /* dbl roundi */
-#define M_TRUNCFI(a,c)          M_FP2(0x0d,FMT_F,a,c)           /* flt trunci */
-#define M_TRUNCDI(a,c)          M_FP2(0x0d,FMT_D,a,c)           /* dbl trunci */
-#define M_CEILFI(a,c)           M_FP2(0x0e,FMT_F,a,c)           /* flt ceili  */
-#define M_CEILDI(a,c)           M_FP2(0x0e,FMT_D,a,c)           /* dbl ceili  */
-#define M_FLOORFI(a,c)          M_FP2(0x0f,FMT_F,a,c)           /* flt trunci */
-#define M_FLOORDI(a,c)          M_FP2(0x0f,FMT_D,a,c)           /* dbl trunci */
-
-#define M_ROUNDFL(a,c)          M_FP2(0x08,FMT_F,a,c)           /* flt roundl */
-#define M_ROUNDDL(a,c)          M_FP2(0x08,FMT_D,a,c)           /* dbl roundl */
-#define M_TRUNCFL(a,c)          M_FP2(0x09,FMT_F,a,c)           /* flt truncl */
-#define M_TRUNCDL(a,c)          M_FP2(0x09,FMT_D,a,c)           /* dbl truncl */
-#define M_CEILFL(a,c)           M_FP2(0x0a,FMT_F,a,c)           /* flt ceill  */
-#define M_CEILDL(a,c)           M_FP2(0x0a,FMT_D,a,c)           /* dbl ceill  */
-#define M_FLOORFL(a,c)          M_FP2(0x0b,FMT_F,a,c)           /* flt truncl */
-#define M_FLOORDL(a,c)          M_FP2(0x0b,FMT_D,a,c)           /* dbl truncl */
-
-#define M_CVTDF(a,c)            M_FP2(0x20,FMT_D,a,c)           /* dbl2flt    */
-#define M_CVTIF(a,c)            M_FP2(0x20,FMT_I,a,c)           /* int2flt    */
-#define M_CVTLF(a,c)            M_FP2(0x20,FMT_L,a,c)           /* long2flt   */
-#define M_CVTFD(a,c)            M_FP2(0x21,FMT_F,a,c)           /* flt2dbl    */
-#define M_CVTID(a,c)            M_FP2(0x21,FMT_I,a,c)           /* int2dbl    */
-#define M_CVTLD(a,c)            M_FP2(0x21,FMT_L,a,c)           /* long2dbl   */
-#define M_CVTFI(a,c)            M_FP2(0x24,FMT_F,a,c)           /* flt2int    */
-#define M_CVTDI(a,c)            M_FP2(0x24,FMT_D,a,c)           /* dbl2int    */
-#define M_CVTFL(a,c)            M_FP2(0x25,FMT_F,a,c)           /* flt2long   */
-#define M_CVTDL(a,c)            M_FP2(0x25,FMT_D,a,c)           /* dbl2long   */
-
-#define M_MOVDI(d,i)            M_FP3(0,0,d,i,0)                /* i = d      */
-#define M_MOVDL(d,l)            M_FP3(0,1,d,l,0)                /* l = d      */
-#define M_MOVID(i,d)            M_FP3(0,4,d,i,0)                /* d = i      */
-#define M_MOVLD(l,d)            M_FP3(0,5,d,l,0)                /* d = l      */
-
-#define M_DMFC1(l,f)                           M_FP3(0,1,f,l,0)
-#define M_DMTC1(l,f)                           M_FP3(0,5,f,l,0)
-
-#define M_FCMPFF(a,b)           M_FP3(0x30,FMT_F,a,b,0)         /* c = a == b */
-#define M_FCMPFD(a,b)           M_FP3(0x30,FMT_D,a,b,0)         /* c = a == b */
-#define M_FCMPUNF(a,b)          M_FP3(0x31,FMT_F,a,b,0)         /* c = a == b */
-#define M_FCMPUND(a,b)          M_FP3(0x31,FMT_D,a,b,0)         /* c = a == b */
-#define M_FCMPEQF(a,b)          M_FP3(0x32,FMT_F,a,b,0)         /* c = a == b */
-#define M_FCMPEQD(a,b)          M_FP3(0x32,FMT_D,a,b,0)         /* c = a == b */
-#define M_FCMPUEQF(a,b)         M_FP3(0x33,FMT_F,a,b,0)         /* c = a == b */
-#define M_FCMPUEQD(a,b)         M_FP3(0x33,FMT_D,a,b,0)         /* c = a == b */
-#define M_FCMPOLTF(a,b)         M_FP3(0x34,FMT_F,a,b,0)         /* c = a <  b */
-#define M_FCMPOLTD(a,b)         M_FP3(0x34,FMT_D,a,b,0)         /* c = a <  b */
-#define M_FCMPULTF(a,b)         M_FP3(0x35,FMT_F,a,b,0)         /* c = a <  b */
-#define M_FCMPULTD(a,b)         M_FP3(0x35,FMT_D,a,b,0)         /* c = a <  b */
-#define M_FCMPOLEF(a,b)         M_FP3(0x36,FMT_F,a,b,0)         /* c = a <= b */
-#define M_FCMPOLED(a,b)         M_FP3(0x36,FMT_D,a,b,0)         /* c = a <= b */
-#define M_FCMPULEF(a,b)         M_FP3(0x37,FMT_F,a,b,0)         /* c = a <= b */
-#define M_FCMPULE(a,b)          M_FP3(0x37,FMT_D,a,b,0)         /* c = a <= b */
-
-#define M_FBF(disp)             M_ITYPE(0x11,8,0,disp)          /* br false   */
-#define M_FBT(disp)             M_ITYPE(0x11,8,1,disp)          /* br true    */
-#define M_FBFL(disp)            M_ITYPE(0x11,8,2,disp)          /* br false   */
-#define M_FBTL(disp)            M_ITYPE(0x11,8,3,disp)          /* br true    */
-
-/*
- * Load Address pseudo instruction:
- * -n32 addressing mode -> 32 bit addrs, -64 addressing mode -> 64 bit addrs
- */
-#if POINTERSIZE==8
-#define POINTERSHIFT 3
-#define M_ALD(a,b,disp)         M_LLD(a,b,disp)
-#define M_AST(a,b,disp)         M_LST(a,b,disp)
-#define M_AADD(a,b,c)           M_LADD(a,b,c)
-#define M_ASLL_IMM(a,b,c)       M_LSLL_IMM(a,b,c)
-#define M_LDA(a,b,disp)         M_LADD_IMM(b,disp,a)            /* a = b+disp */
-#else
-#define POINTERSHIFT 2
-#define M_ALD(a,b,disp)         M_ILD(a,b,disp)
-#define M_AST(a,b,disp)         M_IST(a,b,disp)
-#define M_AADD(a,b,c)           M_IADD(a,b,c)
-#define M_ASLL_IMM(a,b,c)       M_ISLL_IMM(a,b,c)
-#define M_LDA(a,b,disp)         M_IADD_IMM(b,disp,a)            /* a = b+disp */
-#endif
-
-/* macros for special commands (see an Alpha-manual for description) **********/ 
-
-#if 0
-#define M_CMOVEQ(a,b,c)         M_OP3 (0x11,0x24, a,b,c,0)     /* a==0 ? c=b  */
-#define M_CMOVNE(a,b,c)         M_OP3 (0x11,0x26, a,b,c,0)     /* a!=0 ? c=b  */
-#define M_CMOVLT(a,b,c)         M_OP3 (0x11,0x44, a,b,c,0)     /* a< 0 ? c=b  */
-#define M_CMOVGE(a,b,c)         M_OP3 (0x11,0x46, a,b,c,0)     /* a>=0 ? c=b  */
-#define M_CMOVLE(a,b,c)         M_OP3 (0x11,0x64, a,b,c,0)     /* a<=0 ? c=b  */
-#define M_CMOVGT(a,b,c)         M_OP3 (0x11,0x66, a,b,c,0)     /* a> 0 ? c=b  */
-
-#define M_CMOVEQ_IMM(a,b,c)     M_OP3 (0x11,0x24, a,b,c,1)     /* a==0 ? c=b  */
-#define M_CMOVNE_IMM(a,b,c)     M_OP3 (0x11,0x26, a,b,c,1)     /* a!=0 ? c=b  */
-#define M_CMOVLT_IMM(a,b,c)     M_OP3 (0x11,0x44, a,b,c,1)     /* a< 0 ? c=b  */
-#define M_CMOVGE_IMM(a,b,c)     M_OP3 (0x11,0x46, a,b,c,1)     /* a>=0 ? c=b  */
-#define M_CMOVLE_IMM(a,b,c)     M_OP3 (0x11,0x64, a,b,c,1)     /* a<=0 ? c=b  */
-#define M_CMOVGT_IMM(a,b,c)     M_OP3 (0x11,0x66, a,b,c,1)     /* a> 0 ? c=b  */
-#endif
-
-/* function gen_resolvebranch **************************************************
-
-       backpatches a branch instruction; MIPS branch instructions are very
-       regular, so it is only necessary to overwrite some fixed bits in the
-       instruction.
-
-       parameters: ip ... pointer to instruction after branch (void*)
-                   so ... offset of instruction after branch  (s4)
-                   to ... offset of branch target             (s4)
-
-*******************************************************************************/
-
-#define gen_resolvebranch(ip,so,to) ((s4*)(ip))[-1]|=((s4)(to)-(so))>>2&0xffff
-
-#define SOFTNULLPTRCHECK       /* soft null pointer check supportet as option */
-
-void ngen_init();
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/mips/threads.h b/mips/threads.h
deleted file mode 100644 (file)
index c77ad9a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************** threads.h **************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       System dependent part of thread header file.
-
-       Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/19
-
-*******************************************************************************/
-
-
-#ifndef __sysdep_threads_h
-#define __sysdep_threads_h
-
-#include "config.h"
-#include "threads/thread.h"
-
-/* Thread handling */
-
-/* prototypes */
-
-void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
-u1*  asm_initialize_thread_stack (void *func, u1 *stack);
-
-/* access macros */
-
-#define        THREADSTACKSIZE         (32 * 1024)
-
-#define        THREADSWITCH(to, from)  asm_perform_threadswitch(&(from)->restorePoint,\
-                                    &(to)->restorePoint, &(from)->usedStackTop)
-
-#define THREADINIT(to, func)    (to)->restorePoint =                         \
-                                    asm_initialize_thread_stack((u1*)(func), \
-                                                            (to)->stackEnd)
-
-#define        THREADINFO(e)                               \
-               do {                                        \
-                       (e)->restorePoint = 0;                  \
-                       (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
-               } while(0)
-
-#endif
diff --git a/mips/types.h b/mips/types.h
deleted file mode 100644 (file)
index 4ade237..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* alpha/types.h ***************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       machine specific definitions for the Alpha processor
-       
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/09/22
-
-*******************************************************************************/
-
-#ifndef _CACAO_TYPES_H
-
-#define _CACAO_TYPES_H
-
-#define POINTERSIZE         8
-#define WORDS_BIGENDIAN     1
-
-#define SUPPORT_DIVISION    0
-#define SUPPORT_LONG        1
-#define SUPPORT_FLOAT       1
-#define SUPPORT_DOUBLE      1
-
-#define SUPPORT_LONG_ADD    1
-#define SUPPORT_LONG_CMP    1
-#define SUPPORT_LONG_LOG    1
-#define SUPPORT_LONG_SHIFT  1
-#define SUPPORT_LONG_MULDIV 1
-#define SUPPORT_LONG_ICVT   1
-#define SUPPORT_LONG_FCVT   1
-
-#define U8_AVAILABLE        1
-
-
-typedef signed char             s1;
-typedef unsigned char           u1;
-typedef signed short int        s2;
-typedef unsigned short int      u2;
-
-typedef signed int              s4;
-typedef unsigned int            u4;
-
-#if U8_AVAILABLE
-typedef signed long int         s8;
-typedef unsigned long int       u8; 
-#else
-typedef struct {u4 low, high;}  u8;
-#define s8 u8
-#endif
-
-#endif
-
index 39bb95a45dd74570338e7f7aea86ae78b3d19e61..89ae48f12f07a5326c5afced482341866e2c23e5 100644 (file)
@@ -1,7 +1,20 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
 SUBDIRS = boehm-gc
 
 noinst_LIBRARIES = libboehm.a
 
 libboehm_a_SOURCES = boehm.c
 
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@ -I./boehm-gc/include
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@ -I./boehm-gc/include
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
index 2feeed3cbab76830988e7ca7abbb1ad90f0f589a..4048887967962554a09c6612082083b3df4a8da3 100644 (file)
@@ -10,6 +10,8 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+# $Id: Makefile.in 557 2003-11-02 22:51:59Z twisti $
+
 
 SHELL = @SHELL@
 
@@ -59,25 +61,23 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 host_alias = @host_alias@
 host_triplet = @host@
-ASMPART = @ASMPART@
-BOEHM_LIB = @BOEHM_LIB@
+ARCH_DIR = @ARCH_DIR@
 CC = @CC@
 COMPILER_OBJECTS = @COMPILER_OBJECTS@
-GC_OBJ = @GC_OBJ@
 LIBTHREAD = @LIBTHREAD@
 MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
-SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
-EXTRA_LIBRARIES = libboehm.a
-noinst_LIBRARIES = @BOEHM_LIB@
+SUBDIRS = boehm-gc
+
+noinst_LIBRARIES = libboehm.a
 
 libboehm_a_SOURCES = boehm.c
 
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@ -I./boehm-gc/include
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -147,6 +147,61 @@ libboehm.a: $(libboehm_a_OBJECTS) $(libboehm_a_DEPENDENCIES)
        $(AR) cru libboehm.a $(libboehm_a_OBJECTS) $(libboehm_a_LIBADD)
        $(RANLIB) libboehm.a
 
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive  \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+       @set fnord $(MAKEFLAGS); amf=$$2; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @set fnord $(MAKEFLAGS); amf=$$2; \
+       dot_seen=no; \
+       rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+         rev="$$subdir $$rev"; \
+         test "$$subdir" != "." || dot_seen=yes; \
+       done; \
+       test "$$dot_seen" = "no" && rev=". $$rev"; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+
 tags: TAGS
 
 ID: $(HEADERS) $(SOURCES) $(LISP)
@@ -157,9 +212,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP)
        here=`pwd` && cd $(srcdir) \
          && mkid -f$$here/ID $$unique $(LISP)
 
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
        tags=; \
        here=`pwd`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+   if test "$$subdir" = .; then :; else \
+           test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+   fi; \
+       done; \
        list='$(SOURCES) $(HEADERS)'; \
        unique=`for i in $$list; do echo $$i; done | \
          awk '    { files[$$0] = 1; } \
@@ -196,6 +256,16 @@ distdir: $(DISTFILES)
            || cp -p $$d/$$file $(distdir)/$$file || :; \
          fi; \
        done
+       for subdir in $(SUBDIRS); do \
+         if test "$$subdir" = .; then :; else \
+           test -d $(distdir)/$$subdir \
+           || mkdir $(distdir)/$$subdir \
+           || exit 1; \
+           chmod 777 $(distdir)/$$subdir; \
+           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
+             || exit 1; \
+         fi; \
+       done
 
 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
 
@@ -229,29 +299,30 @@ maintainer-clean-depend:
            >> .deps/$(*F).P; \
        rm -f .deps/$(*F).pp
 info-am:
-info: info-am
+info: info-recursive
 dvi-am:
-dvi: dvi-am
+dvi: dvi-recursive
 check-am: all-am
-check: check-am
+check: check-recursive
 installcheck-am:
-installcheck: installcheck-am
+installcheck: installcheck-recursive
 install-exec-am:
-install-exec: install-exec-am
+install-exec: install-exec-recursive
 
 install-data-am:
-install-data: install-data-am
+install-data: install-data-recursive
 
 install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
+install: install-recursive
 uninstall-am:
-uninstall: uninstall-am
+uninstall: uninstall-recursive
 all-am: Makefile $(LIBRARIES)
-all-redirect: all-am
+all-redirect: all-recursive
 install-strip:
        $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
+installdirs: installdirs-recursive
+installdirs-am:
 
 
 mostlyclean-generic:
@@ -266,18 +337,18 @@ maintainer-clean-generic:
 mostlyclean-am:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
                mostlyclean-tags mostlyclean-depend mostlyclean-generic
 
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
 
 clean-am:  clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
                clean-generic mostlyclean-am
 
-clean: clean-am
+clean: clean-recursive
 
 distclean-am:  distclean-noinstLIBRARIES distclean-compile \
                distclean-tags distclean-depend distclean-generic \
                clean-am
 
-distclean: distclean-am
+distclean: distclean-recursive
 
 maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
                maintainer-clean-compile maintainer-clean-tags \
@@ -286,19 +357,25 @@ maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
        @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
+maintainer-clean: maintainer-clean-recursive
 
 .PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
 clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
 mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile tags mostlyclean-tags distclean-tags \
-clean-tags maintainer-clean-tags distdir mostlyclean-depend \
-distclean-depend clean-depend maintainer-clean-depend info-am info \
-dvi-am dvi check check-am installcheck-am installcheck 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
+maintainer-clean-compile install-data-recursive \
+uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs-am 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.
index 892b8e159022dc1d95611fde03396acf8db47521..cfdde8dd6226ad4d514354664591d1e614dee225 100644 (file)
@@ -1,23 +1,40 @@
-/* boehm.c *********************************************************************
+/* mm/boehm.c - interface for boehm gc
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains the interface to the Boehm GC
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Andi Krall          EMAIL: cacao@complang.tuwien.ac.at
-                Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                        Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: $Id: boehm.c 512 2003-10-22 20:47:18Z twisti $
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Stefan Ring
+
+   $Id: boehm.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include "global.h"
 #include "threads/thread.h"
 #include "asmpart.h"
+#include "toolbox/loging.h"
 
 /* this is temporary workaround */
 #if defined(__X86_64__)
@@ -142,6 +159,7 @@ void gc_call()
        GC_gcollect();
 }
 
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
diff --git a/narray/Makefile.am b/narray/Makefile.am
deleted file mode 100644 (file)
index 482b098..0000000
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_DIST = graph.c loop.c analyze.c tracing.c loop.h 
diff --git a/narray/analyze.c b/narray/analyze.c
deleted file mode 100644 (file)
index b8a2c86..0000000
+++ /dev/null
@@ -1,3577 +0,0 @@
-/* analyze.c *******************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties.
-
-       Contains the functions which perform the bound check removals. With 
-       the loops identified, these functions scan the code for array accesses
-       that take place in loops and try to guarantee that their bounds are
-       never violated. The function to call is optimize_loops().
-
-       Authors: Christopher Kruegel      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/17/02
-
-*******************************************************************************/
-#ifdef LOOP_DEBUG
-
-/*     Test functions -> will be removed in final release
-*/
-
-void show_trace(struct Trace *trace)
-{
-       if (trace != NULL) {
-               switch (trace->type) {
-               case TRACE_IVAR:
-                       printf("int-var");
-                       printf("\nNr.:\t%d", trace->var);
-                       printf("\nValue:\t%d", trace->constant);
-                       break;
-      
-               case TRACE_AVAR:
-                       printf("object-var");
-                       printf("\nNr.:\t%d", trace->var);
-                       break;
-      
-               case TRACE_ALENGTH:
-                       printf("array-length");
-                       printf("\nNr.:\t%d", trace->var);
-                       printf("\nValue:\t%d", trace->constant);
-                       break;
-
-               case TRACE_ICONST:
-                       printf("int-const");
-                       printf("\nValue:\t%d", trace->constant);
-                       break;
-      
-               case TRACE_UNKNOWN:
-                       printf("unknown");
-                       break;
-                       }
-               }
-       else
-               printf("Trace is null");
-       
-       printf("\n");
-}
-
-
-void show_change(struct Changes *c)
-{
-       printf("*** Changes ***\n");
-       if (c != NULL)
-               printf("Lower/Upper Bound:\t%d/%d\n", c->lower_bound, c->upper_bound);
-       else
-               printf("Unrestricted\n");
-}
-
-show_varinfo(struct LoopVar *lv)
-{
-       printf("   *** Loop Info ***\n");
-       printf("Value:\t%d\n", lv->value);
-       printf("Static:\t\t%d/%d\n", lv->static_l, lv->static_u);
-       printf("D-Valid:\t%d/%d\n", lv->dynamic_l_v, lv->dynamic_u_v);
-       printf("Dynamic\t\t%d/%d\n", lv->dynamic_l, lv->dynamic_u);
-}
-
-void show_right_side()
-{
-       int i;
-       printf("\n   *** Head ***   \nType:\t");
-       show_trace(c_rightside);
-
-       printf("\n   *** Nested Loops: ***\n");
-       for (i=0; i<block_count; ++i) 
-               printf("%d\t", c_nestedLoops[i]);
-       printf("\n");
-
-       printf("\n   *** Hierarchie: ***\n");   
-       for (i=0; i<block_count; ++i) 
-               printf("%d\t", c_hierarchie[i]);
-       printf("\n");
-       
-
-       printf("\n   *** Current Loop ***\n");
-       for (i=0; i<block_count; ++i)
-           printf("%d\t", c_current_loop[i]);
-       printf("\n");
-}
-
-void resultPass3()
-{
-       int i;
-       struct LoopContainer *lc = c_allLoops;
-  
-       printf("\n\n****** PASS 3 ******\n\n");
-  
-       while (lc != NULL) {
-               printf("Loop Analysis:\n");
-               printf("Optimize:\t%d\n", lc->toOpt);
-               printf("Modified Vars: ");
-               /*
-               for (i=0; i<lc->num_vars; ++i)
-                 printf("%d ", lc->vars[i]);
-               printf("\n\n");
-               */
-               lc = lc->next;
-               }
-
-       printf("\nNested Loops:\n");
-       for (i=0; i<block_count; ++i)
-           printf("%d ", c_nestedLoops[i]);
-       printf("\n");
-       for (i=0; i<block_count; ++i) 
-               printf("%d ", c_hierarchie[i]);
-       printf("\n");
-       fflush(stdout);
-}
-
-void show_tree(struct LoopContainer *lc, int tabs) 
-{
-       int cnt;
-
-       while (lc != NULL) {
-               for (cnt = 0; cnt < tabs; ++cnt)
-                       printf("  ");
-               printf("%d\n", lc->loop_head);
-
-               show_tree(lc->tree_down, tabs+1);
-
-               lc = lc->tree_right;
-       }
-}
-
-#endif
-
-#ifdef STATISTICS
-
-void show_loop_statistics()
-{
-       printf("\n\n****** LOOP STATISTICS ****** \n\n");
-       if (c_stat_or) 
-           printf("Optimization cancelled by or\n");
-       else if (c_stat_exception)
-           printf("Optimization cancelled by exception\n");
-       else {
-               printf("Number of array accesses:\t%d\n", c_stat_array_accesses);
-               if (c_stat_array_accesses) {
-                       printf("\nFully optimized:\t%d\n", c_stat_full_opt);
-                       printf("Not optimized:\t\t%d\n", c_stat_no_opt);
-                       printf("Upper optimized:\t%d\n", c_stat_upper_opt);
-                       printf("Lower optimized:\t%d\n", c_stat_lower_opt);
-                       }
-               }
-}
-
-void show_procedure_statistics()
-{
-       printf("\n\n****** PROCEDURE STATISTICS ****** \n\n");
-       printf("Number of loops:\t\t%d\n", c_stat_num_loops);
-       printf("Number of array accesses:\t%d\n", c_stat_sum_accesses);
-       if (c_stat_sum_accesses) {
-               printf("\nFully optimized:\t%d\n", c_stat_sum_full);
-               printf("Not optimized:\t\t%d\n", c_stat_sum_no);
-               printf("Upper optimized:\t%d\n", c_stat_sum_upper);
-               printf("Lower optimized:\t%d\n", c_stat_sum_lower);
-               }
-       printf("Opt. cancelled by or:\t\t%d\n", c_stat_sum_or);
-       printf("Opt. cancelled by exception:\t%d\n", c_stat_sum_exception);
-}
-
-#endif
-
-
-/*     This function is used to merge two loops with the same header together.
-       A simple merge sort of the lists nodes of both loops is performed.
-*/
-void analyze_merge(struct LoopContainer *l1, struct LoopContainer *l2)
-{
-       struct LoopElement *start, *last, *le1, *le2; 
-       /* start and last are pointers to the newly built list, le1 and le2 step  */
-       /* step through the lists, that have to be merged.                        */
-
-       le1 = l1->nodes;
-       le2 = l2->nodes;
-
-       /* start a simple merge sort of the nodes of both loops. These lists are  */
-       /* already sorted, so merging is easy.                                    */
-       if (le1->node < le2->node) {
-               start = last = le1;
-               le1 = le1->next;
-               }
-       else if (le1->node == le2->node) {
-               start = last = le1;
-               le1 = le1->next;
-               le2 = le2->next;
-               }
-       else {
-               start = last = le2;
-               le2 = le2->next;
-               }
-
-       /* while the first loop != NULL, depending of the first element of second */
-       /* loop, add new node to result list                                      */
-       while (le1 != NULL) {
-
-               if (le2 == NULL) {
-                       last->next = le1;
-                       break;
-                       }
-               if (le1->node < le2->node) {
-                       last->next = le1;
-                       le1 = le1->next;
-                       }
-               else if (le1->node == le2->node) {
-                       last->next = le1;
-                       le1 = le1->next;
-                       le2 = le2->next;
-                       last = last->next;
-                       }
-               else {
-                       last->next = le2;
-                       le2 = le2->next;
-                       last = last->next;
-                       }
-               }
-
-       last->next = le2;                       
-}
-
-
-/*     This function is used to merge loops with the same header node to a single 
-       one. O(n^2) of number of loops. This merginig is necessary, because the loop
-       finding algorith sometimes (eg. when loopbody ends with a if-else construct)
-       reports a single loop as two loops with the same header node.
-*/
-void analyze_double_headers()
-{
-       int toCheck;
-       struct LoopContainer *t1, *t2, *t3;
-
-       t1 = c_allLoops;
-
-       while (t1 != NULL)      {                       /* for all loops do                                                     */
-               toCheck = t1->loop_head;        /* get header node                                                      */
-               t2 = t1->next;
-
-               while (t2 != NULL) {            /* compare it to headers of rest                        */
-                       if (t2->loop_head == toCheck) {
-
-                               /* found overlapping loops -> merge them together                               */
-                               /* printf("C_INFO: found overlapping loops - merging");         */
-                               analyze_merge(t1, t2);
-                               
-                               /* remove second loop from the list     of all loops                            */
-                               t3 = t1;       
-                               while (t3->next != t2)
-                                       t3 = t3->next;
-                               t3->next = t2->next;
-                               }
-                       t2 = t2->next;
-                   }
-
-               t1 = t1->next;
-           }
-}
-
-
-/* After the hierarchie of loops has been built, we have to insert the exceptions
-   into this tree. The exception ex is inserted into the subtree pointed to by
-   LoopContainer lc.
-*/
-void insert_exception(struct LoopContainer *lc, xtable *ex)
-{
-       struct LoopContainer *temp;
-       struct LoopElement *le;
-
-#ifdef LOOP_DEBUG
-       /* printf("insert_exception called with %d-%d and loop %d\n", ex->start->debug_nr, ex->end->debug_nr, lc->loop_head); */
-#endif
-       
-       /* if child node is reached immediately insert exception into the tree    */
-       if (lc->tree_down == NULL) {
-               ex->next = lc->exceptions;
-               lc->exceptions = ex;
-           }
-       else {
-       /* if we are inside the tree, there are two possibilities:                */
-       /* 1. the exception is inside a nested loop or                            */
-       /* 2. in the loop body of the current loop                                */
-
-               /* check all children (= nested loops)                                */
-               temp = lc->tree_down;
-               
-               while (temp != NULL) {
-                       
-                       le = temp->nodes;
-                       while (le != NULL) {
-
-#ifdef LOOP_DEBUG
-                               printf("%d.%d\n", le->node, block_index[ex->startpc]);
-#endif
-                               /* if the start of the exception is part of the loop, the     */
-                               /* whole exception must be part of the loop                   */
-                               if (le->node == block_index[ex->startpc])
-                                       break;
-                               le = le->next;
-                           }
-                       
-                       /* Exception is part of a nested loop (Case 1) -> insert it there */
-                       if (le != NULL) {
-                               insert_exception(temp, ex);
-                               return;
-                           }
-                       else if ((temp->loop_head >= block_index[ex->startpc]) && (temp->loop_head < block_index[ex->endpc])) {
-                               
-                               /* optimization: if nested loop is part of the exception, the */
-                               /* exception cannot be part of a differnet nested loop.       */
-                               ex->next = lc->exceptions;
-                               lc->exceptions = ex;
-                               return;
-                           }
-                       else
-                               temp = temp->tree_right;
-                   }
-                   
-               /* Exception is not contained in any nested loop (Case 2)             */
-               if (temp == NULL) {
-                       ex->next = lc->exceptions;
-                       lc->exceptions = ex;
-                   }
-           } 
-}
-
-
-/*     This function builds a loop hierarchie. The header node of the innermost loop,
-       each basic block belongs to, is stored in the array c_nestedLoops. The array
-       c_hierarchie stores the relationship between differnt loops in as follows: 
-    Each loop, that is a nested loop, stores its direct surrounding loop as a 
-    parent. Top level loops have no parents.
-*/
-void analyze_nested()
-{
-       /* i/count/tmp are counters                                               */
-       /* toOverwrite is used while loop hierarchie is built (see below)         */
-       int i, header, toOverwrite, tmp, len;
-
-       /* first/last are used during topological sort to build ordered loop list */
-       struct LoopContainer *first, *last, *start, *t, *temp;
-
-       /* Used to step through all nodes of a loop.                              */
-       struct LoopElement *le; 
-
-       /* init global structures                                                 */
-       c_nestedLoops = DMNEW(int, block_count);
-       c_hierarchie = DMNEW(int, block_count);         
-       for (i=0; i<block_count; ++i) {
-               c_nestedLoops[i] = -1;
-               c_hierarchie[i] = -1;
-           }
-
-       /* if there are no optimizable loops -> return                            */
-       if (c_allLoops == NULL)
-               return;
-
-       temp = c_allLoops;
-       while (temp != NULL) {              /* for all loops, do                  */
-               header = temp->loop_head;
-
-               /* toOverwrite is number of current parent loop (-1 if none)          */
-               toOverwrite = c_nestedLoops[header];    
-
-               c_hierarchie[header] = toOverwrite;
-
-               if (toOverwrite == header)      /* check for loops with same header   */
-                       printf("C_ERROR: Loops have same header\n");
-
-               le = temp->nodes;
-               while (le != NULL) {            /* for all loop nodes, do             */
-                       tmp = c_nestedLoops[le->node];
-
-                   /* if node is part of parent loop -> overwrite it with nested     */
-                       if (tmp == toOverwrite)
-                               c_nestedLoops[le->node] = header;
-                       else {
-                               c_hierarchie[tmp] = header;
-#ifdef LOOP_DEBUG
-                               /* printf("set head of %d to %d", tmp, header);               */
-#endif
-                           }
-
-                       le = le->next;
-                       }
-
-               temp = temp->next;
-               }
-
-       /* init root of hierarchie tree                                           */
-       root = DMNEW(struct LoopContainer, 1);
-       LoopContainerInit(root, -1);
-
-    /* obtain parent pointer and build hierarchie tree                        */
-    start = c_allLoops;    
-    while (start != NULL) {
-               
-               /* look for parent of loop pointed at by start                        */
-               first = c_allLoops;
-               while (first != NULL) {
-
-                       /* the parent of the loop, pointed at by start has been found     */
-                       if (first->loop_head == c_hierarchie[start->loop_head]) {
-#ifdef LOOP_DEBUG
-                               /* printf("set parent to pointer\n");                         */
-#endif
-
-                               start->parent = first;
-                               start->tree_right = first->tree_down;
-                               first->tree_down = start;
-
-                               break;
-                           }
-                       first = first->next;
-                   }
-
-               /* no parent loop found, set parent to root                           */
-               if (first == NULL) {
-#ifdef LOOP_DEBUG
-                       /* printf("set parent to root\n");                                */
-#endif
-                       start->parent = root;
-                       start->tree_right = root->tree_down;
-                       root->tree_down = start;                
-                   }
-               /* if a parent exists, increase this nodes indegree                   */
-               else
-                       start->parent->in_degree += 1;
-
-               start = start->next;
-           }
-
-       /* insert exceptions into tree                                            */
-#ifdef LOOP_DEBUG
-       printf("--- Showing tree ---\n");
-       show_tree(root, 0);
-       printf(" --- End ---\n");
-#endif
-       for (len = 0; len < exceptiontablelength; ++len) 
-               insert_exception(root, extable + len);
-
-
-       /* determine sequence of loops for optimization by topological sort       */
-
-       /* init queue                                                             */
-       start = NULL;
-       temp = c_allLoops;
-       while (temp != NULL) {
-
-               /* a loops with indegree == 0 are pushed onto the stack               */
-               if (temp->in_degree == 0) {
-                       t = temp->next;
-                       temp->next = start;
-                       start = temp;
-                       }
-               else 
-                       t = temp->next;
-                   
-               temp = t;
-               }
-
-       /* sort loops                                                             */
-       first = last = start;
-       start = start->next;
-
-       if (last == NULL) {
-               printf("C_ERROR: loops are looped\n");
-               exit(-1);
-           }
-
-       /* pop each node from the stack and decrease its parents indegree by one  */
-       /* when the parents indegree reaches zero, push it onto the stack as well */
-       if ((last->parent != root) && (--last->parent->in_degree == 0)) {
-               last->parent->next = start;
-               start = last->parent;
-               }
-       while (start != NULL) {
-
-               last->next = start;
-
-               start = start->next;
-               last = last->next;
-               
-               if ((last->parent != root) && (--last->parent->in_degree == 0)) {
-                       last->parent->next = start;
-                       start = last->parent;
-                       }
-               }
-
-       last->next = NULL;
-       c_allLoops = first;
-
-#ifdef LOOP_DEBUG
-       printf("*** Hierarchie Results \n");
-       while (first != NULL) {
-               printf("%d ", first->loop_head);
-               first = first->next;
-           }
-       printf("\n");
-       fflush(stdout);
-#endif 
-}
-
-/*     This function is used to add variables that occur as index variables in
-       array accesses (ARRAY_INDEX) or as variables, that change their value (VAR_MOD)
-       to the list of interesting vars (c_loopvars) for the current loop.
-*/
-void add_to_vars(int var, int type, int direction)
-{
-       struct LoopVar *lv;     
-
-       /* printf("Added to vars %d %d %d\n", var, type, direction);              */
-       lv = c_loopvars;
-       while (lv != NULL) {            /* check if var has been previously added */
-               if (lv->value == var) {
-                       if (type == ARRAY_INDEX)
-                               lv->index = 1;              /* var is used as index           */
-                       else if (type == VAR_MOD) {
-                               lv->modified = 1;           /* var is used in assignment      */
-                               switch (direction) {        /* how was var modified ?         */
-                               case D_UP:
-                                       lv->static_u = 0;       /* incremented, no static upper   */
-                                       break;                  /* bound can be guaranteeed       */
-                               case D_DOWN:
-                                       lv->static_l = 0;       /* decremented, no static lower   */
-                                       break;                  /* bound can be guaranteeed       */
-                               case D_UNKNOWN:
-                                       lv->static_u = lv->static_l = 0;
-                                       break;                  /* no info at all                 */
-                               default:
-                                       printf("C_ERROR: unknown direction\n");
-                                       break;
-                                       }
-                               }
-                       return;
-                       }
-               lv = lv->next;
-               }
-
-       /* variable is not found in list -> add variable to list                                        */
-       lv = DNEW(struct LoopVar);
-
-       lv->modified = lv->index = 0;
-       lv->value = var;
-
-       if (type == ARRAY_INDEX) {
-               lv->index = 1;
-               lv->static_u = lv->static_l = 1;    /* arrayindex -> var not modified */
-               }
-       else if (type == VAR_MOD) {
-               lv->modified = 1;
-               switch (direction) {                /* var used in assignment -> set  */
-               case D_UP:                          /* proper static bounds           */
-                       lv->static_u = 0; lv->static_l = 1;
-                       break;
-               case D_DOWN:
-                       lv->static_u = 1; lv->static_l = 0;
-                       break;
-               case D_UNKNOWN:
-                       lv->static_u = lv->static_l = 0;
-                       break;
-               default:
-                       printf("C_ERROR: unknown direction\n");
-                       break;
-                       }
-               }
-
-       /* no dynamic bounds have been determined so far                          */
-       lv->dynamic_l = lv->dynamic_l_v = lv->dynamic_u = lv->dynamic_u_v = 0;
-
-       lv->next = c_loopvars;                  /* add var to list                */
-       c_loopvars = lv;
-}
-
-/*     This function checks, whether a given loop with header node contains array
-       accesses. If so, it returns 1, else it returns 0 and the loops needs no
-       further consideration in the optimization process. When array accesses are 
-       found, a list of all variables, that are used as array index, is built and 
-       stored in c_loopvars. For all variables (integer), which values are changed, 
-       a flag in c_var_modified is set.
-*/
-int analyze_for_array_access(int node)
-{
-       basicblock bp;
-       instruction *ip;
-       int ic, i, access;
-       struct depthElement *d;
-       struct Trace *t;
-
-       if (c_toVisit[node] > 0) {          /* node has not been visited yet      */
-               c_toVisit[node] = 0;
-   
-               bp = block[node];               /* prepare an instruction scan        */
-               ip = bp.iinstr;
-               ic = bp.icount;
-
-               access = 0;                     /* number of array accesses in loop   */
-
-               for (i=0; i<ic; ++i, ++ip) {    /* for each instruction, check opcode */
-                       switch (ip->opc) {
-                       case ICMD_IASTORE:          /* array store                        */
-                       case ICMD_LASTORE:          
-                       case ICMD_FASTORE:          
-                       case ICMD_DASTORE:          
-                       case ICMD_AASTORE:          
-                       case ICMD_BASTORE:          
-                       case ICMD_CASTORE:          
-                       case ICMD_SASTORE:
-                               t = tracing(&bp, i-1, 1);   /* try to identify index variable */
-
-                               if (t->type == TRACE_IVAR) {
-                                       /* if it is a variable, add it to list of index variables */
-                                       add_to_vars(t->var, ARRAY_INDEX, D_UNKNOWN);
-                                       access++;                               
-                               }
-                               else if (t->type == TRACE_ICONST)
-                                       access++;
-                               break;
-      
-                       case ICMD_IALOAD:                               /* array load                                           */
-                   case ICMD_LALOAD:       
-                       case ICMD_FALOAD:
-                       case ICMD_DALOAD:
-                       case ICMD_AALOAD:
-                       case ICMD_BALOAD:
-                       case ICMD_CALOAD:
-                       case ICMD_SALOAD:
-                               t = tracing(&bp, i-1, 0);   /* try to identify index variable */
-               
-                               if (t->type == TRACE_IVAR) {
-                                       /* if it is a variable, add it to list of index variables */
-                                       add_to_vars(t->var, ARRAY_INDEX, D_UNKNOWN);
-                                       access++;
-                                       }
-                               else if (t->type == TRACE_ICONST)
-                                       access++;
-                               break;
-
-                       case ICMD_ISTORE:                               /* integer store                                        */
-                               c_var_modified[ip->op1] = 1;
-
-                               /* try to find out, how it was modified                                                 */
-                               t = tracing(&bp, i-1, 0);       
-                               if (t->type == TRACE_IVAR) {
-                                       if ((t->constant > 0) && (t->var == ip->op1))
-                                               /* a constant was added to the same var                                 */
-                                               add_to_vars(t->var, VAR_MOD, D_UP);
-                                       else if (t->var == ip->op1)     
-                                               /* a constant was subtracted from the same var                  */
-                                               add_to_vars(t->var, VAR_MOD, D_DOWN);
-                                       else
-                                               add_to_vars(t->var, VAR_MOD, D_UNKNOWN);
-                                       }
-                               else
-                                       add_to_vars(ip->op1, VAR_MOD, D_UNKNOWN);
-                               break;
-
-                       case ICMD_IINC:                                 /* simple add/sub of a constant         */
-                               c_var_modified[ip->op1] = 1;
-               
-                               if (ip->val.i > 0)
-                                       add_to_vars(ip->op1, VAR_MOD, D_UP);
-                               else
-                                       add_to_vars(ip->op1, VAR_MOD, D_DOWN);
-                               break;
-
-                       case ICMD_LSTORE:
-                       case ICMD_FSTORE:
-                       case ICMD_DSTORE:
-                       case ICMD_ASTORE:
-                               c_var_modified[ip->op1] = 1;
-                               break;
-                       }
-               }
-
-               d = c_dTable[node];
-               while (d != NULL) {                                     /* check all successors of block        */
-                       access += analyze_for_array_access(d->value);
-                       d = d->next;
-                       }
-
-               return access;
-               }
-       else
-               return 0;
-}
-
-/*     This function scans the exception graph structure to find modifications of
-       array index variables of the current loop. If any modifications are found,
-       1 is returned, else 0.
-*/
-int quick_scan(int node)
-{
-       basicblock bp;
-       instruction *ip;
-       int count, i;
-       struct LoopVar *lv;
-       struct depthElement *d;
-  
-       /*  printf("QS: %d - %d\n", node, c_exceptionVisit[node]);                                      */
-   
-
-       if (c_exceptionVisit[node] > 0) {       /* node is part of exception graph              */
-               c_exceptionVisit[node] = -1;
-               
-               bp = block[node];                               /* setup scan of all instructions               */
-               ip = bp.iinstr;
-               count = bp.icount;                              
-
-               for (i=0; i<count; ++i, ++ip) { /* for each instruction do                              */
-                       switch (ip->opc) {
-                       case ICMD_ISTORE:
-                       case ICMD_IINC:                         /* a variable is modified                               */
-       
-                               lv = c_loopvars;                /* is it an array index var ?                   */
-                               while (lv != NULL) {
-                                       if ((lv->index) && (lv->value == ip->op1))
-                                               return 1;               /* yes, so return 1                                             */
-                                       lv = lv->next;
-                                       }
-                               break;
-                               }
-                       }
-  
-           d = c_exceptionGraph[node];         /* check all successor nodes                    */
-               while (d != NULL) {
-                       if (quick_scan(d->value) > 0)
-                               return 1;                               /* if an access is found return 1               */
-                       d = d->next;
-                       }
-
-               return 0;                                               /* nothing found, so return 0                   */
-               }
-       else
-               return 0;
-}
-
-/*     This function returns 1, when the condition of the loop contains 
-       or statements or when an array index variable is modified in any
-       catch block within the loop.
-*/
-int analyze_or_exceptions(int head, struct LoopContainer *lc)
-{
-       struct depthElement *d;
-       int i, k, value, flag, count;
-       struct LoopElement *le;
-
-       d = c_dTable[head];
-       count = flag = 0;
-
-       /* analyze for or-statements                                                                                            */
-#ifdef LOOP_DEBUG
-       printf("*** Analyze for OR ... ");                                                                              
-       fflush(stdout);
-#endif
-
-       while (d != NULL) {                             /* for all successor nodes check if they        */
-               value = d->value;                       /* are part of the loop                                         */
-
-               le = lc->nodes;
-
-               while (le != NULL) {
-                       if (le->node == value)
-                               break;
-                       le = le->next;
-                       }
-
-               if (le == NULL)                         /* node is not part of the loop                         */
-                       ++flag;                                 
-
-               d = d->next;
-               ++count;
-               }
-
-       if ((count > 1) && (flag == 0)){/* if all successors part of the loop, exit */
-#ifdef STATISTICS
-               c_stat_or++;
-#endif
-               return 0;
-               }
-
-       /* check for exceptions */
-       /* printf("done\n*** Analyze for EXCEPTIONS(%d) . ", exceptiontablelength);     */
-
-       if (!exceptiontablelength)              /* when there are no exceptions, exit           */
-               return 1;
-
-       if ((c_exceptionGraph = (struct depthElement **) malloc(sizeof(struct depthElement *) * block_count)) == NULL)
-               c_mem_error();
-       if ((c_exceptionVisit = (int *) malloc(sizeof(int) * block_count)) == NULL)
-               c_mem_error();
-       
-       for (k=0; k<block_count; ++k) {
-               c_exceptionVisit[k] = -1;
-               c_exceptionGraph[k] = NULL;
-               }
-
-
-       /* for all nodes that start catch block check whether they are part of loop     */
-       for (i = 0; i < c_old_xtablelength; i++) {      
-               value = block_index[extable[i].startpc];
-   
-               le = lc->nodes;
-               while (le != NULL) {
-
-                       if (le->node == value)  {                       /* exception is in loop                 */
-#ifdef LOOP_DEBUG
-                               printf("C_INFO: Loop contains exception\n");                                    
-                               fflush(stdout);
-#endif
-
-                               /* build a graph structure, that contains all nodes that are    */
-                               /* part of the catc block                                                                               */
-                               dF_Exception(-1, block_index[extable[i].handlerpc]);
-
-                               /* if array index variables are modified there, return 0                */
-                               if (quick_scan(block_index[extable[i].handlerpc]) > 0) {
-#ifdef STATISTICS
-                                       c_stat_exception++;
-#endif
-                                       /* printf("C_INFO: loopVar modified in exception\n");           */
-                                       return 0;
-                                       }
-                               }
-                       le = le->next;
-                       }
-               }
-
-#ifdef LOOP_DEBUG
-       printf("none ... done\n");                                                                                              
-       fflush(stdout);
-#endif
-       return 1;
-}
-
-/*     This function sets a flag in c_var_modified for all variables that have
-       been found as part of an assigment in the loop.
-*/
-void scan_global_list()
-{
-       struct LoopVar *lv;
-       lv = c_loopvars;
-
-       while (lv != NULL) {
-               if (lv->modified)
-                       c_var_modified[lv->value] = 1;
-               lv = lv->next;
-               }
-}
-
-/*     This function analyses the condition in the loop header and trys to find
-       out, whether some dynamic guarantees can be set up.
-*/
-void init_constraints(int head)
-{
-       basicblock bp;
-       instruction *ip;
-       int ic, l_mod, r_mod, changed, operand;
-       struct Trace *left, *right, *th;
-       struct LoopVar *lv_left, *lv_right, *lh;
-
-       bp = block[head];
-       ic = bp.icount;
-       ip = bp.iinstr+(ic-1);  /* set ip to last instruction in header node            */
-
-       switch (ip->opc) {              /* check op-code                                                                        */
-               
-       /* comparison against constant value                                                                            */
-       case ICMD_IFEQ:                 /* ..., value ==> ...                                                           */
-       case ICMD_IFLT:         /* ..., value ==> ...                                                           */
-       case ICMD_IFLE:         /* ..., value ==> ...                                                           */
-       case ICMD_IFGT:         /* ..., value ==> ...                                                           */
-       case ICMD_IFGE:         /* ..., value ==> ...                                                           */
-                                                       /* op1 = target JavaVM pc, val.i = constant                     */
-
-               left = tracing(&bp, ic-2, 0);   /* analyse left arg., right is constant */
-               right = create_trace(TRACE_ICONST, -1, ip->val.i, 0);
-               break;
-
-       /* standard comparison                                                                                                          */
-       case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                                            */
-       case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                                            */
-       case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                                            */
-       case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                                            */
-       case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                                            */
-               
-               left = tracing(&bp, ic-2, 1);   /* get left and right argument                  */
-               right = tracing(&bp, ic-2, 0);
-               break;
-       
-       /* other condition                                                                                                                      */
-       default:
-               left = create_trace(TRACE_UNKNOWN, -1, 0, 0);
-               right = create_trace(TRACE_UNKNOWN, -1, 0, 0);
-               break;
-               }
-
-       /* analyse left and right side of comparison                                                            */
-       l_mod = r_mod = 0;
-
-       if (left->type == TRACE_IVAR) { /* is a loop variable on left side ?            */
-               lv_left = c_loopvars;
-               while (lv_left != NULL) {
-                       if (lv_left->value == left->var) {
-                               l_mod = lv_left->modified;      /* yes, but has it been modified ?      */       
-                               break;                          
-                               }
-                       lv_left = lv_left->next;
-                       }
-               }
-
-       if (right->type == TRACE_IVAR){ /* is a loop variable on right side ?           */
-               lv_right = c_loopvars;
-               while (lv_right != NULL) {
-                       if (lv_right->value == right->var) {
-                               r_mod = lv_right->modified;     /* yes, but has it been modified ?      */
-                               break;
-                               }
-                       lv_right = lv_right->next;
-                       }
-               }
-
-       if ((l_mod - r_mod) == 0) {             /* both 1 or both 0 -> no dynamic contraints*/
-               c_rightside = NULL;                     /* possible                                                                     */
-               return;
-               }
-
-       /* to simplify processing, make the left side the one, that contains the        */
-       /* modified variable                                                                                                            */
-       if (r_mod > l_mod) {
-               th = left;    left = right;        right = th;
-               lh = lv_left; lv_left = lv_right;  lv_right = lh;
-               changed = 1;                            /* set changed to true                                          */
-               }
-       else
-               changed = 0;                            /* no change needed                                                     */ 
-
-       /* make sure that right side's value does not change during loop execution      */ 
-       if (right->type == TRACE_UNKNOWN) {
-               c_rightside = NULL;
-               return;
-               }
-
-       /* determine operands:                                                                                                          */
-       /* for further explaination a is modified, b nonmodified var                            */
-       switch (ip->opc) {              /* check opcode again                                                           */      
-       case ICMD_IFEQ:         /* ..., value ==> ...                                                           */
-       case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                                            */
-               operand = OP_EQ;                                /* a == b                                                               */
-               break;
-
-       case ICMD_IFLE:         /* ..., value ==> ...                                                           */
-       case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                                            */
-               if (changed)
-                       operand = OP_GE;                        /* b<=a         -> a>=b                                         */
-               else {
-                       operand = OP_LT;                        /* a<=b         -> a<(b+1)                                      */ 
-                       if (left->constant != 0)
-                               left->constant -= 1;
-                       else
-                               right->constant += 1;   
-                       }
-               break;
-
-       case ICMD_IFLT:         /* ..., value ==> ...                                                           */
-       case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                                            */
-               if (changed) {
-                       operand = OP_GE;                        /* b<a          -> a>=(b+1)                                     */
-                       if (left->constant != 0)
-                               left->constant -= 1;
-                       else
-                               right->constant += 1;   
-                       }
-               else
-                       operand = OP_LT;                        /* a<b          -> a<b                                          */
-               break;
-
-       case ICMD_IFGT:         /* ..., value ==> ...                                                           */
-       case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                                            */
-               if (changed)
-                       operand = OP_LT;                        /* b>a          -> a<b                                          */
-               else {
-                       operand = OP_GE;                        /* a>b          ->      a>=(b+1)                                */
-                       if (left->constant != 0)
-                               left->constant -= 1;
-                       else
-                               right->constant += 1;
-                       }
-               break;
-               
-       case ICMD_IFGE:         /* ..., value ==> ...                                                           */
-       case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                                            */
-               if (changed) {
-                       operand = OP_LT;                        /* b>=a         -> a<(b+1)                                      */
-                       if (left->constant != 0)
-                               left->constant -= 1;
-                       else
-                               right->constant += 1;
-                       }
-               else
-                       operand = OP_GE;                        /* a>=b         -> a>=b                                         */
-               break;
-
-       default:
-               printf("C_ERROR: debugging error 0x00\n");
-               }
-
-
-       /* NOW: left/lv_left -> loopVar                                                                                         */
-       /*              right/lv_right -> const, nonmod. var, arraylength                                       */
-       switch (operand) {                                      /* check operand                                                */
-       case OP_EQ:
-               lv_left->dynamic_u_v = 1;               /* upper + lower bound tested                   */
-               lv_left->dynamic_l_v = 1;
-       
-               lv_left->dynamic_l = lv_left->dynamic_u = left->constant;
-               break;
-
-       case OP_LT:
-               lv_left->dynamic_u_v = 1;               /* upper bound tested                                   */
-       
-               lv_left->dynamic_u = left->constant;
-               break;
-
-       case OP_GE:
-               lv_left->dynamic_l_v = 1;               /* lower bound tested                                   */
-       
-               lv_left->dynamic_l = left->constant;
-               break;
-
-       default:
-               printf("C_ERROR: debugging error 0x01\n");
-               }
-
-       c_rightside = right;
-
-       switch (c_rightside->type) {
-       case TRACE_ICONST:
-               c_rs_needed_instr = 1;
-               break;
-       case TRACE_ALENGTH:
-               c_rs_needed_instr = 2;
-               break;
-       case TRACE_IVAR:
-               c_rs_needed_instr = 3;
-               break;
-       default:
-               printf("C_ERROR: wrong right-side type\n");
-               }
-}
-
-/*     This function is needed to add and record new static tests (before loop
-       entry) of variables to make guaratees for index variables. type states
-       the kind of the test. arrayRef is the array, which length is tested
-       against, varRef is the variable, that is testes and constant is the
-       constant value, that is tested.
-*/
-void add_new_constraint(int type, int arrayRef, int varRef, int constant)
-{
-       struct Constraint *tc;
-
-       switch (type) {
-       case TEST_ZERO:                                 /* a variable is tested against a const         */
-
-               tc = c_constraints[varRef];     /* does a test already exist for this var ?     */
-               while (tc != NULL) {
-                       if (tc->type == TEST_ZERO) {
-                               if (constant < tc->constant)
-                                       tc->constant = constant;
-                               return;                         /* yes. update constant and return                      */
-                               }
-                               tc = tc->next;
-                       }
-
-               /* insert a new test for this variable                                                                  */
-               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
-                       c_mem_error();
-               tc->type     = TEST_ZERO;
-               tc->varRef   = varRef;
-               tc->constant = constant;
-               tc->next     = c_constraints[varRef];
-               c_constraints[varRef] = tc;
-               c_needed_instr += 3;
-
-               break;
-
-       case TEST_ALENGTH:                              /* variable is tested against array length      */
-
-               tc = c_constraints[varRef];     /* does a test already exist for this var ?     */
-               while (tc != NULL) {
-                       if ((tc->type == TEST_ALENGTH) && (tc->arrayRef == arrayRef)) {
-                               if (constant > tc->constant)
-                                       tc->constant = constant;
-                               return;                         /* yes. update constant and return                      */
-                               }
-                       tc = tc->next;
-                       }
-
-               /* insert a new test for this variable                                                                  */
-               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
-                       c_mem_error();
-               tc->type         = TEST_ALENGTH;
-               tc->arrayRef = arrayRef;
-               tc->varRef   = varRef;
-               tc->constant = constant;
-               tc->next     = c_constraints[varRef];
-               c_constraints[varRef] = tc;
-               c_needed_instr += 6;
-
-               /* if arrayRef is not already tested against null, insert that test     */
-               if (!(c_null_check[arrayRef])) {
-                       c_null_check[arrayRef] = 1;
-                       c_needed_instr +=2;
-                   }
-                       
-               break;
-
-       case TEST_CONST_ZERO:           
-               /* done earlier                                                                                                                 */
-               break;
-
-       case TEST_CONST_ALENGTH:                /* a const is tested against array length       */
-
-               /* does a test already exist for this array                                                             */
-               tc = c_constraints[maxlocals];
-               while (tc != NULL) {
-                       if ((tc->type == TEST_CONST_ALENGTH) && (tc->arrayRef == arrayRef)) {
-                               if (constant > tc->constant)
-                                       tc->constant = constant;
-                               return;                         /* yes. update constant and return                      */
-                               }
-                       tc = tc->next;
-                       }
-               
-               /* insert a new test for this array                                                                             */
-               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
-                       c_mem_error();
-               tc->type         = TEST_CONST_ALENGTH;
-               tc->arrayRef = arrayRef;
-               tc->constant = constant;
-               tc->next     = c_constraints[maxlocals];
-               c_constraints[maxlocals] = tc;
-               c_needed_instr += 4;
-
-               /* if arrayRef is not already tested against null, insert that test     */
-               if (!(c_null_check[arrayRef])) {
-                       c_null_check[arrayRef] = 1;
-                       c_needed_instr +=2;
-                   }
-
-               break;
-
-       case TEST_UNMOD_ZERO:                   /* test unmodified var against constant         */
-
-               /* search if test already exists                                                                                */
-               tc = c_constraints[varRef];
-               while (tc != NULL) {
-                       if (tc->type == TEST_UNMOD_ZERO) {
-                               if (constant < tc->constant)
-                                       tc->constant = constant;
-                               return;                         /* yes, so update constant                                      */
-                               }
-                       tc = tc->next;
-                       }
-               
-               /* else, a new test is inserted                                                                                 */              
-               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
-                       c_mem_error();
-               tc->type         = TEST_UNMOD_ZERO;
-               tc->varRef   = varRef;
-               tc->constant = constant;
-               tc->next     = c_constraints[varRef];
-               c_constraints[varRef] = tc;
-               c_needed_instr += 3;
-
-               break;
-       
-       case TEST_UNMOD_ALENGTH:                /* test unmodified var against array length     */
-
-               /* search if test alreay exists                                                                                 */
-               tc = c_constraints[varRef];
-               while (tc != NULL) {
-                       if ((tc->type == TEST_UNMOD_ALENGTH) && (tc->arrayRef == arrayRef)) {
-                               if (constant > tc->constant)
-                                       tc->constant = constant;        
-                               return;                         /* yes, so modify constants                                     */
-                               }
-                       tc = tc->next;
-                       }
-               
-               /* create new entry                                                                                                             */
-               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
-                       c_mem_error();
-               tc->type         = TEST_UNMOD_ALENGTH;
-               tc->varRef   = varRef;
-               tc->arrayRef = arrayRef;
-               tc->constant = constant;
-               tc->next     = c_constraints[varRef];
-               c_constraints[varRef] = tc;
-               c_needed_instr += 6;
-
-               /* if arrayRef is not already tested against null, insert that test     */
-               if (!(c_null_check[arrayRef])) {
-                       c_null_check[arrayRef] = 1;
-                       c_needed_instr +=2;
-                   }
-
-               break;
-       
-       case TEST_RS_ZERO:                              /* test right side of the loop condition        */
-                                                                       /* against a constant - needed by dynamic       */
-                                                                       /* checks                                                                       */
-               /*!! varRef -> maxlocals */
-               /* search if test already exists                                                                                */
-               tc = c_constraints[maxlocals];
-               while (tc != NULL) {
-                       if (tc->type == TEST_RS_ZERO) {
-                               if (constant < tc->constant)
-                                       tc->constant = constant;
-                               return;                         /* yes, so modify constants                                     */
-                               }
-                       tc = tc->next;
-                       }
-
-               /* create new entry                                                                                                             */
-               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
-                       c_mem_error();
-               tc->type     = TEST_RS_ZERO;
-               tc->constant = constant;
-               tc->next     = c_constraints[maxlocals];
-               c_constraints[maxlocals] = tc;
-               c_needed_instr += (2 + c_rs_needed_instr);
-
-               /* if arrayRef on right side is not already tested against null,        */
-               /* insert that test                                                     */
-               if ((c_rightside->type == TRACE_ALENGTH) && (!(c_null_check[c_rightside->var]))) {
-                       c_null_check[c_rightside->var] = 1;
-                       c_needed_instr +=2;
-                   }
-
-               break;
-               
-       case TEST_RS_ALENGTH:                   /* test right side of the loop condition        */
-                                                                       /* against array length - needed by dynamic     */
-                                                                       /* checks                                                                       */
-               /*!! varRef -> maxlocals */
-               /* search if test already exists                                                                                */
-               tc = c_constraints[maxlocals];
-               while (tc != NULL)
-               {
-                       if ((tc->type == TEST_RS_ALENGTH) && (tc->arrayRef == arrayRef))
-                       {
-                               if (constant > tc->constant)
-                                       tc->constant = constant;
-                               return;                         /* yes, so modify constants                                     */
-                       }
-                       tc = tc->next;
-               }
-
-               /* create new entry                                                                                                             */
-               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
-                       c_mem_error();
-               tc->type         = TEST_RS_ALENGTH;
-               tc->arrayRef = arrayRef;
-               tc->constant = constant;
-               tc->next     = c_constraints[maxlocals];
-               c_constraints[maxlocals] = tc;
-               c_needed_instr += (3 + c_rs_needed_instr);
-
-               /* if arrayRef is not already tested against null, insert that test     */
-               if (!(c_null_check[arrayRef])) {
-                       c_null_check[arrayRef] = 1;
-                       c_needed_instr +=2;
-                   }
-
-               /* if arrayRef on right side is not already tested against null,        */
-               /* insert that test                                                     */
-               if ((c_rightside->type == TRACE_ALENGTH) && (!(c_null_check[c_rightside->var]))) {
-                       c_null_check[c_rightside->var] = 1;
-                       c_needed_instr +=2;
-                   }
-               break;
-
-       }
-}
-
-/*     This functions adds new static (before loop enry) tests of variables to the
-       program to be able to guarantee certain values for index variables in array
-       access (to safely remove bound checks).
-*/
-int insert_static(int arrayRef, struct Trace *index, struct Changes *varChanges, int special)
-{
-       struct LoopVar *lv;
-       int varRef;
-       int high, low;
-       
-       /* printf("insert static check - %d\n", arrayRef);
-          show_trace(index);
-          show_change(varChanges);
-       */
-
-       if (varChanges == NULL) {                       /* the variable hasn't changed / const  */
-               if ((varChanges = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
-                       c_mem_error();
-               varChanges->lower_bound = varChanges->upper_bound = 0;
-               }
-
-       switch (index->type) {                          /* check index type                                             */
-       case TRACE_IVAR:                                        /* it is a variable                                             */
-               if (index->neg < 0) {                   /* if it's a negated var, return                */
-#ifdef STATISTICS
-                       c_stat_no_opt++;                        
-#endif
-                       return OPT_NONE;
-                       }
-
-               varRef = index->var;
-               high = low = 0;
-
-               if (c_var_modified[varRef])     {       /* volatile var                                                 */
-                       
-                       lv = c_loopvars;                        /* get reference to loop variable               */
-
-                       while ((lv != NULL) && (lv->value != varRef))
-                               lv = lv->next;
-                       if (lv == NULL)
-                         printf("C_ERROR: debugging error 0x02\n");
-
-                       /* show_varinfo(lv);                                                                                            */
-                       
-                       /* check existing static bounds and add new contraints on variable      */
-                       /* to possibly remove bound checks                                                                      */
-                       if (lv->static_l) {
-                               /* the var is never decremented, so we add a static test againt */
-                               /* constant                                                                                                             */
-                               if (varChanges->lower_bound > varChanges->upper_bound)
-                                       add_new_constraint(TEST_ZERO, arrayRef, varRef, index->constant);
-                               else
-                                       add_new_constraint(TEST_ZERO, arrayRef, varRef, varChanges->lower_bound+index->constant);
-                               low = 1;
-                               }
-                       else if ((lv->dynamic_l_v) && (!special)) {
-                               /* the variable is decremented, but it is checked against a             */
-                               /* bound in the loop condition                                                                  */
-                               if (varChanges->lower_bound <= varChanges->upper_bound) {
-                                       add_new_constraint(TEST_RS_ZERO, arrayRef, varRef, varChanges->lower_bound+index->constant+lv->dynamic_l);
-                                       low = 1;
-                                       }
-                               }
-
-                       if (lv->static_u) {
-                               /* the var is never incremented, so we add a static test againt */
-                               /* constant                                                                                                             */
-                               if (varChanges->lower_bound > varChanges->upper_bound)
-                                       add_new_constraint(TEST_ALENGTH, arrayRef, varRef, index->constant);
-                               else
-                                       add_new_constraint(TEST_ALENGTH, arrayRef, varRef, varChanges->upper_bound+index->constant);
-                               high = 1;
-                               }
-                       else if ((lv->dynamic_u_v) &&  (!special)) {
-                               /* the variable is decremented, but it is checked against a             */
-                               /* bound in the loop condition                                                                  */
-                               if (varChanges->lower_bound <= varChanges->upper_bound) {
-                                       add_new_constraint(TEST_RS_ALENGTH, arrayRef, varRef, varChanges->upper_bound+index->constant+lv->dynamic_u);
-                                       high = 1;
-                                       }
-                               }
-                       }
-               else {                                                  /* the var is never modified at all             */
-                       add_new_constraint(TEST_UNMOD_ZERO, arrayRef, index->var, index->constant);
-                       add_new_constraint(TEST_UNMOD_ALENGTH, arrayRef, index->var, index->constant);
-                       low = high = 1;
-                       }
-               
-               /* if the addition of new variable tests made guarantees possible,              */
-               /* return the best possible optimization                                                                */
-               if ((high > 0) && (low > 0)) {
-                       /* printf("fully optimzed\n");                                                                          */
-#ifdef STATISTICS
-                       c_stat_full_opt++;                      
-#endif
-                       return OPT_FULL;
-                       }
-               else if (high > 0) {
-                       /* printf("upper optimzed\n");                                                                          */
-#ifdef STATISTICS
-                       c_stat_upper_opt++;                     
-#endif
-                       return OPT_UPPER;
-                       }
-               else if (low > 0) {
-                       /* printf("lower optimzed\n");                                                                          */
-#ifdef STATISTICS
-                       c_stat_lower_opt++;                     
-#endif
-                       return OPT_LOWER;
-                       }
-               else {
-                       /* printf("not optimzed\n");                                                                            */
-#ifdef STATISTICS
-                       c_stat_no_opt++;                        
-#endif
-                       return OPT_NONE;
-                       }
-               break;
-
-       case TRACE_ICONST:                      /* if it is a constant, optimization is easy    */
-               if (index->constant < 0) {
-#ifdef STATISTICS
-                       c_stat_no_opt++;                        
-#endif
-                       return OPT_NONE;        /* negative index -> bad                                                */
-                       }
-               else {
-                       add_new_constraint(TEST_CONST_ALENGTH, arrayRef, 0, index->constant);
-#ifdef STATISTICS
-                       c_stat_full_opt++;                      
-#endif
-                       return OPT_FULL;        /* else just test constant against array length */
-                       }
-               break;
-
-       case TRACE_ALENGTH:                     /* else, no optimizations possible                              */
-       case TRACE_UNKNOWN: 
-       case TRACE_AVAR:    
-#ifdef STATISTICS
-               c_stat_no_opt++;                        
-#endif
-               return OPT_NONE;
-       }
-
-       /* keep compiler happy */
-       return 0;
-}
-
-
-
-/*     copy a stack and return the start pointer of the newly created one
-*/
-stackptr copy_stack_from(stackptr source) { 
-       stackptr current, top;
-
-       if (source == NULL)
-               return NULL;
-
-       /* copy first element                                                       */
-       current = DMNEW(stackelement, 1);
-       current->type = source->type;
-       current->flags = source->flags;
-       current->varkind = source->varkind;
-       current->varnum = source->varnum;
-       current->regoff = source->regoff;
-       
-       top = current;
-
-       /* if there exist more, then copy the rest                                  */
-       while (source->prev != NULL) {
-               source = source->prev;
-               current->prev = DMNEW(stackelement, 1);
-               current->type = source->type;
-               current->flags = source->flags;
-               current->varkind = source->varkind;
-               current->varnum = source->varnum;
-               current->regoff = source->regoff;
-               current = current->prev;
-               }
-
-       current->prev = NULL;
-       return top;
-}
-
-
-/* The following defines are used in the procedure void create_static_checks(...)
-   They add a new instruction with its corresponding stack manipulation and
-   are used to build the new loop header of an optimized loop, where we have
-   to check certain variables and constants against values to guarantee that 
-   index values in array accesses remain with array bounds.
-
-   inst: pointer to the new instruction
-   tos: stackpointer before this operation is executed
-   newstack: temporary stackptr
-   stackdepth: counts the current stackdepth
-   original start: blockpointer to the head of the new, optimized loop 
-*/
-
-/* Load a local integer variable v                                              */
-#define LOAD_VAR(v) { \
-       inst->opc = ICMD_ILOAD; \
-       inst->op1 = v; \
-       newstack = DMNEW(stackelement, 1); \
-    inst->dst = newstack; \
-       newstack->prev = tos; \
-       newstack->type = TYPE_INT; \
-       newstack->flags = 0; \
-       newstack->varkind = LOCALVAR; \
-       newstack->varnum = v; \
-       tos = newstack; \
-       inst++; \
-       stackdepth++; \
-       }
-
-/* Load a constant with value c                                                 */
-#define LOAD_CONST(c) { \
-       inst->opc = ICMD_ICONST; \
-       inst->op1 = 0; \
-       inst->val.i = (c); \
-       newstack = DMNEW(stackelement, 1); \
-       newstack->prev = tos; \
-       newstack->type = TYPE_INT; \
-       newstack->flags = 0; \
-       newstack->varkind = UNDEFVAR; \
-       newstack->varnum = stackdepth; \
-       tos = newstack; \
-       inst->dst = tos; \
-       inst++; \
-       stackdepth++; \
-       }
-
-/* Load a local reference (adress) variable a                                   */
-#define LOAD_ADDR(a) { \
-       inst->opc = ICMD_ALOAD; \
-       inst->op1 = a; \
-       newstack = DMNEW(stackelement, 1); \
-       newstack->prev = tos; \
-       newstack->type = TYPE_ADR; \
-       newstack->flags = 0; \
-       newstack->varkind = LOCALVAR; \
-       newstack->varnum = a; \
-       tos = newstack; \
-       inst->dst = tos; \
-       inst++; \
-       stackdepth++; \
-       }
-
-/* Insert a compare greater-or-equal and jump to the unoptimized loop, if the   */
-/* comparison is true                                                           */
-#define GOTO_NOOPT_IF_GE { \
-       inst->opc = ICMD_IF_ICMPGE; \
-    inst->target = original_start->copied_to; \
-       if (tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-    if (tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-       inst->dst = tos; \
-       inst++; \
-       stackdepth -= 2; \
-       }
-
-/* Insert a compare greater than and jump to the unoptimized loop, if the       */
-/* comparison is true                                                           */
-#define GOTO_NOOPT_IF_GT { \
-       inst->opc = ICMD_IF_ICMPGT; \
-    inst->target = original_start->copied_to; \
-       if (tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-    if (tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-       inst->dst = tos; \
-       inst++; \
-       stackdepth -= 2; \
-       }
-
-
-/* Insert a compare less-than and jump to the unoptimized loop, if the          */
-/* comparison is true                                                           */
-#define GOTO_NOOPT_IF_LT { \
-       inst->opc = ICMD_IF_ICMPLT; \
-    inst->target = original_start->copied_to; \
-       if(tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-    if(tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-       inst->dst = tos; \
-       inst++; \
-       stackdepth -= 2; \
-       }
-
-/* Insert a compare if-not-null and jump to the unoptimized loop, if the        */
-/* comparison is true                                                           */
-#define GOTO_NOOPT_IF_NULL { \
-       inst->opc = ICMD_IFNULL; \
-    inst->target = original_start->copied_to; \
-    if(tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-       inst->dst = tos; \
-       inst++; \
-       stackdepth -= 1; \
-       }
-
-/* Insert an add instruction, that adds two integer values on top of the stack  */
-/* together                                                                     */
-#define ADD { \
-       inst->opc = ICMD_IADD; \
-       if(tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-    if(tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-       newstack = DMNEW(stackelement, 1); \
-       newstack->prev = tos; \
-       newstack->type = TYPE_INT; \
-       newstack->flags = 0; \
-       newstack->varkind = UNDEFVAR; \
-       newstack->varnum = stackdepth; \
-       tos = newstack; \
-       inst->dst = tos; \
-       inst++; \
-       stackdepth--; \
-       }
-               
-/* Insert instructions to load the arraylength of an array with reference a     */
-/* fisrt, the reference must be loaded, then a null-pointer check is inserted   */
-/* if not already done earlier. Finally an arraylength instruction is added     */
-#define LOAD_ARRAYLENGTH(a) { \
-    if (c_null_check[a]) { \
-               LOAD_ADDR(a); \
-               GOTO_NOOPT_IF_NULL; \
-               c_null_check[a] = 0; \
-           }  \
-       LOAD_ADDR(a); \
-    inst->opc = ICMD_ARRAYLENGTH; \
-       if(tos->varkind == UNDEFVAR) \
-               tos->varkind = TEMPVAR;  \
-    tos = tos->prev; \
-       newstack = DMNEW(stackelement, 1); \
-       newstack->prev = tos; \
-       newstack->type = TYPE_INT; \
-       newstack->flags = 0; \
-       newstack->varkind = UNDEFVAR; \
-       newstack->varnum = stackdepth; \
-       tos = newstack; \
-       inst->dst = tos; \
-       inst++; \
-       }       
-
-
-/* Inserts the instructions to load the value of the right side of comparison   */
-/* Depending of the type of the right side, the apropriate instructions are     */
-/* created.                                                                     */
-#define LOAD_RIGHT_SIDE { \
-       switch (c_rightside->type) { \
-       case TRACE_ICONST: \
-               LOAD_CONST(c_rightside->constant); \
-               break; \
-       case TRACE_IVAR: \
-               LOAD_VAR(c_rightside->var); \
-               LOAD_CONST(c_rightside->constant); \
-               ADD; \
-               break; \
-       case TRACE_ALENGTH: \
-               LOAD_ARRAYLENGTH(c_rightside->var); \
-               break; \
-       default: \
-               panic("C_ERROR: illegal trace on rightside of loop-header"); \
-       } \
-}
-
-/*     Patch jumps in original loop and in copied loop, add gotos in copied loop.
-       All jumps in the original loop to the loop head have to be redirected to
-       the newly inserted one. For the copied loop, it is necessay to redirect all
-       jumps inside that loop to the copied nodes. lc points to the current loop, 
-       loop_head is a pointer to the newly inserted head and original start was
-       the old head and is now the head of the optimized variant of the loop.
-*/
-void patch_jumps(basicblock *original_start, basicblock *loop_head, struct LoopContainer *lc)
-{
-       /* step through all nodes of a loop                                         */
-       struct LoopElement *le;
-       basicblock *bptr;
-       instruction *inst, *temp_instr;
-       int i;
-
-       le = lc->nodes;
-       while (le != NULL) {
-
-               /* do nothing for new loop head                                         */
-               if (le->block == loop_head) {
-                       le = le->next;
-                       continue;
-                   }
-
-               /* for original version                                                 */
-               bptr = le->block;
-               inst = bptr->iinstr;
-               for (i = 0; i < bptr->icount; ++i, ++inst) {
-                       switch (inst->opc) {
-
-                       case ICMD_IF_ICMPEQ:
-                       case ICMD_IF_ICMPLT:
-                       case ICMD_IF_ICMPLE:
-                       case ICMD_IF_ICMPNE:
-                       case ICMD_IF_ICMPGT:
-                       case ICMD_IF_ICMPGE:
-
-                       case ICMD_IF_LCMPEQ:
-                       case ICMD_IF_LCMPLT:
-                       case ICMD_IF_LCMPLE:
-                       case ICMD_IF_LCMPNE:
-                       case ICMD_IF_LCMPGT:
-                       case ICMD_IF_LCMPGE:
-
-                       case ICMD_IF_ACMPEQ:
-                       case ICMD_IF_ACMPNE:
-
-                       case ICMD_IFEQ:
-                       case ICMD_IFNE:
-                       case ICMD_IFLT:
-                       case ICMD_IFGE:
-                       case ICMD_IFGT:
-                       case ICMD_IFLE:
-
-                       case ICMD_IF_LEQ:
-                       case ICMD_IF_LNE:
-                       case ICMD_IF_LLT:
-                       case ICMD_IF_LGE:
-                       case ICMD_IF_LGT:
-                       case ICMD_IF_LLE:
-
-                       case ICMD_GOTO:
-                       case ICMD_JSR:
-                       case ICMD_IFNULL:
-                       case ICMD_IFNONNULL:
-
-                               /* jump to newly inserted loopheader has to be redirected       */
-                               if (((basicblock *) inst->target) == loop_head)
-                                       inst->target = (void *) original_start;
-                               break;
-
-                       case ICMD_TABLESWITCH:
-                               {
-                                       s4 *s4ptr, l, i;
-                                       void **tptr;
-
-                                       tptr = (void **) inst->target;
-
-                                       s4ptr = inst->val.a;
-                                       l = s4ptr[1];                          /* low     */
-                                       i = s4ptr[2];                          /* high    */
-
-                                       i = i - l + 1;
-
-                                       /* jump to newly inserted loopheader has to be redirected   */
-                                       for (tptr = inst->target; i >= 0; --i, ++tptr) {
-                                               if (((basicblock *) *tptr) == loop_head)
-                                                       tptr[0] = (void *) original_start;
-                                               }
-                               }
-                               break;
-
-                       case ICMD_LOOKUPSWITCH:
-                               {
-                                       s4 i, l, *s4ptr;
-                                       void **tptr;
-
-                                       tptr = (void **) inst->target;
-
-                                       s4ptr = inst->val.a;
-                                       l = s4ptr[0];                          /* default  */
-                                       i = s4ptr[1];                          /* count    */
-
-                                       /* jump to newly inserted loopheader has to be redirected   */
-                                       for (tptr = inst->target; i >= 0; --i, ++tptr) {
-                                               if (((basicblock *) *tptr) == loop_head)
-                                                       tptr[0] = (void *) original_start;
-                                               }
-                               }
-                               break;
-                       }
-               }
-
-               /* if node is part of loop and has fall through to original start, that */
-               /* must be redirected. Unfortunately the instructions have to be copied */
-
-               if (bptr->next == loop_head) {
-                       temp_instr = DMNEW(instruction, bptr->icount + 1);
-                       memcpy(temp_instr, bptr->iinstr, sizeof(instruction)*bptr->icount);
-                       bptr->iinstr = temp_instr;
-
-                       bptr->iinstr[bptr->icount].opc = ICMD_GOTO;
-                       bptr->iinstr[bptr->icount].target = original_start;
-                       bptr->iinstr[bptr->icount].dst = NULL;
-                       ++bptr->icount;
-                       }       
-               
-               /* for copied version - which gets the unoptimized variant              */
-               bptr = le->block->copied_to;
-               inst = bptr->iinstr;
-               for (i = 0; i < bptr->icount; ++i, ++inst) {
-
-                       switch (inst->opc) {
-
-                       case ICMD_IASTORE:                      /* array store                                                  */
-                       case ICMD_LASTORE:          
-                       case ICMD_FASTORE:          
-                       case ICMD_DASTORE:          
-                       case ICMD_AASTORE:          
-                       case ICMD_BASTORE:          
-                       case ICMD_CASTORE:          
-                       case ICMD_SASTORE:
-                       case ICMD_IALOAD:                       /* array load                                               */
-                   case ICMD_LALOAD:       
-                       case ICMD_FALOAD:
-                       case ICMD_DALOAD:
-                       case ICMD_AALOAD:
-                       case ICMD_BALOAD:
-                       case ICMD_CALOAD:
-                       case ICMD_SALOAD:
-
-                               /* undo previous optimizations in new loop                      */
-                               inst->op1 = 0;
-                               break;
-
-                       case ICMD_IF_ICMPEQ:
-                       case ICMD_IF_ICMPLT:
-                       case ICMD_IF_ICMPLE:
-                       case ICMD_IF_ICMPNE:
-                       case ICMD_IF_ICMPGT:
-                       case ICMD_IF_ICMPGE:
-
-                       case ICMD_IF_LCMPEQ:
-                       case ICMD_IF_LCMPLT:
-                       case ICMD_IF_LCMPLE:
-                       case ICMD_IF_LCMPNE:
-                       case ICMD_IF_LCMPGT:
-                       case ICMD_IF_LCMPGE:
-
-                       case ICMD_IF_ACMPEQ:
-                       case ICMD_IF_ACMPNE:
-
-                       case ICMD_IFEQ:
-                       case ICMD_IFNE:
-                       case ICMD_IFLT:
-                       case ICMD_IFGE:
-                       case ICMD_IFGT:
-                       case ICMD_IFLE:
-
-                       case ICMD_IF_LEQ:
-                       case ICMD_IF_LNE:
-                       case ICMD_IF_LLT:
-                       case ICMD_IF_LGE:
-                       case ICMD_IF_LGT:
-                       case ICMD_IF_LLE:
-
-                       case ICMD_GOTO:
-                       case ICMD_JSR:
-                       case ICMD_IFNULL:
-                       case ICMD_IFNONNULL:
-
-                               /* jump to newly inserted loopheader has to be redirected       */
-                               if (((basicblock *) inst->target) == loop_head)
-                                       inst->target = (void *) original_start->copied_to;
-                               /* jump to loop internal nodes has to be redirected             */
-                               else if (((basicblock *) inst->target)->lflags & LOOP_PART)
-                                       inst->target = (void *) ((basicblock *) inst->target)->copied_to;
-                               break;
-                               
-                       case ICMD_TABLESWITCH:
-                               {
-                                       s4 *s4ptr, l, i;
-                                       
-                                       void **copy_ptr, *base_ptr;
-                                       void **tptr;
-
-                                       tptr = (void **) inst->target;
-
-                                       s4ptr = inst->val.a;
-                                       l = s4ptr[1];                          /* low     */
-                                       i = s4ptr[2];                          /* high    */
-
-                                       i = i - l + 1;
-                                       
-                                       copy_ptr = (void**) DMNEW(void*, i+1);
-                                       base_ptr = (void*) copy_ptr;
-
-                                       /* Targets for switch instructions are stored in an extra   */
-                                       /* that must be copied for new inserted loop.               */
-
-                                       for (tptr = inst->target; i >= 0; --i, ++tptr, ++copy_ptr) {
-                                               /* jump to newly inserted loopheader must be redirected */
-                                               if (((basicblock *) *tptr) == loop_head)
-                                                       copy_ptr[0] = (void *) original_start->copied_to;
-                                               /* jump to loop internal nodes has to be redirected     */
-                                               else if (((basicblock *) *tptr)->lflags & LOOP_PART)
-                                                       copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
-                                               else
-                                                       copy_ptr[0] = tptr[0];
-                                               }
-
-                                       inst->target = base_ptr;
-                               }
-                               break;
-
-                       case ICMD_LOOKUPSWITCH:
-                               {
-                                       s4 i, l, *s4ptr;
-
-                                       void **copy_ptr, **base_ptr;
-                                       void **tptr;
-
-                                       tptr = (void **) inst->target;
-
-                                       s4ptr = inst->val.a;
-                                       l = s4ptr[0];                          /* default  */
-                                       i = s4ptr[1];                          /* count    */
-
-                                       copy_ptr = (void**) DMNEW(void*, i+1);
-                                       base_ptr = (void*) copy_ptr;
-
-                                       /* Targets for switch instructions are stored in an extra   */
-                                       /* that must be copied for new inserted loop.               */
-
-                                       for (tptr = inst->target; i >= 0; --i, ++tptr, ++copy_ptr) {
-                                               /* jump to newly inserted loopheader must be redirected */
-                                               if (((basicblock *) *tptr) == loop_head)
-                                                       copy_ptr[0] = (void *) original_start->copied_to;
-                                               /* jump to loop internal nodes has to be redirected     */
-                                               else if (((basicblock *) *tptr)->lflags & LOOP_PART)
-                                                       copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
-                                               else 
-                                                       copy_ptr[0] = tptr[0];
-                                               }
-
-                                       inst->target = base_ptr;
-                               }
-                               break;
-                               
-                               }
-                       }
-
-               /* if fall through exits loop, goto is needed                           */
-               if (!(le->block->next->lflags & LOOP_PART)) {
-                       bptr->iinstr[bptr->icount].opc = ICMD_GOTO;
-                       bptr->iinstr[bptr->icount].dst = NULL;
-                       bptr->iinstr[bptr->icount].target = le->block->next;
-                       bptr->icount++;
-                       }
-               
-               le = le->next;
-               }
-}
-
-/*     Add the new header node of a loop that has been duplicated to all parent 
-    loops in nesting hierarchie.
-*/
-void header_into_parent_loops(struct LoopContainer *lc, basicblock *to_insert, basicblock *replace, basicblock *after)
-{
-       /* we have to insert the node to_insert before the node after and replace   */
-       /* the pointer of to_insert by the node replace                             */
-
-       struct LoopElement *le, *t;
-
-       /* if the top of the tree is reached, then return                           */
-       if ((lc == NULL) || (lc == root))
-               return;
-
-       /* create new node, that should be inserted                                 */
-       t = DMNEW(struct LoopElement, 1);
-       t->block = to_insert;
-       t->node = -1;
-
-       /* first, find the node, that has to be replaced (= "to_insert") and        */
-       /* replace it by the node "replace"                                         */
-       le = lc->nodes;
-       while (le->block != to_insert)
-               le = le->next;
-       le->block = replace;
-
-       /* BUGFIX                                                                   */
-       if (after == to_insert)
-               after = replace;
-
-       /* now find the node after and insert the newly create node before "after"  */
-       le = lc->nodes;
-       if (le->block == after) {
-               t->next = lc->nodes;
-               lc->nodes = t;
-           }
-       else {
-               while (le->next->block != after)
-                       le = le->next;
-
-               t->next = le->next;
-               le->next = t;
-           }
-
-       /* go up one hierarchie level                                               */
-       header_into_parent_loops(lc->parent, to_insert, replace, after);
-}
-
-/*     Add a new node (not header) of a duplicated loop to all parent loops in 
-    nesting hierarchie
-*/
-void node_into_parent_loops(struct LoopContainer *lc, basicblock *to_insert)
-{
-       struct LoopElement *le, *t;
-
-       /* if the top of the tree is reached, then return                           */
-       if ((lc == NULL) || (lc == root))
-               return;
-
-       /* create new node, that should be inserted                                 */
-       t = DMNEW(struct LoopElement, 1);
-       t->block = to_insert;
-       t->node = -1;
-
-       le = lc->nodes;
-
-       /* append new node to node list of loop                                     */
-       while (le->next != NULL)
-               le = le->next;
-
-       t->next = le->next;
-       le->next = t;
-
-       /* go up one hierarchie level                                               */
-       node_into_parent_loops(NULL, to_insert);
-}
-
-
-/* void patch_handler(...) is very similar to parts of the function patch_jumps. 
-   Its task is to redirect all jumps from the original head to the new head and
-   to redirect internal jumps inside the exception handler to the newly
-   created (copied) nodes.
-*/
-void patch_handler(struct LoopContainer *lc, basicblock *bptr, basicblock *original_head, basicblock *new_head)
-{
-       instruction *ip;
-       int i;
-
-       /* If node is not part of exception handler or has been visited, exit       */
-       if (!(bptr->lflags & HANDLER_PART) || (bptr->lflags & HANDLER_VISITED))
-               return;
-
-       /* mark block as visited                                                    */
-       bptr->lflags |= HANDLER_VISITED;
-
-       /* for all instructions in the copied block, do                             */
-       for (i = 0, ip = bptr->copied_to->iinstr; i < bptr->copied_to->icount; ++i, ++ip) {
-               switch (ip->opc) {
-               case ICMD_RETURN:
-               case ICMD_IRETURN:
-               case ICMD_LRETURN:
-               case ICMD_FRETURN:
-               case ICMD_DRETURN:
-               case ICMD_ARETURN:
-               case ICMD_ATHROW:
-                       break;                                 
-
-               case ICMD_IF_ICMPEQ:
-               case ICMD_IF_ICMPLT:
-               case ICMD_IF_ICMPLE:
-               case ICMD_IF_ICMPNE:
-               case ICMD_IF_ICMPGT:
-               case ICMD_IF_ICMPGE:
-                       
-               case ICMD_IF_LCMPEQ:
-               case ICMD_IF_LCMPLT:
-               case ICMD_IF_LCMPLE:
-               case ICMD_IF_LCMPNE:
-               case ICMD_IF_LCMPGT:
-               case ICMD_IF_LCMPGE:
-
-               case ICMD_IF_ACMPEQ:
-               case ICMD_IF_ACMPNE:
-
-               case ICMD_IFEQ:
-               case ICMD_IFNE:
-               case ICMD_IFLT:
-               case ICMD_IFGE:
-               case ICMD_IFGT:
-               case ICMD_IFLE:
-                               
-               case ICMD_IF_LEQ:
-               case ICMD_IF_LNE:
-               case ICMD_IF_LLT:
-               case ICMD_IF_LGE:
-               case ICMD_IF_LGT:
-               case ICMD_IF_LLE:
-
-               case ICMD_JSR:
-               case ICMD_IFNULL:
-               case ICMD_IFNONNULL:
-
-                       patch_handler(lc, bptr->next, original_head, new_head); 
-
-                       /* fall through */
-
-               case ICMD_GOTO:
-
-                       patch_handler(lc, ip->target, original_head, new_head);
-
-                       /* jumps to old header have to be redirected                        */
-                       if (((basicblock *) ip->target) == original_head)
-                               ip->target = (void *) new_head->copied_to;
-                       /* jumps to handler internal nodes have to be redirected            */
-                       else if (((basicblock *) ip->target)->lflags & HANDLER_PART)
-                               ip->target = (void *) ((basicblock *) ip->target)->copied_to;
-                       /* jumps to loop internal nodes have to be redirected               */
-                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
-                               ip->target = (void *) ((basicblock *) ip->target)->copied_to;
-                  
-                  
-                       break;
-                               
-               case ICMD_TABLESWITCH:
-                       {
-                               s4 *s4ptr, l, i;
-                               void **tptr;
-                               void **copy_ptr, **base_ptr;
-                               tptr = (void **) ip->target;
-                               s4ptr = ip->val.a;
-                               l = s4ptr[1];                          /* low                   */
-                               i = s4ptr[2];                          /* high                  */
-                               i = i - l + 1;
-                               
-                               copy_ptr = (void**) DMNEW(void*, i+1);
-                               base_ptr = (void*) copy_ptr;
-
-                               for (tptr = ip->target; i >= 0; --i, ++tptr, ++copy_ptr) {
-                                       patch_handler(lc, ((basicblock *) *tptr), original_head, new_head);
-                                       /* jumps to old header have to be redirected                */
-                                       if (((basicblock *) *tptr) == original_head)
-                                               copy_ptr[0] = (void *) new_head->copied_to;
-                                       /* jumps to handler internal nodes have to be redirected    */
-                                       else if (((basicblock *) *tptr)->lflags & HANDLER_PART)
-                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
-                                       /* jumps to loop internal nodes have to be redirected       */
-                                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
-                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
-                                       else
-                                               copy_ptr[0] = tptr[0];
-                                   }
-
-                               ip->target = base_ptr;
-                       }
-                       break;
-
-               case ICMD_LOOKUPSWITCH:
-                       {
-                               s4 i, l, *s4ptr;
-
-                               void **tptr;
-                               void **copy_ptr, **base_ptr;
-
-                               tptr = (void **) ip->target;
-                               s4ptr = ip->val.a;
-                               l = s4ptr[0];                          /* default               */
-                               i = s4ptr[1];                          /* count                 */
-
-                               copy_ptr = (void**) DMNEW(void*, i+1);
-                               base_ptr = (void*) copy_ptr;
-
-                               for (tptr = ip->target; i >= 0; --i, ++tptr, ++copy_ptr) {
-
-                                       patch_handler(lc, ((basicblock *) *tptr), original_head, new_head);
-                                       /* jumps to old header have to be redirected                */
-                                       if (((basicblock *) *tptr) == original_head)
-                                               copy_ptr[0] = (void *) new_head->copied_to;
-                                       /* jumps to handler internal nodes have to be redirected    */
-                                       else if (((basicblock *) *tptr)->lflags & HANDLER_PART)
-                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
-                                       /* jumps to loop internal nodes have to be redirected       */
-                                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
-                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
-                                       else
-                                               copy_ptr[0] = tptr[0];
-                                   }
-
-                               ip->target = base_ptr;
-                       }
-                       break;
-                               
-                   }   /* switch */
-                  
-           }       /* for    */
-
-               /* if fall through exits loop, goto is needed                           */
-               if (!(bptr->next->lflags & HANDLER_PART)) {
-                       bptr->copied_to->iinstr[bptr->copied_to->icount].opc = ICMD_GOTO;
-                       bptr->copied_to->iinstr[bptr->copied_to->icount].dst = NULL;
-                       bptr->copied_to->iinstr[bptr->copied_to->icount].target = bptr->next;
-                       bptr->copied_to->icount++;
-                       }               
-}
-
-
-/* This function copys the exception handler and redirects all jumps from the
-   original head to the new head in the original exception handler. All
-   redirection in the copied exception handler is done in patch_handler(...).
-*/
-void copy_handler(struct LoopContainer *lc, basicblock *bptr, basicblock *original_head, basicblock *new_head)
-{
-       instruction *ip;
-       s4 *s4ptr;
-       void **tptr;
-       int high, low, count;
-       struct LoopElement *le;
-       basicblock *new;
-
-       /* If this node has already been copied, return                             */
-       if (bptr->lflags & HANDLER_PART)
-               return;
-
-       /* The exception handler exists, when control flow enters loop again        */
-
-       if (bptr->lflags & LOOP_PART)
-               return;
-       for (le = lc->nodes; le != NULL; le = le->next) {
-               if (le->block == bptr) {
-                       printf("C_PANIC: should not happen\n");
-                       exit(-1);
-            }
-           }
-
-       /* mark block as part of handler                                            */
-       bptr->lflags |= HANDLER_PART;
-
-       /* copy node                                                                */
-       new = DMNEW(basicblock, 1);    
-       memcpy(new, bptr, sizeof(basicblock));
-       new->debug_nr = c_debug_nr++;
-
-       c_last_block_copied = new;
-
-       /* copy instructions and allow one more slot for possible GOTO              */
-       new->iinstr = DMNEW(instruction, bptr->icount + 1);
-       memcpy(new->iinstr, bptr->iinstr, bptr->icount*sizeof(instruction));
-
-       /* update original block                                                    */
-       bptr->copied_to = new;
-
-       /* append block to global list of basic blocks                              */
-       last_block->next = new;
-       last_block = new;
-       new->next = NULL;
-
-
-       /* find next block to copy, depending on last instruction of BB             */
-       if (bptr->icount == 0) {
-               copy_handler(lc, bptr->next, original_head, new_head);
-               return;
-           }
-
-       ip = bptr->iinstr + (bptr->icount - 1);
-       
-               switch (ip->opc) {
-               case ICMD_RETURN:
-               case ICMD_IRETURN:
-               case ICMD_LRETURN:
-               case ICMD_FRETURN:
-               case ICMD_DRETURN:
-               case ICMD_ARETURN:
-               case ICMD_ATHROW:
-                       break;                                 
-               
-               case ICMD_IFEQ:
-               case ICMD_IFNE:
-               case ICMD_IFLT:
-               case ICMD_IFGE:
-               case ICMD_IFGT:
-               case ICMD_IFLE:
-                       
-               case ICMD_IF_LCMPEQ:
-               case ICMD_IF_LCMPLT:
-               case ICMD_IF_LCMPLE:
-               case ICMD_IF_LCMPNE:
-               case ICMD_IF_LCMPGT:
-               case ICMD_IF_LCMPGE:
-                       
-               case ICMD_IF_LEQ:
-               case ICMD_IF_LNE:
-               case ICMD_IF_LLT:
-               case ICMD_IF_LGE:
-               case ICMD_IF_LGT:
-               case ICMD_IF_LLE:
-                       
-               case ICMD_IFNULL:
-               case ICMD_IFNONNULL:
-                       
-               case ICMD_IF_ICMPEQ:
-               case ICMD_IF_ICMPNE:
-               case ICMD_IF_ICMPLT:
-               case ICMD_IF_ICMPGE:
-               case ICMD_IF_ICMPGT:
-               case ICMD_IF_ICMPLE:
-               case ICMD_IF_ACMPEQ:
-               case ICMD_IF_ACMPNE:
-                       copy_handler(lc, bptr->next, original_head, new_head);
-                       /* fall through */
-         
-               case ICMD_GOTO:
-
-                       /* redirect jump from original_head to new_head                    */
-                       if ((basicblock *) ip->target == original_head)
-                               ip->target = (void *) new_head;
-                               
-                       copy_handler(lc, (basicblock *) (ip->target), original_head, new_head);
-                       
-                       break;
-         
-               case ICMD_TABLESWITCH:
-                       s4ptr = ip->val.a;
-                       tptr = (void **) ip->target;
-                       
-                       /* default branch */
-                       if (((basicblock *) *tptr) == original_head)
-                               tptr[0] = (void *) new_head;
-                       
-                       copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
-                       
-                       s4ptr++;
-                       low = *s4ptr;
-                       s4ptr++;
-                       high = *s4ptr;
-                       
-                       count = (high-low+1);
-                       
-                       while (--count >= 0) {
-                               tptr++;
-                               /* redirect jump from original_head to new_head                 */
-                               if (((basicblock *) *tptr) == original_head)
-                                       tptr[0] = (void *) new_head;
-                               copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
-                       }
-                       break;
-
-               case ICMD_LOOKUPSWITCH:
-                       s4ptr = ip->val.a;
-                       tptr = (void **) ip->target;
-                       
-                       /* default branch */
-                       if (((basicblock *) *tptr) == original_head)
-                               tptr[0] = (void *) new_head;
-                       
-                       copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
-                       
-                       ++s4ptr;
-                       count = *s4ptr;
-                       
-                       while (--count >= 0) {
-                               ++tptr;
-                               /* redirect jump from original_head to new_head                 */
-                               if (((basicblock *) *tptr) == original_head)
-                                       tptr[0] = (void *) new_head;
-                               copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
-                       }  
-                       break;
-
-               case ICMD_JSR:
-                       c_last_target = bptr;
-                       copy_handler(lc, (basicblock *) (ip->target), original_head, new_head);         
-                       break;
-                       
-               case ICMD_RET:
-                       copy_handler(lc, c_last_target->next, original_head, new_head);
-                       break;
-                       
-               default:
-                       copy_handler(lc, bptr->next, original_head, new_head);
-                       break;  
-                   } 
-           
-}           
-
-
-/* If a loop is duplicated, all exceptions, that are contained in this loops' body
-   have to be duplicated as well. The following function together with the
-   two helper functions copy_handler and patch_handler perform this task.
-*/
-void update_internal_exceptions(struct LoopContainer *lc, basicblock *original_head, basicblock *new_head)
-{
-       xtable *ex, *new;
-       struct LoopContainer *l;
-
-       /* Bottom of tree reached -> return                                         */
-       if (lc == NULL)
-               return;
-
-       /* Call update_internal for all nested (=child) loops                       */
-       l = lc->tree_down;
-       while (l != NULL) {
-               update_internal_exceptions(l, original_head, new_head);
-               l = l->tree_right;
-           }
-
-       /* For all exceptions of this loop, do                                      */
-       ex = lc->exceptions;
-       while (ex != NULL) {
-               
-               /* Copy the exception and patch the jumps                               */
-               copy_handler(lc, ex->handler, original_head, new_head);
-               patch_handler(lc, ex->handler, original_head, new_head);                
-
-               /* Insert a new exception into the global exception table               */
-               new = DMNEW(xtable, 1);
-               memcpy(new, ex, sizeof(xtable));
-
-               /* Increase number of exceptions                                        */
-               ++exceptiontablelength;
-
-               ex->next = new;
-               ex->down = new;
-
-               /* Set new start and end point of this exception                        */
-               new->start = ex->start->copied_to;
-               new->end = ex->end->copied_to;
-
-               /* Set handler pointer to copied exception handler                      */
-               new->handler = ex->handler->copied_to;
-
-               ex = new->next;
-           }
-
-}
-
-/* If a loop is duplicated, all exceptions that contain this loop have to be
-   extended to the copied nodes as well. The following function checks for
-   all exceptions of all parent loops, whether they contain the loop pointed to
-   by lc. If so, the exceptions are extended to contain all newly created nodes.
-*/
-void update_external_exceptions(struct LoopContainer *lc, int loop_head)
-{
-       xtable *ex, *new;
-
-       /* Top of tree reached -> return                                            */
-       if (lc == NULL)
-               return;
-       
-       ex = lc->exceptions;
-
-       /* For all exceptions of this loop do                                       */
-       while (ex != NULL) {
-                  
-               /* It is possible that the loop contains exceptions that do not protect */
-               /* the loop just duplicated. It must be checked, if this is the case    */
-               if ((loop_head >= block_index[ex->startpc]) && (loop_head < block_index[ex->endpc])) {
-
-                       /* loop is really inside exception, so create new exception entry   */
-                       /* in global exception list                                         */
-                       new = DMNEW(xtable, 1);
-                       memcpy(new, ex, sizeof(xtable));
-
-
-                       /* Increase number of exceptions                                    */
-                       ++exceptiontablelength;
-
-                       ex->next = new;
-                       ex->down = new;
-
-                       /* Set new start and end point of this exception                    */
-                       new->start = c_first_block_copied;
-                       new->end = c_last_block_copied;
-
-                       ex = new->next;
-               }
-               /* exception does not contain the duplicated loop -> do nothing         */
-               else
-                       ex = ex->next;
-           }
-
-       /* Call update_external for parent node                                     */
-       update_external_exceptions(lc->parent, loop_head);
-}
-       
-
-
-/*     This function is needed to insert the static checks, stored in c_constraints
-       into the intermediate code.
-*/
-void create_static_checks(struct LoopContainer *lc)
-{
-       int i, stackdepth, cnt;
-       struct Constraint *tc1;
-       struct LoopElement *le; 
-
-       /* loop_head points to the newly inserted loop_head, original_start to      */
-       /* the old loop header                                                      */
-       basicblock *bptr, *loop_head, *original_start, *temp;
-       instruction *inst, *tiptr;
-
-       /* tos and newstack are needed by the macros, that insert instructions into */
-       /* the new loop head                                                        */
-       stackptr newstack, tos;
-       xtable *ex;
-
-#ifdef STATISTICS
-       /* show_loop_statistics(); */ 
-#endif
-
-       loop_head = &block[c_current_head];
-       c_first_block_copied = c_last_block_copied = NULL;
-
-       /* the loop nodes are copied                                                */
-       le = lc->nodes;
-       while (le != NULL)
-       {
-               bptr = DMNEW(basicblock, 1);    
-               memcpy(bptr, le->block, sizeof(basicblock));
-               bptr->debug_nr = c_debug_nr++;
-
-               /* determine beginning of copied loop to extend exception handler, that */
-               /* protect this loop                                                    */
-               if (c_first_block_copied == NULL)
-                       c_first_block_copied = bptr;
-
-               /* copy instructions and add one more slot for possible GOTO            */
-               bptr->iinstr = DMNEW(instruction, bptr->icount + 1);
-
-               memcpy(bptr->iinstr, le->block->iinstr, (bptr->icount+1)*sizeof(instruction));
-
-               le->block->copied_to = bptr;
-
-               /* add block to global list of BBs                                      */
-               last_block->next = bptr;
-               last_block = bptr;
-               bptr->next = NULL;
-
-               node_into_parent_loops(lc->parent, bptr);
-               le = le->next;
-       }
-
-       c_last_block_copied = bptr;
-
-       /* create an additional basicblock for dynamic checks                       */
-       original_start = bptr = DMNEW(basicblock, 1);    
-
-       /* copy current loop header to new basic block                              */
-       memcpy(bptr, loop_head, sizeof(basicblock));
-    bptr->debug_nr = c_debug_nr++;
-
-       /* insert the new basic block and move header before first loop node        */
-       le = lc->nodes;
-       temp = le->block;
-
-       /* if header is first node of loop, insert original header after it         */
-       if (temp == loop_head)
-               loop_head->next = bptr;
-       else {
-       /* else, we have to find the predecessor of loop header                     */
-               while (temp->next != loop_head)
-                       temp = temp->next;
-
-               /* insert original header after newly created block                     */
-               temp->next = bptr;
-
-               /* if predecessor is not loop part, insert a goto                       */
-               if (!(temp->lflags & LOOP_PART)) {
-
-                       /* copy instructions and add an additional slot                     */
-                       tiptr = DMNEW(instruction, temp->icount + 1);
-                       memcpy(tiptr, temp->iinstr, sizeof(instruction)*temp->icount);
-                       
-                       temp->iinstr = tiptr;
-                       tiptr = temp->iinstr + temp->icount;
-                       
-                       /* add goto to loop header. If node is part of exception handler    */
-                       /* jmp is automagically redirected during patch_handler and works   */
-                       /* correct                                                          */
-                       tiptr->opc = ICMD_GOTO;
-                       tiptr->dst = NULL;
-                       tiptr->target = (void*) loop_head;
-                       
-                       ++temp->icount;
-                   }
-               
-               
-               temp = block;
-               /* if first loop block is first BB of global list, insert loop_head at  */
-               /* beginning of global BB list                                          */
-               if (temp == le->block) {
-                       if (c_newstart == NULL) {
-                               c_needs_redirection = true;
-                               c_newstart = loop_head;
-                               loop_head->next = block;
-                           }
-                       else {
-                               loop_head->next = c_newstart;
-                               c_newstart = loop_head;
-                           }
-                   }
-               else {
-          
-                       while (temp->next != le->block)
-                               temp = temp->next;
-
-                       loop_head->next = temp->next;
-                       temp->next = loop_head;
-               
-                       /* to be on the safe side insert a jump from the previous instr     */
-                       /* over thr new inserted node                                       */
-       
-                       /* special case - jump from node to loop_head: then remove          */
-                       /* goto / happens rather often due to loop layout                   */
-                       tiptr = temp->iinstr + (temp->icount-1);
-               
-                       if ((tiptr->opc == ICMD_GOTO) && (tiptr->target == loop_head)) {
-                               tiptr->opc = ICMD_NOP;
-                               tiptr->dst = NULL;
-                       }
-                       else {
-
-                               tiptr = DMNEW(instruction, temp->icount + 1);
-                               memcpy(tiptr, temp->iinstr, sizeof(instruction)*temp->icount);
-
-                               temp->iinstr = tiptr;
-                               tiptr = temp->iinstr + temp->icount;
-
-                               tiptr->opc = ICMD_GOTO;
-                               tiptr->dst = NULL;
-                               tiptr->target = (void*) loop_head->next;
-
-                               ++temp->icount;
-                   }
-                   }
-           }
-
-       /* adjust exceptions                                                        */
-       ex = extable;
-       while (ex != NULL) {
-
-               /* if an exception covers whole loop and starts at first loop node, it  */
-               /* has to be extended to cover the new first node as well               */
-               if (ex->start == le->block) {
-                       
-                       if ((lc->loop_head >= block_index[ex->startpc]) && (lc->loop_head < block_index[ex->endpc])) 
-                               ex->start = loop_head;
-                   }
-
-               /* an exception that ended at the old loop header now must contains the */
-               /* new loop header as well                                              */
-               if (ex->end == loop_head)
-                       ex->end = original_start;
-
-               ex = ex->down;
-           }
-       
-
-       /* insert new header node into nodelists of all enclosing loops             */
-       header_into_parent_loops(lc, loop_head, original_start, le->block);
-
-       /* prepare instruction array to insert checks                               */
-       inst = loop_head->iinstr = DMNEW(instruction, c_needed_instr + 2); 
-       loop_head->icount = c_needed_instr + 1;
-
-       /* init instruction array                                                   */
-       for (cnt=0; cnt<c_needed_instr + 1; ++cnt) {
-               inst[0].opc = ICMD_NOP;
-               inst[0].dst = NULL;
-           }
-
-       loop_head->copied_to = NULL; 
-
-       /* prepare stack                                                            */
-       loop_head->instack = copy_stack_from(bptr->instack);
-       loop_head->outstack = copy_stack_from(bptr->instack);
-       
-       tos = loop_head->instack;
-       stackdepth = loop_head->indepth;
-       
-       /* step through all inserted checks and create instructions for them        */
-       for (i=0; i<maxlocals+1; ++i)
-       {
-               tc1 = c_constraints[i];
-               while (tc1 != NULL)
-               {
-                       switch (tc1->type)
-                       {
-                       
-                               /* check a variable against a constant                          */
-                       case TEST_ZERO:
-                       case TEST_UNMOD_ZERO: 
-
-#ifdef LOOP_DEBUG
-                               printf("insert ZERO-test\n");
-                               fflush(stdout);
-#endif
-
-                               /* optimize if tc1->varRef >= tc1->constant                     */
-                               LOAD_VAR(tc1->varRef);
-                               LOAD_CONST(tc1->constant);
-                               GOTO_NOOPT_IF_LT;
-                               break;
-
-                               /* check a variable against an array length                     */
-                       case TEST_ALENGTH:       
-                       case TEST_UNMOD_ALENGTH:
-                               
-                               /* optimize if                                                  */
-                               /* tc1->varRef + tc1->constant < lengthOf(tc1->arrayRef)        */
-#ifdef LOOP_DEBUG
-                               printf("insert ALENGTH-test\n");
-                               fflush(stdout);
-#endif
-
-                               LOAD_VAR(tc1->varRef);
-                               LOAD_CONST(tc1->constant);
-                               ADD;
-                               LOAD_ARRAYLENGTH(tc1->arrayRef);
-                               GOTO_NOOPT_IF_GE;
-                               break;
-                               
-                               /* test right side of comparison against constant               */
-                       case TEST_RS_ZERO:      
-
-#ifdef LOOP_DEBUG
-                               printf("insert RS-ZERO-test\n");
-                               fflush(stdout);
-#endif
-
-                               /* optimize if right-side >= tc1->constant                      */
-                               LOAD_RIGHT_SIDE;
-                               LOAD_CONST(tc1->constant);
-                               GOTO_NOOPT_IF_LT;
-                               break;
-                               
-                               /* test right side of comparison against array length           */
-                       case TEST_RS_ALENGTH: 
-
-#ifdef LOOP_DEBUG
-                               printf("insert RS-ALENGTH-test\n");
-                               fflush(stdout);
-#endif
-                               /* optimize if right-side < lengthOf(arrayRef)                  */
-                               LOAD_RIGHT_SIDE;
-                               LOAD_ARRAYLENGTH(tc1->arrayRef);
-                               GOTO_NOOPT_IF_GT;
-                               break;
-                               
-                               /* test unmodified variable against arraylength                 */
-                       case TEST_CONST_ALENGTH:
-
-#ifdef LOOP_DEBUG
-                               printf("insert CONST ALENGTH-test\n");
-                               fflush(stdout);
-#endif
-
-                               /* optimize if tc1->constant < lengthOf(tc1->arrayRef)          */
-                               LOAD_CONST(tc1->constant);
-                               LOAD_ARRAYLENGTH(tc1->arrayRef);
-                               GOTO_NOOPT_IF_GE;
-                               break;              
-                       }
-                       
-                       tc1 = tc1->next;
-               }
-               c_constraints[i] = NULL;
-       }
-   
-       /* if all tests succeed, jump to optimized loop header                      */
-       if (loop_head->next != original_start) {
-               inst->opc = ICMD_GOTO;
-               inst->dst = NULL;
-               inst->target = original_start;
-           }
-
-       /* redirect jumps from original loop head to newly inserted one             */
-       patch_jumps(original_start, loop_head, lc); 
-
-       /* if exceptions have to be correct due to loop duplication these two       */
-       /* functions perform this task.                                             */
-       update_internal_exceptions(lc, loop_head, original_start);
-       update_external_exceptions(lc->parent, lc->loop_head);
-}
-
-
-/*     This function performs an update between two arrays of struct Changes (that
-       reflect variable changes). The merge is performed unrstricted in the way, that
-       all variable changes in c1 took place in a nested loop and therefore are
-       considered to be without limit. Beside that, the merge is a simple union of the
-       changes recorded in both arrays. A variable, which limits are undefinied, is
-       represented by its lower bound being higher than the upper bound. The result 
-       of the union is stored in c1.
-*/
-struct Changes ** constraints_unrestricted_merge(struct Changes **c1, struct Changes **c2)
-{
-       int i, changed;
-
-       if ((c1 == NULL) || (c2 == NULL))
-               printf("C_ERROR: debugging error 0x03\n");
-
-       changed = 0;
-       for (i=0; i<maxlocals; ++i) {
-               if (c1[i] == NULL) {
-                       if (c2[i] != NULL) {            /* a change in c2 is updated in c1              */
-                               changed = 1;
-                               c1[i] = c2[i];
-                               c1[i]->lower_bound = c1[i]->upper_bound+1;
-                               }
-                       }
-               else {
-                       if (c1[i]->lower_bound > c1[i]->upper_bound)
-                               continue;                               /* variable's bounds already undefined  */
-
-                       if (c2[i] == NULL) {            /* variable changed in c1 -> now undef. */
-                               changed = 1;
-                               c1[i]->lower_bound = c1[i]->upper_bound+1;
-                               }
-                       else {
-                               if ((c1[i]->lower_bound == c2[i]->lower_bound) &&
-                                       (c1[i]->upper_bound == c2[i]->upper_bound))
-                                       continue;                       /* variable's bounds remain the same    */
-                               else {
-                                       changed = 1;
-                                       c1[i]->lower_bound = c1[i]->upper_bound+1;
-                                       }                                       /* variable changed in c1 -> now undef. */
-                               }
-                       }
-               }
-       
-       if (changed)
-               return c1;
-       else
-               return NULL;
-}
-
-/*     This function performs an update between two arrays of struct Changes (that
-       reflect variable changes). The merge is a simple union of the bounds
-       changes recorded in both arrays. A variable, which limits are undefinied, is
-       represented by its lower bound being higher than the upper bound. The result 
-       of the union is stored in c1.
-*/
-struct Changes ** constraints_merge(struct Changes **c1, struct Changes **c2)
-{
-       int i, changed;
-
-       if ((c1 == NULL) || (c2 == NULL))
-               printf("C_ERROR: debugging error 0x04\n");
-
-       changed = 0;
-
-       for (i=0; i<maxlocals; ++i) {
-               if (c1[i] == NULL) {
-                       if (c2[i] != NULL) {            /* update changes in c2 in c1                   */
-                               if ((c1[i] = (struct Changes *) malloc (sizeof(struct Changes))) == NULL)
-                                       c_mem_error();
-
-                                       c1[i]->lower_bound = c2[i]->lower_bound; 
-                                       c1[i]->upper_bound = c2[i]->upper_bound;
-                                       changed = 1;
-                               }       
-               }
-               else {
-                       if (c2[i] != NULL) {
-
-                               if (c1[i]->lower_bound > c1[i]->upper_bound)
-                                       continue;                       /* var in c1 is unrestricted                    */
-
-                               if (c1[i]->lower_bound > c2[i]->lower_bound) {
-                                       c1[i]->lower_bound = c2[i]->lower_bound;
-                                       changed = 1;            /* write new lower bound                                */
-                                       }
-                               if (c1[i]->upper_bound < c2[i]->upper_bound) {
-                                       c1[i]->upper_bound = c2[i]->upper_bound;
-                                       changed = 1;            /* write new higher bound                               */
-                                       }
-                               }
-                       }
-               }
-
-       if (changed)
-               return c1;
-       else
-               return NULL;
-}
-
-
-/*     This function simply copies an array of changes 
-*/
-struct Changes** constraints_clone(struct Changes **c)
-{
-       int i;
-       struct Changes **t;
-       
-       if ((t = (struct Changes **) malloc(maxlocals * sizeof(struct Changes *))) == NULL)
-               c_mem_error();
-
-       for (i=0; i<maxlocals; ++i) {           /* for all array elements (vars) do             */
-               if (c[i] == NULL)
-                       t[i] = NULL;
-               else {
-                       if ((t[i] = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
-                               c_mem_error();
-                       t[i]->lower_bound = c[i]->lower_bound;
-                       t[i]->upper_bound = c[i]->upper_bound;
-                       }
-               }
-       
-       return t;
-}
-
-/*     This function is used to reset the changes of a variable to the time, it was
-       pushed onto the stack. If a variable has been modified between an instruction
-       and a previous push onto the stack, its value in the changes array does not
-       correctly reflect its bounds the time, it was pushed onto the stack. This 
-       function corrects the situation.
-       */
-struct Changes* backtrack_var(int node, int from, int to, int varRef, struct Changes *changes)
-{
-       struct Changes *tmp;
-       basicblock bp;
-       instruction *ip;
-       struct Trace *t;
-
-       if (changes == NULL)    /* if there are no changes, immediately return          */
-               return NULL;
-       else {                                  /* init a Changes structure with current values         */
-               if ((tmp = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
-                       c_mem_error();
-               
-               tmp->upper_bound = changes->upper_bound;
-               tmp->lower_bound = changes->lower_bound;
-               }
-
-       if (tmp->upper_bound < tmp->lower_bound)
-               return tmp;                     /* if it is unrestricted no backtracking can happen     */
-
-       bp = block[node];
-       ip = bp.iinstr + to;
-
-       for (; from < to; --to, --ip) {         /* scan instructions backwards                  */
-               switch (ip->opc) {
-               case ICMD_IINC:                                 /* a var has been modified                              */
-                       if (varRef != ip->op1)          /* not the one, we are interested in    */
-                               break;
-                       tmp->upper_bound -= ip->val.i;          /* take back modifications              */
-                       tmp->lower_bound -= ip->val.i;
-                       break;
-
-               case ICMD_ISTORE:                               /* a var has been modified                              */
-                       if (varRef != ip->op1)          /* not the one, we are interested in    */
-                               break;
-
-                       /* it is our variable, so trace its origin                                                      */
-                       t = tracing(&block[node],to, 0);                
-       
-                       switch (t->type) {
-                               case TRACE_IVAR:  
-                                       if ((t->var = ip->op1) && (t->neg > 0)) {
-                                               /* it was the same var -> take back modifications               */
-                                               tmp->upper_bound -= t->constant;
-                                               tmp->lower_bound -= t->constant;
-                                               }               
-                                       else
-                                               tmp->lower_bound = tmp->upper_bound+1;  /* unknown              */
-                                       break;
-
-                               /* cannot restore it -> invalidate t                                                    */
-                               case TRACE_ICONST:
-                               case TRACE_ALENGTH:   
-                               case TRACE_UNKNOWN: 
-                               case TRACE_AVAR: 
-                                       tmp->lower_bound = tmp->upper_bound+1;   
-                                       break;
-                               }
-
-                       break;
-                       }
-               }
-       return tmp;
-}
-
-/*     This function performs the main task of bound check removal. It removes
-       all bound-checks in node. change is a pointer to an array of struct Changes
-       that reflect for all local variables, how their values have changed from
-       the start of the loop. The special flag is needed to deal with the header
-       node.
-*/
-void remove_boundchecks(int node, int from, struct Changes **change, int special)
-{
-       basicblock bp;
-       instruction *ip;
-       int i, count, ignore, degrade_checks, opt_level;
-       struct depthElement *d;
-       struct Changes **t1, **tmp, *t;
-       struct Trace *t_array, *t_index;
-
-       /* printf("remove_bc called: %d - %d - %d\n", node, from, special);                     */
-          
-       /* a flag, that is set, when previous optimzations have to be taken back        */
-       degrade_checks = 0;                     
-
-       if (c_current_loop[node] > 0) {         /* this node is part of the loop                */
-               if (c_current_loop[node] > 1) { /* it is not the header node                    */
-
-                       /* get variable changes, already recorded for this node                         */
-                       t1 = c_dTable[node]->changes;
-                       
-                       if (t1 != NULL) {                       /* it is not the first visit                    */
-                               if ((c_nestedLoops[node] != c_current_head) && (c_nestedLoops[node] == c_nestedLoops[from])) {
-                               /* we are looping in a nested loop, so made optimizations               */
-                               /* need to be reconsidered                                                                              */
-                                       degrade_checks = 1;
-                                       if (constraints_unrestricted_merge(t1, change) == NULL) 
-                                               return;                 /* no changes since previous visit              */
-                                               /* if there have been changes, they are updated by              */
-                                               /* constraints_unrestricted_merge in t1                                 */
-                                       }
-                               else {
-                                       if (constraints_merge(t1, change) == NULL)
-                                               return;                 /* no changes since previous visit              */
-                                               /* if there have been changes, they are updated by              */
-                                               /* constraints_merge in t1                                                              */
-                                       }
-                               }
-                       else {                                          /* first visit                                                  */
-                               /* printf("first visit - constraints cloned\n");                                */
-                               c_dTable[node]->changes = constraints_clone(change);
-                               }
-
-                       /* tmp now holds a copy of the updated variable changes                         */
-                       tmp = constraints_clone(c_dTable[node]->changes);       
-                       }
-               else if (special) {                             /* header and need special traetment    */
-                       /* printf("special treatment called\n");                                                        */
-                       /* tmp now holds a copy of the current new variable changes                     */
-                       tmp = constraints_clone(change);
-                       }
-               else
-                       return;
-
-               bp = block[node];                               /* scan all instructions                                */
-               count = bp.icount;
-               ip = bp.iinstr;
-               ignore = 0;
-
-               for (i=0; i<count; ++i, ++ip) {
-                       switch (ip->opc) {
-                       case ICMD_IASTORE:                      /* found an array store                                 */
-                       case ICMD_LASTORE:          
-                       case ICMD_FASTORE:          
-                       case ICMD_DASTORE:          
-                       case ICMD_AASTORE:          
-                       case ICMD_BASTORE:          
-                       case ICMD_CASTORE:          
-                       case ICMD_SASTORE:
-
-                               t_index = tracing(&bp, i-1, 1); /* get index                                    */
-                               t_array = tracing(&bp, i-1, 2); /* get array refernce                   */
-                               ignore = 1;
-                               /* fall through */
-
-                       case ICMD_IALOAD:                       /* found an array load                                  */
-                       case ICMD_LALOAD:       
-                       case ICMD_FALOAD:
-                       case ICMD_DALOAD:
-                       case ICMD_AALOAD:
-                       case ICMD_BALOAD:
-                       case ICMD_CALOAD:
-                       case ICMD_SALOAD:
-                               if (!ignore) {
-                                       t_index = tracing(&bp, i-1, 0); /* get index                            */
-                                       t_array = tracing(&bp, i-1, 1); /* get array refernce           */
-                                       ignore = 0;
-                                       }
-
-                               /* printf("Array access with params:\n");
-                               printf("Array:\n");
-                               show_trace(t_array);
-                               printf("Index:\n");
-                               show_trace(t_index);
-                               */
-
-#ifdef STATISTICS
-                               if (ip->op1 == OPT_UNCHECKED) {         /* found new access                     */
-                                  c_stat_array_accesses++;
-                                  ip->op1 = OPT_NONE;
-                                  c_stat_no_opt++;
-                                  }
-#endif
-
-                               /* can only optimize known arrays that do not change                    */
-                               if ((t_array->type != TRACE_AVAR) || (c_var_modified[t_array->var])) 
-                                       break;
-                               
-                               switch (t_index->type) {        /* now we look at the index                     */
-                               case TRACE_ICONST:                      /* it is a constant value or an         */
-                               case TRACE_ALENGTH:                     /* array length                                         */
-#ifdef STATISTICS
-                                       switch (ip->op1) {              /* take back old optimzation            */
-                                       case OPT_UNCHECKED:
-                                               break;
-                                       case OPT_NONE:
-                                               c_stat_no_opt--;
-                                               break;
-                                       case OPT_FULL:
-                                               c_stat_full_opt--;
-                                               break;
-                                       case OPT_UPPER:
-                                               c_stat_upper_opt--;
-                                               break;
-                                       case OPT_LOWER:
-                                               c_stat_lower_opt--;
-                                               break;
-                                               }
-#endif
-                                       if (degrade_checks)             /* replace existing optimization        */
-                                               ip->op1 = insert_static(t_array->var, t_index, NULL, special);
-                                       else {
-                                               /* Check current optimization and try to improve it     by      */
-                                               /* inserting new checks                                                                 */
-                                               switch (ip->op1) {      
-                                               case OPT_UNCHECKED:
-                                                       ip->op1 = insert_static(t_array->var, t_index, NULL, special);
-                                                       break;
-                                               case OPT_NONE:          
-                                                       ip->op1 = insert_static(t_array->var, t_index, NULL, special);
-                                                       break;
-                                               case OPT_UPPER:         
-                                                       opt_level = insert_static(t_array->var, t_index, NULL, special);
-                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_LOWER))
-                                                               ip->op1 = OPT_FULL;
-                                                       break;
-                                               case OPT_LOWER: 
-                                                       opt_level = insert_static(t_array->var, t_index, NULL, special);
-                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_UPPER))
-                                                               ip->op1 = OPT_FULL;
-                                                       break;
-                                               case OPT_FULL:
-#ifdef STATISTICS
-                                                       c_stat_full_opt++;
-#endif
-                                                       break;
-                                                       }
-                                               }
-                                       break;
-
-                               case TRACE_IVAR:                        /* it's a variable                                      */
-
-                                       /* if the variable is changed between its usage as an index     */
-                                       /* of the array access and its push onto the stack, we have     */
-                                       /* to set the changes back to the time, it is pushed onto       */
-                                       /* the stack as an index variable.                                                      */
-                                       t = backtrack_var(node, t_index->nr, i-1, t_index->var, tmp[t_index->var]);
-#ifdef STATISTICS
-                                       switch (ip->op1) {              /* take back old optimzation            */
-                                       case OPT_UNCHECKED:
-                                               break;
-                                       case OPT_NONE:
-                                               c_stat_no_opt--;
-                                               break;
-                                       case OPT_FULL:
-                                               c_stat_full_opt--;
-                                               break;
-                                       case OPT_UPPER:
-                                               c_stat_upper_opt--;
-                                               break;
-                                       case OPT_LOWER:
-                                               c_stat_lower_opt--;
-                                               break;
-                                               }
-#endif
-                                       if (degrade_checks)
-                                               ip->op1 = insert_static(t_array->var, t_index, t, special);
-                                       else {
-                                               /* Check current optimization and try to improve it     by      */
-                                               /* insert new check. t reflects var changes for index   */
-                                               switch (ip->op1) {
-                                               case OPT_UNCHECKED:
-                                                       ip->op1 = insert_static(t_array->var, t_index, t, special);
-                                                       break;
-                                               case OPT_NONE:
-                                                       ip->op1 = insert_static(t_array->var, t_index, t, special);
-                                                       break;
-                                               case OPT_UPPER:
-                                                       opt_level = insert_static(t_array->var, t_index, t, special);
-                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_LOWER))
-                                                               ip->op1 = OPT_FULL;
-                                                       break;
-                                               case OPT_LOWER: 
-                                                       opt_level = insert_static(t_array->var, t_index, t, special);
-                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_UPPER))
-                                                               ip->op1 = OPT_FULL;
-                                                       break;
-                                               case OPT_FULL:
-#ifdef STATISTICS
-                                                       c_stat_full_opt++;
-#endif
-                                                       break;
-                                                       }
-                                               }
-                                       break;
-
-                               case TRACE_UNKNOWN: 
-                               case TRACE_AVAR:    
-                                       break;
-                                       }
-                               break;
-               
-                       case ICMD_ISTORE:               /* an integer value is stored                           */
-                               t_index = tracing(&bp, i-1, 0); /* trace back its origin                */
-
-                               /* the struct Changes for this variable needs to be updated             */
-                               t = tmp[ip->op1];
-                               if (t == NULL) {        /* if it's the first one, create new entry      */
-                                       if ((t = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
-                                               c_mem_error();
-                                       t->upper_bound = t->lower_bound = 0;
-                                       tmp[ip->op1] = t;
-                                       }
-
-                               switch (t_index->type) {                /* check origin of store                */
-
-                               case TRACE_ICONST:      /* constant -> set bounds to const value        */
-                                       t->upper_bound = t->lower_bound = t_index->constant;
-                                       break;  
-
-                               case TRACE_IVAR:        /* if it's the same variable, update consts     */  
-                                       if ((t_index->var = ip->op1) && (t_index->neg > 0)) {
-                                               t->upper_bound += t_index->constant;
-                                               t->lower_bound += t_index->constant;
-                                               }
-                                       else
-                                               t->lower_bound = t->upper_bound+1;
-                                       break;
-
-                               case TRACE_ALENGTH:   /* else -> unknown                                                */
-                               case TRACE_UNKNOWN: 
-                               case TRACE_AVAR: 
-                                       t->lower_bound = t->upper_bound+1;   
-                                       break;
-                                       }
-
-                               break;
-
-                       case ICMD_IINC:                 
-
-                               /* the struct Changes for this variable needs to be updated             */
-                               if ((t = tmp[ip->op1]) == NULL) {       /* first one -> create new      */
-                                       if ((t = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
-                                               c_mem_error();
-                                       t->upper_bound = t->lower_bound = ip->val.i;
-                                       tmp[ip->op1] = t;
-                                       }  
-                               else {                          /* update changes, made by iinc                         */
-                                       t->upper_bound += ip->val.i;
-                                       t->lower_bound += ip->val.i;
-                                       }
-                               break;
-                               }       /* switch */
-                       }               /* for    */
-               
-               if (!special) {                         /* we are not interested in only the header     */
-                       d = c_dTable[node];
-                       while (d != NULL) {             /* check all sucessors of current node          */
-                               remove_boundchecks(d->value, node, tmp, special);       
-                               d = d->next;
-                               }
-                       }
-           }   /* if */
-}
-
-/*     This function calls the bound-check removal function for the header node
-       with a special flag. It is important to notice, that no dynamic 
-       constraint hold in the header node (because the comparison is done at
-       block end).
-*/
-void remove_header_boundchecks(int node, struct Changes **changes)
-{
-       remove_boundchecks(node, -1, changes, BOUNDCHECK_SPECIAL);
-}
-
-/*     Marks all basicblocks that are part of the loop
-*/
-void mark_loop_nodes(struct LoopContainer *lc)
-{
-       struct LoopElement *le = lc->nodes;
-
-       while (le != NULL) {
-               le->block->lflags |= LOOP_PART;
-               le = le->next;
-               }
-}
-
-/*     Clears mark for all basicblocks that are part of the loop
-*/
-void unmark_loop_nodes(struct LoopContainer *lc)
-{
-       struct LoopElement *le = lc->nodes;
-
-       while (le != NULL) {
-               le->block->lflags = 0;
-               le = le->next;
-               }
-}
-
-
-/*     This function performs the analysis of code in detected loops and trys to
-       identify array accesses suitable for optimization (bound check removal). The
-       intermediate code is then modified to reflect these optimizations.
-*/
-void optimize_single_loop(struct LoopContainer *lc)
-{
-       struct LoopElement *le;
-       struct depthElement *d;
-       int i, head, node;
-       struct Changes **changes;
-
-       if ((changes = (struct Changes **) malloc(maxlocals * sizeof(struct Changes *))) == NULL)
-               c_mem_error();
-
-    head = c_current_head = lc->loop_head;
-       c_needed_instr = c_rs_needed_instr = 0;
-
-       /* init array for null ptr checks */
-       for (i=0; i<maxlocals; ++i) 
-               c_null_check[i] = 0;
-
-
-       /* don't optimize root node (it is the main procedure, not a loop)                      */
-       if (head < 0)
-               return;
-
-       /* setup variables with initial values                                                                          */
-       c_loopvars = NULL;
-       for (i=0; i < block_count; ++i) {
-               c_toVisit[i] = 0;
-               c_current_loop[i] = -1;
-               if ((d = c_dTable[i]) != NULL)
-                       d->changes = NULL;
-               }
-
-       for (i=0; i < maxlocals; ++i) {
-               c_var_modified[i] = 0;
-               if (changes[i] != NULL) {
-                       changes[i] = NULL;
-                       }
-               }
-
-       for (i=0; i < (maxlocals+1); ++i) {
-               if (c_constraints[i] != NULL) {
-                   c_constraints[i] = NULL;
-                       }
-               }
-
-       le = lc->nodes;
-       while (le != NULL) {
-               node = le->node;
-
-               if (node == head)
-                       c_current_loop[node] = 1;   /* the header node gets 1               */
-               else if (c_nestedLoops[node] == head)
-                       c_current_loop[node] = 2;       /* top level nodes get 2                                */
-               else
-                       c_current_loop[node] = 3;       /* nodes, part of nested loop get 3             */
-               
-               c_toVisit[node] = 1;
-               le = le->next;
-               }
-
-       /* After setup work has been performed, start to analyse                                        */
-#ifdef LOOP_DEBUG
-       printf("****** Starting analysis (%d)******\n", head);                  
-       fflush(stdout);
-#endif
-
-       if (analyze_for_array_access(head) > 0) {/* loop contains array access          */
-
-#ifdef LOOP_DEBUG
-               struct LoopVar *lv;
-
-               printf("analyze for array access finished and found\n");        
-               fflush(stdout);
-               lv = c_loopvars;
-               while (lv != NULL) {
-                       if (lv->modified)
-                               printf("Var --> %d\n", lv->value);
-                       lv = lv->next;
-               }
-#endif
-
-               /* for performance reasons the list of all interesting loop vars is             */
-               /* scaned and for all modified vars a flag in c_var_modified is set             */
-               scan_global_list();                                     
-
-#ifdef LOOP_DEBUG
-               printf("global list scanned\n");
-               fflush(stdout);
-#endif
-
-               /* if the loop header contains or-conditions or an index variable               */
-               /* is modified in the catch-block within the loop, a conservative               */
-               /* approach is taken and optimizations are cancelled                                    */
-               if (analyze_or_exceptions(head, lc) > 0) {
-
-#ifdef LOOP_DEBUG
-                       printf("Analyzed for or/exception - no problems \n");            
-                       fflush(stdout);
-#endif
-
-                       init_constraints(head); /* analyze dynamic bounds in header                     */
-
-#ifdef LOOP_DEBUG                      
-                       show_right_side();
-#endif                                                                                         
-
-                       if (c_rightside == NULL)
-                               return;
-
-                       /* single pass bound check removal - for all successors, do                     */
-                       remove_header_boundchecks(head, changes);
-
-                       d = c_dTable[head];
-                       while (d != NULL) {
-                               remove_boundchecks(d->value, -1, changes, BOUNDCHECK_REGULAR);
-                               d = d->next;
-                               }
-           
-#ifdef LOOP_DEBUG
-                       printf("Array-bound checks finished\n");                                                        
-                       fflush(stdout);
-#endif
-
-                       mark_loop_nodes(lc);
-
-#ifdef LOOP_DEBUG                      
-                       printf("START: create static checks\n");
-                       fflush(stdout);
-#endif
-
-                       create_static_checks(lc);       /* create checks                                                */
-
-#ifdef LOOP_DEBUG
-                       printf("END: create static checks\n");
-                       fflush(stdout);
-#endif
-                       unmark_loop_nodes(lc);
-                       }
-               }
-       /* else
-               printf("No array accesses found\n");                                                                    */
-
-#ifdef STATISTICS
-       c_stat_num_loops++;             /* increase number of loops                                                     */      
-
-       c_stat_sum_accesses += c_stat_array_accesses;
-       c_stat_sum_full += c_stat_full_opt;
-       c_stat_sum_no += c_stat_no_opt;
-       c_stat_sum_lower += c_stat_lower_opt;
-       c_stat_sum_upper += c_stat_upper_opt;
-       c_stat_sum_or += c_stat_or;
-       c_stat_sum_exception += c_stat_exception;
-
-       c_stat_array_accesses = 0;              
-       c_stat_full_opt = 0;
-       c_stat_no_opt = 0;
-       c_stat_lower_opt = 0;
-       c_stat_upper_opt = 0;   
-       c_stat_or = c_stat_exception = 0;
-#endif
-       
-}
-
-/*     This function preforms necessary setup work, before the recursive function
-       optimize_single loop can be called.
-*/
-void optimize_loops()
-{
-       struct LoopContainer *lc = c_allLoops;
-
-       /* first, merge loops with same header node - all loops with the same           */
-       /* header node are optimizied in one pass, because they all depend on the       */
-       /* same dynamic loop condition                                                                                          */
-
-#ifdef LOOP_DEBUG
-       printf("start analyze_double_headers\n");
-       fflush(stdout);
-#endif
-
-       analyze_double_headers();
-
-       /* create array with loop nesting levels - nested loops cause problems,         */
-       /* especially, when they modify index variables used in surrounding     loops   */
-       /* store results in array c_nestedLoops and c_hierarchie                                        */
-
-#ifdef LOOP_DEBUG
-       printf("double done\n");
-       fflush(stdout);
-#endif
-
-       analyze_nested();
-
-#ifdef LOOP_DEBUG
-       printf("analyze nested done\n");
-       fflush(stdout);
-#endif
-
-       /* create array with entries for current loop                                                           */
-       c_current_loop = DMNEW(int, block_count);       
-       c_toVisit = DMNEW(int, block_count);
-       c_var_modified = DMNEW(int, maxlocals);
-       c_null_check = DMNEW(int, maxlocals);
-
-       if ((c_constraints = (struct Constraint **) malloc((maxlocals+1) * sizeof(struct Constraint *))) == NULL)
-               c_mem_error();
-
-#ifdef STATISTICS
-       c_stat_num_loops = 0;           /* set statistic vars to zero                                   */
-       c_stat_array_accesses = c_stat_sum_accesses = 0;                
-       c_stat_full_opt = c_stat_sum_full = 0;
-       c_stat_no_opt = c_stat_sum_no = 0;
-       c_stat_lower_opt = c_stat_sum_lower = 0;
-       c_stat_upper_opt = c_stat_sum_upper = 0;
-       c_stat_or = c_stat_sum_or = 0;
-       c_stat_exception = c_stat_sum_exception = 0;
-#endif
-       /* init vars needed by all loops                                            */
-       c_needs_redirection = false;
-       c_newstart = NULL;
-       c_old_xtablelength = exceptiontablelength;
-
-       /* loops have been topologically sorted                                     */
-       lc = c_allLoops;
-       while (lc != NULL) {
-               optimize_single_loop(lc);
-
-#ifdef LOOP_DEBUG
-               printf(" *** Optimized loop *** \n");
-               fflush(stdout);
-#endif
-
-               lc = lc->next;
-               }
-#ifdef LOOP_DEBUG
-       printf("---*** All loops finished ***---\n");
-       fflush(stdout);
-#endif
-
-       /* if global BB list start is modified, set block to new start              */
-       if (c_needs_redirection == true)
-               block = c_newstart;
-
-}
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
-
-
-
diff --git a/narray/graph.c b/narray/graph.c
deleted file mode 100644 (file)
index 97325f8..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-/* graph.c *********************************************************************
-
-        Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-        See file COPYRIGHT for information on usage and disclaimer of warranties.
-
-        Contains the functions which build a list, that represents the control
-               flow graph of the procedure, that is being analyzed.
-
-        Authors: Christopher Kruegel      EMAIL: cacao@complang.tuwien.ac.at
-
-        Last Change: 1998/17/02
-
-*******************************************************************************/
-
-void dF(int from, int blockIndex);
-                                                       
-void LoopContainerInit(struct LoopContainer *lc, int i)
-{
-       struct LoopElement *le = DMNEW(struct LoopElement, 1);
-
-       le->next = NULL;
-
-       lc->parent = NULL;
-
-       lc->tree_right = NULL;
-       lc->tree_down = NULL;
-
-       lc->exceptions = NULL;
-
-       lc->in_degree = 0;
-       le->node = lc->loop_head = i;
-       le->block = &block[i];
-
-       /* lc->nodes = (int *) malloc(sizeof(int)*block_count);
-       lc->nodes[0] = i; */
-
-       lc->nodes = le;
-}
-       
-/*     depthFirst() builds the control flow graph out of the intermediate code of  
-       the procedure, that is to be optimized and stores the list in the global 
-       variable c_dTable 
-*/                                                                     
-void depthFirst()
-{
-       int i;
-
-/*     allocate memory and init gobal variables needed by function dF(int, int)        */
-  
-       if ((c_defnum = (int *) malloc(block_count * sizeof(int))) == NULL)             
-               c_mem_error();
-       if ((c_numPre = (int *) malloc(block_count * sizeof(int))) == NULL)
-               c_mem_error();
-       if ((c_parent = (int *) malloc(block_count * sizeof(int))) == NULL)
-               c_mem_error();
-       if ((c_reverse = (int *) malloc(block_count * sizeof(int))) == NULL)
-               c_mem_error();
-       
-       if ((c_pre = (int **) malloc(block_count * sizeof(int *))) == NULL)
-               c_mem_error(); 
-
-       if ((c_dTable = (struct depthElement **) malloc(block_count * sizeof(struct depthElement *))) == NULL)
-               c_mem_error();
-       
-       for (i = 0; i < block_count; ++i) {
-               c_defnum[i] = c_parent[i] = -1;
-               c_numPre[i] = c_reverse[i] = 0;
-
-               if ((c_pre[i] = (int *) malloc(block_count * sizeof(int))) == NULL)
-                       c_mem_error();
-               c_dTable[i] = NULL;
-           }
-  
-       c_globalCount = 0;
-       c_allLoops = NULL;
-  
-       dF(-1, 0);      /* call helper function dF that traverses basic block structure */
-}
-
-/*     dF starts from the first block of the given procedure and traverses the 
-       control flow graph in a depth-first order, thereby building up the adeacency
-       list c_dTable
-*/ 
-void dF(int from, int blockIndex)
-{
-       instruction *ip;
-       s4 *s4ptr;
-       int high, low, count;
-       struct depthElement *hp;
-       struct LoopContainer *tmp; 
-       int cnt, *ptr;
-       
-       if (from >= 0) {        
-/*     the current basic block has a predecessor (ie. is not the first one)            */
-               if ((hp = (struct depthElement *) malloc(sizeof(struct depthElement))) == NULL)
-                       c_mem_error();                  /* cretae new depth element                                     */
-
-               hp->next = c_dTable[from];      /* insert values                                                        */
-               hp->value = blockIndex;
-               hp->changes = NULL;
-               
-               c_dTable[from] = hp;    /* insert into table                                                    */
-           }
-  
-       if (from == blockIndex) {       /* insert one node loops into loop container    */
-               if ((tmp = (struct LoopContainer *) malloc(sizeof(struct LoopContainer))) == NULL)
-                       c_mem_error();
-               LoopContainerInit(tmp, blockIndex);
-               tmp->next = c_allLoops;
-               c_allLoops = tmp;
-           }
-
-#ifdef C_DEBUG
-       if (blockIndex > block_count) {
-               fprintf(stderr, "DepthFirst: BlockIndex exceeded\n");
-               exit(1);
-               }               
-#endif
-
-       ip = block[blockIndex].iinstr + block[blockIndex].icount -1;
-                                                                               /* set ip to last instruction                   */
-                                                                       
-       if (c_defnum[blockIndex] == -1) {       /* current block has not been visited   */
-           c_defnum[blockIndex] = c_globalCount;       /* update global count                  */
-           c_parent[blockIndex] = from;        /* write parent block of current one    */
-               c_reverse[c_globalCount] = blockIndex;
-               ++c_globalCount;
-               
-               if (!block[blockIndex].icount) {
-                                                                               /* block does not contain instructions  */
-                       dF(blockIndex, blockIndex+1);
-                   }
-               else {                                                  /* for all successors, do                               */
-                       switch (ip->opc) {                      /* check type of last instruction               */
-                       case ICMD_RETURN:
-                       case ICMD_IRETURN:
-                       case ICMD_LRETURN:
-                       case ICMD_FRETURN:
-                       case ICMD_DRETURN:
-                       case ICMD_ARETURN:
-                       case ICMD_ATHROW:
-                               break;                                  /* function returns -> end of graph             */        
-                               
-                       case ICMD_IFEQ:
-                       case ICMD_IFNE:
-                       case ICMD_IFLT:
-                       case ICMD_IFGE:
-                       case ICMD_IFGT:
-                       case ICMD_IFLE:
-                       case ICMD_IFNULL:
-                       case ICMD_IFNONNULL:
-                       case ICMD_IF_ICMPEQ:
-                       case ICMD_IF_ICMPNE:
-                       case ICMD_IF_ICMPLT:
-                       case ICMD_IF_ICMPGE:
-                       case ICMD_IF_ICMPGT:
-                       case ICMD_IF_ICMPLE:
-                       case ICMD_IF_ACMPEQ:
-                       case ICMD_IF_ACMPNE:                            /* branch -> check next block   */
-                          dF(blockIndex, blockIndex + 1);
-                          /* fall throu */
-                          
-                       case ICMD_GOTO:
-                               dF(blockIndex, block_index[ip->op1]);         
-                               break;                                                  /* visit branch (goto) target   */
-                               
-                       case ICMD_TABLESWITCH:                          /* switch statement                             */
-                               s4ptr = ip->val.a;
-                               
-                               dF(blockIndex, block_index[*s4ptr]);    /* default branch               */
-                               
-                               s4ptr++;
-                               low = *s4ptr;
-                               s4ptr++;
-                               high = *s4ptr;
-                               
-                               count = (high-low+1);
-                               
-                               while (--count >= 0) {
-                                       s4ptr++;
-                                       dF(blockIndex, block_index[*s4ptr]);
-                                   }
-                               break;
-                               
-                       case ICMD_LOOKUPSWITCH:                         /* switch statement                             */
-                               s4ptr = ip->val.a;
-                          
-                               dF(blockIndex, block_index[*s4ptr]);    /* default branch               */
-                               
-                               ++s4ptr;
-                               count = *s4ptr++;
-                               
-                               while (--count >= 0) {
-                                       dF(blockIndex, block_index[s4ptr[1]]);
-                                       s4ptr += 2;
-                                   }
-                               break;
-
-                       case ICMD_JSR:
-                               c_last_jump = blockIndex;
-                               dF(blockIndex, block_index[ip->op1]);         
-                               break;
-                               
-                       case ICMD_RET:
-                               dF(blockIndex, c_last_jump+1);
-                               break;
-                               
-                       default:
-                               dF(blockIndex, blockIndex + 1);
-                               break;  
-                           }                         
-                   }
-           } 
-
-       for (ptr = c_pre[blockIndex], cnt = 0; cnt < c_numPre[blockIndex]; ++cnt, ++ptr)
-       {
-               if (*ptr == from)
-                       break;
-       }
-
-       if (cnt >= c_numPre[blockIndex]) {      
-               c_pre[blockIndex][c_numPre[blockIndex]] = from;
-                                                   /* add predeccessors to list c_pre          */
-               c_numPre[blockIndex]++;                         /* increase number of predecessors      */              
-           }
-    
-}
-
-/* a slightly modified version of dF(int, int) that is used to traverse the part 
-   of the control graph that is not reached by normal program flow but by the 
-   raising of exceptions (code of catch blocks)
-*/
-void dF_Exception(int from, int blockIndex)
-{
-       instruction *ip;
-       s4 *s4ptr;
-       int high, low, count;
-       struct depthElement *hp;
-
-       if (c_exceptionVisit[blockIndex] < 0)   /* has block been visited, return       */
-               c_exceptionVisit[blockIndex] = 1;
-       else
-               return;
-
-       if (c_dTable[blockIndex] != NULL)               /* back to regular code section         */
-               return;
-
-       if (from >= 0) {                /* build exception graph (in c_exceptionGraph)          */
-           if ((hp = (struct depthElement *) malloc(sizeof(struct depthElement))) == NULL)
-                       c_mem_error();
-
-               hp->next = c_exceptionGraph[from];              
-               hp->value = blockIndex;
-               hp->changes = NULL;
-
-               c_exceptionGraph[from] = hp;
-           }
-       
-#ifdef C_DEBUG
-       if (blockIndex > block_count) {
-               fprintf(stderr, "DepthFirst: BlockIndex exceeded\n");
-               exit(1);
-        }
-#endif
-
-       ip = block[blockIndex].iinstr + block[blockIndex].icount -1;
-       
-       if (!block[blockIndex].icount)
-               dF_Exception(blockIndex, blockIndex+1);
-       else {
-               switch (ip->opc) {
-               case ICMD_RETURN:
-               case ICMD_IRETURN:
-               case ICMD_LRETURN:
-               case ICMD_FRETURN:
-               case ICMD_DRETURN:
-               case ICMD_ARETURN:
-               case ICMD_ATHROW:
-                       break;                                 
-               
-               case ICMD_IFEQ:
-               case ICMD_IFNE:
-               case ICMD_IFLT:
-               case ICMD_IFGE:
-               case ICMD_IFGT:
-               case ICMD_IFLE:
-               case ICMD_IFNULL:
-               case ICMD_IFNONNULL:
-               case ICMD_IF_ICMPEQ:
-               case ICMD_IF_ICMPNE:
-               case ICMD_IF_ICMPLT:
-               case ICMD_IF_ICMPGE:
-               case ICMD_IF_ICMPGT:
-               case ICMD_IF_ICMPLE:
-               case ICMD_IF_ACMPEQ:
-               case ICMD_IF_ACMPNE:
-                       dF_Exception(blockIndex, blockIndex + 1);
-                       /* fall throu */
-         
-               case ICMD_GOTO:
-                       dF_Exception(blockIndex, block_index[ip->op1]);         
-                       break;
-         
-               case ICMD_TABLESWITCH:
-                       s4ptr = ip->val.a;
-                       
-                       /* default branch */
-                       dF_Exception(blockIndex, block_index[*s4ptr]);
-                       
-                       s4ptr++;
-                       low = *s4ptr;
-                       s4ptr++;
-                       high = *s4ptr;
-                       
-                       count = (high-low+1);
-
-                       while (--count >= 0) {
-                               s4ptr++;
-                               dF_Exception(blockIndex, block_index[*s4ptr]);
-                           }
-                       break;
-
-               case ICMD_LOOKUPSWITCH:
-                       s4ptr = ip->val.a;
-                       /* default branch */
-                       dF_Exception(blockIndex, block_index[*s4ptr]);
-                       
-                       ++s4ptr;
-                       count = *s4ptr++;
-
-                       while (--count >= 0) {
-                               dF_Exception(blockIndex, block_index[s4ptr[1]]);
-                               s4ptr += 2;
-                           }  
-                       break;
-
-               case ICMD_JSR:
-                       c_last_jump = blockIndex;
-                       dF_Exception(blockIndex, block_index[ip->op1]);         
-                       break;
-       
-               case ICMD_RET:
-                       dF_Exception(blockIndex, c_last_jump+1);
-                       break;
-                       
-               default:
-                       dF_Exception(blockIndex, blockIndex + 1);
-                       break;  
-                   }                         
-        }
-}
-
-/*     Test function -> will be removed in final release
-*/
-void resultPass1()
-{
-       int i, j;
-       struct depthElement *hp;
-       
-       printf("\n\n****** PASS 1 ******\n\n");
-       printf("Number of Nodes: %d\n\n", c_globalCount);
-       printf("Predecessors:\n");
-       for (i=0; i<block_count; ++i) {
-               printf("Block %d:\t", i);
-               for (j=0; j<c_numPre[i]; ++j)
-                       printf("%d ", c_pre[i][j]);
-               printf("\n");
-       }
-       printf("\n");
-
-       printf("Graph:\n");
-       for (i=0; i<block_count; ++i) {
-               printf("Block %d:\t", i);
-               hp = c_dTable[i];
-               
-               while (hp != NULL) {
-                       printf("%d ", hp->value);
-                       hp = hp->next;
-                   }
-               printf("\n");
-           }
-       printf("\n");
-}
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/narray/loop.c b/narray/loop.c
deleted file mode 100644 (file)
index ae3dbed..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/* loop.c **********************************************************************
-
-        Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-        See file COPYRIGHT for information on usage and disclaimer of warranties.
-
-        Contains the functions which use the control flow graph to do loop detection.
-               The loop detection is performed according to Lengauer-Tarjan algorithm 
-               that uses dominator trees (found eg. in modern compiler implementation
-               by a.w. appel)
-
-        Authors: Christopher Kruegel      EMAIL: cacao@complang.tuwien.ac.at
-
-        Last Change: 1998/17/02
-
-*******************************************************************************/
-
-/*     This function allocates and initializes variables, that are used by the
-        loop detection algorithm
-*/
-void setup()
-{
-       int i;
-
-       c_semi_dom = (int *) malloc(block_count * sizeof(int));
-       c_idom = (int *) malloc(block_count * sizeof(int));
-       c_same_dom = (int *) malloc(block_count * sizeof(int));
-       c_numBucket = (int *) malloc(block_count * sizeof(int));
-       c_ancestor = (int *) malloc(block_count * sizeof(int));
-       c_contains = (int *) malloc(block_count * sizeof(int));
-       c_stack = (int *) malloc(block_count * sizeof(int));
-
-       c_bucket = (int **) malloc(block_count * sizeof(int *));
-  
-       for (i=0; i<block_count; ++i) {
-               c_numBucket[i] = 0;
-               c_stack[i] = c_ancestor[i] = c_semi_dom[i] = c_same_dom[i] = c_idom[i] = -1;
-         
-               c_bucket[i] = (int *) malloc(block_count * sizeof(int));
-               }
-}
-
-/*     This function is a helper function for dominators and has to find the 
-       ancestor of the node v in the control graph, which semi-dominator has the  
-       lowest def-num.
-*/
-int findLowAnc(int v)
-{
-       int u = v;                      /* u is the node which has the current lowest semi-dom  */
-  
-       while (c_ancestor[v] != -1) {   /* as long as v has an ancestor, continue       */
-               if (c_defnum[c_semi_dom[v]] < c_defnum[c_semi_dom[u]])  
-                                                                       /* if v's semi-dom is smaller                           */
-                       u = v;                                  /* it gets the new current node u                       */
-               v = c_ancestor[v];                      /* climb one step up in the tree                        */
-               }
-       return u;                       /* return node with the lowest semi-dominator def-num   */
-}
-
-
-/*     This function builds the dominator tree out of a given control flow graph and 
-       stores its results in c_idom[]. It first calculates the number of possible
-       dominators in c_bucket and eventually determines the single dominator in a 
-       final pass.
-*/
-void dominators()
-{
-       int i, j, semi, s, n, v, actual, p, y;
-  
-       for (n=(c_globalCount-1); n>0; --n) {   /* for all nodes (except last), do      */
-               actual = c_reverse[n];
-               semi = p = c_parent[actual];            
-       
-               /* for all predecessors of current node, do                                                             */
-               for (i=0; i<c_numPre[actual]; ++i) {
-                       v = c_pre[actual][i];
-      
-                       if (c_defnum[v] <= c_defnum[actual])
-                               s = v;                  /* if predecessor has lower def-num     than node       */
-                                                               /* it becomes candidate for semi dominator              */
-                       else
-                               s = c_semi_dom[findLowAnc(v)];
-                                                               /* else the semi-dominator of it's ancestor             */
-                                                               /* with lowest def-num becomes candidate                */
-                       
-                       if (c_defnum[s] < c_defnum[semi])
-                               semi = s;               /* if the def-num of the new candidate is lower */
-                                                               /* than old one, it gets new semi dominator             */
-                       }
-    
-               /* write semi dominator -> according to SEMIDOMINATOR THEOREM                   */
-               c_semi_dom[actual] = semi;                              
-               c_ancestor[actual] = p;                                 
-    
-               c_bucket[semi][c_numBucket[semi]] = actual;
-               c_numBucket[semi]++;    /* defer calculation of dominator to final pass */
-      
-
-               /* first clause of DOMINATOR THEOREM, try to find dominator now                 */
-               for (j=0; j<c_numBucket[p]; ++j) {
-                       v = c_bucket[p][j];
-                       y = findLowAnc(v);
-      
-                       if (c_semi_dom[y] == c_semi_dom[v])     
-                               c_idom[v] = p;                  /* if y's dominator is already known    */
-                                                                               /* found it and write to c_idom                 */
-                       else
-                               c_same_dom[v] = y;              /* wait till final pass                                 */
-                       }
-               
-               c_numBucket[p] = 0;
-               }
-  
-       /* final pass to get missing dominators ->second clause of DOMINATOR THEORM     */
-       for (j=1; j<(c_globalCount-1); ++j) {           
-               if (c_same_dom[c_reverse[j]] != -1)     
-                       c_idom[c_reverse[j]] = c_idom[c_same_dom[c_reverse[j]]];
-               }
-}
-
-/*     A helper function needed by detectLoops() that checks, whether a given 
-       connection between two nodes in the control flow graph is possibly part
-       of a loop (is a backEdge).
-*/
-int isBackEdge(int from, int to)
-{
-       int tmp = c_idom[to];   /* speed optimization: if the to-node is dominated      */
-       while (tmp != -1) {             /* by the from node as it is most of the time,          */
-               if (tmp == from)        /* there is no backEdge                                                         */
-                       return 0;
-               tmp = c_idom[tmp];
-               }
-
-       tmp = c_idom[from];             /* if from-node doesn't dominate to-node, we have       */
-       while (tmp != -1) {             /* to climb all the way up from the from-node to        */
-               if (tmp == to)          /* the top to check, whether it is dominated by to      */
-                       return 1;               /* if so, return a backedge                                                     */
-               tmp = c_idom[tmp];
-               }
-
-       return 0;                               /* else, there is no backedge                                           */
-}
-
-
-/*     These stack functions are helper functions for createLoop(int, int)  
-       to manage the set of nodes in the current loop.
-*/
-void push(int i, struct LoopContainer *lc)
-{
-       struct LoopElement *le = lc->nodes, *t;
-
-       if (!c_contains[i])
-       {
-               t = DMNEW(struct LoopElement, 1);
-               
-               t->node = i;
-               t->block = &block[i];
-
-               c_contains[i] = 1;
-
-               if (i < le->node)
-               {
-                       t->next = lc->nodes;
-                       lc->nodes = t;
-               }
-               else
-               {
-                       while ((le->next != NULL) && (le->next->node < i))
-                               le = le->next;
-
-                       t->next = le->next;
-                       le->next = t;
-               }
-
-               c_stack[c_stackPointer++] = i;
-       }
-}
-int pop()
-{
-       return (c_stack[--c_stackPointer]);
-}
-int isFull()
-{
-       return (c_stackPointer);
-}
-
-
-/*     This function is a helper function, that finds all nodes, that belong to 
-       the loop with a known header node and a member node of the loop (and a 
-       back edge between these two nodes).
-*/
-void createLoop(int header, int member)
-{
-       int i, nextMember;
-
-       struct LoopContainer *currentLoop = (struct LoopContainer *) malloc(sizeof(struct LoopContainer));
-       LoopContainerInit(currentLoop, header);         /* set up loop structure                */
-       
-       for (i=0; i<block_count; ++i)
-               c_contains[i] = 0;
-       c_contains[header] = 1;
-
-       c_stackPointer = 0;                             /* init stack with first node of the loop       */
-       push(member, currentLoop);
-
-       while (isFull()) {                              /* while there are still unvisited nodes        */
-               nextMember = pop();
-               
-               /* push all predecessors, while they are not equal to loop header               */
-               for (i=0; i<c_numPre[nextMember]; ++i)                  
-                       push(c_pre[nextMember][i], currentLoop);                
-               }
-
-       currentLoop->next = c_allLoops;
-       c_allLoops = currentLoop;
-}
-
-
-/*     After all dominators have been calculated, the loops can be detected and
-        added to the global list c_allLoops.
-*/
-void detectLoops()
-{
-       int i;
-       struct depthElement *h;
-       
-       /* for all edges in the control flow graph do                                                           */
-       for (i=0; i<block_count; ++i) {                 
-               h = c_dTable[i];
-
-               while (h != NULL) {
-                       /* if it's a backedge, than add a new loop to list                                      */
-                       if (isBackEdge(i, h->value))     
-                               createLoop(h->value, i);
-                       h = h->next;
-                       }
-               }
-}
-
-/*     This function is called by higher level routines to perform the loop 
-       detection and set up the c_allLoops list.
-*/
-void analyseGraph()
-{
-  setup();
-  dominators();
-  detectLoops();
-}
-
-/*     Test function -> will be removed in final release
-*/
-void resultPass2()
-{
-  int i;
-  struct LoopContainer *lc = c_allLoops;
-  struct LoopElement *le;
-  
-  printf("\n\n****** PASS 2 ******\n\n");
-  
-  printf("Loops:\n\n");
-  
-  i = 0;
-  while (lc != NULL) {
-         printf("Loop [%d]: ", ++i);
-
-         le = lc->nodes;
-         while (le != NULL) {
-           printf("%d ", le->node);
-               printf("\n");
-               le = le->next;
-         }
-
-         lc = lc->next;
-  }
-
-  printf("\n");
-
-}
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
-
-
-
diff --git a/narray/loop.h b/narray/loop.h
deleted file mode 100644 (file)
index 615dfbb..0000000
+++ /dev/null
@@ -1,343 +0,0 @@
-/* loop.h **********************************************************************
-
-        Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-        See file COPYRIGHT for information on usage and disclaimer of warranties.
-
-               Main header file for array bound removal files
-        
-        Authors: Christopher Kruegel      EMAIL: cacao@complang.tuwien.ac.at
-
-        Last Change: 1998/17/02
-
-*******************************************************************************/
-
-#ifndef __C_ARRAYBOUND_
-#define __C_ARRAYBOUND_
-
-/* #define LOOP_DEBUG */
-
-/*     GLOBAL DEFINES                                                                                                                          */
-
-
-/*     Different types for struct Trace                                                                                        */
-#define TRACE_UNKNOWN 0                        /* unknown                                                                              */
-#define TRACE_ICONST  1                        /* integer constant value                                               */
-#define TRACE_ALENGTH 2                        /* array length value                                                   */
-#define TRACE_IVAR    3                        /* integer variable reference                                   */
-#define TRACE_AVAR    4                        /* object (array) reference                                             */
-
-/*     The ways a variable can be used in a loop                                                                       */
-#define ARRAY_INDEX      0                     /* var used as array index                                              */
-#define VAR_MOD                  1                     /* var changes its value                                                */
-
-/*     The way, integer variables change their values                                                          */
-#define D_UP             0                     /* var is only increased                                                */
-#define D_DOWN           1                     /* var is only decreased                                                */
-#define D_UNKNOWN        2                     /* not known                                                                    */
-
-/*     The different types of operators in loop conditions                                                     */
-#define OP_EQ            0                     /* operator:    ==                                                              */
-#define OP_LT         1                        /* operator:    <                                                               */
-#define OP_GE        2                 /* operator:    >=                                                              */
-#define OP_UNKNOWN       3                     /* operator:    unknown                                                 */
-
-/*     Possible types of static tests (constraints) in struct Constraint                       */
-#define TEST_ZERO                      0       /* check variable against const. lower bound    */
-#define TEST_ALENGTH           1       /* check variable against array length                  */
-#define TEST_CONST_ZERO                2       /* check constant against const. lower bound    */
-#define TEST_CONST_ALENGTH     3       /* check variable against array length                  */
-#define TEST_UNMOD_ZERO                4       /* check var. that is constant in loop against  */
-                                                               /* constant lower bound                                                 */
-#define TEST_UNMOD_ALENGTH     5       /* check var. that is constant in loop against  */
-                                                               /* array length                                                                 */
-#define TEST_RS_ZERO           6       /* check constant part of loop condition against*/
-                                                               /* constant lower bound                                                 */
-#define TEST_RS_ALENGTH                7       /* check constant part of loop condition against*/
-                                                               /* array length                                                                 */
-
-/*     Possible types of bound check optimizations                                                                     */
-#define OPT_UNCHECKED  0               /* access not checked yet - first visit                 */
-#define OPT_NONE               1               /* no optimization                                                              */
-#define OPT_FULL               2               /* fully remove bound check                                             */
-#define OPT_LOWER              3               /* remove check againt zero                                             */
-#define OPT_UPPER              4               /* remove check against array length                    */
-
-/*     The different ways, remove_boundcheck(.) can be called                                          */ 
-#define BOUNDCHECK_REGULAR     0       /* perform regular optimization                                 */
-#define BOUNDCHECK_SPECIAL     1       /* only optimize header node - and ignore               */
-                                                               /* information from loop condition                              */
-
-#define LOOP_PART       0x1     /* a flag that marks a BB part of a loop        */
-#define HANDLER_PART    0x2     /* a flag that marks a BB part of ex-handler    */
-#define HANDLER_VISITED 0x4     /* flag to prevent loop if copying catch blocks */
-
-/*     STRUCT DEFINITIONS                                                                                                                      */
-
-/*     This struct records information about interesting vars (vars that are modified
-       or used as an array index in loops.
-*/
-struct LoopVar
-{
-       int value;                                      /* reference to array of local variables                */
-
-       int modified;                           /* set if value of var is changed                               */
-       int index;                                      /* set if var is used as array index                    */
-
-       int static_l;                           /* var is never decremented -> static lower             */
-                                                               /* bound possible                                                               */
-       int static_u;                           /* var is never incremented -> static upper             */
-                                                               /* bound possible                                                               */
-       int dynamic_l;
-       int dynamic_l_v;                        /* variable is left side of loop condition in   */
-                                                               /* variable + dynamic_l >= right side                   */
-       int dynamic_u;
-       int dynamic_u_v;                        /* variable is left side of loop condition in   */
-                                                               /* variable + dynamic_u < right side                    */
-       struct LoopVar *next;           /* list pointer                                                                 */
-};
-
-/*     This struct records the needed static test of variables before loop entry.      */
-struct Constraint
-{
-       int type;                                       /* type of test to perform                                              */
-
-       int arrayRef;                           /* array reference involved in test (if any)    */
-       int varRef;                                     /* which variable to test (if involved)                 */
-       int constant;                           /* which constant to test (if involved)                 */
-
-       struct Constraint *next;        /* list pointer                                                                 */
-};
-
-/* This structure is used to record variables that change their value in loops.        */
-struct Changes
-{
-       int var;                                        /* variable involved                                                    */
-       int lower_bound;                        /* a minimum lower bound that is guaranteed             */
-       int upper_bound;                        /* a maximum upper bound that is guaranteed             */
-                                                               /* IMPORTANT: if lower_bound > upper_bound              */
-                                                               /* there are no guarantees at all                               */
-};
-
-/*     This struct is used to build the control flow graph and stores the variable     
-       changes at the beginning of each basic block.
-*/
-struct depthElement
-{
-       int value;                                      /* number of successor of this block                    */
-       struct depthElement *next;      /* list pointer                                                                 */
-       struct Changes **changes;       /* pointer to array of variable changes                 */
-};
-
-/*     Used to build a list of all basicblock, the loop consists of                            
-*/
-struct LoopElement
-{
-       int node;
-       basicblock      *block;                 
-       struct LoopElement *next;
-};
-
-/*     This structure stores informations about a single loop
-*/
-struct LoopContainer
-{
-       int toOpt;                                                      /* does this loop need optimization             */
-               
-       struct LoopElement *nodes;          /* list of BBs this loop consists of    */
-       int loop_head;                      
-       int in_degree;                      /* needed to topological sort loops to  */
-                                           /* get the order of optimizing them     */
-       
-       struct LoopContainer *next;                     /* list pointer                                                 */
-       struct LoopContainer *parent;           /* points to parent loop, if this BB    */
-                                                                               /* is head of a loop                                    */
-
-       struct LoopContainer *tree_right;   /* used for tree hierarchie of loops    */
-       struct LoopContainer *tree_down;
-
-       xtable *exceptions;                 /* list of exception in that loop       */
-};
-
-/*     This struct is needed to record the source of operands of intermediate code
-       instructions. The instructions are scanned backwards and the stack is 
-       analyzed in order to determine the type of operand.
-*/
-struct Trace
-{
-       int type;                                       /* the type of the operand                                              */
-
-       int neg;                                        /* set if negated                                                               */
-       int var;                                        /* variable reference   for IVAR                                */
-                                                               /* array reference              for AVAR/ARRAY                  */
-       int nr;                                         /* instruction number in the basic block, where */
-                                                               /* the trace is defined                                                 */
-       int constant;                           /* constant value               for ICONST                              */
-                                                               /* modifiers                    for IVAR                                */
-};
-
-
-
-/* FUNCTIONS                                                                                                                                   */
-
-void c_mem_error()
-{
-  printf("C_ERROR: Not enough memeory\n");
-  exit(-1);
-} 
-
-/* GLOBAL VARS                                                                                                                                 */
-
-int c_debug_nr;                 /* a counter to number all BB with an unique    */
-                                /* value                                        */
-
-/* modified by graph.c                                                                                                                 */
-
-int *c_defnum;                                 /* array that stores a number for each node     when*/
-                                                               /* control flow graph is traveres depth first   */
-int *c_parent;                                 /* for each node that array stores its parent   */
-int *c_reverse;                                        /* for each def number that array stores the    */
-                                                               /* corresponding node                                                   */
-int c_globalCount;                             /* counter for def numbering                                    */
-int *c_numPre;                                 /* array that stores for each node its number   */
-                                                               /* predecessors                                                                 */
-int **c_pre;                                   /* array of array that stores predecessors              */
-int c_last_jump;                               /* stores the source node of the last jsr instr */
-basicblock *c_last_target;      /* stores the source BB of the last jsr instr  */
-
-struct depthElement **c_dTable;        /* adjacency list for control flow graph                */
-struct depthElement **c_exceptionGraph;        /* adjacency list for exception graph   */
-
-struct LoopContainer *c_allLoops;              /* list of all loops                                    */
-struct LoopContainer *c_loop_root;             /* root of loop hierarchie tree                 */
-
-int *c_exceptionVisit;                 /* array that stores a flag for each node part  */
-                                                               /* of the exception graph                                               */
-
-/* modified by loop.c                                                                                                                  */
-
-int *c_semi_dom;                               /* store for each node its semi dominator               */
-int *c_idom;                                   /* store for each node its dominator                    */
-int *c_same_dom;                               /* temp array to hold nodes with same dominator */
-int *c_ancestor;                               /* store for each node its ancestor with lowest */
-                                                               /* semi dominator                                                               */
-int *c_numBucket;                              
-int **c_bucket;
-
-int *c_contains;                               /* store for each node whether it's part of loop*/
-int *c_stack;                                  /* a simple stack as array                                              */
-int c_stackPointer;                            /* stackpointer                                                                 */
-
-
-/* modified by analyze.c                                                                                                               */
-
-struct LoopContainer *root;     /* the root pointer for the hierarchie tree of  */
-                                /* all loops in that procedure                  */
-
-int c_needed_instr;                            /* number of instructions that have to be               */
-                                                               /* inserted before loop header to make sure             */
-                                                               /* array optimization is legal                                  */
-int c_rs_needed_instr;                 /* number of instructions needed to load the    */
-                                                               /* value ofthe right side of the loop condition */
-int *c_nestedLoops;                            /* store for each node the header node of the   */
-                                                               /* loop this node belongs to, -1 for none               */
-int *c_hierarchie;              /* store a loop hierarchie                      */
-int *c_toVisit;                                        /* set for each node that is part of the loop   */
-
-int *c_current_loop;                   /* for each node:                               */
-                                                               /* store 0:     node is not part of loop                        */
-                                                               /* store 1:     node is loop header                                     */
-                                                               /* store 2:     node is in loop but not part of any     */
-                                                               /*                      nested loop                         */
-                                                               /* store 3:     node is part of nested loop                     */
-
-int c_current_head;                            /* store number of node that is header of loop  */
-int *c_var_modified;                   /* store for each local variable whether its    */
-                                                               /* value is changed in the loop                                 */
-
-struct Trace *c_rightside;             /* right side of loop condition                                 */
-struct Constraint **c_constraints;
-                                                               /* array that stores for each variable a list   */
-                                                               /* static tests (constraints) that have to be   */
-                                                               /* performed before loop entry                                  */
-                                                               /* IMPORTANT: c_constraints[maxlocals] stores   */
-                                                               /*                        the tests for constants and the       */
-                                                               /*                        right side of loop condition          */
-       
-struct LoopVar *c_loopvars;            /* a list of all intersting variables of the    */
-                                                               /* current loop (variables that are modified or */
-                                                               /* used as array index                                                  */
-
-basicblock *c_first_block_copied; /* pointer to the first block, that is copied */
-                                  /* during loop duplication                    */
-
-basicblock *c_last_block_copied;  /* last block, that is copied during loop     */
-                                  /* duplication                                */
-
-int *c_null_check;              /* array to store for local vars, whether they  */
-                                /* need to be checked against the null reference*/
-                                /* in the loop head                             */
-
-bool c_needs_redirection;       /* if a loop header is inserted as first block  */
-                                /* into the global BB list, this is set to true */
-                                 
-basicblock *c_newstart;         /* if a loop header is inserted as first block  */
-                                /* into the gloal BB list, this pointer is the  */
-                                /* new start                                    */
-int c_old_xtablelength;         /* used to store the original tablelength       */
-
-/* set debug mode                                                                                                                              */
-#define C_DEBUG
-
-
-/* declare statistic variables                                                                                                 */
-#ifdef STATISTICS
-
-int c_stat_num_loops;                  /* number of loops                                                              */
-
-/* statistics per loop                                                                                                                 */
-int c_stat_array_accesses;             /* number of array accesses                                             */
-
-int c_stat_full_opt;                   /* number of fully optimized accesses                   */
-int c_stat_no_opt;                             /* number of not optimized accesses                             */
-int c_stat_lower_opt;                  /* number of accesses where check against zero  */
-                                                               /* is removed                                                                   */
-int c_stat_upper_opt;                  /* number of accesses where check against array */
-                                                               /* lengh is removed                                                             */
-int c_stat_or;                                 /* set if optimization is cancelled because of  */
-                                                               /* or in loop condition                                                 */
-int c_stat_exception;                  /* set if optimization is cancelled because of  */
-                                                               /* index var modified in catch block                    */
-
-/* statistics per procedure                                                                                                            */
-int c_stat_sum_accesses;               /* number of array accesses                                             */
-
-int c_stat_sum_full;                   /* number of fully optimized accesses                   */
-int c_stat_sum_no;                             /* number of not optimized accesses                             */
-int c_stat_sum_lower;                  /* number of accesses where check against zero  */
-                                                               /* is removed                                                                   */
-int c_stat_sum_upper;                  /* number of accesses where check against array */
-                                                               /* lengh is removed                                                             */
-int c_stat_sum_or;                             /* set if optimization is cancelled because of  */
-                                                               /* or in loop condition                                                 */
-int c_stat_sum_exception;              /* set if optimization is cancelled because of  */
-
-
-#endif
-
-#endif
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
-
diff --git a/narray/tracing.c b/narray/tracing.c
deleted file mode 100644 (file)
index e963346..0000000
+++ /dev/null
@@ -1,647 +0,0 @@
-/* tracing.c *******************************************************************
-
-        Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-        See file COPYRIGHT for information on usage and disclaimer of warranties.
-
-        Contains the functions which create a trace. A trace is a structure, that
-               contains the source of the arguments of a given instruction. For more
-               details see function tracing(basicblock, int, int) below.
-
-        Authors: Christopher Kruegel      EMAIL: cacao@complang.tuwien.ac.at
-
-        Last Change: 1998/17/02
-
-*******************************************************************************/
-
-/*     Test function -> will be removed in final release
-*/
-void printTraceResult(struct Trace *p)
-{
-       printf("TRACE: ");
-
-       switch (p->type) {
-       case TRACE_UNKNOWN:
-               printf("\tUnknown");
-               break;
-       case TRACE_ICONST:
-               printf("\tconst - %d", p->constant);
-               break;
-       case TRACE_ALENGTH:
-               printf("\tarray - (%d)%d - %d", p->neg, p->var, p->constant);
-               break;
-       case TRACE_IVAR:
-               printf("\tivar - (%d)%d - %d", p->neg, p->var, p->constant);
-               break;
-       case TRACE_AVAR:
-               printf("\tavar - %d", p->var);
-               break;
-               }
-       
-       printf("\n");
-}
-
-    
-/*     A function that creates a new trace structure and initializes its values
-*/
-struct Trace* create_trace(int type, int var, int constant, int nr)
-{
-       struct Trace *t;
-       if ((t = (struct Trace *) malloc(sizeof(struct Trace))) == NULL)
-               c_mem_error();
-
-       t->type = type;
-
-       t->neg = 1;
-       t->var = var;
-       t->nr = nr;
-
-       t->constant = constant;
-
-       return t;
-}
-
-/*     When the function tracing(...) encounters an add instruction during its 
-       backward scan over the instructions, it trys to identify the source of the
-       arguments of this add function. The following function performs this task.
-*/
-struct Trace* add(struct Trace* a, struct Trace* b)
-{
-       switch (a->type) {                      /* check the first argument of add. when it             */
-       case TRACE_UNKNOWN:                     /* is unknown or array-address, return unknown  */
-       case TRACE_AVAR:
-               return create_trace(TRACE_UNKNOWN, -1, 0, 0);
-
-       case TRACE_ICONST:                      /* when it is constant, check second argument   */
-               switch (b->type) {
-               case TRACE_IVAR:                        /* when second argument is a variable value */
-               case TRACE_ALENGTH:                     /* or array length, just add the constant       */
-                       a->type = b->type;
-                       a->var  = b->var;
-                       a->neg  = b->neg;
-                       a->constant += b->constant;
-                       break;
-               case TRACE_UNKNOWN:                     /* when unknown/array ref. return unknown       */
-               case TRACE_AVAR:
-                     return create_trace(TRACE_UNKNOWN, -1, 0, 0);
-           case TRACE_ICONST:                  /* when both are constant, just add them        */
-                       a->constant += b->constant;
-                       break;
-                       }
-               break;
-
-       case TRACE_IVAR:                        /* when it is a variable value or array length, */
-       case TRACE_ALENGTH:                     /* check second argument                                                */
-               switch (b->type) {
-               case TRACE_IVAR:                        /* when it is not a constant return unknown     */
-               case TRACE_ALENGTH:
-               case TRACE_UNKNOWN:
-               case TRACE_AVAR:
-                       return create_trace(TRACE_UNKNOWN, -1, 0, 0);
-               case TRACE_ICONST:                      /* when it is a constant, just add it           */
-                       a->constant += b->constant;
-                       break;
-                       }
-               break;
-               }
-
-       return a;
-}
-
-/*     When the function tracing(...) encounters a neg instruction during its 
-       backward scan over the instructions, it trys to identify the source of the
-       argument of this neg function. The following function performs this task.
-*/
-struct Trace* negate(struct Trace* a)
-{
-       switch (a->type) {                              /* check argument type                                          */
-       case TRACE_IVAR:                                /* when it is variable/array length value       */
-       case TRACE_ALENGTH:                                     
-               a->neg = -(a->neg);                             /* invert negate flag                                   */
-               a->constant = -(a->constant);   /* and negate constant                                  */
-               break;
-       
-       case TRACE_ICONST:                              /* when it is a constant, negate it                     */
-               a->constant = -(a->constant);
-               break;
-
-       default:
-               a->type = TRACE_UNKNOWN;        /* else return unknown                                          */
-               break;
-               }
-
-  return a;
-}
-
-/*     When the function tracing(...) encounters a sub instruction during its backward
-       scan over the instructions, it trys to identify the source of the arguments of
-       this sub function. The following function performs this task, by applaying the
-       negate function on the second argument and then adds the values.
-*/
-struct Trace* sub(struct Trace* a, struct Trace* b)
-{
-       struct Trace *c = negate(b);
-       return add(a, c);
-}
-
-
-/*     When the function tracing(...) encounters an array length instruction during
-       its backward scan over the instructions, it trys to identify the source of 
-       the argument ofthis array length function. The following function performs 
-       this task.
-*/
-struct Trace* array_length(struct Trace* a)
-{
-       if (a->type == TRACE_AVAR)      /* if argument is an array ref., mark the type  */
-               a->type = TRACE_ALENGTH;        /* as array length of this array reference      */
-       else
-               a->type = TRACE_UNKNOWN;        /* else it's unknown                                    */
-
-       return a;
-}
-
-/*     This function is used to identify the types of operands of an intermediate 
-       code instruction.It is needed by functions, that analyze array accesses. If 
-       something is stored into or loaded from an array, we have to find out, which 
-       array really has been accessed. When a compare instruction is encountered at
-       a loop header, the type of its operands have to be detected to construct
-       dynamic bounds for some variables in the loop. This function returns a struct
-       Trace (see loop.h for more details about this structure). block is the basic
-       block to be examined, index holds the offset of the examined instruction in
-       this block. The arguments are retrieved by using the stack structure, the 
-       compilation process sets up. During the backwards scan of the code, it is 
-       possible, that other instructions temporaray put or get values from the stack
-       and hide the value, we are interested in below them. The value temp counts
-       the number of values on the stack, the are located beyond the target value.
-*/
-struct Trace* tracing(basicblock *block, int index, int temp)
-{
-       int args, retval;
-       instruction *ip;
-       methodinfo *m;
-
-       if (index >= 0) {
-               ip = block->iinstr+index;
-
-/*     printf("TRACING with %d %d %d\n", index, temp, ip->opc);
-*/
-               switch (ip->opc) {
-               
-               /* nop, nullcheckpop                                                                                                    */
-               case ICMD_NOP:                          /* ...  ==> ...                                                         */
-                       return tracing(block, index-1, temp);
-                       break;
-      
-               case ICMD_NULLCHECKPOP:         /* ..., objectref  ==> ...                                      */
-                       return tracing(block, index-1, temp+1);
-                       break;
-
-               /* Constants                                                                                                                    */
-               case ICMD_LCONST:                               
-               case ICMD_DCONST:
-               case ICMD_FCONST:
-               case ICMD_ACONST:
-                       if (temp > 0)                           
-                               return tracing(block, index-1, temp-1);         
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;                                          
-
-               case ICMD_ICONST:
-                       if (temp > 0)           /* if the target argument is not on top                 */
-                               return tracing(block, index-1, temp-1); /* look further                 */
-                       else
-                               return create_trace(TRACE_ICONST, -1, ip->val.i, index);
-                       break;                          /* else, return the value, found at this instr. */
-
-               /* Load/Store                                                                                                                   */
-        case ICMD_LLOAD:               
-               case ICMD_DLOAD:    
-               case ICMD_FLOAD:
-                       if (temp > 0)
-                               return tracing(block, index-1, temp-1);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-    
-               case ICMD_ILOAD:
-                       if (temp > 0)
-                               return tracing(block, index-1, temp-1);
-                   else
-                               return create_trace(TRACE_IVAR, ip->op1, 0, index);
-                       break;
-
-               case ICMD_ALOAD:    
-                       if (temp > 0)
-                               return tracing(block, index-1, temp-1);
-                       else
-                               return create_trace(TRACE_AVAR, ip->op1, 0, index);                     
-                       break;
-               
-               case ICMD_LSTORE:    
-               case ICMD_DSTORE:    
-               case ICMD_FSTORE:
-               case ICMD_ISTORE:
-               case ICMD_ASTORE:    
-                       return tracing(block, index-1, temp+1);
-                       break;
-       
-
-               /* pop/dup/swap                                                                                                                 */
-               case ICMD_POP:      
-                       return tracing(block, index-1, temp+1);
-                       break;
-     
-               case ICMD_POP2:  
-                       return tracing(block, index-1, temp+2);
-                       break;
-
-               case ICMD_DUP:
-                       if (temp > 0)
-                               return tracing(block, index-1, temp-1);
-                       else
-                               return tracing(block, index-1, temp);
-                       break;
-
-               case ICMD_DUP_X1:                       /* ..., a, b ==> ..., b, a, b                           */
-                       switch (temp) {
-                       case 0:                                 /* when looking for top or third element,       */
-                       case 2:                                 /* just return top element                                      */
-                               return tracing(block, index-1, 0);
-                       case 1:
-                               return tracing(block, index-1, 1);
-                       default:
-                               return tracing(block, index-1, temp-1);
-                               }
-                       break;
-
-               case ICMD_DUP2:                         /* ..., a, b ==> ..., a, b, a, b                        */
-                       switch (temp) { 
-                       case 0:                                 /* when looking for top or third element        */
-                       case 2:                                 /* just return top element                                      */
-                               return tracing(block, index-1, 0);
-                       case 1:                                 /* when looking for second or fourth element*/
-                       case 3:                                 /* just return second element                           */
-                               return tracing(block, index-1, 1);
-                       default:
-                               return tracing(block, index-1, temp-2);
-                               }
-                       break;
-
-               case ICMD_DUP2_X1:                      /* ..., a, b, c ==> ..., b, c, a, b, c          */
-                       switch (temp) {
-                       case 0:
-                       case 3:
-                               return tracing(block, index-1, 0);
-                       case 1:
-                       case 4:
-                               return tracing(block, index-1, 1);
-                       case 2:
-                               return tracing(block, index-1, 2);
-                       default:
-                               return tracing(block, index-1, temp-2);
-                               }
-                       break;
-
-               case ICMD_DUP_X2:                       /* ..., a, b, c ==> ..., c, a, b, c                     */
-                       switch (temp) {    
-                       case 0:
-                       case 3:
-                               return tracing(block, index-1, 0);
-                       case 1:
-                       case 4:
-                               return tracing(block, index-1, 1);
-                       case 2:
-                               return tracing(block, index-1, 2);
-                       default:
-                               return tracing(block, index-1, temp-2);
-                               }
-                       break;
-
-               case ICMD_DUP2_X2:                      /* .., a, b, c, d ==> ..., c, d, a, b, c, d     */
-                       switch (temp) {
-                       case 0:
-                       case 4:
-                               return tracing(block, index-1, 0);
-                       case 1:
-                       case 5:
-                               return tracing(block, index-1, 1);
-                       case 2:
-                               return tracing(block, index-1, 2);
-                       case 3:
-                               return tracing(block, index-1, 3);
-                       default:
-                               return tracing(block, index-1, temp-2);
-                               }
-                       break;
-
-               case ICMD_SWAP:                         /* ..., a, b ==> ..., b, a                                      */
-                       switch (temp) {
-                       case 0:
-                               return tracing(block, index-1, 1);
-                       case 1:
-                               return tracing(block, index-1, 0);
-                       default:
-                               return tracing(block, index-1, temp);
-                               }
-                       break;
-      
-               /* Interger operations                                                                                                  */
-           case ICMD_INEG:                             /* ..., value  ==> ..., - value                         */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp);
-                       else                                    /* if an inter neg. operation is found,         */
-                                                                       /* invokethe negate function                            */
-                               return negate(tracing(block, index-1, temp));
-                       break;
-
-               case ICMD_LNEG:                         /* ..., value  ==> ..., - value                         */
-               case ICMD_I2L:                          /* ..., value  ==> ..., value                           */
-               case ICMD_L2I:                          /* ..., value  ==> ..., value                           */
-               case ICMD_INT2BYTE:                     /* ..., value  ==> ..., value                           */
-               case ICMD_INT2CHAR:                     /* ..., value  ==> ..., value                           */
-               case ICMD_INT2SHORT:            /* ..., value  ==> ..., value                           */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-               case ICMD_IADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp+1);
-                       else                                    /* when add is encountered, invoke add func     */
-                               return add(tracing(block, index-1, 0), tracing(block, index-1, 1));
-                       break;
-
-               case ICMD_IADDCONST:            /* ..., value  ==> ..., value + constant        */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp);
-                       else                                    /* when a constant is added, create a           */
-                                                                       /* constant-trace and use add function          */
-                               return add(tracing(block, index-1, 0), create_trace(TRACE_ICONST, -1, ip->val.i, index));
-                       break;
-
-               case ICMD_ISUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp+1);
-                       else                                    /* use sub function for sub instructions        */
-                               return sub(tracing(block, index-1, 1), tracing(block, index-1, 0));
-                       break;
-
-               case ICMD_ISUBCONST:            /* ..., value  ==> ..., value + constant        */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp);
-                       else
-                               return sub(tracing(block, index-1, 0), create_trace(TRACE_ICONST, -1, ip->val.i, index));
-                       break;
-
-               case ICMD_LADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
-               case ICMD_LSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
-               case ICMD_IMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
-               case ICMD_LMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
-               case ICMD_ISHL:                         /* ..., val1, val2  ==> ..., val1 << val2       */
-               case ICMD_ISHR:                         /* ..., val1, val2  ==> ..., val1 >> val2       */
-               case ICMD_IUSHR:                        /* ..., val1, val2  ==> ..., val1 >>> val2      */
-               case ICMD_LSHL:                         /* ..., val1, val2  ==> ..., val1 << val2       */
-               case ICMD_LSHR:                         /* ..., val1, val2  ==> ..., val1 >> val2       */
-               case ICMD_LUSHR:                        /* ..., val1, val2  ==> ..., val1 >>> val2      */
-               case ICMD_IAND:                         /* ..., val1, val2  ==> ..., val1 & val2        */
-               case ICMD_LAND:  
-               case ICMD_IOR:                          /* ..., val1, val2  ==> ..., val1 | val2        */
-               case ICMD_LOR:
-               case ICMD_IXOR:                         /* ..., val1, val2  ==> ..., val1 ^ val2        */
-               case ICMD_LXOR:
-                       if (temp > 0)
-                               return tracing(block, index-1, temp+1);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-     
-               case ICMD_LADDCONST:            /* ..., value  ==> ..., value + constant        */
-               case ICMD_LSUBCONST:            /* ..., value  ==> ..., value - constant        */
-               case ICMD_IMULCONST:            /* ..., value  ==> ..., value * constant        */
-               case ICMD_LMULCONST:            /* ..., value  ==> ..., value * constant        */
-               case ICMD_IDIVPOW2:                     /* ..., value  ==> ..., value << constant       */
-               case ICMD_LDIVPOW2:                     /* val.i = constant                                                     */
-               case ICMD_ISHLCONST:            /* ..., value  ==> ..., value << constant       */
-               case ICMD_ISHRCONST:            /* ..., value  ==> ..., value >> constant       */
-               case ICMD_IUSHRCONST:           /* ..., value  ==> ..., value >>> constant      */
-               case ICMD_LSHLCONST:            /* ..., value  ==> ..., value << constant       */
-               case ICMD_LSHRCONST:            /* ..., value  ==> ..., value >> constant       */
-               case ICMD_LUSHRCONST:           /* ..., value  ==> ..., value >>> constant      */
-               case ICMD_IANDCONST:            /* ..., value  ==> ..., value & constant        */
-               case ICMD_IREMPOW2:                     /* ..., value  ==> ..., value % constant        */
-               case ICMD_IREM0X10001:          /* ..., value  ==> ..., value % 0x100001        */
-               case ICMD_LANDCONST:            /* ..., value  ==> ..., value & constant        */
-               case ICMD_LREMPOW2:                     /* ..., value  ==> ..., value % constant        */
-               case ICMD_LREM0X10001:          /* ..., value  ==> ..., value % 0x10001         */
-               case ICMD_IORCONST:                     /* ..., value  ==> ..., value | constant        */
-               case ICMD_LORCONST:                     /* ..., value  ==> ..., value | constant        */  
-               case ICMD_IXORCONST:            /* ..., value  ==> ..., value ^ constant        */
-               case ICMD_LXORCONST:            /* ..., value  ==> ..., value ^ constant        */
-               case ICMD_LCMP:                         /* ..., val1, val2  ==> ..., val1 cmp val2      */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-               case ICMD_IINC:                         /* ..., value  ==> ..., value + constant        */
-                       return tracing(block, index-1, temp);
-                       break;
-
-
-               /* floating operations                                                                                                  */
-               case ICMD_FADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
-               case ICMD_DADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
-               case ICMD_FSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
-               case ICMD_DSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
-               case ICMD_FMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
-               case ICMD_DMUL:                         /* ..., val1, val2  ==> ..., val1 *** val2      */
-               case ICMD_FDIV:                         /* ..., val1, val2  ==> ..., val1 / val2        */
-               case ICMD_DDIV:                         /* ..., val1, val2  ==> ..., val1 / val2        */
-               case ICMD_FREM:                         /* ..., val1, val2  ==> ..., val1 % val2        */
-               case ICMD_DREM:                         /* ..., val1, val2  ==> ..., val1 % val2        */
-               case ICMD_FCMPL:                        /* .., val1, val2  ==> ..., val1 fcmpl val2     */
-               case ICMD_DCMPL:
-               case ICMD_FCMPG:                        /* .., val1, val2  ==> ..., val1 fcmpg val2     */
-               case ICMD_DCMPG:
-                       if (temp > 0)
-                               return tracing(block, index-1, temp+1);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-               case ICMD_FNEG:                         /* ..., value  ==> ..., - value                         */
-               case ICMD_DNEG:                         /* ..., value  ==> ..., - value                         */  
-               case ICMD_I2F:                          /* ..., value  ==> ..., (float) value           */
-               case ICMD_L2F:
-               case ICMD_I2D:                          /* ..., value  ==> ..., (double) value          */
-               case ICMD_L2D:
-               case ICMD_F2I:                          /* ..., value  ==> ..., (int) value                     */
-               case ICMD_D2I:
-               case ICMD_F2L:                          /* ..., value  ==> ..., (long) value            */
-               case ICMD_D2L:  
-               case ICMD_F2D:                          /* ..., value  ==> ..., (double) value          */
-               case ICMD_D2F:                          /* ..., value  ==> ..., (double) value          */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-   
-               /* memory operations                                                                                                    */
-                case ICMD_ARRAYLENGTH:         /* ..., arrayref  ==> ..., length                       */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp);
-                       else
-                               return array_length(tracing(block, index-1, 0));
-                       break;
-
-               case ICMD_AALOAD:                       /* ..., arrayref, index  ==> ..., value         */
-               case ICMD_LALOAD:                       /* ..., arrayref, index  ==> ..., value         */  
-               case ICMD_IALOAD:                       /* ..., arrayref, index  ==> ..., value         */
-               case ICMD_FALOAD:                       /* ..., arrayref, index  ==> ..., value         */
-               case ICMD_DALOAD:                       /* ..., arrayref, index  ==> ..., value         */
-               case ICMD_CALOAD:                       /* ..., arrayref, index  ==> ..., value         */
-               case ICMD_SALOAD:                       /* ..., arrayref, index  ==> ..., value         */
-               case ICMD_BALOAD:                       /* ..., arrayref, index  ==> ..., value         */
-                       if (temp > 0)           
-                               return tracing(block, index-1, temp+1);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-               case ICMD_AASTORE:                      /* ..., arrayref, index, value  ==> ...         */
-               case ICMD_LASTORE:                      /* ..., arrayref, index, value  ==> ...         */
-               case ICMD_IASTORE:                      /* ..., arrayref, index, value  ==> ...         */
-               case ICMD_FASTORE:                      /* ..., arrayref, index, value  ==> ...         */
-               case ICMD_DASTORE:                      /* ..., arrayref, index, value  ==> ...         */
-               case ICMD_CASTORE:                      /* ..., arrayref, index, value  ==> ...         */
-               case ICMD_SASTORE:                      /* ..., arrayref, index, value  ==> ...         */
-               case ICMD_BASTORE:                      /* ..., arrayref, index, value  ==> ...         */
-                       return tracing(block, index-1, temp+3);
-                       break;
-               case ICMD_PUTSTATIC:            /* ..., value  ==> ...                                          */
-               case ICMD_PUTFIELD:                     /* ..., value  ==> ...                                          */
-                       return tracing(block, index-1, temp+1);
-                       break;
-               case ICMD_GETSTATIC:            /* ...  ==> ..., value                                          */
-               case ICMD_GETFIELD:                     /* ...  ==> ..., value                                          */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp-1);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-
-               /* branch: should not be encountered, but function calls possible               */
-               case ICMD_INVOKESTATIC:         /* ..., [arg1, [arg2 ...]] ==> ...                      */
-                       m = ip->val.a;                  /* get method pointer and                                       */
-                       args = ip->op1;                 /* number of arguments                                          */
-                       if (m->returntype != TYPE_VOID)
-                               retval = 1;                     /* if function returns a value, it is on        */
-                       else                                    /* top of stack                                                         */
-                               retval = 0;
-      
-                       if (temp > 0)                   /* temp is increased by number of arguments     */
-                                                                       /* less a possible result value                         */
-                               return tracing(block, index-1, temp+(args-retval));
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-               case ICMD_INVOKESPECIAL:        /* ..., objectref, [arg1, [arg2 ...]] ==> .     */
-               case ICMD_INVOKEVIRTUAL:        /* ..., objectref, [arg1, [arg2 ...]] ==> .     */
-               case ICMD_INVOKEINTERFACE:      /* ..., objectref, [arg1, [arg2 ...]] ==> . */
-                       m = ip->val.a;
-                       args = ip->op1; 
-                       if (m->returntype != TYPE_VOID)
-                               retval = 1;
-                       else
-                               retval = 0;
-                       
-                       if (temp > 0)                   /* same as above but add 1 for object ref       */
-                               return tracing(block, index-1, temp+(args-retval+1));
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-               /* special                                                                                                                              */  
-               case ICMD_INSTANCEOF:           /* ..., objectref ==> ..., intresult            */
-               case ICMD_CHECKCAST:            /* ..., objectref ==> ..., objectref            */
-                       if (temp > 0)
-                               return tracing(block, index-1, temp);
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-      
-               case ICMD_MULTIANEWARRAY:       /* ..., cnt1, [cnt2, ...] ==> ..., arrayref     */
-                                                                       /* op1 = dimension                                                      */ 
-
-                       if (temp > 0)                   /* temp increased by number of dimensions       */
-                                                                       /* minus one for array ref                                      */
-                               return tracing(block, index-1, temp+(ip->op1 - 1));
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-       
-               case ICMD_BUILTIN3:                     /* ..., arg1, arg2, arg3 ==> ...                        */
-                       if (ip->op1 != TYPE_VOID)
-                               retval = 1;
-                       else
-                               retval = 0;
-      
-                       if (temp > 0)                   /* increase temp by 3 minus possible return     */
-                                                                       /* value                                                                        */
-                               return tracing(block, index-1, temp+(3-retval));
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-               case ICMD_BUILTIN2:                     /* ..., arg1, arg2 ==> ...                                      */
-                       if (ip->op1 != TYPE_VOID)
-                               retval = 1;
-                       else
-                               retval = 0;
-                       if (temp > 0)
-                               return tracing(block, index-1, temp+(2-retval));
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                                                    */
-                       if (ip->op1 != TYPE_VOID)
-                               retval = 1;
-                       else
-                               retval = 0;
-                       if (temp > 0)
-                               return tracing(block, index-1, temp+(1-retval));
-                       else
-                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       break;
-
-               /* others                                                                                                                               */
-               default:
-                       return create_trace(TRACE_UNKNOWN, -1, 0, index);
-                       }       /* switch       */
-               }               /* if           */
-       else
-               return create_trace(TRACE_UNKNOWN, -1, 0, index);
-}
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
index 48836c1372a8c8fb4a7715906f7047310e81e77a..d431fc2d51f25114eea9d1a36ee949f7c300ea95 100644 (file)
@@ -59,16 +59,13 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 host_alias = @host_alias@
 host_triplet = @host@
-ASMPART = @ASMPART@
-BOEHM_LIB = @BOEHM_LIB@
+ARCH_DIR = @ARCH_DIR@
 CC = @CC@
 COMPILER_OBJECTS = @COMPILER_OBJECTS@
-GC_OBJ = @GC_OBJ@
 LIBTHREAD = @LIBTHREAD@
 MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
-SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
index 52ccfb2d7d7c2413e0975a270d5c212e7ea18e43..a2627033f74e7fa3fe366273752f1759d763de29 100644 (file)
@@ -1,5 +1,42 @@
-#include  <stdio.h>
-#include  <string.h>
+/* natcalls.h -
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: natcalls.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _NATCALLS_H
+#define _NATCALLS_H
+
+#include "global.h"
+
 
 /*---------- Define Constants ---------------------------*/
 #define MAX 256
@@ -18,60 +55,76 @@ typedef struct nativeCompMethod nativeCompMethod;
 int classCnt;
 
 struct classMeth {
-  int i_class;
-  int j_method;
-  int methCnt;
+       int i_class;
+       int j_method;
+       int methCnt;
 };
 
 struct  methodCall{
-        char *classname;
-        char *methodname;
-        char *descriptor;
-} ;
+       char *classname;
+       char *methodname;
+       char *descriptor;
+};
 
 struct  nativeMethod  {
-        char *methodname;
-        char *descriptor;
-        struct methodCall methodCalls[MAXCALLS];
-} ;
+       char *methodname;
+       char *descriptor;
+       struct methodCall methodCalls[MAXCALLS];
+};
 
 
 static struct nativeCall {
-        char *classname;
-        struct nativeMethod methods[MAXCALLS];
-        int methCnt;
-        int callCnt[MAXCALLS];
+       char *classname;
+       struct nativeMethod methods[MAXCALLS];
+       int methCnt;
+       int callCnt[MAXCALLS];
 } nativeCalls[] =
- {
-
+{
 #include "nativecalls.h"
-}
-;
+};
 
 #define NATIVECALLSSIZE  (sizeof(nativeCalls)/sizeof(struct nativeCall))
 
 
-struct  methodCompCall{
-        utf *classname;
-        utf *methodname;
-        utf *descriptor;
-} ;
+struct methodCompCall {
+       utf *classname;
+       utf *methodname;
+       utf *descriptor;
+};
+
 
-struct  nativeCompMethod  {
-        utf *methodname;
-        utf *descriptor;
-        struct methodCompCall methodCalls[MAXCALLS];
-} ;
+struct nativeCompMethod {
+       utf *methodname;
+       utf *descriptor;
+       struct methodCompCall methodCalls[MAXCALLS];
+};
 
 
 struct nativeCompCall {
-        utf *classname;
-        struct nativeCompMethod methods[MAXCALLS];
-        int methCnt;
-        int callCnt[MAXCALLS];
+       utf *classname;
+       struct nativeCompMethod methods[MAXCALLS];
+       int methCnt;
+       int callCnt[MAXCALLS];
 } nativeCompCalls[NATIVECALLSSIZE];
 
 
 bool natcall2utf(bool);
 void printNativeCall(nativeCall);
 void markNativeMethodsRT(utf *, utf* , utf* ); 
+
+#endif /* _NATCALLS_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+
index 5378f1d7e10c4ecde1f3fa6a25c91251860db75c..3c2418119169ac92e98f30396c4a3b4001fd02ca 100644 (file)
--- a/native.c
+++ b/native.c
@@ -1,30 +1,43 @@
-/****************************** native.c ***************************************
+/* native.c - table of native functions
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-    Contains the tables for native methods.
-       The .hh files created with the header file generator are all included here
-       as are the C functions implementing these methods.
-       
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at 
-                Roman Obermaisser   EMAIL: cacao@complang.tuwien.ac.at 
-                Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at 
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Last Change: 2003/02/26
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Roman Obermaisser
+            Andreas Krall
+
+   The .hh files created with the header file generator are all
+   included here as are the C functions implementing these methods.
+
+   $Id: native.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include <unistd.h>
 #include <time.h>
-#include "global.h"
-#include "native.h"
-#include "nativetypes.hh"
-#include "builtin.h"
-#include "asmpart.h"
-#include "tables.h"
-#include "loader.h"
 #include <math.h>
 #include <string.h>
 #include <assert.h>
 #include <utime.h>
 #include <sys/utsname.h>
 
-#include "threads/thread.h"                       /* schani */
+#include "global.h"
+#include "native.h"
+#include "nativetypes.hh"
+#include "builtin.h"
+#include "asmpart.h"
+#include "tables.h"
+#include "loader.h"
+#include "toolbox/loging.h"
+#include "threads/thread.h"
+#include "threads/threadio.h"
 #include "threads/locks.h"
 
 /* Include files for IO functions */
@@ -45,7 +67,6 @@
 #endif
 #include <sys/stat.h>
 
-#include "../threads/threadio.h"                    
 
 /* searchpath for classfiles */
 static char *classpath;
@@ -1070,3 +1091,17 @@ for (i=0;i<NATIVECALLSSIZE; i++) {
 return true;
 }
 /*--------------------------------------------------------*/
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 102a7a6fef6454cd4437dee4c080b023ee1c3a24..f60b6972191e6c3a1031cfa5f9c9be0be53c9b0c 100644 (file)
--- a/native.h
+++ b/native.h
@@ -85,3 +85,17 @@ void systemclassloader_addlibname(java_objectheader *o);
 void systemclassloader_addlibrary(java_objectheader *o);
 
 void copy_vftbl(vftbl **dest, vftbl *src);
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index a4e9db7ca8f7a36afc0ad10453e531cae02c5861..b046f0c0ca234bdc6c7944595d883f79621523ca 100644 (file)
 },
 1,  {2 }
 },
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/powerpc/Makefile.am b/powerpc/Makefile.am
deleted file mode 100644 (file)
index 9d77398..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-EXTRA_DIST = asmpart.S disass.c ngen.c \
-            defines.h native-math.h ngen.h \
-            types.h threads.h 
-
-noinst_LIBRARIES = libdisass.a
-
-libdisass_a_SOURCES = ppc-dis.c ppc-opc.c
diff --git a/powerpc/asmart.c b/powerpc/asmart.c
deleted file mode 100644 (file)
index d377554..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "global.h"
-
-void synchronize_caches() { }
-
-
-void asm_call_jit_compiler () { }
-
-java_objectheader *asm_calljavamethod (methodinfo *m, void *arg1, void*arg2,
-                                       void*arg3, void*arg4) { }
-
-java_objectheader *asm_calljavafunction (methodinfo *m, void *arg1, void*arg2,
-                                         void*arg3, void*arg4) { }
-
-methodinfo *asm_getcallingmethod () { }
-
-void asm_dumpregistersandcall ( functionptr f) { }
-
-void asm_builtin_aastore() { }
-void asm_builtin_checkarraycast() { }
-void asm_builtin_checkcast() { }
-void asm_builtin_idiv() { }
-void asm_builtin_irem() { }
-void asm_builtin_ldiv() { }
-void asm_builtin_lrem() { }
-void asm_builtin_monitorenter() { }
-void asm_builtin_monitorexit() { }
-
-void asm_handle_exception() { }
-int has_no_x_instr_set() { return 0; }
diff --git a/powerpc/asmpart.S b/powerpc/asmpart.S
deleted file mode 100644 (file)
index 16d23d8..0000000
+++ /dev/null
@@ -1,999 +0,0 @@
-#include "offsets.h"
-
-.text
-       .align 2
-
-       .globl _builtin_throw_exception
-       .globl _jit_compile
-       .globl _builtin_canstore
-       .globl _builtin_trace_exception
-       .globl _builtin_monitorenter
-       .globl _builtin_monitorexit
-       .globl _builtin_ldiv
-       .globl _builtin_lrem
-       .globl _builtin_checkarraycast
-       .globl _proto_java_lang_NullPointerException
-       .globl _proto_java_lang_ArrayIndexOutOfBoundsException
-       .globl _proto_java_lang_ArrayStoreException
-       .globl _proto_java_lang_ArithmeticException
-       .globl _proto_java_lang_ClassCastException
-
-       .globl _catch_Handler
-
-#define     MethodPointer   -8
-#define     FrameSize       -12
-#define     IsSync          -16
-#define     IsLeaf          -20
-#define     IntSave         -24
-#define     FltSave         -28
-#define     ExTableSize     -32
-#define     ExTableStart    -32
-
-#define     ExEntrySize     -16
-#define     ExStartPC       -4
-#define     ExEndPC         -8
-#define     ExHandlerPC     -12
-#define     ExCatchType     -16
-
-#define itmp1 r11
-#define itmp2 r12
-#define itmp3 r0
-
-#define xptr itmp1
-#define xpc itmp2
-
-#define pv r13
-#define mptr r12
-#define mptrn 12
-
-       .align 2
-builtinthrow:
-       .long _builtin_throw_exception
-
-       .align 2
-    .long   0                         /* catch type all                       */
-    .long   calljava_xhandler         /* handler pc                           */
-    .long   calljava_xhandler         /* end pc                               */
-    .long   _asm_calljavamethod       /* start pc                             */
-    .long   1                         /* extable size                         */
-    .long   0                         /* fltsave                              */
-    .long   0                         /* intsave                              */
-    .long   0                         /* isleaf                               */
-    .long   0                         /* IsSync                               */
-    .long   24                        /* frame size                           */
-    .long   0                         /* method pointer (pointer to name)     */
-       .long   0                         /* padding                              */
-
-
-.globl _asm_docalljavamethod
-_asm_docalljavamethod:
-       mflr r0
-       stw r31,-4(r1)
-//     stw r30,-8(r1)
-       stw pv,-12(r1)
-       stw r0,8(r1)
-       stwu r1,-148(r1)
-       bl 0f
-0:
-       mflr r31
-
-       stw r16,40(r1)
-       stw r17,44(r1)
-       stw r18,48(r1)
-       stw r19,52(r1)
-       stw r20,56(r1)
-       stw r21,60(r1)
-       stw r22,64(r1)
-       stw r23,68(r1)
-       stfd f16,72(r1)
-       stfd f17,80(r1)
-       stfd f18,88(r1)
-       stfd f19,96(r1)
-       stfd f20,104(r1)
-       stfd f21,112(r1)
-       stfd f22,120(r1)
-       stfd f23,128(r1)
-
-       stw r3,36(r1)
-       addi r2,r1,36
-       mr r3,r4
-       mr r4,r5
-       mr r5,r6
-       mr r6,r7
-
-//     addis mptr,r31,ha16(_asm_call_jit_compiler-0b)
-       addi mptr,r31,lo16(_asm_call_jit_compiler-0b)
-       stw mptr,32(r1)
-       addi mptr,r1,28
-
-       lwz pv,4(mptr)
-       mtctr pv
-       bctrl
-1:
-       mflr itmp1
-       addi pv,itmp1,lo16(_asm_docalljavamethod-1b)
-       
-calljava_regrestore:
-       lwz r16,40(r1)
-       lwz r17,44(r1)
-       lwz r18,48(r1)
-       lwz r19,52(r1)
-       lwz r20,56(r1)
-       lwz r21,60(r1)
-       lwz r22,64(r1)
-       lwz r23,68(r1)
-       lfd f16,72(r1)
-       lfd f17,80(r1)
-       lfd f18,88(r1)
-       lfd f19,96(r1)
-       lfd f20,104(r1)
-       lfd f21,112(r1)
-       lfd f22,120(r1)
-       lfd f23,128(r1)
-
-       lwz r0,148+8(r1)
-       mtlr r0
-       addi r1,r1,148
-       lwz pv,-12(r1)
-//     lwz r30,-8(r1)
-       lwz r31,-4(r1)
-       blr
-calljava_xhandler:
-       mr r3,itmp1
-//     addis pv,r31,ha16(builtinthrow-0b)
-       lwz itmp1,lo16(builtinthrow-0b)(r31)
-       mtctr itmp1
-       bctrl
-       b calljava_regrestore
-
-
-
-
-jitcompile:
-       .long _jit_compile
-
-.globl _asm_call_jit_compiler
-_asm_call_jit_compiler:
-0:
-       mflr itmp1
-       stw r31,-4(r1)
-//     stw pv,-8(r1)
-       stw r29,-12(r1)
-       stw itmp1,8(r1)
-       stwu r1,-176(r1)
-       mr r31,pv
-
-       lwz itmp3,-12(itmp1)
-       srwi itmp3,itmp3,16
-       andi. itmp3,itmp3,31
-       cmpwi itmp3,mptrn
-       beq noregchange
-       lwz itmp3,4(itmp1)
-       extsh itmp3,itmp3
-       add mptr,itmp3,itmp1
-       lwz itmp3,8(itmp1)
-       srwi itmp3,itmp3,16
-       cmpwi itmp3,0x3dad
-       bne noregchange
-       lwz itmp3,8(itmp1)
-       slwi itmp3,itmp3,16
-       add mptr,mptr,itmp3
-noregchange:
-       mr r29,mptr
-       stw r3,28(r1)
-       stw r4,32(r1)
-       stw r5,36(r1)
-       stw r6,40(r1)
-       stw r7,44(r1)
-       stw r8,48(r1)
-       stw r9,52(r1)
-       stfd f1,56(r1)
-       stfd f2,64(r1)
-       stfd f3,72(r1)
-       stfd f4,80(r1)
-       stfd f5,88(r1)
-       stfd f6,96(r1)
-       stfd f7,104(r1)
-       stfd f8,112(r1)
-       stfd f9,120(r1)
-       stfd f10,128(r1)
-       stfd f11,136(r1)
-       stfd f12,144(r1)
-       stfd f13,152(r1)
-       stw r10,160(r1)
-
-       lwz r3,0(r2)
-//     addis pv,r31,ha16(jitcompile-0b)
-       lwz itmp1,lo16(jitcompile-0b)(r31)
-       mtctr itmp1
-       bctrl
-
-       mr pv,r3
-       mr mptr,r29
-       lwz r3,28(r1)
-       lwz r4,32(r1)
-       lwz r5,36(r1)
-       lwz r6,40(r1)
-       lwz r7,44(r1)
-       lwz r8,48(r1)
-       lwz r9,52(r1)
-       lfd f1,56(r1)
-       lfd f2,64(r1)
-       lfd f3,72(r1)
-       lfd f4,80(r1)
-       lfd f5,88(r1)
-       lfd f6,96(r1)
-       lfd f7,104(r1)
-       lfd f8,112(r1)
-       lfd f9,120(r1)
-       lfd f10,128(r1)
-       lfd f11,136(r1)
-       lfd f12,144(r1)
-       lfd f13,152(r1)
-       lwz r10,160(r1)
-
-       lwz itmp1,176+8(r1)
-       lwz itmp3,-12(itmp1)
-       extsh itmp3,itmp3
-       add mptr,mptr,itmp3
-       stw pv,0(mptr)
-
-       mtctr pv
-
-       lwz r0,176+8(r1)
-       mtlr r0
-       addi r1,r1,176
-       lwz r29,-12(r1)
-//     lwz pv,-8(r1)
-       lwz r31,-4(r1)
-       bctr
-
-
-builtin_traceexception:
-       .long _builtin_trace_exception
-builtin_monitorenter:
-       .long _builtin_monitorenter
-builtin_monitorexit:
-       .long _builtin_monitorexit
-builtin_ldiv:
-       .long _builtin_ldiv
-builtin_lrem:
-       .long _builtin_lrem
-
-.globl _asm_handle_nat_exception
-_asm_handle_nat_exception:
-       mflr r2
-       lwz itmp3,4(r2)
-       extsh itmp3,itmp3
-       add pv,itmp3,r2
-       lwz itmp3,8(r2)
-       srwi itmp3,itmp3,16
-       cmpwi itmp3,0x3dad
-       bne _asm_handle_exception
-       lwz itmp3,8(r2)
-       slwi itmp3,itmp3,16
-       add pv,pv,itmp3
-
-       .globl _asm_handle_exception
-_asm_handle_exception:
-       addi r1,r1,-18*4
-       stw r0,0*4(r1)
-       stw r2,1*4(r1)
-       stw r3,2*4(r1)
-       stw r4,3*4(r1)
-       stw r5,4*4(r1)
-       stw r6,5*4(r1)
-       stw r7,6*4(r1)
-       stw r8,7*4(r1)
-       stw r9,8*4(r1)
-       stw r10,9*4(r1)
-       stw r16,10*4(r1)
-       stw r17,11*4(r1)
-       stw r18,12*4(r1)
-       stw r19,13*4(r1)
-       stw r20,14*4(r1)
-       stw r21,15*4(r1)
-       stw r22,16*4(r1)
-       stw r23,17*4(r1)
-
-       li r2,1
-ex_stack_loop:
-       addi r1,r1,-4*4
-       stw xptr,0*4(r1)
-       stw xpc,1*4(r1)
-       mflr xptr
-       stw xptr,2*4(r1)
-       stw r2,3*4(r1)
-
-       lwz r3,0*4(r1)
-       lwz r4,MethodPointer(pv)
-       mr r5,xpc
-       mr r6,r2
-
-       bl 0f
-0:
-       mflr itmp1
-       lwz itmp1,lo16(builtin_traceexception-0b)(itmp1)
-       mtctr itmp1
-       addi r1,r1,-40
-       bctrl
-       addi r1,r1,40
-
-       lwz xptr,2*4(r1)
-       mtlr xptr
-       lwz xptr,0*4(r1)
-       lwz xpc,1*4(r1)
-       lwz r2,3*4(r1)
-       addi r1,r1,4*4
-
-       lwz r3,ExTableSize(pv)
-       mr. r3,r3
-       beq empty_table
-       addi r4,pv,ExTableStart
-
-ex_table_loop:
-       lwz r5,ExStartPC(r4)
-       cmplw r5,xpc
-       bgt ex_table_cont
-       lwz r5,ExEndPC(r4)
-       cmplw xpc,r5
-       bge ex_table_cont
-       lwz r7,ExCatchType(r4)
-       mr. r7,r7
-       beq ex_handle_it
-
-       lwz r6,offobjvftbl(xptr)
-       lwz r7,offobjvftbl(r7)
-       lwz r6,offbaseval(r6)
-       lwz r8,offbaseval(r7)
-       lwz r7,offdiffval(r7)
-       subf r6,r8,r6
-       cmplw r6,r7
-       bgt ex_table_cont
-
-ex_handle_it:
-       lwz xpc,ExHandlerPC(r4)
-       mr. r2,r2
-       beq ex_jump
-
-       lwz r0,0*4(r1)
-       lwz r2,1*4(r1)
-       lwz r3,2*4(r1)
-       lwz r4,3*4(r1)
-       lwz r5,4*4(r1)
-       lwz r6,5*4(r1)
-       lwz r7,6*4(r1)
-       lwz r8,7*4(r1)
-       lwz r9,8*4(r1)
-       lwz r10,9*4(r1)
-       lwz r16,10*4(r1)
-       lwz r17,11*4(r1)
-       lwz r18,12*4(r1)
-       lwz r19,13*4(r1)
-       lwz r20,14*4(r1)
-       lwz r21,15*4(r1)
-       lwz r22,16*4(r1)
-       lwz r23,17*4(r1)
-       addi r1,r1,18*4
-
-ex_jump:
-       mtctr xpc
-       bctr
-
-ex_table_cont:
-       addi r4,r4,ExEntrySize
-       addic. r3,r3,-1
-       bgt ex_table_loop
-
-empty_table:
-       mr. r2,r2
-       beq ex_already_cleared
-       addi r1,r1,18*4
-       li r2,0
-ex_already_cleared:
-       lwz r3,IsSync(pv)
-       mr. r3,r3
-       beq no_monitor_exit
-       add r3,r1,r3
-       lwz r6,-4(r3)
-
-       addi r1,r1,-6*4
-       stw r3,0*4(r1)
-       stw r4,1*4(r1)
-       stw r2,2*4(r1)
-       stw xptr,3*4(r1)
-       stw xpc,4*4(r1)
-       mflr xptr
-       stw xptr,5*4(r1)
-
-       mr r3,r6
-       bl 0f
-0:
-       mflr itmp1
-       lwz itmp1,lo16(builtin_monitorexit-0b)(itmp1)
-       mtctr itmp1
-       addi r1,r1,-40
-       bctrl
-       addi r1,r1,40
-
-       lwz xptr,5*4(r1)
-       mtlr xptr
-       lwz r3,0*4(r1)
-       lwz r4,1*4(r1)
-       lwz r2,2*4(r1)
-       lwz xptr,3*4(r1)
-       lwz xpc,4*4(r1)
-       addi r1,r1,6*4
-
-no_monitor_exit:
-       lwz r3,FrameSize(pv)
-       add r1,r1,r3
-       mr r3,r1
-       lwz r4,IsLeaf(pv)
-       mr. r4,r4
-       bne ex_no_restore
-       lwz r4,8(r3)
-       mtlr r4
-ex_no_restore:
-       mflr r4
-       mr xpc,r4
-       lwz r4,IntSave(pv)
-       bl ex_int1
-ex_int1:
-       mflr r5
-       addi r5,r5,lo16(ex_int2-ex_int1)
-       slwi r4,r4,2
-       subf r5,r4,r5
-       mtctr r5
-       bctr
-       lwz r14,-40(r3)
-       lwz r15,-36(r3)
-       lwz r24,-32(r3)
-       lwz r25,-28(r3)
-       lwz r26,-24(r3)
-       lwz r27,-20(r3)
-       lwz r28,-16(r3)
-       lwz r29,-12(r3)
-       lwz r30,-8(r3)
-       lwz r31,-4(r3)
-ex_int2:
-       subf r3,r4,r3
-
-       lwz r4,FltSave(pv)
-       bl ex_flt1
-ex_flt1:
-       mflr r5
-       addi r5,r5,lo16(ex_flt2-ex_flt1)
-       slwi r4,r4,2
-       subf r5,r4,r5
-       mtctr r5
-       bctr
-       lfd f14,-80(r3)
-       lfd f15,-72(r3)
-       lfd f24,-64(r3)
-       lfd f25,-56(r3)
-       lfd f26,-48(r3)
-       lfd f27,-40(r3)
-       lfd f28,-32(r3)
-       lfd f29,-24(r3)
-       lfd f30,-16(r3)
-       lfd f31,-8(r3)
-ex_flt2:
-       mtlr xpc
-       lwz itmp3,4(xpc)
-       extsh itmp3,itmp3
-       add pv,itmp3,xpc
-       lwz itmp3,8(xpc)
-       srwi itmp3,itmp3,16
-       cmpwi itmp3,0x3dad
-       bne ex_stack_loop
-       lwz itmp3,8(xpc)
-       slwi itmp3,itmp3,16
-       add pv,pv,itmp3
-       b ex_stack_loop
-
-
-
-
-
-
-
-.globl _asm_builtin_checkarraycast
-_asm_builtin_checkarraycast:
-0:
-       mflr r0
-       stw r0,8(r1)
-       stwu r1,-48(r1)
-
-       stw r3,32(r1)
-       lwz itmp1,lo16(builtincheckarraycast-0b)(pv)
-       mtctr itmp1
-       bctrl
-
-       lwz r0,48+8(r1)
-       mtlr r0
-       mr. r3,r3
-       beq nb_carray_throw
-       lwz r3,32(r1)
-       addi r1,r1,48
-       blr
-
-nb_carray_throw:
-       lwz xptr,lo16(proto_java_lang_ClassCastException-0b)(pv)
-       lwz xptr,0(xptr)
-       addi r1,r1,48
-       mflr xpc
-       b _asm_handle_nat_exception
-
-.globl _asm_builtin_checkcast
-_asm_builtin_checkcast:
-0:
-       lwz xptr,lo16(proto_java_lang_NullPointerException-0b)(pv)
-       lwz xptr,0(xptr)
-       mflr xpc
-       b _asm_handle_nat_exception
-
-
-       
-       
-       
-       
-       
-builtincanstore:
-       .long _builtin_canstore
-builtincheckarraycast:
-       .long _builtin_checkarraycast
-       
-.globl _asm_builtin_aastore
-_asm_builtin_aastore:
-0:
-       mr. r3,r3
-       beq nb_aastore_null
-       mflr r0
-       stw r0,8(r1)
-       stwu r1,-48(r1)
-
-       lwz itmp1,offarraysize(r3)
-       slwi itmp3,r4,2
-       add itmp2,r3,itmp3
-       cmplw r4,itmp1
-       bge nb_aastore_bound
-       mr r4,r5
-       stw itmp2,32(r1)
-       stw r4,36(r1)
-//     addis pv,r31,ha16(builtincanstore-0b)
-       lwz itmp1,lo16(builtincanstore-0b)(pv)
-       mtctr itmp1
-       bctrl
-
-       lwz r0,48+8(r1)
-       mtlr r0
-       lwz itmp1,32(r1)
-       lwz itmp2,36(r1)
-       addi r1,r1,48
-       mr. r3,r3
-       beq nb_aastore_throw
-       stw itmp2,offobjarrdata(itmp1)
-       blr
-
-proto_java_lang_NullPointerException:
-       .long _proto_java_lang_NullPointerException
-proto_java_lang_ArrayIndexOutOfBoundsException:
-       .long _proto_java_lang_ArrayIndexOutOfBoundsException
-proto_java_lang_ArrayStoreException:
-       .long _proto_java_lang_ArrayStoreException
-proto_java_lang_ArithmeticException:
-       .long _proto_java_lang_ArithmeticException
-proto_java_lang_ClassCastException:
-       .long _proto_java_lang_ClassCastException
-
-nb_aastore_null:
-       lwz xptr,lo16(proto_java_lang_NullPointerException-0b)(pv)
-       lwz xptr,0(xptr)
-       mflr xpc
-       b _asm_handle_nat_exception
-nb_aastore_bound:
-       lwz xptr,lo16(proto_java_lang_ArrayIndexOutOfBoundsException-0b)(pv)
-       lwz xptr,0(xptr)
-       addi r1,r1,48
-       mflr xpc
-       b _asm_handle_nat_exception
-nb_aastore_throw:
-       lwz xptr,lo16(proto_java_lang_ArrayStoreException-0b)(pv)
-       lwz xptr,0(xptr)
-       mflr xpc
-       b _asm_handle_nat_exception
-
-
-
-.globl _asm_dumpregistersandcall
-_asm_dumpregistersandcall:
-       mflr r0
-       stw r0,8(r1)
-
-       stw r16,-72(r1)
-       stw r17,-68(r1)
-       stw r18,-64(r1)
-       stw r19,-60(r1)
-       stw r20,-56(r1)
-       stw r21,-52(r1)
-       stw r22,-48(r1)
-       stw r23,-44(r1)
-
-       stw r14,-40(r1)
-       stw r15,-36(r1)
-       stw r24,-32(r1)
-       stw r25,-28(r1)
-       stw r26,-24(r1)
-       stw r27,-20(r1)
-       stw r28,-16(r1)
-       stw r29,-12(r1)
-       stw r30,-8(r1)
-       stw r31,-4(r1)
-       addi r1,r1,-96
-
-       mtctr r3
-       bctrl
-
-       lwz r0,96+8(r1)
-       mtlr r0
-       addi r1,r1,96
-       blr
-
-       
-       
-.globl _asm_builtin_monitorenter
-_asm_builtin_monitorenter:
-0:
-       lwz itmp2,lo16(builtin_monitorenter-0b)(pv)
-       mr. r3,r3
-       beq nb_monitorenter
-       mtctr itmp2
-       bctr
-nb_monitorenter:
-       mflr r2
-       lwz xptr,lo16(proto_java_lang_NullPointerException-0b)(pv)
-       lwz xptr,0(xptr)
-       addi xpc,r2,-4
-       b _asm_handle_nat_exception
-
-.globl _asm_builtin_monitorexit
-_asm_builtin_monitorexit:
-0:
-       lwz itmp2,lo16(builtin_monitorexit-0b)(pv)
-       mr. r3,r3
-       beq nb_monitorexit
-       mtctr itmp2
-       bctr
-nb_monitorexit:
-       mflr r2
-       lwz xptr,lo16(proto_java_lang_NullPointerException-0b)(pv)
-       lwz xptr,0(xptr)
-       addi xpc,r2,-4
-       b _asm_handle_nat_exception
-       
-       
-       
-       
-       
-.globl _synchronize_caches
-_synchronize_caches:
-       blr
-.globl _asm_getcallingmethod
-_asm_getcallingmethod:
-       li r3,0
-       blr
-
-.globl _asm_builtin_ldiv
-_asm_builtin_ldiv:
-0:
-       or. r0,r5,r6
-       beq nb_ldiv
-       lwz itmp1,lo16(builtin_ldiv-0b)(pv)
-       mtctr itmp1
-       bctr
-nb_ldiv:
-       lwz xptr,lo16(proto_java_lang_ArithmeticException-0b)(pv)
-       lwz xptr,0(xptr)
-       mflr xpc
-       b _asm_handle_nat_exception
-
-.globl _asm_builtin_lrem
-_asm_builtin_lrem:
-0:
-       or. r0,r5,r6
-       beq nb_lrem
-       lwz itmp1,lo16(builtin_lrem-0b)(pv)
-       mtctr itmp1
-       bctr
-nb_lrem:
-       lwz xptr,lo16(proto_java_lang_ArithmeticException-0b)(pv)
-       lwz xptr,0(xptr)
-       mflr xpc
-       b _asm_handle_nat_exception
-
-.globl _asm_builtin_idiv
-_asm_builtin_idiv:
-0:
-       mr. r4,r4
-       beq nb_idiv
-       divw r3,r3,r4
-       blr
-nb_idiv:
-       lwz xptr,lo16(proto_java_lang_ArithmeticException-0b)(pv)
-       lwz xptr,0(xptr)
-       mflr xpc
-       b _asm_handle_nat_exception
-
-.globl _asm_builtin_irem
-_asm_builtin_irem:
-0:
-       mr. r4,r4
-       beq nb_irem
-       divw itmp3,r3,r4
-       mullw itmp3,itmp3,r4
-       subf r3,itmp3,r3
-       blr
-nb_irem:
-       lwz xptr,lo16(proto_java_lang_ArithmeticException-0b)(pv)
-       lwz xptr,0(xptr)
-       mflr xpc
-       b _asm_handle_nat_exception
-
-
-       
-       
-.globl _has_no_x_instr_set
-_has_no_x_instr_set:
-       li r3,0
-       blr
-
-
-       .globl _asm_cacheflush
-_asm_cacheflush:
-       addi r4,r4,31
-       mr r5,r3
-       add r4,r3,r4
-1:
-       cmplw r3,r4
-       bge 0f
-       dcbst 0,r3
-       addi r3,r3,32
-       b 1b
-0:
-       sync
-1:
-       cmplw r5,r4
-       bge 0f
-       icbi 0,r5
-       addi r5,r5,32
-       b 1b
-0:
-       sync
-       isync
-       blr
-
-       .align 3
-doublezero:
-       .double 0.0
-
-.globl _asm_initialize_thread_stack
-_asm_initialize_thread_stack:
-       addi r4,r4,-256
-       stw r3,120(r4)
-       li r3,0
-       stw r3,124(r4)
-       stw r3,0(r4)
-       stw r3,4(r4)
-       stw r3,8(r4)
-       stw r3,12(r4)
-       stw r3,16(r4)
-       stw r3,20(r4)
-       stw r3,24(r4)
-       stw r3,28(r4)
-       stw r3,32(r4)
-       stw r3,36(r4)
-
-       stw r3,128(r4)
-       stw r3,132(r4)
-       stw r3,136(r4)
-       stw r3,140(r4)
-       stw r3,144(r4)
-       stw r3,148(r4)
-       stw r3,152(r4)
-       stw r3,156(r4)
-
-       mflr r0
-       bl 0f
-0:
-       mflr r3
-       mtlr r0
-       lfd f0,lo16(doublezero-0b)(r3)
-
-       stfd f0,40(r4)
-       stfd f0,48(r4)
-       stfd f0,56(r4)
-       stfd f0,64(r4)
-       stfd f0,72(r4)
-       stfd f0,80(r4)
-       stfd f0,88(r4)
-       stfd f0,96(r4)
-       stfd f0,104(r4)
-       stfd f0,112(r4)
-
-       stfd f0,160(r4)
-       stfd f0,168(r4)
-       stfd f0,176(r4)
-       stfd f0,184(r4)
-       stfd f0,192(r4)
-       stfd f0,200(r4)
-       stfd f0,208(r4)
-       stfd f0,216(r4)
-
-       mr r3,r4
-       blr
-
-.globl _asm_perform_threadswitch
-_asm_perform_threadswitch:
-       mflr r0
-       addi r1,r1,-224
-       stw r0,120(r1)
-       stw pv,124(r1)
-       stw r14,0(r1)
-       stw r15,4(r1)
-       stw r24,8(r1)
-       stw r25,12(r1)
-       stw r26,16(r1)
-       stw r27,20(r1)
-       stw r28,24(r1)
-       stw r29,28(r1)
-       stw r30,32(r1)
-       stw r31,36(r1)
-       stfd f14,40(r1)
-       stfd f15,48(r1)
-       stfd f24,56(r1)
-       stfd f25,64(r1)
-       stfd f26,72(r1)
-       stfd f27,80(r1)
-       stfd f28,88(r1)
-       stfd f29,96(r1)
-       stfd f30,104(r1)
-       stfd f31,112(r1)
-
-       stw r16,128(r1)
-       stw r17,132(r1)
-       stw r18,136(r1)
-       stw r19,140(r1)
-       stw r20,144(r1)
-       stw r21,148(r1)
-       stw r22,152(r1)
-       stw r23,156(r1)
-       stfd f16,160(r1)
-       stfd f17,168(r1)
-       stfd f18,176(r1)
-       stfd f19,184(r1)
-       stfd f20,192(r1)
-       stfd f21,200(r1)
-       stfd f22,208(r1)
-       stfd f23,216(r1)
-
-       stw r1,0(r3)
-       stw r1,0(r5)
-       lwz r1,0(r4)
-
-       lwz r0,120(r1)
-       lwz pv,124(r1)
-       lwz r14,0(r1)
-       lwz r15,4(r1)
-       lwz r24,8(r1)
-       lwz r25,12(r1)
-       lwz r26,16(r1)
-       lwz r27,20(r1)
-       lwz r28,24(r1)
-       lwz r29,28(r1)
-       lwz r30,32(r1)
-       lwz r31,36(r1)
-       lfd f14,40(r1)
-       lfd f15,48(r1)
-       lfd f24,56(r1)
-       lfd f25,64(r1)
-       lfd f26,72(r1)
-       lfd f27,80(r1)
-       lfd f28,88(r1)
-       lfd f29,96(r1)
-       lfd f30,104(r1)
-       lfd f31,112(r1)
-
-       lwz r16,128(r1)
-       lwz r17,132(r1)
-       lwz r18,136(r1)
-       lwz r19,140(r1)
-       lwz r20,144(r1)
-       lwz r21,148(r1)
-       lwz r22,152(r1)
-       lwz r23,156(r1)
-       lfd f16,160(r1)
-       lfd f17,168(r1)
-       lfd f18,176(r1)
-       lfd f19,184(r1)
-       lfd f20,192(r1)
-       lfd f21,200(r1)
-       lfd f22,208(r1)
-       lfd f23,216(r1)
-
-       mtlr r0
-       addi r1,r1,224
-       blr
-
-
-
-.globl _asm_switchstackandcall
-_asm_switchstackandcall:
-       mflr r0
-       addi r3,r3,-48
-       stw r0,40(r3)
-       stw r1,44(r3)
-       stw r1,0(r5)
-       mr r1,r3
-
-       mtctr r4
-       mr r3,r6
-       bctrl
-
-       lwz r0,40(r1)
-       mtlr r0
-       lwz r1,44(r1)
-       blr
-
-
-
-       .globl _my_dump
-_my_dump:
-       mflr r0
-       bl 0f
-0:
-       mflr itmp1
-       mtlr r0
-       lwz xptr,lo16(proto_java_lang_NullPointerException-0b)(itmp1)
-       lwz xptr,0(xptr)
-       b _asm_handle_exception
-
-
-
-
-
-#define C_RED_ZONE 224
-
-catch_Handler:
-       .long _catch_Handler
-
-       .globl _asm_sighandler
-_asm_sighandler:
-       addi r1,r1,-32*4 - 32 - C_RED_ZONE
-       stmw r0,32(r1)
-       mflr r0
-       stw r0,28(r1)
-
-       bl 0f
-0:
-       mflr r31
-       lwz r0,lo16(catch_Handler-0b)(r31)
-       mtctr r0
-       addi r3,r1,32
-       bctrl
-       
-       lwz r0,28(r1)
-       mtlr r0
-       cmpwi r3,0
-       bne 1f
-       lmw r2,32+8(r1)
-       lwz r0,32(r1)
-       addi r1,r1,32*4 + 32 + C_RED_ZONE
-       b _asm_handle_exception
-
-1:
-       mtctr r3
-       lmw r2,32+8(r1)
-       lwz r0,32(r1)
-       addi r1,r1,32*4 + 32 + C_RED_ZONE
-       bctr
diff --git a/powerpc/defines.h b/powerpc/defines.h
deleted file mode 100644 (file)
index 5532fbb..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* powerpc/defines.h ***********************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       system-dependent definitions
-
-       Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/09/11
-
-*******************************************************************************/
-
-#define USE_INTERNAL_THREADS
-
-#define HAVE_FCNTL
-#define HAVE_IOCTL
diff --git a/powerpc/dis-asm.h b/powerpc/dis-asm.h
deleted file mode 100644 (file)
index 98988a2..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-/* Interface between the opcode library and its callers.
-
-   Copyright 2001, 2002 Free Software Foundation, Inc.
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-   
-   Written by Cygnus Support, 1993.
-
-   The opcode library (libopcodes.a) provides instruction decoders for
-   a large variety of instruction sets, callable with an identical
-   interface, for making instruction-processing programs more independent
-   of the instruction set being processed.  */
-
-#ifndef DIS_ASM_H
-#define DIS_ASM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-
-#define PARAMS(a) a
-
-       /*
-typedef unsigned char u1;
-typedef unsigned int u4;
-typedef signed int s4;
-       */
-typedef void *PTR;
-typedef void *bfd;
-typedef u4 bfd_vma;
-typedef s4 bfd_signed_vma;
-typedef u1 bfd_byte;
-       
-typedef int (*fprintf_ftype) PARAMS((PTR, const char*, ...));
-
-enum dis_insn_type {
-  dis_noninsn,                 /* Not a valid instruction */
-  dis_nonbranch,               /* Not a branch instruction */
-  dis_branch,                  /* Unconditional branch */
-  dis_condbranch,              /* Conditional branch */
-  dis_jsr,                     /* Jump to subroutine */
-  dis_condjsr,                 /* Conditional jump to subroutine */
-  dis_dref,                    /* Data reference instruction */
-  dis_dref2                    /* Two data references in instruction */
-};
-
-/* This struct is passed into the instruction decoding routine, 
-   and is passed back out into each callback.  The various fields are used
-   for conveying information from your main routine into your callbacks,
-   for passing information into the instruction decoders (such as the
-   addresses of the callback functions), or for passing information
-   back from the instruction decoders to their callers.
-
-   It must be initialized before it is first passed; this can be done
-   by hand, or using one of the initialization macros below.  */
-
-typedef struct disassemble_info {
-  fprintf_ftype fprintf_func;
-  PTR stream;
-  PTR application_data;
-
-  /* An arch/mach-specific bitmask of selected instruction subsets, mainly
-     for processors with run-time-switchable instruction sets.  The default,
-     zero, means that there is no constraint.  CGEN-based opcodes ports
-     may use ISA_foo masks.  */
-  unsigned long insn_sets;
-
-
-  /* For use by the disassembler.
-     The top 16 bits are reserved for public use (and are documented here).
-     The bottom 16 bits are for the internal use of the disassembler.  */
-  unsigned long flags;
-#define INSN_HAS_RELOC 0x80000000
-  PTR private_data;
-
-  /* Function used to get bytes to disassemble.  MEMADDR is the
-     address of the stuff to be disassembled, MYADDR is the address to
-     put the bytes in, and LENGTH is the number of bytes to read.
-     INFO is a pointer to this struct.
-     Returns an errno value or 0 for success.  */
-  int (*read_memory_func)
-    PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
-            struct disassemble_info *info));
-
-  /* Function which should be called if we get an error that we can't
-     recover from.  STATUS is the errno value from read_memory_func and
-     MEMADDR is the address that we were trying to read.  INFO is a
-     pointer to this struct.  */
-  void (*memory_error_func)
-    PARAMS ((int status, bfd_vma memaddr, struct disassemble_info *info));
-
-  /* Function called to print ADDR.  */
-  void (*print_address_func)
-    PARAMS ((bfd_vma addr, struct disassemble_info *info));
-
-  /* Function called to determine if there is a symbol at the given ADDR.
-     If there is, the function returns 1, otherwise it returns 0.
-     This is used by ports which support an overlay manager where
-     the overlay number is held in the top part of an address.  In
-     some circumstances we want to include the overlay number in the
-     address, (normally because there is a symbol associated with
-     that address), but sometimes we want to mask out the overlay bits.  */
-  int (* symbol_at_address_func)
-    PARAMS ((bfd_vma addr, struct disassemble_info * info));
-
-  /* These are for buffer_read_memory.  */
-  bfd_byte *buffer;
-  bfd_vma buffer_vma;
-  unsigned int buffer_length;
-
-  /* This variable may be set by the instruction decoder.  It suggests
-      the number of bytes objdump should display on a single line.  If
-      the instruction decoder sets this, it should always set it to
-      the same value in order to get reasonable looking output.  */
-  int bytes_per_line;
-
-  /* the next two variables control the way objdump displays the raw data */
-  /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */
-  /* output will look like this:
-     00:   00000000 00000000
-     with the chunks displayed according to "display_endian". */
-  int bytes_per_chunk;
-
-  /* Number of octets per incremented target address 
-     Normally one, but some DSPs have byte sizes of 16 or 32 bits.  */
-  unsigned int octets_per_byte;
-
-  /* Results from instruction decoders.  Not all decoders yet support
-     this information.  This info is set each time an instruction is
-     decoded, and is only valid for the last such instruction.
-
-     To determine whether this decoder supports this information, set
-     insn_info_valid to 0, decode an instruction, then check it.  */
-
-  char insn_info_valid;                /* Branch info has been set. */
-  char branch_delay_insns;     /* How many sequential insn's will run before
-                                  a branch takes effect.  (0 = normal) */
-  char data_size;              /* Size of data reference in insn, in bytes */
-  enum dis_insn_type insn_type;        /* Type of instruction */
-  bfd_vma target;              /* Target address of branch or dref, if known;
-                                  zero if unknown.  */
-  bfd_vma target2;             /* Second target address for dref2 */
-
-  /* Command line options specific to the target disassembler.  */
-  char * disassembler_options;
-
-} disassemble_info;
-
-\f
-/* Standard disassemblers.  Disassemble one instruction at the given
-   target address.  Return number of octets processed.  */
-typedef int (*disassembler_ftype)
-     PARAMS((bfd_vma, disassemble_info *));
-
-extern int print_insn_big_mips         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_mips      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i386             PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_i386_att         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i386_intel       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ia64             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i370             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68hc11          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68hc12          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_z8001            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_z8002            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300h           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300s           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8500            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_alpha            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_arm          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_arm       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sparc            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_a29k         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_a29k      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_avr              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_d10v             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_d30v             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_dlx              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_fr30             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_hppa             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i860             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i960             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ip2k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m32r             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m88k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mcore            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mmix             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mn10200          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mn10300          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ns32k            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_openrisc         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_or32          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_or32       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_pdp11            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_pj               PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_powerpc      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_powerpc   PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_rs6000           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_s390              PARAMS ((bfd_vma, disassemble_info*)); 
-extern int print_insn_sh               PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic30            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic4x            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic54x           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic80            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_v850             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_vax              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_w65              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_xstormy16                PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sh64             PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_sh64x_media      PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_frv              PARAMS ((bfd_vma, disassemble_info *));
-
-extern disassembler_ftype arc_get_disassembler PARAMS ((void *));
-extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *));
-
-extern void print_arm_disassembler_options PARAMS ((FILE *));
-extern void parse_arm_disassembler_option  PARAMS ((char *));
-extern int  get_arm_regname_num_options    PARAMS ((void));
-extern int  set_arm_regname_option         PARAMS ((int));
-extern int  get_arm_regnames               PARAMS ((int, const char **, const char **, const char ***));
-
-/* Fetch the disassembler for a given BFD, if that support is available.  */
-extern disassembler_ftype disassembler PARAMS ((bfd *));
-
-/* Document any target specific options available from the disassembler.  */
-extern void disassembler_usage          PARAMS ((FILE *));
-
-\f
-/* This block of definitions is for particular callers who read instructions
-   into a buffer before calling the instruction decoder.  */
-
-/* Here is a function which callers may wish to use for read_memory_func.
-   It gets bytes from a buffer.  */
-extern int buffer_read_memory
-  PARAMS ((bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *));
-
-/* This function goes with buffer_read_memory.
-   It prints a message using info->fprintf_func and info->stream.  */
-extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *));
-
-
-/* Just print the address in hex.  This is included for completeness even
-   though both GDB and objdump provide their own (to print symbolic
-   addresses).  */
-extern void generic_print_address
-  PARAMS ((bfd_vma, struct disassemble_info *));
-
-/* Always true.  */
-extern int generic_symbol_at_address
-  PARAMS ((bfd_vma, struct disassemble_info *));
-
-/* Macro to initialize a disassemble_info struct.  This should be called
-   by all applications creating such a struct.  */
-#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
-  (INFO).insn_sets = 0, \
-  (INFO).octets_per_byte = 1, \
-  INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC)
-
-/* Call this macro to initialize only the internal variables for the
-   disassembler.  Architecture dependent things such as byte order, or machine
-   variant are not touched by this macro.  This makes things much easier for
-   GDB which must initialize these things separately.  */
-
-#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
-  (INFO).fprintf_func = (fprintf_ftype)(FPRINTF_FUNC), \
-  (INFO).stream = (PTR)(STREAM), \
-  (INFO).private_data = NULL, \
-  (INFO).buffer = NULL, \
-  (INFO).buffer_vma = 0, \
-  (INFO).buffer_length = 0, \
-  (INFO).read_memory_func = buffer_read_memory, \
-  (INFO).memory_error_func = perror_memory, \
-  (INFO).print_address_func = generic_print_address, \
-  (INFO).symbol_at_address_func = generic_symbol_at_address, \
-  (INFO).flags = 0, \
-  (INFO).bytes_per_line = 0, \
-  (INFO).bytes_per_chunk = 0, \
-  (INFO).disassembler_options = NULL, \
-  (INFO).insn_info_valid = 0
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* ! defined (DIS_ASM_H) */
diff --git a/powerpc/disass.c b/powerpc/disass.c
deleted file mode 100644 (file)
index 28f12ca..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "dis-asm.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-
-char *regs[] = {
-       "r0",
-       "r1",
-       "r2",
-       "r3",
-       "r4",
-       "r5",
-       "r6",
-       "r7",
-       "r8",
-       "r9",
-       "r10",
-       "r11",
-       "r12",
-       "r13",
-       "r14",
-       "r15",
-       "r16",
-       "r17",
-       "r18",
-       "r19",
-       "r20",
-       "r21",
-       "r22",
-       "r23",
-       "r24",
-       "r25",
-       "r26",
-       "r27",
-       "r28",
-       "r29",
-       "r30",
-       "r31",
-};
-
-void myprintf(PTR p, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       vprintf(fmt, ap);
-       va_end(ap);
-       fflush(stdout);
-}
-
-int buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info)
-{
-       memcpy(myaddr, (void*) memaddr, length);
-       return 0;
-}
-
-void perror_memory(int status, bfd_vma memaddr, struct disassemble_info *info)
-{
-       assert(0);
-}
-
-void generic_print_address(bfd_vma addr, struct disassemble_info *info)
-{
-       myprintf(NULL, "0x%x", addr - (u4) info->application_data);
-}
-
-int generic_symbol_at_address(bfd_vma addr, struct disassemble_info *info)
-{
-       assert(0);
-}
-
-unsigned long bfd_getb32(void *buf)
-{
-       return *(unsigned long *) buf;
-}
-
-unsigned long bfd_getl32(void *buf)
-{
-       return *(unsigned long *) buf;
-}
-
-void sprintf_vma(char *buf, bfd_vma disp)
-{
-       sprintf(buf, "0x%x", disp);
-}
-
-void disassinstr(int c, int pos)
-{
-       disassemble_info info;
-
-       printf ("%6x: %8x  ", pos, c);
-
-       INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
-       info.application_data = (PTR) ((u4) &c - pos);
-       print_insn_big_powerpc((bfd_vma) &c, &info);
-       printf ("\n");
-}
-
-void disassemble(int *code, int len)
-{
-       int p;
-       disassemble_info info;
-
-       INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
-       info.application_data = code;
-       printf ("  --- disassembler listing ---\n");
-       for (p = 0; p < len; p += 4, code++) {
-               myprintf(NULL, "%6x: %08x  ", p, *code);
-               print_insn_big_powerpc((bfd_vma) p, &info);
-               myprintf(NULL, "\n");
-       }
-}
diff --git a/powerpc/native-math.h b/powerpc/native-math.h
deleted file mode 100644 (file)
index b58b060..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* alpha/native-math.h *********************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the machine-specific floating point definitions.
-
-       Authors: Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-                Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/10/21
-
-*******************************************************************************/
-
-#ifndef _NATIVE_MATH_H
-#define _NATIVE_MATH_H
-
-/* include machine-specific math.h */
-
-#include <math.h>
-
-#define copysignf copysign
-#define finitef finite
-#define fmodf fmod
-#define isnanf isnan
-
-/* define infinity for floating point numbers */
-
-static u4 flt_nan    = 0xffffffff;
-static u4 flt_posinf = 0x7f800000;
-static u4 flt_neginf = 0xff800000;
-
-#define FLT_NAN    (*((float*) (&flt_nan)))
-#define FLT_POSINF (*((float*) (&flt_posinf)))
-#define FLT_NEGINF (*((float*) (&flt_neginf)))
-
-/* define infinity for double floating point numbers */
-
-static u8 dbl_nan    = 0xffffffffffffffffLL ;
-static u8 dbl_posinf = 0x7ff0000000000000LL ;
-static u8 dbl_neginf = 0xfff0000000000000LL ;
-
-#define DBL_NAN    (*((double*) (&dbl_nan)))
-#define DBL_POSINF (*((double*) (&dbl_posinf)))
-#define DBL_NEGINF (*((double*) (&dbl_neginf)))
-
-#endif
diff --git a/powerpc/ngen.c b/powerpc/ngen.c
deleted file mode 100644 (file)
index 005209a..0000000
+++ /dev/null
@@ -1,3230 +0,0 @@
-/* alpha/ngen.c ****************************************************************
-
-       Copyright (c) 1997, 2003 A. Krall, R. Grafl, M. Gschwind, M. Probst, S. Ring
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the codegenerator for a PowerPC processor.
-       This module generates PowerPC machine code for a sequence of
-       pseudo commands (ICMDs).
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: $Id: ngen.c 556 2003-11-02 13:32:02Z stefan $
-
-*******************************************************************************/
-
-#include "jitdef.h"   /* phil */
-
-/* additional functions and macros to generate code ***************************/
-
-#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
-
-
-#ifdef STATISTICS
-#define COUNT_SPILLS count_spills++
-#else
-#define COUNT_SPILLS
-#endif
-
-
-/* gen_nullptr_check(objreg) */
-
-#ifdef SOFTNULLPTRCHECK
-#define gen_nullptr_check(objreg) \
-       if (checknull) {\
-               M_TST((objreg));\
-               M_BEQ(0);\
-               mcode_addxnullrefs(mcodeptr);\
-       }
-#else
-#define gen_nullptr_check(objreg)
-#endif
-
-
-/* MCODECHECK(icnt) */
-
-#define MCODECHECK(icnt) \
-       if((mcodeptr+(icnt))>mcodeend)mcodeptr=mcode_increase((u1*)mcodeptr)
-
-/* M_INTMOVE:
-     generates an integer-move from register a to b.
-     if a and b are the same int-register, no code will be generated.
-*/ 
-
-#define M_INTMOVE(a,b) if((a)!=(b)){M_MOV(a,b);}
-
-#define M_TINTMOVE(t,a,b) \
-       if ((t)==TYPE_LNG) \
-               {if (a<=b)M_INTMOVE(secondregs[a],secondregs[b]);\
-               M_INTMOVE(a,b); if (a>b)M_INTMOVE(secondregs[a],secondregs[b]);} \
-       else \
-               M_INTMOVE(a,b);
-
-
-/* M_FLTMOVE:
-    generates a floating-point-move from register a to b.
-    if a and b are the same float-register, no code will be generated
-*/ 
-
-#define M_FLTMOVE(a,b) if((a)!=(b)){M_FMOV(a,b);}
-
-
-/* var_to_reg_xxx:
-    this function generates code to fetch data from a pseudo-register
-    into a real register. 
-    If the pseudo-register has actually been assigned to a real 
-    register, no code will be emitted, since following operations
-    can use this register directly.
-    
-    v: pseudoregister to be fetched from
-    tempregnum: temporary register to be used if v is actually spilled to ram
-
-    return: the register number, where the operand can be found after 
-            fetching (this wil be either tempregnum or the register
-            number allready given to v)
-*/
-
-#define var_to_reg_int0(regnr,v,tempnr,a,b) { \
-       if ((v)->flags & INMEMORY) \
-               {COUNT_SPILLS;if (a) M_ILD(tempnr,REG_SP,4*(v)->regoff); \
-               regnr=tempnr; \
-               if ((b) && IS_2_WORD_TYPE((v)->type)) \
-                       M_ILD((a)?secondregs[tempnr]:tempnr,REG_SP,4*(v)->regoff+4);} \
-       else regnr=(!(a)&&(b)) ? secondregs[(v)->regoff] : (v)->regoff; \
-}
-#define var_to_reg_int(regnr,v,tempnr) var_to_reg_int0(regnr,v,tempnr,1,1)
-
-
-#define var_to_reg_flt(regnr,v,tempnr) { \
-       if ((v)->flags & INMEMORY) { \
-               COUNT_SPILLS; \
-               if ((v)->type==TYPE_DBL) \
-                       M_DLD(tempnr,REG_SP,4*(v)->regoff); \
-               else \
-                       M_FLD(tempnr,REG_SP,4*(v)->regoff); \
-               regnr=tempnr; \
-       } else regnr=(v)->regoff; \
-}
-
-
-/* reg_of_var:
-    This function determines a register, to which the result of an operation
-    should go, when it is ultimatively intended to store the result in
-    pseudoregister v.
-    If v is assigned to an actual register, this register will be returned.
-    Otherwise (when v is spilled) this function returns tempregnum.
-    If not already done, regoff and flags are set in the stack location.
-*/        
-
-static int reg_of_var(stackptr v, int tempregnum)
-{
-       varinfo      *var;
-
-       switch (v->varkind) {
-               case TEMPVAR:
-                       if (!(v->flags & INMEMORY))
-                               return(v->regoff);
-                       break;
-               case STACKVAR:
-                       var = &(interfaces[v->varnum][v->type]);
-                       v->regoff = var->regoff;
-                       if (!(var->flags & INMEMORY))
-                               return(var->regoff);
-                       break;
-               case LOCALVAR:
-                       var = &(locals[v->varnum][v->type]);
-                       v->regoff = var->regoff;
-                       if (!(var->flags & INMEMORY))
-                               return(var->regoff);
-                       break;
-               case ARGVAR:
-                       v->regoff = v->varnum;
-                       if (IS_FLT_DBL_TYPE(v->type)) {
-                               if (v->varnum < fltreg_argnum) {
-                                       v->regoff = argfltregs[v->varnum];
-                                       return(argfltregs[v->varnum]);
-                                       }
-                               }
-                       else
-                               if (v->varnum < intreg_argnum - (IS_2_WORD_TYPE(v->type)!=0)) {
-                                       v->regoff = argintregs[v->varnum];
-                                       return(argintregs[v->varnum]);
-                                       }
-                       v->regoff += 6;
-                       break;
-               }
-       v->flags |= INMEMORY;
-       return tempregnum;
-}
-
-
-/* store_reg_to_var_xxx:
-    This function generates the code to store the result of an operation
-    back into a spilled pseudo-variable.
-    If the pseudo-variable has not been spilled in the first place, this 
-    function will generate nothing.
-    
-    v ............ Pseudovariable
-    tempregnum ... Number of the temporary registers as returned by
-                   reg_of_var.
-*/     
-
-#define store_reg_to_var_int0(sptr, tempregnum, a, b) {       \
-       if ((sptr)->flags & INMEMORY) {                    \
-               COUNT_SPILLS;                                  \
-               if (a) M_IST(tempregnum, REG_SP, 4 * (sptr)->regoff); \
-               if ((b) && IS_2_WORD_TYPE((sptr)->type)) \
-                       M_IST(secondregs[tempregnum], REG_SP, 4 * (sptr)->regoff + 4); \
-               }                                              \
-       }
-
-#define store_reg_to_var_int(sptr, tempregnum) \
-       store_reg_to_var_int0(sptr, tempregnum, 1, 1)
-
-#define store_reg_to_var_flt(sptr, tempregnum) {       \
-       if ((sptr)->flags & INMEMORY) {                    \
-               COUNT_SPILLS;                                  \
-               if ((sptr)->type==TYPE_DBL) \
-                       M_DST(tempregnum, REG_SP, 4 * (sptr)->regoff); \
-               else \
-                       M_FST(tempregnum, REG_SP, 4 * (sptr)->regoff); \
-               }                                              \
-       }
-
-
-#undef ICACHE
-#define ICACHE 0
-void docacheflush(u1 *p, long bytelen, int dummy);
-
-/* NullPointerException signal handler for hardware null pointer check */
-
-void asm_sighandler();
-
-int lastsig;
-int crashpc;
-
-int catch_Handler(int *regs)
-{
-       sigset_t nsig;
-       int instr, reg;
-
-       instr = *(int *) crashpc;
-       reg = (instr>>16) & 31;
-
-       if (!regs[reg]) {
-               sigemptyset(&nsig);
-               sigaddset(&nsig, lastsig);
-               sigprocmask(SIG_UNBLOCK, &nsig, NULL);           /* unblock signal    */
-
-               regs[REG_ITMP2_XPC] = crashpc;
-               regs[REG_ITMP1_XPTR] = (int) proto_java_lang_NullPointerException;
-
-               return 0;
-       }
-
-       panic("segfault");
-}
-
-void catch_NullPointerException(int sig, void *code, struct sigcontext *ctx)
-{
-       int oldsp = ctx->sc_sp;
-
-       lastsig = sig;
-       crashpc = ctx->sc_ir;
-       ctx->sc_ir = (int) asm_sighandler;
-}
-
-
-void init_exceptions(void)
-{
-       /* install signal handlers we need to convert to exceptions */
-
-       if (!checknull) {
-
-#if defined(SIGSEGV)
-               signal(SIGSEGV, (void*) catch_NullPointerException);
-#endif
-
-#if defined(SIGBUS)
-               signal(SIGBUS, (void*) catch_NullPointerException);
-#endif
-
-               }
-}
-
-void adjust_argvars(stackptr s, int d, int *fa, int *ia)
-{
-       if (!d) {
-               *fa = 0; *ia = 0;
-               return;
-       }
-       adjust_argvars(s->prev, d-1, fa, ia);
-       if (s->varkind == ARGVAR)
-               s->varnum = (IS_FLT_DBL_TYPE(s->type)) ? *fa : *ia;
-       *fa += (IS_FLT_DBL_TYPE(s->type) != 0);
-       *ia += (IS_2_WORD_TYPE(s->type)) ? 2 : 1;
-}
-
-void nocode()
-{
-       printf("NOCODE\n");
-}
-
-
-/* function: preregpass ********************************************************
-
-       This is the extra pass mentioned in the documentation. Argument registers
-       are renumbered to match the PowerPC argument passing calling conventions.
-    
-*******************************************************************************/
-
-#define intmaxf(a,b) (((a)<(b)) ? (b) : (a))
-
-void preregpass()
-{
-       int paramsize;
-       stackptr    src;
-       basicblock  *bptr;
-       instruction *iptr;
-       int s3, len;
-
-       ifmemuse = 0;
-       for (bptr = block; bptr != NULL; bptr = bptr->next) {
-               len = bptr->icount;
-               for (iptr = bptr->iinstr, src = bptr->instack;
-                   len > 0;
-                   src = iptr->dst, len--, iptr++)
-               {
-                       if (bptr->flags < BBREACHED)
-                               continue;
-                       switch (iptr->opc) {
-                               case ICMD_BUILTIN1:
-                                       s3 = 1;
-                                       goto countparams;
-                               case ICMD_BUILTIN2:
-                                       s3 = 2;
-                                       goto countparams;
-                               case ICMD_BUILTIN3:
-                                       s3 = 3;
-                                       goto countparams;
-
-                               case ICMD_INVOKEVIRTUAL:
-                               case ICMD_INVOKESPECIAL:
-                               case ICMD_INVOKESTATIC:
-                               case ICMD_INVOKEINTERFACE:
-                                       s3 = iptr->op1;
-countparams:
-                                       {
-                                               int ia, fa;
-                                               adjust_argvars(src, s3, &fa, &ia);
-                                       }
-                                       paramsize = 0;
-                                       for (; --s3 >= 0; src = src->prev) {
-                                               paramsize += IS_2_WORD_TYPE(src->type) ? 2 : 1;
-                                               }
-                                       ifmemuse = intmaxf(ifmemuse, paramsize);
-                                       break;
-
-                               case ICMD_MULTIANEWARRAY:
-                                       s3 = iptr->op1;
-                                       paramsize = intreg_argnum + s3;
-                                       ifmemuse = intmaxf(ifmemuse, paramsize);
-                                       break;
-                       }
-               }
-       }
-
-       ifmemuse += 6;
-       maxmemuse = ifmemuse;
-}
-
-/* function gen_mcode **********************************************************
-
-       generates machine code
-
-*******************************************************************************/
-
-#define        MethodPointer   -8
-#define        FrameSize       -12
-#define     IsSync          -16
-#define     IsLeaf          -20
-#define     IntSave         -24
-#define     FltSave         -28
-#define     ExTableSize     -32
-#define     ExTableStart    -32
-
-#define     ExEntrySize     -16
-#define     ExStartPC       -4
-#define     ExEndPC         -8
-#define     ExHandlerPC     -12
-#define     ExCatchType     -16
-
-static void gen_mcode()
-{
-       int  len, s1, s2, s3, d;
-       s4   a;
-       s4          *mcodeptr;
-       stackptr    src;
-       varinfo     *var;
-       basicblock  *bptr;
-       instruction *iptr;
-       xtable *ex;
-
-       {
-       int p, pa, t, l, r;
-
-       savedregs_num = 0;
-
-       /* space to save used callee saved registers */
-
-       savedregs_num += (savintregcnt - maxsavintreguse);
-       savedregs_num += 2*(savfltregcnt - maxsavfltreguse);
-
-       parentargs_base = maxmemuse + savedregs_num;
-
-#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               parentargs_base++;
-
-#endif
-
-       /* create method header */
-
-       parentargs_base = (parentargs_base+3) & ~3;
-
-#if POINTERSIZE==4
-       (void) dseg_addaddress(method);                         /* Filler         */
-#endif
-       (void) dseg_addaddress(method);                         /* MethodPointer  */
-       (void) dseg_adds4(parentargs_base * 4);                 /* FrameSize      */
-
-#ifdef USE_THREADS
-
-       /* IsSync contains the offset relative to the stack pointer for the
-          argument of monitor_exit used in the exception handler. Since the
-          offset could be zero and give a wrong meaning of the flag it is
-          offset by one.
-       */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               (void) dseg_adds4((maxmemuse + 1) * 4);             /* IsSync         */
-       else
-
-#endif
-
-       (void) dseg_adds4(0);                                   /* IsSync         */
-                                              
-       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
-       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
-       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
-       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
-
-       /* create exception table */
-
-       for (ex = extable; ex != NULL; ex = ex->down) {
-
-#ifdef LOOP_DEBUG      
-               if (ex->start != NULL)
-                       printf("adding start - %d - ", ex->start->debug_nr);
-               else {
-                       printf("PANIC - start is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->start);
-
-#ifdef LOOP_DEBUG                      
-               if (ex->end != NULL)
-                       printf("adding end - %d - ", ex->end->debug_nr);
-               else {
-                       printf("PANIC - end is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->end);
-
-#ifdef LOOP_DEBUG              
-               if (ex->handler != NULL)
-                       printf("adding handler - %d\n", ex->handler->debug_nr);
-               else {
-                       printf("PANIC - handler is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->handler);
-          
-               (void) dseg_addaddress(ex->catchtype);
-               }
-       
-       /* initialize mcode variables */
-       
-       mcodeptr = (s4*) mcodebase;
-       mcodeend = (s4*) (mcodebase + mcodesize);
-       MCODECHECK(128 + mparamcount);
-
-       /* create stack frame (if necessary) */
-
-       if (!isleafmethod) {
-               M_MFLR(REG_ITMP3);
-               M_AST(REG_ITMP3, REG_SP, 8);
-       }
-       if (parentargs_base)
-               {M_LDA (REG_SP, REG_SP, -parentargs_base * 4);}
-
-       /* save return address and used callee saved registers */
-
-       p = parentargs_base;
-       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
-               {p--; M_IST (savintregs[r], REG_SP, 4 * p);}
-       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
-               {p-=2; M_DST (savfltregs[r], REG_SP, 4 * p);}
-
-       /* save monitorenter argument */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               if (method->flags & ACC_STATIC) {
-                       p = dseg_addaddress (class);
-                       M_ALD(REG_ITMP1, REG_PV, p);
-                       M_AST(REG_ITMP1, REG_SP, 4 * maxmemuse);
-                       } 
-               else {
-                       M_AST (argintregs[0], REG_SP, 4 * maxmemuse);
-                       }
-               }                       
-#endif
-
-       /* copy argument registers to stack and call trace function with pointer
-          to arguments on stack. ToDo: save floating point registers !!!!!!!!!
-       */
-
-#if 1
-       if (runverbose) {
-               M_MFLR(REG_ITMP3);
-               M_LDA (REG_SP, REG_SP, -208);
-
-               M_IST(REG_ITMP3, REG_SP, 13*8 + 96);
-               M_IST(argintregs[0], REG_SP, 0*4 + 64);
-               M_IST(argintregs[1], REG_SP, 1*4 + 64);
-               M_IST(argintregs[2], REG_SP, 2*4 + 64);
-               M_IST(argintregs[3], REG_SP, 3*4 + 64);
-               M_IST(argintregs[4], REG_SP, 4*4 + 64);
-               M_IST(argintregs[5], REG_SP, 5*4 + 64);
-               M_IST(argintregs[6], REG_SP, 6*4 + 64);
-               M_IST(argintregs[7], REG_SP, 7*4 + 64);
-
-               M_DST(argfltregs[0], REG_SP, 0*8 + 96);
-               M_DST(argfltregs[1], REG_SP, 1*8 + 96);
-               M_DST(argfltregs[2], REG_SP, 2*8 + 96);
-               M_DST(argfltregs[3], REG_SP, 3*8 + 96);
-               M_DST(argfltregs[4], REG_SP, 4*8 + 96);
-               M_DST(argfltregs[5], REG_SP, 5*8 + 96);
-               M_DST(argfltregs[6], REG_SP, 6*8 + 96);
-               M_DST(argfltregs[7], REG_SP, 7*8 + 96);
-               M_DST(argfltregs[8], REG_SP, 8*8 + 96);
-               M_DST(argfltregs[9], REG_SP, 9*8 + 96);
-               M_DST(argfltregs[10], REG_SP, 10*8 + 96);
-               M_DST(argfltregs[11], REG_SP, 11*8 + 96);
-               M_DST(argfltregs[12], REG_SP, 12*8 + 96);
-
-               p = dseg_addaddress (method);
-               M_ALD(REG_ITMP1, REG_PV, p);
-               M_AST(REG_ITMP1, REG_SP, 56);
-               p = dseg_addaddress ((void*) (builtin_trace_args));
-               M_ALD(REG_ITMP2, REG_PV, p);
-               M_MTCTR(REG_ITMP2);
-               M_JSR;
-
-               M_ILD(REG_ITMP3, REG_SP, 13*8 + 96);
-               M_ILD(argintregs[0], REG_SP, 0*4 + 64);
-               M_ILD(argintregs[1], REG_SP, 1*4 + 64);
-               M_ILD(argintregs[2], REG_SP, 2*4 + 64);
-               M_ILD(argintregs[3], REG_SP, 3*4 + 64);
-               M_ILD(argintregs[4], REG_SP, 4*4 + 64);
-               M_ILD(argintregs[5], REG_SP, 5*4 + 64);
-               M_ILD(argintregs[6], REG_SP, 6*4 + 64);
-               M_ILD(argintregs[7], REG_SP, 7*4 + 64);
-
-               M_DLD(argfltregs[0], REG_SP, 0*8 + 96);
-               M_DLD(argfltregs[1], REG_SP, 1*8 + 96);
-               M_DLD(argfltregs[2], REG_SP, 2*8 + 96);
-               M_DLD(argfltregs[3], REG_SP, 3*8 + 96);
-               M_DLD(argfltregs[4], REG_SP, 4*8 + 96);
-               M_DLD(argfltregs[5], REG_SP, 5*8 + 96);
-               M_DLD(argfltregs[6], REG_SP, 6*8 + 96);
-               M_DLD(argfltregs[7], REG_SP, 7*8 + 96);
-               M_DLD(argfltregs[8], REG_SP, 8*8 + 96);
-               M_DLD(argfltregs[9], REG_SP, 9*8 + 96);
-               M_DLD(argfltregs[10], REG_SP, 10*8 + 96);
-               M_DLD(argfltregs[11], REG_SP, 11*8 + 96);
-               M_DLD(argfltregs[12], REG_SP, 12*8 + 96);
-
-               M_LDA (REG_SP, REG_SP, 208);
-               M_MTLR(REG_ITMP3);
-               }
-#endif
-
-       /* take arguments out of register or stack frame */
-
-       {
-               int narg=0, niarg=0;
-               int arg, iarg;
-       for (p = 0, l = 0; p < mparamcount; p++) {
-               arg = narg; iarg = niarg;
-               t = mparamtypes[p];
-               var = &(locals[l][t]);
-               l++, niarg++;
-               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
-                       l++, niarg++;
-               if (var->type < 0)
-                       continue;
-               r = var->regoff; 
-               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
-                       if (iarg < INT_ARG_CNT -
-                                       (IS_2_WORD_TYPE(t)!=0)) {        /* register arguments    */
-                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
-                                       {M_TINTMOVE (t, argintregs[iarg], r);}
-                               else                                 /* reg arg -> spilled    */
-                                       {
-                                               M_IST (argintregs[iarg], REG_SP, 4 * r);
-                                               if (IS_2_WORD_TYPE(t))
-                                                       M_IST (secondregs[argintregs[iarg]], REG_SP, 4 * r + 4);
-                                       }
-                               }
-                       else {                                   /* stack arguments       */
-                               pa = iarg + 6;
-                               if (!(var->flags & INMEMORY))        /* stack arg -> register */ 
-                                       {
-                                               M_ILD (r, REG_SP, 4 * (parentargs_base + pa));
-                                               if (IS_2_WORD_TYPE(t))
-                                                       M_ILD (secondregs[r], REG_SP, 4 * (parentargs_base + pa) + 4);
-                                       }
-                               else {                               /* stack arg -> spilled  */
-                                       M_ILD (REG_ITMP1, REG_SP, 4 * (parentargs_base + pa));
-                                       M_IST (REG_ITMP1, REG_SP, 4 * r);
-                                       if (IS_2_WORD_TYPE(t)) {
-                                               M_ILD (REG_ITMP1, REG_SP, 4 * (parentargs_base + pa) + 4);
-                                               M_IST (REG_ITMP1, REG_SP, 4 * r + 4);
-                                               }
-                                       }
-                               }
-                       }
-               else {                                       /* floating args         */   
-                       ++narg;
-                       if (arg < FLT_ARG_CNT) {                 /* register arguments    */
-                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
-                                       {M_FLTMOVE (argfltregs[arg], r);}
-                               else                                             /* reg arg -> spilled    */
-                                       M_DST (argfltregs[arg], REG_SP, 4 * r);
-                               }
-                       else {                                   /* stack arguments       */
-                               pa = iarg + 6;
-                               if (!(var->flags & INMEMORY))        /* stack-arg -> register */
-                                       if (IS_2_WORD_TYPE(t))
-                                               M_DLD (r, REG_SP, 4 * (parentargs_base + pa) );
-                                       else
-                                               M_FLD (r, REG_SP, 4 * (parentargs_base + pa) );
-                               else {                               /* stack-arg -> spilled  */
-                                       if (IS_2_WORD_TYPE(t))
-                                               M_DLD (REG_FTMP1, REG_SP, 4 * (parentargs_base + pa));
-                                       else
-                                               M_FLD (REG_FTMP1, REG_SP, 4 * (parentargs_base + pa));
-                                       M_DST (REG_FTMP1, REG_SP, 4 * r);
-                                       }
-                               }
-                       }
-               }  /* end for */
-       }
-
-       /* call monitorenter function */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               p = dseg_addaddress ((void*) (builtin_monitorenter));
-               M_ALD(REG_ITMP3, REG_PV, p);
-               M_MTCTR(REG_ITMP3);
-               M_ALD(argintregs[0], REG_SP, 4 * maxmemuse);
-               M_JSR;
-               }                       
-#endif
-       }
-
-       /* end of header generation */
-
-       /* walk through all basic blocks */
-       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
-
-               bptr -> mpc = (int)((u1*) mcodeptr - mcodebase);
-
-               if (bptr->flags >= BBREACHED) {
-
-               /* branch resolving */
-
-               {
-               branchref *brefs;
-               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
-                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
-                                         brefs->branchpos, bptr->mpc);
-                       }
-               }
-
-               /* copy interface registers to their destination */
-
-               src = bptr->instack;
-               len = bptr->indepth;
-               MCODECHECK(64+len);
-               while (src != NULL) {
-                       len--;
-                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
-                               d = reg_of_var(src, REG_ITMP1);
-                               M_INTMOVE(REG_ITMP1, d);
-                               store_reg_to_var_int(src, d);
-                               }
-                       else {
-                               d = reg_of_var(src, REG_IFTMP);
-                               if ((src->varkind != STACKVAR)) {
-                                       s2 = src->type;
-                                       if (IS_FLT_DBL_TYPE(s2)) {
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       s1 = interfaces[len][s2].regoff;
-                                                       M_FLTMOVE(s1,d);
-                                                       }
-                                               else {
-                                                       if (IS_2_WORD_TYPE(s2))
-                                                               M_DLD(d, REG_SP, 4 * interfaces[len][s2].regoff);
-                                                       else
-                                                               M_FLD(d, REG_SP, 4 * interfaces[len][s2].regoff);
-                                                       }
-                                               store_reg_to_var_flt(src, d);
-                                               }
-                                       else {
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       s1 = interfaces[len][s2].regoff;
-                                                       M_TINTMOVE(s2,s1,d);
-                                                       }
-                                               else {
-                                                       M_ILD(d, REG_SP, 4 * interfaces[len][s2].regoff);
-                                                       if (IS_2_WORD_TYPE(s2))
-                                                               M_ILD(secondregs[d], REG_SP, 4 * interfaces[len][s2].regoff + 4);
-                                                       }
-                                               store_reg_to_var_int(src, d);
-                                               }
-                                       }
-                               }
-                       src = src->prev;
-                       }
-
-               /* walk through all instructions */
-               
-               src = bptr->instack;
-               len = bptr->icount;
-               for (iptr = bptr->iinstr;
-                   len > 0;
-                   src = iptr->dst, len--, iptr++) {
-
-       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
-       switch (iptr->opc) {
-
-               case ICMD_NOP:        /* ...  ==> ...                                 */
-                       break;
-
-               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_TST(s1);
-                       M_BEQ(0);
-                       mcode_addxnullrefs(mcodeptr);
-                       break;
-
-               /* constant operations ************************************************/
-
-#define ICONST(r,c) if(((c)>=0&&(c)<=32767)||((c)>=-32768&&(c)<0)){M_LDA(r,REG_ZERO,c);} \
-                    else{a=dseg_adds4(c);M_ILD(r,REG_PV,a);}
-
-#define LCONST(r,c) ICONST(r,(s4)((s8)(c)>>32)); ICONST(secondregs[r],(s4)((s8)(c)));
-
-               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.i = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       ICONST(d, iptr->val.i);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.l = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       LCONST(d, iptr->val.l);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.f = constant                    */
-
-                       d = reg_of_var (iptr->dst, REG_FTMP1);
-                       a = dseg_addfloat (iptr->val.f);
-                       M_FLD(d, REG_PV, a);
-                       store_reg_to_var_flt (iptr->dst, d);
-                       break;
-                       
-               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.d = constant                    */
-
-                       d = reg_of_var (iptr->dst, REG_FTMP1);
-                       a = dseg_adddouble (iptr->val.d);
-                       M_DLD(d, REG_PV, a);
-                       store_reg_to_var_flt (iptr->dst, d);
-                       break;
-
-               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.a = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       ICONST(d, (u4) iptr->val.a);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               /* load/store operations **********************************************/
-
-               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_LLOAD:      /* op1 = local variable                         */
-               case ICMD_ALOAD:
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY) {
-                               M_ILD(d, REG_SP, 4 * var->regoff);
-                               if (IS_2_WORD_TYPE(var->type))
-                                       M_ILD(secondregs[d], REG_SP, 4 * var->regoff + 4);
-                       } else
-                               {M_TINTMOVE(var->type,var->regoff,d);}
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_DLOAD:      /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY)
-                               if (IS_2_WORD_TYPE(var->type))
-                                       M_DLD(d, REG_SP, 4 * var->regoff);
-                               else
-                                       M_FLD(d, REG_SP, 4 * var->regoff);
-                       else
-                               {M_FLTMOVE(var->regoff,d);}
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-
-               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
-               case ICMD_LSTORE:     /* op1 = local variable                         */
-               case ICMD_ASTORE:
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               M_IST(s1, REG_SP, 4 * var->regoff);
-                               if (IS_2_WORD_TYPE(var->type))
-                                       M_IST(secondregs[s1], REG_SP, 4 * var->regoff + 4);
-                               }
-                       else {
-                               var_to_reg_int(s1, src, var->regoff);
-                               M_TINTMOVE(var->type, s1, var->regoff);
-                               }
-                       break;
-
-               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_DSTORE:     /* op1 = local variable                         */
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1))
-                               break;
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               if (var->type==TYPE_DBL)
-                                       M_DST(s1, REG_SP, 4 * var->regoff);
-                               else
-                                       M_FST(s1, REG_SP, 4 * var->regoff);
-                               }
-                       else {
-                               var_to_reg_flt(s1, src, var->regoff);
-                               M_FLTMOVE(s1, var->regoff);
-                               }
-                       break;
-
-
-               /* pop/dup/swap operations ********************************************/
-
-               /* attention: double and longs are only one entry in CACAO ICMDs      */
-
-               case ICMD_POP:        /* ..., value  ==> ...                          */
-               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
-                       break;
-
-#define M_COPY(from,to) \
-                       d = reg_of_var(to, REG_IFTMP); \
-                       if ((from->regoff != to->regoff) || \
-                           ((from->flags ^ to->flags) & INMEMORY)) { \
-                               if (IS_FLT_DBL_TYPE(from->type)) { \
-                                       var_to_reg_flt(s1, from, d); \
-                                       M_FLTMOVE(s1,d); \
-                                       store_reg_to_var_flt(to, d); \
-                                       }\
-                               else { \
-                                       var_to_reg_int(s1, from, d); \
-                                       M_TINTMOVE(from->type,s1,d); \
-                                       store_reg_to_var_int(to, d); \
-                                       }\
-                               }
-
-               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
-                       M_COPY(src, iptr->dst);
-                       break;
-
-               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
-
-                       M_COPY(src,       iptr->dst->prev->prev);
-
-               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
-
-                       M_COPY(src,       iptr->dst);
-                       M_COPY(src->prev, iptr->dst->prev);
-                       break;
-
-               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
-
-                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
-
-               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
-
-                       M_COPY(src,             iptr->dst);
-                       M_COPY(src->prev,       iptr->dst->prev);
-                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
-                       M_COPY(src, iptr->dst->prev->prev->prev);
-                       break;
-
-               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
-
-                       M_COPY(src,                   iptr->dst);
-                       M_COPY(src->prev,             iptr->dst->prev);
-                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
-                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
-                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
-                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
-                       break;
-
-               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
-
-                       M_COPY(src, iptr->dst->prev);
-                       M_COPY(src->prev, iptr->dst);
-                       break;
-
-
-               /* integer operations *************************************************/
-
-               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_int(s1, src, REG_ITMP1); 
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_NEG(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-        case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
-
-            var_to_reg_int(s1, src, REG_ITMP1);
-            d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_SUBFIC(secondregs[s1], 0, secondregs[d]);
-            M_SUBFZE(s1, d);
-            store_reg_to_var_int(iptr->dst, d);
-            break;
-
-               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_INTMOVE(s1, secondregs[d]);
-                       M_SRA_IMM(secondregs[d], 31, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int0(s1, src, REG_ITMP2, 0, 1);
-                       d = reg_of_var(iptr->dst, REG_ITMP2);
-                       M_INTMOVE(s1, d );
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_BSEXT(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_CZEXT(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SSEXT(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IADD(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= -32768) && (iptr->val.i <= 32767)) {
-                               M_IADD_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_IADD(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-        case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-            var_to_reg_int0(s1, src->prev, REG_ITMP1, 0, 1);
-            var_to_reg_int0(s2, src, REG_ITMP2, 0, 1);
-            d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_ADDC(s1, s2, secondregs[d]);
-            var_to_reg_int0(s1, src->prev, REG_ITMP1, 1, 0);
-            var_to_reg_int0(s2, src, REG_ITMP3, 1, 0);
-            M_ADDE(s1, s2, d);
-            store_reg_to_var_int(iptr->dst, d);
-            break;
-
-               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.l = constant                             */
-
-                       s3 = iptr->val.l & 0xffffffff;
-                       var_to_reg_int0(s1, src, REG_ITMP1, 0, 1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((s3 >= -32768) && (s3 <= 32767)) {
-                               M_ADDIC(s1, s3, secondregs[d]);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_ADDC(s1, REG_ITMP2, secondregs[d]);
-                               }
-                       var_to_reg_int0(s1, src, REG_ITMP1, 1, 0);
-                       s3 = iptr->val.l >> 32;
-                       if (s3 == -1)
-                               M_ADDME(s1, d);
-                       else if (s3 == 0)
-                               M_ADDZE(s1, d);
-                       else {
-                               ICONST(REG_ITMP3, s3);
-                               M_ADDE(s1, REG_ITMP3, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_ISUB(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= -32767) && (iptr->val.i <= 32768)) {
-                               M_IADD_IMM(s1, -iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, -iptr->val.i);
-                               M_IADD(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-        case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-            var_to_reg_int0(s1, src->prev, REG_ITMP1, 0, 1);
-            var_to_reg_int0(s2, src, REG_ITMP2, 0, 1);
-            d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_SUBC(s1, s2, secondregs[d]);
-            var_to_reg_int0(s1, src->prev, REG_ITMP1, 1, 0);
-            var_to_reg_int0(s2, src, REG_ITMP3, 1, 0);
-            M_SUBE(s1, s2, d);
-            store_reg_to_var_int(iptr->dst, d);
-            break;
-
-               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
-                                     /* val.l = constant                             */
-
-                       s3 = (-iptr->val.l) & 0xffffffff;
-                       var_to_reg_int0(s1, src, REG_ITMP1, 0, 1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((s3 >= -32768) && (s3 <= 32767)) {
-                               M_ADDIC(s1, s3, secondregs[d]);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_ADDC(s1, REG_ITMP2, secondregs[d]);
-                               }
-                       var_to_reg_int0(s1, src, REG_ITMP1, 1, 0);
-                       s3 = (-iptr->val.l) >> 32;
-                       if (s3 == -1)
-                               M_ADDME(s1, d);
-                       else if (s3 == 0)
-                               M_ADDZE(s1, d);
-                       else {
-                               ICONST(REG_ITMP3, s3);
-                               M_ADDE(s1, REG_ITMP3, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IDIV(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IDIV(s1, s2, d);
-                       M_IMUL(d, s2, d);
-                       M_ISUB(s1, d, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_IMUL(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= -32768) && (iptr->val.i <= 32767)) {
-                               M_IMUL_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_IMUL(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value << constant       */
-                                     
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SRA_IMM(s1, iptr->val.i, d);
-                       M_ADDZE(d, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND_IMM(s2, 0x1f, REG_ITMP3);
-                       M_SLL(s1, REG_ITMP3, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SLL_IMM(s1, iptr->val.i & 0x1f, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND_IMM(s2, 0x1f, REG_ITMP3);
-                       M_SRA(s1, REG_ITMP3, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_SRA_IMM(s1, iptr->val.i & 0x1f, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND_IMM(s2, 0x1f, REG_ITMP2);
-                       M_SRL(s1, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->val.i & 0x1f)
-                               M_SRL_IMM(s1, iptr->val.i & 0x1f, d);
-                       else
-                               M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_AND(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 65535)) {
-                               M_AND_IMM(s1, iptr->val.i, d);
-                               }
-                       /*
-                       else if (iptr->val.i == 0xffffff) {
-                               M_RLWINM(s1, 0, 8, 31, d);
-                               }
-                       */
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_AND(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
-
-                       var_to_reg_int0(s1, src->prev, REG_ITMP1, 0, 1);
-            var_to_reg_int0(s2, src, REG_ITMP2, 0, 1);
-            d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_AND(s1, s2, secondregs[d]);
-            var_to_reg_int0(s1, src->prev, REG_ITMP1, 1, 0);
-            var_to_reg_int0(s2, src, REG_ITMP3, 1, 0);
-            M_AND(s1, s2, d);
-            store_reg_to_var_int(iptr->dst, d);
-            break;
-
-               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.l = constant                             */
-
-                       s3 = iptr->val.l & 0xffffffff;
-                       var_to_reg_int0(s1, src, REG_ITMP1, 0, 1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((s3 >= 0) && (s3 <= 65535)) {
-                               M_AND_IMM(s1, s3, secondregs[d]);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_AND(s1, REG_ITMP2, secondregs[d]);
-                               }
-                       var_to_reg_int0(s1, src, REG_ITMP1, 1, 0);
-                       s3 = iptr->val.l >> 32;
-                       if ((s3 >= 0) && (s3 <= 65535)) {
-                               M_AND_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP3, s3);
-                               M_AND(s1, REG_ITMP3, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_MOV(s1, REG_ITMP2);
-                       M_CMPI(s1, 0);
-                       M_BGE(1 + 2*(iptr->val.i >= 32768));
-                       if (iptr->val.i >= 32768) {
-                               M_ADDIS(REG_ZERO, iptr->val.i>>16, REG_ITMP2);
-                               M_OR_IMM(REG_ITMP2, iptr->val.i, REG_ITMP2);
-                               M_IADD(s1, REG_ITMP2, REG_ITMP2);
-                               } 
-                       else
-                               M_IADD_IMM(s1, iptr->val.i, REG_ITMP2);
-                       {
-                               int b=0, m = iptr->val.i;
-                               while (m >>= 1)
-                                       ++b;
-                               M_RLWINM(REG_ITMP2, 0, 0, 30-b, REG_ITMP2);
-                       }
-                       M_ISUB(s1, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_OR( s1,s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 65535)) {
-                               M_OR_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_OR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LOR:       /* ..., val1, val2  ==> ..., val1 | val2        */
-
-                       var_to_reg_int0(s1, src->prev, REG_ITMP1, 0, 1);
-            var_to_reg_int0(s2, src, REG_ITMP2, 0, 1);
-            d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_OR(s1, s2, secondregs[d]);
-            var_to_reg_int0(s1, src->prev, REG_ITMP1, 1, 0);
-            var_to_reg_int0(s2, src, REG_ITMP3, 1, 0);
-            M_OR(s1, s2, d);
-            store_reg_to_var_int(iptr->dst, d);
-            break;
-
-               case ICMD_LORCONST:  /* ..., value  ==> ..., value | constant        */
-                                     /* val.l = constant                             */
-
-                       s3 = iptr->val.l & 0xffffffff;
-                       var_to_reg_int0(s1, src, REG_ITMP1, 0, 1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((s3 >= 0) && (s3 <= 65535)) {
-                               M_OR_IMM(s1, s3, secondregs[d]);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_OR(s1, REG_ITMP2, secondregs[d]);
-                               }
-                       var_to_reg_int0(s1, src, REG_ITMP1, 1, 0);
-                       s3 = iptr->val.l >> 32;
-                       if ((s3 >= 0) && (s3 <= 65535)) {
-                               M_OR_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP3, s3);
-                               M_OR(s1, REG_ITMP3, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_XOR(s1, s2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((iptr->val.i >= 0) && (iptr->val.i <= 65535)) {
-                               M_XOR_IMM(s1, iptr->val.i, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_XOR(s1, REG_ITMP2, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
-
-                       var_to_reg_int0(s1, src->prev, REG_ITMP1, 0, 1);
-            var_to_reg_int0(s2, src, REG_ITMP2, 0, 1);
-            d = reg_of_var(iptr->dst, REG_ITMP3);
-            M_XOR(s1, s2, secondregs[d]);
-            var_to_reg_int0(s1, src->prev, REG_ITMP1, 1, 0);
-            var_to_reg_int0(s2, src, REG_ITMP3, 1, 0);
-            M_XOR(s1, s2, d);
-            store_reg_to_var_int(iptr->dst, d);
-            break;
-
-               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.l = constant                             */
-
-                       s3 = iptr->val.l & 0xffffffff;
-                       var_to_reg_int0(s1, src, REG_ITMP1, 0, 1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if ((s3 >= 0) && (s3 <= 65535)) {
-                               M_XOR_IMM(s1, s3, secondregs[d]);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, s3);
-                               M_XOR(s1, REG_ITMP2, secondregs[d]);
-                               }
-                       var_to_reg_int0(s1, src, REG_ITMP1, 1, 0);
-                       s3 = iptr->val.l >> 32;
-                       if ((s3 >= 0) && (s3 <= 65535)) {
-                               M_XOR_IMM(s1, s3, d);
-                               }
-                       else {
-                               ICONST(REG_ITMP3, s3);
-                               M_XOR(s1, REG_ITMP3, d);
-                               }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LCMP:       /* ..., val1, val2  ==> ..., val1 cmp val2      */
-
-                       var_to_reg_int0(s1, src->prev, REG_ITMP3, 1, 0);
-                       var_to_reg_int0(s2, src, REG_ITMP2, 1, 0);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       {
-                               int tempreg =
-                                       (d==s1 || d==s2 || d==secondregs[s1] || d==secondregs[s2]);
-                               int dreg = tempreg ? REG_ITMP1 : d;
-                               s4 *br1;
-                               M_IADD_IMM(REG_ZERO, 1, dreg);
-                               M_CMP(s1, s2);
-                               M_BGT(0);
-                               br1 = mcodeptr;
-                               M_BLT(0);
-                               var_to_reg_int0(s1, src->prev, REG_ITMP3, 0, 1);
-                               var_to_reg_int0(s2, src, REG_ITMP2, 0, 1);
-                               M_CMPU(s1, s2);
-                               M_BGT(3);
-                               M_BEQ(1);
-                               M_IADD_IMM(dreg, -1, dreg);
-                               M_IADD_IMM(dreg, -1, dreg);
-                               gen_resolvebranch(br1, (u1*) br1, (u1*) mcodeptr);
-                               gen_resolvebranch(br1+1, (u1*) (br1+1), (u1*) (mcodeptr-2));
-                               M_INTMOVE(dreg, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
-                                     /* op1 = variable, val.i = constant             */
-
-            var = &(locals[iptr->op1][TYPE_INT]);
-            if (var->flags & INMEMORY) {
-                s1 = REG_ITMP1;
-                M_ILD(s1, REG_SP, 4 * var->regoff);
-                }
-            else
-                s1 = var->regoff;
-                       {
-                               u4 m = iptr->val.i;
-                               if (m&0x8000)
-                                       m += 65536;
-                               if (m&0xffff0000)
-                                       M_ADDIS(s1, m>>16, s1);
-                               if (m&0xffff)
-                                       M_IADD_IMM(s1, m&0xffff, s1);
-                       }
-            if (var->flags & INMEMORY)
-                               M_IST(s1, REG_SP, 4 * var->regoff);
-                       break;
-
-
-               /* floating operations ************************************************/
-
-               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FMOVN(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FMOVN(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FADD(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DADD(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FSUB(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DSUB(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FMUL(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 *** val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DMUL(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FDIV(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_DDIV(s1, s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-               
-               case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
-               case ICMD_D2I:
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_CLR(d);
-                       a = dseg_addfloat(0.0);
-                       M_FLD(REG_FTMP2, REG_PV, a);
-                       M_FCMPU(s1, REG_FTMP2);
-                       M_BNAN(4);
-                       a = dseg_adds4(0);
-                       M_CVTDL_C(s1, REG_FTMP1);
-                       M_LDA (REG_ITMP1, REG_PV, a);
-                       M_STFIWX(REG_FTMP1, 0, REG_ITMP1);
-                       M_ILD (d, REG_PV, a);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-               
-               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_FLTMOVE(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-                                       
-               case ICMD_D2F:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       M_CVTDF(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-               
-               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
-               case ICMD_DCMPL:
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_FCMPU(s2, s1);
-                       M_IADD_IMM(0, -1, d);
-                       M_BNAN(4);
-                       M_BGT(3);
-                       M_IADD_IMM(0, 0, d);
-                       M_BGE(1);
-                       M_IADD_IMM(0, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
-               case ICMD_DCMPG:
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_FCMPU(s1, s2);
-                       M_IADD_IMM(0, 1, d);
-                       M_BNAN(4);
-                       M_BGT(3);
-                       M_IADD_IMM(0, 0, d);
-                       M_BGE(1);
-                       M_IADD_IMM(0, -1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-                       
-
-               /* memory operations **************************************************/
-
-#define gen_bound_check \
-            if (checkbounds) { \
-                               M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));\
-                               M_CMPU(s2, REG_ITMP3);\
-                               M_BGE(0);\
-                               mcode_addxboundrefs(mcodeptr); \
-                }
-
-               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., length              */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       gen_nullptr_check(s1);
-                       M_ILD(d, s1, OFFSET(java_arrayheader, size));
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_SLL_IMM(s2, 2, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_objectarray, data[0]), REG_ITMP2);
-                       M_LWZX(d, s1, REG_ITMP2);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_SLL_IMM(s2, 3, REG_ITMP2);
-                       M_IADD(s1, REG_ITMP2, REG_ITMP2);
-                       M_ILD(d, REG_ITMP2, OFFSET(java_longarray, data[0]));
-                       M_ILD(secondregs[d], REG_ITMP2, OFFSET(java_longarray, data[0])+4);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_SLL_IMM(s2, 2, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_intarray, data[0]), REG_ITMP2);
-                       M_LWZX(d, s1, REG_ITMP2);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_SLL_IMM(s2, 2, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_floatarray, data[0]), REG_ITMP2);
-                       M_LFSX(d, s1, REG_ITMP2);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_SLL_IMM(s2, 3, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_doublearray, data[0]), REG_ITMP2);
-                       M_LFDX(d, s1, REG_ITMP2);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_IADD_IMM(s2, OFFSET(java_chararray, data[0]), REG_ITMP2);
-                       M_LBZX(d, s1, REG_ITMP2);
-                       M_BSEXT(d, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;                  
-
-               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_SLL_IMM(s2, 1, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_shortarray, data[0]), REG_ITMP2);
-                       M_LHAX(d, s1, REG_ITMP2);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       M_SLL_IMM(s2, 1, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_chararray, data[0]), REG_ITMP2);
-                       M_LHZX(d, s1, REG_ITMP2);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int0(s3, src, REG_ITMP3, 1, 0);
-                       M_SLL_IMM(s2, 3, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_intarray, data[0]), REG_ITMP2);
-                       M_STWX(s3, s1, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, 4, REG_ITMP2);
-                       var_to_reg_int0(s3, src, REG_ITMP3, 0, 1);
-                       M_STWX(s3, s1, REG_ITMP2);
-                       break;
-
-               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_SLL_IMM(s2, 2, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_intarray, data[0]), REG_ITMP2);
-                       M_STWX(s3, s1, REG_ITMP2);
-                       break;
-
-               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_flt(s3, src, REG_FTMP3);
-                       M_SLL_IMM(s2, 2, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_floatarray, data[0]), REG_ITMP2);
-                       M_STFSX(s3, s1, REG_ITMP2);
-                       break;
-
-               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_flt(s3, src, REG_FTMP3);
-                       M_SLL_IMM(s2, 3, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_doublearray, data[0]), REG_ITMP2);
-                       M_STFDX(s3, s1, REG_ITMP2);
-                       break;
-
-               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_IADD_IMM(s2, OFFSET(java_bytearray, data[0]), REG_ITMP2);
-                       M_STBX(s3, s1, REG_ITMP2);
-                       break;
-
-               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_SLL_IMM(s2, 1, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_shortarray, data[0]), REG_ITMP2);
-                       M_STHX(s3, s1, REG_ITMP2);
-                       break;
-
-               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                               }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       M_SLL_IMM(s2, 1, REG_ITMP2);
-                       M_IADD_IMM(REG_ITMP2, OFFSET(java_chararray, data[0]), REG_ITMP2);
-                       M_STHX(s3, s1, REG_ITMP2);
-                       break;
-
-               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
-                       M_ALD(REG_ITMP1, REG_PV, a);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       M_IST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s2, src, REG_ITMP3);
-                                       M_IST(s2, REG_ITMP1, 0);
-                                       M_IST(secondregs[s2], REG_ITMP1, 4);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       M_AST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       M_FST(s2, REG_ITMP1, 0);
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       M_DST(s2, REG_ITMP1, 0);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
-                       M_ALD(REG_ITMP1, REG_PV, a);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_ILD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_ILD(d, REG_ITMP1, 0);
-                                       M_ILD(secondregs[d], REG_ITMP1, 4);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_ADR:
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       M_ALD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_FLT:
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       M_FLD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       M_DLD(d, REG_ITMP1, 0);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       M_IST(s2, s1, a);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_IST(s2, s1, a);
-                                       M_IST(secondregs[s2], s1, a+4);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       M_AST(s2, s1, a);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       gen_nullptr_check(s1);
-                                       M_FST(s2, s1, a);
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       gen_nullptr_check(s1);
-                                       M_DST(s2, s1, a);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_ILD(d, s1, a);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_ILD(d, s1, a);
-                                       M_ILD(secondregs[d], s1, a+4);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_ADR:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                                       gen_nullptr_check(s1);
-                                       M_ALD(d, s1, a);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       M_FLD(d, s1, a);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       var_to_reg_int(s1, src, REG_ITMP1);
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       M_DLD(d, s1, a);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               /* branch operations **************************************************/
-
-#define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}}
-
-               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP2, REG_PV, a);
-                       M_MTCTR(REG_ITMP2);
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_INTMOVE(s1, REG_ITMP1_XPTR);
-
-                       if (isleafmethod) M_MFLR(REG_ITMP3);  /* save LR */
-                       M_BL(0);            /* get current PC */
-                       M_MFLR(REG_ITMP2_XPC);
-                       if (isleafmethod) M_MTLR(REG_ITMP3);  /* restore LR */
-                       M_RTS;              /* jump to CTR */
-
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_GOTO:         /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-                       M_BR(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_JSR:          /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if (isleafmethod) M_MFLR(REG_ITMP2);
-                       M_BL(0);
-                       M_MFLR(REG_ITMP1);
-                       M_IADD_IMM(REG_ITMP1, isleafmethod?16:12, REG_ITMP1);
-                       if (isleafmethod) M_MTLR(REG_ITMP2);
-                       M_BR(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-                       
-               case ICMD_RET:          /* ... ==> ...                                */
-                                       /* op1 = local variable                       */
-
-                       var = &(locals[iptr->op1][TYPE_ADR]);
-                       if (var->flags & INMEMORY) {
-                               M_ALD(REG_ITMP1, REG_SP, 4 * var->regoff);
-                               M_MTCTR(REG_ITMP1);
-                               }
-                       else
-                               M_MTCTR(var->regoff);
-                       M_RTS;
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_IFNULL:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_TST(s1);
-                       M_BEQ(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_TST(s1);
-                       M_BNE(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFLT:
-               case ICMD_IFLE:
-               case ICMD_IFNE:
-               case ICMD_IFGT:
-               case ICMD_IFGE:
-               case ICMD_IFEQ:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if ((iptr->val.i >= -32768) && (iptr->val.i <= 32767)) {
-                               M_CMPI(s1, iptr->val.i);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, iptr->val.i);
-                               M_CMP(s1, REG_ITMP2);
-                               }
-                       switch (iptr->opc)
-                       {
-                               case ICMD_IFLT:
-                                       M_BLT(0);
-                                       break;
-                               case ICMD_IFLE:
-                                       M_BLE(0);
-                                       break;
-                               case ICMD_IFNE:
-                                       M_BNE(0);
-                                       break;
-                               case ICMD_IFGT:
-                                       M_BGT(0);
-                                       break;
-                               case ICMD_IFGE:
-                                       M_BGE(0);
-                                       break;
-                               case ICMD_IFEQ:
-                                       M_BEQ(0);
-                                       break;
-                               }
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-
-               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-                       nocode();
-                       //CUT
-                       break;
-
-                       //CUT: alle _L
-               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPEQ:    /* op1 = target JavaVM pc                     */
-               case ICMD_IF_ACMPEQ:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMP(s1, s2);
-                       M_BEQ(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPNE:    /* op1 = target JavaVM pc                     */
-               case ICMD_IF_ACMPNE:
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMP(s1, s2);
-                       M_BNE(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPLT:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMP(s1, s2);
-                       M_BLT(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPGT:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMP(s1, s2);
-                       M_BGT(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPLE:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMP(s1, s2);
-                       M_BLE(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_LCMPGE:    /* op1 = target JavaVM pc                     */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       M_CMP(s1, s2);
-                       M_BGE(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_LRETURN:
-               case ICMD_ARETURN:
-
-               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_DRETURN:
-
-               case ICMD_RETURN:      /* ...  ==> ...                                */
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               a = dseg_addaddress ((void*) (builtin_monitorexit));
-                               M_ALD(REG_ITMP3, REG_PV, a);
-                               M_MTCTR(REG_ITMP3);
-                               M_ALD(argintregs[0], REG_SP, 4 * maxmemuse);
-                               M_JSR;
-                               }                       
-#endif
-                       switch (iptr->opc) {
-                       case ICMD_IRETURN:
-                       case ICMD_LRETURN:
-                       case ICMD_ARETURN:
-                               var_to_reg_int(s1, src, REG_RESULT);
-                               M_TINTMOVE(src->type, s1, REG_RESULT);
-                               goto nowperformreturn;
-
-                       case ICMD_FRETURN:
-                       case ICMD_DRETURN:
-                               var_to_reg_flt(s1, src, REG_FRESULT);
-                               M_FLTMOVE(s1, REG_FRESULT);
-                               goto nowperformreturn;
-                       }
-
-nowperformreturn:
-                       {
-                       int r, p;
-                       
-                       p = parentargs_base;
-                       
-                       /* restore return address                                         */
-
-                       if (!isleafmethod) {
-                               M_ALD (REG_ITMP3, REG_SP, 4 * p + 8);
-                               M_MTLR (REG_ITMP3);
-                               }
-
-                       /* restore saved registers                                        */
-
-                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
-                                       {p--; M_ILD(savintregs[r], REG_SP, 4 * p);}
-                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
-                                       {p-=2; M_DLD(savfltregs[r], REG_SP, 4 * p);}
-
-                       /* deallocate stack                                               */
-
-                       if (parentargs_base)
-                               {M_LDA(REG_SP, REG_SP, parentargs_base*4);}
-
-                       /* call trace function */
-
-#if 1
-                       if (runverbose) {
-                               M_MFLR(REG_ITMP3);
-                               M_LDA (REG_SP, REG_SP, -80);
-                               M_DST(REG_FRESULT, REG_SP, 48+0);
-                               M_IST(REG_RESULT, REG_SP, 48+8);
-                               M_AST(REG_ITMP3, REG_SP, 48+12);
-                               M_IST(REG_RESULT+1, REG_SP, 48+16);
-                               a = dseg_addaddress (method);
-                               M_MOV(REG_RESULT+1, argintregs[2]);
-                               M_MOV(REG_RESULT, argintregs[1]);
-                               M_ALD(argintregs[0], REG_PV, a);
-                               M_FLTMOVE(REG_FRESULT, argfltregs[0]);
-                               M_FLTMOVE(REG_FRESULT, argfltregs[1]);
-                               a = dseg_addaddress ((void*) (builtin_displaymethodstop));
-                               M_ALD(REG_ITMP2, REG_PV, a);
-                               M_MTCTR(REG_ITMP2);
-                               M_JSR;
-                               M_DLD(REG_FRESULT, REG_SP, 48+0);
-                               M_ILD(REG_RESULT, REG_SP, 48+8);
-                               M_ALD(REG_ITMP3, REG_SP, 48+12);
-                               M_ILD(REG_RESULT+1, REG_SP, 48+16);
-                               M_LDA (REG_SP, REG_SP, 80);
-                               M_MTLR(REG_ITMP3);
-                               }
-#endif
-
-                       M_RET;
-                       ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
-                       {
-                       s4 i, l, *s4ptr;
-                       void **tptr;
-
-                       tptr = (void **) iptr->target;
-
-                       s4ptr = iptr->val.a;
-                       l = s4ptr[1];                          /* low     */
-                       i = s4ptr[2];                          /* high    */
-                       
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       if (l == 0)
-                               {M_INTMOVE(s1, REG_ITMP1);}
-                       else if (l <= 32768) {
-                               M_LDA(REG_ITMP1, s1, -l);
-                               }
-                       else {
-                               ICONST(REG_ITMP2, l);
-                               M_ISUB(s1, REG_ITMP2, REG_ITMP1);
-                               }
-                       i = i - l + 1;
-
-                       /* range check */
-
-                       M_CMPUI(REG_ITMP1, i - 1);
-                       M_BGT(0);
-
-
-                       /* mcode_addreference(BlockPtrOfPC(s4ptr[0]), mcodeptr); */
-                       mcode_addreference((basicblock *) tptr[0], mcodeptr);
-
-                       /* build jump table top down and use address of lowest entry */
-
-                       /* s4ptr += 3 + i; */
-                       tptr += i;
-
-                       while (--i >= 0) {
-                               /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
-                               dseg_addtarget((basicblock *) tptr[0]); 
-                               --tptr;
-                               }
-                       }
-
-                       /* length of dataseg after last dseg_addtarget is used by load */
-
-                       M_SLL_IMM(REG_ITMP1, 2, REG_ITMP1);
-                       M_IADD(REG_ITMP1, REG_PV, REG_ITMP2);
-                       M_ALD(REG_ITMP2, REG_ITMP2, -dseglen);
-                       M_MTCTR(REG_ITMP2);
-                       M_RTS;
-                       ALIGNCODENOP;
-                       break;
-
-
-               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
-                       {
-                       s4 i, l, val, *s4ptr;
-                       void **tptr;
-
-                       tptr = (void **) iptr->target;
-
-                       s4ptr = iptr->val.a;
-                       l = s4ptr[0];                          /* default  */
-                       i = s4ptr[1];                          /* count    */
-                       
-                       MCODECHECK((i<<2)+8);
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       while (--i >= 0) {
-                               s4ptr += 2;
-                               ++tptr;
-
-                               val = s4ptr[0];
-                               if ((val >= -32768) && (val <= 32767)) {
-                                       M_CMPI(s1, val);
-                                       } 
-                               else {
-                                       a = dseg_adds4 (val);
-                                       M_ILD(REG_ITMP2, REG_PV, a);
-                                       M_CMP(s1, REG_ITMP2);
-                                       }
-                               M_BEQ(0);
-                               /* mcode_addreference(BlockPtrOfPC(s4ptr[1]), mcodeptr); */
-                               mcode_addreference((basicblock *) tptr[0], mcodeptr); 
-                               }
-
-                       M_BR(0);
-                       /* mcode_addreference(BlockPtrOfPC(l), mcodeptr); */
-                       
-                       tptr = (void **) iptr->target;
-                       mcode_addreference((basicblock *) tptr[0], mcodeptr);
-
-                       ALIGNCODENOP;
-                       break;
-                       }
-
-
-               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 3;
-                       goto gen_method;
-
-               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 2;
-                       goto gen_method;
-
-               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 1;
-                       goto gen_method;
-
-               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-                       s3 = iptr->op1;
-
-gen_method: {
-                       methodinfo   *m;
-                       classinfo    *ci;
-
-                       MCODECHECK((s3 << 1) + 64);
-
-                       {
-                       /* copy arguments to registers or stack location                  */
-
-                               stackptr srcsave = src;
-                               int s3save = s3;
-                               int fltcnt = 0;
-                               int argsize = 0;
-                       for (; --s3 >= 0; src = src->prev) {
-                               argsize += IS_2_WORD_TYPE(src->type) ? 2 : 1;
-                               if (IS_FLT_DBL_TYPE(src->type))
-                                       ++fltcnt;
-                               }
-
-                       for (s3=s3save, src=srcsave; --s3 >= 0; src = src->prev) {
-                               argsize -= IS_2_WORD_TYPE(src->type) ? 2 : 1;
-                               if (IS_FLT_DBL_TYPE(src->type))
-                                       --fltcnt;
-                               if (src->varkind == ARGVAR)
-                                       continue;
-                               if (IS_INT_LNG_TYPE(src->type)) {
-                                       if (argsize < INT_ARG_CNT) {
-                                               s1 = argintregs[argsize];
-                                               var_to_reg_int(d, src, s1);
-                                               if (argsize < INT_ARG_CNT-1)
-                                                       {M_TINTMOVE(src->type, d, s1);}
-                                               else {
-                                                       M_INTMOVE(d, s1);
-                                                       if (IS_2_WORD_TYPE(src->type))
-                                                               M_IST(secondregs[d], REG_SP, 4 * (argsize + 6) + 4);
-                                                       }
-                                               }
-                                       else  {
-                                               var_to_reg_int(d, src, REG_ITMP1);
-                                               M_IST(d, REG_SP, 4 * (argsize + 6));
-                                               if (IS_2_WORD_TYPE(src->type))
-                                                       M_IST(secondregs[d], REG_SP, 4 * (argsize + 6) + 4);
-                                               }
-                                       }
-                               else
-                                       if (fltcnt < FLT_ARG_CNT) {
-                                               s1 = argfltregs[fltcnt];
-                                               var_to_reg_flt(d, src, s1);
-                                               M_FLTMOVE(d, s1);
-                                               }
-                                       else {
-                                               var_to_reg_flt(d, src, REG_FTMP1);
-                                               if (IS_2_WORD_TYPE(src->type))
-                                                       M_DST(d, REG_SP, 4 * (argsize + 6));
-                                               else
-                                                       M_FST(d, REG_SP, 4 * (argsize + 6));
-                                               }
-                               } /* end of for */
-                       }
-
-                       m = iptr->val.a;
-                       switch (iptr->opc) {
-                               case ICMD_BUILTIN3:
-                               case ICMD_BUILTIN2:
-                               case ICMD_BUILTIN1:
-                                       a = dseg_addaddress ((void*) (m));
-
-                                       M_ALD(REG_PV, REG_PV, a); /* Pointer to built-in-function */
-                                       d = iptr->op1;
-                                       goto makeactualcall;
-
-                               case ICMD_INVOKESTATIC:
-                               case ICMD_INVOKESPECIAL:
-                                       a = dseg_addaddress (m->stubroutine);
-
-                                       M_ALD(REG_PV, REG_PV, a );       /* method pointer in r27 */
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               case ICMD_INVOKEVIRTUAL:
-
-                                       gen_nullptr_check(argintregs[0]);
-                                       M_ALD(REG_METHODPTR, argintregs[0],
-                                                                OFFSET(java_objectheader, vftbl));
-                                       M_ALD(REG_PV, REG_METHODPTR, OFFSET(vftbl, table[0]) +
-                                                               sizeof(methodptr) * m->vftblindex);
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               case ICMD_INVOKEINTERFACE:
-                                       ci = m->class;
-                                       
-                                       gen_nullptr_check(argintregs[0]);
-                                       M_ALD(REG_METHODPTR, argintregs[0],
-                                                                OFFSET(java_objectheader, vftbl));    
-                                       M_ALD(REG_METHODPTR, REG_METHODPTR,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             sizeof(methodptr*) * ci->index);
-                                       M_ALD(REG_PV, REG_METHODPTR,
-                                                           sizeof(methodptr) * (m - ci->methods));
-
-                                       d = m->returntype;
-                                       goto makeactualcall;
-
-                               default:
-                                       d = 0;
-                                       sprintf (logtext, "Unkown ICMD-Command: %d", iptr->opc);
-                                       error ();
-                               }
-
-makeactualcall:
-
-                       M_MTCTR(REG_PV);
-                       M_JSR;
-
-                       /* recompute pv */
-
-                       s1 = (int)((u1*) mcodeptr - mcodebase);
-                       M_MFLR(REG_ITMP1);
-                       if (s1<=32768) M_LDA (REG_PV, REG_ITMP1, -s1);
-                       else {
-                               s4 ml=-s1, mh=0;
-                               while (ml<-32768) { ml+=65536; mh--; }
-                               M_LDA (REG_PV, REG_ITMP1, ml );
-                               M_LDAH (REG_PV, REG_PV, mh );
-                               }
-
-                       /* d contains return type */
-
-                       if (d != TYPE_VOID) {
-                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
-                                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                                       M_TINTMOVE(iptr->dst->type, REG_RESULT, s1);
-                                       store_reg_to_var_int(iptr->dst, s1);
-                                       }
-                               else {
-                                       s1 = reg_of_var(iptr->dst, REG_FRESULT);
-                                       M_FLTMOVE(REG_FRESULT, s1);
-                                       store_reg_to_var_flt(iptr->dst, s1);
-                                       }
-                               }
-                       }
-                       break;
-
-
-               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          return (sub != NULL) &&
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL);
- *
- *          superclass is a class:
- *
- *          return ((sub != NULL) && (0
- *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                  super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_MOV(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                               }
-                       M_CLR(d);
-                       if (iptr->op1) {                               /* class/interface */
-                               M_TST(s1);
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       M_BEQ(9);
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
-                                       M_LDATST(REG_ITMP2, REG_ITMP2, - super->index);
-                                       M_BLE(5);
-                                       M_ALD(REG_ITMP1, REG_ITMP1,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             super->index * sizeof(methodptr*));
-                                       M_TST(REG_ITMP1);
-                                       M_CLR(d);
-                                       M_BEQ(1);
-                                       M_IADD_IMM(REG_ZERO, 1, d);
-                                       }
-                               else {                                     /* class           */
-                                       M_BEQ(10);
-                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
-                                       a = dseg_addaddress ((void*) super->vftbl);
-                                       M_ALD(REG_ITMP2, REG_PV, a);
-                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
-                                       M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                                       M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
-                                       M_CMPU(REG_ITMP1, REG_ITMP2);
-                                       M_CLR(d);
-                                       M_BGT(1);
-                                       M_IADD_IMM(REG_ZERO, 1, d);
-                                       }
-                               }
-                       else
-                               panic ("internal error: no inlined array instanceof");
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          OK if ((sub == NULL) ||
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL));
- *
- *          superclass is a class:
- *
- *          OK if ((sub == NULL) || (0
- *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                 super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       var_to_reg_int(s1, src, d);
-                       if (iptr->op1) {                               /* class/interface */
-                               M_TST(s1);
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       M_BEQ(7);
-                                       M_ALD(REG_ITMP2, s1, OFFSET(java_objectheader, vftbl));
-                                       M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, interfacetablelength));
-                                       M_LDATST(REG_ITMP3, REG_ITMP3, - super->index);
-                                       M_BLE(0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       M_ALD(REG_ITMP3, REG_ITMP2,
-                                             OFFSET(vftbl, interfacetable[0]) -
-                                             super->index * sizeof(methodptr*));
-                                       M_TST(REG_ITMP3);
-                                       M_BEQ(0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       }
-                               else {                                     /* class           */
-                    M_BEQ(8 + (s1 == REG_ITMP1));
-                    M_ALD(REG_ITMP2, s1, OFFSET(java_objectheader, vftbl));
-                    M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
-                    a = dseg_addaddress ((void*) super->vftbl);
-                    M_ALD(REG_ITMP2, REG_PV, a);
-                    if (d != REG_ITMP1) {
-                        M_ILD(REG_ITMP1, REG_ITMP2, OFFSET(vftbl, baseval));
-                        M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                        M_ISUB(REG_ITMP3, REG_ITMP1, REG_ITMP3);
-                        }
-                    else {
-                        M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, baseval));
-                        M_ISUB(REG_ITMP3, REG_ITMP2, REG_ITMP3);
-                        M_ALD(REG_ITMP2, REG_PV, a);
-                        M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
-                        }
-                    M_CMPU(REG_ITMP3, REG_ITMP2);
-                    M_BGT(0);
-                    mcode_addxcastrefs(mcodeptr);
-                    }
-                               }
-                       else
-                               panic ("internal error: no inlined array checkcast");
-                       }
-                       M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_CMPI(s1, 0);
-                       M_BLT(0);
-                       mcode_addxcheckarefs(mcodeptr);
-                       break;
-
-               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
-                                     /* op1 = dimension, val.a = array descriptor    */
-
-                       /* check for negative sizes and copy sizes to stack if necessary  */
-
-                       MCODECHECK((iptr->op1 << 1) + 64);
-
-                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
-                               var_to_reg_int(s2, src, REG_ITMP1);
-                               M_CMPI(s2, 0);
-                               M_BLT(0);
-                               mcode_addxcheckarefs(mcodeptr);
-
-                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
-
-                               if (src->varkind != ARGVAR) {
-                                       M_IST(s2, REG_SP, 4 * (s1 + INT_ARG_CNT + 6));
-                                       }
-                               }
-
-                       /* a0 = dimension count */
-
-                       ICONST(argintregs[0], iptr->op1);
-
-                       /* a1 = arraydescriptor */
-
-                       a = dseg_addaddress(iptr->val.a);
-                       M_ALD(argintregs[1], REG_PV, a);
-
-                       /* a2 = pointer to dimensions = stack pointer */
-
-                       M_LDA(argintregs[2], REG_SP, (INT_ARG_CNT + 6)*4);
-
-                       a = dseg_addaddress((void*) (builtin_nmultianewarray));
-                       M_ALD(REG_PV, REG_PV, a);
-                       M_MTCTR(REG_PV);
-                       M_JSR;
-                       s1 = (int)((u1*) mcodeptr - mcodebase);
-                       M_MFLR(REG_ITMP1);
-                       if (s1 <= 32768)
-                               M_LDA (REG_PV, REG_ITMP1, -s1);
-                       else {
-                               s4 ml = -s1, mh = 0;
-                       while (ml < -32768) {ml += 65536; mh--;}
-                               M_LDA(REG_PV, REG_ITMP1, ml);
-                               M_LDAH(REG_PV, REG_PV, mh);
-                           }
-                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                       M_INTMOVE(REG_RESULT, s1);
-                       store_reg_to_var_int(iptr->dst, s1);
-                       break;
-
-
-               default: sprintf (logtext, "Unknown pseudo command: %d", iptr->opc);
-                        error();
-       
-   
-
-       } /* switch */
-               
-       } /* for instruction */
-               
-       /* copy values to interface registers */
-
-       src = bptr->outstack;
-       len = bptr->outdepth;
-       MCODECHECK(64+len);
-       while (src) {
-               len--;
-               if ((src->varkind != STACKVAR)) {
-                       s2 = src->type;
-                       if (IS_FLT_DBL_TYPE(s2)) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_FLTMOVE(s1,interfaces[len][s2].regoff);
-                                       }
-                               else {
-                                       M_DST(s1, REG_SP, 4 * interfaces[len][s2].regoff);
-                                       }
-                               }
-                       else {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_TINTMOVE(s2,s1,interfaces[len][s2].regoff);
-                                       }
-                               else {
-                                       M_IST(s1, REG_SP, 4 * interfaces[len][s2].regoff);
-                                       if (IS_2_WORD_TYPE(s2))
-                                               M_IST(secondregs[s1], REG_SP, 4 * interfaces[len][s2].regoff + 4);
-                                       }
-                               }
-                       }
-               src = src->prev;
-               }
-       } /* if (bptr -> flags >= BBREACHED) */
-       } /* for basic block */
-
-       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
-
-       {
-       /* generate bound check stubs */
-
-       s4 *xcodeptr = NULL;
-       
-       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
-                               xboundrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-
-               gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
-                                 xboundrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xboundrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       M_BR((xcodeptr-mcodeptr)-1);
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(proto_java_lang_ArrayIndexOutOfBoundsException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_MTCTR(REG_ITMP3);
-                       M_RTS;
-                       }
-               }
-
-       /* generate negative array size check stubs */
-
-       xcodeptr = NULL;
-       
-       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
-                               xcheckarefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
-                                 xcheckarefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xcheckarefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       M_BR((xcodeptr-mcodeptr)-1);
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(proto_java_lang_NegativeArraySizeException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_MTCTR(REG_ITMP3);
-                       M_RTS;
-                       }
-               }
-
-       /* generate cast check stubs */
-
-       xcodeptr = NULL;
-       
-       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
-                               xcastrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
-                                 xcastrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xcastrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       M_BR((xcodeptr-mcodeptr)-1);
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(proto_java_lang_ClassCastException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_MTCTR(REG_ITMP3);
-                       M_RTS;
-                       }
-               }
-
-
-#ifdef SOFTNULLPTRCHECK
-
-       /* generate null pointer check stubs */
-
-       xcodeptr = NULL;
-
-       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
-                               xnullrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
-                       continue;
-                       }
-
-               gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
-                                 xnullrefs->branchpos, (u1*) mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               M_LDA(REG_ITMP2_XPC, REG_PV, xnullrefs->branchpos - 4);
-
-               if (xcodeptr != NULL) {
-                       M_BR((xcodeptr-mcodeptr)-1);
-                       }
-               else {
-                       xcodeptr = mcodeptr;
-
-                       a = dseg_addaddress(proto_java_lang_NullPointerException);
-                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
-
-                       a = dseg_addaddress(asm_handle_exception);
-                       M_ALD(REG_ITMP3, REG_PV, a);
-
-                       M_MTCTR(REG_ITMP3);
-                       M_RTS;
-                       }
-               }
-
-#endif
-       }
-
-       mcode_finish((int)((u1*) mcodeptr - mcodebase));
-
-    docacheflush((void*) method->entrypoint,
-                      ((u1*) mcodeptr - mcodebase), ICACHE);
-}
-
-
-/* function createcompilerstub *************************************************
-
-       creates a stub routine which calls the compiler
-       
-*******************************************************************************/
-
-#define COMPSTUBSIZE 6
-
-u1 *createcompilerstub (methodinfo *m)
-{
-       s4 *s = CNEW (s4, COMPSTUBSIZE);    /* memory to hold the stub            */
-       s4 *mcodeptr = s;                   /* code generation pointer            */
-
-       M_LDA(2, REG_PV, 4*4);
-       M_ALD(REG_PV, REG_PV, 5*4);
-       M_MTCTR(REG_PV);
-       M_RTS;
-
-       s[4] = (s4) m;                      /* literals to be adressed            */
-       s[5] = (s4) asm_call_jit_compiler;  /* jump directly via PV from above    */
-
-    docacheflush((void*) s, (char*) mcodeptr - (char*) s, ICACHE);
-
-#ifdef STATISTICS
-       count_cstub_len += COMPSTUBSIZE * 4;
-#endif
-
-       return (u1*) s;
-}
-
-
-/* function removecompilerstub *************************************************
-
-     deletes a compilerstub from memory  (simply by freeing it)
-
-*******************************************************************************/
-
-void removecompilerstub (u1 *stub) 
-{
-       CFREE (stub, COMPSTUBSIZE * 4);
-}
-
-/* function: createnativestub **************************************************
-
-       creates a stub routine which calls a native method
-
-*******************************************************************************/
-
-#define NATIVESTUBSIZE 80
-#define NATIVESTUBOFFSET 8
-
-u1 *createnativestub (functionptr f, methodinfo *m)
-{
-       int disp;
-       s4 *s = CNEW (s4, NATIVESTUBSIZE);  /* memory to hold the stub            */
-       s4 *cs = s + NATIVESTUBOFFSET;
-       s4 *mcodeptr = cs;                  /* code generation pointer            */
-
-       *(cs-1) = (s4) f;                   /* address of native method           */
-       *(cs-2) = (s4) (&exceptionptr);     /* address of exceptionptr            */
-       *(cs-3) = (s4) asm_handle_nat_exception; /* addr of asm exception handler */
-       *(cs-4) = (s4) (&env);              /* addr of jni_environement           */
-//     *(cs-5) = (s4) asm_builtin_trace;
-       *(cs-6) = (s4) m;
-//     *(cs-7) = (s4) asm_builtin_exittrace;
-       *(cs-8) = (s4) builtin_trace_exception;
-
-#if 0
-       printf("stub: ");
-       utf_display(m->class->name);
-       printf(".");
-       utf_display(m->name);
-       printf(" 0x%p\n", cs);
-#endif
-
-       M_MFLR (REG_ITMP1);
-       M_AST  (REG_ITMP1, REG_SP, 8);      /* store return address               */
-       M_LDA  (REG_SP, REG_SP, -64);       /* build up stackframe                */
-
-#if 0
-       if (runverbose) {
-               M_ALD(REG_ITMP1, REG_PV, -6*4);
-               M_ALD(REG_PV, REG_PV, -5*4);
-
-//             M_JSR(REG_RA, REG_PV);
-               disp = -(int) (mcodeptr - (s4*) cs)*4;
-               M_LDA(REG_PV, REG_ITMP1, disp);
-       }
-#endif
-
-       reg_init();
-
-       M_MOV  (argintregs[6],argintregs[7]); 
-       M_MOV  (argintregs[5],argintregs[6]); 
-       M_MOV  (argintregs[4],argintregs[5]); 
-       M_MOV  (argintregs[3],argintregs[4]);
-       M_MOV  (argintregs[2],argintregs[3]);
-       M_MOV  (argintregs[1],argintregs[2]);
-       M_MOV  (argintregs[0],argintregs[1]);
-       
-       M_ALD  (argintregs[0], REG_PV, -4*4);/* load adress of jni_environement   */
-
-       M_ALD  (REG_PV, REG_PV, -1*4);      /* load adress of native method       */
-       M_MTCTR(REG_PV);
-       M_JSR;
-
-       disp = -(int) (mcodeptr - cs)*4;
-       M_MFLR (REG_ITMP1);
-       M_LDA  (REG_PV, REG_ITMP1, disp);   /* recompute pv from ra               */
-       M_ALD  (REG_ITMP2, REG_PV, -2*4);   /* get address of exceptionptr        */
-
-       M_ALD  (REG_ITMP1, REG_ITMP2, 0);   /* load exception into reg. itmp1     */
-       M_TST  (REG_ITMP1);
-       M_BNE  (4 + (runverbose ? 0 : 0));  /* if no exception then return        */
-
-#if 0
-       if (runverbose) {
-               M_ALD(argintregs[0], REG_PV, -6*4);
-               M_MOV(REG_RESULT, argintregs[1]);
-               M_FMOV(REG_FRESULT, argfltregs[2]);
-               M_FMOV(REG_FRESULT, argfltregs[3]);
-               M_ALD(REG_PV, REG_PV, -7*4);
-//             M_JSR(REG_RA, REG_PV);
-       }
-#endif
-
-       M_ALD  (REG_ITMP1, REG_SP, 64+8);         /* load return address                */
-       M_MTLR (REG_ITMP1);
-       M_LDA  (REG_SP, REG_SP, 64);         /* remove stackframe                  */
-
-       M_RET;
-       
-       M_CLR  (REG_ITMP3);
-       M_AST  (REG_ITMP3, REG_ITMP2, 0);    /* store NULL into exceptionptr       */
-
-#if 0
-       if (runverbose) {
-               M_LDA(REG_SP, REG_SP, -8);
-               M_AST(REG_ITMP1, REG_SP, 0);
-               M_MOV(REG_ITMP1, argintregs[0]);
-               M_ALD(argintregs[1], REG_PV, -6*4);
-               M_ALD(argintregs[2], REG_SP, 0);
-               M_CLR(argintregs[3]);
-               M_ALD(REG_PV, REG_PV, -8*4);
-//             M_JSR(REG_RA, REG_PV);
-               disp = -(int) (mcodeptr - cs)*4;
-               M_LDA  (REG_PV, REG_ITMP1, disp);
-               M_ALD(REG_ITMP1, REG_SP, 0);
-               M_LDA(REG_SP, REG_SP, 8);
-       }
-#endif
-
-       M_ALD  (REG_ITMP3, REG_SP, 64+8);         /* load return address                */
-       M_MTLR (REG_ITMP3);
-       M_LDA  (REG_SP, REG_SP, 64);         /* remove stackframe                  */
-
-       M_LDA  (REG_ITMP2, REG_ITMP1, -4);     /* move fault address into reg. itmp2 */
-
-       M_ALD  (REG_ITMP3, REG_PV, -3*4);   /* load asm exception handler address */
-       M_MTCTR(REG_ITMP3);
-       M_RTS;
-       
-#if 0
-       {
-               static int stubprinted;
-               if (!stubprinted)
-                       printf("stubsize: %d/2\n", (int) (p - (s4*) s));
-               stubprinted = 1;
-       }
-#endif
-
-    docacheflush((void*) s, (char*) mcodeptr - (char*) s, ICACHE);
-
-#ifdef STATISTICS
-       count_nstub_len += NATIVESTUBSIZE * 4;
-#endif
-
-       return (u1*) (s + NATIVESTUBOFFSET);
-}
-
-/* function: removenativestub **************************************************
-
-    removes a previously created native-stub from memory
-    
-*******************************************************************************/
-
-void removenativestub (u1 *stub)
-{
-       CFREE ((s4*) stub - NATIVESTUBOFFSET, NATIVESTUBSIZE * 4);
-}
-
-java_objectheader *asm_docalljavamethod (methodinfo *m, void *arg1, void*arg2,
-                                       void*arg3, void*arg4);
-java_objectheader *asm_calljavamethod (methodinfo *m, void *arg1, void*arg2,
-                                       void*arg3, void*arg4)
-{
-       java_objectheader *r = asm_docalljavamethod(m, arg1, arg2, arg3, arg4);
-       return (exceptionptr ? r : NULL);
-}
-
-java_objectheader *asm_calljavafunction (methodinfo *m, void *arg1, void*arg2,
-                                       void*arg3, void*arg4)
-{
-       return asm_docalljavamethod(m, arg1, arg2, arg3, arg4);
-}
-
-void asm_cacheflush(u1 *p, long bytelen);
-
-void docacheflush(u1 *p, long bytelen, int dummy)
-{
-       asm_cacheflush(p, bytelen);
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/powerpc/ngen.h b/powerpc/ngen.h
deleted file mode 100644 (file)
index 09b77e1..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/* alpha/ngen.h ****************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the machine dependent code generator definitions and macros for an
-       Alpha processor.
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/11
-
-*******************************************************************************/
-
-/* see also file calling.doc for explanation of calling conventions           */
-
-/* preallocated registers *****************************************************/
-
-/* integer registers */
-  
-#define REG_RESULT       3   /* to deliver method results                     */ 
-
-//#define REG_RA          26   /* return address                                */
-#define REG_PV          13   /* procedure vector, must be provided by caller  */
-#define REG_METHODPTR   12   /* pointer to the place from where the procedure */
-                             /* vector has been fetched                       */
-#define REG_ITMP1       11   /* temporary register                            */
-#define REG_ITMP2       12   /* temporary register and method pointer         */
-#define REG_ITMP3        0   /* temporary register                            */
-
-#define REG_ITMP1_XPTR  11   /* exception pointer = temporary register 1      */
-#define REG_ITMP2_XPC   12   /* exception pc = temporary register 2           */
-
-#define REG_SP           1   /* stack pointer                                 */
-#define REG_ZERO         0   /* allways zero                                  */
-
-/* floating point registers */
-
-#define REG_FRESULT      1   /* to deliver floating point method results      */ 
-#define REG_FTMP1       16   /* temporary floating point register             */
-#define REG_FTMP2       17   /* temporary floating point register             */
-#define REG_FTMP3        0   /* temporary floating point register             */
-
-#define REG_IFTMP        0   /* temporary integer and floating point register */
-
-/* register descripton - array ************************************************/
-
-/* #define REG_RES   0         reserved register for OS or code generator     */
-/* #define REG_RET   1         return value register                          */
-/* #define REG_EXC   2         exception value register (only old jit)        */
-/* #define REG_SAV   3         (callee) saved register                        */
-/* #define REG_TMP   4         scratch temporary register (caller saved)      */
-/* #define REG_ARG   5         argument register (caller saved)               */
-
-/* #define REG_END   -1        last entry in tables */
-int nregdescint[] = {
-       REG_RES, REG_RES, REG_TMP, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, 
-       REG_ARG, REG_ARG, REG_ARG, REG_RES, REG_RES, REG_RES, REG_SAV, REG_SAV, 
-       REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
-       REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
-       REG_END };
-
-//#define INT_SAV_CNT     19   /* number of int callee saved registers          */
-#define INT_ARG_CNT      8   /* number of int argument registers              */
-
-/* for use of reserved registers, see comment above */
-       
-int nregdescfloat[] = {
-       REG_RES, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG,
-       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_SAV, REG_SAV, 
-       REG_RES, REG_RES, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
-       REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
-       REG_END };
-
-//#define FLT_SAV_CNT     18   /* number of flt callee saved registers          */
-#define FLT_ARG_CNT     13   /* number of flt argument registers              */
-
-/* for use of reserved registers, see comment above */
-
-
-/* stackframe-infos ***********************************************************/
-
-int parentargs_base; /* offset in stackframe for the parameter from the caller*/
-
-/* -> see file 'calling.doc' */
-
-
-/* macros to create code ******************************************************/
-
-#define M_OP3(x,y,oe,rc,d,a,b) \
-       *mcodeptr++ = (((x)<<26) | ((d)<<21) | ((a)<<16) | ((b)<<11) | ((oe)<<10) | ((y)<<1) | (rc))
-
-#define M_OP4(x,y,rc,d,a,b,c) \
-       *mcodeptr++ = (((x)<<26) | ((d)<<21) | ((a)<<16) | ((b)<<11) | ((c)<<6) | ((y)<<1) | (rc))
-
-#define M_OP2_IMM(x,d,a,i) \
-       *mcodeptr++ = (((x)<<26) | ((d)<<21) | ((a)<<16) | ((i)&0xffff))
-
-#define M_BRMASK (((1<<16)-1)&~3)
-#define M_BRAMASK (((1<<26)-1)&~3)
-
-#define M_BRA(x,i,a,l) \
-       *mcodeptr++ = (((x)<<26) | (((i)*4+4)&M_BRAMASK) | ((a)<<1) | (l));
-
-#define M_BRAC(x,bo,bi,i,a,l) \
-       *mcodeptr++ = (((x)<<26) | ((bo)<<21) | ((bi)<<16) | (((i)*4+4)&M_BRMASK) | ((a)<<1) | (l));
-
-#define M_IADD(a,b,c) M_OP3(31, 266, 0, 0, c, a, b)
-#define M_IADD_IMM(a,b,c) M_OP2_IMM(14, c, a, b)
-#define M_ADDC(a,b,c) M_OP3(31, 10, 0, 0, c, a, b)
-#define M_ADDIC(a,b,c) M_OP2_IMM(12, c, a, b)
-#define M_ADDICTST(a,b,c) M_OP2_IMM(13, c, a, b)
-#define M_ADDE(a,b,c) M_OP3(31, 138, 0, 0, c, a, b)
-#define M_ADDZE(a,b) M_OP3(31, 202, 0, 0, b, a, 0)
-#define M_ADDME(a,b) M_OP3(31, 234, 0, 0, b, a, 0)
-#define M_ISUB(a,b,c) M_OP3(31, 40, 0, 0, c, b, a)
-#define M_ISUBTST(a,b,c) M_OP3(31, 40, 0, 1, c, b, a)
-#define M_SUBC(a,b,c) M_OP3(31, 8, 0, 0, c, b, a)
-#define M_SUBIC(a,b,c) M_OP2_IMM(8, c, b, a)
-#define M_SUBE(a,b,c) M_OP3(31, 136, 0, 0, c, b, a)
-#define M_SUBZE(a,b) M_OP3(31, 200, 0, 0, b, a, 0)
-#define M_SUBME(a,b) M_OP3(31, 232, 0, 0, b, a, 0)
-#define M_AND(a,b,c) M_OP3(31, 28, 0, 0, a, c, b)
-#define M_AND_IMM(a,b,c) M_OP2_IMM(28, a, c, b)
-#define M_ANDIS(a,b,c) M_OP2_IMM(29, a, c, b)
-#define M_OR(a,b,c) M_OP3(31, 444, 0, 0, a, c, b)
-#define M_OR_IMM(a,b,c) M_OP2_IMM(24, a, c, b)
-#define M_ORIS(a,b,c) M_OP2_IMM(25, a, c, b)
-#define M_XOR(a,b,c) M_OP3(31, 316, 0, 0, a, c, b)
-#define M_XOR_IMM(a,b,c) M_OP2_IMM(26, a, c, b)
-#define M_XORIS(a,b,c) M_OP2_IMM(27, a, c, b)
-#define M_SLL(a,b,c) M_OP3(31, 24, 0, 0, a, c, b)
-#define M_SRL(a,b,c) M_OP3(31, 536, 0, 0, a, c, b)
-#define M_SRA(a,b,c) M_OP3(31, 792, 0, 0, a, c, b)
-#define M_SRA_IMM(a,b,c) M_OP3(31, 824, 0, 0, a, c, b)
-#define M_IMUL(a,b,c) M_OP3(31, 235, 0, 0, c, a, b)
-#define M_IMUL_IMM(a,b,c) M_OP2_IMM(7, c, a, b)
-#define M_IDIV(a,b,c) M_OP3(31, 491, 0, 0, c, a, b)
-#define M_NEG(a,b) M_OP3(31, 104, 0, 0, b, a, 0)
-#define M_NOT(a,b) M_OP3(31, 124, 0, 0, a, b, a)
-
-#define M_SUBFIC(a,b,c) M_OP2_IMM(8, c, a, b)
-#define M_SUBFZE(a,b) M_OP3(31, 200, 0, 0, b, a, 0)
-#define M_RLWINM(a,b,c,d,e) M_OP4(21, d, 0, a, e, b, c)
-#define M_ADDZE(a,b) M_OP3(31, 202, 0, 0, b, a, 0)
-#define M_SLL_IMM(a,b,c) M_RLWINM(a,b,0,31-(b),c)
-#define M_SRL_IMM(a,b,c) M_RLWINM(a,32-(b),b,31,c)
-#define M_ADDIS(a,b,c) M_OP2_IMM(15, c, a, b)
-#define M_STFIWX(a,b,c) M_OP3(31, 983, 0, 0, a, b, c)
-#define M_LWZX(a,b,c) M_OP3(31, 23, 0, 0, a, b, c)
-#define M_LHZX(a,b,c) M_OP3(31, 279, 0, 0, a, b, c)
-#define M_LHAX(a,b,c) M_OP3(31, 343, 0, 0, a, b, c)
-#define M_LBZX(a,b,c) M_OP3(31, 87, 0, 0, a, b, c)
-#define M_LFSX(a,b,c) M_OP3(31, 535, 0, 0, a, b, c)
-#define M_LFDX(a,b,c) M_OP3(31, 599, 0, 0, a, b, c)
-#define M_STWX(a,b,c) M_OP3(31, 151, 0, 0, a, b, c)
-#define M_STHX(a,b,c) M_OP3(31, 407, 0, 0, a, b, c)
-#define M_STBX(a,b,c) M_OP3(31, 215, 0, 0, a, b, c)
-#define M_STFSX(a,b,c) M_OP3(31, 663, 0, 0, a, b, c)
-#define M_STFDX(a,b,c) M_OP3(31, 727, 0, 0, a, b, c)
-#define M_STWU(a,b,c) M_OP2_IMM(37, a, b, c)
-#define M_LDAH(a,b,c) M_ADDIS(b, c, a)
-#define M_TRAP M_OP3(31, 4, 0, 0, 31, 0, 0)
-
-#define M_NOP M_OR_IMM(0, 0, 0)
-#define M_MOV(a,b) M_OR(a, a, b)
-#define M_TST(a) M_OP3(31, 444, 0, 1, a, a, a)
-
-#define M_DADD(a,b,c) M_OP3(63, 21, 0, 0, c, a, b)
-#define M_FADD(a,b,c) M_OP3(59, 21, 0, 0, c, a, b)
-#define M_DSUB(a,b,c) M_OP3(63, 20, 0, 0, c, a, b)
-#define M_FSUB(a,b,c) M_OP3(59, 20, 0, 0, c, a, b)
-#define M_DMUL(a,b,c) M_OP4(63, 25, 0, c, a, 0, b)
-#define M_FMUL(a,b,c) M_OP4(59, 25, 0, c, a, 0, b)
-#define M_DDIV(a,b,c) M_OP3(63, 18, 0, 0, c, a, b)
-#define M_FDIV(a,b,c) M_OP3(59, 18, 0, 0, c, a, b)
-
-#define M_FABS(a,b) M_OP3(63, 264, 0, 0, b, 0, a)
-#define M_CVTDL(a,b) M_OP3(63, 14, 0, 0, b, 0, a)
-#define M_CVTDL_C(a,b) M_OP3(63, 15, 0, 0, b, 0, a)
-#define M_CVTDF(a,b) M_OP3(63, 12, 0, 0, b, 0, a)
-#define M_FMOV(a,b) M_OP3(63, 72, 0, 0, b, 0, a)
-#define M_FMOVN(a,b) M_OP3(63, 40, 0, 0, b, 0, a)
-#define M_DSQRT(a,b) M_OP3(63, 22, 0, 0, b, 0, a)
-#define M_FSQRT(a,b) M_OP3(59, 22, 0, 0, b, 0, a)
-
-#define M_FCMPU(a,b) M_OP3(63, 0, 0, 0, 0, a, b)
-#define M_FCMPO(a,b) M_OP3(63, 32, 0, 0, 0, a, b)
-
-#define M_BST(a,b,c) M_OP2_IMM(38, a, b, c)
-#define M_SST(a,b,c) M_OP2_IMM(44, a, b, c)
-#define M_IST(a,b,c) M_OP2_IMM(36, a, b, c)
-#define M_AST(a,b,c) M_OP2_IMM(36, a, b, c)
-#define M_BLDU(a,b,c) M_OP2_IMM(34, a, b, c)
-#define M_SLDU(a,b,c) M_OP2_IMM(40, a, b, c)
-#define M_ILD(a,b,c) M_OP2_IMM(32, a, b, c)
-#define M_ALD(a,b,c) M_OP2_IMM(32, a, b, c)
-
-#define M_BSEXT(a,b) M_OP3(31, 954, 0, 0, a, b, 0)
-#define M_SSEXT(a,b) M_OP3(31, 922, 0, 0, a, b, 0)
-#define M_CZEXT(a,b) M_RLWINM(a,0,16,31,b)
-
-#define M_BR(a) M_BRA(18, a, 0, 0);
-#define M_BL(a) M_BRA(18, a, 0, 1);
-#define M_RET M_OP3(19, 16, 0, 0, 20, 0, 0);
-#define M_JSR M_OP3(19, 528, 0, 1, 20, 0, 0);
-#define M_RTS M_OP3(19, 528, 0, 0, 20, 0, 0);
-
-#define M_CMP(a,b) M_OP3(31, 0, 0, 0, 0, a, b);
-#define M_CMPU(a,b) M_OP3(31, 32, 0, 0, 0, a, b);
-#define M_CMPI(a,b) M_OP2_IMM(11, 0, a, b);
-#define M_CMPUI(a,b) M_OP2_IMM(10, 0, a, b);
-
-#define M_BLT(a) M_BRAC(16, 12, 0, a, 0, 0);
-#define M_BLE(a) M_BRAC(16, 4, 1, a, 0, 0);
-#define M_BGT(a) M_BRAC(16, 12, 1, a, 0, 0);
-#define M_BGE(a) M_BRAC(16, 4, 0, a, 0, 0);
-#define M_BEQ(a) M_BRAC(16, 12, 2, a, 0, 0);
-#define M_BNE(a) M_BRAC(16, 4, 2, a, 0, 0);
-#define M_BNAN(a) M_BRAC(16, 12, 3, a, 0, 0);
-
-#define M_DLD(a,b,c) M_OP2_IMM(50, a, b, c)
-#define M_DST(a,b,c) M_OP2_IMM(54, a, b, c)
-#define M_FLD(a,b,c) M_OP2_IMM(48, a, b, c)
-#define M_FST(a,b,c) M_OP2_IMM(52, a, b, c)
-
-#define M_MFLR(a) M_OP3(31, 339, 0, 0, a, 8, 0)
-#define M_MFXER(a) M_OP3(31, 339, 0, 0, a, 1, 0)
-#define M_MFCTR(a) M_OP3(31, 339, 0, 0, a, 9, 0)
-#define M_MTLR(a) M_OP3(31, 467, 0, 0, a, 8, 0)
-#define M_MTXER(a) M_OP3(31, 467, 0, 0, a, 1, 0)
-#define M_MTCTR(a) M_OP3(31, 467, 0, 0, a, 9, 0)
-
-#define M_LDA(a,b,c) M_IADD_IMM(b, c, a)
-#define M_LDATST(a,b,c) M_ADDICTST(b, c, a)
-#define M_CLR(a) M_IADD_IMM(0, 0, a)
-
-/* function gen_resolvebranch **************************************************
-
-       parameters: ip ... pointer to instruction after branch (void*)
-                   so ... offset of instruction after branch  (s4)
-                   to ... offset of branch target             (s4)
-
-*******************************************************************************/
-
-#define gen_resolvebranch(ip,so,to) \
-       *((s4*)(ip)-1)=(*((s4*)(ip)-1) & ~M_BRMASK) | (((s4)((to)-(so))+4)&((((*((s4*)(ip)-1)>>26)&63)==18)?M_BRAMASK:M_BRMASK))
-
-#define SOFTNULLPTRCHECK       /* soft null pointer check supported as option */
diff --git a/powerpc/ppc-dis.c b/powerpc/ppc-dis.c
deleted file mode 100644 (file)
index 1a8f16e..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/* ppc-dis.c -- Disassemble PowerPC instructions
-   Copyright 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
-   Written by Ian Lance Taylor, Cygnus Support
-
-This file is part of GDB, GAS, and the GNU binutils.
-
-GDB, GAS, and the GNU binutils are free software; you can redistribute
-them and/or modify them under the terms of the GNU General Public
-License as published by the Free Software Foundation; either version
-2, or (at your option) any later version.
-
-GDB, GAS, and the GNU binutils are distributed in the hope that they
-will be useful, but WITHOUT ANY WARRANTY; without even the implied
-warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this file; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-
-typedef unsigned char u1;
-typedef unsigned int u4;
-typedef signed int s4;
-
-#include <stdio.h>
-#include "dis-asm.h"
-#include "ppc.h"
-
-#include <string.h>
-
-unsigned long bfd_getb32(void *);
-unsigned long bfd_getl32(void *);
-
-/* This file provides several disassembler functions, all of which use
-   the disassembler interface defined in dis-asm.h.  Several functions
-   are provided because this file handles disassembly for the PowerPC
-   in both big and little endian mode and also for the POWER (RS/6000)
-   chip.  */
-
-static int print_insn_powerpc PARAMS ((bfd_vma, struct disassemble_info *,
-                                      int bigendian, int dialect));
-
-static int powerpc_dialect PARAMS ((struct disassemble_info *));
-
-/* Determine which set of machines to disassemble for.  PPC403/601 or
-   BookE.  For convenience, also disassemble instructions supported
-   by the AltiVec vector unit.  */
-
-int
-powerpc_dialect(info)
-     struct disassemble_info *info;
-{
-  int dialect = PPC_OPCODE_PPC | PPC_OPCODE_ALTIVEC;
-
-#if 0
-  if (BFD_DEFAULT_TARGET_SIZE == 64)
-    dialect |= PPC_OPCODE_64;
-#endif
-
-  if (info->disassembler_options
-      && (strcmp (info->disassembler_options, "booke") == 0
-         || strcmp (info->disassembler_options, "booke32") == 0
-         || strcmp (info->disassembler_options, "booke64") == 0))
-    dialect |= PPC_OPCODE_BOOKE | PPC_OPCODE_BOOKE64;
-  else 
-    if ((0)
-        || (info->disassembler_options
-       && (   strcmp (info->disassembler_options, "e500") == 0
-           || strcmp (info->disassembler_options, "e500x2") == 0)))
-      {
-        dialect |= PPC_OPCODE_BOOKE
-         | PPC_OPCODE_SPE | PPC_OPCODE_ISEL
-         | PPC_OPCODE_EFS | PPC_OPCODE_BRLOCK
-         | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK
-         | PPC_OPCODE_RFMCI;
-       /* efs* and AltiVec conflict.  */
-       dialect &= ~PPC_OPCODE_ALTIVEC;
-      }
-  else 
-    if (info->disassembler_options
-       && (strcmp (info->disassembler_options, "efs") == 0))
-      {
-       dialect |= PPC_OPCODE_EFS;
-       /* efs* and AltiVec conflict.  */
-       dialect &= ~PPC_OPCODE_ALTIVEC;
-      }
-  else
-    dialect |= PPC_OPCODE_403 | PPC_OPCODE_601 | PPC_OPCODE_COMMON;
-
-  if (info->disassembler_options
-      && strcmp (info->disassembler_options, "power4") == 0)
-    dialect |= PPC_OPCODE_POWER4;
-
-  if (info->disassembler_options)
-    {
-      if (strstr (info->disassembler_options, "32") != NULL)
-       dialect &= ~PPC_OPCODE_64;
-      else if (strstr (info->disassembler_options, "64") != NULL)
-       dialect |= PPC_OPCODE_64;
-    }
-
-  return dialect;
-}
-
-/* Print a big endian PowerPC instruction.  */
-
-int
-print_insn_big_powerpc (memaddr, info)
-     bfd_vma memaddr;
-     struct disassemble_info *info;
-{
-  return print_insn_powerpc (memaddr, info, 1, powerpc_dialect(info));
-}
-
-/* Print a little endian PowerPC instruction.  */
-
-int
-print_insn_little_powerpc (memaddr, info)
-     bfd_vma memaddr;
-     struct disassemble_info *info;
-{
-  return print_insn_powerpc (memaddr, info, 0, powerpc_dialect(info));
-}
-
-/* Print a POWER (RS/6000) instruction.  */
-
-int
-print_insn_rs6000 (memaddr, info)
-     bfd_vma memaddr;
-     struct disassemble_info *info;
-{
-  return print_insn_powerpc (memaddr, info, 1, PPC_OPCODE_POWER);
-}
-
-/* Print a PowerPC or POWER instruction.  */
-
-static int
-print_insn_powerpc (memaddr, info, bigendian, dialect)
-     bfd_vma memaddr;
-     struct disassemble_info *info;
-     int bigendian;
-     int dialect;
-{
-  bfd_byte buffer[4];
-  int status;
-  unsigned long insn;
-  const struct powerpc_opcode *opcode;
-  const struct powerpc_opcode *opcode_end;
-  unsigned long op;
-
-  status = (*info->read_memory_func) (memaddr, buffer, 4, info);
-  if (status != 0)
-    {
-      (*info->memory_error_func) (status, memaddr, info);
-      return -1;
-    }
-
-  if (bigendian)
-    insn = bfd_getb32 (buffer);
-  else
-    insn = bfd_getl32 (buffer);
-
-  /* Get the major opcode of the instruction.  */
-  op = PPC_OP (insn);
-
-  /* Find the first match in the opcode table.  We could speed this up
-     a bit by doing a binary search on the major opcode.  */
-  opcode_end = powerpc_opcodes + powerpc_num_opcodes;
-  for (opcode = powerpc_opcodes; opcode < opcode_end; opcode++)
-    {
-      unsigned long table_op;
-      const unsigned char *opindex;
-      const struct powerpc_operand *operand;
-      int invalid;
-      int need_comma;
-      int need_paren;
-
-      table_op = PPC_OP (opcode->opcode);
-      if (op < table_op)
-       break;
-      if (op > table_op)
-       continue;
-
-      if ((insn & opcode->mask) != opcode->opcode
-         || (opcode->flags & dialect) == 0)
-       continue;
-
-      if ((dialect & PPC_OPCODE_EFS) && (opcode->flags & PPC_OPCODE_ALTIVEC))
-        continue;
-
-      /* Make two passes over the operands.  First see if any of them
-        have extraction functions, and, if they do, make sure the
-        instruction is valid.  */
-      invalid = 0;
-      for (opindex = opcode->operands; *opindex != 0; opindex++)
-       {
-         operand = powerpc_operands + *opindex;
-         if (operand->extract)
-           (*operand->extract) (insn, dialect, &invalid);
-       }
-      if (invalid)
-       continue;
-
-      /* The instruction is valid.  */
-      (*info->fprintf_func) (info->stream, "%s", opcode->name);
-      if (opcode->operands[0] != 0)
-       (*info->fprintf_func) (info->stream, "\t");
-
-      /* Now extract and print the operands.  */
-      need_comma = 0;
-      need_paren = 0;
-      for (opindex = opcode->operands; *opindex != 0; opindex++)
-       {
-         long value;
-
-         operand = powerpc_operands + *opindex;
-
-         /* Operands that are marked FAKE are simply ignored.  We
-            already made sure that the extract function considered
-            the instruction to be valid.  */
-         if ((operand->flags & PPC_OPERAND_FAKE) != 0)
-           continue;
-
-         /* Extract the value from the instruction.  */
-         if (operand->extract)
-           value = (*operand->extract) (insn, dialect, (int *) NULL);
-         else
-           {
-             value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
-             if ((operand->flags & PPC_OPERAND_SIGNED) != 0
-                 && (value & (1 << (operand->bits - 1))) != 0)
-               value -= 1 << operand->bits;
-           }
-
-         /* If the operand is optional, and the value is zero, don't
-            print anything.  */
-         if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
-             && (operand->flags & PPC_OPERAND_NEXT) == 0
-             && value == 0)
-           continue;
-
-         if (need_comma)
-           {
-             (*info->fprintf_func) (info->stream, ",");
-             need_comma = 0;
-           }
-
-         /* Print the operand as directed by the flags.  */
-         if ((operand->flags & PPC_OPERAND_GPR) != 0)
-           (*info->fprintf_func) (info->stream, "r%ld", value);
-         else if ((operand->flags & PPC_OPERAND_FPR) != 0)
-           (*info->fprintf_func) (info->stream, "f%ld", value);
-         else if ((operand->flags & PPC_OPERAND_VR) != 0)
-           (*info->fprintf_func) (info->stream, "v%ld", value);
-         else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0)
-           (*info->print_address_func) (memaddr + value, info);
-         else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
-           (*info->print_address_func) ((bfd_vma) value & 0xffffffff, info);
-         else if ((operand->flags & PPC_OPERAND_CR) == 0
-                  || (dialect & PPC_OPCODE_PPC) == 0)
-           (*info->fprintf_func) (info->stream, "%ld", value);
-         else
-           {
-             if (operand->bits == 3)
-               (*info->fprintf_func) (info->stream, "cr%d", value);
-             else
-               {
-                 static const char *cbnames[4] = { "lt", "gt", "eq", "so" };
-                 int cr;
-                 int cc;
-
-                 cr = value >> 2;
-                 if (cr != 0)
-                   (*info->fprintf_func) (info->stream, "4*cr%d", cr);
-                 cc = value & 3;
-                 if (cc != 0)
-                   {
-                     if (cr != 0)
-                       (*info->fprintf_func) (info->stream, "+");
-                     (*info->fprintf_func) (info->stream, "%s", cbnames[cc]);
-                   }
-               }
-           }
-
-         if (need_paren)
-           {
-             (*info->fprintf_func) (info->stream, ")");
-             need_paren = 0;
-           }
-
-         if ((operand->flags & PPC_OPERAND_PARENS) == 0)
-           need_comma = 1;
-         else
-           {
-             (*info->fprintf_func) (info->stream, "(");
-             need_paren = 1;
-           }
-       }
-
-      /* We have found and printed an instruction; return.  */
-      return 4;
-    }
-
-  /* We could not find a match.  */
-  (*info->fprintf_func) (info->stream, ".long 0x%lx", insn);
-
-  return 4;
-}
diff --git a/powerpc/ppc-opc.c b/powerpc/ppc-opc.c
deleted file mode 100644 (file)
index 3eb2aca..0000000
+++ /dev/null
@@ -1,4569 +0,0 @@
-/* ppc-opc.c -- PowerPC opcode list
-   Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-   Written by Ian Lance Taylor, Cygnus Support
-
-This file is part of GDB, GAS, and the GNU binutils.
-
-GDB, GAS, and the GNU binutils are free software; you can redistribute
-them and/or modify them under the terms of the GNU General Public
-License as published by the Free Software Foundation; either version
-2, or (at your option) any later version.
-
-GDB, GAS, and the GNU binutils are distributed in the hope that they
-will be useful, but WITHOUT ANY WARRANTY; without even the implied
-warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this file; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
-
-#include <stdio.h>
-#include "ppc.h"
-
-#define _(a) a
-
-/* This file holds the PowerPC opcode table.  The opcode table
-   includes almost all of the extended instruction mnemonics.  This
-   permits the disassembler to use them, and simplifies the assembler
-   logic, at the cost of increasing the table size.  The table is
-   strictly constant data, so the compiler should be able to put it in
-   the .text section.
-
-   This file also holds the operand table.  All knowledge about
-   inserting operands into instructions and vice-versa is kept in this
-   file.  */
-\f
-/* Local insertion and extraction functions.  */
-
-static unsigned long insert_bat
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_bat
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_bba
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_bba
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_bd
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_bd
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_bdm
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_bdm
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_bdp
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_bdp
-  PARAMS ((unsigned long, int, int *));
-static int valid_bo
-  PARAMS ((long, int));
-static unsigned long insert_bo
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_bo
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_boe
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_boe
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_ds
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_ds
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_de
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_de
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_des
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_des
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_li
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_li
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_mbe
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_mbe
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_mb6
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_mb6
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_nb
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_nb
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_nsi
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_nsi
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_pmrn
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_pmrn
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_ral
-  PARAMS ((unsigned long, long, int, const char **));
-static unsigned long insert_ram
-  PARAMS ((unsigned long, long, int, const char **));
-static unsigned long insert_ras
-  PARAMS ((unsigned long, long, int, const char **));
-static unsigned long insert_rbs
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_rbs
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_sh6
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_sh6
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_spr
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_spr
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_tbr
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_tbr
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_ev2
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_ev2
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_ev4
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_ev4
-  PARAMS ((unsigned long, int, int *));
-static unsigned long insert_ev8
-  PARAMS ((unsigned long, long, int, const char **));
-static long extract_ev8
-  PARAMS ((unsigned long, int, int *));
-\f
-/* The operands table.
-
-   The fields are bits, shift, insert, extract, flags.
-
-   We used to put parens around the various additions, like the one
-   for BA just below.  However, that caused trouble with feeble
-   compilers with a limit on depth of a parenthesized expression, like
-   (reportedly) the compiler in Microsoft Developer Studio 5.  So we
-   omit the parens, since the macros are never used in a context where
-   the addition will be ambiguous.  */
-
-const struct powerpc_operand powerpc_operands[] =
-{
-  /* The zero index is used to indicate the end of the list of
-     operands.  */
-#define UNUSED 0
-  { 0, 0, 0, 0, 0 },
-
-  /* The BA field in an XL form instruction.  */
-#define BA UNUSED + 1
-#define BA_MASK (0x1f << 16)
-  { 5, 16, 0, 0, PPC_OPERAND_CR },
-
-  /* The BA field in an XL form instruction when it must be the same
-     as the BT field in the same instruction.  */
-#define BAT BA + 1
-  { 5, 16, insert_bat, extract_bat, PPC_OPERAND_FAKE },
-
-  /* The BB field in an XL form instruction.  */
-#define BB BAT + 1
-#define BB_MASK (0x1f << 11)
-  { 5, 11, 0, 0, PPC_OPERAND_CR },
-
-  /* The BB field in an XL form instruction when it must be the same
-     as the BA field in the same instruction.  */
-#define BBA BB + 1
-  { 5, 11, insert_bba, extract_bba, PPC_OPERAND_FAKE },
-
-  /* The BD field in a B form instruction.  The lower two bits are
-     forced to zero.  */
-#define BD BBA + 1
-  { 16, 0, insert_bd, extract_bd, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
-
-  /* The BD field in a B form instruction when absolute addressing is
-     used.  */
-#define BDA BD + 1
-  { 16, 0, insert_bd, extract_bd, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
-
-  /* The BD field in a B form instruction when the - modifier is used.
-     This sets the y bit of the BO field appropriately.  */
-#define BDM BDA + 1
-  { 16, 0, insert_bdm, extract_bdm,
-      PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
-
-  /* The BD field in a B form instruction when the - modifier is used
-     and absolute address is used.  */
-#define BDMA BDM + 1
-  { 16, 0, insert_bdm, extract_bdm,
-      PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
-
-  /* The BD field in a B form instruction when the + modifier is used.
-     This sets the y bit of the BO field appropriately.  */
-#define BDP BDMA + 1
-  { 16, 0, insert_bdp, extract_bdp,
-      PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
-
-  /* The BD field in a B form instruction when the + modifier is used
-     and absolute addressing is used.  */
-#define BDPA BDP + 1
-  { 16, 0, insert_bdp, extract_bdp,
-      PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
-
-  /* The BF field in an X or XL form instruction.  */
-#define BF BDPA + 1
-  { 3, 23, 0, 0, PPC_OPERAND_CR },
-
-  /* An optional BF field.  This is used for comparison instructions,
-     in which an omitted BF field is taken as zero.  */
-#define OBF BF + 1
-  { 3, 23, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
-
-  /* The BFA field in an X or XL form instruction.  */
-#define BFA OBF + 1
-  { 3, 18, 0, 0, PPC_OPERAND_CR },
-
-  /* The BI field in a B form or XL form instruction.  */
-#define BI BFA + 1
-#define BI_MASK (0x1f << 16)
-  { 5, 16, 0, 0, PPC_OPERAND_CR },
-
-  /* The BO field in a B form instruction.  Certain values are
-     illegal.  */
-#define BO BI + 1
-#define BO_MASK (0x1f << 21)
-  { 5, 21, insert_bo, extract_bo, 0 },
-
-  /* The BO field in a B form instruction when the + or - modifier is
-     used.  This is like the BO field, but it must be even.  */
-#define BOE BO + 1
-  { 5, 21, insert_boe, extract_boe, 0 },
-
-  /* The BT field in an X or XL form instruction.  */
-#define BT BOE + 1
-  { 5, 21, 0, 0, PPC_OPERAND_CR },
-
-  /* The condition register number portion of the BI field in a B form
-     or XL form instruction.  This is used for the extended
-     conditional branch mnemonics, which set the lower two bits of the
-     BI field.  This field is optional.  */
-#define CR BT + 1
-  { 3, 18, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
-
-  /* The CRB field in an X form instruction.  */
-#define CRB CR + 1
-  { 5, 6, 0, 0, 0 },
-
-  /* The CRFD field in an X form instruction.  */
-#define CRFD CRB + 1
-  { 3, 23, 0, 0, 0 },
-
-  /* The CRFS field in an X form instruction.  */
-#define CRFS CRFD + 1
-  { 3, 0, 0, 0, 0 },
-
-  /* The CT field in an X form instruction.  */
-#define CT CRFS + 1
-#define RD CT
-  { 5, 21, 0, 0, PPC_OPERAND_OPTIONAL },
-
-  /* The D field in a D form instruction.  This is a displacement off
-     a register, and implies that the next operand is a register in
-     parentheses.  */
-#define D CT + 1
-  { 16, 0, 0, 0, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
-
-  /* The DE field in a DE form instruction.  This is like D, but is 12
-     bits only.  */
-#define DE D + 1
-  { 14, 0, insert_de, extract_de, PPC_OPERAND_PARENS },
-
-  /* The DES field in a DES form instruction.  This is like DS, but is 14
-     bits only (12 stored.)  */
-#define DES DE + 1
-  { 14, 0, insert_des, extract_des, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
-
-  /* The DS field in a DS form instruction.  This is like D, but the
-     lower two bits are forced to zero.  */
-#define DS DES + 1
-  { 16, 0, insert_ds, extract_ds,
-      PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED | PPC_OPERAND_DS },
-
-  /* The E field in a wrteei instruction.  */
-#define E DS + 1
-  { 1, 15, 0, 0, 0 },
-
-  /* The FL1 field in a POWER SC form instruction.  */
-#define FL1 E + 1
-  { 4, 12, 0, 0, 0 },
-
-  /* The FL2 field in a POWER SC form instruction.  */
-#define FL2 FL1 + 1
-  { 3, 2, 0, 0, 0 },
-
-  /* The FLM field in an XFL form instruction.  */
-#define FLM FL2 + 1
-  { 8, 17, 0, 0, 0 },
-
-  /* The FRA field in an X or A form instruction.  */
-#define FRA FLM + 1
-#define FRA_MASK (0x1f << 16)
-  { 5, 16, 0, 0, PPC_OPERAND_FPR },
-
-  /* The FRB field in an X or A form instruction.  */
-#define FRB FRA + 1
-#define FRB_MASK (0x1f << 11)
-  { 5, 11, 0, 0, PPC_OPERAND_FPR },
-
-  /* The FRC field in an A form instruction.  */
-#define FRC FRB + 1
-#define FRC_MASK (0x1f << 6)
-  { 5, 6, 0, 0, PPC_OPERAND_FPR },
-
-  /* The FRS field in an X form instruction or the FRT field in a D, X
-     or A form instruction.  */
-#define FRS FRC + 1
-#define FRT FRS
-  { 5, 21, 0, 0, PPC_OPERAND_FPR },
-
-  /* The FXM field in an XFX instruction.  */
-#define FXM FRS + 1
-#define FXM_MASK (0xff << 12)
-  { 8, 12, 0, 0, 0 },
-
-  /* The L field in a D or X form instruction.  */
-#define L FXM + 1
-  { 1, 21, 0, 0, PPC_OPERAND_OPTIONAL },
-
-  /* The LEV field in a POWER SC form instruction.  */
-#define LEV L + 1
-  { 7, 5, 0, 0, 0 },
-
-  /* The LI field in an I form instruction.  The lower two bits are
-     forced to zero.  */
-#define LI LEV + 1
-  { 26, 0, insert_li, extract_li, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
-
-  /* The LI field in an I form instruction when used as an absolute
-     address.  */
-#define LIA LI + 1
-  { 26, 0, insert_li, extract_li, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
-
-  /* The LS field in an X (sync) form instruction.  */
-#define LS LIA + 1
-  { 2, 21, 0, 0, PPC_OPERAND_OPTIONAL },
-
-  /* The MB field in an M form instruction.  */
-#define MB LS + 1
-#define MB_MASK (0x1f << 6)
-  { 5, 6, 0, 0, 0 },
-
-  /* The ME field in an M form instruction.  */
-#define ME MB + 1
-#define ME_MASK (0x1f << 1)
-  { 5, 1, 0, 0, 0 },
-
-  /* The MB and ME fields in an M form instruction expressed a single
-     operand which is a bitmask indicating which bits to select.  This
-     is a two operand form using PPC_OPERAND_NEXT.  See the
-     description in opcode/ppc.h for what this means.  */
-#define MBE ME + 1
-  { 5, 6, 0, 0, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT },
-  { 32, 0, insert_mbe, extract_mbe, 0 },
-
-  /* The MB or ME field in an MD or MDS form instruction.  The high
-     bit is wrapped to the low end.  */
-#define MB6 MBE + 2
-#define ME6 MB6
-#define MB6_MASK (0x3f << 5)
-  { 6, 5, insert_mb6, extract_mb6, 0 },
-
-  /* The MO field in an mbar instruction.  */
-#define MO MB6 + 1
-  { 5, 21, 0, 0, 0 },
-
-  /* The NB field in an X form instruction.  The value 32 is stored as
-     0.  */
-#define NB MO + 1
-  { 6, 11, insert_nb, extract_nb, 0 },
-
-  /* The NSI field in a D form instruction.  This is the same as the
-     SI field, only negated.  */
-#define NSI NB + 1
-  { 16, 0, insert_nsi, extract_nsi,
-      PPC_OPERAND_NEGATIVE | PPC_OPERAND_SIGNED },
-
-  /* The PMRN field in an X form instruction.  */
-#define PMRN NSI + 1
-  { 16, 0, insert_pmrn, extract_pmrn, PPC_OPERAND_GPR },
-
-  /* The RA field in an D, DS, X, XO, M, or MDS form instruction.  */
-#define RA PMRN + 1
-#define RA_MASK (0x1f << 16)
-  { 5, 16, 0, 0, PPC_OPERAND_GPR },
-
-  /* The RA field in a D or X form instruction which is an updating
-     load, which means that the RA field may not be zero and may not
-     equal the RT field.  */
-#define RAL RA + 1
-  { 5, 16, insert_ral, 0, PPC_OPERAND_GPR },
-
-  /* The RA field in an lmw instruction, which has special value
-     restrictions.  */
-#define RAM RAL + 1
-  { 5, 16, insert_ram, 0, PPC_OPERAND_GPR },
-
-  /* The RA field in a D or X form instruction which is an updating
-     store or an updating floating point load, which means that the RA
-     field may not be zero.  */
-#define RAS RAM + 1
-  { 5, 16, insert_ras, 0, PPC_OPERAND_GPR },
-
-  /* The RB field in an X, XO, M, or MDS form instruction.  */
-#define RB RAS + 1
-#define RB_MASK (0x1f << 11)
-  { 5, 11, 0, 0, PPC_OPERAND_GPR },
-
-  /* The RB field in an X form instruction when it must be the same as
-     the RS field in the instruction.  This is used for extended
-     mnemonics like mr.  */
-#define RBS RB + 1
-  { 5, 1, insert_rbs, extract_rbs, PPC_OPERAND_FAKE },
-
-  /* The RS field in a D, DS, X, XFX, XS, M, MD or MDS form
-     instruction or the RT field in a D, DS, X, XFX or XO form
-     instruction.  */
-#define RS RBS + 1
-#define RT RS
-#define RT_MASK (0x1f << 21)
-  { 5, 21, 0, 0, PPC_OPERAND_GPR },
-
-  /* The SH field in an X or M form instruction.  */
-#define SH RS + 1
-#define SH_MASK (0x1f << 11)
-  { 5, 11, 0, 0, 0 },
-
-  /* The SH field in an MD form instruction.  This is split.  */
-#define SH6 SH + 1
-#define SH6_MASK ((0x1f << 11) | (1 << 1))
-  { 6, 1, insert_sh6, extract_sh6, 0 },
-
-  /* The SI field in a D form instruction.  */
-#define SI SH6 + 1
-  { 16, 0, 0, 0, PPC_OPERAND_SIGNED },
-
-  /* The SI field in a D form instruction when we accept a wide range
-     of positive values.  */
-#define SISIGNOPT SI + 1
-  { 16, 0, 0, 0, PPC_OPERAND_SIGNED | PPC_OPERAND_SIGNOPT },
-
-  /* The SPR field in an XFX form instruction.  This is flipped--the
-     lower 5 bits are stored in the upper 5 and vice- versa.  */
-#define SPR SISIGNOPT + 1
-#define SPR_MASK (0x3ff << 11)
-  { 10, 11, insert_spr, extract_spr, 0 },
-
-  /* The BAT index number in an XFX form m[ft]ibat[lu] instruction.  */
-#define SPRBAT SPR + 1
-#define SPRBAT_MASK (0x3 << 17)
-  { 2, 17, 0, 0, 0 },
-
-  /* The SPRG register number in an XFX form m[ft]sprg instruction.  */
-#define SPRG SPRBAT + 1
-#define SPRG_MASK (0x3 << 16)
-  { 2, 16, 0, 0, 0 },
-
-  /* The SR field in an X form instruction.  */
-#define SR SPRG + 1
-  { 4, 16, 0, 0, 0 },
-
-  /* The STRM field in an X AltiVec form instruction.  */
-#define STRM SR + 1
-#define STRM_MASK (0x3 << 21)
-  { 2, 21, 0, 0, 0 },
-
-  /* The SV field in a POWER SC form instruction.  */
-#define SV STRM + 1
-  { 14, 2, 0, 0, 0 },
-
-  /* The TBR field in an XFX form instruction.  This is like the SPR
-     field, but it is optional.  */
-#define TBR SV + 1
-  { 10, 11, insert_tbr, extract_tbr, PPC_OPERAND_OPTIONAL },
-
-  /* The TO field in a D or X form instruction.  */
-#define TO TBR + 1
-#define TO_MASK (0x1f << 21)
-  { 5, 21, 0, 0, 0 },
-
-  /* The U field in an X form instruction.  */
-#define U TO + 1
-  { 4, 12, 0, 0, 0 },
-
-  /* The UI field in a D form instruction.  */
-#define UI U + 1
-  { 16, 0, 0, 0, 0 },
-
-  /* The VA field in a VA, VX or VXR form instruction. */
-#define VA UI + 1
-#define VA_MASK        (0x1f << 16)
-  { 5, 16, 0, 0, PPC_OPERAND_VR },
-
-  /* The VB field in a VA, VX or VXR form instruction. */
-#define VB VA + 1
-#define VB_MASK (0x1f << 11)
-  { 5, 11, 0, 0, PPC_OPERAND_VR },
-
-  /* The VC field in a VA form instruction. */
-#define VC VB + 1
-#define VC_MASK (0x1f << 6)
-  { 5, 6, 0, 0, PPC_OPERAND_VR },
-
-  /* The VD or VS field in a VA, VX, VXR or X form instruction. */
-#define VD VC + 1
-#define VS VD
-#define VD_MASK (0x1f << 21)
-  { 5, 21, 0, 0, PPC_OPERAND_VR },
-
-  /* The SIMM field in a VX form instruction. */
-#define SIMM VD + 1
-  { 5, 16, 0, 0, PPC_OPERAND_SIGNED},
-
-  /* The UIMM field in a VX form instruction. */
-#define UIMM SIMM + 1
-  { 5, 16, 0, 0, 0 },
-
-  /* The SHB field in a VA form instruction. */
-#define SHB UIMM + 1
-  { 4, 6, 0, 0, 0 },
-
-  /* The other UIMM field in a EVX form instruction. */
-#define EVUIMM SHB + 1
-  { 5, 11, 0, 0, 0 },
-
-  /* The other UIMM field in a half word EVX form instruction. */
-#define EVUIMM_2 EVUIMM + 1
-  { 5, 11, insert_ev2, extract_ev2, PPC_OPERAND_PARENS },
-
-  /* The other UIMM field in a word EVX form instruction. */
-#define EVUIMM_4 EVUIMM_2 + 1
-  { 5, 11, insert_ev4, extract_ev4, PPC_OPERAND_PARENS },
-
-  /* The other UIMM field in a double EVX form instruction. */
-#define EVUIMM_8 EVUIMM_4 + 1
-  { 8, 11, insert_ev8, extract_ev8, PPC_OPERAND_PARENS },
-
-  /* The WS field.  */
-#define WS EVUIMM_8 + 1
-#define WS_MASK (0x7 << 11)
-  { 3, 11, 0, 0, 0 },
-
-  /* The L field in an mtmsrd instruction */
-#define MTMSRD_L WS + 1
-  { 1, 16, 0, 0, PPC_OPERAND_OPTIONAL },
-
-};
-
-#define ATTRIBUTE_UNUSED
-
-/* The functions used to insert and extract complicated operands.  */
-
-/* The BA field in an XL form instruction when it must be the same as
-   the BT field in the same instruction.  This operand is marked FAKE.
-   The insertion function just copies the BT field into the BA field,
-   and the extraction function just checks that the fields are the
-   same.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_bat (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value ATTRIBUTE_UNUSED;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | (((insn >> 21) & 0x1f) << 16);
-}
-
-static long
-extract_bat (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid;
-{
-  if (invalid != (int *) NULL
-      && ((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
-    *invalid = 1;
-  return 0;
-}
-
-/* The BB field in an XL form instruction when it must be the same as
-   the BA field in the same instruction.  This operand is marked FAKE.
-   The insertion function just copies the BA field into the BB field,
-   and the extraction function just checks that the fields are the
-   same.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_bba (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value ATTRIBUTE_UNUSED;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | (((insn >> 16) & 0x1f) << 11);
-}
-
-static long
-extract_bba (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid;
-{
-  if (invalid != (int *) NULL
-      && ((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
-    *invalid = 1;
-  return 0;
-}
-
-/* The BD field in a B form instruction.  The lower two bits are
-   forced to zero.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_bd (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | (value & 0xfffc);
-}
-
-/*ARGSUSED*/
-static long
-extract_bd (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
-}
-
-/* The BD field in a B form instruction when the - modifier is used.
-   This modifier means that the branch is not expected to be taken.
-   For chips built to versions of the architecture prior to version 2
-   (ie. not Power4 compatible), we set the y bit of the BO field to 1
-   if the offset is negative.  When extracting, we require that the y
-   bit be 1 and that the offset be positive, since if the y bit is 0
-   we just want to print the normal form of the instruction.
-   Power4 compatible targets use two bits, "a", and "t", instead of
-   the "y" bit.  "at" == 00 => no hint, "at" == 01 => unpredictable,
-   "at" == 10 => not taken, "at" == 11 => taken.  The "t" bit is 00001
-   in BO field, the "a" bit is 00010 for branch on CR(BI) and 01000
-   for branch on CTR.  We only handle the taken/not-taken hint here.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_bdm (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  if ((dialect & PPC_OPCODE_POWER4) == 0)
-    {
-      if ((value & 0x8000) != 0)
-       insn |= 1 << 21;
-    }
-  else
-    {
-      if ((insn & (0x14 << 21)) == (0x04 << 21))
-       insn |= 0x02 << 21;
-      else if ((insn & (0x14 << 21)) == (0x10 << 21))
-       insn |= 0x08 << 21;
-    }
-  return insn | (value & 0xfffc);
-}
-
-static long
-extract_bdm (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect;
-     int *invalid;
-{
-  if (invalid != (int *) NULL)
-    {
-      if ((dialect & PPC_OPCODE_POWER4) == 0)
-       {
-         if (((insn & (1 << 21)) == 0) != ((insn & (1 << 15)) == 0))
-           *invalid = 1;
-       }
-      else
-       {
-         if ((insn & (0x17 << 21)) != (0x06 << 21)
-             && (insn & (0x1d << 21)) != (0x18 << 21))
-           *invalid = 1;
-       }
-    }
-  return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
-}
-
-/* The BD field in a B form instruction when the + modifier is used.
-   This is like BDM, above, except that the branch is expected to be
-   taken.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_bdp (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  if ((dialect & PPC_OPCODE_POWER4) == 0)
-    {
-      if ((value & 0x8000) == 0)
-       insn |= 1 << 21;
-    }
-  else
-    {
-      if ((insn & (0x14 << 21)) == (0x04 << 21))
-       insn |= 0x03 << 21;
-      else if ((insn & (0x14 << 21)) == (0x10 << 21))
-       insn |= 0x09 << 21;
-    }
-  return insn | (value & 0xfffc);
-}
-
-static long
-extract_bdp (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect;
-     int *invalid;
-{
-  if (invalid != (int *) NULL)
-    {
-      if ((dialect & PPC_OPCODE_POWER4) == 0)
-       {
-         if (((insn & (1 << 21)) == 0) == ((insn & (1 << 15)) == 0))
-           *invalid = 1;
-       }
-      else
-       {
-         if ((insn & (0x17 << 21)) != (0x07 << 21)
-             && (insn & (0x1d << 21)) != (0x19 << 21))
-           *invalid = 1;
-       }
-    }
-  return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
-}
-
-/* Check for legal values of a BO field.  */
-
-static int
-valid_bo (value, dialect)
-     long value;
-     int dialect;
-{
-  if ((dialect & PPC_OPCODE_POWER4) == 0)
-    {
-      /* Certain encodings have bits that are required to be zero.
-        These are (z must be zero, y may be anything):
-            001zy
-            011zy
-            1z00y
-            1z01y
-            1z1zz
-      */
-      switch (value & 0x14)
-       {
-       default:
-       case 0:
-         return 1;
-       case 0x4:
-         return (value & 0x2) == 0;
-       case 0x10:
-         return (value & 0x8) == 0;
-       case 0x14:
-         return value == 0x14;
-       }
-    }
-  else
-    {
-      /* Certain encodings have bits that are required to be zero.
-        These are (z must be zero, a & t may be anything):
-            0000z
-            0001z
-            0100z
-            0101z
-            001at
-            011at
-            1a00t
-            1a01t
-            1z1zz
-      */
-      if ((value & 0x14) == 0)
-       return (value & 0x1) == 0;
-      else if ((value & 0x14) == 0x14)
-       return value == 0x14;
-      else
-       return 1;
-    }
-}
-
-/* The BO field in a B form instruction.  Warn about attempts to set
-   the field to an illegal value.  */
-
-static unsigned long
-insert_bo (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect;
-     const char **errmsg;
-{
-  if (errmsg != (const char **) NULL
-      && ! valid_bo (value, dialect))
-    *errmsg = _("invalid conditional option");
-  return insn | ((value & 0x1f) << 21);
-}
-
-static long
-extract_bo (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect;
-     int *invalid;
-{
-  long value;
-
-  value = (insn >> 21) & 0x1f;
-  if (invalid != (int *) NULL
-      && ! valid_bo (value, dialect))
-    *invalid = 1;
-  return value;
-}
-
-/* The BO field in a B form instruction when the + or - modifier is
-   used.  This is like the BO field, but it must be even.  When
-   extracting it, we force it to be even.  */
-
-static unsigned long
-insert_boe (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect;
-     const char **errmsg;
-{
-  if (errmsg != (const char **) NULL)
-    {
-      if (! valid_bo (value, dialect))
-       *errmsg = _("invalid conditional option");
-      else if ((value & 1) != 0)
-       *errmsg = _("attempt to set y bit when using + or - modifier");
-    }
-  return insn | ((value & 0x1f) << 21);
-}
-
-static long
-extract_boe (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect;
-     int *invalid;
-{
-  long value;
-
-  value = (insn >> 21) & 0x1f;
-  if (invalid != (int *) NULL
-      && ! valid_bo (value, dialect))
-    *invalid = 1;
-  return value & 0x1e;
-}
-
-static unsigned long
-insert_ev2 (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char ** errmsg ATTRIBUTE_UNUSED;
-{
-  if ((value & 1) != 0 && errmsg != NULL)
-    *errmsg = _("offset not a multiple of 2");
-  if ((value > 62) != 0 && errmsg != NULL)
-    *errmsg = _("offset greater than 62");
-  return insn | ((value & 0xf8) << 8);
-}
-
-static long
-extract_ev2 (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int * invalid ATTRIBUTE_UNUSED;
-{
-  return (insn >> 8) & 0xf8;
-}
-
-static unsigned long
-insert_ev4 (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char ** errmsg ATTRIBUTE_UNUSED;
-{
-  if ((value & 3) != 0 && errmsg != NULL)
-    *errmsg = _("offset not a multiple of 4");
-  if ((value > 124) != 0 && errmsg != NULL)
-    *errmsg = _("offset greater than 124");
-  return insn | ((value & 0xf8) << 8);
-}
-
-static long
-extract_ev4 (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int * invalid ATTRIBUTE_UNUSED;
-{
-  return (insn >> 8) & 0xf8;
-}
-
-static unsigned long
-insert_ev8 (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char ** errmsg ATTRIBUTE_UNUSED;
-{
-  if ((value & 7) != 0 && errmsg != NULL)
-    *errmsg = _("offset not a multiple of 8");
-  if ((value > 248) != 0 && errmsg != NULL)
-    *errmsg = _("offset greater than 248");
-  return insn | ((value & 0xf8) << 8);
-}
-
-static long
-extract_ev8 (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int * invalid ATTRIBUTE_UNUSED;
-{
-  return (insn >> 8) & 0xf8;
-}
-
-/* The DS field in a DS form instruction.  This is like D, but the
-   lower two bits are forced to zero.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_ds (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  if ((value & 3) != 0 && errmsg != NULL)
-    *errmsg = _("offset not a multiple of 4");
-  return insn | (value & 0xfffc);
-}
-
-/*ARGSUSED*/
-static long
-extract_ds (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
-}
-
-/* The DE field in a DE form instruction.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_de (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  if ((value > 2047 || value < -2048) && errmsg != NULL)
-    *errmsg = _("offset not between -2048 and 2047");
-  return insn | ((value << 4) & 0xfff0);
-}
-
-/*ARGSUSED*/
-static long
-extract_de (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return (insn & 0xfff0) >> 4;
-}
-
-/* The DES field in a DES form instruction.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_des (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  if ((value > 8191 || value < -8192) && errmsg != NULL)
-    *errmsg = _("offset not between -8192 and 8191");
-  else if ((value & 3) != 0 && errmsg != NULL)
-    *errmsg = _("offset not a multiple of 4");
-  return insn | ((value << 2) & 0xfff0);
-}
-
-/*ARGSUSED*/
-static long
-extract_des (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return (((insn >> 2) & 0x3ffc) ^ 0x2000) - 0x2000;
-}
-
-/* The LI field in an I form instruction.  The lower two bits are
-   forced to zero.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_li (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  if ((value & 3) != 0 && errmsg != (const char **) NULL)
-    *errmsg = _("ignoring least significant bits in branch offset");
-  return insn | (value & 0x3fffffc);
-}
-
-/*ARGSUSED*/
-static long
-extract_li (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return ((insn & 0x3fffffc) ^ 0x2000000) - 0x2000000;
-}
-
-/* The MB and ME fields in an M form instruction expressed as a single
-   operand which is itself a bitmask.  The extraction function always
-   marks it as invalid, since we never want to recognize an
-   instruction which uses a field of this type.  */
-
-static unsigned long
-insert_mbe (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  unsigned long uval, mask;
-  int mb, me, mx, count, last;
-
-  uval = value;
-
-  if (uval == 0)
-    {
-      if (errmsg != (const char **) NULL)
-       *errmsg = _("illegal bitmask");
-      return insn;
-    }
-
-  mb = 0;
-  me = 32;
-  if ((uval & 1) != 0)
-    last = 1;
-  else
-    last = 0;
-  count = 0;
-
-  /* mb: location of last 0->1 transition */
-  /* me: location of last 1->0 transition */
-  /* count: # transitions */
-
-  for (mx = 0, mask = (long) 1 << 31; mx < 32; ++mx, mask >>= 1)
-    {
-      if ((uval & mask) && !last)
-       {
-         ++count;
-         mb = mx;
-         last = 1;
-       }
-      else if (!(uval & mask) && last)
-       {
-         ++count;
-         me = mx;
-         last = 0;
-       }
-    }
-  if (me == 0)
-    me = 32;
-
-  if (count != 2 && (count != 0 || ! last))
-    {
-      if (errmsg != (const char **) NULL)
-       *errmsg = _("illegal bitmask");
-    }
-
-  return insn | (mb << 6) | ((me - 1) << 1);
-}
-
-static long
-extract_mbe (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid;
-{
-  long ret;
-  int mb, me;
-  int i;
-
-  if (invalid != (int *) NULL)
-    *invalid = 1;
-
-  mb = (insn >> 6) & 0x1f;
-  me = (insn >> 1) & 0x1f;
-  if (mb < me + 1)
-    {
-      ret = 0;
-      for (i = mb; i <= me; i++)
-       ret |= (long) 1 << (31 - i);
-    }
-  else if (mb == me + 1)
-    ret = ~0;
-  else /* (mb > me + 1) */
-    {
-      ret = ~ (long) 0;
-      for (i = me + 1; i < mb; i++)
-       ret &= ~ ((long) 1 << (31 - i));
-    }
-  return ret;
-}
-
-/* The MB or ME field in an MD or MDS form instruction.  The high bit
-   is wrapped to the low end.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_mb6 (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | ((value & 0x1f) << 6) | (value & 0x20);
-}
-
-/*ARGSUSED*/
-static long
-extract_mb6 (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return ((insn >> 6) & 0x1f) | (insn & 0x20);
-}
-
-/* The NB field in an X form instruction.  The value 32 is stored as
-   0.  */
-
-static unsigned long
-insert_nb (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  if (value < 0 || value > 32)
-    *errmsg = _("value out of range");
-  if (value == 32)
-    value = 0;
-  return insn | ((value & 0x1f) << 11);
-}
-
-/*ARGSUSED*/
-static long
-extract_nb (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  long ret;
-
-  ret = (insn >> 11) & 0x1f;
-  if (ret == 0)
-    ret = 32;
-  return ret;
-}
-
-/* The NSI field in a D form instruction.  This is the same as the SI
-   field, only negated.  The extraction function always marks it as
-   invalid, since we never want to recognize an instruction which uses
-   a field of this type.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_nsi (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | ((- value) & 0xffff);
-}
-
-static long
-extract_nsi (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid;
-{
-  if (invalid != (int *) NULL)
-    *invalid = 1;
-  return - (((insn & 0xffff) ^ 0x8000) - 0x8000);
-}
-
-/* The PMRN field in a X form instruction.
-   This has 5+5 bits switched around.  */
-
-static unsigned long
-insert_pmrn (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | ((value & 0x1f) << 16) | ((value & 0x3e) << 11);
-}
-
-static long
-extract_pmrn (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return ((insn >> 16) & 0x1f) | ((insn >> 11) & 0x3e);
-}
-
-/* The RA field in a D or X form instruction which is an updating
-   load, which means that the RA field may not be zero and may not
-   equal the RT field.  */
-
-static unsigned long
-insert_ral (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  if (value == 0
-      || (unsigned long) value == ((insn >> 21) & 0x1f))
-    *errmsg = "invalid register operand when updating";
-  return insn | ((value & 0x1f) << 16);
-}
-
-/* The RA field in an lmw instruction, which has special value
-   restrictions.  */
-
-static unsigned long
-insert_ram (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  if ((unsigned long) value >= ((insn >> 21) & 0x1f))
-    *errmsg = _("index register in load range");
-  return insn | ((value & 0x1f) << 16);
-}
-
-/* The RA field in a D or X form instruction which is an updating
-   store or an updating floating point load, which means that the RA
-   field may not be zero.  */
-
-static unsigned long
-insert_ras (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg;
-{
-  if (value == 0)
-    *errmsg = _("invalid register operand when updating");
-  return insn | ((value & 0x1f) << 16);
-}
-
-/* The RB field in an X form instruction when it must be the same as
-   the RS field in the instruction.  This is used for extended
-   mnemonics like mr.  This operand is marked FAKE.  The insertion
-   function just copies the BT field into the BA field, and the
-   extraction function just checks that the fields are the same.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_rbs (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value ATTRIBUTE_UNUSED;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | (((insn >> 21) & 0x1f) << 11);
-}
-
-static long
-extract_rbs (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid;
-{
-  if (invalid != (int *) NULL
-      && ((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
-    *invalid = 1;
-  return 0;
-}
-
-/* The SH field in an MD form instruction.  This is split.  */
-
-/*ARGSUSED*/
-static unsigned long
-insert_sh6 (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
-}
-
-/*ARGSUSED*/
-static long
-extract_sh6 (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
-}
-
-/* The SPR field in an XFX form instruction.  This is flipped--the
-   lower 5 bits are stored in the upper 5 and vice- versa.  */
-
-static unsigned long
-insert_spr (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
-}
-
-static long
-extract_spr (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
-}
-
-/* The TBR field in an XFX instruction.  This is just like SPR, but it
-   is optional.  When TBR is omitted, it must be inserted as 268 (the
-   magic number of the TB register).  These functions treat 0
-   (indicating an omitted optional operand) as 268.  This means that
-   ``mftb 4,0'' is not handled correctly.  This does not matter very
-   much, since the architecture manual does not define mftb as
-   accepting any values other than 268 or 269.  */
-
-#define TB (268)
-
-static unsigned long
-insert_tbr (insn, value, dialect, errmsg)
-     unsigned long insn;
-     long value;
-     int dialect ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
-{
-  if (value == 0)
-    value = TB;
-  return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
-}
-
-static long
-extract_tbr (insn, dialect, invalid)
-     unsigned long insn;
-     int dialect ATTRIBUTE_UNUSED;
-     int *invalid ATTRIBUTE_UNUSED;
-{
-  long ret;
-
-  ret = ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
-  if (ret == TB)
-    ret = 0;
-  return ret;
-}
-\f
-/* Macros used to form opcodes.  */
-
-/* The main opcode.  */
-#define OP(x) ((((unsigned long)(x)) & 0x3f) << 26)
-#define OP_MASK OP (0x3f)
-
-/* The main opcode combined with a trap code in the TO field of a D
-   form instruction.  Used for extended mnemonics for the trap
-   instructions.  */
-#define OPTO(x,to) (OP (x) | ((((unsigned long)(to)) & 0x1f) << 21))
-#define OPTO_MASK (OP_MASK | TO_MASK)
-
-/* The main opcode combined with a comparison size bit in the L field
-   of a D form or X form instruction.  Used for extended mnemonics for
-   the comparison instructions.  */
-#define OPL(x,l) (OP (x) | ((((unsigned long)(l)) & 1) << 21))
-#define OPL_MASK OPL (0x3f,1)
-
-/* An A form instruction.  */
-#define A(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1) | (((unsigned long)(rc)) & 1))
-#define A_MASK A (0x3f, 0x1f, 1)
-
-/* An A_MASK with the FRB field fixed.  */
-#define AFRB_MASK (A_MASK | FRB_MASK)
-
-/* An A_MASK with the FRC field fixed.  */
-#define AFRC_MASK (A_MASK | FRC_MASK)
-
-/* An A_MASK with the FRA and FRC fields fixed.  */
-#define AFRAFRC_MASK (A_MASK | FRA_MASK | FRC_MASK)
-
-/* A B form instruction.  */
-#define B(op, aa, lk) (OP (op) | ((((unsigned long)(aa)) & 1) << 1) | ((lk) & 1))
-#define B_MASK B (0x3f, 1, 1)
-
-/* A B form instruction setting the BO field.  */
-#define BBO(op, bo, aa, lk) (B ((op), (aa), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21))
-#define BBO_MASK BBO (0x3f, 0x1f, 1, 1)
-
-/* A BBO_MASK with the y bit of the BO field removed.  This permits
-   matching a conditional branch regardless of the setting of the y
-   bit.  Similarly for the 'at' bits used for power4 branch hints.  */
-#define Y_MASK   (((unsigned long) 1) << 21)
-#define AT1_MASK (((unsigned long) 3) << 21)
-#define AT2_MASK (((unsigned long) 9) << 21)
-#define BBOY_MASK  (BBO_MASK &~ Y_MASK)
-#define BBOAT_MASK (BBO_MASK &~ AT1_MASK)
-
-/* A B form instruction setting the BO field and the condition bits of
-   the BI field.  */
-#define BBOCB(op, bo, cb, aa, lk) \
-  (BBO ((op), (bo), (aa), (lk)) | ((((unsigned long)(cb)) & 0x3) << 16))
-#define BBOCB_MASK BBOCB (0x3f, 0x1f, 0x3, 1, 1)
-
-/* A BBOCB_MASK with the y bit of the BO field removed.  */
-#define BBOYCB_MASK (BBOCB_MASK &~ Y_MASK)
-#define BBOATCB_MASK (BBOCB_MASK &~ AT1_MASK)
-#define BBOAT2CB_MASK (BBOCB_MASK &~ AT2_MASK)
-
-/* A BBOYCB_MASK in which the BI field is fixed.  */
-#define BBOYBI_MASK (BBOYCB_MASK | BI_MASK)
-#define BBOATBI_MASK (BBOAT2CB_MASK | BI_MASK)
-
-/* An Context form instruction.  */
-#define CTX(op, xop)   (OP (op) | (((unsigned long)(xop)) & 0x7))
-#define CTX_MASK       CTX(0x3f, 0x7)
-
-/* An User Context form instruction.  */
-#define UCTX(op, xop)  (OP (op) | (((unsigned long)(xop)) & 0x1f))
-#define UCTX_MASK      UCTX(0x3f, 0x1f)
-
-/* The main opcode mask with the RA field clear.  */
-#define DRA_MASK (OP_MASK | RA_MASK)
-
-/* A DS form instruction.  */
-#define DSO(op, xop) (OP (op) | ((xop) & 0x3))
-#define DS_MASK DSO (0x3f, 3)
-
-/* A DE form instruction.  */
-#define DEO(op, xop) (OP (op) | ((xop) & 0xf))
-#define DE_MASK DEO (0x3e, 0xf)
-
-/* An EVSEL form instruction.  */
-#define EVSEL(op, xop) (OP (op) | (((unsigned long)(xop)) & 0xff) << 3)
-#define EVSEL_MASK EVSEL(0x3f, 0xff)
-
-/* An M form instruction.  */
-#define M(op, rc) (OP (op) | ((rc) & 1))
-#define M_MASK M (0x3f, 1)
-
-/* An M form instruction with the ME field specified.  */
-#define MME(op, me, rc) (M ((op), (rc)) | ((((unsigned long)(me)) & 0x1f) << 1))
-
-/* An M_MASK with the MB and ME fields fixed.  */
-#define MMBME_MASK (M_MASK | MB_MASK | ME_MASK)
-
-/* An M_MASK with the SH and ME fields fixed.  */
-#define MSHME_MASK (M_MASK | SH_MASK | ME_MASK)
-
-/* An MD form instruction.  */
-#define MD(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x7) << 2) | ((rc) & 1))
-#define MD_MASK MD (0x3f, 0x7, 1)
-
-/* An MD_MASK with the MB field fixed.  */
-#define MDMB_MASK (MD_MASK | MB6_MASK)
-
-/* An MD_MASK with the SH field fixed.  */
-#define MDSH_MASK (MD_MASK | SH6_MASK)
-
-/* An MDS form instruction.  */
-#define MDS(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0xf) << 1) | ((rc) & 1))
-#define MDS_MASK MDS (0x3f, 0xf, 1)
-
-/* An MDS_MASK with the MB field fixed.  */
-#define MDSMB_MASK (MDS_MASK | MB6_MASK)
-
-/* An SC form instruction.  */
-#define SC(op, sa, lk) (OP (op) | ((((unsigned long)(sa)) & 1) << 1) | ((lk) & 1))
-#define SC_MASK (OP_MASK | (((unsigned long)0x3ff) << 16) | (((unsigned long)1) << 1) | 1)
-
-/* An VX form instruction. */
-#define VX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7ff))
-
-/* The mask for an VX form instruction. */
-#define VX_MASK        VX(0x3f, 0x7ff)
-
-/* An VA form instruction. */
-#define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x03f))
-
-/* The mask for an VA form instruction. */
-#define VXA_MASK VXA(0x3f, 0x3f)
-
-/* An VXR form instruction. */
-#define VXR(op, xop, rc) (OP (op) | (((rc) & 1) << 10) | (((unsigned long)(xop)) & 0x3ff))
-
-/* The mask for a VXR form instruction. */
-#define VXR_MASK VXR(0x3f, 0x3ff, 1)
-
-/* An X form instruction.  */
-#define X(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1))
-
-/* An X form instruction with the RC bit specified.  */
-#define XRC(op, xop, rc) (X ((op), (xop)) | ((rc) & 1))
-
-/* The mask for an X form instruction.  */
-#define X_MASK XRC (0x3f, 0x3ff, 1)
-
-/* An X_MASK with the RA field fixed.  */
-#define XRA_MASK (X_MASK | RA_MASK)
-
-/* An X_MASK with the RB field fixed.  */
-#define XRB_MASK (X_MASK | RB_MASK)
-
-/* An X_MASK with the RT field fixed.  */
-#define XRT_MASK (X_MASK | RT_MASK)
-
-/* An X_MASK with the RA and RB fields fixed.  */
-#define XRARB_MASK (X_MASK | RA_MASK | RB_MASK)
-
-/* An XRARB_MASK, but with the L bit clear. */
-#define XRLARB_MASK (XRARB_MASK & ~((unsigned long) 1 << 16))
-
-/* An X_MASK with the RT and RA fields fixed.  */
-#define XRTRA_MASK (X_MASK | RT_MASK | RA_MASK)
-
-/* An XRTRA_MASK, but with L bit clear.  */
-#define XRTLRA_MASK (XRTRA_MASK & ~((unsigned long) 1 << 21))
-
-/* An X form comparison instruction.  */
-#define XCMPL(op, xop, l) (X ((op), (xop)) | ((((unsigned long)(l)) & 1) << 21))
-
-/* The mask for an X form comparison instruction.  */
-#define XCMP_MASK (X_MASK | (((unsigned long)1) << 22))
-
-/* The mask for an X form comparison instruction with the L field
-   fixed.  */
-#define XCMPL_MASK (XCMP_MASK | (((unsigned long)1) << 21))
-
-/* An X form trap instruction with the TO field specified.  */
-#define XTO(op, xop, to) (X ((op), (xop)) | ((((unsigned long)(to)) & 0x1f) << 21))
-#define XTO_MASK (X_MASK | TO_MASK)
-
-/* An X form tlb instruction with the SH field specified.  */
-#define XTLB(op, xop, sh) (X ((op), (xop)) | ((((unsigned long)(sh)) & 0x1f) << 11))
-#define XTLB_MASK (X_MASK | SH_MASK)
-
-/* An X form sync instruction.  */
-#define XSYNC(op, xop, l) (X ((op), (xop)) | ((((unsigned long)(l)) & 3) << 21))
-
-/* An X form sync instruction with everything filled in except the LS field.  */
-#define XSYNC_MASK (0xff9fffff)
-
-/* An X form AltiVec dss instruction.  */
-#define XDSS(op, xop, a) (X ((op), (xop)) | ((((unsigned long)(a)) & 1) << 25))
-#define XDSS_MASK XDSS(0x3f, 0x3ff, 1)
-
-/* An XFL form instruction.  */
-#define XFL(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1) | (((unsigned long)(rc)) & 1))
-#define XFL_MASK (XFL (0x3f, 0x3ff, 1) | (((unsigned long)1) << 25) | (((unsigned long)1) << 16))
-
-/* An X form isel instruction.  */
-#define XISEL(op, xop)  (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1))
-#define XISEL_MASK      XISEL(0x3f, 0x1f)
-
-/* An XL form instruction with the LK field set to 0.  */
-#define XL(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1))
-
-/* An XL form instruction which uses the LK field.  */
-#define XLLK(op, xop, lk) (XL ((op), (xop)) | ((lk) & 1))
-
-/* The mask for an XL form instruction.  */
-#define XL_MASK XLLK (0x3f, 0x3ff, 1)
-
-/* An XL form instruction which explicitly sets the BO field.  */
-#define XLO(op, bo, xop, lk) \
-  (XLLK ((op), (xop), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21))
-#define XLO_MASK (XL_MASK | BO_MASK)
-
-/* An XL form instruction which explicitly sets the y bit of the BO
-   field.  */
-#define XLYLK(op, xop, y, lk) (XLLK ((op), (xop), (lk)) | ((((unsigned long)(y)) & 1) << 21))
-#define XLYLK_MASK (XL_MASK | Y_MASK)
-
-/* An XL form instruction which sets the BO field and the condition
-   bits of the BI field.  */
-#define XLOCB(op, bo, cb, xop, lk) \
-  (XLO ((op), (bo), (xop), (lk)) | ((((unsigned long)(cb)) & 3) << 16))
-#define XLOCB_MASK XLOCB (0x3f, 0x1f, 0x3, 0x3ff, 1)
-
-/* An XL_MASK or XLYLK_MASK or XLOCB_MASK with the BB field fixed.  */
-#define XLBB_MASK (XL_MASK | BB_MASK)
-#define XLYBB_MASK (XLYLK_MASK | BB_MASK)
-#define XLBOCBBB_MASK (XLOCB_MASK | BB_MASK)
-
-/* An XL_MASK with the BO and BB fields fixed.  */
-#define XLBOBB_MASK (XL_MASK | BO_MASK | BB_MASK)
-
-/* An XL_MASK with the BO, BI and BB fields fixed.  */
-#define XLBOBIBB_MASK (XL_MASK | BO_MASK | BI_MASK | BB_MASK)
-
-/* An XO form instruction.  */
-#define XO(op, xop, oe, rc) \
-  (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 1) | ((((unsigned long)(oe)) & 1) << 10) | (((unsigned long)(rc)) & 1))
-#define XO_MASK XO (0x3f, 0x1ff, 1, 1)
-
-/* An XO_MASK with the RB field fixed.  */
-#define XORB_MASK (XO_MASK | RB_MASK)
-
-/* An XS form instruction.  */
-#define XS(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 2) | (((unsigned long)(rc)) & 1))
-#define XS_MASK XS (0x3f, 0x1ff, 1)
-
-/* A mask for the FXM version of an XFX form instruction.  */
-#define XFXFXM_MASK (X_MASK | (((unsigned long)1) << 20) | (((unsigned long)1) << 11))
-
-/* An XFX form instruction with the FXM field filled in.  */
-#define XFXM(op, xop, fxm) \
-  (X ((op), (xop)) | ((((unsigned long)(fxm)) & 0xff) << 12))
-
-/* An XFX form instruction with the SPR field filled in.  */
-#define XSPR(op, xop, spr) \
-  (X ((op), (xop)) | ((((unsigned long)(spr)) & 0x1f) << 16) | ((((unsigned long)(spr)) & 0x3e0) << 6))
-#define XSPR_MASK (X_MASK | SPR_MASK)
-
-/* An XFX form instruction with the SPR field filled in except for the
-   SPRBAT field.  */
-#define XSPRBAT_MASK (XSPR_MASK &~ SPRBAT_MASK)
-
-/* An XFX form instruction with the SPR field filled in except for the
-   SPRG field.  */
-#define XSPRG_MASK (XSPR_MASK &~ SPRG_MASK)
-
-/* An X form instruction with everything filled in except the E field.  */
-#define XE_MASK (0xffff7fff)
-
-/* An X form user context instruction.  */
-#define XUC(op, xop)  (OP (op) | (((unsigned long)(xop)) & 0x1f))
-#define XUC_MASK      XUC(0x3f, 0x1f)
-
-/* The BO encodings used in extended conditional branch mnemonics.  */
-#define BODNZF (0x0)
-#define BODNZFP        (0x1)
-#define BODZF  (0x2)
-#define BODZFP (0x3)
-#define BODNZT (0x8)
-#define BODNZTP        (0x9)
-#define BODZT  (0xa)
-#define BODZTP (0xb)
-
-#define BOF    (0x4)
-#define BOFP   (0x5)
-#define BOFM4  (0x6)
-#define BOFP4  (0x7)
-#define BOT    (0xc)
-#define BOTP   (0xd)
-#define BOTM4  (0xe)
-#define BOTP4  (0xf)
-
-#define BODNZ  (0x10)
-#define BODNZP (0x11)
-#define BODZ   (0x12)
-#define BODZP  (0x13)
-#define BODNZM4 (0x18)
-#define BODNZP4 (0x19)
-#define BODZM4 (0x1a)
-#define BODZP4 (0x1b)
-
-#define BOU    (0x14)
-
-/* The BI condition bit encodings used in extended conditional branch
-   mnemonics.  */
-#define CBLT   (0)
-#define CBGT   (1)
-#define CBEQ   (2)
-#define CBSO   (3)
-
-/* The TO encodings used in extended trap mnemonics.  */
-#define TOLGT  (0x1)
-#define TOLLT  (0x2)
-#define TOEQ   (0x4)
-#define TOLGE  (0x5)
-#define TOLNL  (0x5)
-#define TOLLE  (0x6)
-#define TOLNG  (0x6)
-#define TOGT   (0x8)
-#define TOGE   (0xc)
-#define TONL   (0xc)
-#define TOLT   (0x10)
-#define TOLE   (0x14)
-#define TONG   (0x14)
-#define TONE   (0x18)
-#define TOU    (0x1f)
-\f
-/* Smaller names for the flags so each entry in the opcodes table will
-   fit on a single line.  */
-#undef PPC
-#define PPC     PPC_OPCODE_PPC | PPC_OPCODE_ANY
-#define PPCCOM PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_ANY
-#define NOPOWER4 PPC_OPCODE_NOPOWER4 | PPCCOM
-#define POWER4 PPC_OPCODE_POWER4 | PPCCOM
-#define PPC32   PPC_OPCODE_32 | PPC_OPCODE_PPC | PPC_OPCODE_ANY
-#define PPC64   PPC_OPCODE_64 | PPC_OPCODE_PPC | PPC_OPCODE_ANY
-#define PPCONLY        PPC_OPCODE_PPC
-#define PPC403 PPC_OPCODE_403
-#define PPC405 PPC403
-#define PPC750 PPC
-#define PPC860 PPC
-#define PPCVEC PPC_OPCODE_ALTIVEC | PPC_OPCODE_ANY | PPC_OPCODE_PPC
-#define        POWER   PPC_OPCODE_POWER | PPC_OPCODE_ANY
-#define        POWER2  PPC_OPCODE_POWER | PPC_OPCODE_POWER2 | PPC_OPCODE_ANY
-#define PPCPWR2        PPC_OPCODE_PPC | PPC_OPCODE_POWER | PPC_OPCODE_POWER2 | PPC_OPCODE_ANY
-#define        POWER32 PPC_OPCODE_POWER | PPC_OPCODE_ANY | PPC_OPCODE_32
-#define        COM     PPC_OPCODE_POWER | PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_ANY
-#define        COM32   PPC_OPCODE_POWER | PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_ANY | PPC_OPCODE_32
-#define        M601    PPC_OPCODE_POWER | PPC_OPCODE_601 | PPC_OPCODE_ANY
-#define PWRCOM PPC_OPCODE_POWER | PPC_OPCODE_601 | PPC_OPCODE_COMMON | PPC_OPCODE_ANY
-#define        MFDEC1  PPC_OPCODE_POWER
-#define        MFDEC2  PPC_OPCODE_PPC | PPC_OPCODE_601
-#define BOOKE  PPC_OPCODE_BOOKE
-#define BOOKE64        PPC_OPCODE_BOOKE64
-#define CLASSIC        PPC_OPCODE_CLASSIC
-#define PPCSPE PPC_OPCODE_SPE
-#define PPCISEL        PPC_OPCODE_ISEL
-#define PPCEFS PPC_OPCODE_EFS
-#define PPCBRLK        PPC_OPCODE_BRLOCK
-#define PPCPMR PPC_OPCODE_PMR
-#define PPCCHLK        PPC_OPCODE_CACHELCK
-#define PPCRFMCI       PPC_OPCODE_RFMCI
-\f
-/* The opcode table.
-
-   The format of the opcode table is:
-
-   NAME             OPCODE     MASK            FLAGS           { OPERANDS }
-
-   NAME is the name of the instruction.
-   OPCODE is the instruction opcode.
-   MASK is the opcode mask; this is used to tell the disassembler
-     which bits in the actual opcode must match OPCODE.
-   FLAGS are flags indicated what processors support the instruction.
-   OPERANDS is the list of operands.
-
-   The disassembler reads the table in order and prints the first
-   instruction which matches, so this table is sorted to put more
-   specific instructions before more general instructions.  It is also
-   sorted by major opcode.  */
-
-const struct powerpc_opcode powerpc_opcodes[] = {
-{ "tdlgti",  OPTO(2,TOLGT), OPTO_MASK, PPC64,          { RA, SI } },
-{ "tdllti",  OPTO(2,TOLLT), OPTO_MASK, PPC64,          { RA, SI } },
-{ "tdeqi",   OPTO(2,TOEQ), OPTO_MASK,  PPC64,          { RA, SI } },
-{ "tdlgei",  OPTO(2,TOLGE), OPTO_MASK, PPC64,          { RA, SI } },
-{ "tdlnli",  OPTO(2,TOLNL), OPTO_MASK, PPC64,          { RA, SI } },
-{ "tdllei",  OPTO(2,TOLLE), OPTO_MASK, PPC64,          { RA, SI } },
-{ "tdlngi",  OPTO(2,TOLNG), OPTO_MASK, PPC64,          { RA, SI } },
-{ "tdgti",   OPTO(2,TOGT), OPTO_MASK,  PPC64,          { RA, SI } },
-{ "tdgei",   OPTO(2,TOGE), OPTO_MASK,  PPC64,          { RA, SI } },
-{ "tdnli",   OPTO(2,TONL), OPTO_MASK,  PPC64,          { RA, SI } },
-{ "tdlti",   OPTO(2,TOLT), OPTO_MASK,  PPC64,          { RA, SI } },
-{ "tdlei",   OPTO(2,TOLE), OPTO_MASK,  PPC64,          { RA, SI } },
-{ "tdngi",   OPTO(2,TONG), OPTO_MASK,  PPC64,          { RA, SI } },
-{ "tdnei",   OPTO(2,TONE), OPTO_MASK,  PPC64,          { RA, SI } },
-{ "tdi",     OP(2),    OP_MASK,        PPC64,          { TO, RA, SI } },
-
-{ "twlgti",  OPTO(3,TOLGT), OPTO_MASK, PPCCOM,         { RA, SI } },
-{ "tlgti",   OPTO(3,TOLGT), OPTO_MASK, PWRCOM,         { RA, SI } },
-{ "twllti",  OPTO(3,TOLLT), OPTO_MASK, PPCCOM,         { RA, SI } },
-{ "tllti",   OPTO(3,TOLLT), OPTO_MASK, PWRCOM,         { RA, SI } },
-{ "tweqi",   OPTO(3,TOEQ), OPTO_MASK,  PPCCOM,         { RA, SI } },
-{ "teqi",    OPTO(3,TOEQ), OPTO_MASK,  PWRCOM,         { RA, SI } },
-{ "twlgei",  OPTO(3,TOLGE), OPTO_MASK, PPCCOM,         { RA, SI } },
-{ "tlgei",   OPTO(3,TOLGE), OPTO_MASK, PWRCOM,         { RA, SI } },
-{ "twlnli",  OPTO(3,TOLNL), OPTO_MASK, PPCCOM,         { RA, SI } },
-{ "tlnli",   OPTO(3,TOLNL), OPTO_MASK, PWRCOM,         { RA, SI } },
-{ "twllei",  OPTO(3,TOLLE), OPTO_MASK, PPCCOM,         { RA, SI } },
-{ "tllei",   OPTO(3,TOLLE), OPTO_MASK, PWRCOM,         { RA, SI } },
-{ "twlngi",  OPTO(3,TOLNG), OPTO_MASK, PPCCOM,         { RA, SI } },
-{ "tlngi",   OPTO(3,TOLNG), OPTO_MASK, PWRCOM,         { RA, SI } },
-{ "twgti",   OPTO(3,TOGT), OPTO_MASK,  PPCCOM,         { RA, SI } },
-{ "tgti",    OPTO(3,TOGT), OPTO_MASK,  PWRCOM,         { RA, SI } },
-{ "twgei",   OPTO(3,TOGE), OPTO_MASK,  PPCCOM,         { RA, SI } },
-{ "tgei",    OPTO(3,TOGE), OPTO_MASK,  PWRCOM,         { RA, SI } },
-{ "twnli",   OPTO(3,TONL), OPTO_MASK,  PPCCOM,         { RA, SI } },
-{ "tnli",    OPTO(3,TONL), OPTO_MASK,  PWRCOM,         { RA, SI } },
-{ "twlti",   OPTO(3,TOLT), OPTO_MASK,  PPCCOM,         { RA, SI } },
-{ "tlti",    OPTO(3,TOLT), OPTO_MASK,  PWRCOM,         { RA, SI } },
-{ "twlei",   OPTO(3,TOLE), OPTO_MASK,  PPCCOM,         { RA, SI } },
-{ "tlei",    OPTO(3,TOLE), OPTO_MASK,  PWRCOM,         { RA, SI } },
-{ "twngi",   OPTO(3,TONG), OPTO_MASK,  PPCCOM,         { RA, SI } },
-{ "tngi",    OPTO(3,TONG), OPTO_MASK,  PWRCOM,         { RA, SI } },
-{ "twnei",   OPTO(3,TONE), OPTO_MASK,  PPCCOM,         { RA, SI } },
-{ "tnei",    OPTO(3,TONE), OPTO_MASK,  PWRCOM,         { RA, SI } },
-{ "twi",     OP(3),    OP_MASK,        PPCCOM,         { TO, RA, SI } },
-{ "ti",      OP(3),    OP_MASK,        PWRCOM,         { TO, RA, SI } },
-
-{ "macchw",    XO(4,172,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchw.",   XO(4,172,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwo",   XO(4,172,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwo.",  XO(4,172,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchws",   XO(4,236,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchws.",  XO(4,236,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwso",  XO(4,236,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwso.", XO(4,236,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwsu",  XO(4,204,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwsu.", XO(4,204,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwsuo", XO(4,204,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwsuo.",        XO(4,204,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwu",   XO(4,140,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwu.",  XO(4,140,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwuo",  XO(4,140,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "macchwuo.", XO(4,140,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhw",    XO(4,44,0,0),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhw.",   XO(4,44,0,1),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwo",   XO(4,44,1,0),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwo.",  XO(4,44,1,1),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhws",   XO(4,108,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhws.",  XO(4,108,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwso",  XO(4,108,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwso.", XO(4,108,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwsu",  XO(4,76,0,0),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwsu.", XO(4,76,0,1),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwsuo", XO(4,76,1,0),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwsuo.",        XO(4,76,1,1),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwu",   XO(4,12,0,0),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwu.",  XO(4,12,0,1),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwuo",  XO(4,12,1,0),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "machhwuo.", XO(4,12,1,1),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhw",    XO(4,428,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhw.",   XO(4,428,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwo",   XO(4,428,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwo.",  XO(4,428,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhws",   XO(4,492,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhws.",  XO(4,492,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwso",  XO(4,492,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwso.", XO(4,492,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwsu",  XO(4,460,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwsu.", XO(4,460,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwsuo", XO(4,460,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwsuo.",        XO(4,460,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwu",   XO(4,396,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwu.",  XO(4,396,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwuo",  XO(4,396,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "maclhwuo.", XO(4,396,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "mulchw",    XRC(4,168,0),  X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mulchw.",   XRC(4,168,1),  X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mulchwu",   XRC(4,136,0),  X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mulchwu.",  XRC(4,136,1),  X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mulhhw",    XRC(4,40,0),   X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mulhhw.",   XRC(4,40,1),   X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mulhhwu",   XRC(4,8,0),    X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mulhhwu.",  XRC(4,8,1),    X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mullhw",    XRC(4,424,0),  X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mullhw.",   XRC(4,424,1),  X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mullhwu",   XRC(4,392,0),  X_MASK,  PPC405,         { RT, RA, RB } },
-{ "mullhwu.",  XRC(4,392,1),  X_MASK,  PPC405,         { RT, RA, RB } },
-{ "nmacchw",   XO(4,174,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmacchw.",  XO(4,174,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmacchwo",  XO(4,174,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmacchwo.", XO(4,174,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmacchws",  XO(4,238,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmacchws.", XO(4,238,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmacchwso", XO(4,238,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmacchwso.",        XO(4,238,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmachhw",   XO(4,46,0,0),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmachhw.",  XO(4,46,0,1),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmachhwo",  XO(4,46,1,0),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmachhwo.", XO(4,46,1,1),  XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmachhws",  XO(4,110,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmachhws.", XO(4,110,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmachhwso", XO(4,110,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmachhwso.",        XO(4,110,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmaclhw",   XO(4,430,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmaclhw.",  XO(4,430,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmaclhwo",  XO(4,430,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmaclhwo.", XO(4,430,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmaclhws",  XO(4,494,0,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmaclhws.", XO(4,494,0,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmaclhwso", XO(4,494,1,0), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "nmaclhwso.",        XO(4,494,1,1), XO_MASK, PPC405,         { RT, RA, RB } },
-{ "mfvscr",  VX(4, 1540), VX_MASK,     PPCVEC,         { VD } },
-{ "mtvscr",  VX(4, 1604), VX_MASK,     PPCVEC,         { VB } },
-{ "vaddcuw", VX(4,  384), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vaddfp",  VX(4,   10), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vaddsbs", VX(4,  768), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vaddshs", VX(4,  832), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vaddsws", VX(4,  896), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vaddubm", VX(4,    0), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vaddubs", VX(4,  512), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vadduhm", VX(4,   64), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vadduhs", VX(4,  576), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vadduwm", VX(4,  128), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vadduws", VX(4,  640), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vand",    VX(4, 1028), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vandc",   VX(4, 1092), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vavgsb",  VX(4, 1282), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vavgsh",  VX(4, 1346), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vavgsw",  VX(4, 1410), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vavgub",  VX(4, 1026), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vavguh",  VX(4, 1090), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vavguw",  VX(4, 1154), VX_MASK,     PPCVEC,         { VD, VA, VB } },
-{ "vcfsx",   VX(4,  842), VX_MASK,     PPCVEC,         { VD, VB, UIMM } },
-{ "vcfux",   VX(4,  778), VX_MASK,     PPCVEC,         { VD, VB, UIMM } },
-{ "vcmpbfp",   VXR(4, 966, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpbfp.",  VXR(4, 966, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpeqfp",  VXR(4, 198, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpeqfp.", VXR(4, 198, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpequb",  VXR(4,   6, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpequb.", VXR(4,   6, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpequh",  VXR(4,  70, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpequh.", VXR(4,  70, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpequw",  VXR(4, 134, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpequw.", VXR(4, 134, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgefp",  VXR(4, 454, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgefp.", VXR(4, 454, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtfp",  VXR(4, 710, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtfp.", VXR(4, 710, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtsb",  VXR(4, 774, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtsb.", VXR(4, 774, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtsh",  VXR(4, 838, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtsh.", VXR(4, 838, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtsw",  VXR(4, 902, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtsw.", VXR(4, 902, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtub",  VXR(4, 518, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtub.", VXR(4, 518, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtuh",  VXR(4, 582, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtuh.", VXR(4, 582, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtuw",  VXR(4, 646, 0), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vcmpgtuw.", VXR(4, 646, 1), VXR_MASK, PPCVEC,       { VD, VA, VB } },
-{ "vctsxs",    VX(4,  970), VX_MASK,   PPCVEC,         { VD, VB, UIMM } },
-{ "vctuxs",    VX(4,  906), VX_MASK,   PPCVEC,         { VD, VB, UIMM } },
-{ "vexptefp",  VX(4,  394), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vlogefp",   VX(4,  458), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vmaddfp",   VXA(4,  46), VXA_MASK,  PPCVEC,         { VD, VA, VC, VB } },
-{ "vmaxfp",    VX(4, 1034), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmaxsb",    VX(4,  258), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmaxsh",    VX(4,  322), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmaxsw",    VX(4,  386), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmaxub",    VX(4,    2), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmaxuh",    VX(4,   66), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmaxuw",    VX(4,  130), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmhaddshs", VXA(4,  32), VXA_MASK,  PPCVEC,         { VD, VA, VB, VC } },
-{ "vmhraddshs", VXA(4, 33), VXA_MASK,  PPCVEC,         { VD, VA, VB, VC } },
-{ "vminfp",    VX(4, 1098), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vminsb",    VX(4,  770), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vminsh",    VX(4,  834), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vminsw",    VX(4,  898), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vminub",    VX(4,  514), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vminuh",    VX(4,  578), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vminuw",    VX(4,  642), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmladduhm", VXA(4,  34), VXA_MASK,  PPCVEC,         { VD, VA, VB, VC } },
-{ "vmrghb",    VX(4,   12), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmrghh",    VX(4,   76), VX_MASK,    PPCVEC,                { VD, VA, VB } },
-{ "vmrghw",    VX(4,  140), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmrglb",    VX(4,  268), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmrglh",    VX(4,  332), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmrglw",    VX(4,  396), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmsummbm",  VXA(4,  37), VXA_MASK,  PPCVEC,         { VD, VA, VB, VC } },
-{ "vmsumshm",  VXA(4,  40), VXA_MASK,  PPCVEC,         { VD, VA, VB, VC } },
-{ "vmsumshs",  VXA(4,  41), VXA_MASK,  PPCVEC,         { VD, VA, VB, VC } },
-{ "vmsumubm",  VXA(4,  36), VXA_MASK,   PPCVEC,                { VD, VA, VB, VC } },
-{ "vmsumuhm",  VXA(4,  38), VXA_MASK,   PPCVEC,                { VD, VA, VB, VC } },
-{ "vmsumuhs",  VXA(4,  39), VXA_MASK,   PPCVEC,                { VD, VA, VB, VC } },
-{ "vmulesb",   VX(4,  776), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmulesh",   VX(4,  840), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmuleub",   VX(4,  520), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmuleuh",   VX(4,  584), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmulosb",   VX(4,  264), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmulosh",   VX(4,  328), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmuloub",   VX(4,    8), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vmulouh",   VX(4,   72), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vnmsubfp",  VXA(4,  47), VXA_MASK,  PPCVEC,         { VD, VA, VC, VB } },
-{ "vnor",      VX(4, 1284), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vor",       VX(4, 1156), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vperm",     VXA(4,  43), VXA_MASK,  PPCVEC,         { VD, VA, VB, VC } },
-{ "vpkpx",     VX(4,  782), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vpkshss",   VX(4,  398), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vpkshus",   VX(4,  270), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vpkswss",   VX(4,  462), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vpkswus",   VX(4,  334), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vpkuhum",   VX(4,   14), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vpkuhus",   VX(4,  142), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vpkuwum",   VX(4,   78), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vpkuwus",   VX(4,  206), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vrefp",     VX(4,  266), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vrfim",     VX(4,  714), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vrfin",     VX(4,  522), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vrfip",     VX(4,  650), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vrfiz",     VX(4,  586), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vrlb",      VX(4,    4), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vrlh",      VX(4,   68), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vrlw",      VX(4,  132), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vrsqrtefp", VX(4,  330), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vsel",      VXA(4,  42), VXA_MASK,  PPCVEC,         { VD, VA, VB, VC } },
-{ "vsl",       VX(4,  452), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vslb",      VX(4,  260), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsldoi",    VXA(4,  44), VXA_MASK,  PPCVEC,         { VD, VA, VB, SHB } },
-{ "vslh",      VX(4,  324), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vslo",      VX(4, 1036), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vslw",      VX(4,  388), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vspltb",    VX(4,  524), VX_MASK,   PPCVEC,         { VD, VB, UIMM } },
-{ "vsplth",    VX(4,  588), VX_MASK,   PPCVEC,         { VD, VB, UIMM } },
-{ "vspltisb",  VX(4,  780), VX_MASK,   PPCVEC,         { VD, SIMM } },
-{ "vspltish",  VX(4,  844), VX_MASK,   PPCVEC,         { VD, SIMM } },
-{ "vspltisw",  VX(4,  908), VX_MASK,   PPCVEC,         { VD, SIMM } },
-{ "vspltw",    VX(4,  652), VX_MASK,   PPCVEC,         { VD, VB, UIMM } },
-{ "vsr",       VX(4,  708), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsrab",     VX(4,  772), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsrah",     VX(4,  836), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsraw",     VX(4,  900), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsrb",      VX(4,  516), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsrh",      VX(4,  580), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsro",      VX(4, 1100), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsrw",      VX(4,  644), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubcuw",   VX(4, 1408), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubfp",    VX(4,   74), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubsbs",   VX(4, 1792), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubshs",   VX(4, 1856), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubsws",   VX(4, 1920), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsububm",   VX(4, 1024), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsububs",   VX(4, 1536), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubuhm",   VX(4, 1088), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubuhs",   VX(4, 1600), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubuwm",   VX(4, 1152), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsubuws",   VX(4, 1664), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsumsws",   VX(4, 1928), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsum2sws",  VX(4, 1672), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsum4sbs",  VX(4, 1800), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsum4shs",  VX(4, 1608), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vsum4ubs",  VX(4, 1544), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-{ "vupkhpx",   VX(4,  846), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vupkhsb",   VX(4,  526), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vupkhsh",   VX(4,  590), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vupklpx",   VX(4,  974), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vupklsb",   VX(4,  654), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vupklsh",   VX(4,  718), VX_MASK,   PPCVEC,         { VD, VB } },
-{ "vxor",      VX(4, 1220), VX_MASK,   PPCVEC,         { VD, VA, VB } },
-
-{ "evaddw",    VX(4, 512), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evaddiw",   VX(4, 514), VX_MASK,    PPCSPE,         { RD, RB, UIMM } },
-{ "evsubfw",   VX(4, 516), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evsubifw",  VX(4, 518), VX_MASK,    PPCSPE,         { RD, UIMM, RB } },
-{ "evabs",     VX(4, 520), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evneg",     VX(4, 521), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evextsb",   VX(4, 522), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evextsh",   VX(4, 523), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evrndw",    VX(4, 524), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evcntlzw",  VX(4, 525), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evcntlsw",  VX(4, 526), VX_MASK,    PPCSPE,         { RD, RA } },
-
-{ "brinc",     VX(4, 527), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-
-{ "evand",     VX(4, 529), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evandc",    VX(4, 530), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evor",      VX(4, 535), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evorc",     VX(4, 539), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evxor",     VX(4, 534), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "eveqv",     VX(4, 537), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evnand",    VX(4, 542), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evnor",     VX(4, 536), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-
-{ "evrlw",     VX(4, 552), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evrlwi",    VX(4, 554), VX_MASK,    PPCSPE,         { RD, RA, EVUIMM } },
-{ "evslw",     VX(4, 548), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evslwi",    VX(4, 550), VX_MASK,    PPCSPE,         { RD, RA, EVUIMM } },
-{ "evsrws",    VX(4, 545), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evsrwu",    VX(4, 544), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evsrwis",   VX(4, 547), VX_MASK,    PPCSPE,         { RD, RA, EVUIMM } },
-{ "evsrwiu",   VX(4, 546), VX_MASK,    PPCSPE,         { RD, RA, EVUIMM } },
-{ "evsplati",  VX(4, 553), VX_MASK,    PPCSPE,         { RD, SIMM } },
-{ "evsplatfi", VX(4, 555), VX_MASK,    PPCSPE,         { RD, SIMM } },
-{ "evmergehi", VX(4, 556), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evmergelo", VX(4, 557), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evmergehilo",VX(4,558), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evmergelohi",VX(4,559), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-
-{ "evcmpgts",  VX(4, 561), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evcmpgtu",  VX(4, 560), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evcmplts",  VX(4, 563), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evcmpltu",  VX(4, 562), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evcmpeq",   VX(4, 564), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evsel",     EVSEL(4,79),EVSEL_MASK, PPCSPE,         { RD, RA, RB, CRFS } },
-
-{ "evldd",     VX(4, 769), VX_MASK,    PPCSPE,         { RS, EVUIMM_8, RA } },
-{ "evlddx",    VX(4, 768), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evldw",     VX(4, 771), VX_MASK,    PPCSPE,         { RS, EVUIMM_8, RA } },
-{ "evldwx",    VX(4, 770), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evldh",     VX(4, 773), VX_MASK,    PPCSPE,         { RS, EVUIMM_8, RA } },
-{ "evldhx",    VX(4, 772), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evlwhe",    VX(4, 785), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evlwhex",   VX(4, 784), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evlwhou",   VX(4, 789), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evlwhoux",  VX(4, 788), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evlwhos",   VX(4, 791), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evlwhosx",  VX(4, 790), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evlwwsplat",VX(4, 793), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evlwwsplatx",VX(4, 792), VX_MASK,   PPCSPE,         { RS, RA, RB } },
-{ "evlwhsplat",VX(4, 797), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evlwhsplatx",VX(4, 796), VX_MASK,   PPCSPE,         { RS, RA, RB } },
-{ "evlhhesplat",VX(4, 777), VX_MASK,   PPCSPE,         { RS, EVUIMM_2, RA } },
-{ "evlhhesplatx",VX(4, 776), VX_MASK,  PPCSPE,         { RS, RA, RB } },
-{ "evlhhousplat",VX(4, 781), VX_MASK,  PPCSPE,         { RS, EVUIMM_2, RA } },
-{ "evlhhousplatx",VX(4, 780), VX_MASK, PPCSPE,         { RS, RA, RB } },
-{ "evlhhossplat",VX(4, 783), VX_MASK,  PPCSPE,         { RS, EVUIMM_2, RA } },
-{ "evlhhossplatx",VX(4, 782), VX_MASK, PPCSPE,         { RS, RA, RB } },
-
-{ "evstdd",    VX(4, 801), VX_MASK,    PPCSPE,         { RS, EVUIMM_8, RA } },
-{ "evstddx",   VX(4, 800), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evstdw",    VX(4, 803), VX_MASK,    PPCSPE,         { RS, EVUIMM_8, RA } },
-{ "evstdwx",   VX(4, 802), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evstdh",    VX(4, 805), VX_MASK,    PPCSPE,         { RS, EVUIMM_8, RA } },
-{ "evstdhx",   VX(4, 804), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evstwwe",   VX(4, 825), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evstwwex",  VX(4, 824), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evstwwo",   VX(4, 829), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evstwwox",  VX(4, 828), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evstwhe",   VX(4, 817), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evstwhex",  VX(4, 816), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-{ "evstwho",   VX(4, 821), VX_MASK,    PPCSPE,         { RS, EVUIMM_4, RA } },
-{ "evstwhox",  VX(4, 820), VX_MASK,    PPCSPE,         { RS, RA, RB } },
-
-{ "evfsabs",   VX(4, 644), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evfsnabs",  VX(4, 645), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evfsneg",   VX(4, 656), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evfsadd",   VX(4, 640), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evfssub",   VX(4, 641), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evfsmul",   VX(4, 648), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evfsdiv",   VX(4, 649), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evfscmpgt", VX(4, 652), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evfscmplt", VX(4, 653), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evfscmpeq", VX(4, 654), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evfststgt", VX(4, 668), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evfststlt", VX(4, 669), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evfststeq", VX(4, 670), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evfscfui",  VX(4, 656), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfsctuiz", VX(4, 664), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfscfsi",  VX(4, 657), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfscfuf",  VX(4, 658), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfscfsf",  VX(4, 659), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfsctui",  VX(4, 660), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfsctsi",  VX(4, 661), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfsctsiz", VX(4, 666), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfsctuf",  VX(4, 662), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evfsctsf",  VX(4, 663), VX_MASK,    PPCSPE,         { RD, RB } },
-
-{ "efsabs",   VX(4, 708), VX_MASK,     PPCEFS,         { RD, RA } },
-{ "efsnabs",  VX(4, 709), VX_MASK,     PPCEFS,         { RD, RA } },
-{ "efsneg",   VX(4, 710), VX_MASK,     PPCEFS,         { RD, RA } },
-{ "efsadd",   VX(4, 704), VX_MASK,     PPCEFS,         { RD, RA, RB } },
-{ "efssub",   VX(4, 705), VX_MASK,     PPCEFS,         { RD, RA, RB } },
-{ "efsmul",   VX(4, 712), VX_MASK,     PPCEFS,         { RD, RA, RB } },
-{ "efsdiv",   VX(4, 713), VX_MASK,     PPCEFS,         { RD, RA, RB } },
-{ "efscmpgt", VX(4, 716), VX_MASK,     PPCEFS,         { CRFD, RA, RB } },
-{ "efscmplt", VX(4, 717), VX_MASK,     PPCEFS,         { CRFD, RA, RB } },
-{ "efscmpeq", VX(4, 718), VX_MASK,     PPCEFS,         { CRFD, RA, RB } },
-{ "efststgt", VX(4, 732), VX_MASK,     PPCEFS,         { CRFD, RA, RB } },
-{ "efststlt", VX(4, 733), VX_MASK,     PPCEFS,         { CRFD, RA, RB } },
-{ "efststeq", VX(4, 734), VX_MASK,     PPCEFS,         { CRFD, RA, RB } },
-{ "efscfui",  VX(4, 720), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efsctuiz", VX(4, 728), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efscfsi",  VX(4, 721), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efscfuf",  VX(4, 722), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efscfsf",  VX(4, 723), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efsctui",  VX(4, 724), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efsctsi",  VX(4, 725), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efsctsiz", VX(4, 730), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efsctuf",  VX(4, 726), VX_MASK,     PPCEFS,         { RD, RB } },
-{ "efsctsf",  VX(4, 727), VX_MASK,     PPCEFS,         { RD, RB } },
-
-{ "evsabs",    VX(4, 708), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evsnabs",   VX(4, 709), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evsneg",    VX(4, 710), VX_MASK,    PPCSPE,         { RD, RA } },
-{ "evsadd",    VX(4, 704), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evssub",    VX(4, 705), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evsmul",    VX(4, 712), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evsdiv",    VX(4, 713), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evscmpgt",  VX(4, 716), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evsgmplt",  VX(4, 717), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evsgmpeq",  VX(4, 718), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evststgt",  VX(4, 732), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evststlt",  VX(4, 733), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evststeq",  VX(4, 734), VX_MASK,    PPCSPE,         { CRFD, RA, RB } },
-{ "evscfui",   VX(4, 720), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evscfsi",   VX(4, 721), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evscfuf",   VX(4, 722), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evscfsf",   VX(4, 723), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evsctui",   VX(4, 724), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evsctuiz",  VX(4, 728), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evsctsi",   VX(4, 725), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evsctsiz",  VX(4, 730), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evsctuf",   VX(4, 726), VX_MASK,    PPCSPE,         { RD, RB } },
-{ "evsctsf",   VX(4, 727), VX_MASK,    PPCSPE,         { RD, RB } },
-
-{ "evmhossf",  VX(4, 1031), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhossfa", VX(4, 1063), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhosmf",  VX(4, 1039), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhosmfa", VX(4, 1071), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhosmi",  VX(4, 1037), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhosmia", VX(4, 1069), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhoumi",  VX(4, 1036), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhoumia", VX(4, 1068), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhessf",  VX(4, 1027), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhessfa", VX(4, 1059), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhesmf",  VX(4, 1035), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhesmfa", VX(4, 1067), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhesmi",  VX(4, 1033), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmhesmia", VX(4, 1065), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmheumi",  VX(4, 1032), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmheumia", VX(4, 1064), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-
-{ "evmhossfaaw",VX(4, 1287), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhossiaaw",VX(4, 1285), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhosmfaaw",VX(4, 1295), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhosmiaaw",VX(4, 1293), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhousiaaw",VX(4, 1284), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhoumiaaw",VX(4, 1292), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhessfaaw",VX(4, 1283), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhessiaaw",VX(4, 1281), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhesmfaaw",VX(4, 1291), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhesmiaaw",VX(4, 1289), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmheusiaaw",VX(4, 1280), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmheumiaaw",VX(4, 1288), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-
-{ "evmhossfanw",VX(4, 1415), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhossianw",VX(4, 1413), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhosmfanw",VX(4, 1423), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhosmianw",VX(4, 1421), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhousianw",VX(4, 1412), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhoumianw",VX(4, 1420), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhessfanw",VX(4, 1411), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhessianw",VX(4, 1409), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhesmfanw",VX(4, 1419), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhesmianw",VX(4, 1417), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmheusianw",VX(4, 1408), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmheumianw",VX(4, 1416), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-
-{ "evmhogsmfaa",VX(4, 1327), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhogsmiaa",VX(4, 1325), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhogumiaa",VX(4, 1324), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhegsmfaa",VX(4, 1323), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhegsmiaa",VX(4, 1321), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhegumiaa",VX(4, 1320), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-
-{ "evmhogsmfan",VX(4, 1455), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhogsmian",VX(4, 1453), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhogumian",VX(4, 1452), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhegsmfan",VX(4, 1451), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhegsmian",VX(4, 1449), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmhegumian",VX(4, 1448), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-
-{ "evmwhssf",  VX(4, 1095), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhssfa", VX(4, 1127), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhsmf",  VX(4, 1103), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhsmfa", VX(4, 1135), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhsmi",  VX(4, 1101), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhsmia", VX(4, 1133), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhumi",  VX(4, 1100), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhumia", VX(4, 1132), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-
-{ "evmwlssf",  VX(4, 1091), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwlssfa", VX(4, 1123), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwlsmf",  VX(4, 1099), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwlsmfa", VX(4, 1131), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwlumi",  VX(4, 1096), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwlumia", VX(4, 1128), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-
-{ "evmwhssfaa",VX(4, 1351), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhssmaa",VX(4, 1349), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhsmfaa",VX(4, 1359), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhsmiaa",VX(4, 1357), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhusiaa",VX(4, 1348), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhumiaa",VX(4, 1356), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-
-{ "evmwlssfaaw",VX(4, 1347), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlssiaaw",VX(4, 1345), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlsmfaaw",VX(4, 1355), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlsmiaaw",VX(4, 1353), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlusiaaw",VX(4, 1344), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlumiaaw",VX(4, 1352), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-
-{ "evmwhssfan",VX(4, 1479), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhssian",VX(4, 1477), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhsmfan",VX(4, 1487), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhsmian",VX(4, 1485), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhusian",VX(4, 1476), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwhumian",VX(4, 1484), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-
-{ "evmwlssfanw",VX(4, 1475), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlssianw",VX(4, 1473), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlsmfanw",VX(4, 1483), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlsmianw",VX(4, 1481), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlusianw",VX(4, 1472), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwlumianw",VX(4, 1480), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-
-{ "evmwhgssfaa",VX(4, 1383), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwhgsmfaa",VX(4, 1391), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwhgsmiaa",VX(4, 1381), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwhgumiaa",VX(4, 1380), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-
-{ "evmwhgssfan",VX(4, 1511), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwhgsmfan",VX(4, 1519), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwhgsmian",VX(4, 1509), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-{ "evmwhgumian",VX(4, 1508), VX_MASK,  PPCSPE,         { RD, RA, RB } },
-
-{ "evmwssf",   VX(4, 1107), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwssfa",  VX(4, 1139), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwsmf",   VX(4, 1115), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwsmfa",  VX(4, 1147), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwsmi",   VX(4, 1113), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwsmia",  VX(4, 1145), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwumi",   VX(4, 1112), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwumia",  VX(4, 1144), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-
-{ "evmwssfaa", VX(4, 1363), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwsmfaa", VX(4, 1371), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwsmiaa", VX(4, 1369), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwumiaa", VX(4, 1368), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-
-{ "evmwssfan", VX(4, 1491), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwsmfan", VX(4, 1499), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwsmian", VX(4, 1497), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-{ "evmwumian", VX(4, 1496), VX_MASK,   PPCSPE,         { RD, RA, RB } },
-
-{ "evaddssiaaw",VX(4, 1217), VX_MASK,  PPCSPE,         { RD, RA } },
-{ "evaddsmiaaw",VX(4, 1225), VX_MASK,  PPCSPE,         { RD, RA } },
-{ "evaddusiaaw",VX(4, 1216), VX_MASK,  PPCSPE,         { RD, RA } },
-{ "evaddumiaaw",VX(4, 1224), VX_MASK,  PPCSPE,         { RD, RA } },
-
-{ "evsubfssiaaw",VX(4, 1219), VX_MASK, PPCSPE,         { RD, RA } },
-{ "evsubfsmiaaw",VX(4, 1227), VX_MASK, PPCSPE,         { RD, RA } },
-{ "evsubfusiaaw",VX(4, 1218), VX_MASK, PPCSPE,         { RD, RA } },
-{ "evsubfumiaaw",VX(4, 1226), VX_MASK, PPCSPE,         { RD, RA } },
-
-{ "evmra",    VX(4, 1220), VX_MASK,    PPCSPE,         { RD, RA } },
-
-{ "evdivws",  VX(4, 1222), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-{ "evdivwu",  VX(4, 1223), VX_MASK,    PPCSPE,         { RD, RA, RB } },
-
-{ "mulli",   OP(7),    OP_MASK,        PPCCOM,         { RT, RA, SI } },
-{ "muli",    OP(7),    OP_MASK,        PWRCOM,         { RT, RA, SI } },
-
-{ "subfic",  OP(8),    OP_MASK,        PPCCOM,         { RT, RA, SI } },
-{ "sfi",     OP(8),    OP_MASK,        PWRCOM,         { RT, RA, SI } },
-
-{ "dozi",    OP(9),    OP_MASK,        M601,           { RT, RA, SI } },
-
-{ "bce",     B(9,0,0), B_MASK,         BOOKE64,        { BO, BI, BD } },
-{ "bcel",    B(9,0,1), B_MASK,         BOOKE64,        { BO, BI, BD } },
-{ "bcea",    B(9,1,0), B_MASK,         BOOKE64,        { BO, BI, BDA } },
-{ "bcela",   B(9,1,1), B_MASK,         BOOKE64,        { BO, BI, BDA } },
-
-{ "cmplwi",  OPL(10,0),        OPL_MASK,       PPCCOM,         { OBF, RA, UI } },
-{ "cmpldi",  OPL(10,1), OPL_MASK,      PPC64,          { OBF, RA, UI } },
-{ "cmpli",   OP(10),   OP_MASK,        PPCONLY,        { BF, L, RA, UI } },
-{ "cmpli",   OP(10),   OP_MASK,        PWRCOM,         { BF, RA, UI } },
-
-{ "cmpwi",   OPL(11,0),        OPL_MASK,       PPCCOM,         { OBF, RA, SI } },
-{ "cmpdi",   OPL(11,1),        OPL_MASK,       PPC64,          { OBF, RA, SI } },
-{ "cmpi",    OP(11),   OP_MASK,        PPCONLY,        { BF, L, RA, SI } },
-{ "cmpi",    OP(11),   OP_MASK,        PWRCOM,         { BF, RA, SI } },
-
-{ "addic",   OP(12),   OP_MASK,        PPCCOM,         { RT, RA, SI } },
-{ "ai",             OP(12),    OP_MASK,        PWRCOM,         { RT, RA, SI } },
-{ "subic",   OP(12),   OP_MASK,        PPCCOM,         { RT, RA, NSI } },
-
-{ "addic.",  OP(13),   OP_MASK,        PPCCOM,         { RT, RA, SI } },
-{ "ai.",     OP(13),   OP_MASK,        PWRCOM,         { RT, RA, SI } },
-{ "subic.",  OP(13),   OP_MASK,        PPCCOM,         { RT, RA, NSI } },
-
-{ "li",             OP(14),    DRA_MASK,       PPCCOM,         { RT, SI } },
-{ "lil",     OP(14),   DRA_MASK,       PWRCOM,         { RT, SI } },
-{ "addi",    OP(14),   OP_MASK,        PPCCOM,         { RT, RA, SI } },
-{ "cal",     OP(14),   OP_MASK,        PWRCOM,         { RT, D, RA } },
-{ "subi",    OP(14),   OP_MASK,        PPCCOM,         { RT, RA, NSI } },
-{ "la",             OP(14),    OP_MASK,        PPCCOM,         { RT, D, RA } },
-
-{ "lis",     OP(15),   DRA_MASK,       PPCCOM,         { RT, SISIGNOPT } },
-{ "liu",     OP(15),   DRA_MASK,       PWRCOM,         { RT, SISIGNOPT } },
-{ "addis",   OP(15),   OP_MASK,        PPCCOM,         { RT,RA,SISIGNOPT } },
-{ "cau",     OP(15),   OP_MASK,        PWRCOM,         { RT,RA,SISIGNOPT } },
-{ "subis",   OP(15),   OP_MASK,        PPCCOM,         { RT, RA, NSI } },
-
-{ "bdnz-",   BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM,  { BDM } },
-{ "bdnz+",   BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM,  { BDP } },
-{ "bdnz",    BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM,  { BD } },
-{ "bdn",     BBO(16,BODNZ,0,0), BBOATBI_MASK, PWRCOM,  { BD } },
-{ "bdnzl-",  BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM,  { BDM } },
-{ "bdnzl+",  BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM,  { BDP } },
-{ "bdnzl",   BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM,  { BD } },
-{ "bdnl",    BBO(16,BODNZ,0,1), BBOATBI_MASK, PWRCOM,  { BD } },
-{ "bdnza-",  BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM,  { BDMA } },
-{ "bdnza+",  BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM,  { BDPA } },
-{ "bdnza",   BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM,  { BDA } },
-{ "bdna",    BBO(16,BODNZ,1,0), BBOATBI_MASK, PWRCOM,  { BDA } },
-{ "bdnzla-", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM,  { BDMA } },
-{ "bdnzla+", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM,  { BDPA } },
-{ "bdnzla",  BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM,  { BDA } },
-{ "bdnla",   BBO(16,BODNZ,1,1), BBOATBI_MASK, PWRCOM,  { BDA } },
-{ "bdz-",    BBO(16,BODZ,0,0),  BBOATBI_MASK, PPCCOM,  { BDM } },
-{ "bdz+",    BBO(16,BODZ,0,0),  BBOATBI_MASK, PPCCOM,  { BDP } },
-{ "bdz",     BBO(16,BODZ,0,0),  BBOATBI_MASK, COM,     { BD } },
-{ "bdzl-",   BBO(16,BODZ,0,1),  BBOATBI_MASK, PPCCOM,  { BDM } },
-{ "bdzl+",   BBO(16,BODZ,0,1),  BBOATBI_MASK, PPCCOM,  { BDP } },
-{ "bdzl",    BBO(16,BODZ,0,1),  BBOATBI_MASK, COM,     { BD } },
-{ "bdza-",   BBO(16,BODZ,1,0),  BBOATBI_MASK, PPCCOM,  { BDMA } },
-{ "bdza+",   BBO(16,BODZ,1,0),  BBOATBI_MASK, PPCCOM,  { BDPA } },
-{ "bdza",    BBO(16,BODZ,1,0),  BBOATBI_MASK, COM,     { BDA } },
-{ "bdzla-",  BBO(16,BODZ,1,1),  BBOATBI_MASK, PPCCOM,  { BDMA } },
-{ "bdzla+",  BBO(16,BODZ,1,1),  BBOATBI_MASK, PPCCOM,  { BDPA } },
-{ "bdzla",   BBO(16,BODZ,1,1),  BBOATBI_MASK, COM,     { BDA } },
-{ "blt-",    BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "blt+",    BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "blt",     BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bltl-",   BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bltl+",   BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bltl",    BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "blta-",   BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "blta+",   BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "blta",    BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bltla-",  BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bltla+",  BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bltla",   BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bgt-",    BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bgt+",    BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bgt",     BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bgtl-",   BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bgtl+",   BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bgtl",    BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bgta-",   BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bgta+",   BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bgta",    BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bgtla-",  BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bgtla+",  BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bgtla",   BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "beq-",    BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "beq+",    BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "beq",     BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "beql-",   BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "beql+",   BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "beql",    BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "beqa-",   BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "beqa+",   BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "beqa",    BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "beqla-",  BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "beqla+",  BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "beqla",   BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bso-",    BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bso+",    BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bso",     BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bsol-",   BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bsol+",   BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bsol",    BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bsoa-",   BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bsoa+",   BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bsoa",    BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bsola-",  BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bsola+",  BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bsola",   BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bun-",    BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bun+",    BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bun",     BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BD } },
-{ "bunl-",   BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bunl+",   BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bunl",    BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BD } },
-{ "buna-",   BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "buna+",   BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "buna",    BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDA } },
-{ "bunla-",  BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bunla+",  BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bunla",   BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDA } },
-{ "bge-",    BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bge+",    BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bge",     BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bgel-",   BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bgel+",   BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bgel",    BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bgea-",   BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bgea+",   BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bgea",    BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bgela-",  BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bgela+",  BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bgela",   BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bnl-",    BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bnl+",    BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bnl",     BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bnll-",   BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bnll+",   BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bnll",    BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bnla-",   BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnla+",   BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnla",    BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bnlla-",  BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnlla+",  BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnlla",   BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "ble-",    BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "ble+",    BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "ble",     BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "blel-",   BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "blel+",   BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "blel",    BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "blea-",   BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "blea+",   BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "blea",    BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "blela-",  BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "blela+",  BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "blela",   BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bng-",    BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bng+",    BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bng",     BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bngl-",   BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bngl+",   BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bngl",    BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bnga-",   BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnga+",   BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnga",    BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bngla-",  BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bngla+",  BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bngla",   BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bne-",    BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bne+",    BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bne",     BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bnel-",   BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bnel+",   BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bnel",    BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bnea-",   BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnea+",   BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnea",    BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bnela-",  BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnela+",  BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnela",   BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bns-",    BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bns+",    BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bns",     BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bnsl-",   BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bnsl+",   BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bnsl",    BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, COM,                { CR, BD } },
-{ "bnsa-",   BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnsa+",   BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnsa",    BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bnsla-",  BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnsla+",  BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnsla",   BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, COM,                { CR, BDA } },
-{ "bnu-",    BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bnu+",    BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bnu",     BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,     { CR, BD } },
-{ "bnul-",   BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDM } },
-{ "bnul+",   BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BDP } },
-{ "bnul",    BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,     { CR, BD } },
-{ "bnua-",   BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnua+",   BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnua",    BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,     { CR, BDA } },
-{ "bnula-",  BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDMA } },
-{ "bnula+",  BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDPA } },
-{ "bnula",   BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,     { CR, BDA } },
-{ "bdnzt-",  BBO(16,BODNZT,0,0), BBOY_MASK, NOPOWER4,  { BI, BDM } },
-{ "bdnzt+",  BBO(16,BODNZT,0,0), BBOY_MASK, NOPOWER4,  { BI, BDP } },
-{ "bdnzt",   BBO(16,BODNZT,0,0), BBOY_MASK, PPCCOM,    { BI, BD } },
-{ "bdnztl-", BBO(16,BODNZT,0,1), BBOY_MASK, NOPOWER4,  { BI, BDM } },
-{ "bdnztl+", BBO(16,BODNZT,0,1), BBOY_MASK, NOPOWER4,  { BI, BDP } },
-{ "bdnztl",  BBO(16,BODNZT,0,1), BBOY_MASK, PPCCOM,    { BI, BD } },
-{ "bdnzta-", BBO(16,BODNZT,1,0), BBOY_MASK, NOPOWER4,  { BI, BDMA } },
-{ "bdnzta+", BBO(16,BODNZT,1,0), BBOY_MASK, NOPOWER4,  { BI, BDPA } },
-{ "bdnzta",  BBO(16,BODNZT,1,0), BBOY_MASK, PPCCOM,    { BI, BDA } },
-{ "bdnztla-",BBO(16,BODNZT,1,1), BBOY_MASK, NOPOWER4,  { BI, BDMA } },
-{ "bdnztla+",BBO(16,BODNZT,1,1), BBOY_MASK, NOPOWER4,  { BI, BDPA } },
-{ "bdnztla", BBO(16,BODNZT,1,1), BBOY_MASK, PPCCOM,    { BI, BDA } },
-{ "bdnzf-",  BBO(16,BODNZF,0,0), BBOY_MASK, NOPOWER4,  { BI, BDM } },
-{ "bdnzf+",  BBO(16,BODNZF,0,0), BBOY_MASK, NOPOWER4,  { BI, BDP } },
-{ "bdnzf",   BBO(16,BODNZF,0,0), BBOY_MASK, PPCCOM,    { BI, BD } },
-{ "bdnzfl-", BBO(16,BODNZF,0,1), BBOY_MASK, NOPOWER4,  { BI, BDM } },
-{ "bdnzfl+", BBO(16,BODNZF,0,1), BBOY_MASK, NOPOWER4,  { BI, BDP } },
-{ "bdnzfl",  BBO(16,BODNZF,0,1), BBOY_MASK, PPCCOM,    { BI, BD } },
-{ "bdnzfa-", BBO(16,BODNZF,1,0), BBOY_MASK, NOPOWER4,  { BI, BDMA } },
-{ "bdnzfa+", BBO(16,BODNZF,1,0), BBOY_MASK, NOPOWER4,  { BI, BDPA } },
-{ "bdnzfa",  BBO(16,BODNZF,1,0), BBOY_MASK, PPCCOM,    { BI, BDA } },
-{ "bdnzfla-",BBO(16,BODNZF,1,1), BBOY_MASK, NOPOWER4,  { BI, BDMA } },
-{ "bdnzfla+",BBO(16,BODNZF,1,1), BBOY_MASK, NOPOWER4,  { BI, BDPA } },
-{ "bdnzfla", BBO(16,BODNZF,1,1), BBOY_MASK, PPCCOM,    { BI, BDA } },
-{ "bt-",     BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM,      { BI, BDM } },
-{ "bt+",     BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM,      { BI, BDP } },
-{ "bt",             BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM,       { BI, BD } },
-{ "bbt",     BBO(16,BOT,0,0), BBOAT_MASK, PWRCOM,      { BI, BD } },
-{ "btl-",    BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM,      { BI, BDM } },
-{ "btl+",    BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM,      { BI, BDP } },
-{ "btl",     BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM,      { BI, BD } },
-{ "bbtl",    BBO(16,BOT,0,1), BBOAT_MASK, PWRCOM,      { BI, BD } },
-{ "bta-",    BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM,      { BI, BDMA } },
-{ "bta+",    BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM,      { BI, BDPA } },
-{ "bta",     BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM,      { BI, BDA } },
-{ "bbta",    BBO(16,BOT,1,0), BBOAT_MASK, PWRCOM,      { BI, BDA } },
-{ "btla-",   BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM,      { BI, BDMA } },
-{ "btla+",   BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM,      { BI, BDPA } },
-{ "btla",    BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM,      { BI, BDA } },
-{ "bbtla",   BBO(16,BOT,1,1), BBOAT_MASK, PWRCOM,      { BI, BDA } },
-{ "bf-",     BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM,      { BI, BDM } },
-{ "bf+",     BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM,      { BI, BDP } },
-{ "bf",             BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM,       { BI, BD } },
-{ "bbf",     BBO(16,BOF,0,0), BBOAT_MASK, PWRCOM,      { BI, BD } },
-{ "bfl-",    BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM,      { BI, BDM } },
-{ "bfl+",    BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM,      { BI, BDP } },
-{ "bfl",     BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM,      { BI, BD } },
-{ "bbfl",    BBO(16,BOF,0,1), BBOAT_MASK, PWRCOM,      { BI, BD } },
-{ "bfa-",    BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM,      { BI, BDMA } },
-{ "bfa+",    BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM,      { BI, BDPA } },
-{ "bfa",     BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM,      { BI, BDA } },
-{ "bbfa",    BBO(16,BOF,1,0), BBOAT_MASK, PWRCOM,      { BI, BDA } },
-{ "bfla-",   BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM,      { BI, BDMA } },
-{ "bfla+",   BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM,      { BI, BDPA } },
-{ "bfla",    BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM,      { BI, BDA } },
-{ "bbfla",   BBO(16,BOF,1,1), BBOAT_MASK, PWRCOM,      { BI, BDA } },
-{ "bdzt-",   BBO(16,BODZT,0,0), BBOY_MASK, NOPOWER4,   { BI, BDM } },
-{ "bdzt+",   BBO(16,BODZT,0,0), BBOY_MASK, NOPOWER4,   { BI, BDP } },
-{ "bdzt",    BBO(16,BODZT,0,0), BBOY_MASK, PPCCOM,     { BI, BD } },
-{ "bdztl-",  BBO(16,BODZT,0,1), BBOY_MASK, NOPOWER4,   { BI, BDM } },
-{ "bdztl+",  BBO(16,BODZT,0,1), BBOY_MASK, NOPOWER4,   { BI, BDP } },
-{ "bdztl",   BBO(16,BODZT,0,1), BBOY_MASK, PPCCOM,     { BI, BD } },
-{ "bdzta-",  BBO(16,BODZT,1,0), BBOY_MASK, NOPOWER4,   { BI, BDMA } },
-{ "bdzta+",  BBO(16,BODZT,1,0), BBOY_MASK, NOPOWER4,   { BI, BDPA } },
-{ "bdzta",   BBO(16,BODZT,1,0), BBOY_MASK, PPCCOM,     { BI, BDA } },
-{ "bdztla-", BBO(16,BODZT,1,1), BBOY_MASK, NOPOWER4,   { BI, BDMA } },
-{ "bdztla+", BBO(16,BODZT,1,1), BBOY_MASK, NOPOWER4,   { BI, BDPA } },
-{ "bdztla",  BBO(16,BODZT,1,1), BBOY_MASK, PPCCOM,     { BI, BDA } },
-{ "bdzf-",   BBO(16,BODZF,0,0), BBOY_MASK, NOPOWER4,   { BI, BDM } },
-{ "bdzf+",   BBO(16,BODZF,0,0), BBOY_MASK, NOPOWER4,   { BI, BDP } },
-{ "bdzf",    BBO(16,BODZF,0,0), BBOY_MASK, PPCCOM,     { BI, BD } },
-{ "bdzfl-",  BBO(16,BODZF,0,1), BBOY_MASK, NOPOWER4,   { BI, BDM } },
-{ "bdzfl+",  BBO(16,BODZF,0,1), BBOY_MASK, NOPOWER4,   { BI, BDP } },
-{ "bdzfl",   BBO(16,BODZF,0,1), BBOY_MASK, PPCCOM,     { BI, BD } },
-{ "bdzfa-",  BBO(16,BODZF,1,0), BBOY_MASK, NOPOWER4,   { BI, BDMA } },
-{ "bdzfa+",  BBO(16,BODZF,1,0), BBOY_MASK, NOPOWER4,   { BI, BDPA } },
-{ "bdzfa",   BBO(16,BODZF,1,0), BBOY_MASK, PPCCOM,     { BI, BDA } },
-{ "bdzfla-", BBO(16,BODZF,1,1), BBOY_MASK, NOPOWER4,   { BI, BDMA } },
-{ "bdzfla+", BBO(16,BODZF,1,1), BBOY_MASK, NOPOWER4,   { BI, BDPA } },
-{ "bdzfla",  BBO(16,BODZF,1,1), BBOY_MASK, PPCCOM,     { BI, BDA } },
-{ "bc-",     B(16,0,0),        B_MASK,         PPCCOM,         { BOE, BI, BDM } },
-{ "bc+",     B(16,0,0),        B_MASK,         PPCCOM,         { BOE, BI, BDP } },
-{ "bc",             B(16,0,0), B_MASK,         COM,            { BO, BI, BD } },
-{ "bcl-",    B(16,0,1),        B_MASK,         PPCCOM,         { BOE, BI, BDM } },
-{ "bcl+",    B(16,0,1),        B_MASK,         PPCCOM,         { BOE, BI, BDP } },
-{ "bcl",     B(16,0,1),        B_MASK,         COM,            { BO, BI, BD } },
-{ "bca-",    B(16,1,0),        B_MASK,         PPCCOM,         { BOE, BI, BDMA } },
-{ "bca+",    B(16,1,0),        B_MASK,         PPCCOM,         { BOE, BI, BDPA } },
-{ "bca",     B(16,1,0),        B_MASK,         COM,            { BO, BI, BDA } },
-{ "bcla-",   B(16,1,1),        B_MASK,         PPCCOM,         { BOE, BI, BDMA } },
-{ "bcla+",   B(16,1,1),        B_MASK,         PPCCOM,         { BOE, BI, BDPA } },
-{ "bcla",    B(16,1,1),        B_MASK,         COM,            { BO, BI, BDA } },
-
-{ "sc",      SC(17,1,0), 0xffffffff,   PPC,            { 0 } },
-{ "svc",     SC(17,0,0), SC_MASK,      POWER,          { LEV, FL1, FL2 } },
-{ "svcl",    SC(17,0,1), SC_MASK,      POWER,          { LEV, FL1, FL2 } },
-{ "svca",    SC(17,1,0), SC_MASK,      PWRCOM,         { SV } },
-{ "svcla",   SC(17,1,1), SC_MASK,      POWER,          { SV } },
-
-{ "b",      B(18,0,0), B_MASK,         COM,            { LI } },
-{ "bl",      B(18,0,1),        B_MASK,         COM,            { LI } },
-{ "ba",      B(18,1,0),        B_MASK,         COM,            { LIA } },
-{ "bla",     B(18,1,1),        B_MASK,         COM,            { LIA } },
-
-{ "mcrf",    XL(19,0), XLBB_MASK|(3<<21)|(3<<16), COM, { BF, BFA } },
-
-{ "blr",     XLO(19,BOU,16,0), XLBOBIBB_MASK, PPCCOM,  { 0 } },
-{ "br",      XLO(19,BOU,16,0), XLBOBIBB_MASK, PWRCOM,  { 0 } },
-{ "blrl",    XLO(19,BOU,16,1), XLBOBIBB_MASK, PPCCOM,  { 0 } },
-{ "brl",     XLO(19,BOU,16,1), XLBOBIBB_MASK, PWRCOM,  { 0 } },
-{ "bdnzlr",  XLO(19,BODNZ,16,0), XLBOBIBB_MASK, PPCCOM,        { 0 } },
-{ "bdnzlr-", XLO(19,BODNZ,16,0), XLBOBIBB_MASK, NOPOWER4,      { 0 } },
-{ "bdnzlr+", XLO(19,BODNZP,16,0), XLBOBIBB_MASK, NOPOWER4,     { 0 } },
-{ "bdnzlr-", XLO(19,BODNZM4,16,0), XLBOBIBB_MASK, POWER4,      { 0 } },
-{ "bdnzlr+", XLO(19,BODNZP4,16,0), XLBOBIBB_MASK, POWER4,      { 0 } },
-{ "bdnzlrl", XLO(19,BODNZ,16,1), XLBOBIBB_MASK, PPCCOM,        { 0 } },
-{ "bdnzlrl-",XLO(19,BODNZ,16,1), XLBOBIBB_MASK, NOPOWER4,      { 0 } },
-{ "bdnzlrl+",XLO(19,BODNZP,16,1), XLBOBIBB_MASK, NOPOWER4,     { 0 } },
-{ "bdnzlrl-",XLO(19,BODNZM4,16,1), XLBOBIBB_MASK, POWER4,      { 0 } },
-{ "bdnzlrl+",XLO(19,BODNZP4,16,1), XLBOBIBB_MASK, POWER4,      { 0 } },
-{ "bdzlr",   XLO(19,BODZ,16,0), XLBOBIBB_MASK, PPCCOM, { 0 } },
-{ "bdzlr-",  XLO(19,BODZ,16,0), XLBOBIBB_MASK, NOPOWER4,       { 0 } },
-{ "bdzlr+",  XLO(19,BODZP,16,0), XLBOBIBB_MASK, NOPOWER4,      { 0 } },
-{ "bdzlr-",  XLO(19,BODZM4,16,0), XLBOBIBB_MASK, POWER4,       { 0 } },
-{ "bdzlr+",  XLO(19,BODZP4,16,0), XLBOBIBB_MASK, POWER4,       { 0 } },
-{ "bdzlrl",  XLO(19,BODZ,16,1), XLBOBIBB_MASK, PPCCOM, { 0 } },
-{ "bdzlrl-", XLO(19,BODZ,16,1), XLBOBIBB_MASK, NOPOWER4,       { 0 } },
-{ "bdzlrl+", XLO(19,BODZP,16,1), XLBOBIBB_MASK, NOPOWER4,      { 0 } },
-{ "bdzlrl-", XLO(19,BODZM4,16,1), XLBOBIBB_MASK, POWER4,       { 0 } },
-{ "bdzlrl+", XLO(19,BODZP4,16,1), XLBOBIBB_MASK, POWER4,       { 0 } },
-{ "bltlr",   XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bltlr-",  XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bltlr+",  XLOCB(19,BOTP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bltlr-",  XLOCB(19,BOTM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bltlr+",  XLOCB(19,BOTP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bltr",    XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bltlrl",  XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bltlrl-", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bltlrl+", XLOCB(19,BOTP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bltlrl-", XLOCB(19,BOTM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bltlrl+", XLOCB(19,BOTP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bltrl",   XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bgtlr",   XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bgtlr-",  XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgtlr+",  XLOCB(19,BOTP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgtlr-",  XLOCB(19,BOTM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgtlr+",  XLOCB(19,BOTP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgtr",    XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bgtlrl",  XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bgtlrl-", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgtlrl+", XLOCB(19,BOTP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgtlrl-", XLOCB(19,BOTM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgtlrl+", XLOCB(19,BOTP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgtrl",   XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "beqlr",   XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "beqlr-",  XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "beqlr+",  XLOCB(19,BOTP,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "beqlr-",  XLOCB(19,BOTM4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "beqlr+",  XLOCB(19,BOTP4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "beqr",    XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "beqlrl",  XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "beqlrl-", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "beqlrl+", XLOCB(19,BOTP,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "beqlrl-", XLOCB(19,BOTM4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "beqlrl+", XLOCB(19,BOTP4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "beqrl",   XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bsolr",   XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bsolr-",  XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bsolr+",  XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bsolr-",  XLOCB(19,BOTM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bsolr+",  XLOCB(19,BOTP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bsor",    XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bsolrl",  XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bsolrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bsolrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bsolrl-", XLOCB(19,BOTM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bsolrl+", XLOCB(19,BOTP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bsorl",   XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bunlr",   XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bunlr-",  XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bunlr+",  XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bunlr-",  XLOCB(19,BOTM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bunlr+",  XLOCB(19,BOTP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bunlrl",  XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bunlrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bunlrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bunlrl-", XLOCB(19,BOTM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bunlrl+", XLOCB(19,BOTP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgelr",   XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bgelr-",  XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgelr+",  XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgelr-",  XLOCB(19,BOFM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgelr+",  XLOCB(19,BOFP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bger",    XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bgelrl",  XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bgelrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgelrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgelrl-", XLOCB(19,BOFM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgelrl+", XLOCB(19,BOFP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgerl",   XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnllr",   XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnllr-",  XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnllr+",  XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnllr-",  XLOCB(19,BOFM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnllr+",  XLOCB(19,BOFP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnlr",    XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnllrl",  XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnllrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnllrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnllrl-", XLOCB(19,BOFM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnllrl+", XLOCB(19,BOFP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnlrl",   XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "blelr",   XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "blelr-",  XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "blelr+",  XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "blelr-",  XLOCB(19,BOFM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "blelr+",  XLOCB(19,BOFP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bler",    XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "blelrl",  XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "blelrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "blelrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "blelrl-", XLOCB(19,BOFM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "blelrl+", XLOCB(19,BOFP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "blerl",   XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnglr",   XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnglr-",  XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnglr+",  XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnglr-",  XLOCB(19,BOFM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnglr+",  XLOCB(19,BOFP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bngr",    XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnglrl",  XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnglrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnglrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnglrl-", XLOCB(19,BOFM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnglrl+", XLOCB(19,BOFP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bngrl",   XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnelr",   XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnelr-",  XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnelr+",  XLOCB(19,BOFP,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnelr-",  XLOCB(19,BOFM4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnelr+",  XLOCB(19,BOFP4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bner",    XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnelrl",  XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnelrl-", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnelrl+", XLOCB(19,BOFP,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnelrl-", XLOCB(19,BOFM4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnelrl+", XLOCB(19,BOFP4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnerl",   XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnslr",   XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnslr-",  XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnslr+",  XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnslr-",  XLOCB(19,BOFM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnslr+",  XLOCB(19,BOFP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnsr",    XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnslrl",  XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnslrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnslrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnslrl-", XLOCB(19,BOFM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnslrl+", XLOCB(19,BOFP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnsrl",   XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
-{ "bnulr",   XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnulr-",  XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnulr+",  XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnulr-",  XLOCB(19,BOFM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnulr+",  XLOCB(19,BOFP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnulrl",  XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnulrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnulrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnulrl-", XLOCB(19,BOFM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnulrl+", XLOCB(19,BOFP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "btlr",    XLO(19,BOT,16,0), XLBOBB_MASK, PPCCOM,    { BI } },
-{ "btlr-",   XLO(19,BOT,16,0), XLBOBB_MASK, NOPOWER4,  { BI } },
-{ "btlr+",   XLO(19,BOTP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "btlr-",   XLO(19,BOTM4,16,0), XLBOBB_MASK, POWER4,  { BI } },
-{ "btlr+",   XLO(19,BOTP4,16,0), XLBOBB_MASK, POWER4,  { BI } },
-{ "bbtr",    XLO(19,BOT,16,0), XLBOBB_MASK, PWRCOM,    { BI } },
-{ "btlrl",   XLO(19,BOT,16,1), XLBOBB_MASK, PPCCOM,    { BI } },
-{ "btlrl-",  XLO(19,BOT,16,1), XLBOBB_MASK, NOPOWER4,  { BI } },
-{ "btlrl+",  XLO(19,BOTP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "btlrl-",  XLO(19,BOTM4,16,1), XLBOBB_MASK, POWER4,  { BI } },
-{ "btlrl+",  XLO(19,BOTP4,16,1), XLBOBB_MASK, POWER4,  { BI } },
-{ "bbtrl",   XLO(19,BOT,16,1), XLBOBB_MASK, PWRCOM,    { BI } },
-{ "bflr",    XLO(19,BOF,16,0), XLBOBB_MASK, PPCCOM,    { BI } },
-{ "bflr-",   XLO(19,BOF,16,0), XLBOBB_MASK, NOPOWER4,  { BI } },
-{ "bflr+",   XLO(19,BOFP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bflr-",   XLO(19,BOFM4,16,0), XLBOBB_MASK, POWER4,  { BI } },
-{ "bflr+",   XLO(19,BOFP4,16,0), XLBOBB_MASK, POWER4,  { BI } },
-{ "bbfr",    XLO(19,BOF,16,0), XLBOBB_MASK, PWRCOM,    { BI } },
-{ "bflrl",   XLO(19,BOF,16,1), XLBOBB_MASK, PPCCOM,    { BI } },
-{ "bflrl-",  XLO(19,BOF,16,1), XLBOBB_MASK, NOPOWER4,  { BI } },
-{ "bflrl+",  XLO(19,BOFP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bflrl-",  XLO(19,BOFM4,16,1), XLBOBB_MASK, POWER4,  { BI } },
-{ "bflrl+",  XLO(19,BOFP4,16,1), XLBOBB_MASK, POWER4,  { BI } },
-{ "bbfrl",   XLO(19,BOF,16,1), XLBOBB_MASK, PWRCOM,    { BI } },
-{ "bdnztlr", XLO(19,BODNZT,16,0), XLBOBB_MASK, PPCCOM, { BI } },
-{ "bdnztlr-",XLO(19,BODNZT,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdnztlr+",XLO(19,BODNZTP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdnztlrl",XLO(19,BODNZT,16,1), XLBOBB_MASK, PPCCOM, { BI } },
-{ "bdnztlrl-",XLO(19,BODNZT,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdnztlrl+",XLO(19,BODNZTP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdnzflr", XLO(19,BODNZF,16,0), XLBOBB_MASK, PPCCOM, { BI } },
-{ "bdnzflr-",XLO(19,BODNZF,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdnzflr+",XLO(19,BODNZFP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdnzflrl",XLO(19,BODNZF,16,1), XLBOBB_MASK, PPCCOM, { BI } },
-{ "bdnzflrl-",XLO(19,BODNZF,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdnzflrl+",XLO(19,BODNZFP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdztlr",  XLO(19,BODZT,16,0), XLBOBB_MASK, PPCCOM,  { BI } },
-{ "bdztlr-", XLO(19,BODZT,16,0), XLBOBB_MASK, NOPOWER4,        { BI } },
-{ "bdztlr+", XLO(19,BODZTP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdztlrl", XLO(19,BODZT,16,1), XLBOBB_MASK, PPCCOM,  { BI } },
-{ "bdztlrl-",XLO(19,BODZT,16,1), XLBOBB_MASK, NOPOWER4,        { BI } },
-{ "bdztlrl+",XLO(19,BODZTP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdzflr",  XLO(19,BODZF,16,0), XLBOBB_MASK, PPCCOM,  { BI } },
-{ "bdzflr-", XLO(19,BODZF,16,0), XLBOBB_MASK, NOPOWER4,        { BI } },
-{ "bdzflr+", XLO(19,BODZFP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bdzflrl", XLO(19,BODZF,16,1), XLBOBB_MASK, PPCCOM,  { BI } },
-{ "bdzflrl-",XLO(19,BODZF,16,1), XLBOBB_MASK, NOPOWER4,        { BI } },
-{ "bdzflrl+",XLO(19,BODZFP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bclr",    XLLK(19,16,0), XLYBB_MASK,        PPCCOM,         { BO, BI } },
-{ "bclrl",   XLLK(19,16,1), XLYBB_MASK,        PPCCOM,         { BO, BI } },
-{ "bclr+",   XLYLK(19,16,1,0), XLYBB_MASK, PPCCOM,     { BOE, BI } },
-{ "bclrl+",  XLYLK(19,16,1,1), XLYBB_MASK, PPCCOM,     { BOE, BI } },
-{ "bclr-",   XLYLK(19,16,0,0), XLYBB_MASK, PPCCOM,     { BOE, BI } },
-{ "bclrl-",  XLYLK(19,16,0,1), XLYBB_MASK, PPCCOM,     { BOE, BI } },
-{ "bcr",     XLLK(19,16,0), XLBB_MASK, PWRCOM,         { BO, BI } },
-{ "bcrl",    XLLK(19,16,1), XLBB_MASK, PWRCOM,         { BO, BI } },
-{ "bclre",   XLLK(19,17,0), XLBB_MASK, BOOKE64,        { BO, BI } },
-{ "bclrel",  XLLK(19,17,1), XLBB_MASK, BOOKE64,        { BO, BI } },
-
-{ "rfid",    XL(19,18),        0xffffffff,     PPC64,          { 0 } },
-
-{ "crnot",   XL(19,33), XL_MASK,       PPCCOM,         { BT, BA, BBA } },
-{ "crnor",   XL(19,33),        XL_MASK,        COM,            { BT, BA, BB } },
-{ "rfmci",    X(19,38),  0xffffffff,   PPCRFMCI,       { 0 } },
-
-
-{ "rfi",     XL(19,50),        0xffffffff,     COM,            { 0 } },
-{ "rfci",    XL(19,51),        0xffffffff,     PPC403,         { 0 } },
-{ "rfci",    XL(19,51),        0xffffffff,     BOOKE,          { 0 } },
-
-{ "rfsvc",   XL(19,82),        0xffffffff,     POWER,          { 0 } },
-
-{ "crandc",  XL(19,129), XL_MASK,      COM,            { BT, BA, BB } },
-
-{ "isync",   XL(19,150), 0xffffffff,   PPCCOM,         { 0 } },
-{ "ics",     XL(19,150), 0xffffffff,   PWRCOM,         { 0 } },
-
-{ "crclr",   XL(19,193), XL_MASK,      PPCCOM,         { BT, BAT, BBA } },
-{ "crxor",   XL(19,193), XL_MASK,      COM,            { BT, BA, BB } },
-
-{ "crnand",  XL(19,225), XL_MASK,      COM,            { BT, BA, BB } },
-
-{ "crand",   XL(19,257), XL_MASK,      COM,            { BT, BA, BB } },
-
-{ "crset",   XL(19,289), XL_MASK,      PPCCOM,         { BT, BAT, BBA } },
-{ "creqv",   XL(19,289), XL_MASK,      COM,            { BT, BA, BB } },
-
-{ "crorc",   XL(19,417), XL_MASK,      COM,            { BT, BA, BB } },
-
-{ "crmove",  XL(19,449), XL_MASK,      PPCCOM,         { BT, BA, BBA } },
-{ "cror",    XL(19,449), XL_MASK,      COM,            { BT, BA, BB } },
-
-{ "bctr",    XLO(19,BOU,528,0), XLBOBIBB_MASK, COM,    { 0 } },
-{ "bctrl",   XLO(19,BOU,528,1), XLBOBIBB_MASK, COM,    { 0 } },
-{ "bltctr",  XLOCB(19,BOT,CBLT,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bltctr-", XLOCB(19,BOT,CBLT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bltctr+", XLOCB(19,BOTP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bltctr-", XLOCB(19,BOTM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bltctr+", XLOCB(19,BOTP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bltctrl", XLOCB(19,BOT,CBLT,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bltctrl-",XLOCB(19,BOT,CBLT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bltctrl+",XLOCB(19,BOTP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bltctrl-",XLOCB(19,BOTM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bltctrl+",XLOCB(19,BOTP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgtctr",  XLOCB(19,BOT,CBGT,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bgtctr-", XLOCB(19,BOT,CBGT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgtctr+", XLOCB(19,BOTP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgtctr-", XLOCB(19,BOTM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgtctr+", XLOCB(19,BOTP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgtctrl", XLOCB(19,BOT,CBGT,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bgtctrl-",XLOCB(19,BOT,CBGT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgtctrl+",XLOCB(19,BOTP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgtctrl-",XLOCB(19,BOTM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgtctrl+",XLOCB(19,BOTP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "beqctr",  XLOCB(19,BOT,CBEQ,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "beqctr-", XLOCB(19,BOT,CBEQ,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "beqctr+", XLOCB(19,BOTP,CBEQ,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "beqctr-", XLOCB(19,BOTM4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "beqctr+", XLOCB(19,BOTP4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "beqctrl", XLOCB(19,BOT,CBEQ,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "beqctrl-",XLOCB(19,BOT,CBEQ,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "beqctrl+",XLOCB(19,BOTP,CBEQ,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "beqctrl-",XLOCB(19,BOTM4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "beqctrl+",XLOCB(19,BOTP4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bsoctr",  XLOCB(19,BOT,CBSO,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bsoctr-", XLOCB(19,BOT,CBSO,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bsoctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bsoctr-", XLOCB(19,BOTM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bsoctr+", XLOCB(19,BOTP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bsoctrl", XLOCB(19,BOT,CBSO,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bsoctrl-",XLOCB(19,BOT,CBSO,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bsoctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bsoctrl-",XLOCB(19,BOTM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bsoctrl+",XLOCB(19,BOTP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bunctr",  XLOCB(19,BOT,CBSO,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bunctr-", XLOCB(19,BOT,CBSO,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bunctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bunctr-", XLOCB(19,BOTM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bunctr+", XLOCB(19,BOTP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bunctrl", XLOCB(19,BOT,CBSO,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bunctrl-",XLOCB(19,BOT,CBSO,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bunctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bunctrl-",XLOCB(19,BOTM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bunctrl+",XLOCB(19,BOTP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgectr",  XLOCB(19,BOF,CBLT,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bgectr-", XLOCB(19,BOF,CBLT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgectr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgectr-", XLOCB(19,BOFM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgectr+", XLOCB(19,BOFP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgectrl", XLOCB(19,BOF,CBLT,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bgectrl-",XLOCB(19,BOF,CBLT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgectrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bgectrl-",XLOCB(19,BOFM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bgectrl+",XLOCB(19,BOFP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnlctr",  XLOCB(19,BOF,CBLT,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnlctr-", XLOCB(19,BOF,CBLT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnlctr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnlctr-", XLOCB(19,BOFM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnlctr+", XLOCB(19,BOFP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnlctrl", XLOCB(19,BOF,CBLT,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnlctrl-",XLOCB(19,BOF,CBLT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnlctrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnlctrl-",XLOCB(19,BOFM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnlctrl+",XLOCB(19,BOFP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "blectr",  XLOCB(19,BOF,CBGT,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "blectr-", XLOCB(19,BOF,CBGT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "blectr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "blectr-", XLOCB(19,BOFM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "blectr+", XLOCB(19,BOFP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "blectrl", XLOCB(19,BOF,CBGT,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "blectrl-",XLOCB(19,BOF,CBGT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "blectrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "blectrl-",XLOCB(19,BOFM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "blectrl+",XLOCB(19,BOFP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bngctr",  XLOCB(19,BOF,CBGT,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bngctr-", XLOCB(19,BOF,CBGT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bngctr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bngctr-", XLOCB(19,BOFM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bngctr+", XLOCB(19,BOFP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bngctrl", XLOCB(19,BOF,CBGT,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bngctrl-",XLOCB(19,BOF,CBGT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bngctrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bngctrl-",XLOCB(19,BOFM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bngctrl+",XLOCB(19,BOFP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnectr",  XLOCB(19,BOF,CBEQ,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnectr-", XLOCB(19,BOF,CBEQ,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnectr+", XLOCB(19,BOFP,CBEQ,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnectr-", XLOCB(19,BOFM4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnectr+", XLOCB(19,BOFP4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnectrl", XLOCB(19,BOF,CBEQ,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnectrl-",XLOCB(19,BOF,CBEQ,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnectrl+",XLOCB(19,BOFP,CBEQ,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnectrl-",XLOCB(19,BOFM4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnectrl+",XLOCB(19,BOFP4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnsctr",  XLOCB(19,BOF,CBSO,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnsctr-", XLOCB(19,BOF,CBSO,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnsctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnsctr-", XLOCB(19,BOFM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnsctr+", XLOCB(19,BOFP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnsctrl", XLOCB(19,BOF,CBSO,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnsctrl-",XLOCB(19,BOF,CBSO,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnsctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnsctrl-",XLOCB(19,BOFM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnsctrl+",XLOCB(19,BOFP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnuctr",  XLOCB(19,BOF,CBSO,528,0),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnuctr-", XLOCB(19,BOF,CBSO,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnuctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnuctr-", XLOCB(19,BOFM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnuctr+", XLOCB(19,BOFP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnuctrl", XLOCB(19,BOF,CBSO,528,1),  XLBOCBBB_MASK, PPCCOM, { CR } },
-{ "bnuctrl-",XLOCB(19,BOF,CBSO,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnuctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
-{ "bnuctrl-",XLOCB(19,BOFM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "bnuctrl+",XLOCB(19,BOFP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
-{ "btctr",   XLO(19,BOT,528,0),  XLBOBB_MASK, PPCCOM,  { BI } },
-{ "btctr-",  XLO(19,BOT,528,0),  XLBOBB_MASK, NOPOWER4,        { BI } },
-{ "btctr+",  XLO(19,BOTP,528,0), XLBOBB_MASK, NOPOWER4,        { BI } },
-{ "btctr-",  XLO(19,BOTM4,528,0), XLBOBB_MASK, POWER4, { BI } },
-{ "btctr+",  XLO(19,BOTP4,528,0), XLBOBB_MASK, POWER4, { BI } },
-{ "btctrl",  XLO(19,BOT,528,1),  XLBOBB_MASK, PPCCOM,  { BI } },
-{ "btctrl-", XLO(19,BOT,528,1),  XLBOBB_MASK, NOPOWER4,        { BI } },
-{ "btctrl+", XLO(19,BOTP,528,1), XLBOBB_MASK, NOPOWER4,        { BI } },
-{ "btctrl-", XLO(19,BOTM4,528,1), XLBOBB_MASK, POWER4, { BI } },
-{ "btctrl+", XLO(19,BOTP4,528,1), XLBOBB_MASK, POWER4, { BI } },
-{ "bfctr",   XLO(19,BOF,528,0),  XLBOBB_MASK, PPCCOM,  { BI } },
-{ "bfctr-",  XLO(19,BOF,528,0),  XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bfctr+",  XLO(19,BOFP,528,0), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bfctr-",  XLO(19,BOFM4,528,0), XLBOBB_MASK, POWER4, { BI } },
-{ "bfctr+",  XLO(19,BOFP4,528,0), XLBOBB_MASK, POWER4, { BI } },
-{ "bfctrl",  XLO(19,BOF,528,1),  XLBOBB_MASK, PPCCOM,  { BI } },
-{ "bfctrl-", XLO(19,BOF,528,1),  XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bfctrl+", XLO(19,BOFP,528,1), XLBOBB_MASK, NOPOWER4, { BI } },
-{ "bfctrl-", XLO(19,BOFM4,528,1), XLBOBB_MASK, POWER4, { BI } },
-{ "bfctrl+", XLO(19,BOFP4,528,1), XLBOBB_MASK, POWER4, { BI } },
-{ "bcctr",   XLLK(19,528,0),     XLYBB_MASK,  PPCCOM,  { BO, BI } },
-{ "bcctr-",  XLYLK(19,528,0,0),  XLYBB_MASK,  PPCCOM,  { BOE, BI } },
-{ "bcctr+",  XLYLK(19,528,1,0),  XLYBB_MASK,  PPCCOM,  { BOE, BI } },
-{ "bcctrl",  XLLK(19,528,1),     XLYBB_MASK,  PPCCOM,  { BO, BI } },
-{ "bcctrl-", XLYLK(19,528,0,1),  XLYBB_MASK,  PPCCOM,  { BOE, BI } },
-{ "bcctrl+", XLYLK(19,528,1,1),  XLYBB_MASK,  PPCCOM,  { BOE, BI } },
-{ "bcc",     XLLK(19,528,0),     XLBB_MASK,   PWRCOM,  { BO, BI } },
-{ "bccl",    XLLK(19,528,1),     XLBB_MASK,   PWRCOM,  { BO, BI } },
-{ "bcctre",  XLLK(19,529,0),     XLYBB_MASK,  BOOKE64, { BO, BI } },
-{ "bcctrel", XLLK(19,529,1),     XLYBB_MASK,  BOOKE64, { BO, BI } },
-
-{ "rlwimi",  M(20,0),  M_MASK,         PPCCOM,         { RA,RS,SH,MBE,ME } },
-{ "rlimi",   M(20,0),  M_MASK,         PWRCOM,         { RA,RS,SH,MBE,ME } },
-
-{ "rlwimi.", M(20,1),  M_MASK,         PPCCOM,         { RA,RS,SH,MBE,ME } },
-{ "rlimi.",  M(20,1),  M_MASK,         PWRCOM,         { RA,RS,SH,MBE,ME } },
-
-{ "rotlwi",  MME(21,31,0), MMBME_MASK, PPCCOM,         { RA, RS, SH } },
-{ "clrlwi",  MME(21,31,0), MSHME_MASK, PPCCOM,         { RA, RS, MB } },
-{ "rlwinm",  M(21,0),  M_MASK,         PPCCOM,         { RA,RS,SH,MBE,ME } },
-{ "rlinm",   M(21,0),  M_MASK,         PWRCOM,         { RA,RS,SH,MBE,ME } },
-{ "rotlwi.", MME(21,31,1), MMBME_MASK, PPCCOM,         { RA,RS,SH } },
-{ "clrlwi.", MME(21,31,1), MSHME_MASK, PPCCOM,         { RA, RS, MB } },
-{ "rlwinm.", M(21,1),  M_MASK,         PPCCOM,         { RA,RS,SH,MBE,ME } },
-{ "rlinm.",  M(21,1),  M_MASK,         PWRCOM,         { RA,RS,SH,MBE,ME } },
-
-{ "rlmi",    M(22,0),  M_MASK,         M601,           { RA,RS,RB,MBE,ME } },
-{ "rlmi.",   M(22,1),  M_MASK,         M601,           { RA,RS,RB,MBE,ME } },
-
-{ "be",             B(22,0,0), B_MASK,         BOOKE64,        { LI } },
-{ "bel",     B(22,0,1),        B_MASK,         BOOKE64,        { LI } },
-{ "bea",     B(22,1,0),        B_MASK,         BOOKE64,        { LIA } },
-{ "bela",    B(22,1,1),        B_MASK,         BOOKE64,        { LIA } },
-
-{ "rotlw",   MME(23,31,0), MMBME_MASK, PPCCOM,         { RA, RS, RB } },
-{ "rlwnm",   M(23,0),  M_MASK,         PPCCOM,         { RA,RS,RB,MBE,ME } },
-{ "rlnm",    M(23,0),  M_MASK,         PWRCOM,         { RA,RS,RB,MBE,ME } },
-{ "rotlw.",  MME(23,31,1), MMBME_MASK, PPCCOM,         { RA, RS, RB } },
-{ "rlwnm.",  M(23,1),  M_MASK,         PPCCOM,         { RA,RS,RB,MBE,ME } },
-{ "rlnm.",   M(23,1),  M_MASK,         PWRCOM,         { RA,RS,RB,MBE,ME } },
-
-{ "nop",     OP(24),   0xffffffff,     PPCCOM,         { 0 } },
-{ "ori",     OP(24),   OP_MASK,        PPCCOM,         { RA, RS, UI } },
-{ "oril",    OP(24),   OP_MASK,        PWRCOM,         { RA, RS, UI } },
-
-{ "oris",    OP(25),   OP_MASK,        PPCCOM,         { RA, RS, UI } },
-{ "oriu",    OP(25),   OP_MASK,        PWRCOM,         { RA, RS, UI } },
-
-{ "xori",    OP(26),   OP_MASK,        PPCCOM,         { RA, RS, UI } },
-{ "xoril",   OP(26),   OP_MASK,        PWRCOM,         { RA, RS, UI } },
-
-{ "xoris",   OP(27),   OP_MASK,        PPCCOM,         { RA, RS, UI } },
-{ "xoriu",   OP(27),   OP_MASK,        PWRCOM,         { RA, RS, UI } },
-
-{ "andi.",   OP(28),   OP_MASK,        PPCCOM,         { RA, RS, UI } },
-{ "andil.",  OP(28),   OP_MASK,        PWRCOM,         { RA, RS, UI } },
-
-{ "andis.",  OP(29),   OP_MASK,        PPCCOM,         { RA, RS, UI } },
-{ "andiu.",  OP(29),   OP_MASK,        PWRCOM,         { RA, RS, UI } },
-
-{ "rotldi",  MD(30,0,0), MDMB_MASK,    PPC64,          { RA, RS, SH6 } },
-{ "clrldi",  MD(30,0,0), MDSH_MASK,    PPC64,          { RA, RS, MB6 } },
-{ "rldicl",  MD(30,0,0), MD_MASK,      PPC64,          { RA, RS, SH6, MB6 } },
-{ "rotldi.", MD(30,0,1), MDMB_MASK,    PPC64,          { RA, RS, SH6 } },
-{ "clrldi.", MD(30,0,1), MDSH_MASK,    PPC64,          { RA, RS, MB6 } },
-{ "rldicl.", MD(30,0,1), MD_MASK,      PPC64,          { RA, RS, SH6, MB6 } },
-
-{ "rldicr",  MD(30,1,0), MD_MASK,      PPC64,          { RA, RS, SH6, ME6 } },
-{ "rldicr.", MD(30,1,1), MD_MASK,      PPC64,          { RA, RS, SH6, ME6 } },
-
-{ "rldic",   MD(30,2,0), MD_MASK,      PPC64,          { RA, RS, SH6, MB6 } },
-{ "rldic.",  MD(30,2,1), MD_MASK,      PPC64,          { RA, RS, SH6, MB6 } },
-
-{ "rldimi",  MD(30,3,0), MD_MASK,      PPC64,          { RA, RS, SH6, MB6 } },
-{ "rldimi.", MD(30,3,1), MD_MASK,      PPC64,          { RA, RS, SH6, MB6 } },
-
-{ "rotld",   MDS(30,8,0), MDSMB_MASK,  PPC64,          { RA, RS, RB } },
-{ "rldcl",   MDS(30,8,0), MDS_MASK,    PPC64,          { RA, RS, RB, MB6 } },
-{ "rotld.",  MDS(30,8,1), MDSMB_MASK,  PPC64,          { RA, RS, RB } },
-{ "rldcl.",  MDS(30,8,1), MDS_MASK,    PPC64,          { RA, RS, RB, MB6 } },
-
-{ "rldcr",   MDS(30,9,0), MDS_MASK,    PPC64,          { RA, RS, RB, ME6 } },
-{ "rldcr.",  MDS(30,9,1), MDS_MASK,    PPC64,          { RA, RS, RB, ME6 } },
-
-{ "cmpw",    XCMPL(31,0,0), XCMPL_MASK, PPCCOM,                { OBF, RA, RB } },
-{ "cmpd",    XCMPL(31,0,1), XCMPL_MASK, PPC64,         { OBF, RA, RB } },
-{ "cmp",     X(31,0),  XCMP_MASK,      PPCONLY,        { BF, L, RA, RB } },
-{ "cmp",     X(31,0),  XCMPL_MASK,     PWRCOM,         { BF, RA, RB } },
-
-{ "twlgt",   XTO(31,4,TOLGT), XTO_MASK, PPCCOM,                { RA, RB } },
-{ "tlgt",    XTO(31,4,TOLGT), XTO_MASK, PWRCOM,                { RA, RB } },
-{ "twllt",   XTO(31,4,TOLLT), XTO_MASK, PPCCOM,                { RA, RB } },
-{ "tllt",    XTO(31,4,TOLLT), XTO_MASK, PWRCOM,                { RA, RB } },
-{ "tweq",    XTO(31,4,TOEQ), XTO_MASK, PPCCOM,         { RA, RB } },
-{ "teq",     XTO(31,4,TOEQ), XTO_MASK, PWRCOM,         { RA, RB } },
-{ "twlge",   XTO(31,4,TOLGE), XTO_MASK, PPCCOM,                { RA, RB } },
-{ "tlge",    XTO(31,4,TOLGE), XTO_MASK, PWRCOM,                { RA, RB } },
-{ "twlnl",   XTO(31,4,TOLNL), XTO_MASK, PPCCOM,                { RA, RB } },
-{ "tlnl",    XTO(31,4,TOLNL), XTO_MASK, PWRCOM,                { RA, RB } },
-{ "twlle",   XTO(31,4,TOLLE), XTO_MASK, PPCCOM,                { RA, RB } },
-{ "tlle",    XTO(31,4,TOLLE), XTO_MASK, PWRCOM,                { RA, RB } },
-{ "twlng",   XTO(31,4,TOLNG), XTO_MASK, PPCCOM,                { RA, RB } },
-{ "tlng",    XTO(31,4,TOLNG), XTO_MASK, PWRCOM,                { RA, RB } },
-{ "twgt",    XTO(31,4,TOGT), XTO_MASK, PPCCOM,         { RA, RB } },
-{ "tgt",     XTO(31,4,TOGT), XTO_MASK, PWRCOM,         { RA, RB } },
-{ "twge",    XTO(31,4,TOGE), XTO_MASK, PPCCOM,         { RA, RB } },
-{ "tge",     XTO(31,4,TOGE), XTO_MASK, PWRCOM,         { RA, RB } },
-{ "twnl",    XTO(31,4,TONL), XTO_MASK, PPCCOM,         { RA, RB } },
-{ "tnl",     XTO(31,4,TONL), XTO_MASK, PWRCOM,         { RA, RB } },
-{ "twlt",    XTO(31,4,TOLT), XTO_MASK, PPCCOM,         { RA, RB } },
-{ "tlt",     XTO(31,4,TOLT), XTO_MASK, PWRCOM,         { RA, RB } },
-{ "twle",    XTO(31,4,TOLE), XTO_MASK, PPCCOM,         { RA, RB } },
-{ "tle",     XTO(31,4,TOLE), XTO_MASK, PWRCOM,         { RA, RB } },
-{ "twng",    XTO(31,4,TONG), XTO_MASK, PPCCOM,         { RA, RB } },
-{ "tng",     XTO(31,4,TONG), XTO_MASK, PWRCOM,         { RA, RB } },
-{ "twne",    XTO(31,4,TONE), XTO_MASK, PPCCOM,         { RA, RB } },
-{ "tne",     XTO(31,4,TONE), XTO_MASK, PWRCOM,         { RA, RB } },
-{ "trap",    XTO(31,4,TOU), 0xffffffff,        PPCCOM,         { 0 } },
-{ "tw",      X(31,4),  X_MASK,         PPCCOM,         { TO, RA, RB } },
-{ "t",       X(31,4),  X_MASK,         PWRCOM,         { TO, RA, RB } },
-
-{ "subfc",   XO(31,8,0,0), XO_MASK,    PPCCOM,         { RT, RA, RB } },
-{ "sf",      XO(31,8,0,0), XO_MASK,    PWRCOM,         { RT, RA, RB } },
-{ "subc",    XO(31,8,0,0), XO_MASK,    PPC,            { RT, RB, RA } },
-{ "subfc.",  XO(31,8,0,1), XO_MASK,    PPCCOM,         { RT, RA, RB } },
-{ "sf.",     XO(31,8,0,1), XO_MASK,    PWRCOM,         { RT, RA, RB } },
-{ "subc.",   XO(31,8,0,1), XO_MASK,    PPCCOM,         { RT, RB, RA } },
-{ "subfco",  XO(31,8,1,0), XO_MASK,    PPCCOM,         { RT, RA, RB } },
-{ "sfo",     XO(31,8,1,0), XO_MASK,    PWRCOM,         { RT, RA, RB } },
-{ "subco",   XO(31,8,1,0), XO_MASK,    PPC,            { RT, RB, RA } },
-{ "subfco.", XO(31,8,1,1), XO_MASK,    PPCCOM,         { RT, RA, RB } },
-{ "sfo.",    XO(31,8,1,1), XO_MASK,    PWRCOM,         { RT, RA, RB } },
-{ "subco.",  XO(31,8,1,1), XO_MASK,    PPC,            { RT, RB, RA } },
-
-{ "mulhdu",  XO(31,9,0,0), XO_MASK,    PPC64,          { RT, RA, RB } },
-{ "mulhdu.", XO(31,9,0,1), XO_MASK,    PPC64,          { RT, RA, RB } },
-
-{ "addc",    XO(31,10,0,0), XO_MASK,   PPCCOM,         { RT, RA, RB } },
-{ "a",       XO(31,10,0,0), XO_MASK,   PWRCOM,         { RT, RA, RB } },
-{ "addc.",   XO(31,10,0,1), XO_MASK,   PPCCOM,         { RT, RA, RB } },
-{ "a.",      XO(31,10,0,1), XO_MASK,   PWRCOM,         { RT, RA, RB } },
-{ "addco",   XO(31,10,1,0), XO_MASK,   PPCCOM,         { RT, RA, RB } },
-{ "ao",      XO(31,10,1,0), XO_MASK,   PWRCOM,         { RT, RA, RB } },
-{ "addco.",  XO(31,10,1,1), XO_MASK,   PPCCOM,         { RT, RA, RB } },
-{ "ao.",     XO(31,10,1,1), XO_MASK,   PWRCOM,         { RT, RA, RB } },
-
-{ "mulhwu",  XO(31,11,0,0), XO_MASK,   PPC,            { RT, RA, RB } },
-{ "mulhwu.", XO(31,11,0,1), XO_MASK,   PPC,            { RT, RA, RB } },
-
-{ "isel",    XISEL(31,15),XISEL_MASK,  PPCISEL,        { RT, RA, RB, CRB } },
-
-{ "mfcr",    X(31,19), XRARB_MASK,     COM,            { RT } },
-
-{ "lwarx",   X(31,20), X_MASK,         PPC,            { RT, RA, RB } },
-
-{ "ldx",     X(31,21), X_MASK,         PPC64,          { RT, RA, RB } },
-
-{ "icbt",    X(31,22), X_MASK,         BOOKE,          { CT, RA, RB } },
-
-{ "lwzx",    X(31,23), X_MASK,         PPCCOM,         { RT, RA, RB } },
-{ "lx",      X(31,23), X_MASK,         PWRCOM,         { RT, RA, RB } },
-
-{ "slw",     XRC(31,24,0), X_MASK,     PPCCOM,         { RA, RS, RB } },
-{ "sl",      XRC(31,24,0), X_MASK,     PWRCOM,         { RA, RS, RB } },
-{ "slw.",    XRC(31,24,1), X_MASK,     PPCCOM,         { RA, RS, RB } },
-{ "sl.",     XRC(31,24,1), X_MASK,     PWRCOM,         { RA, RS, RB } },
-
-{ "cntlzw",  XRC(31,26,0), XRB_MASK,   PPCCOM,         { RA, RS } },
-{ "cntlz",   XRC(31,26,0), XRB_MASK,   PWRCOM,         { RA, RS } },
-{ "cntlzw.", XRC(31,26,1), XRB_MASK,   PPCCOM,         { RA, RS } },
-{ "cntlz.",  XRC(31,26,1), XRB_MASK,   PWRCOM,         { RA, RS } },
-
-{ "sld",     XRC(31,27,0), X_MASK,     PPC64,          { RA, RS, RB } },
-{ "sld.",    XRC(31,27,1), X_MASK,     PPC64,          { RA, RS, RB } },
-
-{ "and",     XRC(31,28,0), X_MASK,     COM,            { RA, RS, RB } },
-{ "and.",    XRC(31,28,1), X_MASK,     COM,            { RA, RS, RB } },
-
-{ "maskg",   XRC(31,29,0), X_MASK,     M601,           { RA, RS, RB } },
-{ "maskg.",  XRC(31,29,1), X_MASK,     M601,           { RA, RS, RB } },
-
-{ "icbte",   X(31,30), X_MASK,         BOOKE64,        { CT, RA, RB } },
-
-{ "lwzxe",   X(31,31), X_MASK,         BOOKE64,        { RT, RA, RB } },
-
-{ "cmplw",   XCMPL(31,32,0), XCMPL_MASK, PPCCOM,       { OBF, RA, RB } },
-{ "cmpld",   XCMPL(31,32,1), XCMPL_MASK, PPC64,                { OBF, RA, RB } },
-{ "cmpl",    X(31,32), XCMP_MASK,       PPCONLY,       { BF, L, RA, RB } },
-{ "cmpl",    X(31,32), XCMPL_MASK,      PWRCOM,        { BF, RA, RB } },
-
-{ "subf",    XO(31,40,0,0), XO_MASK,   PPC,            { RT, RA, RB } },
-{ "sub",     XO(31,40,0,0), XO_MASK,   PPC,            { RT, RB, RA } },
-{ "subf.",   XO(31,40,0,1), XO_MASK,   PPC,            { RT, RA, RB } },
-{ "sub.",    XO(31,40,0,1), XO_MASK,   PPC,            { RT, RB, RA } },
-{ "subfo",   XO(31,40,1,0), XO_MASK,   PPC,            { RT, RA, RB } },
-{ "subo",    XO(31,40,1,0), XO_MASK,   PPC,            { RT, RB, RA } },
-{ "subfo.",  XO(31,40,1,1), XO_MASK,   PPC,            { RT, RA, RB } },
-{ "subo.",   XO(31,40,1,1), XO_MASK,   PPC,            { RT, RB, RA } },
-
-{ "ldux",    X(31,53), X_MASK,         PPC64,          { RT, RAL, RB } },
-
-{ "dcbst",   X(31,54), XRT_MASK,       PPC,            { RA, RB } },
-
-{ "lwzux",   X(31,55), X_MASK,         PPCCOM,         { RT, RAL, RB } },
-{ "lux",     X(31,55), X_MASK,         PWRCOM,         { RT, RA, RB } },
-
-{ "dcbste",  X(31,62), XRT_MASK,       BOOKE64,        { RA, RB } },
-
-{ "lwzuxe",  X(31,63), X_MASK,         BOOKE64,        { RT, RAL, RB } },
-
-{ "cntlzd",  XRC(31,58,0), XRB_MASK,   PPC64,          { RA, RS } },
-{ "cntlzd.", XRC(31,58,1), XRB_MASK,   PPC64,          { RA, RS } },
-
-{ "andc",    XRC(31,60,0), X_MASK,     COM,            { RA, RS, RB } },
-{ "andc.",   XRC(31,60,1), X_MASK,     COM,            { RA, RS, RB } },
-
-{ "tdlgt",   XTO(31,68,TOLGT), XTO_MASK, PPC64,                { RA, RB } },
-{ "tdllt",   XTO(31,68,TOLLT), XTO_MASK, PPC64,                { RA, RB } },
-{ "tdeq",    XTO(31,68,TOEQ), XTO_MASK,  PPC64,                { RA, RB } },
-{ "tdlge",   XTO(31,68,TOLGE), XTO_MASK, PPC64,                { RA, RB } },
-{ "tdlnl",   XTO(31,68,TOLNL), XTO_MASK, PPC64,                { RA, RB } },
-{ "tdlle",   XTO(31,68,TOLLE), XTO_MASK, PPC64,                { RA, RB } },
-{ "tdlng",   XTO(31,68,TOLNG), XTO_MASK, PPC64,                { RA, RB } },
-{ "tdgt",    XTO(31,68,TOGT), XTO_MASK,  PPC64,                { RA, RB } },
-{ "tdge",    XTO(31,68,TOGE), XTO_MASK,  PPC64,                { RA, RB } },
-{ "tdnl",    XTO(31,68,TONL), XTO_MASK,  PPC64,                { RA, RB } },
-{ "tdlt",    XTO(31,68,TOLT), XTO_MASK,  PPC64,                { RA, RB } },
-{ "tdle",    XTO(31,68,TOLE), XTO_MASK,  PPC64,                { RA, RB } },
-{ "tdng",    XTO(31,68,TONG), XTO_MASK,  PPC64,                { RA, RB } },
-{ "tdne",    XTO(31,68,TONE), XTO_MASK,  PPC64,                { RA, RB } },
-{ "td",             X(31,68),  X_MASK,          PPC64,         { TO, RA, RB } },
-
-{ "mulhd",   XO(31,73,0,0), XO_MASK,    PPC64,         { RT, RA, RB } },
-{ "mulhd.",  XO(31,73,0,1), XO_MASK,    PPC64,         { RT, RA, RB } },
-
-{ "mulhw",   XO(31,75,0,0), XO_MASK,   PPC,            { RT, RA, RB } },
-{ "mulhw.",  XO(31,75,0,1), XO_MASK,   PPC,            { RT, RA, RB } },
-
-{ "mtsrd",   X(31,82), XRB_MASK|(1<<20), PPC64,        { SR, RS } },
-
-{ "mfmsr",   X(31,83), XRARB_MASK,     COM,            { RT } },
-
-{ "ldarx",   X(31,84), X_MASK,         PPC64,          { RT, RA, RB } },
-
-{ "dcbf",    X(31,86), XRT_MASK,       PPC,            { RA, RB } },
-
-{ "lbzx",    X(31,87), X_MASK,         COM,            { RT, RA, RB } },
-
-{ "dcbfe",   X(31,94), XRT_MASK,       BOOKE64,        { RA, RB } },
-
-{ "lbzxe",   X(31,95), X_MASK,         BOOKE64,        { RT, RA, RB } },
-
-{ "neg",     XO(31,104,0,0), XORB_MASK,        COM,            { RT, RA } },
-{ "neg.",    XO(31,104,0,1), XORB_MASK,        COM,            { RT, RA } },
-{ "nego",    XO(31,104,1,0), XORB_MASK,        COM,            { RT, RA } },
-{ "nego.",   XO(31,104,1,1), XORB_MASK,        COM,            { RT, RA } },
-
-{ "mul",     XO(31,107,0,0), XO_MASK,  M601,           { RT, RA, RB } },
-{ "mul.",    XO(31,107,0,1), XO_MASK,  M601,           { RT, RA, RB } },
-{ "mulo",    XO(31,107,1,0), XO_MASK,  M601,           { RT, RA, RB } },
-{ "mulo.",   XO(31,107,1,1), XO_MASK,  M601,           { RT, RA, RB } },
-
-{ "mtsrdin", X(31,114),        XRA_MASK,       PPC64,          { RS, RB } },
-
-{ "clf",     X(31,118), XTO_MASK,      POWER,          { RA, RB } },
-
-{ "lbzux",   X(31,119),        X_MASK,         COM,            { RT, RAL, RB } },
-
-{ "not",     XRC(31,124,0), X_MASK,    COM,            { RA, RS, RBS } },
-{ "nor",     XRC(31,124,0), X_MASK,    COM,            { RA, RS, RB } },
-{ "not.",    XRC(31,124,1), X_MASK,    COM,            { RA, RS, RBS } },
-{ "nor.",    XRC(31,124,1), X_MASK,    COM,            { RA, RS, RB } },
-
-{ "lwarxe",  X(31,126),        X_MASK,         BOOKE64,        { RT, RA, RB } },
-
-{ "lbzuxe",  X(31,127),        X_MASK,         BOOKE64,        { RT, RAL, RB } },
-
-{ "wrtee",   X(31,131),        XRARB_MASK,     PPC403,         { RS } },
-{ "wrtee",   X(31,131),        XRARB_MASK,     BOOKE,          { RS } },
-
-{ "dcbtstls",X(31,134),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-
-{ "subfe",   XO(31,136,0,0), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "sfe",     XO(31,136,0,0), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "subfe.",  XO(31,136,0,1), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "sfe.",    XO(31,136,0,1), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "subfeo",  XO(31,136,1,0), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "sfeo",    XO(31,136,1,0), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "subfeo.", XO(31,136,1,1), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "sfeo.",   XO(31,136,1,1), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-
-{ "adde",    XO(31,138,0,0), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "ae",      XO(31,138,0,0), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "adde.",   XO(31,138,0,1), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "ae.",     XO(31,138,0,1), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "addeo",   XO(31,138,1,0), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "aeo",     XO(31,138,1,0), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "addeo.",  XO(31,138,1,1), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "aeo.",    XO(31,138,1,1), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-
-{ "dcbtstlse",X(31,142),X_MASK,                PPCCHLK,        { CT, RA, RB }},
-
-{ "mtcr",    XFXM(31,144,0xff), XFXFXM_MASK|FXM_MASK, COM,     { RS }},
-{ "mtcrf",   X(31,144),        XFXFXM_MASK,    COM,            { FXM, RS } },
-
-{ "mtmsr",   X(31,146),        XRARB_MASK,     COM,            { RS } },
-
-{ "stdx",    X(31,149), X_MASK,                PPC64,          { RS, RA, RB } },
-
-{ "stwcx.",  XRC(31,150,1), X_MASK,    PPC,            { RS, RA, RB } },
-
-{ "stwx",    X(31,151), X_MASK,                PPCCOM,         { RS, RA, RB } },
-{ "stx",     X(31,151), X_MASK,                PWRCOM,         { RS, RA, RB } },
-
-{ "stwcxe.", XRC(31,158,1), X_MASK,    BOOKE64,        { RS, RA, RB } },
-
-{ "stwxe",   X(31,159), X_MASK,                BOOKE64,        { RS, RA, RB } },
-
-{ "slq",     XRC(31,152,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "slq.",    XRC(31,152,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "sle",     XRC(31,153,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "sle.",    XRC(31,153,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "wrteei",  X(31,163),        XE_MASK,        PPC403,         { E } },
-{ "wrteei",  X(31,163),        XE_MASK,        BOOKE,          { E } },
-
-{ "dcbtls",  X(31,166),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-{ "dcbtlse", X(31,174),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-
-{ "mtmsrd",  X(31,178),        XRLARB_MASK,    PPC64,          { RS, MTMSRD_L } },
-
-{ "stdux",   X(31,181),        X_MASK,         PPC64,          { RS, RAS, RB } },
-
-{ "stwux",   X(31,183),        X_MASK,         PPCCOM,         { RS, RAS, RB } },
-{ "stux",    X(31,183),        X_MASK,         PWRCOM,         { RS, RA, RB } },
-
-{ "sliq",    XRC(31,184,0), X_MASK,    M601,           { RA, RS, SH } },
-{ "sliq.",   XRC(31,184,1), X_MASK,    M601,           { RA, RS, SH } },
-
-{ "stwuxe",  X(31,191),        X_MASK,         BOOKE64,        { RS, RAS, RB } },
-
-{ "subfze",  XO(31,200,0,0), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "sfze",    XO(31,200,0,0), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "subfze.", XO(31,200,0,1), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "sfze.",   XO(31,200,0,1), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "subfzeo", XO(31,200,1,0), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "sfzeo",   XO(31,200,1,0), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "subfzeo.",XO(31,200,1,1), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "sfzeo.",  XO(31,200,1,1), XORB_MASK, PWRCOM,                { RT, RA } },
-
-{ "addze",   XO(31,202,0,0), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "aze",     XO(31,202,0,0), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "addze.",  XO(31,202,0,1), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "aze.",    XO(31,202,0,1), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "addzeo",  XO(31,202,1,0), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "azeo",    XO(31,202,1,0), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "addzeo.", XO(31,202,1,1), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "azeo.",   XO(31,202,1,1), XORB_MASK, PWRCOM,                { RT, RA } },
-
-{ "mtsr",    X(31,210),        XRB_MASK|(1<<20), COM32,        { SR, RS } },
-
-{ "stdcx.",  XRC(31,214,1), X_MASK,    PPC64,          { RS, RA, RB } },
-
-{ "stbx",    X(31,215),        X_MASK,         COM,            { RS, RA, RB } },
-
-{ "sllq",    XRC(31,216,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "sllq.",   XRC(31,216,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "sleq",    XRC(31,217,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "sleq.",   XRC(31,217,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "stbxe",   X(31,223),        X_MASK,         BOOKE64,        { RS, RA, RB } },
-
-{ "icblc",   X(31,230),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-
-{ "subfme",  XO(31,232,0,0), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "sfme",    XO(31,232,0,0), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "subfme.", XO(31,232,0,1), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "sfme.",   XO(31,232,0,1), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "subfmeo", XO(31,232,1,0), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "sfmeo",   XO(31,232,1,0), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "subfmeo.",XO(31,232,1,1), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "sfmeo.",  XO(31,232,1,1), XORB_MASK, PWRCOM,                { RT, RA } },
-
-{ "mulld",   XO(31,233,0,0), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "mulld.",  XO(31,233,0,1), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "mulldo",  XO(31,233,1,0), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "mulldo.", XO(31,233,1,1), XO_MASK,  PPC64,          { RT, RA, RB } },
-
-{ "addme",   XO(31,234,0,0), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "ame",     XO(31,234,0,0), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "addme.",  XO(31,234,0,1), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "ame.",    XO(31,234,0,1), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "addmeo",  XO(31,234,1,0), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "ameo",    XO(31,234,1,0), XORB_MASK, PWRCOM,                { RT, RA } },
-{ "addmeo.", XO(31,234,1,1), XORB_MASK, PPCCOM,                { RT, RA } },
-{ "ameo.",   XO(31,234,1,1), XORB_MASK, PWRCOM,                { RT, RA } },
-
-{ "mullw",   XO(31,235,0,0), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "muls",    XO(31,235,0,0), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "mullw.",  XO(31,235,0,1), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "muls.",   XO(31,235,0,1), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "mullwo",  XO(31,235,1,0), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "mulso",   XO(31,235,1,0), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "mullwo.", XO(31,235,1,1), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "mulso.",  XO(31,235,1,1), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-
-{ "icblce",  X(31,238),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-{ "mtsrin",  X(31,242),        XRA_MASK,       PPC32,          { RS, RB } },
-{ "mtsri",   X(31,242),        XRA_MASK,       POWER32,        { RS, RB } },
-
-{ "dcbtst",  X(31,246),        XRT_MASK,       PPC,            { CT, RA, RB } },
-
-{ "stbux",   X(31,247),        X_MASK,         COM,            { RS, RAS, RB } },
-
-{ "slliq",   XRC(31,248,0), X_MASK,    M601,           { RA, RS, SH } },
-{ "slliq.",  XRC(31,248,1), X_MASK,    M601,           { RA, RS, SH } },
-
-{ "dcbtste", X(31,253),        X_MASK,         BOOKE64,        { CT, RA, RB } },
-
-{ "stbuxe",  X(31,255),        X_MASK,         BOOKE64,        { RS, RAS, RB } },
-
-{ "mfdcrx",  X(31,259),        X_MASK,         BOOKE,          { RS, RA } },
-
-{ "icbt",    X(31,262),        XRT_MASK,       PPC403,         { RA, RB } },
-
-{ "doz",     XO(31,264,0,0), XO_MASK,  M601,           { RT, RA, RB } },
-{ "doz.",    XO(31,264,0,1), XO_MASK,  M601,           { RT, RA, RB } },
-{ "dozo",    XO(31,264,1,0), XO_MASK,  M601,           { RT, RA, RB } },
-{ "dozo.",   XO(31,264,1,1), XO_MASK,  M601,           { RT, RA, RB } },
-
-{ "add",     XO(31,266,0,0), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "cax",     XO(31,266,0,0), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "add.",    XO(31,266,0,1), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "cax.",    XO(31,266,0,1), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "addo",    XO(31,266,1,0), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "caxo",    XO(31,266,1,0), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-{ "addo.",   XO(31,266,1,1), XO_MASK,  PPCCOM,         { RT, RA, RB } },
-{ "caxo.",   XO(31,266,1,1), XO_MASK,  PWRCOM,         { RT, RA, RB } },
-
-{ "tlbiel",  X(31,274), XRTRA_MASK,    POWER4,         { RB } },
-
-{ "mfapidi", X(31,275), X_MASK,                BOOKE,          { RT, RA } },
-
-{ "lscbx",   XRC(31,277,0), X_MASK,    M601,           { RT, RA, RB } },
-{ "lscbx.",  XRC(31,277,1), X_MASK,    M601,           { RT, RA, RB } },
-
-{ "dcbt",    X(31,278),        XRT_MASK,       PPC,            { CT, RA, RB } },
-
-{ "lhzx",    X(31,279),        X_MASK,         COM,            { RT, RA, RB } },
-
-{ "eqv",     XRC(31,284,0), X_MASK,    COM,            { RA, RS, RB } },
-{ "eqv.",    XRC(31,284,1), X_MASK,    COM,            { RA, RS, RB } },
-
-{ "dcbte",   X(31,286),        X_MASK,         BOOKE64,        { CT, RA, RB } },
-
-{ "lhzxe",   X(31,287),        X_MASK,         BOOKE64,        { RT, RA, RB } },
-
-{ "tlbie",   X(31,306),        XRTLRA_MASK,    PPC,            { RB, L } },
-{ "tlbi",    X(31,306),        XRT_MASK,       POWER,          { RA, RB } },
-
-{ "eciwx",   X(31,310), X_MASK,                PPC,            { RT, RA, RB } },
-
-{ "lhzux",   X(31,311),        X_MASK,         COM,            { RT, RAL, RB } },
-
-{ "xor",     XRC(31,316,0), X_MASK,    COM,            { RA, RS, RB } },
-{ "xor.",    XRC(31,316,1), X_MASK,    COM,            { RA, RS, RB } },
-
-{ "lhzuxe",  X(31,319),        X_MASK,         BOOKE64,        { RT, RAL, RB } },
-
-{ "mfexisr", XSPR(31,323,64), XSPR_MASK, PPC403,       { RT } },
-{ "mfexier", XSPR(31,323,66), XSPR_MASK, PPC403,       { RT } },
-{ "mfbr0",   XSPR(31,323,128), XSPR_MASK, PPC403,      { RT } },
-{ "mfbr1",   XSPR(31,323,129), XSPR_MASK, PPC403,      { RT } },
-{ "mfbr2",   XSPR(31,323,130), XSPR_MASK, PPC403,      { RT } },
-{ "mfbr3",   XSPR(31,323,131), XSPR_MASK, PPC403,      { RT } },
-{ "mfbr4",   XSPR(31,323,132), XSPR_MASK, PPC403,      { RT } },
-{ "mfbr5",   XSPR(31,323,133), XSPR_MASK, PPC403,      { RT } },
-{ "mfbr6",   XSPR(31,323,134), XSPR_MASK, PPC403,      { RT } },
-{ "mfbr7",   XSPR(31,323,135), XSPR_MASK, PPC403,      { RT } },
-{ "mfbear",  XSPR(31,323,144), XSPR_MASK, PPC403,      { RT } },
-{ "mfbesr",  XSPR(31,323,145), XSPR_MASK, PPC403,      { RT } },
-{ "mfiocr",  XSPR(31,323,160), XSPR_MASK, PPC403,      { RT } },
-{ "mfdmacr0", XSPR(31,323,192), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmact0", XSPR(31,323,193), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmada0", XSPR(31,323,194), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmasa0", XSPR(31,323,195), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmacc0", XSPR(31,323,196), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmacr1", XSPR(31,323,200), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmact1", XSPR(31,323,201), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmada1", XSPR(31,323,202), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmasa1", XSPR(31,323,203), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmacc1", XSPR(31,323,204), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmacr2", XSPR(31,323,208), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmact2", XSPR(31,323,209), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmada2", XSPR(31,323,210), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmasa2", XSPR(31,323,211), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmacc2", XSPR(31,323,212), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmacr3", XSPR(31,323,216), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmact3", XSPR(31,323,217), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmada3", XSPR(31,323,218), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmasa3", XSPR(31,323,219), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmacc3", XSPR(31,323,220), XSPR_MASK, PPC403,     { RT } },
-{ "mfdmasr", XSPR(31,323,224), XSPR_MASK, PPC403,      { RT } },
-{ "mfdcr",   X(31,323),        X_MASK,         PPC403,         { RT, SPR } },
-{ "mfdcr",   X(31,323),        X_MASK,         BOOKE,          { RT, SPR } },
-
-{ "div",     XO(31,331,0,0), XO_MASK,  M601,           { RT, RA, RB } },
-{ "div.",    XO(31,331,0,1), XO_MASK,  M601,           { RT, RA, RB } },
-{ "divo",    XO(31,331,1,0), XO_MASK,  M601,           { RT, RA, RB } },
-{ "divo.",   XO(31,331,1,1), XO_MASK,  M601,           { RT, RA, RB } },
-
-{ "mfpmr",   X(31,334),        X_MASK,         PPCPMR,         { RT, PMRN }},
-
-{ "mfmq",     XSPR(31,339,0),   XSPR_MASK, M601,       { RT } },
-{ "mfxer",    XSPR(31,339,1),   XSPR_MASK, COM,                { RT } },
-{ "mfrtcu",   XSPR(31,339,4),   XSPR_MASK, COM,                { RT } },
-{ "mfrtcl",   XSPR(31,339,5),   XSPR_MASK, COM,                { RT } },
-{ "mfdec",    XSPR(31,339,6),   XSPR_MASK, MFDEC1,     { RT } },
-{ "mflr",     XSPR(31,339,8),   XSPR_MASK, COM,                { RT } },
-{ "mfctr",    XSPR(31,339,9),   XSPR_MASK, COM,                { RT } },
-{ "mftid",    XSPR(31,339,17),  XSPR_MASK, POWER,      { RT } },
-{ "mfdsisr",  XSPR(31,339,18),  XSPR_MASK, COM,                { RT } },
-{ "mfdar",    XSPR(31,339,19),  XSPR_MASK, COM,                { RT } },
-{ "mfdec",    XSPR(31,339,22),  XSPR_MASK, MFDEC2,     { RT } },
-{ "mfsdr0",   XSPR(31,339,24),  XSPR_MASK, POWER,      { RT } },
-{ "mfsdr1",   XSPR(31,339,25),  XSPR_MASK, COM,                { RT } },
-{ "mfsrr0",   XSPR(31,339,26),  XSPR_MASK, COM,                { RT } },
-{ "mfsrr1",   XSPR(31,339,27),  XSPR_MASK, COM,                { RT } },
-{ "mfcmpa",   XSPR(31,339,144), XSPR_MASK, PPC860,     { RT } },
-{ "mfcmpb",   XSPR(31,339,145), XSPR_MASK, PPC860,     { RT } },
-{ "mfcmpc",   XSPR(31,339,146), XSPR_MASK, PPC860,     { RT } },
-{ "mfcmpd",   XSPR(31,339,147), XSPR_MASK, PPC860,     { RT } },
-{ "mficr",    XSPR(31,339,148), XSPR_MASK, PPC860,     { RT } },
-{ "mfder",    XSPR(31,339,149), XSPR_MASK, PPC860,     { RT } },
-{ "mfcounta", XSPR(31,339,150), XSPR_MASK, PPC860,     { RT } },
-{ "mfcountb", XSPR(31,339,151), XSPR_MASK, PPC860,     { RT } },
-{ "mfcmpe",   XSPR(31,339,152), XSPR_MASK, PPC860,     { RT } },
-{ "mfcmpf",   XSPR(31,339,153), XSPR_MASK, PPC860,     { RT } },
-{ "mfcmpg",   XSPR(31,339,154), XSPR_MASK, PPC860,     { RT } },
-{ "mfcmph",   XSPR(31,339,155), XSPR_MASK, PPC860,     { RT } },
-{ "mflctrl1", XSPR(31,339,156), XSPR_MASK, PPC860,     { RT } },
-{ "mflctrl2", XSPR(31,339,157), XSPR_MASK, PPC860,     { RT } },
-{ "mfictrl",  XSPR(31,339,158), XSPR_MASK, PPC860,     { RT } },
-{ "mfbar",    XSPR(31,339,159), XSPR_MASK, PPC860,     { RT } },
-{ "mfvrsave", XSPR(31,339,256), XSPR_MASK, PPCVEC,     { RT } },
-{ "mfsprg4",  XSPR(31,339,260), XSPR_MASK, PPC405,     { RT } },
-{ "mfsprg5",  XSPR(31,339,261), XSPR_MASK, PPC405,     { RT } },
-{ "mfsprg6",  XSPR(31,339,262), XSPR_MASK, PPC405,     { RT } },
-{ "mfsprg7",  XSPR(31,339,263), XSPR_MASK, PPC405,     { RT } },
-{ "mfsprg",   XSPR(31,339,272), XSPRG_MASK, PPC,       { RT, SPRG } },
-{ "mfsprg0",  XSPR(31,339,272), XSPR_MASK, PPC,                { RT } },
-{ "mfsprg1",  XSPR(31,339,273), XSPR_MASK, PPC,                { RT } },
-{ "mfsprg2",  XSPR(31,339,274), XSPR_MASK, PPC,                { RT } },
-{ "mfsprg3",  XSPR(31,339,275), XSPR_MASK, PPC,                { RT } },
-{ "mfasr",    XSPR(31,339,280), XSPR_MASK, PPC64,      { RT } },
-{ "mfear",    XSPR(31,339,282), XSPR_MASK, PPC,                { RT } },
-{ "mfpvr",    XSPR(31,339,287), XSPR_MASK, PPC,                { RT } },
-{ "mfspefscr",XSPR(31,339,512), XSPR_MASK, PPCSPE,     { RT } },
-{ "mfibatu",  XSPR(31,339,528), XSPRBAT_MASK, PPC,     { RT, SPRBAT } },
-{ "mfibatl",  XSPR(31,339,529), XSPRBAT_MASK, PPC,     { RT, SPRBAT } },
-{ "mfdbatu",  XSPR(31,339,536), XSPRBAT_MASK, PPC,     { RT, SPRBAT } },
-{ "mfdbatl",  XSPR(31,339,537), XSPRBAT_MASK, PPC,     { RT, SPRBAT } },
-{ "mfic_cst", XSPR(31,339,560), XSPR_MASK, PPC860,     { RT } },
-{ "mfic_adr", XSPR(31,339,561), XSPR_MASK, PPC860,     { RT } },
-{ "mfic_dat", XSPR(31,339,562), XSPR_MASK, PPC860,     { RT } },
-{ "mfdc_cst", XSPR(31,339,568), XSPR_MASK, PPC860,     { RT } },
-{ "mfdc_adr", XSPR(31,339,569), XSPR_MASK, PPC860,     { RT } },
-{ "mfdc_dat", XSPR(31,339,570), XSPR_MASK, PPC860,     { RT } },
-{ "mfdpdr",   XSPR(31,339,630), XSPR_MASK, PPC860,     { RT } },
-{ "mfdpir",   XSPR(31,339,631), XSPR_MASK, PPC860,     { RT } },
-{ "mfimmr",   XSPR(31,339,638), XSPR_MASK, PPC860,     { RT } },
-{ "mfmi_ctr", XSPR(31,339,784), XSPR_MASK, PPC860,     { RT } },
-{ "mfmi_ap",  XSPR(31,339,786), XSPR_MASK, PPC860,     { RT } },
-{ "mfmi_epn", XSPR(31,339,787), XSPR_MASK, PPC860,     { RT } },
-{ "mfmi_twc", XSPR(31,339,789), XSPR_MASK, PPC860,     { RT } },
-{ "mfmi_rpn", XSPR(31,339,790), XSPR_MASK, PPC860,     { RT } },
-{ "mfmd_ctr", XSPR(31,339,792), XSPR_MASK, PPC860,     { RT } },
-{ "mfm_casid",XSPR(31,339,793), XSPR_MASK, PPC860,     { RT } },
-{ "mfmd_ap",  XSPR(31,339,794), XSPR_MASK, PPC860,     { RT } },
-{ "mfmd_epn", XSPR(31,339,795), XSPR_MASK, PPC860,     { RT } },
-{ "mfmd_twb", XSPR(31,339,796), XSPR_MASK, PPC860,     { RT } },
-{ "mfmd_twc", XSPR(31,339,797), XSPR_MASK, PPC860,     { RT } },
-{ "mfmd_rpn", XSPR(31,339,798), XSPR_MASK, PPC860,     { RT } },
-{ "mfm_tw",   XSPR(31,339,799), XSPR_MASK, PPC860,     { RT } },
-{ "mfmi_dbcam",XSPR(31,339,816), XSPR_MASK, PPC860,    { RT } },
-{ "mfmi_dbram0",XSPR(31,339,817), XSPR_MASK, PPC860,   { RT } },
-{ "mfmi_dbram1",XSPR(31,339,818), XSPR_MASK, PPC860,   { RT } },
-{ "mfmd_dbcam", XSPR(31,339,824), XSPR_MASK, PPC860,   { RT } },
-{ "mfmd_dbram0",XSPR(31,339,825), XSPR_MASK, PPC860,   { RT } },
-{ "mfmd_dbram1",XSPR(31,339,826), XSPR_MASK, PPC860,   { RT } },
-{ "mfzpr",     XSPR(31,339,944), XSPR_MASK, PPC403,    { RT } },
-{ "mfpid",     XSPR(31,339,945), XSPR_MASK, PPC403,    { RT } },
-{ "mfccr0",    XSPR(31,339,947), XSPR_MASK, PPC405,    { RT } },
-{ "mficdbdr",  XSPR(31,339,979), XSPR_MASK, PPC403,    { RT } },
-{ "mfummcr0",  XSPR(31,339,936),  XSPR_MASK, PPC750,   { RT } },
-{ "mfupmc1",   XSPR(31,339,937),  XSPR_MASK, PPC750,   { RT } },
-{ "mfupmc2",   XSPR(31,339,938),  XSPR_MASK, PPC750,   { RT } },
-{ "mfusia",    XSPR(31,339,939),  XSPR_MASK, PPC750,   { RT } },
-{ "mfummcr1",  XSPR(31,339,940),  XSPR_MASK, PPC750,   { RT } },
-{ "mfupmc3",   XSPR(31,339,941),  XSPR_MASK, PPC750,   { RT } },
-{ "mfupmc4",   XSPR(31,339,942),  XSPR_MASK, PPC750,   { RT } },
-{ "mfiac3",     XSPR(31,339,948),  XSPR_MASK, PPC405,  { RT } },
-{ "mfiac4",     XSPR(31,339,949),  XSPR_MASK, PPC405,  { RT } },
-{ "mfdvc1",     XSPR(31,339,950),  XSPR_MASK, PPC405,  { RT } },
-{ "mfdvc2",     XSPR(31,339,951),  XSPR_MASK, PPC405,  { RT } },
-{ "mfmmcr0",   XSPR(31,339,952),  XSPR_MASK, PPC750,   { RT } },
-{ "mfpmc1",    XSPR(31,339,953),  XSPR_MASK, PPC750,   { RT } },
-{ "mfsgr",     XSPR(31,339,953),  XSPR_MASK, PPC403,   { RT } },
-{ "mfpmc2",    XSPR(31,339,954),  XSPR_MASK, PPC750,   { RT } },
-{ "mfdcwr",    XSPR(31,339,954),  XSPR_MASK, PPC403,   { RT } },
-{ "mfsia",     XSPR(31,339,955),  XSPR_MASK, PPC750,   { RT } },
-{ "mfsler",    XSPR(31,339,955),  XSPR_MASK, PPC405,   { RT } },
-{ "mfmmcr1",   XSPR(31,339,956),  XSPR_MASK, PPC750,   { RT } },
-{ "mfsu0r",    XSPR(31,339,956),  XSPR_MASK, PPC405,   { RT } },
-{ "mfpmc3",    XSPR(31,339,957),  XSPR_MASK, PPC750,   { RT } },
-{ "mfdbcr1",   XSPR(31,339,957),  XSPR_MASK, PPC405,   { RT } },
-{ "mfpmc4",    XSPR(31,339,958),  XSPR_MASK, PPC750,   { RT } },
-{ "mfesr",   XSPR(31,339,980), XSPR_MASK, PPC403,      { RT } },
-{ "mfdear",  XSPR(31,339,981), XSPR_MASK, PPC403,      { RT } },
-{ "mfevpr",  XSPR(31,339,982), XSPR_MASK, PPC403,      { RT } },
-{ "mfcdbcr", XSPR(31,339,983), XSPR_MASK, PPC403,      { RT } },
-{ "mftsr",   XSPR(31,339,984), XSPR_MASK, PPC403,      { RT } },
-{ "mftcr",   XSPR(31,339,986), XSPR_MASK, PPC403,      { RT } },
-{ "mfpit",   XSPR(31,339,987), XSPR_MASK, PPC403,      { RT } },
-{ "mftbhi",  XSPR(31,339,988), XSPR_MASK, PPC403,      { RT } },
-{ "mftblo",  XSPR(31,339,989), XSPR_MASK, PPC403,      { RT } },
-{ "mfsrr2",  XSPR(31,339,990), XSPR_MASK, PPC403,      { RT } },
-{ "mfsrr3",  XSPR(31,339,991), XSPR_MASK, PPC403,      { RT } },
-{ "mfdbsr",  XSPR(31,339,1008), XSPR_MASK, PPC403,     { RT } },
-{ "mfdbcr0", XSPR(31,339,1010), XSPR_MASK, PPC405,     { RT } },
-{ "mfiac1",  XSPR(31,339,1012), XSPR_MASK, PPC403,     { RT } },
-{ "mfiac2",  XSPR(31,339,1013), XSPR_MASK, PPC403,     { RT } },
-{ "mfdac1",  XSPR(31,339,1014), XSPR_MASK, PPC403,     { RT } },
-{ "mfdac2",  XSPR(31,339,1015), XSPR_MASK, PPC403,     { RT } },
-{ "mfdccr",  XSPR(31,339,1018), XSPR_MASK, PPC403,     { RT } },
-{ "mficcr",  XSPR(31,339,1019), XSPR_MASK, PPC403,     { RT } },
-{ "mfpbl1",  XSPR(31,339,1020), XSPR_MASK, PPC403,     { RT } },
-{ "mfpbu1",  XSPR(31,339,1021), XSPR_MASK, PPC403,     { RT } },
-{ "mfpbl2",  XSPR(31,339,1022), XSPR_MASK, PPC403,     { RT } },
-{ "mfpbu2",  XSPR(31,339,1023), XSPR_MASK, PPC403,     { RT } },
-{ "mfl2cr",    XSPR(31,339,1017), XSPR_MASK, PPC750,   { RT } },
-{ "mfictc",    XSPR(31,339,1019), XSPR_MASK, PPC750,   { RT } },
-{ "mfthrm1",   XSPR(31,339,1020), XSPR_MASK, PPC750,   { RT } },
-{ "mfthrm2",   XSPR(31,339,1021), XSPR_MASK, PPC750,   { RT } },
-{ "mfthrm3",   XSPR(31,339,1022), XSPR_MASK, PPC750,   { RT } },
-{ "mfspr",   X(31,339),        X_MASK,         COM,            { RT, SPR } },
-
-{ "lwax",    X(31,341),        X_MASK,         PPC64,          { RT, RA, RB } },
-
-{ "dst",     XDSS(31,342,0), XDSS_MASK,        PPCVEC,         { RA, RB, STRM } },
-{ "dstt",    XDSS(31,342,1), XDSS_MASK,        PPCVEC,         { RA, RB, STRM } },
-
-{ "lhax",    X(31,343),        X_MASK,         COM,            { RT, RA, RB } },
-
-{ "lhaxe",   X(31,351),        X_MASK,         BOOKE64,        { RT, RA, RB } },
-
-{ "dstst",   XDSS(31,374,0), XDSS_MASK,        PPCVEC,         { RA, RB, STRM } },
-{ "dststt",  XDSS(31,374,1), XDSS_MASK,        PPCVEC,         { RA, RB, STRM } },
-
-{ "dccci",   X(31,454),        XRT_MASK,       PPC403,         { RA, RB } },
-
-{ "abs",     XO(31,360,0,0), XORB_MASK, M601,          { RT, RA } },
-{ "abs.",    XO(31,360,0,1), XORB_MASK, M601,          { RT, RA } },
-{ "abso",    XO(31,360,1,0), XORB_MASK, M601,          { RT, RA } },
-{ "abso.",   XO(31,360,1,1), XORB_MASK, M601,          { RT, RA } },
-
-{ "divs",    XO(31,363,0,0), XO_MASK,  M601,           { RT, RA, RB } },
-{ "divs.",   XO(31,363,0,1), XO_MASK,  M601,           { RT, RA, RB } },
-{ "divso",   XO(31,363,1,0), XO_MASK,  M601,           { RT, RA, RB } },
-{ "divso.",  XO(31,363,1,1), XO_MASK,  M601,           { RT, RA, RB } },
-
-{ "tlbia",   X(31,370),        0xffffffff,     PPC,            { 0 } },
-
-{ "mftbl",   XSPR(31,371,268), XSPR_MASK, CLASSIC,     { RT } },
-{ "mftbu",   XSPR(31,371,269), XSPR_MASK, CLASSIC,     { RT } },
-{ "mftb",    X(31,371),        X_MASK,         CLASSIC,        { RT, TBR } },
-
-{ "lwaux",   X(31,373),        X_MASK,         PPC64,          { RT, RAL, RB } },
-
-{ "lhaux",   X(31,375),        X_MASK,         COM,            { RT, RAL, RB } },
-
-{ "lhauxe",  X(31,383),        X_MASK,         BOOKE64,        { RT, RAL, RB } },
-
-{ "mtdcrx",  X(31,387),        X_MASK,         BOOKE,          { RA, RS } },
-
-{ "dcblc",   X(31,390),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-
-{ "subfe64", XO(31,392,0,0), XO_MASK,  BOOKE64,        { RT, RA, RB } },
-{ "subfe64o",XO(31,392,1,0), XO_MASK,  BOOKE64,        { RT, RA, RB } },
-
-{ "adde64",  XO(31,394,0,0), XO_MASK,  BOOKE64,        { RT, RA, RB } },
-{ "adde64o", XO(31,394,1,0), XO_MASK,  BOOKE64,        { RT, RA, RB } },
-
-{ "dcblce",  X(31,398),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-
-{ "slbmte",  X(31,402), XRA_MASK,      PPC64,          { RS, RB } },
-
-{ "sthx",    X(31,407),        X_MASK,         COM,            { RS, RA, RB } },
-
-{ "lfqx",    X(31,791),        X_MASK,         POWER2,         { FRT, RA, RB } },
-
-{ "lfqux",   X(31,823),        X_MASK,         POWER2,         { FRT, RA, RB } },
-
-{ "stfqx",   X(31,919),        X_MASK,         POWER2,         { FRS, RA, RB } },
-
-{ "stfqux",  X(31,951),        X_MASK,         POWER2,         { FRS, RA, RB } },
-
-{ "orc",     XRC(31,412,0), X_MASK,    COM,            { RA, RS, RB } },
-{ "orc.",    XRC(31,412,1), X_MASK,    COM,            { RA, RS, RB } },
-
-{ "sradi",   XS(31,413,0), XS_MASK,    PPC64,          { RA, RS, SH6 } },
-{ "sradi.",  XS(31,413,1), XS_MASK,    PPC64,          { RA, RS, SH6 } },
-
-{ "sthxe",   X(31,415),        X_MASK,         BOOKE64,        { RS, RA, RB } },
-
-{ "slbie",   X(31,434),        XRTRA_MASK,     PPC64,          { RB } },
-
-{ "ecowx",   X(31,438),        X_MASK,         PPC,            { RT, RA, RB } },
-
-{ "sthux",   X(31,439),        X_MASK,         COM,            { RS, RAS, RB } },
-
-{ "sthuxe",  X(31,447),        X_MASK,         BOOKE64,        { RS, RAS, RB } },
-
-{ "mr",             XRC(31,444,0), X_MASK,     COM,            { RA, RS, RBS } },
-{ "or",      XRC(31,444,0), X_MASK,    COM,            { RA, RS, RB } },
-{ "mr.",     XRC(31,444,1), X_MASK,    COM,            { RA, RS, RBS } },
-{ "or.",     XRC(31,444,1), X_MASK,    COM,            { RA, RS, RB } },
-
-{ "mtexisr", XSPR(31,451,64), XSPR_MASK, PPC403,       { RT } },
-{ "mtexier", XSPR(31,451,66), XSPR_MASK, PPC403,       { RT } },
-{ "mtbr0",   XSPR(31,451,128), XSPR_MASK, PPC403,      { RT } },
-{ "mtbr1",   XSPR(31,451,129), XSPR_MASK, PPC403,      { RT } },
-{ "mtbr2",   XSPR(31,451,130), XSPR_MASK, PPC403,      { RT } },
-{ "mtbr3",   XSPR(31,451,131), XSPR_MASK, PPC403,      { RT } },
-{ "mtbr4",   XSPR(31,451,132), XSPR_MASK, PPC403,      { RT } },
-{ "mtbr5",   XSPR(31,451,133), XSPR_MASK, PPC403,      { RT } },
-{ "mtbr6",   XSPR(31,451,134), XSPR_MASK, PPC403,      { RT } },
-{ "mtbr7",   XSPR(31,451,135), XSPR_MASK, PPC403,      { RT } },
-{ "mtbear",  XSPR(31,451,144), XSPR_MASK, PPC403,      { RT } },
-{ "mtbesr",  XSPR(31,451,145), XSPR_MASK, PPC403,      { RT } },
-{ "mtiocr",  XSPR(31,451,160), XSPR_MASK, PPC403,      { RT } },
-{ "mtdmacr0", XSPR(31,451,192), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmact0", XSPR(31,451,193), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmada0", XSPR(31,451,194), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmasa0", XSPR(31,451,195), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmacc0", XSPR(31,451,196), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmacr1", XSPR(31,451,200), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmact1", XSPR(31,451,201), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmada1", XSPR(31,451,202), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmasa1", XSPR(31,451,203), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmacc1", XSPR(31,451,204), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmacr2", XSPR(31,451,208), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmact2", XSPR(31,451,209), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmada2", XSPR(31,451,210), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmasa2", XSPR(31,451,211), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmacc2", XSPR(31,451,212), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmacr3", XSPR(31,451,216), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmact3", XSPR(31,451,217), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmada3", XSPR(31,451,218), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmasa3", XSPR(31,451,219), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmacc3", XSPR(31,451,220), XSPR_MASK, PPC403,     { RT } },
-{ "mtdmasr", XSPR(31,451,224), XSPR_MASK, PPC403,      { RT } },
-{ "mtdcr",   X(31,451),        X_MASK,         PPC403,         { SPR, RS } },
-{ "mtdcr",   X(31,451),        X_MASK,         BOOKE,          { SPR, RS } },
-
-{ "subfze64",XO(31,456,0,0), XORB_MASK, BOOKE64,       { RT, RA } },
-{ "subfze64o",XO(31,456,1,0), XORB_MASK, BOOKE64,      { RT, RA } },
-
-{ "divdu",   XO(31,457,0,0), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "divdu.",  XO(31,457,0,1), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "divduo",  XO(31,457,1,0), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "divduo.", XO(31,457,1,1), XO_MASK,  PPC64,          { RT, RA, RB } },
-
-{ "addze64", XO(31,458,0,0), XORB_MASK, BOOKE64,       { RT, RA } },
-{ "addze64o",XO(31,458,1,0), XORB_MASK, BOOKE64,       { RT, RA } },
-
-{ "divwu",   XO(31,459,0,0), XO_MASK,  PPC,            { RT, RA, RB } },
-{ "divwu.",  XO(31,459,0,1), XO_MASK,  PPC,            { RT, RA, RB } },
-{ "divwuo",  XO(31,459,1,0), XO_MASK,  PPC,            { RT, RA, RB } },
-{ "divwuo.", XO(31,459,1,1), XO_MASK,  PPC,            { RT, RA, RB } },
-
-{ "mtmq",    XSPR(31,467,0),   XSPR_MASK,    M601,     { RS } },
-{ "mtxer",   XSPR(31,467,1),   XSPR_MASK,    COM,      { RS } },
-{ "mtlr",    XSPR(31,467,8),   XSPR_MASK,    COM,      { RS } },
-{ "mtctr",   XSPR(31,467,9),   XSPR_MASK,    COM,      { RS } },
-{ "mttid",   XSPR(31,467,17),  XSPR_MASK,    POWER,    { RS } },
-{ "mtdsisr", XSPR(31,467,18),  XSPR_MASK,    COM,      { RS } },
-{ "mtdar",   XSPR(31,467,19),  XSPR_MASK,    COM,      { RS } },
-{ "mtrtcu",  XSPR(31,467,20),  XSPR_MASK,    COM,      { RS } },
-{ "mtrtcl",  XSPR(31,467,21),  XSPR_MASK,    COM,      { RS } },
-{ "mtdec",   XSPR(31,467,22),  XSPR_MASK,    COM,      { RS } },
-{ "mtsdr0",  XSPR(31,467,24),  XSPR_MASK,    POWER,    { RS } },
-{ "mtsdr1",  XSPR(31,467,25),  XSPR_MASK,    COM,      { RS } },
-{ "mtsrr0",  XSPR(31,467,26),  XSPR_MASK,    COM,      { RS } },
-{ "mtsrr1",  XSPR(31,467,27),  XSPR_MASK,    COM,      { RS } },
-{ "mtcmpa",   XSPR(31,467,144), XSPR_MASK, PPC860,     { RT } },
-{ "mtcmpb",   XSPR(31,467,145), XSPR_MASK, PPC860,     { RT } },
-{ "mtcmpc",   XSPR(31,467,146), XSPR_MASK, PPC860,     { RT } },
-{ "mtcmpd",   XSPR(31,467,147), XSPR_MASK, PPC860,     { RT } },
-{ "mticr",    XSPR(31,467,148), XSPR_MASK, PPC860,     { RT } },
-{ "mtder",    XSPR(31,467,149), XSPR_MASK, PPC860,     { RT } },
-{ "mtcounta", XSPR(31,467,150), XSPR_MASK, PPC860,     { RT } },
-{ "mtcountb", XSPR(31,467,151), XSPR_MASK, PPC860,     { RT } },
-{ "mtcmpe",   XSPR(31,467,152), XSPR_MASK, PPC860,     { RT } },
-{ "mtcmpf",   XSPR(31,467,153), XSPR_MASK, PPC860,     { RT } },
-{ "mtcmpg",   XSPR(31,467,154), XSPR_MASK, PPC860,     { RT } },
-{ "mtcmph",   XSPR(31,467,155), XSPR_MASK, PPC860,     { RT } },
-{ "mtlctrl1", XSPR(31,467,156), XSPR_MASK, PPC860,     { RT } },
-{ "mtlctrl2", XSPR(31,467,157), XSPR_MASK, PPC860,     { RT } },
-{ "mtictrl",  XSPR(31,467,158), XSPR_MASK, PPC860,     { RT } },
-{ "mtbar",    XSPR(31,467,159), XSPR_MASK, PPC860,     { RT } },
-{ "mtvrsave",XSPR(31,467,256), XSPR_MASK,    PPCVEC,   { RT } },
-{ "mtsprg",  XSPR(31,467,272), XSPRG_MASK,   PPC,      { SPRG, RS } },
-{ "mtsprg0", XSPR(31,467,272), XSPR_MASK,    PPC,      { RT } },
-{ "mtsprg1", XSPR(31,467,273), XSPR_MASK,    PPC,      { RT } },
-{ "mtsprg2", XSPR(31,467,274), XSPR_MASK,    PPC,      { RT } },
-{ "mtsprg3", XSPR(31,467,275), XSPR_MASK,    PPC,      { RT } },
-{ "mtsprg4", XSPR(31,467,276), XSPR_MASK,    PPC405,   { RT } },
-{ "mtsprg5", XSPR(31,467,277), XSPR_MASK,    PPC405,   { RT } },
-{ "mtsprg6", XSPR(31,467,278), XSPR_MASK,    PPC405,   { RT } },
-{ "mtsprg7", XSPR(31,467,279), XSPR_MASK,    PPC405,   { RT } },
-{ "mtasr",   XSPR(31,467,280), XSPR_MASK,    PPC64,    { RS } },
-{ "mtear",   XSPR(31,467,282), XSPR_MASK,    PPC,      { RS } },
-{ "mttbl",   XSPR(31,467,284), XSPR_MASK,    PPC,      { RS } },
-{ "mttbu",   XSPR(31,467,285), XSPR_MASK,    PPC,      { RS } },
-{ "mtspefscr",XSPR(31,467,512),XSPR_MASK,    PPCSPE,   { RT } },
-{ "mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC,      { SPRBAT, RS } },
-{ "mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC,      { SPRBAT, RS } },
-{ "mtdbatu", XSPR(31,467,536), XSPRBAT_MASK, PPC,      { SPRBAT, RS } },
-{ "mtdbatl", XSPR(31,467,537), XSPRBAT_MASK, PPC,      { SPRBAT, RS } },
-{ "mtzpr",   XSPR(31,467,944), XSPR_MASK, PPC403,      { RT } },
-{ "mtpid",   XSPR(31,467,945), XSPR_MASK, PPC403,      { RT } },
-{ "mtccr0",  XSPR(31,467,947), XSPR_MASK, PPC405,      { RT } },
-{ "mtiac3",  XSPR(31,467,948), XSPR_MASK, PPC405,      { RT } },
-{ "mtiac4",  XSPR(31,467,949), XSPR_MASK, PPC405,      { RT } },
-{ "mtdvc1",  XSPR(31,467,950), XSPR_MASK, PPC405,      { RT } },
-{ "mtdvc2",  XSPR(31,467,951), XSPR_MASK, PPC405,      { RT } },
-{ "mtsgr",   XSPR(31,467,953), XSPR_MASK, PPC403,      { RT } },
-{ "mtdcwr",  XSPR(31,467,954), XSPR_MASK, PPC403,      { RT } },
-{ "mtsler",  XSPR(31,467,955), XSPR_MASK, PPC405,      { RT } },
-{ "mtsu0r",  XSPR(31,467,956), XSPR_MASK, PPC405,      { RT } },
-{ "mtdbcr1", XSPR(31,467,957), XSPR_MASK, PPC405,      { RT } },
-{ "mticdbdr",XSPR(31,467,979), XSPR_MASK, PPC403,      { RT } },
-{ "mtesr",   XSPR(31,467,980), XSPR_MASK, PPC403,      { RT } },
-{ "mtdear",  XSPR(31,467,981), XSPR_MASK, PPC403,      { RT } },
-{ "mtevpr",  XSPR(31,467,982), XSPR_MASK, PPC403,      { RT } },
-{ "mtcdbcr", XSPR(31,467,983), XSPR_MASK, PPC403,      { RT } },
-{ "mttsr",   XSPR(31,467,984), XSPR_MASK, PPC403,      { RT } },
-{ "mttcr",   XSPR(31,467,986), XSPR_MASK, PPC403,      { RT } },
-{ "mtpit",   XSPR(31,467,987), XSPR_MASK, PPC403,      { RT } },
-{ "mttbhi",  XSPR(31,467,988), XSPR_MASK, PPC403,      { RT } },
-{ "mttblo",  XSPR(31,467,989), XSPR_MASK, PPC403,      { RT } },
-{ "mtsrr2",  XSPR(31,467,990), XSPR_MASK, PPC403,      { RT } },
-{ "mtsrr3",  XSPR(31,467,991), XSPR_MASK, PPC403,      { RT } },
-{ "mtdbsr",  XSPR(31,467,1008), XSPR_MASK, PPC403,     { RT } },
-{ "mtdbcr0", XSPR(31,467,1010), XSPR_MASK, PPC405,     { RT } },
-{ "mtiac1",  XSPR(31,467,1012), XSPR_MASK, PPC403,     { RT } },
-{ "mtiac2",  XSPR(31,467,1013), XSPR_MASK, PPC403,     { RT } },
-{ "mtdac1",  XSPR(31,467,1014), XSPR_MASK, PPC403,     { RT } },
-{ "mtdac2",  XSPR(31,467,1015), XSPR_MASK, PPC403,     { RT } },
-{ "mtdccr",  XSPR(31,467,1018), XSPR_MASK, PPC403,     { RT } },
-{ "mticcr",  XSPR(31,467,1019), XSPR_MASK, PPC403,     { RT } },
-{ "mtpbl1",  XSPR(31,467,1020), XSPR_MASK, PPC403,     { RT } },
-{ "mtpbu1",  XSPR(31,467,1021), XSPR_MASK, PPC403,     { RT } },
-{ "mtpbl2",  XSPR(31,467,1022), XSPR_MASK, PPC403,     { RT } },
-{ "mtpbu2",  XSPR(31,467,1023), XSPR_MASK, PPC403,     { RT } },
-{ "mtummcr0",  XSPR(31,467,936),  XSPR_MASK, PPC750,   { RT } },
-{ "mtupmc1",   XSPR(31,467,937),  XSPR_MASK, PPC750,   { RT } },
-{ "mtupmc2",   XSPR(31,467,938),  XSPR_MASK, PPC750,   { RT } },
-{ "mtusia",    XSPR(31,467,939),  XSPR_MASK, PPC750,   { RT } },
-{ "mtummcr1",  XSPR(31,467,940),  XSPR_MASK, PPC750,   { RT } },
-{ "mtupmc3",   XSPR(31,467,941),  XSPR_MASK, PPC750,   { RT } },
-{ "mtupmc4",   XSPR(31,467,942),  XSPR_MASK, PPC750,   { RT } },
-{ "mtmmcr0",   XSPR(31,467,952),  XSPR_MASK, PPC750,   { RT } },
-{ "mtpmc1",    XSPR(31,467,953),  XSPR_MASK, PPC750,   { RT } },
-{ "mtpmc2",    XSPR(31,467,954),  XSPR_MASK, PPC750,   { RT } },
-{ "mtsia",     XSPR(31,467,955),  XSPR_MASK, PPC750,   { RT } },
-{ "mtmmcr1",   XSPR(31,467,956),  XSPR_MASK, PPC750,   { RT } },
-{ "mtpmc3",    XSPR(31,467,957),  XSPR_MASK, PPC750,   { RT } },
-{ "mtpmc4",    XSPR(31,467,958),  XSPR_MASK, PPC750,   { RT } },
-{ "mtl2cr",    XSPR(31,467,1017), XSPR_MASK, PPC750,   { RT } },
-{ "mtictc",    XSPR(31,467,1019), XSPR_MASK, PPC750,   { RT } },
-{ "mtthrm1",   XSPR(31,467,1020), XSPR_MASK, PPC750,   { RT } },
-{ "mtthrm2",   XSPR(31,467,1021), XSPR_MASK, PPC750,   { RT } },
-{ "mtthrm3",   XSPR(31,467,1022), XSPR_MASK, PPC750,   { RT } },
-{ "mtspr",   X(31,467),               X_MASK,       COM,       { SPR, RS } },
-
-{ "dcbi",    X(31,470),        XRT_MASK,       PPC,            { RA, RB } },
-
-{ "nand",    XRC(31,476,0), X_MASK,    COM,            { RA, RS, RB } },
-{ "nand.",   XRC(31,476,1), X_MASK,    COM,            { RA, RS, RB } },
-
-{ "dcbie",   X(31,478),        XRT_MASK,       BOOKE64,        { RA, RB } },
-
-{ "dcread",  X(31,486),        X_MASK,         PPC403,         { RT, RA, RB }},
-
-{ "mtpmr",   X(31,462),        X_MASK,         PPCPMR,         { PMRN, RS }},
-
-{ "icbtls",  X(31,486),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-
-{ "nabs",    XO(31,488,0,0), XORB_MASK, M601,          { RT, RA } },
-{ "subfme64",XO(31,488,0,0), XORB_MASK, BOOKE64,       { RT, RA } },
-{ "nabs.",   XO(31,488,0,1), XORB_MASK, M601,          { RT, RA } },
-{ "nabso",   XO(31,488,1,0), XORB_MASK, M601,          { RT, RA } },
-{ "subfme64o",XO(31,488,1,0), XORB_MASK, BOOKE64,      { RT, RA } },
-{ "nabso.",  XO(31,488,1,1), XORB_MASK, M601,          { RT, RA } },
-
-{ "divd",    XO(31,489,0,0), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "divd.",   XO(31,489,0,1), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "divdo",   XO(31,489,1,0), XO_MASK,  PPC64,          { RT, RA, RB } },
-{ "divdo.",  XO(31,489,1,1), XO_MASK,  PPC64,          { RT, RA, RB } },
-
-{ "addme64", XO(31,490,0,0), XORB_MASK, BOOKE64,       { RT, RA } },
-{ "addme64o",XO(31,490,1,0), XORB_MASK, BOOKE64,       { RT, RA } },
-
-{ "divw",    XO(31,491,0,0), XO_MASK,  PPC,            { RT, RA, RB } },
-{ "divw.",   XO(31,491,0,1), XO_MASK,  PPC,            { RT, RA, RB } },
-{ "divwo",   XO(31,491,1,0), XO_MASK,  PPC,            { RT, RA, RB } },
-{ "divwo.",  XO(31,491,1,1), XO_MASK,  PPC,            { RT, RA, RB } },
-
-{ "icbtlse", X(31,494),        X_MASK,         PPCCHLK,        { CT, RA, RB }},
-
-{ "slbia",   X(31,498),        0xffffffff,     PPC64,          { 0 } },
-
-{ "cli",     X(31,502), XRB_MASK,      POWER,          { RT, RA } },
-
-{ "stdcxe.", XRC(31,511,1), X_MASK,    BOOKE64,        { RS, RA, RB } },
-
-{ "mcrxr",   X(31,512),        XRARB_MASK|(3<<21), COM,        { BF } },
-
-{ "bblels",  X(31,518),        X_MASK,         PPCBRLK,        { 0 }},
-{ "mcrxr64", X(31,544),        XRARB_MASK|(3<<21), BOOKE,      { BF } },
-
-{ "clcs",    X(31,531), XRB_MASK,      M601,           { RT, RA } },
-
-{ "lswx",    X(31,533),        X_MASK,         PPCCOM,         { RT, RA, RB } },
-{ "lsx",     X(31,533),        X_MASK,         PWRCOM,         { RT, RA, RB } },
-
-{ "lwbrx",   X(31,534),        X_MASK,         PPCCOM,         { RT, RA, RB } },
-{ "lbrx",    X(31,534),        X_MASK,         PWRCOM,         { RT, RA, RB } },
-
-{ "lfsx",    X(31,535),        X_MASK,         COM,            { FRT, RA, RB } },
-
-{ "srw",     XRC(31,536,0), X_MASK,    PPCCOM,         { RA, RS, RB } },
-{ "sr",      XRC(31,536,0), X_MASK,    PWRCOM,         { RA, RS, RB } },
-{ "srw.",    XRC(31,536,1), X_MASK,    PPCCOM,         { RA, RS, RB } },
-{ "sr.",     XRC(31,536,1), X_MASK,    PWRCOM,         { RA, RS, RB } },
-
-{ "rrib",    XRC(31,537,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "rrib.",   XRC(31,537,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "srd",     XRC(31,539,0), X_MASK,    PPC64,          { RA, RS, RB } },
-{ "srd.",    XRC(31,539,1), X_MASK,    PPC64,          { RA, RS, RB } },
-
-{ "maskir",  XRC(31,541,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "maskir.", XRC(31,541,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "lwbrxe",  X(31,542),        X_MASK,         BOOKE64,        { RT, RA, RB } },
-
-{ "lfsxe",   X(31,543),        X_MASK,         BOOKE64,        { FRT, RA, RB } },
-
-{ "bbelr",   X(31,550),        X_MASK,         PPCBRLK,        { 0 }},
-{ "tlbsync", X(31,566),        0xffffffff,     PPC,            { 0 } },
-
-{ "lfsux",   X(31,567),        X_MASK,         COM,            { FRT, RAS, RB } },
-
-{ "lfsuxe",  X(31,575),        X_MASK,         BOOKE64,        { FRT, RAS, RB } },
-
-{ "mfsr",    X(31,595),        XRB_MASK|(1<<20), COM32,        { RT, SR } },
-
-{ "lswi",    X(31,597),        X_MASK,         PPCCOM,         { RT, RA, NB } },
-{ "lsi",     X(31,597),        X_MASK,         PWRCOM,         { RT, RA, NB } },
-
-{ "lwsync",  XSYNC(31,598,1), 0xffffffff, PPCONLY,     { 0 } },
-{ "ptesync", XSYNC(31,598,2), 0xffffffff, PPC64,       { 0 } },
-{ "sync",    X(31,598), XSYNC_MASK,    PPCCOM,         { LS } },
-{ "dcs",     X(31,598), 0xffffffff,    PWRCOM,         { 0 } },
-{ "msync",   X(31,598), 0xf80007fe,    BOOKE,          { 0 } },
-
-{ "lfdx",    X(31,599), X_MASK,                COM,            { FRT, RA, RB } },
-
-{ "lfdxe",   X(31,607), X_MASK,                BOOKE64,        { FRT, RA, RB } },
-
-{ "mfsri",   X(31,627), X_MASK,                PWRCOM,         { RT, RA, RB } },
-
-{ "dclst",   X(31,630), XRB_MASK,      PWRCOM,         { RS, RA } },
-
-{ "lfdux",   X(31,631), X_MASK,                COM,            { FRT, RAS, RB } },
-
-{ "lfduxe",  X(31,639), X_MASK,                BOOKE64,        { FRT, RAS, RB } },
-
-{ "mfsrin",  X(31,659), XRA_MASK,      PPC32,          { RT, RB } },
-
-{ "stswx",   X(31,661), X_MASK,                PPCCOM,         { RS, RA, RB } },
-{ "stsx",    X(31,661), X_MASK,                PWRCOM,         { RS, RA, RB } },
-
-{ "stwbrx",  X(31,662), X_MASK,                PPCCOM,         { RS, RA, RB } },
-{ "stbrx",   X(31,662), X_MASK,                PWRCOM,         { RS, RA, RB } },
-
-{ "stfsx",   X(31,663), X_MASK,                COM,            { FRS, RA, RB } },
-
-{ "srq",     XRC(31,664,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "srq.",    XRC(31,664,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "sre",     XRC(31,665,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "sre.",    XRC(31,665,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "stwbrxe", X(31,670), X_MASK,                BOOKE64,        { RS, RA, RB } },
-
-{ "stfsxe",  X(31,671), X_MASK,                BOOKE64,        { FRS, RA, RB } },
-
-{ "stfsux",  X(31,695),        X_MASK,         COM,            { FRS, RAS, RB } },
-
-{ "sriq",    XRC(31,696,0), X_MASK,    M601,           { RA, RS, SH } },
-{ "sriq.",   XRC(31,696,1), X_MASK,    M601,           { RA, RS, SH } },
-
-{ "stfsuxe", X(31,703),        X_MASK,         BOOKE64,        { FRS, RAS, RB } },
-
-{ "stswi",   X(31,725),        X_MASK,         PPCCOM,         { RS, RA, NB } },
-{ "stsi",    X(31,725),        X_MASK,         PWRCOM,         { RS, RA, NB } },
-
-{ "stfdx",   X(31,727),        X_MASK,         COM,            { FRS, RA, RB } },
-
-{ "srlq",    XRC(31,728,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "srlq.",   XRC(31,728,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "sreq",    XRC(31,729,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "sreq.",   XRC(31,729,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "stfdxe",  X(31,735),        X_MASK,         BOOKE64,        { FRS, RA, RB } },
-
-{ "dcba",    X(31,758),        XRT_MASK,       PPC405,         { RA, RB } },
-{ "dcba",    X(31,758),        XRT_MASK,       BOOKE,          { RA, RB } },
-
-{ "stfdux",  X(31,759),        X_MASK,         COM,            { FRS, RAS, RB } },
-
-{ "srliq",   XRC(31,760,0), X_MASK,    M601,           { RA, RS, SH } },
-{ "srliq.",  XRC(31,760,1), X_MASK,    M601,           { RA, RS, SH } },
-
-{ "dcbae",   X(31,766),        XRT_MASK,       BOOKE64,        { RA, RB } },
-
-{ "stfduxe", X(31,767),        X_MASK,         BOOKE64,        { FRS, RAS, RB } },
-
-{ "tlbivax", X(31,786),        XRT_MASK,       BOOKE,          { RA, RB } },
-{ "tlbivaxe",X(31,787),        XRT_MASK,       BOOKE,          { RA, RB } },
-
-{ "lhbrx",   X(31,790),        X_MASK,         COM,            { RT, RA, RB } },
-
-{ "sraw",    XRC(31,792,0), X_MASK,    PPCCOM,         { RA, RS, RB } },
-{ "sra",     XRC(31,792,0), X_MASK,    PWRCOM,         { RA, RS, RB } },
-{ "sraw.",   XRC(31,792,1), X_MASK,    PPCCOM,         { RA, RS, RB } },
-{ "sra.",    XRC(31,792,1), X_MASK,    PWRCOM,         { RA, RS, RB } },
-
-{ "srad",    XRC(31,794,0), X_MASK,    PPC64,          { RA, RS, RB } },
-{ "srad.",   XRC(31,794,1), X_MASK,    PPC64,          { RA, RS, RB } },
-
-{ "lhbrxe",  X(31,798),        X_MASK,         BOOKE64,        { RT, RA, RB } },
-
-{ "ldxe",    X(31,799),        X_MASK,         BOOKE64,        { RT, RA, RB } },
-{ "lduxe",   X(31,831),        X_MASK,         BOOKE64,        { RT, RA, RB } },
-
-{ "rac",     X(31,818),        X_MASK,         PWRCOM,         { RT, RA, RB } },
-
-{ "dss",     XDSS(31,822,0), XDSS_MASK,        PPCVEC,         { STRM } },
-{ "dssall",  XDSS(31,822,1), XDSS_MASK,        PPCVEC,         { 0 } },
-
-{ "srawi",   XRC(31,824,0), X_MASK,    PPCCOM,         { RA, RS, SH } },
-{ "srai",    XRC(31,824,0), X_MASK,    PWRCOM,         { RA, RS, SH } },
-{ "srawi.",  XRC(31,824,1), X_MASK,    PPCCOM,         { RA, RS, SH } },
-{ "srai.",   XRC(31,824,1), X_MASK,    PWRCOM,         { RA, RS, SH } },
-
-{ "slbmfev", X(31,851), XRA_MASK,      PPC64,          { RT, RB } },
-
-{ "eieio",   X(31,854),        0xffffffff,     PPC,            { 0 } },
-{ "mbar",    X(31,854),        0xffffffff,     BOOKE,          { MO } },
-
-{ "tlbsx",   XRC(31,914,0), X_MASK,    PPC403,         { RT, RA, RB } },
-{ "tlbsx.",  XRC(31,914,1), X_MASK,    PPC403,         { RT, RA, RB } },
-
-{ "tlbsx",   XRC(31,914,0), X_MASK,    BOOKE,          { RA, RB } },
-{ "tlbsx.",  XRC(31,914,1), X_MASK,    BOOKE,          { RA, RB } },
-{ "tlbsxe",  XRC(31,915,0), X_MASK,    BOOKE,          { RA, RB } },
-{ "tlbsxe.", XRC(31,915,1), X_MASK,    BOOKE,          { RA, RB } },
-
-{ "slbmfee", X(31,915), XRA_MASK,      PPC64,          { RT, RB } },
-
-{ "sthbrx",  X(31,918),        X_MASK,         COM,            { RS, RA, RB } },
-
-{ "sraq",    XRC(31,920,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "sraq.",   XRC(31,920,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "srea",    XRC(31,921,0), X_MASK,    M601,           { RA, RS, RB } },
-{ "srea.",   XRC(31,921,1), X_MASK,    M601,           { RA, RS, RB } },
-
-{ "extsh",   XRC(31,922,0), XRB_MASK,  PPCCOM,         { RA, RS } },
-{ "exts",    XRC(31,922,0), XRB_MASK,  PWRCOM,         { RA, RS } },
-{ "extsh.",  XRC(31,922,1), XRB_MASK,  PPCCOM,         { RA, RS } },
-{ "exts.",   XRC(31,922,1), XRB_MASK,  PWRCOM,         { RA, RS } },
-
-{ "sthbrxe", X(31,926),        X_MASK,         BOOKE64,        { RS, RA, RB } },
-
-{ "stdxe",   X(31,927), X_MASK,                BOOKE64,        { RS, RA, RB } },
-
-{ "tlbre",   X(31,946),        X_MASK,         BOOKE,          { RT, RA, WS } },
-
-{ "tlbrehi", XTLB(31,946,0), XTLB_MASK,        PPC403,         { RT, RA } },
-{ "tlbrelo", XTLB(31,946,1), XTLB_MASK,        PPC403,         { RT, RA } },
-
-{ "sraiq",   XRC(31,952,0), X_MASK,    M601,           { RA, RS, SH } },
-{ "sraiq.",  XRC(31,952,1), X_MASK,    M601,           { RA, RS, SH } },
-
-{ "extsb",   XRC(31,954,0), XRB_MASK,  PPC,            { RA, RS} },
-{ "extsb.",  XRC(31,954,1), XRB_MASK,  PPC,            { RA, RS} },
-
-{ "stduxe",  X(31,959),        X_MASK,         BOOKE64,        { RS, RAS, RB } },
-
-{ "iccci",   X(31,966),        XRT_MASK,       PPC403,         { RA, RB } },
-
-{ "tlbld",   X(31,978),        XRTRA_MASK,     PPC,            { RB } },
-
-{ "tlbwehi", XTLB(31,978,0), XTLB_MASK,        PPC403,         { RT, RA } },
-{ "tlbwelo", XTLB(31,978,1), XTLB_MASK,        PPC403,         { RT, RA } },
-{ "tlbwe",   X(31,978),        X_MASK,         PPC403,         { RS, RA, SH } },
-
-{ "tlbwe",   X(31,978),        X_MASK,         BOOKE,          { RT, RA, WS } },
-
-{ "icbi",    X(31,982),        XRT_MASK,       PPC,            { RA, RB } },
-
-{ "stfiwx",  X(31,983),        X_MASK,         PPC,            { FRS, RA, RB } },
-
-{ "extsw",   XRC(31,986,0), XRB_MASK,  PPC,            { RA, RS } },
-{ "extsw.",  XRC(31,986,1), XRB_MASK,  PPC,            { RA, RS } },
-
-{ "icread",  X(31,998),        XRT_MASK,       PPC403,         { RA, RB } },
-
-{ "icbie",   X(31,990),        XRT_MASK,       BOOKE64,        { RA, RB } },
-{ "stfiwxe", X(31,991),        X_MASK,         BOOKE64,        { FRS, RA, RB } },
-
-{ "tlbli",   X(31,1010), XRTRA_MASK,   PPC,            { RB } },
-
-{ "dcbz",    X(31,1014), XRT_MASK,     PPC,            { RA, RB } },
-{ "dclz",    X(31,1014), XRT_MASK,     PPC,            { RA, RB } },
-
-{ "dcbze",   X(31,1022), XRT_MASK,     BOOKE64,        { RA, RB } },
-
-{ "lvebx",   X(31,   7), X_MASK,       PPCVEC,         { VD, RA, RB } },
-{ "lvehx",   X(31,  39), X_MASK,       PPCVEC,         { VD, RA, RB } },
-{ "lvewx",   X(31,  71), X_MASK,       PPCVEC,         { VD, RA, RB } },
-{ "lvsl",    X(31,   6), X_MASK,       PPCVEC,         { VD, RA, RB } },
-{ "lvsr",    X(31,  38), X_MASK,       PPCVEC,         { VD, RA, RB } },
-{ "lvx",     X(31, 103), X_MASK,       PPCVEC,         { VD, RA, RB } },
-{ "lvxl",    X(31, 359), X_MASK,       PPCVEC,         { VD, RA, RB } },
-{ "stvebx",  X(31, 135), X_MASK,       PPCVEC,         { VS, RA, RB } },
-{ "stvehx",  X(31, 167), X_MASK,       PPCVEC,         { VS, RA, RB } },
-{ "stvewx",  X(31, 199), X_MASK,       PPCVEC,         { VS, RA, RB } },
-{ "stvx",    X(31, 231), X_MASK,       PPCVEC,         { VS, RA, RB } },
-{ "stvxl",   X(31, 487), X_MASK,       PPCVEC,         { VS, RA, RB } },
-
-{ "lwz",     OP(32),   OP_MASK,        PPCCOM,         { RT, D, RA } },
-{ "l",      OP(32),    OP_MASK,        PWRCOM,         { RT, D, RA } },
-
-{ "lwzu",    OP(33),   OP_MASK,        PPCCOM,         { RT, D, RAL } },
-{ "lu",      OP(33),   OP_MASK,        PWRCOM,         { RT, D, RA } },
-
-{ "lbz",     OP(34),   OP_MASK,        COM,            { RT, D, RA } },
-
-{ "lbzu",    OP(35),   OP_MASK,        COM,            { RT, D, RAL } },
-
-{ "stw",     OP(36),   OP_MASK,        PPCCOM,         { RS, D, RA } },
-{ "st",      OP(36),   OP_MASK,        PWRCOM,         { RS, D, RA } },
-
-{ "stwu",    OP(37),   OP_MASK,        PPCCOM,         { RS, D, RAS } },
-{ "stu",     OP(37),   OP_MASK,        PWRCOM,         { RS, D, RA } },
-
-{ "stb",     OP(38),   OP_MASK,        COM,            { RS, D, RA } },
-
-{ "stbu",    OP(39),   OP_MASK,        COM,            { RS, D, RAS } },
-
-{ "lhz",     OP(40),   OP_MASK,        COM,            { RT, D, RA } },
-
-{ "lhzu",    OP(41),   OP_MASK,        COM,            { RT, D, RAL } },
-
-{ "lha",     OP(42),   OP_MASK,        COM,            { RT, D, RA } },
-
-{ "lhau",    OP(43),   OP_MASK,        COM,            { RT, D, RAL } },
-
-{ "sth",     OP(44),   OP_MASK,        COM,            { RS, D, RA } },
-
-{ "sthu",    OP(45),   OP_MASK,        COM,            { RS, D, RAS } },
-
-{ "lmw",     OP(46),   OP_MASK,        PPCCOM,         { RT, D, RAM } },
-{ "lm",      OP(46),   OP_MASK,        PWRCOM,         { RT, D, RA } },
-
-{ "stmw",    OP(47),   OP_MASK,        PPCCOM,         { RS, D, RA } },
-{ "stm",     OP(47),   OP_MASK,        PWRCOM,         { RS, D, RA } },
-
-{ "lfs",     OP(48),   OP_MASK,        COM,            { FRT, D, RA } },
-
-{ "lfsu",    OP(49),   OP_MASK,        COM,            { FRT, D, RAS } },
-
-{ "lfd",     OP(50),   OP_MASK,        COM,            { FRT, D, RA } },
-
-{ "lfdu",    OP(51),   OP_MASK,        COM,            { FRT, D, RAS } },
-
-{ "stfs",    OP(52),   OP_MASK,        COM,            { FRS, D, RA } },
-
-{ "stfsu",   OP(53),   OP_MASK,        COM,            { FRS, D, RAS } },
-
-{ "stfd",    OP(54),   OP_MASK,        COM,            { FRS, D, RA } },
-
-{ "stfdu",   OP(55),   OP_MASK,        COM,            { FRS, D, RAS } },
-
-{ "lfq",     OP(56),   OP_MASK,        POWER2,         { FRT, D, RA } },
-
-{ "lfqu",    OP(57),   OP_MASK,        POWER2,         { FRT, D, RA } },
-
-{ "lbze",    DEO(58,0), DE_MASK,       BOOKE64,        { RT, DE, RA } },
-{ "lbzue",   DEO(58,1), DE_MASK,       BOOKE64,        { RT, DE, RAL } },
-{ "lhze",    DEO(58,2), DE_MASK,       BOOKE64,        { RT, DE, RA } },
-{ "lhzue",   DEO(58,3), DE_MASK,       BOOKE64,        { RT, DE, RAL } },
-{ "lhae",    DEO(58,4), DE_MASK,       BOOKE64,        { RT, DE, RA } },
-{ "lhaue",   DEO(58,5), DE_MASK,       BOOKE64,        { RT, DE, RAL } },
-{ "lwze",    DEO(58,6), DE_MASK,       BOOKE64,        { RT, DE, RA } },
-{ "lwzue",   DEO(58,7), DE_MASK,       BOOKE64,        { RT, DE, RAL } },
-{ "stbe",    DEO(58,8), DE_MASK,       BOOKE64,        { RS, DE, RA } },
-{ "stbue",   DEO(58,9), DE_MASK,       BOOKE64,        { RS, DE, RAS } },
-{ "sthe",    DEO(58,10), DE_MASK,      BOOKE64,        { RS, DE, RA } },
-{ "sthue",   DEO(58,11), DE_MASK,      BOOKE64,        { RS, DE, RAS } },
-{ "stwe",    DEO(58,14), DE_MASK,      BOOKE64,        { RS, DE, RA } },
-{ "stwue",   DEO(58,15), DE_MASK,      BOOKE64,        { RS, DE, RAS } },
-
-{ "ld",      DSO(58,0),        DS_MASK,        PPC64,          { RT, DS, RA } },
-
-{ "ldu",     DSO(58,1), DS_MASK,       PPC64,          { RT, DS, RAL } },
-
-{ "lwa",     DSO(58,2), DS_MASK,       PPC64,          { RT, DS, RA } },
-
-{ "fdivs",   A(59,18,0), AFRC_MASK,    PPC,            { FRT, FRA, FRB } },
-{ "fdivs.",  A(59,18,1), AFRC_MASK,    PPC,            { FRT, FRA, FRB } },
-
-{ "fsubs",   A(59,20,0), AFRC_MASK,    PPC,            { FRT, FRA, FRB } },
-{ "fsubs.",  A(59,20,1), AFRC_MASK,    PPC,            { FRT, FRA, FRB } },
-
-{ "fadds",   A(59,21,0), AFRC_MASK,    PPC,            { FRT, FRA, FRB } },
-{ "fadds.",  A(59,21,1), AFRC_MASK,    PPC,            { FRT, FRA, FRB } },
-
-{ "fsqrts",  A(59,22,0), AFRAFRC_MASK, PPC,            { FRT, FRB } },
-{ "fsqrts.", A(59,22,1), AFRAFRC_MASK, PPC,            { FRT, FRB } },
-
-{ "fres",    A(59,24,0), AFRAFRC_MASK, PPC,            { FRT, FRB } },
-{ "fres.",   A(59,24,1), AFRAFRC_MASK, PPC,            { FRT, FRB } },
-
-{ "fmuls",   A(59,25,0), AFRB_MASK,    PPC,            { FRT, FRA, FRC } },
-{ "fmuls.",  A(59,25,1), AFRB_MASK,    PPC,            { FRT, FRA, FRC } },
-
-{ "fmsubs",  A(59,28,0), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-{ "fmsubs.", A(59,28,1), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-
-{ "fmadds",  A(59,29,0), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-{ "fmadds.", A(59,29,1), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-
-{ "fnmsubs", A(59,30,0), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-{ "fnmsubs.",A(59,30,1), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-
-{ "fnmadds", A(59,31,0), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-{ "fnmadds.",A(59,31,1), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-
-{ "stfq",    OP(60),   OP_MASK,        POWER2,         { FRS, D, RA } },
-
-{ "stfqu",   OP(61),   OP_MASK,        POWER2,         { FRS, D, RA } },
-
-{ "lde",     DEO(62,0), DE_MASK,       BOOKE64,        { RT, DES, RA } },
-{ "ldue",    DEO(62,1), DE_MASK,       BOOKE64,        { RT, DES, RA } },
-{ "lfse",    DEO(62,4), DE_MASK,       BOOKE64,        { FRT, DES, RA } },
-{ "lfsue",   DEO(62,5), DE_MASK,       BOOKE64,        { FRT, DES, RAS } },
-{ "lfde",    DEO(62,6), DE_MASK,       BOOKE64,        { FRT, DES, RA } },
-{ "lfdue",   DEO(62,7), DE_MASK,       BOOKE64,        { FRT, DES, RAS } },
-{ "stde",    DEO(62,8), DE_MASK,       BOOKE64,        { RS, DES, RA } },
-{ "stdue",   DEO(62,9), DE_MASK,       BOOKE64,        { RS, DES, RAS } },
-{ "stfse",   DEO(62,12), DE_MASK,      BOOKE64,        { FRS, DES, RA } },
-{ "stfsue",  DEO(62,13), DE_MASK,      BOOKE64,        { FRS, DES, RAS } },
-{ "stfde",   DEO(62,14), DE_MASK,      BOOKE64,        { FRS, DES, RA } },
-{ "stfdue",  DEO(62,15), DE_MASK,      BOOKE64,        { FRS, DES, RAS } },
-
-{ "std",     DSO(62,0),        DS_MASK,        PPC64,          { RS, DS, RA } },
-
-{ "stdu",    DSO(62,1),        DS_MASK,        PPC64,          { RS, DS, RAS } },
-
-{ "fcmpu",   X(63,0),  X_MASK|(3<<21), COM,            { BF, FRA, FRB } },
-
-{ "frsp",    XRC(63,12,0), XRA_MASK,   COM,            { FRT, FRB } },
-{ "frsp.",   XRC(63,12,1), XRA_MASK,   COM,            { FRT, FRB } },
-
-{ "fctiw",   XRC(63,14,0), XRA_MASK,   PPCCOM,         { FRT, FRB } },
-{ "fcir",    XRC(63,14,0), XRA_MASK,   POWER2,         { FRT, FRB } },
-{ "fctiw.",  XRC(63,14,1), XRA_MASK,   PPCCOM,         { FRT, FRB } },
-{ "fcir.",   XRC(63,14,1), XRA_MASK,   POWER2,         { FRT, FRB } },
-
-{ "fctiwz",  XRC(63,15,0), XRA_MASK,   PPCCOM,         { FRT, FRB } },
-{ "fcirz",   XRC(63,15,0), XRA_MASK,   POWER2,         { FRT, FRB } },
-{ "fctiwz.", XRC(63,15,1), XRA_MASK,   PPCCOM,         { FRT, FRB } },
-{ "fcirz.",  XRC(63,15,1), XRA_MASK,   POWER2,         { FRT, FRB } },
-
-{ "fdiv",    A(63,18,0), AFRC_MASK,    PPCCOM,         { FRT, FRA, FRB } },
-{ "fd",      A(63,18,0), AFRC_MASK,    PWRCOM,         { FRT, FRA, FRB } },
-{ "fdiv.",   A(63,18,1), AFRC_MASK,    PPCCOM,         { FRT, FRA, FRB } },
-{ "fd.",     A(63,18,1), AFRC_MASK,    PWRCOM,         { FRT, FRA, FRB } },
-
-{ "fsub",    A(63,20,0), AFRC_MASK,    PPCCOM,         { FRT, FRA, FRB } },
-{ "fs",      A(63,20,0), AFRC_MASK,    PWRCOM,         { FRT, FRA, FRB } },
-{ "fsub.",   A(63,20,1), AFRC_MASK,    PPCCOM,         { FRT, FRA, FRB } },
-{ "fs.",     A(63,20,1), AFRC_MASK,    PWRCOM,         { FRT, FRA, FRB } },
-
-{ "fadd",    A(63,21,0), AFRC_MASK,    PPCCOM,         { FRT, FRA, FRB } },
-{ "fa",      A(63,21,0), AFRC_MASK,    PWRCOM,         { FRT, FRA, FRB } },
-{ "fadd.",   A(63,21,1), AFRC_MASK,    PPCCOM,         { FRT, FRA, FRB } },
-{ "fa.",     A(63,21,1), AFRC_MASK,    PWRCOM,         { FRT, FRA, FRB } },
-
-{ "fsqrt",   A(63,22,0), AFRAFRC_MASK, PPCPWR2,        { FRT, FRB } },
-{ "fsqrt.",  A(63,22,1), AFRAFRC_MASK, PPCPWR2,        { FRT, FRB } },
-
-{ "fsel",    A(63,23,0), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-{ "fsel.",   A(63,23,1), A_MASK,       PPC,            { FRT,FRA,FRC,FRB } },
-
-{ "fmul",    A(63,25,0), AFRB_MASK,    PPCCOM,         { FRT, FRA, FRC } },
-{ "fm",      A(63,25,0), AFRB_MASK,    PWRCOM,         { FRT, FRA, FRC } },
-{ "fmul.",   A(63,25,1), AFRB_MASK,    PPCCOM,         { FRT, FRA, FRC } },
-{ "fm.",     A(63,25,1), AFRB_MASK,    PWRCOM,         { FRT, FRA, FRC } },
-
-{ "frsqrte", A(63,26,0), AFRAFRC_MASK, PPC,            { FRT, FRB } },
-{ "frsqrte.",A(63,26,1), AFRAFRC_MASK, PPC,            { FRT, FRB } },
-
-{ "fmsub",   A(63,28,0), A_MASK,       PPCCOM,         { FRT,FRA,FRC,FRB } },
-{ "fms",     A(63,28,0), A_MASK,       PWRCOM,         { FRT,FRA,FRC,FRB } },
-{ "fmsub.",  A(63,28,1), A_MASK,       PPCCOM,         { FRT,FRA,FRC,FRB } },
-{ "fms.",    A(63,28,1), A_MASK,       PWRCOM,         { FRT,FRA,FRC,FRB } },
-
-{ "fmadd",   A(63,29,0), A_MASK,       PPCCOM,         { FRT,FRA,FRC,FRB } },
-{ "fma",     A(63,29,0), A_MASK,       PWRCOM,         { FRT,FRA,FRC,FRB } },
-{ "fmadd.",  A(63,29,1), A_MASK,       PPCCOM,         { FRT,FRA,FRC,FRB } },
-{ "fma.",    A(63,29,1), A_MASK,       PWRCOM,         { FRT,FRA,FRC,FRB } },
-
-{ "fnmsub",  A(63,30,0), A_MASK,       PPCCOM,         { FRT,FRA,FRC,FRB } },
-{ "fnms",    A(63,30,0), A_MASK,       PWRCOM,         { FRT,FRA,FRC,FRB } },
-{ "fnmsub.", A(63,30,1), A_MASK,       PPCCOM,         { FRT,FRA,FRC,FRB } },
-{ "fnms.",   A(63,30,1), A_MASK,       PWRCOM,         { FRT,FRA,FRC,FRB } },
-
-{ "fnmadd",  A(63,31,0), A_MASK,       PPCCOM,         { FRT,FRA,FRC,FRB } },
-{ "fnma",    A(63,31,0), A_MASK,       PWRCOM,         { FRT,FRA,FRC,FRB } },
-{ "fnmadd.", A(63,31,1), A_MASK,       PPCCOM,         { FRT,FRA,FRC,FRB } },
-{ "fnma.",   A(63,31,1), A_MASK,       PWRCOM,         { FRT,FRA,FRC,FRB } },
-
-{ "fcmpo",   X(63,32), X_MASK|(3<<21), COM,            { BF, FRA, FRB } },
-
-{ "mtfsb1",  XRC(63,38,0), XRARB_MASK, COM,            { BT } },
-{ "mtfsb1.", XRC(63,38,1), XRARB_MASK, COM,            { BT } },
-
-{ "fneg",    XRC(63,40,0), XRA_MASK,   COM,            { FRT, FRB } },
-{ "fneg.",   XRC(63,40,1), XRA_MASK,   COM,            { FRT, FRB } },
-
-{ "mcrfs",   X(63,64), XRB_MASK|(3<<21)|(3<<16), COM,  { BF, BFA } },
-
-{ "mtfsb0",  XRC(63,70,0), XRARB_MASK, COM,            { BT } },
-{ "mtfsb0.", XRC(63,70,1), XRARB_MASK, COM,            { BT } },
-
-{ "fmr",     XRC(63,72,0), XRA_MASK,   COM,            { FRT, FRB } },
-{ "fmr.",    XRC(63,72,1), XRA_MASK,   COM,            { FRT, FRB } },
-
-{ "mtfsfi",  XRC(63,134,0), XRA_MASK|(3<<21)|(1<<11), COM, { BF, U } },
-{ "mtfsfi.", XRC(63,134,1), XRA_MASK|(3<<21)|(1<<11), COM, { BF, U } },
-
-{ "fnabs",   XRC(63,136,0), XRA_MASK,  COM,            { FRT, FRB } },
-{ "fnabs.",  XRC(63,136,1), XRA_MASK,  COM,            { FRT, FRB } },
-
-{ "fabs",    XRC(63,264,0), XRA_MASK,  COM,            { FRT, FRB } },
-{ "fabs.",   XRC(63,264,1), XRA_MASK,  COM,            { FRT, FRB } },
-
-{ "mffs",    XRC(63,583,0), XRARB_MASK,        COM,            { FRT } },
-{ "mffs.",   XRC(63,583,1), XRARB_MASK,        COM,            { FRT } },
-
-{ "mtfsf",   XFL(63,711,0), XFL_MASK,  COM,            { FLM, FRB } },
-{ "mtfsf.",  XFL(63,711,1), XFL_MASK,  COM,            { FLM, FRB } },
-
-{ "fctid",   XRC(63,814,0), XRA_MASK,  PPC64,          { FRT, FRB } },
-{ "fctid.",  XRC(63,814,1), XRA_MASK,  PPC64,          { FRT, FRB } },
-
-{ "fctidz",  XRC(63,815,0), XRA_MASK,  PPC64,          { FRT, FRB } },
-{ "fctidz.", XRC(63,815,1), XRA_MASK,  PPC64,          { FRT, FRB } },
-
-{ "fcfid",   XRC(63,846,0), XRA_MASK,  PPC64,          { FRT, FRB } },
-{ "fcfid.",  XRC(63,846,1), XRA_MASK,  PPC64,          { FRT, FRB } },
-
-};
-
-const int powerpc_num_opcodes =
-  sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]);
-\f
-/* The macro table.  This is only used by the assembler.  */
-
-/* The expressions of the form (-x ! 31) & (x | 31) have the value 0
-   when x=0; 32-x when x is between 1 and 31; are negative if x is
-   negative; and are 32 or more otherwise.  This is what you want
-   when, for instance, you are emulating a right shift by a
-   rotate-left-and-mask, because the underlying instructions support
-   shifts of size 0 but not shifts of size 32.  By comparison, when
-   extracting x bits from some word you want to use just 32-x, because
-   the underlying instructions don't support extracting 0 bits but do
-   support extracting the whole word (32 bits in this case).  */
-
-const struct powerpc_macro powerpc_macros[] = {
-{ "extldi",  4,   PPC64,       "rldicr %0,%1,%3,(%2)-1" },
-{ "extldi.", 4,   PPC64,       "rldicr. %0,%1,%3,(%2)-1" },
-{ "extrdi",  4,   PPC64,       "rldicl %0,%1,(%2)+(%3),64-(%2)" },
-{ "extrdi.", 4,   PPC64,       "rldicl. %0,%1,(%2)+(%3),64-(%2)" },
-{ "insrdi",  4,   PPC64,       "rldimi %0,%1,64-((%2)+(%3)),%3" },
-{ "insrdi.", 4,   PPC64,       "rldimi. %0,%1,64-((%2)+(%3)),%3" },
-{ "rotrdi",  3,   PPC64,       "rldicl %0,%1,(-(%2)!63)&((%2)|63),0" },
-{ "rotrdi.", 3,   PPC64,       "rldicl. %0,%1,(-(%2)!63)&((%2)|63),0" },
-{ "sldi",    3,   PPC64,       "rldicr %0,%1,%2,63-(%2)" },
-{ "sldi.",   3,   PPC64,       "rldicr. %0,%1,%2,63-(%2)" },
-{ "srdi",    3,   PPC64,       "rldicl %0,%1,(-(%2)!63)&((%2)|63),%2" },
-{ "srdi.",   3,   PPC64,       "rldicl. %0,%1,(-(%2)!63)&((%2)|63),%2" },
-{ "clrrdi",  3,   PPC64,       "rldicr %0,%1,0,63-(%2)" },
-{ "clrrdi.", 3,   PPC64,       "rldicr. %0,%1,0,63-(%2)" },
-{ "clrlsldi",4,   PPC64,       "rldic %0,%1,%3,(%2)-(%3)" },
-{ "clrlsldi.",4,  PPC64,       "rldic. %0,%1,%3,(%2)-(%3)" },
-
-{ "extlwi",  4,   PPCCOM,      "rlwinm %0,%1,%3,0,(%2)-1" },
-{ "extlwi.", 4,   PPCCOM,      "rlwinm. %0,%1,%3,0,(%2)-1" },
-{ "extrwi",  4,   PPCCOM,      "rlwinm %0,%1,(%2)+(%3),32-(%2),31" },
-{ "extrwi.", 4,   PPCCOM,      "rlwinm. %0,%1,(%2)+(%3),32-(%2),31" },
-{ "inslwi",  4,   PPCCOM,      "rlwimi %0,%1,(-(%3)!31)&((%3)|31),%3,(%2)+(%3)-1" },
-{ "inslwi.", 4,   PPCCOM,      "rlwimi. %0,%1,(-(%3)!31)&((%3)|31),%3,(%2)+(%3)-1"},
-{ "insrwi",  4,   PPCCOM,      "rlwimi %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1" },
-{ "insrwi.", 4,   PPCCOM,      "rlwimi. %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1"},
-{ "rotrwi",  3,   PPCCOM,      "rlwinm %0,%1,(-(%2)!31)&((%2)|31),0,31" },
-{ "rotrwi.", 3,   PPCCOM,      "rlwinm. %0,%1,(-(%2)!31)&((%2)|31),0,31" },
-{ "slwi",    3,   PPCCOM,      "rlwinm %0,%1,%2,0,31-(%2)" },
-{ "sli",     3,   PWRCOM,      "rlinm %0,%1,%2,0,31-(%2)" },
-{ "slwi.",   3,   PPCCOM,      "rlwinm. %0,%1,%2,0,31-(%2)" },
-{ "sli.",    3,   PWRCOM,      "rlinm. %0,%1,%2,0,31-(%2)" },
-{ "srwi",    3,   PPCCOM,      "rlwinm %0,%1,(-(%2)!31)&((%2)|31),%2,31" },
-{ "sri",     3,   PWRCOM,      "rlinm %0,%1,(-(%2)!31)&((%2)|31),%2,31" },
-{ "srwi.",   3,   PPCCOM,      "rlwinm. %0,%1,(-(%2)!31)&((%2)|31),%2,31" },
-{ "sri.",    3,   PWRCOM,      "rlinm. %0,%1,(-(%2)!31)&((%2)|31),%2,31" },
-{ "clrrwi",  3,   PPCCOM,      "rlwinm %0,%1,0,0,31-(%2)" },
-{ "clrrwi.", 3,   PPCCOM,      "rlwinm. %0,%1,0,0,31-(%2)" },
-{ "clrlslwi",4,   PPCCOM,      "rlwinm %0,%1,%3,(%2)-(%3),31-(%3)" },
-{ "clrlslwi.",4,  PPCCOM,      "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" },
-
-{ "mftbl",   1,   BOOKE,       "mfspr %0,tbl" },
-{ "mftbu",   1,   BOOKE,       "mfspr %0,tbu" },
-{ "mftb",    2,   BOOKE,       "mfspr %0,%1" },
-};
-
-const int powerpc_num_macros =
-  sizeof (powerpc_macros) / sizeof (powerpc_macros[0]);
diff --git a/powerpc/ppc.h b/powerpc/ppc.h
deleted file mode 100644 (file)
index 5320913..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-/* ppc.h -- Header file for PowerPC opcode table
-   Copyright 1994, 1995, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
-   Written by Ian Lance Taylor, Cygnus Support
-
-This file is part of GDB, GAS, and the GNU binutils.
-
-GDB, GAS, and the GNU binutils are free software; you can redistribute
-them and/or modify them under the terms of the GNU General Public
-License as published by the Free Software Foundation; either version
-1, or (at your option) any later version.
-
-GDB, GAS, and the GNU binutils are distributed in the hope that they
-will be useful, but WITHOUT ANY WARRANTY; without even the implied
-warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this file; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-#ifndef PPC_H
-#define PPC_H
-
-#define PARAMS(a) a
-
-/* The opcode table is an array of struct powerpc_opcode.  */
-
-struct powerpc_opcode
-{
-  /* The opcode name.  */
-  const char *name;
-
-  /* The opcode itself.  Those bits which will be filled in with
-     operands are zeroes.  */
-  unsigned long opcode;
-
-  /* The opcode mask.  This is used by the disassembler.  This is a
-     mask containing ones indicating those bits which must match the
-     opcode field, and zeroes indicating those bits which need not
-     match (and are presumably filled in by operands).  */
-  unsigned long mask;
-
-  /* One bit flags for the opcode.  These are used to indicate which
-     specific processors support the instructions.  The defined values
-     are listed below.  */
-  unsigned long flags;
-
-  /* An array of operand codes.  Each code is an index into the
-     operand table.  They appear in the order which the operands must
-     appear in assembly code, and are terminated by a zero.  */
-  unsigned char operands[8];
-};
-
-/* The table itself is sorted by major opcode number, and is otherwise
-   in the order in which the disassembler should consider
-   instructions.  */
-extern const struct powerpc_opcode powerpc_opcodes[];
-extern const int powerpc_num_opcodes;
-
-/* Values defined for the flags field of a struct powerpc_opcode.  */
-
-/* Opcode is defined for the PowerPC architecture.  */
-#define PPC_OPCODE_PPC (01)
-
-/* Opcode is defined for the POWER (RS/6000) architecture.  */
-#define PPC_OPCODE_POWER (02)
-
-/* Opcode is defined for the POWER2 (Rios 2) architecture.  */
-#define PPC_OPCODE_POWER2 (04)
-
-/* Opcode is only defined on 32 bit architectures.  */
-#define PPC_OPCODE_32 (010)
-
-/* Opcode is only defined on 64 bit architectures.  */
-#define PPC_OPCODE_64 (020)
-
-/* Opcode is supported by the Motorola PowerPC 601 processor.  The 601
-   is assumed to support all PowerPC (PPC_OPCODE_PPC) instructions,
-   but it also supports many additional POWER instructions.  */
-#define PPC_OPCODE_601 (040)
-
-/* Opcode is supported in both the Power and PowerPC architectures
-   (ie, compiler's -mcpu=common or assembler's -mcom).  */
-#define PPC_OPCODE_COMMON (0100)
-
-/* Opcode is supported for any Power or PowerPC platform (this is
-   for the assembler's -many option, and it eliminates duplicates).  */
-#define PPC_OPCODE_ANY (0200)
-
-/* Opcode is supported as part of the 64-bit bridge.  */
-#define PPC_OPCODE_64_BRIDGE (0400)
-
-/* Opcode is supported by Altivec Vector Unit */
-#define PPC_OPCODE_ALTIVEC (01000)
-
-/* Opcode is supported by PowerPC 403 processor.  */
-#define PPC_OPCODE_403 (02000)
-
-/* Opcode is supported by PowerPC BookE processor.  */
-#define PPC_OPCODE_BOOKE (04000)
-
-/* Opcode is only supported by 64-bit PowerPC BookE processor.  */
-#define PPC_OPCODE_BOOKE64 (010000)
-
-/* Opcode is only supported by Power4 architecture.  */
-#define PPC_OPCODE_POWER4 (020000)
-
-/* Opcode isn't supported by Power4 architecture.  */
-#define PPC_OPCODE_NOPOWER4 (040000)
-
-/* Opcode is only supported by POWERPC Classic architecture.  */
-#define PPC_OPCODE_CLASSIC (0100000)
-
-/* Opcode is only supported by e500x2 Core.  */
-#define PPC_OPCODE_SPE     (0200000)
-
-/* Opcode is supported by e500x2 Integer select APU.  */
-#define PPC_OPCODE_ISEL     (0400000)
-
-/* Opcode is an e500 SPE floating point instruction.  */
-#define PPC_OPCODE_EFS      (01000000)
-
-/* Opcode is supported by branch locking APU.  */
-#define PPC_OPCODE_BRLOCK   (02000000)
-
-/* Opcode is supported by performance monitor APU.  */
-#define PPC_OPCODE_PMR      (04000000)
-
-/* Opcode is supported by cache locking APU.  */
-#define PPC_OPCODE_CACHELCK (010000000)
-
-/* Opcode is supported by machine check APU.  */
-#define PPC_OPCODE_RFMCI    (020000000)
-
-/* A macro to extract the major opcode from an instruction.  */
-#define PPC_OP(i) (((i) >> 26) & 0x3f)
-\f
-/* The operands table is an array of struct powerpc_operand.  */
-
-struct powerpc_operand
-{
-  /* The number of bits in the operand.  */
-  int bits;
-
-  /* How far the operand is left shifted in the instruction.  */
-  int shift;
-
-  /* Insertion function.  This is used by the assembler.  To insert an
-     operand value into an instruction, check this field.
-
-     If it is NULL, execute
-         i |= (op & ((1 << o->bits) - 1)) << o->shift;
-     (i is the instruction which we are filling in, o is a pointer to
-     this structure, and op is the opcode value; this assumes twos
-     complement arithmetic).
-
-     If this field is not NULL, then simply call it with the
-     instruction and the operand value.  It will return the new value
-     of the instruction.  If the ERRMSG argument is not NULL, then if
-     the operand value is illegal, *ERRMSG will be set to a warning
-     string (the operand will be inserted in any case).  If the
-     operand value is legal, *ERRMSG will be unchanged (most operands
-     can accept any value).  */
-  unsigned long (*insert) PARAMS ((unsigned long instruction, long op,
-                                  int dialect,
-                                  const char **errmsg));
-
-  /* Extraction function.  This is used by the disassembler.  To
-     extract this operand type from an instruction, check this field.
-
-     If it is NULL, compute
-         op = ((i) >> o->shift) & ((1 << o->bits) - 1);
-        if ((o->flags & PPC_OPERAND_SIGNED) != 0
-            && (op & (1 << (o->bits - 1))) != 0)
-          op -= 1 << o->bits;
-     (i is the instruction, o is a pointer to this structure, and op
-     is the result; this assumes twos complement arithmetic).
-
-     If this field is not NULL, then simply call it with the
-     instruction value.  It will return the value of the operand.  If
-     the INVALID argument is not NULL, *INVALID will be set to
-     non-zero if this operand type can not actually be extracted from
-     this operand (i.e., the instruction does not match).  If the
-     operand is valid, *INVALID will not be changed.  */
-  long (*extract) PARAMS ((unsigned long instruction, int dialect,
-                          int *invalid));
-
-  /* One bit syntax flags.  */
-  unsigned long flags;
-};
-
-/* Elements in the table are retrieved by indexing with values from
-   the operands field of the powerpc_opcodes table.  */
-
-extern const struct powerpc_operand powerpc_operands[];
-
-/* Values defined for the flags field of a struct powerpc_operand.  */
-
-/* This operand takes signed values.  */
-#define PPC_OPERAND_SIGNED (01)
-
-/* This operand takes signed values, but also accepts a full positive
-   range of values when running in 32 bit mode.  That is, if bits is
-   16, it takes any value from -0x8000 to 0xffff.  In 64 bit mode,
-   this flag is ignored.  */
-#define PPC_OPERAND_SIGNOPT (02)
-
-/* This operand does not actually exist in the assembler input.  This
-   is used to support extended mnemonics such as mr, for which two
-   operands fields are identical.  The assembler should call the
-   insert function with any op value.  The disassembler should call
-   the extract function, ignore the return value, and check the value
-   placed in the valid argument.  */
-#define PPC_OPERAND_FAKE (04)
-
-/* The next operand should be wrapped in parentheses rather than
-   separated from this one by a comma.  This is used for the load and
-   store instructions which want their operands to look like
-       reg,displacement(reg)
-   */
-#define PPC_OPERAND_PARENS (010)
-
-/* This operand may use the symbolic names for the CR fields, which
-   are
-       lt  0   gt  1   eq  2   so  3   un  3
-       cr0 0   cr1 1   cr2 2   cr3 3
-       cr4 4   cr5 5   cr6 6   cr7 7
-   These may be combined arithmetically, as in cr2*4+gt.  These are
-   only supported on the PowerPC, not the POWER.  */
-#define PPC_OPERAND_CR (020)
-
-/* This operand names a register.  The disassembler uses this to print
-   register names with a leading 'r'.  */
-#define PPC_OPERAND_GPR (040)
-
-/* This operand names a floating point register.  The disassembler
-   prints these with a leading 'f'.  */
-#define PPC_OPERAND_FPR (0100)
-
-/* This operand is a relative branch displacement.  The disassembler
-   prints these symbolically if possible.  */
-#define PPC_OPERAND_RELATIVE (0200)
-
-/* This operand is an absolute branch address.  The disassembler
-   prints these symbolically if possible.  */
-#define PPC_OPERAND_ABSOLUTE (0400)
-
-/* This operand is optional, and is zero if omitted.  This is used for
-   the optional BF and L fields in the comparison instructions.  The
-   assembler must count the number of operands remaining on the line,
-   and the number of operands remaining for the opcode, and decide
-   whether this operand is present or not.  The disassembler should
-   print this operand out only if it is not zero.  */
-#define PPC_OPERAND_OPTIONAL (01000)
-
-/* This flag is only used with PPC_OPERAND_OPTIONAL.  If this operand
-   is omitted, then for the next operand use this operand value plus
-   1, ignoring the next operand field for the opcode.  This wretched
-   hack is needed because the Power rotate instructions can take
-   either 4 or 5 operands.  The disassembler should print this operand
-   out regardless of the PPC_OPERAND_OPTIONAL field.  */
-#define PPC_OPERAND_NEXT (02000)
-
-/* This operand should be regarded as a negative number for the
-   purposes of overflow checking (i.e., the normal most negative
-   number is disallowed and one more than the normal most positive
-   number is allowed).  This flag will only be set for a signed
-   operand.  */
-#define PPC_OPERAND_NEGATIVE (04000)
-
-/* This operand names a vector unit register.  The disassembler
-   prints these with a leading 'v'.  */
-#define PPC_OPERAND_VR (010000)
-
-/* This operand is for the DS field in a DS form instruction.  */
-#define PPC_OPERAND_DS (020000)
-\f
-/* The POWER and PowerPC assemblers use a few macros.  We keep them
-   with the operands table for simplicity.  The macro table is an
-   array of struct powerpc_macro.  */
-
-struct powerpc_macro
-{
-  /* The macro name.  */
-  const char *name;
-
-  /* The number of operands the macro takes.  */
-  unsigned int operands;
-
-  /* One bit flags for the opcode.  These are used to indicate which
-     specific processors support the instructions.  The values are the
-     same as those for the struct powerpc_opcode flags field.  */
-  unsigned long flags;
-
-  /* A format string to turn the macro into a normal instruction.
-     Each %N in the string is replaced with operand number N (zero
-     based).  */
-  const char *format;
-};
-
-extern const struct powerpc_macro powerpc_macros[];
-extern const int powerpc_num_macros;
-
-#endif /* PPC_H */
diff --git a/powerpc/threads.h b/powerpc/threads.h
deleted file mode 100644 (file)
index c35df86..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************** threads.h **************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       System dependent part of thread header file.
-
-       Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1998/11/19
-
-*******************************************************************************/
-
-
-#ifndef __sysdep_threads_h
-#define __sysdep_threads_h
-
-#include "config.h"
-#include "threads/thread.h"
-
-/* Thread handling */
-
-/* prototypes */
-
-void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
-u1*  asm_initialize_thread_stack (void *func, u1 *stack);
-void *asm_switchstackandcall (void *stack, void *func, void **stacktopsave, void *p);
-
-/* access macros */
-
-#define        THREADSTACKSIZE         (32 * 1024)
-
-#define        THREADSWITCH(to, from)  asm_perform_threadswitch(&(from)->restorePoint,\
-                                    &(to)->restorePoint, &(from)->usedStackTop)
-
-#define THREADINIT(to, func)    (to)->restorePoint =                         \
-                                    asm_initialize_thread_stack((u1*)(func), \
-                                                            (to)->stackEnd)
-
-#define        THREADINFO(e)                               \
-               do {                                        \
-                       (e)->restorePoint = 0;                  \
-                       (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
-               } while(0)
-
-#endif
diff --git a/powerpc/types.h b/powerpc/types.h
deleted file mode 100644 (file)
index a13bbdd..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* alpha/types.h ***************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       machine specific definitions for the Alpha processor
-       
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: 1997/09/22
-
-*******************************************************************************/
-
-#ifndef _CACAO_TYPES_H
-
-#define _CACAO_TYPES_H
-
-#define POINTERSIZE         4
-#define WORDS_BIGENDIAN     1
-
-#define SUPPORT_DIVISION    0
-#define SUPPORT_LONG        1
-#define SUPPORT_FLOAT       1
-#define SUPPORT_DOUBLE      1
-#define SUPPORT_FMOD        0
-#define SUPPORT_FICVT       1
-#define SUPPORT_IFCVT       0
-
-#define SUPPORT_LONG_ADD    1
-#define SUPPORT_LONG_CMP    1
-#define SUPPORT_LONG_LOG    1
-#define SUPPORT_LONG_SHIFT  0
-#define SUPPORT_LONG_MULDIV 0
-#define SUPPORT_LONG_ICVT   0
-#define SUPPORT_LONG_FCVT   0
-
-//#define CONDITIONAL_LOADCONST
-#define NOLONG_CONDITIONAL
-#define NO_DIV_OPT
-#define USETWOREGS
-#define CONSECUTIVE_FLOATARGS
-#define SPECIALMEMUSE
-#define USEBUILTINTABLE
-
-#define U8_AVAILABLE        1
-
-typedef signed char             s1;
-typedef unsigned char           u1;
-typedef signed short int        s2;
-typedef unsigned short int      u2;
-
-typedef signed int              s4;
-typedef unsigned int            u4;
-
-#if U8_AVAILABLE
-typedef signed long long        s8;
-typedef unsigned long long      u8; 
-#else
-typedef struct {u4 low, high;}  u8;
-#define s8 u8
-#endif
-
-#endif
-
index e2ddccf9fcbb859fe2afaae925445dcc52470aeb..24e2af7f74ff985a3d684fe7e448c613b91b8177 100644 (file)
@@ -1,36 +1,59 @@
-/* main.c **********************************************************************
+/* main.c - contains main() and variables for the global options
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains main() and variables for the global options.
-       This module does the following tasks:
-          - Command line option handling
-          - Calling initialization routines
-          - Calling the class loader
-          - Running the main method
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Andi Krall          EMAIL: cacao@complang.tuwien.ac.at
-                Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                        Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: $Id: cacao.c 552 2003-11-01 20:47:35Z twisti $
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-#include "global.h"
+   Authors: Reinhard Grafl
+
+   Changes: Andi Krall
+            Mark Probst
+            Philipp Tomsich
+
+   This module does the following tasks:
+     - Command line option handling
+     - Calling initialization routines
+     - Calling the class loader
+     - Running the main method
+
+   $Id: cacao.c 557 2003-11-02 22:51:59Z twisti $
 
+*/
+
+
+#include <stdlib.h>
+#include "global.h"
 #include "tables.h"
 #include "loader.h"
 #include "jit.h"
-
 #include "asmpart.h"
 #include "builtin.h"
 #include "native.h"
-
 #include "threads/thread.h"
+#include "toolbox/loging.h"
+#include "parseRTstats.h"
+
 
 bool compileall = false;
 bool verbose =  false;
@@ -170,42 +193,44 @@ Prints the correct usage syntax to stdout.
 
 static void print_usage()
 {
-       printf ("USAGE: cacao [options] classname [program arguments]\n");
-       printf ("Options:\n");
-       printf ("          -classpath path ...... specify a path to look for classes\n");
-       printf ("          -Dpropertyname=value . add an entry to the property list\n");
-       printf ("          -mx maxmem[k|m] ...... specify the size for the heap\n");
-       printf ("          -ms initmem[k|m] ..... specify the initial size for the heap\n");
-       printf ("          -v ................... write state-information\n");
-       printf ("          -verbose ............. write more information\n");
-       printf ("          -verbosegc ........... write message for each GC\n");
-       printf ("          -verbosecall ......... write message for each call\n");
-       printf ("          -noieee .............. don't use ieee compliant arithmetic\n");
-       printf ("          -softnull ............ use software nullpointer check\n");
-       printf ("          -time ................ measure the runtime\n");
-       printf ("          -stat ................ detailed compiler statistics\n");
-       printf ("          -log logfile ......... specify a name for the logfile\n");
-       printf ("          -c(heck)b(ounds) ..... don't check array bounds\n");
-       printf ("                  s(ync) ....... don't check for synchronization\n");
-       printf ("          -oloop ............... optimize array accesses in loops\n"); 
-       printf ("          -l ................... don't start the class after loading\n");
-       printf ("          -all ................. compile all methods, no execution\n");
-       printf ("          -m ................... compile only a specific method\n");
-       printf ("          -sig ................. specify signature for a specific method\n");
-       printf ("          -s(how)a(ssembler) ... show disassembled listing\n");
-       printf ("                 c(onstants) ... show the constant pool\n");
-       printf ("                 d(atasegment).. show data segment listing\n");
-       printf ("                 i(ntermediate). show intermediate representation\n");
-       printf ("                 m(ethods)...... show class fields and methods\n");
-       printf ("                 u(tf) ......... show the utf - hash\n");
-       printf ("          -i     n ............. activate inlining\n");
-       printf ("                 v ............. inline virtual methods\n");
-       printf ("                 e ............. inline methods with exceptions\n");
-       printf ("                 p ............. optimize argument renaming\n");
-       printf ("                 o ............. inline methods of foreign classes\n");
-       printf ("          -rt .................. use rapid type analysis\n");
-       printf ("          -xta ................. use x type analysis\n");
-       printf ("          -vta ................. use variable type analysis\n");
+       printf("USAGE: cacao [options] classname [program arguments]\n");
+       printf("Options:\n");
+       printf("          -classpath path ...... specify a path to look for classes\n");
+       printf("          -Dpropertyname=value . add an entry to the property list\n");
+       printf("          -mx maxmem[k|m] ...... specify the size for the heap\n");
+       printf("          -ms initmem[k|m] ..... specify the initial size for the heap\n");
+       printf("          -v ................... write state-information\n");
+       printf("          -verbose ............. write more information\n");
+       printf("          -verbosegc ........... write message for each GC\n");
+       printf("          -verbosecall ......... write message for each call\n");
+#if defined(__ALPHA__)
+       printf("          -noieee .............. don't use ieee compliant arithmetic\n");
+#endif
+       printf("          -softnull ............ use software nullpointer check\n");
+       printf("          -time ................ measure the runtime\n");
+       printf("          -stat ................ detailed compiler statistics\n");
+       printf("          -log logfile ......... specify a name for the logfile\n");
+       printf("          -c(heck)b(ounds) ..... don't check array bounds\n");
+       printf("                  s(ync) ....... don't check for synchronization\n");
+       printf("          -oloop ............... optimize array accesses in loops\n"); 
+       printf("          -l ................... don't start the class after loading\n");
+       printf("          -all ................. compile all methods, no execution\n");
+       printf("          -m ................... compile only a specific method\n");
+       printf("          -sig ................. specify signature for a specific method\n");
+       printf("          -s(how)a(ssembler) ... show disassembled listing\n");
+       printf("                 c(onstants) ... show the constant pool\n");
+       printf("                 d(atasegment).. show data segment listing\n");
+       printf("                 i(ntermediate). show intermediate representation\n");
+       printf("                 m(ethods)...... show class fields and methods\n");
+       printf("                 u(tf) ......... show the utf - hash\n");
+       printf("          -i     n ............. activate inlining\n");
+       printf("                 v ............. inline virtual methods\n");
+       printf("                 e ............. inline methods with exceptions\n");
+       printf("                 p ............. optimize argument renaming\n");
+       printf("                 o ............. inline methods of foreign classes\n");
+       printf("          -rt .................. use rapid type analysis\n");
+       printf("          -xta ................. use x type analysis\n");
+       printf("          -vta ................. use variable type analysis\n");
 }   
 
 
@@ -221,17 +246,17 @@ static void print_times()
        long int totaltime = getcputime();
        long int runtime = totaltime - loadingtime - compilingtime;
 
-       sprintf (logtext, "Time for loading classes: %ld secs, %ld millis",
-            loadingtime / 1000000, (loadingtime % 1000000) / 1000);
+       sprintf(logtext, "Time for loading classes: %ld secs, %ld millis",
+                       loadingtime / 1000000, (loadingtime % 1000000) / 1000);
        dolog();
-       sprintf (logtext, "Time for compiling code:  %ld secs, %ld millis",
-            compilingtime / 1000000, (compilingtime % 1000000) / 1000);
+       sprintf(logtext, "Time for compiling code:  %ld secs, %ld millis",
+                       compilingtime / 1000000, (compilingtime % 1000000) / 1000);
        dolog();
-       sprintf (logtext, "Time for running program: %ld secs, %ld millis",
-            runtime / 1000000, (runtime % 1000000) / 1000);
+       sprintf(logtext, "Time for running program: %ld secs, %ld millis",
+                       runtime / 1000000, (runtime % 1000000) / 1000);
        dolog();
-       sprintf (logtext, "Total time: %ld secs, %ld millis",
-            totaltime / 1000000, (totaltime % 1000000) / 1000);
+       sprintf(logtext, "Total time: %ld secs, %ld millis",
+                       totaltime / 1000000, (totaltime % 1000000) / 1000);
        dolog();
 }
 
@@ -248,169 +273,170 @@ static void print_times()
 
 static void print_stats()
 {
-       sprintf (logtext, "Number of JitCompiler Calls: %d", count_jit_calls);
+       sprintf(logtext, "Number of JitCompiler Calls: %d", count_jit_calls);
        dolog();
-       sprintf (logtext, "Number of compiled Methods: %d", count_methods);
+       sprintf(logtext, "Number of compiled Methods: %d", count_methods);
        dolog();
-       sprintf (logtext, "Number of max basic blocks per method: %d", count_max_basic_blocks);
+       sprintf(logtext, "Number of max basic blocks per method: %d", count_max_basic_blocks);
        dolog();
-       sprintf (logtext, "Number of compiled basic blocks: %d", count_basic_blocks);
+       sprintf(logtext, "Number of compiled basic blocks: %d", count_basic_blocks);
        dolog();
-       sprintf (logtext, "Number of max JavaVM-Instructions per method: %d", count_max_javainstr);
+       sprintf(logtext, "Number of max JavaVM-Instructions per method: %d", count_max_javainstr);
        dolog();
-       sprintf (logtext, "Number of compiled JavaVM-Instructions: %d", count_javainstr);
+       sprintf(logtext, "Number of compiled JavaVM-Instructions: %d", count_javainstr);
        dolog();
-       sprintf (logtext, "Size of compiled JavaVM-Instructions:   %d(%d)", count_javacodesize,
-                                                     count_javacodesize - count_methods * 18);
+       sprintf(logtext, "Size of compiled JavaVM-Instructions:   %d(%d)", count_javacodesize,
+                       count_javacodesize - count_methods * 18);
        dolog();
-       sprintf (logtext, "Size of compiled Exception Tables:      %d", count_javaexcsize);
+       sprintf(logtext, "Size of compiled Exception Tables:      %d", count_javaexcsize);
        dolog();
-       sprintf (logtext, "Value of extended instruction set var:  %d", has_ext_instr_set);
+       sprintf(logtext, "Value of extended instruction set var:  %d", has_ext_instr_set);
        dolog();
-       sprintf (logtext, "Number of Machine-Instructions: %d", count_code_len >> 2);
+       sprintf(logtext, "Number of Machine-Instructions: %d", count_code_len >> 2);
        dolog();
-       sprintf (logtext, "Number of Spills: %d", count_spills);
+       sprintf(logtext, "Number of Spills: %d", count_spills);
        dolog();
-       sprintf (logtext, "Number of Activ    Pseudocommands: %5d", count_pcmd_activ);
+       sprintf(logtext, "Number of Activ    Pseudocommands: %5d", count_pcmd_activ);
        dolog();
-       sprintf (logtext, "Number of Drop     Pseudocommands: %5d", count_pcmd_drop);
+       sprintf(logtext, "Number of Drop     Pseudocommands: %5d", count_pcmd_drop);
        dolog();
-       sprintf (logtext, "Number of Const    Pseudocommands: %5d (zero:%5d)", count_pcmd_load, count_pcmd_zero);
+       sprintf(logtext, "Number of Const    Pseudocommands: %5d (zero:%5d)", count_pcmd_load, count_pcmd_zero);
        dolog();
-       sprintf (logtext, "Number of ConstAlu Pseudocommands: %5d (cmp: %5d, store:%5d)", count_pcmd_const_alu, count_pcmd_const_bra, count_pcmd_const_store);
+       sprintf(logtext, "Number of ConstAlu Pseudocommands: %5d (cmp: %5d, store:%5d)", count_pcmd_const_alu, count_pcmd_const_bra, count_pcmd_const_store);
        dolog();
-       sprintf (logtext, "Number of Move     Pseudocommands: %5d", count_pcmd_move);
+       sprintf(logtext, "Number of Move     Pseudocommands: %5d", count_pcmd_move);
        dolog();
-       sprintf (logtext, "Number of Load     Pseudocommands: %5d", count_load_instruction);
+       sprintf(logtext, "Number of Load     Pseudocommands: %5d", count_load_instruction);
        dolog();
-       sprintf (logtext, "Number of Store    Pseudocommands: %5d (combined: %5d)", count_pcmd_store, count_pcmd_store - count_pcmd_store_comb);
+       sprintf(logtext, "Number of Store    Pseudocommands: %5d (combined: %5d)", count_pcmd_store, count_pcmd_store - count_pcmd_store_comb);
        dolog();
-       sprintf (logtext, "Number of OP       Pseudocommands: %5d", count_pcmd_op);
+       sprintf(logtext, "Number of OP       Pseudocommands: %5d", count_pcmd_op);
        dolog();
-       sprintf (logtext, "Number of DUP      Pseudocommands: %5d", count_dup_instruction);
+       sprintf(logtext, "Number of DUP      Pseudocommands: %5d", count_dup_instruction);
        dolog();
-       sprintf (logtext, "Number of Mem      Pseudocommands: %5d", count_pcmd_mem);
+       sprintf(logtext, "Number of Mem      Pseudocommands: %5d", count_pcmd_mem);
        dolog();
-       sprintf (logtext, "Number of Method   Pseudocommands: %5d", count_pcmd_met);
+       sprintf(logtext, "Number of Method   Pseudocommands: %5d", count_pcmd_met);
        dolog();
-       sprintf (logtext, "Number of Branch   Pseudocommands: %5d (rets:%5d, Xrets: %5d)",
-                         count_pcmd_bra, count_pcmd_return, count_pcmd_returnx);
+       sprintf(logtext, "Number of Branch   Pseudocommands: %5d (rets:%5d, Xrets: %5d)",
+                       count_pcmd_bra, count_pcmd_return, count_pcmd_returnx);
        dolog();
-       sprintf (logtext, "Number of Table    Pseudocommands: %5d", count_pcmd_table);
+       sprintf(logtext, "Number of Table    Pseudocommands: %5d", count_pcmd_table);
        dolog();
-       sprintf (logtext, "Number of Useful   Pseudocommands: %5d", count_pcmd_table +
-                count_pcmd_bra + count_pcmd_load + count_pcmd_mem + count_pcmd_op);
+       sprintf(logtext, "Number of Useful   Pseudocommands: %5d", count_pcmd_table +
+                       count_pcmd_bra + count_pcmd_load + count_pcmd_mem + count_pcmd_op);
        dolog();
-       sprintf (logtext, "Number of Null Pointer Checks:     %5d", count_check_null);
+       sprintf(logtext, "Number of Null Pointer Checks:     %5d", count_check_null);
        dolog();
-       sprintf (logtext, "Number of Array Bound Checks:      %5d", count_check_bound);
+       sprintf(logtext, "Number of Array Bound Checks:      %5d", count_check_bound);
        dolog();
-       sprintf (logtext, "Number of Try-Blocks: %d", count_tryblocks);
+       sprintf(logtext, "Number of Try-Blocks: %d", count_tryblocks);
        dolog();
-       sprintf (logtext, "Maximal count of stack elements:   %d", count_max_new_stack);
+       sprintf(logtext, "Maximal count of stack elements:   %d", count_max_new_stack);
        dolog();
-       sprintf (logtext, "Upper bound of max stack elements: %d", count_upper_bound_new_stack);
+       sprintf(logtext, "Upper bound of max stack elements: %d", count_upper_bound_new_stack);
        dolog();
-       sprintf (logtext, "Distribution of stack sizes at block boundary");
+       sprintf(logtext, "Distribution of stack sizes at block boundary");
        dolog();
-       sprintf (logtext, "    0    1    2    3    4    5    6    7    8    9    >=10");
+       sprintf(logtext, "    0    1    2    3    4    5    6    7    8    9    >=10");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_block_stack[0],
-               count_block_stack[1],count_block_stack[2],count_block_stack[3],count_block_stack[4],
-               count_block_stack[5],count_block_stack[6],count_block_stack[7],count_block_stack[8],
-               count_block_stack[9],count_block_stack[10]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_block_stack[0],
+                       count_block_stack[1], count_block_stack[2], count_block_stack[3], count_block_stack[4],
+                       count_block_stack[5], count_block_stack[6], count_block_stack[7], count_block_stack[8],
+                       count_block_stack[9], count_block_stack[10]);
        dolog();
-       sprintf (logtext, "Distribution of store stack depth");
+       sprintf(logtext, "Distribution of store stack depth");
        dolog();
-       sprintf (logtext, "    0    1    2    3    4    5    6    7    8    9    >=10");
+       sprintf(logtext, "    0    1    2    3    4    5    6    7    8    9    >=10");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_depth[0],
-               count_store_depth[1],count_store_depth[2],count_store_depth[3],count_store_depth[4],
-               count_store_depth[5],count_store_depth[6],count_store_depth[7],count_store_depth[8],
-               count_store_depth[9],count_store_depth[10]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_depth[0],
+                       count_store_depth[1], count_store_depth[2], count_store_depth[3], count_store_depth[4],
+                       count_store_depth[5], count_store_depth[6], count_store_depth[7], count_store_depth[8],
+                       count_store_depth[9], count_store_depth[10]);
        dolog();
-       sprintf (logtext, "Distribution of store creator chains first part");
+       sprintf(logtext, "Distribution of store creator chains first part");
        dolog();
-       sprintf (logtext, "    0    1    2    3    4    5    6    7    8    9  ");
+       sprintf(logtext, "    0    1    2    3    4    5    6    7    8    9  ");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_length[0],
-               count_store_length[1],count_store_length[2],count_store_length[3],count_store_length[4],
-               count_store_length[5],count_store_length[6],count_store_length[7],count_store_length[8],
-               count_store_length[9]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_length[0],
+                       count_store_length[1], count_store_length[2], count_store_length[3], count_store_length[4],
+                       count_store_length[5], count_store_length[6], count_store_length[7], count_store_length[8],
+                       count_store_length[9]);
        dolog();
-       sprintf (logtext, "Distribution of store creator chains second part");
+       sprintf(logtext, "Distribution of store creator chains second part");
        dolog();
-       sprintf (logtext, "   10   11   12   13   14   15   16   17   18   19  >=20");
+       sprintf(logtext, "   10   11   12   13   14   15   16   17   18   19  >=20");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_length[10],
-               count_store_length[11],count_store_length[12],count_store_length[13],count_store_length[14],
-               count_store_length[15],count_store_length[16],count_store_length[17],count_store_length[18],
-               count_store_length[19],count_store_length[20]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_store_length[10],
+                       count_store_length[11], count_store_length[12], count_store_length[13], count_store_length[14],
+                       count_store_length[15], count_store_length[16], count_store_length[17], count_store_length[18],
+                       count_store_length[19], count_store_length[20]);
        dolog();
-       sprintf (logtext, "Distribution of analysis iterations");
+       sprintf(logtext, "Distribution of analysis iterations");
        dolog();
-       sprintf (logtext, "    1    2    3    4    >=5");
+       sprintf(logtext, "    1    2    3    4    >=5");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d", count_analyse_iterations[0],count_analyse_iterations[1],
-               count_analyse_iterations[2],count_analyse_iterations[3],count_analyse_iterations[4]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d", count_analyse_iterations[0], count_analyse_iterations[1],
+                       count_analyse_iterations[2], count_analyse_iterations[3], count_analyse_iterations[4]);
        dolog();
-       sprintf (logtext, "Distribution of basic blocks per method");
+       sprintf(logtext, "Distribution of basic blocks per method");
        dolog();
-       sprintf (logtext, " <= 5 <=10 <=15 <=20 <=30 <=40 <=50 <=75  >75");
+       sprintf(logtext, " <= 5 <=10 <=15 <=20 <=30 <=40 <=50 <=75  >75");
        dolog();
-       sprintf (logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_method_bb_distribution[0],
-               count_method_bb_distribution[1],count_method_bb_distribution[2],count_method_bb_distribution[3],
-               count_method_bb_distribution[4],count_method_bb_distribution[5],count_method_bb_distribution[6],
-               count_method_bb_distribution[7],count_method_bb_distribution[8]);
+       sprintf(logtext, "%5d%5d%5d%5d%5d%5d%5d%5d%5d", count_method_bb_distribution[0],
+                       count_method_bb_distribution[1], count_method_bb_distribution[2], count_method_bb_distribution[3],
+                       count_method_bb_distribution[4], count_method_bb_distribution[5], count_method_bb_distribution[6],
+                       count_method_bb_distribution[7], count_method_bb_distribution[8]);
        dolog();
-       sprintf (logtext, "Distribution of basic block sizes");
+       sprintf(logtext, "Distribution of basic block sizes");
        dolog();
-       sprintf (logtext,
-       "  0    1    2    3    4   5   6   7   8   9 <13 <15 <17 <19 <21 <26 <31 >30");
+       sprintf(logtext,
+                        "  0    1    2    3    4   5   6   7   8   9 <13 <15 <17 <19 <21 <26 <31 >30");
        dolog();
-       sprintf (logtext, "%3d%5d%5d%5d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d",
-               count_block_size_distribution[0], count_block_size_distribution[1], count_block_size_distribution[2],
-               count_block_size_distribution[3], count_block_size_distribution[4], count_block_size_distribution[5],
-               count_block_size_distribution[6], count_block_size_distribution[7], count_block_size_distribution[8],
-               count_block_size_distribution[9], count_block_size_distribution[10],count_block_size_distribution[11],
-               count_block_size_distribution[12],count_block_size_distribution[13],count_block_size_distribution[14],
-               count_block_size_distribution[15],count_block_size_distribution[16],count_block_size_distribution[17]);
+       sprintf(logtext, "%3d%5d%5d%5d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d",
+                       count_block_size_distribution[0], count_block_size_distribution[1], count_block_size_distribution[2],
+                       count_block_size_distribution[3], count_block_size_distribution[4], count_block_size_distribution[5],
+                       count_block_size_distribution[6], count_block_size_distribution[7], count_block_size_distribution[8],
+                       count_block_size_distribution[9], count_block_size_distribution[10], count_block_size_distribution[11],
+                       count_block_size_distribution[12], count_block_size_distribution[13], count_block_size_distribution[14],
+                       count_block_size_distribution[15], count_block_size_distribution[16], count_block_size_distribution[17]);
        dolog();
-       sprintf (logtext, "Size of Code Area (Kb):  %10.3f", (float) count_code_len / 1024);
+       sprintf(logtext, "Size of Code Area (Kb):  %10.3f", (float) count_code_len / 1024);
        dolog();
-       sprintf (logtext, "Size of data Area (Kb):  %10.3f", (float) count_data_len / 1024);
+       sprintf(logtext, "Size of data Area (Kb):  %10.3f", (float) count_data_len / 1024);
        dolog();
-       sprintf (logtext, "Size of Class Infos (Kb):%10.3f", (float) (count_class_infos) / 1024);
+       sprintf(logtext, "Size of Class Infos (Kb):%10.3f", (float) (count_class_infos) / 1024);
        dolog();
-       sprintf (logtext, "Size of Const Pool (Kb): %10.3f", (float) (count_const_pool_len + count_utf_len) / 1024);
+       sprintf(logtext, "Size of Const Pool (Kb): %10.3f", (float) (count_const_pool_len + count_utf_len) / 1024);
        dolog();
-       sprintf (logtext, "Size of Vftbl (Kb):      %10.3f", (float) count_vftbl_len / 1024);
+       sprintf(logtext, "Size of Vftbl (Kb):      %10.3f", (float) count_vftbl_len / 1024);
        dolog();
-       sprintf (logtext, "Size of comp stub (Kb):  %10.3f", (float) count_cstub_len / 1024);
+       sprintf(logtext, "Size of comp stub (Kb):  %10.3f", (float) count_cstub_len / 1024);
        dolog();
-       sprintf (logtext, "Size of native stub (Kb):%10.3f", (float) count_nstub_len / 1024);
+       sprintf(logtext, "Size of native stub (Kb):%10.3f", (float) count_nstub_len / 1024);
        dolog();
-       sprintf (logtext, "Size of Utf (Kb):        %10.3f", (float) count_utf_len / 1024);
+       sprintf(logtext, "Size of Utf (Kb):        %10.3f", (float) count_utf_len / 1024);
        dolog();
-       sprintf (logtext, "Size of VMCode (Kb):     %10.3f(%d)", (float) count_vmcode_len / 1024,
-                                                     count_vmcode_len - 18 * count_all_methods);
+       sprintf(logtext, "Size of VMCode (Kb):     %10.3f(%d)", (float) count_vmcode_len / 1024,
+                       count_vmcode_len - 18 * count_all_methods);
        dolog();
-       sprintf (logtext, "Size of ExTable (Kb):    %10.3f", (float) count_extable_len / 1024);
+       sprintf(logtext, "Size of ExTable (Kb):    %10.3f", (float) count_extable_len / 1024);
        dolog();
-       sprintf (logtext, "Number of class loads:   %d", count_class_loads);
+       sprintf(logtext, "Number of class loads:   %d", count_class_loads);
        dolog();
-       sprintf (logtext, "Number of class inits:   %d", count_class_inits);
+       sprintf(logtext, "Number of class inits:   %d", count_class_inits);
        dolog();
-       sprintf (logtext, "Number of loaded Methods: %d\n\n", count_all_methods);
+       sprintf(logtext, "Number of loaded Methods: %d\n\n", count_all_methods);
        dolog();
 
-       sprintf (logtext, "Calls of utf_new: %22d", count_utf_new);
+       sprintf(logtext, "Calls of utf_new: %22d", count_utf_new);
        dolog();
-       sprintf (logtext, "Calls of utf_new (element found): %6d\n\n", count_utf_new_found);
+       sprintf(logtext, "Calls of utf_new (element found): %6d\n\n", count_utf_new_found);
        dolog();
 }
 
 
+
 /********** Function: class_compile_methods   (debugging only) ********/
 
 void class_compile_methods ()
@@ -425,19 +451,20 @@ void class_compile_methods ()
                        m = &(c->methods[i]);
                        if (m->jcode) {
                                (void) jit_compile(m);
-                               }
                        }
-               c = list_next (&linkedclasses, c);
                }
+               c = list_next (&linkedclasses, c);
+       }
 }
 
+
+
 /*
  * void exit_handler(void)
  * -----------------------
  * The exit_handler function is called upon program termination to shutdown
  * the various subsystems and release the resources allocated to the VM.
  */
-
 void exit_handler(void)
 {
        /********************* Print debug tables ************************/
@@ -470,6 +497,8 @@ void exit_handler(void)
        }
 }
 
+
+
 /************************** Function: main *******************************
 
    The main program.
@@ -502,9 +531,9 @@ int main(int argc, char **argv)
 
        /************ Collect info from the environment ************************/
 
-       cp = getenv ("CLASSPATH");
+       cp = getenv("CLASSPATH");
        if (cp) {
-               strcpy (classpath, cp);
+               strcpy(classpath, cp);
        }
 
        /***************** Interpret the command line *****************/
@@ -512,8 +541,7 @@ int main(int argc, char **argv)
        checknull = false;
        opt_noieee = false;
 
-       while ( (i = get_opt(argc,argv)) != OPT_DONE) {
-
+       while ((i = get_opt(argc,argv)) != OPT_DONE) {
                switch (i) {
                case OPT_IGNORE: break;
                        
@@ -524,11 +552,12 @@ int main(int argc, char **argv)
                                
                case OPT_D:
                        {
-                               int n,l=strlen(opt_arg);
-                               for (n=0; n<l; n++) {
+                               int n;
+                               int l = strlen(opt_arg);
+                               for (n = 0; n < l; n++) {
                                        if (opt_arg[n]=='=') {
                                                opt_arg[n] = '\0';
-                                               attach_property (opt_arg, opt_arg+n+1);
+                                               attach_property(opt_arg, opt_arg + n + 1);
                                                goto didit;
                                        }
                                }
@@ -537,19 +566,19 @@ int main(int argc, char **argv)
                                        
                        didit: ;
                        }       
-               break;
+                       break;
                                
                case OPT_MS:
                case OPT_MX:
-                       if (opt_arg[strlen(opt_arg)-1] == 'k') {
+                       if (opt_arg[strlen(opt_arg) - 1] == 'k') {
                                j = 1024 * atoi(opt_arg);
                        }
-                       else if (opt_arg[strlen(opt_arg)-1] == 'm') {
+                       else if (opt_arg[strlen(opt_arg) - 1] == 'm') {
                                j = 1024 * 1024 * atoi(opt_arg);
                        }
                        else j = atoi(opt_arg);
                                
-                       if (i==OPT_MX) heapsize = j;
+                       if (i == OPT_MX) heapsize = j;
                        else heapstartsize = j;
                        break;
 
@@ -590,15 +619,20 @@ int main(int argc, char **argv)
                        break;
                                        
                case OPT_LOG:
-                       strcpy (logfilename, opt_arg);
+                       strcpy(logfilename, opt_arg);
                        break;
                        
                case OPT_CHECK:
-                       for (j=0; j<strlen(opt_arg); j++) {
+                       for (j = 0; j < strlen(opt_arg); j++) {
                                switch (opt_arg[j]) {
-                               case 'b': checkbounds=false; break;
-                               case 's': checksync=false; break;
-                               default:  print_usage();
+                               case 'b':
+                                       checkbounds = false;
+                                       break;
+                               case 's':
+                                       checksync = false;
+                                       break;
+                               default:
+                                       print_usage();
                                        exit(10);
                                }
                        }
@@ -626,15 +660,30 @@ int main(int argc, char **argv)
                        break;
                        
                case OPT_SHOW:       /* Display options */
-                       for (j=0; j<strlen(opt_arg); j++) {             
+                       for (j = 0; j < strlen(opt_arg); j++) {         
                                switch (opt_arg[j]) {
-                               case 'a':  showdisassemble=true; compileverbose=true; break;
-                               case 'c':  showconstantpool=true; break;
-                               case 'd':  showddatasegment=true; break;
-                               case 'i':  showintermediate=true; compileverbose=true; break;
-                               case 'm':  showmethods=true; break;
-                               case 'u':  showutf=true; break;
-                               default:   print_usage();
+                               case 'a':
+                                       showdisassemble = true;
+                                       compileverbose=true;
+                                       break;
+                               case 'c':
+                                       showconstantpool = true;
+                                       break;
+                               case 'd':
+                                       showddatasegment = true;
+                                       break;
+                               case 'i':
+                                       showintermediate = true;
+                                       compileverbose = true;
+                                       break;
+                               case 'm':
+                                       showmethods = true;
+                                       break;
+                               case 'u':
+                                       showutf = true;
+                                       break;
+                               default:
+                                       print_usage();
                                        exit(10);
                                }
                        }
@@ -645,14 +694,25 @@ int main(int argc, char **argv)
                        break;
 
                case OPT_INLINING:
-                       for (j=0; j<strlen(opt_arg); j++) {             
+                       for (j = 0; j < strlen(opt_arg); j++) {         
                                switch (opt_arg[j]) {
-                               case 'n':  useinlining = true; break;
-                               case 'v':  inlinevirtuals = true; break;
-                               case 'e':  inlineexceptions = true; break;
-                               case 'p':  inlineparamopt = true; break;
-                               case 'o':  inlineoutsiders = true; break;
-                               default:   print_usage();
+                               case 'n':
+                                       useinlining = true;
+                                       break;
+                               case 'v':
+                                       inlinevirtuals = true;
+                                       break;
+                               case 'e':
+                                       inlineexceptions = true;
+                                       break;
+                               case 'p':
+                                       inlineparamopt = true;
+                                       break;
+                               case 'o':
+                                       inlineoutsiders = true;
+                                       break;
+                               default:
+                                       print_usage();
                                        exit(10);
                                }
                        }
@@ -678,50 +738,47 @@ int main(int argc, char **argv)
    
    
        if (opt_ind >= argc) {
-               print_usage ();
+               print_usage();
                exit(10);
        }
 
 
        /**************************** Program start *****************************/
 
-       log_init (logfilename);
+       log_init(logfilename);
        if (verbose) {
-               log_text (
-                                 "CACAO started -------------------------------------------------------");
+               log_text("CACAO started -------------------------------------------------------");
        }
        
-       suck_init (classpath);
-       native_setclasspath (classpath);
+       suck_init(classpath);
+       native_setclasspath(classpath);
                
        tables_init();
        heap_init(heapsize, heapstartsize, &dummy);
        jit_init();
        loader_init();
 
-       native_loadclasses ();
+       native_loadclasses();
 
 
        /*********************** Load JAVA classes  ***************************/
    
        cp = argv[opt_ind++];
-       for (i=strlen(cp)-1; i>=0; i--) {     /* Transform dots into slashes */
-               if (cp[i]=='.') cp[i]='/';        /* in the class name */
+       for (i = strlen(cp) - 1; i >= 0; i--) {     /* Transform dots into slashes */
+               if (cp[i] == '.') cp[i] = '/';        /* in the class name */
        }
 
-       topclass = loader_load ( utf_new_char (cp) );
+       topclass = loader_load( utf_new_char (cp) );
 
-       if (exceptionptr != 0)
-       {
-               printf ("#### Class loader has thrown: ");
-               utf_display (exceptionptr->vftbl->class->name);
-               printf ("\n");
+       if (exceptionptr != 0) {
+               printf("#### Class loader has thrown: ");
+               utf_display(exceptionptr->vftbl->class->name);
+               printf("\n");
 
                exceptionptr = 0;
        }
 
-       if (topclass == 0)
-       {
+       if (topclass == 0) {
                printf("#### Could not find top class - exiting\n");
                exit(1);
        }
@@ -729,7 +786,7 @@ int main(int argc, char **argv)
        gc_init();
 
 #ifdef USE_THREADS
-       initThreads((u1*)&dummy);                   /* schani */
+       initThreads((u1*) &dummy);                   /* schani */
 #endif
 
        /************************* Start worker routines ********************/
@@ -745,28 +802,28 @@ int main(int argc, char **argv)
                                                                           utf_new_char ("main"), 
                                                                           utf_new_char ("([Ljava/lang/String;)V")
                                                                           );
-               if (!mainmethod) panic ("Can not find method 'void main(String[])'");
-               if ((mainmethod->flags & ACC_STATIC) != ACC_STATIC) panic ("main is not static!");
+               if (!mainmethod) panic("Can not find method 'void main(String[])'");
+               if ((mainmethod->flags & ACC_STATIC) != ACC_STATIC) panic("main is not static!");
                        
-               a = builtin_anewarray (argc - opt_ind, class_java_lang_String);
-               for (i=opt_ind; i<argc; i++) {
-                       a->data[i-opt_ind] = javastring_new (utf_new_char (argv[i]) );
+               a = builtin_anewarray(argc - opt_ind, class_java_lang_String);
+               for (i = opt_ind; i < argc; i++) {
+                       a->data[i - opt_ind] = javastring_new(utf_new_char(argv[i]));
                }
-               local_exceptionptr = asm_calljavamethod (mainmethod, a, NULL, NULL, NULL );
+               local_exceptionptr = asm_calljavamethod(mainmethod, a, NULL, NULL, NULL);
        
                if (local_exceptionptr) {
-                       printf ("#### Program has thrown: ");
-                       utf_display (local_exceptionptr->vftbl->class->name);
-                       printf ("\n");
+                       printf("#### Program has thrown: ");
+                       utf_display(local_exceptionptr->vftbl->class->name);
+                       printf("\n");
                }
-                                        /*RTAprint*/ if ((pCallgraph >= 1) && (opt_rt)) {
-                                        /*RTAprint*/    printCallgraph (); }
+               /*RTAprint*/ if ((pCallgraph >= 1) && (opt_rt)) {
+                       /*RTAprint*/    printCallgraph (); }
 
-                                        /*RTprint*/ if ((pClassHeir >= 1) && (opt_rt)) {
-                                        /*RTprint*/     printf("Last RTA Info -");
-                                        /*RTprint*/     printRThierarchyInfo(mainmethod); 
-                                       /*RTprint*/     }
-                                       /*RTprint*/     printObjectClassHeirarchy1( );
+               /*RTprint*/ if ((pClassHeir >= 1) && (opt_rt)) {
+                       /*RTprint*/     printf("Last RTA Info -");
+                       /*RTprint*/     printRThierarchyInfo(mainmethod); 
+                       /*RTprint*/     }
+               /*RTprint*/     printObjectClassHeirarchy1( );
 
 
 #ifdef USE_THREADS
@@ -794,7 +851,7 @@ int main(int argc, char **argv)
                        m = class_findmethod(topclass, 
                                                                 utf_new_char(specificmethodname), NULL);
                if (!m) panic ("Specific method not found");
-                       (void) jit_compile(m);
+               (void) jit_compile(m);
        }
 
        exit(0);
@@ -811,23 +868,25 @@ int main(int argc, char **argv)
 
 void cacao_shutdown(s4 status)
 {
-                                        /*RTAprint*/ if ((pCallgraph >= 1) && (opt_rt)) {
-                                        /*RTAprint*/    printCallgraph (NULL); }
+       if ((pCallgraph >= 1) && (opt_rt)) {
+               printCallgraph(NULL);
+       }
 
-                                        /*RTprint*/ if ((pClassHeir >= 1) && (opt_rt)) {
-                                        /*RTprint*/     printf("RTA Information -");
-                                        /*RTprint*/     printRThierarchyInfo(NULL); }
+       if ((pClassHeir >= 1) && (opt_rt)) {
+               printf("RTA Information -");
+               printRThierarchyInfo(NULL);
+       }
 
        if (verbose || getcompilingtime || statistics) {
                log_text ("CACAO terminated by shutdown");
                if (statistics)
-                       print_stats ();
+                       print_stats();
                if (getcompilingtime)
-                       print_times ();
+                       print_times();
                mem_usagelog(0);
-               sprintf (logtext, "Exit status: %d\n", (int) status);
+               sprintf(logtext, "Exit status: %d\n", (int) status);
                dolog();
-               }
+       }
 
        exit(status);
 }
index a56f63d246113e5ab5690849d6eb4861e2edcfda..fc0d43f1117601c8c37cefc772b6ea38227674a1 100644 (file)
@@ -1,30 +1,47 @@
-/* headers.c *******************************************************************
+/* headers.c - main for header generation (cacaoh)
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       This module replaces 'main' for header file generation. It also fakes some
-       references to external modules which would otherwise depend on the header
-       files generated by this very program.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       This module is quite a quick hack and not documented very well as a
-       consequence.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-       Last Change: $Id: headers.c 542 2003-10-30 20:58:18Z twisti $
+   Contact: cacao@complang.tuwien.ac.at
 
-*******************************************************************************/
+   Authors: Reinhard Grafl
 
-#define CACAOH
+   Changes: Mark Probst
+            Philipp Tomsich
 
-#include "config.h" /* phil */
+   $Id: headers.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdlib.h>
+#include "config.h"
 #include "global.h"
 #include "tables.h"
 #include "loader.h"
+#include "toolbox/chain.h"
+#include "toolbox/memory.h"
+#include "toolbox/loging.h"
 
 
 /******* replace some external functions  *********/
@@ -100,12 +117,12 @@ static bool dopadding;
 
 static void printIDpart (int c) 
 {
-               if (     (c>='a' && c<='z')
-                     || (c>='A' && c<='Z')
-                     || (c>='0' && c<='9')
-                     || (c=='_') )          
-                          putc (c,file);
-        else       putc ('_',file);
+       if (     (c>='a' && c<='z')
+                        || (c>='A' && c<='Z')
+                        || (c>='0' && c<='9')
+                        || (c=='_') )          
+               putc (c,file);
+       else       putc ('_',file);
 
 }
 
@@ -135,57 +152,57 @@ static char *printtype (char *utf_ptr)
        u2 c;
 
        switch (utf_nextu2(&utf_ptr)) {
-               case 'V': fprintf (file, "void");
-                         break;
-               case 'I':
-               case 'S':
-               case 'B':
-               case 'C':
-               case 'Z': addoutputsize (4);
-                  fprintf (file, "s4");
-                  break;
-               case 'J': addoutputsize (8);
-                  fprintf (file, "s8");
-                  break;
-               case 'F': addoutputsize (4);
-                  fprintf (file, "float");
-                  break;
-               case 'D': addoutputsize (8);
-                  fprintf (file, "double");
-                  break;
-               case '[':
-                       addoutputsize ( sizeof(java_arrayheader*) ); 
-                       switch (utf_nextu2(&utf_ptr)) {
-                               case 'I':  fprintf (file, "java_intarray*"); break;
-                               case 'J':  fprintf (file, "java_longarray*"); break;
-                               case 'Z':  fprintf (file, "java_booleanarray*"); break;
-                               case 'B':  fprintf (file, "java_bytearray*"); break;
-                               case 'S':  fprintf (file, "java_shortarray*"); break;
-                               case 'C':  fprintf (file, "java_chararray*"); break;
-                               case 'F':  fprintf (file, "java_floatarray*"); break;
-                               case 'D':  fprintf (file, "java_doublearray*"); break;
+       case 'V': fprintf (file, "void");
+               break;
+       case 'I':
+       case 'S':
+       case 'B':
+       case 'C':
+       case 'Z': addoutputsize (4);
+               fprintf (file, "s4");
+               break;
+       case 'J': addoutputsize (8);
+               fprintf (file, "s8");
+               break;
+       case 'F': addoutputsize (4);
+               fprintf (file, "float");
+               break;
+       case 'D': addoutputsize (8);
+               fprintf (file, "double");
+               break;
+       case '[':
+               addoutputsize ( sizeof(java_arrayheader*) ); 
+               switch (utf_nextu2(&utf_ptr)) {
+               case 'I':  fprintf (file, "java_intarray*"); break;
+               case 'J':  fprintf (file, "java_longarray*"); break;
+               case 'Z':  fprintf (file, "java_booleanarray*"); break;
+               case 'B':  fprintf (file, "java_bytearray*"); break;
+               case 'S':  fprintf (file, "java_shortarray*"); break;
+               case 'C':  fprintf (file, "java_chararray*"); break;
+               case 'F':  fprintf (file, "java_floatarray*"); break;
+               case 'D':  fprintf (file, "java_doublearray*"); break;
                                
-                               case '[':  fprintf (file, "java_arrayarray*");                                         
-                                          while ((c = utf_nextu2(&utf_ptr)) == '[') ;
-                                          if (c=='L') 
-                                                          while (utf_nextu2(&utf_ptr) != ';');
-                           break;
+               case '[':  fprintf (file, "java_arrayarray*");                                         
+                       while ((c = utf_nextu2(&utf_ptr)) == '[') ;
+                       if (c=='L') 
+                               while (utf_nextu2(&utf_ptr) != ';');
+                       break;
                            
-                               case 'L':  fprintf (file, "java_objectarray*");
-                                          while ( utf_nextu2(&utf_ptr) != ';');
-                                          break;
-                               default: panic ("invalid type descriptor");
-                               }
+               case 'L':  fprintf (file, "java_objectarray*");
+                       while ( utf_nextu2(&utf_ptr) != ';');
                        break;
+               default: panic ("invalid type descriptor");
+               }
+               break;
                
-               case 'L': 
-                       addoutputsize ( sizeof(java_objectheader*));
-            fprintf (file, "struct ");
-            while ( (c = utf_nextu2(&utf_ptr)) != ';' ) printIDpart (c);        
-            fprintf (file, "*");
-                       break;
+       case 'L': 
+               addoutputsize ( sizeof(java_objectheader*));
+               fprintf (file, "struct ");
+               while ( (c = utf_nextu2(&utf_ptr)) != ';' ) printIDpart (c);     
+               fprintf (file, "*");
+               break;
                                        
-               default:  panic ("Unknown type in field descriptor");
+       default:  panic ("Unknown type in field descriptor");
        }
        
        return utf_ptr;
@@ -218,7 +235,7 @@ static void printfields (classinfo *c)
                addoutputsize ( sizeof(java_objectheader) );
                fprintf (file, "   java_objectheader header;\n");
                return;
-               }
+       }
                
        printfields (c->super);
        
@@ -237,8 +254,8 @@ static void printfields (classinfo *c)
                        chain_addlast(ident_chain,f->name);     
 
                        fprintf (file, ";\n");
-                       }
                }
+       }
 }
 
 /***************** store prototype for native method in file ******************/
@@ -285,7 +302,7 @@ static void printmethod (methodinfo *m)
                printID (m->class->name);
                fprintf (file, "* this ");
 
-           };
+       };
 
        if ((*utf_ptr)!=')') fprintf (file, ", "); 
                        
@@ -293,7 +310,7 @@ static void printmethod (methodinfo *m)
                utf_ptr = printtype (utf_ptr);
                fprintf (file, " par%d", paramnum++);
                if ((*utf_ptr)!=')') fprintf (file, ", ");
-               }
+       }
                        
        fprintf (file, ");\n");
 }
@@ -303,22 +320,22 @@ static void printmethod (methodinfo *m)
 
 static void simple_classname(char *buffer, utf *u)
 {
-  int i, simplename_start;
+       int i, simplename_start;
 
-  for (i=utf_strlen(u)-1; i>=0; i--) { 
+       for (i=utf_strlen(u)-1; i>=0; i--) { 
 
-       if (u->text[i] == '$') u->text[i] = '_'; else /* convert '$' to '_' */
-    if (u->text[i] == '/') {
-       /* beginning of simple name */
-        simplename_start = i+1;
-               break;
+               if (u->text[i] == '$') u->text[i] = '_'; else /* convert '$' to '_' */
+                       if (u->text[i] == '/') {
+                               /* beginning of simple name */
+                               simplename_start = i+1;
+                               break;
+                       }
        }
-  }
 
-  for (i=simplename_start; i < utf_strlen(u); i++) 
-                 buffer[i-simplename_start] = u->text[i];
+       for (i=simplename_start; i < utf_strlen(u); i++) 
+               buffer[i-simplename_start] = u->text[i];
 
-  buffer[i-simplename_start] = '\0';                
+       buffer[i-simplename_start] = '\0';                
 }
 
 /*********** create headerfile for classes and store native methods in chain ************/
@@ -370,9 +387,9 @@ static void headerfile_generate (classinfo *c)
 
                if (m->flags & ACC_NATIVE) {
                        chain_addlast (nativemethod_chain, m);     
-                       printmethod(m);                                             
-                       }                                                       
-               }
+                       printmethod(m);                                             
+               }                                                       
+       }
                                
 
        chain_free(ident_chain);                                 
@@ -409,7 +426,7 @@ static void printnativetableentry (methodinfo *m)
        utf_fprint (file, m->descriptor);
        fprintf (file, "\",\n     ");
        if ( (m->flags & ACC_STATIC) !=0)  fprintf (file, "true");
-                                     else fprintf (file, "false");
+       else fprintf (file, "false");
        fprintf (file, ",\n     ");
        fprintf (file, "(functionptr) Java_");
        printID (m->class->name);
@@ -478,7 +495,7 @@ Prints usage information for the JAVA header generator to stdout.
 
 static void print_usage()
 {
-       printf ("USAGE: jch class [class..]\n");
+       printf("Usage: cacaoh class [class..]\n");
 }   
 
 
@@ -497,95 +514,94 @@ int main(int argc, char **argv)
        void *dummy;
                
 
-   /********** internal (only used by main) *****************************/
+       /********** internal (only used by main) *****************************/
    
        char classpath[500] = "";
        char offsets_filename[1024] = ""; /* phil */
        u4 heapsize = 100000;
 
-   /*********** options so only headers are generated *******************/
+       /*********** options so only headers are generated *******************/
    
-   makeinitializations=false;
+       makeinitializations=false;
    
 
-   /************ Collect some info from the environment *****************/
+       /************ Collect some info from the environment *****************/
 
-       cp = getenv ("CLASSPATH");
+       cp = getenv("CLASSPATH");
        if (cp) {
-               strcpy (classpath + strlen(classpath), ":");
-               strcpy (classpath + strlen(classpath), cp);
-               }
+               strcpy(classpath + strlen(classpath), ":");
+               strcpy(classpath + strlen(classpath), cp);
+       }
 
        if (argc < 2) {
-               print_usage ();
+               print_usage();
                exit(10);
-               }
+       }
 
 
-   /**************************** Program start **************************/
+       /**************************** Program start **************************/
 
-       log_init (NULL);
-       log_text ("Java - header-generator started"); 
+       log_init(NULL);
+       log_text("Java - header-generator started"); 
        
-       sprintf(offsets_filename, "%s/offsets.h", SYSDEP_DIR); /* phil */
+       sprintf(offsets_filename, "jit/%s/offsets.h", ARCH_DIR); /* phil */
        file = fopen(offsets_filename, "w");
        if (file == NULL) {
-               fprintf (stderr, "Can not open file '%s' for write", offsets_filename);
+               fprintf(stderr, "Can not open file '%s' for write", offsets_filename);
                exit(-1);
        }
        
-       fprintf (file, "/* This file is machine generated, don't edit it !*/\n\n"); 
+       fprintf(file, "/* This file is machine generated, don't edit it !*/\n\n"); 
 
-       fprintf (file, "#define offobjvftbl    %3d\n", (int) OFFSET(java_objectheader, vftbl));
-       fprintf (file, "#define offarraysize   %3d\n", (int) OFFSET(java_arrayheader, size));
-       fprintf (file, "#define offobjarrdata  %3d\n\n", (int) OFFSET(java_objectarray, data[0]));
-       fprintf (file, "#define offbaseval     %3d\n", (int) OFFSET(vftbl, baseval));
-       fprintf (file, "#define offdiffval     %3d\n", (int) OFFSET(vftbl, diffval));
+       fprintf(file, "#define offobjvftbl    %3d\n", (int) OFFSET(java_objectheader, vftbl));
+       fprintf(file, "#define offarraysize   %3d\n", (int) OFFSET(java_arrayheader, size));
+       fprintf(file, "#define offobjarrdata  %3d\n\n", (int) OFFSET(java_objectarray, data[0]));
+       fprintf(file, "#define offbaseval     %3d\n", (int) OFFSET(vftbl, baseval));
+       fprintf(file, "#define offdiffval     %3d\n", (int) OFFSET(vftbl, diffval));
 
-       fclose (file);
+       fclose(file);
 
-       suck_init (classpath);
+       suck_init(classpath);
    
-       tables_init ();
-       heap_init (heapsize, heapsize, &dummy);
-       loader_init ();
+       tables_init();
+       heap_init(heapsize, heapsize, &dummy);
+       loader_init();
 
 
-   /*********************** Load JAVA classes  **************************/
+       /*********************** Load JAVA classes  **************************/
        
-       nativemethod_chain = chain_new ();
-       nativeclass_chain = chain_new ();
+       nativemethod_chain = chain_new();
+       nativeclass_chain = chain_new();
        
-       for (a=1; a<argc; a++) {   
-               cp = argv[a];
+       for (a = 1; a < argc; a++) {
+               cp = argv[a];
 
                /* convert classname */
-               for (i=strlen(cp)-1; i>=0; i--)    
+               for (i = strlen(cp) - 1; i >= 0; i--)    
                        switch (cp[i]) {
-                         case '.': cp[i]='/';
-                                       break;
-                         case '_': cp[i]='$';    
+                       case '.': cp[i]='/';
+                               break;
+                       case '_': cp[i]='$';    
                        }
        
-               topclass = loader_load ( utf_new_char (cp) );
+               topclass = loader_load(utf_new_char(cp));
                
-        headerfile_generate (topclass);
+        headerfile_generate(topclass);
        }
 
-       headers_finish ();
+       headers_finish();
 
-   /************************ Release all resources **********************/
+       /************************ Release all resources **********************/
 
-       loader_close ();
-       heap_close ();
-       tables_close ( literalstring_free );
+       loader_close();
+       heap_close();
+       tables_close( literalstring_free );
        
 
-   /* Print "finished" message */
+       /* Print "finished" message */
 
-       log_text ("Java - header-generator stopped");
-       log_cputime ();
+       log_text("Java - header-generator stopped");
+       log_cputime();
        mem_usagelog(1);
        
        return 0;
index 39bb95a45dd74570338e7f7aea86ae78b3d19e61..89ae48f12f07a5326c5afced482341866e2c23e5 100644 (file)
@@ -1,7 +1,20 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
 SUBDIRS = boehm-gc
 
 noinst_LIBRARIES = libboehm.a
 
 libboehm_a_SOURCES = boehm.c
 
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@ -I./boehm-gc/include
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@ -I./boehm-gc/include
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
index 892b8e159022dc1d95611fde03396acf8db47521..cfdde8dd6226ad4d514354664591d1e614dee225 100644 (file)
@@ -1,23 +1,40 @@
-/* boehm.c *********************************************************************
+/* mm/boehm.c - interface for boehm gc
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains the interface to the Boehm GC
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Andi Krall          EMAIL: cacao@complang.tuwien.ac.at
-                Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                        Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: $Id: boehm.c 512 2003-10-22 20:47:18Z twisti $
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Stefan Ring
+
+   $Id: boehm.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include "global.h"
 #include "threads/thread.h"
 #include "asmpart.h"
+#include "toolbox/loging.h"
 
 /* this is temporary workaround */
 #if defined(__X86_64__)
@@ -142,6 +159,7 @@ void gc_call()
        GC_gcollect();
 }
 
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
index 866241778e444716ae384facc62bb2fc4efc1780..7b007bd98bf507d8237512a6e219234fd84d29a7 100644 (file)
@@ -1,16 +1,35 @@
-/************************* toolbox/memory.c ************************************
+/* toolbox/memory.c - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Not documented, see memory.h.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1996/10/03
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+
+   $Id: memory.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 
 #include "global.h"
-#include "callargs.h"
 #include "loging.h"
 #include "memory.h"
 
 
-       /********* general types, variables and auxiliary functions *********/
+/********* general types, variables and auxiliary functions *********/
 
 #define DUMPBLOCKSIZE  (2<<21)
 #define ALIGNSIZE           8
@@ -46,13 +64,14 @@ dumplist *topdumpblock = NULL;
 long int maxmemusage = 0;
 long int maxdumpsize = 0;
 
-/* #define TRACECALLARGS */
+#define TRACECALLARGS
 
 #ifdef TRACECALLARGS
 static char *nomallocmem = NULL;
 static char *nomalloctop;
 static char *nomallocptr;
 
+
 static void *lit_checked_alloc (int length)
 {
        void *m;
@@ -90,9 +109,11 @@ static void *checked_alloc (int length)
        return m;
 }
 
+
 static int mmapcodesize = 0;
 static void *mmapcodeptr = NULL;
 
+
 void *mem_mmap(int length)
 {
        void *retptr;
@@ -104,11 +125,11 @@ void *mem_mmap(int length)
                        mmapcodesize = length;
                mmapcodesize = (ALIGN(mmapcodesize, getpagesize()));
                mmapcodeptr = mmap (NULL, (size_t) mmapcodesize,
-                             PROT_READ | PROT_WRITE | PROT_EXEC,
-                             MAP_PRIVATE | MAP_ANONYMOUS, -1, (off_t) 0);
+                                                       PROT_READ | PROT_WRITE | PROT_EXEC,
+                                                       MAP_PRIVATE | MAP_ANONYMOUS, -1, (off_t) 0);
                if (mmapcodeptr == (void*) -1)
                        panic ("Out of memory");
-               }
+       }
        retptr = mmapcodeptr;
        mmapcodeptr = (void*) ((char*) mmapcodeptr + length);
        mmapcodesize -= length;
@@ -118,7 +139,7 @@ void *mem_mmap(int length)
 
 #ifdef DEBUG
 
-       /************ Memory manager, safe version **************/
+/************ Memory manager, safe version **************/
 
 
 typedef struct memblock {
@@ -180,19 +201,19 @@ void mem_free(void *m, int length)
        if (!m) {
                if (length==0) return;
                panic ("returned memoryblock with address NULL, length != 0");
-               }
+       }
 
        mb = (memblock*) (((char*) m) - BLOCKOFFSET);
        
        if (mb->length != length) {
                sprintf (logtext, 
-                        "Memory block of size %d has been return as size %d",
+                                "Memory block of size %d has been return as size %d",
                         mb->length, length);
                error();
-               }
+       }
                
        if (mb->prev) mb->prev->next = mb->next;
-                else firstmemblock = mb->next;
+       else firstmemblock = mb->next;
        if (mb->next) mb->next->prev = mb->prev;
 
        free (mb);
@@ -207,19 +228,19 @@ void lit_mem_free(void *m, int length)
        if (!m) {
                if (length==0) return;
                panic ("returned memoryblock with address NULL, length != 0");
-               }
+       }
 
        mb = (memblock*) (((char*) m) - BLOCKOFFSET);
        
        if (mb->length != length) {
                sprintf (logtext, 
-                        "Memory block of size %d has been return as size %d",
+                                "Memory block of size %d has been return as size %d",
                         mb->length, length);
                error();
-               }
+       }
                
        if (mb->prev) mb->prev->next = mb->next;
-                else firstmemblock = mb->next;
+       else firstmemblock = mb->next;
        if (mb->next) mb->next->prev = mb->prev;
 
 #ifdef TRACECALLARGS
@@ -255,23 +276,23 @@ static void mem_characterlog (unsigned char *m, int len)
                        
                for (i=z; i<(z+LINESIZE) && i<len; i++) {
                        sprintf (logtext+strlen(logtext), "%2x ", m[i]);
-                       }
+               }
                for (; i<(z+LINESIZE); i++) {
                        sprintf (logtext+strlen(logtext), "   ");
-                       }
+               }
                                        
                sprintf (logtext+strlen(logtext),"   ");
                for (i=z; i<(z+LINESIZE) && i<len; i++) {
                        sprintf (logtext+strlen(logtext),
-                            "%c", (m[i]>=' ' && m[i]<=127) ? m[i] : '.');
-                       }
+                                        "%c", (m[i]>=' ' && m[i]<=127) ? m[i] : '.');
+               }
                        
                dolog();
-               }
+       }
 }
 
 #else
-               /******* Memory manager, fast version ******/
+/******* Memory manager, fast version ******/
 
 
 void *mem_alloc(int length)
@@ -301,7 +322,7 @@ void mem_free(void *m, int length)
        if (!m) {
                if (length==0) return;
                panic ("returned memoryblock with address NULL, length != 0");
-               }
+       }
 
        memoryusage -= length;
 
@@ -314,7 +335,7 @@ void lit_mem_free(void *m, int length)
        if (!m) {
                if (length==0) return;
                panic ("returned memoryblock with address NULL, length != 0");
-               }
+       }
 
        memoryusage -= length;
 
@@ -331,8 +352,8 @@ void *mem_realloc (void *m1, int len1, int len2)
 
        if (!m1) {
                if (len1!=0) 
-                 panic ("reallocating memoryblock with address NULL, length != 0");
-               }
+                       panic ("reallocating memoryblock with address NULL, length != 0");
+       }
                
        memoryusage = (memoryusage - len1) + len2;
 
@@ -344,9 +365,7 @@ void *mem_realloc (void *m1, int len1, int len2)
 
 #endif
 
-               /******* common memory manager parts ******/
-
-
+/******* common memory manager parts ******/
 
 long int mem_usage()
 {
@@ -354,38 +373,35 @@ long int mem_usage()
 }
 
 
-
-
-
 void *dump_alloc(int length)
 {
        void *m;
 
-        if (length==0) return NULL;
+       if (length == 0) return NULL;
        
-       length = ALIGN (length, ALIGNSIZE);
+       length = ALIGN(length, ALIGNSIZE);
 
-       assert (length <= DUMPBLOCKSIZE);
-       assert (length > 0);
+       assert(length <= DUMPBLOCKSIZE);
+       assert(length > 0);
 
        if (dumpsize + length > dumpspace) {
-               dumplist *newdumpblock = checked_alloc (sizeof(dumplist));
+               dumplist *newdumpblock = checked_alloc(sizeof(dumplist));
 
-               newdumpblock -> prev = topdumpblock;
+               newdumpblock->prev = topdumpblock;
                topdumpblock = newdumpblock;
 
-               newdumpblock -> dumpmem = checked_alloc (DUMPBLOCKSIZE);
+               newdumpblock->dumpmem = checked_alloc(DUMPBLOCKSIZE);
 
                dumpsize = dumpspace;
                dumpspace += DUMPBLOCKSIZE;             
-               }
+       }
        
-       m = topdumpblock -> dumpmem + DUMPBLOCKSIZE - (dumpspace - dumpsize);
+       m = topdumpblock->dumpmem + DUMPBLOCKSIZE - (dumpspace - dumpsize);
        dumpsize += length;
        
        if (dumpsize > maxdumpsize) {
                maxdumpsize = dumpsize;
-               }
+       }
                
        return m;
 }   
@@ -393,8 +409,8 @@ void *dump_alloc(int length)
 
 void *dump_realloc(void *ptr, int len1, int len2)
 {
-       void *p2 = dump_alloc (len2);
-       memcpy (p2, ptr, len1); 
+       void *p2 = dump_alloc(len2);
+       memcpy(p2, ptr, len1);  
        return p2;
 }
 
@@ -407,59 +423,70 @@ long int dump_size()
 
 void dump_release(long int size)
 {
-       assert (size >= 0 && size <= dumpsize);
+       assert(size >= 0 && size <= dumpsize);
 
        dumpsize = size;
        
-       while (dumpspace  >  dumpsize + DUMPBLOCKSIZE) {
+       while (dumpspace > dumpsize + DUMPBLOCKSIZE) {
                dumplist *oldtop = topdumpblock;
                
-               topdumpblock = oldtop -> prev;
+               topdumpblock = oldtop->prev;
                dumpspace -= DUMPBLOCKSIZE;
                
 #ifdef TRACECALLARGS
 #else
-               free (oldtop -> dumpmem);
-               free (oldtop);
+               free(oldtop->dumpmem);
+               free(oldtop);
 #endif
-               }               
+       }               
 }
 
 
-
-
 void mem_usagelog (int givewarnings)
 {
        if ((memoryusage!=0) && givewarnings) {
                sprintf (logtext, "Allocated memory not returned: %d",
-                     (int)memoryusage);
+                                (int)memoryusage);
                dolog();
 
 #ifdef DEBUG
                { 
-               memblock *mb = firstmemblock;
-               while (mb) {
-                       sprintf (logtext, "   Memory block size: %d", 
-                         (int)(mb->length) );
-                       dolog();
-                       mem_characterlog ( ((unsigned char*)mb) + BLOCKOFFSET, mb->length);
-                       mb = mb->next;
+                       memblock *mb = firstmemblock;
+                       while (mb) {
+                               sprintf (logtext, "   Memory block size: %d", 
+                                                (int)(mb->length) );
+                               dolog();
+                               mem_characterlog ( ((unsigned char*)mb) + BLOCKOFFSET, mb->length);
+                               mb = mb->next;
                        }
                }
 #endif
                        
-               }
+       }
 
        if ((dumpsize!=0) && givewarnings) {
                sprintf (logtext, "Dump memory not returned: %d",(int)dumpsize);
                dolog();
-               }
+       }
 
 
-       sprintf (logtext, "Random/Dump - memory usage: %dK/%dK", 
-             (int)((maxmemusage+1023)/1024), 
-             (int)((maxdumpsize+1023)/1024) );
+       sprintf(logtext, "Random/Dump - memory usage: %dK/%dK", 
+                       (int)((maxmemusage+1023)/1024), 
+                       (int)((maxdumpsize+1023)/1024) );
        dolog();
        
 }
 
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index fbcf7f59c3b1bf7639a177b95a0aa0c4a18997d6..f1c378d373f87232da767967f91dee3fc7cf6c5f 100644 (file)
@@ -1,16 +1,38 @@
-/************************* toolbox/memory.h ************************************
+/* toolbox/memory.h - macros for memory management
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Macros for memory management
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1996/10/03
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+
+   $Id: memory.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _MEMORY_H
+#define _MEMORY_H
 
 #include "types.h"
 
 void *heap_alloc_uncollectable(u4 bytelen);
 #define GCNEW(type,num)       heap_alloc_uncollectable(sizeof(type) * (num))
 
-#define ALIGN(pos,size)       ( ( ((pos)+(size)-1) / (size))*(size) )
-#define PADDING(pos,size)     ( ALIGN((pos),(size)) - (pos) )
-#define OFFSET(s,el)          ( (int) ( (size_t) &( ((s*)0) -> el ) ) )
+#define ALIGN(pos,size)       ((((pos) + (size) - 1) / (size)) * (size))
+#define PADDING(pos,size)     (ALIGN((pos),(size)) - (pos))
+#define OFFSET(s,el)          ((int) ((size_t) & (((s*) 0)->el)))
 
 
-#define NEW(type)             ((type*) mem_alloc ( sizeof(type) ))
-#define FREE(ptr,type)        mem_free (ptr, sizeof(type) )
+#define NEW(type)             ((type*) mem_alloc(sizeof(type)))
+#define FREE(ptr,type)        mem_free(ptr, sizeof(type))
 
-#define LNEW(type)             ((type*) lit_mem_alloc ( sizeof(type) ))
-#define LFREE(ptr,type)        lit_mem_free (ptr, sizeof(type) )
+#define LNEW(type)            ((type*) lit_mem_alloc(sizeof(type)))
+#define LFREE(ptr,type)       lit_mem_free(ptr, sizeof(type))
 
-#define MNEW(type,num)        ((type*) mem_alloc ( sizeof(type) * (num) ))
-#define MFREE(ptr,type,num)   mem_free (ptr, sizeof(type) * (num) )
-#define MREALLOC(ptr,type,num1,num2) mem_realloc (ptr, sizeof(type) * (num1), \
-                                                       sizeof(type) * (num2) )
+#define MNEW(type,num)        ((type*) mem_alloc(sizeof(type) * (num)))
+#define MFREE(ptr,type,num)   mem_free(ptr, sizeof(type) * (num))
+#define MREALLOC(ptr,type,num1,num2) mem_realloc(ptr, sizeof(type) * (num1), \
+                                                      sizeof(type) * (num2))
 
-#define DNEW(type)            ((type*) dump_alloc ( sizeof(type) ))
-#define DMNEW(type,num)       ((type*) dump_alloc ( sizeof(type) * (num) ))
-#define DMREALLOC(ptr,type,num1,num2)  dump_realloc (ptr, sizeof(type)*(num1),\
-                                                       sizeof(type) * (num2) )
+#define DNEW(type)            ((type*) dump_alloc(sizeof(type)))
+#define DMNEW(type,num)       ((type*) dump_alloc(sizeof(type) * (num)))
+#define DMREALLOC(ptr,type,num1,num2)  dump_realloc(ptr, sizeof(type) * (num1),\
+                                                         sizeof(type) * (num2))
 
-#define MCOPY(dest,src,type,num)  memcpy (dest,src, sizeof(type)* (num) )
+#define MCOPY(dest,src,type,num)  memcpy(dest,src, sizeof(type)* (num))
 
 #ifdef USE_CODEMMAP
-#define CNEW(type,num)        ((type*) mem_mmap ( sizeof(type) * (num) ))
+#define CNEW(type,num)        ((type*) mem_mmap( sizeof(type) * (num)))
 #define CFREE(ptr,num)
 #else
-#define CNEW(type,num)        ((type*) mem_alloc ( sizeof(type) * (num) ))
-#define CFREE(ptr,num)        mem_free (ptr, num)
+#define CNEW(type,num)        ((type*) mem_alloc(sizeof(type) * (num)))
+#define CFREE(ptr,num)        mem_free(ptr, num)
 #endif
 
+
 void *mem_alloc(int length);
 void *mem_mmap(int length);
 void *lit_mem_alloc(int length);
@@ -116,3 +139,19 @@ Some more macros:
        
 
 */
+
+#endif /* _MEMORY_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index bedd4b8f88a3f19577dcbc72a97a01c23351c32d..d504479b89f425c304ec0b481ab62735cb66e068 100644 (file)
@@ -1,9 +1,38 @@
-/********************************** jni.c *****************************************
+/* jni.c - implementation of JNI functions
 
-       implementation of the Java Native Interface functions                             
-       which are used in the JNI function table                                         
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-***********************************************************************************/
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: ?
+
+   $Id: jni.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include "types.h"
+#include "toolbox/memory.h"
 
 
 #define JNI_VERSION       0x00010002
@@ -1940,8 +1969,7 @@ jboolean ExceptionCheck (JNIEnv* env)
        
 /********************************* JNI function table ******************************/
 
-JNIEnv env =     
-   {   
+JNIEnv env = {   
     NULL,
     NULL,
     NULL,
@@ -2171,7 +2199,8 @@ JNIEnv env =
     &NewWeakGlobalRef,
     &DeleteWeakGlobalRef,
     &ExceptionCheck
-    };
+};
+
 
 /*
  * These are local overrides for various environment variables in Emacs.
index 183fcda5c0751e0f795795b1805be3b7d64fc905..140c1737c90034bbe5d81b1fc63b146a0fa5235b 100644 (file)
@@ -1,9 +1,38 @@
-/******************************** jni.h ***************************************
+/* jni.h - JNI types and data structures
 
-       contains Java Native Interface types and data structures 
-       includes layout of the JNI function table
-       
-*******************************************************************************/
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: ?
+
+   $Id: jni.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _JNI_H
+#define _JNI_H
 
 #include <stdarg.h>
 
@@ -421,5 +450,18 @@ struct JNI_Table {
 
 extern JNIEnv env;
 
-
-
+#endif /* _JNI_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 52ccfb2d7d7c2413e0975a270d5c212e7ea18e43..a2627033f74e7fa3fe366273752f1759d763de29 100644 (file)
@@ -1,5 +1,42 @@
-#include  <stdio.h>
-#include  <string.h>
+/* natcalls.h -
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: natcalls.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _NATCALLS_H
+#define _NATCALLS_H
+
+#include "global.h"
+
 
 /*---------- Define Constants ---------------------------*/
 #define MAX 256
@@ -18,60 +55,76 @@ typedef struct nativeCompMethod nativeCompMethod;
 int classCnt;
 
 struct classMeth {
-  int i_class;
-  int j_method;
-  int methCnt;
+       int i_class;
+       int j_method;
+       int methCnt;
 };
 
 struct  methodCall{
-        char *classname;
-        char *methodname;
-        char *descriptor;
-} ;
+       char *classname;
+       char *methodname;
+       char *descriptor;
+};
 
 struct  nativeMethod  {
-        char *methodname;
-        char *descriptor;
-        struct methodCall methodCalls[MAXCALLS];
-} ;
+       char *methodname;
+       char *descriptor;
+       struct methodCall methodCalls[MAXCALLS];
+};
 
 
 static struct nativeCall {
-        char *classname;
-        struct nativeMethod methods[MAXCALLS];
-        int methCnt;
-        int callCnt[MAXCALLS];
+       char *classname;
+       struct nativeMethod methods[MAXCALLS];
+       int methCnt;
+       int callCnt[MAXCALLS];
 } nativeCalls[] =
- {
-
+{
 #include "nativecalls.h"
-}
-;
+};
 
 #define NATIVECALLSSIZE  (sizeof(nativeCalls)/sizeof(struct nativeCall))
 
 
-struct  methodCompCall{
-        utf *classname;
-        utf *methodname;
-        utf *descriptor;
-} ;
+struct methodCompCall {
+       utf *classname;
+       utf *methodname;
+       utf *descriptor;
+};
+
 
-struct  nativeCompMethod  {
-        utf *methodname;
-        utf *descriptor;
-        struct methodCompCall methodCalls[MAXCALLS];
-} ;
+struct nativeCompMethod {
+       utf *methodname;
+       utf *descriptor;
+       struct methodCompCall methodCalls[MAXCALLS];
+};
 
 
 struct nativeCompCall {
-        utf *classname;
-        struct nativeCompMethod methods[MAXCALLS];
-        int methCnt;
-        int callCnt[MAXCALLS];
+       utf *classname;
+       struct nativeCompMethod methods[MAXCALLS];
+       int methCnt;
+       int callCnt[MAXCALLS];
 } nativeCompCalls[NATIVECALLSSIZE];
 
 
 bool natcall2utf(bool);
 void printNativeCall(nativeCall);
 void markNativeMethodsRT(utf *, utf* , utf* ); 
+
+#endif /* _NATCALLS_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+
index 5378f1d7e10c4ecde1f3fa6a25c91251860db75c..3c2418119169ac92e98f30396c4a3b4001fd02ca 100644 (file)
@@ -1,30 +1,43 @@
-/****************************** native.c ***************************************
+/* native.c - table of native functions
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-    Contains the tables for native methods.
-       The .hh files created with the header file generator are all included here
-       as are the C functions implementing these methods.
-       
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at 
-                Roman Obermaisser   EMAIL: cacao@complang.tuwien.ac.at 
-                Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at 
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Last Change: 2003/02/26
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Roman Obermaisser
+            Andreas Krall
+
+   The .hh files created with the header file generator are all
+   included here as are the C functions implementing these methods.
+
+   $Id: native.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include <unistd.h>
 #include <time.h>
-#include "global.h"
-#include "native.h"
-#include "nativetypes.hh"
-#include "builtin.h"
-#include "asmpart.h"
-#include "tables.h"
-#include "loader.h"
 #include <math.h>
 #include <string.h>
 #include <assert.h>
 #include <utime.h>
 #include <sys/utsname.h>
 
-#include "threads/thread.h"                       /* schani */
+#include "global.h"
+#include "native.h"
+#include "nativetypes.hh"
+#include "builtin.h"
+#include "asmpart.h"
+#include "tables.h"
+#include "loader.h"
+#include "toolbox/loging.h"
+#include "threads/thread.h"
+#include "threads/threadio.h"
 #include "threads/locks.h"
 
 /* Include files for IO functions */
@@ -45,7 +67,6 @@
 #endif
 #include <sys/stat.h>
 
-#include "../threads/threadio.h"                    
 
 /* searchpath for classfiles */
 static char *classpath;
@@ -1070,3 +1091,17 @@ for (i=0;i<NATIVECALLSSIZE; i++) {
 return true;
 }
 /*--------------------------------------------------------*/
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 102a7a6fef6454cd4437dee4c080b023ee1c3a24..f60b6972191e6c3a1031cfa5f9c9be0be53c9b0c 100644 (file)
@@ -85,3 +85,17 @@ void systemclassloader_addlibname(java_objectheader *o);
 void systemclassloader_addlibrary(java_objectheader *o);
 
 void copy_vftbl(vftbl **dest, vftbl *src);
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index a4e9db7ca8f7a36afc0ad10453e531cae02c5861..b046f0c0ca234bdc6c7944595d883f79621523ca 100644 (file)
 },
 1,  {2 }
 },
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 2d820ff56804182647cf44143f2f81d488501daf..fb3970d0868e4bf70cd5d14aa75f5f3fb58f29ae 100644 (file)
@@ -1,8 +1,26 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+
 noinst_LIBRARIES = @LIBTHREAD@
 EXTRA_LIBRARIES = libthreads.a
 
-libthreads_a_SOURCES = locks.c locks.h \
-                      thread.c thread.h \
-                      threadio.c threadio.h
+libthreads_a_SOURCES = \
+       locks.c \
+       locks.h \
+       thread.c \
+       thread.h \
+       threadio.c \
+       threadio.h
+
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@
+
 
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
index 93ce98b6914d74f63fc068433c518a77db779744..cc7b20b66feea92387372ac44c85b29145a5d379 100644 (file)
@@ -10,8 +10,8 @@
  * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
  */
 
-#include "config.h"
 
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <assert.h>
 #include <unistd.h>
 
+#include "config.h"
 #include "thread.h"
 
+
 #define        TH_READ         0
 #define        TH_WRITE        1
 #define        TH_ACCEPT       TH_READ
@@ -134,8 +136,8 @@ void clear_thread_flags(void)
 #endif
 #endif
 
-    fflush (stdout);
-    fflush (stderr);
+    fflush(stdout);
+    fflush(stderr);
 }
 
 
index 0d1eac2372b76907a5f35de1a398ab0187c2b03d..a0d4c2547e129cbbafdb0537fb813e878d9150cb 100644 (file)
  * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
  */
 
-#include "config.h"
-
 #include <assert.h>
-
 #include <sys/types.h>
 #include <sys/mman.h>                   /* for mprotect */
 #include <unistd.h>
 #include <signal.h>
 #include <sys/time.h>
 
+#include "config.h"
 #include "thread.h"
 #include "locks.h"
 #include "threads.h"
-
 #include "tables.h"
 #include "native.h"
 #include "loader.h"
 #include "builtin.h"
 #include "asmpart.h"
-
+#include "toolbox/loging.h"
 #include "toolbox/memory.h"
 
+
 static classinfo *class_java_lang_ThreadDeath;
 
 thread* currentThread = NULL;
index c50a3e67fcbaf0e1f37bbf9a95af98dc922dc7a7..04061b02f2dab699d672c2b981ed14f1280aed44 100644 (file)
@@ -1,9 +1,28 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
 noinst_LIBRARIES = libtoolbox.a
 
-libtoolbox_a_SOURCES = memory.c memory.h \
-                      loging.c loging.h \
-                      chain.c chain.h \
-                      tree.c tree.h \
-                      list.c list.h
+libtoolbox_a_SOURCES = \
+       memory.c \
+       memory.h \
+       loging.c \
+       loging.h \
+       chain.c \
+       chain.h \
+       tree.c \
+       tree.h \
+       list.c \
+       list.h
+
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@
+
 
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
index c550f5adf7cf09e36f0964e164de1b9dcd4f4747..5e551b2a9087e7e3918df098082c15ba8bab1894 100644 (file)
@@ -1,41 +1,63 @@
-/************************* toolbox/chain.h *************************************
+/* toolbox/chain.h - management of doubly linked lists with external linking
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Management of doubly linked lists with external linking
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1996/10/03
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-#ifndef CHAIN_H
-#define CHAIN_H
+   Authors: Reinhard Grafl
+
+   $Id: chain.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _CHAIN_H
+#define _CHAIN_H
 
 typedef struct chainlink {          /* structure for list element */
-       struct chainlink *next,*prev;
+       struct chainlink *next;
+       struct chainlink *prev;
        void *element;
-       } chainlink;
+} chainlink;
 
 typedef struct chain {             /* structure for list */
        int  usedump;   
 
-       chainlink *first,*last;
+       chainlink *first;
+       chainlink *last;
        chainlink *active;
-       } chain;
+} chain;
 
 
-chain *chain_new ();
-chain *chain_dnew ();
+/* function prototypes */
+chain *chain_new();
+chain *chain_dnew();
 void chain_free(chain *c);
 
 void chain_addafter(chain *c, void *element);
 void chain_addbefore(chain *c, void *element);
-void chain_addlast (chain *c, void *element);
-void chain_addfirst (chain *c, void *element);
+void chain_addlast(chain *c, void *element);
+void chain_addfirst(chain *c, void *element);
 
 void chain_remove(chain *c);
 void *chain_remove_go_prev(chain *c);
@@ -87,4 +109,18 @@ insertion/deletion occurs at a position relative to this cursor.
 
 */
 
-#endif
+#endif /* _CHAIN_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index e1d804ae2a46f0b7d59ea936a37c57e0b4e143ef..ec7e82ab4444fd9077e2163d281b5f2506a6cca5 100644 (file)
@@ -1,35 +1,56 @@
-/****************************** builtin.c **************************************
+/* builtin.c - functions for unsupported operations
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains C functions for JavaVM Instructions that cannot be translated
-       to machine language directly. Consequently, the generated machine code
-       for these instructions contains function calls instead of machine
-       instructions, using the C calling convention.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl          EMAIL: cacao@complang.tuwien.ac.at
-                        Andreas  Krall          EMAIL: cacao@complang.tuwien.ac.at
-                        Mark Probst             EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 2003/02/12
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-#include <assert.h>
+   Authors: Reinhard Grafl
+            Andreas Krall
+            Mark Probst
+
+   Contains C functions for JavaVM Instructions that cannot be
+   translated to machine language directly. Consequently, the
+   generated machine code for these instructions contains function
+   calls instead of machine instructions, using the C calling
+   convention.
+
+   $Id: builtin.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
+
+#include <assert.h>
 #include "global.h"
 #include "builtin.h"
-
 #include "loader.h"
 #include "tables.h"
-
 #include "threads/thread.h"
-#include "threads/locks.h"                             /* schani */
+#include "threads/locks.h"
+#include "toolbox/loging.h"
 
 #include "native-math.h"
 
+
 builtin_descriptor builtin_desc[] = {
        {(functionptr) builtin_instanceof,                 "instanceof"},
        {(functionptr) builtin_checkcast,                  "checkcast"},
@@ -45,9 +66,7 @@ builtin_descriptor builtin_desc[] = {
        {(functionptr) builtin_anewarray,          "anewarray"},
        {(functionptr) builtin_newarray_array,     "newarray_array"},
 #if defined(__I386__)
-       /*
-        * have 2 parameters (needs stack manipulation)
-        */
+       /* have 2 parameters (needs stack manipulation) */
        {(functionptr) asm_builtin_anewarray,      "anewarray"},
        {(functionptr) asm_builtin_newarray_array, "newarray_array"},
 #endif
@@ -123,7 +142,7 @@ builtin_descriptor builtin_desc[] = {
 #endif
        {(functionptr) builtin_d2f,                                "d2f"},
        {(functionptr) NULL,                                       "unknown"}
-       };
+};
 
 
 /*****************************************************************************
@@ -145,20 +164,20 @@ s4 builtin_isanysubclass (classinfo *sub, classinfo *super)
 { 
        if (super->flags & ACC_INTERFACE)
                return (sub->vftbl->interfacetablelength > super->index) &&
-                          (sub->vftbl->interfacetable[-super->index] != NULL);
+                       (sub->vftbl->interfacetable[-super->index] != NULL);
 
        /*
-       while (sub != 0)
-               if (sub == super)
-                       return 1;
-               else
-                       sub = sub->super;
+         while (sub != 0)
+         if (sub == super)
+         return 1;
+         else
+         sub = sub->super;
 
-       return 0;
+         return 0;
        */
 
        return (unsigned) (sub->vftbl->baseval - super->vftbl->baseval) <=
-                  (unsigned) (super->vftbl->diffval);
+               (unsigned) (super->vftbl->diffval);
 }
 
 
@@ -174,9 +193,9 @@ s4 builtin_isanysubclass (classinfo *sub, classinfo *super)
 
 s4 builtin_instanceof(java_objectheader *obj, classinfo *class)
 {
-       #ifdef DEBUG
+#ifdef DEBUG
        log_text ("builtin_instanceof called");
-       #endif
+#endif
        
        if (!obj) return 0;
        return builtin_isanysubclass (obj->vftbl->class, class);
@@ -227,13 +246,13 @@ static s4 builtin_descriptorscompatible(constant_arraydescriptor *desc, constant
        if (desc==target) return 1;
        if (desc->arraytype != target->arraytype) return 0;
        switch (target->arraytype) {
-               case ARRAYTYPE_OBJECT: 
-                       return builtin_isanysubclass (desc->objectclass, target->objectclass);
-               case ARRAYTYPE_ARRAY:
-                       return builtin_descriptorscompatible 
-                         (desc->elementdescriptor, target->elementdescriptor);
-               default: return 1;
-               }
+       case ARRAYTYPE_OBJECT: 
+               return builtin_isanysubclass (desc->objectclass, target->objectclass);
+       case ARRAYTYPE_ARRAY:
+               return builtin_descriptorscompatible 
+                       (desc->elementdescriptor, target->elementdescriptor);
+       default: return 1;
+       }
 }
 
 
@@ -265,40 +284,40 @@ s4 builtin_checkarraycast(java_objectheader *o, constant_arraydescriptor *desc)
                printf ("#### checkarraycast failed 1\n");
 #endif
                return 0;
-               }
+       }
                
        if (a->arraytype != desc->arraytype) {
 #ifdef DEBUG
                printf ("#### checkarraycast failed 2\n");
 #endif
                return 0;
-               }
+       }
        
        switch (a->arraytype) {
-               case ARRAYTYPE_OBJECT: {
-                       java_objectarray *oa = (java_objectarray*) o;
-                       int result = builtin_isanysubclass (oa->elementtype, desc->objectclass);
+       case ARRAYTYPE_OBJECT: {
+               java_objectarray *oa = (java_objectarray*) o;
+               int result = builtin_isanysubclass (oa->elementtype, desc->objectclass);
 
 #ifdef DEBUG
-                       if (!result)
-                               printf ("#### checkarraycast failed 3\n");
+               if (!result)
+                       printf ("#### checkarraycast failed 3\n");
 #endif
-                       return result;
-                       }
-               case ARRAYTYPE_ARRAY: {
-                       java_arrayarray *aa = (java_arrayarray*) o;
-                       int result = builtin_descriptorscompatible
-                               (aa->elementdescriptor, desc->elementdescriptor);
+               return result;
+       }
+       case ARRAYTYPE_ARRAY: {
+               java_arrayarray *aa = (java_arrayarray*) o;
+               int result = builtin_descriptorscompatible
+                       (aa->elementdescriptor, desc->elementdescriptor);
 
 #ifdef DEBUG
-                       if (!result)
-                               printf ("#### checkarraycast failed 4\n");
+               if (!result)
+                       printf ("#### checkarraycast failed 4\n");
 #endif
-                       return result;
-                       }
-               default:   
-                       return 1;
-               }
+               return result;
+       }
+       default:   
+               return 1;
+       }
 }
 
 
@@ -318,7 +337,7 @@ java_objectheader *builtin_throw_exception (java_objectheader *local_exceptionpt
                sprintf(logtext, "Builtin exception thrown: ");
                utf_sprint(logtext + strlen(logtext), local_exceptionptr->vftbl->class->name);
                dolog();
-               }
+       }
        exceptionptr = local_exceptionptr;
        return local_exceptionptr;
 }
@@ -341,15 +360,15 @@ s4 builtin_canstore (java_objectarray *a, java_objectheader *o)
        case ARRAYTYPE_OBJECT:
                if ( ! builtin_checkcast (o, a->elementtype) ) {
                        return 0;
-                       }
+               }
                return 1;
                break;
 
        case ARRAYTYPE_ARRAY:
                if ( ! builtin_checkarraycast 
-                                (o, ((java_arrayarray*)a)->elementdescriptor) ) {
+                        (o, ((java_arrayarray*)a)->elementdescriptor) ) {
                        return 0;
-                       }
+               }
                return 1;
                break;
 
@@ -461,74 +480,74 @@ void* __builtin_newarray(s4 base_size,
 
 #if 0
        {
-       classinfo *c;
+               classinfo *c;
 
-       switch (arraytype) {
-       case ARRAYTYPE_INT:
-               c = create_array_class(utf_new_char("[I"));
-               XXX_use_class_as_object(c, "int");
-               break;
+               switch (arraytype) {
+               case ARRAYTYPE_INT:
+                       c = create_array_class(utf_new_char("[I"));
+                       XXX_use_class_as_object(c, "int");
+                       break;
 
-       case ARRAYTYPE_LONG:
-               c = create_array_class(utf_new_char("[J"));
-               XXX_use_class_as_object(c, "long");
-               break;
+               case ARRAYTYPE_LONG:
+                       c = create_array_class(utf_new_char("[J"));
+                       XXX_use_class_as_object(c, "long");
+                       break;
 
-       case ARRAYTYPE_FLOAT:
-               c = create_array_class(utf_new_char("[F"));
-               XXX_use_class_as_object(c, "float");
-               break;
+               case ARRAYTYPE_FLOAT:
+                       c = create_array_class(utf_new_char("[F"));
+                       XXX_use_class_as_object(c, "float");
+                       break;
 
-       case ARRAYTYPE_DOUBLE:
-               c = create_array_class(utf_new_char("[D"));
-               XXX_use_class_as_object(c, "double");
-               break;
+               case ARRAYTYPE_DOUBLE:
+                       c = create_array_class(utf_new_char("[D"));
+                       XXX_use_class_as_object(c, "double");
+                       break;
 
-       case ARRAYTYPE_BYTE:
-               c = create_array_class(utf_new_char("[B"));
-               XXX_use_class_as_object(c, "byte");
-               break;
+               case ARRAYTYPE_BYTE:
+                       c = create_array_class(utf_new_char("[B"));
+                       XXX_use_class_as_object(c, "byte");
+                       break;
 
-       case ARRAYTYPE_CHAR:
-               c = create_array_class(utf_new_char("[C"));
-               XXX_use_class_as_object(c, "char");
-               break;
+               case ARRAYTYPE_CHAR:
+                       c = create_array_class(utf_new_char("[C"));
+                       XXX_use_class_as_object(c, "char");
+                       break;
 
-       case ARRAYTYPE_SHORT:
-               c = create_array_class(utf_new_char("[S"));
-               XXX_use_class_as_object(c, "short");
-               break;
+               case ARRAYTYPE_SHORT:
+                       c = create_array_class(utf_new_char("[S"));
+                       XXX_use_class_as_object(c, "short");
+                       break;
 
-       case ARRAYTYPE_BOOLEAN:
-               c = create_array_class(utf_new_char("[Z"));
-               XXX_use_class_as_object(c, "boolean");
-               break;
+               case ARRAYTYPE_BOOLEAN:
+                       c = create_array_class(utf_new_char("[Z"));
+                       XXX_use_class_as_object(c, "boolean");
+                       break;
 
-       case ARRAYTYPE_OBJECT:
-               {
-               char *cname, *buf;
-               cname = heap_allocate(utf_strlen(el->name), false, NULL);
-               utf_sprint(cname, el->name);
-               buf = heap_allocate(strlen(cname) + 3, false, NULL);
-/*  printf("\n\n[L%s;\n\n", cname); */
-               sprintf(buf, "[L%s;", cname);
-               c = create_array_class(utf_new_char(buf));
-/*             MFREE(buf, char, strlen(cname) + 3); */
-/*             MFREE(cname, char, utf_strlen(el->name)); */
-               XXX_use_class_as_object(c, cname);
-               }
-               break;
+               case ARRAYTYPE_OBJECT:
+                       {
+                               char *cname, *buf;
+                               cname = heap_allocate(utf_strlen(el->name), false, NULL);
+                               utf_sprint(cname, el->name);
+                               buf = heap_allocate(strlen(cname) + 3, false, NULL);
+                               /*  printf("\n\n[L%s;\n\n", cname); */
+                               sprintf(buf, "[L%s;", cname);
+                               c = create_array_class(utf_new_char(buf));
+                               /*              MFREE(buf, char, strlen(cname) + 3); */
+                               /*              MFREE(cname, char, utf_strlen(el->name)); */
+                               XXX_use_class_as_object(c, cname);
+                       }
+                       break;
 
-       case ARRAYTYPE_ARRAY:
-               c = create_array_class(utf_new_char("[["));
-               XXX_use_class_as_object(c, "java/lang/Boolean");
-               break;
+               case ARRAYTYPE_ARRAY:
+                       c = create_array_class(utf_new_char("[["));
+                       XXX_use_class_as_object(c, "java/lang/Boolean");
+                       break;
 
-       default:
-               panic("unknown array type");
-       }
+               default:
+                       panic("unknown array type");
+               }
 
-       a->objheader.vftbl = c->vftbl;
+               a->objheader.vftbl = c->vftbl;
        }
 #else
        a->objheader.vftbl = class_array->vftbl;
@@ -573,7 +592,7 @@ java_objectarray *builtin_anewarray (s4 size, classinfo *elementtype)
 *****************************************************************************/
 
 java_arrayarray *builtin_newarray_array 
-               (s4 size, constant_arraydescriptor *elementdesc)
+(s4 size, constant_arraydescriptor *elementdesc)
 {
        java_arrayarray *a; 
        a = (java_arrayarray*)__builtin_newarray(sizeof(java_arrayarray),
@@ -773,7 +792,7 @@ java_longarray *builtin_newarray_long (s4 size)
        /* Helper functions */
 
 static java_arrayheader *multianewarray_part (java_intarray *dims, int thisdim,
-                                          constant_arraydescriptor *desc)
+                                                                                         constant_arraydescriptor *desc)
 {
        u4 size,i;
        java_arrayarray *a;
@@ -808,7 +827,7 @@ static java_arrayheader *multianewarray_part (java_intarray *dims, int thisdim,
                
                default: panic ("Invalid arraytype in multianewarray");
                }
-               }
+       }
 
        /* if the last dimension has not been reached yet */
 
@@ -820,25 +839,25 @@ static java_arrayheader *multianewarray_part (java_intarray *dims, int thisdim,
        
        for (i=0; i<size; i++) {
                java_arrayheader *ea = 
-                 multianewarray_part (dims, thisdim+1, desc->elementdescriptor);
+                       multianewarray_part (dims, thisdim+1, desc->elementdescriptor);
                if (!ea) return NULL;
 
                a -> data[i] = ea;
-               }
+       }
                
        return (java_arrayheader*) a;
 }
 
 
 java_arrayheader *builtin_multianewarray (java_intarray *dims,
-                                         constant_arraydescriptor *desc)
+                                                                                 constant_arraydescriptor *desc)
 {
        return multianewarray_part (dims, 0, desc);
 }
 
 
 static java_arrayheader *nmultianewarray_part (int n, long *dims, int thisdim,
-                                          constant_arraydescriptor *desc)
+                                                                                          constant_arraydescriptor *desc)
 {
        int size, i;
        java_arrayarray *a;
@@ -867,14 +886,14 @@ static java_arrayheader *nmultianewarray_part (int n, long *dims, int thisdim,
                        return (java_arrayheader*) builtin_newarray_long(size); 
                case ARRAYTYPE_OBJECT:
                        return (java_arrayheader*) builtin_anewarray(size,
-                                                                          desc->objectclass);
+                                                                                                                desc->objectclass);
                case ARRAYTYPE_ARRAY:
                        return (java_arrayheader*) builtin_newarray_array(size,
-                                                                          desc->elementdescriptor);
+                                                                                                                         desc->elementdescriptor);
                
                default: panic ("Invalid arraytype in multianewarray");
                }
-               }
+       }
 
        /* if the last dimension has not been reached yet */
 
@@ -890,14 +909,14 @@ static java_arrayheader *nmultianewarray_part (int n, long *dims, int thisdim,
                if (!ea) return NULL;
 
                a -> data[i] = ea;
-               }
+       }
                
        return (java_arrayheader*) a;
 }
 
 
 java_arrayheader *builtin_nmultianewarray (int size,
-                                         constant_arraydescriptor *desc, long *dims)
+                                                                                  constant_arraydescriptor *desc, long *dims)
 {
        (void) builtin_newarray_int(size); /* for compatibility with -old */
        return nmultianewarray_part (size, dims, 0, desc);
@@ -922,7 +941,7 @@ s4 builtin_aastore (java_objectarray *a, s4 index, java_objectheader *o)
        if (builtin_canstore(a,o)) {
                a->data[index] = o;
                return 1;
-               }
+       }
        return 0;
 }
 
@@ -943,7 +962,7 @@ s4 builtin_aastore (java_objectarray *a, s4 index, java_objectheader *o)
 u4 methodindent=0;
 
 java_objectheader *builtin_trace_exception (java_objectheader *exceptionptr,
-                                  methodinfo *method, int *pos, int noindent) {
+                                                                                       methodinfo *method, int *pos, int noindent) {
 
        if (!noindent)
                methodindent--;
@@ -960,11 +979,11 @@ java_objectheader *builtin_trace_exception (java_objectheader *exceptionptr,
                        else
                                printf("(NOSYNC)");
                        printf("(%p) at position %p\n", method->entrypoint, pos);
-                       }
+               }
                else
                        printf("call_java_method\n");
                fflush (stdout);
-               }
+       }
        return exceptionptr;
 }
 
@@ -986,109 +1005,109 @@ void builtin_trace_args(s8 a0, s8 a1, s8 a2, s8 a3, s8 a4, s8 a5,
        utf_sprint (logtext+strlen(logtext), method->descriptor);
        sprintf (logtext+strlen(logtext), "(");
        switch (method->paramcount) {
-        case 0:
-            break;
+       case 0:
+               break;
 
 #if defined(__I386__)
-               case 1:
-                       sprintf(logtext+strlen(logtext), "%llx", a0);
-                       break;
+       case 1:
+               sprintf(logtext+strlen(logtext), "%llx", a0);
+               break;
 
-               case 2:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx", a0, a1);
-                       break;
+       case 2:
+               sprintf(logtext+strlen(logtext), "%llx, %llx", a0, a1);
+               break;
 
-               case 3:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx", a0, a1, a2);
-                       break;
+       case 3:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx", a0, a1, a2);
+               break;
 
-               case 4:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3);
-                       break;
+       case 4:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3);
+               break;
 
-               case 5:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3,   a4);
-                       break;
+       case 5:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3,   a4);
+               break;
 
-               case 6:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5);
-                       break;
+       case 6:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3,   a4,   a5);
+               break;
 
 #if TRACE_ARGS_NUM > 6
-               case 7:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5,   a6);
-                       break;
+       case 7:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3,   a4,   a5,   a6);
+               break;
 
-               case 8:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx, %llx",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5,   a6,   a7);
-                       break;
+       case 8:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx, %llx",
+                               a0,   a1,   a2,   a3,   a4,   a5,   a6,   a7);
+               break;
 
-               default:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx, %llx, ...(%d)",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5,   a6,   a7,   method->paramcount - 8);
-                       break;
+       default:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, %llx, %llx, ...(%d)",
+                               a0,   a1,   a2,   a3,   a4,   a5,   a6,   a7,   method->paramcount - 8);
+               break;
 #else
-               default:
-                       sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, ...(%d)",
-                                                                                         a0,   a1,   a2,   a3,   a4,   a5,   method->paramcount - 6);
-                       break;
+       default:
+               sprintf(logtext+strlen(logtext), "%llx, %llx, %llx, %llx, %llx, %llx, ...(%d)",
+                               a0,   a1,   a2,   a3,   a4,   a5,   method->paramcount - 6);
+               break;
 #endif
 #else
-               case 1:
-                       sprintf(logtext+strlen(logtext), "%lx", a0);
-                       break;
+       case 1:
+               sprintf(logtext+strlen(logtext), "%lx", a0);
+               break;
 
-               case 2:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx", a0, a1);
-                       break;
+       case 2:
+               sprintf(logtext+strlen(logtext), "%lx, %lx", a0, a1);
+               break;
 
-               case 3:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx", a0, a1, a2);
-                       break;
+       case 3:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx", a0, a1, a2);
+               break;
 
-               case 4:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3);
-                       break;
+       case 4:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3);
+               break;
 
-               case 5:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3,  a4);
-                       break;
+       case 5:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3,  a4);
+               break;
 
-               case 6:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5);
-                       break;
+       case 6:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3,  a4,  a5);
+               break;
 
 #if TRACE_ARGS_NUM > 6
-               case 7:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5,  a6);
-                       break;
+       case 7:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3,  a4,  a5,  a6);
+               break;
 
-               case 8:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5,  a6,  a7);
-                       break;
+       case 8:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx",
+                               a0,  a1,  a2,  a3,  a4,  a5,  a6,  a7);
+               break;
 
-               default:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx, ...(%d)",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5,  a6,  a7,  method->paramcount - 8);
-                       break;
+       default:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx, ...(%d)",
+                               a0,  a1,  a2,  a3,  a4,  a5,  a6,  a7,  method->paramcount - 8);
+               break;
 #else
-               default:
-                       sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, ...(%d)",
-                                                                                         a0,  a1,  a2,  a3,  a4,  a5,   method->paramcount - 6);
-                       break;
+       default:
+               sprintf(logtext+strlen(logtext), "%lx, %lx, %lx, %lx, %lx, %lx, ...(%d)",
+                               a0,  a1,  a2,  a3,  a4,  a5,   method->paramcount - 6);
+               break;
 #endif
 #endif
-               }
+       }
        sprintf (logtext+strlen(logtext), ")");
 
        dolog ();
@@ -1120,30 +1139,30 @@ void builtin_displaymethodstop(methodinfo *method, s8 l, double d, float f)
        utf_sprint (logtext+strlen(logtext), method->name);
        utf_sprint (logtext+strlen(logtext), method->descriptor);
        switch (method->returntype) {
-               case TYPE_INT:
-                       sprintf (logtext+strlen(logtext), "->%d", (s4) l);
-                       break;
-               case TYPE_LONG:
+       case TYPE_INT:
+               sprintf (logtext+strlen(logtext), "->%d", (s4) l);
+               break;
+       case TYPE_LONG:
 #if defined(__I386__)
-                       sprintf(logtext+strlen(logtext), "->%lld", (s8) l);
+               sprintf(logtext+strlen(logtext), "->%lld", (s8) l);
 #else
-                       sprintf(logtext+strlen(logtext), "->%ld", (s8) l);
+               sprintf(logtext+strlen(logtext), "->%ld", (s8) l);
 #endif
-                       break;
-               case TYPE_ADDRESS:
+               break;
+       case TYPE_ADDRESS:
 #if defined(__I386__)
-                       sprintf(logtext+strlen(logtext), "->%p", (u1*) ((s4) l));
+               sprintf(logtext+strlen(logtext), "->%p", (u1*) ((s4) l));
 #else
-                       sprintf(logtext+strlen(logtext), "->%p", (u1*) l);
+               sprintf(logtext+strlen(logtext), "->%p", (u1*) l);
 #endif
-                       break;
-               case TYPE_FLOAT:
-                       sprintf (logtext+strlen(logtext), "->%g", f);
-                       break;
-               case TYPE_DOUBLE:
-                       sprintf (logtext+strlen(logtext), "->%g", d);
-                       break;
-               }
+               break;
+       case TYPE_FLOAT:
+               sprintf (logtext+strlen(logtext), "->%g", f);
+               break;
+       case TYPE_DOUBLE:
+               sprintf (logtext+strlen(logtext), "->%g", d);
+               break;
+       }
        dolog ();
 }
 
@@ -1181,37 +1200,37 @@ internal_lock_mutex_for_object (java_objectheader *object)
        entry = &mutexHashTable[hashValue];
 
        if (entry->object != 0)
-       {
-               if (entry->mutex.count == 0 && entry->conditionCount == 0)
                {
-                       entry->object = 0;
-                       entry->mutex.holder = 0;
-                       entry->mutex.count = 0;
-                       entry->mutex.muxWaiters = 0;
+                       if (entry->mutex.count == 0 && entry->conditionCount == 0)
+                               {
+                                       entry->object = 0;
+                                       entry->mutex.holder = 0;
+                                       entry->mutex.count = 0;
+                                       entry->mutex.muxWaiters = 0;
+                               }
+                       else
+                               {
+                                       while (entry->next != 0 && entry->object != object)
+                                               entry = entry->next;
+
+                                       if (entry->object != object)
+                                               {
+                                                       entry->next = firstFreeOverflowEntry;
+                                                       firstFreeOverflowEntry = firstFreeOverflowEntry->next;
+
+                                                       entry = entry->next;
+                                                       entry->object = 0;
+                                                       entry->next = 0;
+                                                       assert(entry->conditionCount == 0);
+                                               }
+                               }
                }
        else
-       {
-               while (entry->next != 0 && entry->object != object)
-               entry = entry->next;
-
-               if (entry->object != object)
                {
-                       entry->next = firstFreeOverflowEntry;
-                       firstFreeOverflowEntry = firstFreeOverflowEntry->next;
-
-                       entry = entry->next;
-                       entry->object = 0;
-                       entry->next = 0;
-                       assert(entry->conditionCount == 0);
+                       entry->mutex.holder = 0;
+                       entry->mutex.count = 0;
+                       entry->mutex.muxWaiters = 0;
                }
-       }
-       }
-       else
-       {
-               entry->mutex.holder = 0;
-               entry->mutex.count = 0;
-               entry->mutex.muxWaiters = 0;
-       }
 
        if (entry->object == 0)
                entry->object = object;
@@ -1237,23 +1256,23 @@ internal_unlock_mutex_for_object (java_objectheader *object)
        if (entry->object == object)
                internal_unlock_mutex(&entry->mutex);
        else
-       {
-               while (entry->next != 0 && entry->next->object != object)
-                       entry = entry->next;
+               {
+                       while (entry->next != 0 && entry->next->object != object)
+                               entry = entry->next;
 
-               assert(entry->next != 0);
+                       assert(entry->next != 0);
 
-               internal_unlock_mutex(&entry->next->mutex);
+                       internal_unlock_mutex(&entry->next->mutex);
 
-               if (entry->next->mutex.count == 0 && entry->conditionCount == 0)
-               {
-                       mutexHashEntry *unlinked = entry->next;
+                       if (entry->next->mutex.count == 0 && entry->conditionCount == 0)
+                               {
+                                       mutexHashEntry *unlinked = entry->next;
 
-                       entry->next = unlinked->next;
-                       unlinked->next = firstFreeOverflowEntry;
-                       firstFreeOverflowEntry = unlinked;
+                                       entry->next = unlinked->next;
+                                       unlinked->next = firstFreeOverflowEntry;
+                                       firstFreeOverflowEntry = unlinked;
+                               }
                }
-       }
 }
 #endif
 
@@ -1291,13 +1310,13 @@ void builtin_monitorexit (java_objectheader *o)
 
        hashValue = MUTEX_HASH_VALUE(o);
        if (mutexHashTable[hashValue].object == o)
-       {
-               if (mutexHashTable[hashValue].mutex.count == 1
-                       && mutexHashTable[hashValue].mutex.muxWaiters != 0)
-                       internal_unlock_mutex_for_object(o);
-               else
-                       --mutexHashTable[hashValue].mutex.count;
-       }
+               {
+                       if (mutexHashTable[hashValue].mutex.count == 1
+                               && mutexHashTable[hashValue].mutex.muxWaiters != 0)
+                               internal_unlock_mutex_for_object(o);
+                       else
+                               --mutexHashTable[hashValue].mutex.count;
+               }
        else
                internal_unlock_mutex_for_object(o);
 
@@ -1465,14 +1484,14 @@ float builtin_fadd (float a, float b)
        if (finitef(a)) {
                if (finitef(b)) return a+b;
                else return b;
-               }
+       }
        else {
                if (finitef(b)) return a;
                else {
                        if (copysignf(1.0, a)==copysignf(1.0, b)) return a;
                        else  return FLT_NAN;
-                       }
                }
+       }
 }
 
 float builtin_fsub (float a, float b)
@@ -1488,18 +1507,18 @@ float builtin_fmul (float a, float b)
                if (finitef(b)) return a*b;
                else {
                        if (a==0) return FLT_NAN;
-                                else return copysignf(b, copysignf(1.0, b)*a);
-                       }
+                       else return copysignf(b, copysignf(1.0, b)*a);
                }
+       }
        else {
                if (finitef(b)) {
                        if (b==0) return FLT_NAN;
-                                else return copysignf(a, copysignf(1.0, a)*b);
-                       }
+                       else return copysignf(a, copysignf(1.0, a)*b);
+               }
                else {
                        return copysignf(a, copysignf(1.0, a)*copysignf(1.0, b));
-                       }
                }
+       }
 }
 
 float builtin_fdiv (float a, float b)
@@ -1512,8 +1531,8 @@ float builtin_fdiv (float a, float b)
                                return FLT_POSINF;
                        else if (a < 0)
                                return FLT_NEGINF;
-                       }
                }
+       }
        return FLT_NAN;
 }
 
@@ -1528,8 +1547,8 @@ float builtin_fneg (float a)
        if (isnanf(a)) return a;
        else {
                if (finitef(a)) return -a;
-                                  else return copysignf(a,-copysignf(1.0, a));
-               }
+               else return copysignf(a,-copysignf(1.0, a));
+       }
 }
 
 s4 builtin_fcmpl (float a, float b)
@@ -1539,7 +1558,7 @@ s4 builtin_fcmpl (float a, float b)
        if (!finitef(a) || !finitef(b)) {
                a = finitef(a) ? 0 : copysignf(1.0,      a);
                b = finitef(b) ? 0 : copysignf(1.0, b);
-               }
+       }
        if (a>b) return 1;
        if (a==b) return 0;
        return -1;
@@ -1552,7 +1571,7 @@ s4 builtin_fcmpg (float a, float b)
        if (!finitef(a) || !finitef(b)) {
                a = finitef(a) ? 0 : copysignf(1.0, a);
                b = finitef(b) ? 0 : copysignf(1.0, b);
-               }
+       }
        if (a>b) return 1;
        if (a==b) return 0;
        return -1;
@@ -1569,14 +1588,14 @@ double builtin_dadd (double a, double b)
        if (finite(a)) {
                if (finite(b)) return a+b;
                else return b;
-               }
+       }
        else {
                if (finite(b)) return a;
                else {
                        if (copysign(1.0, a)==copysign(1.0, b)) return a;
                        else  return DBL_NAN;
-                       }
                }
+       }
 }
 
 double builtin_dsub (double a, double b)
@@ -1592,18 +1611,18 @@ double builtin_dmul (double a, double b)
                if (finite(b)) return a*b;
                else {
                        if (a==0) return DBL_NAN;
-                                else return copysign(b, copysign(1.0, b)*a);
-                       }
+                       else return copysign(b, copysign(1.0, b)*a);
                }
+       }
        else {
                if (finite(b)) {
                        if (b==0) return DBL_NAN;
-                                else return copysign(a, copysign(1.0, a)*b);
-                       }
+                       else return copysign(a, copysign(1.0, a)*b);
+               }
                else {
                        return copysign(a, copysign(1.0, a)*copysign(1.0, b));
-                       }
                }
+       }
 }
 
 double builtin_ddiv (double a, double b)
@@ -1616,8 +1635,8 @@ double builtin_ddiv (double a, double b)
                                return DBL_POSINF;
                        else if (a < 0)
                                return DBL_NEGINF;
-                       }
                }
+       }
        return DBL_NAN;
 }
 
@@ -1631,8 +1650,8 @@ double builtin_dneg (double a)
        if (isnan(a)) return a;
        else {
                if (finite(a)) return -a;
-                                 else return copysign(a,-copysign(1.0, a));
-               }
+               else return copysign(a,-copysign(1.0, a));
+       }
 }
 
 s4 builtin_dcmpl (double a, double b)
@@ -1642,7 +1661,7 @@ s4 builtin_dcmpl (double a, double b)
        if (!finite(a) || !finite(b)) {
                a = finite(a) ? 0 : copysign(1.0, a);
                b = finite(b) ? 0 : copysign(1.0, b);
-               }
+       }
        if (a>b) return 1;
        if (a==b) return 0;
        return -1;
@@ -1655,7 +1674,7 @@ s4 builtin_dcmpg (double a, double b)
        if (!finite(a) || !finite(b)) {
                a = finite(a) ? 0 : copysign(1.0, a);
                b = finite(b) ? 0 : copysign(1.0, b);
-               }
+       }
        if (a>b) return 1;
        if (a==b) return 0;
        return -1;
@@ -1675,14 +1694,14 @@ s8 builtin_i2l (s4 i)
 
 float builtin_i2f (s4 a)
 {
-float f = (float) a;
-return f;
+       float f = (float) a;
+       return f;
 }
 
 double builtin_i2d (s4 a)
 {
-double d = (double) a;
-return d;
+       double d = (double) a;
+       return d;
 }
 
 
@@ -1719,46 +1738,46 @@ double builtin_l2d (s8 a)
 s4 builtin_f2i(float a) 
 {
 
-return builtin_d2i((double) a);
+       return builtin_d2i((double) a);
 
-/*     float f;
+       /*      float f;
        
-       if (isnanf(a))
+               if (isnanf(a))
                return 0;
-       if (finitef(a)) {
+               if (finitef(a)) {
                if (a > 2147483647)
-                       return 2147483647;
+               return 2147483647;
                if (a < (-2147483648))
-                       return (-2147483648);
+               return (-2147483648);
                return (s4) a;
                }
-       f = copysignf((float) 1.0, a);
-       if (f > 0)
+               f = copysignf((float) 1.0, a);
+               if (f > 0)
                return 2147483647;
-       return (-2147483648); */
+               return (-2147483648); */
 }
 
 
 s8 builtin_f2l (float a)
 {
 
-return builtin_d2l((double) a);
+       return builtin_d2l((double) a);
 
-/*     float f;
+       /*      float f;
        
-       if (finitef(a)) {
+               if (finitef(a)) {
                if (a > 9223372036854775807L)
-                       return 9223372036854775807L;
+               return 9223372036854775807L;
                if (a < (-9223372036854775808L))
-                       return (-9223372036854775808L);
+               return (-9223372036854775808L);
                return (s8) a;
                }
-       if (isnanf(a))
+               if (isnanf(a))
                return 0;
-       f = copysignf((float) 1.0, a);
-       if (f > 0)
+               f = copysignf((float) 1.0, a);
+               if (f > 0)
                return 9223372036854775807L;
-       return (-9223372036854775808L); */
+               return (-9223372036854775808L); */
 }
 
 
@@ -1768,7 +1787,7 @@ double builtin_f2d (float a)
        else {
                if (isnanf(a)) return DBL_NAN;
                else               return copysign(DBL_POSINF, (double) copysignf(1.0, a) );
-               }
+       }
 }
 
 
@@ -1782,7 +1801,7 @@ s4 builtin_d2i (double a)
                if (a <= (-2147483647-1))
                        return (-2147483647-1);
                return (s4) a;
-               }
+       }
        if (isnan(a))
                return 0;
        d = copysign(1.0, a);
@@ -1802,7 +1821,7 @@ s8 builtin_d2l (double a)
                if (a <= (-9223372036854775807LL-1))
                        return (-9223372036854775807LL-1);
                return (s8) a;
-               }
+       }
        if (isnan(a))
                return 0;
        d = copysign(1.0, a);
@@ -1818,7 +1837,7 @@ float builtin_d2f (double a)
        else {
                if (isnan(a)) return FLT_NAN;
                else              return copysignf (FLT_POSINF, (float) copysign(1.0, a));
-               }
+       }
 }
 
 
index cfd81f69da791259641658de9b5a29a6d1ad6ca2..0afdbf45137a27d7474916e94de1d0d5838cf21c 100644 (file)
@@ -142,3 +142,16 @@ s8       asm_builtin_d2l (double a);
 
 float    builtin_d2f (double a);
 
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 40db75667a913b2e3773f362e3ac7e086f165151..c72293e512a8f2867325749e1848f2d9429cf0e3 100644 (file)
@@ -1,25 +1,47 @@
-/* global.h ********************************************************************
+/* global.h - global definitions
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains global definitions which are used in the whole program, includes
-       some files and contains global used macros.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl              EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall   (andi)     EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Mark     Probst  (schani)   EMAIL: cacao@complang.tuwien.ac.at
-                        Philipp  Tomsich (phil)     EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: $Id: global.h 548 2003-11-01 19:46:25Z twisti $
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas Krall
+
+   Changes: Mark Probst
+            Philipp Tomsich
 
-#ifndef __global_h_
-#define __global_h_
+   $Id: global.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _GLOBAL_H
+#define _GLOBAL_H
 
 #include "config.h"
+#include "types.h"
+#include "toolbox/list.h"
+
 
 #define _GNU_SOURCE
 
  */
 #define SIZE_FROM_CLASSINFO
 
-/* standard includes **********************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "toolbox/memory.h"
-#include "toolbox/chain.h"
-#include "toolbox/list.h"
-#include "toolbox/loging.h"
-
-/* system dependent types *****************************************************/
-
-#include "types.h"
-
 
 /* additional data types ******************************************************/
 
@@ -209,6 +215,7 @@ struct utf {
        char       *text;           /* pointer to text                            */
 };
 
+
 /* data structure of internal javastrings stored in global hashtable **********/
 
 struct literalstring {
@@ -216,14 +223,16 @@ struct literalstring {
        java_objectheader *string;  
 };
 
+
 /* data structure for accessing hashtables ************************************/
 
 typedef struct {            
-  u4 size;
-  u4 entries;        /* number of entries in the table */
-  void **ptr;        /* pointer to hashtable */
+       u4 size;
+       u4 entries;        /* number of entries in the table */
+       void **ptr;        /* pointer to hashtable */
 } hashtable;
 
+
 /* data structures of remaining constant pool entries *************************/
 
 typedef struct {                /* Fieldref, Methodref and InterfaceMethodref     */
@@ -232,32 +241,39 @@ typedef struct {                /* Fieldref, Methodref and InterfaceMethodref
        utf       *descriptor;  /* field/method/interface type descriptor string  */
 } constant_FMIref;
 
+
 typedef struct {            /* Integer                                        */
        s4 value;
 } constant_integer;
+
        
 typedef struct {            /* Float                                          */
        float value;
 } constant_float;
 
+
 typedef struct {            /* Long                                           */
        s8 value;
 } constant_long;
        
+
 typedef struct {            /* Double                                         */
        double value;
 } constant_double;
 
+
 typedef struct {            /* NameAndType (Field or Method)                  */
        utf *name;              /* field/method name                              */
        utf *descriptor;        /* field/method type descriptor string            */
 } constant_nameandtype;
 
-/*  arraydescriptor describes array types. Basic array types contain their
-       type in the arraytype field, objectclass contains a class pointer for
-       arrays of objects (arraytype == ARRAYTYPE_OBJECT), elementdescriptor
-       contains a pointer to an arraydescriptor which describes the element
-       types in the case of arrays of arrays (arraytype == ARRAYTYPE_ARRAY).
+
+/* 
+   arraydescriptor describes array types. Basic array types contain their
+   type in the arraytype field, objectclass contains a class pointer for
+   arrays of objects (arraytype == ARRAYTYPE_OBJECT), elementdescriptor
+   contains a pointer to an arraydescriptor which describes the element
+   types in the case of arrays of arrays (arraytype == ARRAYTYPE_ARRAY).
 */
 
 typedef struct constant_arraydescriptor {
@@ -266,7 +282,6 @@ typedef struct constant_arraydescriptor {
        struct constant_arraydescriptor *elementdescriptor;
 } constant_arraydescriptor;
 
-#include "jit/sets.h"
 
 /* data structures of the runtime system **************************************/
 
@@ -383,22 +398,26 @@ typedef struct primitivetypeinfo {
        char *name;                          /* name of primitive class           */
 } primitivetypeinfo;
 
+
 /* field, method and class structures *****************************************/
 
+#include "sets.h"
 typedef        struct xtafldinfo {
-               bool       fieldChecked;                
-               classinfo *fldClassType;
-               classSet  *XTAclassSet;      /* field class type set                  */  
-               } xtafldinfo;
+       bool       fieldChecked;                
+       classinfo *fldClassType;
+       classSet  *XTAclassSet;          /* field class type set                  */
+} xtafldinfo;
+
+
 /* fieldinfo ******************************************************************/
 
 struct fieldinfo {           /* field of a class                                 */
-       s4       flags;       /* ACC flags                                        */
-       s4       type;        /* basic data type                                  */
+       s4  flags;            /* ACC flags                                        */
+       s4  type;             /* basic data type                                  */
        utf *name;            /* name of field                                    */
        utf *descriptor;      /* JavaVM descriptor string of field                */
        
-       s4       offset;      /* offset from start of object (instance variables) */
+       s4  offset;           /* offset from start of object (instance variables) */
 
        union {               /* storage for static values (class variables)      */
                s4 i; 
@@ -409,8 +428,7 @@ struct fieldinfo {        /* field of a class                                 */
        } value;
        
        xtafldinfo *xta;
-
-} ;
+};
 
 struct basicblock;
 
@@ -701,7 +719,7 @@ extern int count_utf_new_found;
 
 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
 
-#endif
+#endif /* _GLOBAL_H */
 
 
 /*
index 6877826bf4db3e47c7d247870fb4eef0aa831f42..5c4858250464b9cdd08ea847f3acf0768629ecb4 100644 (file)
@@ -1,2 +1,37 @@
-EXTRA_DIST = mcode.c parse.c reg.c stack.c jitdef.h inline.c parseRT.h \
-               parseRTprint.h sets.h sets.c parseRTstats.h
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+
+SUBDIRS = loop @ARCH_DIR@
+DIST_SUBDIRS = loop alpha i386 mips powerpc x86_64
+
+INCLUDES = -I$(top_srcdir)/jit/@ARCH_DIR@ -I$(top_srcdir)/jit
+
+EXTRA_DIST = \
+       jit.c \
+       jit.h \
+       codegen.inc \
+       parse.c \
+       reg.inc \
+       stack.c \
+       jitdef.h \
+       inline.c \
+       sets.c \
+       sets.h \
+       parseRT.c \
+       parseRTprint.h \
+       parseRTstats.c
+
+noinst_LIBRARIES = libjit.a
+
+libjit_a_SOURCES = jit.c parse.c stack.c inline.c sets.c parseRT.c parseRTstats.c
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
diff --git a/src/vm/jit/alpha/Makefile.am b/src/vm/jit/alpha/Makefile.am
new file mode 100644 (file)
index 0000000..99adcce
--- /dev/null
@@ -0,0 +1,33 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+
+INCLUDES = -I$(top_srcdir)/jit
+
+EXTRA_DIST = \
+       asmpart.S \
+       disass.c \
+       disass.h \
+       native-math.h \
+       codegen.c \
+       codegen.h \
+       types.h \
+       threads.h \
+       sigcontext.h
+
+noinst_LIBRARIES = libarch.a
+
+libarch_a_SOURCES = asmpart.S codegen.c disass.c
+
+%.o: %.S
+       $(COMPILE) -c $<
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
diff --git a/src/vm/jit/alpha/asmpart.S b/src/vm/jit/alpha/asmpart.S
new file mode 100644 (file)
index 0000000..0e71fb3
--- /dev/null
@@ -0,0 +1,1229 @@
+/* -*- mode: asm; tab-width: 4 -*- */
+/****************************** asmpart.S **************************************
+*                                                                              *
+*   It contains the Java-C interface functions for Alpha processors.           *
+*                                                                              *
+*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
+*                                                                              *
+*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
+*                                                                              *
+*   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
+*            Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
+*                                                                              *
+*   Last Change: 2003/02/17                                                    *
+*                                                                              *
+*******************************************************************************/
+
+#include "offsets.h"
+
+#define v0      $0
+
+#define t0      $1
+#define t1      $2
+#define t2      $3
+#define t3      $4
+#define t4      $5
+#define t5      $6
+#define t6      $7
+#define t7      $8
+
+#define        s0      $9
+#define        s1      $10
+#define        s2      $11
+#define        s3      $12
+#define        s4      $13
+#define        s5      $14
+#define        s6      $15
+
+#define a0      $16
+#define a1      $17
+#define a2      $18
+#define a3      $19
+#define a4      $20
+#define a5      $21
+
+#define t8      $22
+#define t9      $23
+#define t10     $24
+#define t11     $25
+#define ra      $26
+#define t12     $27
+
+#define pv      t12
+#define AT      $at
+#define gp      $29
+#define sp      $30
+#define zero    $31
+
+#define itmp1   $25
+#define itmp2   $28
+#define itmp3   $29
+
+#define xptr    itmp1
+#define xpc     itmp2
+
+#define sf0     $f2
+#define sf1     $f3
+#define sf2     $f4
+#define sf3     $f5
+#define sf4     $f6
+#define sf5     $f7
+#define sf6     $f8
+#define sf7     $f9
+
+#define fzero   $f31
+
+
+#define PAL_imb 134
+
+       .text
+       .set    noat
+       .set    noreorder
+
+
+/********************* exported functions and variables ***********************/
+
+       .globl has_no_x_instr_set
+       .globl synchronize_caches
+       .globl asm_calljavamethod
+       .globl asm_calljavafunction
+       .globl asm_call_jit_compiler
+       .globl asm_dumpregistersandcall
+       .globl asm_handle_exception
+       .globl asm_handle_nat_exception
+       .globl asm_builtin_checkcast    
+       .globl asm_builtin_checkarraycast
+       .globl asm_builtin_aastore
+       .globl asm_builtin_monitorenter
+       .globl asm_builtin_monitorexit
+       .globl asm_builtin_idiv
+       .globl asm_builtin_irem
+       .globl asm_builtin_ldiv
+       .globl asm_builtin_lrem
+       .globl asm_perform_threadswitch
+       .globl asm_initialize_thread_stack
+       .globl asm_switchstackandcall
+       .globl asm_getcallingmethod
+       .globl asm_builtin_trace
+       .globl asm_builtin_exittrace
+
+/*************************** imported functions *******************************/
+
+       .globl jit_compile
+       .globl builtin_monitorexit
+       .globl builtin_throw_exception
+       .globl builtin_trace_exception
+       .globl class_java_lang_Object
+
+
+/*********************** function has_no_x_instr_set ***************************
+*                                                                              *
+*   determines if the byte support instruction set (21164a and higher)         *
+*   is available.                                                              *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    has_no_x_instr_set
+has_no_x_instr_set:
+
+       .long   0x47e03c20                /* amask   1,v0                         */
+       jmp     zero,(ra)                 /* return                               */
+
+       .end    has_no_x_instr_set
+
+
+/********************* function synchronize_caches ****************************/
+
+       .ent    synchronize_caches
+synchronize_caches:
+
+       call_pal PAL_imb                  /* synchronise instruction cache        */
+       jmp     zero,(ra)                 /* return                               */
+
+       .end    synchronize_caches
+
+
+/********************* function asm_calljavamethod *****************************
+*                                                                              *
+*   This function calls a Java-method (which possibly needs compilation)       *
+*   with up to 4 parameters.                                                   *
+*                                                                              *
+*   This functions calls the JIT-compiler which eventually translates the      *
+*   method into machine code.                                                  *
+*                                                                              *
+*   An possibly throwed exception will be returned to the caller as function   *
+*   return value, so the java method cannot return a fucntion value (this      *
+*   function usually calls 'main' and '<clinit>' which do not return a         *
+*   function value).                                                           *
+*                                                                              *
+*   C-prototype:                                                               *
+*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
+*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
+*                                                                              *
+*******************************************************************************/
+
+#define        MethodPointer   -8
+#define        FrameSize       -12
+#define     IsSync          -16
+#define     IsLeaf          -20
+#define     IntSave         -24
+#define     FltSave         -28
+#define     ExTableSize     -32
+#define     ExTableStart    -32
+
+#define     ExEntrySize     -32
+#define     ExStartPC       -8
+#define     ExEndPC         -16
+#define     ExHandlerPC     -24
+#define     ExCatchType     -32
+
+       .ent    asm_calljavamethod
+
+call_name:
+       .ascii  "calljavamethod\0\0"
+
+       .align  3
+       .quad   0                         /* catch type all                       */
+       .quad   calljava_xhandler         /* handler pc                           */
+       .quad   calljava_xhandler         /* end pc                               */
+       .quad   asm_calljavamethod        /* start pc                             */
+       .long   1                         /* extable size                         */
+       .long   0                         /* fltsave                              */
+       .long   0                         /* intsave                              */
+       .long   0                         /* isleaf                               */
+       .long   0                         /* IsSync                               */
+       .long   32                        /* frame size                           */
+       .quad   0                         /* method pointer (pointer to name)     */
+
+asm_calljavamethod:
+
+       .frame $30,32,$26
+       .mask 0x4000000,-32
+       ldgp    gp,0(pv)
+       lda     sp,-32(sp)                /* allocate stack space                 */
+       stq     gp,24(sp)                 /* save global pointer                  */
+       stq     ra,0(sp)                  /* save return address                  */
+       .prologue 1
+
+       stq     a0,16(sp)                 /* save method pointer for compiler     */
+       lda     v0,16(sp)                 /* pass pointer to method pointer via v0*/
+
+       mov     a1,a0                     /* pass the remaining parameters        */
+       mov     a2,a1
+       mov     a3,a2
+       mov     a4,a3
+
+       lda     $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
+       stq     $28,8(sp)                 /* store function address               */
+       mov     sp,$28                    /* set method pointer                   */
+
+       ldq     pv,8($28)                 /* method call as in Java               */
+       jmp     ra,(pv)                   /* call JIT compiler                    */
+calljava_jit:
+       lda     pv,-64(ra)                /* asm_calljavamethod-calljava_jit !!!!!*/
+
+calljava_return:
+
+       ldq     ra,0(sp)                  /* restore return address               */
+       ldq     gp,24(sp)                 /* restore global pointer               */
+       lda     sp,32(sp)                 /* free stack space                     */
+    clr     v0
+
+calljava_ret:
+       jmp     zero,(ra)
+
+calljava_xhandler:
+
+       ldq     gp,24(sp)                 /* restore global pointer               */
+       mov     itmp1,a0
+       jsr     ra,builtin_throw_exception
+       ldq     ra,0(sp)                  /* restore return address               */
+       lda     sp,32(sp)                 /* free stack space                     */
+       jmp     zero,(ra)
+       .end    asm_calljavamethod
+
+
+/********************* function asm_calljavafunction ***************************
+*                                                                              *
+*   This function calls a Java-method (which possibly needs compilation)       *
+*   with up to 4 address parameters.                                           *
+*                                                                              *
+*   This functions calls the JIT-compiler which eventually translates the      *
+*   method into machine code.                                                  *
+*                                                                              *
+*   C-prototype:                                                               *
+*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
+*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_calljavafunction
+
+call_name2:
+       .ascii  "calljavafunction\0\0"
+
+       .align  3
+       .quad   0                         /* catch type all                       */
+       .quad   calljava_xhandler2        /* handler pc                           */
+       .quad   calljava_xhandler2        /* end pc                               */
+       .quad   asm_calljavafunction      /* start pc                             */
+       .long   1                         /* extable size                         */
+       .long   0                         /* fltsave                              */
+       .long   0                         /* intsave                              */
+       .long   0                         /* isleaf                               */
+       .long   0                         /* IsSync                               */
+       .long   32                        /* frame size                           */
+       .quad   0                         /* method pointer (pointer to name)     */
+
+asm_calljavafunction:
+
+       .frame $30,32,$26
+       .mask 0x4000000,-32
+       ldgp    gp,0(pv)
+       lda     sp,-32(sp)                /* allocate stack space                 */
+       stq     gp,24(sp)                 /* save global pointer                  */
+       stq     ra,0(sp)                  /* save return address                  */
+       .prologue 1
+
+       stq     a0,16(sp)                 /* save method pointer for compiler     */
+       lda     v0,16(sp)                 /* pass pointer to method pointer via v0*/
+
+       mov     a1,a0                     /* pass the remaining parameters        */
+       mov     a2,a1
+       mov     a3,a2
+       mov     a4,a3
+
+       lda     $28,asm_call_jit_compiler /* fake virtual function call (2 instr) */
+       stq     $28,8(sp)                 /* store function address               */
+       mov     sp,$28                    /* set method pointer                   */
+
+       ldq     pv,8($28)                 /* method call as in Java               */
+       jmp     ra,(pv)                   /* call JIT compiler                    */
+calljava_jit2:
+       lda     pv,-64(ra)                /* asm_calljavafunction-calljava_jit !!!!!*/
+
+calljava_return2:
+
+       ldq     ra,0(sp)                  /* restore return address               */
+       ldq     gp,24(sp)                 /* restore global pointer               */
+       lda     sp,32(sp)                 /* free stack space                     */
+
+calljava_ret2:
+       jmp     zero,(ra)
+
+calljava_xhandler2:
+
+       ldq     gp,24(sp)                 /* restore global pointer               */
+       mov     itmp1,a0
+       jsr     ra,builtin_throw_exception
+       ldq     ra,0(sp)                  /* restore return address               */
+       lda     sp,32(sp)                 /* free stack space                     */
+       jmp     zero,(ra)
+       .end    asm_calljavafunction
+                                               
+
+/****************** function asm_call_jit_compiler *****************************
+*                                                                              *
+*   invokes the compiler for untranslated JavaVM methods.                      *
+*                                                                              *
+*   Register R0 contains a pointer to the method info structure (prepared      *
+*   by createcompilerstub). Using the return address in R26 and the            *
+*   offset in the LDA instruction or using the value in methodptr R28 the      *
+*   patching address for storing the method address can be computed:           *
+*                                                                              *
+*   method address was either loaded using                                     *
+*   M_LDQ (REG_PV, REG_PV, a)        ; invokestatic/special    ($27)           *
+*   M_LDA (REG_PV, REG_RA, low)                                                *
+*   M_LDAH(REG_PV, REG_RA, high)     ; optional                                *
+*   or                                                                         *
+*   M_LDQ (REG_PV, REG_METHODPTR, m) ; invokevirtual/interface ($28)           *
+*   in the static case the method pointer can be computed using the            *
+*   return address and the lda function following the jmp instruction          *
+*                                                                              *
+*******************************************************************************/
+
+
+       .ent    asm_call_jit_compiler
+asm_call_jit_compiler:
+
+       .frame $30,0,$26
+       ldgp    gp,0(pv)
+       ldl     t8,-8(ra)             /* load instruction LDQ PV,xxx($yy)         */
+       srl     t8,16,t8              /* shift right register number $yy          */
+       and     t8,31,t8              /* isolate register number                  */
+       subl    t8,28,t8              /* test for REG_METHODPTR                   */
+       beq     t8,noregchange       
+       ldl     t8,0(ra)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t8,48,t8
+       sra     t8,48,t8              /* isolate offset                           */
+       addq    t8,ra,$28             /* compute update address                   */
+       ldl     t8,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t8,16,t8              /* isolate instruction code                 */
+       lda     t8,-0x177b(t8)        /* test for LDAH                            */
+       bne     t8,noregchange       
+       ldl     t8,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       sll     t8,16,t8              /* compute high offset                      */
+       addl    t8,0,t8               /* sign extend high offset                  */
+       addq    t8,$28,$28            /* compute update address                   */
+noregchange:
+       lda     sp,-14*8(sp)          /* reserve stack space                      */
+       stq     a0,0*8(sp)            /* save all argument registers              */
+       stq     a1,1*8(sp)            /* they could be used by method             */
+       stq     a2,2*8(sp)
+       stq     a3,3*8(sp)
+       stq     a4,4*8(sp)
+       stq     a5,5*8(sp)
+       stt     $f16,6*8(sp)
+       stt     $f17,7*8(sp)
+       stt     $f18,8*8(sp)
+       stt     $f19,9*8(sp)
+       stt     $f20,10*8(sp)
+       stt     $f21,11*8(sp)
+       stq     $28,12*8(sp)          /* save method pointer                      */
+       stq     ra,13*8(sp)           /* save return address                      */
+
+       ldq     a0,0(v0)              /* pass 'methodinfo' pointer to             */
+       jsr     ra,jit_compile        /* jit compiler                             */
+       ldgp    gp,0(ra)
+
+       call_pal PAL_imb              /* synchronise instruction cache            */
+
+       ldq     a0,0*8(sp)            /* load argument registers                  */
+       ldq     a1,1*8(sp)
+       ldq     a2,2*8(sp)
+       ldq     a3,3*8(sp)
+       ldq     a4,4*8(sp)
+       ldq     a5,5*8(sp)
+       ldt     $f16,6*8(sp)
+       ldt     $f17,7*8(sp)
+       ldt     $f18,8*8(sp)
+       ldt     $f19,9*8(sp)
+       ldt     $f20,10*8(sp)
+       ldt     $f21,11*8(sp)
+       ldq     $28,12*8(sp)          /* load method pointer                      */
+       ldq     ra,13*8(sp)           /* load return address                      */
+       lda     sp,14*8(sp)           /* deallocate stack area                    */
+
+       ldl     t8,-8(ra)             /* load instruction LDQ PV,xxx($yy)         */
+       sll     t8,48,t8
+       sra     t8,48,t8              /* isolate offset                           */
+
+       addq    t8,$28,t8             /* compute update address via method pointer*/
+       stq     v0,0(t8)              /* save new method address there            */
+
+       mov     v0,pv                 /* load method address into pv              */
+
+       jmp     zero,(pv)             /* and call method. The method returns      */
+                                     /* directly to the caller (ra).             */
+
+       .end    asm_call_jit_compiler
+
+
+/****************** function asm_dumpregistersandcall **************************
+*                                                                              *
+*   This funtion saves all callee saved registers and calls the function       *
+*   which is passed as parameter.                                              *
+*                                                                              *
+*   This function is needed by the garbage collector, which needs to access    *
+*   all registers which are stored on the stack. Unused registers are          *
+*   cleared to avoid interferances with the GC.                                *
+*                                                                              *
+*   void asm_dumpregistersandcall (functionptr f);                             *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_dumpregistersandcall
+asm_dumpregistersandcall:
+       lda     sp,-16*8(sp)          /* allocate stack                           */
+       stq     ra,0(sp)              /* save return address                      */
+
+       stq     s0,1*8(sp)            /* save all callee saved registers          */
+       stq     s1,2*8(sp)            /* intialize the remaining registers        */
+       stq     s2,3*8(sp)
+       stq     s3,4*8(sp)
+       stq     s4,5*8(sp)
+       stq     s5,6*8(sp)
+       stq     s6,7*8(sp)
+       stt     $f2,8*8(sp)
+       stt     $f3,9*8(sp)
+       stt     $f4,10*8(sp)
+       stt     $f5,11*8(sp)
+       stt     $f6,12*8(sp)
+       stt     $f7,13*8(sp)
+       stt     $f8,14*8(sp)
+       stt     $f9,15*8(sp)
+
+       clr     v0                   /* intialize the remaining registers         */
+       clr     t0
+       clr     t1
+       clr     t2
+       clr     t3
+       clr     t4
+       clr     t5
+       clr     t6
+       clr     t7
+       clr     a1
+       clr     a2
+       clr     a3
+       clr     a4
+       clr     a5
+       clr     t8
+       clr     t9
+       clr     t10
+       clr     t11
+       clr     t12
+       clr     $28
+       clr     $29
+       cpys    $f31,$f31,$f0
+       cpys    $f31,$f31,$f1
+       cpys    $f31,$f31,$f10
+       cpys    $f31,$f31,$f11
+       cpys    $f31,$f31,$f12
+       cpys    $f31,$f31,$f13
+       cpys    $f31,$f31,$f14
+       cpys    $f31,$f31,$f15
+       cpys    $f31,$f31,$f16
+       cpys    $f31,$f31,$f17
+       cpys    $f31,$f31,$f18
+       cpys    $f31,$f31,$f19
+       cpys    $f31,$f31,$f20
+       cpys    $f31,$f31,$f21
+       cpys    $f31,$f31,$f22
+       cpys    $f31,$f31,$f23
+       cpys    $f31,$f31,$f24
+       cpys    $f31,$f31,$f25
+       cpys    $f31,$f31,$f26
+       cpys    $f31,$f31,$f27
+       cpys    $f31,$f31,$f28
+       cpys    $f31,$f31,$f29
+       cpys    $f31,$f31,$f30
+
+       mov     a0,pv                 /* load function pointer                    */
+       jmp     ra,(pv)               /* and call function                        */
+
+       ldq     ra,0(sp)              /* load return address                      */
+       lda     sp,16*8(sp)           /* deallocate stack                         */
+       jmp     zero,(ra)             /* return                                   */
+
+       .end    asm_dumpregistersandcall
+
+
+/********************* function asm_handle_exception ***************************
+*                                                                              *
+*   This function handles an exception. It does not use the usual calling      *
+*   conventions. The exception pointer is passed in REG_ITMP1 and the          *
+*   pc from the exception raising position is passed in REG_ITMP2. It searches *
+*   the local exception table for a handler. If no one is found, it unwinds    *
+*   stacks and continues searching the callers.                                *
+*                                                                              *
+*   void asm_handle_exception (exceptionptr, exceptionpc);                     *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_handle_nat_exception
+asm_handle_nat_exception:
+
+       ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,48,t0
+       sra     t0,48,t0              /* isolate offset                           */
+       addq    t0,ra,pv              /* compute update address                   */
+       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t0,16,t0              /* isolate instruction code                 */
+       lda     t0,-0x177b(t0)        /* test for LDAH                            */
+       bne     t0,asm_handle_exception       
+       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       sll     t0,16,t0              /* compute high offset                      */
+       addl    t0,0,t0               /* sign extend high offset                  */
+       addq    t0,pv,pv              /* compute update address                   */
+
+       .aent    asm_handle_exception
+asm_handle_exception:
+
+       lda     sp,-18*8(sp)          /* allocate stack                           */
+       stq     t0,0*8(sp)            /* save possible used registers             */
+       stq     t1,1*8(sp)            /* also registers used by trace_exception   */
+       stq     t2,2*8(sp)
+       stq     t3,3*8(sp)
+       stq     t4,4*8(sp)
+       stq     t5,5*8(sp)
+       stq     t6,6*8(sp)
+       stq     t7,7*8(sp)
+       stq     t8,8*8(sp)
+       stq     t9,9*8(sp)
+       stq     t10,10*8(sp)
+       stq     v0,11*8(sp)
+       stq     a0,12*8(sp)
+       stq     a1,13*8(sp)
+       stq     a2,14*8(sp)
+       stq     a3,15*8(sp)
+       stq     a4,16*8(sp)
+       stq     a5,17*8(sp)
+
+       lda     t3,1(zero)            /* set no unwind flag                       */
+ex_stack_loop:
+       lda     sp,-5*8(sp)           /* allocate stack                           */
+       stq     xptr,0*8(sp)          /* save used register                       */
+       stq     xpc,1*8(sp)
+       stq     pv,2*8(sp)
+       stq     ra,3*8(sp)
+       stq     t3,4*8(sp)
+
+       mov     xptr,a0
+       ldq     a1,MethodPointer(pv)
+       mov     xpc,a2
+       mov     t3,a3
+       br      ra,ex_trace           /* set ra for gp loading                    */
+ex_trace:
+       ldgp    gp,0(ra)              /* load gp                                  */
+       jsr     ra,builtin_trace_exception /* trace_exception(xptr,methodptr)     */
+       
+       ldq     xptr,0*8(sp)          /* restore used register                    */
+       ldq     xpc,1*8(sp)
+       ldq     pv,2*8(sp)
+       ldq     ra,3*8(sp)
+       ldq     t3,4*8(sp)
+       lda     sp,5*8(sp)            /* deallocate stack                         */
+       
+       ldl     t0,ExTableSize(pv)    /* t0 = exception table size                */
+       beq     t0,empty_table        /* if empty table skip                      */
+       lda     t1,ExTableStart(pv)   /* t1 = start of exception table            */
+
+ex_table_loop:
+       ldq     t2,ExStartPC(t1)      /* t2 = exception start pc                  */
+       cmple   t2,xpc,t2             /* t2 = (startpc <= xpc)                    */
+       beq     t2,ex_table_cont      /* if (false) continue                      */
+       ldq     t2,ExEndPC(t1)        /* t2 = exception end pc                    */
+       cmplt   xpc,t2,t2             /* t2 = (xpc < endpc)                       */
+       beq     t2,ex_table_cont      /* if (false) continue                      */
+       ldq     a1,ExCatchType(t1)    /* arg1 = exception catch type              */
+       beq     a1,ex_handle_it       /* NULL catches everything                  */
+
+       ldq     a0,offobjvftbl(xptr)  /* a0 = vftblptr(xptr)                      */
+       ldq     a1,offobjvftbl(a1)    /* a1 = vftblptr(catchtype) class (not obj) */
+       ldl     a0,offbaseval(a0)     /* a0 = baseval(xptr)                       */
+       ldl     v0,offbaseval(a1)     /* a2 = baseval(catchtype)                  */
+       ldl     a1,offdiffval(a1)     /* a1 = diffval(catchtype)                  */
+       subl    a0,v0,a0              /* a0 = baseval(xptr) - baseval(catchtype)  */
+       cmpule  a0,a1,v0              /* v0 = xptr is instanceof catchtype        */
+       beq     v0,ex_table_cont      /* if (false) continue                      */
+
+ex_handle_it:
+
+       ldq     xpc,ExHandlerPC(t1)   /* xpc = exception handler pc               */
+
+       beq     t3,ex_jump            /* if (!(no stack unwinding) skip           */
+
+       ldq     t0,0*8(sp)            /* restore possible used registers          */
+       ldq     t1,1*8(sp)            /* also registers used by trace_exception   */
+       ldq     t2,2*8(sp)
+       ldq     t3,3*8(sp)
+       ldq     t4,4*8(sp)
+       ldq     t5,5*8(sp)
+       ldq     t6,6*8(sp)
+       ldq     t7,7*8(sp)
+       ldq     t8,8*8(sp)
+       ldq     t9,9*8(sp)
+       ldq     t10,10*8(sp)
+       ldq     v0,11*8(sp)
+       ldq     a0,12*8(sp)
+       ldq     a1,13*8(sp)
+       ldq     a2,14*8(sp)
+       ldq     a3,15*8(sp)
+       ldq     a4,16*8(sp)
+       ldq     a5,17*8(sp)
+       lda     sp,18*8(sp)           /* deallocate stack                         */
+
+ex_jump:
+       jmp     zero,(xpc)            /* jump to the handler                      */
+
+ex_table_cont:
+       lda     t1,ExEntrySize(t1)    /* next exception table entry               */
+       subl    t0,1,t0               /* decrement entry counter                  */
+       bgt     t0,ex_table_loop      /* if (t0 > 0) next entry                   */
+
+empty_table:
+       beq     t3,ex_already_cleared /* if here the first time, then             */
+       lda     sp,18*8(sp)           /* deallocate stack and                     */
+       clr     t3                    /* clear the no unwind flag                 */
+ex_already_cleared:
+       ldl     t0,IsSync(pv)         /* t0 = SyncOffset                          */
+       beq     t0,no_monitor_exit    /* if zero no monitorexit                   */
+       addq    sp,t0,t0              /* add stackptr to Offset                   */
+       ldq     a0,-8(t0)             /* load monitorexit pointer                 */
+
+       lda     sp,-7*8(sp)           /* allocate stack                           */
+       stq     t0,0*8(sp)            /* save used register                       */
+       stq     t1,1*8(sp)
+       stq     t3,2*8(sp)
+       stq     xptr,3*8(sp)
+       stq     xpc,4*8(sp)
+       stq     pv,5*8(sp)
+       stq     ra,6*8(sp)
+
+       br      ra,ex_mon_load        /* set ra for gp loading                    */
+ex_mon_load:
+       ldgp    gp,0(ra)              /* load gp                                  */
+       jsr     ra,builtin_monitorexit/* builtin_monitorexit(objectptr)           */
+       
+       ldq     t0,0*8(sp)            /* restore used register                    */
+       ldq     t1,1*8(sp)
+       ldq     t3,2*8(sp)
+       ldq     xptr,3*8(sp)
+       ldq     xpc,4*8(sp)
+       ldq     pv,5*8(sp)
+       ldq     ra,6*8(sp)
+       lda     sp,7*8(sp)            /* deallocate stack                         */
+
+no_monitor_exit:
+       ldl     t0,FrameSize(pv)      /* t0 = frame size                          */
+       addq    sp,t0,sp              /* unwind stack                             */
+       mov     sp,t0                 /* t0 = pointer to save area                */
+       ldl     t1,IsLeaf(pv)         /* t1 = is leaf procedure                   */
+       bne     t1,ex_no_restore      /* if (leaf) skip                           */
+       ldq     ra,-8(t0)             /* restore ra                               */
+       lda     t0,-8(t0)             /* t0--                                     */
+ex_no_restore:
+       mov     ra,xpc                /* the new xpc is ra                        */
+       ldl     t1,IntSave(pv)        /* t1 = saved int register count            */
+       br      t2,ex_int1            /* t2 = current pc                          */
+ex_int1:
+       lda     t2,44(t2)             /* lda t2,ex_int2-ex_int1(t2) !!!!!!!!!!!!! */
+       negl    t1,t1                 /* negate register count                    */
+       s4addq  t1,t2,t2              /* t2 = ex_int_sav - 4 * register count     */
+       jmp     zero,(t2)             /* jump to save position                    */
+       ldq     s0,-56(t0)
+       ldq     s1,-48(t0)
+       ldq     s2,-40(t0)
+       ldq     s3,-32(t0)
+       ldq     s4,-24(t0)
+       ldq     s5,-16(t0)
+       ldq     s6,-8(t0)
+ex_int2:
+       s8addq  t1,t0,t0              /* t0 = t0 - 8 * register count             */
+
+       ldl     t1,FltSave(pv)        /* t1 = saved flt register count            */
+       br      t2,ex_flt1            /* t2 = current pc                          */
+ex_flt1:
+       lda     t2,48(t2)             /* lda t2,ex_flt2-ex_flt1(t2) !!!!!!!!!!!!! */
+       negl    t1,t1                 /* negate register count                    */
+       s4addq  t1,t2,t2              /* t2 = ex_flt_sav - 4 * register count     */
+       jmp     zero,(t2)             /* jump to save position                    */
+       ldt     $f2,-64(t0)
+       ldt     $f3,-56(t0)
+       ldt     $f4,-48(t0)
+       ldt     $f5,-40(t0)
+       ldt     $f6,-32(t0)
+       ldt     $f7,-24(t0)
+       ldt     $f8,-16(t0)
+       ldt     $f9,-8(t0)
+ex_flt2:
+       ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,48,t0
+       sra     t0,48,t0              /* isolate offset                           */
+       addq    t0,ra,pv              /* compute update address                   */
+       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t0,16,t0              /* isolate instruction code                 */
+       lda     t0,-0x177b(t0)        /* test for LDAH                            */
+       bne     t0,ex_stack_loop       
+       ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(RA)         */
+       sll     t0,16,t0              /* compute high offset                      */
+       addl    t0,0,t0               /* sign extend high offset                  */
+       addq    t0,pv,pv              /* compute update address                   */
+       br      ex_stack_loop
+
+       .end    asm_handle_nat_exception
+
+
+/********************* function asm_builtin_monitorenter ***********************
+*                                                                              *
+*   Does null check and calls monitorenter or throws an exception              *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_monitorenter
+asm_builtin_monitorenter:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_monitorenter
+       beq     a0,nb_monitorenter        /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_monitorenter       */
+
+nb_monitorenter:
+       ldq     xptr,proto_java_lang_NullPointerException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_monitorenter
+
+
+/********************* function asm_builtin_monitorexit ************************
+*                                                                              *
+*   Does null check and calls monitorexit or throws an exception               *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_monitorexit
+asm_builtin_monitorexit:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_monitorexit
+       beq     a0,nb_monitorexit         /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_monitorexit        */
+
+nb_monitorexit:
+       ldq     xptr,proto_java_lang_NullPointerException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_monitorexit
+
+
+/************************ function asm_builtin_idiv ****************************
+*                                                                              *
+*   Does null check and calls idiv or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_idiv
+asm_builtin_idiv:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_idiv
+       beq     a1,nb_idiv                /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_idiv               */
+
+nb_idiv:
+       ldq     xptr,proto_java_lang_ArithmeticException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_idiv
+
+
+/************************ function asm_builtin_ldiv ****************************
+*                                                                              *
+*   Does null check and calls ldiv or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_ldiv
+asm_builtin_ldiv:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_ldiv
+       beq     a1,nb_ldiv                /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_ldiv               */
+
+nb_ldiv:
+       ldq     xptr,proto_java_lang_ArithmeticException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_ldiv
+
+
+/************************ function asm_builtin_irem ****************************
+*                                                                              *
+*   Does null check and calls irem or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_irem
+asm_builtin_irem:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_irem
+       beq     a1,nb_irem                /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_irem               */
+
+nb_irem:
+       ldq     xptr,proto_java_lang_ArithmeticException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_irem
+
+
+/************************ function asm_builtin_lrem ****************************
+*                                                                              *
+*   Does null check and calls lrem or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_lrem
+asm_builtin_lrem:
+
+       ldgp    gp,0(pv)
+       lda     pv,builtin_lrem
+       beq     a1,nb_lrem                /* if (null) throw exception            */
+       jmp     zero,(pv)                 /* else call builtin_lrem               */
+
+nb_lrem:
+       ldq     xptr,proto_java_lang_ArithmeticException
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_lrem
+
+
+ /*********************** function new_builtin_checkcast ************************
+ *                                                                              *
+ *   Does the cast check and eventually throws an exception                     *
+ *                                                                              *
+ *******************************************************************************/
+
+    .ent    asm_builtin_checkcast
+asm_builtin_checkcast:
+
+    ldgp    gp,0(pv)
+    lda     sp,-16(sp)                  # allocate stack space
+    stq     ra,0(sp)                    # save return address
+    stq     a0,8(sp)                    # save object pointer
+    jsr     ra,builtin_checkcast        # builtin_checkcast
+    ldgp    gp,0(ra)
+    beq     v0,nb_ccast_throw           # if (false) throw exception
+    ldq     ra,0(sp)                    # restore return address
+    ldq     v0,8(sp)                    # return object pointer
+    lda     sp,16(sp)                   # free stack space
+    jmp     zero,(ra)
+
+nb_ccast_throw:
+    ldq     xptr,proto_java_lang_ClassCastException
+    ldq     ra,0(sp)                    # restore return address
+    lda     sp,16(sp)                   # free stack space
+    lda     xpc,-4(ra)                  # faulting address is return adress - 4
+    br      asm_handle_nat_exception
+    .end    asm_builtin_checkcast
+
+               
+/******************* function asm_builtin_checkarraycast ***********************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_checkarraycast
+asm_builtin_checkarraycast:
+
+       ldgp    gp,0(pv)
+       lda     sp,-16(sp)                /* allocate stack space                 */
+       stq     ra,0(sp)                  /* save return address                  */
+       stq     a0,8(sp)                  /* save object pointer                  */
+       jsr     ra,builtin_checkarraycast /* builtin_checkarraycast               */
+       ldgp    gp,0(ra)
+       beq     v0,nb_carray_throw        /* if (false) throw exception           */
+       ldq     ra,0(sp)                  /* restore return address               */
+       ldq     v0,8(sp)                  /* return object pointer                */
+       lda     sp,16(sp)                 /* free stack space                     */
+       jmp     zero,(ra)
+
+nb_carray_throw:
+       ldq     xptr,proto_java_lang_ClassCastException
+       ldq     ra,0(sp)                  /* restore return address               */
+       lda     sp,16(sp)                 /* free stack space                     */
+       lda     xpc,-4(ra)                /* faulting address is return adress - 4*/
+       br      asm_handle_nat_exception
+       .end    asm_builtin_checkarraycast
+
+
+/******************* function asm_builtin_aastore ******************************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_builtin_aastore
+asm_builtin_aastore:
+
+       ldgp    gp,0(pv)
+       beq     a0,nb_aastore_null        /* if null pointer throw exception      */
+       ldl     t0,offarraysize(a0)       /* load size                            */
+       lda     sp,-24(sp)                /* allocate stack space                 */
+       stq     ra,0(sp)                  /* save return address                  */
+       s8addq  a1,a0,t1                  /* add index*8 to arrayref              */
+       cmpult  a1,t0,t0                  /* do bound check                       */
+       beq     t0,nb_aastore_bound       /* if out of bounds throw exception     */
+       mov     a2,a1                     /* object is second argument            */
+       stq     t1,8(sp)                  /* save store position                  */
+       stq     a1,16(sp)                 /* save object                          */
+       jsr     ra,builtin_canstore       /* builtin_canstore(arrayref,object)    */
+       ldgp    gp,0(ra)
+       ldq     ra,0(sp)                  /* restore return address               */
+       ldq     a0,8(sp)                  /* restore store position               */
+       ldq     a1,16(sp)                 /* restore object                       */
+       lda     sp,24(sp)                 /* free stack space                     */
+       beq     v0,nb_aastore_throw       /* if (false) throw exception           */
+       stq     a1,offobjarrdata(a0)      /* store objectptr in array             */
+       jmp     zero,(ra)
+
+nb_aastore_null:
+       ldq     xptr,proto_java_lang_NullPointerException
+       mov     ra,xpc                    /* faulting address is return adress    */
+       br      asm_handle_nat_exception
+
+nb_aastore_bound:
+       ldq     xptr,proto_java_lang_ArrayIndexOutOfBoundsException
+       lda     sp,24(sp)                 /* free stack space                     */
+       mov     ra,xpc                    /* faulting address is return adress    */
+       br      asm_handle_nat_exception
+
+nb_aastore_throw:
+       ldq     xptr,proto_java_lang_ArrayStoreException
+       mov     ra,xpc                    /* faulting address is return adress    */
+       br      asm_handle_nat_exception
+
+       .end    asm_builtin_aastore
+
+
+/******************* function asm_initialize_thread_stack **********************
+*                                                                              *
+*   initialized a thread stack                                                 *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_initialize_thread_stack
+asm_initialize_thread_stack:
+
+       lda     a1,-128(a1)
+       stq     zero, 0(a1)
+       stq     zero, 8(a1)
+       stq     zero, 16(a1)
+       stq     zero, 24(a1)
+       stq     zero, 32(a1)
+       stq     zero, 40(a1)
+       stq     zero, 48(a1)
+       stt     fzero, 56(a1)
+       stt     fzero, 64(a1)
+       stt     fzero, 72(a1)
+       stt     fzero, 80(a1)
+       stt     fzero, 88(a1)
+       stt     fzero, 96(a1)
+       stt     fzero, 104(a1)
+       stt     fzero, 112(a1)
+       stq     a0, 120(a1)
+       mov     a1, v0
+       jmp     zero,(ra)
+       .end    asm_initialize_thread_stack
+
+
+/******************* function asm_perform_threadswitch *************************
+*                                                                              *
+*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
+*                                                                              *
+*   performs a threadswitch                                                    *
+*                                                                              *
+*******************************************************************************/
+
+       .ent    asm_perform_threadswitch
+asm_perform_threadswitch:
+
+       subq    sp,128,sp
+       stq     s0, 0(sp)
+       stq     s1, 8(sp)
+       stq     s2, 16(sp)
+       stq     s3, 24(sp)
+       stq     s4, 32(sp)
+       stq     s5, 40(sp)
+       stq     s6, 48(sp)
+       stt     sf0, 56(sp)
+       stt     sf1, 64(sp)
+       stt     sf2, 72(sp)
+       stt     sf3, 80(sp)
+       stt     sf4, 88(sp)
+       stt     sf5, 96(sp)
+       stt     sf6, 104(sp)
+       stt     sf7, 112(sp)
+       stq     ra, 120(sp)
+       stq     sp, 0(a0)
+       stq     sp, 0(a2)
+       ldq     sp, 0(a1)
+       ldq     s0, 0(sp)
+       ldq     s1, 8(sp)
+       ldq     s2, 16(sp)
+       ldq     s3, 24(sp)
+       ldq     s4, 32(sp)
+       ldq     s5, 40(sp)
+       ldq     s6, 48(sp)
+       ldt     sf0, 56(sp)
+       ldt     sf1, 64(sp)
+       ldt     sf2, 72(sp)
+       ldt     sf3, 80(sp)
+       ldt     sf4, 88(sp)
+       ldt     sf5, 96(sp)
+       ldt     sf6, 104(sp)
+       ldt     sf7, 112(sp)
+       ldq     ra, 120(sp)
+       mov     ra, pv
+       addq    sp, 128, sp
+       jmp     zero,(ra)
+       .end    asm_perform_threadswitch
+
+
+/********************* function asm_switchstackandcall *************************
+*                                                                              *
+*  void *asm_switchstackandcall (void *stack, void *func, void **stacktopsave, *
+*                               void *p);                                      *
+*                                                                              *
+*   Switches to a new stack, calls a function and switches back.               *
+*       a0      new stack pointer                                              *
+*       a1      function pointer                                               *
+*              a2              pointer to variable where stack top should be stored           *
+*              a3      pointer to user data, is passed to the function                *
+*                                                                              *
+*******************************************************************************/
+
+
+       .ent    asm_switchstackandcall
+asm_switchstackandcall:
+       lda     a0,-2*8(a0)     /* allocate new stack                                 */
+       stq     ra,0(a0)        /* save return address on new stack                   */
+       stq     sp,1*8(a0)      /* save old stack pointer on new stack                */
+       stq sp,0(a2)        /* save old stack pointer to variable                 */
+       mov     a0,sp           /* switch to new stack                                */
+       
+       mov     a1,pv           /* load function pointer                              */
+       mov a3,a0           /* pass pointer */
+       jmp     ra,(pv)         /* and call function                                  */
+
+       ldq     ra,0(sp)        /* load return address                                */
+       ldq     sp,1*8(sp)      /* switch to old stack                                */
+
+       jmp     zero,(ra)       /* return                                             */
+
+       .end    asm_switchstackandcall
+
+               
+/********************* function asm_getcallingmethod ***************************
+*                                                                              *
+*   classinfo *asm_getcallingmethodclass ();                                                              *
+*                                                                                                                                                         *    
+*   goes back stack frames to get the calling method                                              *       
+*                                                                                                                                                         *    
+*                              t2 .. sp                                                                                                       *
+*                              t3 .. ra                                                                                                       *
+*                              t4 .. pv                                                                                                       *
+*                                                                              *
+*******************************************************************************/
+
+
+       .ent    asm_getcallingmethod
+asm_getcallingmethod:
+
+       ldq             t3,16(sp)             /* load return address of native function   */                            
+       addq    sp,24,t2                          /* skip frames of C-Function and nativestub */        
+               
+    /* determine pv (t3) of java-function from ra */
+
+       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,48,t0
+       sra     t0,48,t0              /* isolate offset                           */
+       addq    t0,t3,t4              /* compute update address                   */
+       ldl     t0,4(t3)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t0,16,t0              /* isolate instruction code                 */
+       lda     t0,-0x177b(t0)        /* test for LDAH                            */
+       bne     t0,pv_ok1       
+       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,16,t0              /* compute high offset                      */
+       addl    t0,0,t0               /* sign extend high offset                  */
+       addq    t0,t4,t4              /* compute update address                   */
+
+pv_ok1:                        
+       ldl     t0,FrameSize(t4)      /* t0 = frame size                          */            
+       addq    t2,t0,t2                          /* skip frame of java function                          */
+       ldq             t3,-8(t2)                         /* load new ra                              */                                                                
+
+    /* determine pv (t3) of java-function from ra */
+
+       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,48,t0
+       sra     t0,48,t0              /* isolate offset                           */
+       addq    t0,t3,t4              /* compute update address                   */
+       ldl     t0,4(t3)              /* load instruction LDAH PV,xxx(PV)         */
+       srl     t0,16,t0              /* isolate instruction code                 */
+       lda     t0,-0x177b(t0)        /* test for LDAH                            */
+       bne     t0,pv_ok2
+       ldl     t0,0(t3)              /* load instruction LDA PV,xxx(RA)          */
+       sll     t0,16,t0              /* compute high offset                      */
+       addl    t0,0,t0               /* sign extend high offset                  */
+       addq    t0,t4,t4              /* compute update address                   */
+
+pv_ok2:                
+       ldq     v0,MethodPointer(t4)  /*                                                                                  */
+
+                                                                               
+       jmp     zero,(ra)                                 /* return                                   */
+
+       .end    asm_getcallingmethod
+
+
+
+
+
+
+
+
+/*********************** function asm_builtin_trace ****************************
+*                                                                              *
+*   Intended to be called from the native stub. Saves all argument registers   *
+*   and calls builtin_trace_args.                                              *
+*                                                                              *
+*******************************************************************************/
+
+       .ent asm_builtin_trace
+asm_builtin_trace:
+       ldgp gp,0(pv)
+       lda sp,-112(sp)
+       stq itmp1,0(sp)
+       stq ra,8(sp)
+       stq a0,16(sp)
+       stq a1,24(sp)
+       stq a2,32(sp)
+       stq a3,40(sp)
+       stq a4,48(sp)
+       stq a5,56(sp)
+       stt $f16,64(sp)
+       stt $f17,72(sp)
+       stt $f18,80(sp)
+       stt $f19,88(sp)
+       stt $f20,96(sp)
+       stt $f21,104(sp)
+       
+       jsr ra,builtin_trace_args
+       
+       ldq ra,8(sp)
+       ldq a0,16(sp)
+       ldq a1,24(sp)
+       ldq a2,32(sp)
+       ldq a3,40(sp)
+       ldq a4,48(sp)
+       ldq a5,56(sp)
+       ldt $f16,64(sp)
+       ldt $f17,72(sp)
+       ldt $f18,80(sp)
+       ldt $f19,88(sp)
+       ldt $f20,96(sp)
+       ldt $f21,104(sp)
+       lda sp,112(sp)
+       jmp zero,(ra)
+
+       .end asm_builtin_trace
+
+
+/********************* function asm_builtin_exittrace **************************
+*                                                                              *
+*   Intended to be called from the native stub. Saves return value and calls   *
+*   builtin_displaymethodstop.                                                 *
+*                                                                              *
+*******************************************************************************/
+
+       .ent asm_builtin_exittrace
+asm_builtin_exittrace:
+       ldgp gp,0(pv)
+       lda sp,-24(sp)
+       stq ra,0(sp)
+       stq v0,8(sp)
+       stt $f0,16(sp)
+       
+       jsr ra,builtin_displaymethodstop
+       
+       ldq ra,0(sp)
+       ldq v0,8(sp)
+       ldt $f0,16(sp)
+       lda sp,24(sp)
+       jmp zero,(ra)
+
+       .end asm_builtin_exittrace
diff --git a/src/vm/jit/alpha/codegen.c b/src/vm/jit/alpha/codegen.c
new file mode 100644 (file)
index 0000000..083d9fd
--- /dev/null
@@ -0,0 +1,3943 @@
+/* jit/alpha/codegen.c - machine code generator for alpha
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   $Id: codegen.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include <signal.h>
+#include "types.h"
+#include "codegen.h"
+#include "jit.h"
+#include "reg.h"
+#include "builtin.h"
+#include "asmpart.h"
+#include "jni.h"
+#include "loader.h"
+#include "tables.h"
+#include "native.h"
+
+/* include independent code generation stuff */
+#include "codegen.inc"
+#include "reg.inc"
+
+
+/* *****************************************************************************
+
+Datatypes and Register Allocations:
+----------------------------------- 
+
+On 64-bit-machines (like the Alpha) all operands are stored in the
+registers in a 64-bit form, even when the correspondig JavaVM  operands
+only need 32 bits. This is done by a canonical representation:
+
+32-bit integers are allways stored as sign-extended 64-bit values (this
+approach is directly supported by the Alpha architecture and is very easy
+to implement).
+
+32-bit-floats are stored in a 64-bit doubleprecision register by simply
+expanding the exponent and mantissa with zeroes. (also supported by the
+architecture)
+
+
+Stackframes:
+
+The calling conventions and the layout of the stack is  explained in detail
+in the documention file: calling.doc
+
+*******************************************************************************/
+
+
+/* additional functions and macros to generate code ***************************/
+
+/* #define BlockPtrOfPC(pc)        block+block_index[pc] */
+#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
+
+
+#ifdef STATISTICS
+#define COUNT_SPILLS count_spills++
+#else
+#define COUNT_SPILLS
+#endif
+
+
+/* gen_nullptr_check(objreg) */
+
+#ifdef SOFTNULLPTRCHECK
+#define gen_nullptr_check(objreg) \
+       if (checknull) {\
+       M_BEQZ((objreg), 0);\
+       mcode_addxnullrefs(mcodeptr);\
+       }
+#else
+#define gen_nullptr_check(objreg)
+#endif
+
+
+/* MCODECHECK(icnt) */
+
+#define MCODECHECK(icnt) \
+       if((mcodeptr+(icnt))>mcodeend)mcodeptr=mcode_increase((u1*)mcodeptr)
+
+/* M_INTMOVE:
+     generates an integer-move from register a to b.
+     if a and b are the same int-register, no code will be generated.
+*/ 
+
+#define M_INTMOVE(a,b) if(a!=b){M_MOV(a,b);}
+
+
+/* M_FLTMOVE:
+    generates a floating-point-move from register a to b.
+    if a and b are the same float-register, no code will be generated
+*/ 
+
+#define M_FLTMOVE(a,b) if(a!=b){M_FMOV(a,b);}
+
+
+/* var_to_reg_xxx:
+    this function generates code to fetch data from a pseudo-register
+    into a real register. 
+    If the pseudo-register has actually been assigned to a real 
+    register, no code will be emitted, since following operations
+    can use this register directly.
+    
+    v: pseudoregister to be fetched from
+    tempregnum: temporary register to be used if v is actually spilled to ram
+
+    return: the register number, where the operand can be found after 
+            fetching (this wil be either tempregnum or the register
+            number allready given to v)
+*/
+
+#define var_to_reg_int(regnr,v,tempnr) { \
+       if ((v)->flags & INMEMORY) \
+               {COUNT_SPILLS;M_LLD(tempnr,REG_SP,8*(v)->regoff);regnr=tempnr;} \
+       else regnr=(v)->regoff; \
+}
+
+
+#define var_to_reg_flt(regnr,v,tempnr) { \
+       if ((v)->flags & INMEMORY) \
+               {COUNT_SPILLS;M_DLD(tempnr,REG_SP,8*(v)->regoff);regnr=tempnr;} \
+       else regnr=(v)->regoff; \
+}
+
+
+/* reg_of_var:
+    This function determines a register, to which the result of an operation
+    should go, when it is ultimatively intended to store the result in
+    pseudoregister v.
+    If v is assigned to an actual register, this register will be returned.
+    Otherwise (when v is spilled) this function returns tempregnum.
+    If not already done, regoff and flags are set in the stack location.
+*/        
+
+static int reg_of_var(stackptr v, int tempregnum)
+{
+       varinfo      *var;
+
+       switch (v->varkind) {
+               case TEMPVAR:
+                       if (!(v->flags & INMEMORY))
+                               return(v->regoff);
+                       break;
+               case STACKVAR:
+                       var = &(interfaces[v->varnum][v->type]);
+                       v->regoff = var->regoff;
+                       if (!(var->flags & INMEMORY))
+                               return(var->regoff);
+                       break;
+               case LOCALVAR:
+                       var = &(locals[v->varnum][v->type]);
+                       v->regoff = var->regoff;
+                       if (!(var->flags & INMEMORY))
+                               return(var->regoff);
+                       break;
+               case ARGVAR:
+                       v->regoff = v->varnum;
+                       if (IS_FLT_DBL_TYPE(v->type)) {
+                               if (v->varnum < fltreg_argnum) {
+                                       v->regoff = argfltregs[v->varnum];
+                                       return(argfltregs[v->varnum]);
+                                       }
+                               }
+                       else
+                               if (v->varnum < intreg_argnum) {
+                                       v->regoff = argintregs[v->varnum];
+                                       return(argintregs[v->varnum]);
+                                       }
+                       v->regoff -= intreg_argnum;
+                       break;
+               }
+       v->flags |= INMEMORY;
+       return tempregnum;
+}
+
+
+/* store_reg_to_var_xxx:
+    This function generates the code to store the result of an operation
+    back into a spilled pseudo-variable.
+    If the pseudo-variable has not been spilled in the first place, this 
+    function will generate nothing.
+    
+    v ............ Pseudovariable
+    tempregnum ... Number of the temporary registers as returned by
+                   reg_of_var.
+*/     
+
+#define store_reg_to_var_int(sptr, tempregnum) {       \
+       if ((sptr)->flags & INMEMORY) {                    \
+               COUNT_SPILLS;                                  \
+               M_LST(tempregnum, REG_SP, 8 * (sptr)->regoff); \
+               }                                              \
+       }
+
+#define store_reg_to_var_flt(sptr, tempregnum) {       \
+       if ((sptr)->flags & INMEMORY) {                    \
+               COUNT_SPILLS;                                  \
+               M_DST(tempregnum, REG_SP, 8 * (sptr)->regoff); \
+               }                                              \
+       }
+
+
+/* NullPointerException handlers and exception handling initialisation        */
+
+typedef struct sigctx_struct {
+
+       long          sc_onstack;           /* sigstack state to restore          */
+       long          sc_mask;              /* signal mask to restore             */
+       long          sc_pc;                /* pc at time of signal               */
+       long          sc_ps;                /* psl to retore                      */
+       long          sc_regs[32];          /* processor regs 0 to 31             */
+       long          sc_ownedfp;           /* fp has been used                   */
+       long          sc_fpregs[32];        /* fp regs 0 to 31                    */
+       unsigned long sc_fpcr;              /* floating point control register    */
+       unsigned long sc_fp_control;        /* software fpcr                      */
+                                           /* rest is unused                     */
+       unsigned long sc_reserved1, sc_reserved2;
+       unsigned long sc_ssize;
+       char          *sc_sbase;
+       unsigned long sc_traparg_a0;
+       unsigned long sc_traparg_a1;
+       unsigned long sc_traparg_a2;
+       unsigned long sc_fp_trap_pc;
+       unsigned long sc_fp_trigger_sum;
+       unsigned long sc_fp_trigger_inst;
+       unsigned long sc_retcode[2];
+} sigctx_struct;
+
+
+/* NullPointerException signal handler for hardware null pointer check */
+
+void catch_NullPointerException(int sig, int code, sigctx_struct *sigctx)
+{
+       sigset_t nsig;
+       int      instr;
+       long     faultaddr;
+
+       /* Reset signal handler - necessary for SysV, does no harm for BSD */
+
+       instr = *((int*)(sigctx->sc_pc));
+       faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f];
+
+       if (faultaddr == 0) {
+               signal(sig, (void*) catch_NullPointerException); /* reinstall handler */
+               sigemptyset(&nsig);
+               sigaddset(&nsig, sig);
+               sigprocmask(SIG_UNBLOCK, &nsig, NULL);           /* unblock signal    */
+               sigctx->sc_regs[REG_ITMP1_XPTR] =
+                                           (long) proto_java_lang_NullPointerException;
+               sigctx->sc_regs[REG_ITMP2_XPC] = sigctx->sc_pc;
+               sigctx->sc_pc = (long) asm_handle_exception;
+               return;
+               }
+       else {
+               faultaddr += (long) ((instr << 16) >> 16);
+               fprintf(stderr, "faulting address: 0x%16lx\n", faultaddr);
+               panic("Stack overflow");
+               }
+}
+
+
+#ifdef __osf__
+
+void init_exceptions(void)
+{
+
+#else /* Linux */
+
+/* Linux on Digital Alpha needs an initialisation of the ieee floating point
+       control for IEEE compliant arithmetic (option -mieee of GCC). Under
+       Digital Unix this is done automatically.
+*/
+
+#include <asm/fpu.h>
+
+extern unsigned long ieee_get_fp_control();
+extern void ieee_set_fp_control(unsigned long fp_control);
+
+void init_exceptions(void)
+{
+/* initialize floating point control */
+
+ieee_set_fp_control(ieee_get_fp_control()
+                    & ~IEEE_TRAP_ENABLE_INV
+                    & ~IEEE_TRAP_ENABLE_DZE
+/*                  & ~IEEE_TRAP_ENABLE_UNF   we dont want underflow */
+                    & ~IEEE_TRAP_ENABLE_OVF);
+#endif
+
+       /* install signal handlers we need to convert to exceptions */
+
+       if (!checknull) {
+
+#if defined(SIGSEGV)
+               signal(SIGSEGV, (void*) catch_NullPointerException);
+#endif
+
+#if defined(SIGBUS)
+               signal(SIGBUS, (void*) catch_NullPointerException);
+#endif
+               }
+}
+
+
+/* function gen_mcode **********************************************************
+
+       generates machine code
+
+*******************************************************************************/
+
+#define        MethodPointer   -8
+#define        FrameSize       -12
+#define     IsSync          -16
+#define     IsLeaf          -20
+#define     IntSave         -24
+#define     FltSave         -28
+#define     ExTableSize     -32
+#define     ExTableStart    -32
+
+#define     ExEntrySize     -32
+#define     ExStartPC       -8
+#define     ExEndPC         -16
+#define     ExHandlerPC     -24
+#define     ExCatchType     -32
+
+void codegen()
+{
+       int  len, s1, s2, s3, d, bbs;
+       s4   a;
+       s4          *mcodeptr;
+       stackptr    src;
+       varinfo     *var;
+       basicblock  *bptr;
+       instruction *iptr;
+       xtable *ex;
+
+       {
+       int p, pa, t, l, r;
+
+       savedregs_num = (isleafmethod) ? 0 : 1;           /* space to save the RA */
+
+       /* space to save used callee saved registers */
+
+       savedregs_num += (savintregcnt - maxsavintreguse);
+       savedregs_num += (savfltregcnt - maxsavfltreguse);
+
+       parentargs_base = maxmemuse + savedregs_num;
+
+#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
+
+       if (checksync && (method->flags & ACC_SYNCHRONIZED))
+               parentargs_base++;
+
+#endif
+
+       /* create method header */
+
+       (void) dseg_addaddress(method);                         /* MethodPointer  */
+       (void) dseg_adds4(parentargs_base * 8);                 /* FrameSize      */
+
+#ifdef USE_THREADS
+
+       /* IsSync contains the offset relative to the stack pointer for the
+          argument of monitor_exit used in the exception handler. Since the
+          offset could be zero and give a wrong meaning of the flag it is
+          offset by one.
+       */
+
+       if (checksync && (method->flags & ACC_SYNCHRONIZED))
+               (void) dseg_adds4((maxmemuse + 1) * 8);             /* IsSync         */
+       else
+
+#endif
+
+       (void) dseg_adds4(0);                                   /* IsSync         */
+                                              
+       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
+       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
+       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
+       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
+
+       /* create exception table */
+
+       for (ex = extable; ex != NULL; ex = ex->down) {
+
+#ifdef LOOP_DEBUG      
+               if (ex->start != NULL)
+                       printf("adding start - %d - ", ex->start->debug_nr);
+               else {
+                       printf("PANIC - start is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->start);
+
+#ifdef LOOP_DEBUG                      
+               if (ex->end != NULL)
+                       printf("adding end - %d - ", ex->end->debug_nr);
+               else {
+                       printf("PANIC - end is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->end);
+
+#ifdef LOOP_DEBUG              
+               if (ex->handler != NULL)
+                       printf("adding handler - %d\n", ex->handler->debug_nr);
+               else {
+                       printf("PANIC - handler is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->handler);
+          
+               (void) dseg_addaddress(ex->catchtype);
+               }
+       
+       /* initialize mcode variables */
+       
+       mcodeptr = (s4*) mcodebase;
+       mcodeend = (s4*) (mcodebase + mcodesize);
+       MCODECHECK(128 + mparamcount);
+
+       /* create stack frame (if necessary) */
+
+       if (parentargs_base)
+               {M_LDA (REG_SP, REG_SP, -parentargs_base * 8);}
+
+       /* save return address and used callee saved registers */
+
+       p = parentargs_base;
+       if (!isleafmethod)
+               {p--;  M_AST (REG_RA, REG_SP, 8*p);}
+       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
+               {p--; M_LST (savintregs[r], REG_SP, 8 * p);}
+       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
+               {p--; M_DST (savfltregs[r], REG_SP, 8 * p);}
+
+       /* save monitorenter argument */
+
+#ifdef USE_THREADS
+       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+               if (method->flags & ACC_STATIC) {
+                       p = dseg_addaddress (class);
+                       M_ALD(REG_ITMP1, REG_PV, p);
+                       M_AST(REG_ITMP1, REG_SP, 8 * maxmemuse);
+                       } 
+               else {
+                       M_AST (argintregs[0], REG_SP, 8 * maxmemuse);
+                       }
+               }                       
+#endif
+
+       /* copy argument registers to stack and call trace function with pointer
+          to arguments on stack. ToDo: save floating point registers !!!!!!!!!
+       */
+
+       if (runverbose) {
+               M_LDA (REG_SP, REG_SP, -(14*8));
+               M_AST(REG_RA, REG_SP, 1*8);
+
+               M_LST(argintregs[0], REG_SP,  2*8);
+               M_LST(argintregs[1], REG_SP,  3*8);
+               M_LST(argintregs[2], REG_SP,  4*8);
+               M_LST(argintregs[3], REG_SP,  5*8);
+               M_LST(argintregs[4], REG_SP,  6*8);
+               M_LST(argintregs[5], REG_SP,  7*8);
+
+               M_DST(argfltregs[0], REG_SP,  8*8);
+               M_DST(argfltregs[1], REG_SP,  9*8);
+               M_DST(argfltregs[2], REG_SP, 10*8);
+               M_DST(argfltregs[3], REG_SP, 11*8);
+               M_DST(argfltregs[4], REG_SP, 12*8);
+               M_DST(argfltregs[5], REG_SP, 13*8);
+
+               p = dseg_addaddress (method);
+               M_ALD(REG_ITMP1, REG_PV, p);
+               M_AST(REG_ITMP1, REG_SP, 0);
+               p = dseg_addaddress ((void*) (builtin_trace_args));
+               M_ALD(REG_PV, REG_PV, p);
+               M_JSR(REG_RA, REG_PV);
+               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+               M_ALD(REG_RA, REG_SP, 1*8);
+
+               M_LLD(argintregs[0], REG_SP,  2*8);
+               M_LLD(argintregs[1], REG_SP,  3*8);
+               M_LLD(argintregs[2], REG_SP,  4*8);
+               M_LLD(argintregs[3], REG_SP,  5*8);
+               M_LLD(argintregs[4], REG_SP,  6*8);
+               M_LLD(argintregs[5], REG_SP,  7*8);
+
+               M_DLD(argfltregs[0], REG_SP,  8*8);
+               M_DLD(argfltregs[1], REG_SP,  9*8);
+               M_DLD(argfltregs[2], REG_SP, 10*8);
+               M_DLD(argfltregs[3], REG_SP, 11*8);
+               M_DLD(argfltregs[4], REG_SP, 12*8);
+               M_DLD(argfltregs[5], REG_SP, 13*8);
+
+               M_LDA (REG_SP, REG_SP, 14*8);
+               }
+
+       /* take arguments out of register or stack frame */
+
+       for (p = 0, l = 0; p < mparamcount; p++) {
+               t = mparamtypes[p];
+               var = &(locals[l][t]);
+               l++;
+               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
+                       l++;
+               if (var->type < 0)
+                       continue;
+               r = var->regoff; 
+               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
+                       if (p < INT_ARG_CNT) {                   /* register arguments    */
+                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
+                                       {M_INTMOVE (argintregs[p], r);}
+                               else                                 /* reg arg -> spilled    */
+                                       M_LST (argintregs[p], REG_SP, 8 * r);
+                               }
+                       else {                                   /* stack arguments       */
+                               pa = p - INT_ARG_CNT;
+                               if (!(var->flags & INMEMORY))        /* stack arg -> register */ 
+                                       M_LLD (r, REG_SP, 8 * (parentargs_base + pa));
+                               else {                               /* stack arg -> spilled  */
+                                       M_LLD (REG_ITMP1, REG_SP, 8 * (parentargs_base + pa));
+                                       M_LST (REG_ITMP1, REG_SP, 8 * r);
+                                       }
+                               }
+                       }
+               else {                                       /* floating args         */   
+                       if (p < FLT_ARG_CNT) {                   /* register arguments    */
+                               if (!(var->flags & INMEMORY))        /* reg arg -> register   */
+                                       {M_FLTMOVE (argfltregs[p], r);}
+                               else                                             /* reg arg -> spilled    */
+                                       M_DST (argfltregs[p], REG_SP, 8 * r);
+                               }
+                       else {                                   /* stack arguments       */
+                               pa = p - FLT_ARG_CNT;
+                               if (!(var->flags & INMEMORY))        /* stack-arg -> register */
+                                       M_DLD (r, REG_SP, 8 * (parentargs_base + pa) );
+                               else {                               /* stack-arg -> spilled  */
+                                       M_DLD (REG_FTMP1, REG_SP, 8 * (parentargs_base + pa));
+                                       M_DST (REG_FTMP1, REG_SP, 8 * r);
+                                       }
+                               }
+                       }
+               }  /* end for */
+
+       /* call trace function */
+
+#if 0
+       if (runverbose && !isleafmethod) {
+               M_LDA (REG_SP, REG_SP, -8);
+               p = dseg_addaddress (method);
+               M_ALD(REG_ITMP1, REG_PV, p);
+               M_AST(REG_ITMP1, REG_SP, 0);
+               p = dseg_addaddress ((void*) (builtin_trace_args));
+               M_ALD(REG_PV, REG_PV, p);
+               M_JSR(REG_RA, REG_PV);
+               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+               M_LDA(REG_SP, REG_SP, 8);
+               }
+#endif
+
+       /* call monitorenter function */
+
+#ifdef USE_THREADS
+       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+               p = dseg_addaddress ((void*) (builtin_monitorenter));
+               M_ALD(REG_PV, REG_PV, p);
+               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
+               M_JSR(REG_RA, REG_PV);
+               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+               }                       
+#endif
+       }
+
+       /* end of header generation */
+
+       /* walk through all basic blocks */
+       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
+
+               bptr -> mpc = (int)((u1*) mcodeptr - mcodebase);
+
+               if (bptr->flags >= BBREACHED) {
+
+               /* branch resolving */
+
+               {
+               branchref *brefs;
+               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
+                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
+                                         brefs->branchpos, bptr->mpc);
+                       }
+               }
+
+               /* copy interface registers to their destination */
+
+               src = bptr->instack;
+               len = bptr->indepth;
+               MCODECHECK(64+len);
+               while (src != NULL) {
+                       len--;
+                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
+                               d = reg_of_var(src, REG_ITMP1);
+                               M_INTMOVE(REG_ITMP1, d);
+                               store_reg_to_var_int(src, d);
+                               }
+                       else {
+                               d = reg_of_var(src, REG_IFTMP);
+                               if ((src->varkind != STACKVAR)) {
+                                       s2 = src->type;
+                                       if (IS_FLT_DBL_TYPE(s2)) {
+                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                                       s1 = interfaces[len][s2].regoff;
+                                                       M_FLTMOVE(s1,d);
+                                                       }
+                                               else {
+                                                       M_DLD(d, REG_SP, 8 * interfaces[len][s2].regoff);
+                                                       }
+                                               store_reg_to_var_flt(src, d);
+                                               }
+                                       else {
+                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                                       s1 = interfaces[len][s2].regoff;
+                                                       M_INTMOVE(s1,d);
+                                                       }
+                                               else {
+                                                       M_LLD(d, REG_SP, 8 * interfaces[len][s2].regoff);
+                                                       }
+                                               store_reg_to_var_int(src, d);
+                                               }
+                                       }
+                               }
+                       src = src->prev;
+                       }
+
+               /* walk through all instructions */
+               
+               src = bptr->instack;
+               len = bptr->icount;
+               for (iptr = bptr->iinstr;
+                   len > 0;
+                   src = iptr->dst, len--, iptr++) {
+
+       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
+       switch (iptr->opc) {
+
+               case ICMD_NOP:        /* ...  ==> ...                                 */
+                       break;
+
+               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_BEQZ(s1, 0);
+                       codegen_addxnullrefs(mcodeptr);
+                       break;
+
+               /* constant operations ************************************************/
+
+#define ICONST(r,c) if(((c)>=-32768)&&((c)<= 32767)){M_LDA(r,REG_ZERO,c);} \
+                    else{a=dseg_adds4(c);M_ILD(r,REG_PV,a);}
+
+#define LCONST(r,c) if(((c)>=-32768)&&((c)<= 32767)){M_LDA(r,REG_ZERO,c);} \
+                    else{a=dseg_adds8(c);M_LLD(r,REG_PV,a);}
+
+               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.i = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       ICONST(d, iptr->val.i);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.l = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       LCONST(d, iptr->val.l);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.f = constant                    */
+
+                       d = reg_of_var (iptr->dst, REG_FTMP1);
+                       a = dseg_addfloat (iptr->val.f);
+                       M_FLD(d, REG_PV, a);
+                       store_reg_to_var_flt (iptr->dst, d);
+                       break;
+                       
+               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.d = constant                    */
+
+                       d = reg_of_var (iptr->dst, REG_FTMP1);
+                       a = dseg_adddouble (iptr->val.d);
+                       M_DLD(d, REG_PV, a);
+                       store_reg_to_var_flt (iptr->dst, d);
+                       break;
+
+               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.a = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->val.a) {
+                               a = dseg_addaddress (iptr->val.a);
+                               M_ALD(d, REG_PV, a);
+                               }
+                       else {
+                               M_INTMOVE(REG_ZERO, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               /* load/store operations **********************************************/
+
+               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_LLOAD:      /* op1 = local variable                         */
+               case ICMD_ALOAD:
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1))
+                               break;
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (var->flags & INMEMORY)
+                               M_LLD(d, REG_SP, 8 * var->regoff);
+                       else
+                               {M_INTMOVE(var->regoff,d);}
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_DLOAD:      /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1))
+                               break;
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (var->flags & INMEMORY)
+                               M_DLD(d, REG_SP, 8 * var->regoff);
+                       else
+                               {M_FLTMOVE(var->regoff,d);}
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+
+               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
+               case ICMD_LSTORE:     /* op1 = local variable                         */
+               case ICMD_ASTORE:
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1))
+                               break;
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               M_LST(s1, REG_SP, 8 * var->regoff);
+                               }
+                       else {
+                               var_to_reg_int(s1, src, var->regoff);
+                               M_INTMOVE(s1, var->regoff);
+                               }
+                       break;
+
+               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
+               case ICMD_DSTORE:     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1))
+                               break;
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               M_DST(s1, REG_SP, 8 * var->regoff);
+                               }
+                       else {
+                               var_to_reg_flt(s1, src, var->regoff);
+                               M_FLTMOVE(s1, var->regoff);
+                               }
+                       break;
+
+
+               /* pop/dup/swap operations ********************************************/
+
+               /* attention: double and longs are only one entry in CACAO ICMDs      */
+
+               case ICMD_POP:        /* ..., value  ==> ...                          */
+               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
+                       break;
+
+#define M_COPY(from,to) \
+                       d = reg_of_var(to, REG_IFTMP); \
+                       if ((from->regoff != to->regoff) || \
+                           ((from->flags ^ to->flags) & INMEMORY)) { \
+                               if (IS_FLT_DBL_TYPE(from->type)) { \
+                                       var_to_reg_flt(s1, from, d); \
+                                       M_FLTMOVE(s1,d); \
+                                       store_reg_to_var_flt(to, d); \
+                                       }\
+                               else { \
+                                       var_to_reg_int(s1, from, d); \
+                                       M_INTMOVE(s1,d); \
+                                       store_reg_to_var_int(to, d); \
+                                       }\
+                               }
+
+               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
+                       M_COPY(src, iptr->dst);
+                       break;
+
+               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
+
+                       M_COPY(src,       iptr->dst->prev->prev);
+
+               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
+
+                       M_COPY(src,       iptr->dst);
+                       M_COPY(src->prev, iptr->dst->prev);
+                       break;
+
+               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
+
+                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
+
+               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
+
+                       M_COPY(src,             iptr->dst);
+                       M_COPY(src->prev,       iptr->dst->prev);
+                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
+                       M_COPY(src, iptr->dst->prev->prev->prev);
+                       break;
+
+               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
+
+                       M_COPY(src,                   iptr->dst);
+                       M_COPY(src->prev,             iptr->dst->prev);
+                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
+                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
+                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
+                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
+                       break;
+
+               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
+
+                       M_COPY(src, iptr->dst->prev);
+                       M_COPY(src->prev, iptr->dst);
+                       break;
+
+
+               /* integer operations *************************************************/
+
+               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
+
+                       var_to_reg_int(s1, src, REG_ITMP1); 
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_ISUB(REG_ZERO, s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_LSUB(REG_ZERO, s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_INTMOVE(s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_IADD(s1, REG_ZERO, d );
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_BSEXT(s1, d);
+                               }
+                       else {
+                               M_SLL_IMM(s1, 56, d);
+                               M_SRA_IMM( d, 56, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+            M_CZEXT(s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_SSEXT(s1, d);
+                               }
+                       else {
+                               M_SLL_IMM(s1, 48, d);
+                               M_SRA_IMM( d, 48, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_IADD(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_IADD_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_IADD(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_LADD(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_LADD_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_LADD(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_ISUB(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_ISUB_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_ISUB(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_LSUB(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_LSUB_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_LSUB(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_IMUL(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_IMUL_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_IMUL(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_LMUL (s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LMULCONST:  /* ..., value  ==> ..., value * constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_LMUL_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_LMUL(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value << constant       */
+               case ICMD_LDIVPOW2:   /* val.i = constant                             */
+                                     
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->val.i <= 15) {
+                               M_LDA(REG_ITMP2, s1, (1 << iptr->val.i) -1);
+                               M_CMOVGE(s1, s1, REG_ITMP2);
+                               }
+                       else {
+                               M_SRA_IMM(s1, 63, REG_ITMP2);
+                               M_SRL_IMM(REG_ITMP2, 64 - iptr->val.i, REG_ITMP2);
+                               M_LADD(s1, REG_ITMP2, REG_ITMP2);
+                               }
+                       M_SRA_IMM(REG_ITMP2, iptr->val.i, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_AND_IMM(s2, 0x1f, REG_ITMP3);
+                       M_SLL(s1, REG_ITMP3, d);
+                       M_IADD(d, REG_ZERO, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SLL_IMM(s1, iptr->val.i & 0x1f, d);
+                       M_IADD(d, REG_ZERO, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_AND_IMM(s2, 0x1f, REG_ITMP3);
+                       M_SRA(s1, REG_ITMP3, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRA_IMM(s1, iptr->val.i & 0x1f, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_AND_IMM(s2, 0x1f, REG_ITMP2);
+            M_IZEXT(s1, d);
+                       M_SRL(d, REG_ITMP2, d);
+                       M_IADD(d, REG_ZERO, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+            M_IZEXT(s1, d);
+                       M_SRL_IMM(d, iptr->val.i & 0x1f, d);
+                       M_IADD(d, REG_ZERO, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SLL(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSHLCONST:  /* ..., value  ==> ..., value << constant       */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SLL_IMM(s1, iptr->val.i & 0x3f, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRA(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LSHRCONST:  /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRA_IMM(s1, iptr->val.i & 0x3f, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRL(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_SRL_IMM(s1, iptr->val.i & 0x3f, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
+               case ICMD_LAND:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_AND(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_AND_IMM(s1, iptr->val.i, d);
+                               }
+                       else if (iptr->val.i == 0xffff) {
+                               M_CZEXT(s1, d);
+                               }
+                       else if (iptr->val.i == 0xffffff) {
+                               M_ZAPNOT_IMM(s1, 0x07, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_AND(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                               }
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_AND_IMM(s1, iptr->val.i, d);
+                               M_BGEZ(s1, 3);
+                               M_ISUB(REG_ZERO, s1, d);
+                               M_AND_IMM(d, iptr->val.i, d);
+                               }
+                       else if (iptr->val.i == 0xffff) {
+                               M_CZEXT(s1, d);
+                               M_BGEZ(s1, 3);
+                               M_ISUB(REG_ZERO, s1, d);
+                               M_CZEXT(d, d);
+                               }
+                       else if (iptr->val.i == 0xffffff) {
+                               M_ZAPNOT_IMM(s1, 0x07, d);
+                               M_BGEZ(s1, 3);
+                               M_ISUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x07, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_AND(s1, REG_ITMP2, d);
+                               M_BGEZ(s1, 3);
+                               M_ISUB(REG_ZERO, s1, d);
+                               M_AND(d, REG_ITMP2, d);
+                               }
+                       M_ISUB(REG_ZERO, d, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IREM0X10001:  /* ..., value  ==> ..., value % 0x100001      */
+               
+/*          b = value & 0xffff;
+                       a = value >> 16;
+                       a = ((b - a) & 0xffff) + (b < a);
+*/
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP3);
+                               s1 = REG_ITMP3;
+                               }
+                       M_BLTZ(s1, 7);
+            M_CZEXT(s1, REG_ITMP2);
+                       M_SRA_IMM(s1, 16, d);
+                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
+                       M_ISUB(REG_ITMP2, d, d);
+            M_CZEXT(d, d);
+                       M_IADD(d, REG_ITMP1, d);
+                       M_BR(11 + (s1 == REG_ITMP1));
+                       M_ISUB(REG_ZERO, s1, REG_ITMP1);
+            M_CZEXT(REG_ITMP1, REG_ITMP2);
+                       M_SRA_IMM(REG_ITMP1, 16, d);
+                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
+                       M_ISUB(REG_ITMP2, d, d);
+            M_CZEXT(d, d);
+                       M_IADD(d, REG_ITMP1, d);
+                       M_ISUB(REG_ZERO, d, d);
+                       if (s1 == REG_ITMP1) {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               }
+                       M_SLL_IMM(s1, 33, REG_ITMP2);
+                       M_CMPEQ(REG_ITMP2, REG_ZERO, REG_ITMP2);
+                       M_ISUB(d, REG_ITMP2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_AND_IMM(s1, iptr->val.l, d);
+                               }
+                       else if (iptr->val.l == 0xffffL) {
+                               M_CZEXT(s1, d);
+                               }
+                       else if (iptr->val.l == 0xffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x07, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffL) {
+                               M_IZEXT(s1, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x1f, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x3f, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x7f, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_AND(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LREMPOW2:   /* ..., value  ==> ..., value % constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                               }
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_AND_IMM(s1, iptr->val.l, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_AND_IMM(d, iptr->val.l, d);
+                               }
+                       else if (iptr->val.l == 0xffffL) {
+                               M_CZEXT(s1, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_CZEXT(d, d);
+                               }
+                       else if (iptr->val.l == 0xffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x07, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x07, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffL) {
+                               M_IZEXT(s1, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_IZEXT(d, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x1f, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x1f, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x3f, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x3f, d);
+                               }
+                       else if (iptr->val.l == 0xffffffffffffffL) {
+                               M_ZAPNOT_IMM(s1, 0x7f, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_ZAPNOT_IMM(d, 0x7f, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_AND(s1, REG_ITMP2, d);
+                               M_BGEZ(s1, 3);
+                               M_LSUB(REG_ZERO, s1, d);
+                               M_AND(d, REG_ITMP2, d);
+                               }
+                       M_LSUB(REG_ZERO, d, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LREM0X10001:/* ..., value  ==> ..., value % 0x10001         */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP3);
+                               s1 = REG_ITMP3;
+                               }
+                       M_CZEXT(s1, REG_ITMP2);
+                       M_SRA_IMM(s1, 16, d);
+                       M_CMPLT(REG_ITMP2, d, REG_ITMP1);
+                       M_LSUB(REG_ITMP2, d, d);
+            M_CZEXT(d, d);
+                       M_LADD(d, REG_ITMP1, d);
+                       M_LDA(REG_ITMP2, REG_ZERO, -1);
+                       M_SRL_IMM(REG_ITMP2, 33, REG_ITMP2);
+                       if (s1 == REG_ITMP1) {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               }
+                       M_CMPULT(s1, REG_ITMP2, REG_ITMP2);
+                       M_BNEZ(REG_ITMP2, 11);
+                       M_LDA(d, REG_ZERO, -257);
+                       M_ZAPNOT_IMM(d, 0xcd, d);
+                       M_LSUB(REG_ZERO, s1, REG_ITMP2);
+                       M_CMOVGE(s1, s1, REG_ITMP2);
+                       M_UMULH(REG_ITMP2, d, REG_ITMP2);
+                       M_SRL_IMM(REG_ITMP2, 16, REG_ITMP2);
+                       M_LSUB(REG_ZERO, REG_ITMP2, d);
+                       M_CMOVGE(s1, REG_ITMP2, d);
+                       M_SLL_IMM(d, 16, REG_ITMP2);
+                       M_LADD(d, REG_ITMP2, d);
+                       M_LSUB(s1, d, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
+               case ICMD_LOR:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_OR( s1,s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_OR_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_OR(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LORCONST:   /* ..., value  ==> ..., value | constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_OR_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_OR(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
+               case ICMD_LXOR:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_XOR(s1, s2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_XOR_IMM(s1, iptr->val.i, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, iptr->val.i);
+                               M_XOR(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
+                                     /* val.l = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+                               M_XOR_IMM(s1, iptr->val.l, d);
+                               }
+                       else {
+                               LCONST(REG_ITMP2, iptr->val.l);
+                               M_XOR(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_LCMP:       /* ..., val1, val2  ==> ..., val1 cmp val2      */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       M_CMPLT(s1, s2, REG_ITMP3);
+                       M_CMPLT(s2, s1, REG_ITMP1);
+                       M_LSUB (REG_ITMP1, REG_ITMP3, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
+                                     /* op1 = variable, val.i = constant             */
+
+                       var = &(locals[iptr->op1][TYPE_INT]);
+                       if (var->flags & INMEMORY) {
+                               s1 = REG_ITMP1;
+                               M_LLD(s1, REG_SP, 8 * var->regoff);
+                               }
+                       else
+                               s1 = var->regoff;
+                       if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+                               M_IADD_IMM(s1, iptr->val.i, s1);
+                               }
+                       else if ((iptr->val.i > -256) && (iptr->val.i < 0)) {
+                               M_ISUB_IMM(s1, (-iptr->val.i), s1);
+                               }
+                       else {
+                               M_LDA (s1, s1, iptr->val.i);
+                               M_IADD(s1, REG_ZERO, s1);
+                               }
+                       if (var->flags & INMEMORY)
+                               M_LST(s1, REG_SP, 8 * var->regoff);
+                       break;
+
+
+               /* floating operations ************************************************/
+
+               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       M_FMOVN(s1, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       M_FMOVN(s1, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FADD(s1, s2, d);
+                               }
+                       else {
+                               M_FADDS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DADD(s1, s2, d);
+                               }
+                       else {
+                               M_DADDS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FSUB(s1, s2, d);
+                               }
+                       else {
+                               M_FSUBS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DSUB(s1, s2, d);
+                               }
+                       else {
+                               M_DSUBS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FMUL(s1, s2, d);
+                               }
+                       else {
+                               M_FMULS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 *** val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DMUL(s1, s2, d);
+                               }
+                       else {
+                               M_DMULS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FDIV(s1, s2, d);
+                               }
+                       else {
+                               M_FDIVS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DDIV(s1, s2, d);
+                               }
+                       else {
+                               M_DDIVS(s1, s2, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+               
+               case ICMD_FREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_FDIV(s1,s2, REG_FTMP3);
+                               M_CVTDL_C(REG_FTMP3, REG_FTMP3); /* round to integer */
+                               M_CVTLF(REG_FTMP3, REG_FTMP3);
+                               M_FMUL(REG_FTMP3, s2, REG_FTMP3);
+                               M_FSUB(s1, REG_FTMP3, d);
+                               }
+                       else {
+                               M_FDIVS(s1,s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_CVTDL_CS(REG_FTMP3, REG_FTMP3); /* round to integer */
+                               M_TRAPB;
+                               M_CVTLF(REG_FTMP3, REG_FTMP3);
+                               M_FMULS(REG_FTMP3, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_FSUBS(s1, REG_FTMP3, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                   break;
+
+               case ICMD_DREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_DDIV(s1,s2, REG_FTMP3);
+                               M_CVTDL_C(REG_FTMP3, REG_FTMP3); /* round to integer */
+                               M_CVTLD(REG_FTMP3, REG_FTMP3);
+                               M_DMUL(REG_FTMP3, s2, REG_FTMP3);
+                               M_DSUB(s1, REG_FTMP3, d);
+                               }
+                       else {
+                               M_DDIVS(s1,s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_CVTDL_CS(REG_FTMP3, REG_FTMP3); /* round to integer */
+                               M_TRAPB;
+                               M_CVTLD(REG_FTMP3, REG_FTMP3);
+                               M_DMULS(REG_FTMP3, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_DSUBS(s1, REG_FTMP3, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                   break;
+
+               case ICMD_I2F:       /* ..., value  ==> ..., (float) value            */
+               case ICMD_L2F:
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       a = dseg_adddouble(0.0);
+                       M_LST (s1, REG_PV, a);
+                       M_DLD (d, REG_PV, a);
+                       M_CVTLF(d, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_I2D:       /* ..., value  ==> ..., (double) value           */
+               case ICMD_L2D:
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       a = dseg_adddouble(0.0);
+                       M_LST (s1, REG_PV, a);
+                       M_DLD (d, REG_PV, a);
+                       M_CVTLD(d, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+                       
+               case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
+               case ICMD_D2I:
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       a = dseg_adddouble(0.0);
+                       if (opt_noieee) {
+                               M_CVTDL_C(s1, REG_FTMP1);
+                               M_CVTLI(REG_FTMP1, REG_FTMP2);
+                               }
+                       else {
+                               M_CVTDL_CS(s1, REG_FTMP1);
+                               M_TRAPB;
+                               M_CVTLIS(REG_FTMP1, REG_FTMP2);
+                               M_TRAPB;
+                               }
+                       M_DST (REG_FTMP1, REG_PV, a);
+                       M_ILD (d, REG_PV, a);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+               
+               case ICMD_F2L:       /* ..., value  ==> ..., (long) value             */
+               case ICMD_D2L:
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       a = dseg_adddouble(0.0);
+                       if (opt_noieee) {
+                               M_CVTDL_C(s1, REG_FTMP1);
+                               }
+                       else {
+                               M_CVTDL_CS(s1, REG_FTMP1);
+                               M_TRAPB;
+                               }
+                       M_DST (REG_FTMP1, REG_PV, a);
+                       M_LLD (d, REG_PV, a);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       M_FLTMOVE(s1, d);
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+                                       
+               case ICMD_D2F:       /* ..., value  ==> ..., (double) value           */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (opt_noieee) {
+                               M_CVTDF(s1, d);
+                               }
+                       else {
+                               M_CVTDFS(s1, d);
+                               M_TRAPB;
+                               }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+               
+               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
+               case ICMD_DCMPL:
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (opt_noieee) {
+                               M_LSUB_IMM(REG_ZERO, 1, d);
+                               M_FCMPEQ(s1, s2, REG_FTMP3);
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instructions */
+                               M_CLR   (d);
+                               M_FCMPLT(s2, s1, REG_FTMP3);
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_LADD_IMM(REG_ZERO, 1, d);
+                               }
+                       else {
+                               M_LSUB_IMM(REG_ZERO, 1, d);
+                               M_FCMPEQS(s1, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instructions */
+                               M_CLR   (d);
+                               M_FCMPLTS(s2, s1, REG_FTMP3);
+                               M_TRAPB;
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_LADD_IMM(REG_ZERO, 1, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+                       
+               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
+               case ICMD_DCMPG:
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (opt_noieee) {
+                               M_LADD_IMM(REG_ZERO, 1, d);
+                               M_FCMPEQ(s1, s2, REG_FTMP3);
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_CLR   (d);
+                               M_FCMPLT(s1, s2, REG_FTMP3);
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_LSUB_IMM(REG_ZERO, 1, d);
+                               }
+                       else {
+                               M_LADD_IMM(REG_ZERO, 1, d);
+                               M_FCMPEQS(s1, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_CLR   (d);
+                               M_FCMPLTS(s1, s2, REG_FTMP3);
+                               M_TRAPB;
+                               M_FBEQZ (REG_FTMP3, 1);        /* jump over next instruction  */
+                               M_LSUB_IMM(REG_ZERO, 1, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               /* memory operations **************************************************/
+
+                       /* #define gen_bound_check \
+                       if (checkbounds) {\
+                               M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));\
+                               M_CMPULT(s2, REG_ITMP3, REG_ITMP3);\
+                               M_BEQZ(REG_ITMP3, 0);\
+                               codegen_addxboundrefs(mcodeptr);\
+                               }
+                       */
+
+#define gen_bound_check \
+            if (checkbounds) { \
+                               M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));\
+                               M_CMPULT(s2, REG_ITMP3, REG_ITMP3);\
+                               M_BEQZ(REG_ITMP3, 0);\
+                               codegen_addxboundrefs(mcodeptr); \
+                }
+
+               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., length              */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       gen_nullptr_check(s1);
+                       M_ILD(d, s1, OFFSET(java_arrayheader, size));
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       M_SAADDQ(s2, s1, REG_ITMP1);
+                       M_ALD( d, REG_ITMP1, OFFSET(java_objectarray, data[0]));
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       M_S8ADDQ(s2, s1, REG_ITMP1);
+                       M_LLD(d, REG_ITMP1, OFFSET(java_longarray, data[0]));
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                 
+                       M_S4ADDQ(s2, s1, REG_ITMP1);
+                       M_ILD(d, REG_ITMP1, OFFSET(java_intarray, data[0]));
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       M_S4ADDQ(s2, s1, REG_ITMP1);
+                       M_FLD(d, REG_ITMP1, OFFSET(java_floatarray, data[0]));
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       M_S8ADDQ(s2, s1, REG_ITMP1);
+                       M_DLD(d, REG_ITMP1, OFFSET(java_doublearray, data[0]));
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_SLDU(d, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               }
+                       else {
+                               M_LADD (s2, s1, REG_ITMP1);
+                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               M_EXTWL(REG_ITMP2, REG_ITMP1, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;                  
+
+               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_SLDU( d, REG_ITMP1, OFFSET (java_shortarray, data[0]));
+                               M_SSEXT(d, d);
+                               }
+                       else {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_shortarray, data[0]));
+                               M_LDA(REG_ITMP1, REG_ITMP1, OFFSET(java_shortarray, data[0])+2);
+                               M_EXTQH(REG_ITMP2, REG_ITMP1, d);
+                               M_SRA_IMM(d, 48, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       if (has_ext_instr_set) {
+                               M_LADD   (s2, s1, REG_ITMP1);
+                               M_BLDU   (d, REG_ITMP1, OFFSET (java_bytearray, data[0]));
+                               M_BSEXT  (d, d);
+                               }
+                       else {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_bytearray, data[0]));
+                               M_LDA(REG_ITMP1, REG_ITMP1, OFFSET(java_bytearray, data[0])+1);
+                               M_EXTQH(REG_ITMP2, REG_ITMP1, d);
+                               M_SRA_IMM(d, 56, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_AASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       M_SAADDQ(s2, s1, REG_ITMP1);
+                       M_AST   (s3, REG_ITMP1, OFFSET(java_objectarray, data[0]));
+                       break;
+
+               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       M_S8ADDQ(s2, s1, REG_ITMP1);
+                       M_LST   (s3, REG_ITMP1, OFFSET(java_longarray, data[0]));
+                       break;
+
+               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       M_S4ADDQ(s2, s1, REG_ITMP1);
+                       M_IST   (s3, REG_ITMP1, OFFSET(java_intarray, data[0]));
+                       break;
+
+               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_flt(s3, src, REG_FTMP3);
+                       M_S4ADDQ(s2, s1, REG_ITMP1);
+                       M_FST   (s3, REG_ITMP1, OFFSET(java_floatarray, data[0]));
+                       break;
+
+               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_flt(s3, src, REG_FTMP3);
+                       M_S8ADDQ(s2, s1, REG_ITMP1);
+                       M_DST   (s3, REG_ITMP1, OFFSET(java_doublearray, data[0]));
+                       break;
+
+               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_SST (s3, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               }
+                       else {
+                               M_LADD (s2, s1, REG_ITMP1);
+                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_chararray, data[0]));
+                               M_INSWL(s3, REG_ITMP1, REG_ITMP3);
+                               M_MSKWL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
+                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
+                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
+                               }
+                       break;
+
+               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_LADD(s2, REG_ITMP1, REG_ITMP1);
+                               M_SST (s3, REG_ITMP1, OFFSET(java_shortarray, data[0]));
+                               }
+                       else {
+                               M_LADD (s2, s1, REG_ITMP1);
+                               M_LADD (s2, REG_ITMP1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_shortarray, data[0]));
+                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_shortarray, data[0]));
+                               M_INSWL(s3, REG_ITMP1, REG_ITMP3);
+                               M_MSKWL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
+                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
+                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
+                               }
+                       break;
+
+               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                               }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       if (has_ext_instr_set) {
+                               M_LADD(s2, s1, REG_ITMP1);
+                               M_BST (s3, REG_ITMP1, OFFSET(java_bytearray, data[0]));
+                               }
+                       else {
+                               M_LADD (s2, s1, REG_ITMP1);
+                               M_LLD_U(REG_ITMP2, REG_ITMP1, OFFSET(java_bytearray, data[0]));
+                               M_LDA  (REG_ITMP1, REG_ITMP1, OFFSET(java_bytearray, data[0]));
+                               M_INSBL(s3, REG_ITMP1, REG_ITMP3);
+                               M_MSKBL(REG_ITMP2, REG_ITMP1, REG_ITMP2);
+                               M_OR   (REG_ITMP2, REG_ITMP3, REG_ITMP2);
+                               M_LST_U(REG_ITMP2, REG_ITMP1, 0);
+                               }
+                       break;
+
+
+               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
+                                     /* op1 = type, val.a = field address            */
+
+                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
+                       M_ALD(REG_ITMP1, REG_PV, a);
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       M_IST(s2, REG_ITMP1, 0);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       M_LST(s2, REG_ITMP1, 0);
+                                       break;
+                               case TYPE_ADR:
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       M_AST(s2, REG_ITMP1, 0);
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_flt(s2, src, REG_FTMP2);
+                                       M_FST(s2, REG_ITMP1, 0);
+                                       break;
+                               case TYPE_DBL:
+                                       var_to_reg_flt(s2, src, REG_FTMP2);
+                                       M_DST(s2, REG_ITMP1, 0);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
+                                     /* op1 = type, val.a = field address            */
+
+                       a = dseg_addaddress (&(((fieldinfo *)(iptr->val.a))->value));
+                       M_ALD(REG_ITMP1, REG_PV, a);
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       M_ILD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_LNG:
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       M_LLD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_ADR:
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       M_ALD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_FLT:
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       M_FLD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               case TYPE_DBL:                          
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       M_DLD(d, REG_ITMP1, 0);
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+
+               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
+                                     /* op1 = type, val.i = field offset             */
+
+                       a = ((fieldinfo *)(iptr->val.a))->offset;
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       M_IST(s2, s1, a);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       M_LST(s2, s1, a);
+                                       break;
+                               case TYPE_ADR:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       M_AST(s2, s1, a);
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_flt(s2, src, REG_FTMP2);
+                                       gen_nullptr_check(s1);
+                                       M_FST(s2, s1, a);
+                                       break;
+                               case TYPE_DBL:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_flt(s2, src, REG_FTMP2);
+                                       gen_nullptr_check(s1);
+                                       M_DST(s2, s1, a);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
+                                     /* op1 = type, val.i = field offset             */
+
+                       a = ((fieldinfo *)(iptr->val.a))->offset;
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       gen_nullptr_check(s1);
+                                       M_ILD(d, s1, a);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       gen_nullptr_check(s1);
+                                       M_LLD(d, s1, a);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_ADR:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                                       gen_nullptr_check(s1);
+                                       M_ALD(d, s1, a);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       M_FLD(d, s1, a);
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               case TYPE_DBL:                          
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       M_DLD(d, s1, a);
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+
+               /* branch operations **************************************************/
+
+#define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}}
+
+               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_INTMOVE(s1, REG_ITMP1_XPTR);
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP2, REG_PV, a);
+                       M_JMP(REG_ITMP2_XPC, REG_ITMP2);
+                       M_NOP;              /* nop ensures that XPC is less than the end */
+                                           /* of basic block                            */
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_GOTO:         /* ... ==> ...                                */
+                                       /* op1 = target JavaVM pc                     */
+                       M_BR(0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_JSR:          /* ... ==> ...                                */
+                                       /* op1 = target JavaVM pc                     */
+
+                       M_BSR(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+                       
+               case ICMD_RET:          /* ... ==> ...                                */
+                                       /* op1 = local variable                       */
+
+                       var = &(locals[iptr->op1][TYPE_ADR]);
+                       if (var->flags & INMEMORY) {
+                               M_ALD(REG_ITMP1, REG_SP, 8 * var->regoff);
+                               M_RET(REG_ZERO, REG_ITMP1);
+                               }
+                       else
+                               M_RET(REG_ZERO, var->regoff);
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_IFNULL:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_BEQZ(s1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_BNEZ(s1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFEQ:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BEQZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPEQ_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFLT:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BLTZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPLT_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFLE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BLEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPLE_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFNE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BNEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPEQ_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFGT:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BGTZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPLE_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFGE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.i == 0) {
+                               M_BGEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.i > 0) && (iptr->val.i <= 255)) {
+                                       M_CMPLT_IMM(s1, iptr->val.i, REG_ITMP1);
+                                       }
+                               else {
+                                       ICONST(REG_ITMP2, iptr->val.i);
+                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BEQZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPEQ_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BLTZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPLT_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BLEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPLE_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BNEZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BNEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPEQ_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BGTZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPLE_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPLE(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (iptr->val.l == 0) {
+                               M_BGEZ(s1, 0);
+                               }
+                       else {
+                               if ((iptr->val.l > 0) && (iptr->val.l <= 255)) {
+                                       M_CMPLT_IMM(s1, iptr->val.l, REG_ITMP1);
+                                       }
+                               else {
+                                       LCONST(REG_ITMP2, iptr->val.l);
+                                       M_CMPLT(s1, REG_ITMP2, REG_ITMP1);
+                                       }
+                               M_BEQZ(REG_ITMP1, 0);
+                               }
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPEQ:    /* op1 = target JavaVM pc                     */
+               case ICMD_IF_ACMPEQ:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPEQ(s1, s2, REG_ITMP1);
+                       M_BNEZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPNE:    /* op1 = target JavaVM pc                     */
+               case ICMD_IF_ACMPNE:
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPEQ(s1, s2, REG_ITMP1);
+                       M_BEQZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPLT:    /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPLT(s1, s2, REG_ITMP1);
+                       M_BNEZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPGT:    /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPLE(s1, s2, REG_ITMP1);
+                       M_BEQZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPLE:    /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPLE(s1, s2, REG_ITMP1);
+                       M_BNEZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_LCMPGE:    /* op1 = target JavaVM pc                     */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       M_CMPLT(s1, s2, REG_ITMP1);
+                       M_BEQZ(REG_ITMP1, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               /* (value xx 0) ? IFxx_ICONST : ELSE_ICONST                           */
+
+               case ICMD_ELSE_ICONST:  /* handled by IFxx_ICONST                     */
+                       break;
+
+               case ICMD_IFEQ_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPEQ(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPEQ(s1, REG_ZERO, d);
+                                       M_XOR_IMM(d, 1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVEQ_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVEQ(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFNE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPEQ(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPEQ(s1, REG_ZERO, d);
+                                       M_XOR_IMM(d, 1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVNE_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVNE(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFLT_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPLT(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPLE(REG_ZERO, s1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVLT_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVLT(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFGE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPLE(REG_ZERO, s1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPLT(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVGE_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVGE(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFGT_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPLT(REG_ZERO, s1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPLE(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVGT_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVGT(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_IFLE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       s3 = iptr->val.i;
+                       if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                               if ((s3 == 1) && (iptr[1].val.i == 0)) {
+                                       M_CMPLE(s1, REG_ZERO, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if ((s3 == 0) && (iptr[1].val.i == 1)) {
+                                       M_CMPLT(REG_ZERO, s1, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                                       }
+                               if (s1 == d) {
+                                       M_MOV(s1, REG_ITMP1);
+                                       s1 = REG_ITMP1;
+                                       }
+                               ICONST(d, iptr[1].val.i);
+                               }
+                       if ((s3 >= 0) && (s3 <= 255)) {
+                               M_CMOVLE_IMM(s1, s3, d);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, s3);
+                               M_CMOVLE(s1, REG_ITMP2, d);
+                               }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
+               case ICMD_LRETURN:
+               case ICMD_ARETURN:
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               a = dseg_addaddress ((void*) (builtin_monitorexit));
+                               M_ALD(REG_PV, REG_PV, a);
+                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
+                               M_JSR(REG_RA, REG_PV);
+                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+                               }                       
+#endif
+                       var_to_reg_int(s1, src, REG_RESULT);
+                       M_INTMOVE(s1, REG_RESULT);
+                       goto nowperformreturn;
+
+               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
+               case ICMD_DRETURN:
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               a = dseg_addaddress ((void*) (builtin_monitorexit));
+                               M_ALD(REG_PV, REG_PV, a);
+                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
+                               M_JSR(REG_RA, REG_PV);
+                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+                               }                       
+#endif
+                       var_to_reg_flt(s1, src, REG_FRESULT);
+                       M_FLTMOVE(s1, REG_FRESULT);
+                       goto nowperformreturn;
+
+               case ICMD_RETURN:      /* ...  ==> ...                                */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               a = dseg_addaddress ((void*) (builtin_monitorexit));
+                               M_ALD(REG_PV, REG_PV, a);
+                               M_ALD(argintregs[0], REG_SP, 8 * maxmemuse);
+                               M_JSR(REG_RA, REG_PV);
+                               M_LDA(REG_PV, REG_RA, -(int)((u1*) mcodeptr - mcodebase));
+                               }                       
+#endif
+
+nowperformreturn:
+                       {
+                       int r, p;
+                       
+                       p = parentargs_base;
+                       
+                       /* restore return address                                         */
+
+                       if (!isleafmethod)
+                               {p--;  M_LLD (REG_RA, REG_SP, 8 * p);}
+
+                       /* restore saved registers                                        */
+
+                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--)
+                                       {p--; M_LLD(savintregs[r], REG_SP, 8 * p);}
+                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--)
+                                       {p--; M_DLD(savfltregs[r], REG_SP, 8 * p);}
+
+                       /* deallocate stack                                               */
+
+                       if (parentargs_base)
+                               {M_LDA(REG_SP, REG_SP, parentargs_base*8);}
+
+                       /* call trace function */
+
+                       if (runverbose) {
+                               M_LDA (REG_SP, REG_SP, -24);
+                               M_AST(REG_RA, REG_SP, 0);
+                               M_LST(REG_RESULT, REG_SP, 8);
+                               M_DST(REG_FRESULT, REG_SP,16);
+                               a = dseg_addaddress (method);
+                               M_ALD(argintregs[0], REG_PV, a);
+                               M_MOV(REG_RESULT, argintregs[1]);
+                               M_FLTMOVE(REG_FRESULT, argfltregs[2]);
+                               M_FLTMOVE(REG_FRESULT, argfltregs[3]);
+                               a = dseg_addaddress ((void*) (builtin_displaymethodstop));
+                               M_ALD(REG_PV, REG_PV, a);
+                               M_JSR (REG_RA, REG_PV);
+                               s1 = (int)((u1*) mcodeptr - mcodebase);
+                               if (s1<=32768) M_LDA (REG_PV, REG_RA, -s1);
+                               else {
+                                       s4 ml=-s1, mh=0;
+                                       while (ml<-32768) { ml+=65536; mh--; }
+                                       M_LDA (REG_PV, REG_RA, ml );
+                                       M_LDAH (REG_PV, REG_PV, mh );
+                                       }
+                               M_DLD(REG_FRESULT, REG_SP,16);
+                               M_LLD(REG_RESULT, REG_SP, 8);
+                               M_ALD(REG_RA, REG_SP, 0);
+                               M_LDA (REG_SP, REG_SP, 24);
+                               }
+
+                       M_RET(REG_ZERO, REG_RA);
+                       ALIGNCODENOP;
+                       }
+                       break;
+
+
+               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
+                       {
+                       s4 i, l, *s4ptr;
+                       void **tptr;
+
+                       tptr = (void **) iptr->target;
+
+                       s4ptr = iptr->val.a;
+                       l = s4ptr[1];                          /* low     */
+                       i = s4ptr[2];                          /* high    */
+                       
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       if (l == 0)
+                               {M_INTMOVE(s1, REG_ITMP1);}
+                       else if (l <= 32768) {
+                               M_LDA(REG_ITMP1, s1, -l);
+                               }
+                       else {
+                               ICONST(REG_ITMP2, l);
+                               M_ISUB(s1, REG_ITMP2, REG_ITMP1);
+                               }
+                       i = i - l + 1;
+
+                       /* range check */
+
+                       if (i <= 256)
+                               M_CMPULE_IMM(REG_ITMP1, i - 1, REG_ITMP2);
+                       else {
+                               M_LDA(REG_ITMP2, REG_ZERO, i - 1);
+                               M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
+                               }
+                       M_BEQZ(REG_ITMP2, 0);
+
+
+                       /* codegen_addreference(BlockPtrOfPC(s4ptr[0]), mcodeptr); */
+                       codegen_addreference((basicblock *) tptr[0], mcodeptr);
+
+                       /* build jump table top down and use address of lowest entry */
+
+                       /* s4ptr += 3 + i; */
+                       tptr += i;
+
+                       while (--i >= 0) {
+                               /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
+                               dseg_addtarget((basicblock *) tptr[0]); 
+                               --tptr;
+                               }
+                       }
+
+                       /* length of dataseg after last dseg_addtarget is used by load */
+
+                       M_SAADDQ(REG_ITMP1, REG_PV, REG_ITMP2);
+                       M_ALD(REG_ITMP2, REG_ITMP2, -dseglen);
+                       M_JMP(REG_ZERO, REG_ITMP2);
+                       ALIGNCODENOP;
+                       break;
+
+
+               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
+                       {
+                       s4 i, l, val, *s4ptr;
+                       void **tptr;
+
+                       tptr = (void **) iptr->target;
+
+                       s4ptr = iptr->val.a;
+                       l = s4ptr[0];                          /* default  */
+                       i = s4ptr[1];                          /* count    */
+                       
+                       MCODECHECK((i<<2)+8);
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       while (--i >= 0) {
+                               s4ptr += 2;
+                               ++tptr;
+
+                               val = s4ptr[0];
+                               if ((val >= 0) && (val <= 255)) {
+                                       M_CMPEQ_IMM(s1, val, REG_ITMP2);
+                                       }
+                               else {
+                                       if ((val >= -32768) && (val <= 32767)) {
+                                               M_LDA(REG_ITMP2, REG_ZERO, val);
+                                               } 
+                                       else {
+                                               a = dseg_adds4 (val);
+                                               M_ILD(REG_ITMP2, REG_PV, a);
+                                               }
+                                       M_CMPEQ(s1, REG_ITMP2, REG_ITMP2);
+                                       }
+                               M_BNEZ(REG_ITMP2, 0);
+                               /* codegen_addreference(BlockPtrOfPC(s4ptr[1]), mcodeptr); */
+                               codegen_addreference((basicblock *) tptr[0], mcodeptr); 
+                               }
+
+                       M_BR(0);
+                       /* codegen_addreference(BlockPtrOfPC(l), mcodeptr); */
+                       
+                       tptr = (void **) iptr->target;
+                       codegen_addreference((basicblock *) tptr[0], mcodeptr);
+
+                       ALIGNCODENOP;
+                       break;
+                       }
+
+
+               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 3;
+                       goto gen_method;
+
+               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 2;
+                       goto gen_method;
+
+               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 1;
+                       goto gen_method;
+
+               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+                       s3 = iptr->op1;
+
+gen_method: {
+                       methodinfo   *m;
+                       classinfo    *ci;
+
+                       MCODECHECK((s3 << 1) + 64);
+
+                       /* copy arguments to registers or stack location                  */
+
+                       for (; --s3 >= 0; src = src->prev) {
+                               if (src->varkind == ARGVAR)
+                                       continue;
+                               if (IS_INT_LNG_TYPE(src->type)) {
+                                       if (s3 < INT_ARG_CNT) {
+                                               s1 = argintregs[s3];
+                                               var_to_reg_int(d, src, s1);
+                                               M_INTMOVE(d, s1);
+                                               }
+                                       else  {
+                                               var_to_reg_int(d, src, REG_ITMP1);
+                                               M_LST(d, REG_SP, 8 * (s3 - INT_ARG_CNT));
+                                               }
+                                       }
+                               else
+                                       if (s3 < FLT_ARG_CNT) {
+                                               s1 = argfltregs[s3];
+                                               var_to_reg_flt(d, src, s1);
+                                               M_FLTMOVE(d, s1);
+                                               }
+                                       else {
+                                               var_to_reg_flt(d, src, REG_FTMP1);
+                                               M_DST(d, REG_SP, 8 * (s3 - FLT_ARG_CNT));
+                                               }
+                               } /* end of for */
+
+                       m = iptr->val.a;
+                       switch (iptr->opc) {
+                               case ICMD_BUILTIN3:
+                               case ICMD_BUILTIN2:
+                               case ICMD_BUILTIN1:
+                                       a = dseg_addaddress ((void*) (m));
+
+                                       M_ALD(REG_PV, REG_PV, a); /* Pointer to built-in-function */
+                                       d = iptr->op1;
+                                       goto makeactualcall;
+
+                               case ICMD_INVOKESTATIC:
+                               case ICMD_INVOKESPECIAL:
+                                       a = dseg_addaddress (m->stubroutine);
+
+                                       M_ALD(REG_PV, REG_PV, a );       /* method pointer in r27 */
+
+                                       d = m->returntype;
+                                       goto makeactualcall;
+
+                               case ICMD_INVOKEVIRTUAL:
+
+                                       gen_nullptr_check(argintregs[0]);
+                                       M_ALD(REG_METHODPTR, argintregs[0],
+                                                                OFFSET(java_objectheader, vftbl));
+                                       M_ALD(REG_PV, REG_METHODPTR, OFFSET(vftbl, table[0]) +
+                                                               sizeof(methodptr) * m->vftblindex);
+
+                                       d = m->returntype;
+                                       goto makeactualcall;
+
+                               case ICMD_INVOKEINTERFACE:
+                                       ci = m->class;
+                                       
+                                       gen_nullptr_check(argintregs[0]);
+                                       M_ALD(REG_METHODPTR, argintregs[0],
+                                                                OFFSET(java_objectheader, vftbl));    
+                                       M_ALD(REG_METHODPTR, REG_METHODPTR,
+                                             OFFSET(vftbl, interfacetable[0]) -
+                                             sizeof(methodptr*) * ci->index);
+                                       M_ALD(REG_PV, REG_METHODPTR,
+                                                           sizeof(methodptr) * (m - ci->methods));
+
+                                       d = m->returntype;
+                                       goto makeactualcall;
+
+                               default:
+                                       d = 0;
+                                       sprintf (logtext, "Unkown ICMD-Command: %d", iptr->opc);
+                                       error ();
+                               }
+
+makeactualcall:
+
+                       M_JSR (REG_RA, REG_PV);
+
+                       /* recompute pv */
+
+                       s1 = (int)((u1*) mcodeptr - mcodebase);
+                       if (s1<=32768) M_LDA (REG_PV, REG_RA, -s1);
+                       else {
+                               s4 ml=-s1, mh=0;
+                               while (ml<-32768) { ml+=65536; mh--; }
+                               M_LDA (REG_PV, REG_RA, ml );
+                               M_LDAH (REG_PV, REG_PV, mh );
+                               }
+
+                       /* d contains return type */
+
+                       if (d != TYPE_VOID) {
+                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
+                                       s1 = reg_of_var(iptr->dst, REG_RESULT);
+                                       M_INTMOVE(REG_RESULT, s1);
+                                       store_reg_to_var_int(iptr->dst, s1);
+                                       }
+                               else {
+                                       s1 = reg_of_var(iptr->dst, REG_FRESULT);
+                                       M_FLTMOVE(REG_FRESULT, s1);
+                                       store_reg_to_var_flt(iptr->dst, s1);
+                                       }
+                               }
+                       }
+                       break;
+
+
+               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
+
+                                     /* op1:   0 == array, 1 == class                */
+                                     /* val.a: (classinfo*) superclass               */
+
+/*          superclass is an interface:
+ *
+ *          return (sub != NULL) &&
+ *                 (sub->vftbl->interfacetablelength > super->index) &&
+ *                 (sub->vftbl->interfacetable[-super->index] != NULL);
+ *
+ *          superclass is a class:
+ *
+ *          return ((sub != NULL) && (0
+ *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
+ *                  super->vftbl->diffvall));
+ */
+
+                       {
+                       classinfo *super = (classinfo*) iptr->val.a;
+                       
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_MOV(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                               }
+                       M_CLR(d);
+                       if (iptr->op1) {                               /* class/interface */
+                               if (super->flags & ACC_INTERFACE) {        /* interface       */
+                                       M_BEQZ(s1, 6);
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
+                                       M_LDA(REG_ITMP2, REG_ITMP2, - super->index);
+                                       M_BLEZ(REG_ITMP2, 2);
+                                       M_ALD(REG_ITMP1, REG_ITMP1,
+                                             OFFSET(vftbl, interfacetable[0]) -
+                                             super->index * sizeof(methodptr*));
+                                       M_CMPULT(REG_ZERO, REG_ITMP1, d);      /* REG_ITMP1 != 0  */
+                                       }
+                               else {                                     /* class           */
+/*
+                                       s2 = super->vftbl->diffval;
+                                       M_BEQZ(s1, 4 + (s2 > 255));
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       M_LDA(REG_ITMP1, REG_ITMP1, - super->vftbl->baseval);
+                                       if (s2 <= 255)
+                                               M_CMPULE_IMM(REG_ITMP1, s2, d);
+                                       else {
+                                               M_LDA(REG_ITMP2, REG_ZERO, s2);
+                                               M_CMPULE(REG_ITMP1, REG_ITMP2, d);
+                                               }
+*/
+                                       M_BEQZ(s1, 7);
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       a = dseg_addaddress ((void*) super->vftbl);
+                                       M_ALD(REG_ITMP2, REG_PV, a);
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
+                                       M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                       M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
+                                       M_CMPULE(REG_ITMP1, REG_ITMP2, d);
+                                       }
+                               }
+                       else
+                               panic ("internal error: no inlined array instanceof");
+                       }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
+
+                                     /* op1:   0 == array, 1 == class                */
+                                     /* val.a: (classinfo*) superclass               */
+
+/*          superclass is an interface:
+ *
+ *          OK if ((sub == NULL) ||
+ *                 (sub->vftbl->interfacetablelength > super->index) &&
+ *                 (sub->vftbl->interfacetable[-super->index] != NULL));
+ *
+ *          superclass is a class:
+ *
+ *          OK if ((sub == NULL) || (0
+ *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
+ *                 super->vftbl->diffvall));
+ */
+
+                       {
+                       classinfo *super = (classinfo*) iptr->val.a;
+                       
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       var_to_reg_int(s1, src, d);
+                       if (iptr->op1) {                               /* class/interface */
+                               if (super->flags & ACC_INTERFACE) {        /* interface       */
+                                       M_BEQZ(s1, 6);
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
+                                       M_LDA(REG_ITMP2, REG_ITMP2, - super->index);
+                                       M_BLEZ(REG_ITMP2, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+                                       M_ALD(REG_ITMP2, REG_ITMP1,
+                                             OFFSET(vftbl, interfacetable[0]) -
+                                             super->index * sizeof(methodptr*));
+                                       M_BEQZ(REG_ITMP2, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+                                       }
+                               else {                                     /* class           */
+/*
+                                       s2 = super->vftbl->diffval;
+                                       M_BEQZ(s1, 4 + (s2 != 0) + (s2 > 255));
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       M_LDA(REG_ITMP1, REG_ITMP1, - super->vftbl->baseval);
+                                       if (s2 == 0) {
+                                               M_BNEZ(REG_ITMP1, 0);
+                                               }
+                                       else if (s2 <= 255) {
+                                               M_CMPULE_IMM(REG_ITMP1, s2, REG_ITMP2);
+                                               M_BEQZ(REG_ITMP2, 0);
+                                               }
+                                       else {
+                                               M_LDA(REG_ITMP2, REG_ZERO, s2);
+                                               M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
+                                               M_BEQZ(REG_ITMP2, 0);
+                                               }
+*/
+                                       M_BEQZ(s1, 8 + (d == REG_ITMP3));
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       a = dseg_addaddress ((void*) super->vftbl);
+                                       M_ALD(REG_ITMP2, REG_PV, a);
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       if (d != REG_ITMP3) {
+                                               M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                               M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
+                                               }
+                                       else {
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, baseval));
+                                               M_ISUB(REG_ITMP1, REG_ITMP2, REG_ITMP1);
+                                               M_ALD(REG_ITMP2, REG_PV, a);
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                               }
+                                       M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
+                                       M_BEQZ(REG_ITMP2, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+                                       }
+                               }
+                       else
+                               panic ("internal error: no inlined array checkcast");
+                       }
+                       M_INTMOVE(s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_BLTZ(s1, 0);
+                       codegen_addxcheckarefs(mcodeptr);
+                       break;
+
+               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
+                                     /* op1 = dimension, val.a = array descriptor    */
+
+                       /* check for negative sizes and copy sizes to stack if necessary  */
+
+                       MCODECHECK((iptr->op1 << 1) + 64);
+
+                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
+                               var_to_reg_int(s2, src, REG_ITMP1);
+                               M_BLTZ(s2, 0);
+                               codegen_addxcheckarefs(mcodeptr);
+
+                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
+
+                               if (src->varkind != ARGVAR) {
+                                       M_LST(s2, REG_SP, 8 * (s1 + INT_ARG_CNT));
+                                       }
+                               }
+
+                       /* a0 = dimension count */
+
+                       ICONST(argintregs[0], iptr->op1);
+
+                       /* a1 = arraydescriptor */
+
+                       a = dseg_addaddress(iptr->val.a);
+                       M_ALD(argintregs[1], REG_PV, a);
+
+                       /* a2 = pointer to dimensions = stack pointer */
+
+                       M_INTMOVE(REG_SP, argintregs[2]);
+
+                       a = dseg_addaddress((void*) (builtin_nmultianewarray));
+                       M_ALD(REG_PV, REG_PV, a);
+                       M_JSR(REG_RA, REG_PV);
+                       s1 = (int)((u1*) mcodeptr - mcodebase);
+                       if (s1 <= 32768)
+                               M_LDA (REG_PV, REG_RA, -s1);
+                       else {
+                               s4 ml = -s1, mh = 0;
+                               while (ml < -32768) {ml += 65536; mh--;}
+                               M_LDA(REG_PV, REG_RA, ml);
+                               M_LDAH(REG_PV, REG_PV, mh);
+                           }
+                       s1 = reg_of_var(iptr->dst, REG_RESULT);
+                       M_INTMOVE(REG_RESULT, s1);
+                       store_reg_to_var_int(iptr->dst, s1);
+                       break;
+
+
+               default: sprintf (logtext, "Unknown pseudo command: %d", iptr->opc);
+                        error();
+       
+   
+
+       } /* switch */
+               
+       } /* for instruction */
+               
+       /* copy values to interface registers */
+
+       src = bptr->outstack;
+       len = bptr->outdepth;
+       MCODECHECK(64+len);
+       while (src) {
+               len--;
+               if ((src->varkind != STACKVAR)) {
+                       s2 = src->type;
+                       if (IS_FLT_DBL_TYPE(s2)) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                       M_FLTMOVE(s1,interfaces[len][s2].regoff);
+                                       }
+                               else {
+                                       M_DST(s1, REG_SP, 8 * interfaces[len][s2].regoff);
+                                       }
+                               }
+                       else {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                       M_INTMOVE(s1,interfaces[len][s2].regoff);
+                                       }
+                               else {
+                                       M_LST(s1, REG_SP, 8 * interfaces[len][s2].regoff);
+                                       }
+                               }
+                       }
+               src = src->prev;
+               }
+       } /* if (bptr -> flags >= BBREACHED) */
+       } /* for basic block */
+
+       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
+
+       {
+       /* generate bound check stubs */
+
+       s4 *xcodeptr = NULL;
+       
+       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
+                               xboundrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
+                       continue;
+                       }
+
+
+               gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
+                                 xboundrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               M_LDA(REG_ITMP2_XPC, REG_PV, xboundrefs->branchpos - 4);
+
+               if (xcodeptr != NULL) {
+                       M_BR((xcodeptr-mcodeptr)-1);
+                       }
+               else {
+                       xcodeptr = mcodeptr;
+
+                       a = dseg_addaddress(proto_java_lang_ArrayIndexOutOfBoundsException);
+                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
+
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP3, REG_PV, a);
+
+                       M_JMP(REG_ZERO, REG_ITMP3);
+                       }
+               }
+
+       /* generate negative array size check stubs */
+
+       xcodeptr = NULL;
+       
+       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
+                               xcheckarefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
+                       continue;
+                       }
+
+               gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
+                                 xcheckarefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               M_LDA(REG_ITMP2_XPC, REG_PV, xcheckarefs->branchpos - 4);
+
+               if (xcodeptr != NULL) {
+                       M_BR((xcodeptr-mcodeptr)-1);
+                       }
+               else {
+                       xcodeptr = mcodeptr;
+
+                       a = dseg_addaddress(proto_java_lang_NegativeArraySizeException);
+                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
+
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP3, REG_PV, a);
+
+                       M_JMP(REG_ZERO, REG_ITMP3);
+                       }
+               }
+
+       /* generate cast check stubs */
+
+       xcodeptr = NULL;
+       
+       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
+                               xcastrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
+                       continue;
+                       }
+
+               gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
+                                 xcastrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               M_LDA(REG_ITMP2_XPC, REG_PV, xcastrefs->branchpos - 4);
+
+               if (xcodeptr != NULL) {
+                       M_BR((xcodeptr-mcodeptr)-1);
+                       }
+               else {
+                       xcodeptr = mcodeptr;
+
+                       a = dseg_addaddress(proto_java_lang_ClassCastException);
+                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
+
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP3, REG_PV, a);
+
+                       M_JMP(REG_ZERO, REG_ITMP3);
+                       }
+               }
+
+
+#ifdef SOFTNULLPTRCHECK
+
+       /* generate null pointer check stubs */
+
+       xcodeptr = NULL;
+
+       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
+                               xnullrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - 4);
+                       continue;
+                       }
+
+               gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
+                                 xnullrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               M_LDA(REG_ITMP2_XPC, REG_PV, xnullrefs->branchpos - 4);
+
+               if (xcodeptr != NULL) {
+                       M_BR((xcodeptr-mcodeptr)-1);
+                       }
+               else {
+                       xcodeptr = mcodeptr;
+
+                       a = dseg_addaddress(proto_java_lang_NullPointerException);
+                       M_ALD(REG_ITMP1_XPTR, REG_PV, a);
+
+                       a = dseg_addaddress(asm_handle_exception);
+                       M_ALD(REG_ITMP3, REG_PV, a);
+
+                       M_JMP(REG_ZERO, REG_ITMP3);
+                       }
+               }
+
+#endif
+       }
+
+       codegen_finish((int)((u1*) mcodeptr - mcodebase));
+}
+
+
+/* redefinition of code generation macros (compiling into array) **************/
+
+/* 
+These macros are newly defined to allow code generation into an array.
+This is necessary, because the original M_.. macros generate code by
+calling 'codegen_adds4' that uses an additional data structure to
+receive the code.
+
+For a faster (but less flexible) version to generate code, these
+macros directly use the (s4* p) - pointer to put the code directly
+in a locally defined array.
+This makes sense only for the stub-generation-routines below.
+*/
+
+#undef M_OP3
+#define M_OP3(op,fu,a,b,c,const) \
+       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<(16-3*(const)))| \
+       ((const)<<12)|((fu)<<5)|((c)) )
+#undef M_FOP3
+#define M_FOP3(op,fu,a,b,c) \
+       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((fu)<<5)|(c) )
+#undef M_BRA
+#define M_BRA(op,a,disp) \
+       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((disp)&0x1fffff) )
+#undef M_MEM
+#define M_MEM(op,a,b,disp) \
+       *(p++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((disp)&0xffff) )
+
+
+/* function createcompilerstub *************************************************
+
+       creates a stub routine which calls the compiler
+       
+*******************************************************************************/
+
+#define COMPSTUBSIZE 3
+
+u1 *createcompilerstub (methodinfo *m)
+{
+       u8 *s = CNEW (u8, COMPSTUBSIZE);    /* memory to hold the stub            */
+       s4 *p = (s4*) s;                    /* code generation pointer            */
+       
+                                           /* code for the stub                  */
+       M_ALD (REG_PV, REG_PV, 16);         /* load pointer to the compiler       */
+       M_JMP (0, REG_PV);                  /* jump to the compiler, return address
+                                              in reg 0 is used as method pointer */
+       s[1] = (u8) m;                      /* literals to be adressed            */  
+       s[2] = (u8) asm_call_jit_compiler;  /* jump directly via PV from above    */
+
+#ifdef STATISTICS
+       count_cstub_len += COMPSTUBSIZE * 8;
+#endif
+
+       return (u1*) s;
+}
+
+
+/* function removecompilerstub *************************************************
+
+     deletes a compilerstub from memory  (simply by freeing it)
+
+*******************************************************************************/
+
+void removecompilerstub (u1 *stub) 
+{
+       CFREE (stub, COMPSTUBSIZE * 8);
+}
+
+/* function: createnativestub **************************************************
+
+       creates a stub routine which calls a native method
+
+*******************************************************************************/
+
+#define NATIVESTUBSIZE 34
+#define NATIVESTUBOFFSET 8
+
+int runverbosenat = 0;
+
+u1 *createnativestub (functionptr f, methodinfo *m)
+{
+       int disp;
+       u8 *s = CNEW (u8, NATIVESTUBSIZE);  /* memory to hold the stub            */
+       u8 *cs = s + NATIVESTUBOFFSET;
+       s4 *p = (s4*) (cs);                 /* code generation pointer            */
+
+       *(cs-1) = (u8) f;                   /* address of native method           */
+       *(cs-2) = (u8) (&exceptionptr);     /* address of exceptionptr            */
+       *(cs-3) = (u8) asm_handle_nat_exception; /* addr of asm exception handler */
+       *(cs-4) = (u8) (&env);              /* addr of jni_environement           */
+       *(cs-5) = (u8) asm_builtin_trace;
+       *(cs-6) = (u8) m;
+       *(cs-7) = (u8) asm_builtin_exittrace;
+       *(cs-8) = (u8) builtin_trace_exception;
+
+#if 0
+       printf("stub: ");
+       utf_display(m->class->name);
+       printf(".");
+       utf_display(m->name);
+       printf(" 0x%p\n", cs);
+#endif
+
+       M_LDA  (REG_SP, REG_SP, -8);        /* build up stackframe                */
+       M_AST  (REG_RA, REG_SP, 0);         /* store return address               */
+
+#if 1
+       if (runverbosenat) {
+               M_ALD(REG_ITMP1, REG_PV, -6*8);
+               M_ALD(REG_PV, REG_PV, -5*8);
+
+               M_JSR(REG_RA, REG_PV);
+               disp = -(int) (p - (s4*) cs)*4;
+               M_LDA(REG_PV, REG_RA, disp);
+       }
+#endif
+
+       reg_init();
+
+       M_MOV  (argintregs[4],argintregs[5]); 
+       M_FMOV (argfltregs[4],argfltregs[5]);
+
+       M_MOV  (argintregs[3],argintregs[4]);
+       M_FMOV (argfltregs[3],argfltregs[4]);
+
+       M_MOV  (argintregs[2],argintregs[3]);
+       M_FMOV (argfltregs[2],argfltregs[3]);
+
+       M_MOV  (argintregs[1],argintregs[2]);
+       M_FMOV (argfltregs[1],argfltregs[2]);
+
+       M_MOV  (argintregs[0],argintregs[1]);
+       M_FMOV (argfltregs[0],argfltregs[1]);
+       
+       M_ALD  (argintregs[0], REG_PV, -4*8);/* load adress of jni_environement   */
+
+       M_ALD  (REG_PV, REG_PV, -1*8);      /* load adress of native method       */
+       M_JSR  (REG_RA, REG_PV);            /* call native method                 */
+
+       disp = -(int) (p - (s4*) cs)*4;
+       M_LDA  (REG_PV, REG_RA, disp);      /* recompute pv from ra               */
+       M_ALD  (REG_ITMP3, REG_PV, -2*8);   /* get address of exceptionptr        */
+
+       M_ALD  (REG_ITMP1, REG_ITMP3, 0);   /* load exception into reg. itmp1     */
+       M_BNEZ (REG_ITMP1,
+                       3 + (runverbosenat ? 6 : 0));  /* if no exception then return        */
+
+#if 1
+       if (runverbosenat) {
+               M_ALD(argintregs[0], REG_PV, -6*8);
+               M_MOV(REG_RESULT, argintregs[1]);
+               M_FMOV(REG_FRESULT, argfltregs[2]);
+               M_FMOV(REG_FRESULT, argfltregs[3]);
+               M_ALD(REG_PV, REG_PV, -7*8);
+               M_JSR(REG_RA, REG_PV);
+       }
+#endif
+
+       M_ALD  (REG_RA, REG_SP, 0);         /* load return address                */
+       M_LDA  (REG_SP, REG_SP, 8);         /* remove stackframe                  */
+
+       M_RET  (REG_ZERO, REG_RA);          /* return to caller                   */
+       
+       M_AST  (REG_ZERO, REG_ITMP3, 0);    /* store NULL into exceptionptr       */
+
+#if 1
+       if (runverbosenat) {
+               M_LDA(REG_SP, REG_SP, -8);
+               M_AST(REG_ITMP1, REG_SP, 0);
+               M_MOV(REG_ITMP1, argintregs[0]);
+               M_ALD(argintregs[1], REG_PV, -6*8);
+               M_ALD(argintregs[2], REG_SP, 0);
+               M_CLR(argintregs[3]);
+               M_ALD(REG_PV, REG_PV, -8*8);
+               M_JSR(REG_RA, REG_PV);
+               disp = -(int) (p - (s4*) cs)*4;
+               M_LDA  (REG_PV, REG_RA, disp);
+               M_ALD(REG_ITMP1, REG_SP, 0);
+               M_LDA(REG_SP, REG_SP, 8);
+       }
+#endif
+
+       M_ALD  (REG_RA, REG_SP, 0);         /* load return address                */
+       M_LDA  (REG_SP, REG_SP, 8);         /* remove stackframe                  */
+
+       M_LDA  (REG_ITMP2, REG_RA, -4);     /* move fault address into reg. itmp2 */
+
+       M_ALD  (REG_ITMP3, REG_PV, -3*8);   /* load asm exception handler address */
+       M_JMP  (REG_ZERO, REG_ITMP3);       /* jump to asm exception handler      */
+       
+#if 0
+       {
+               static int stubprinted;
+               if (!stubprinted)
+                       printf("stubsize: %d/2\n", (int) (p - (s4*) s));
+               stubprinted = 1;
+       }
+#endif
+
+#ifdef STATISTICS
+       count_nstub_len += NATIVESTUBSIZE * 8;
+#endif
+
+       return (u1*) (s + NATIVESTUBOFFSET);
+}
+
+/* function: removenativestub **************************************************
+
+    removes a previously created native-stub from memory
+    
+*******************************************************************************/
+
+void removenativestub (u1 *stub)
+{
+       CFREE ((u8*) stub - NATIVESTUBOFFSET, NATIVESTUBSIZE * 8);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/alpha/codegen.h b/src/vm/jit/alpha/codegen.h
new file mode 100644 (file)
index 0000000..d45d3a4
--- /dev/null
@@ -0,0 +1,448 @@
+/* jit/alpha/codegen.h - code generation macros and definitions for alpha
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   $Id: codegen.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _CODEGEN_H
+#define _CODEGEN_H
+
+#include "jit.h"
+
+
+/* see also file calling.doc for explanation of calling conventions           */
+
+/* preallocated registers *****************************************************/
+
+/* integer registers */
+  
+#define REG_RESULT      0    /* to deliver method results                     */ 
+
+#define REG_RA          26   /* return address                                */
+#define REG_PV          27   /* procedure vector, must be provided by caller  */
+#define REG_METHODPTR   28   /* pointer to the place from where the procedure */
+                             /* vector has been fetched                       */
+#define REG_ITMP1       25   /* temporary register                            */
+#define REG_ITMP2       28   /* temporary register and method pointer         */
+#define REG_ITMP3       29   /* temporary register                            */
+
+#define REG_ITMP1_XPTR  25   /* exception pointer = temporary register 1      */
+#define REG_ITMP2_XPC   28   /* exception pc = temporary register 2           */
+
+#define REG_SP          30   /* stack pointer                                 */
+#define REG_ZERO        31   /* allways zero                                  */
+
+/* floating point registers */
+
+#define REG_FRESULT     0    /* to deliver floating point method results      */ 
+#define REG_FTMP1       28   /* temporary floating point register             */
+#define REG_FTMP2       29   /* temporary floating point register             */
+#define REG_FTMP3       30   /* temporary floating point register             */
+
+#define REG_IFTMP       28   /* temporary integer and floating point register */
+
+/* register descripton - array ************************************************/
+
+/* #define REG_RES   0         reserved register for OS or code generator     */
+/* #define REG_RET   1         return value register                          */
+/* #define REG_EXC   2         exception value register (only old jit)        */
+/* #define REG_SAV   3         (callee) saved register                        */
+/* #define REG_TMP   4         scratch temporary register (caller saved)      */
+/* #define REG_ARG   5         argument register (caller saved)               */
+
+/* #define REG_END   -1        last entry in tables */
+int nregdescint[] = {
+       REG_RET, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
+       REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, 
+       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
+       REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
+       REG_END };
+
+#define INT_SAV_CNT      7   /* number of int callee saved registers          */
+#define INT_ARG_CNT      6   /* number of int argument registers              */
+
+/* for use of reserved registers, see comment above */
+       
+int nregdescfloat[] = {
+       REG_RET, REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
+       REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
+       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
+       REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES,
+       REG_END };
+
+#define FLT_SAV_CNT      8   /* number of flt callee saved registers          */
+#define FLT_ARG_CNT      6   /* number of flt argument registers              */
+
+/* for use of reserved registers, see comment above */
+
+
+/* parameter allocation mode */
+
+int nreg_parammode = PARAMMODE_NUMBERED;  
+
+   /* parameter-registers will be allocated by assigning the
+      1. parameter:   int/float-reg 16
+      2. parameter:   int/float-reg 17  
+      3. parameter:   int/float-reg 18 ....
+   */
+
+
+/* stackframe-infos ***********************************************************/
+
+int parentargs_base; /* offset in stackframe for the parameter from the caller*/
+
+/* -> see file 'calling.doc' */
+
+
+/* macros to create code ******************************************************/
+
+#define REG   0
+#define CONST 1
+
+/* 3-address-operations: M_OP3
+      op ..... opcode
+      fu ..... function-number
+      a  ..... register number source 1
+      b  ..... register number or constant integer source 2
+      c  ..... register number destination
+      const .. switch to use b as constant integer 
+                 (REG means: use b as register number)
+                 (CONST means: use b as constant 8-bit-integer)
+*/      
+#define M_OP3(op,fu,a,b,c,const) \
+       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<(16-3*(const)))| \
+       ((const)<<12)|((fu)<<5)|((c)) )
+
+/* 3-address-floating-point-operation: M_FOP3 
+     op .... opcode
+     fu .... function-number
+     a,b ... source floating-point registers
+     c ..... destination register
+*/ 
+#define M_FOP3(op,fu,a,b,c) \
+       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((fu)<<5)|(c) )
+
+/* branch instructions: M_BRA 
+      op ..... opcode
+      a ...... register to be tested
+      disp ... relative address to be jumped to (divided by 4)
+*/
+#define M_BRA(op,a,disp) \
+       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((disp)&0x1fffff) )
+
+
+/* memory operations: M_MEM
+      op ..... opcode
+      a ...... source/target register for memory access
+      b ...... base register
+      disp ... displacement (16 bit signed) to be added to b
+*/ 
+#define M_MEM(op,a,b,disp) \
+       *(mcodeptr++) = ( (((s4)(op))<<26)|((a)<<21)|((b)<<16)|((disp)&0xffff) )
+
+
+/* macros for all used commands (see an Alpha-manual for description) *********/ 
+
+#define M_LDA(a,b,disp)         M_MEM (0x08,a,b,disp)           /* low const  */
+#define M_LDAH(a,b,disp)        M_MEM (0x09,a,b,disp)           /* high const */
+#define M_BLDU(a,b,disp)        M_MEM (0x0a,a,b,disp)           /*  8 load    */
+#define M_SLDU(a,b,disp)        M_MEM (0x0c,a,b,disp)           /* 16 load    */
+#define M_ILD(a,b,disp)         M_MEM (0x28,a,b,disp)           /* 32 load    */
+#define M_LLD(a,b,disp)         M_MEM (0x29,a,b,disp)           /* 64 load    */
+#define M_ALD(a,b,disp)         M_MEM (0x29,a,b,disp)           /* addr load  */
+#define M_BST(a,b,disp)         M_MEM (0x0e,a,b,disp)           /*  8 store   */
+#define M_SST(a,b,disp)         M_MEM (0x0d,a,b,disp)           /* 16 store   */
+#define M_IST(a,b,disp)         M_MEM (0x2c,a,b,disp)           /* 32 store   */
+#define M_LST(a,b,disp)         M_MEM (0x2d,a,b,disp)           /* 64 store   */
+#define M_AST(a,b,disp)         M_MEM (0x2d,a,b,disp)           /* addr store */
+
+#define M_BSEXT(b,c)            M_OP3 (0x1c,0x0,REG_ZERO,b,c,0) /*  8 signext */
+#define M_SSEXT(b,c)            M_OP3 (0x1c,0x1,REG_ZERO,b,c,0) /* 16 signext */
+
+#define M_BR(disp)              M_BRA (0x30,REG_ZERO,disp)      /* branch     */
+#define M_BSR(ra,disp)          M_BRA (0x34,ra,disp)            /* branch sbr */
+#define M_BEQZ(a,disp)          M_BRA (0x39,a,disp)             /* br a == 0  */
+#define M_BLTZ(a,disp)          M_BRA (0x3a,a,disp)             /* br a <  0  */
+#define M_BLEZ(a,disp)          M_BRA (0x3b,a,disp)             /* br a <= 0  */
+#define M_BNEZ(a,disp)          M_BRA (0x3d,a,disp)             /* br a != 0  */
+#define M_BGEZ(a,disp)          M_BRA (0x3e,a,disp)             /* br a >= 0  */
+#define M_BGTZ(a,disp)          M_BRA (0x3f,a,disp)             /* br a >  0  */
+
+#define M_JMP(a,b)              M_MEM (0x1a,a,b,0x0000)         /* jump       */
+#define M_JSR(a,b)              M_MEM (0x1a,a,b,0x4000)         /* call sbr   */
+#define M_RET(a,b)              M_MEM (0x1a,a,b,0x8000)         /* return     */
+
+#define M_IADD(a,b,c)           M_OP3 (0x10,0x0,  a,b,c,0)      /* 32 add     */
+#define M_LADD(a,b,c)           M_OP3 (0x10,0x20, a,b,c,0)      /* 64 add     */
+#define M_ISUB(a,b,c)           M_OP3 (0x10,0x09, a,b,c,0)      /* 32 sub     */
+#define M_LSUB(a,b,c)           M_OP3 (0x10,0x29, a,b,c,0)      /* 64 sub     */
+#define M_IMUL(a,b,c)           M_OP3 (0x13,0x00, a,b,c,0)      /* 32 mul     */
+#define M_LMUL(a,b,c)           M_OP3 (0x13,0x20, a,b,c,0)      /* 64 mul     */
+
+#define M_IADD_IMM(a,b,c)       M_OP3 (0x10,0x0,  a,b,c,1)      /* 32 add     */
+#define M_LADD_IMM(a,b,c)       M_OP3 (0x10,0x20, a,b,c,1)      /* 64 add     */
+#define M_ISUB_IMM(a,b,c)       M_OP3 (0x10,0x09, a,b,c,1)      /* 32 sub     */
+#define M_LSUB_IMM(a,b,c)       M_OP3 (0x10,0x29, a,b,c,1)      /* 64 sub     */
+#define M_IMUL_IMM(a,b,c)       M_OP3 (0x13,0x00, a,b,c,1)      /* 32 mul     */
+#define M_LMUL_IMM(a,b,c)       M_OP3 (0x13,0x20, a,b,c,1)      /* 64 mul     */
+
+#define M_CMPEQ(a,b,c)          M_OP3 (0x10,0x2d, a,b,c,0)      /* c = a == b */
+#define M_CMPLT(a,b,c)          M_OP3 (0x10,0x4d, a,b,c,0)      /* c = a <  b */
+#define M_CMPLE(a,b,c)          M_OP3 (0x10,0x6d, a,b,c,0)      /* c = a <= b */
+
+#define M_CMPULE(a,b,c)         M_OP3 (0x10,0x3d, a,b,c,0)      /* c = a <= b */
+#define M_CMPULT(a,b,c)         M_OP3 (0x10,0x1d, a,b,c,0)      /* c = a <= b */
+
+#define M_CMPEQ_IMM(a,b,c)      M_OP3 (0x10,0x2d, a,b,c,1)      /* c = a == b */
+#define M_CMPLT_IMM(a,b,c)      M_OP3 (0x10,0x4d, a,b,c,1)      /* c = a <  b */
+#define M_CMPLE_IMM(a,b,c)      M_OP3 (0x10,0x6d, a,b,c,1)      /* c = a <= b */
+
+#define M_CMPULE_IMM(a,b,c)     M_OP3 (0x10,0x3d, a,b,c,1)      /* c = a <= b */
+#define M_CMPULT_IMM(a,b,c)     M_OP3 (0x10,0x1d, a,b,c,1)      /* c = a <= b */
+
+#define M_AND(a,b,c)            M_OP3 (0x11,0x00, a,b,c,0)      /* c = a &  b */
+#define M_OR( a,b,c)            M_OP3 (0x11,0x20, a,b,c,0)      /* c = a |  b */
+#define M_XOR(a,b,c)            M_OP3 (0x11,0x40, a,b,c,0)      /* c = a ^  b */
+
+#define M_AND_IMM(a,b,c)        M_OP3 (0x11,0x00, a,b,c,1)      /* c = a &  b */
+#define M_OR_IMM( a,b,c)        M_OP3 (0x11,0x20, a,b,c,1)      /* c = a |  b */
+#define M_XOR_IMM(a,b,c)        M_OP3 (0x11,0x40, a,b,c,1)      /* c = a ^  b */
+
+#define M_MOV(a,c)              M_OR (a,a,c)                    /* c = a      */
+#define M_CLR(c)                M_OR (31,31,c)                  /* c = 0      */
+#define M_NOP                   M_OR (31,31,31)                 /* ;          */
+
+#define M_SLL(a,b,c)            M_OP3 (0x12,0x39, a,b,c,0)      /* c = a << b */
+#define M_SRA(a,b,c)            M_OP3 (0x12,0x3c, a,b,c,0)      /* c = a >> b */
+#define M_SRL(a,b,c)            M_OP3 (0x12,0x34, a,b,c,0)      /* c = a >>>b */
+
+#define M_SLL_IMM(a,b,c)        M_OP3 (0x12,0x39, a,b,c,1)      /* c = a << b */
+#define M_SRA_IMM(a,b,c)        M_OP3 (0x12,0x3c, a,b,c,1)      /* c = a >> b */
+#define M_SRL_IMM(a,b,c)        M_OP3 (0x12,0x34, a,b,c,1)      /* c = a >>>b */
+
+#define M_FLD(a,b,disp)         M_MEM (0x22,a,b,disp)           /* load flt   */
+#define M_DLD(a,b,disp)         M_MEM (0x23,a,b,disp)           /* load dbl   */
+#define M_FST(a,b,disp)         M_MEM (0x26,a,b,disp)           /* store flt  */
+#define M_DST(a,b,disp)         M_MEM (0x27,a,b,disp)           /* store dbl  */
+
+#define M_FADD(a,b,c)           M_FOP3 (0x16, 0x080, a,b,c)     /* flt add    */
+#define M_DADD(a,b,c)           M_FOP3 (0x16, 0x0a0, a,b,c)     /* dbl add    */
+#define M_FSUB(a,b,c)           M_FOP3 (0x16, 0x081, a,b,c)     /* flt sub    */
+#define M_DSUB(a,b,c)           M_FOP3 (0x16, 0x0a1, a,b,c)     /* dbl sub    */
+#define M_FMUL(a,b,c)           M_FOP3 (0x16, 0x082, a,b,c)     /* flt mul    */
+#define M_DMUL(a,b,c)           M_FOP3 (0x16, 0x0a2, a,b,c)     /* dbl mul    */
+#define M_FDIV(a,b,c)           M_FOP3 (0x16, 0x083, a,b,c)     /* flt div    */
+#define M_DDIV(a,b,c)           M_FOP3 (0x16, 0x0a3, a,b,c)     /* dbl div    */
+
+#define M_FADDS(a,b,c)          M_FOP3 (0x16, 0x580, a,b,c)     /* flt add    */
+#define M_DADDS(a,b,c)          M_FOP3 (0x16, 0x5a0, a,b,c)     /* dbl add    */
+#define M_FSUBS(a,b,c)          M_FOP3 (0x16, 0x581, a,b,c)     /* flt sub    */
+#define M_DSUBS(a,b,c)          M_FOP3 (0x16, 0x5a1, a,b,c)     /* dbl sub    */
+#define M_FMULS(a,b,c)          M_FOP3 (0x16, 0x582, a,b,c)     /* flt mul    */
+#define M_DMULS(a,b,c)          M_FOP3 (0x16, 0x5a2, a,b,c)     /* dbl mul    */
+#define M_FDIVS(a,b,c)          M_FOP3 (0x16, 0x583, a,b,c)     /* flt div    */
+#define M_DDIVS(a,b,c)          M_FOP3 (0x16, 0x5a3, a,b,c)     /* dbl div    */
+
+#define M_CVTDF(b,c)            M_FOP3 (0x16, 0x0ac, 31,b,c)    /* dbl2long   */
+#define M_CVTLF(b,c)            M_FOP3 (0x16, 0x0bc, 31,b,c)    /* long2flt   */
+#define M_CVTLD(b,c)            M_FOP3 (0x16, 0x0be, 31,b,c)    /* long2dbl   */
+#define M_CVTDL(b,c)            M_FOP3 (0x16, 0x1af, 31,b,c)    /* dbl2long   */
+#define M_CVTDL_C(b,c)          M_FOP3 (0x16, 0x12f, 31,b,c)    /* dbl2long   */
+#define M_CVTLI(b,c)            M_FOP3 (0x17, 0x130, 31,b,c)    /* long2int   */
+
+#define M_CVTDFS(b,c)           M_FOP3 (0x16, 0x5ac, 31,b,c)    /* dbl2long   */
+#define M_CVTDLS(b,c)           M_FOP3 (0x16, 0x5af, 31,b,c)    /* dbl2long   */
+#define M_CVTDL_CS(b,c)         M_FOP3 (0x16, 0x52f, 31,b,c)    /* dbl2long   */
+#define M_CVTLIS(b,c)           M_FOP3 (0x17, 0x530, 31,b,c)    /* long2int   */
+
+#define M_FCMPEQ(a,b,c)         M_FOP3 (0x16, 0x0a5, a,b,c)     /* c = a==b   */
+#define M_FCMPLT(a,b,c)         M_FOP3 (0x16, 0x0a6, a,b,c)     /* c = a<b    */
+
+#define M_FCMPEQS(a,b,c)        M_FOP3 (0x16, 0x5a5, a,b,c)     /* c = a==b   */
+#define M_FCMPLTS(a,b,c)        M_FOP3 (0x16, 0x5a6, a,b,c)     /* c = a<b    */
+
+#define M_FMOV(fa,fb)           M_FOP3 (0x17, 0x020, fa,fa,fb)  /* b = a      */
+#define M_FMOVN(fa,fb)          M_FOP3 (0x17, 0x021, fa,fa,fb)  /* b = -a     */
+
+#define M_FNOP                  M_FMOV (31,31)
+
+#define M_FBEQZ(fa,disp)        M_BRA (0x31,fa,disp)            /* br a == 0.0*/
+
+/* macros for special commands (see an Alpha-manual for description) **********/ 
+
+#define M_TRAPB                 M_MEM (0x18,0,0,0x0000)        /* trap barrier*/
+
+#define M_S4ADDL(a,b,c)         M_OP3 (0x10,0x02, a,b,c,0)     /* c = a*4 + b */
+#define M_S4ADDQ(a,b,c)         M_OP3 (0x10,0x22, a,b,c,0)     /* c = a*4 + b */
+#define M_S4SUBL(a,b,c)         M_OP3 (0x10,0x0b, a,b,c,0)     /* c = a*4 - b */
+#define M_S4SUBQ(a,b,c)         M_OP3 (0x10,0x2b, a,b,c,0)     /* c = a*4 - b */
+#define M_S8ADDL(a,b,c)         M_OP3 (0x10,0x12, a,b,c,0)     /* c = a*8 + b */
+#define M_S8ADDQ(a,b,c)         M_OP3 (0x10,0x32, a,b,c,0)     /* c = a*8 + b */
+#define M_S8SUBL(a,b,c)         M_OP3 (0x10,0x1b, a,b,c,0)     /* c = a*8 - b */
+#define M_S8SUBQ(a,b,c)         M_OP3 (0x10,0x3b, a,b,c,0)     /* c = a*8 - b */
+#define M_SAADDQ(a,b,c)         M_S8ADDQ(a,b,c)                /* c = a*8 + b */
+
+#define M_S4ADDL_IMM(a,b,c)     M_OP3 (0x10,0x02, a,b,c,1)     /* c = a*4 + b */
+#define M_S4ADDQ_IMM(a,b,c)     M_OP3 (0x10,0x22, a,b,c,1)     /* c = a*4 + b */
+#define M_S4SUBL_IMM(a,b,c)     M_OP3 (0x10,0x0b, a,b,c,1)     /* c = a*4 - b */
+#define M_S4SUBQ_IMM(a,b,c)     M_OP3 (0x10,0x2b, a,b,c,1)     /* c = a*4 - b */
+#define M_S8ADDL_IMM(a,b,c)     M_OP3 (0x10,0x12, a,b,c,1)     /* c = a*8 + b */
+#define M_S8ADDQ_IMM(a,b,c)     M_OP3 (0x10,0x32, a,b,c,1)     /* c = a*8 + b */
+#define M_S8SUBL_IMM(a,b,c)     M_OP3 (0x10,0x1b, a,b,c,1)     /* c = a*8 - b */
+#define M_S8SUBQ_IMM(a,b,c)     M_OP3 (0x10,0x3b, a,b,c,1)     /* c = a*8 - b */
+
+#define M_LLD_U(a,b,disp)       M_MEM (0x0b,a,b,disp)          /* unalign ld  */
+#define M_LST_U(a,b,disp)       M_MEM (0x0f,a,b,disp)          /* unalign st  */
+
+#define M_ZAP(a,b,c)            M_OP3 (0x12,0x30, a,b,c,0)
+#define M_ZAPNOT(a,b,c)         M_OP3 (0x12,0x31, a,b,c,0)
+
+#define M_ZAP_IMM(a,b,c)        M_OP3 (0x12,0x30, a,b,c,1)
+#define M_ZAPNOT_IMM(a,b,c)     M_OP3 (0x12,0x31, a,b,c,1)
+
+#define M_BZEXT(a,b)            M_ZAPNOT_IMM(a, 0x01, b)       /*  8 zeroext  */
+#define M_CZEXT(a,b)            M_ZAPNOT_IMM(a, 0x03, b)       /* 16 zeroext  */
+#define M_IZEXT(a,b)            M_ZAPNOT_IMM(a, 0x0f, b)       /* 32 zeroext  */
+
+#define M_EXTBL(a,b,c)          M_OP3 (0x12,0x06, a,b,c,0)
+#define M_EXTWL(a,b,c)          M_OP3 (0x12,0x16, a,b,c,0)
+#define M_EXTLL(a,b,c)          M_OP3 (0x12,0x26, a,b,c,0)
+#define M_EXTQL(a,b,c)          M_OP3 (0x12,0x36, a,b,c,0)
+#define M_EXTWH(a,b,c)          M_OP3 (0x12,0x5a, a,b,c,0)
+#define M_EXTLH(a,b,c)          M_OP3 (0x12,0x6a, a,b,c,0)
+#define M_EXTQH(a,b,c)          M_OP3 (0x12,0x7a, a,b,c,0)
+#define M_INSBL(a,b,c)          M_OP3 (0x12,0x0b, a,b,c,0)
+#define M_INSWL(a,b,c)          M_OP3 (0x12,0x1b, a,b,c,0)
+#define M_INSLL(a,b,c)          M_OP3 (0x12,0x2b, a,b,c,0)
+#define M_INSQL(a,b,c)          M_OP3 (0x12,0x3b, a,b,c,0)
+#define M_INSWH(a,b,c)          M_OP3 (0x12,0x57, a,b,c,0)
+#define M_INSLH(a,b,c)          M_OP3 (0x12,0x67, a,b,c,0)
+#define M_INSQH(a,b,c)          M_OP3 (0x12,0x77, a,b,c,0)
+#define M_MSKBL(a,b,c)          M_OP3 (0x12,0x02, a,b,c,0)
+#define M_MSKWL(a,b,c)          M_OP3 (0x12,0x12, a,b,c,0)
+#define M_MSKLL(a,b,c)          M_OP3 (0x12,0x22, a,b,c,0)
+#define M_MSKQL(a,b,c)          M_OP3 (0x12,0x32, a,b,c,0)
+#define M_MSKWH(a,b,c)          M_OP3 (0x12,0x52, a,b,c,0)
+#define M_MSKLH(a,b,c)          M_OP3 (0x12,0x62, a,b,c,0)
+#define M_MSKQH(a,b,c)          M_OP3 (0x12,0x72, a,b,c,0)
+
+#define M_EXTBL_IMM(a,b,c)      M_OP3 (0x12,0x06, a,b,c,1)
+#define M_EXTWL_IMM(a,b,c)      M_OP3 (0x12,0x16, a,b,c,1)
+#define M_EXTLL_IMM(a,b,c)      M_OP3 (0x12,0x26, a,b,c,1)
+#define M_EXTQL_IMM(a,b,c)      M_OP3 (0x12,0x36, a,b,c,1)
+#define M_EXTWH_IMM(a,b,c)      M_OP3 (0x12,0x5a, a,b,c,1)
+#define M_EXTLH_IMM(a,b,c)      M_OP3 (0x12,0x6a, a,b,c,1)
+#define M_EXTQH_IMM(a,b,c)      M_OP3 (0x12,0x7a, a,b,c,1)
+#define M_INSBL_IMM(a,b,c)      M_OP3 (0x12,0x0b, a,b,c,1)
+#define M_INSWL_IMM(a,b,c)      M_OP3 (0x12,0x1b, a,b,c,1)
+#define M_INSLL_IMM(a,b,c)      M_OP3 (0x12,0x2b, a,b,c,1)
+#define M_INSQL_IMM(a,b,c)      M_OP3 (0x12,0x3b, a,b,c,1)
+#define M_INSWH_IMM(a,b,c)      M_OP3 (0x12,0x57, a,b,c,1)
+#define M_INSLH_IMM(a,b,c)      M_OP3 (0x12,0x67, a,b,c,1)
+#define M_INSQH_IMM(a,b,c)      M_OP3 (0x12,0x77, a,b,c,1)
+#define M_MSKBL_IMM(a,b,c)      M_OP3 (0x12,0x02, a,b,c,1)
+#define M_MSKWL_IMM(a,b,c)      M_OP3 (0x12,0x12, a,b,c,1)
+#define M_MSKLL_IMM(a,b,c)      M_OP3 (0x12,0x22, a,b,c,1)
+#define M_MSKQL_IMM(a,b,c)      M_OP3 (0x12,0x32, a,b,c,1)
+#define M_MSKWH_IMM(a,b,c)      M_OP3 (0x12,0x52, a,b,c,1)
+#define M_MSKLH_IMM(a,b,c)      M_OP3 (0x12,0x62, a,b,c,1)
+#define M_MSKQH_IMM(a,b,c)      M_OP3 (0x12,0x72, a,b,c,1)
+
+#define M_UMULH(a,b,c)          M_OP3 (0x13,0x30, a,b,c,0)     /* 64 umulh    */
+
+#define M_UMULH_IMM(a,b,c)      M_OP3 (0x13,0x30, a,b,c,1)     /* 64 umulh    */
+
+#define M_CMOVEQ(a,b,c)         M_OP3 (0x11,0x24, a,b,c,0)     /* a==0 ? c=b  */
+#define M_CMOVNE(a,b,c)         M_OP3 (0x11,0x26, a,b,c,0)     /* a!=0 ? c=b  */
+#define M_CMOVLT(a,b,c)         M_OP3 (0x11,0x44, a,b,c,0)     /* a< 0 ? c=b  */
+#define M_CMOVGE(a,b,c)         M_OP3 (0x11,0x46, a,b,c,0)     /* a>=0 ? c=b  */
+#define M_CMOVLE(a,b,c)         M_OP3 (0x11,0x64, a,b,c,0)     /* a<=0 ? c=b  */
+#define M_CMOVGT(a,b,c)         M_OP3 (0x11,0x66, a,b,c,0)     /* a> 0 ? c=b  */
+
+#define M_CMOVEQ_IMM(a,b,c)     M_OP3 (0x11,0x24, a,b,c,1)     /* a==0 ? c=b  */
+#define M_CMOVNE_IMM(a,b,c)     M_OP3 (0x11,0x26, a,b,c,1)     /* a!=0 ? c=b  */
+#define M_CMOVLT_IMM(a,b,c)     M_OP3 (0x11,0x44, a,b,c,1)     /* a< 0 ? c=b  */
+#define M_CMOVGE_IMM(a,b,c)     M_OP3 (0x11,0x46, a,b,c,1)     /* a>=0 ? c=b  */
+#define M_CMOVLE_IMM(a,b,c)     M_OP3 (0x11,0x64, a,b,c,1)     /* a<=0 ? c=b  */
+#define M_CMOVGT_IMM(a,b,c)     M_OP3 (0x11,0x66, a,b,c,1)     /* a> 0 ? c=b  */
+
+/* macros for unused commands (see an Alpha-manual for description) ***********/ 
+
+#define M_ANDNOT(a,b,c,const)   M_OP3 (0x11,0x08, a,b,c,const) /* c = a &~ b  */
+#define M_ORNOT(a,b,c,const)    M_OP3 (0x11,0x28, a,b,c,const) /* c = a |~ b  */
+#define M_XORNOT(a,b,c,const)   M_OP3 (0x11,0x48, a,b,c,const) /* c = a ^~ b  */
+
+#define M_CMPBGE(a,b,c,const)   M_OP3 (0x10,0x0f, a,b,c,const)
+
+#define M_FCMPUN(a,b,c)         M_FOP3 (0x16, 0x0a4, a,b,c)    /* unordered   */
+#define M_FCMPLE(a,b,c)         M_FOP3 (0x16, 0x0a7, a,b,c)    /* c = a<=b    */
+
+#define M_FCMPUNS(a,b,c)        M_FOP3 (0x16, 0x5a4, a,b,c)    /* unordered   */
+#define M_FCMPLES(a,b,c)        M_FOP3 (0x16, 0x5a7, a,b,c)    /* c = a<=b    */
+
+#define M_FBNEZ(fa,disp)        M_BRA (0x35,fa,disp)
+#define M_FBLEZ(fa,disp)        M_BRA (0x33,fa,disp)
+
+#define M_JMP_CO(a,b)           M_MEM (0x1a,a,b,0xc000)        /* call cosub  */
+
+
+/* function gen_resolvebranch **************************************************
+
+       backpatches a branch instruction; Alpha branch instructions are very
+       regular, so it is only necessary to overwrite some fixed bits in the
+       instruction.
+
+       parameters: ip ... pointer to instruction after branch (void*)
+                   so ... offset of instruction after branch  (s4)
+                   to ... offset of branch target             (s4)
+
+*******************************************************************************/
+
+#define gen_resolvebranch(ip,so,to) ((s4*)(ip))[-1]|=((s4)(to)-(so))>>2&0x1fffff
+
+#define SOFTNULLPTRCHECK       /* soft null pointer check supportet as option */
+
+#endif /* _CODEGEN_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/alpha/disass.c b/src/vm/jit/alpha/disass.c
new file mode 100644 (file)
index 0000000..d3db0c3
--- /dev/null
@@ -0,0 +1,448 @@
+/* jit/alpha/disass.c - primitive disassembler for alpha machine code
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   $Id: disass.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "disass.h"
+
+/*  The disassembler uses two tables for decoding the instructions. The first
+       table (ops) is used to classify the instructions based on the op code and
+       contains the instruction names for instructions which don't used the
+       function codes. This table is indexed by the op code (6 bit, 64 entries).
+       The second table (op3s) contains instructions which contain both an op
+       code and a function code. This table is an unsorted list of instructions
+       which is terminated by op code and function code zero. This list is
+       searched linearly for a matching pair of opcode and function code.
+*/
+
+#define ITYPE_UNDEF 0           /* undefined instructions (illegal opcode)    */
+#define ITYPE_JMP   1           /* jump instructions                          */
+#define ITYPE_MEM   2           /* memory instructions                        */
+#define ITYPE_FMEM  3           /* floating point memory instructions         */
+#define ITYPE_BRA   4           /* branch instructions                        */
+#define ITYPE_OP    5           /* integer instructions                       */
+#define ITYPE_FOP   6           /* floating point instructions                */
+
+
+/* instruction decode table for 6 bit op codes                                */
+
+static struct {char *name; int itype;} ops[] = {
+       /* 0x00 */  {"",        ITYPE_UNDEF},
+       /* 0x01 */  {"",        ITYPE_UNDEF},
+       /* 0x02 */  {"",        ITYPE_UNDEF},
+       /* 0x03 */  {"",        ITYPE_UNDEF},
+       /* 0x04 */  {"",        ITYPE_UNDEF},
+       /* 0x05 */  {"",        ITYPE_UNDEF},
+       /* 0x06 */  {"",        ITYPE_UNDEF},
+       /* 0x07 */  {"",        ITYPE_UNDEF},
+       /* 0x08 */  {"lda    ",   ITYPE_MEM},
+       /* 0x09 */  {"ldah   ",   ITYPE_MEM},
+       /* 0x0a */  {"ldb    ",   ITYPE_MEM},
+       /* 0x0b */  {"ldq_u  ",   ITYPE_MEM},
+       /* 0x0c */  {"ldw    ",   ITYPE_MEM},
+       /* 0x0d */  {"stw    ",   ITYPE_MEM},
+       /* 0x0e */  {"stb    ",   ITYPE_MEM},
+       /* 0x0f */  {"stq_u  ",   ITYPE_MEM},
+       /* 0x10 */  {"op     ",    ITYPE_OP},
+       /* 0x11 */  {"op     ",    ITYPE_OP},
+       /* 0x12 */  {"op     ",    ITYPE_OP},
+       /* 0x13 */  {"op     ",    ITYPE_OP},
+       /* 0x14 */  {"",        ITYPE_UNDEF},
+       /* 0x15 */  {"",        ITYPE_UNDEF},
+       /* 0x16 */  {"fop    ",   ITYPE_FOP},
+       /* 0x17 */  {"fop    ",   ITYPE_FOP},
+       /* 0x18 */  {"memfmt ",   ITYPE_MEM},
+       /* 0x19 */  {"",        ITYPE_UNDEF},
+       /* 0x1a */  {"jmp    ",   ITYPE_JMP},
+       /* 0x1b */  {"",        ITYPE_UNDEF},
+       /* 0x1c */  {"op     ",    ITYPE_OP},
+       /* 0x1d */  {"",        ITYPE_UNDEF},
+       /* 0x1e */  {"",        ITYPE_UNDEF},
+       /* 0x1f */  {"",        ITYPE_UNDEF},
+       /* 0x20 */  {"ldf    ",  ITYPE_FMEM},
+       /* 0x21 */  {"ldg    ",  ITYPE_FMEM},
+       /* 0x22 */  {"lds    ",  ITYPE_FMEM},
+       /* 0x23 */  {"ldt    ",  ITYPE_FMEM},
+       /* 0x24 */  {"stf    ",  ITYPE_FMEM},
+       /* 0x25 */  {"stg    ",  ITYPE_FMEM},
+       /* 0x26 */  {"sts    ",  ITYPE_FMEM},
+       /* 0x27 */  {"stt    ",  ITYPE_FMEM},
+       /* 0x28 */  {"ldl    ",   ITYPE_MEM},
+       /* 0x29 */  {"ldq    ",   ITYPE_MEM},
+       /* 0x2a */  {"ldl_l  ",   ITYPE_MEM},
+       /* 0x2b */  {"ldq_l  ",   ITYPE_MEM},
+       /* 0x2c */  {"stl    ",   ITYPE_MEM},
+       /* 0x2d */  {"stq    ",   ITYPE_MEM},
+       /* 0x2e */  {"stl_c  ",   ITYPE_MEM},
+       /* 0x2f */  {"stq_c  ",   ITYPE_MEM},
+       /* 0x30 */  {"br     ",   ITYPE_BRA},
+       /* 0x31 */  {"fbeq   ",   ITYPE_BRA},
+       /* 0x32 */  {"fblt   ",   ITYPE_BRA},
+       /* 0x33 */  {"fble   ",   ITYPE_BRA},
+       /* 0x34 */  {"bsr    ",   ITYPE_BRA},
+       /* 0x35 */  {"fbne   ",   ITYPE_BRA},
+       /* 0x36 */  {"fbge   ",   ITYPE_BRA},
+       /* 0x37 */  {"fbgt   ",   ITYPE_BRA},
+       /* 0x38 */  {"blbc   ",   ITYPE_BRA},
+       /* 0x39 */  {"beq    ",   ITYPE_BRA},
+       /* 0x3a */  {"blt    ",   ITYPE_BRA},
+       /* 0x3b */  {"ble    ",   ITYPE_BRA},
+       /* 0x3c */  {"blbs   ",   ITYPE_BRA},
+       /* 0x3d */  {"bne    ",   ITYPE_BRA},
+       /* 0x3e */  {"bge    ",   ITYPE_BRA},
+       /* 0x3f */  {"bgt    ",   ITYPE_BRA}
+};
+
+
+/* instruction decode list for 6 bit op codes and 9 bit function codes        */
+static struct { u2 op, fun; char *name; }  op3s[] = {
+       { 0x10, 0x00,  "addl   " },
+       { 0x10, 0x40,  "addl/v " },
+       { 0x10, 0x20,  "addq   " },
+       { 0x10, 0x60,  "addq/v " },
+       { 0x10, 0x09,  "subl   " },
+       { 0x10, 0x49,  "subl/v " },
+       { 0x10, 0x29,  "subq   " },
+       { 0x10, 0x69,  "subq/v " },
+       { 0x10, 0x2D,  "cmpeq  " },
+       { 0x10, 0x4D,  "cmplt  " },
+       { 0x10, 0x6D,  "cmple  " },
+       { 0x10, 0x1D,  "cmpult " },
+       { 0x10, 0x3D,  "cmpule " },
+       { 0x10, 0x0F,  "cmpbge " },
+       { 0x10, 0x02,  "s4addl " },
+       { 0x10, 0x0b,  "s4subl " },
+       { 0x10, 0x22,  "s4addq " },
+       { 0x10, 0x2b,  "s4subq " },
+       { 0x10, 0x12,  "s8addl " },
+       { 0x10, 0x1b,  "s8subl " },
+       { 0x10, 0x32,  "s8addq " },
+       { 0x10, 0x3b,  "s8subq " },
+       { 0x11, 0x00,  "and    " },
+       { 0x11, 0x20,  "or     " },
+       { 0x11, 0x40,  "xor    " },
+       { 0x11, 0x08,  "andnot " },
+       { 0x11, 0x28,  "ornot  " },
+       { 0x11, 0x48,  "xornot " },
+       { 0x11, 0x24,  "cmoveq " },
+       { 0x11, 0x44,  "cmovlt " },
+       { 0x11, 0x64,  "cmovle " },
+       { 0x11, 0x26,  "cmovne " },
+       { 0x11, 0x46,  "cmovge " },
+       { 0x11, 0x66,  "cmovgt " },
+       { 0x11, 0x14,  "cmovlbs" },
+       { 0x11, 0x16,  "cmovlbc" },
+       { 0x12, 0x39,  "sll    " },
+       { 0x12, 0x3C,  "sra    " },
+       { 0x12, 0x34,  "srl    " },
+       { 0x12, 0x30,  "zap    " },
+       { 0x12, 0x31,  "zapnot " },
+       { 0x12, 0x06,  "extbl  " },
+       { 0x12, 0x16,  "extwl  " },
+       { 0x12, 0x26,  "extll  " },
+       { 0x12, 0x36,  "extql  " },
+       { 0x12, 0x5a,  "extwh  " },
+       { 0x12, 0x6a,  "extlh  " },
+       { 0x12, 0x7a,  "extqh  " },
+       { 0x12, 0x0b,  "insbl  " },
+       { 0x12, 0x1b,  "inswl  " },
+       { 0x12, 0x2b,  "insll  " },
+       { 0x12, 0x3b,  "insql  " },
+       { 0x12, 0x57,  "inswh  " },
+       { 0x12, 0x67,  "inslh  " },
+       { 0x12, 0x77,  "insqh  " },
+       { 0x12, 0x02,  "mskbl  " },
+       { 0x12, 0x12,  "mskwl  " },
+       { 0x12, 0x22,  "mskll  " },
+       { 0x12, 0x32,  "mskql  " },
+       { 0x12, 0x52,  "mskwh  " },
+       { 0x12, 0x62,  "msklh  " },
+       { 0x12, 0x72,  "mskqh  " },
+       { 0x13, 0x00,  "mull   " },
+       { 0x13, 0x20,  "mulq   " },
+       { 0x13, 0x40,  "mull/v " },
+       { 0x13, 0x60,  "mulq/v " },
+       { 0x13, 0x30,  "umulh  " },
+       { 0x16, 0x080, "fadd   " },
+       { 0x16, 0x0a0, "dadd   " },
+       { 0x16, 0x081, "fsub   " },
+       { 0x16, 0x0a1, "dsub   " },
+       { 0x16, 0x082, "fmul   " },
+       { 0x16, 0x0a2, "dmul   " },
+       { 0x16, 0x083, "fdiv   " },
+       { 0x16, 0x0a3, "ddiv   " },
+       { 0x16, 0x580, "fadds  " },
+       { 0x16, 0x5a0, "dadds  " },
+       { 0x16, 0x581, "fsubs  " },
+       { 0x16, 0x5a1, "dsubs  " },
+       { 0x16, 0x582, "fmuls  " },
+       { 0x16, 0x5a2, "dmuls  " },
+       { 0x16, 0x583, "fdivs  " },
+       { 0x16, 0x5a3, "ddivs  " },
+       { 0x16, 0x0ac, "cvtdf  " },
+       { 0x16, 0x0bc, "cvtlf  " },
+       { 0x16, 0x0be, "cvtld  " },
+       { 0x16, 0x0af, "cvtdl  " },
+       { 0x16, 0x02f, "cvtdlc " },
+       { 0x17, 0x030, "cvtli  " },
+       { 0x16, 0x1af, "cvtdlv " },
+       { 0x16, 0x12f, "cvtdlcv" },
+       { 0x17, 0x130, "cvtliv " },
+       { 0x16, 0x5ac, "cvtdfs " },
+       { 0x16, 0x5af, "cvtdls " },
+       { 0x16, 0x52f, "cvtdlcs" },
+       { 0x16, 0x0a4, "fcmpun " },
+       { 0x16, 0x0a5, "fcmpeq " },
+       { 0x16, 0x0a6, "fcmplt " },
+       { 0x16, 0x0a7, "fcmple " },
+       { 0x16, 0x5a4, "fcmpuns" },
+       { 0x16, 0x5a5, "fcmpeqs" },
+       { 0x16, 0x5a6, "fcmplts" },
+       { 0x16, 0x5a7, "fcmples" },
+       { 0x17, 0x020, "fmov   " },
+       { 0x17, 0x021, "fmovn  " },
+       { 0x1c, 0x0,   "bsext  " },
+       { 0x1c, 0x1,   "wsext  " },
+       
+       { 0x00, 0x00,  NULL }
+};
+
+
+/* name table for 32 integer registers                                        */
+
+char *regs[] = {
+       /* 0x00 */  "v0",   /*  "$0", */
+       /* 0x01 */  "t0",   /*  "$1", */
+       /* 0x02 */  "t1",   /*  "$2", */
+       /* 0x03 */  "t2",   /*  "$3", */
+       /* 0x04 */  "t3",   /*  "$4", */
+       /* 0x05 */  "t4",   /*  "$5", */
+       /* 0x06 */  "t5",   /*  "$6", */
+       /* 0x07 */  "t6",   /*  "$7", */
+
+       /* 0x08 */  "t7",   /*  "$8", */
+       /* 0x09 */  "s0",   /*  "$9", */
+       /* 0x0a */  "s1",   /* "$10", */
+       /* 0x0b */  "s2",   /* "$11", */
+       /* 0x0c */  "s3",   /* "$12", */
+       /* 0x0d */  "s4",   /* "$13", */
+       /* 0x0e */  "s5",   /* "$14", */
+       /* 0x0f */  "s6",   /* "$15", */
+
+       /* 0x10 */  "a0",   /* "$16", */
+       /* 0x11 */  "a1",   /* "$17", */
+       /* 0x12 */  "a2",   /* "$18", */
+       /* 0x13 */  "a3",   /* "$19", */
+       /* 0x14 */  "a4",   /* "$20", */
+       /* 0x15 */  "a5",   /* "$21", */
+       /* 0x16 */  "t8",   /* "$22", */
+       /* 0x17 */  "t9",   /* "$23", */
+
+       /* 0x18 */  "t10",  /* "$24", */
+       /* 0x19 */  "t11",  /* "$25", */
+       /* 0x1a */  "ra",   /* "$26", */
+       /* 0x1b */  "pv",   /* "$27", */
+       /* 0x1c */  "at",   /* "$28", */
+       /* 0x1d */  "gp",   /* "$29", */
+       /* 0x1e */  "sp",   /* "$30", */
+       /* 0x1f */  "zero"  /* "$31"  */
+};
+
+
+/* function disassinstr ********************************************************
+
+       outputs a disassembler listing of one machine code instruction on 'stdout'
+       c:   instructions machine code
+       pos: instructions address relative to method start
+
+*******************************************************************************/
+
+void disassinstr(int c, int pos)
+{
+       int op;                     /* 6 bit op code                              */
+       int opfun;                  /* 7 bit function code                        */
+       int ra, rb, rc;             /* 6 bit register specifiers                  */
+       int lit;                    /* 8 bit unsigned literal                     */
+       int i;                      /* loop counter                               */
+
+       op    = (c >> 26) & 0x3f;   /* 6 bit op code                              */
+       opfun = (c >> 5)  & 0x7f;   /* 7 bit function code                        */
+       ra    = (c >> 21) & 0x1f;   /* 6 bit source register specifier            */
+       rb    = (c >> 16) & 0x1f;   /* 6 bit source register specifier            */
+       rc    = (c >> 0)  & 0x1f;   /* 6 bit destination register specifiers      */
+       lit   = (c >> 13) & 0xff;   /* 8 bit unsigned literal                     */
+
+       printf ("%6x: %8x  ", pos, c);
+       
+       switch (ops[op].itype) {
+               case ITYPE_JMP:
+                       switch ((c >> 14) & 3) {  /* branch hint */
+                               case 0:
+                                       if (ra == 31) {
+                                               printf ("jmp     (%s)\n", regs[rb]); 
+                                               return;
+                                               }
+                                       printf ("jmp     "); 
+                                       break;
+                               case 1:
+                                       if (ra == 26) {
+                                               printf ("jsr     (%s)\n", regs[rb]); 
+                                               return;
+                                               }
+                                       printf ("jsr     "); 
+                                       break;
+                               case 2:
+                                       if (ra == 31 && rb == 26) {
+                                               printf ("ret\n"); 
+                                               return;
+                                               }
+                                       if (ra == 31) {
+                                               printf ("ret     (%s)\n", regs[rb]); 
+                                               return;
+                                               }
+                                       printf ("ret     ");
+                                       break;
+                               case 3:
+                                       printf ("jsr_co  "); 
+                                       break;
+                               }
+                       printf ("%s,(%s)\n", regs[ra], regs[rb]); 
+                       break;
+
+               case ITYPE_MEM: {
+                       int disp = (c << 16) >> 16; /* 16 bit signed displacement         */
+
+                       if (op == 0x18 && ra == 0 && ra == 0 && disp == 0)
+                               printf ("trapb\n"); 
+                       else
+                               printf ("%s %s,%d(%s)\n", ops[op].name, regs[ra], disp, regs[rb]); 
+                       break;
+                       }
+
+               case ITYPE_FMEM: {
+                       printf ("%s $f%d,%d(%s)\n", ops[op].name, ra, (c << 16) >> 16, regs[rb]); 
+                       break;
+                       }
+
+               case ITYPE_BRA:             /* 21 bit signed branch offset */
+                       if (op == 0x30 && ra == 31)
+                               printf("br      0x%x\n", pos + 4 + ((c << 11) >> 9));
+                       else if (op == 0x34 && ra == 26)
+                               printf("brs     0x%x\n", pos + 4 + ((c << 11) >> 9));
+                       else
+                               printf("%s %s,0x%x\n",
+                                      ops[op].name, regs[ra], pos + 4 + ((c << 11) >> 9));
+                       break;
+                       
+               case ITYPE_FOP: {
+                       int fopfun = (c >> 5) & 0x7ff;  /* 11 bit fp function code        */
+
+                       if (op == 0x17 && fopfun == 0x020 && ra == rb) {
+                               if (ra == 31 && rc == 31)
+                                       printf("fnop\n");
+                               else
+                                       printf("fmov    $f%d,$f%d\n", ra, rc);
+                               return;
+                               }
+                       for (i = 0; op3s[i].name; i++)
+                               if (op3s[i].op == op && op3s[i].fun == fopfun) {
+                                       printf("%s $f%d,$f%d,$f%d\n", op3s[i].name, ra, rb,  rc);
+                                       return;
+                                       }
+                       printf("%s%x $f%d,$f%d,$f%d\n", ops[op].name, fopfun, ra, rb, rc);
+                       break;
+                       }
+
+               case ITYPE_OP:
+                       if (op == 0x11 && opfun == 0x20 && ra == rb && ~(c&0x1000)) {
+                               if (ra == 31 && rc == 31)
+                                       printf("nop\n");
+                               else if (ra == 31)
+                                       printf("clr     %s\n", regs[rc]);
+                               else
+                                       printf("mov     %s,%s\n", regs[ra], regs[rc]);
+                               return;
+                               }
+                       for (i = 0; op3s[i].name; i++) {
+                               if (op3s[i].op == op && op3s[i].fun == opfun) {
+                                       if (c & 0x1000)                  /* immediate instruction */
+                                               printf("%s %s,%d,%s\n",
+                                                      op3s[i].name, regs[ra], lit, regs[rc]);
+                                       else
+                                               printf("%s %s,%s,%s\n",
+                                                      op3s[i].name, regs[ra], regs[rb], regs[rc]);
+                                       return;
+                                       }
+                               }
+                       /* fall through */
+               default:
+                       if (c & 0x1000)                          /* immediate instruction */
+                               printf("UNDEF  %x(%x) $%d,%d,$%d\n", op, opfun, ra, lit, rc);
+                       else
+                               printf("UNDEF  %x(%x) $%d,$%d,$%d\n", op, opfun, ra, rb,  rc);          
+               }
+}
+
+
+/* function disassemble ********************************************************
+
+       outputs a disassembler listing of some machine code on 'stdout'
+       code: pointer to first instruction
+       len:  code size (number of instructions * 4)
+
+*******************************************************************************/
+
+void disassemble(int *code, int len)
+{
+       int p;
+
+       printf ("  --- disassembler listing ---\n");    
+       for (p = 0; p < len; p += 4, code++)
+               disassinstr(*code, p); 
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/alpha/disass.h b/src/vm/jit/alpha/disass.h
new file mode 100644 (file)
index 0000000..6dcb05e
--- /dev/null
@@ -0,0 +1,62 @@
+/* alpha/disass.h - disassembler header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: disass.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _DISASS_H
+#define _DISASS_H
+
+#include "types.h"
+
+
+extern char *regs[];
+
+
+/* function prototypes */
+void disassinstr(int c, int pos);
+void disassemble(int *code, int len);
+
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/alpha/types.h b/src/vm/jit/alpha/types.h
new file mode 100644 (file)
index 0000000..fac2f72
--- /dev/null
@@ -0,0 +1,94 @@
+/* jit/alpha/types.h - machine specific definitions for alpha processor
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas  Krall
+            Michael Gschwind
+
+   $Id: types.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _TYPES_H
+#define _TYPES_H
+
+#define POINTERSIZE         8
+#define WORDS_BIGENDIAN     0
+
+#define SUPPORT_DIVISION    0
+#define SUPPORT_LONG        1
+#define SUPPORT_FLOAT       1
+#define SUPPORT_DOUBLE      1
+
+#define SUPPORT_LONG_ADD    1
+#define SUPPORT_LONG_CMP    1
+#define SUPPORT_LONG_LOG    1
+#define SUPPORT_LONG_SHIFT  1
+#define SUPPORT_LONG_MULDIV 1
+#define SUPPORT_LONG_ICVT   1
+#define SUPPORT_LONG_FCVT   1
+
+#define CONDITIONAL_LOADCONST
+
+#define U8_AVAILABLE        1
+
+
+typedef signed char             s1;
+typedef unsigned char           u1;
+typedef signed short int        s2;
+typedef unsigned short int      u2;
+
+typedef signed int              s4;
+typedef unsigned int            u4;
+
+#if U8_AVAILABLE
+typedef signed long int         s8;
+typedef unsigned long int       u8; 
+#else
+typedef struct {u4 low, high;}  u8;
+#define s8 u8
+#endif
+
+#endif /* _TYPES_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+
+
index 2504c53f5451cc1db7a709097bc442876378acf2..6b15f6dece832368cc983261d781aaf4fc0733b2 100644 (file)
@@ -1,22 +1,41 @@
-/****************************** asmpart.h **************************************
+/* asmpart.h - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Headerfile for asmpart.S. asmpart.S contains the machine dependent
-       Java - C interface functions.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1997/10/15
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas Krall
+
+   $Id: asmpart.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include "global.h"
 
-/* determines if the byte support instruction set (21164a and higher)
+/* 
+   determines if the byte support instruction set (21164a and higher)
    is available.
 */
 int has_no_x_instr_set();
@@ -24,21 +43,24 @@ int has_no_x_instr_set();
 void synchronize_caches();
 
 
-/* invokes the compiler for untranslated JavaVM methods.
+/* 
+   invokes the compiler for untranslated JavaVM methods.
    Register R0 contains a pointer to the method info structure
    (prepared by createcompilerstub).
 */
 void asm_call_jit_compiler();
 
 
-/* This function calls a Java-method (which possibly needs compilation)
+/* 
+   This function calls a Java-method (which possibly needs compilation)
    with up to 4 parameters. This function calls a Java-method (which
    possibly needs compilation) with up to 4 parameters.
 */
 java_objectheader *asm_calljavamethod(methodinfo *m, void *arg1, void *arg2,
                                       void *arg3, void *arg4);
 
-/* This function calls a Java-method (which possibly needs compilation)
+/* 
+   This function calls a Java-method (which possibly needs compilation)
    with up to 4 parameters. This function calls a Java-method (which
    possibly needs compilation) with up to 4 parameters. 
    also supports a return value
@@ -46,12 +68,17 @@ java_objectheader *asm_calljavamethod(methodinfo *m, void *arg1, void *arg2,
 java_objectheader *asm_calljavafunction(methodinfo *m, void *arg1, void *arg2,
                                         void *arg3, void *arg4);
 
-/* gets the class of the caller from the stack frame
+void asm_handle_exception();
+void asm_handle_nat_exception();
+
+/* 
+   gets the class of the caller from the stack frame
 */
 methodinfo *asm_getcallingmethod();
 
 
-/* This funtion saves all callee saved registers and calls the function
+/* 
+   This funtion saves all callee saved registers and calls the function
    which is passed as parameter.
    This function is needed by the garbage collector, which needs to access
    all registers which are stored on the stack. Unused registers are
@@ -64,3 +91,17 @@ void *asm_switchstackandcall(void *stack, void *func, void **stacktopsave, void
 
 void asm_builtin_trace();
 void asm_builtin_exittrace();
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/codegen.inc b/src/vm/jit/codegen.inc
new file mode 100644 (file)
index 0000000..0e1dea2
--- /dev/null
@@ -0,0 +1,445 @@
+/* jit/codegen.inc - architecture independent code generator
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas  Krall
+
+   Changes: Michael Gschwind
+            Christian Thalinger
+
+   All functions assume the following code area / data area layout:
+
+   +-----------+
+   |           |
+   | code area | code area grows to higher addresses
+   |           |
+   +-----------+ <-- start of procedure
+   |           |
+   | data area | data area grows to lower addresses
+   |           |
+   +-----------+
+
+   The functions first write into a temporary code/data area allocated by
+   "codegen_init". "codegen_finish" copies the code and data area into permanent
+   memory. All functions writing values into the data area return the offset
+   relative the begin of the code area (start of procedure).   
+
+   $Id: codegen.inc 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include "toolbox/memory.h"
+#include "toolbox/loging.h"
+
+
+#define MCODEINITSIZE (1<<15)       /* 32 Kbyte code area initialization size */
+#define DSEGINITSIZE  (1<<12)       /*  4 Kbyte data area initialization size */
+
+static u1* mcodebase = NULL;        /* base pointer of code area              */
+static s4* mcodeend  = NULL;        /* pointer to end of code area            */
+static int mcodesize;               /* complete size of code area (bytes)     */
+
+static u1* dsegtop = NULL;          /* pointer to top (end) of data area      */
+static int dsegsize;                /* complete size of data area (bytes)     */
+int dseglen;                        /* used size of data area (bytes)         */
+                                    /* data area grows from top to bottom     */
+
+static jumpref *jumpreferences;     /* list of jumptable target addresses     */
+static dataref *datareferences;     /* list of data segment references        */
+static branchref *xboundrefs;       /* list of bound check branches           */
+static branchref *xcheckarefs;      /* list of array size check branches      */
+static branchref *xnullrefs;        /* list of null check branches            */
+static branchref *xcastrefs;        /* list of cast check branches            */
+static branchref *xdivrefs;         /* list of divide by zero branches        */
+
+void codegen_init();                /* allocates code and data area           */
+void codegen_close();               /* releases temporary storage             */
+static void codegen_finish();       /* makes code and data area permanent and */
+                                    /* updates branch references to code/data */
+
+static s4 dseg_adds4(s4 value);         /* adds an int to data area           */
+static s4 dseg_adds8(s8 value);         /* adds an long to data area          */
+static s4 dseg_addfloat (float value);  /* adds an float to data area         */
+static s4 dseg_adddouble(double value); /* adds an double to data area        */
+
+#if POINTERSIZE == 8
+#define dseg_addaddress(value)      dseg_adds8((s8)(value))
+#else
+#define dseg_addaddress(value)      dseg_adds4((s4)(value))
+#endif
+
+static void dseg_addtarget(basicblock *target);
+static void dseg_adddata(u1 *ptr);
+static void codegen_addreference(basicblock *target, void *branchptr);
+static void codegen_addxboundrefs(void *branchptr);
+static void codegen_addxnullrefs(void *branchptr);
+static void codegen_addxcastrefs(void *branchptr);
+static void codegen_addxdivrefs(void *branchptr);
+
+void dseg_display(s4 *s4ptr);
+
+
+
+/* codegen_init allocates and initialises code area, data area and references   */
+
+void codegen_init()
+{
+       if (!mcodebase) {
+               mcodebase = MNEW(u1, MCODEINITSIZE);
+               mcodesize = MCODEINITSIZE;
+       }
+
+       if (!dsegtop) {
+               dsegtop = MNEW(u1, DSEGINITSIZE);
+               dsegsize = DSEGINITSIZE;
+               dsegtop += dsegsize;
+       }
+
+       dseglen = 0;
+
+       jumpreferences = NULL;
+       datareferences = NULL;
+       xboundrefs = NULL;
+       xnullrefs = NULL;
+       xcastrefs = NULL;
+       xdivrefs = NULL;
+}
+
+
+
+/* codegen_close releases temporary code and data area                          */
+
+void codegen_close()
+{
+       if (mcodebase) {
+               MFREE(mcodebase, u1, mcodesize);
+               mcodebase = NULL;
+       }
+
+       if (dsegtop) {
+               MFREE(dsegtop - dsegsize, u1, dsegsize);
+               dsegtop = NULL;
+       }
+}
+
+
+
+/* codegen_increase doubles code area                                           */
+
+static s4 *codegen_increase(u1 *codeptr)
+{
+       long len;
+
+       len = codeptr - mcodebase;
+       mcodebase = MREALLOC(mcodebase, u1, mcodesize, mcodesize * 2);
+       mcodesize *= 2;
+       mcodeend = (s4*) (mcodebase + mcodesize);
+       return (s4*) (mcodebase + len);
+}
+
+
+
+/* desg_increase doubles data area                                            */
+
+static void dseg_increase()
+{
+       u1 *newstorage = MNEW(u1, dsegsize * 2);
+       memcpy(newstorage + dsegsize, dsegtop - dsegsize, dsegsize);
+       MFREE(dsegtop - dsegsize, u1, dsegsize);
+       dsegtop = newstorage;
+       dsegsize *= 2;
+       dsegtop += dsegsize;
+}
+
+
+
+static s4 dseg_adds4_increase(s4 value)
+{
+       dseg_increase();
+       *((s4 *) (dsegtop - dseglen)) = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adds4(s4 value)
+{
+       s4 *dataptr;
+
+       dseglen += 4;
+       dataptr = (s4 *) (dsegtop - dseglen);
+       if (dseglen > dsegsize)
+               return dseg_adds4_increase(value);
+       *dataptr = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adds8_increase(s8 value)
+{
+       dseg_increase();
+       *((s8 *) (dsegtop - dseglen)) = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adds8(s8 value)
+{
+       s8 *dataptr;
+
+       dseglen = ALIGN (dseglen + 8, 8);
+       dataptr = (s8 *) (dsegtop - dseglen);
+       if (dseglen > dsegsize)
+               return dseg_adds8_increase(value);
+       *dataptr = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_addfloat_increase(float value)
+{
+       dseg_increase();
+       *((float *) (dsegtop - dseglen)) = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_addfloat(float value)
+{
+       float *dataptr;
+
+       dseglen += 4;
+       dataptr = (float *) (dsegtop - dseglen);
+       if (dseglen > dsegsize)
+               return dseg_addfloat_increase(value);
+       *dataptr = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adddouble_increase(double value)
+{
+       dseg_increase();
+       *((double *) (dsegtop - dseglen)) = value;
+       return -dseglen;
+}
+
+
+
+static s4 dseg_adddouble(double value)
+{
+       double *dataptr;
+
+       dseglen = ALIGN (dseglen + 8, 8);
+       dataptr = (double *) (dsegtop - dseglen);
+       if (dseglen > dsegsize)
+               return dseg_adddouble_increase(value);
+       *dataptr = value;
+       return -dseglen;
+}
+
+
+
+static void dseg_addtarget(basicblock *target)
+{
+       jumpref *jr = DNEW(jumpref);
+
+       jr->tablepos = dseg_addaddress(NULL);
+       jr->target = target;
+       jr->next = jumpreferences;
+       jumpreferences = jr;
+}
+
+
+
+static void dseg_adddata(u1 *ptr)
+{
+       dataref *dr = DNEW(dataref);
+
+       dr->pos = (u1 *) (ptr - mcodebase);
+       dr->next = datareferences;
+       datareferences = dr;
+}
+
+
+
+static void codegen_addreference(basicblock *target, void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       if (target->mpc >= 0) {
+               gen_resolvebranch((u1*) mcodebase + branchpos, branchpos, target->mpc);
+       }
+       else {
+               branchref *br = DNEW(branchref);
+
+               br->branchpos = branchpos;
+               br->next = target->branchrefs;
+               target->branchrefs= br;
+       }
+}
+
+
+
+static void codegen_addxboundrefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xboundrefs;
+       xboundrefs = br;
+}
+
+
+
+static void codegen_addxcheckarefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xcheckarefs;
+       xcheckarefs = br;
+}
+
+
+
+static void codegen_addxnullrefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xnullrefs;
+       xnullrefs = br;
+}
+
+
+
+static void codegen_addxcastrefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xcastrefs;
+       xcastrefs = br;
+}
+
+
+
+static void codegen_addxdivrefs(void *branchptr)
+{
+       s4 branchpos = (u1*) branchptr - mcodebase;
+
+       branchref *br = DNEW(branchref);
+
+       br->branchpos = branchpos;
+       br->next = xdivrefs;
+       xdivrefs = br;
+}
+
+
+
+static void codegen_finish(int mcodelen)
+{
+       jumpref *jr;
+       u1 *epoint;
+
+       count_code_len += mcodelen;
+       count_data_len += dseglen;
+
+       dseglen = ALIGN(dseglen, MAX_ALIGN);
+
+       method -> mcodelength = mcodelen + dseglen;
+       method -> mcode = CNEW(u1, mcodelen + dseglen);
+
+       memcpy ( method->mcode, dsegtop - dseglen, dseglen);
+       memcpy ( method->mcode + dseglen, mcodebase, mcodelen);
+
+       method -> entrypoint = epoint = (u1*) (method->mcode + dseglen);
+
+       /* jump table resolving */
+       jr = jumpreferences;
+       while (jr != NULL) {
+           *((void**) (epoint + jr->tablepos)) = epoint + jr->target->mpc;
+           jr = jr->next;
+       }
+
+#if defined(__I386__) || defined(__X86_64__)
+       {
+               dataref *dr;
+               /* add method into datastructure to find the entrypoint */
+               addmethod(method->entrypoint, method->entrypoint + mcodelen);
+        
+               /* data segment references resolving */
+               dr = datareferences;
+               while (dr != NULL) {
+                       *((void**) ((long) epoint + (long) dr->pos - POINTERSIZE)) = epoint;
+                       dr = dr->next;
+               }
+       }
+#endif
+}
+
+
+
+void dseg_display(s4 *s4ptr)
+{
+       int i;
+       
+       printf("  --- dump of datasegment\n");
+       for (i = dseglen; i > 0 ; i -= 4) {
+               printf("-%6x: %8x\n", i, (int)(*s4ptr++));
+       }
+       printf("  --- begin of data segment: %p\n", s4ptr);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/i386/Makefile.am b/src/vm/jit/i386/Makefile.am
new file mode 100644 (file)
index 0000000..c39bb7b
--- /dev/null
@@ -0,0 +1,36 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+
+INCLUDES = -I$(top_srcdir)/jit
+
+EXTRA_DIST = \
+       asmpart.S \
+       disass.c \
+       disass.h \
+       native-math.h \
+       codegen.c \
+       codegen.h \
+       methodtable.c \
+       methodtable.h \
+       types.h \
+       threads.h \
+       dis-asm.h \
+       bfd.h
+
+noinst_LIBRARIES = libarch.a
+
+libarch_a_SOURCES = asmpart.S codegen.c disass.c i386-dis.c dis-buf.c methodtable.c
+
+%.o: %.S
+       $(COMPILE) -c $<
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
diff --git a/src/vm/jit/i386/ansidecl.h b/src/vm/jit/i386/ansidecl.h
new file mode 100644 (file)
index 0000000..9a7c577
--- /dev/null
@@ -0,0 +1,295 @@
+/* ANSI and traditional C compatability macros
+   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* ANSI and traditional C compatibility macros
+
+   ANSI C is assumed if __STDC__ is #defined.
+
+   Macro               ANSI C definition       Traditional C definition
+   -----               ---- - ----------       ----------- - ----------
+   ANSI_PROTOTYPES     1                       not defined
+   PTR                 `void *'                `char *'
+   PTRCONST            `void *const'           `char *'
+   LONG_DOUBLE         `long double'           `double'
+   const               not defined             `'
+   volatile            not defined             `'
+   signed              not defined             `'
+   VA_START(ap, var)   va_start(ap, var)       va_start(ap)
+
+   Note that it is safe to write "void foo();" indicating a function
+   with no return value, in all K+R compilers we have been able to test.
+
+   For declaring functions with prototypes, we also provide these:
+
+   PARAMS ((prototype))
+   -- for functions which take a fixed number of arguments.  Use this
+   when declaring the function.  When defining the function, write a
+   K+R style argument list.  For example:
+
+       char *strcpy PARAMS ((char *dest, char *source));
+       ...
+       char *
+       strcpy (dest, source)
+            char *dest;
+            char *source;
+       { ... }
+
+
+   VPARAMS ((prototype, ...))
+   -- for functions which take a variable number of arguments.  Use
+   PARAMS to declare the function, VPARAMS to define it.  For example:
+
+       int printf PARAMS ((const char *format, ...));
+       ...
+       int
+       printf VPARAMS ((const char *format, ...))
+       {
+          ...
+       }
+
+   For writing functions which take variable numbers of arguments, we
+   also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros.  These
+   hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
+   thoroughly than the simple VA_START() macro mentioned above.
+
+   VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
+   Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
+   corresponding to the list of fixed arguments.  Then use va_arg
+   normally to get the variable arguments, or pass your va_list object
+   around.  You do not declare the va_list yourself; VA_OPEN does it
+   for you.
+
+   Here is a complete example:
+
+       int
+       printf VPARAMS ((const char *format, ...))
+       {
+          int result;
+
+          VA_OPEN (ap, format);
+          VA_FIXEDARG (ap, const char *, format);
+
+          result = vfprintf (stdout, format, ap);
+          VA_CLOSE (ap);
+
+          return result;
+       }
+
+
+   You can declare variables either before or after the VA_OPEN,
+   VA_FIXEDARG sequence.  Also, VA_OPEN and VA_CLOSE are the beginning
+   and end of a block.  They must appear at the same nesting level,
+   and any variables declared after VA_OPEN go out of scope at
+   VA_CLOSE.  Unfortunately, with a K+R compiler, that includes the
+   argument list.  You can have multiple instances of VA_OPEN/VA_CLOSE
+   pairs in a single function in case you need to traverse the
+   argument list more than once.
+
+   For ease of writing code which uses GCC extensions but needs to be
+   portable to other compilers, we provide the GCC_VERSION macro that
+   simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
+   wrappers around __attribute__.  Also, __extension__ will be #defined
+   to nothing if it doesn't work.  See below.
+
+   This header also defines a lot of obsolete macros:
+   CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
+   AND, DOTS, NOARGS.  Don't use them.  */
+
+#ifndef        _ANSIDECL_H
+#define _ANSIDECL_H    1
+
+/* Every source file includes this file,
+   so they will all get the switch for lint.  */
+/* LINTLIBRARY */
+
+/* Using MACRO(x,y) in cpp #if conditionals does not work with some
+   older preprocessors.  Thus we can't define something like this:
+
+#define HAVE_GCC_VERSION(MAJOR, MINOR) \
+  (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
+
+and then test "#if HAVE_GCC_VERSION(2,7)".
+
+So instead we use the macro below and test it against specific values.  */
+
+/* This macro simplifies testing whether we are using gcc, and if it
+   is of a particular minimum version. (Both major & minor numbers are
+   significant.)  This macro will evaluate to 0 if we are not using
+   gcc at all.  */
+#ifndef GCC_VERSION
+#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#endif /* GCC_VERSION */
+
+#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
+/* All known AIX compilers implement these things (but don't always
+   define __STDC__).  The RISC/OS MIPS compiler defines these things
+   in SVR4 mode, but does not define __STDC__.  */
+
+#define ANSI_PROTOTYPES        1
+#define PTR            void *
+#define PTRCONST       void *const
+#define LONG_DOUBLE    long double
+
+#define PARAMS(ARGS)           ARGS
+#define VPARAMS(ARGS)          ARGS
+#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
+
+/* variadic function helper macros */
+/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
+   use without inhibiting further decls and without declaring an
+   actual variable.  */
+#define VA_OPEN(AP, VAR)       { va_list AP; va_start(AP, VAR); { struct Qdmy
+#define VA_CLOSE(AP)           } va_end(AP); }
+#define VA_FIXEDARG(AP, T, N)  struct Qdmy
+#undef const
+#undef volatile
+#undef signed
+
+/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
+   it too, but it's not in C89.  */
+#undef inline
+#if __STDC_VERSION__ > 199901L
+/* it's a keyword */
+#else
+# if GCC_VERSION >= 2007
+#  define inline __inline__   /* __inline__ prevents -pedantic warnings */
+# else
+#  define inline  /* nothing */
+# endif
+#endif
+
+/* These are obsolete.  Do not use.  */
+#ifndef IN_GCC
+#define CONST          const
+#define VOLATILE       volatile
+#define SIGNED         signed
+
+#define PROTO(type, name, arglist)     type name arglist
+#define EXFUN(name, proto)             name proto
+#define DEFUN(name, arglist, args)     name(args)
+#define DEFUN_VOID(name)               name(void)
+#define AND            ,
+#define DOTS           , ...
+#define NOARGS         void
+#endif /* ! IN_GCC */
+
+#else  /* Not ANSI C.  */
+
+#undef  ANSI_PROTOTYPES
+#define PTR            char *
+#define PTRCONST       PTR
+#define LONG_DOUBLE    double
+
+#define PARAMS(args)           ()
+#define VPARAMS(args)          (va_alist) va_dcl
+#define VA_START(va_list, var) va_start(va_list)
+
+#define VA_OPEN(AP, VAR)               { va_list AP; va_start(AP); { struct Qdmy
+#define VA_CLOSE(AP)                   } va_end(AP); }
+#define VA_FIXEDARG(AP, TYPE, NAME)    TYPE NAME = va_arg(AP, TYPE)
+
+/* some systems define these in header files for non-ansi mode */
+#undef const
+#undef volatile
+#undef signed
+#undef inline
+#define const
+#define volatile
+#define signed
+#define inline
+
+#ifndef IN_GCC
+#define CONST
+#define VOLATILE
+#define SIGNED
+
+#define PROTO(type, name, arglist)     type name ()
+#define EXFUN(name, proto)             name()
+#define DEFUN(name, arglist, args)     name arglist args;
+#define DEFUN_VOID(name)               name()
+#define AND            ;
+#define DOTS
+#define NOARGS
+#endif /* ! IN_GCC */
+
+#endif /* ANSI C.  */
+
+/* Define macros for some gcc attributes.  This permits us to use the
+   macros freely, and know that they will come into play for the
+   version of gcc in which they are supported.  */
+
+#if (GCC_VERSION < 2007)
+# define __attribute__(x)
+#endif
+
+/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
+#ifndef ATTRIBUTE_MALLOC
+# if (GCC_VERSION >= 2096)
+#  define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define ATTRIBUTE_MALLOC
+# endif /* GNUC >= 2.96 */
+#endif /* ATTRIBUTE_MALLOC */
+
+/* Attributes on labels were valid as of gcc 2.93. */
+#ifndef ATTRIBUTE_UNUSED_LABEL
+# if (GCC_VERSION >= 2093)
+#  define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
+# else
+#  define ATTRIBUTE_UNUSED_LABEL
+# endif /* GNUC >= 2.93 */
+#endif /* ATTRIBUTE_UNUSED_LABEL */
+
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif /* ATTRIBUTE_UNUSED */
+
+#ifndef ATTRIBUTE_NORETURN
+#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif /* ATTRIBUTE_NORETURN */
+
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
+#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
+#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
+#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
+#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
+#endif /* ATTRIBUTE_PRINTF */
+
+/* We use __extension__ in some places to suppress -pedantic warnings
+   about GCC extensions.  This feature didn't work properly before
+   gcc 2.8.  */
+#if GCC_VERSION < 2008
+#define __extension__
+#endif
+
+/* Bootstrap support:  Adjust certain macros defined by Autoconf,
+   which are only valid for the stage1 compiler.  If we detect
+   a modern version of GCC, we are probably in stage2 or beyond,
+   so unconditionally reset the values.  Note that const, inline,
+   etc. have been dealt with above.  */
+#if (GCC_VERSION >= 2007)
+# ifndef HAVE_LONG_DOUBLE
+#  define HAVE_LONG_DOUBLE 1
+# endif
+#endif /* GCC >= 2.7 */
+
+#endif /* ansidecl.h   */
diff --git a/src/vm/jit/i386/asmpart.S b/src/vm/jit/i386/asmpart.S
new file mode 100644 (file)
index 0000000..b100b7c
--- /dev/null
@@ -0,0 +1,1079 @@
+/* -*- mode: asm; tab-width: 4 -*- */
+/****************************** asmpart.c **************************************
+*                                                                              *
+*   It contains the Java-C interface functions for i386 processors.            *
+*                                                                              *
+*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
+*                                                                              *
+*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
+*                                                                              *
+*   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
+*            Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
+*            Christian Thalinger                                               *
+*                                                                              *
+*   Last Change: $Id: asmpart.S 557 2003-11-02 22:51:59Z twisti $        *
+*                                                                              *
+*******************************************************************************/
+
+#include "offsets.h"
+
+       .text
+
+
+/********************* exported functions and variables ***********************/
+
+       .globl has_no_x_instr_set
+       .globl asm_calljavamethod
+       .globl asm_calljavafunction
+       .globl asm_call_jit_compiler
+       .globl asm_dumpregistersandcall
+       .globl asm_handle_exception
+       .globl asm_handle_nat_exception
+       .globl asm_builtin_checkcast    
+       .globl asm_builtin_checkarraycast
+       .globl asm_builtin_anewarray
+       .globl asm_builtin_newarray_array
+       .globl asm_builtin_aastore
+       .globl asm_builtin_monitorenter
+       .globl asm_builtin_monitorexit
+       .globl asm_builtin_ldiv
+       .globl asm_builtin_lrem
+    .globl asm_builtin_f2i
+    .globl asm_builtin_f2l
+    .globl asm_builtin_d2i
+    .globl asm_builtin_d2l
+       .globl asm_builtin_arrayinstanceof
+       .globl asm_perform_threadswitch
+       .globl asm_initialize_thread_stack
+       .globl asm_switchstackandcall
+       .globl asm_getcallingmethod
+    .globl asm_builtin_trace
+    .globl asm_builtin_exittrace
+    
+/*************************** imported functions *******************************/
+
+       .globl jit_compile
+       .globl builtin_monitorexit
+       .globl builtin_throw_exception
+       .globl builtin_trace_exception
+       .globl class_java_lang_Object
+       .globl findmethod
+
+/*********************** function has_no_x_instr_set ***************************
+*                                                                              *
+*   determines if the byte support instruction set (21164a and higher)         *
+*   is available.                                                              *
+*                                                                              *
+*   Use it on i386 architecture to init the fpu.                               *
+*                                                                              *
+*******************************************************************************/
+
+has_no_x_instr_set:
+               finit                         /* intitialize the fpu                  */
+
+               pushl   $0x027f   /* Round to nearest, 53-bit mode, exceptions masked */
+               fldcw   (%esp)
+               addl    $4,%esp
+               
+               xor             %eax,%eax                               /* result code 0 (not used for i386)  */
+               ret
+
+
+/********************* function asm_calljavamethod *****************************
+*                                                                              *
+*   This function calls a Java-method (which possibly needs compilation)       *
+*   with up to 4 parameters.                                                   *
+*                                                                              *
+*   This functions calls the JIT-compiler which eventually translates the      *
+*   method into machine code.                                                  *
+*                                                                              *
+*   An possibly throwed exception will be returned to the caller as function   *
+*   return value, so the java method cannot return a fucntion value (this      *
+*   function usually calls 'main' and '<clinit>' which do not return a         *
+*   function value).                                                           *
+*                                                                              *
+*   C-prototype:                                                               *
+*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
+*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
+*                                                                              *
+*******************************************************************************/
+
+#define        MethodPointer   -4
+#define        FrameSize       -8
+#define     IsSync          -12
+#define     IsLeaf          -16
+#define     IntSave         -20
+#define     FltSave         -24
+#define     ExTableSize     -28
+#define     ExTableStart    -28
+
+#define     ExEntrySize     -16
+#define     ExStartPC       -4
+#define     ExEndPC         -8
+#define     ExHandlerPC     -12
+#define     ExCatchType     -16
+
+call_name:
+       .ascii  "calljavamethod\0\0"
+
+/*     .align  3 */
+       .align  8
+       .long   0                         /* catch type all                       */
+       .long   calljava_xhandler         /* handler pc                           */
+       .long   calljava_xhandler         /* end pc                               */
+       .long   asm_calljavamethod        /* start pc                             */
+       .long   1                         /* extable size                         */
+       .long   0                         /* fltsave                              */
+       .long   0                         /* intsave                              */
+       .long   0                         /* isleaf                               */
+       .long   0                         /* IsSync                               */
+       .long   32                        /* frame size                           */
+       .long   0                         /* method pointer (pointer to name)     */
+
+asm_calljavamethod:
+               pushl   %ebp                  /* allocate stack space                 */
+               movl    %esp, %ebp
+
+               subl    $32,%esp              /* pass the remaining parameters        */
+               xorl    %edx,%edx
+
+               movl    %edx,28(%esp)         /* convert parms to 8 byte              */
+               movl    24(%ebp),%eax
+               movl    %eax,24(%esp)
+               
+               movl    %edx,20(%esp)
+               movl    20(%ebp),%eax
+               movl    %eax,16(%esp)
+
+               movl    %edx,12(%esp)
+               movl    16(%ebp),%eax
+               movl    %eax,8(%esp)
+
+               movl    %edx,4(%esp)
+               movl    12(%ebp),%eax
+               movl    %eax,(%esp)
+
+               movl    8(%ebp),%eax          /* move function pointer to %eax        */
+
+               lea             asm_call_jit_compiler,%ecx
+               call    *%ecx                 /* call JIT compiler                    */
+               
+calljava_jit:
+calljava_return:
+calljava_ret:
+               xorl    %eax,%eax
+               leave                                             /* free stack space                     */
+               ret
+
+calljava_xhandler:
+               pushl   %eax                              /* pass exception pointer               */
+               call    builtin_throw_exception
+               addl    $4,%esp
+               addl    $32,%esp
+               popl    %ebp
+               ret
+
+
+/********************* function asm_calljavafunction ***************************
+*                                                                              *
+*   This function calls a Java-method (which possibly needs compilation)       *
+*   with up to 4 address parameters.                                           *
+*                                                                              *
+*   This functions calls the JIT-compiler which eventually translates the      *
+*   method into machine code.                                                  *
+*                                                                              *
+*   C-prototype:                                                               *
+*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
+*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
+*                                                                              *
+*******************************************************************************/
+
+call_name2:
+       .ascii  "calljavafunction\0\0"
+
+/*     .align  3 */
+       .align  8
+       .long   0                         /* catch type all                       */
+       .long   calljava_xhandler2        /* handler pc                           */
+       .long   calljava_xhandler2        /* end pc                               */
+       .long   asm_calljavafunction      /* start pc                             */
+       .long   1                         /* extable size                         */
+       .long   0                         /* fltsave                              */
+       .long   0                         /* intsave                              */
+       .long   0                         /* isleaf                               */
+       .long   0                         /* IsSync                               */
+       .long   32                        /* frame size                           */
+       .long   0                         /* method pointer (pointer to name)     */
+
+asm_calljavafunction:
+               pushl   %ebp                  /* allocate stack space                 */
+               movl    %esp, %ebp
+
+               subl    $32,%esp              /* pass the remaining parameters        */
+               xorl    %edx,%edx
+
+               movl    %edx,28(%esp)         /* convert parms to 8 byte              */
+               movl    24(%ebp),%eax
+               movl    %eax,24(%esp)
+               
+               movl    %edx,20(%esp)
+               movl    20(%ebp),%eax
+               movl    %eax,16(%esp)
+
+               movl    %edx,12(%esp)
+               movl    16(%ebp),%eax
+               movl    %eax,8(%esp)
+
+               movl    %edx,4(%esp)
+               movl    12(%ebp),%eax
+               movl    %eax,(%esp)
+
+               movl    8(%ebp),%eax          /* move function pointer to %eax        */
+
+               lea             asm_call_jit_compiler,%ecx 
+               call    *%ecx                 /* call JIT compiler                    */
+       
+calljava_jit2:
+calljava_return2:
+calljava_ret2:
+               leave
+               ret
+
+calljava_xhandler2:
+               pushl   %eax                              /* pass exception pointer               */
+               call    builtin_throw_exception
+               addl    $4,%esp
+               addl    $32,%esp
+               popl    %ebp
+               ret
+                                               
+
+/****************** function asm_call_jit_compiler *****************************
+*                                                                              *
+*   invokes the compiler for untranslated JavaVM methods.                      *
+*                                                                              *
+*   Register R0 contains a pointer to the method info structure (prepared      *
+*   by createcompilerstub). Using the return address in R26 and the            *
+*   offset in the LDA instruction or using the value in methodptr R28 the      *
+*   patching address for storing the method address can be computed:           *
+*                                                                              *
+*   method address was either loaded using                                     *
+*                                                                              *
+*   i386_mov_imm_reg(a, REG_ITMP2)                ; invokestatic/special       *
+*   i386_call_reg(REG_ITMP2)                                                   *
+*                                                                              *
+*   or                                                                         *
+*                                                                              *
+*   i386_mov_membase_reg(REG_SP, 0, REG_ITMP1)    ; invokevirtual/interface    *
+*   i386_mov_membase_reg(REG_ITMP1, OFFSET(, vftbl), REG_ITMP2)                *
+*   i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + \                *
+*       sizeof(methodptr) * m->vftblindex, REG_ITMP1)                          *
+*   i386_call_reg(REG_ITMP1)                                                   *
+*                                                                              *
+*   in the static case the method pointer can be computed using the            *
+*   return address and the lda function following the jmp instruction          *
+*                                                                              *
+*******************************************************************************/
+
+
+asm_call_jit_compiler:
+        push    %ecx
+               push    %ebx            /* save register                              */
+        push    %ebp
+                               
+               mov     12(%esp),%ebp   /* get return address (2 push)                */
+               mov     -1(%ebp),%bl    /* get function code                          */
+               cmp     $0xd2,%bl               /* called with `call *REG_ITMP2' (%edx)?      */
+               jne             L_not_static_special
+
+               sub     $6,%ebp                 /* calculate address of immediate             */
+               jmp             L_call_jit_compile
+               
+L_not_static_special:
+               cmp     $0xd0,%bl               /* called with `call *REG_ITMP1' (%eax)       */
+               jne             L_not_virtual_interface
+               
+               sub     $6,%ebp         /* calculate address of offset                */
+               mov     (%ebp),%ebp     /* get offset                                 */
+               add     %edx,%ebp       /* add base address to get method address     */
+               jmp             L_call_jit_compile
+
+L_not_virtual_interface:        /* a call from asm_calljavamethod             */
+               xor     %ebp,%ebp
+               
+L_call_jit_compile:
+               push    %ebp            /* save address for method pointer            */
+
+               push    %eax                    /* push methodpointer on stack                */
+               call    jit_compile
+               add     $4,%esp
+
+               pop     %ebp            /* restore address for method pointer         */
+               test    %ebp,%ebp               /* is address == 0 (asm_calljavamethod)       */
+               je              L_call_method
+               
+               mov     %eax,(%ebp)             /* and now save the new pointer               */
+
+L_call_method:
+        pop     %ebp
+               pop     %ebx            /* restore registers                          */
+        pop     %ecx
+                       
+               jmp             *%eax                   /* ...and now call the new method             */
+
+
+
+/****************** function asm_dumpregistersandcall **************************
+*                                                                              *
+*   This funtion saves all callee saved registers and calls the function       *
+*   which is passed as parameter.                                              *
+*                                                                              *
+*   This function is needed by the garbage collector, which needs to access    *
+*   all registers which are stored on the stack. Unused registers are          *
+*   cleared to avoid interferances with the GC.                                *
+*                                                                              *
+*   void asm_dumpregistersandcall (functionptr f);                             *
+*                                                                              *
+*******************************************************************************/
+
+asm_dumpregistersandcall:
+        xor     %eax,%eax
+        mov     %eax,(%eax)
+        
+               push    %ebx
+               push    %ebp
+               push    %esi
+               push    %edi
+                               
+               mov     8(%ebp),%eax            /* load function pointer */
+               call    *%eax                           /* call function */
+
+               pop             %edi
+               pop             %esi
+               pop             %ebp
+               pop             %ebx
+               
+               ret
+        
+
+/********************* function asm_handle_exception ***************************
+*                                                                              *
+*   This function handles an exception. It does not use the usual calling      *
+*   conventions. The exception pointer is passed in REG_ITMP1 and the          *
+*   pc from the exception raising position is passed in REG_ITMP2. It searches *
+*   the local exception table for a handler. If no one is found, it unwinds    *
+*   stacks and continues searching the callers.                                *
+*                                                                              *
+*   void asm_handle_exception (exceptionptr, exceptionpc);                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_handle_nat_exception:
+               add     $4,%esp                                         /* clear return address of native stub */
+               
+asm_handle_exception:
+               push    %eax
+               push    %edx                                            /* get the data segment ptr       */
+               call    findmethod
+               mov     %eax,%ecx
+               pop     %edx
+               pop     %eax
+
+               push    %ebp
+               mov     %esp,%ebp
+
+               push    %eax                                            /* save exception pointer         */
+/*             subl    $2,%edx */
+               push    %edx                                            /* save exception pc              */
+               push    %ecx                                            /* save data segment pointer      */
+        
+               push    %ebx
+               push    %esi
+               push    %edi
+               
+ex_stack_loop:
+               sub     $16,%esp
+
+               movl    %eax,(%esp)                                     /* exception pointer */
+
+               movl    MethodPointer(%ecx),%eax        /* method pointer */
+               movl    %eax,4(%esp)
+               
+               movl    %edx,8(%esp)                            /* exception pc */
+               movl    $1,12(%esp)                                     /* set no unwind flag */
+               call    builtin_trace_exception
+
+               addl    $16,%esp
+
+               movl    -12(%ebp),%esi                          /* %esi = data segment pointer */
+               movl    ExTableSize(%esi),%ecx          /* %ecx = exception table size */
+               test    %ecx,%ecx                                       /* if empty table skip */
+               je              empty_table
+
+               lea             ExTableStart(%esi),%edi         /* %edi = start of exception table */
+               movl    -4(%ebp),%eax                           /* get xptr */
+               
+ex_table_loop:
+               movl    -8(%ebp),%edx                           /* get xpc */
+               
+               movl    ExStartPC(%edi),%ebx            /* %ebx = exception start pc */
+               cmpl    %edx,%ebx                                       /* %ebx = (startpc <= xpc) */
+               jg              ex_table_cont                           /* if (false) continue */
+               movl    ExEndPC(%edi),%ebx                      /* %ebx = exception end pc */
+               cmpl    %ebx,%edx                                       /* %ebx = (xpc < endpc) */
+               jge             ex_table_cont                           /* if (false) continue */
+               movl    ExCatchType(%edi),%ebx          /* arg1 = exception catch type */
+               test    %ebx,%ebx                                       /* NULL catches everything */
+               je              ex_handle_it
+
+               movl    offobjvftbl(%eax),%esi          /* %esi = vftblptr(xptr) */
+               movl    offobjvftbl(%ebx),%ebx          /* %ebx = vftblptr(catchtype) class (not obj) */
+               movl    offbaseval(%esi),%esi           /* %esi = baseval(xptr) */
+               movl    offbaseval(%ebx),%edx           /* %edx = baseval(catchtype) */
+               movl    offdiffval(%ebx),%ebx           /* %ebx = diffval(catchtype) */
+               subl    %edx,%esi                                       /* %esi = baseval(xptr) - baseval(catchtype) */
+               cmpl    %ebx,%esi                                       /* xptr is instanceof catchtype */
+               ja              ex_table_cont
+               
+ex_handle_it:
+               movl    ExHandlerPC(%edi),%edx
+               
+               popl    %edi
+               popl    %esi
+               popl    %ebx
+        
+        popl    %eax                        /* pop %ecx (dummy) */
+        popl    %eax                        /* pop %edx (dummy) */
+        popl    %eax                        /* pop %eax */
+        
+               leave
+
+               jmp             *%edx
+
+ex_table_cont:
+               lea             ExEntrySize(%edi),%edi
+               decl    %ecx
+               test    %ecx,%ecx
+               jg              ex_table_loop
+               
+empty_table:
+               popl    %edi
+               popl    %esi
+               popl    %ebx
+               popl    %ecx                                            /* restore data segment pointer   */
+               popl    %edx
+               popl    %eax                                            /* restore exception pointer      */
+               popl    %ebp
+
+               movl    %eax,%edi                                       /* save exception pointer         */
+                               
+ex_already_cleared:            
+               movl    IsSync(%ecx),%eax                       /* %eax = SyncOffset              */
+               test    %eax,%eax                                       /* if zero no monitorexit         */
+               je              no_monitor_exit
+               
+               addl    %esp,%eax
+               movl    -8(%eax),%eax
+        pusha                               /* save regs                      */
+               pushl   %eax
+               call    builtin_monitorexit
+               addl    $4,%esp
+        popa                                /* restore regs                   */
+        
+no_monitor_exit:
+               movl    FrameSize(%ecx),%eax            /* %eax = frame size              */
+               addl    %eax,%esp                                       /* unwind stack                   */
+               movl    %esp,%eax                                       /* %eax = pointer to save area    */
+
+               movl    IntSave(%ecx),%edx                      /* %edx = saved int register count */
+               test    %edx,%edx
+               je              noint
+               cmpl    $1,%edx
+               je              int1
+               
+int2:  
+               movl    -16(%eax),%ebx
+
+int1:  
+               movl    -8(%eax),%ebp
+
+               shll    $3,%edx                                         /* multiply by 8 bytes             */
+               subl    %edx,%eax
+               
+noint:
+               movl    FltSave(%ecx),%edx                      /* %edx = saved flt register count */
+               test    %edx,%edx
+               je              noflt
+               cmpl    $1,%edx
+               je              flt1
+               cmpl    $2,%edx
+               je              flt2
+               cmpl    $3,%edx
+               je              flt3
+               
+flt4:  
+               fldl    -32(%eax)
+               fstp    %st(1)
+
+flt3:  
+               fldl    -24(%eax)
+               fstp    %st(2)
+               
+flt2:  
+               fldl    -16(%eax)
+               fstp    %st(3)
+               
+flt1:  
+               fldl    -8(%eax)
+               fstp    %st(4)
+               
+noflt:                                 
+               popl    %edx                                            /* the new xpc is return address  */
+               subl    $2,%edx
+               
+               pushl   %edx
+               pushl   %ebx
+               pushl   %ebp
+               pushl   %esi
+               pushl   %edi
+                                                               
+               pushl   %edx                                            /* get the new data segment ptr   */
+               call    findmethod
+               movl    %eax,%ecx
+               addl    $4,%esp
+
+               popl    %edi
+               popl    %esi
+               popl    %ebp
+               popl    %ebx
+               popl    %edx
+               
+               movl    %edi,%eax                                       /* restore saved exception pointer */
+                               
+               pushl   %ebp
+               movl    %esp,%ebp
+
+               pushl   %eax                                            /* save exception pointer         */
+               pushl   %edx                                            /* save exception pc              */
+               pushl   %ecx                                            /* save data segment pointer      */
+               pushl   %ebx
+               pushl   %esi
+               pushl   %edi
+               
+               jmp             ex_stack_loop
+               
+
+/********************* function asm_builtin_monitorenter ***********************
+*                                                                              *
+*   Does null check and calls monitorenter or throws an exception              *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_monitorenter:
+               cmpl    $0,4(%esp)
+               je              nb_monitorenter                 /* if (null) throw exception          */
+               jmp             builtin_monitorenter    /* else call builtin_monitorenter     */
+
+nb_monitorenter:
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               movl    proto_java_lang_NullPointerException,%eax
+               jmp             asm_handle_exception
+               
+
+/********************* function asm_builtin_monitorexit ************************
+*                                                                              *
+*   Does null check and calls monitorexit or throws an exception               *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_monitorexit:
+               cmpl    $0,4(%esp)
+               je              nb_monitorexit                  /* if (null) throw exception          */
+               jmp             builtin_monitorexit             /* else call builtin_monitorenter     */
+
+nb_monitorexit:
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               movl    proto_java_lang_NullPointerException,%eax
+               jmp             asm_handle_exception
+
+
+/************************ function asm_builtin_ldiv ****************************
+*                                                                              *
+*   Does null check and calls ldiv or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_ldiv:
+               movl    12(%esp),%eax
+               orl             16(%esp),%eax
+               test    %eax,%eax                               /* if (null) throw exception */
+               je              nb_ldiv
+
+               jmp             builtin_ldiv
+
+nb_ldiv:
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ArithmeticException,%eax
+               jmp             asm_handle_exception
+                               
+
+/************************ function asm_builtin_lrem ****************************
+*                                                                              *
+*   Does null check and calls lrem or throws an exception                      *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_lrem:
+               movl    12(%esp),%eax
+               orl             16(%esp),%eax
+               test    %eax,%eax                               /* if (null) throw exception */
+               je              nb_lrem
+
+               jmp             builtin_lrem
+
+nb_lrem:
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ArithmeticException,%eax
+               jmp             asm_handle_exception
+               
+
+/************************ function asm_builtin_x2x *****************************
+*                                                                              *
+*   Wrapper functions for corner cases                                         *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_f2i:
+        sub     $4,%esp
+        fsts    (%esp)
+        call    builtin_f2i
+        add     $4,%esp
+        ret            
+
+asm_builtin_d2i:
+        sub     $8,%esp
+        fstl    (%esp)
+        call    builtin_d2i
+        add     $8,%esp
+        ret            
+
+asm_builtin_f2l:
+        sub     $4,%esp
+        fsts    (%esp)
+        call    builtin_f2l
+        add     $4,%esp
+        ret            
+
+asm_builtin_d2l:
+        sub     $8,%esp
+        fstl    (%esp)
+        call    builtin_d2l
+        add     $8,%esp
+        ret            
+
+        
+/*********************** function new_builtin_checkcast ************************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_checkcast:
+               xorl    %eax,%eax
+               movl    $0,(%eax)
+               ret
+
+               
+/******************* function asm_builtin_checkarraycast ***********************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_checkarraycast:
+               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes)    */
+
+               movl    12(%esp),%eax           /* 8 (frame) + 4 (return)             */
+               movl    %eax,(%esp)                             /* save object pointer                */
+
+               movl    20(%esp),%eax
+               movl    %eax,4(%esp)
+
+               call    builtin_checkarraycast  /* builtin_checkarraycast             */
+       
+               test    %eax,%eax               /* if (false) throw exception         */
+               je              nb_carray_throw
+
+               movl    12(%esp),%eax                   /* return object pointer              */
+               addl    $8,%esp
+               ret
+
+nb_carray_throw:
+               addl    $8,%esp
+               
+               popl    %edx                                    /* delete return address              */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ClassCastException,%eax
+               jmp             asm_handle_exception
+
+               
+/******************* function asm_builtin_anewarray ****************************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_anewarray:
+               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
+
+               movl    12(%esp),%eax
+               movl    %eax,(%esp)
+
+               movl    20(%esp),%eax
+               movl    %eax,4(%esp)
+
+               call    builtin_anewarray
+       
+               addl    $8,%esp
+               ret
+
+               
+/******************* function asm_builtin_newarray_array ***********************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_newarray_array:
+               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
+
+               movl    12(%esp),%eax
+               movl    %eax,(%esp)
+
+               movl    20(%esp),%eax
+               movl    %eax,4(%esp)
+
+               call    builtin_newarray_array
+       
+               addl    $8,%esp
+               ret
+
+               
+/******************* function asm_builtin_aastore ******************************
+*                                                                              *
+*   Does the cast check and eventually throws an exception                     *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_aastore:
+               subl    $12,%esp                                /* build stack frame (3 * 4 bytes)    */
+
+               movl    16(%esp),%eax           /* 12 (frame) + 4 (return)            */
+               test    %eax,%eax                               /* if null pointer throw exception    */
+               je              nb_aastore_null
+
+               movl    offarraysize(%eax),%edx /* load size                          */
+               movl    24(%esp),%ecx                   /* index                              */
+               cmpl    %edx,%ecx                               /* do bound check                     */
+               ja              nb_aastore_bound                /* if out of bounds throw exception   */
+
+               shll    $2,%ecx                                 /* index * 4                          */
+               addl    %eax,%ecx                               /* add index * 4 to arrayref          */
+               
+               movl    %ecx,8(%esp)                    /* save store position                */
+               
+               movl    16(%esp),%eax           /* 12 (frame) + 4 (return)            */
+               movl    %eax,(%esp)
+
+               movl    32(%esp),%eax                   /* object is second argument          */
+               movl    %eax,4(%esp)
+               
+               call    builtin_canstore                /* builtin_canstore(arrayref,object)  */
+
+               test    %eax,%eax                               /* if (false) throw exception         */
+               je              nb_aastore_throw
+
+               movl    32(%esp),%eax
+               movl    8(%esp),%ecx
+               movl    %eax,offobjarrdata(%ecx)/* store objectptr in array           */
+               
+               addl    $12,%esp
+               ret
+
+nb_aastore_null:
+               addl    $12,%esp
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_NullPointerException,%eax
+               jmp             asm_handle_exception
+
+nb_aastore_bound:
+               addl    $12,%esp
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ArrayIndexOutOfBoundsException,%eax
+               jmp             asm_handle_exception
+               
+nb_aastore_throw:
+               addl    $12,%esp
+               popl    %edx                                    /* delete return address */
+               subl    $2,%edx                                 /* faulting address is return adress - 2 */
+               
+               movl    proto_java_lang_ArrayStoreException,%eax
+               jmp             asm_handle_exception
+
+               
+/******************* function asm_builtin_arrayinstanceof **********************
+*                                                                              *
+*   Does the instanceof check of arrays                                        *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_arrayinstanceof:
+               subl    $8,%esp                                 /* build stack frame (2 * 4 bytes) */
+
+               movl    12(%esp),%eax
+               movl    %eax,(%esp)
+
+               movl    20(%esp),%eax
+               movl    %eax,4(%esp)
+
+               call    builtin_arrayinstanceof
+       
+               addl    $8,%esp
+               ret
+
+               
+/******************* function asm_initialize_thread_stack **********************
+*                                                                              *
+* initialized a thread stack                                                   *
+* (to)->restorePoint = asm_initialize_thread_stack((u1*)(func), (to)->stackEnd)*
+*                                                                              *
+*******************************************************************************/
+
+asm_initialize_thread_stack:
+               movl    8(%esp),%eax            /* (to)->stackEnd                     */
+               subl    $36,%eax                                /* 4 bytes * 8 regs + 4 bytes func    */
+
+               xorl    %edx,%edx
+               movl    %edx,0(%eax)
+               movl    %edx,4(%eax)
+               movl    %edx,8(%eax)
+               movl    %edx,12(%eax)
+               movl    %edx,16(%eax)
+               movl    %edx,20(%eax)
+               movl    %edx,24(%eax)
+               movl    %edx,28(%eax)
+
+               movl    4(%esp),%edx            /* save (u1*) (func)                  */
+               movl    %edx,32(%eax)
+
+               ret                             /* return restorepoint in %eax        */
+
+
+/******************* function asm_perform_threadswitch *************************
+*                                                                              *
+*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
+*                                                                              *
+*   performs a threadswitch                                                    *
+*                                                                              *
+*******************************************************************************/
+
+asm_perform_threadswitch:
+               subl    $36,%esp
+
+               movl    %eax,0(%esp)
+               movl    %edx,4(%esp)
+               movl    %ecx,8(%esp)
+               movl    %ebx,12(%esp)
+               movl    %esp,16(%esp)
+               movl    %ebp,20(%esp)
+               movl    %esi,24(%esp)
+               movl    %edi,28(%esp)
+
+               movl    36(%esp),%eax                   /* save current return address */
+               movl    %eax,32(%esp)
+
+               movl    40(%esp),%eax                   /* first argument **from */
+               movl    %esp,0(%eax)
+
+               movl    48(%esp),%eax                   /* third argument **stackTop */
+               movl    %esp,0(%eax)
+
+               movl    44(%esp),%eax                   /* second argument **to */
+               movl    0(%eax),%esp                    /* load new stack pointer */
+
+               movl    0(%esp),%eax
+               movl    4(%esp),%edx
+               movl    8(%esp),%ecx
+               movl    12(%esp),%ebx
+                                                                               /* skip stack pointer */
+               movl    20(%esp),%ebp
+               movl    24(%esp),%esi
+               movl    28(%esp),%edi
+
+               addl    $32,%esp                /* leave return address on stack      */
+               ret
+               
+
+/********************* function asm_switchstackandcall *************************
+*                                                                              *
+*  int asm_switchstackandcall (void *stack, void *func, void **stacktopsave,   *
+*                                     void *p);                                       *
+*                                                                              *
+*   Switches to a new stack, calls a function and switches back.               *
+*       a0      new stack pointer                                              *
+*       a1      function pointer                                               *
+*              a2              pointer to variable where stack top should be stored           *
+*       a3      pointer to user data, is passed to the function                *
+*                                                                              *
+*******************************************************************************/
+
+asm_switchstackandcall:
+               movl    4(%esp),%edx                    /* first argument *stack */
+               subl    $8,%edx                                 /* allocate new stack */
+
+               movl    (%esp),%eax                             /* save return address on new stack */
+               movl    %eax,(%edx)
+
+               movl    %esp,4(%edx)                    /* save old stack pointer on new stack */
+
+               movl    12(%esp),%eax                   /* third argument **stacktopsave */
+               movl    %esp,(%eax)                             /* save old stack pointer to variable */
+
+               movl    8(%esp),%eax                    /* load function pointer */
+               movl    16(%esp),%ecx                   /* fourth argument *p */
+               
+               movl    %edx,%esp                               /* switch to new stack */
+
+               subl    $4,%esp
+               movl    %ecx,0(%esp)                    /* pass pointer */
+               call    *%eax                                   /* and call function */
+               addl    $4,%esp
+
+               movl    (%esp),%edx                             /* load return address */
+               movl    4(%esp),%esp                    /* switch to old stack */
+               movl    %edx,(%esp)
+               ret
+
+               
+/********************* function asm_getcallingmethod ***************************
+*                                                                              *
+*   classinfo *asm_getcallingmethod ();                                                                   *
+*                                                                                                                                                         *    
+*   goes back stack frames to get the calling method                                              *       
+*                                                                                                                                                         *    
+*                              t2 .. sp                                                                                                       *
+*                              t3 .. ra                                                                                                       *
+*                              t4 .. pv                                                                                                       *
+*                                                                              *
+*******************************************************************************/
+
+asm_getcallingmethod:
+               xorl    %eax,%eax
+/*             movl    $0,(%eax) */
+               ret
+
+
+/*********************** function asm_builtin_trace ****************************
+*                                                                              *
+*   Intended to be called from the native stub. Saves all argument registers   *
+*   and calls builtin_trace_args.                                              *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_trace:
+        pusha
+        subl    $68,%esp                /* 4 + 8 * 4 + 68 = 104 */
+
+        movl    104(%esp),%eax
+        movl    108(%esp),%edx
+        movl    %eax,(%esp)
+        movl    %edx,4(%esp)
+
+        movl    112(%esp),%eax
+        movl    116(%esp),%edx
+        movl    %eax,8(%esp)
+        movl    %edx,12(%esp)
+
+        movl    120(%esp),%eax
+        movl    124(%esp),%edx
+        movl    %eax,16(%esp)
+        movl    %edx,20(%esp)
+
+        movl    128(%esp),%eax
+        movl    132(%esp),%edx
+        movl    %eax,24(%esp)
+        movl    %edx,28(%esp)
+
+        movl    136(%esp),%eax
+        movl    140(%esp),%edx
+        movl    %eax,32(%esp)
+        movl    %edx,36(%esp)
+
+        movl    144(%esp),%eax
+        movl    148(%esp),%edx
+        movl    %eax,40(%esp)
+        movl    %edx,44(%esp)
+
+        movl    152(%esp),%eax
+        movl    156(%esp),%edx
+        movl    %eax,48(%esp)
+        movl    %edx,52(%esp)
+
+        movl    160(%esp),%eax
+        movl    164(%esp),%edx
+        movl    %eax,56(%esp)
+        movl    %edx,60(%esp)
+
+        movl    168(%esp),%eax
+        movl    %eax,64(%esp)
+        
+        call    builtin_trace_args
+        addl    $68,%esp
+
+        popa
+        ret
+
+
+/********************* function asm_builtin_exittrace **************************
+*                                                                              *
+*   Intended to be called from the native stub. Saves return value and calls   *
+*   builtin_displaymethodstop.                                                 *
+*                                                                              *
+*******************************************************************************/
+
+asm_builtin_exittrace:
+        pusha
+        subl    $24,%esp
+        
+        movl    60(%esp),%eax           /* 4 + 8 * 4 + 24 = 60 */
+        movl    %eax,(%esp)
+
+        movl    64(%esp),%eax
+        movl    68(%esp),%edx
+        movl    %eax,4(%esp)
+        movl    %edx,8(%esp)
+
+        movl    72(%esp),%eax
+        movl    76(%esp),%edx
+        movl    %eax,12(%esp)
+        movl    %edx,16(%esp)
+
+        movl    80(%esp),%eax
+        movl    %eax,20(%esp)
+
+        call    builtin_displaymethodstop
+        addl    $24,%esp
+
+        popa
+        ret
diff --git a/src/vm/jit/i386/bfd.h b/src/vm/jit/i386/bfd.h
new file mode 100644 (file)
index 0000000..cd75aeb
--- /dev/null
@@ -0,0 +1,4177 @@
+/* DO NOT EDIT!  -*- buffer-read-only: t -*-  This file is automatically 
+   generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c", 
+   "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c", 
+   "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c", 
+   "linker.c" and "simple.c".
+   Run "make headers" in your build bfd/ to regenerate.  */
+
+/* Main header file for the bfd library -- portable access to object files.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001, 2002
+   Free Software Foundation, Inc.
+   Contributed by Cygnus Support.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef __BFD_H_SEEN__
+#define __BFD_H_SEEN__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ansidecl.h"
+#include "symcat.h"
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#ifndef SABER
+/* This hack is to avoid a problem with some strict ANSI C preprocessors.
+   The problem is, "32_" is not a valid preprocessing token, and we don't
+   want extra underscores (e.g., "nlm_32_").  The XCONCAT2 macro will
+   cause the inner CONCAT2 macros to be evaluated first, producing
+   still-valid pp-tokens.  Then the final concatenation can be done.  */
+#undef CONCAT4
+#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
+#endif
+#endif
+
+/* The word size used by BFD on the host.  This may be 64 with a 32
+   bit target if the host is 64 bit, or if other 64 bit targets have
+   been selected with --enable-targets, or if --enable-64-bit-bfd.  */
+#define BFD_ARCH_SIZE 32
+
+/* The word size of the default bfd target.  */
+#define BFD_DEFAULT_TARGET_SIZE 32
+
+#define BFD_HOST_64BIT_LONG 0
+#if 0
+#define BFD_HOST_64_BIT 
+#define BFD_HOST_U_64_BIT 
+#endif
+
+#if BFD_ARCH_SIZE >= 64
+#define BFD64
+#endif
+
+#ifndef INLINE
+#if __GNUC__ >= 2
+#define INLINE __inline__
+#else
+#define INLINE
+#endif
+#endif
+
+/* Forward declaration.  */
+typedef struct _bfd bfd;
+
+/* To squelch erroneous compiler warnings ("illegal pointer
+   combination") from the SVR3 compiler, we would like to typedef
+   boolean to int (it doesn't like functions which return boolean.
+   Making sure they are never implicitly declared to return int
+   doesn't seem to help).  But this file is not configured based on
+   the host.  */
+/* General rules: functions which are boolean return true on success
+   and false on failure (unless they're a predicate).   -- bfd.doc */
+/* I'm sure this is going to break something and someone is going to
+   force me to change it.  */
+/* typedef enum boolean {false, true} boolean; */
+/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
+/* It gets worse if the host also defines a true/false enum... -sts */
+/* And even worse if your compiler has built-in boolean types... -law */
+/* And even worse if your compiler provides a stdbool.h that conflicts
+   with these definitions... gcc 2.95 and later do.  If so, it must
+   be included first.  -drow */
+#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+#define TRUE_FALSE_ALREADY_DEFINED
+#else
+#if defined (__bool_true_false_are_defined)
+/* We have <stdbool.h>.  */
+#define TRUE_FALSE_ALREADY_DEFINED
+#endif
+#endif
+#ifdef MPW
+/* Pre-emptive strike - get the file with the enum.  */
+#include <Types.h>
+#define TRUE_FALSE_ALREADY_DEFINED
+#endif /* MPW */
+#ifndef TRUE_FALSE_ALREADY_DEFINED
+/*typedef enum bfd_boolean {false, true} boolean;*/
+typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
+#define BFD_TRUE_FALSE
+#else
+/* Use enum names that will appear nowhere else.  */
+typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
+#endif
+
+/* Support for different sizes of target format ints and addresses.
+   If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
+   set to 1 above.  Otherwise, if gcc is being used, this code will
+   use gcc's "long long" type.  Otherwise, BFD_HOST_64_BIT must be
+   defined above.  */
+
+#ifndef BFD_HOST_64_BIT
+# if BFD_HOST_64BIT_LONG
+#  define BFD_HOST_64_BIT long
+#  define BFD_HOST_U_64_BIT unsigned long
+# else
+#  ifdef __GNUC__
+#   if __GNUC__ >= 2
+#    define BFD_HOST_64_BIT long long
+#    define BFD_HOST_U_64_BIT unsigned long long
+#   endif /* __GNUC__ >= 2 */
+#  endif /* ! defined (__GNUC__) */
+# endif /* ! BFD_HOST_64BIT_LONG */
+#endif /* ! defined (BFD_HOST_64_BIT) */
+
+#ifdef BFD64
+
+#ifndef BFD_HOST_64_BIT
+ #error No 64 bit integer type available
+#endif /* ! defined (BFD_HOST_64_BIT) */
+
+typedef BFD_HOST_U_64_BIT bfd_vma;
+typedef BFD_HOST_64_BIT bfd_signed_vma;
+typedef BFD_HOST_U_64_BIT bfd_size_type;
+typedef BFD_HOST_U_64_BIT symvalue;
+
+#ifndef fprintf_vma
+#if BFD_HOST_64BIT_LONG
+#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
+#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
+#else
+#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
+#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
+#define fprintf_vma(s,x) \
+  fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
+#define sprintf_vma(s,x) \
+  sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
+#endif
+#endif
+
+#else /* not BFD64  */
+
+/* Represent a target address.  Also used as a generic unsigned type
+   which is guaranteed to be big enough to hold any arithmetic types
+   we need to deal with.  */
+typedef unsigned long bfd_vma;
+
+/* A generic signed type which is guaranteed to be big enough to hold any
+   arithmetic types we need to deal with.  Can be assumed to be compatible
+   with bfd_vma in the same way that signed and unsigned ints are compatible
+   (as parameters, in assignment, etc).  */
+typedef long bfd_signed_vma;
+
+typedef unsigned long symvalue;
+typedef unsigned long bfd_size_type;
+
+/* Print a bfd_vma x on stream s.  */
+#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
+#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
+
+#endif /* not BFD64  */
+
+/* A pointer to a position in a file.  */
+/* FIXME:  This should be using off_t from <sys/types.h>.
+   For now, try to avoid breaking stuff by not including <sys/types.h> here.
+   This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
+   Probably the best long-term answer is to avoid using file_ptr AND off_t
+   in this header file, and to handle this in the BFD implementation
+   rather than in its interface.  */
+/* typedef off_t       file_ptr; */
+typedef bfd_signed_vma file_ptr;
+typedef bfd_vma ufile_ptr;
+
+extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
+#define printf_vma(x) fprintf_vma(stdout,x)
+#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
+
+typedef unsigned int flagword; /* 32 bits of flags */
+typedef unsigned char bfd_byte;
+\f
+/* File formats.  */
+
+typedef enum bfd_format
+{
+  bfd_unknown = 0,     /* File format is unknown.  */
+  bfd_object,          /* Linker/assember/compiler output.  */
+  bfd_archive,         /* Object archive file.  */
+  bfd_core,            /* Core dump.  */
+  bfd_type_end         /* Marks the end; don't use it!  */
+}
+bfd_format;
+
+/* Values that may appear in the flags field of a BFD.  These also
+   appear in the object_flags field of the bfd_target structure, where
+   they indicate the set of flags used by that backend (not all flags
+   are meaningful for all object file formats) (FIXME: at the moment,
+   the object_flags values have mostly just been copied from backend
+   to another, and are not necessarily correct).  */
+
+/* No flags.  */
+#define BFD_NO_FLAGS           0x00
+
+/* BFD contains relocation entries.  */
+#define HAS_RELOC      0x01
+
+/* BFD is directly executable.  */
+#define EXEC_P         0x02
+
+/* BFD has line number information (basically used for F_LNNO in a
+   COFF header).  */
+#define HAS_LINENO     0x04
+
+/* BFD has debugging information.  */
+#define HAS_DEBUG      0x08
+
+/* BFD has symbols.  */
+#define HAS_SYMS       0x10
+
+/* BFD has local symbols (basically used for F_LSYMS in a COFF
+   header).  */
+#define HAS_LOCALS     0x20
+
+/* BFD is a dynamic object.  */
+#define DYNAMIC        0x40
+
+/* Text section is write protected (if D_PAGED is not set, this is
+   like an a.out NMAGIC file) (the linker sets this by default, but
+   clears it for -r or -N).  */
+#define WP_TEXT        0x80
+
+/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
+   linker sets this by default, but clears it for -r or -n or -N).  */
+#define D_PAGED        0x100
+
+/* BFD is relaxable (this means that bfd_relax_section may be able to
+   do something) (sometimes bfd_relax_section can do something even if
+   this is not set).  */
+#define BFD_IS_RELAXABLE 0x200
+
+/* This may be set before writing out a BFD to request using a
+   traditional format.  For example, this is used to request that when
+   writing out an a.out object the symbols not be hashed to eliminate
+   duplicates.  */
+#define BFD_TRADITIONAL_FORMAT 0x400
+
+/* This flag indicates that the BFD contents are actually cached in
+   memory.  If this is set, iostream points to a bfd_in_memory struct.  */
+#define BFD_IN_MEMORY 0x800
+/* The sections in this BFD specify a memory page.  */
+#define HAS_LOAD_PAGE 0x1000
+\f
+/* Symbols and relocation.  */
+
+/* A count of carsyms (canonical archive symbols).  */
+typedef unsigned long symindex;
+
+/* How to perform a relocation.  */
+typedef const struct reloc_howto_struct reloc_howto_type;
+
+#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
+
+/* General purpose part of a symbol X;
+   target specific parts are in libcoff.h, libaout.h, etc.  */
+
+#define bfd_get_section(x) ((x)->section)
+#define bfd_get_output_section(x) ((x)->section->output_section)
+#define bfd_set_section(x,y) ((x)->section) = (y)
+#define bfd_asymbol_base(x) ((x)->section->vma)
+#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
+#define bfd_asymbol_name(x) ((x)->name)
+/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
+#define bfd_asymbol_bfd(x) ((x)->the_bfd)
+#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
+
+/* A canonical archive symbol.  */
+/* This is a type pun with struct ranlib on purpose!  */
+typedef struct carsym
+{
+  char *name;
+  file_ptr file_offset;        /* Look here to find the file.  */
+}
+carsym;                        /* To make these you call a carsymogen.  */
+
+/* Used in generating armaps (archive tables of contents).
+   Perhaps just a forward definition would do?  */
+struct orl                     /* Output ranlib.  */
+{
+  char **name;         /* Symbol name.  */
+  union
+  {
+    file_ptr pos;
+    bfd *abfd;
+  } u;                 /* bfd* or file position.  */
+  int namidx;          /* Index into string table.  */
+};
+\f
+/* Linenumber stuff.  */
+typedef struct lineno_cache_entry
+{
+  unsigned int line_number;    /* Linenumber from start of function.  */
+  union
+  {
+    struct symbol_cache_entry *sym;    /* Function name.  */
+    bfd_vma offset;                    /* Offset into section.  */
+  } u;
+}
+alent;
+\f
+/* Object and core file sections.  */
+
+#define        align_power(addr, align)        \
+  (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
+
+typedef struct sec *sec_ptr;
+
+#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
+#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
+#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
+#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
+#define bfd_section_name(bfd, ptr) ((ptr)->name)
+#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
+#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
+#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
+#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
+#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
+#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
+
+#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
+
+#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)true), true)
+#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
+#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
+
+typedef struct stat stat_type;
+\f
+typedef enum bfd_print_symbol
+{
+  bfd_print_symbol_name,
+  bfd_print_symbol_more,
+  bfd_print_symbol_all
+} bfd_print_symbol_type;
+
+/* Information about a symbol that nm needs.  */
+
+typedef struct _symbol_info
+{
+  symvalue value;
+  char type;
+  const char *name;            /* Symbol name.  */
+  unsigned char stab_type;     /* Stab type.  */
+  char stab_other;             /* Stab other.  */
+  short stab_desc;             /* Stab desc.  */
+  const char *stab_name;       /* String for stab type.  */
+} symbol_info;
+
+/* Get the name of a stabs type code.  */
+
+extern const char *bfd_get_stab_name PARAMS ((int));
+\f
+/* Hash table routines.  There is no way to free up a hash table.  */
+
+/* An element in the hash table.  Most uses will actually use a larger
+   structure, and an instance of this will be the first field.  */
+
+struct bfd_hash_entry
+{
+  /* Next entry for this hash code.  */
+  struct bfd_hash_entry *next;
+  /* String being hashed.  */
+  const char *string;
+  /* Hash code.  This is the full hash code, not the index into the
+     table.  */
+  unsigned long hash;
+};
+
+/* A hash table.  */
+
+struct bfd_hash_table
+{
+  /* The hash array.  */
+  struct bfd_hash_entry **table;
+  /* The number of slots in the hash table.  */
+  unsigned int size;
+  /* A function used to create new elements in the hash table.  The
+     first entry is itself a pointer to an element.  When this
+     function is first invoked, this pointer will be NULL.  However,
+     having the pointer permits a hierarchy of method functions to be
+     built each of which calls the function in the superclass.  Thus
+     each function should be written to allocate a new block of memory
+     only if the argument is NULL.  */
+  struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
+                                            struct bfd_hash_table *,
+                                            const char *));
+   /* An objalloc for this hash table.  This is a struct objalloc *,
+     but we use PTR to avoid requiring the inclusion of objalloc.h.  */
+  PTR memory;
+};
+
+/* Initialize a hash table.  */
+extern boolean bfd_hash_table_init
+  PARAMS ((struct bfd_hash_table *,
+          struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+                                      struct bfd_hash_table *,
+                                      const char *)));
+
+/* Initialize a hash table specifying a size.  */
+extern boolean bfd_hash_table_init_n
+  PARAMS ((struct bfd_hash_table *,
+          struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+                                      struct bfd_hash_table *,
+                                      const char *),
+          unsigned int size));
+
+/* Free up a hash table.  */
+extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
+
+/* Look up a string in a hash table.  If CREATE is true, a new entry
+   will be created for this string if one does not already exist.  The
+   COPY argument must be true if this routine should copy the string
+   into newly allocated memory when adding an entry.  */
+extern struct bfd_hash_entry *bfd_hash_lookup
+  PARAMS ((struct bfd_hash_table *, const char *, boolean create,
+          boolean copy));
+
+/* Replace an entry in a hash table.  */
+extern void bfd_hash_replace
+  PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
+          struct bfd_hash_entry *nw));
+
+/* Base method for creating a hash table entry.  */
+extern struct bfd_hash_entry *bfd_hash_newfunc
+  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
+          const char *));
+
+/* Grab some space for a hash table entry.  */
+extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
+                                     unsigned int));
+
+/* Traverse a hash table in a random order, calling a function on each
+   element.  If the function returns false, the traversal stops.  The
+   INFO argument is passed to the function.  */
+extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
+                                      boolean (*) (struct bfd_hash_entry *,
+                                                   PTR),
+                                      PTR info));
+
+#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
+
+/* User program access to BFD facilities.  */
+
+/* Direct I/O routines, for programs which know more about the object
+   file than BFD does.  Use higher level routines if possible.  */
+
+extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *));
+extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *));
+extern int bfd_seek PARAMS ((bfd *, file_ptr, int));
+extern ufile_ptr bfd_tell PARAMS ((bfd *));
+extern int bfd_flush PARAMS ((bfd *));
+extern int bfd_stat PARAMS ((bfd *, struct stat *));
+
+/* Deprecated old routines.  */
+#if __GNUC__
+#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
+  (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__),     \
+   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
+  (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__),    \
+   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#else
+#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
+  (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
+   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
+  (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
+   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#endif
+extern void warn_deprecated
+  PARAMS ((const char *, const char *, int, const char *));
+
+/* Cast from const char * to char * so that caller can assign to
+   a char * without a warning.  */
+#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
+#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
+#define bfd_get_format(abfd) ((abfd)->format)
+#define bfd_get_target(abfd) ((abfd)->xvec->name)
+#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
+#define bfd_family_coff(abfd) \
+  (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
+   bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
+#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
+#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
+#define bfd_header_big_endian(abfd) \
+  ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
+#define bfd_header_little_endian(abfd) \
+  ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
+#define bfd_get_file_flags(abfd) ((abfd)->flags)
+#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
+#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
+#define bfd_my_archive(abfd) ((abfd)->my_archive)
+#define bfd_has_map(abfd) ((abfd)->has_armap)
+
+#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
+#define bfd_usrdata(abfd) ((abfd)->usrdata)
+
+#define bfd_get_start_address(abfd) ((abfd)->start_address)
+#define bfd_get_symcount(abfd) ((abfd)->symcount)
+#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
+#define bfd_count_sections(abfd) ((abfd)->section_count)
+
+#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
+
+#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
+
+#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
+
+extern boolean bfd_cache_close PARAMS ((bfd *abfd));
+/* NB: This declaration should match the autogenerated one in libbfd.h.  */
+
+extern boolean bfd_record_phdr
+  PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
+          boolean, boolean, unsigned int, struct sec **));
+
+/* Byte swapping routines.  */
+
+bfd_vma                bfd_getb64         PARAMS ((const unsigned char *));
+bfd_vma        bfd_getl64         PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
+bfd_vma                bfd_getb32         PARAMS ((const unsigned char *));
+bfd_vma                bfd_getl32         PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
+bfd_vma                bfd_getb16         PARAMS ((const unsigned char *));
+bfd_vma                bfd_getl16         PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
+bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
+void           bfd_putb64         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putl64         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putb32         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putl32         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putb16         PARAMS ((bfd_vma, unsigned char *));
+void           bfd_putl16         PARAMS ((bfd_vma, unsigned char *));
+
+/* Byte swapping routines which take size and endiannes as arguments.  */
+
+bfd_vma         bfd_get_bits       PARAMS ((bfd_byte *, int, boolean));
+void            bfd_put_bits       PARAMS ((bfd_vma, bfd_byte *, int, boolean));
+\f
+/* Externally visible ECOFF routines.  */
+
+#if defined(__STDC__) || defined(ALMOST_STDC)
+struct ecoff_debug_info;
+struct ecoff_debug_swap;
+struct ecoff_extr;
+struct symbol_cache_entry;
+struct bfd_link_info;
+struct bfd_link_hash_entry;
+struct bfd_elf_version_tree;
+#endif
+extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
+extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
+extern boolean bfd_ecoff_set_regmasks
+  PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
+          unsigned long *cprmask));
+extern PTR bfd_ecoff_debug_init
+  PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
+          const struct ecoff_debug_swap *output_swap,
+          struct bfd_link_info *));
+extern void bfd_ecoff_debug_free
+  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+          const struct ecoff_debug_swap *output_swap,
+          struct bfd_link_info *));
+extern boolean bfd_ecoff_debug_accumulate
+  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+          const struct ecoff_debug_swap *output_swap,
+          bfd *input_bfd, struct ecoff_debug_info *input_debug,
+          const struct ecoff_debug_swap *input_swap,
+          struct bfd_link_info *));
+extern boolean bfd_ecoff_debug_accumulate_other
+  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+          const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
+          struct bfd_link_info *));
+extern boolean bfd_ecoff_debug_externals
+  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap,
+          boolean relocateable,
+          boolean (*get_extr) (struct symbol_cache_entry *,
+                               struct ecoff_extr *),
+          void (*set_index) (struct symbol_cache_entry *,
+                             bfd_size_type)));
+extern boolean bfd_ecoff_debug_one_external
+  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap,
+          const char *name, struct ecoff_extr *esym));
+extern bfd_size_type bfd_ecoff_debug_size
+  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap));
+extern boolean bfd_ecoff_write_debug
+  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap, file_ptr where));
+extern boolean bfd_ecoff_write_accumulated_debug
+  PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
+          const struct ecoff_debug_swap *swap,
+          struct bfd_link_info *info, file_ptr where));
+extern boolean bfd_mips_ecoff_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+
+/* Externally visible ELF routines.  */
+
+struct bfd_link_needed_list
+{
+  struct bfd_link_needed_list *next;
+  bfd *by;
+  const char *name;
+};
+
+extern boolean bfd_elf32_record_link_assignment
+  PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
+extern boolean bfd_elf64_record_link_assignment
+  PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
+extern struct bfd_link_needed_list *bfd_elf_get_needed_list
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf_get_bfd_needed_list
+  PARAMS ((bfd *, struct bfd_link_needed_list **));
+extern boolean bfd_elf32_size_dynamic_sections
+  PARAMS ((bfd *, const char *, const char *, const char *,
+          const char * const *, struct bfd_link_info *, struct sec **,
+          struct bfd_elf_version_tree *));
+extern boolean bfd_elf64_size_dynamic_sections
+  PARAMS ((bfd *, const char *, const char *, const char *,
+          const char * const *, struct bfd_link_info *, struct sec **,
+          struct bfd_elf_version_tree *));
+extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
+extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
+extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
+extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf32_discard_info
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf64_discard_info
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* Return an upper bound on the number of bytes required to store a
+   copy of ABFD's program header table entries.  Return -1 if an error
+   occurs; bfd_get_error will return an appropriate code.  */
+extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
+
+/* Copy ABFD's program header table entries to *PHDRS.  The entries
+   will be stored as an array of Elf_Internal_Phdr structures, as
+   defined in include/elf/internal.h.  To find out how large the
+   buffer needs to be, call bfd_get_elf_phdr_upper_bound.
+
+   Return the number of program header table entries read, or -1 if an
+   error occurs; bfd_get_error will return an appropriate code.  */
+extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
+
+/* Return the arch_size field of an elf bfd, or -1 if not elf.  */
+extern int bfd_get_arch_size PARAMS ((bfd *));
+
+/* Return true if address "naturally" sign extends, or -1 if not elf.  */
+extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
+
+extern boolean bfd_m68k_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+extern boolean bfd_mips_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+
+/* SunOS shared library support routines for the linker.  */
+
+extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_sunos_record_link_assignment
+  PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_sunos_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
+          struct sec **));
+
+/* Linux shared library support routines for the linker.  */
+
+extern boolean bfd_i386linux_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_m68klinux_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_sparclinux_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* mmap hacks */
+
+struct _bfd_window_internal;
+typedef struct _bfd_window_internal bfd_window_internal;
+
+typedef struct _bfd_window
+{
+  /* What the user asked for.  */
+  PTR data;
+  bfd_size_type size;
+  /* The actual window used by BFD.  Small user-requested read-only
+     regions sharing a page may share a single window into the object
+     file.  Read-write versions shouldn't until I've fixed things to
+     keep track of which portions have been claimed by the
+     application; don't want to give the same region back when the
+     application wants two writable copies!  */
+  struct _bfd_window_internal *i;
+}
+bfd_window;
+
+extern void bfd_init_window PARAMS ((bfd_window *));
+extern void bfd_free_window PARAMS ((bfd_window *));
+extern boolean bfd_get_file_window
+  PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
+
+/* XCOFF support routines for the linker.  */
+
+extern boolean bfd_xcoff_link_record_set
+  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
+          bfd_size_type));
+extern boolean bfd_xcoff_import_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
+          bfd_vma, const char *, const char *, const char *, unsigned int));
+extern boolean bfd_xcoff_export_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
+extern boolean bfd_xcoff_link_count_reloc
+  PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_xcoff_record_link_assignment
+  PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_xcoff_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
+          unsigned long, unsigned long, unsigned long, boolean,
+          int, boolean, boolean, struct sec **, boolean));
+extern boolean bfd_xcoff_link_generate_rtinit
+  PARAMS ((bfd *, const char *, const char *, boolean));
+
+/* XCOFF support routines for ar.  */
+extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *));
+
+/* Externally visible COFF routines.  */
+
+#if defined(__STDC__) || defined(ALMOST_STDC)
+struct internal_syment;
+union internal_auxent;
+#endif
+
+extern boolean bfd_coff_get_syment
+  PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
+
+extern boolean bfd_coff_get_auxent
+  PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
+
+extern boolean bfd_coff_set_symbol_class
+  PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
+
+extern boolean bfd_m68k_coff_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+
+/* ARM Interworking support.  Called from linker.  */
+extern boolean bfd_arm_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_arm_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_arm_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* PE ARM Interworking support.  Called from linker.  */
+extern boolean bfd_arm_pe_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_arm_pe_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_arm_pe_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* ELF ARM Interworking support.  Called from linker.  */
+extern boolean bfd_elf32_arm_allocate_interworking_sections
+  PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_elf32_arm_process_before_allocation
+  PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_elf32_arm_get_bfd_for_interworking
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* TI COFF load page support.  */
+extern void bfd_ticoff_set_section_load_page
+  PARAMS ((struct sec *, int));
+
+extern int bfd_ticoff_get_section_load_page
+  PARAMS ((struct sec *));
+
+/* Extracted from init.c.  */
+void
+bfd_init PARAMS ((void));
+
+/* Extracted from opncls.c.  */
+bfd *
+bfd_openr PARAMS ((const char *filename, const char *target));
+
+bfd *
+bfd_fdopenr PARAMS ((const char *filename, const char *target, int fd));
+
+bfd *
+bfd_openstreamr PARAMS ((const char *, const char *, PTR));
+
+bfd *
+bfd_openw PARAMS ((const char *filename, const char *target));
+
+boolean
+bfd_close PARAMS ((bfd *abfd));
+
+boolean
+bfd_close_all_done PARAMS ((bfd *));
+
+bfd *
+bfd_create PARAMS ((const char *filename, bfd *templ));
+
+boolean
+bfd_make_writable PARAMS ((bfd *abfd));
+
+boolean
+bfd_make_readable PARAMS ((bfd *abfd));
+
+/* Extracted from libbfd.c.  */
+
+/* Byte swapping macros for user section data.  */
+
+#define bfd_put_8(abfd, val, ptr) \
+                ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
+#define bfd_put_signed_8 \
+               bfd_put_8
+#define bfd_get_8(abfd, ptr) \
+                (*(unsigned char *) (ptr) & 0xff)
+#define bfd_get_signed_8(abfd, ptr) \
+               (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
+
+#define bfd_put_16(abfd, val, ptr) \
+                BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
+#define bfd_put_signed_16 \
+                bfd_put_16
+#define bfd_get_16(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx16, (ptr))
+#define bfd_get_signed_16(abfd, ptr) \
+                BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
+
+#define bfd_put_32(abfd, val, ptr) \
+                BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
+#define bfd_put_signed_32 \
+                bfd_put_32
+#define bfd_get_32(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx32, (ptr))
+#define bfd_get_signed_32(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
+
+#define bfd_put_64(abfd, val, ptr) \
+                BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
+#define bfd_put_signed_64 \
+                bfd_put_64
+#define bfd_get_64(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx64, (ptr))
+#define bfd_get_signed_64(abfd, ptr) \
+                BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
+
+#define bfd_get(bits, abfd, ptr)                               \
+                ( (bits) ==  8 ? (bfd_vma) bfd_get_8 (abfd, ptr)       \
+                : (bits) == 16 ? bfd_get_16 (abfd, ptr)        \
+                : (bits) == 32 ? bfd_get_32 (abfd, ptr)        \
+                : (bits) == 64 ? bfd_get_64 (abfd, ptr)        \
+                : (abort (), (bfd_vma) - 1))
+
+#define bfd_put(bits, abfd, val, ptr)                          \
+                ( (bits) ==  8 ? bfd_put_8  (abfd, val, ptr)   \
+                : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)   \
+                : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)   \
+                : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)   \
+                : (abort (), (void) 0))
+
+
+/* Byte swapping macros for file header data.  */
+
+#define bfd_h_put_8(abfd, val, ptr) \
+  bfd_put_8 (abfd, val, ptr)
+#define bfd_h_put_signed_8(abfd, val, ptr) \
+  bfd_put_8 (abfd, val, ptr)
+#define bfd_h_get_8(abfd, ptr) \
+  bfd_get_8 (abfd, ptr)
+#define bfd_h_get_signed_8(abfd, ptr) \
+  bfd_get_signed_8 (abfd, ptr)
+
+#define bfd_h_put_16(abfd, val, ptr) \
+  BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
+#define bfd_h_put_signed_16 \
+  bfd_h_put_16
+#define bfd_h_get_16(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx16, (ptr))
+#define bfd_h_get_signed_16(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
+
+#define bfd_h_put_32(abfd, val, ptr) \
+  BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
+#define bfd_h_put_signed_32 \
+  bfd_h_put_32
+#define bfd_h_get_32(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx32, (ptr))
+#define bfd_h_get_signed_32(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
+
+#define bfd_h_put_64(abfd, val, ptr) \
+  BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
+#define bfd_h_put_signed_64 \
+  bfd_h_put_64
+#define bfd_h_get_64(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx64, (ptr))
+#define bfd_h_get_signed_64(abfd, ptr) \
+  BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
+
+/* Refinements on the above, which should eventually go away.  Save
+   cluttering the source with (bfd_vma) and (bfd_byte *) casts.  */
+
+#define H_PUT_64(abfd, val, where) \
+  bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_32(abfd, val, where) \
+  bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_16(abfd, val, where) \
+  bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_8 bfd_h_put_8
+
+#define H_PUT_S64(abfd, val, where) \
+  bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S32(abfd, val, where) \
+  bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S16(abfd, val, where) \
+  bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S8 bfd_h_put_signed_8
+
+#define H_GET_64(abfd, where) \
+  bfd_h_get_64 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_32(abfd, where) \
+  bfd_h_get_32 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_16(abfd, where) \
+  bfd_h_get_16 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_8 bfd_h_get_8
+
+#define H_GET_S64(abfd, where) \
+  bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S32(abfd, where) \
+  bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S16(abfd, where) \
+  bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S8 bfd_h_get_signed_8
+
+
+/* Extracted from bfdio.c.  */
+long
+bfd_get_mtime PARAMS ((bfd *abfd));
+
+long
+bfd_get_size PARAMS ((bfd *abfd));
+
+/* Extracted from bfdwin.c.  */
+/* Extracted from section.c.  */
+/* This structure is used for a comdat section, as in PE.  A comdat
+   section is associated with a particular symbol.  When the linker
+   sees a comdat section, it keeps only one of the sections with a
+   given name and associated with a given symbol.  */
+
+struct bfd_comdat_info
+{
+  /* The name of the symbol associated with a comdat section.  */
+  const char *name;
+
+  /* The local symbol table index of the symbol associated with a
+     comdat section.  This is only meaningful to the object file format
+     specific code; it is not an index into the list returned by
+     bfd_canonicalize_symtab.  */
+  long symbol;
+};
+
+typedef struct sec
+{
+  /* The name of the section; the name isn't a copy, the pointer is
+     the same as that passed to bfd_make_section.  */
+  const char *name;
+
+  /* A unique sequence number.  */
+  int id;
+
+  /* Which section in the bfd; 0..n-1 as sections are created in a bfd.  */
+  int index;
+
+  /* The next section in the list belonging to the BFD, or NULL.  */
+  struct sec *next;
+
+  /* The field flags contains attributes of the section. Some
+     flags are read in from the object file, and some are
+     synthesized from other information.  */
+  flagword flags;
+
+#define SEC_NO_FLAGS   0x000
+
+  /* Tells the OS to allocate space for this section when loading.
+     This is clear for a section containing debug information only.  */
+#define SEC_ALLOC      0x001
+
+  /* Tells the OS to load the section from the file when loading.
+     This is clear for a .bss section.  */
+#define SEC_LOAD       0x002
+
+  /* The section contains data still to be relocated, so there is
+     some relocation information too.  */
+#define SEC_RELOC      0x004
+
+  /* ELF reserves 4 processor specific bits and 8 operating system
+     specific bits in sh_flags; at present we can get away with just
+     one in communicating between the assembler and BFD, but this
+     isn't a good long-term solution.  */
+#define SEC_ARCH_BIT_0 0x008
+
+  /* A signal to the OS that the section contains read only data.  */
+#define SEC_READONLY   0x010
+
+  /* The section contains code only.  */
+#define SEC_CODE       0x020
+
+  /* The section contains data only.  */
+#define SEC_DATA       0x040
+
+  /* The section will reside in ROM.  */
+#define SEC_ROM        0x080
+
+  /* The section contains constructor information. This section
+     type is used by the linker to create lists of constructors and
+     destructors used by <<g++>>. When a back end sees a symbol
+     which should be used in a constructor list, it creates a new
+     section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
+     the symbol to it, and builds a relocation. To build the lists
+     of constructors, all the linker has to do is catenate all the
+     sections called <<__CTOR_LIST__>> and relocate the data
+     contained within - exactly the operations it would peform on
+     standard data.  */
+#define SEC_CONSTRUCTOR 0x100
+
+  /* The section has contents - a data section could be
+     <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
+     <<SEC_HAS_CONTENTS>>  */
+#define SEC_HAS_CONTENTS 0x200
+
+  /* An instruction to the linker to not output the section
+     even if it has information which would normally be written.  */
+#define SEC_NEVER_LOAD 0x400
+
+  /* The section is a COFF shared library section.  This flag is
+     only for the linker.  If this type of section appears in
+     the input file, the linker must copy it to the output file
+     without changing the vma or size.  FIXME: Although this
+     was originally intended to be general, it really is COFF
+     specific (and the flag was renamed to indicate this).  It
+     might be cleaner to have some more general mechanism to
+     allow the back end to control what the linker does with
+     sections.  */
+#define SEC_COFF_SHARED_LIBRARY 0x800
+
+  /* The section contains thread local data.  */
+#define SEC_THREAD_LOCAL 0x1000
+
+  /* The section has GOT references.  This flag is only for the
+     linker, and is currently only used by the elf32-hppa back end.
+     It will be set if global offset table references were detected
+     in this section, which indicate to the linker that the section
+     contains PIC code, and must be handled specially when doing a
+     static link.  */
+#define SEC_HAS_GOT_REF 0x4000
+
+  /* The section contains common symbols (symbols may be defined
+     multiple times, the value of a symbol is the amount of
+     space it requires, and the largest symbol value is the one
+     used).  Most targets have exactly one of these (which we
+     translate to bfd_com_section_ptr), but ECOFF has two.  */
+#define SEC_IS_COMMON 0x8000
+
+  /* The section contains only debugging information.  For
+     example, this is set for ELF .debug and .stab sections.
+     strip tests this flag to see if a section can be
+     discarded.  */
+#define SEC_DEBUGGING 0x10000
+
+  /* The contents of this section are held in memory pointed to
+     by the contents field.  This is checked by bfd_get_section_contents,
+     and the data is retrieved from memory if appropriate.  */
+#define SEC_IN_MEMORY 0x20000
+
+  /* The contents of this section are to be excluded by the
+     linker for executable and shared objects unless those
+     objects are to be further relocated.  */
+#define SEC_EXCLUDE 0x40000
+
+  /* The contents of this section are to be sorted based on the sum of
+     the symbol and addend values specified by the associated relocation
+     entries.  Entries without associated relocation entries will be
+     appended to the end of the section in an unspecified order.  */
+#define SEC_SORT_ENTRIES 0x80000
+
+  /* When linking, duplicate sections of the same name should be
+     discarded, rather than being combined into a single section as
+     is usually done.  This is similar to how common symbols are
+     handled.  See SEC_LINK_DUPLICATES below.  */
+#define SEC_LINK_ONCE 0x100000
+
+  /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
+     should handle duplicate sections.  */
+#define SEC_LINK_DUPLICATES 0x600000
+
+  /* This value for SEC_LINK_DUPLICATES means that duplicate
+     sections with the same name should simply be discarded.  */
+#define SEC_LINK_DUPLICATES_DISCARD 0x0
+
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if there are any duplicate sections, although
+     it should still only link one copy.  */
+#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
+
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if any duplicate sections are a different size.  */
+#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
+
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if any duplicate sections contain different
+     contents.  */
+#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
+
+  /* This section was created by the linker as part of dynamic
+     relocation or other arcane processing.  It is skipped when
+     going through the first-pass output, trusting that someone
+     else up the line will take care of it later.  */
+#define SEC_LINKER_CREATED 0x800000
+
+  /* This section should not be subject to garbage collection.  */
+#define SEC_KEEP 0x1000000
+
+  /* This section contains "short" data, and should be placed
+     "near" the GP.  */
+#define SEC_SMALL_DATA 0x2000000
+
+  /* This section contains data which may be shared with other
+     executables or shared objects.  */
+#define SEC_SHARED 0x4000000
+
+  /* When a section with this flag is being linked, then if the size of
+     the input section is less than a page, it should not cross a page
+     boundary.  If the size of the input section is one page or more, it
+     should be aligned on a page boundary.  */
+#define SEC_BLOCK 0x8000000
+
+  /* Conditionally link this section; do not link if there are no
+     references found to any symbol in the section.  */
+#define SEC_CLINK 0x10000000
+
+  /* Attempt to merge identical entities in the section.
+     Entity size is given in the entsize field.  */
+#define SEC_MERGE 0x20000000
+
+  /* If given with SEC_MERGE, entities to merge are zero terminated
+     strings where entsize specifies character size instead of fixed
+     size entries.  */
+#define SEC_STRINGS 0x40000000
+
+  /* This section contains data about section groups.  */
+#define SEC_GROUP 0x80000000
+
+  /*  End of section flags.  */
+
+  /* Some internal packed boolean fields.  */
+
+  /* See the vma field.  */
+  unsigned int user_set_vma : 1;
+
+  /* Whether relocations have been processed.  */
+  unsigned int reloc_done : 1;
+
+  /* A mark flag used by some of the linker backends.  */
+  unsigned int linker_mark : 1;
+
+  /* Another mark flag used by some of the linker backends.  Set for
+     output sections that have an input section.  */
+  unsigned int linker_has_input : 1;
+
+  /* A mark flag used by some linker backends for garbage collection.  */
+  unsigned int gc_mark : 1;
+
+  /* Used by the ELF code to mark sections which have been allocated
+     to segments.  */
+  unsigned int segment_mark : 1;
+
+  /* End of internal packed boolean fields.  */
+
+  /*  The virtual memory address of the section - where it will be
+      at run time.  The symbols are relocated against this.  The
+      user_set_vma flag is maintained by bfd; if it's not set, the
+      backend can assign addresses (for example, in <<a.out>>, where
+      the default address for <<.data>> is dependent on the specific
+      target and various flags).  */
+  bfd_vma vma;
+
+  /*  The load address of the section - where it would be in a
+      rom image; really only used for writing section header
+      information.  */
+  bfd_vma lma;
+
+  /* The size of the section in octets, as it will be output.
+     Contains a value even if the section has no contents (e.g., the
+     size of <<.bss>>).  This will be filled in after relocation.  */
+  bfd_size_type _cooked_size;
+
+  /* The original size on disk of the section, in octets.  Normally this
+     value is the same as the size, but if some relaxing has
+     been done, then this value will be bigger.  */
+  bfd_size_type _raw_size;
+
+  /* If this section is going to be output, then this value is the
+     offset in *bytes* into the output section of the first byte in the
+     input section (byte ==> smallest addressable unit on the
+     target).  In most cases, if this was going to start at the
+     100th octet (8-bit quantity) in the output section, this value
+     would be 100.  However, if the target byte size is 16 bits
+     (bfd_octets_per_byte is "2"), this value would be 50.  */
+  bfd_vma output_offset;
+
+  /* The output section through which to map on output.  */
+  struct sec *output_section;
+
+  /* The alignment requirement of the section, as an exponent of 2 -
+     e.g., 3 aligns to 2^3 (or 8).  */
+  unsigned int alignment_power;
+
+  /* If an input section, a pointer to a vector of relocation
+     records for the data in this section.  */
+  struct reloc_cache_entry *relocation;
+
+  /* If an output section, a pointer to a vector of pointers to
+     relocation records for the data in this section.  */
+  struct reloc_cache_entry **orelocation;
+
+  /* The number of relocation records in one of the above.  */
+  unsigned reloc_count;
+
+  /* Information below is back end specific - and not always used
+     or updated.  */
+
+  /* File position of section data.  */
+  file_ptr filepos;
+
+  /* File position of relocation info.  */
+  file_ptr rel_filepos;
+
+  /* File position of line data.  */
+  file_ptr line_filepos;
+
+  /* Pointer to data for applications.  */
+  PTR userdata;
+
+  /* If the SEC_IN_MEMORY flag is set, this points to the actual
+     contents.  */
+  unsigned char *contents;
+
+  /* Attached line number information.  */
+  alent *lineno;
+
+  /* Number of line number records.  */
+  unsigned int lineno_count;
+
+  /* Entity size for merging purposes.  */
+  unsigned int entsize;
+
+  /* Optional information about a COMDAT entry; NULL if not COMDAT.  */
+  struct bfd_comdat_info *comdat;
+
+  /* When a section is being output, this value changes as more
+     linenumbers are written out.  */
+  file_ptr moving_line_filepos;
+
+  /* What the section number is in the target world.  */
+  int target_index;
+
+  PTR used_by_bfd;
+
+  /* If this is a constructor section then here is a list of the
+     relocations created to relocate items within it.  */
+  struct relent_chain *constructor_chain;
+
+  /* The BFD which owns the section.  */
+  bfd *owner;
+
+  /* A symbol which points at this section only.  */
+  struct symbol_cache_entry *symbol;
+  struct symbol_cache_entry **symbol_ptr_ptr;
+
+  struct bfd_link_order *link_order_head;
+  struct bfd_link_order *link_order_tail;
+} asection;
+
+/* These sections are global, and are managed by BFD.  The application
+   and target back end are not permitted to change the values in
+   these sections.  New code should use the section_ptr macros rather
+   than referring directly to the const sections.  The const sections
+   may eventually vanish.  */
+#define BFD_ABS_SECTION_NAME "*ABS*"
+#define BFD_UND_SECTION_NAME "*UND*"
+#define BFD_COM_SECTION_NAME "*COM*"
+#define BFD_IND_SECTION_NAME "*IND*"
+
+/* The absolute section.  */
+extern const asection bfd_abs_section;
+#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
+#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
+/* Pointer to the undefined section.  */
+extern const asection bfd_und_section;
+#define bfd_und_section_ptr ((asection *) &bfd_und_section)
+#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
+/* Pointer to the common section.  */
+extern const asection bfd_com_section;
+#define bfd_com_section_ptr ((asection *) &bfd_com_section)
+/* Pointer to the indirect section.  */
+extern const asection bfd_ind_section;
+#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
+#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
+
+#define bfd_is_const_section(SEC)              \
+ (   ((SEC) == bfd_abs_section_ptr)            \
+  || ((SEC) == bfd_und_section_ptr)            \
+  || ((SEC) == bfd_com_section_ptr)            \
+  || ((SEC) == bfd_ind_section_ptr))
+
+extern const struct symbol_cache_entry * const bfd_abs_symbol;
+extern const struct symbol_cache_entry * const bfd_com_symbol;
+extern const struct symbol_cache_entry * const bfd_und_symbol;
+extern const struct symbol_cache_entry * const bfd_ind_symbol;
+#define bfd_get_section_size_before_reloc(section) \
+     ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
+                            : (section)->_raw_size)
+#define bfd_get_section_size_after_reloc(section) \
+     ((section)->reloc_done ? (section)->_cooked_size \
+                            : (abort (), (bfd_size_type) 1))
+
+/* Macros to handle insertion and deletion of a bfd's sections.  These
+   only handle the list pointers, ie. do not adjust section_count,
+   target_index etc.  */
+#define bfd_section_list_remove(ABFD, PS) \
+  do                                                   \
+    {                                                  \
+      asection **_ps = PS;                             \
+      asection *_s = *_ps;                             \
+      *_ps = _s->next;                                 \
+      if (_s->next == NULL)                            \
+        (ABFD)->section_tail = _ps;                    \
+    }                                                  \
+  while (0)
+#define bfd_section_list_insert(ABFD, PS, S) \
+  do                                                   \
+    {                                                  \
+      asection **_ps = PS;                             \
+      asection *_s = S;                                \
+      _s->next = *_ps;                                 \
+      *_ps = _s;                                       \
+      if (_s->next == NULL)                            \
+        (ABFD)->section_tail = &_s->next;              \
+    }                                                  \
+  while (0)
+
+void
+bfd_section_list_clear PARAMS ((bfd *));
+
+asection *
+bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
+
+char *
+bfd_get_unique_section_name PARAMS ((bfd *abfd,
+    const char *templat,
+    int *count));
+
+asection *
+bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name));
+
+asection *
+bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name));
+
+asection *
+bfd_make_section PARAMS ((bfd *, const char *name));
+
+boolean
+bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
+
+void
+bfd_map_over_sections PARAMS ((bfd *abfd,
+    void (*func) (bfd *abfd,
+    asection *sect,
+    PTR obj),
+    PTR obj));
+
+boolean
+bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
+
+boolean
+bfd_set_section_contents PARAMS ((bfd *abfd, asection *section,
+    PTR data, file_ptr offset,
+    bfd_size_type count));
+
+boolean
+bfd_get_section_contents PARAMS ((bfd *abfd, asection *section,
+    PTR location, file_ptr offset,
+    bfd_size_type count));
+
+boolean
+bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec,
+    bfd *obfd, asection *osec));
+
+#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
+     BFD_SEND (obfd, _bfd_copy_private_section_data, \
+               (ibfd, isection, obfd, osection))
+void
+_bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section));
+
+boolean
+bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group));
+
+/* Extracted from archures.c.  */
+enum bfd_architecture
+{
+  bfd_arch_unknown,   /* File arch not known.  */
+  bfd_arch_obscure,   /* Arch known, not one of these.  */
+  bfd_arch_m68k,      /* Motorola 68xxx */
+#define bfd_mach_m68000 1
+#define bfd_mach_m68008 2
+#define bfd_mach_m68010 3
+#define bfd_mach_m68020 4
+#define bfd_mach_m68030 5
+#define bfd_mach_m68040 6
+#define bfd_mach_m68060 7
+#define bfd_mach_cpu32  8
+#define bfd_mach_mcf5200  9
+#define bfd_mach_mcf5206e 10
+#define bfd_mach_mcf5307  11
+#define bfd_mach_mcf5407  12
+  bfd_arch_vax,       /* DEC Vax */
+  bfd_arch_i960,      /* Intel 960 */
+    /* The order of the following is important.
+       lower number indicates a machine type that
+       only accepts a subset of the instructions
+       available to machines with higher numbers.
+       The exception is the "ca", which is
+       incompatible with all other machines except
+       "core".  */
+
+#define bfd_mach_i960_core      1
+#define bfd_mach_i960_ka_sa     2
+#define bfd_mach_i960_kb_sb     3
+#define bfd_mach_i960_mc        4
+#define bfd_mach_i960_xa        5
+#define bfd_mach_i960_ca        6
+#define bfd_mach_i960_jx        7
+#define bfd_mach_i960_hx        8
+
+  bfd_arch_or32,      /* OpenRISC 32 */
+
+  bfd_arch_a29k,      /* AMD 29000 */
+  bfd_arch_sparc,     /* SPARC */
+#define bfd_mach_sparc                 1
+/* The difference between v8plus and v9 is that v9 is a true 64 bit env.  */
+#define bfd_mach_sparc_sparclet        2
+#define bfd_mach_sparc_sparclite       3
+#define bfd_mach_sparc_v8plus          4
+#define bfd_mach_sparc_v8plusa         5 /* with ultrasparc add'ns.  */
+#define bfd_mach_sparc_sparclite_le    6
+#define bfd_mach_sparc_v9              7
+#define bfd_mach_sparc_v9a             8 /* with ultrasparc add'ns.  */
+#define bfd_mach_sparc_v8plusb         9 /* with cheetah add'ns.  */
+#define bfd_mach_sparc_v9b             10 /* with cheetah add'ns.  */
+/* Nonzero if MACH has the v9 instruction set.  */
+#define bfd_mach_sparc_v9_p(mach) \
+  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
+   && (mach) != bfd_mach_sparc_sparclite_le)
+  bfd_arch_mips,      /* MIPS Rxxxx */
+#define bfd_mach_mips3000              3000
+#define bfd_mach_mips3900              3900
+#define bfd_mach_mips4000              4000
+#define bfd_mach_mips4010              4010
+#define bfd_mach_mips4100              4100
+#define bfd_mach_mips4111              4111
+#define bfd_mach_mips4120              4120
+#define bfd_mach_mips4300              4300
+#define bfd_mach_mips4400              4400
+#define bfd_mach_mips4600              4600
+#define bfd_mach_mips4650              4650
+#define bfd_mach_mips5000              5000
+#define bfd_mach_mips5400              5400
+#define bfd_mach_mips5500              5500
+#define bfd_mach_mips6000              6000
+#define bfd_mach_mips8000              8000
+#define bfd_mach_mips10000             10000
+#define bfd_mach_mips12000             12000
+#define bfd_mach_mips16                16
+#define bfd_mach_mips5                 5
+#define bfd_mach_mips_sb1              12310201 /* octal 'SB', 01 */
+#define bfd_mach_mipsisa32             32
+#define bfd_mach_mipsisa64             64
+  bfd_arch_i386,      /* Intel 386 */
+#define bfd_mach_i386_i386 1
+#define bfd_mach_i386_i8086 2
+#define bfd_mach_i386_i386_intel_syntax 3
+#define bfd_mach_x86_64 64
+#define bfd_mach_x86_64_intel_syntax 65
+  bfd_arch_we32k,     /* AT&T WE32xxx */
+  bfd_arch_tahoe,     /* CCI/Harris Tahoe */
+  bfd_arch_i860,      /* Intel 860 */
+  bfd_arch_i370,      /* IBM 360/370 Mainframes */
+  bfd_arch_romp,      /* IBM ROMP PC/RT */
+  bfd_arch_alliant,   /* Alliant */
+  bfd_arch_convex,    /* Convex */
+  bfd_arch_m88k,      /* Motorola 88xxx */
+  bfd_arch_m98k,      /* Motorola 98xxx */
+  bfd_arch_pyramid,   /* Pyramid Technology */
+  bfd_arch_h8300,     /* Hitachi H8/300 */
+#define bfd_mach_h8300   1
+#define bfd_mach_h8300h  2
+#define bfd_mach_h8300s  3
+  bfd_arch_pdp11,     /* DEC PDP-11 */
+  bfd_arch_powerpc,   /* PowerPC */
+#define bfd_mach_ppc           32
+#define bfd_mach_ppc64         64
+#define bfd_mach_ppc_403       403
+#define bfd_mach_ppc_403gc     4030
+#define bfd_mach_ppc_505       505
+#define bfd_mach_ppc_601       601
+#define bfd_mach_ppc_602       602
+#define bfd_mach_ppc_603       603
+#define bfd_mach_ppc_ec603e    6031
+#define bfd_mach_ppc_604       604
+#define bfd_mach_ppc_620       620
+#define bfd_mach_ppc_630       630
+#define bfd_mach_ppc_750       750
+#define bfd_mach_ppc_860       860
+#define bfd_mach_ppc_a35       35
+#define bfd_mach_ppc_rs64ii    642
+#define bfd_mach_ppc_rs64iii   643
+#define bfd_mach_ppc_7400      7400
+#define bfd_mach_ppc_e500      500
+  bfd_arch_rs6000,    /* IBM RS/6000 */
+#define bfd_mach_rs6k          6000
+#define bfd_mach_rs6k_rs1      6001
+#define bfd_mach_rs6k_rsc      6003
+#define bfd_mach_rs6k_rs2      6002
+  bfd_arch_hppa,      /* HP PA RISC */
+  bfd_arch_d10v,      /* Mitsubishi D10V */
+#define bfd_mach_d10v          1
+#define bfd_mach_d10v_ts2      2
+#define bfd_mach_d10v_ts3      3
+  bfd_arch_d30v,      /* Mitsubishi D30V */
+  bfd_arch_dlx,       /* DLX */
+  bfd_arch_m68hc11,   /* Motorola 68HC11 */
+  bfd_arch_m68hc12,   /* Motorola 68HC12 */
+  bfd_arch_z8k,       /* Zilog Z8000 */
+#define bfd_mach_z8001         1
+#define bfd_mach_z8002         2
+  bfd_arch_h8500,     /* Hitachi H8/500 */
+  bfd_arch_sh,        /* Hitachi SH */
+#define bfd_mach_sh            1
+#define bfd_mach_sh2        0x20
+#define bfd_mach_sh_dsp     0x2d
+#define bfd_mach_sh3        0x30
+#define bfd_mach_sh3_dsp    0x3d
+#define bfd_mach_sh3e       0x3e
+#define bfd_mach_sh4        0x40
+#define bfd_mach_sh5        0x50
+  bfd_arch_alpha,     /* Dec Alpha */
+#define bfd_mach_alpha_ev4  0x10
+#define bfd_mach_alpha_ev5  0x20
+#define bfd_mach_alpha_ev6  0x30
+  bfd_arch_arm,       /* Advanced Risc Machines ARM.  */
+#define bfd_mach_arm_2         1
+#define bfd_mach_arm_2a        2
+#define bfd_mach_arm_3         3
+#define bfd_mach_arm_3M        4
+#define bfd_mach_arm_4         5
+#define bfd_mach_arm_4T        6
+#define bfd_mach_arm_5         7
+#define bfd_mach_arm_5T        8
+#define bfd_mach_arm_5TE       9
+#define bfd_mach_arm_XScale    10
+  bfd_arch_ns32k,     /* National Semiconductors ns32000 */
+  bfd_arch_w65,       /* WDC 65816 */
+  bfd_arch_tic30,     /* Texas Instruments TMS320C30 */
+  bfd_arch_tic4x,     /* Texas Instruments TMS320C3X/4X */
+#define bfd_mach_c3x           30
+#define bfd_mach_c4x           40
+  bfd_arch_tic54x,    /* Texas Instruments TMS320C54X */
+  bfd_arch_tic80,     /* TI TMS320c80 (MVP) */
+  bfd_arch_v850,      /* NEC V850 */
+#define bfd_mach_v850          1
+#define bfd_mach_v850e         'E'
+  bfd_arch_arc,       /* ARC Cores */
+#define bfd_mach_arc_5         5
+#define bfd_mach_arc_6         6
+#define bfd_mach_arc_7         7
+#define bfd_mach_arc_8         8
+  bfd_arch_m32r,      /* Mitsubishi M32R/D */
+#define bfd_mach_m32r          1 /* For backwards compatibility.  */
+#define bfd_mach_m32rx         'x'
+  bfd_arch_mn10200,   /* Matsushita MN10200 */
+  bfd_arch_mn10300,   /* Matsushita MN10300 */
+#define bfd_mach_mn10300               300
+#define bfd_mach_am33          330
+  bfd_arch_fr30,
+#define bfd_mach_fr30          0x46523330
+  bfd_arch_frv,
+#define bfd_mach_frv           1
+#define bfd_mach_frvsimple     2
+#define bfd_mach_fr300         300
+#define bfd_mach_fr400         400
+#define bfd_mach_frvtomcat     499     /* fr500 prototype */
+#define bfd_mach_fr500         500
+  bfd_arch_mcore,
+  bfd_arch_ia64,      /* HP/Intel ia64 */
+#define bfd_mach_ia64_elf64    64
+#define bfd_mach_ia64_elf32    32
+  bfd_arch_ip2k,      /* Ubicom IP2K microcontrollers. */
+#define bfd_mach_ip2022        1
+#define bfd_mach_ip2022ext     2
+  bfd_arch_pj,
+  bfd_arch_avr,       /* Atmel AVR microcontrollers.  */
+#define bfd_mach_avr1          1
+#define bfd_mach_avr2          2
+#define bfd_mach_avr3          3
+#define bfd_mach_avr4          4
+#define bfd_mach_avr5          5
+  bfd_arch_cris,      /* Axis CRIS */
+  bfd_arch_s390,      /* IBM s390 */
+#define bfd_mach_s390_31       31
+#define bfd_mach_s390_64       64
+  bfd_arch_openrisc,  /* OpenRISC */
+  bfd_arch_mmix,      /* Donald Knuth's educational processor.  */
+  bfd_arch_xstormy16,
+#define bfd_mach_xstormy16     1
+  bfd_arch_last
+  };
+
+typedef struct bfd_arch_info
+{
+  int bits_per_word;
+  int bits_per_address;
+  int bits_per_byte;
+  enum bfd_architecture arch;
+  unsigned long mach;
+  const char *arch_name;
+  const char *printable_name;
+  unsigned int section_align_power;
+  /* True if this is the default machine for the architecture.
+     The default arch should be the first entry for an arch so that
+     all the entries for that arch can be accessed via <<next>>.  */
+  boolean the_default;
+  const struct bfd_arch_info * (*compatible)
+       PARAMS ((const struct bfd_arch_info *a,
+                const struct bfd_arch_info *b));
+
+  boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
+
+  const struct bfd_arch_info *next;
+}
+bfd_arch_info_type;
+
+const char *
+bfd_printable_name PARAMS ((bfd *abfd));
+
+const bfd_arch_info_type *
+bfd_scan_arch PARAMS ((const char *string));
+
+const char **
+bfd_arch_list PARAMS ((void));
+
+const bfd_arch_info_type *
+bfd_arch_get_compatible PARAMS ((
+    const bfd *abfd,
+    const bfd *bbfd));
+
+void
+bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
+
+enum bfd_architecture
+bfd_get_arch PARAMS ((bfd *abfd));
+
+unsigned long
+bfd_get_mach PARAMS ((bfd *abfd));
+
+unsigned int
+bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
+
+unsigned int
+bfd_arch_bits_per_address PARAMS ((bfd *abfd));
+
+const bfd_arch_info_type *
+bfd_get_arch_info PARAMS ((bfd *abfd));
+
+const bfd_arch_info_type *
+bfd_lookup_arch PARAMS ((enum bfd_architecture
+    arch,
+    unsigned long machine));
+
+const char *
+bfd_printable_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long machine));
+
+unsigned int
+bfd_octets_per_byte PARAMS ((bfd *abfd));
+
+unsigned int
+bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
+    unsigned long machine));
+
+/* Extracted from reloc.c.  */
+typedef enum bfd_reloc_status
+{
+  /* No errors detected.  */
+  bfd_reloc_ok,
+
+  /* The relocation was performed, but there was an overflow.  */
+  bfd_reloc_overflow,
+
+  /* The address to relocate was not within the section supplied.  */
+  bfd_reloc_outofrange,
+
+  /* Used by special functions.  */
+  bfd_reloc_continue,
+
+  /* Unsupported relocation size requested.  */
+  bfd_reloc_notsupported,
+
+  /* Unused.  */
+  bfd_reloc_other,
+
+  /* The symbol to relocate against was undefined.  */
+  bfd_reloc_undefined,
+
+  /* The relocation was performed, but may not be ok - presently
+     generated only when linking i960 coff files with i960 b.out
+     symbols.  If this type is returned, the error_message argument
+     to bfd_perform_relocation will be set.  */
+  bfd_reloc_dangerous
+ }
+ bfd_reloc_status_type;
+
+
+typedef struct reloc_cache_entry
+{
+  /* A pointer into the canonical table of pointers.  */
+  struct symbol_cache_entry **sym_ptr_ptr;
+
+  /* offset in section.  */
+  bfd_size_type address;
+
+  /* addend for relocation value.  */
+  bfd_vma addend;
+
+  /* Pointer to how to perform the required relocation.  */
+  reloc_howto_type *howto;
+
+}
+arelent;
+
+enum complain_overflow
+{
+  /* Do not complain on overflow.  */
+  complain_overflow_dont,
+
+  /* Complain if the bitfield overflows, whether it is considered
+     as signed or unsigned.  */
+  complain_overflow_bitfield,
+
+  /* Complain if the value overflows when considered as signed
+     number.  */
+  complain_overflow_signed,
+
+  /* Complain if the value overflows when considered as an
+     unsigned number.  */
+  complain_overflow_unsigned
+};
+
+struct reloc_howto_struct
+{
+  /*  The type field has mainly a documentary use - the back end can
+      do what it wants with it, though normally the back end's
+      external idea of what a reloc number is stored
+      in this field.  For example, a PC relative word relocation
+      in a coff environment has the type 023 - because that's
+      what the outside world calls a R_PCRWORD reloc.  */
+  unsigned int type;
+
+  /*  The value the final relocation is shifted right by.  This drops
+      unwanted data from the relocation.  */
+  unsigned int rightshift;
+
+  /*  The size of the item to be relocated.  This is *not* a
+      power-of-two measure.  To get the number of bytes operated
+      on by a type of relocation, use bfd_get_reloc_size.  */
+  int size;
+
+  /*  The number of bits in the item to be relocated.  This is used
+      when doing overflow checking.  */
+  unsigned int bitsize;
+
+  /*  Notes that the relocation is relative to the location in the
+      data section of the addend.  The relocation function will
+      subtract from the relocation value the address of the location
+      being relocated.  */
+  boolean pc_relative;
+
+  /*  The bit position of the reloc value in the destination.
+      The relocated value is left shifted by this amount.  */
+  unsigned int bitpos;
+
+  /* What type of overflow error should be checked for when
+     relocating.  */
+  enum complain_overflow complain_on_overflow;
+
+  /* If this field is non null, then the supplied function is
+     called rather than the normal function.  This allows really
+     strange relocation methods to be accomodated (e.g., i960 callj
+     instructions).  */
+  bfd_reloc_status_type (*special_function)
+    PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
+             bfd *, char **));
+
+  /* The textual name of the relocation type.  */
+  char *name;
+
+  /* Some formats record a relocation addend in the section contents
+     rather than with the relocation.  For ELF formats this is the
+     distinction between USE_REL and USE_RELA (though the code checks
+     for USE_REL == 1/0).  The value of this field is TRUE if the
+     addend is recorded with the section contents; when performing a
+     partial link (ld -r) the section contents (the data) will be
+     modified.  The value of this field is FALSE if addends are
+     recorded with the relocation (in arelent.addend); when performing
+     a partial link the relocation will be modified.
+     All relocations for all ELF USE_RELA targets should set this field
+     to FALSE (values of TRUE should be looked on with suspicion).
+     However, the converse is not true: not all relocations of all ELF
+     USE_REL targets set this field to TRUE.  Why this is so is peculiar
+     to each particular target.  For relocs that aren't used in partial
+     links (e.g. GOT stuff) it doesn't matter what this is set to.  */
+  boolean partial_inplace;
+
+  /* The src_mask selects which parts of the read in data
+     are to be used in the relocation sum.  E.g., if this was an 8 bit
+     byte of data which we read and relocated, this would be
+     0x000000ff.  When we have relocs which have an addend, such as
+     sun4 extended relocs, the value in the offset part of a
+     relocating field is garbage so we never use it.  In this case
+     the mask would be 0x00000000.  */
+  bfd_vma src_mask;
+
+  /* The dst_mask selects which parts of the instruction are replaced
+     into the instruction.  In most cases src_mask == dst_mask,
+     except in the above special case, where dst_mask would be
+     0x000000ff, and src_mask would be 0x00000000.  */
+  bfd_vma dst_mask;
+
+  /* When some formats create PC relative instructions, they leave
+     the value of the pc of the place being relocated in the offset
+     slot of the instruction, so that a PC relative relocation can
+     be made just by adding in an ordinary offset (e.g., sun3 a.out).
+     Some formats leave the displacement part of an instruction
+     empty (e.g., m88k bcs); this flag signals the fact.  */
+  boolean pcrel_offset;
+};
+
+#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
+  { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
+#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
+  HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
+         NAME, false, 0, 0, IN)
+
+#define EMPTY_HOWTO(C) \
+  HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \
+         NULL, false, 0, 0, false)
+
+#define HOWTO_PREPARE(relocation, symbol)               \
+  {                                                     \
+    if (symbol != (asymbol *) NULL)                     \
+      {                                                 \
+        if (bfd_is_com_section (symbol->section))       \
+          {                                             \
+            relocation = 0;                             \
+          }                                             \
+        else                                            \
+          {                                             \
+            relocation = symbol->value;                 \
+          }                                             \
+      }                                                 \
+  }
+
+unsigned int
+bfd_get_reloc_size PARAMS ((reloc_howto_type *));
+
+typedef struct relent_chain
+{
+  arelent relent;
+  struct relent_chain *next;
+}
+arelent_chain;
+
+bfd_reloc_status_type
+bfd_check_overflow PARAMS ((enum complain_overflow how,
+    unsigned int bitsize,
+    unsigned int rightshift,
+    unsigned int addrsize,
+    bfd_vma relocation));
+
+bfd_reloc_status_type
+bfd_perform_relocation PARAMS ((bfd *abfd,
+    arelent *reloc_entry,
+    PTR data,
+    asection *input_section,
+    bfd *output_bfd,
+    char **error_message));
+
+bfd_reloc_status_type
+bfd_install_relocation PARAMS ((bfd *abfd,
+    arelent *reloc_entry,
+    PTR data, bfd_vma data_start,
+    asection *input_section,
+    char **error_message));
+
+enum bfd_reloc_code_real {
+  _dummy_first_bfd_reloc_code_real,
+
+
+/* Basic absolute relocations of N bits.  */
+  BFD_RELOC_64,
+  BFD_RELOC_32,
+  BFD_RELOC_26,
+  BFD_RELOC_24,
+  BFD_RELOC_16,
+  BFD_RELOC_14,
+  BFD_RELOC_8,
+
+/* PC-relative relocations.  Sometimes these are relative to the address
+of the relocation itself; sometimes they are relative to the start of
+the section containing the relocation.  It depends on the specific target.
+
+The 24-bit relocation is used in some Intel 960 configurations.  */
+  BFD_RELOC_64_PCREL,
+  BFD_RELOC_32_PCREL,
+  BFD_RELOC_24_PCREL,
+  BFD_RELOC_16_PCREL,
+  BFD_RELOC_12_PCREL,
+  BFD_RELOC_8_PCREL,
+
+/* For ELF.  */
+  BFD_RELOC_32_GOT_PCREL,
+  BFD_RELOC_16_GOT_PCREL,
+  BFD_RELOC_8_GOT_PCREL,
+  BFD_RELOC_32_GOTOFF,
+  BFD_RELOC_16_GOTOFF,
+  BFD_RELOC_LO16_GOTOFF,
+  BFD_RELOC_HI16_GOTOFF,
+  BFD_RELOC_HI16_S_GOTOFF,
+  BFD_RELOC_8_GOTOFF,
+  BFD_RELOC_64_PLT_PCREL,
+  BFD_RELOC_32_PLT_PCREL,
+  BFD_RELOC_24_PLT_PCREL,
+  BFD_RELOC_16_PLT_PCREL,
+  BFD_RELOC_8_PLT_PCREL,
+  BFD_RELOC_64_PLTOFF,
+  BFD_RELOC_32_PLTOFF,
+  BFD_RELOC_16_PLTOFF,
+  BFD_RELOC_LO16_PLTOFF,
+  BFD_RELOC_HI16_PLTOFF,
+  BFD_RELOC_HI16_S_PLTOFF,
+  BFD_RELOC_8_PLTOFF,
+
+/* Relocations used by 68K ELF.  */
+  BFD_RELOC_68K_GLOB_DAT,
+  BFD_RELOC_68K_JMP_SLOT,
+  BFD_RELOC_68K_RELATIVE,
+
+/* Linkage-table relative.  */
+  BFD_RELOC_32_BASEREL,
+  BFD_RELOC_16_BASEREL,
+  BFD_RELOC_LO16_BASEREL,
+  BFD_RELOC_HI16_BASEREL,
+  BFD_RELOC_HI16_S_BASEREL,
+  BFD_RELOC_8_BASEREL,
+  BFD_RELOC_RVA,
+
+/* Absolute 8-bit relocation, but used to form an address like 0xFFnn.  */
+  BFD_RELOC_8_FFnn,
+
+/* These PC-relative relocations are stored as word displacements --
+i.e., byte displacements shifted right two bits.  The 30-bit word
+displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
+SPARC.  (SPARC tools generally refer to this as <<WDISP30>>.)  The
+signed 16-bit displacement is used on the MIPS, and the 23-bit
+displacement is used on the Alpha.  */
+  BFD_RELOC_32_PCREL_S2,
+  BFD_RELOC_16_PCREL_S2,
+  BFD_RELOC_23_PCREL_S2,
+
+/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
+the target word.  These are used on the SPARC.  */
+  BFD_RELOC_HI22,
+  BFD_RELOC_LO10,
+
+/* For systems that allocate a Global Pointer register, these are
+displacements off that register.  These relocation types are
+handled specially, because the value the register will have is
+decided relatively late.  */
+  BFD_RELOC_GPREL16,
+  BFD_RELOC_GPREL32,
+
+/* Reloc types used for i960/b.out.  */
+  BFD_RELOC_I960_CALLJ,
+
+/* SPARC ELF relocations.  There is probably some overlap with other
+relocation types already defined.  */
+  BFD_RELOC_NONE,
+  BFD_RELOC_SPARC_WDISP22,
+  BFD_RELOC_SPARC22,
+  BFD_RELOC_SPARC13,
+  BFD_RELOC_SPARC_GOT10,
+  BFD_RELOC_SPARC_GOT13,
+  BFD_RELOC_SPARC_GOT22,
+  BFD_RELOC_SPARC_PC10,
+  BFD_RELOC_SPARC_PC22,
+  BFD_RELOC_SPARC_WPLT30,
+  BFD_RELOC_SPARC_COPY,
+  BFD_RELOC_SPARC_GLOB_DAT,
+  BFD_RELOC_SPARC_JMP_SLOT,
+  BFD_RELOC_SPARC_RELATIVE,
+  BFD_RELOC_SPARC_UA16,
+  BFD_RELOC_SPARC_UA32,
+  BFD_RELOC_SPARC_UA64,
+
+/* I think these are specific to SPARC a.out (e.g., Sun 4).  */
+  BFD_RELOC_SPARC_BASE13,
+  BFD_RELOC_SPARC_BASE22,
+
+/* SPARC64 relocations  */
+#define BFD_RELOC_SPARC_64 BFD_RELOC_64
+  BFD_RELOC_SPARC_10,
+  BFD_RELOC_SPARC_11,
+  BFD_RELOC_SPARC_OLO10,
+  BFD_RELOC_SPARC_HH22,
+  BFD_RELOC_SPARC_HM10,
+  BFD_RELOC_SPARC_LM22,
+  BFD_RELOC_SPARC_PC_HH22,
+  BFD_RELOC_SPARC_PC_HM10,
+  BFD_RELOC_SPARC_PC_LM22,
+  BFD_RELOC_SPARC_WDISP16,
+  BFD_RELOC_SPARC_WDISP19,
+  BFD_RELOC_SPARC_7,
+  BFD_RELOC_SPARC_6,
+  BFD_RELOC_SPARC_5,
+#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
+  BFD_RELOC_SPARC_PLT32,
+  BFD_RELOC_SPARC_PLT64,
+  BFD_RELOC_SPARC_HIX22,
+  BFD_RELOC_SPARC_LOX10,
+  BFD_RELOC_SPARC_H44,
+  BFD_RELOC_SPARC_M44,
+  BFD_RELOC_SPARC_L44,
+  BFD_RELOC_SPARC_REGISTER,
+
+/* SPARC little endian relocation  */
+  BFD_RELOC_SPARC_REV32,
+
+/* Alpha ECOFF and ELF relocations.  Some of these treat the symbol or
+"addend" in some special way.
+For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
+writing; when reading, it will be the absolute section symbol.  The
+addend is the displacement in bytes of the "lda" instruction from
+the "ldah" instruction (which is at the address of this reloc).  */
+  BFD_RELOC_ALPHA_GPDISP_HI16,
+
+/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
+with GPDISP_HI16 relocs.  The addend is ignored when writing the
+relocations out, and is filled in with the file's GP value on
+reading, for convenience.  */
+  BFD_RELOC_ALPHA_GPDISP_LO16,
+
+/* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
+relocation except that there is no accompanying GPDISP_LO16
+relocation.  */
+  BFD_RELOC_ALPHA_GPDISP,
+
+/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
+the assembler turns it into a LDQ instruction to load the address of
+the symbol, and then fills in a register in the real instruction.
+
+The LITERAL reloc, at the LDQ instruction, refers to the .lita
+section symbol.  The addend is ignored when writing, but is filled
+in with the file's GP value on reading, for convenience, as with the
+GPDISP_LO16 reloc.
+
+The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
+It should refer to the symbol to be referenced, as with 16_GOTOFF,
+but it generates output not based on the position within the .got
+section, but relative to the GP value chosen for the file during the
+final link stage.
+
+The LITUSE reloc, on the instruction using the loaded address, gives
+information to the linker that it might be able to use to optimize
+away some literal section references.  The symbol is ignored (read
+as the absolute section symbol), and the "addend" indicates the type
+of instruction using the register:
+1 - "memory" fmt insn
+2 - byte-manipulation (byte offset reg)
+3 - jsr (target of branch)  */
+  BFD_RELOC_ALPHA_LITERAL,
+  BFD_RELOC_ALPHA_ELF_LITERAL,
+  BFD_RELOC_ALPHA_LITUSE,
+
+/* The HINT relocation indicates a value that should be filled into the
+"hint" field of a jmp/jsr/ret instruction, for possible branch-
+prediction logic which may be provided on some processors.  */
+  BFD_RELOC_ALPHA_HINT,
+
+/* The LINKAGE relocation outputs a linkage pair in the object file,
+which is filled by the linker.  */
+  BFD_RELOC_ALPHA_LINKAGE,
+
+/* The CODEADDR relocation outputs a STO_CA in the object file,
+which is filled by the linker.  */
+  BFD_RELOC_ALPHA_CODEADDR,
+
+/* The GPREL_HI/LO relocations together form a 32-bit offset from the
+GP register.  */
+  BFD_RELOC_ALPHA_GPREL_HI16,
+  BFD_RELOC_ALPHA_GPREL_LO16,
+
+/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must
+share a common GP, and the target address is adjusted for 
+STO_ALPHA_STD_GPLOAD.  */
+  BFD_RELOC_ALPHA_BRSGP,
+
+/* Alpha thread-local storage relocations.  */
+  BFD_RELOC_ALPHA_TLSGD,
+  BFD_RELOC_ALPHA_TLSLDM,
+  BFD_RELOC_ALPHA_DTPMOD64,
+  BFD_RELOC_ALPHA_GOTDTPREL16,
+  BFD_RELOC_ALPHA_DTPREL64,
+  BFD_RELOC_ALPHA_DTPREL_HI16,
+  BFD_RELOC_ALPHA_DTPREL_LO16,
+  BFD_RELOC_ALPHA_DTPREL16,
+  BFD_RELOC_ALPHA_GOTTPREL16,
+  BFD_RELOC_ALPHA_TPREL64,
+  BFD_RELOC_ALPHA_TPREL_HI16,
+  BFD_RELOC_ALPHA_TPREL_LO16,
+  BFD_RELOC_ALPHA_TPREL16,
+
+/* Bits 27..2 of the relocation address shifted right 2 bits;
+simple reloc otherwise.  */
+  BFD_RELOC_MIPS_JMP,
+
+/* The MIPS16 jump instruction.  */
+  BFD_RELOC_MIPS16_JMP,
+
+/* MIPS16 GP relative reloc.  */
+  BFD_RELOC_MIPS16_GPREL,
+
+/* High 16 bits of 32-bit value; simple reloc.  */
+  BFD_RELOC_HI16,
+
+/* High 16 bits of 32-bit value but the low 16 bits will be sign
+extended and added to form the final result.  If the low 16
+bits form a negative number, we need to add one to the high value
+to compensate for the borrow when the low bits are added.  */
+  BFD_RELOC_HI16_S,
+
+/* Low 16 bits.  */
+  BFD_RELOC_LO16,
+
+/* Like BFD_RELOC_HI16_S, but PC relative.  */
+  BFD_RELOC_PCREL_HI16_S,
+
+/* Like BFD_RELOC_LO16, but PC relative.  */
+  BFD_RELOC_PCREL_LO16,
+
+/* Relocation against a MIPS literal section.  */
+  BFD_RELOC_MIPS_LITERAL,
+
+/* MIPS ELF relocations.  */
+  BFD_RELOC_MIPS_GOT16,
+  BFD_RELOC_MIPS_CALL16,
+  BFD_RELOC_MIPS_GOT_HI16,
+  BFD_RELOC_MIPS_GOT_LO16,
+  BFD_RELOC_MIPS_CALL_HI16,
+  BFD_RELOC_MIPS_CALL_LO16,
+  BFD_RELOC_MIPS_SUB,
+  BFD_RELOC_MIPS_GOT_PAGE,
+  BFD_RELOC_MIPS_GOT_OFST,
+  BFD_RELOC_MIPS_GOT_DISP,
+  BFD_RELOC_MIPS_SHIFT5,
+  BFD_RELOC_MIPS_SHIFT6,
+  BFD_RELOC_MIPS_INSERT_A,
+  BFD_RELOC_MIPS_INSERT_B,
+  BFD_RELOC_MIPS_DELETE,
+  BFD_RELOC_MIPS_HIGHEST,
+  BFD_RELOC_MIPS_HIGHER,
+  BFD_RELOC_MIPS_SCN_DISP,
+  BFD_RELOC_MIPS_REL16,
+  BFD_RELOC_MIPS_RELGOT,
+  BFD_RELOC_MIPS_JALR,
+
+/* Fujitsu Frv Relocations.  */
+  BFD_RELOC_FRV_LABEL16,
+  BFD_RELOC_FRV_LABEL24,
+  BFD_RELOC_FRV_LO16,
+  BFD_RELOC_FRV_HI16,
+  BFD_RELOC_FRV_GPREL12,
+  BFD_RELOC_FRV_GPRELU12,
+  BFD_RELOC_FRV_GPREL32,
+  BFD_RELOC_FRV_GPRELHI,
+  BFD_RELOC_FRV_GPRELLO,
+
+
+/* i386/elf relocations  */
+  BFD_RELOC_386_GOT32,
+  BFD_RELOC_386_PLT32,
+  BFD_RELOC_386_COPY,
+  BFD_RELOC_386_GLOB_DAT,
+  BFD_RELOC_386_JUMP_SLOT,
+  BFD_RELOC_386_RELATIVE,
+  BFD_RELOC_386_GOTOFF,
+  BFD_RELOC_386_GOTPC,
+  BFD_RELOC_386_TLS_TPOFF,
+  BFD_RELOC_386_TLS_IE,
+  BFD_RELOC_386_TLS_GOTIE,
+  BFD_RELOC_386_TLS_LE,
+  BFD_RELOC_386_TLS_GD,
+  BFD_RELOC_386_TLS_LDM,
+  BFD_RELOC_386_TLS_LDO_32,
+  BFD_RELOC_386_TLS_IE_32,
+  BFD_RELOC_386_TLS_LE_32,
+  BFD_RELOC_386_TLS_DTPMOD32,
+  BFD_RELOC_386_TLS_DTPOFF32,
+  BFD_RELOC_386_TLS_TPOFF32,
+
+/* x86-64/elf relocations  */
+  BFD_RELOC_X86_64_GOT32,
+  BFD_RELOC_X86_64_PLT32,
+  BFD_RELOC_X86_64_COPY,
+  BFD_RELOC_X86_64_GLOB_DAT,
+  BFD_RELOC_X86_64_JUMP_SLOT,
+  BFD_RELOC_X86_64_RELATIVE,
+  BFD_RELOC_X86_64_GOTPCREL,
+  BFD_RELOC_X86_64_32S,
+  BFD_RELOC_X86_64_DTPMOD64,
+  BFD_RELOC_X86_64_DTPOFF64,
+  BFD_RELOC_X86_64_TPOFF64,
+  BFD_RELOC_X86_64_TLSGD,
+  BFD_RELOC_X86_64_TLSLD,
+  BFD_RELOC_X86_64_DTPOFF32,
+  BFD_RELOC_X86_64_GOTTPOFF,
+  BFD_RELOC_X86_64_TPOFF32,
+
+/* ns32k relocations  */
+  BFD_RELOC_NS32K_IMM_8,
+  BFD_RELOC_NS32K_IMM_16,
+  BFD_RELOC_NS32K_IMM_32,
+  BFD_RELOC_NS32K_IMM_8_PCREL,
+  BFD_RELOC_NS32K_IMM_16_PCREL,
+  BFD_RELOC_NS32K_IMM_32_PCREL,
+  BFD_RELOC_NS32K_DISP_8,
+  BFD_RELOC_NS32K_DISP_16,
+  BFD_RELOC_NS32K_DISP_32,
+  BFD_RELOC_NS32K_DISP_8_PCREL,
+  BFD_RELOC_NS32K_DISP_16_PCREL,
+  BFD_RELOC_NS32K_DISP_32_PCREL,
+
+/* PDP11 relocations  */
+  BFD_RELOC_PDP11_DISP_8_PCREL,
+  BFD_RELOC_PDP11_DISP_6_PCREL,
+
+/* Picojava relocs.  Not all of these appear in object files.  */
+  BFD_RELOC_PJ_CODE_HI16,
+  BFD_RELOC_PJ_CODE_LO16,
+  BFD_RELOC_PJ_CODE_DIR16,
+  BFD_RELOC_PJ_CODE_DIR32,
+  BFD_RELOC_PJ_CODE_REL16,
+  BFD_RELOC_PJ_CODE_REL32,
+
+/* Power(rs6000) and PowerPC relocations.  */
+  BFD_RELOC_PPC_B26,
+  BFD_RELOC_PPC_BA26,
+  BFD_RELOC_PPC_TOC16,
+  BFD_RELOC_PPC_B16,
+  BFD_RELOC_PPC_B16_BRTAKEN,
+  BFD_RELOC_PPC_B16_BRNTAKEN,
+  BFD_RELOC_PPC_BA16,
+  BFD_RELOC_PPC_BA16_BRTAKEN,
+  BFD_RELOC_PPC_BA16_BRNTAKEN,
+  BFD_RELOC_PPC_COPY,
+  BFD_RELOC_PPC_GLOB_DAT,
+  BFD_RELOC_PPC_JMP_SLOT,
+  BFD_RELOC_PPC_RELATIVE,
+  BFD_RELOC_PPC_LOCAL24PC,
+  BFD_RELOC_PPC_EMB_NADDR32,
+  BFD_RELOC_PPC_EMB_NADDR16,
+  BFD_RELOC_PPC_EMB_NADDR16_LO,
+  BFD_RELOC_PPC_EMB_NADDR16_HI,
+  BFD_RELOC_PPC_EMB_NADDR16_HA,
+  BFD_RELOC_PPC_EMB_SDAI16,
+  BFD_RELOC_PPC_EMB_SDA2I16,
+  BFD_RELOC_PPC_EMB_SDA2REL,
+  BFD_RELOC_PPC_EMB_SDA21,
+  BFD_RELOC_PPC_EMB_MRKREF,
+  BFD_RELOC_PPC_EMB_RELSEC16,
+  BFD_RELOC_PPC_EMB_RELST_LO,
+  BFD_RELOC_PPC_EMB_RELST_HI,
+  BFD_RELOC_PPC_EMB_RELST_HA,
+  BFD_RELOC_PPC_EMB_BIT_FLD,
+  BFD_RELOC_PPC_EMB_RELSDA,
+  BFD_RELOC_PPC64_HIGHER,
+  BFD_RELOC_PPC64_HIGHER_S,
+  BFD_RELOC_PPC64_HIGHEST,
+  BFD_RELOC_PPC64_HIGHEST_S,
+  BFD_RELOC_PPC64_TOC16_LO,
+  BFD_RELOC_PPC64_TOC16_HI,
+  BFD_RELOC_PPC64_TOC16_HA,
+  BFD_RELOC_PPC64_TOC,
+  BFD_RELOC_PPC64_PLTGOT16,
+  BFD_RELOC_PPC64_PLTGOT16_LO,
+  BFD_RELOC_PPC64_PLTGOT16_HI,
+  BFD_RELOC_PPC64_PLTGOT16_HA,
+  BFD_RELOC_PPC64_ADDR16_DS,
+  BFD_RELOC_PPC64_ADDR16_LO_DS,
+  BFD_RELOC_PPC64_GOT16_DS,
+  BFD_RELOC_PPC64_GOT16_LO_DS,
+  BFD_RELOC_PPC64_PLT16_LO_DS,
+  BFD_RELOC_PPC64_SECTOFF_DS,
+  BFD_RELOC_PPC64_SECTOFF_LO_DS,
+  BFD_RELOC_PPC64_TOC16_DS,
+  BFD_RELOC_PPC64_TOC16_LO_DS,
+  BFD_RELOC_PPC64_PLTGOT16_DS,
+  BFD_RELOC_PPC64_PLTGOT16_LO_DS,
+
+/* IBM 370/390 relocations  */
+  BFD_RELOC_I370_D12,
+
+/* The type of reloc used to build a contructor table - at the moment
+probably a 32 bit wide absolute relocation, but the target can choose.
+It generally does map to one of the other relocation types.  */
+  BFD_RELOC_CTOR,
+
+/* ARM 26 bit pc-relative branch.  The lowest two bits must be zero and are
+not stored in the instruction.  */
+  BFD_RELOC_ARM_PCREL_BRANCH,
+
+/* ARM 26 bit pc-relative branch.  The lowest bit must be zero and is
+not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
+field in the instruction.  */
+  BFD_RELOC_ARM_PCREL_BLX,
+
+/* Thumb 22 bit pc-relative branch.  The lowest bit must be zero and is
+not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
+field in the instruction.  */
+  BFD_RELOC_THUMB_PCREL_BLX,
+
+/* These relocs are only used within the ARM assembler.  They are not
+(at present) written to any object files.  */
+  BFD_RELOC_ARM_IMMEDIATE,
+  BFD_RELOC_ARM_ADRL_IMMEDIATE,
+  BFD_RELOC_ARM_OFFSET_IMM,
+  BFD_RELOC_ARM_SHIFT_IMM,
+  BFD_RELOC_ARM_SWI,
+  BFD_RELOC_ARM_MULTI,
+  BFD_RELOC_ARM_CP_OFF_IMM,
+  BFD_RELOC_ARM_ADR_IMM,
+  BFD_RELOC_ARM_LDR_IMM,
+  BFD_RELOC_ARM_LITERAL,
+  BFD_RELOC_ARM_IN_POOL,
+  BFD_RELOC_ARM_OFFSET_IMM8,
+  BFD_RELOC_ARM_HWLITERAL,
+  BFD_RELOC_ARM_THUMB_ADD,
+  BFD_RELOC_ARM_THUMB_IMM,
+  BFD_RELOC_ARM_THUMB_SHIFT,
+  BFD_RELOC_ARM_THUMB_OFFSET,
+  BFD_RELOC_ARM_GOT12,
+  BFD_RELOC_ARM_GOT32,
+  BFD_RELOC_ARM_JUMP_SLOT,
+  BFD_RELOC_ARM_COPY,
+  BFD_RELOC_ARM_GLOB_DAT,
+  BFD_RELOC_ARM_PLT32,
+  BFD_RELOC_ARM_RELATIVE,
+  BFD_RELOC_ARM_GOTOFF,
+  BFD_RELOC_ARM_GOTPC,
+
+/* Hitachi SH relocs.  Not all of these appear in object files.  */
+  BFD_RELOC_SH_PCDISP8BY2,
+  BFD_RELOC_SH_PCDISP12BY2,
+  BFD_RELOC_SH_IMM4,
+  BFD_RELOC_SH_IMM4BY2,
+  BFD_RELOC_SH_IMM4BY4,
+  BFD_RELOC_SH_IMM8,
+  BFD_RELOC_SH_IMM8BY2,
+  BFD_RELOC_SH_IMM8BY4,
+  BFD_RELOC_SH_PCRELIMM8BY2,
+  BFD_RELOC_SH_PCRELIMM8BY4,
+  BFD_RELOC_SH_SWITCH16,
+  BFD_RELOC_SH_SWITCH32,
+  BFD_RELOC_SH_USES,
+  BFD_RELOC_SH_COUNT,
+  BFD_RELOC_SH_ALIGN,
+  BFD_RELOC_SH_CODE,
+  BFD_RELOC_SH_DATA,
+  BFD_RELOC_SH_LABEL,
+  BFD_RELOC_SH_LOOP_START,
+  BFD_RELOC_SH_LOOP_END,
+  BFD_RELOC_SH_COPY,
+  BFD_RELOC_SH_GLOB_DAT,
+  BFD_RELOC_SH_JMP_SLOT,
+  BFD_RELOC_SH_RELATIVE,
+  BFD_RELOC_SH_GOTPC,
+  BFD_RELOC_SH_GOT_LOW16,
+  BFD_RELOC_SH_GOT_MEDLOW16,
+  BFD_RELOC_SH_GOT_MEDHI16,
+  BFD_RELOC_SH_GOT_HI16,
+  BFD_RELOC_SH_GOTPLT_LOW16,
+  BFD_RELOC_SH_GOTPLT_MEDLOW16,
+  BFD_RELOC_SH_GOTPLT_MEDHI16,
+  BFD_RELOC_SH_GOTPLT_HI16,
+  BFD_RELOC_SH_PLT_LOW16,
+  BFD_RELOC_SH_PLT_MEDLOW16,
+  BFD_RELOC_SH_PLT_MEDHI16,
+  BFD_RELOC_SH_PLT_HI16,
+  BFD_RELOC_SH_GOTOFF_LOW16,
+  BFD_RELOC_SH_GOTOFF_MEDLOW16,
+  BFD_RELOC_SH_GOTOFF_MEDHI16,
+  BFD_RELOC_SH_GOTOFF_HI16,
+  BFD_RELOC_SH_GOTPC_LOW16,
+  BFD_RELOC_SH_GOTPC_MEDLOW16,
+  BFD_RELOC_SH_GOTPC_MEDHI16,
+  BFD_RELOC_SH_GOTPC_HI16,
+  BFD_RELOC_SH_COPY64,
+  BFD_RELOC_SH_GLOB_DAT64,
+  BFD_RELOC_SH_JMP_SLOT64,
+  BFD_RELOC_SH_RELATIVE64,
+  BFD_RELOC_SH_GOT10BY4,
+  BFD_RELOC_SH_GOT10BY8,
+  BFD_RELOC_SH_GOTPLT10BY4,
+  BFD_RELOC_SH_GOTPLT10BY8,
+  BFD_RELOC_SH_GOTPLT32,
+  BFD_RELOC_SH_SHMEDIA_CODE,
+  BFD_RELOC_SH_IMMU5,
+  BFD_RELOC_SH_IMMS6,
+  BFD_RELOC_SH_IMMS6BY32,
+  BFD_RELOC_SH_IMMU6,
+  BFD_RELOC_SH_IMMS10,
+  BFD_RELOC_SH_IMMS10BY2,
+  BFD_RELOC_SH_IMMS10BY4,
+  BFD_RELOC_SH_IMMS10BY8,
+  BFD_RELOC_SH_IMMS16,
+  BFD_RELOC_SH_IMMU16,
+  BFD_RELOC_SH_IMM_LOW16,
+  BFD_RELOC_SH_IMM_LOW16_PCREL,
+  BFD_RELOC_SH_IMM_MEDLOW16,
+  BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
+  BFD_RELOC_SH_IMM_MEDHI16,
+  BFD_RELOC_SH_IMM_MEDHI16_PCREL,
+  BFD_RELOC_SH_IMM_HI16,
+  BFD_RELOC_SH_IMM_HI16_PCREL,
+  BFD_RELOC_SH_PT_16,
+  BFD_RELOC_SH_TLS_GD_32,
+  BFD_RELOC_SH_TLS_LD_32,
+  BFD_RELOC_SH_TLS_LDO_32,
+  BFD_RELOC_SH_TLS_IE_32,
+  BFD_RELOC_SH_TLS_LE_32,
+  BFD_RELOC_SH_TLS_DTPMOD32,
+  BFD_RELOC_SH_TLS_DTPOFF32,
+  BFD_RELOC_SH_TLS_TPOFF32,
+
+/* Thumb 23-, 12- and 9-bit pc-relative branches.  The lowest bit must
+be zero and is not stored in the instruction.  */
+  BFD_RELOC_THUMB_PCREL_BRANCH9,
+  BFD_RELOC_THUMB_PCREL_BRANCH12,
+  BFD_RELOC_THUMB_PCREL_BRANCH23,
+
+/* ARC Cores relocs.
+ARC 22 bit pc-relative branch.  The lowest two bits must be zero and are
+not stored in the instruction.  The high 20 bits are installed in bits 26
+through 7 of the instruction.  */
+  BFD_RELOC_ARC_B22_PCREL,
+
+/* ARC 26 bit absolute branch.  The lowest two bits must be zero and are not
+stored in the instruction.  The high 24 bits are installed in bits 23
+through 0.  */
+  BFD_RELOC_ARC_B26,
+
+/* Mitsubishi D10V relocs.
+This is a 10-bit reloc with the right 2 bits
+assumed to be 0.  */
+  BFD_RELOC_D10V_10_PCREL_R,
+
+/* Mitsubishi D10V relocs.
+This is a 10-bit reloc with the right 2 bits
+assumed to be 0.  This is the same as the previous reloc
+except it is in the left container, i.e.,
+shifted left 15 bits.  */
+  BFD_RELOC_D10V_10_PCREL_L,
+
+/* This is an 18-bit reloc with the right 2 bits
+assumed to be 0.  */
+  BFD_RELOC_D10V_18,
+
+/* This is an 18-bit reloc with the right 2 bits
+assumed to be 0.  */
+  BFD_RELOC_D10V_18_PCREL,
+
+/* Mitsubishi D30V relocs.
+This is a 6-bit absolute reloc.  */
+  BFD_RELOC_D30V_6,
+
+/* This is a 6-bit pc-relative reloc with
+the right 3 bits assumed to be 0.  */
+  BFD_RELOC_D30V_9_PCREL,
+
+/* This is a 6-bit pc-relative reloc with
+the right 3 bits assumed to be 0. Same
+as the previous reloc but on the right side
+of the container.  */
+  BFD_RELOC_D30V_9_PCREL_R,
+
+/* This is a 12-bit absolute reloc with the
+right 3 bitsassumed to be 0.  */
+  BFD_RELOC_D30V_15,
+
+/* This is a 12-bit pc-relative reloc with
+the right 3 bits assumed to be 0.  */
+  BFD_RELOC_D30V_15_PCREL,
+
+/* This is a 12-bit pc-relative reloc with
+the right 3 bits assumed to be 0. Same
+as the previous reloc but on the right side
+of the container.  */
+  BFD_RELOC_D30V_15_PCREL_R,
+
+/* This is an 18-bit absolute reloc with
+the right 3 bits assumed to be 0.  */
+  BFD_RELOC_D30V_21,
+
+/* This is an 18-bit pc-relative reloc with
+the right 3 bits assumed to be 0.  */
+  BFD_RELOC_D30V_21_PCREL,
+
+/* This is an 18-bit pc-relative reloc with
+the right 3 bits assumed to be 0. Same
+as the previous reloc but on the right side
+of the container.  */
+  BFD_RELOC_D30V_21_PCREL_R,
+
+/* This is a 32-bit absolute reloc.  */
+  BFD_RELOC_D30V_32,
+
+/* This is a 32-bit pc-relative reloc.  */
+  BFD_RELOC_D30V_32_PCREL,
+
+/* DLX relocs  */
+  BFD_RELOC_DLX_HI16_S,
+
+/* DLX relocs  */
+  BFD_RELOC_DLX_LO16,
+
+/* DLX relocs  */
+  BFD_RELOC_DLX_JMP26,
+
+/* Mitsubishi M32R relocs.
+This is a 24 bit absolute address.  */
+  BFD_RELOC_M32R_24,
+
+/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0.  */
+  BFD_RELOC_M32R_10_PCREL,
+
+/* This is an 18-bit reloc with the right 2 bits assumed to be 0.  */
+  BFD_RELOC_M32R_18_PCREL,
+
+/* This is a 26-bit reloc with the right 2 bits assumed to be 0.  */
+  BFD_RELOC_M32R_26_PCREL,
+
+/* This is a 16-bit reloc containing the high 16 bits of an address
+used when the lower 16 bits are treated as unsigned.  */
+  BFD_RELOC_M32R_HI16_ULO,
+
+/* This is a 16-bit reloc containing the high 16 bits of an address
+used when the lower 16 bits are treated as signed.  */
+  BFD_RELOC_M32R_HI16_SLO,
+
+/* This is a 16-bit reloc containing the lower 16 bits of an address.  */
+  BFD_RELOC_M32R_LO16,
+
+/* This is a 16-bit reloc containing the small data area offset for use in
+add3, load, and store instructions.  */
+  BFD_RELOC_M32R_SDA16,
+
+/* This is a 9-bit reloc  */
+  BFD_RELOC_V850_9_PCREL,
+
+/* This is a 22-bit reloc  */
+  BFD_RELOC_V850_22_PCREL,
+
+/* This is a 16 bit offset from the short data area pointer.  */
+  BFD_RELOC_V850_SDA_16_16_OFFSET,
+
+/* This is a 16 bit offset (of which only 15 bits are used) from the
+short data area pointer.  */
+  BFD_RELOC_V850_SDA_15_16_OFFSET,
+
+/* This is a 16 bit offset from the zero data area pointer.  */
+  BFD_RELOC_V850_ZDA_16_16_OFFSET,
+
+/* This is a 16 bit offset (of which only 15 bits are used) from the
+zero data area pointer.  */
+  BFD_RELOC_V850_ZDA_15_16_OFFSET,
+
+/* This is an 8 bit offset (of which only 6 bits are used) from the
+tiny data area pointer.  */
+  BFD_RELOC_V850_TDA_6_8_OFFSET,
+
+/* This is an 8bit offset (of which only 7 bits are used) from the tiny
+data area pointer.  */
+  BFD_RELOC_V850_TDA_7_8_OFFSET,
+
+/* This is a 7 bit offset from the tiny data area pointer.  */
+  BFD_RELOC_V850_TDA_7_7_OFFSET,
+
+/* This is a 16 bit offset from the tiny data area pointer.  */
+  BFD_RELOC_V850_TDA_16_16_OFFSET,
+
+/* This is a 5 bit offset (of which only 4 bits are used) from the tiny
+data area pointer.  */
+  BFD_RELOC_V850_TDA_4_5_OFFSET,
+
+/* This is a 4 bit offset from the tiny data area pointer.  */
+  BFD_RELOC_V850_TDA_4_4_OFFSET,
+
+/* This is a 16 bit offset from the short data area pointer, with the
+bits placed non-contigously in the instruction.  */
+  BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
+
+/* This is a 16 bit offset from the zero data area pointer, with the
+bits placed non-contigously in the instruction.  */
+  BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
+
+/* This is a 6 bit offset from the call table base pointer.  */
+  BFD_RELOC_V850_CALLT_6_7_OFFSET,
+
+/* This is a 16 bit offset from the call table base pointer.  */
+  BFD_RELOC_V850_CALLT_16_16_OFFSET,
+
+/* Used for relaxing indirect function calls.  */
+  BFD_RELOC_V850_LONGCALL,
+
+/* Used for relaxing indirect jumps.  */
+  BFD_RELOC_V850_LONGJUMP,
+
+/* Used to maintain alignment whilst relaxing.  */
+  BFD_RELOC_V850_ALIGN,
+
+/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
+instruction.  */
+  BFD_RELOC_MN10300_32_PCREL,
+
+/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
+instruction.  */
+  BFD_RELOC_MN10300_16_PCREL,
+
+/* This is a 8bit DP reloc for the tms320c30, where the most
+significant 8 bits of a 24 bit word are placed into the least
+significant 8 bits of the opcode.  */
+  BFD_RELOC_TIC30_LDP,
+
+/* This is a 7bit reloc for the tms320c54x, where the least
+significant 7 bits of a 16 bit word are placed into the least
+significant 7 bits of the opcode.  */
+  BFD_RELOC_TIC54X_PARTLS7,
+
+/* This is a 9bit DP reloc for the tms320c54x, where the most
+significant 9 bits of a 16 bit word are placed into the least
+significant 9 bits of the opcode.  */
+  BFD_RELOC_TIC54X_PARTMS9,
+
+/* This is an extended address 23-bit reloc for the tms320c54x.  */
+  BFD_RELOC_TIC54X_23,
+
+/* This is a 16-bit reloc for the tms320c54x, where the least
+significant 16 bits of a 23-bit extended address are placed into
+the opcode.  */
+  BFD_RELOC_TIC54X_16_OF_23,
+
+/* This is a reloc for the tms320c54x, where the most
+significant 7 bits of a 23-bit extended address are placed into
+the opcode.  */
+  BFD_RELOC_TIC54X_MS7_OF_23,
+
+/* This is a 48 bit reloc for the FR30 that stores 32 bits.  */
+  BFD_RELOC_FR30_48,
+
+/* This is a 32 bit reloc for the FR30 that stores 20 bits split up into
+two sections.  */
+  BFD_RELOC_FR30_20,
+
+/* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
+4 bits.  */
+  BFD_RELOC_FR30_6_IN_4,
+
+/* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
+into 8 bits.  */
+  BFD_RELOC_FR30_8_IN_8,
+
+/* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
+into 8 bits.  */
+  BFD_RELOC_FR30_9_IN_8,
+
+/* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
+into 8 bits.  */
+  BFD_RELOC_FR30_10_IN_8,
+
+/* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
+short offset into 8 bits.  */
+  BFD_RELOC_FR30_9_PCREL,
+
+/* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
+short offset into 11 bits.  */
+  BFD_RELOC_FR30_12_PCREL,
+
+/* Motorola Mcore relocations.  */
+  BFD_RELOC_MCORE_PCREL_IMM8BY4,
+  BFD_RELOC_MCORE_PCREL_IMM11BY2,
+  BFD_RELOC_MCORE_PCREL_IMM4BY2,
+  BFD_RELOC_MCORE_PCREL_32,
+  BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
+  BFD_RELOC_MCORE_RVA,
+
+/* These are relocations for the GETA instruction.  */
+  BFD_RELOC_MMIX_GETA,
+  BFD_RELOC_MMIX_GETA_1,
+  BFD_RELOC_MMIX_GETA_2,
+  BFD_RELOC_MMIX_GETA_3,
+
+/* These are relocations for a conditional branch instruction.  */
+  BFD_RELOC_MMIX_CBRANCH,
+  BFD_RELOC_MMIX_CBRANCH_J,
+  BFD_RELOC_MMIX_CBRANCH_1,
+  BFD_RELOC_MMIX_CBRANCH_2,
+  BFD_RELOC_MMIX_CBRANCH_3,
+
+/* These are relocations for the PUSHJ instruction.  */
+  BFD_RELOC_MMIX_PUSHJ,
+  BFD_RELOC_MMIX_PUSHJ_1,
+  BFD_RELOC_MMIX_PUSHJ_2,
+  BFD_RELOC_MMIX_PUSHJ_3,
+
+/* These are relocations for the JMP instruction.  */
+  BFD_RELOC_MMIX_JMP,
+  BFD_RELOC_MMIX_JMP_1,
+  BFD_RELOC_MMIX_JMP_2,
+  BFD_RELOC_MMIX_JMP_3,
+
+/* This is a relocation for a relative address as in a GETA instruction or
+a branch.  */
+  BFD_RELOC_MMIX_ADDR19,
+
+/* This is a relocation for a relative address as in a JMP instruction.  */
+  BFD_RELOC_MMIX_ADDR27,
+
+/* This is a relocation for an instruction field that may be a general
+register or a value 0..255.  */
+  BFD_RELOC_MMIX_REG_OR_BYTE,
+
+/* This is a relocation for an instruction field that may be a general
+register.  */
+  BFD_RELOC_MMIX_REG,
+
+/* This is a relocation for two instruction fields holding a register and
+an offset, the equivalent of the relocation.  */
+  BFD_RELOC_MMIX_BASE_PLUS_OFFSET,
+
+/* This relocation is an assertion that the expression is not allocated as
+a global register.  It does not modify contents.  */
+  BFD_RELOC_MMIX_LOCAL,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
+short offset into 7 bits.  */
+  BFD_RELOC_AVR_7_PCREL,
+
+/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
+short offset into 12 bits.  */
+  BFD_RELOC_AVR_13_PCREL,
+
+/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
+program memory address) into 16 bits.  */
+  BFD_RELOC_AVR_16_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
+data memory address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_LO8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+of data memory address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_HI8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+of program memory address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_HH8_LDI,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(usually data memory address) into 8 bit immediate value of SUBI insn.  */
+  BFD_RELOC_AVR_LO8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 8 bit of data memory address) into 8 bit immediate value of
+SUBI insn.  */
+  BFD_RELOC_AVR_HI8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(most high 8 bit of program memory address) into 8 bit immediate value
+of LDI or SUBI insn.  */
+  BFD_RELOC_AVR_HH8_LDI_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
+command address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_LO8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+of command address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_HI8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+of command address) into 8 bit immediate value of LDI insn.  */
+  BFD_RELOC_AVR_HH8_LDI_PM,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(usually command address) into 8 bit immediate value of SUBI insn.  */
+  BFD_RELOC_AVR_LO8_LDI_PM_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 8 bit of 16 bit command address) into 8 bit immediate value
+of SUBI insn.  */
+  BFD_RELOC_AVR_HI8_LDI_PM_NEG,
+
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
+(high 6 bit of 22 bit command address) into 8 bit immediate
+value of SUBI insn.  */
+  BFD_RELOC_AVR_HH8_LDI_PM_NEG,
+
+/* This is a 32 bit reloc for the AVR that stores 23 bit value
+into 22 bits.  */
+  BFD_RELOC_AVR_CALL,
+
+/* Direct 12 bit.  */
+  BFD_RELOC_390_12,
+
+/* 12 bit GOT offset.  */
+  BFD_RELOC_390_GOT12,
+
+/* 32 bit PC relative PLT address.  */
+  BFD_RELOC_390_PLT32,
+
+/* Copy symbol at runtime.  */
+  BFD_RELOC_390_COPY,
+
+/* Create GOT entry.  */
+  BFD_RELOC_390_GLOB_DAT,
+
+/* Create PLT entry.  */
+  BFD_RELOC_390_JMP_SLOT,
+
+/* Adjust by program base.  */
+  BFD_RELOC_390_RELATIVE,
+
+/* 32 bit PC relative offset to GOT.  */
+  BFD_RELOC_390_GOTPC,
+
+/* 16 bit GOT offset.  */
+  BFD_RELOC_390_GOT16,
+
+/* PC relative 16 bit shifted by 1.  */
+  BFD_RELOC_390_PC16DBL,
+
+/* 16 bit PC rel. PLT shifted by 1.  */
+  BFD_RELOC_390_PLT16DBL,
+
+/* PC relative 32 bit shifted by 1.  */
+  BFD_RELOC_390_PC32DBL,
+
+/* 32 bit PC rel. PLT shifted by 1.  */
+  BFD_RELOC_390_PLT32DBL,
+
+/* 32 bit PC rel. GOT shifted by 1.  */
+  BFD_RELOC_390_GOTPCDBL,
+
+/* 64 bit GOT offset.  */
+  BFD_RELOC_390_GOT64,
+
+/* 64 bit PC relative PLT address.  */
+  BFD_RELOC_390_PLT64,
+
+/* 32 bit rel. offset to GOT entry.  */
+  BFD_RELOC_390_GOTENT,
+
+/* Scenix IP2K - 9-bit register number / data address  */
+  BFD_RELOC_IP2K_FR9,
+
+/* Scenix IP2K - 4-bit register/data bank number  */
+  BFD_RELOC_IP2K_BANK,
+
+/* Scenix IP2K - low 13 bits of instruction word address  */
+  BFD_RELOC_IP2K_ADDR16CJP,
+
+/* Scenix IP2K - high 3 bits of instruction word address  */
+  BFD_RELOC_IP2K_PAGE3,
+
+/* Scenix IP2K - ext/low/high 8 bits of data address  */
+  BFD_RELOC_IP2K_LO8DATA,
+  BFD_RELOC_IP2K_HI8DATA,
+  BFD_RELOC_IP2K_EX8DATA,
+
+/* Scenix IP2K - low/high 8 bits of instruction word address  */
+  BFD_RELOC_IP2K_LO8INSN,
+  BFD_RELOC_IP2K_HI8INSN,
+
+/* Scenix IP2K - even/odd PC modifier to modify snb pcl.0  */
+  BFD_RELOC_IP2K_PC_SKIP,
+
+/* Scenix IP2K - 16 bit word address in text section.  */
+  BFD_RELOC_IP2K_TEXT,
+
+/* Scenix IP2K - 7-bit sp or dp offset  */
+  BFD_RELOC_IP2K_FR_OFFSET,
+
+/* Scenix VPE4K coprocessor - data/insn-space addressing  */
+  BFD_RELOC_VPE4KMATH_DATA,
+  BFD_RELOC_VPE4KMATH_INSN,
+
+/* These two relocations are used by the linker to determine which of
+the entries in a C++ virtual function table are actually used.  When
+the --gc-sections option is given, the linker will zero out the entries
+that are not used, so that the code for those functions need not be
+included in the output.
+
+VTABLE_INHERIT is a zero-space relocation used to describe to the
+linker the inheritence tree of a C++ virtual function table.  The
+relocation's symbol should be the parent class' vtable, and the
+relocation should be located at the child vtable.
+
+VTABLE_ENTRY is a zero-space relocation that describes the use of a
+virtual function table entry.  The reloc's symbol should refer to the
+table of the class mentioned in the code.  Off of that base, an offset
+describes the entry that is being used.  For Rela hosts, this offset
+is stored in the reloc's addend.  For Rel hosts, we are forced to put
+this offset in the reloc's section offset.  */
+  BFD_RELOC_VTABLE_INHERIT,
+  BFD_RELOC_VTABLE_ENTRY,
+
+/* Intel IA64 Relocations.  */
+  BFD_RELOC_IA64_IMM14,
+  BFD_RELOC_IA64_IMM22,
+  BFD_RELOC_IA64_IMM64,
+  BFD_RELOC_IA64_DIR32MSB,
+  BFD_RELOC_IA64_DIR32LSB,
+  BFD_RELOC_IA64_DIR64MSB,
+  BFD_RELOC_IA64_DIR64LSB,
+  BFD_RELOC_IA64_GPREL22,
+  BFD_RELOC_IA64_GPREL64I,
+  BFD_RELOC_IA64_GPREL32MSB,
+  BFD_RELOC_IA64_GPREL32LSB,
+  BFD_RELOC_IA64_GPREL64MSB,
+  BFD_RELOC_IA64_GPREL64LSB,
+  BFD_RELOC_IA64_LTOFF22,
+  BFD_RELOC_IA64_LTOFF64I,
+  BFD_RELOC_IA64_PLTOFF22,
+  BFD_RELOC_IA64_PLTOFF64I,
+  BFD_RELOC_IA64_PLTOFF64MSB,
+  BFD_RELOC_IA64_PLTOFF64LSB,
+  BFD_RELOC_IA64_FPTR64I,
+  BFD_RELOC_IA64_FPTR32MSB,
+  BFD_RELOC_IA64_FPTR32LSB,
+  BFD_RELOC_IA64_FPTR64MSB,
+  BFD_RELOC_IA64_FPTR64LSB,
+  BFD_RELOC_IA64_PCREL21B,
+  BFD_RELOC_IA64_PCREL21BI,
+  BFD_RELOC_IA64_PCREL21M,
+  BFD_RELOC_IA64_PCREL21F,
+  BFD_RELOC_IA64_PCREL22,
+  BFD_RELOC_IA64_PCREL60B,
+  BFD_RELOC_IA64_PCREL64I,
+  BFD_RELOC_IA64_PCREL32MSB,
+  BFD_RELOC_IA64_PCREL32LSB,
+  BFD_RELOC_IA64_PCREL64MSB,
+  BFD_RELOC_IA64_PCREL64LSB,
+  BFD_RELOC_IA64_LTOFF_FPTR22,
+  BFD_RELOC_IA64_LTOFF_FPTR64I,
+  BFD_RELOC_IA64_LTOFF_FPTR32MSB,
+  BFD_RELOC_IA64_LTOFF_FPTR32LSB,
+  BFD_RELOC_IA64_LTOFF_FPTR64MSB,
+  BFD_RELOC_IA64_LTOFF_FPTR64LSB,
+  BFD_RELOC_IA64_SEGREL32MSB,
+  BFD_RELOC_IA64_SEGREL32LSB,
+  BFD_RELOC_IA64_SEGREL64MSB,
+  BFD_RELOC_IA64_SEGREL64LSB,
+  BFD_RELOC_IA64_SECREL32MSB,
+  BFD_RELOC_IA64_SECREL32LSB,
+  BFD_RELOC_IA64_SECREL64MSB,
+  BFD_RELOC_IA64_SECREL64LSB,
+  BFD_RELOC_IA64_REL32MSB,
+  BFD_RELOC_IA64_REL32LSB,
+  BFD_RELOC_IA64_REL64MSB,
+  BFD_RELOC_IA64_REL64LSB,
+  BFD_RELOC_IA64_LTV32MSB,
+  BFD_RELOC_IA64_LTV32LSB,
+  BFD_RELOC_IA64_LTV64MSB,
+  BFD_RELOC_IA64_LTV64LSB,
+  BFD_RELOC_IA64_IPLTMSB,
+  BFD_RELOC_IA64_IPLTLSB,
+  BFD_RELOC_IA64_COPY,
+  BFD_RELOC_IA64_LTOFF22X,
+  BFD_RELOC_IA64_LDXMOV,
+  BFD_RELOC_IA64_TPREL14,
+  BFD_RELOC_IA64_TPREL22,
+  BFD_RELOC_IA64_TPREL64I,
+  BFD_RELOC_IA64_TPREL64MSB,
+  BFD_RELOC_IA64_TPREL64LSB,
+  BFD_RELOC_IA64_LTOFF_TPREL22,
+  BFD_RELOC_IA64_DTPMOD64MSB,
+  BFD_RELOC_IA64_DTPMOD64LSB,
+  BFD_RELOC_IA64_LTOFF_DTPMOD22,
+  BFD_RELOC_IA64_DTPREL14,
+  BFD_RELOC_IA64_DTPREL22,
+  BFD_RELOC_IA64_DTPREL64I,
+  BFD_RELOC_IA64_DTPREL32MSB,
+  BFD_RELOC_IA64_DTPREL32LSB,
+  BFD_RELOC_IA64_DTPREL64MSB,
+  BFD_RELOC_IA64_DTPREL64LSB,
+  BFD_RELOC_IA64_LTOFF_DTPREL22,
+
+/* Motorola 68HC11 reloc.
+This is the 8 bit high part of an absolute address.  */
+  BFD_RELOC_M68HC11_HI8,
+
+/* Motorola 68HC11 reloc.
+This is the 8 bit low part of an absolute address.  */
+  BFD_RELOC_M68HC11_LO8,
+
+/* Motorola 68HC11 reloc.
+This is the 3 bit of a value.  */
+  BFD_RELOC_M68HC11_3B,
+
+/* Motorola 68HC11 reloc.
+This reloc marks the beginning of a jump/call instruction.
+It is used for linker relaxation to correctly identify beginning
+of instruction and change some branchs to use PC-relative
+addressing mode.  */
+  BFD_RELOC_M68HC11_RL_JUMP,
+
+/* Motorola 68HC11 reloc.
+This reloc marks a group of several instructions that gcc generates
+and for which the linker relaxation pass can modify and/or remove
+some of them.  */
+  BFD_RELOC_M68HC11_RL_GROUP,
+
+/* Motorola 68HC11 reloc.
+This is the 16-bit lower part of an address.  It is used for 'call'
+instruction to specify the symbol address without any special
+transformation (due to memory bank window).  */
+  BFD_RELOC_M68HC11_LO16,
+
+/* Motorola 68HC11 reloc.
+This is a 8-bit reloc that specifies the page number of an address.
+It is used by 'call' instruction to specify the page number of
+the symbol.  */
+  BFD_RELOC_M68HC11_PAGE,
+
+/* Motorola 68HC11 reloc.
+This is a 24-bit reloc that represents the address with a 16-bit
+value and a 8-bit page number.  The symbol address is transformed
+to follow the 16K memory bank of 68HC12 (seen as mapped in the window).  */
+  BFD_RELOC_M68HC11_24,
+
+/* These relocs are only used within the CRIS assembler.  They are not
+(at present) written to any object files.  */
+  BFD_RELOC_CRIS_BDISP8,
+  BFD_RELOC_CRIS_UNSIGNED_5,
+  BFD_RELOC_CRIS_SIGNED_6,
+  BFD_RELOC_CRIS_UNSIGNED_6,
+  BFD_RELOC_CRIS_UNSIGNED_4,
+
+/* Relocs used in ELF shared libraries for CRIS.  */
+  BFD_RELOC_CRIS_COPY,
+  BFD_RELOC_CRIS_GLOB_DAT,
+  BFD_RELOC_CRIS_JUMP_SLOT,
+  BFD_RELOC_CRIS_RELATIVE,
+
+/* 32-bit offset to symbol-entry within GOT.  */
+  BFD_RELOC_CRIS_32_GOT,
+
+/* 16-bit offset to symbol-entry within GOT.  */
+  BFD_RELOC_CRIS_16_GOT,
+
+/* 32-bit offset to symbol-entry within GOT, with PLT handling.  */
+  BFD_RELOC_CRIS_32_GOTPLT,
+
+/* 16-bit offset to symbol-entry within GOT, with PLT handling.  */
+  BFD_RELOC_CRIS_16_GOTPLT,
+
+/* 32-bit offset to symbol, relative to GOT.  */
+  BFD_RELOC_CRIS_32_GOTREL,
+
+/* 32-bit offset to symbol with PLT entry, relative to GOT.  */
+  BFD_RELOC_CRIS_32_PLT_GOTREL,
+
+/* 32-bit offset to symbol with PLT entry, relative to this relocation.  */
+  BFD_RELOC_CRIS_32_PLT_PCREL,
+
+/* Intel i860 Relocations.  */
+  BFD_RELOC_860_COPY,
+  BFD_RELOC_860_GLOB_DAT,
+  BFD_RELOC_860_JUMP_SLOT,
+  BFD_RELOC_860_RELATIVE,
+  BFD_RELOC_860_PC26,
+  BFD_RELOC_860_PLT26,
+  BFD_RELOC_860_PC16,
+  BFD_RELOC_860_LOW0,
+  BFD_RELOC_860_SPLIT0,
+  BFD_RELOC_860_LOW1,
+  BFD_RELOC_860_SPLIT1,
+  BFD_RELOC_860_LOW2,
+  BFD_RELOC_860_SPLIT2,
+  BFD_RELOC_860_LOW3,
+  BFD_RELOC_860_LOGOT0,
+  BFD_RELOC_860_SPGOT0,
+  BFD_RELOC_860_LOGOT1,
+  BFD_RELOC_860_SPGOT1,
+  BFD_RELOC_860_LOGOTOFF0,
+  BFD_RELOC_860_SPGOTOFF0,
+  BFD_RELOC_860_LOGOTOFF1,
+  BFD_RELOC_860_SPGOTOFF1,
+  BFD_RELOC_860_LOGOTOFF2,
+  BFD_RELOC_860_LOGOTOFF3,
+  BFD_RELOC_860_LOPC,
+  BFD_RELOC_860_HIGHADJ,
+  BFD_RELOC_860_HAGOT,
+  BFD_RELOC_860_HAGOTOFF,
+  BFD_RELOC_860_HAPC,
+  BFD_RELOC_860_HIGH,
+  BFD_RELOC_860_HIGOT,
+  BFD_RELOC_860_HIGOTOFF,
+
+/* OpenRISC Relocations.  */
+  BFD_RELOC_OPENRISC_ABS_26,
+  BFD_RELOC_OPENRISC_REL_26,
+
+/* H8 elf Relocations.  */
+  BFD_RELOC_H8_DIR16A8,
+  BFD_RELOC_H8_DIR16R8,
+  BFD_RELOC_H8_DIR24A8,
+  BFD_RELOC_H8_DIR24R8,
+  BFD_RELOC_H8_DIR32A16,
+
+/* Sony Xstormy16 Relocations.  */
+  BFD_RELOC_XSTORMY16_REL_12,
+  BFD_RELOC_XSTORMY16_24,
+  BFD_RELOC_XSTORMY16_FPTR16,
+
+/* Relocations used by VAX ELF.  */
+  BFD_RELOC_VAX_GLOB_DAT,
+  BFD_RELOC_VAX_JMP_SLOT,
+  BFD_RELOC_VAX_RELATIVE,
+  BFD_RELOC_UNUSED };
+typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
+reloc_howto_type *
+bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+
+const char *
+bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
+
+/* Extracted from syms.c.  */
+
+typedef struct symbol_cache_entry
+{
+  /* A pointer to the BFD which owns the symbol. This information
+     is necessary so that a back end can work out what additional
+     information (invisible to the application writer) is carried
+     with the symbol.
+
+     This field is *almost* redundant, since you can use section->owner
+     instead, except that some symbols point to the global sections
+     bfd_{abs,com,und}_section.  This could be fixed by making
+     these globals be per-bfd (or per-target-flavor).  FIXME.  */
+  struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field.  */
+
+  /* The text of the symbol. The name is left alone, and not copied; the
+     application may not alter it.  */
+  const char *name;
+
+  /* The value of the symbol.  This really should be a union of a
+     numeric value with a pointer, since some flags indicate that
+     a pointer to another symbol is stored here.  */
+  symvalue value;
+
+  /* Attributes of a symbol.  */
+#define BSF_NO_FLAGS    0x00
+
+  /* The symbol has local scope; <<static>> in <<C>>. The value
+     is the offset into the section of the data.  */
+#define BSF_LOCAL      0x01
+
+  /* The symbol has global scope; initialized data in <<C>>. The
+     value is the offset into the section of the data.  */
+#define BSF_GLOBAL     0x02
+
+  /* The symbol has global scope and is exported. The value is
+     the offset into the section of the data.  */
+#define BSF_EXPORT     BSF_GLOBAL /* No real difference.  */
+
+  /* A normal C symbol would be one of:
+     <<BSF_LOCAL>>, <<BSF_FORT_COMM>>,  <<BSF_UNDEFINED>> or
+     <<BSF_GLOBAL>>.  */
+
+  /* The symbol is a debugging record. The value has an arbitary
+     meaning, unless BSF_DEBUGGING_RELOC is also set.  */
+#define BSF_DEBUGGING  0x08
+
+  /* The symbol denotes a function entry point.  Used in ELF,
+     perhaps others someday.  */
+#define BSF_FUNCTION    0x10
+
+  /* Used by the linker.  */
+#define BSF_KEEP        0x20
+#define BSF_KEEP_G      0x40
+
+  /* A weak global symbol, overridable without warnings by
+     a regular global symbol of the same name.  */
+#define BSF_WEAK        0x80
+
+  /* This symbol was created to point to a section, e.g. ELF's
+     STT_SECTION symbols.  */
+#define BSF_SECTION_SYM 0x100
+
+  /* The symbol used to be a common symbol, but now it is
+     allocated.  */
+#define BSF_OLD_COMMON  0x200
+
+  /* The default value for common data.  */
+#define BFD_FORT_COMM_DEFAULT_VALUE 0
+
+  /* In some files the type of a symbol sometimes alters its
+     location in an output file - ie in coff a <<ISFCN>> symbol
+     which is also <<C_EXT>> symbol appears where it was
+     declared and not at the end of a section.  This bit is set
+     by the target BFD part to convey this information.  */
+#define BSF_NOT_AT_END    0x400
+
+  /* Signal that the symbol is the label of constructor section.  */
+#define BSF_CONSTRUCTOR   0x800
+
+  /* Signal that the symbol is a warning symbol.  The name is a
+     warning.  The name of the next symbol is the one to warn about;
+     if a reference is made to a symbol with the same name as the next
+     symbol, a warning is issued by the linker.  */
+#define BSF_WARNING       0x1000
+
+  /* Signal that the symbol is indirect.  This symbol is an indirect
+     pointer to the symbol with the same name as the next symbol.  */
+#define BSF_INDIRECT      0x2000
+
+  /* BSF_FILE marks symbols that contain a file name.  This is used
+     for ELF STT_FILE symbols.  */
+#define BSF_FILE          0x4000
+
+  /* Symbol is from dynamic linking information.  */
+#define BSF_DYNAMIC       0x8000
+
+  /* The symbol denotes a data object.  Used in ELF, and perhaps
+     others someday.  */
+#define BSF_OBJECT        0x10000
+
+  /* This symbol is a debugging symbol.  The value is the offset
+     into the section of the data.  BSF_DEBUGGING should be set
+     as well.  */
+#define BSF_DEBUGGING_RELOC 0x20000
+
+  /* This symbol is thread local.  Used in ELF.  */
+#define BSF_THREAD_LOCAL  0x40000
+
+  flagword flags;
+
+  /* A pointer to the section to which this symbol is
+     relative.  This will always be non NULL, there are special
+     sections for undefined and absolute symbols.  */
+  struct sec *section;
+
+  /* Back end special data.  */
+  union
+    {
+      PTR p;
+      bfd_vma i;
+    }
+  udata;
+}
+asymbol;
+
+#define bfd_get_symtab_upper_bound(abfd) \
+     BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
+
+boolean
+bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
+
+boolean
+bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name));
+
+#define bfd_is_local_label_name(abfd, name) \
+     BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
+
+#define bfd_canonicalize_symtab(abfd, location) \
+     BFD_SEND (abfd, _bfd_canonicalize_symtab,\
+                  (abfd, location))
+
+boolean
+bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
+
+void
+bfd_print_symbol_vandf PARAMS ((bfd *abfd, PTR file, asymbol *symbol));
+
+#define bfd_make_empty_symbol(abfd) \
+     BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
+
+asymbol *
+_bfd_generic_make_empty_symbol PARAMS ((bfd *));
+
+#define bfd_make_debug_symbol(abfd,ptr,size) \
+        BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
+
+int
+bfd_decode_symclass PARAMS ((asymbol *symbol));
+
+boolean
+bfd_is_undefined_symclass PARAMS ((int symclass));
+
+void
+bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
+
+boolean
+bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
+
+#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
+     BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
+               (ibfd, isymbol, obfd, osymbol))
+
+/* Extracted from bfd.c.  */
+struct _bfd
+{
+  /* The filename the application opened the BFD with.  */
+  const char *filename;
+
+  /* A pointer to the target jump table.  */
+  const struct bfd_target *xvec;
+
+  /* To avoid dragging too many header files into every file that
+     includes `<<bfd.h>>', IOSTREAM has been declared as a "char *",
+     and MTIME as a "long".  Their correct types, to which they
+     are cast when used, are "FILE *" and "time_t".    The iostream
+     is the result of an fopen on the filename.  However, if the
+     BFD_IN_MEMORY flag is set, then iostream is actually a pointer
+     to a bfd_in_memory struct.  */
+  PTR iostream;
+
+  /* Is the file descriptor being cached?  That is, can it be closed as
+     needed, and re-opened when accessed later?  */
+  boolean cacheable;
+
+  /* Marks whether there was a default target specified when the
+     BFD was opened. This is used to select which matching algorithm
+     to use to choose the back end.  */
+  boolean target_defaulted;
+
+  /* The caching routines use these to maintain a
+     least-recently-used list of BFDs.  */
+  struct _bfd *lru_prev, *lru_next;
+
+  /* When a file is closed by the caching routines, BFD retains
+     state information on the file here...  */
+  ufile_ptr where;
+
+  /* ... and here: (``once'' means at least once).  */
+  boolean opened_once;
+
+  /* Set if we have a locally maintained mtime value, rather than
+     getting it from the file each time.  */
+  boolean mtime_set;
+
+  /* File modified time, if mtime_set is true.  */
+  long mtime;
+
+  /* Reserved for an unimplemented file locking extension.  */
+  int ifd;
+
+  /* The format which belongs to the BFD. (object, core, etc.)  */
+  bfd_format format;
+
+  /* The direction with which the BFD was opened.  */
+  enum bfd_direction
+    {
+      no_direction = 0,
+      read_direction = 1,
+      write_direction = 2,
+      both_direction = 3
+    }
+  direction;
+
+  /* Format_specific flags.  */
+  flagword flags;
+
+  /* Currently my_archive is tested before adding origin to
+     anything. I believe that this can become always an add of
+     origin, with origin set to 0 for non archive files.  */
+  ufile_ptr origin;
+
+  /* Remember when output has begun, to stop strange things
+     from happening.  */
+  boolean output_has_begun;
+
+  /* A hash table for section names.  */
+  struct bfd_hash_table section_htab;
+
+  /* Pointer to linked list of sections.  */
+  struct sec *sections;
+
+  /* The place where we add to the section list.  */
+  struct sec **section_tail;
+
+  /* The number of sections.  */
+  unsigned int section_count;
+
+  /* Stuff only useful for object files:
+     The start address.  */
+  bfd_vma start_address;
+
+  /* Used for input and output.  */
+  unsigned int symcount;
+
+  /* Symbol table for output BFD (with symcount entries).  */
+  struct symbol_cache_entry  **outsymbols;
+
+  /* Used for slurped dynamic symbol tables.  */
+  unsigned int dynsymcount;
+
+  /* Pointer to structure which contains architecture information.  */
+  const struct bfd_arch_info *arch_info;
+
+  /* Stuff only useful for archives.  */
+  PTR arelt_data;
+  struct _bfd *my_archive;     /* The containing archive BFD.  */
+  struct _bfd *next;           /* The next BFD in the archive.  */
+  struct _bfd *archive_head;   /* The first BFD in the archive.  */
+  boolean has_armap;
+
+  /* A chain of BFD structures involved in a link.  */
+  struct _bfd *link_next;
+
+  /* A field used by _bfd_generic_link_add_archive_symbols.  This will
+     be used only for archive elements.  */
+  int archive_pass;
+
+  /* Used by the back end to hold private data.  */
+  union
+    {
+      struct aout_data_struct *aout_data;
+      struct artdata *aout_ar_data;
+      struct _oasys_data *oasys_obj_data;
+      struct _oasys_ar_data *oasys_ar_data;
+      struct coff_tdata *coff_obj_data;
+      struct pe_tdata *pe_obj_data;
+      struct xcoff_tdata *xcoff_obj_data;
+      struct ecoff_tdata *ecoff_obj_data;
+      struct ieee_data_struct *ieee_data;
+      struct ieee_ar_data_struct *ieee_ar_data;
+      struct srec_data_struct *srec_data;
+      struct ihex_data_struct *ihex_data;
+      struct tekhex_data_struct *tekhex_data;
+      struct elf_obj_tdata *elf_obj_data;
+      struct nlm_obj_tdata *nlm_obj_data;
+      struct bout_data_struct *bout_data;
+      struct mmo_data_struct *mmo_data;
+      struct sun_core_struct *sun_core_data;
+      struct sco5_core_struct *sco5_core_data;
+      struct trad_core_struct *trad_core_data;
+      struct som_data_struct *som_data;
+      struct hpux_core_struct *hpux_core_data;
+      struct hppabsd_core_struct *hppabsd_core_data;
+      struct sgi_core_struct *sgi_core_data;
+      struct lynx_core_struct *lynx_core_data;
+      struct osf_core_struct *osf_core_data;
+      struct cisco_core_struct *cisco_core_data;
+      struct versados_data_struct *versados_data;
+      struct netbsd_core_struct *netbsd_core_data;
+      struct mach_o_data_struct *mach_o_data;
+      struct mach_o_fat_data_struct *mach_o_fat_data;
+      struct bfd_pef_data_struct *pef_data;
+      struct bfd_pef_xlib_data_struct *pef_xlib_data;
+      struct bfd_sym_data_struct *sym_data;
+      PTR any;
+    }
+  tdata;
+
+  /* Used by the application to hold private data.  */
+  PTR usrdata;
+
+  /* Where all the allocated stuff under this BFD goes.  This is a
+     struct objalloc *, but we use PTR to avoid requiring the inclusion of
+     objalloc.h.  */
+  PTR memory;
+};
+
+typedef enum bfd_error
+{
+  bfd_error_no_error = 0,
+  bfd_error_system_call,
+  bfd_error_invalid_target,
+  bfd_error_wrong_format,
+  bfd_error_wrong_object_format,
+  bfd_error_invalid_operation,
+  bfd_error_no_memory,
+  bfd_error_no_symbols,
+  bfd_error_no_armap,
+  bfd_error_no_more_archived_files,
+  bfd_error_malformed_archive,
+  bfd_error_file_not_recognized,
+  bfd_error_file_ambiguously_recognized,
+  bfd_error_no_contents,
+  bfd_error_nonrepresentable_section,
+  bfd_error_no_debug_section,
+  bfd_error_bad_value,
+  bfd_error_file_truncated,
+  bfd_error_file_too_big,
+  bfd_error_invalid_error_code
+}
+bfd_error_type;
+
+bfd_error_type
+bfd_get_error PARAMS ((void));
+
+void
+bfd_set_error PARAMS ((bfd_error_type error_tag));
+
+const char *
+bfd_errmsg PARAMS ((bfd_error_type error_tag));
+
+void
+bfd_perror PARAMS ((const char *message));
+
+typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
+
+bfd_error_handler_type
+bfd_set_error_handler PARAMS ((bfd_error_handler_type));
+
+void
+bfd_set_error_program_name PARAMS ((const char *));
+
+bfd_error_handler_type
+bfd_get_error_handler PARAMS ((void));
+
+const char *
+bfd_archive_filename PARAMS ((bfd *));
+
+long
+bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
+
+long
+bfd_canonicalize_reloc PARAMS ((bfd *abfd,
+    asection *sec,
+    arelent **loc,
+    asymbol **syms));
+
+void
+bfd_set_reloc PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count));
+
+boolean
+bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
+
+int
+bfd_get_arch_size PARAMS ((bfd *abfd));
+
+int
+bfd_get_sign_extend_vma PARAMS ((bfd *abfd));
+
+boolean
+bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
+
+unsigned int
+bfd_get_gp_size PARAMS ((bfd *abfd));
+
+void
+bfd_set_gp_size PARAMS ((bfd *abfd, unsigned int i));
+
+bfd_vma
+bfd_scan_vma PARAMS ((const char *string, const char **end, int base));
+
+boolean
+bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
+
+#define bfd_copy_private_bfd_data(ibfd, obfd) \
+     BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
+               (ibfd, obfd))
+boolean
+bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
+
+#define bfd_merge_private_bfd_data(ibfd, obfd) \
+     BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
+               (ibfd, obfd))
+boolean
+bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
+
+#define bfd_set_private_flags(abfd, flags) \
+     BFD_SEND (abfd, _bfd_set_private_flags, \
+               (abfd, flags))
+#define bfd_sizeof_headers(abfd, reloc) \
+     BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+
+#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
+     BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, sec, syms, off, file, func, line))
+
+       /* Do these three do anything useful at all, for any back end?  */
+#define bfd_debug_info_start(abfd) \
+        BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+
+#define bfd_debug_info_end(abfd) \
+        BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
+
+#define bfd_debug_info_accumulate(abfd, section) \
+        BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
+
+
+#define bfd_stat_arch_elt(abfd, stat) \
+        BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
+
+#define bfd_update_armap_timestamp(abfd) \
+        BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
+
+#define bfd_set_arch_mach(abfd, arch, mach)\
+        BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
+
+#define bfd_relax_section(abfd, section, link_info, again) \
+       BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
+
+#define bfd_gc_sections(abfd, link_info) \
+       BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
+
+#define bfd_merge_sections(abfd, link_info) \
+       BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
+
+#define bfd_discard_group(abfd, sec) \
+       BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
+
+#define bfd_link_hash_table_create(abfd) \
+       BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
+
+#define bfd_link_hash_table_free(abfd, hash) \
+       BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
+
+#define bfd_link_add_symbols(abfd, info) \
+       BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
+
+#define bfd_link_just_syms(sec, info) \
+       BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
+
+#define bfd_final_link(abfd, info) \
+       BFD_SEND (abfd, _bfd_final_link, (abfd, info))
+
+#define bfd_free_cached_info(abfd) \
+       BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
+
+#define bfd_get_dynamic_symtab_upper_bound(abfd) \
+       BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
+
+#define bfd_print_private_bfd_data(abfd, file)\
+       BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
+
+#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
+       BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
+
+#define bfd_get_dynamic_reloc_upper_bound(abfd) \
+       BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
+
+#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
+       BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
+
+extern bfd_byte *bfd_get_relocated_section_contents
+       PARAMS ((bfd *, struct bfd_link_info *,
+                 struct bfd_link_order *, bfd_byte *,
+                 boolean, asymbol **));
+
+boolean
+bfd_alt_mach_code PARAMS ((bfd *abfd, int alternative));
+
+struct bfd_preserve
+{
+  PTR marker;
+  PTR tdata;
+  flagword flags;
+  const struct bfd_arch_info *arch_info;
+  struct sec *sections;
+  struct sec **section_tail;
+  unsigned int section_count;
+  struct bfd_hash_table section_htab;
+};
+
+boolean
+bfd_preserve_save PARAMS ((bfd *, struct bfd_preserve *));
+
+void
+bfd_preserve_restore PARAMS ((bfd *, struct bfd_preserve *));
+
+void
+bfd_preserve_finish PARAMS ((bfd *, struct bfd_preserve *));
+
+/* Extracted from archive.c.  */
+symindex
+bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
+
+boolean
+bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
+
+bfd *
+bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
+
+/* Extracted from corefile.c.  */
+const char *
+bfd_core_file_failing_command PARAMS ((bfd *abfd));
+
+int
+bfd_core_file_failing_signal PARAMS ((bfd *abfd));
+
+boolean
+core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+
+/* Extracted from targets.c.  */
+#define BFD_SEND(bfd, message, arglist) \
+               ((*((bfd)->xvec->message)) arglist)
+
+#ifdef DEBUG_BFD_SEND
+#undef BFD_SEND
+#define BFD_SEND(bfd, message, arglist) \
+  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
+    ((*((bfd)->xvec->message)) arglist) : \
+    (bfd_assert (__FILE__,__LINE__), NULL))
+#endif
+#define BFD_SEND_FMT(bfd, message, arglist) \
+            (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
+
+#ifdef DEBUG_BFD_SEND
+#undef BFD_SEND_FMT
+#define BFD_SEND_FMT(bfd, message, arglist) \
+  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
+   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
+   (bfd_assert (__FILE__,__LINE__), NULL))
+#endif
+
+enum bfd_flavour
+{
+  bfd_target_unknown_flavour,
+  bfd_target_aout_flavour,
+  bfd_target_coff_flavour,
+  bfd_target_ecoff_flavour,
+  bfd_target_xcoff_flavour,
+  bfd_target_elf_flavour,
+  bfd_target_ieee_flavour,
+  bfd_target_nlm_flavour,
+  bfd_target_oasys_flavour,
+  bfd_target_tekhex_flavour,
+  bfd_target_srec_flavour,
+  bfd_target_ihex_flavour,
+  bfd_target_som_flavour,
+  bfd_target_os9k_flavour,
+  bfd_target_versados_flavour,
+  bfd_target_msdos_flavour,
+  bfd_target_ovax_flavour,
+  bfd_target_evax_flavour,
+  bfd_target_mmo_flavour,
+  bfd_target_mach_o_flavour,
+  bfd_target_pef_flavour,
+  bfd_target_pef_xlib_flavour,
+  bfd_target_sym_flavour
+};
+
+enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
+
+/* Forward declaration.  */
+typedef struct bfd_link_info _bfd_link_info;
+
+typedef struct bfd_target
+{
+  /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  */
+  char *name;
+
+ /* The "flavour" of a back end is a general indication about
+    the contents of a file.  */
+  enum bfd_flavour flavour;
+
+  /* The order of bytes within the data area of a file.  */
+  enum bfd_endian byteorder;
+
+ /* The order of bytes within the header parts of a file.  */
+  enum bfd_endian header_byteorder;
+
+  /* A mask of all the flags which an executable may have set -
+     from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.  */
+  flagword object_flags;
+
+ /* A mask of all the flags which a section may have set - from
+    the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.  */
+  flagword section_flags;
+
+ /* The character normally found at the front of a symbol.
+    (if any), perhaps `_'.  */
+  char symbol_leading_char;
+
+ /* The pad character for file names within an archive header.  */
+  char ar_pad_char;
+
+  /* The maximum number of characters in an archive header.  */
+  unsigned short ar_max_namelen;
+
+  /* Entries for byte swapping for data. These are different from the
+     other entry points, since they don't take a BFD asthe first argument.
+     Certain other handlers could do the same.  */
+  bfd_vma        (*bfd_getx64) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
+  void           (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
+  bfd_vma        (*bfd_getx32) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
+  void           (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
+  bfd_vma        (*bfd_getx16) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
+  void           (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
+
+  /* Byte swapping for the headers.  */
+  bfd_vma        (*bfd_h_getx64) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
+  void           (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
+  bfd_vma        (*bfd_h_getx32) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
+  void           (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
+  bfd_vma        (*bfd_h_getx16) PARAMS ((const bfd_byte *));
+  bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
+  void           (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
+
+  /* Format dependent routines: these are vectors of entry points
+     within the target vector structure, one for each format to check.  */
+
+  /* Check the format of a file being read.  Return a <<bfd_target *>> or zero.  */
+  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
+
+  /* Set the format of a file being written.  */
+  boolean  (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
+
+  /* Write cached information into a file being written, at <<bfd_close>>.  */
+  boolean  (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
+
+
+  /* Generic entry points.  */
+#define BFD_JUMP_TABLE_GENERIC(NAME) \
+CONCAT2 (NAME,_close_and_cleanup), \
+CONCAT2 (NAME,_bfd_free_cached_info), \
+CONCAT2 (NAME,_new_section_hook), \
+CONCAT2 (NAME,_get_section_contents), \
+CONCAT2 (NAME,_get_section_contents_in_window)
+
+  /* Called when the BFD is being closed to do any necessary cleanup.  */
+  boolean  (*_close_and_cleanup) PARAMS ((bfd *));
+  /* Ask the BFD to free all cached information.  */
+  boolean  (*_bfd_free_cached_info) PARAMS ((bfd *));
+  /* Called when a new section is created.  */
+  boolean  (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
+  /* Read the contents of a section.  */
+  boolean  (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+                                                 file_ptr, bfd_size_type));
+  boolean  (*_bfd_get_section_contents_in_window)
+    PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
+
+  /* Entry points to copy private data.  */
+#define BFD_JUMP_TABLE_COPY(NAME) \
+CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
+CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
+CONCAT2 (NAME,_bfd_copy_private_section_data), \
+CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
+CONCAT2 (NAME,_bfd_set_private_flags), \
+CONCAT2 (NAME,_bfd_print_private_bfd_data) \
+  /* Called to copy BFD general private data from one object file
+     to another.  */
+  boolean  (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
+  /* Called to merge BFD general private data from one object file
+     to a common output file when linking.  */
+  boolean  (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
+  /* Called to copy BFD private section data from one object file
+     to another.  */
+  boolean  (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
+                                                      bfd *, sec_ptr));
+  /* Called to copy BFD private symbol data from one symbol
+     to another.  */
+  boolean  (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
+                                                     bfd *, asymbol *));
+  /* Called to set private backend flags.  */
+  boolean  (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
+
+  /* Called to print private BFD data.  */
+  boolean  (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
+
+  /* Core file entry points.  */
+#define BFD_JUMP_TABLE_CORE(NAME) \
+CONCAT2 (NAME,_core_file_failing_command), \
+CONCAT2 (NAME,_core_file_failing_signal), \
+CONCAT2 (NAME,_core_file_matches_executable_p)
+  char *   (*_core_file_failing_command) PARAMS ((bfd *));
+  int      (*_core_file_failing_signal) PARAMS ((bfd *));
+  boolean  (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
+
+  /* Archive entry points.  */
+#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
+CONCAT2 (NAME,_slurp_armap), \
+CONCAT2 (NAME,_slurp_extended_name_table), \
+CONCAT2 (NAME,_construct_extended_name_table), \
+CONCAT2 (NAME,_truncate_arname), \
+CONCAT2 (NAME,_write_armap), \
+CONCAT2 (NAME,_read_ar_hdr), \
+CONCAT2 (NAME,_openr_next_archived_file), \
+CONCAT2 (NAME,_get_elt_at_index), \
+CONCAT2 (NAME,_generic_stat_arch_elt), \
+CONCAT2 (NAME,_update_armap_timestamp)
+  boolean  (*_bfd_slurp_armap) PARAMS ((bfd *));
+  boolean  (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
+  boolean  (*_bfd_construct_extended_name_table)
+    PARAMS ((bfd *, char **, bfd_size_type *, const char **));
+  void     (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
+  boolean  (*write_armap)
+    PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+  PTR      (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
+  bfd *    (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
+#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
+  bfd *    (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
+  int      (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
+  boolean  (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
+
+  /* Entry points used for symbols.  */
+#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
+CONCAT2 (NAME,_get_symtab_upper_bound), \
+CONCAT2 (NAME,_get_symtab), \
+CONCAT2 (NAME,_make_empty_symbol), \
+CONCAT2 (NAME,_print_symbol), \
+CONCAT2 (NAME,_get_symbol_info), \
+CONCAT2 (NAME,_bfd_is_local_label_name), \
+CONCAT2 (NAME,_get_lineno), \
+CONCAT2 (NAME,_find_nearest_line), \
+CONCAT2 (NAME,_bfd_make_debug_symbol), \
+CONCAT2 (NAME,_read_minisymbols), \
+CONCAT2 (NAME,_minisymbol_to_symbol)
+  long     (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
+  long     (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
+                                                struct symbol_cache_entry **));
+  struct symbol_cache_entry *
+           (*_bfd_make_empty_symbol) PARAMS ((bfd *));
+  void     (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
+                                         struct symbol_cache_entry *,
+                                         bfd_print_symbol_type));
+#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
+  void     (*_bfd_get_symbol_info) PARAMS ((bfd *,
+                                            struct symbol_cache_entry *,
+                                            symbol_info *));
+#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
+  boolean  (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
+
+  alent *  (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
+  boolean  (*_bfd_find_nearest_line)
+    PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
+             const char **, const char **, unsigned int *));
+ /* Back-door to allow format-aware applications to create debug symbols
+    while using BFD for everything else.  Currently used by the assembler
+    when creating COFF files.  */
+  asymbol *(*_bfd_make_debug_symbol) PARAMS ((bfd *, void *,
+                                              unsigned long size));
+#define bfd_read_minisymbols(b, d, m, s) \
+  BFD_SEND (b, _read_minisymbols, (b, d, m, s))
+  long     (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
+                                         unsigned int *));
+#define bfd_minisymbol_to_symbol(b, d, m, f) \
+  BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
+  asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
+                                             asymbol *));
+
+  /* Routines for relocs.  */
+#define BFD_JUMP_TABLE_RELOCS(NAME) \
+CONCAT2 (NAME,_get_reloc_upper_bound), \
+CONCAT2 (NAME,_canonicalize_reloc), \
+CONCAT2 (NAME,_bfd_reloc_type_lookup)
+  long     (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
+  long     (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
+                                               struct symbol_cache_entry **));
+  /* See documentation on reloc types.  */
+  reloc_howto_type *
+           (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type));
+
+  /* Routines used when writing an object file.  */
+#define BFD_JUMP_TABLE_WRITE(NAME) \
+CONCAT2 (NAME,_set_arch_mach), \
+CONCAT2 (NAME,_set_section_contents)
+  boolean  (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
+                                          unsigned long));
+  boolean  (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+                                                 file_ptr, bfd_size_type));
+
+  /* Routines used by the linker.  */
+#define BFD_JUMP_TABLE_LINK(NAME) \
+CONCAT2 (NAME,_sizeof_headers), \
+CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
+CONCAT2 (NAME,_bfd_relax_section), \
+CONCAT2 (NAME,_bfd_link_hash_table_create), \
+CONCAT2 (NAME,_bfd_link_hash_table_free), \
+CONCAT2 (NAME,_bfd_link_add_symbols), \
+CONCAT2 (NAME,_bfd_link_just_syms), \
+CONCAT2 (NAME,_bfd_final_link), \
+CONCAT2 (NAME,_bfd_link_split_section), \
+CONCAT2 (NAME,_bfd_gc_sections), \
+CONCAT2 (NAME,_bfd_merge_sections), \
+CONCAT2 (NAME,_bfd_discard_group)
+  int      (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
+  bfd_byte *(*_bfd_get_relocated_section_contents)
+    PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
+             bfd_byte *, boolean, struct symbol_cache_entry **));
+
+  boolean  (*_bfd_relax_section)
+    PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
+
+  /* Create a hash table for the linker.  Different backends store
+     different information in this table.  */
+  struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
+
+  /* Release the memory associated with the linker hash table.  */
+  void (*_bfd_link_hash_table_free) PARAMS ((struct bfd_link_hash_table *));
+
+  /* Add symbols from this object file into the hash table.  */
+  boolean  (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* Indicate that we are only retrieving symbol values from this section.  */
+  void     (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
+
+  /* Do a link based on the link_order structures attached to each
+     section of the BFD.  */
+  boolean  (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* Should this section be split up into smaller pieces during linking.  */
+  boolean  (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
+
+  /* Remove sections that are not referenced from the output.  */
+  boolean  (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* Attempt to merge SEC_MERGE sections.  */
+  boolean  (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
+
+  /* Discard members of a group.  */
+  boolean  (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
+
+  /* Routines to handle dynamic symbols and relocs.  */
+#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
+CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
+CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
+CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
+CONCAT2 (NAME,_canonicalize_dynamic_reloc)
+  /* Get the amount of memory required to hold the dynamic symbols.  */
+  long     (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
+  /* Read in the dynamic symbols.  */
+  long     (*_bfd_canonicalize_dynamic_symtab)
+    PARAMS ((bfd *, struct symbol_cache_entry **));
+  /* Get the amount of memory required to hold the dynamic relocs.  */
+  long     (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
+  /* Read in the dynamic relocs.  */
+  long     (*_bfd_canonicalize_dynamic_reloc)
+    PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
+
+  /* Opposite endian version of this target.  */
+  const struct bfd_target * alternative_target;
+
+  /* Data for use by back-end routines, which isn't
+     generic enough to belong in this structure.  */
+  PTR backend_data;
+
+} bfd_target;
+
+boolean
+bfd_set_default_target PARAMS ((const char *name));
+
+const bfd_target *
+bfd_find_target PARAMS ((const char *target_name, bfd *abfd));
+
+const char **
+bfd_target_list PARAMS ((void));
+
+const bfd_target *
+bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
+
+/* Extracted from format.c.  */
+boolean
+bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
+
+boolean
+bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
+
+boolean
+bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
+
+const char *
+bfd_format_string PARAMS ((bfd_format format));
+
+/* Extracted from linker.c.  */
+boolean
+bfd_link_split_section PARAMS ((bfd *abfd, asection *sec));
+
+#define bfd_link_split_section(abfd, sec) \
+       BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
+
+/* Extracted from simple.c.  */
+bfd_byte *
+bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf));
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/vm/jit/i386/codegen.c b/src/vm/jit/i386/codegen.c
new file mode 100644 (file)
index 0000000..6313258
--- /dev/null
@@ -0,0 +1,6019 @@
+/* jit/i386/codegen.c - machine code generator for i386
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Christian Thalinger
+
+   $Id: codegen.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include <signal.h>
+#include "types.h"
+#include "codegen.h"
+#include "jit.h"
+#include "reg.h"
+#include "builtin.h"
+#include "asmpart.h"
+#include "jni.h"
+#include "loader.h"
+#include "tables.h"
+#include "native.h"
+#include "methodtable.h"
+
+/* include independent code generation stuff */
+#include "codegen.inc"
+#include "reg.inc"
+
+
+/* additional functions and macros to generate code ***************************/
+
+#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
+
+
+#ifdef STATISTICS
+#define COUNT_SPILLS count_spills++
+#else
+#define COUNT_SPILLS
+#endif
+
+
+#define CALCOFFSETBYTES(var, val) \
+    if ((s4) (val) < -128 || (s4) (val) > 127) (var) += 4; \
+    else if ((s4) (val) != 0) (var) += 1;
+
+
+#define CALCREGOFFBYTES(var, val) \
+    if ((val) > 15) (var) += 4; \
+    else if ((val) != 0) (var) += 1;
+
+
+#define CALCIMMEDIATEBYTES(var, val) \
+    if ((s4) (val) < -128 || (s4) (val) > 127) (var) += 4; \
+    else (var) += 1;
+
+
+/* gen_nullptr_check(objreg) */
+
+#define gen_nullptr_check(objreg) \
+       if (checknull) { \
+        i386_test_reg_reg((objreg), (objreg)); \
+        i386_jcc(I386_CC_E, 0); \
+           codegen_addxnullrefs(mcodeptr); \
+       }
+
+
+/* MCODECHECK(icnt) */
+
+#define MCODECHECK(icnt) \
+       if ((mcodeptr + (icnt)) > (u1*) mcodeend) mcodeptr = (u1*) codegen_increase((u1*) mcodeptr)
+
+/* M_INTMOVE:
+     generates an integer-move from register a to b.
+     if a and b are the same int-register, no code will be generated.
+*/ 
+
+#define M_INTMOVE(reg,dreg) if ((reg) != (dreg)) { i386_mov_reg_reg((reg),(dreg)); }
+
+
+/* M_FLTMOVE:
+    generates a floating-point-move from register a to b.
+    if a and b are the same float-register, no code will be generated
+*/
+
+#define M_FLTMOVE(reg,dreg) panic("M_FLTMOVE");
+
+#define M_LNGMEMMOVE(reg,dreg) \
+    do { \
+        i386_mov_membase_reg(REG_SP, (reg) * 8, REG_ITMP1); \
+        i386_mov_membase_reg(REG_SP, (reg) * 8 + 4, REG_ITMP2); \
+        i386_mov_reg_membase(REG_ITMP1, REG_SP, (dreg) * 8); \
+        i386_mov_reg_membase(REG_ITMP2, REG_SP, (dreg) * 8 + 4); \
+    } while (0)
+
+
+/* var_to_reg_xxx:
+    this function generates code to fetch data from a pseudo-register
+    into a real register. 
+    If the pseudo-register has actually been assigned to a real 
+    register, no code will be emitted, since following operations
+    can use this register directly.
+    
+    v: pseudoregister to be fetched from
+    tempregnum: temporary register to be used if v is actually spilled to ram
+
+    return: the register number, where the operand can be found after 
+            fetching (this wil be either tempregnum or the register
+            number allready given to v)
+*/
+
+#define var_to_reg_int(regnr,v,tempnr) \
+    if ((v)->flags & INMEMORY) { \
+        COUNT_SPILLS; \
+        i386_mov_membase_reg(REG_SP, (v)->regoff * 8, tempnr); \
+        regnr = tempnr; \
+    } else { \
+        regnr = (v)->regoff; \
+    }
+
+
+
+#define var_to_reg_flt(regnr,v,tempnr) \
+    if ((v)->type == TYPE_FLT) { \
+        if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_flds_membase(REG_SP, (v)->regoff * 8); \
+            fpu_st_offset++; \
+            regnr = tempnr; \
+        } else { \
+            i386_fld_reg((v)->regoff + fpu_st_offset); \
+            fpu_st_offset++; \
+            regnr = (v)->regoff; \
+        } \
+    } else { \
+        if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_fldl_membase(REG_SP, (v)->regoff * 8); \
+            fpu_st_offset++; \
+            regnr = tempnr; \
+        } else { \
+            i386_fld_reg((v)->regoff + fpu_st_offset); \
+            fpu_st_offset++; \
+            regnr = (v)->regoff; \
+        } \
+    }
+
+#define NEW_var_to_reg_flt(regnr,v,tempnr) \
+    if ((v)->type == TYPE_FLT) { \
+       if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_flds_membase(REG_SP, (v)->regoff * 8); \
+            fpu_st_offset++; \
+            regnr = tempnr; \
+        } else { \
+            regnr = (v)->regoff; \
+        } \
+    } else { \
+        if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_fldl_membase(REG_SP, (v)->regoff * 8); \
+            fpu_st_offset++; \
+            regnr = tempnr; \
+        } else { \
+            regnr = (v)->regoff; \
+        } \
+    }
+
+
+/* reg_of_var:
+    This function determines a register, to which the result of an operation
+    should go, when it is ultimatively intended to store the result in
+    pseudoregister v.
+    If v is assigned to an actual register, this register will be returned.
+    Otherwise (when v is spilled) this function returns tempregnum.
+    If not already done, regoff and flags are set in the stack location.
+*/        
+
+static int reg_of_var(stackptr v, int tempregnum)
+{
+       varinfo      *var;
+
+       switch (v->varkind) {
+       case TEMPVAR:
+               if (!(v->flags & INMEMORY))
+                       return(v->regoff);
+               break;
+       case STACKVAR:
+               var = &(interfaces[v->varnum][v->type]);
+               v->regoff = var->regoff;
+               if (!(var->flags & INMEMORY))
+                       return(var->regoff);
+               break;
+       case LOCALVAR:
+               var = &(locals[v->varnum][v->type]);
+               v->regoff = var->regoff;
+               if (!(var->flags & INMEMORY))
+                       return(var->regoff);
+               break;
+       case ARGVAR:
+               v->regoff = v->varnum;
+               if (IS_FLT_DBL_TYPE(v->type)) {
+                       if (v->varnum < fltreg_argnum) {
+                               v->regoff = argfltregs[v->varnum];
+                               return(argfltregs[v->varnum]);
+                       }
+               }
+               else
+                       if (v->varnum < intreg_argnum) {
+                               v->regoff = argintregs[v->varnum];
+                               return(argintregs[v->varnum]);
+                       }
+               v->regoff -= intreg_argnum;
+               break;
+       }
+       v->flags |= INMEMORY;
+       return tempregnum;
+}
+
+
+/* store_reg_to_var_xxx:
+    This function generates the code to store the result of an operation
+    back into a spilled pseudo-variable.
+    If the pseudo-variable has not been spilled in the first place, this 
+    function will generate nothing.
+    
+    v ............ Pseudovariable
+    tempregnum ... Number of the temporary registers as returned by
+                   reg_of_var.
+*/     
+
+#define store_reg_to_var_int(sptr, tempregnum) \
+    if ((sptr)->flags & INMEMORY) { \
+        COUNT_SPILLS; \
+        i386_mov_reg_membase(tempregnum, REG_SP, (sptr)->regoff * 8); \
+    }
+
+
+#define store_reg_to_var_flt(sptr, tempregnum) \
+    if ((sptr)->type == TYPE_FLT) { \
+        if ((sptr)->flags & INMEMORY) { \
+             COUNT_SPILLS; \
+             i386_fstps_membase(REG_SP, (sptr)->regoff * 8); \
+             fpu_st_offset--; \
+        } else { \
+/*                  i386_fxch_reg((sptr)->regoff);*/ \
+             i386_fstp_reg((sptr)->regoff + fpu_st_offset); \
+             fpu_st_offset--; \
+        } \
+    } else { \
+        if ((sptr)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            i386_fstpl_membase(REG_SP, (sptr)->regoff * 8); \
+            fpu_st_offset--; \
+        } else { \
+/*                  i386_fxch_reg((sptr)->regoff);*/ \
+            i386_fstp_reg((sptr)->regoff + fpu_st_offset); \
+            fpu_st_offset--; \
+        } \
+    }
+
+
+/* NullPointerException signal handler for hardware null pointer check */
+
+void catch_NullPointerException(int sig)
+{
+       sigset_t nsig;
+       int      instr;
+/*     long     faultaddr; */
+
+       void **_p = (void **) &sig;
+       struct sigcontext *sigctx = (struct sigcontext *) ++_p;
+
+       /* Reset signal handler - necessary for SysV, does no harm for BSD */
+
+       instr = *((int*)(sigctx->eip));
+/*     faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f]; */
+
+/*     fprintf(stderr, "null=%d %p addr=%p\n", sig, sigctx, sigctx->eip); */
+
+/*     if (faultaddr == 0) { */
+               signal(sig, (void *) catch_NullPointerException);          /* reinstall handler */
+               sigemptyset(&nsig);
+               sigaddset(&nsig, sig);
+               sigprocmask(SIG_UNBLOCK, &nsig, NULL);                     /* unblock signal    */
+               sigctx->eax = (long) proto_java_lang_NullPointerException; /* REG_ITMP1_XPTR    */
+               sigctx->edx = sigctx->eip;                                 /* REG_ITMP2_XPC     */
+               sigctx->eip = (long) asm_handle_exception;
+
+               return;
+
+/*     } else { */
+/*             faultaddr += (long) ((instr << 16) >> 16); */
+/*             fprintf(stderr, "faulting address: 0x%08x\n", faultaddr); */
+/*             panic("Stack overflow"); */
+/*     } */
+}
+
+/* ArithmeticException signal handler for hardware divide by zero check */
+
+void catch_ArithmeticException(int sig)
+{
+       sigset_t nsig;
+
+       void **_p = (void **) &sig;
+       struct sigcontext *sigctx = (struct sigcontext *) ++_p;
+
+       classinfo *c;
+       java_objectheader *p;
+       methodinfo *m;
+
+       /* Reset signal handler - necessary for SysV, does no harm for BSD        */
+
+       signal(sig, (void *) catch_ArithmeticException);     /* reinstall handler */
+       sigemptyset(&nsig);
+       sigaddset(&nsig, sig);
+       sigprocmask(SIG_UNBLOCK, &nsig, NULL);               /* unblock signal    */
+
+       c = loader_load(utf_new_char("java/lang/ArithmeticException"));
+       p = builtin_new(c);
+       m = class_findmethod(c, 
+                                                utf_new_char("<init>"), 
+                                                utf_new_char("(Ljava/lang/String;)V"));
+
+       asm_calljavamethod(m, p, javastring_new_char("/ by zero"), NULL, NULL);
+
+       sigctx->eax = (long) p;                              /* REG_ITMP1_XPTR    */
+       sigctx->edx = sigctx->eip;                           /* REG_ITMP2_XPC     */
+       sigctx->eip = (long) asm_handle_exception;
+
+       return;
+}
+
+void init_exceptions(void)
+{
+       /* install signal handlers we need to convert to exceptions */
+
+       if (!checknull) {
+
+#if defined(SIGSEGV)
+               signal(SIGSEGV, (void *) catch_NullPointerException);
+#endif
+
+#if defined(SIGBUS)
+               signal(SIGBUS, (void *) catch_NullPointerException);
+#endif
+       }
+
+       signal(SIGFPE, (void *) catch_ArithmeticException);
+}
+
+
+/* function gen_mcode **********************************************************
+
+       generates machine code
+
+*******************************************************************************/
+
+u1          *mcodeptr;
+
+void codegen()
+{
+       int  len, s1, s2, s3, d/*, bbs*/;
+       s4   a;
+       stackptr    src;
+       varinfo     *var;
+/*     varinfo     *dst; */
+       basicblock  *bptr;
+       instruction *iptr;
+
+       int fpu_st_offset = 0;
+
+       xtable *ex;
+
+       {
+       int p, pa, t, l, r;
+
+       savedregs_num = 0;
+
+       /* space to save used callee saved registers */
+
+       savedregs_num += (savintregcnt - maxsavintreguse);
+       savedregs_num += (savfltregcnt - maxsavfltreguse);
+
+       parentargs_base = maxmemuse + savedregs_num;
+
+#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
+
+       if (checksync && (method->flags & ACC_SYNCHRONIZED))
+               parentargs_base++;
+
+#endif
+
+       /* create method header */
+
+       (void) dseg_addaddress(method);                         /* MethodPointer  */
+       (void) dseg_adds4(parentargs_base * 8);                 /* FrameSize      */
+
+#ifdef USE_THREADS
+
+       /* IsSync contains the offset relative to the stack pointer for the
+          argument of monitor_exit used in the exception handler. Since the
+          offset could be zero and give a wrong meaning of the flag it is
+          offset by one.
+       */
+
+       if (checksync && (method->flags & ACC_SYNCHRONIZED))
+               (void) dseg_adds4((maxmemuse + 1) * 8);             /* IsSync         */
+       else
+
+#endif
+
+       (void) dseg_adds4(0);                                   /* IsSync         */
+                                              
+       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
+       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
+       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
+       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
+
+       /* create exception table */
+
+       for (ex = extable; ex != NULL; ex = ex->down) {
+
+#ifdef LOOP_DEBUG      
+               if (ex->start != NULL)
+                       printf("adding start - %d - ", ex->start->debug_nr);
+               else {
+                       printf("PANIC - start is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->start);
+
+#ifdef LOOP_DEBUG                      
+               if (ex->end != NULL)
+                       printf("adding end - %d - ", ex->end->debug_nr);
+               else {
+                       printf("PANIC - end is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->end);
+
+#ifdef LOOP_DEBUG              
+               if (ex->handler != NULL)
+                       printf("adding handler - %d\n", ex->handler->debug_nr);
+               else {
+                       printf("PANIC - handler is NULL");
+                       exit(-1);
+               }
+#endif
+
+               dseg_addtarget(ex->handler);
+          
+               (void) dseg_addaddress(ex->catchtype);
+       }
+       
+       /* initialize mcode variables */
+       
+       mcodeptr = (u1*) mcodebase;
+       mcodeend = (s4*) (mcodebase + mcodesize);
+       MCODECHECK(128 + mparamcount);
+
+       /* create stack frame (if necessary) */
+
+       if (parentargs_base) {
+               i386_alu_imm_reg(I386_SUB, parentargs_base * 8, REG_SP);
+       }
+
+       /* save return address and used callee saved registers */
+
+       p = parentargs_base;
+       for (r = savintregcnt - 1; r >= maxsavintreguse; r--) {
+               p--; i386_mov_reg_membase(savintregs[r], REG_SP, p * 8);
+       }
+       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--) {
+               p--; i386_fld_reg(savfltregs[r]); i386_fstpl_membase(REG_SP, p * 8);
+       }
+
+       /* save monitorenter argument */
+
+#ifdef USE_THREADS
+       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+               if (method->flags & ACC_STATIC) {
+                       i386_mov_imm_reg((s4) class, REG_ITMP1);
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, maxmemuse * 8);
+
+               } else {
+                       i386_mov_membase_reg(REG_SP, parentargs_base * 8 + 4, REG_ITMP1);
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, maxmemuse * 8);
+               }
+       }                       
+#endif
+
+       /* copy argument registers to stack and call trace function with pointer
+          to arguments on stack.
+       */
+
+       if (runverbose) {
+               i386_alu_imm_reg(I386_SUB, TRACE_ARGS_NUM * 8 + 4, REG_SP);
+
+               for (p = 0; p < mparamcount; p++) {
+                       t = mparamtypes[p];
+                       if (IS_INT_LNG_TYPE(t)) {
+                               if (IS_2_WORD_TYPE(t)) {
+                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4 + 4, REG_ITMP2);
+
+                               } else if (t == TYPE_ADR) {
+                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+
+                               } else {
+                                       i386_mov_membase_reg(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                                       i386_cltd();
+                               }
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
+
+                       } else {
+                               if (t == TYPE_FLT) {
+                                       i386_flds_membase(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4);
+                                       i386_fstps_membase(REG_SP, p * 8);
+                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
+
+                               } else {
+                                       i386_fldl_membase(REG_SP, 4 + (parentargs_base + TRACE_ARGS_NUM + p) * 8 + 4);
+                                       i386_fstpl_membase(REG_SP, p * 8);
+                               }
+                       }
+               }
+
+               /* fill up the remaining arguments */
+               i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
+               for (p = mparamcount; p < TRACE_ARGS_NUM; p++) {
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8 + 4);
+               }
+
+               i386_mov_imm_membase((s4) method, REG_SP, TRACE_ARGS_NUM * 8);
+
+               i386_mov_imm_reg((s4) builtin_trace_args, REG_ITMP1);
+/*             i386_mov_imm_reg(asm_builtin_trace, REG_ITMP1); */
+               i386_call_reg(REG_ITMP1);
+
+               i386_alu_imm_reg(I386_ADD, TRACE_ARGS_NUM * 8 + 4, REG_SP);
+       }
+
+       /* take arguments out of register or stack frame */
+
+       for (p = 0, l = 0; p < mparamcount; p++) {
+               t = mparamtypes[p];
+               var = &(locals[l][t]);
+               l++;
+               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
+                       l++;
+               if (var->type < 0)
+                       continue;
+               r = var->regoff; 
+               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
+                       if (p < intreg_argnum) {                 /* register arguments    */
+                               panic("integer register argument");
+                               if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
+/*                                     M_INTMOVE (argintregs[p], r); */
+
+                               } else {                             /* reg arg -> spilled    */
+/*                                     M_LST (argintregs[p], REG_SP, 8 * r); */
+                               }
+                       } else {                                 /* stack arguments       */
+                               pa = p - intreg_argnum;
+                               if (!(var->flags & INMEMORY)) {      /* stack arg -> register */ 
+                                       i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, r);            /* + 4 for return address */
+                               } else {                             /* stack arg -> spilled  */
+                                       if (!IS_2_WORD_TYPE(t)) {
+                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1);    /* + 4 for return address */
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1);    /* + 4 for return address */
+                                               i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4 + 4, REG_ITMP2);    /* + 4 for return address */
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, r * 8 + 4);
+                                       }
+                               }
+                       }
+               
+               } else {                                     /* floating args         */   
+                       if (p < fltreg_argnum) {                 /* register arguments    */
+                               if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
+                                       panic("There are no float argument registers!");
+
+                               } else {                                         /* reg arg -> spilled    */
+                                       panic("There are no float argument registers!");
+                               }
+
+                       } else {                                 /* stack arguments       */
+                               pa = p - fltreg_argnum;
+                               if (!(var->flags & INMEMORY)) {      /* stack-arg -> register */
+                                       if (t == TYPE_FLT) {
+                                               i386_flds_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
+                                               fpu_st_offset++;
+                                               i386_fstp_reg(r + fpu_st_offset);
+                                               fpu_st_offset--;
+
+                                       } else {
+                                               i386_fldl_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
+                                               fpu_st_offset++;
+                                               i386_fstp_reg(r + fpu_st_offset);
+                                               fpu_st_offset--;
+                                       }
+
+                               } else {                              /* stack-arg -> spilled  */
+/*                                     i386_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 4, REG_ITMP1); */
+/*                                     i386_mov_reg_membase(REG_ITMP1, REG_SP, r * 8); */
+                                       if (t == TYPE_FLT) {
+                                               i386_flds_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
+                                               i386_fstps_membase(REG_SP, r * 8);
+
+                                       } else {
+                                               i386_fldl_membase(REG_SP, (parentargs_base + pa) * 8 + 4);
+                                               i386_fstpl_membase(REG_SP, r * 8);
+                                       }
+                               }
+                       }
+               }
+       }  /* end for */
+
+       /* call monitorenter function */
+
+#ifdef USE_THREADS
+       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+               i386_mov_membase_reg(REG_SP, maxmemuse * 8, REG_ITMP1);
+               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+               i386_mov_imm_reg((s4) builtin_monitorenter, REG_ITMP2);
+               i386_call_reg(REG_ITMP2);
+               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+       }                       
+#endif
+       }
+
+       /* end of header generation */
+
+       /* walk through all basic blocks */
+       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
+
+               bptr->mpc = (int)((u1*) mcodeptr - mcodebase);
+
+               if (bptr->flags >= BBREACHED) {
+
+               /* branch resolving */
+
+               branchref *brefs;
+               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
+                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
+                                         brefs->branchpos, bptr->mpc);
+               }
+
+               /* copy interface registers to their destination */
+
+               src = bptr->instack;
+               len = bptr->indepth;
+               MCODECHECK(64+len);
+               while (src != NULL) {
+                       len--;
+                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
+                               if (!IS_2_WORD_TYPE(src->type)) {
+                                       if (bptr->type == BBTYPE_SBR) {
+                                               d = reg_of_var(src, REG_ITMP1);
+                                               i386_pop_reg(d);
+                                               store_reg_to_var_int(src, d);
+
+                                       } else if (bptr->type == BBTYPE_EXH) {
+                                               d = reg_of_var(src, REG_ITMP1);
+                                               M_INTMOVE(REG_ITMP1, d);
+                                               store_reg_to_var_int(src, d);
+                                       }
+
+                               } else {
+                                       panic("copy interface registers: longs have to me in memory (begin 1)");
+                               }
+
+                       } else {
+                               d = reg_of_var(src, REG_ITMP1);
+                               if ((src->varkind != STACKVAR)) {
+                                       s2 = src->type;
+                                       if (IS_FLT_DBL_TYPE(s2)) {
+                                               s1 = interfaces[len][s2].regoff;
+                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                                       M_FLTMOVE(s1, d);
+
+                                               } else {
+                                                       if (s2 == TYPE_FLT) {
+                                                               i386_flds_membase(REG_SP, s1 * 8);
+
+                                                       } else {
+                                                               i386_fldl_membase(REG_SP, s1 * 8);
+                                                       }
+                                               }
+                                               store_reg_to_var_flt(src, d);
+
+                                       } else {
+                                               s1 = interfaces[len][s2].regoff;
+                                               if (!IS_2_WORD_TYPE(interfaces[len][s2].type)) {
+                                                       if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                                               M_INTMOVE(s1, d);
+
+                                                       } else {
+                                                               i386_mov_membase_reg(REG_SP, s1 * 8, d);
+                                                       }
+                                                       store_reg_to_var_int(src, d);
+
+                                               } else {
+                                                       if (interfaces[len][s2].flags & INMEMORY) {
+                                                               M_LNGMEMMOVE(s1, src->regoff);
+
+                                                       } else {
+                                                               panic("copy interface registers: longs have to be in memory (begin 2)");
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       src = src->prev;
+               }
+
+               /* walk through all instructions */
+               
+               src = bptr->instack;
+               len = bptr->icount;
+               for (iptr = bptr->iinstr;
+                   len > 0;
+                   src = iptr->dst, len--, iptr++) {
+
+       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
+       switch (iptr->opc) {
+
+               case ICMD_NOP:        /* ...  ==> ...                                 */
+                       break;
+
+               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_test_reg_reg(src->regoff, src->regoff);
+                       }
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addxnullrefs(mcodeptr);
+                       break;
+
+               /* constant operations ************************************************/
+
+               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.i = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_imm_membase(iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               if (iptr->val.i == 0) {
+                                       i386_alu_reg_reg(I386_XOR, d, d);
+
+                               } else {
+                                       i386_mov_imm_reg(iptr->val.i, d);
+                               }
+                       }
+                       break;
+
+               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.l = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_imm_membase(iptr->val.l, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_imm_membase(iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
+                               
+                       } else {
+                               panic("LCONST: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.f = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (iptr->val.f == 0.0) {
+                               i386_fldz();
+                               fpu_st_offset++;
+
+                               /* -0.0 */
+                               if (iptr->val.i == 0x80000000) {
+                                       i386_fchs();
+                               }
+
+                       } else if (iptr->val.f == 1.0) {
+                               i386_fld1();
+                               fpu_st_offset++;
+
+                       } else if (iptr->val.f == 2.0) {
+                               i386_fld1();
+                               i386_fld1();
+                               i386_faddp();
+                               fpu_st_offset++;
+
+                       } else {
+                               a = dseg_addfloat(iptr->val.f);
+                               i386_mov_imm_reg(0, REG_ITMP1);
+                               dseg_adddata(mcodeptr);
+                               i386_flds_membase(REG_ITMP1, a);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+               
+               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.d = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (iptr->val.d == 0.0) {
+                               i386_fldz();
+                               fpu_st_offset++;
+
+                               /* -0.0 */
+                               if (iptr->val.l == 0x8000000000000000LL) {
+                                       i386_fchs();
+                               }
+
+                       } else if (iptr->val.d == 1.0) {
+                               i386_fld1();
+                               fpu_st_offset++;
+
+                       } else if (iptr->val.d == 2.0) {
+                               i386_fld1();
+                               i386_fld1();
+                               i386_faddp();
+                               fpu_st_offset++;
+
+                       } else {
+                               a = dseg_adddouble(iptr->val.d);
+                               i386_mov_imm_reg(0, REG_ITMP1);
+                               dseg_adddata(mcodeptr);
+                               i386_fldl_membase(REG_ITMP1, a);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
+                                     /* op1 = 0, val.a = constant                    */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_imm_membase((s4) iptr->val.a, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               if ((s4) iptr->val.a == 0) {
+                                       i386_alu_reg_reg(I386_XOR, d, d);
+
+                               } else {
+                                       i386_mov_imm_reg((s4) iptr->val.a, d);
+                               }
+                       }
+                       break;
+
+
+               /* load/store operations **********************************************/
+
+               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_ALOAD:      /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (var->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, var->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_mov_reg_membase(var->regoff, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (var->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, var->regoff * 8, iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(var->regoff, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_LLOAD:      /* ...  ==> ..., content of local variable      */
+                                     /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (var->flags & INMEMORY) {
+                                       M_LNGMEMMOVE(var->regoff, iptr->dst->regoff);
+
+                               } else {
+                                       panic("LLOAD: longs have to be in memory");
+                               }
+
+                       } else {
+                               panic("LLOAD: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
+                                     /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (var->flags & INMEMORY) {
+                               i386_flds_membase(REG_SP, var->regoff * 8);
+                               fpu_st_offset++;
+                       } else {
+                               i386_fld_reg(var->regoff + fpu_st_offset);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DLOAD:      /* ...  ==> ..., content of local variable      */
+                                     /* op1 = local variable                         */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if ((iptr->dst->varkind == LOCALVAR) &&
+                           (iptr->dst->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
+                       if (var->flags & INMEMORY) {
+                               i386_fldl_membase(REG_SP, var->regoff * 8);
+                               fpu_st_offset++;
+                       } else {
+                               i386_fld_reg(var->regoff + fpu_st_offset);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
+               case ICMD_ASTORE:     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, var->regoff * 8);
+                                       
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, var->regoff * 8);
+                               }
+
+                       } else {
+                               var_to_reg_int(s1, src, var->regoff);
+                               M_INTMOVE(s1, var->regoff);
+                       }
+                       break;
+
+               case ICMD_LSTORE:     /* ..., value  ==> ...                          */
+                                     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       M_LNGMEMMOVE(src->regoff, var->regoff);
+
+                               } else {
+                                       panic("LSTORE: longs have to be in memory");
+                               }
+
+                       } else {
+                               panic("LSTORE: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
+                                     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               i386_fstps_membase(REG_SP, var->regoff * 8);
+                               fpu_st_offset--;
+                       } else {
+                               var_to_reg_flt(s1, src, var->regoff);
+/*                             M_FLTMOVE(s1, var->regoff); */
+                               i386_fstp_reg(var->regoff + fpu_st_offset);
+                               fpu_st_offset--;
+                       }
+                       break;
+
+               case ICMD_DSTORE:     /* ..., value  ==> ...                          */
+                                     /* op1 = local variable                         */
+
+                       if ((src->varkind == LOCALVAR) &&
+                           (src->varnum == iptr->op1)) {
+                               break;
+                       }
+                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
+                       if (var->flags & INMEMORY) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               i386_fstpl_membase(REG_SP, var->regoff * 8);
+                               fpu_st_offset--;
+                       } else {
+                               var_to_reg_flt(s1, src, var->regoff);
+/*                             M_FLTMOVE(s1, var->regoff); */
+                               i386_fstp_reg(var->regoff + fpu_st_offset);
+                               fpu_st_offset--;
+                       }
+                       break;
+
+
+               /* pop/dup/swap operations ********************************************/
+
+               /* attention: double and longs are only one entry in CACAO ICMDs      */
+
+               case ICMD_POP:        /* ..., value  ==> ...                          */
+               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
+                       break;
+
+#define M_COPY(from,to) \
+               d = reg_of_var(to, REG_ITMP1); \
+                       if ((from->regoff != to->regoff) || \
+                           ((from->flags ^ to->flags) & INMEMORY)) { \
+                               if (IS_FLT_DBL_TYPE(from->type)) { \
+                                       var_to_reg_flt(s1, from, d); \
+/*                                     M_FLTMOVE(s1, d);*/ \
+                                       store_reg_to_var_flt(to, d); \
+                               } else { \
+                    if (!IS_2_WORD_TYPE(from->type)) { \
+                        if (to->flags & INMEMORY) { \
+                             if (from->flags & INMEMORY) { \
+                                 i386_mov_membase_reg(REG_SP, from->regoff * 8, REG_ITMP1); \
+                                 i386_mov_reg_membase(REG_ITMP1, REG_SP, to->regoff * 8); \
+                             } else { \
+                                 i386_mov_reg_membase(from->regoff, REG_SP, to->regoff * 8); \
+                             } \
+                        } else { \
+                             if (from->flags & INMEMORY) { \
+                                 i386_mov_membase_reg(REG_SP, from->regoff * 8, to->regoff); \
+                             } else { \
+                                 i386_mov_reg_reg(from->regoff, to->regoff); \
+                             } \
+                        } \
+                    } else { \
+                        M_LNGMEMMOVE(from->regoff, to->regoff); \
+                    } \
+                               } \
+                       }
+
+               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
+                       M_COPY(src, iptr->dst);
+                       break;
+
+               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
+
+                       M_COPY(src,       iptr->dst->prev->prev);
+
+               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
+
+                       M_COPY(src,       iptr->dst);
+                       M_COPY(src->prev, iptr->dst->prev);
+                       break;
+
+               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
+
+                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
+
+               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
+
+                       M_COPY(src,             iptr->dst);
+                       M_COPY(src->prev,       iptr->dst->prev);
+                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
+                       M_COPY(src, iptr->dst->prev->prev->prev);
+                       break;
+
+               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
+
+                       M_COPY(src,                   iptr->dst);
+                       M_COPY(src->prev,             iptr->dst->prev);
+                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
+                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
+                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
+                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
+                       break;
+
+               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
+
+                       M_COPY(src, iptr->dst->prev);
+                       M_COPY(src->prev, iptr->dst);
+                       break;
+
+
+               /* integer operations *************************************************/
+
+               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_neg_reg(REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       }
+
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                                       i386_neg_reg(iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_neg_reg(iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_imm_membase(I386_ADC, 0, REG_SP, iptr->dst->regoff * 8 + 4);
+                                               i386_neg_membase(REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_neg_reg(REG_ITMP1);
+                                               i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
+                                               i386_neg_reg(REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_EAX);
+                                       i386_cltd();
+                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, I386_EAX);
+                                       i386_cltd();
+                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SHL, 24, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, 24, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_shift_imm_membase(I386_SHL, 24, REG_SP, iptr->dst->regoff * 8);
+                                       i386_shift_imm_membase(I386_SAR, 24, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SHL, 24, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SAR, 24, iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SHL, 24, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SAR, 24, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_alu_imm_membase(I386_AND, 0x0000ffff, REG_SP, iptr->dst->regoff * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_alu_imm_reg(I386_AND, 0x0000ffff, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       }
+
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_alu_imm_membase(I386_AND, 0x0000ffff, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                                       i386_alu_imm_reg(I386_AND, 0x0000ffff, iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_alu_imm_reg(I386_AND, 0x0000ffff, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SHL, 16, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, 16, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_shift_imm_membase(I386_SHL, 16, REG_SP, iptr->dst->regoff * 8);
+                                       i386_shift_imm_membase(I386_SAR, 16, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SHL, 16, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SAR, 16, iptr->dst->regoff);
+
+                               } else {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SHL, 16, iptr->dst->regoff);
+                                       i386_shift_imm_reg(I386_SAR, 16, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+
+               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialu(I386_ADD, src, iptr);
+                       break;
+
+               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       /* should we use a inc optimization for smaller code size? */
+                       i386_emit_ialuconst(I386_ADD, src, iptr);
+                       break;
+
+               case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_reg_membase(I386_ADD, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_reg_membase(I386_ADC, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else if (src->prev->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_reg_membase(I386_ADD, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_reg_membase(I386_ADC, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_membase_reg(I386_ADD, REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_alu_membase_reg(I386_ADC, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+
+                               }
+                       }
+                       break;
+
+               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_alu_imm_membase(I386_ADD, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_imm_membase(I386_ADC, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_imm_reg(I386_ADD, iptr->val.l, REG_ITMP1);
+                                               i386_alu_imm_reg(I386_ADC, iptr->val.l >> 32, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       if (src->prev->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_alu_reg_membase(I386_SUB, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       }
+
+                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                                       M_INTMOVE(src->prev->regoff, REG_ITMP1);
+                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       if (src->prev->regoff == iptr->dst->regoff) {
+                                               i386_alu_reg_membase(I386_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       }
+
+                               } else {
+                                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+                                       i386_alu_reg_membase(I386_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, d);
+                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, d);
+
+                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                                       M_INTMOVE(src->prev->regoff, d);
+                                       i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, d);
+
+                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       /* workaround for reg alloc */
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
+                                               M_INTMOVE(REG_ITMP1, d);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, d);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, d);
+                                       }
+
+                               } else {
+                                       /* workaround for reg alloc */
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               M_INTMOVE(src->prev->regoff, REG_ITMP1);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, REG_ITMP1);
+                                               M_INTMOVE(REG_ITMP1, d);
+
+                                       } else {
+                                               M_INTMOVE(src->prev->regoff, d);
+                                               i386_alu_reg_reg(I386_SUB, src->regoff, d);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialuconst(I386_SUB, src, iptr);
+                       break;
+
+               case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       if (src->prev->regoff == iptr->dst->regoff) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_reg_membase(I386_SUB, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_reg_membase(I386_SBB, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_membase_reg(I386_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_alu_membase_reg(I386_SBB, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_alu_imm_membase(I386_SUB, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
+                                               i386_alu_imm_membase(I386_SBB, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                       } else {
+                                               /* TODO: could be size optimized with lea -- see gcc output */
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_alu_imm_reg(I386_SUB, iptr->val.l, REG_ITMP1);
+                                               i386_alu_imm_reg(I386_SBB, iptr->val.l >> 32, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_imul_reg_reg(src->prev->regoff, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                       i386_imul_reg_reg(src->regoff, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_mov_reg_reg(src->prev->regoff, REG_ITMP1);
+                                       i386_imul_reg_reg(src->regoff, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                                       i386_imul_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+
+                               } else {
+                                       if (src->regoff == iptr->dst->regoff) {
+                                               i386_imul_reg_reg(src->prev->regoff, iptr->dst->regoff);
+
+                                       } else {
+                                               M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                                               i386_imul_reg_reg(src->regoff, iptr->dst->regoff);
+                                       }
+                               }
+                       }
+                       break;
+
+               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_imul_imm_membase_reg(iptr->val.i, REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                               } else {
+                                       i386_imul_imm_reg_reg(iptr->val.i, src->regoff, REG_ITMP1);
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               }
+
+                       } else {
+                               if (src->flags & INMEMORY) {
+                                       i386_imul_imm_membase_reg(iptr->val.i, REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+                               } else {
+                                       i386_imul_imm_reg_reg(iptr->val.i, src->regoff, iptr->dst->regoff);
+                               }
+                       }
+                       break;
+
+               case ICMD_LMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);        /* mem -> EAX             */
+                                       /* optimize move EAX -> REG_ITMP3 is slower??? */
+/*                                     i386_mov_reg_reg(I386_EAX, REG_ITMP3); */
+                                       i386_mul_membase(REG_SP, src->regoff * 8);                            /* mem * EAX -> EDX:EAX   */
+
+                                       /* TODO: optimize move EAX -> REG_ITMP3 */
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP3);   /* mem -> ITMP3           */
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);            /* mem * ITMP3 -> ITMP3   */
+                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
+
+                                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP3);       /* mem -> ITMP3           */
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);        /* mem * ITMP3 -> ITMP3   */
+
+                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
+                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+               case ICMD_LMULCONST:  /* ..., value  ==> ..., value * constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       i386_mov_imm_reg(iptr->val.l, I386_EAX);                              /* imm -> EAX             */
+                                       i386_mul_membase(REG_SP, src->regoff * 8);                            /* mem * EAX -> EDX:EAX   */
+                                       /* TODO: optimize move EAX -> REG_ITMP3 */
+                                       i386_mov_imm_reg(iptr->val.l >> 32, REG_ITMP3);                       /* imm -> ITMP3           */
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);            /* mem * ITMP3 -> ITMP3   */
+
+                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
+                                       i386_mov_imm_reg(iptr->val.l, REG_ITMP3);                             /* imm -> ITMP3           */
+                                       i386_imul_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);        /* mem * ITMP3 -> ITMP3   */
+
+                                       i386_alu_reg_reg(I386_ADD, REG_ITMP3, I386_EDX);                      /* ITMP3 + EDX -> EDX     */
+                                       i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+#define gen_div_check(v) \
+    if (checknull) { \
+        if ((v)->flags & INMEMORY) { \
+            i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8); \
+        } else { \
+            i386_test_reg_reg(src->regoff, src->regoff); \
+        } \
+        i386_jcc(I386_CC_E, 0); \
+        codegen_addxdivrefs(mcodeptr); \
+    }
+
+               case ICMD_IDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       var_to_reg_int(s1, src, REG_ITMP3);
+                       gen_div_check(src);
+               if (src->prev->flags & INMEMORY) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);
+
+                       } else {
+                               M_INTMOVE(src->prev->regoff, I386_EAX);
+                       }
+                       
+                       i386_alu_imm_reg(I386_CMP, 0x80000000, I386_EAX);    /* check as described in jvm spec */
+                       i386_jcc(I386_CC_NE, 3 + 6);
+                       i386_alu_imm_reg(I386_CMP, -1, s1);
+                       i386_jcc(I386_CC_E, 1 + 2);
+
+                       i386_cltd();
+                       i386_idiv_reg(s1);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_reg_membase(I386_EAX, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               M_INTMOVE(I386_EAX, iptr->dst->regoff);
+                       }
+                       break;
+
+               case ICMD_IREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       var_to_reg_int(s1, src, REG_ITMP3);
+                       gen_div_check(src);
+                       if (src->prev->flags & INMEMORY) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, I386_EAX);
+
+                       } else {
+                               M_INTMOVE(src->prev->regoff, I386_EAX);
+                       }
+                       
+                       i386_alu_imm_reg(I386_CMP, 0x80000000, I386_EAX);    /* check as described in jvm spec */
+                       i386_jcc(I386_CC_NE, 2 + 3 + 6);
+                       i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EDX);
+                       i386_alu_imm_reg(I386_CMP, -1, s1);
+                       i386_jcc(I386_CC_E, 1 + 2);
+
+                       i386_cltd();
+                       i386_idiv_reg(s1);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_reg_membase(I386_EDX, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               M_INTMOVE(I386_EDX, iptr->dst->regoff);
+                       }
+                       break;
+
+               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       /* TODO: optimize for `/ 2' */
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       M_INTMOVE(s1, d);
+                       i386_test_reg_reg(d, d);
+                       a = 2;
+                       CALCIMMEDIATEBYTES(a, (1 << iptr->val.i) - 1);
+                       i386_jcc(I386_CC_NS, a);
+                       i386_alu_imm_reg(I386_ADD, (1 << iptr->val.i) - 1, d);
+                               
+                       i386_shift_imm_reg(I386_SAR, iptr->val.i, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LDIVPOW2:   /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       a = 2;
+                                       CALCIMMEDIATEBYTES(a, (1 << iptr->val.i) - 1);
+                                       a += 3;
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+
+                                       i386_test_reg_reg(REG_ITMP2, REG_ITMP2);
+                                       i386_jcc(I386_CC_NS, a);
+                                       i386_alu_imm_reg(I386_ADD, (1 << iptr->val.i) - 1, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
+                                       i386_shrd_imm_reg_reg(iptr->val.i, REG_ITMP2, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, iptr->val.i, REG_ITMP2);
+
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
+                                     /* val.i = constant                             */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                       if (s1 == d) {
+                               M_INTMOVE(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                       } 
+
+                       a = 2;
+                       a += 2;
+                       a += 2;
+                       CALCIMMEDIATEBYTES(a, iptr->val.i);
+                       a += 2;
+
+                       /* TODO: optimize */
+                       M_INTMOVE(s1, d);
+                       i386_alu_imm_reg(I386_AND, iptr->val.i, d);
+                       i386_test_reg_reg(s1, s1);
+                       i386_jcc(I386_CC_GE, a);
+                       i386_mov_reg_reg(s1, d);
+                       i386_neg_reg(d);
+                       i386_alu_imm_reg(I386_AND, iptr->val.i, d);
+                       i386_neg_reg(d);
+
+/*                     M_INTMOVE(s1, I386_EAX); */
+/*                     i386_cltd(); */
+/*                     i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EAX); */
+/*                     i386_alu_reg_reg(I386_SUB, I386_EDX, I386_EAX); */
+/*                     i386_alu_reg_reg(I386_AND, iptr->val.i, I386_EAX); */
+/*                     i386_alu_reg_reg(I386_XOR, I386_EDX, I386_EAX); */
+/*                     i386_alu_reg_reg(I386_SUB, I386_EDX, I386_EAX); */
+/*                     M_INTMOVE(I386_EAX, d); */
+
+/*                     i386_alu_reg_reg(I386_XOR, d, d); */
+/*                     i386_mov_imm_reg(iptr->val.i, I386_ECX); */
+/*                     i386_shrd_reg_reg(s1, d); */
+/*                     i386_shift_imm_reg(I386_SHR, 32 - iptr->val.i, d); */
+
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LREMPOW2:   /* ..., value  ==> ..., value % constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY) {
+                               if (src->flags & INMEMORY) {
+                                       /* Intel algorithm -- does not work, because constant is wrong */
+/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1); */
+/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3); */
+
+/*                                     M_INTMOVE(REG_ITMP1, REG_ITMP2); */
+/*                                     i386_test_reg_reg(REG_ITMP3, REG_ITMP3); */
+/*                                     i386_jcc(I386_CC_NS, offset); */
+/*                                     i386_alu_imm_reg(I386_ADD, (1 << iptr->val.l) - 1, REG_ITMP2); */
+/*                                     i386_alu_imm_reg(I386_ADC, 0, REG_ITMP3); */
+                                       
+/*                                     i386_shrd_imm_reg_reg(iptr->val.l, REG_ITMP3, REG_ITMP2); */
+/*                                     i386_shift_imm_reg(I386_SAR, iptr->val.l, REG_ITMP3); */
+/*                                     i386_shld_imm_reg_reg(iptr->val.l, REG_ITMP2, REG_ITMP3); */
+
+/*                                     i386_shift_imm_reg(I386_SHL, iptr->val.l, REG_ITMP2); */
+
+/*                                     i386_alu_reg_reg(I386_SUB, REG_ITMP2, REG_ITMP1); */
+/*                                     i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2); */
+/*                                     i386_alu_reg_reg(I386_SBB, REG_ITMP3, REG_ITMP2); */
+
+/*                                     i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
+/*                                     i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
+
+                                       /* Alpha algorithm */
+                                       a = 3;
+                                       CALCOFFSETBYTES(a, src->regoff * 8);
+                                       a += 3;
+                                       CALCOFFSETBYTES(a, src->regoff * 8 + 4);
+
+                                       a += 2;
+                                       a += 3;
+                                       a += 2;
+
+                                       /* TODO: hmm, don't know if this is always correct */
+                                       a += 2;
+                                       CALCIMMEDIATEBYTES(a, iptr->val.l & 0x00000000ffffffff);
+                                       a += 2;
+                                       CALCIMMEDIATEBYTES(a, iptr->val.l >> 32);
+
+                                       a += 2;
+                                       a += 3;
+                                       a += 2;
+
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                       
+                                       i386_alu_imm_reg(I386_AND, iptr->val.l, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_AND, iptr->val.l >> 32, REG_ITMP2);
+                                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8 + 4);
+                                       i386_jcc(I386_CC_GE, a);
+
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                       
+                                       i386_neg_reg(REG_ITMP1);
+                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
+                                       i386_neg_reg(REG_ITMP2);
+                                       
+                                       i386_alu_imm_reg(I386_AND, iptr->val.l, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_AND, iptr->val.l >> 32, REG_ITMP2);
+                                       
+                                       i386_neg_reg(REG_ITMP1);
+                                       i386_alu_imm_reg(I386_ADC, 0, REG_ITMP2);
+                                       i386_neg_reg(REG_ITMP2);
+
+                                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                               }
+                       }
+                       break;
+
+               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishift(I386_SHL, src, iptr);
+                       break;
+
+               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishiftconst(I386_SHL, src, iptr);
+                       break;
+
+               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishift(I386_SAR, src, iptr);
+                       break;
+
+               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishiftconst(I386_SAR, src, iptr);
+                       break;
+
+               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishift(I386_SHR, src, iptr);
+                       break;
+
+               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ishiftconst(I386_SHR, src, iptr);
+                       break;
+
+               case ICMD_LSHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ){
+                               if (src->prev->flags & INMEMORY) {
+/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
+
+/*                                             if (src->flags & INMEMORY) { */
+/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
+/*                                             } else { */
+/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
+/*                                             } */
+
+/*                                             i386_test_imm_reg(32, I386_ECX); */
+/*                                             i386_jcc(I386_CC_E, 2 + 2); */
+/*                                             i386_mov_reg_reg(REG_ITMP1, REG_ITMP2); */
+/*                                             i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1); */
+                                               
+/*                                             i386_shld_reg_membase(REG_ITMP1, REG_SP, src->prev->regoff * 8 + 4); */
+/*                                             i386_shift_membase(I386_SHL, REG_SP, iptr->dst->regoff * 8); */
+
+/*                                     } else { */
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                                               
+                                               if (src->flags & INMEMORY) {
+                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                                               } else {
+                                                       M_INTMOVE(src->regoff, I386_ECX);
+                                               }
+                                               
+                                               i386_test_imm_reg(32, I386_ECX);
+                                               i386_jcc(I386_CC_E, 2 + 2);
+                                               i386_mov_reg_reg(REG_ITMP1, REG_ITMP2);
+                                               i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
+                                               
+                                               i386_shld_reg_reg(REG_ITMP1, REG_ITMP2);
+                                               i386_shift_reg(I386_SHL, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+/*                                     } */
+                               }
+                       }
+                       break;
+
+        case ICMD_LSHLCONST:  /* ..., value  ==> ..., value << constant       */
+                                         /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+
+                               if (iptr->val.i & 0x20) {
+                                       i386_mov_reg_reg(REG_ITMP1, REG_ITMP2);
+                                       i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
+                                       i386_shld_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP1, REG_ITMP2);
+
+                               } else {
+                                       i386_shld_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP1, REG_ITMP2);
+                                       i386_shift_imm_reg(I386_SHL, iptr->val.i & 0x3f, REG_ITMP1);
+                               }
+
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+                       break;
+
+               case ICMD_LSHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ){
+                               if (src->prev->flags & INMEMORY) {
+/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
+                                               /* TODO: optimize */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2); */
+
+/*                                             if (src->flags & INMEMORY) { */
+/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
+/*                                             } else { */
+/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
+/*                                             } */
+
+/*                                             i386_test_imm_reg(32, I386_ECX); */
+/*                                             i386_jcc(I386_CC_E, 2 + 3); */
+/*                                             i386_mov_reg_reg(REG_ITMP2, REG_ITMP1); */
+/*                                             i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2); */
+                                               
+/*                                             i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1); */
+/*                                             i386_shift_reg(I386_SAR, REG_ITMP2); */
+/*                                             i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
+/*                                             i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
+
+/*                                     } else { */
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+
+                                               if (src->flags & INMEMORY) {
+                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                                               } else {
+                                                       M_INTMOVE(src->regoff, I386_ECX);
+                                               }
+
+                                               i386_test_imm_reg(32, I386_ECX);
+                                               i386_jcc(I386_CC_E, 2 + 3);
+                                               i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
+                                               i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2);
+                                               
+                                               i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1);
+                                               i386_shift_reg(I386_SAR, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+/*                                     } */
+                               }
+                       }
+                       break;
+
+               case ICMD_LSHRCONST:  /* ..., value  ==> ..., value >> constant       */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+
+                               if (iptr->val.i & 0x20) {
+                                       i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, 31, REG_ITMP2);
+                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
+
+                               } else {
+                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SAR, iptr->val.i & 0x3f, REG_ITMP2);
+                               }
+
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+                       break;
+
+               case ICMD_LUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ){
+                               if (src->prev->flags & INMEMORY) {
+/*                                     if (src->prev->regoff == iptr->dst->regoff) { */
+                                               /* TODO: optimize */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1); */
+/*                                             i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2); */
+
+/*                                             if (src->flags & INMEMORY) { */
+/*                                                     i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX); */
+/*                                             } else { */
+/*                                                     M_INTMOVE(src->regoff, I386_ECX); */
+/*                                             } */
+
+/*                                             i386_test_imm_reg(32, I386_ECX); */
+/*                                             i386_jcc(I386_CC_E, 2 + 2); */
+/*                                             i386_mov_reg_reg(REG_ITMP2, REG_ITMP1); */
+/*                                             i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2); */
+                                               
+/*                                             i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1); */
+/*                                             i386_shift_reg(I386_SHR, REG_ITMP2); */
+/*                                             i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8); */
+/*                                             i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4); */
+
+/*                                     } else { */
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+
+                                               if (src->flags & INMEMORY) {
+                                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                                               } else {
+                                                       M_INTMOVE(src->regoff, I386_ECX);
+                                               }
+
+                                               i386_test_imm_reg(32, I386_ECX);
+                                               i386_jcc(I386_CC_E, 2 + 2);
+                                               i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
+                                               i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+                                               
+                                               i386_shrd_reg_reg(REG_ITMP2, REG_ITMP1);
+                                               i386_shift_reg(I386_SHR, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+/*                                     } */
+                               }
+                       }
+                       break;
+
+               case ICMD_LUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       if (iptr->dst->flags & INMEMORY ) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+
+                               if (iptr->val.i & 0x20) {
+                                       i386_mov_reg_reg(REG_ITMP2, REG_ITMP1);
+                                       i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
+
+                               } else {
+                                       i386_shrd_imm_reg_reg(iptr->val.i & 0x3f, REG_ITMP2, REG_ITMP1);
+                                       i386_shift_imm_reg(I386_SHR, iptr->val.i & 0x3f, REG_ITMP2);
+                               }
+
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+                       break;
+
+               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialu(I386_AND, src, iptr);
+                       break;
+
+               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialuconst(I386_AND, src, iptr);
+                       break;
+
+               case ICMD_LAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_lalu(I386_AND, src, iptr);
+                       break;
+
+               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_laluconst(I386_AND, src, iptr);
+                       break;
+
+               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialu(I386_OR, src, iptr);
+                       break;
+
+               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialuconst(I386_OR, src, iptr);
+                       break;
+
+               case ICMD_LOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_lalu(I386_OR, src, iptr);
+                       break;
+
+               case ICMD_LORCONST:   /* ..., value  ==> ..., value | constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_laluconst(I386_OR, src, iptr);
+                       break;
+
+               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialu(I386_XOR, src, iptr);
+                       break;
+
+               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
+                                     /* val.i = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ialuconst(I386_XOR, src, iptr);
+                       break;
+
+               case ICMD_LXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_lalu(I386_XOR, src, iptr);
+                       break;
+
+               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
+                                     /* val.l = constant                             */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_laluconst(I386_XOR, src, iptr);
+                       break;
+
+               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
+                                     /* op1 = variable, val.i = constant             */
+
+                       var = &(locals[iptr->op1][TYPE_INT]);
+                       if (var->flags & INMEMORY) {
+                               if (iptr->val.i == 1) {
+                                       i386_inc_membase(REG_SP, var->regoff * 8);
+                               } else if (iptr->val.i == -1) {
+                                       i386_dec_membase(REG_SP, var->regoff * 8);
+
+                               } else {
+                                       i386_alu_imm_membase(I386_ADD, iptr->val.i, REG_SP, var->regoff * 8);
+                               }
+
+                       } else {
+                               if (iptr->val.i == 1) {
+                                       i386_inc_reg(var->regoff);
+                               } else if (iptr->val.i == -1) {
+                                       i386_dec_reg(var->regoff);
+
+                               } else {
+                                       i386_alu_imm_reg(I386_ADD, iptr->val.i, var->regoff);
+                               }
+                       }
+                       break;
+
+
+               /* floating operations ************************************************/
+#if 0
+#define ROUND_TO_SINGLE \
+                       i386_fstps_membase(REG_SP, -8); \
+                       i386_flds_membase(REG_SP, -8);
+
+#define ROUND_TO_DOUBLE \
+                       i386_fstpl_membase(REG_SP, -8); \
+                       i386_fldl_membase(REG_SP, -8);
+
+#define FPU_SET_24BIT_MODE \
+                       if (!fpu_in_24bit_mode) { \
+                               i386_fldcw_mem(&fpu_ctrlwrd_24bit); \
+                               fpu_in_24bit_mode = 1; \
+                       }
+
+#define FPU_SET_53BIT_MODE \
+                       if (fpu_in_24bit_mode) { \
+                               i386_fldcw_mem(&fpu_ctrlwrd_53bit); \
+                               fpu_in_24bit_mode = 0; \
+                       }
+#else
+#define ROUND_TO_SINGLE
+#define ROUND_TO_DOUBLE
+#define FPU_SET_24BIT_MODE
+#define FPU_SET_53BIT_MODE
+#endif
+               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
+
+                       FPU_SET_24BIT_MODE;
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       i386_fchs();
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
+
+                       FPU_SET_53BIT_MODE;
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       i386_fchs();
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_faddp();
+                       fpu_st_offset--;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_faddp();
+                       fpu_st_offset--;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_fsubp();
+                       fpu_st_offset--;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_fsubp();
+                       fpu_st_offset--;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_fmulp();
+                       fpu_st_offset--;
+                       ROUND_TO_SINGLE;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+
+/*                     i386_fldt_mem(subnormal_bias1); */
+/*                     i386_fmulp(); */
+
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+
+                       i386_fmulp();
+                       fpu_st_offset--;
+
+/*                     i386_fldt_mem(subnormal_bias2); */
+/*                     i386_fmulp(); */
+
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       i386_fdivp();
+                       fpu_st_offset--;
+                       ROUND_TO_SINGLE;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+
+/*                     i386_fldt_mem(subnormal_bias1); */
+/*                     i386_fmulp(); */
+
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+
+                       i386_fdivp();
+                       fpu_st_offset--;
+
+/*                     i386_fldt_mem(subnormal_bias2); */
+/*                     i386_fmulp(); */
+
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       FPU_SET_24BIT_MODE;
+                       /* exchanged to skip fxch */
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+/*                     i386_fxch(); */
+                       i386_fprem();
+                       i386_wait();
+                       i386_fnstsw();
+                       i386_sahf();
+                       i386_jcc(I386_CC_P, -(2 + 1 + 2 + 1 + 6));
+                       store_reg_to_var_flt(iptr->dst, d);
+                       i386_ffree_reg(0);
+                       i386_fincstp();
+                       fpu_st_offset--;
+                       break;
+
+               case ICMD_DREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
+
+                       FPU_SET_53BIT_MODE;
+                       /* exchanged to skip fxch */
+                       var_to_reg_flt(s2, src, REG_FTMP2);
+                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+/*                     i386_fxch(); */
+                       i386_fprem();
+                       i386_wait();
+                       i386_fnstsw();
+                       i386_sahf();
+                       i386_jcc(I386_CC_P, -(2 + 1 + 2 + 1 + 6));
+                       store_reg_to_var_flt(iptr->dst, d);
+                       i386_ffree_reg(0);
+                       i386_fincstp();
+                       fpu_st_offset--;
+                       break;
+
+               case ICMD_I2F:       /* ..., value  ==> ..., (float) value            */
+               case ICMD_I2D:       /* ..., value  ==> ..., (double) value           */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (src->flags & INMEMORY) {
+                               i386_fildl_membase(REG_SP, src->regoff * 8);
+                               fpu_st_offset++;
+
+                       } else {
+                               a = dseg_adds4(0);
+                               i386_mov_imm_reg(0, REG_ITMP1);
+                               dseg_adddata(mcodeptr);
+                               i386_mov_reg_membase(src->regoff, REG_ITMP1, a);
+                               i386_fildl_membase(REG_ITMP1, a);
+                               fpu_st_offset++;
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_L2F:       /* ..., value  ==> ..., (float) value            */
+               case ICMD_L2D:       /* ..., value  ==> ..., (double) value           */
+
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (src->flags & INMEMORY) {
+                               i386_fildll_membase(REG_SP, src->regoff * 8);
+                               fpu_st_offset++;
+
+                       } else {
+                               panic("L2F: longs have to be in memory");
+                       }
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+                       
+               case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
+                       i386_mov_imm_reg(0, REG_ITMP1);
+                       dseg_adddata(mcodeptr);
+                       i386_fldcw_membase(REG_ITMP1, a);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_fistpl_membase(REG_SP, iptr->dst->regoff * 8);
+                               fpu_st_offset--;
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+
+                       } else {
+                               a = dseg_adds4(0);
+                               i386_fistpl_membase(REG_ITMP1, a);
+                               fpu_st_offset--;
+                               i386_mov_membase_reg(REG_ITMP1, a, iptr->dst->regoff);
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_reg(I386_CMP, 0x80000000, iptr->dst->regoff);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + ((REG_RESULT == d) ? 0 : 2);
+                       }
+
+                       i386_jcc(I386_CC_NE, a);
+
+                               /* XXX: change this when we use registers */
+                       i386_flds_membase(REG_SP, src->regoff * 8);
+                       i386_mov_imm_reg((s4) asm_builtin_f2i, REG_ITMP2);
+                       i386_call_reg(REG_ITMP2);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               M_INTMOVE(REG_RESULT, d);
+                       }
+                       break;
+
+               case ICMD_D2I:       /* ..., value  ==> ..., (int) value              */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
+                       i386_mov_imm_reg(0, REG_ITMP1);
+                       dseg_adddata(mcodeptr);
+                       i386_fldcw_membase(REG_ITMP1, a);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_fistpl_membase(REG_SP, iptr->dst->regoff * 8);
+                               fpu_st_offset--;
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+
+                       } else {
+                               a = dseg_adds4(0);
+                               i386_fistpl_membase(REG_ITMP1, a);
+                               fpu_st_offset--;
+                               i386_mov_membase_reg(REG_ITMP1, a, iptr->dst->regoff);
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_reg(I386_CMP, 0x80000000, iptr->dst->regoff);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + ((REG_RESULT == d) ? 0 : 2);
+                       }
+
+                       i386_jcc(I386_CC_NE, a);
+
+                       /* XXX: change this when we use registers */
+                       i386_fldl_membase(REG_SP, src->regoff * 8);
+                       i386_mov_imm_reg((s4) asm_builtin_d2i, REG_ITMP2);
+                       i386_call_reg(REG_ITMP2);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+                       } else {
+                               M_INTMOVE(REG_RESULT, d);
+                       }
+                       break;
+
+               case ICMD_F2L:       /* ..., value  ==> ..., (long) value             */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
+                       i386_mov_imm_reg(0, REG_ITMP1);
+                       dseg_adddata(mcodeptr);
+                       i386_fldcw_membase(REG_ITMP1, a);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_fistpll_membase(REG_SP, iptr->dst->regoff * 8);
+                               fpu_st_offset--;
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                               a = 6 + 4;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+                               a += 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2;
+                               a += 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+                               a += 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8 + 4);
+
+                               i386_jcc(I386_CC_NE, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, iptr->dst->regoff * 8);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+
+                               i386_jcc(I386_CC_NE, a);
+
+                               /* XXX: change this when we use registers */
+                               i386_flds_membase(REG_SP, src->regoff * 8);
+                               i386_mov_imm_reg((s4) asm_builtin_f2l, REG_ITMP2);
+                               i386_call_reg(REG_ITMP2);
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else {
+                               panic("F2L: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_D2L:       /* ..., value  ==> ..., (long) value             */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+
+                       a = dseg_adds4(0x0e7f);    /* Round to zero, 53-bit mode, exception masked */
+                       i386_mov_imm_reg(0, REG_ITMP1);
+                       dseg_adddata(mcodeptr);
+                       i386_fldcw_membase(REG_ITMP1, a);
+
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_fistpll_membase(REG_SP, iptr->dst->regoff * 8);
+                               fpu_st_offset--;
+
+                               a = dseg_adds4(0x027f);    /* Round to nearest, 53-bit mode, exceptions masked */
+                               i386_fldcw_membase(REG_ITMP1, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0x80000000, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                               a = 6 + 4;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+                               a += 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2;
+                               a += 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+                               a += 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8 + 4);
+
+                               i386_jcc(I386_CC_NE, a);
+
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, iptr->dst->regoff * 8);
+
+                               a = 3;
+                               CALCOFFSETBYTES(a, src->regoff * 8);
+                               a += 5 + 2 + 3;
+                               CALCOFFSETBYTES(a, iptr->dst->regoff * 8);
+
+                               i386_jcc(I386_CC_NE, a);
+
+                               /* XXX: change this when we use registers */
+                               i386_fldl_membase(REG_SP, src->regoff * 8);
+                               i386_mov_imm_reg((s4) asm_builtin_d2l, REG_ITMP2);
+                               i386_call_reg(REG_ITMP2);
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else {
+                               panic("D2L: longs have to be in memory");
+                       }
+                       break;
+
+               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       /* nothing to do */
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_D2F:       /* ..., value  ==> ..., (float) value            */
+
+                       var_to_reg_flt(s1, src, REG_FTMP1);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       /* nothing to do */
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
+               case ICMD_DCMPL:
+
+                       /* exchanged to skip fxch */
+                       var_to_reg_flt(s2, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s1, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                       i386_alu_reg_reg(I386_XOR, d, d);
+/*                     i386_fxch(); */
+                       i386_fucompp();
+                       fpu_st_offset -= 2;
+                       i386_fnstsw();
+                       i386_test_imm_reg(0x400, I386_EAX);    /* unordered treat as GT */
+                       i386_jcc(I386_CC_E, 6);
+                       i386_alu_imm_reg(I386_AND, 0x000000ff, I386_EAX);
+                       i386_sahf();
+                       i386_jcc(I386_CC_E, 6 + 1 + 5 + 1);
+                       i386_jcc(I386_CC_B, 1 + 5);
+                       i386_dec_reg(d);
+                       i386_jmp_imm(1);
+                       i386_inc_reg(d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
+               case ICMD_DCMPG:
+
+                       /* exchanged to skip fxch */
+                       var_to_reg_flt(s2, src->prev, REG_FTMP1);
+                       var_to_reg_flt(s1, src, REG_FTMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                       i386_alu_reg_reg(I386_XOR, d, d);
+/*                     i386_fxch(); */
+                       i386_fucompp();
+                       fpu_st_offset -= 2;
+                       i386_fnstsw();
+                       i386_test_imm_reg(0x400, I386_EAX);    /* unordered treat as LT */
+                       i386_jcc(I386_CC_E, 3);
+                       i386_movb_imm_reg(1, I386_AH);
+                       i386_sahf();
+                       i386_jcc(I386_CC_E, 6 + 1 + 5 + 1);
+                       i386_jcc(I386_CC_B, 1 + 5);
+                       i386_dec_reg(d);
+                       i386_jmp_imm(1);
+                       i386_inc_reg(d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               /* memory operations **************************************************/
+
+#define gen_bound_check \
+    if (checkbounds) { \
+        i386_alu_membase_reg(I386_CMP, s1, OFFSET(java_arrayheader, size), s2); \
+        i386_jcc(I386_CC_AE, 0); \
+        codegen_addxboundrefs(mcodeptr); \
+    }
+
+               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., length              */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                       gen_nullptr_check(s1);
+                       i386_mov_membase_reg(s1, OFFSET(java_arrayheader, size), d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_mov_memindex_reg(OFFSET(java_objectarray, data[0]), s1, s2, 2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       
+                       if (iptr->dst->flags & INMEMORY) {
+                               i386_mov_memindex_reg(OFFSET(java_longarray, data[0]), s1, s2, 3, REG_ITMP3);
+                               i386_mov_reg_membase(REG_ITMP3, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_memindex_reg(OFFSET(java_longarray, data[0]) + 4, s1, s2, 3, REG_ITMP3);
+                               i386_mov_reg_membase(REG_ITMP3, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+                       break;
+
+               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_mov_memindex_reg(OFFSET(java_intarray, data[0]), s1, s2, 2, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_flds_memindex(OFFSET(java_floatarray, data[0]), s1, s2, 2);
+                       fpu_st_offset++;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_FTMP3);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_fldl_memindex(OFFSET(java_doublearray, data[0]), s1, s2, 3);
+                       fpu_st_offset++;
+                       store_reg_to_var_flt(iptr->dst, d);
+                       break;
+
+               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_movzwl_memindex_reg(OFFSET(java_chararray, data[0]), s1, s2, 1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;                  
+
+               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_movswl_memindex_reg(OFFSET(java_shortarray, data[0]), s1, s2, 1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
+
+                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src, REG_ITMP2);
+                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       i386_movsbl_memindex_reg(OFFSET(java_bytearray, data[0]), s1, s2, 0, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+
+               case ICMD_AASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       i386_mov_reg_memindex(s3, OFFSET(java_objectarray, data[0]), s1, s2, 2);
+                       break;
+
+               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+
+                       if (src->flags & INMEMORY) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);
+                               i386_mov_reg_memindex(REG_ITMP3, OFFSET(java_longarray, data[0]), s1, s2, 3);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP3);
+                               i386_mov_reg_memindex(REG_ITMP3, OFFSET(java_longarray, data[0]) + 4, s1, s2, 3);
+                       }
+                       break;
+
+               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       i386_mov_reg_memindex(s3, OFFSET(java_intarray, data[0]), s1, s2, 2);
+                       break;
+
+               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_flt(s3, src, REG_FTMP1);
+                       i386_fstps_memindex(OFFSET(java_floatarray, data[0]), s1, s2, 2);
+                       fpu_st_offset--;
+                       break;
+
+               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_flt(s3, src, REG_FTMP1);
+                       i386_fstpl_memindex(OFFSET(java_doublearray, data[0]), s1, s2, 3);
+                       fpu_st_offset--;
+                       break;
+
+               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       i386_movw_reg_memindex(s3, OFFSET(java_chararray, data[0]), s1, s2, 1);
+                       break;
+
+               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       i386_movw_reg_memindex(s3, OFFSET(java_shortarray, data[0]), s1, s2, 1);
+                       break;
+
+               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
+
+                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
+                       var_to_reg_int(s2, src->prev, REG_ITMP2);
+                       if (iptr->op1 == 0) {
+                               gen_nullptr_check(s1);
+                               gen_bound_check;
+                       }
+                       var_to_reg_int(s3, src, REG_ITMP3);
+                       M_INTMOVE(s3, REG_ITMP3);    /* because EBP, ESI, EDI have no xH and xL bytes */
+                       i386_movb_reg_memindex(REG_ITMP3, OFFSET(java_bytearray, data[0]), s1, s2, 0);
+                       break;
+
+
+               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
+                                     /* op1 = type, val.a = field address            */
+
+                       a = dseg_addaddress(&(((fieldinfo *)(iptr->val.a))->value));
+                       /* here it's slightly slower */
+                       i386_mov_imm_reg(0, REG_ITMP2);
+                       dseg_adddata(mcodeptr);
+                       i386_mov_membase_reg(REG_ITMP2, a, REG_ITMP2);
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                               case TYPE_ADR:
+                                       var_to_reg_int(s2, src, REG_ITMP1);
+                                       i386_mov_reg_membase(s2, REG_ITMP2, 0);
+                                       break;
+                               case TYPE_LNG:
+                                       if (src->flags & INMEMORY) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_ITMP2, 0);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_ITMP2, 0 + 4);
+                                       } else {
+                                               panic("PUTSTATIC: longs have to be in memory");
+                                       }
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_flt(s2, src, REG_FTMP1);
+                                       i386_fstps_membase(REG_ITMP2, 0);
+                                       fpu_st_offset--;
+                                       break;
+                               case TYPE_DBL:
+                                       var_to_reg_flt(s2, src, REG_FTMP1);
+                                       i386_fstpl_membase(REG_ITMP2, 0);
+                                       fpu_st_offset--;
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
+                                     /* op1 = type, val.a = field address            */
+
+                       a = dseg_addaddress(&(((fieldinfo *)(iptr->val.a))->value));
+                       i386_mov_imm_reg(0, REG_ITMP2);
+                       dseg_adddata(mcodeptr);
+                       i386_mov_membase_reg(REG_ITMP2, a, REG_ITMP2);
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                               case TYPE_ADR:
+                                       d = reg_of_var(iptr->dst, REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP2, 0, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_LNG:
+                                       d = reg_of_var(iptr->dst, REG_NULL);
+                                       if (iptr->dst->flags & INMEMORY) {
+                                               i386_mov_membase_reg(REG_ITMP2, 0, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                                               i386_mov_membase_reg(REG_ITMP2, 0 + 4, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       } else {
+                                               panic("GETSTATIC: longs have to be in memory");
+                                       }
+                                       break;
+                               case TYPE_FLT:
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       i386_flds_membase(REG_ITMP2, 0);
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               case TYPE_DBL:                          
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       i386_fldl_membase(REG_ITMP2, 0);
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
+                                     /* op1 = type, val.i = field offset             */
+
+                       a = ((fieldinfo *)(iptr->val.a))->offset;
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                               case TYPE_ADR:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_int(s2, src, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       i386_mov_reg_membase(s2, s1, a);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       gen_nullptr_check(s1);
+                                       if (src->flags & INMEMORY) {
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP2, s1, a);
+                                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                               i386_mov_reg_membase(REG_ITMP2, s1, a + 4);
+                                       } else {
+                                               panic("PUTFIELD: longs have to be in memory");
+                                       }
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_flt(s2, src, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       i386_fstps_membase(s1, a);
+                                       fpu_st_offset--;
+                                       break;
+                               case TYPE_DBL:
+                                       var_to_reg_int(s1, src->prev, REG_ITMP1);
+                                       var_to_reg_flt(s2, src, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       i386_fstpl_membase(s1, a);
+                                       fpu_st_offset--;
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
+                                     /* op1 = type, val.i = field offset             */
+
+                       a = ((fieldinfo *)(iptr->val.a))->offset;
+                       switch (iptr->op1) {
+                               case TYPE_INT:
+                               case TYPE_ADR:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_ITMP2);
+                                       gen_nullptr_check(s1);
+                                       i386_mov_membase_reg(s1, a, d);
+                                       store_reg_to_var_int(iptr->dst, d);
+                                       break;
+                               case TYPE_LNG:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_NULL);
+                                       gen_nullptr_check(s1);
+                                       i386_mov_membase_reg(s1, a, REG_ITMP2);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8);
+                                       i386_mov_membase_reg(s1, a + 4, REG_ITMP2);
+                                       i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                                       break;
+                               case TYPE_FLT:
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       i386_flds_membase(s1, a);
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               case TYPE_DBL:                          
+                                       var_to_reg_int(s1, src, REG_ITMP1);
+                                       d = reg_of_var(iptr->dst, REG_FTMP1);
+                                       gen_nullptr_check(s1);
+                                       i386_fldl_membase(s1, a);
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                                       break;
+                               default: panic ("internal error");
+                               }
+                       break;
+
+
+               /* branch operations **************************************************/
+
+                       /* TWISTI */
+/*  #define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}} */
+#define ALIGNCODENOP do {} while (0)
+
+               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
+
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       M_INTMOVE(s1, REG_ITMP1_XPTR);
+
+                       i386_call_imm(0);                    /* passing exception pointer */
+                       i386_pop_reg(REG_ITMP2_XPC);
+
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_GOTO:         /* ... ==> ...                                */
+                                       /* op1 = target JavaVM pc                     */
+
+                       i386_jmp_imm(0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       ALIGNCODENOP;
+                       break;
+
+               case ICMD_JSR:          /* ... ==> ...                                */
+                                       /* op1 = target JavaVM pc                     */
+
+                       i386_call_imm(0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+                       
+               case ICMD_RET:          /* ... ==> ...                                */
+                                       /* op1 = local variable                       */
+
+                       var = &(locals[iptr->op1][TYPE_ADR]);
+                       var_to_reg_int(s1, var, REG_ITMP1);
+                       i386_jmp_reg(s1);
+                       break;
+
+               case ICMD_IFNULL:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_test_reg_reg(src->regoff, src->regoff);
+                       }
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_test_reg_reg(src->regoff, src->regoff);
+                       }
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFEQ:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFLT:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_L, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFLE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_LE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFNE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFGT:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_G, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IFGE:         /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.i = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.i, REG_SP, src->regoff * 8);
+
+                       } else {
+                               i386_alu_imm_reg(I386_CMP, iptr->val.i, src->regoff);
+                       }
+                       i386_jcc(I386_CC_GE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       if (src->flags & INMEMORY) {
+                               if (iptr->val.l == 0) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_alu_membase_reg(I386_OR, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+
+                               } else if (iptr->val.l > 0 && iptr->val.l <= 0x00000000ffffffff) {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_XOR, iptr->val.l, REG_ITMP1);
+                                       i386_alu_membase_reg(I386_OR, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                                       
+                               } else {
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                                       i386_alu_imm_reg(I386_XOR, iptr->val.l >> 32, REG_ITMP2);
+                                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                       i386_alu_imm_reg(I386_XOR, iptr->val.l, REG_ITMP1);
+                                       i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
+                               }
+                       }
+                       i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize as in IF_LEQ */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 6;
+                               CALCREGOFFBYTES(a, src->regoff);
+                               CALCIMMEDIATEBYTES(a, iptr->val.l);
+
+                               i386_jcc(I386_CC_G, a);
+
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
+                               i386_jcc(I386_CC_B, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize as in IF_LEQ */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 6;
+                               CALCREGOFFBYTES(a, src->regoff);
+                               CALCIMMEDIATEBYTES(a, iptr->val.l);
+                               
+                               i386_jcc(I386_CC_G, a);
+
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
+                               i386_jcc(I386_CC_BE, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize for val.l == 0 */
+                       if (src->flags & INMEMORY) {
+                               i386_mov_imm_reg(iptr->val.l, REG_ITMP1);
+                               i386_mov_imm_reg(iptr->val.l >> 32, REG_ITMP2);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
+                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
+                       }                       
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize as in IF_LEQ */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
+                               i386_jcc(I386_CC_G, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 6;
+                               CALCREGOFFBYTES(a, src->regoff);
+                               CALCIMMEDIATEBYTES(a, iptr->val.l);
+
+                               i386_jcc(I386_CC_L, a);
+
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
+                               i386_jcc(I386_CC_A, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
+                                       /* op1 = target JavaVM pc, val.l = constant   */
+
+                       /* TODO: optimize as in IF_LEQ */
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l >> 32, REG_SP, src->regoff * 8 + 4);
+                               i386_jcc(I386_CC_G, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 6;
+                               CALCREGOFFBYTES(a, src->regoff);
+                               CALCIMMEDIATEBYTES(a, iptr->val.l);
+
+                               i386_jcc(I386_CC_L, a);
+
+                               i386_alu_imm_membase(I386_CMP, iptr->val.l, REG_SP, src->regoff * 8);
+                               i386_jcc(I386_CC_AE, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_ACMPEQ:    /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPEQ:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
+                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
+                       }                       
+                       i386_jcc(I386_CC_E, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
+               case ICMD_IF_ACMPNE:    /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPNE:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_XOR, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_reg(I386_OR, REG_ITMP2, REG_ITMP1);
+                               i386_test_reg_reg(REG_ITMP1, REG_ITMP1);
+                       }                       
+                       i386_jcc(I386_CC_NE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_L, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPLT:    /* ..., value, value ==> ...                  */
+                                   /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 3 + 6;
+                               CALCREGOFFBYTES(a, src->prev->regoff);
+                               CALCREGOFFBYTES(a, src->regoff);
+
+                               i386_jcc(I386_CC_G, a);
+
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_jcc(I386_CC_B, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_G, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPGT:    /* ..., value, value ==> ...                  */
+                                /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                               i386_jcc(I386_CC_G, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 3 + 6;
+                               CALCREGOFFBYTES(a, src->prev->regoff);
+                               CALCREGOFFBYTES(a, src->regoff);
+
+                               i386_jcc(I386_CC_L, a);
+
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_jcc(I386_CC_A, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_LE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPLE:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 3 + 6;
+                               CALCREGOFFBYTES(a, src->prev->regoff);
+                               CALCREGOFFBYTES(a, src->regoff);
+
+                               i386_jcc(I386_CC_G, a);
+
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_jcc(I386_CC_BE, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
+                                       /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(I386_CMP, REG_ITMP1, REG_SP, src->prev->regoff * 8);
+
+                       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, src->prev->regoff);
+
+                       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_alu_reg_membase(I386_CMP, src->regoff, REG_SP, src->prev->regoff * 8);
+
+                       } else {
+                               i386_alu_reg_reg(I386_CMP, src->regoff, src->prev->regoff);
+                       }
+                       i386_jcc(I386_CC_GE, 0);
+                       codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       break;
+
+               case ICMD_IF_LCMPGE:    /* ..., value, value ==> ...                  */
+                                   /* op1 = target JavaVM pc                     */
+
+                       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8 + 4, REG_ITMP1);
+                               i386_jcc(I386_CC_G, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+
+                               a = 3 + 3 + 6;
+                               CALCREGOFFBYTES(a, src->prev->regoff);
+                               CALCREGOFFBYTES(a, src->regoff);
+
+                               i386_jcc(I386_CC_L, a);
+
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(I386_CMP, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_jcc(I386_CC_AE, 0);
+                               codegen_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
+                       }                       
+                       break;
+
+               /* (value xx 0) ? IFxx_ICONST : ELSE_ICONST                           */
+
+               case ICMD_ELSE_ICONST:  /* handled by IFxx_ICONST                     */
+                       break;
+
+               case ICMD_IFEQ_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_NE, src, iptr);
+                       break;
+
+               case ICMD_IFNE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_E, src, iptr);
+                       break;
+
+               case ICMD_IFLT_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_GE, src, iptr);
+                       break;
+
+               case ICMD_IFGE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_L, src, iptr);
+                       break;
+
+               case ICMD_IFGT_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_LE, src, iptr);
+                       break;
+
+               case ICMD_IFLE_ICONST:  /* ..., value ==> ..., constant               */
+                                       /* val.i = constant                           */
+
+                       d = reg_of_var(iptr->dst, REG_NULL);
+                       i386_emit_ifcc_iconst(I386_CC_G, src, iptr);
+                       break;
+
+
+               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
+               case ICMD_ARETURN:
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+                       var_to_reg_int(s1, src, REG_RESULT);
+                       M_INTMOVE(s1, REG_RESULT);
+                       goto nowperformreturn;
+
+               case ICMD_LRETURN:      /* ..., retvalue ==> ...                      */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+                       if (src->flags & INMEMORY) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_RESULT);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_RESULT2);
+
+                       } else {
+                               panic("LRETURN: longs have to be in memory");
+                       }
+                       goto nowperformreturn;
+
+               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+                       var_to_reg_flt(s1, src, REG_FRESULT);
+                       /* this may be an early return -- keep the offset correct for the remaining code */
+                       fpu_st_offset--;
+                       goto nowperformreturn;
+
+               case ICMD_DRETURN:      /* ..., retvalue ==> ...                      */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+                       var_to_reg_flt(s1, src, REG_FRESULT);
+                       /* this may be an early return -- keep the offset correct for the remaining code */
+                       fpu_st_offset--;
+                       goto nowperformreturn;
+
+               case ICMD_RETURN:      /* ...  ==> ...                                */
+
+#ifdef USE_THREADS
+                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
+                               i386_mov_membase_reg(REG_SP, 8 * maxmemuse, REG_ITMP1);
+                               i386_alu_imm_reg(I386_SUB, 4, REG_SP);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, 0);
+                               i386_mov_imm_reg((s4) builtin_monitorexit, REG_ITMP1);
+                               i386_call_reg(REG_ITMP1);
+                               i386_alu_imm_reg(I386_ADD, 4, REG_SP);
+                       }
+#endif
+
+nowperformreturn:
+                       {
+                       int r, p;
+                       
+                       p = parentargs_base;
+                       
+                       /* restore saved registers                                        */
+                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--) {
+                               p--;
+                               i386_mov_membase_reg(REG_SP, p * 8, savintregs[r]);
+                       }
+                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--) {
+                               p--;
+                               i386_fldl_membase(REG_SP, p * 8);
+                               fpu_st_offset++;
+                               if (iptr->opc == ICMD_FRETURN || iptr->opc == ICMD_DRETURN) {
+                                       i386_fstp_reg(savfltregs[r] + fpu_st_offset + 1);
+                               } else {
+                                       i386_fstp_reg(savfltregs[r] + fpu_st_offset);
+                               }
+                               fpu_st_offset--;
+                       }
+
+                       /* deallocate stack                                               */
+                       if (parentargs_base) {
+                               i386_alu_imm_reg(I386_ADD, parentargs_base * 8, REG_SP);
+                       }
+
+                       /* call trace function */
+                       if (runverbose) {
+                               i386_alu_imm_reg(I386_SUB, 4 + 8 + 8 + 4, REG_SP);
+
+                               i386_mov_imm_membase((s4) method, REG_SP, 0);
+
+                               i386_mov_reg_membase(REG_RESULT, REG_SP, 4);
+                               i386_mov_reg_membase(REG_RESULT2, REG_SP, 4 + 4);
+                               
+                               i386_fstl_membase(REG_SP, 4 + 8);
+                               i386_fsts_membase(REG_SP, 4 + 8 + 8);
+
+                               i386_mov_imm_reg((s4) builtin_displaymethodstop, REG_ITMP1);
+/*                             i386_mov_imm_reg(asm_builtin_exittrace, REG_ITMP1); */
+                               i386_call_reg(REG_ITMP1);
+
+                               i386_mov_membase_reg(REG_SP, 4, REG_RESULT);
+                               i386_mov_membase_reg(REG_SP, 4 + 4, REG_RESULT2);
+
+                               i386_alu_imm_reg(I386_ADD, 4 + 8 + 8 + 4, REG_SP);
+                       }
+
+                       i386_ret();
+                       ALIGNCODENOP;
+                       }
+                       break;
+
+
+               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
+                       {
+                               s4 i, l, *s4ptr;
+                               void **tptr;
+
+                               tptr = (void **) iptr->target;
+
+                               s4ptr = iptr->val.a;
+                               l = s4ptr[1];                          /* low     */
+                               i = s4ptr[2];                          /* high    */
+
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               M_INTMOVE(s1, REG_ITMP1);
+                               if (l != 0) {
+                                       i386_alu_imm_reg(I386_SUB, l, REG_ITMP1);
+                               }
+                               i = i - l + 1;
+
+                /* range check */
+
+                               i386_alu_imm_reg(I386_CMP, i - 1, REG_ITMP1);
+                               i386_jcc(I386_CC_A, 0);
+
+                /* codegen_addreference(BlockPtrOfPC(s4ptr[0]), mcodeptr); */
+                               codegen_addreference((basicblock *) tptr[0], mcodeptr);
+
+                               /* build jump table top down and use address of lowest entry */
+
+                /* s4ptr += 3 + i; */
+                               tptr += i;
+
+                               while (--i >= 0) {
+                                       /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
+                                       dseg_addtarget((basicblock *) tptr[0]); 
+                                       --tptr;
+                               }
+
+                               /* length of dataseg after last dseg_addtarget is used by load */
+
+                               i386_mov_imm_reg(0, REG_ITMP2);
+                               dseg_adddata(mcodeptr);
+                               i386_mov_memindex_reg(-dseglen, REG_ITMP2, REG_ITMP1, 2, REG_ITMP1);
+                               i386_jmp_reg(REG_ITMP1);
+                               ALIGNCODENOP;
+                       }
+                       break;
+
+
+               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
+                       {
+                               s4 i, l, val, *s4ptr;
+                               void **tptr;
+
+                               tptr = (void **) iptr->target;
+
+                               s4ptr = iptr->val.a;
+                               l = s4ptr[0];                          /* default  */
+                               i = s4ptr[1];                          /* count    */
+                       
+                               MCODECHECK((i<<2)+8);
+                               var_to_reg_int(s1, src, REG_ITMP1);    /* reg compare should always be faster */
+                               while (--i >= 0) {
+                                       s4ptr += 2;
+                                       ++tptr;
+
+                                       val = s4ptr[0];
+                                       i386_alu_imm_reg(I386_CMP, val, s1);
+                                       i386_jcc(I386_CC_E, 0);
+                                       /* codegen_addreference(BlockPtrOfPC(s4ptr[1]), mcodeptr); */
+                                       codegen_addreference((basicblock *) tptr[0], mcodeptr); 
+                               }
+
+                               i386_jmp_imm(0);
+                               /* codegen_addreference(BlockPtrOfPC(l), mcodeptr); */
+                       
+                               tptr = (void **) iptr->target;
+                               codegen_addreference((basicblock *) tptr[0], mcodeptr);
+
+                               ALIGNCODENOP;
+                       }
+                       break;
+
+
+               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 3;
+                       goto gen_method;
+
+               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 2;
+                       goto gen_method;
+
+               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
+                                       /* op1 = return type, val.a = function pointer*/
+                       s3 = 1;
+                       goto gen_method;
+
+               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
+                                       /* op1 = arg count, val.a = method pointer    */
+
+                       s3 = iptr->op1;
+
+gen_method: {
+                       methodinfo   *m;
+                       classinfo    *ci;
+
+                       MCODECHECK((s3 << 1) + 64);
+
+                       /* copy arguments to registers or stack location                  */
+
+                       for (; --s3 >= 0; src = src->prev) {
+                               if (src->varkind == ARGVAR) {
+                                       continue;
+                               }
+
+                               if (IS_INT_LNG_TYPE(src->type)) {
+                                       if (s3 < intreg_argnum) {
+                                               panic("No integer argument registers available!");
+
+                                       } else {
+                                               if (!IS_2_WORD_TYPE(src->type)) {
+                                                       if (src->flags & INMEMORY) {
+                                                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, s3 * 8);
+
+                                                       } else {
+                                                               i386_mov_reg_membase(src->regoff, REG_SP, s3 * 8);
+                                                       }
+
+                                               } else {
+                                                       if (src->flags & INMEMORY) {
+                                                               M_LNGMEMMOVE(src->regoff, s3);
+
+                                                       } else {
+                                                               panic("copy arguments: longs have to be in memory");
+                                                       }
+                                               }
+                                       }
+
+                               } else {
+                                       if (s3 < fltreg_argnum) {
+                                               panic("No float argument registers available!");
+
+                                       } else {
+                                               var_to_reg_flt(d, src, REG_FTMP1);
+                                               if (src->type == TYPE_FLT) {
+                                                       i386_fstps_membase(REG_SP, s3 * 8);
+
+                                               } else {
+                                                       i386_fstpl_membase(REG_SP, s3 * 8);
+                                               }
+                                       }
+                               }
+                       } /* end of for */
+
+                       m = iptr->val.a;
+                       switch (iptr->opc) {
+                               case ICMD_BUILTIN3:
+                               case ICMD_BUILTIN2:
+                               case ICMD_BUILTIN1:
+
+                                       a = (s4) m;
+                                       d = iptr->op1;
+
+                                       i386_mov_imm_reg(a, REG_ITMP1);
+                                       i386_call_reg(REG_ITMP1);
+                                       break;
+
+                               case ICMD_INVOKESTATIC:
+
+                                       a = (s4) m->stubroutine;
+                                       d = m->returntype;
+
+                                       i386_mov_imm_reg(a, REG_ITMP2);
+                                       i386_call_reg(REG_ITMP2);
+                                       break;
+
+                               case ICMD_INVOKESPECIAL:
+
+                                       a = (s4) m->stubroutine;
+                                       d = m->returntype;
+
+                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
+                                       gen_nullptr_check(REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, 0, REG_ITMP1);    /* access memory for hardware nullptr */
+
+                                       i386_mov_imm_reg(a, REG_ITMP2);
+                                       i386_call_reg(REG_ITMP2);
+                                       break;
+
+                               case ICMD_INVOKEVIRTUAL:
+
+                                       d = m->returntype;
+
+                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
+                                       gen_nullptr_check(REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(java_objectheader, vftbl), REG_ITMP2);
+                                       i386_mov_membase32_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + sizeof(methodptr) * m->vftblindex, REG_ITMP1);
+
+                                       i386_call_reg(REG_ITMP1);
+                                       break;
+
+                               case ICMD_INVOKEINTERFACE:
+
+                                       ci = m->class;
+                                       d = m->returntype;
+
+                                       i386_mov_membase_reg(REG_SP, 0, REG_ITMP1);
+                                       gen_nullptr_check(REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - sizeof(methodptr) * ci->index, REG_ITMP2);
+                                       i386_mov_membase32_reg(REG_ITMP2, sizeof(methodptr) * (m - ci->methods), REG_ITMP1);
+
+                                       i386_call_reg(REG_ITMP1);
+                                       break;
+
+                               default:
+                                       d = 0;
+                                       sprintf(logtext, "Unkown ICMD-Command: %d", iptr->opc);
+                                       error();
+                               }
+
+                       /* d contains return type */
+
+                       if (d != TYPE_VOID) {
+                               d = reg_of_var(iptr->dst, REG_NULL);
+
+                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
+                                       if (IS_2_WORD_TYPE(iptr->dst->type)) {
+                                               if (iptr->dst->flags & INMEMORY) {
+                                                       i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+                                                       i386_mov_reg_membase(REG_RESULT2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                                               } else {
+                                                       panic("RETURN: longs have to be in memory");
+                                               }
+
+                                       } else {
+                                               if (iptr->dst->flags & INMEMORY) {
+                                                       i386_mov_reg_membase(REG_RESULT, REG_SP, iptr->dst->regoff * 8);
+
+                                               } else {
+                                                       M_INTMOVE(REG_RESULT, iptr->dst->regoff);
+                                               }
+                                       }
+
+                               } else {
+                                       /* fld from called function -- has other fpu_st_offset counter */
+                                       fpu_st_offset++;
+                                       store_reg_to_var_flt(iptr->dst, d);
+                               }
+                       }
+                       }
+                       break;
+
+
+               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
+
+                                     /* op1:   0 == array, 1 == class                */
+                                     /* val.a: (classinfo*) superclass               */
+
+/*          superclass is an interface:
+ *
+ *          return (sub != NULL) &&
+ *                 (sub->vftbl->interfacetablelength > super->index) &&
+ *                 (sub->vftbl->interfacetable[-super->index] != NULL);
+ *
+ *          superclass is a class:
+ *
+ *          return ((sub != NULL) && (0
+ *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
+ *                  super->vftbl->diffvall));
+ */
+
+                       {
+                       classinfo *super = (classinfo*) iptr->val.a;
+                       
+                       var_to_reg_int(s1, src, REG_ITMP1);
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       if (s1 == d) {
+                               M_INTMOVE(s1, REG_ITMP1);
+                               s1 = REG_ITMP1;
+                       }
+                       i386_alu_reg_reg(I386_XOR, d, d);
+                       if (iptr->op1) {                               /* class/interface */
+                               if (super->flags & ACC_INTERFACE) {        /* interface       */
+                                       i386_test_reg_reg(s1, s1);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 2;
+                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetablelength));
+                                       
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, super->index);
+                                       
+                                       a += 3;
+                                       a += 6;
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
+
+                                       a += 3;
+
+                                       a += 6;    /* jcc */
+                                       a += 5;
+
+                                       i386_jcc(I386_CC_E, a);
+
+                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetablelength), REG_ITMP2);
+                                       i386_alu_imm_reg(I386_SUB, super->index, REG_ITMP2);
+                                       /* TODO: test */
+                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 0;
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
+
+                                       a += 3;
+
+                                       a += 6;    /* jcc */
+                                       a += 5;
+
+                                       i386_jcc(I386_CC_LE, a);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*), REG_ITMP1);
+                                       /* TODO: test */
+                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP1);
+/*                                     i386_setcc_reg(I386_CC_A, d); */
+/*                                     i386_jcc(I386_CC_BE, 5); */
+                                       i386_jcc(I386_CC_E, 5);
+                                       i386_mov_imm_reg(1, d);
+                                       
+
+                               } else {                                   /* class           */
+                                       i386_test_reg_reg(s1, s1);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 2;
+                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
+                                       a += 5;
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+                                       
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
+                                       
+                                       a += 2;
+                                       a += 2;    /* xor */
+
+                                       a += 2;
+
+                                       a += 6;    /* jcc */
+                                       a += 5;
+
+                                       i386_jcc(I386_CC_E, a);
+
+                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, baseval), REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP3);
+                                       i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
+                                       i386_alu_reg_reg(I386_SUB, REG_ITMP3, REG_ITMP1);
+                                       i386_alu_reg_reg(I386_XOR, d, d);
+                                       i386_alu_reg_reg(I386_CMP, REG_ITMP2, REG_ITMP1);
+                                       i386_jcc(I386_CC_A, 5);
+                                       i386_mov_imm_reg(1, d);
+                               }
+                       }
+                       else
+                               panic ("internal error: no inlined array instanceof");
+                       }
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
+
+                                     /* op1:   0 == array, 1 == class                */
+                                     /* val.a: (classinfo*) superclass               */
+
+/*          superclass is an interface:
+ *
+ *          OK if ((sub == NULL) ||
+ *                 (sub->vftbl->interfacetablelength > super->index) &&
+ *                 (sub->vftbl->interfacetable[-super->index] != NULL));
+ *
+ *          superclass is a class:
+ *
+ *          OK if ((sub == NULL) || (0
+ *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
+ *                 super->vftbl->diffvall));
+ */
+
+                       {
+                       classinfo *super = (classinfo*) iptr->val.a;
+                       
+                       d = reg_of_var(iptr->dst, REG_ITMP3);
+                       var_to_reg_int(s1, src, d);
+                       if (iptr->op1) {                               /* class/interface */
+                               if (super->flags & ACC_INTERFACE) {        /* interface       */
+                                       i386_test_reg_reg(s1, s1);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 2;
+                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetablelength));
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, super->index);
+
+                                       a += 3;
+                                       a += 6;
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
+
+                                       a += 3;
+                                       a += 6;
+
+                                       i386_jcc(I386_CC_E, a);
+
+                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetablelength), REG_ITMP2);
+                                       i386_alu_imm_reg(I386_SUB, super->index, REG_ITMP2);
+                                       /* TODO: test */
+                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
+                                       i386_jcc(I386_CC_LE, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*), REG_ITMP2);
+                                       /* TODO: test */
+                                       i386_alu_imm_reg(I386_CMP, 0, REG_ITMP2);
+                                       i386_jcc(I386_CC_E, 0);
+                                       codegen_addxcastrefs(mcodeptr);
+
+                               } else {                                     /* class           */
+                                       i386_test_reg_reg(s1, s1);
+
+                                       /* TODO: clean up this calculation */
+                                       a = 2;
+                                       CALCOFFSETBYTES(a, OFFSET(java_objectheader, vftbl));
+
+                                       a += 5;
+
+                                       a += 2;
+                                       CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+
+                                       if (d != REG_ITMP3) {
+                                               a += 2;
+                                               CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+                                               
+                                               a += 2;
+                                               CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
+
+                                               a += 2;
+                                               
+                                       } else {
+                                               a += 2;
+                                               CALCOFFSETBYTES(a, OFFSET(vftbl, baseval));
+
+                                               a += 2;
+
+                                               a += 5;
+
+                                               a += 2;
+                                               CALCOFFSETBYTES(a, OFFSET(vftbl, diffval));
+                                       }
+
+                                       a += 2;
+
+                                       a += 6;
+
+                                       i386_jcc(I386_CC_E, a);
+
+                                       i386_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
+                                       i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
+                                       i386_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, baseval), REG_ITMP1);
+                                       if (d != REG_ITMP3) {
+                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP3);
+                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
+                                               i386_alu_reg_reg(I386_SUB, REG_ITMP3, REG_ITMP1);
+
+                                       } else {
+                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP2);
+                                               i386_alu_reg_reg(I386_SUB, REG_ITMP2, REG_ITMP1);
+                                               i386_mov_imm_reg((s4) super->vftbl, REG_ITMP2);
+                                               i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
+                                       }
+                                       i386_alu_reg_reg(I386_CMP, REG_ITMP2, REG_ITMP1);
+                                       i386_jcc(I386_CC_A, 0);    /* (u) REG_ITMP1 > (u) REG_ITMP2 -> jump */
+                                       codegen_addxcastrefs(mcodeptr);
+                               }
+
+                       } else
+                               panic ("internal error: no inlined array checkcast");
+                       }
+                       M_INTMOVE(s1, d);
+                       store_reg_to_var_int(iptr->dst, d);
+                       break;
+
+               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
+
+                       if (src->flags & INMEMORY) {
+                               i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+                               
+                       } else {
+                               i386_test_reg_reg(src->regoff, src->regoff);
+                       }
+                       i386_jcc(I386_CC_L, 0);
+                       codegen_addxcheckarefs(mcodeptr);
+                       break;
+
+               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
+                                     /* op1 = dimension, val.a = array descriptor    */
+
+                       /* check for negative sizes and copy sizes to stack if necessary  */
+
+                       MCODECHECK((iptr->op1 << 1) + 64);
+
+                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
+                               if (src->flags & INMEMORY) {
+                                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+                               } else {
+                                       i386_test_reg_reg(src->regoff, src->regoff);
+                               }
+                               i386_jcc(I386_CC_L, 0);
+                               codegen_addxcheckarefs(mcodeptr);
+
+                               /* 
+                                * copy sizes to new stack location, be cause native function
+                                * builtin_nmultianewarray access them as (int *)
+                                */
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, -(iptr->op1 - s1) * 4);
+
+                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
+
+                               if (src->varkind != ARGVAR) {
+                                       if (src->flags & INMEMORY) {
+                                               i386_mov_membase_reg(REG_SP, (src->regoff + intreg_argnum) * 8, REG_ITMP1);
+                                               i386_mov_reg_membase(REG_ITMP1, REG_SP, (s1 + intreg_argnum) * 8);
+
+                                       } else {
+                                               i386_mov_reg_membase(src->regoff, REG_SP, (s1 + intreg_argnum) * 8);
+                                       }
+                               }
+                       }
+                       i386_alu_imm_reg(I386_SUB, iptr->op1 * 4, REG_SP);
+
+                       /* a0 = dimension count */
+
+                       /* save stack pointer */
+                       M_INTMOVE(REG_SP, REG_ITMP1);
+
+                       i386_alu_imm_reg(I386_SUB, 12, REG_SP);
+                       i386_mov_imm_membase(iptr->op1, REG_SP, 0);
+
+                       /* a1 = arraydescriptor */
+
+                       i386_mov_imm_membase((s4) iptr->val.a, REG_SP, 4);
+
+                       /* a2 = pointer to dimensions = stack pointer */
+
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, 8);
+
+                       i386_mov_imm_reg((s4) (builtin_nmultianewarray), REG_ITMP1);
+                       i386_call_reg(REG_ITMP1);
+                       i386_alu_imm_reg(I386_ADD, 12 + iptr->op1 * 4, REG_SP);
+
+                       s1 = reg_of_var(iptr->dst, REG_RESULT);
+                       M_INTMOVE(REG_RESULT, s1);
+                       store_reg_to_var_int(iptr->dst, s1);
+                       break;
+
+
+               default: sprintf (logtext, "Unknown pseudo command: %d", iptr->opc);
+                        error();
+       
+   
+
+       } /* switch */
+               
+       } /* for instruction */
+               
+       /* copy values to interface registers */
+
+       src = bptr->outstack;
+       len = bptr->outdepth;
+       MCODECHECK(64+len);
+       while (src) {
+               len--;
+               if ((src->varkind != STACKVAR)) {
+                       s2 = src->type;
+                       if (IS_FLT_DBL_TYPE(s2)) {
+                               var_to_reg_flt(s1, src, REG_FTMP1);
+                               if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                       M_FLTMOVE(s1,interfaces[len][s2].regoff);
+
+                               } else {
+                                       panic("double store");
+/*                                     M_DST(s1, REG_SP, 8 * interfaces[len][s2].regoff); */
+                               }
+
+                       } else {
+                               var_to_reg_int(s1, src, REG_ITMP1);
+                               if (!IS_2_WORD_TYPE(interfaces[len][s2].type)) {
+                                       if (!(interfaces[len][s2].flags & INMEMORY)) {
+                                               M_INTMOVE(s1, interfaces[len][s2].regoff);
+
+                                       } else {
+                                               i386_mov_reg_membase(s1, REG_SP, interfaces[len][s2].regoff * 8);
+                                       }
+
+                               } else {
+                                       if (interfaces[len][s2].flags & INMEMORY) {
+                                               M_LNGMEMMOVE(s1, interfaces[len][s2].regoff);
+
+                                       } else {
+                                               panic("copy interface registers: longs have to be in memory (end)");
+                                       }
+                               }
+                       }
+               }
+               src = src->prev;
+       }
+       } /* if (bptr -> flags >= BBREACHED) */
+       } /* for basic block */
+
+       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
+
+       {
+
+       /* generate bound check stubs */
+       u1 *xcodeptr = NULL;
+       
+       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
+                               xboundrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+                       }
+
+
+               gen_resolvebranch((u1*) mcodebase + xboundrefs->branchpos, 
+                                 xboundrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xboundrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+
+               } else {
+                       xcodeptr = mcodeptr;
+
+                       i386_mov_imm_reg((s4) proto_java_lang_ArrayIndexOutOfBoundsException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+
+       /* generate negative array size check stubs */
+       xcodeptr = NULL;
+       
+       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
+                               xcheckarefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+                       }
+
+               gen_resolvebranch((u1*) mcodebase + xcheckarefs->branchpos, 
+                                 xcheckarefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xcheckarefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+
+               } else {
+                       xcodeptr = mcodeptr;
+
+                       i386_mov_imm_reg((s4) proto_java_lang_NegativeArraySizeException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+
+       /* generate cast check stubs */
+       xcodeptr = NULL;
+       
+       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
+                               xcastrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+               }
+
+               gen_resolvebranch((u1*) mcodebase + xcastrefs->branchpos, 
+                                 xcastrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xcastrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+               
+               } else {
+                       xcodeptr = mcodeptr;
+
+                       i386_mov_imm_reg((s4) proto_java_lang_ClassCastException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+
+       /* generate divide by zero check stubs */
+       xcodeptr = NULL;
+       
+       for (; xdivrefs != NULL; xdivrefs = xdivrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xdivrefs->branchpos, 
+                               xdivrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+               }
+
+               gen_resolvebranch((u1*) mcodebase + xdivrefs->branchpos, 
+                                 xdivrefs->branchpos, (u1*) mcodeptr - mcodebase);
+
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xdivrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+               
+               } else {
+                       xcodeptr = mcodeptr;
+
+                       i386_mov_imm_reg((s4) proto_java_lang_ArithmeticException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+
+       /* generate null pointer check stubs */
+       xcodeptr = NULL;
+       
+       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
+               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+                       gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
+                                                         xnullrefs->branchpos, (u1*) xcodeptr - (u1*) mcodebase - (5 + 5 + 2));
+                       continue;
+               }
+
+               gen_resolvebranch((u1*) mcodebase + xnullrefs->branchpos, 
+                                                 xnullrefs->branchpos, (u1*) mcodeptr - mcodebase);
+               
+               MCODECHECK(8);
+
+               i386_mov_imm_reg(0, REG_ITMP2_XPC);    /* 5 bytes */
+               dseg_adddata(mcodeptr);
+               i386_mov_imm_reg(xnullrefs->branchpos - 6, REG_ITMP1);    /* 5 bytes */
+               i386_alu_reg_reg(I386_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 2 bytes */
+               
+               if (xcodeptr != NULL) {
+                       i386_jmp_imm(((u1 *) xcodeptr - (u1 *) mcodeptr) - 5);
+                       
+               } else {
+                       xcodeptr = mcodeptr;
+                       
+                       i386_mov_imm_reg((s4) proto_java_lang_NullPointerException, REG_ITMP1_XPTR);
+                       i386_mov_imm_reg((s4) asm_handle_exception, I386_EDI);
+                       i386_jmp_reg(I386_EDI);
+               }
+       }
+       }
+
+       codegen_finish((int)((u1*) mcodeptr - mcodebase));
+}
+
+
+/* function createcompilerstub *************************************************
+
+   creates a stub routine which calls the compiler
+       
+*******************************************************************************/
+
+#define COMPSTUBSIZE 12
+
+u1 *createcompilerstub(methodinfo *m)
+{
+    u1 *s = CNEW(u1, COMPSTUBSIZE);     /* memory to hold the stub            */
+    mcodeptr = s;                       /* code generation pointer            */
+
+    /* code for the stub */
+    i386_mov_imm_reg((s4) m, REG_ITMP1);/* pass method pointer to compiler    */
+
+       /* we use EDI cause EDX (REG_ITMP2) is used for patching */
+    i386_mov_imm_reg((s4) asm_call_jit_compiler, I386_EDI);   /* load address */
+    i386_jmp_reg(I386_EDI);             /* jump to compiler                   */
+
+#ifdef STATISTICS
+    count_cstub_len += COMPSTUBSIZE;
+#endif
+
+    return (u1*) s;
+}
+
+
+/* function removecompilerstub *************************************************
+
+     deletes a compilerstub from memory  (simply by freeing it)
+
+*******************************************************************************/
+
+void removecompilerstub(u1 *stub) 
+{
+    CFREE(stub, COMPSTUBSIZE);
+}
+
+/* function: createnativestub **************************************************
+
+       creates a stub routine which calls a native method
+
+*******************************************************************************/
+
+#define NATIVESTUBSIZE 320
+
+u1 *createnativestub(functionptr f, methodinfo *m)
+{
+    u1 *s = CNEW(u1, NATIVESTUBSIZE);   /* memory to hold the stub            */
+
+    u1 *tptr;
+    int i;
+    int stackframesize = 4;           /* initial 4 bytes is space for jni env */
+    int stackframeoffset = 4;
+
+    int p, t;
+
+    mcodeptr = s;                       /* make macros work                   */
+
+    reg_init();
+    
+    descriptor2types(m);                     /* set paramcount and paramtypes */
+
+    if (runverbose) {
+        i386_alu_imm_reg(I386_SUB, TRACE_ARGS_NUM * 8 + 4, REG_SP);
+        
+        for (p = 0; p < m->paramcount; p++) {
+            t = m->paramtypes[p];
+            if (IS_INT_LNG_TYPE(t)) {
+                if (IS_2_WORD_TYPE(t)) {
+                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4 + 4, REG_ITMP2);
+
+                } else if (t == TYPE_ADR) {
+                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                    i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+
+                } else {
+                    i386_mov_membase_reg(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4, REG_ITMP1);
+                    i386_cltd();
+                }
+                i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
+                i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
+
+            } else {
+                if (t == TYPE_FLT) {
+                    i386_flds_membase(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4);
+                    i386_fstps_membase(REG_SP, p * 8);
+                    i386_alu_reg_reg(I386_XOR, REG_ITMP2, REG_ITMP2);
+                    i386_mov_reg_membase(REG_ITMP2, REG_SP, p * 8 + 4);
+
+                } else {
+                    i386_fldl_membase(REG_SP, 4 + (TRACE_ARGS_NUM + p) * 8 + 4);
+                    i386_fstpl_membase(REG_SP, p * 8);
+                }
+            }
+        }
+
+               
+        i386_alu_reg_reg(I386_XOR, REG_ITMP1, REG_ITMP1);
+        for (p = m->paramcount; p < TRACE_ARGS_NUM; p++) {
+            i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8);
+            i386_mov_reg_membase(REG_ITMP1, REG_SP, p * 8 + 4);
+        }
+
+        i386_mov_imm_membase((s4) m, REG_SP, TRACE_ARGS_NUM * 8);
+
+        i386_mov_imm_reg((s4) asm_builtin_trace, REG_ITMP1);
+        i386_call_reg(REG_ITMP1);
+
+        i386_alu_imm_reg(I386_ADD, TRACE_ARGS_NUM * 8 + 4, REG_SP);
+    }
+
+    /*
+        * mark the whole fpu stack as free for native functions
+        * (only for saved register count == 0)
+        */
+    i386_ffree_reg(0);
+    i386_ffree_reg(1);
+    i386_ffree_reg(2);
+    i386_ffree_reg(3);
+    i386_ffree_reg(4);
+    i386_ffree_reg(5);
+    i386_ffree_reg(6);
+    i386_ffree_reg(7);
+
+       /*
+        * calculate stackframe size for native function
+        */
+    tptr = m->paramtypes;
+    for (i = 0; i < m->paramcount; i++) {
+        switch (*tptr++) {
+        case TYPE_INT:
+        case TYPE_FLT:
+        case TYPE_ADR:
+            stackframesize += 4;
+            break;
+
+        case TYPE_LNG:
+        case TYPE_DBL:
+            stackframesize += 8;
+            break;
+
+        default:
+            panic("unknown parameter type in native function");
+        }
+    }
+
+    i386_alu_imm_reg(I386_SUB, stackframesize, REG_SP);
+
+    tptr = m->paramtypes;
+    for (i = 0; i < m->paramcount; i++) {
+        switch (*tptr++) {
+        case TYPE_INT:
+        case TYPE_FLT:
+        case TYPE_ADR:
+            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8, REG_ITMP1);
+            i386_mov_reg_membase(REG_ITMP1, REG_SP, stackframeoffset);
+            stackframeoffset += 4;
+            break;
+
+        case TYPE_LNG:
+        case TYPE_DBL:
+            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8, REG_ITMP1);
+            i386_mov_membase_reg(REG_SP, stackframesize + (1 * 4) + i * 8 + 4, REG_ITMP2);
+            i386_mov_reg_membase(REG_ITMP1, REG_SP, stackframeoffset);
+            i386_mov_reg_membase(REG_ITMP2, REG_SP, stackframeoffset + 4);
+            stackframeoffset += 8;
+            break;
+
+        default:
+            panic("unknown parameter type in native function");
+        }
+    }
+
+    i386_mov_imm_membase((s4) &env, REG_SP, 0);
+    i386_mov_imm_reg((s4) f, REG_ITMP1);
+    i386_call_reg(REG_ITMP1);
+    i386_alu_imm_reg(I386_ADD, stackframesize, REG_SP);
+
+    if (runverbose) {
+        i386_alu_imm_reg(I386_SUB, 4 + 8 + 8 + 4, REG_SP);
+               
+        i386_mov_imm_membase((s4) m, REG_SP, 0);
+               
+        i386_mov_reg_membase(REG_RESULT, REG_SP, 4);
+        i386_mov_reg_membase(REG_RESULT2, REG_SP, 4 + 4);
+               
+        i386_fstl_membase(REG_SP, 4 + 8);
+        i386_fsts_membase(REG_SP, 4 + 8 + 8);
+               
+        i386_mov_imm_reg((s4) asm_builtin_exittrace, REG_ITMP1);
+        i386_call_reg(REG_ITMP1);
+               
+        i386_mov_membase_reg(REG_SP, 4, REG_RESULT);
+        i386_mov_membase_reg(REG_SP, 4 + 4, REG_RESULT2);
+               
+        i386_alu_imm_reg(I386_ADD, 4 + 8 + 8 + 4, REG_SP);
+    }
+
+       /* we can use EDI cause it's not preserved across function calls */
+       i386_mov_imm_reg((s4) &exceptionptr, I386_EDI);
+       i386_mov_membase_reg(I386_EDI, 0, I386_EDI);
+       i386_test_reg_reg(I386_EDI, I386_EDI);
+       i386_jcc(I386_CC_NE, 1);
+
+       i386_ret();
+
+       i386_mov_reg_reg(I386_EDI, REG_ITMP1_XPTR);
+       i386_mov_imm_reg((s4) &exceptionptr, I386_EDI);
+       i386_mov_imm_membase(0, I386_EDI, 0);
+       i386_mov_membase_reg(REG_SP, 0, REG_ITMP2_XPC);
+       i386_alu_imm_reg(I386_SUB, 2, REG_ITMP2_XPC);
+
+       i386_mov_imm_reg((s4) asm_handle_nat_exception, I386_EDI);
+       i386_jmp_reg(I386_EDI);
+
+#ifdef STATISTICS
+       count_nstub_len += NATIVESTUBSIZE;
+#endif
+
+       return (u1*) s;
+}
+
+/* function: removenativestub **************************************************
+
+    removes a previously created native-stub from memory
+    
+*******************************************************************************/
+
+void removenativestub(u1 *stub)
+{
+    CFREE(stub, NATIVESTUBSIZE);
+}
+
+
+
+void i386_emit_ialu(s4 alu_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                       } else if (src->prev->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_alu_reg_membase(alu_op, src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_reg(alu_op, src->prev->regoff, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->prev->regoff == iptr->dst->regoff) {
+                               i386_alu_reg_membase(alu_op, src->regoff, REG_SP, iptr->dst->regoff * 8);
+                                               
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_alu_reg_reg(alu_op, src->regoff, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else {
+                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+                       i386_alu_reg_membase(alu_op, src->regoff, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+                       i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                       i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, iptr->dst->regoff);
+
+               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                       i386_alu_membase_reg(alu_op, REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+
+               } else {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_alu_reg_reg(alu_op, src->prev->regoff, iptr->dst->regoff);
+
+                       } else {
+                               M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                               i386_alu_reg_reg(alu_op, src->regoff, iptr->dst->regoff);
+                       }
+               }
+       }
+}
+
+
+
+void i386_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if (src->flags & INMEMORY) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_alu_imm_membase(alu_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_imm_reg(alu_op, iptr->val.i, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else {
+                       i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+                       i386_alu_imm_membase(alu_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else {
+               if (src->flags & INMEMORY) {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+                       i386_alu_imm_reg(alu_op, iptr->val.i, iptr->dst->regoff);
+
+               } else {
+                       M_INTMOVE(src->regoff, iptr->dst->regoff);
+                       i386_alu_imm_reg(alu_op, iptr->val.i, iptr->dst->regoff);
+               }
+       }
+}
+
+
+
+void i386_emit_lalu(s4 alu_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_alu_reg_membase(alu_op, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else if (src->prev->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_alu_reg_membase(alu_op, REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_alu_membase_reg(alu_op, REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+               }
+       }
+}
+
+
+
+void i386_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if (src->flags & INMEMORY) {
+                       if (src->regoff == iptr->dst->regoff) {
+                               i386_alu_imm_membase(alu_op, iptr->val.l, REG_SP, iptr->dst->regoff * 8);
+                               i386_alu_imm_membase(alu_op, iptr->val.l >> 32, REG_SP, iptr->dst->regoff * 8 + 4);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8 + 4, REG_ITMP2);
+                               i386_alu_imm_reg(alu_op, iptr->val.l, REG_ITMP1);
+                               i386_alu_imm_reg(alu_op, iptr->val.l >> 32, REG_ITMP2);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                               i386_mov_reg_membase(REG_ITMP2, REG_SP, iptr->dst->regoff * 8 + 4);
+                       }
+               }
+       }
+}
+
+
+
+void i386_emit_ishift(s4 shift_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->prev->regoff == iptr->dst->regoff) {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                               i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_shift_reg(shift_op, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+                       i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
+
+               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       if (src->prev->regoff == iptr->dst->regoff) {
+                               M_INTMOVE(src->regoff, I386_ECX);
+                               i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
+
+                       } else {
+                               M_INTMOVE(src->regoff, I386_ECX);
+                               i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
+                               i386_shift_reg(shift_op, REG_ITMP1);
+                               i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+                       }
+
+               } else {
+                       M_INTMOVE(src->regoff, I386_ECX);
+                       i386_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
+                       i386_shift_membase(shift_op, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else {
+               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+                       i386_shift_reg(shift_op, iptr->dst->regoff);
+
+               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, I386_ECX);
+                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                       i386_shift_reg(shift_op, iptr->dst->regoff);
+
+               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
+                       M_INTMOVE(src->regoff, I386_ECX);
+                       i386_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
+                       i386_shift_reg(shift_op, iptr->dst->regoff);
+
+               } else {
+                       M_INTMOVE(src->regoff, I386_ECX);
+                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
+                       i386_shift_reg(shift_op, iptr->dst->regoff);
+               }
+       }
+}
+
+
+
+void i386_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr)
+{
+       if ((src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
+               if (src->regoff == iptr->dst->regoff) {
+                       i386_shift_imm_membase(shift_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+               } else {
+                       i386_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
+                       i386_shift_imm_reg(shift_op, iptr->val.i, REG_ITMP1);
+                       i386_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else if ((src->flags & INMEMORY) && !(iptr->dst->flags & INMEMORY)) {
+               i386_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
+               i386_shift_imm_reg(shift_op, iptr->val.i, iptr->dst->regoff);
+                               
+       } else if (!(src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
+               i386_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
+               i386_shift_imm_membase(shift_op, iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+       } else {
+               M_INTMOVE(src->regoff, iptr->dst->regoff);
+               i386_shift_imm_reg(shift_op, iptr->val.i, iptr->dst->regoff);
+       }
+}
+
+
+
+void i386_emit_ifcc_iconst(s4 if_op, stackptr src, instruction *iptr)
+{
+       if (iptr->dst->flags & INMEMORY) {
+               int offset = 0;
+
+               if (src->flags & INMEMORY) {
+                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+               } else {
+                       i386_test_reg_reg(src->regoff, src->regoff);
+               }
+
+               offset += 7;
+               CALCOFFSETBYTES(offset, iptr->dst->regoff * 8);
+       
+               i386_jcc(if_op, offset + (iptr[1].opc == ICMD_ELSE_ICONST) ? 5 + offset : 0);
+               i386_mov_imm_membase(iptr->val.i, REG_SP, iptr->dst->regoff * 8);
+
+               if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                       i386_jmp_imm(offset);
+                       i386_mov_imm_membase(iptr[1].val.i, REG_SP, iptr->dst->regoff * 8);
+               }
+
+       } else {
+               if (src->flags & INMEMORY) {
+                       i386_alu_imm_membase(I386_CMP, 0, REG_SP, src->regoff * 8);
+
+               } else {
+                       i386_test_reg_reg(src->regoff, src->regoff);
+               }
+
+               i386_jcc(if_op, (iptr[1].opc == ICMD_ELSE_ICONST) ? 10 : 5);
+               i386_mov_imm_reg(iptr->val.i, iptr->dst->regoff);
+
+               if ((iptr[1].opc == ICMD_ELSE_ICONST)) {
+                       i386_jmp_imm(5);
+                       i386_mov_imm_reg(iptr[1].val.i, iptr->dst->regoff);
+               }
+       }
+}
+
+
+
+#if 1
+
+/*
+ * mov ops
+ */
+void i386_mov_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x89;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_mov_imm_reg(s4 imm, s4 reg) {
+       *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07);
+       i386_emit_imm32((imm));
+}
+
+
+void i386_movb_imm_reg(s4 imm, s4 reg) {
+       *(mcodeptr++) = (u1) 0xc6;
+       i386_emit_reg(0,(reg));
+       i386_emit_imm8((imm));
+}
+
+
+void i386_mov_membase_reg(s4 basereg, s4 disp, s4 reg) {
+       *(mcodeptr++) = (u1) 0x8b;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+/*
+ * this one is for INVOKEVIRTUAL/INVOKEINTERFACE to have a
+ * constant membase immediate length of 32bit
+ */
+void i386_mov_membase32_reg(s4 basereg, s4 disp, s4 reg) {
+       *(mcodeptr++) = (u1) 0x8b;
+       i386_address_byte(2, (reg), (basereg));
+       i386_emit_imm32((disp));
+}
+
+
+void i386_mov_reg_membase(s4 reg, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0x89;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+void i386_mov_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
+       *(mcodeptr++) = (u1) 0x8b;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_mov_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0x89;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_movw_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0x66;
+       *(mcodeptr++) = (u1) 0x89;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_movb_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0x88;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_mov_imm_membase(s4 imm, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xc7;
+       i386_emit_membase((basereg),(disp),0);
+       i386_emit_imm32((imm));
+}
+
+
+void i386_movsbl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xbe;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_movswl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xbf;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_movzwl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xb7;
+       i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
+}
+
+
+
+/*
+ * alu operations
+ */
+void i386_alu_reg_reg(s4 opc, s4 reg, s4 dreg) {
+       *(mcodeptr++) = (((u1) (opc)) << 3) + 1;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_alu_reg_membase(s4 opc, s4 reg, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (((u1) (opc)) << 3) + 1;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+void i386_alu_membase_reg(s4 opc, s4 basereg, s4 disp, s4 reg) {
+       *(mcodeptr++) = (((u1) (opc)) << 3) + 3;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+void i386_alu_imm_reg(s4 opc, s4 imm, s4 dreg) {
+       if (i386_is_imm8(imm)) { 
+               *(mcodeptr++) = (u1) 0x83;
+               i386_emit_reg((opc),(dreg));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x81;
+               i386_emit_reg((opc),(dreg));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_alu_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp) {
+       if (i386_is_imm8(imm)) { 
+               *(mcodeptr++) = (u1) 0x83;
+               i386_emit_membase((basereg),(disp),(opc));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x81;
+               i386_emit_membase((basereg),(disp),(opc));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_test_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x85;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_test_imm_reg(s4 imm, s4 reg) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_reg(0,(reg));
+       i386_emit_imm32((imm));
+}
+
+
+
+/*
+ * inc, dec operations
+ */
+void i386_inc_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0x40 + ((reg) & 0x07);
+}
+
+
+void i386_inc_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xff;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_dec_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0x48 + ((reg) & 0x07);
+}
+
+                
+void i386_dec_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xff;
+       i386_emit_membase((basereg),(disp),1);
+}
+
+
+
+void i386_cltd() {
+       *(mcodeptr++) = (u1) 0x99;
+}
+
+
+
+void i386_imul_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xaf;
+       i386_emit_reg((dreg),(reg));
+}
+
+
+void i386_imul_membase_reg(s4 basereg, s4 disp, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xaf;
+       i386_emit_membase((basereg),(disp),(dreg));
+}
+
+
+void i386_imul_imm_reg(s4 imm, s4 dreg) {
+       if (i386_is_imm8((imm))) { 
+               *(mcodeptr++) = (u1) 0x6b;
+               i386_emit_reg(0,(dreg));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x69;
+               i386_emit_reg(0,(dreg));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_imul_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
+       if (i386_is_imm8((imm))) { 
+               *(mcodeptr++) = (u1) 0x6b;
+               i386_emit_reg((dreg),(reg));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x69;
+               i386_emit_reg((dreg),(reg));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_imul_imm_membase_reg(s4 imm, s4 basereg, s4 disp, s4 dreg) {
+       if (i386_is_imm8((imm))) { 
+               *(mcodeptr++) = (u1) 0x6b;
+               i386_emit_membase((basereg),(disp),(dreg));
+               i386_emit_imm8((imm));
+       } else { 
+               *(mcodeptr++) = (u1) 0x69;
+               i386_emit_membase((basereg),(disp),(dreg));
+               i386_emit_imm32((imm));
+       } 
+}
+
+
+void i386_mul_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_membase((basereg),(disp),4);
+}
+
+
+void i386_idiv_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_reg(7,(reg));
+}
+
+
+
+void i386_ret() {
+       *(mcodeptr++) = (u1) 0xc3;
+}
+
+
+
+/*
+ * shift ops
+ */
+void i386_shift_reg(s4 opc, s4 reg) {
+       *(mcodeptr++) = (u1) 0xd3;
+       i386_emit_reg((opc),(reg));
+}
+
+
+void i386_shift_membase(s4 opc, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd3;
+       i386_emit_membase((basereg),(disp),(opc));
+}
+
+
+void i386_shift_imm_reg(s4 opc, s4 imm, s4 dreg) {
+       if ((imm) == 1) { 
+               *(mcodeptr++) = (u1) 0xd1;
+               i386_emit_reg((opc),(dreg));
+       } else { 
+               *(mcodeptr++) = (u1) 0xc1;
+               i386_emit_reg((opc),(dreg));
+               i386_emit_imm8((imm));
+       } 
+}
+
+
+void i386_shift_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp) {
+       if ((imm) == 1) { 
+               *(mcodeptr++) = (u1) 0xd1;
+               i386_emit_membase((basereg),(disp),(opc));
+       } else { 
+               *(mcodeptr++) = (u1) 0xc1;
+               i386_emit_membase((basereg),(disp),(opc));
+               i386_emit_imm8((imm));
+       } 
+}
+
+
+void i386_shld_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xa5;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_shld_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xa4;
+       i386_emit_reg((reg),(dreg));
+       i386_emit_imm8((imm));
+}
+
+
+void i386_shld_reg_membase(s4 reg, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xa5;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+void i386_shrd_reg_reg(s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xad;
+       i386_emit_reg((reg),(dreg));
+}
+
+
+void i386_shrd_imm_reg_reg(s4 imm, s4 reg, s4 dreg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xac;
+       i386_emit_reg((reg),(dreg));
+       i386_emit_imm8((imm));
+}
+
+
+void i386_shrd_reg_membase(s4 reg, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) 0xad;
+       i386_emit_membase((basereg),(disp),(reg));
+}
+
+
+
+/*
+ * jump operations
+ */
+void i386_jmp_imm(s4 imm) {
+       *(mcodeptr++) = (u1) 0xe9;
+       i386_emit_imm32((imm));
+}
+
+
+void i386_jmp_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xff;
+       i386_emit_reg(4,(reg));
+}
+
+
+void i386_jcc(s4 opc, s4 imm) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) (0x80 + i386_jcc_map[(opc)]);
+       i386_emit_imm32((imm));
+}
+
+
+
+/*
+ * conditional set operations
+ */
+void i386_setcc_reg(s4 opc, s4 reg) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]);
+       i386_emit_reg(0,(reg));
+}
+
+
+void i386_setcc_membase(s4 opc, s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0x0f;
+       *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]);
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+
+void i386_neg_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_reg(3,(reg));
+}
+
+
+void i386_neg_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xf7;
+       i386_emit_membase((basereg),(disp),3);
+}
+
+
+
+void i386_push_imm(s4 imm) {
+       *(mcodeptr++) = (u1) 0x68;
+       i386_emit_imm32((imm));
+}
+
+
+void i386_pop_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0x58 + (0x07 & (reg));
+}
+
+
+void i386_nop() {
+       *(mcodeptr++) = (u1) 0x90;
+}
+
+
+/*
+ * call instructions
+ */
+void i386_call_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xff;
+       i386_emit_reg(2,(reg));
+}
+
+
+void i386_call_imm(s4 imm) {
+       *(mcodeptr++) = (u1) 0xe8;
+       i386_emit_imm32((imm));
+}
+
+
+
+/*
+ * floating point instructions
+ */
+void i386_fld1() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xe8;
+}
+
+
+void i386_fldz() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xee;
+}
+
+
+void i386_fld_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg));
+}
+
+
+void i386_flds_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_fldl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_fldt_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),5);
+}
+
+
+void i386_flds_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fldl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale));
+}
+
+
+
+
+void i386_fildl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_fildll_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdf;
+       i386_emit_membase((basereg),(disp),5);
+}
+
+
+
+
+void i386_fst_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xd0 + (0x07 & (reg));
+}
+
+
+void i386_fsts_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_membase((basereg),(disp),2);
+}
+
+
+void i386_fstl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_membase((basereg),(disp),2);
+}
+
+
+void i386_fsts_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fstl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fstp_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xd8 + (0x07 & (reg));
+}
+
+
+void i386_fstps_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_membase((basereg),(disp),3);
+}
+
+
+void i386_fstpl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_membase((basereg),(disp),3);
+}
+
+
+void i386_fstpt_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),7);
+}
+
+
+void i386_fstps_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fstpl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale) {
+       *(mcodeptr++) = (u1) 0xdd;
+       i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale));
+}
+
+
+void i386_fistl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),2);
+}
+
+
+void i386_fistpl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdb;
+       i386_emit_membase((basereg),(disp),3);
+}
+
+
+void i386_fistpll_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdf;
+       i386_emit_membase((basereg),(disp),7);
+}
+
+
+void i386_fchs() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xe0;
+}
+
+
+void i386_faddp() {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xc1;
+}
+
+
+void i386_fadd_reg_st(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd8;
+       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
+}
+
+
+void i386_fadd_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdc;
+       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
+}
+
+
+void i386_faddp_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg));
+}
+
+
+void i386_fadds_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd8;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_faddl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdc;
+       i386_emit_membase((basereg),(disp),0);
+}
+
+
+void i386_fsub_reg_st(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd8;
+       *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg));
+}
+
+
+void i386_fsub_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdc;
+       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
+}
+
+
+void i386_fsubp_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
+}
+
+
+void i386_fsubp() {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xe9;
+}
+
+
+void i386_fsubs_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd8;
+       i386_emit_membase((basereg),(disp),4);
+}
+
+
+void i386_fsubl_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdc;
+       i386_emit_membase((basereg),(disp),4);
+}
+
+
+void i386_fmul_reg_st(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd8;
+       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
+}
+
+
+void i386_fmul_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdc;
+       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
+}
+
+
+void i386_fmulp() {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xc9;
+}
+
+
+void i386_fmulp_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
+}
+
+
+void i386_fmuls_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd8;
+       i386_emit_membase((basereg),(disp),1);
+}
+
+
+void i386_fmull_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xdc;
+       i386_emit_membase((basereg),(disp),1);
+}
+
+
+void i386_fdiv_reg_st(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd8;
+       *(mcodeptr++) = (u1) 0xf0 + (0x07 & (reg));
+}
+
+
+void i386_fdiv_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdc;
+       *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg));
+}
+
+
+void i386_fdivp() {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xf9;
+}
+
+
+void i386_fdivp_st_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xde;
+       *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg));
+}
+
+
+void i386_fxch() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xc9;
+}
+
+
+void i386_fxch_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg));
+}
+
+
+void i386_fprem() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xf8;
+}
+
+
+void i386_fprem1() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xf5;
+}
+
+
+void i386_fucom() {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xe1;
+}
+
+
+void i386_fucom_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg));
+}
+
+
+void i386_fucomp_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg));
+}
+
+
+void i386_fucompp() {
+       *(mcodeptr++) = (u1) 0xda;
+       *(mcodeptr++) = (u1) 0xe9;
+}
+
+
+void i386_fnstsw() {
+       *(mcodeptr++) = (u1) 0xdf;
+       *(mcodeptr++) = (u1) 0xe0;
+}
+
+
+void i386_sahf() {
+       *(mcodeptr++) = (u1) 0x9e;
+}
+
+
+void i386_finit() {
+       *(mcodeptr++) = (u1) 0x9b;
+       *(mcodeptr++) = (u1) 0xdb;
+       *(mcodeptr++) = (u1) 0xe3;
+}
+
+
+void i386_fldcw_mem(s4 mem) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_mem(5,(mem));
+}
+
+
+void i386_fldcw_membase(s4 basereg, s4 disp) {
+       *(mcodeptr++) = (u1) 0xd9;
+       i386_emit_membase((basereg),(disp),5);
+}
+
+
+void i386_wait() {
+       *(mcodeptr++) = (u1) 0x9b;
+}
+
+
+void i386_ffree_reg(s4 reg) {
+       *(mcodeptr++) = (u1) 0xdd;
+       *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg));
+}
+
+
+void i386_fdecstp() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xf6;
+}
+
+
+void i386_fincstp() {
+       *(mcodeptr++) = (u1) 0xd9;
+       *(mcodeptr++) = (u1) 0xf7;
+}
+
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/i386/codegen.h b/src/vm/jit/i386/codegen.h
new file mode 100644 (file)
index 0000000..96f6c39
--- /dev/null
@@ -0,0 +1,1683 @@
+/* jit/i386/codegen.h - code generation macros and definitions for i386
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Christian Thalinger
+
+   $Id: codegen.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _CODEGEN_H
+#define _CODEGEN_H
+
+#include "jit.h"
+
+
+/* define x86 register numbers */
+#define I386_EAX    0
+#define I386_ECX    1
+#define I386_EDX    2
+#define I386_EBX    3
+#define I386_ESP    4
+#define I386_EBP    5
+#define I386_ESI    6
+#define I386_EDI    7
+
+
+/* preallocated registers *****************************************************/
+
+/* integer registers */
+  
+#define REG_RESULT      I386_EAX /* to deliver method results                 */
+#define REG_RESULT2     I386_EDX /* to deliver long method results            */
+
+#define REG_ITMP1       I386_EAX /* temporary register                        */
+#define REG_ITMP2       I386_EDX /* temporary register and method pointer     */
+#define REG_ITMP3       I386_ECX /* temporary register                        */
+
+#define REG_NULL        -1       /* used for reg_of_var where d is not needed */
+
+#define REG_ITMP1_XPTR  I386_EAX /* exception pointer = temporary register 1  */
+#define REG_ITMP2_XPC   I386_EDX /* exception pc = temporary register 2       */
+
+#define REG_SP          I386_ESP /* stack pointer                             */
+
+/* floating point registers */
+
+#define REG_FRESULT     0    /* to deliver floating point method results      */
+#define REG_FTMP1       6    /* temporary floating point register             */
+#define REG_FTMP2       7    /* temporary floating point register             */
+#define REG_FTMP3       7    /* temporary floating point register             */
+
+/* register descripton - array ************************************************/
+
+/* #define REG_RES   0         reserved register for OS or code generator     */
+/* #define REG_RET   1         return value register                          */
+/* #define REG_EXC   2         exception value register (only old jit)        */
+/* #define REG_SAV   3         (callee) saved register                        */
+/* #define REG_TMP   4         scratch temporary register (caller saved)      */
+/* #define REG_ARG   5         argument register (caller saved)               */
+
+/* #define REG_END   -1        last entry in tables */
+
+int nregdescint[] = {
+    REG_RET, REG_RES, REG_RES, REG_SAV, REG_RES, REG_SAV, REG_TMP, REG_TMP,
+    REG_END };
+
+/* for use of reserved registers, see comment above */
+
+int nregdescfloat[] = {
+  /* rounding problems with callee saved registers */
+/*      REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_RES, REG_RES, */
+/*      REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, */
+    REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
+    REG_END };
+
+/* for use of reserved registers, see comment above */
+
+
+/* stackframe-infos ***********************************************************/
+
+int parentargs_base; /* offset in stackframe for the parameter from the caller*/
+
+/* -> see file 'calling.doc' */
+
+
+static u1 fpu_in_24bit_mode = 0;
+
+static u2 fpu_ctrlwrd_24bit = 0x007f;    /* Round to nearest, 24-bit mode, exceptions masked */
+static u2 fpu_ctrlwrd_53bit = 0x027f;    /* Round to nearest, 53-bit mode, exceptions masked */
+
+static u4 subnormal_bias1[3] = { 0x00000000, 0x80000000, 0x03ff };    /* 2^(-15360) */
+static u4 subnormal_bias2[3] = { 0x00000000, 0x80000000, 0x7bff };    /* 2^(+15360) */
+
+
+/* macros to create code ******************************************************/
+
+/*
+ * immediate data union
+ */
+typedef union {
+    s4 i;
+    s8 l;
+    float f;
+    double d;
+    void *a;
+    u1 b[8];
+} i386_imm_buf;
+
+
+typedef enum {
+    I386_AL = 0,
+    I386_CL = 1,
+    I386_DL = 2,
+    I386_BL = 3,
+    I386_AH = 4,
+    I386_CH = 5,
+    I386_DH = 6,
+    I386_BH = 7,
+    I386_NREGB
+} I386_RegB_No;
+
+
+/*
+ * opcodes for alu instructions
+ */
+typedef enum {
+    I386_ADD = 0,
+    I386_OR  = 1,
+    I386_ADC = 2,
+    I386_SBB = 3,
+    I386_AND = 4,
+    I386_SUB = 5,
+    I386_XOR = 6,
+    I386_CMP = 7,
+    I386_NALU
+} I386_ALU_Opcode;
+
+typedef enum {
+    I386_ROL = 0,
+    I386_ROR = 1,
+    I386_RCL = 2,
+    I386_RCR = 3,
+    I386_SHL = 4,
+    I386_SHR = 5,
+    I386_SAR = 7,
+    I386_NSHIFT = 8
+} I386_Shift_Opcode;
+
+typedef enum {
+    I386_CC_O = 0,
+    I386_CC_NO = 1,
+    I386_CC_B = 2, I386_CC_C = 2, I386_CC_NAE = 2,
+    I386_CC_BE = 6, I386_CC_NA = 6,
+    I386_CC_AE = 3, I386_CC_NB = 3, I386_CC_NC = 3,
+    I386_CC_E = 4, I386_CC_Z = 4,
+    I386_CC_NE = 5, I386_CC_NZ = 5,
+    I386_CC_A = 7, I386_CC_NBE = 7,
+    I386_CC_S = 8, I386_CC_LZ = 8,
+    I386_CC_NS = 9, I386_CC_GEZ = 9,
+    I386_CC_P = 0x0a, I386_CC_PE = 0x0a,
+    I386_CC_NP = 0x0b, I386_CC_PO = 0x0b,
+    I386_CC_L = 0x0c, I386_CC_NGE = 0x0c,
+    I386_CC_GE = 0x0d, I386_CC_NL = 0x0d,
+    I386_CC_LE = 0x0e, I386_CC_NG = 0x0e,
+    I386_CC_G = 0x0f, I386_CC_NLE = 0x0f,
+    I386_NCC
+} I386_CC;
+
+static const unsigned char i386_jcc_map[] = {
+    0x00, /* o  */
+    0x01, /* no */
+    0x02, /* b, lt  */
+    0x03, /* ae */
+    0x04, /* e  */
+    0x05, /* ne */
+    0x06, /* be */
+    0x07, /* a  */
+    0x08, /* s  */
+    0x09, /* ns */
+    0x0a, /* p  */
+    0x0b, /* np */
+    0x0c, /* l  */
+    0x0d, /* ge */
+    0x0e, /* le */
+    0x0f  /* g  */
+};
+
+
+
+/*
+ * modrm and stuff
+ */
+#define i386_address_byte(mod, reg, rm) \
+    *(mcodeptr++) = ((((mod) & 0x03) << 6) | (((reg) & 0x07) << 3) | (((rm) & 0x07)));
+
+
+#define i386_emit_reg(reg,rm) \
+    i386_address_byte(3,(reg),(rm));
+
+
+#define i386_is_imm8(imm) \
+    (((int)(imm) >= -128 && (int)(imm) <= 127))
+
+
+#define i386_emit_imm8(imm) \
+    *(mcodeptr++) = (u1) ((imm) & 0xff);
+
+
+#define i386_emit_imm16(imm) \
+    do { \
+        i386_imm_buf imb; \
+        imb.i = (int) (imm); \
+        *(mcodeptr++) = imb.b[0]; \
+        *(mcodeptr++) = imb.b[1]; \
+    } while (0)
+
+
+#define i386_emit_imm32(imm) \
+    do { \
+        i386_imm_buf imb; \
+        imb.i = (int) (imm); \
+        *(mcodeptr++) = imb.b[0]; \
+        *(mcodeptr++) = imb.b[1]; \
+        *(mcodeptr++) = imb.b[2]; \
+        *(mcodeptr++) = imb.b[3]; \
+    } while (0)
+
+
+#define i386_emit_mem(r,disp) \
+    do { \
+        i386_address_byte(0,(r),5); \
+        i386_emit_imm32((disp)); \
+    } while (0)
+
+
+#define i386_emit_membase(basereg,disp,dreg) \
+    do { \
+        if ((basereg) == I386_ESP) { \
+            if ((disp) == 0) { \
+                i386_address_byte(0, (dreg), I386_ESP); \
+                i386_address_byte(0, I386_ESP, I386_ESP); \
+            } else if (i386_is_imm8((disp))) { \
+                i386_address_byte(1, (dreg), I386_ESP); \
+                i386_address_byte(0, I386_ESP, I386_ESP); \
+                i386_emit_imm8((disp)); \
+            } else { \
+                i386_address_byte(2, (dreg), I386_ESP); \
+                i386_address_byte(0, I386_ESP, I386_ESP); \
+                i386_emit_imm32((disp)); \
+            } \
+            break; \
+        } \
+        \
+        if ((disp) == 0 && (basereg) != I386_EBP) { \
+            i386_address_byte(0, (dreg), (basereg)); \
+            break; \
+        } \
+        \
+        if (i386_is_imm8((disp))) { \
+            i386_address_byte(1, (dreg), (basereg)); \
+            i386_emit_imm8((disp)); \
+        } else { \
+            i386_address_byte(2, (dreg), (basereg)); \
+            i386_emit_imm32((disp)); \
+        } \
+    } while (0)
+
+
+#define i386_emit_memindex(reg,disp,basereg,indexreg,scale) \
+    do { \
+        if ((basereg) == -1) { \
+            i386_address_byte(0, (reg), 4); \
+            i386_address_byte((scale), (indexreg), 5); \
+            i386_emit_imm32((disp)); \
+        \
+        } else if ((disp) == 0 && (basereg) != I386_EBP) { \
+            i386_address_byte(0, (reg), 4); \
+            i386_address_byte((scale), (indexreg), (basereg)); \
+        \
+        } else if (i386_is_imm8((disp))) { \
+            i386_address_byte(1, (reg), 4); \
+            i386_address_byte((scale), (indexreg), (basereg)); \
+            i386_emit_imm8 ((disp)); \
+        \
+        } else { \
+            i386_address_byte(2, (reg), 4); \
+            i386_address_byte((scale), (indexreg), (basereg)); \
+            i386_emit_imm32((disp)); \
+        }    \
+     } while (0)
+
+
+
+void i386_emit_ialu(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_lalu(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_ishift(s4 shift_op, stackptr src, instruction *iptr);
+void i386_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr);
+void i386_emit_ifcc_iconst(s4 if_op, stackptr src, instruction *iptr);
+
+
+
+#if 0
+
+/*
+ * mov ops
+ */
+#define i386_mov_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_mov_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_movb_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc6; \
+        i386_emit_reg(0,(reg)); \
+        i386_emit_imm8((imm)); \
+    } while (0)
+
+
+#define i386_mov_float_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
+        i386_emit_float32((imm)); \
+    } while (0)
+
+
+#define i386_mov_reg_mem(reg,mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_mem((reg),(mem)); \
+    } while (0)
+
+
+#define i386_mov_mem_reg(mem,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_emit_mem((reg),(mem)); \
+    } while (0)
+
+
+#define i386_mov_membase_reg(basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+/*
+ * this one is for INVOKEVIRTUAL/INVOKEINTERFACE to have a
+ * constant membase immediate length of 32bit
+ */
+#define i386_mov_membase32_reg(basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_address_byte(2, (reg), (basereg)); \
+        i386_emit_imm32((disp)); \
+    } while (0)
+
+
+#define i386_movw_membase_reg(basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        i386_mov_membase_reg((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_movb_membase_reg(basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8a; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_mov_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_movw_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_movb_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x88; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_mov_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movw_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x8b; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movb_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x8a; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_mov_reg_memindex(reg,disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movw_reg_memindex(reg,disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x89; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movb_reg_memindex(reg,disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0x88; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_mov_imm_membase(imm,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc7; \
+        i386_emit_membase((basereg),(disp),0); \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_mov_float_membase(imm,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc7; \
+        i386_emit_membase((basereg),(disp),0); \
+        i386_emit_float32((imm)); \
+    } while (0)
+
+
+#define i386_mov_double_low_membase(imm,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc7; \
+        i386_emit_membase((basereg),(disp),0); \
+        i386_emit_double64_low((imm)); \
+    } while (0)
+
+
+#define i386_mov_double_high_membase(imm,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xc7; \
+        i386_emit_membase((basereg),(disp),0); \
+        i386_emit_double64_high((imm)); \
+    } while (0)
+
+
+#define i386_movsbl_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbe; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_movswl_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbf; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_movzbl_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb6; \
+        /* XXX: why do reg and dreg have to be exchanged */ \
+        i386_emit_reg((dreg),(reg)); \
+    } while (0)
+
+
+#define i386_movzwl_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb7; \
+        /* XXX: why do reg and dreg have to be exchanged */ \
+        i386_emit_reg((dreg),(reg)); \
+    } while (0)
+
+
+#define i386_movsbl_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbe; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movswl_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbf; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movzbl_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb6; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_movzwl_memindex_reg(disp,basereg,indexreg,scale,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb7; \
+        i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+
+/*
+ * alu operations
+ */
+#define i386_alu_reg_reg(opc,reg,dreg) \
+    do { \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_alu_reg_membase(opc,reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_alu_membase_reg(opc,basereg,disp,reg) \
+    do { \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 3; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_alu_imm_reg(opc,imm,dreg) \
+    do { \
+        if (i386_is_imm8(imm)) { \
+            *(mcodeptr++) = (u1) 0x83; \
+            i386_emit_reg((opc),(dreg)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x81; \
+            i386_emit_reg((opc),(dreg)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_alu_imm_membase(opc,imm,basereg,disp) \
+    do { \
+        if (i386_is_imm8(imm)) { \
+            *(mcodeptr++) = (u1) 0x83; \
+            i386_emit_membase((basereg),(disp),(opc)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x81; \
+            i386_emit_membase((basereg),(disp),(opc)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_test_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x85; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_test_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(0,(reg)); \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_testw_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(0,(reg)); \
+        i386_emit_imm16((imm)); \
+    } while (0)
+
+
+#define i386_testb_imm_reg(imm,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf6; \
+        i386_emit_reg(0,(reg)); \
+        i386_emit_imm8((imm)); \
+    } while (0)
+
+
+
+/*
+ * inc, dec operations
+ */
+#define i386_inc_reg(reg) \
+    *(mcodeptr++) = (u1) 0x40 + ((reg) & 0x07);
+
+
+#define i386_inc_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_dec_reg(reg) \
+    *(mcodeptr++) = (u1) 0x48 + ((reg) & 0x07);
+
+        
+#define i386_dec_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_membase((basereg),(disp),1); \
+    } while (0)
+
+
+
+
+#define i386_cltd() \
+    *(mcodeptr++) = (u1) 0x99;
+
+
+
+#define i386_imul_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xaf; \
+        i386_emit_reg((dreg),(reg)); \
+    } while (0)
+
+
+#define i386_imul_membase_reg(basereg,disp,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xaf; \
+        i386_emit_membase((basereg),(disp),(dreg)); \
+    } while (0)
+
+
+#define i386_imul_imm_reg(imm,dreg) \
+    do { \
+        if (i386_is_imm8((imm))) { \
+            *(mcodeptr++) = (u1) 0x6b; \
+            i386_emit_reg(0,(dreg)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x69; \
+            i386_emit_reg(0,(dreg)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_imul_imm_reg_reg(imm,reg,dreg) \
+    do { \
+        if (i386_is_imm8((imm))) { \
+            *(mcodeptr++) = (u1) 0x6b; \
+            i386_emit_reg((dreg),(reg)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x69; \
+            i386_emit_reg((dreg),(reg)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_imul_imm_membase_reg(imm,basereg,disp,dreg) \
+    do { \
+        if (i386_is_imm8((imm))) { \
+            *(mcodeptr++) = (u1) 0x6b; \
+            i386_emit_membase((basereg),(disp),(dreg)); \
+            i386_emit_imm8((imm)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0x69; \
+            i386_emit_membase((basereg),(disp),(dreg)); \
+            i386_emit_imm32((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_mul_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(4,(reg)); \
+    } while (0)
+
+
+#define i386_mul_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_membase((basereg),(disp),4); \
+    } while (0)
+
+
+#define i386_idiv_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(7,(reg)); \
+    } while (0)
+
+
+#define i386_idiv_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_membase((basereg),(disp),7); \
+    } while (0)
+
+
+
+#define i386_ret() \
+    *(mcodeptr++) = (u1) 0xc3;
+
+
+#define i386_leave() \
+    *(mcodeptr++) = (u1) 0xc9;
+
+
+
+/*
+ * shift ops
+ */
+#define i386_shift_reg(opc,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd3; \
+        i386_emit_reg((opc),(reg)); \
+    } while (0)
+
+
+#define i386_shift_membase(opc,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd3; \
+        i386_emit_membase((basereg),(disp),(opc)); \
+    } while (0)
+
+
+#define i386_shift_imm_reg(opc,imm,dreg) \
+    do { \
+        if ((imm) == 1) { \
+            *(mcodeptr++) = (u1) 0xd1; \
+            i386_emit_reg((opc),(dreg)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0xc1; \
+            i386_emit_reg((opc),(dreg)); \
+            i386_emit_imm8((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_shift_imm_membase(opc,imm,basereg,disp) \
+    do { \
+        if ((imm) == 1) { \
+            *(mcodeptr++) = (u1) 0xd1; \
+            i386_emit_membase((basereg),(disp),(opc)); \
+        } else { \
+            *(mcodeptr++) = (u1) 0xc1; \
+            i386_emit_membase((basereg),(disp),(opc)); \
+            i386_emit_imm8((imm)); \
+        } \
+    } while (0)
+
+
+#define i386_shld_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa5; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_shld_imm_reg_reg(imm,reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa4; \
+        i386_emit_reg((reg),(dreg)); \
+        i386_emit_imm8((imm)); \
+    } while (0)
+
+
+#define i386_shld_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa5; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+#define i386_shrd_reg_reg(reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xad; \
+        i386_emit_reg((reg),(dreg)); \
+    } while (0)
+
+
+#define i386_shrd_imm_reg_reg(imm,reg,dreg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xac; \
+        i386_emit_reg((reg),(dreg)); \
+        i386_emit_imm8((imm)); \
+    } while (0)
+
+
+#define i386_shrd_reg_membase(reg,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xad; \
+        i386_emit_membase((basereg),(disp),(reg)); \
+    } while (0)
+
+
+
+/*
+ * jump operations
+ */
+#define i386_jmp_imm(imm) \
+    do { \
+        *(mcodeptr++) = (u1) 0xe9; \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_jmp_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_reg(4,(reg)); \
+    } while (0)
+
+
+#define i386_jcc(opc,imm) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x80 + i386_jcc_map[(opc)]); \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+
+/*
+ * conditional set operations
+ */
+#define i386_setcc_reg(opc,reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
+        i386_emit_reg(0,(reg)); \
+    } while (0)
+
+
+#define i386_setcc_membase(opc,basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+
+#define i386_neg_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_reg(3,(reg)); \
+    } while (0)
+
+
+#define i386_neg_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_mem(3,(mem)); \
+    } while (0)
+
+
+#define i386_neg_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xf7; \
+        i386_emit_membase((basereg),(disp),3); \
+    } while (0)
+
+
+
+#define i386_push_reg(reg) \
+    *(mcodeptr++) = (u1) 0x50 + (0x07 & (reg));
+
+
+#define i386_push_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_membase((basereg),(disp),6); \
+    } while (0)
+
+
+#define i386_push_imm(imm) \
+    do { \
+        *(mcodeptr++) = (u1) 0x68; \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+#define i386_pop_reg(reg) \
+    *(mcodeptr++) = (u1) 0x58 + (0x07 & (reg));
+
+
+#define i386_nop() \
+    *(mcodeptr++) = (u1) 0x90;
+
+
+
+/*
+ * call instructions
+ */
+#define i386_call_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xff; \
+        i386_emit_reg(2,(reg)); \
+    } while (0)
+
+
+#define i386_call_imm(imm) \
+    do { \
+        *(mcodeptr++) = (u1) 0xe8; \
+        i386_emit_imm32((imm)); \
+    } while (0)
+
+
+
+/*
+ * floating point instructions
+ */
+#define i386_fld1() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xe8; \
+    } while (0)
+
+
+#define i386_fldz() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xee; \
+    } while (0)
+
+
+#define i386_fld_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_flds_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_mem(0,(mem)); \
+    } while (0)
+
+
+#define i386_fldl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_mem(0,(mem)); \
+    } while (0)
+
+
+#define i386_fldt_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_mem(5,(mem)); \
+    } while (0)
+
+
+#define i386_flds_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_fldl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_fldt_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),5); \
+    } while (0)
+
+
+#define i386_flds_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_fldl_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+
+
+#define i386_fildl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_mem(0,(mem)); \
+    } while (0)
+
+
+#define i386_fildl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_fildll_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdf; \
+        i386_emit_membase((basereg),(disp),5); \
+    } while (0)
+
+
+
+
+#define i386_fst_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xd0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fsts_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_mem(2,(mem)); \
+    } while (0)
+
+
+#define i386_fstl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_mem(2,(mem)); \
+    } while (0)
+
+
+#define i386_fsts_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_membase((basereg),(disp),2); \
+    } while (0)
+
+
+#define i386_fstl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_membase((basereg),(disp),2); \
+    } while (0)
+
+
+#define i386_fsts_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_fstl_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+
+
+#define i386_fstp_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xd8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fstps_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_mem(3,(mem)); \
+    } while (0)
+
+
+#define i386_fstpl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_mem(3,(mem)); \
+    } while (0)
+
+
+#define i386_fstps_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_membase((basereg),(disp),3); \
+    } while (0)
+
+
+#define i386_fstpl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_membase((basereg),(disp),3); \
+    } while (0)
+
+
+#define i386_fstpt_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),7); \
+    } while (0)
+
+
+#define i386_fstps_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+#define i386_fstpl_memindex(disp,basereg,indexreg,scale) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale)); \
+    } while (0)
+
+
+
+
+#define i386_fistpl_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_mem(3,(mem)); \
+    } while (0)
+
+
+#define i386_fistpll_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdf; \
+        i386_emit_mem(7,(mem)); \
+    } while (0)
+
+
+#define i386_fistl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),2); \
+    } while (0)
+
+
+#define i386_fistpl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdb; \
+        i386_emit_membase((basereg),(disp),3); \
+    } while (0)
+
+
+#define i386_fistpll_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdf; \
+        i386_emit_membase((basereg),(disp),7); \
+    } while (0)
+
+
+
+
+#define i386_fchs() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xe0; \
+    } while (0)
+
+
+#define i386_faddp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc1; \
+    } while (0)
+
+
+#define i386_fadd_reg_st(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
+    } while (0)
+
+
+#define i386_fadd_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
+    } while (0)
+
+
+#define i386_faddp_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
+    } while (0)
+
+
+#define i386_fadds_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_faddl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        i386_emit_membase((basereg),(disp),0); \
+    } while (0)
+
+
+#define i386_fsub_reg_st(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fsub_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fsubp_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fsubp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xe9; \
+    } while (0)
+
+
+#define i386_fsubs_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        i386_emit_membase((basereg),(disp),4); \
+    } while (0)
+
+
+#define i386_fsubl_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        i386_emit_membase((basereg),(disp),4); \
+    } while (0)
+
+
+#define i386_fmul_reg_st(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fmul_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fmulp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc9; \
+    } while (0)
+
+
+#define i386_fmulp_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fmuls_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        i386_emit_membase((basereg),(disp),1); \
+    } while (0)
+
+
+#define i386_fmull_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        i386_emit_membase((basereg),(disp),1); \
+    } while (0)
+
+
+#define i386_fdiv_reg_st(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xf0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fdiv_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fdivp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xf9; \
+    } while (0)
+
+
+#define i386_fdivp_st_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fxch() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc9; \
+    } while (0)
+
+
+#define i386_fxch_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fprem() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf8; \
+    } while (0)
+
+
+#define i386_fprem1() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf5; \
+    } while (0)
+
+
+#define i386_fucom() \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe1; \
+    } while (0)
+
+
+#define i386_fucom_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fucomp_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fucompp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xda; \
+        *(mcodeptr++) = (u1) 0xe9; \
+    } while (0)
+
+
+#define i386_fnstsw() \
+    do { \
+        *(mcodeptr++) = (u1) 0xdf; \
+        *(mcodeptr++) = (u1) 0xe0; \
+    } while (0)
+
+
+#define i386_sahf() \
+    *(mcodeptr++) = (u1) 0x9e;
+
+
+#define i386_finit() \
+    do { \
+        *(mcodeptr++) = (u1) 0x9b; \
+        *(mcodeptr++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xe3; \
+    } while (0)
+
+
+#define i386_fldcw_mem(mem) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_mem(5,(mem)); \
+    } while (0)
+
+
+#define i386_fldcw_membase(basereg,disp) \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        i386_emit_membase((basereg),(disp),5); \
+    } while (0)
+
+
+#define i386_wait() \
+    *(mcodeptr++) = (u1) 0x9b;
+
+
+#define i386_ffree_reg(reg) \
+    do { \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg)); \
+    } while (0)
+
+
+#define i386_fdecstp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf6; \
+    } while (0)
+
+
+#define i386_fincstp() \
+    do { \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf7; \
+    } while (0)
+
+#else
+
+/*
+ * integer instructions
+ */
+void i386_mov_reg_reg(s4 reg, s4 dreg);
+void i386_mov_imm_reg(s4 imm, s4 dreg);
+void i386_movb_imm_reg(s4 imm, s4 dreg);
+void i386_mov_membase_reg(s4 basereg, s4 disp, s4 reg);
+void i386_mov_membase32_reg(s4 basereg, s4 disp, s4 reg);
+void i386_mov_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_mov_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_mov_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_movw_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_movb_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_mov_imm_membase(s4 imm, s4 basereg, s4 disp);
+void i386_movsbl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_movswl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_movzwl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_alu_reg_reg(s4 opc, s4 reg, s4 dreg);
+void i386_alu_reg_membase(s4 opc, s4 reg, s4 basereg, s4 disp);
+void i386_alu_membase_reg(s4 opc, s4 basereg, s4 disp, s4 reg);
+void i386_alu_imm_reg(s4 opc, s4 imm, s4 reg);
+void i386_alu_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp);
+void i386_test_reg_reg(s4 reg, s4 dreg);
+void i386_test_imm_reg(s4 imm, s4 dreg);
+void i386_inc_reg(s4 reg);
+void i386_inc_membase(s4 basereg, s4 disp);
+void i386_dec_reg(s4 reg);
+void i386_dec_membase(s4 basereg, s4 disp);
+void i386_cltd();
+void i386_imul_reg_reg(s4 reg, s4 dreg);
+void i386_imul_membase_reg(s4 basereg, s4 disp, s4 dreg);
+void i386_imul_imm_reg(s4 imm, s4 reg);
+void i386_imul_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_imul_imm_membase_reg(s4 imm, s4 basereg, s4 disp, s4 dreg);
+void i386_mul_membase(s4 basereg, s4 disp);
+void i386_idiv_reg(s4 reg);
+void i386_ret();
+void i386_shift_reg(s4 opc, s4 reg);
+void i386_shift_membase(s4 opc, s4 basereg, s4 disp);
+void i386_shift_imm_reg(s4 opc, s4 imm, s4 reg);
+void i386_shift_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp);
+void i386_shld_reg_reg(s4 reg, s4 dreg);
+void i386_shld_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_shld_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_shrd_reg_reg(s4 reg, s4 dreg);
+void i386_shrd_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_shrd_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_jmp_imm(s4 imm);
+void i386_jmp_reg(s4 reg);
+void i386_jcc(s4 opc, s4 imm);
+void i386_setcc_reg(s4 opc, s4 reg);
+void i386_setcc_membase(s4 opc, s4 basereg, s4 disp);
+void i386_neg_reg(s4 reg);
+void i386_neg_membase(s4 basereg, s4 disp);
+void i386_push_imm(s4 imm);
+void i386_pop_reg(s4 reg);
+void i386_nop();
+void i386_call_reg(s4 reg);
+void i386_call_imm(s4 imm);
+
+
+
+/*
+ * floating point instructions
+ */
+void i386_fld1();
+void i386_fldz();
+void i386_fld_reg(s4 reg);
+void i386_flds_membase(s4 basereg, s4 disp);
+void i386_fldl_membase(s4 basereg, s4 disp);
+void i386_fldt_membase(s4 basereg, s4 disp);
+void i386_flds_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fldl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fildl_membase(s4 basereg, s4 disp);
+void i386_fildll_membase(s4 basereg, s4 disp);
+void i386_fst_reg(s4 reg);
+void i386_fsts_membase(s4 basereg, s4 disp);
+void i386_fstl_membase(s4 basereg, s4 disp);
+void i386_fsts_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstp_reg(s4 reg);
+void i386_fstps_membase(s4 basereg, s4 disp);
+void i386_fstpl_membase(s4 basereg, s4 disp);
+void i386_fstpt_membase(s4 basereg, s4 disp);
+void i386_fstps_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstpl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fistl_membase(s4 basereg, s4 disp);
+void i386_fistpl_membase(s4 basereg, s4 disp);
+void i386_fistpll_membase(s4 basereg, s4 disp);
+void i386_fchs();
+void i386_faddp();
+void i386_fadd_reg_st(s4 reg);
+void i386_fadd_st_reg(s4 reg);
+void i386_faddp_st_reg(s4 reg);
+void i386_fadds_membase(s4 basereg, s4 disp);
+void i386_faddl_membase(s4 basereg, s4 disp);
+void i386_fsub_reg_st(s4 reg);
+void i386_fsub_st_reg(s4 reg);
+void i386_fsubp_st_reg(s4 reg);
+void i386_fsubp();
+void i386_fsubs_membase(s4 basereg, s4 disp);
+void i386_fsubl_membase(s4 basereg, s4 disp);
+void i386_fmul_reg_st(s4 reg);
+void i386_fmul_st_reg(s4 reg);
+void i386_fmulp();
+void i386_fmulp_st_reg(s4 reg);
+void i386_fmuls_membase(s4 basereg, s4 disp);
+void i386_fmull_membase(s4 basereg, s4 disp);
+void i386_fdiv_reg_st(s4 reg);
+void i386_fdiv_st_reg(s4 reg);
+void i386_fdivp();
+void i386_fdivp_st_reg(s4 reg);
+void i386_fxch();
+void i386_fxch_reg(s4 reg);
+void i386_fprem();
+void i386_fprem1();
+void i386_fucom();
+void i386_fucom_reg(s4 reg);
+void i386_fucomp_reg(s4 reg);
+void i386_fucompp();
+void i386_fnstsw();
+void i386_sahf();
+void i386_finit();
+void i386_fldcw_mem(s4 mem);
+void i386_fldcw_membase(s4 basereg, s4 disp);
+void i386_wait();
+void i386_ffree_reg(s4 reg);
+void i386_fdecstp();
+void i386_fincstp();
+
+#endif
+
+
+
+/* function gen_resolvebranch **************************************************
+
+    backpatches a branch instruction
+
+    parameters: ip ... pointer to instruction after branch (void*)
+                so ... offset of instruction after branch  (s4)
+                to ... offset of branch target             (s4)
+
+*******************************************************************************/
+
+#define gen_resolvebranch(ip,so,to) \
+    *((void **) ((ip) - 4)) = (void **) ((to) - (so));
+
+#endif /* _CODEGEN_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/i386/dis-asm.h b/src/vm/jit/i386/dis-asm.h
new file mode 100644 (file)
index 0000000..2f3418e
--- /dev/null
@@ -0,0 +1,328 @@
+/* Interface between the opcode library and its callers.
+
+   Copyright 2001, 2002 Free Software Foundation, Inc.
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+   
+   Written by Cygnus Support, 1993.
+
+   The opcode library (libopcodes.a) provides instruction decoders for
+   a large variety of instruction sets, callable with an identical
+   interface, for making instruction-processing programs more independent
+   of the instruction set being processed.  */
+
+#ifndef DIS_ASM_H
+#define DIS_ASM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include "bfd.h"
+
+#include "types.h"
+#include "ansidecl.h"
+
+#define _(String) (String)
+
+typedef int (*fprintf_ftype) PARAMS((PTR, const char*, ...));
+
+enum dis_insn_type {
+  dis_noninsn,                 /* Not a valid instruction */
+  dis_nonbranch,               /* Not a branch instruction */
+  dis_branch,                  /* Unconditional branch */
+  dis_condbranch,              /* Conditional branch */
+  dis_jsr,                     /* Jump to subroutine */
+  dis_condjsr,                 /* Conditional jump to subroutine */
+  dis_dref,                    /* Data reference instruction */
+  dis_dref2                    /* Two data references in instruction */
+};
+
+/* This struct is passed into the instruction decoding routine, 
+   and is passed back out into each callback.  The various fields are used
+   for conveying information from your main routine into your callbacks,
+   for passing information into the instruction decoders (such as the
+   addresses of the callback functions), or for passing information
+   back from the instruction decoders to their callers.
+
+   It must be initialized before it is first passed; this can be done
+   by hand, or using one of the initialization macros below.  */
+
+typedef struct disassemble_info {
+  fprintf_ftype fprintf_func;
+  PTR stream;
+  PTR application_data;
+
+  /* Target description.  We could replace this with a pointer to the bfd,
+     but that would require one.  There currently isn't any such requirement
+     so to avoid introducing one we record these explicitly.  */
+  /* The bfd_flavour.  This can be bfd_target_unknown_flavour.  */
+  enum bfd_flavour flavour;
+  /* The bfd_arch value.  */
+  enum bfd_architecture arch;
+  /* The bfd_mach value.  */
+  unsigned long mach;
+  /* Endianness (for bi-endian cpus).  Mono-endian cpus can ignore this.  */
+  enum bfd_endian endian;
+  /* An arch/mach-specific bitmask of selected instruction subsets, mainly
+     for processors with run-time-switchable instruction sets.  The default,
+     zero, means that there is no constraint.  CGEN-based opcodes ports
+     may use ISA_foo masks.  */
+  unsigned long insn_sets;
+
+  /* Some targets need information about the current section to accurately
+     display insns.  If this is NULL, the target disassembler function
+     will have to make its best guess.  */
+  asection *section;
+
+  /* An array of pointers to symbols either at the location being disassembled
+     or at the start of the function being disassembled.  The array is sorted
+     so that the first symbol is intended to be the one used.  The others are
+     present for any misc. purposes.  This is not set reliably, but if it is
+     not NULL, it is correct.  */
+  asymbol **symbols;
+  /* Number of symbols in array.  */
+  int num_symbols;
+
+  /* For use by the disassembler.
+     The top 16 bits are reserved for public use (and are documented here).
+     The bottom 16 bits are for the internal use of the disassembler.  */
+  unsigned long flags;
+#define INSN_HAS_RELOC 0x80000000
+  PTR private_data;
+
+  /* Function used to get bytes to disassemble.  MEMADDR is the
+     address of the stuff to be disassembled, MYADDR is the address to
+     put the bytes in, and LENGTH is the number of bytes to read.
+     INFO is a pointer to this struct.
+     Returns an errno value or 0 for success.  */
+  int (*read_memory_func)
+    PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
+            struct disassemble_info *info));
+
+  /* Function which should be called if we get an error that we can't
+     recover from.  STATUS is the errno value from read_memory_func and
+     MEMADDR is the address that we were trying to read.  INFO is a
+     pointer to this struct.  */
+  void (*memory_error_func)
+    PARAMS ((int status, bfd_vma memaddr, struct disassemble_info *info));
+
+  /* Function called to print ADDR.  */
+  void (*print_address_func)
+    PARAMS ((bfd_vma addr, struct disassemble_info *info));
+
+  /* Function called to determine if there is a symbol at the given ADDR.
+     If there is, the function returns 1, otherwise it returns 0.
+     This is used by ports which support an overlay manager where
+     the overlay number is held in the top part of an address.  In
+     some circumstances we want to include the overlay number in the
+     address, (normally because there is a symbol associated with
+     that address), but sometimes we want to mask out the overlay bits.  */
+  int (* symbol_at_address_func)
+    PARAMS ((bfd_vma addr, struct disassemble_info * info));
+
+  /* These are for buffer_read_memory.  */
+  bfd_byte *buffer;
+  bfd_vma buffer_vma;
+  unsigned int buffer_length;
+
+  /* This variable may be set by the instruction decoder.  It suggests
+      the number of bytes objdump should display on a single line.  If
+      the instruction decoder sets this, it should always set it to
+      the same value in order to get reasonable looking output.  */
+  int bytes_per_line;
+
+  /* the next two variables control the way objdump displays the raw data */
+  /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */
+  /* output will look like this:
+     00:   00000000 00000000
+     with the chunks displayed according to "display_endian". */
+  int bytes_per_chunk;
+  enum bfd_endian display_endian;
+
+  /* Number of octets per incremented target address 
+     Normally one, but some DSPs have byte sizes of 16 or 32 bits.  */
+  unsigned int octets_per_byte;
+
+  /* Results from instruction decoders.  Not all decoders yet support
+     this information.  This info is set each time an instruction is
+     decoded, and is only valid for the last such instruction.
+
+     To determine whether this decoder supports this information, set
+     insn_info_valid to 0, decode an instruction, then check it.  */
+
+  char insn_info_valid;                /* Branch info has been set. */
+  char branch_delay_insns;     /* How many sequential insn's will run before
+                                  a branch takes effect.  (0 = normal) */
+  char data_size;              /* Size of data reference in insn, in bytes */
+  enum dis_insn_type insn_type;        /* Type of instruction */
+  bfd_vma target;              /* Target address of branch or dref, if known;
+                                  zero if unknown.  */
+  bfd_vma target2;             /* Second target address for dref2 */
+
+  /* Command line options specific to the target disassembler.  */
+  char * disassembler_options;
+
+} disassemble_info;
+
+\f
+/* Standard disassemblers.  Disassemble one instruction at the given
+   target address.  Return number of octets processed.  */
+typedef int (*disassembler_ftype)
+     PARAMS((bfd_vma, disassemble_info *));
+
+extern int print_insn_big_mips         PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_mips      PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i386             PARAMS ((bfd_vma, disassemble_info *));
+extern int print_insn_i386_att         PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i386_intel       PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_ia64             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i370             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m68hc11          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m68hc12          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m68k             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_z8001            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_z8002            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_h8300            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_h8300h           PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_h8300s           PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_h8500            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_alpha            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_big_arm          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_arm       PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_sparc            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_big_a29k         PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_a29k      PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_avr              PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_d10v             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_d30v             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_dlx              PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_fr30             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_hppa             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i860             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i960             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_ip2k             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m32r             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m88k             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mcore            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mmix             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mn10200          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mn10300          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_ns32k            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_openrisc         PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_big_or32          PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_or32       PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_pdp11            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_pj               PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_big_powerpc      PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_little_powerpc   PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_rs6000           PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_s390              PARAMS ((bfd_vma, disassemble_info*)); 
+extern int print_insn_sh               PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_tic30            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_tic4x            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_tic54x           PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_tic80            PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_v850             PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_vax              PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_w65              PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_xstormy16                PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_sh64             PARAMS ((bfd_vma, disassemble_info *));
+extern int print_insn_sh64x_media      PARAMS ((bfd_vma, disassemble_info *));
+extern int print_insn_frv              PARAMS ((bfd_vma, disassemble_info *));
+
+extern disassembler_ftype arc_get_disassembler PARAMS ((void *));
+extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *));
+
+extern void print_arm_disassembler_options PARAMS ((FILE *));
+extern void parse_arm_disassembler_option  PARAMS ((char *));
+extern int  get_arm_regname_num_options    PARAMS ((void));
+extern int  set_arm_regname_option         PARAMS ((int));
+extern int  get_arm_regnames               PARAMS ((int, const char **, const char **, const char ***));
+
+/* Fetch the disassembler for a given BFD, if that support is available.  */
+extern disassembler_ftype disassembler PARAMS ((bfd *));
+
+/* Document any target specific options available from the disassembler.  */
+extern void disassembler_usage          PARAMS ((FILE *));
+
+\f
+/* This block of definitions is for particular callers who read instructions
+   into a buffer before calling the instruction decoder.  */
+
+/* Here is a function which callers may wish to use for read_memory_func.
+   It gets bytes from a buffer.  */
+extern int buffer_read_memory
+  PARAMS ((bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *));
+
+/* This function goes with buffer_read_memory.
+   It prints a message using info->fprintf_func and info->stream.  */
+extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *));
+
+
+/* Just print the address in hex.  This is included for completeness even
+   though both GDB and objdump provide their own (to print symbolic
+   addresses).  */
+extern void generic_print_address
+  PARAMS ((bfd_vma, struct disassemble_info *));
+
+/* Always true.  */
+extern int generic_symbol_at_address
+  PARAMS ((bfd_vma, struct disassemble_info *));
+
+/* Macro to initialize a disassemble_info struct.  This should be called
+   by all applications creating such a struct.  */
+#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
+  (INFO).flavour = bfd_target_unknown_flavour, \
+  (INFO).arch = bfd_arch_unknown, \
+  (INFO).mach = 0, \
+  (INFO).insn_sets = 0, \
+  (INFO).endian = BFD_ENDIAN_UNKNOWN, \
+  (INFO).octets_per_byte = 1, \
+  INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC)
+
+/* Call this macro to initialize only the internal variables for the
+   disassembler.  Architecture dependent things such as byte order, or machine
+   variant are not touched by this macro.  This makes things much easier for
+   GDB which must initialize these things separately.  */
+
+#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
+  (INFO).fprintf_func = (fprintf_ftype)(FPRINTF_FUNC), \
+  (INFO).stream = (PTR)(STREAM), \
+  (INFO).section = NULL, \
+  (INFO).symbols = NULL, \
+  (INFO).num_symbols = 0, \
+  (INFO).private_data = NULL, \
+  (INFO).buffer = NULL, \
+  (INFO).buffer_vma = 0, \
+  (INFO).buffer_length = 0, \
+  (INFO).read_memory_func = buffer_read_memory, \
+  (INFO).memory_error_func = perror_memory, \
+  (INFO).print_address_func = generic_print_address, \
+  (INFO).symbol_at_address_func = generic_symbol_at_address, \
+  (INFO).flags = 0, \
+  (INFO).bytes_per_line = 0, \
+  (INFO).bytes_per_chunk = 0, \
+  (INFO).display_endian = BFD_ENDIAN_UNKNOWN, \
+  (INFO).disassembler_options = NULL, \
+  (INFO).insn_info_valid = 0
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* ! defined (DIS_ASM_H) */
diff --git a/src/vm/jit/i386/dis-buf.c b/src/vm/jit/i386/dis-buf.c
new file mode 100644 (file)
index 0000000..de297b6
--- /dev/null
@@ -0,0 +1,121 @@
+/* Disassemble from a buffer, for GNU.
+   Copyright 1993, 1994, 1996, 1997, 1998, 1999, 2000
+   Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/*  #include "sysdep.h" */
+#include "dis-asm.h"
+#include <errno.h>
+/*  #include "opintl.h" */
+
+/* Get LENGTH bytes from info's buffer, at target address memaddr.
+   Transfer them to myaddr.  */
+#if 0
+int
+buffer_read_memory (memaddr, myaddr, length, info)
+     bfd_vma memaddr;
+     bfd_byte *myaddr;
+     unsigned int length;
+     struct disassemble_info *info;
+{
+  unsigned int opb = info->octets_per_byte;
+  unsigned int end_addr_offset = length / opb;
+  unsigned int max_addr_offset = info->buffer_length / opb; 
+  unsigned int octets = (memaddr - info->buffer_vma) * opb;
+
+  printf("%d %d\n", memaddr, info->buffer_vma);
+  if (memaddr < info->buffer_vma
+      || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
+    /* Out of bounds.  Use EIO because GDB uses it.  */
+    return EIO;
+  memcpy (myaddr, info->buffer + octets, length);
+
+  return 0;
+}
+#endif
+
+/* Print an error message.  We can assume that this is in response to
+   an error return from buffer_read_memory.  */
+void
+perror_memory (status, memaddr, info)
+     int status;
+     bfd_vma memaddr;
+     struct disassemble_info *info;
+{
+  if (status != EIO)
+    /* Can't happen.  */
+    info->fprintf_func (info->stream, _("Unknown error %d\n"), status);
+  else
+    /* Actually, address between memaddr and memaddr + len was
+       out of bounds.  */
+    info->fprintf_func (info->stream,
+                       _("Address 0x%x is out of bounds.\n"), memaddr);
+}
+
+/* This could be in a separate file, to save miniscule amounts of space
+   in statically linked executables.  */
+
+/* Just print the address is hex.  This is included for completeness even
+   though both GDB and objdump provide their own (to print symbolic
+   addresses).  */
+
+void
+generic_print_address (addr, info)
+     bfd_vma addr;
+     struct disassemble_info *info;
+{
+  char buf[30];
+
+  sprintf_vma (buf, addr);
+  (*info->fprintf_func) (info->stream, "0x%s", buf);
+}
+
+#if 0
+/* Just concatenate the address as hex.  This is included for
+   completeness even though both GDB and objdump provide their own (to
+   print symbolic addresses).  */
+
+void generic_strcat_address PARAMS ((bfd_vma, char *, int));
+
+void
+generic_strcat_address (addr, buf, len)
+     bfd_vma addr;
+     char *buf;
+     int len;
+{
+  if (buf != (char *)NULL && len > 0)
+    {
+      char tmpBuf[30];
+
+      sprintf_vma (tmpBuf, addr);
+      if ((strlen (buf) + strlen (tmpBuf)) <= (unsigned int) len)
+       strcat (buf, tmpBuf);
+      else
+       strncat (buf, tmpBuf, (len - strlen(buf)));
+    }
+  return;
+}
+#endif
+
+/* Just return the given address.  */
+
+int
+generic_symbol_at_address (addr, info)
+     bfd_vma addr ATTRIBUTE_UNUSED;
+     struct disassemble_info *info ATTRIBUTE_UNUSED;
+{
+  return 1;
+}
diff --git a/src/vm/jit/i386/disass.c b/src/vm/jit/i386/disass.c
new file mode 100644 (file)
index 0000000..f9cc6ac
--- /dev/null
@@ -0,0 +1,172 @@
+/* i386/disass.c - wrapper functions for GNU binutils disassembler
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas  Krall
+            Reinhard Grafl
+
+   Changes: Christian Thalinger
+
+   $Id: disass.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdarg.h>
+#include <string.h>
+#include "dis-asm.h"
+
+
+u1 *codestatic = 0;
+int pstatic = 0;
+
+char mylinebuf[512];
+int mylen;
+
+
+char *regs[] = {
+       "eax",
+       "ecx",
+       "edx",
+       "ebx",
+       "esp",
+       "ebp",
+       "esi",
+       "edi"
+};
+
+
+void myprintf(PTR p, const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       mylen += vsprintf(mylinebuf + mylen, fmt, ap);
+       va_end(ap);
+}
+
+int buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info)
+{
+       if (length == 1)
+               *myaddr = *((u1 *) memaddr);
+       else
+               memcpy(myaddr, (void *) memaddr, length);
+       return 0;
+}
+
+
+
+/* function disassinstr ********************************************************
+
+       outputs a disassembler listing of one machine code instruction on 'stdout'
+       c:   instructions machine code
+       pos: instructions address relative to method start
+
+*******************************************************************************/
+
+int disassinstr(u1 *code, int pos)
+{
+       static disassemble_info info;
+       static int dis_initialized;
+       int seqlen;
+       int i;
+
+       if (!dis_initialized) {
+               INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
+               info.mach = bfd_mach_i386_i386;
+               dis_initialized = 1;
+       }
+
+       printf("0x%08x:   ", (s4) code);
+       mylen = 0;
+       seqlen = print_insn_i386((bfd_vma) code, &info);
+
+       for (i = 0; i < seqlen; i++) {
+               printf("%02x ", *(code++));
+       }
+
+       for (; i < 8; i++) {
+               printf("   ");
+       }
+
+       printf("   %s\n", mylinebuf);
+
+       return (seqlen - 1);
+}
+
+
+
+/* function disassemble ********************************************************
+
+       outputs a disassembler listing of some machine code on 'stdout'
+       code: pointer to first instruction
+       len:  code size (number of instructions * 4)
+
+*******************************************************************************/
+
+void disassemble(u1 *code, int len)
+{
+       int p;
+       int seqlen;
+       int i;
+       disassemble_info info;
+
+       INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
+       info.mach = bfd_mach_i386_i386;
+
+       printf("  --- disassembler listing ---\n");
+       for (p = 0; p < len;) {
+               printf("0x%08x:   ", (s4) code);
+               mylen = 0;
+
+               seqlen = print_insn_i386((bfd_vma) code, &info);
+               p += seqlen;
+               /*              myprintf(NULL, "\n"); */
+
+               for (i = 0; i < seqlen; i++) {
+                       printf("%02x ", *(code++));
+               }
+
+               for (; i < 8; i++) {
+                       printf("   ");
+               }
+
+               printf("   %s\n", mylinebuf);
+       }
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/i386/disass.h b/src/vm/jit/i386/disass.h
new file mode 100644 (file)
index 0000000..a16bf66
--- /dev/null
@@ -0,0 +1,65 @@
+/* i386/disass.h - wrapper functions for GNU binutils disassembler
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: disass.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _DISASS_H
+#define _DISASS_H
+
+#include "types.h"
+#include "dis-asm.h"
+
+
+extern char *regs[];
+
+
+/* function prototypes */
+void myprintf(PTR p, const char *fmt, ...);
+int buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info);
+int disassinstr(u1 *code, int pos);
+void disassemble(u1 *code, int len);
+
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/i386/i386-dis.c b/src/vm/jit/i386/i386-dis.c
new file mode 100644 (file)
index 0000000..5b01e2f
--- /dev/null
@@ -0,0 +1,4147 @@
+/* Print i386 instructions for GDB, the GNU debugger.
+   Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2001
+   Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/*
+ * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
+ * July 1988
+ *  modified by John Hassey (hassey@dg-rtp.dg.com)
+ *  x86-64 support added by Jan Hubicka (jh@suse.cz)
+ */
+
+/*
+ * The main tables describing the instructions is essentially a copy
+ * of the "Opcode Map" chapter (Appendix A) of the Intel 80386
+ * Programmers Manual.  Usually, there is a capital letter, followed
+ * by a small letter.  The capital letter tell the addressing mode,
+ * and the small letter tells about the operand size.  Refer to
+ * the Intel manual for details.
+ */
+
+#include "dis-asm.h"
+/*  #include "sysdep.h" */
+/*  #include "opintl.h" */
+
+#define MAXLEN 20
+
+#include <setjmp.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifndef UNIXWARE_COMPAT
+/* Set non-zero for broken, compatible instructions.  Set to zero for
+   non-broken opcodes.  */
+#define UNIXWARE_COMPAT 1
+#endif
+
+static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *));
+static void ckprefix PARAMS ((void));
+static const char *prefix_name PARAMS ((int, int));
+static int print_insn PARAMS ((bfd_vma, disassemble_info *));
+static void dofloat PARAMS ((int));
+static void OP_ST PARAMS ((int, int));
+static void OP_STi  PARAMS ((int, int));
+static int putop PARAMS ((const char *, int));
+static void oappend PARAMS ((const char *));
+static void append_seg PARAMS ((void));
+static void OP_indirE PARAMS ((int, int));
+static void print_operand_value PARAMS ((char *, int, bfd_vma));
+static void OP_E PARAMS ((int, int));
+static void OP_G PARAMS ((int, int));
+static bfd_vma get64 PARAMS ((void));
+static bfd_signed_vma get32 PARAMS ((void));
+static bfd_signed_vma get32s PARAMS ((void));
+static int get16 PARAMS ((void));
+static void set_op PARAMS ((bfd_vma, int));
+static void OP_REG PARAMS ((int, int));
+static void OP_IMREG PARAMS ((int, int));
+static void OP_I PARAMS ((int, int));
+static void OP_I64 PARAMS ((int, int));
+static void OP_sI PARAMS ((int, int));
+static void OP_J PARAMS ((int, int));
+static void OP_SEG PARAMS ((int, int));
+static void OP_DIR PARAMS ((int, int));
+static void OP_OFF PARAMS ((int, int));
+static void OP_OFF64 PARAMS ((int, int));
+static void ptr_reg PARAMS ((int, int));
+static void OP_ESreg PARAMS ((int, int));
+static void OP_DSreg PARAMS ((int, int));
+static void OP_C PARAMS ((int, int));
+static void OP_D PARAMS ((int, int));
+static void OP_T PARAMS ((int, int));
+static void OP_Rd PARAMS ((int, int));
+static void OP_MMX PARAMS ((int, int));
+static void OP_XMM PARAMS ((int, int));
+static void OP_EM PARAMS ((int, int));
+static void OP_EX PARAMS ((int, int));
+static void OP_MS PARAMS ((int, int));
+static void OP_XS PARAMS ((int, int));
+static void OP_3DNowSuffix PARAMS ((int, int));
+static void OP_SIMD_Suffix PARAMS ((int, int));
+static void SIMD_Fixup PARAMS ((int, int));
+static void BadOp PARAMS ((void));
+
+struct dis_private {
+  /* Points to first byte not fetched.  */
+  bfd_byte *max_fetched;
+  bfd_byte the_buffer[MAXLEN];
+  bfd_vma insn_start;
+  int orig_sizeflag;
+  jmp_buf bailout;
+};
+
+/* The opcode for the fwait instruction, which we treat as a prefix
+   when we can.  */
+#define FWAIT_OPCODE (0x9b)
+
+/* Set to 1 for 64bit mode disassembly.  */
+static int mode_64bit;
+
+/* Flags for the prefixes for the current instruction.  See below.  */
+static int prefixes;
+
+/* REX prefix the current instruction.  See below.  */
+static int rex;
+/* Bits of REX we've already used.  */
+static int rex_used;
+#define REX_MODE64     8
+#define REX_EXTX       4
+#define REX_EXTY       2
+#define REX_EXTZ       1
+/* Mark parts used in the REX prefix.  When we are testing for
+   empty prefix (for 8bit register REX extension), just mask it
+   out.  Otherwise test for REX bit is excuse for existence of REX
+   only in case value is nonzero.  */
+#define USED_REX(value)                                        \
+  {                                                    \
+    if (value)                                         \
+      rex_used |= (rex & value) ? (value) | 0x40 : 0;  \
+    else                                               \
+      rex_used |= 0x40;                                        \
+  }
+
+/* Flags for prefixes which we somehow handled when printing the
+   current instruction.  */
+static int used_prefixes;
+
+/* Flags stored in PREFIXES.  */
+#define PREFIX_REPZ 1
+#define PREFIX_REPNZ 2
+#define PREFIX_LOCK 4
+#define PREFIX_CS 8
+#define PREFIX_SS 0x10
+#define PREFIX_DS 0x20
+#define PREFIX_ES 0x40
+#define PREFIX_FS 0x80
+#define PREFIX_GS 0x100
+#define PREFIX_DATA 0x200
+#define PREFIX_ADDR 0x400
+#define PREFIX_FWAIT 0x800
+
+/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
+   to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
+   on error.  */
+#define FETCH_DATA(info, addr) \
+  ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
+   ? 1 : fetch_data ((info), (addr)))
+
+static int
+fetch_data (info, addr)
+     struct disassemble_info *info;
+     bfd_byte *addr;
+{
+  int status;
+  struct dis_private *priv = (struct dis_private *) info->private_data;
+  bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer);
+
+  status = (*info->read_memory_func) (start,
+                                     priv->max_fetched,
+                                     addr - priv->max_fetched,
+                                     info);
+  if (status != 0)
+    {
+      /* If we did manage to read at least one byte, then
+         print_insn_i386 will do something sensible.  Otherwise, print
+         an error.  We do that here because this is where we know
+         STATUS.  */
+      if (priv->max_fetched == priv->the_buffer)
+       (*info->memory_error_func) (status, start, info);
+      longjmp (priv->bailout, 1);
+    }
+  else
+    priv->max_fetched = addr;
+  return 1;
+}
+
+#define XX NULL, 0
+
+#define Eb OP_E, b_mode
+#define Ev OP_E, v_mode
+#define Ed OP_E, d_mode
+#define indirEb OP_indirE, b_mode
+#define indirEv OP_indirE, v_mode
+#define Ew OP_E, w_mode
+#define Ma OP_E, v_mode
+#define M OP_E, 0              /* lea, lgdt, etc. */
+#define Mp OP_E, 0             /* 32 or 48 bit memory operand for LDS, LES etc */
+#define Gb OP_G, b_mode
+#define Gv OP_G, v_mode
+#define Gd OP_G, d_mode
+#define Gw OP_G, w_mode
+#define Rd OP_Rd, d_mode
+#define Rm OP_Rd, m_mode
+#define Ib OP_I, b_mode
+#define sIb OP_sI, b_mode      /* sign extened byte */
+#define Iv OP_I, v_mode
+#define Iq OP_I, q_mode
+#define Iv64 OP_I64, v_mode
+#define Iw OP_I, w_mode
+#define Jb OP_J, b_mode
+#define Jv OP_J, v_mode
+#define Cm OP_C, m_mode
+#define Dm OP_D, m_mode
+#define Td OP_T, d_mode
+
+#define RMeAX OP_REG, eAX_reg
+#define RMeBX OP_REG, eBX_reg
+#define RMeCX OP_REG, eCX_reg
+#define RMeDX OP_REG, eDX_reg
+#define RMeSP OP_REG, eSP_reg
+#define RMeBP OP_REG, eBP_reg
+#define RMeSI OP_REG, eSI_reg
+#define RMeDI OP_REG, eDI_reg
+#define RMrAX OP_REG, rAX_reg
+#define RMrBX OP_REG, rBX_reg
+#define RMrCX OP_REG, rCX_reg
+#define RMrDX OP_REG, rDX_reg
+#define RMrSP OP_REG, rSP_reg
+#define RMrBP OP_REG, rBP_reg
+#define RMrSI OP_REG, rSI_reg
+#define RMrDI OP_REG, rDI_reg
+#define RMAL OP_REG, al_reg
+#define RMAL OP_REG, al_reg
+#define RMCL OP_REG, cl_reg
+#define RMDL OP_REG, dl_reg
+#define RMBL OP_REG, bl_reg
+#define RMAH OP_REG, ah_reg
+#define RMCH OP_REG, ch_reg
+#define RMDH OP_REG, dh_reg
+#define RMBH OP_REG, bh_reg
+#define RMAX OP_REG, ax_reg
+#define RMDX OP_REG, dx_reg
+
+#define eAX OP_IMREG, eAX_reg
+#define eBX OP_IMREG, eBX_reg
+#define eCX OP_IMREG, eCX_reg
+#define eDX OP_IMREG, eDX_reg
+#define eSP OP_IMREG, eSP_reg
+#define eBP OP_IMREG, eBP_reg
+#define eSI OP_IMREG, eSI_reg
+#define eDI OP_IMREG, eDI_reg
+#define AL OP_IMREG, al_reg
+#define AL OP_IMREG, al_reg
+#define CL OP_IMREG, cl_reg
+#define DL OP_IMREG, dl_reg
+#define BL OP_IMREG, bl_reg
+#define AH OP_IMREG, ah_reg
+#define CH OP_IMREG, ch_reg
+#define DH OP_IMREG, dh_reg
+#define BH OP_IMREG, bh_reg
+#define AX OP_IMREG, ax_reg
+#define DX OP_IMREG, dx_reg
+#define indirDX OP_IMREG, indir_dx_reg
+
+#define Sw OP_SEG, w_mode
+#define Ap OP_DIR, 0
+#define Ob OP_OFF, b_mode
+#define Ob64 OP_OFF64, b_mode
+#define Ov OP_OFF, v_mode
+#define Ov64 OP_OFF64, v_mode
+#define Xb OP_DSreg, eSI_reg
+#define Xv OP_DSreg, eSI_reg
+#define Yb OP_ESreg, eDI_reg
+#define Yv OP_ESreg, eDI_reg
+#define DSBX OP_DSreg, eBX_reg
+
+#define es OP_REG, es_reg
+#define ss OP_REG, ss_reg
+#define cs OP_REG, cs_reg
+#define ds OP_REG, ds_reg
+#define fs OP_REG, fs_reg
+#define gs OP_REG, gs_reg
+
+#define MX OP_MMX, 0
+#define XM OP_XMM, 0
+#define EM OP_EM, v_mode
+#define EX OP_EX, v_mode
+#define MS OP_MS, v_mode
+#define XS OP_XS, v_mode
+#define None OP_E, 0
+#define OPSUF OP_3DNowSuffix, 0
+#define OPSIMD OP_SIMD_Suffix, 0
+
+#define cond_jump_flag NULL, cond_jump_mode
+#define loop_jcxz_flag NULL, loop_jcxz_mode
+
+/* bits in sizeflag */
+#define SUFFIX_ALWAYS 4
+#define AFLAG 2
+#define DFLAG 1
+
+#define b_mode 1  /* byte operand */
+#define v_mode 2  /* operand size depends on prefixes */
+#define w_mode 3  /* word operand */
+#define d_mode 4  /* double word operand  */
+#define q_mode 5  /* quad word operand */
+#define x_mode 6
+#define m_mode 7  /* d_mode in 32bit, q_mode in 64bit mode.  */
+#define cond_jump_mode 8
+#define loop_jcxz_mode 9
+
+#define es_reg 100
+#define cs_reg 101
+#define ss_reg 102
+#define ds_reg 103
+#define fs_reg 104
+#define gs_reg 105
+
+#define eAX_reg 108
+#define eCX_reg 109
+#define eDX_reg 110
+#define eBX_reg 111
+#define eSP_reg 112
+#define eBP_reg 113
+#define eSI_reg 114
+#define eDI_reg 115
+
+#define al_reg 116
+#define cl_reg 117
+#define dl_reg 118
+#define bl_reg 119
+#define ah_reg 120
+#define ch_reg 121
+#define dh_reg 122
+#define bh_reg 123
+
+#define ax_reg 124
+#define cx_reg 125
+#define dx_reg 126
+#define bx_reg 127
+#define sp_reg 128
+#define bp_reg 129
+#define si_reg 130
+#define di_reg 131
+
+#define rAX_reg 132
+#define rCX_reg 133
+#define rDX_reg 134
+#define rBX_reg 135
+#define rSP_reg 136
+#define rBP_reg 137
+#define rSI_reg 138
+#define rDI_reg 139
+
+#define indir_dx_reg 150
+
+#define FLOATCODE 1
+#define USE_GROUPS 2
+#define USE_PREFIX_USER_TABLE 3
+#define X86_64_SPECIAL 4
+
+#define FLOAT    NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
+
+#define GRP1b    NULL, NULL, USE_GROUPS, NULL,  0, NULL, 0
+#define GRP1S    NULL, NULL, USE_GROUPS, NULL,  1, NULL, 0
+#define GRP1Ss   NULL, NULL, USE_GROUPS, NULL,  2, NULL, 0
+#define GRP2b    NULL, NULL, USE_GROUPS, NULL,  3, NULL, 0
+#define GRP2S    NULL, NULL, USE_GROUPS, NULL,  4, NULL, 0
+#define GRP2b_one NULL, NULL, USE_GROUPS, NULL,  5, NULL, 0
+#define GRP2S_one NULL, NULL, USE_GROUPS, NULL,  6, NULL, 0
+#define GRP2b_cl  NULL, NULL, USE_GROUPS, NULL,  7, NULL, 0
+#define GRP2S_cl  NULL, NULL, USE_GROUPS, NULL,  8, NULL, 0
+#define GRP3b    NULL, NULL, USE_GROUPS, NULL,  9, NULL, 0
+#define GRP3S    NULL, NULL, USE_GROUPS, NULL, 10, NULL, 0
+#define GRP4     NULL, NULL, USE_GROUPS, NULL, 11, NULL, 0
+#define GRP5     NULL, NULL, USE_GROUPS, NULL, 12, NULL, 0
+#define GRP6     NULL, NULL, USE_GROUPS, NULL, 13, NULL, 0
+#define GRP7     NULL, NULL, USE_GROUPS, NULL, 14, NULL, 0
+#define GRP8     NULL, NULL, USE_GROUPS, NULL, 15, NULL, 0
+#define GRP9     NULL, NULL, USE_GROUPS, NULL, 16, NULL, 0
+#define GRP10    NULL, NULL, USE_GROUPS, NULL, 17, NULL, 0
+#define GRP11    NULL, NULL, USE_GROUPS, NULL, 18, NULL, 0
+#define GRP12    NULL, NULL, USE_GROUPS, NULL, 19, NULL, 0
+#define GRP13    NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0
+#define GRP14    NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0
+#define GRPAMD   NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0
+
+#define PREGRP0   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  0, NULL, 0
+#define PREGRP1   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  1, NULL, 0
+#define PREGRP2   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  2, NULL, 0
+#define PREGRP3   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  3, NULL, 0
+#define PREGRP4   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  4, NULL, 0
+#define PREGRP5   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  5, NULL, 0
+#define PREGRP6   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  6, NULL, 0
+#define PREGRP7   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  7, NULL, 0
+#define PREGRP8   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  8, NULL, 0
+#define PREGRP9   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  9, NULL, 0
+#define PREGRP10  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 10, NULL, 0
+#define PREGRP11  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 11, NULL, 0
+#define PREGRP12  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 12, NULL, 0
+#define PREGRP13  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 13, NULL, 0
+#define PREGRP14  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 14, NULL, 0
+#define PREGRP15  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 15, NULL, 0
+#define PREGRP16  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 16, NULL, 0
+#define PREGRP17  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 17, NULL, 0
+#define PREGRP18  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 18, NULL, 0
+#define PREGRP19  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 19, NULL, 0
+#define PREGRP20  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 20, NULL, 0
+#define PREGRP21  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 21, NULL, 0
+#define PREGRP22  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 22, NULL, 0
+#define PREGRP23  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 23, NULL, 0
+#define PREGRP24  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 24, NULL, 0
+#define PREGRP25  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 25, NULL, 0
+#define PREGRP26  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 26, NULL, 0
+
+#define X86_64_0  NULL, NULL, X86_64_SPECIAL, NULL,  0, NULL, 0
+
+typedef void (*op_rtn) PARAMS ((int bytemode, int sizeflag));
+
+struct dis386 {
+  const char *name;
+  op_rtn op1;
+  int bytemode1;
+  op_rtn op2;
+  int bytemode2;
+  op_rtn op3;
+  int bytemode3;
+};
+
+/* Upper case letters in the instruction names here are macros.
+   'A' => print 'b' if no register operands or suffix_always is true
+   'B' => print 'b' if suffix_always is true
+   'E' => print 'e' if 32-bit form of jcxz
+   'F' => print 'w' or 'l' depending on address size prefix (loop insns)
+   'H' => print ",pt" or ",pn" branch hint
+   'L' => print 'l' if suffix_always is true
+   'N' => print 'n' if instruction has no wait "prefix"
+   'O' => print 'd', or 'o'
+   'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
+   .      or suffix_always is true.  print 'q' if rex prefix is present.
+   'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always
+   .      is true
+   'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode)
+   'S' => print 'w', 'l' or 'q' if suffix_always is true
+   'T' => print 'q' in 64bit mode and behave as 'P' otherwise
+   'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
+   'X' => print 's', 'd' depending on data16 prefix (for XMM)
+   'W' => print 'b' or 'w' ("w" or "de" in intel mode)
+   'Y' => 'q' if instruction has an REX 64bit overwrite prefix
+
+   Many of the above letters print nothing in Intel mode.  See "putop"
+   for the details.
+
+   Braces '{' and '}', and vertical bars '|', indicate alternative
+   mnemonic strings for AT&T, Intel, X86_64 AT&T, and X86_64 Intel
+   modes.  In cases where there are only two alternatives, the X86_64
+   instruction is reserved, and "(bad)" is printed.
+*/
+
+static const struct dis386 dis386[] = {
+  /* 00 */
+  { "addB",            Eb, Gb, XX },
+  { "addS",            Ev, Gv, XX },
+  { "addB",            Gb, Eb, XX },
+  { "addS",            Gv, Ev, XX },
+  { "addB",            AL, Ib, XX },
+  { "addS",            eAX, Iv, XX },
+  { "push{T|}",                es, XX, XX },
+  { "pop{T|}",         es, XX, XX },
+  /* 08 */
+  { "orB",             Eb, Gb, XX },
+  { "orS",             Ev, Gv, XX },
+  { "orB",             Gb, Eb, XX },
+  { "orS",             Gv, Ev, XX },
+  { "orB",             AL, Ib, XX },
+  { "orS",             eAX, Iv, XX },
+  { "push{T|}",                cs, XX, XX },
+  { "(bad)",           XX, XX, XX },   /* 0x0f extended opcode escape */
+  /* 10 */
+  { "adcB",            Eb, Gb, XX },
+  { "adcS",            Ev, Gv, XX },
+  { "adcB",            Gb, Eb, XX },
+  { "adcS",            Gv, Ev, XX },
+  { "adcB",            AL, Ib, XX },
+  { "adcS",            eAX, Iv, XX },
+  { "push{T|}",                ss, XX, XX },
+  { "popT|}",          ss, XX, XX },
+  /* 18 */
+  { "sbbB",            Eb, Gb, XX },
+  { "sbbS",            Ev, Gv, XX },
+  { "sbbB",            Gb, Eb, XX },
+  { "sbbS",            Gv, Ev, XX },
+  { "sbbB",            AL, Ib, XX },
+  { "sbbS",            eAX, Iv, XX },
+  { "push{T|}",                ds, XX, XX },
+  { "pop{T|}",         ds, XX, XX },
+  /* 20 */
+  { "andB",            Eb, Gb, XX },
+  { "andS",            Ev, Gv, XX },
+  { "andB",            Gb, Eb, XX },
+  { "andS",            Gv, Ev, XX },
+  { "andB",            AL, Ib, XX },
+  { "andS",            eAX, Iv, XX },
+  { "(bad)",           XX, XX, XX },   /* SEG ES prefix */
+  { "daa{|}",          XX, XX, XX },
+  /* 28 */
+  { "subB",            Eb, Gb, XX },
+  { "subS",            Ev, Gv, XX },
+  { "subB",            Gb, Eb, XX },
+  { "subS",            Gv, Ev, XX },
+  { "subB",            AL, Ib, XX },
+  { "subS",            eAX, Iv, XX },
+  { "(bad)",           XX, XX, XX },   /* SEG CS prefix */
+  { "das{|}",          XX, XX, XX },
+  /* 30 */
+  { "xorB",            Eb, Gb, XX },
+  { "xorS",            Ev, Gv, XX },
+  { "xorB",            Gb, Eb, XX },
+  { "xorS",            Gv, Ev, XX },
+  { "xorB",            AL, Ib, XX },
+  { "xorS",            eAX, Iv, XX },
+  { "(bad)",           XX, XX, XX },   /* SEG SS prefix */
+  { "aaa{|}",          XX, XX, XX },
+  /* 38 */
+  { "cmpB",            Eb, Gb, XX },
+  { "cmpS",            Ev, Gv, XX },
+  { "cmpB",            Gb, Eb, XX },
+  { "cmpS",            Gv, Ev, XX },
+  { "cmpB",            AL, Ib, XX },
+  { "cmpS",            eAX, Iv, XX },
+  { "(bad)",           XX, XX, XX },   /* SEG DS prefix */
+  { "aas{|}",          XX, XX, XX },
+  /* 40 */
+  { "inc{S|}",         RMeAX, XX, XX },
+  { "inc{S|}",         RMeCX, XX, XX },
+  { "inc{S|}",         RMeDX, XX, XX },
+  { "inc{S|}",         RMeBX, XX, XX },
+  { "inc{S|}",         RMeSP, XX, XX },
+  { "inc{S|}",         RMeBP, XX, XX },
+  { "inc{S|}",         RMeSI, XX, XX },
+  { "inc{S|}",         RMeDI, XX, XX },
+  /* 48 */
+  { "dec{S|}",         RMeAX, XX, XX },
+  { "dec{S|}",         RMeCX, XX, XX },
+  { "dec{S|}",         RMeDX, XX, XX },
+  { "dec{S|}",         RMeBX, XX, XX },
+  { "dec{S|}",         RMeSP, XX, XX },
+  { "dec{S|}",         RMeBP, XX, XX },
+  { "dec{S|}",         RMeSI, XX, XX },
+  { "dec{S|}",         RMeDI, XX, XX },
+  /* 50 */
+  { "pushS",           RMrAX, XX, XX },
+  { "pushS",           RMrCX, XX, XX },
+  { "pushS",           RMrDX, XX, XX },
+  { "pushS",           RMrBX, XX, XX },
+  { "pushS",           RMrSP, XX, XX },
+  { "pushS",           RMrBP, XX, XX },
+  { "pushS",           RMrSI, XX, XX },
+  { "pushS",           RMrDI, XX, XX },
+  /* 58 */
+  { "popS",            RMrAX, XX, XX },
+  { "popS",            RMrCX, XX, XX },
+  { "popS",            RMrDX, XX, XX },
+  { "popS",            RMrBX, XX, XX },
+  { "popS",            RMrSP, XX, XX },
+  { "popS",            RMrBP, XX, XX },
+  { "popS",            RMrSI, XX, XX },
+  { "popS",            RMrDI, XX, XX },
+  /* 60 */
+  { "pusha{P|}",       XX, XX, XX },
+  { "popa{P|}",                XX, XX, XX },
+  { "bound{S|}",       Gv, Ma, XX },
+  { X86_64_0 },
+  { "(bad)",           XX, XX, XX },   /* seg fs */
+  { "(bad)",           XX, XX, XX },   /* seg gs */
+  { "(bad)",           XX, XX, XX },   /* op size prefix */
+  { "(bad)",           XX, XX, XX },   /* adr size prefix */
+  /* 68 */
+  { "pushT",           Iq, XX, XX },
+  { "imulS",           Gv, Ev, Iv },
+  { "pushT",           sIb, XX, XX },
+  { "imulS",           Gv, Ev, sIb },
+  { "ins{b||b|}",      Yb, indirDX, XX },
+  { "ins{R||R|}",      Yv, indirDX, XX },
+  { "outs{b||b|}",     indirDX, Xb, XX },
+  { "outs{R||R|}",     indirDX, Xv, XX },
+  /* 70 */
+  { "joH",             Jb, XX, cond_jump_flag },
+  { "jnoH",            Jb, XX, cond_jump_flag },
+  { "jbH",             Jb, XX, cond_jump_flag },
+  { "jaeH",            Jb, XX, cond_jump_flag },
+  { "jeH",             Jb, XX, cond_jump_flag },
+  { "jneH",            Jb, XX, cond_jump_flag },
+  { "jbeH",            Jb, XX, cond_jump_flag },
+  { "jaH",             Jb, XX, cond_jump_flag },
+  /* 78 */
+  { "jsH",             Jb, XX, cond_jump_flag },
+  { "jnsH",            Jb, XX, cond_jump_flag },
+  { "jpH",             Jb, XX, cond_jump_flag },
+  { "jnpH",            Jb, XX, cond_jump_flag },
+  { "jlH",             Jb, XX, cond_jump_flag },
+  { "jgeH",            Jb, XX, cond_jump_flag },
+  { "jleH",            Jb, XX, cond_jump_flag },
+  { "jgH",             Jb, XX, cond_jump_flag },
+  /* 80 */
+  { GRP1b },
+  { GRP1S },
+  { "(bad)",           XX, XX, XX },
+  { GRP1Ss },
+  { "testB",           Eb, Gb, XX },
+  { "testS",           Ev, Gv, XX },
+  { "xchgB",           Eb, Gb, XX },
+  { "xchgS",           Ev, Gv, XX },
+  /* 88 */
+  { "movB",            Eb, Gb, XX },
+  { "movS",            Ev, Gv, XX },
+  { "movB",            Gb, Eb, XX },
+  { "movS",            Gv, Ev, XX },
+  { "movQ",            Ev, Sw, XX },
+  { "leaS",            Gv, M, XX },
+  { "movQ",            Sw, Ev, XX },
+  { "popU",            Ev, XX, XX },
+  /* 90 */
+  { "nop",             XX, XX, XX },
+  /* FIXME: NOP with REPz prefix is called PAUSE.  */
+  { "xchgS",           RMeCX, eAX, XX },
+  { "xchgS",           RMeDX, eAX, XX },
+  { "xchgS",           RMeBX, eAX, XX },
+  { "xchgS",           RMeSP, eAX, XX },
+  { "xchgS",           RMeBP, eAX, XX },
+  { "xchgS",           RMeSI, eAX, XX },
+  { "xchgS",           RMeDI, eAX, XX },
+  /* 98 */
+  { "cW{tR||tR|}",     XX, XX, XX },
+  { "cR{tO||tO|}",     XX, XX, XX },
+  { "lcall{T|}",       Ap, XX, XX },
+  { "(bad)",           XX, XX, XX },   /* fwait */
+  { "pushfT",          XX, XX, XX },
+  { "popfT",           XX, XX, XX },
+  { "sahf{|}",         XX, XX, XX },
+  { "lahf{|}",         XX, XX, XX },
+  /* a0 */
+  { "movB",            AL, Ob64, XX },
+  { "movS",            eAX, Ov64, XX },
+  { "movB",            Ob64, AL, XX },
+  { "movS",            Ov64, eAX, XX },
+  { "movs{b||b|}",     Yb, Xb, XX },
+  { "movs{R||R|}",     Yv, Xv, XX },
+  { "cmps{b||b|}",     Xb, Yb, XX },
+  { "cmps{R||R|}",     Xv, Yv, XX },
+  /* a8 */
+  { "testB",           AL, Ib, XX },
+  { "testS",           eAX, Iv, XX },
+  { "stosB",           Yb, AL, XX },
+  { "stosS",           Yv, eAX, XX },
+  { "lodsB",           AL, Xb, XX },
+  { "lodsS",           eAX, Xv, XX },
+  { "scasB",           AL, Yb, XX },
+  { "scasS",           eAX, Yv, XX },
+  /* b0 */
+  { "movB",            RMAL, Ib, XX },
+  { "movB",            RMCL, Ib, XX },
+  { "movB",            RMDL, Ib, XX },
+  { "movB",            RMBL, Ib, XX },
+  { "movB",            RMAH, Ib, XX },
+  { "movB",            RMCH, Ib, XX },
+  { "movB",            RMDH, Ib, XX },
+  { "movB",            RMBH, Ib, XX },
+  /* b8 */
+  { "movS",            RMeAX, Iv64, XX },
+  { "movS",            RMeCX, Iv64, XX },
+  { "movS",            RMeDX, Iv64, XX },
+  { "movS",            RMeBX, Iv64, XX },
+  { "movS",            RMeSP, Iv64, XX },
+  { "movS",            RMeBP, Iv64, XX },
+  { "movS",            RMeSI, Iv64, XX },
+  { "movS",            RMeDI, Iv64, XX },
+  /* c0 */
+  { GRP2b },
+  { GRP2S },
+  { "retT",            Iw, XX, XX },
+  { "retT",            XX, XX, XX },
+  { "les{S|}",         Gv, Mp, XX },
+  { "ldsS",            Gv, Mp, XX },
+  { "movA",            Eb, Ib, XX },
+  { "movQ",            Ev, Iv, XX },
+  /* c8 */
+  { "enterT",          Iw, Ib, XX },
+  { "leaveT",          XX, XX, XX },
+  { "lretP",           Iw, XX, XX },
+  { "lretP",           XX, XX, XX },
+  { "int3",            XX, XX, XX },
+  { "int",             Ib, XX, XX },
+  { "into{|}",         XX, XX, XX },
+  { "iretP",           XX, XX, XX },
+  /* d0 */
+  { GRP2b_one },
+  { GRP2S_one },
+  { GRP2b_cl },
+  { GRP2S_cl },
+  { "aam{|}",          sIb, XX, XX },
+  { "aad{|}",          sIb, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "xlat",            DSBX, XX, XX },
+  /* d8 */
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  { FLOAT },
+  /* e0 */
+  { "loopneFH",                Jb, XX, loop_jcxz_flag },
+  { "loopeFH",         Jb, XX, loop_jcxz_flag },
+  { "loopFH",          Jb, XX, loop_jcxz_flag },
+  { "jEcxzH",          Jb, XX, loop_jcxz_flag },
+  { "inB",             AL, Ib, XX },
+  { "inS",             eAX, Ib, XX },
+  { "outB",            Ib, AL, XX },
+  { "outS",            Ib, eAX, XX },
+  /* e8 */
+  { "callT",           Jv, XX, XX },
+  { "jmpT",            Jv, XX, XX },
+  { "ljmp{T|}",                Ap, XX, XX },
+  { "jmp",             Jb, XX, XX },
+  { "inB",             AL, indirDX, XX },
+  { "inS",             eAX, indirDX, XX },
+  { "outB",            indirDX, AL, XX },
+  { "outS",            indirDX, eAX, XX },
+  /* f0 */
+  { "(bad)",           XX, XX, XX },   /* lock prefix */
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },   /* repne */
+  { "(bad)",           XX, XX, XX },   /* repz */
+  { "hlt",             XX, XX, XX },
+  { "cmc",             XX, XX, XX },
+  { GRP3b },
+  { GRP3S },
+  /* f8 */
+  { "clc",             XX, XX, XX },
+  { "stc",             XX, XX, XX },
+  { "cli",             XX, XX, XX },
+  { "sti",             XX, XX, XX },
+  { "cld",             XX, XX, XX },
+  { "std",             XX, XX, XX },
+  { GRP4 },
+  { GRP5 },
+};
+
+static const struct dis386 dis386_twobyte[] = {
+  /* 00 */
+  { GRP6 },
+  { GRP7 },
+  { "larS",            Gv, Ew, XX },
+  { "lslS",            Gv, Ew, XX },
+  { "(bad)",           XX, XX, XX },
+  { "syscall",         XX, XX, XX },
+  { "clts",            XX, XX, XX },
+  { "sysretP",         XX, XX, XX },
+  /* 08 */
+  { "invd",            XX, XX, XX },
+  { "wbinvd",          XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "ud2a",            XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { GRPAMD },
+  { "femms",           XX, XX, XX },
+  { "",                        MX, EM, OPSUF }, /* See OP_3DNowSuffix.  */
+  /* 10 */
+  { PREGRP8 },
+  { PREGRP9 },
+  { "movlpX",          XM, EX, SIMD_Fixup, 'h' }, /* really only 2 operands */
+  { "movlpX",          EX, XM, SIMD_Fixup, 'h' },
+  { "unpcklpX",                XM, EX, XX },
+  { "unpckhpX",                XM, EX, XX },
+  { "movhpX",          XM, EX, SIMD_Fixup, 'l' },
+  { "movhpX",          EX, XM, SIMD_Fixup, 'l' },
+  /* 18 */
+  { GRP14 },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  /* 20 */
+  { "movL",            Rm, Cm, XX },
+  { "movL",            Rm, Dm, XX },
+  { "movL",            Cm, Rm, XX },
+  { "movL",            Dm, Rm, XX },
+  { "movL",            Rd, Td, XX },
+  { "(bad)",           XX, XX, XX },
+  { "movL",            Td, Rd, XX },
+  { "(bad)",           XX, XX, XX },
+  /* 28 */
+  { "movapX",          XM, EX, XX },
+  { "movapX",          EX, XM, XX },
+  { PREGRP2 },
+  { "movntpX",         Ev, XM, XX },
+  { PREGRP4 },
+  { PREGRP3 },
+  { "ucomisX",         XM,EX, XX },
+  { "comisX",          XM,EX, XX },
+  /* 30 */
+  { "wrmsr",           XX, XX, XX },
+  { "rdtsc",           XX, XX, XX },
+  { "rdmsr",           XX, XX, XX },
+  { "rdpmc",           XX, XX, XX },
+  { "sysenter",                XX, XX, XX },
+  { "sysexit",         XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  /* 38 */
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  /* 40 */
+  { "cmovo",           Gv, Ev, XX },
+  { "cmovno",          Gv, Ev, XX },
+  { "cmovb",           Gv, Ev, XX },
+  { "cmovae",          Gv, Ev, XX },
+  { "cmove",           Gv, Ev, XX },
+  { "cmovne",          Gv, Ev, XX },
+  { "cmovbe",          Gv, Ev, XX },
+  { "cmova",           Gv, Ev, XX },
+  /* 48 */
+  { "cmovs",           Gv, Ev, XX },
+  { "cmovns",          Gv, Ev, XX },
+  { "cmovp",           Gv, Ev, XX },
+  { "cmovnp",          Gv, Ev, XX },
+  { "cmovl",           Gv, Ev, XX },
+  { "cmovge",          Gv, Ev, XX },
+  { "cmovle",          Gv, Ev, XX },
+  { "cmovg",           Gv, Ev, XX },
+  /* 50 */
+  { "movmskpX",                Gd, XS, XX },
+  { PREGRP13 },
+  { PREGRP12 },
+  { PREGRP11 },
+  { "andpX",           XM, EX, XX },
+  { "andnpX",          XM, EX, XX },
+  { "orpX",            XM, EX, XX },
+  { "xorpX",           XM, EX, XX },
+  /* 58 */
+  { PREGRP0 },
+  { PREGRP10 },
+  { PREGRP17 },
+  { PREGRP16 },
+  { PREGRP14 },
+  { PREGRP7 },
+  { PREGRP5 },
+  { PREGRP6 },
+  /* 60 */
+  { "punpcklbw",       MX, EM, XX },
+  { "punpcklwd",       MX, EM, XX },
+  { "punpckldq",       MX, EM, XX },
+  { "packsswb",                MX, EM, XX },
+  { "pcmpgtb",         MX, EM, XX },
+  { "pcmpgtw",         MX, EM, XX },
+  { "pcmpgtd",         MX, EM, XX },
+  { "packuswb",                MX, EM, XX },
+  /* 68 */
+  { "punpckhbw",       MX, EM, XX },
+  { "punpckhwd",       MX, EM, XX },
+  { "punpckhdq",       MX, EM, XX },
+  { "packssdw",                MX, EM, XX },
+  { PREGRP26 },
+  { PREGRP24 },
+  { "movd",            MX, Ed, XX },
+  { PREGRP19 },
+  /* 70 */
+  { PREGRP22 },
+  { GRP10 },
+  { GRP11 },
+  { GRP12 },
+  { "pcmpeqb",         MX, EM, XX },
+  { "pcmpeqw",         MX, EM, XX },
+  { "pcmpeqd",         MX, EM, XX },
+  { "emms",            XX, XX, XX },
+  /* 78 */
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  { PREGRP23 },
+  { PREGRP20 },
+  /* 80 */
+  { "joH",             Jv, XX, cond_jump_flag },
+  { "jnoH",            Jv, XX, cond_jump_flag },
+  { "jbH",             Jv, XX, cond_jump_flag },
+  { "jaeH",            Jv, XX, cond_jump_flag },
+  { "jeH",             Jv, XX, cond_jump_flag },
+  { "jneH",            Jv, XX, cond_jump_flag },
+  { "jbeH",            Jv, XX, cond_jump_flag },
+  { "jaH",             Jv, XX, cond_jump_flag },
+  /* 88 */
+  { "jsH",             Jv, XX, cond_jump_flag },
+  { "jnsH",            Jv, XX, cond_jump_flag },
+  { "jpH",             Jv, XX, cond_jump_flag },
+  { "jnpH",            Jv, XX, cond_jump_flag },
+  { "jlH",             Jv, XX, cond_jump_flag },
+  { "jgeH",            Jv, XX, cond_jump_flag },
+  { "jleH",            Jv, XX, cond_jump_flag },
+  { "jgH",             Jv, XX, cond_jump_flag },
+  /* 90 */
+  { "seto",            Eb, XX, XX },
+  { "setno",           Eb, XX, XX },
+  { "setb",            Eb, XX, XX },
+  { "setae",           Eb, XX, XX },
+  { "sete",            Eb, XX, XX },
+  { "setne",           Eb, XX, XX },
+  { "setbe",           Eb, XX, XX },
+  { "seta",            Eb, XX, XX },
+  /* 98 */
+  { "sets",            Eb, XX, XX },
+  { "setns",           Eb, XX, XX },
+  { "setp",            Eb, XX, XX },
+  { "setnp",           Eb, XX, XX },
+  { "setl",            Eb, XX, XX },
+  { "setge",           Eb, XX, XX },
+  { "setle",           Eb, XX, XX },
+  { "setg",            Eb, XX, XX },
+  /* a0 */
+  { "pushT",           fs, XX, XX },
+  { "popT",            fs, XX, XX },
+  { "cpuid",           XX, XX, XX },
+  { "btS",             Ev, Gv, XX },
+  { "shldS",           Ev, Gv, Ib },
+  { "shldS",           Ev, Gv, CL },
+  { "(bad)",           XX, XX, XX },
+  { "(bad)",           XX, XX, XX },
+  /* a8 */
+  { "pushT",           gs, XX, XX },
+  { "popT",            gs, XX, XX },
+  { "rsm",             XX, XX, XX },
+  { "btsS",            Ev, Gv, XX },
+  { "shrdS",           Ev, Gv, Ib },
+  { "shrdS",           Ev, Gv, CL },
+  { GRP13 },
+  { "imulS",           Gv, Ev, XX },
+  /* b0 */
+  { "cmpxchgB",                Eb, Gb, XX },
+  { "cmpxchgS",                Ev, Gv, XX },
+  { "lssS",            Gv, Mp, XX },
+  { "btrS",            Ev, Gv, XX },
+  { "lfsS",            Gv, Mp, XX },
+  { "lgsS",            Gv, Mp, XX },
+  { "movz{bR|x|bR|x}", Gv, Eb, XX },
+  { "movz{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movzww ! */
+  /* b8 */
+  { "(bad)",           XX, XX, XX },
+  { "ud2b",            XX, XX, XX },
+  { GRP8 },
+  { "btcS",            Ev, Gv, XX },
+  { "bsfS",            Gv, Ev, XX },
+  { "bsrS",            Gv, Ev, XX },
+  { "movs{bR|x|bR|x}", Gv, Eb, XX },
+  { "movs{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movsww ! */
+  /* c0 */
+  { "xaddB",           Eb, Gb, XX },
+  { "xaddS",           Ev, Gv, XX },
+  { PREGRP1 },
+  { "movntiS",         Ev, Gv, XX },
+  { "pinsrw",          MX, Ed, Ib },
+  { "pextrw",          Gd, MS, Ib },
+  { "shufpX",          XM, EX, Ib },
+  { GRP9 },
+  /* c8 */
+  { "bswap",           RMeAX, XX, XX },
+  { "bswap",           RMeCX, XX, XX },
+  { "bswap",           RMeDX, XX, XX },
+  { "bswap",           RMeBX, XX, XX },
+  { "bswap",           RMeSP, XX, XX },
+  { "bswap",           RMeBP, XX, XX },
+  { "bswap",           RMeSI, XX, XX },
+  { "bswap",           RMeDI, XX, XX },
+  /* d0 */
+  { "(bad)",           XX, XX, XX },
+  { "psrlw",           MX, EM, XX },
+  { "psrld",           MX, EM, XX },
+  { "psrlq",           MX, EM, XX },
+  { "paddq",           MX, EM, XX },
+  { "pmullw",          MX, EM, XX },
+  { PREGRP21 },
+  { "pmovmskb",                Gd, MS, XX },
+  /* d8 */
+  { "psubusb",         MX, EM, XX },
+  { "psubusw",         MX, EM, XX },
+  { "pminub",          MX, EM, XX },
+  { "pand",            MX, EM, XX },
+  { "paddusb",         MX, EM, XX },
+  { "paddusw",         MX, EM, XX },
+  { "pmaxub",          MX, EM, XX },
+  { "pandn",           MX, EM, XX },
+  /* e0 */
+  { "pavgb",           MX, EM, XX },
+  { "psraw",           MX, EM, XX },
+  { "psrad",           MX, EM, XX },
+  { "pavgw",           MX, EM, XX },
+  { "pmulhuw",         MX, EM, XX },
+  { "pmulhw",          MX, EM, XX },
+  { PREGRP15 },
+  { PREGRP25 },
+  /* e8 */
+  { "psubsb",          MX, EM, XX },
+  { "psubsw",          MX, EM, XX },
+  { "pminsw",          MX, EM, XX },
+  { "por",             MX, EM, XX },
+  { "paddsb",          MX, EM, XX },
+  { "paddsw",          MX, EM, XX },
+  { "pmaxsw",          MX, EM, XX },
+  { "pxor",            MX, EM, XX },
+  /* f0 */
+  { "(bad)",           XX, XX, XX },
+  { "psllw",           MX, EM, XX },
+  { "pslld",           MX, EM, XX },
+  { "psllq",           MX, EM, XX },
+  { "pmuludq",         MX, EM, XX },
+  { "pmaddwd",         MX, EM, XX },
+  { "psadbw",          MX, EM, XX },
+  { PREGRP18 },
+  /* f8 */
+  { "psubb",           MX, EM, XX },
+  { "psubw",           MX, EM, XX },
+  { "psubd",           MX, EM, XX },
+  { "psubq",           MX, EM, XX },
+  { "paddb",           MX, EM, XX },
+  { "paddw",           MX, EM, XX },
+  { "paddd",           MX, EM, XX },
+  { "(bad)",           XX, XX, XX }
+};
+
+static const unsigned char onebyte_has_modrm[256] = {
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
+  /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
+  /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
+  /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
+  /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
+  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
+  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
+  /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
+  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
+  /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
+  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
+  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
+  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
+  /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
+  /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
+  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
+  /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1  /* f0 */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+};
+
+static const unsigned char twobyte_has_modrm[256] = {
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
+  /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
+  /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
+  /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
+  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
+  /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
+  /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
+  /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
+  /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
+  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
+  /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
+  /* a0 */ 0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1, /* af */
+  /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
+  /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
+  /* d0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
+  /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
+  /* f0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+};
+
+static const unsigned char twobyte_uses_SSE_prefix[256] = {
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+  /*       -------------------------------        */
+  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
+  /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
+  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
+  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
+  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
+  /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
+  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
+  /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
+  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
+  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
+  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
+  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
+  /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
+  /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
+  /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
+  /* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0  /* ff */
+  /*       -------------------------------        */
+  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
+};
+
+static char obuf[100];
+static char *obufp;
+static char scratchbuf[100];
+static unsigned char *start_codep;
+static unsigned char *insn_codep;
+static unsigned char *codep;
+static disassemble_info *the_info;
+static int mod;
+static int rm;
+static int reg;
+static unsigned char need_modrm;
+
+/* If we are accessing mod/rm/reg without need_modrm set, then the
+   values are stale.  Hitting this abort likely indicates that you
+   need to update onebyte_has_modrm or twobyte_has_modrm.  */
+#define MODRM_CHECK  if (!need_modrm) abort ()
+
+static const char **names64;
+static const char **names32;
+static const char **names16;
+static const char **names8;
+static const char **names8rex;
+static const char **names_seg;
+static const char **index16;
+
+static const char *intel_names64[] = {
+  "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
+  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
+};
+static const char *intel_names32[] = {
+  "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
+  "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
+};
+static const char *intel_names16[] = {
+  "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
+  "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
+};
+static const char *intel_names8[] = {
+  "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
+};
+static const char *intel_names8rex[] = {
+  "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
+  "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
+};
+static const char *intel_names_seg[] = {
+  "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
+};
+static const char *intel_index16[] = {
+  "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
+};
+
+static const char *att_names64[] = {
+  "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
+  "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
+};
+static const char *att_names32[] = {
+  "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
+  "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
+};
+static const char *att_names16[] = {
+  "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
+  "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
+};
+static const char *att_names8[] = {
+  "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
+};
+static const char *att_names8rex[] = {
+  "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
+  "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
+};
+static const char *att_names_seg[] = {
+  "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
+};
+static const char *att_index16[] = {
+  "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
+};
+
+static const struct dis386 grps[][8] = {
+  /* GRP1b */
+  {
+    { "addA",  Eb, Ib, XX },
+    { "orA",   Eb, Ib, XX },
+    { "adcA",  Eb, Ib, XX },
+    { "sbbA",  Eb, Ib, XX },
+    { "andA",  Eb, Ib, XX },
+    { "subA",  Eb, Ib, XX },
+    { "xorA",  Eb, Ib, XX },
+    { "cmpA",  Eb, Ib, XX }
+  },
+  /* GRP1S */
+  {
+    { "addQ",  Ev, Iv, XX },
+    { "orQ",   Ev, Iv, XX },
+    { "adcQ",  Ev, Iv, XX },
+    { "sbbQ",  Ev, Iv, XX },
+    { "andQ",  Ev, Iv, XX },
+    { "subQ",  Ev, Iv, XX },
+    { "xorQ",  Ev, Iv, XX },
+    { "cmpQ",  Ev, Iv, XX }
+  },
+  /* GRP1Ss */
+  {
+    { "addQ",  Ev, sIb, XX },
+    { "orQ",   Ev, sIb, XX },
+    { "adcQ",  Ev, sIb, XX },
+    { "sbbQ",  Ev, sIb, XX },
+    { "andQ",  Ev, sIb, XX },
+    { "subQ",  Ev, sIb, XX },
+    { "xorQ",  Ev, sIb, XX },
+    { "cmpQ",  Ev, sIb, XX }
+  },
+  /* GRP2b */
+  {
+    { "rolA",  Eb, Ib, XX },
+    { "rorA",  Eb, Ib, XX },
+    { "rclA",  Eb, Ib, XX },
+    { "rcrA",  Eb, Ib, XX },
+    { "shlA",  Eb, Ib, XX },
+    { "shrA",  Eb, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarA",  Eb, Ib, XX },
+  },
+  /* GRP2S */
+  {
+    { "rolQ",  Ev, Ib, XX },
+    { "rorQ",  Ev, Ib, XX },
+    { "rclQ",  Ev, Ib, XX },
+    { "rcrQ",  Ev, Ib, XX },
+    { "shlQ",  Ev, Ib, XX },
+    { "shrQ",  Ev, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarQ",  Ev, Ib, XX },
+  },
+  /* GRP2b_one */
+  {
+    { "rolA",  Eb, XX, XX },
+    { "rorA",  Eb, XX, XX },
+    { "rclA",  Eb, XX, XX },
+    { "rcrA",  Eb, XX, XX },
+    { "shlA",  Eb, XX, XX },
+    { "shrA",  Eb, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarA",  Eb, XX, XX },
+  },
+  /* GRP2S_one */
+  {
+    { "rolQ",  Ev, XX, XX },
+    { "rorQ",  Ev, XX, XX },
+    { "rclQ",  Ev, XX, XX },
+    { "rcrQ",  Ev, XX, XX },
+    { "shlQ",  Ev, XX, XX },
+    { "shrQ",  Ev, XX, XX },
+    { "(bad)", XX, XX, XX},
+    { "sarQ",  Ev, XX, XX },
+  },
+  /* GRP2b_cl */
+  {
+    { "rolA",  Eb, CL, XX },
+    { "rorA",  Eb, CL, XX },
+    { "rclA",  Eb, CL, XX },
+    { "rcrA",  Eb, CL, XX },
+    { "shlA",  Eb, CL, XX },
+    { "shrA",  Eb, CL, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarA",  Eb, CL, XX },
+  },
+  /* GRP2S_cl */
+  {
+    { "rolQ",  Ev, CL, XX },
+    { "rorQ",  Ev, CL, XX },
+    { "rclQ",  Ev, CL, XX },
+    { "rcrQ",  Ev, CL, XX },
+    { "shlQ",  Ev, CL, XX },
+    { "shrQ",  Ev, CL, XX },
+    { "(bad)", XX, XX, XX },
+    { "sarQ",  Ev, CL, XX }
+  },
+  /* GRP3b */
+  {
+    { "testA", Eb, Ib, XX },
+    { "(bad)", Eb, XX, XX },
+    { "notA",  Eb, XX, XX },
+    { "negA",  Eb, XX, XX },
+    { "mulA",  Eb, XX, XX },   /* Don't print the implicit %al register,  */
+    { "imulA", Eb, XX, XX },   /* to distinguish these opcodes from other */
+    { "divA",  Eb, XX, XX },   /* mul/imul opcodes.  Do the same for div  */
+    { "idivA", Eb, XX, XX }    /* and idiv for consistency.               */
+  },
+  /* GRP3S */
+  {
+    { "testQ", Ev, Iv, XX },
+    { "(bad)", XX, XX, XX },
+    { "notQ",  Ev, XX, XX },
+    { "negQ",  Ev, XX, XX },
+    { "mulQ",  Ev, XX, XX },   /* Don't print the implicit register.  */
+    { "imulQ", Ev, XX, XX },
+    { "divQ",  Ev, XX, XX },
+    { "idivQ", Ev, XX, XX },
+  },
+  /* GRP4 */
+  {
+    { "incA",  Eb, XX, XX },
+    { "decA",  Eb, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP5 */
+  {
+    { "incQ",  Ev, XX, XX },
+    { "decQ",  Ev, XX, XX },
+    { "callT", indirEv, XX, XX },
+    { "lcallT",        indirEv, XX, XX },
+    { "jmpT",  indirEv, XX, XX },
+    { "ljmpT", indirEv, XX, XX },
+    { "pushU", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP6 */
+  {
+    { "sldtQ", Ev, XX, XX },
+    { "strQ",  Ev, XX, XX },
+    { "lldt",  Ew, XX, XX },
+    { "ltr",   Ew, XX, XX },
+    { "verr",  Ew, XX, XX },
+    { "verw",  Ew, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX }
+  },
+  /* GRP7 */
+  {
+    { "sgdtQ",  M, XX, XX },
+    { "sidtQ",  M, XX, XX },
+    { "lgdtQ",  M, XX, XX },
+    { "lidtQ",  M, XX, XX },
+    { "smswQ", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "lmsw",  Ew, XX, XX },
+    { "invlpg",        Ew, XX, XX },
+  },
+  /* GRP8 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "btQ",   Ev, Ib, XX },
+    { "btsQ",  Ev, Ib, XX },
+    { "btrQ",  Ev, Ib, XX },
+    { "btcQ",  Ev, Ib, XX },
+  },
+  /* GRP9 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "cmpxchg8b", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP10 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "psrlw", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "psraw", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "psllw", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP11 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "psrld", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "psrad", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "pslld", MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRP12 */
+  {
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "psrlq", MS, Ib, XX },
+    { "psrldq",        MS, Ib, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "psllq", MS, Ib, XX },
+    { "pslldq",        MS, Ib, XX },
+  },
+  /* GRP13 */
+  {
+    { "fxsave", Ev, XX, XX },
+    { "fxrstor", Ev, XX, XX },
+    { "ldmxcsr", Ev, XX, XX },
+    { "stmxcsr", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "lfence", None, XX, XX },
+    { "mfence", None, XX, XX },
+    { "sfence", None, XX, XX },
+    /* FIXME: the sfence with memory operand is clflush!  */
+  },
+  /* GRP14 */
+  {
+    { "prefetchnta", Ev, XX, XX },
+    { "prefetcht0", Ev, XX, XX },
+    { "prefetcht1", Ev, XX, XX },
+    { "prefetcht2", Ev, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* GRPAMD */
+  {
+    { "prefetch", Eb, XX, XX },
+    { "prefetchw", Eb, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  }
+};
+
+static const struct dis386 prefix_user_table[][4] = {
+  /* PREGRP0 */
+  {
+    { "addps", XM, EX, XX },
+    { "addss", XM, EX, XX },
+    { "addpd", XM, EX, XX },
+    { "addsd", XM, EX, XX },
+  },
+  /* PREGRP1 */
+  {
+    { "", XM, EX, OPSIMD },    /* See OP_SIMD_SUFFIX.  */
+    { "", XM, EX, OPSIMD },
+    { "", XM, EX, OPSIMD },
+    { "", XM, EX, OPSIMD },
+  },
+  /* PREGRP2 */
+  {
+    { "cvtpi2ps", XM, EM, XX },
+    { "cvtsi2ssY", XM, Ev, XX },
+    { "cvtpi2pd", XM, EM, XX },
+    { "cvtsi2sdY", XM, Ev, XX },
+  },
+  /* PREGRP3 */
+  {
+    { "cvtps2pi", MX, EX, XX },
+    { "cvtss2siY", Gv, EX, XX },
+    { "cvtpd2pi", MX, EX, XX },
+    { "cvtsd2siY", Gv, EX, XX },
+  },
+  /* PREGRP4 */
+  {
+    { "cvttps2pi", MX, EX, XX },
+    { "cvttss2siY", Gv, EX, XX },
+    { "cvttpd2pi", MX, EX, XX },
+    { "cvttsd2siY", Gv, EX, XX },
+  },
+  /* PREGRP5 */
+  {
+    { "divps", XM, EX, XX },
+    { "divss", XM, EX, XX },
+    { "divpd", XM, EX, XX },
+    { "divsd", XM, EX, XX },
+  },
+  /* PREGRP6 */
+  {
+    { "maxps", XM, EX, XX },
+    { "maxss", XM, EX, XX },
+    { "maxpd", XM, EX, XX },
+    { "maxsd", XM, EX, XX },
+  },
+  /* PREGRP7 */
+  {
+    { "minps", XM, EX, XX },
+    { "minss", XM, EX, XX },
+    { "minpd", XM, EX, XX },
+    { "minsd", XM, EX, XX },
+  },
+  /* PREGRP8 */
+  {
+    { "movups", XM, EX, XX },
+    { "movss", XM, EX, XX },
+    { "movupd", XM, EX, XX },
+    { "movsd", XM, EX, XX },
+  },
+  /* PREGRP9 */
+  {
+    { "movups", EX, XM, XX },
+    { "movss", EX, XM, XX },
+    { "movupd", EX, XM, XX },
+    { "movsd", EX, XM, XX },
+  },
+  /* PREGRP10 */
+  {
+    { "mulps", XM, EX, XX },
+    { "mulss", XM, EX, XX },
+    { "mulpd", XM, EX, XX },
+    { "mulsd", XM, EX, XX },
+  },
+  /* PREGRP11 */
+  {
+    { "rcpps", XM, EX, XX },
+    { "rcpss", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP12 */
+  {
+    { "rsqrtps", XM, EX, XX },
+    { "rsqrtss", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP13 */
+  {
+    { "sqrtps", XM, EX, XX },
+    { "sqrtss", XM, EX, XX },
+    { "sqrtpd", XM, EX, XX },
+    { "sqrtsd", XM, EX, XX },
+  },
+  /* PREGRP14 */
+  {
+    { "subps", XM, EX, XX },
+    { "subss", XM, EX, XX },
+    { "subpd", XM, EX, XX },
+    { "subsd", XM, EX, XX },
+  },
+  /* PREGRP15 */
+  {
+    { "(bad)", XM, EX, XX },
+    { "cvtdq2pd", XM, EX, XX },
+    { "cvttpd2dq", XM, EX, XX },
+    { "cvtpd2dq", XM, EX, XX },
+  },
+  /* PREGRP16 */
+  {
+    { "cvtdq2ps", XM, EX, XX },
+    { "cvttps2dq",XM, EX, XX },
+    { "cvtps2dq",XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP17 */
+  {
+    { "cvtps2pd", XM, EX, XX },
+    { "cvtss2sd", XM, EX, XX },
+    { "cvtpd2ps", XM, EX, XX },
+    { "cvtsd2ss", XM, EX, XX },
+  },
+  /* PREGRP18 */
+  {
+    { "maskmovq", MX, MS, XX },
+    { "(bad)", XM, EX, XX },
+    { "maskmovdqu", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP19 */
+  {
+    { "movq", MX, EM, XX },
+    { "movdqu", XM, EX, XX },
+    { "movdqa", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP20 */
+  {
+    { "movq", EM, MX, XX },
+    { "movdqu", EX, XM, XX },
+    { "movdqa", EX, XM, XX },
+    { "(bad)", EX, XM, XX },
+  },
+  /* PREGRP21 */
+  {
+    { "(bad)", EX, XM, XX },
+    { "movq2dq", XM, MS, XX },
+    { "movq", EX, XM, XX },
+    { "movdq2q", MX, XS, XX },
+  },
+  /* PREGRP22 */
+  {
+    { "pshufw", MX, EM, Ib },
+    { "pshufhw", XM, EX, Ib },
+    { "pshufd", XM, EX, Ib },
+    { "pshuflw", XM, EX, Ib },
+  },
+  /* PREGRP23 */
+  {
+    { "movd", Ed, MX, XX },
+    { "movq", XM, EX, XX },
+    { "movd", Ed, XM, XX },
+    { "(bad)", Ed, XM, XX },
+  },
+  /* PREGRP24 */
+  {
+    { "(bad)", MX, EX, XX },
+    { "(bad)", XM, EX, XX },
+    { "punpckhqdq", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+  /* PREGRP25 */
+  {
+  { "movntq", Ev, MX, XX },
+  { "(bad)", Ev, XM, XX },
+  { "movntdq", Ev, XM, XX },
+  { "(bad)", Ev, XM, XX },
+  },
+  /* PREGRP26 */
+  {
+    { "(bad)", MX, EX, XX },
+    { "(bad)", XM, EX, XX },
+    { "punpcklqdq", XM, EX, XX },
+    { "(bad)", XM, EX, XX },
+  },
+};
+
+static const struct dis386 x86_64_table[][2] = {
+  {
+    { "arpl", Ew, Gw, XX },
+    { "movs{||lq|xd}", Gv, Ed, XX },
+  },
+};
+
+#define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
+
+static void
+ckprefix ()
+{
+  int newrex;
+  rex = 0;
+  prefixes = 0;
+  used_prefixes = 0;
+  rex_used = 0;
+  while (1)
+    {
+      FETCH_DATA (the_info, codep + 1);
+      newrex = 0;
+      switch (*codep)
+       {
+       /* REX prefixes family.  */
+       case 0x40:
+       case 0x41:
+       case 0x42:
+       case 0x43:
+       case 0x44:
+       case 0x45:
+       case 0x46:
+       case 0x47:
+       case 0x48:
+       case 0x49:
+       case 0x4a:
+       case 0x4b:
+       case 0x4c:
+       case 0x4d:
+       case 0x4e:
+       case 0x4f:
+           if (mode_64bit)
+             newrex = *codep;
+           else
+             return;
+         break;
+       case 0xf3:
+         prefixes |= PREFIX_REPZ;
+         break;
+       case 0xf2:
+         prefixes |= PREFIX_REPNZ;
+         break;
+       case 0xf0:
+         prefixes |= PREFIX_LOCK;
+         break;
+       case 0x2e:
+         prefixes |= PREFIX_CS;
+         break;
+       case 0x36:
+         prefixes |= PREFIX_SS;
+         break;
+       case 0x3e:
+         prefixes |= PREFIX_DS;
+         break;
+       case 0x26:
+         prefixes |= PREFIX_ES;
+         break;
+       case 0x64:
+         prefixes |= PREFIX_FS;
+         break;
+       case 0x65:
+         prefixes |= PREFIX_GS;
+         break;
+       case 0x66:
+         prefixes |= PREFIX_DATA;
+         break;
+       case 0x67:
+         prefixes |= PREFIX_ADDR;
+         break;
+       case FWAIT_OPCODE:
+         /* fwait is really an instruction.  If there are prefixes
+            before the fwait, they belong to the fwait, *not* to the
+            following instruction.  */
+         if (prefixes)
+           {
+             prefixes |= PREFIX_FWAIT;
+             codep++;
+             return;
+           }
+         prefixes = PREFIX_FWAIT;
+         break;
+       default:
+         return;
+       }
+      /* Rex is ignored when followed by another prefix.  */
+      if (rex)
+       {
+         oappend (prefix_name (rex, 0));
+         oappend (" ");
+       }
+      rex = newrex;
+      codep++;
+    }
+}
+
+/* Return the name of the prefix byte PREF, or NULL if PREF is not a
+   prefix byte.  */
+
+static const char *
+prefix_name (pref, sizeflag)
+     int pref;
+     int sizeflag;
+{
+  switch (pref)
+    {
+    /* REX prefixes family.  */
+    case 0x40:
+      return "rex";
+    case 0x41:
+      return "rexZ";
+    case 0x42:
+      return "rexY";
+    case 0x43:
+      return "rexYZ";
+    case 0x44:
+      return "rexX";
+    case 0x45:
+      return "rexXZ";
+    case 0x46:
+      return "rexXY";
+    case 0x47:
+      return "rexXYZ";
+    case 0x48:
+      return "rex64";
+    case 0x49:
+      return "rex64Z";
+    case 0x4a:
+      return "rex64Y";
+    case 0x4b:
+      return "rex64YZ";
+    case 0x4c:
+      return "rex64X";
+    case 0x4d:
+      return "rex64XZ";
+    case 0x4e:
+      return "rex64XY";
+    case 0x4f:
+      return "rex64XYZ";
+    case 0xf3:
+      return "repz";
+    case 0xf2:
+      return "repnz";
+    case 0xf0:
+      return "lock";
+    case 0x2e:
+      return "cs";
+    case 0x36:
+      return "ss";
+    case 0x3e:
+      return "ds";
+    case 0x26:
+      return "es";
+    case 0x64:
+      return "fs";
+    case 0x65:
+      return "gs";
+    case 0x66:
+      return (sizeflag & DFLAG) ? "data16" : "data32";
+    case 0x67:
+      if (mode_64bit)
+        return (sizeflag & AFLAG) ? "addr32" : "addr64";
+      else
+        return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32";
+    case FWAIT_OPCODE:
+      return "fwait";
+    default:
+      return NULL;
+    }
+}
+
+static char op1out[100], op2out[100], op3out[100];
+static int op_ad, op_index[3];
+static bfd_vma op_address[3];
+static bfd_vma op_riprel[3];
+static bfd_vma start_pc;
+\f
+/*
+ *   On the 386's of 1988, the maximum length of an instruction is 15 bytes.
+ *   (see topic "Redundant prefixes" in the "Differences from 8086"
+ *   section of the "Virtual 8086 Mode" chapter.)
+ * 'pc' should be the address of this instruction, it will
+ *   be used to print the target address if this is a relative jump or call
+ * The function returns the length of this instruction in bytes.
+ */
+
+static char intel_syntax;
+static char open_char;
+static char close_char;
+static char separator_char;
+static char scale_char;
+
+/* Here for backwards compatibility.  When gdb stops using
+   print_insn_i386_att and print_insn_i386_intel these functions can
+   disappear, and print_insn_i386 be merged into print_insn.  */
+int
+print_insn_i386_att (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  intel_syntax = 0;
+
+  return print_insn (pc, info);
+}
+
+int
+print_insn_i386_intel (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  intel_syntax = 1;
+
+  return print_insn (pc, info);
+}
+
+int
+print_insn_i386 (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  intel_syntax = -1;
+
+  return print_insn (pc, info);
+}
+
+static int
+print_insn (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  const struct dis386 *dp;
+  int i;
+  int two_source_ops;
+  char *first, *second, *third;
+  int needcomma;
+  unsigned char uses_SSE_prefix;
+  int sizeflag;
+  const char *p;
+  struct dis_private priv;
+
+  mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
+               || info->mach == bfd_mach_x86_64);
+
+  if (intel_syntax == -1)
+    intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
+                   || info->mach == bfd_mach_x86_64_intel_syntax);
+
+  if (info->mach == bfd_mach_i386_i386
+      || info->mach == bfd_mach_x86_64
+      || info->mach == bfd_mach_i386_i386_intel_syntax
+      || info->mach == bfd_mach_x86_64_intel_syntax)
+    priv.orig_sizeflag = AFLAG | DFLAG;
+  else if (info->mach == bfd_mach_i386_i8086)
+    priv.orig_sizeflag = 0;
+  else
+    abort ();
+
+  for (p = info->disassembler_options; p != NULL; )
+    {
+      if (strncmp (p, "x86-64", 6) == 0)
+       {
+         mode_64bit = 1;
+         priv.orig_sizeflag = AFLAG | DFLAG;
+       }
+      else if (strncmp (p, "i386", 4) == 0)
+       {
+         mode_64bit = 0;
+         priv.orig_sizeflag = AFLAG | DFLAG;
+       }
+      else if (strncmp (p, "i8086", 5) == 0)
+       {
+         mode_64bit = 0;
+         priv.orig_sizeflag = 0;
+       }
+      else if (strncmp (p, "intel", 5) == 0)
+       {
+         intel_syntax = 1;
+       }
+      else if (strncmp (p, "att", 3) == 0)
+       {
+         intel_syntax = 0;
+       }
+      else if (strncmp (p, "addr", 4) == 0)
+       {
+         if (p[4] == '1' && p[5] == '6')
+           priv.orig_sizeflag &= ~AFLAG;
+         else if (p[4] == '3' && p[5] == '2')
+           priv.orig_sizeflag |= AFLAG;
+       }
+      else if (strncmp (p, "data", 4) == 0)
+       {
+         if (p[4] == '1' && p[5] == '6')
+           priv.orig_sizeflag &= ~DFLAG;
+         else if (p[4] == '3' && p[5] == '2')
+           priv.orig_sizeflag |= DFLAG;
+       }
+      else if (strncmp (p, "suffix", 6) == 0)
+       priv.orig_sizeflag |= SUFFIX_ALWAYS;
+
+      p = strchr (p, ',');
+      if (p != NULL)
+       p++;
+    }
+
+  if (intel_syntax)
+    {
+      names64 = intel_names64;
+      names32 = intel_names32;
+      names16 = intel_names16;
+      names8 = intel_names8;
+      names8rex = intel_names8rex;
+      names_seg = intel_names_seg;
+      index16 = intel_index16;
+      open_char = '[';
+      close_char = ']';
+      separator_char = '+';
+      scale_char = '*';
+    }
+  else
+    {
+      names64 = att_names64;
+      names32 = att_names32;
+      names16 = att_names16;
+      names8 = att_names8;
+      names8rex = att_names8rex;
+      names_seg = att_names_seg;
+      index16 = att_index16;
+      open_char = '(';
+      close_char =  ')';
+      separator_char = ',';
+      scale_char = ',';
+    }
+
+  /* The output looks better if we put 7 bytes on a line, since that
+     puts most long word instructions on a single line.  */
+  info->bytes_per_line = 7;
+
+  info->private_data = (PTR) &priv;
+  priv.max_fetched = priv.the_buffer;
+  priv.insn_start = pc;
+
+  obuf[0] = 0;
+  op1out[0] = 0;
+  op2out[0] = 0;
+  op3out[0] = 0;
+
+  op_index[0] = op_index[1] = op_index[2] = -1;
+
+  the_info = info;
+  start_pc = pc;
+  start_codep = priv.the_buffer;
+  codep = priv.the_buffer;
+
+  if (setjmp (priv.bailout) != 0)
+    {
+      const char *name;
+
+      /* Getting here means we tried for data but didn't get it.  That
+        means we have an incomplete instruction of some sort.  Just
+        print the first byte as a prefix or a .byte pseudo-op.  */
+      if (codep > priv.the_buffer)
+       {
+         name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
+         if (name != NULL)
+           (*info->fprintf_func) (info->stream, "%s", name);
+         else
+           {
+             /* Just print the first byte as a .byte instruction.  */
+             (*info->fprintf_func) (info->stream, ".byte 0x%x",
+                                    (unsigned int) priv.the_buffer[0]);
+           }
+
+         return 1;
+       }
+
+      return -1;
+    }
+
+  obufp = obuf;
+  ckprefix ();
+
+  insn_codep = codep;
+  sizeflag = priv.orig_sizeflag;
+
+  FETCH_DATA (info, codep + 1);
+  two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
+
+  if ((prefixes & PREFIX_FWAIT)
+      && ((*codep < 0xd8) || (*codep > 0xdf)))
+    {
+      const char *name;
+
+      /* fwait not followed by floating point instruction.  Print the
+         first prefix, which is probably fwait itself.  */
+      name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
+      if (name == NULL)
+       name = INTERNAL_DISASSEMBLER_ERROR;
+      (*info->fprintf_func) (info->stream, "%s", name);
+      return 1;
+    }
+
+  if (*codep == 0x0f)
+    {
+      FETCH_DATA (info, codep + 2);
+      dp = &dis386_twobyte[*++codep];
+      need_modrm = twobyte_has_modrm[*codep];
+      uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep];
+    }
+  else
+    {
+      dp = &dis386[*codep];
+      need_modrm = onebyte_has_modrm[*codep];
+      uses_SSE_prefix = 0;
+    }
+  codep++;
+
+  if (!uses_SSE_prefix && (prefixes & PREFIX_REPZ))
+    {
+      oappend ("repz ");
+      used_prefixes |= PREFIX_REPZ;
+    }
+  if (!uses_SSE_prefix && (prefixes & PREFIX_REPNZ))
+    {
+      oappend ("repnz ");
+      used_prefixes |= PREFIX_REPNZ;
+    }
+  if (prefixes & PREFIX_LOCK)
+    {
+      oappend ("lock ");
+      used_prefixes |= PREFIX_LOCK;
+    }
+
+  if (prefixes & PREFIX_ADDR)
+    {
+      sizeflag ^= AFLAG;
+      if (dp->bytemode3 != loop_jcxz_mode || intel_syntax)
+       {
+         if ((sizeflag & AFLAG) || mode_64bit)
+           oappend ("addr32 ");
+         else
+           oappend ("addr16 ");
+         used_prefixes |= PREFIX_ADDR;
+       }
+    }
+
+  if (!uses_SSE_prefix && (prefixes & PREFIX_DATA))
+    {
+      sizeflag ^= DFLAG;
+      if (dp->bytemode3 == cond_jump_mode
+         && dp->bytemode1 == v_mode
+         && !intel_syntax)
+       {
+         if (sizeflag & DFLAG)
+           oappend ("data32 ");
+         else
+           oappend ("data16 ");
+         used_prefixes |= PREFIX_DATA;
+       }
+    }
+
+  if (need_modrm)
+    {
+      FETCH_DATA (info, codep + 1);
+      mod = (*codep >> 6) & 3;
+      reg = (*codep >> 3) & 7;
+      rm = *codep & 7;
+    }
+
+  if (dp->name == NULL && dp->bytemode1 == FLOATCODE)
+    {
+      dofloat (sizeflag);
+    }
+  else
+    {
+      int index;
+      if (dp->name == NULL)
+       {
+         switch (dp->bytemode1)
+           {
+           case USE_GROUPS:
+             dp = &grps[dp->bytemode2][reg];
+             break;
+
+           case USE_PREFIX_USER_TABLE:
+             index = 0;
+             used_prefixes |= (prefixes & PREFIX_REPZ);
+             if (prefixes & PREFIX_REPZ)
+               index = 1;
+             else
+               {
+                 used_prefixes |= (prefixes & PREFIX_DATA);
+                 if (prefixes & PREFIX_DATA)
+                   index = 2;
+                 else
+                   {
+                     used_prefixes |= (prefixes & PREFIX_REPNZ);
+                     if (prefixes & PREFIX_REPNZ)
+                       index = 3;
+                   }
+               }
+             dp = &prefix_user_table[dp->bytemode2][index];
+             break;
+
+           case X86_64_SPECIAL:
+             dp = &x86_64_table[dp->bytemode2][mode_64bit];
+             break;
+
+           default:
+             oappend (INTERNAL_DISASSEMBLER_ERROR);
+             break;
+           }
+       }
+
+      if (putop (dp->name, sizeflag) == 0)
+       {
+         obufp = op1out;
+         op_ad = 2;
+         if (dp->op1)
+           (*dp->op1) (dp->bytemode1, sizeflag);
+
+         obufp = op2out;
+         op_ad = 1;
+         if (dp->op2)
+           (*dp->op2) (dp->bytemode2, sizeflag);
+
+         obufp = op3out;
+         op_ad = 0;
+         if (dp->op3)
+           (*dp->op3) (dp->bytemode3, sizeflag);
+       }
+    }
+
+  /* See if any prefixes were not used.  If so, print the first one
+     separately.  If we don't do this, we'll wind up printing an
+     instruction stream which does not precisely correspond to the
+     bytes we are disassembling.  */
+  if ((prefixes & ~used_prefixes) != 0)
+    {
+      const char *name;
+
+      name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
+      if (name == NULL)
+       name = INTERNAL_DISASSEMBLER_ERROR;
+      (*info->fprintf_func) (info->stream, "%s", name);
+      return 1;
+    }
+  if (rex & ~rex_used)
+    {
+      const char *name;
+      name = prefix_name (rex | 0x40, priv.orig_sizeflag);
+      if (name == NULL)
+       name = INTERNAL_DISASSEMBLER_ERROR;
+      (*info->fprintf_func) (info->stream, "%s ", name);
+    }
+
+  obufp = obuf + strlen (obuf);
+  for (i = strlen (obuf); i < 6; i++)
+    oappend (" ");
+  oappend (" ");
+  (*info->fprintf_func) (info->stream, "%s", obuf);
+
+  /* The enter and bound instructions are printed with operands in the same
+     order as the intel book; everything else is printed in reverse order.  */
+  if (intel_syntax || two_source_ops)
+    {
+      first = op1out;
+      second = op2out;
+      third = op3out;
+      op_ad = op_index[0];
+      op_index[0] = op_index[2];
+      op_index[2] = op_ad;
+    }
+  else
+    {
+      first = op3out;
+      second = op2out;
+      third = op1out;
+    }
+  needcomma = 0;
+  if (*first)
+    {
+      if (op_index[0] != -1 && !op_riprel[0])
+       (*info->print_address_func) ((bfd_vma) op_address[op_index[0]], info);
+      else
+       (*info->fprintf_func) (info->stream, "%s", first);
+      needcomma = 1;
+    }
+  if (*second)
+    {
+      if (needcomma)
+       (*info->fprintf_func) (info->stream, ",");
+      if (op_index[1] != -1 && !op_riprel[1])
+       (*info->print_address_func) ((bfd_vma) op_address[op_index[1]], info);
+      else
+       (*info->fprintf_func) (info->stream, "%s", second);
+      needcomma = 1;
+    }
+  if (*third)
+    {
+      if (needcomma)
+       (*info->fprintf_func) (info->stream, ",");
+      if (op_index[2] != -1 && !op_riprel[2])
+       (*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info);
+      else
+       (*info->fprintf_func) (info->stream, "%s", third);
+    }
+  for (i = 0; i < 3; i++)
+    if (op_index[i] != -1 && op_riprel[i])
+      {
+       (*info->fprintf_func) (info->stream, "        # ");
+       (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
+                                               + op_address[op_index[i]]), info);
+      }
+  return codep - priv.the_buffer;
+}
+
+static const char *float_mem[] = {
+  /* d8 */
+  "fadd{s||s|}",
+  "fmul{s||s|}",
+  "fcom{s||s|}",
+  "fcomp{s||s|}",
+  "fsub{s||s|}",
+  "fsubr{s||s|}",
+  "fdiv{s||s|}",
+  "fdivr{s||s|}",
+  /*  d9 */
+  "fld{s||s|}",
+  "(bad)",
+  "fst{s||s|}",
+  "fstp{s||s|}",
+  "fldenv",
+  "fldcw",
+  "fNstenv",
+  "fNstcw",
+  /* da */
+  "fiadd{l||l|}",
+  "fimul{l||l|}",
+  "ficom{l||l|}",
+  "ficomp{l||l|}",
+  "fisub{l||l|}",
+  "fisubr{l||l|}",
+  "fidiv{l||l|}",
+  "fidivr{l||l|}",
+  /* db */
+  "fild{l||l|}",
+  "(bad)",
+  "fist{l||l|}",
+  "fistp{l||l|}",
+  "(bad)",
+  "fld{t||t|}",
+  "(bad)",
+  "fstp{t||t|}",
+  /* dc */
+  "fadd{l||l|}",
+  "fmul{l||l|}",
+  "fcom{l||l|}",
+  "fcomp{l||l|}",
+  "fsub{l||l|}",
+  "fsubr{l||l|}",
+  "fdiv{l||l|}",
+  "fdivr{l||l|}",
+  /* dd */
+  "fld{l||l|}",
+  "(bad)",
+  "fst{l||l|}",
+  "fstp{l||l|}",
+  "frstor",
+  "(bad)",
+  "fNsave",
+  "fNstsw",
+  /* de */
+  "fiadd",
+  "fimul",
+  "ficom",
+  "ficomp",
+  "fisub",
+  "fisubr",
+  "fidiv",
+  "fidivr",
+  /* df */
+  "fild",
+  "(bad)",
+  "fist",
+  "fistp",
+  "fbld",
+  "fild{ll||ll|}",
+  "fbstp",
+  "fistpll",
+};
+
+#define ST OP_ST, 0
+#define STi OP_STi, 0
+
+#define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0
+#define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0
+#define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0
+#define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0
+#define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0
+#define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0
+#define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0
+#define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0
+#define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0
+
+static const struct dis386 float_reg[][8] = {
+  /* d8 */
+  {
+    { "fadd",  ST, STi, XX },
+    { "fmul",  ST, STi, XX },
+    { "fcom",  STi, XX, XX },
+    { "fcomp", STi, XX, XX },
+    { "fsub",  ST, STi, XX },
+    { "fsubr", ST, STi, XX },
+    { "fdiv",  ST, STi, XX },
+    { "fdivr", ST, STi, XX },
+  },
+  /* d9 */
+  {
+    { "fld",   STi, XX, XX },
+    { "fxch",  STi, XX, XX },
+    { FGRPd9_2 },
+    { "(bad)", XX, XX, XX },
+    { FGRPd9_4 },
+    { FGRPd9_5 },
+    { FGRPd9_6 },
+    { FGRPd9_7 },
+  },
+  /* da */
+  {
+    { "fcmovb",        ST, STi, XX },
+    { "fcmove",        ST, STi, XX },
+    { "fcmovbe",ST, STi, XX },
+    { "fcmovu",        ST, STi, XX },
+    { "(bad)", XX, XX, XX },
+    { FGRPda_5 },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* db */
+  {
+    { "fcmovnb",ST, STi, XX },
+    { "fcmovne",ST, STi, XX },
+    { "fcmovnbe",ST, STi, XX },
+    { "fcmovnu",ST, STi, XX },
+    { FGRPdb_4 },
+    { "fucomi",        ST, STi, XX },
+    { "fcomi", ST, STi, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* dc */
+  {
+    { "fadd",  STi, ST, XX },
+    { "fmul",  STi, ST, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+#if UNIXWARE_COMPAT
+    { "fsub",  STi, ST, XX },
+    { "fsubr", STi, ST, XX },
+    { "fdiv",  STi, ST, XX },
+    { "fdivr", STi, ST, XX },
+#else
+    { "fsubr", STi, ST, XX },
+    { "fsub",  STi, ST, XX },
+    { "fdivr", STi, ST, XX },
+    { "fdiv",  STi, ST, XX },
+#endif
+  },
+  /* dd */
+  {
+    { "ffree", STi, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "fst",   STi, XX, XX },
+    { "fstp",  STi, XX, XX },
+    { "fucom", STi, XX, XX },
+    { "fucomp",        STi, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+  },
+  /* de */
+  {
+    { "faddp", STi, ST, XX },
+    { "fmulp", STi, ST, XX },
+    { "(bad)", XX, XX, XX },
+    { FGRPde_3 },
+#if UNIXWARE_COMPAT
+    { "fsubp", STi, ST, XX },
+    { "fsubrp",        STi, ST, XX },
+    { "fdivp", STi, ST, XX },
+    { "fdivrp",        STi, ST, XX },
+#else
+    { "fsubrp",        STi, ST, XX },
+    { "fsubp", STi, ST, XX },
+    { "fdivrp",        STi, ST, XX },
+    { "fdivp", STi, ST, XX },
+#endif
+  },
+  /* df */
+  {
+    { "ffreep",        STi, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { "(bad)", XX, XX, XX },
+    { FGRPdf_4 },
+    { "fucomip",ST, STi, XX },
+    { "fcomip", ST, STi, XX },
+    { "(bad)", XX, XX, XX },
+  },
+};
+
+static char *fgrps[][8] = {
+  /* d9_2  0 */
+  {
+    "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
+  },
+
+  /* d9_4  1 */
+  {
+    "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
+  },
+
+  /* d9_5  2 */
+  {
+    "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
+  },
+
+  /* d9_6  3 */
+  {
+    "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
+  },
+
+  /* d9_7  4 */
+  {
+    "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
+  },
+
+  /* da_5  5 */
+  {
+    "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
+  },
+
+  /* db_4  6 */
+  {
+    "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
+    "fNsetpm(287 only)","(bad)","(bad)","(bad)",
+  },
+
+  /* de_3  7 */
+  {
+    "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
+  },
+
+  /* df_4  8 */
+  {
+    "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
+  },
+};
+
+static void
+dofloat (sizeflag)
+     int sizeflag;
+{
+  const struct dis386 *dp;
+  unsigned char floatop;
+
+  floatop = codep[-1];
+
+  if (mod != 3)
+    {
+      putop (float_mem[(floatop - 0xd8) * 8 + reg], sizeflag);
+      obufp = op1out;
+      if (floatop == 0xdb)
+        OP_E (x_mode, sizeflag);
+      else if (floatop == 0xdd)
+        OP_E (d_mode, sizeflag);
+      else
+        OP_E (v_mode, sizeflag);
+      return;
+    }
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+
+  dp = &float_reg[floatop - 0xd8][reg];
+  if (dp->name == NULL)
+    {
+      putop (fgrps[dp->bytemode1][rm], sizeflag);
+
+      /* Instruction fnstsw is only one with strange arg.  */
+      if (floatop == 0xdf && codep[-1] == 0xe0)
+       strcpy (op1out, names16[0]);
+    }
+  else
+    {
+      putop (dp->name, sizeflag);
+
+      obufp = op1out;
+      if (dp->op1)
+       (*dp->op1) (dp->bytemode1, sizeflag);
+      obufp = op2out;
+      if (dp->op2)
+       (*dp->op2) (dp->bytemode2, sizeflag);
+    }
+}
+
+static void
+OP_ST (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  oappend ("%st");
+}
+
+static void
+OP_STi (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  sprintf (scratchbuf, "%%st(%d)", rm);
+  oappend (scratchbuf + intel_syntax);
+}
+
+/* Capital letters in template are macros.  */
+static int
+putop (template, sizeflag)
+     const char *template;
+     int sizeflag;
+{
+  const char *p;
+  int alt;
+
+  for (p = template; *p; p++)
+    {
+      switch (*p)
+       {
+       default:
+         *obufp++ = *p;
+         break;
+       case '{':
+         alt = 0;
+         if (intel_syntax)
+           alt += 1;
+         if (mode_64bit)
+           alt += 2;
+         while (alt != 0)
+           {
+             while (*++p != '|')
+               {
+                 if (*p == '}')
+                   {
+                     /* Alternative not valid.  */
+                     strcpy (obuf, "(bad)");
+                     obufp = obuf + 5;
+                     return 1;
+                   }
+                 else if (*p == '\0')
+                   abort ();
+               }
+             alt--;
+           }
+         break;
+       case '|':
+         while (*++p != '}')
+           {
+             if (*p == '\0')
+               abort ();
+           }
+         break;
+       case '}':
+         break;
+       case 'A':
+          if (intel_syntax)
+            break;
+         if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
+           *obufp++ = 'b';
+         break;
+       case 'B':
+          if (intel_syntax)
+            break;
+         if (sizeflag & SUFFIX_ALWAYS)
+           *obufp++ = 'b';
+         break;
+       case 'E':               /* For jcxz/jecxz */
+         if (mode_64bit)
+           {
+             if (sizeflag & AFLAG)
+               *obufp++ = 'r';
+             else
+               *obufp++ = 'e';
+           }
+         else
+           if (sizeflag & AFLAG)
+             *obufp++ = 'e';
+         used_prefixes |= (prefixes & PREFIX_ADDR);
+         break;
+       case 'F':
+          if (intel_syntax)
+            break;
+         if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
+           {
+             if (sizeflag & AFLAG)
+               *obufp++ = mode_64bit ? 'q' : 'l';
+             else
+               *obufp++ = mode_64bit ? 'l' : 'w';
+             used_prefixes |= (prefixes & PREFIX_ADDR);
+           }
+         break;
+       case 'H':
+          if (intel_syntax)
+            break;
+         if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
+             || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
+           {
+             used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS);
+             *obufp++ = ',';
+             *obufp++ = 'p';
+             if (prefixes & PREFIX_DS)
+               *obufp++ = 't';
+             else
+               *obufp++ = 'n';
+           }
+         break;
+       case 'L':
+          if (intel_syntax)
+            break;
+         if (sizeflag & SUFFIX_ALWAYS)
+           *obufp++ = 'l';
+         break;
+       case 'N':
+         if ((prefixes & PREFIX_FWAIT) == 0)
+           *obufp++ = 'n';
+         else
+           used_prefixes |= PREFIX_FWAIT;
+         break;
+       case 'O':
+         USED_REX (REX_MODE64);
+         if (rex & REX_MODE64)
+           *obufp++ = 'o';
+         else
+           *obufp++ = 'd';
+         break;
+       case 'T':
+          if (intel_syntax)
+            break;
+         if (mode_64bit)
+           {
+             *obufp++ = 'q';
+             break;
+           }
+         /* Fall through.  */
+       case 'P':
+          if (intel_syntax)
+            break;
+         if ((prefixes & PREFIX_DATA)
+             || (rex & REX_MODE64)
+             || (sizeflag & SUFFIX_ALWAYS))
+           {
+             USED_REX (REX_MODE64);
+             if (rex & REX_MODE64)
+               *obufp++ = 'q';
+             else
+               {
+                  if (sizeflag & DFLAG)
+                     *obufp++ = 'l';
+                  else
+                    *obufp++ = 'w';
+                  used_prefixes |= (prefixes & PREFIX_DATA);
+               }
+           }
+         break;
+       case 'U':
+          if (intel_syntax)
+            break;
+         if (mode_64bit)
+           {
+             *obufp++ = 'q';
+             break;
+           }
+         /* Fall through.  */
+       case 'Q':
+          if (intel_syntax)
+            break;
+         USED_REX (REX_MODE64);
+         if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
+           {
+             if (rex & REX_MODE64)
+               *obufp++ = 'q';
+             else
+               {
+                 if (sizeflag & DFLAG)
+                   *obufp++ = 'l';
+                 else
+                   *obufp++ = 'w';
+                 used_prefixes |= (prefixes & PREFIX_DATA);
+               }
+           }
+         break;
+       case 'R':
+         USED_REX (REX_MODE64);
+          if (intel_syntax)
+           {
+             if (rex & REX_MODE64)
+               {
+                 *obufp++ = 'q';
+                 *obufp++ = 't';
+               }
+             else if (sizeflag & DFLAG)
+               {
+                 *obufp++ = 'd';
+                 *obufp++ = 'q';
+               }
+             else
+               {
+                 *obufp++ = 'w';
+                 *obufp++ = 'd';
+               }
+           }
+         else
+           {
+             if (rex & REX_MODE64)
+               *obufp++ = 'q';
+             else if (sizeflag & DFLAG)
+               *obufp++ = 'l';
+             else
+               *obufp++ = 'w';
+           }
+         if (!(rex & REX_MODE64))
+           used_prefixes |= (prefixes & PREFIX_DATA);
+         break;
+       case 'S':
+          if (intel_syntax)
+            break;
+         if (sizeflag & SUFFIX_ALWAYS)
+           {
+             if (rex & REX_MODE64)
+               *obufp++ = 'q';
+             else
+               {
+                 if (sizeflag & DFLAG)
+                   *obufp++ = 'l';
+                 else
+                   *obufp++ = 'w';
+                 used_prefixes |= (prefixes & PREFIX_DATA);
+               }
+           }
+         break;
+       case 'X':
+         if (prefixes & PREFIX_DATA)
+           *obufp++ = 'd';
+         else
+           *obufp++ = 's';
+          used_prefixes |= (prefixes & PREFIX_DATA);
+         break;
+       case 'Y':
+          if (intel_syntax)
+            break;
+         if (rex & REX_MODE64)
+           {
+             USED_REX (REX_MODE64);
+             *obufp++ = 'q';
+           }
+         break;
+         /* implicit operand size 'l' for i386 or 'q' for x86-64 */
+       case 'W':
+         /* operand size flag for cwtl, cbtw */
+         USED_REX (0);
+         if (rex)
+           *obufp++ = 'l';
+         else if (sizeflag & DFLAG)
+           *obufp++ = 'w';
+         else
+           *obufp++ = 'b';
+          if (intel_syntax)
+           {
+             if (rex)
+               {
+                 *obufp++ = 'q';
+                 *obufp++ = 'e';
+               }
+             if (sizeflag & DFLAG)
+               {
+                 *obufp++ = 'd';
+                 *obufp++ = 'e';
+               }
+             else
+               {
+                 *obufp++ = 'w';
+               }
+           }
+         if (!rex)
+           used_prefixes |= (prefixes & PREFIX_DATA);
+         break;
+       }
+    }
+  *obufp = 0;
+  return 0;
+}
+
+static void
+oappend (s)
+     const char *s;
+{
+  strcpy (obufp, s);
+  obufp += strlen (s);
+}
+
+static void
+append_seg ()
+{
+  if (prefixes & PREFIX_CS)
+    {
+      used_prefixes |= PREFIX_CS;
+      oappend ("%cs:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_DS)
+    {
+      used_prefixes |= PREFIX_DS;
+      oappend ("%ds:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_SS)
+    {
+      used_prefixes |= PREFIX_SS;
+      oappend ("%ss:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_ES)
+    {
+      used_prefixes |= PREFIX_ES;
+      oappend ("%es:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_FS)
+    {
+      used_prefixes |= PREFIX_FS;
+      oappend ("%fs:" + intel_syntax);
+    }
+  if (prefixes & PREFIX_GS)
+    {
+      used_prefixes |= PREFIX_GS;
+      oappend ("%gs:" + intel_syntax);
+    }
+}
+
+static void
+OP_indirE (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (!intel_syntax)
+    oappend ("*");
+  OP_E (bytemode, sizeflag);
+}
+
+static void
+print_operand_value (buf, hex, disp)
+  char *buf;
+  int hex;
+  bfd_vma disp;
+{
+  if (mode_64bit)
+    {
+      if (hex)
+       {
+         char tmp[30];
+         int i;
+         buf[0] = '0';
+         buf[1] = 'x';
+         sprintf_vma (tmp, disp);
+         for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
+         strcpy (buf + 2, tmp + i);
+       }
+      else
+       {
+         bfd_signed_vma v = disp;
+         char tmp[30];
+         int i;
+         if (v < 0)
+           {
+             *(buf++) = '-';
+             v = -disp;
+             /* Check for possible overflow on 0x8000000000000000.  */
+             if (v < 0)
+               {
+                 strcpy (buf, "9223372036854775808");
+                 return;
+               }
+           }
+         if (!v)
+           {
+             strcpy (buf, "0");
+             return;
+           }
+
+         i = 0;
+         tmp[29] = 0;
+         while (v)
+           {
+             tmp[28 - i] = (v % 10) + '0';
+             v /= 10;
+             i++;
+           }
+         strcpy (buf, tmp + 29 - i);
+       }
+    }
+  else
+    {
+      if (hex)
+       sprintf (buf, "0x%x", (unsigned int) disp);
+      else
+       sprintf (buf, "%d", (int) disp);
+    }
+}
+
+static void
+OP_E (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_vma disp;
+  int add = 0;
+  int riprel = 0;
+  USED_REX (REX_EXTZ);
+  if (rex & REX_EXTZ)
+    add += 8;
+
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+
+  if (mod == 3)
+    {
+      switch (bytemode)
+       {
+       case b_mode:
+         USED_REX (0);
+         if (rex)
+           oappend (names8rex[rm + add]);
+         else
+           oappend (names8[rm + add]);
+         break;
+       case w_mode:
+         oappend (names16[rm + add]);
+         break;
+       case d_mode:
+         oappend (names32[rm + add]);
+         break;
+       case q_mode:
+         oappend (names64[rm + add]);
+         break;
+       case m_mode:
+         if (mode_64bit)
+           oappend (names64[rm + add]);
+         else
+           oappend (names32[rm + add]);
+         break;
+       case v_mode:
+         USED_REX (REX_MODE64);
+         if (rex & REX_MODE64)
+           oappend (names64[rm + add]);
+         else if (sizeflag & DFLAG)
+           oappend (names32[rm + add]);
+         else
+           oappend (names16[rm + add]);
+         used_prefixes |= (prefixes & PREFIX_DATA);
+         break;
+       case 0:
+         if (!(codep[-2] == 0xAE && codep[-1] == 0xF8 /* sfence */)
+             && !(codep[-2] == 0xAE && codep[-1] == 0xF0 /* mfence */)
+             && !(codep[-2] == 0xAE && codep[-1] == 0xe8 /* lfence */))
+           BadOp ();   /* bad sfence,lea,lds,les,lfs,lgs,lss modrm */
+         break;
+       default:
+         oappend (INTERNAL_DISASSEMBLER_ERROR);
+         break;
+       }
+      return;
+    }
+
+  disp = 0;
+  append_seg ();
+
+  if ((sizeflag & AFLAG) || mode_64bit) /* 32 bit address mode */
+    {
+      int havesib;
+      int havebase;
+      int base;
+      int index = 0;
+      int scale = 0;
+
+      havesib = 0;
+      havebase = 1;
+      base = rm;
+
+      if (base == 4)
+       {
+         havesib = 1;
+         FETCH_DATA (the_info, codep + 1);
+         scale = (*codep >> 6) & 3;
+         index = (*codep >> 3) & 7;
+         base = *codep & 7;
+         USED_REX (REX_EXTY);
+         USED_REX (REX_EXTZ);
+         if (rex & REX_EXTY)
+           index += 8;
+         if (rex & REX_EXTZ)
+           base += 8;
+         codep++;
+       }
+
+      switch (mod)
+       {
+       case 0:
+         if ((base & 7) == 5)
+           {
+             havebase = 0;
+             if (mode_64bit && !havesib && (sizeflag & AFLAG))
+               riprel = 1;
+             disp = get32s ();
+           }
+         break;
+       case 1:
+         FETCH_DATA (the_info, codep + 1);
+         disp = *codep++;
+         if ((disp & 0x80) != 0)
+           disp -= 0x100;
+         break;
+       case 2:
+         disp = get32s ();
+         break;
+       }
+
+      if (!intel_syntax)
+        if (mod != 0 || (base & 7) == 5)
+          {
+           print_operand_value (scratchbuf, !riprel, disp);
+            oappend (scratchbuf);
+           if (riprel)
+             {
+               set_op (disp, 1);
+               oappend ("(%rip)");
+             }
+          }
+
+      if (havebase || (havesib && (index != 4 || scale != 0)))
+       {
+          if (intel_syntax)
+            {
+              switch (bytemode)
+                {
+                case b_mode:
+                  oappend ("BYTE PTR ");
+                  break;
+                case w_mode:
+                  oappend ("WORD PTR ");
+                  break;
+                case v_mode:
+                  oappend ("DWORD PTR ");
+                  break;
+                case d_mode:
+                  oappend ("QWORD PTR ");
+                  break;
+                case m_mode:
+                 if (mode_64bit)
+                   oappend ("DWORD PTR ");
+                 else
+                   oappend ("QWORD PTR ");
+                 break;
+                case x_mode:
+                  oappend ("XWORD PTR ");
+                  break;
+                default:
+                  break;
+                }
+             }
+         *obufp++ = open_char;
+         if (intel_syntax && riprel)
+           oappend ("rip + ");
+          *obufp = '\0';
+         USED_REX (REX_EXTZ);
+         if (!havesib && (rex & REX_EXTZ))
+           base += 8;
+         if (havebase)
+           oappend (mode_64bit && (sizeflag & AFLAG)
+                    ? names64[base] : names32[base]);
+         if (havesib)
+           {
+             if (index != 4)
+               {
+                  if (intel_syntax)
+                    {
+                      if (havebase)
+                        {
+                          *obufp++ = separator_char;
+                          *obufp = '\0';
+                        }
+                      sprintf (scratchbuf, "%s",
+                              mode_64bit && (sizeflag & AFLAG)
+                              ? names64[index] : names32[index]);
+                    }
+                  else
+                   sprintf (scratchbuf, ",%s",
+                            mode_64bit && (sizeflag & AFLAG)
+                            ? names64[index] : names32[index]);
+                 oappend (scratchbuf);
+               }
+              if (!intel_syntax
+                  || (intel_syntax
+                      && bytemode != b_mode
+                      && bytemode != w_mode
+                      && bytemode != v_mode))
+                {
+                  *obufp++ = scale_char;
+                  *obufp = '\0';
+                 sprintf (scratchbuf, "%d", 1 << scale);
+                 oappend (scratchbuf);
+                }
+           }
+          if (intel_syntax)
+            if (mod != 0 || (base & 7) == 5)
+              {
+               /* Don't print zero displacements.  */
+                if (disp != 0)
+                  {
+                   if ((bfd_signed_vma) disp > 0)
+                     {
+                       *obufp++ = '+';
+                       *obufp = '\0';
+                     }
+
+                   print_operand_value (scratchbuf, 0, disp);
+                    oappend (scratchbuf);
+                  }
+              }
+
+         *obufp++ = close_char;
+          *obufp = '\0';
+       }
+      else if (intel_syntax)
+        {
+          if (mod != 0 || (base & 7) == 5)
+            {
+             if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
+                             | PREFIX_ES | PREFIX_FS | PREFIX_GS))
+               ;
+             else
+               {
+                 oappend (names_seg[ds_reg - es_reg]);
+                 oappend (":");
+               }
+             print_operand_value (scratchbuf, 1, disp);
+              oappend (scratchbuf);
+            }
+        }
+    }
+  else
+    { /* 16 bit address mode */
+      switch (mod)
+       {
+       case 0:
+         if ((rm & 7) == 6)
+           {
+             disp = get16 ();
+             if ((disp & 0x8000) != 0)
+               disp -= 0x10000;
+           }
+         break;
+       case 1:
+         FETCH_DATA (the_info, codep + 1);
+         disp = *codep++;
+         if ((disp & 0x80) != 0)
+           disp -= 0x100;
+         break;
+       case 2:
+         disp = get16 ();
+         if ((disp & 0x8000) != 0)
+           disp -= 0x10000;
+         break;
+       }
+
+      if (!intel_syntax)
+        if (mod != 0 || (rm & 7) == 6)
+          {
+           print_operand_value (scratchbuf, 0, disp);
+            oappend (scratchbuf);
+          }
+
+      if (mod != 0 || (rm & 7) != 6)
+       {
+         *obufp++ = open_char;
+          *obufp = '\0';
+         oappend (index16[rm + add]);
+          *obufp++ = close_char;
+          *obufp = '\0';
+       }
+    }
+}
+
+static void
+OP_G (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add += 8;
+  switch (bytemode)
+    {
+    case b_mode:
+      USED_REX (0);
+      if (rex)
+       oappend (names8rex[reg + add]);
+      else
+       oappend (names8[reg + add]);
+      break;
+    case w_mode:
+      oappend (names16[reg + add]);
+      break;
+    case d_mode:
+      oappend (names32[reg + add]);
+      break;
+    case q_mode:
+      oappend (names64[reg + add]);
+      break;
+    case v_mode:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       oappend (names64[reg + add]);
+      else if (sizeflag & DFLAG)
+       oappend (names32[reg + add]);
+      else
+       oappend (names16[reg + add]);
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      break;
+    }
+}
+
+static bfd_vma
+get64 ()
+{
+  bfd_vma x;
+#ifdef BFD64
+  unsigned int a;
+  unsigned int b;
+
+  FETCH_DATA (the_info, codep + 8);
+  a = *codep++ & 0xff;
+  a |= (*codep++ & 0xff) << 8;
+  a |= (*codep++ & 0xff) << 16;
+  a |= (*codep++ & 0xff) << 24;
+  b = *codep++ & 0xff;
+  b |= (*codep++ & 0xff) << 8;
+  b |= (*codep++ & 0xff) << 16;
+  b |= (*codep++ & 0xff) << 24;
+  x = a + ((bfd_vma) b << 32);
+#else
+  abort ();
+  x = 0;
+#endif
+  return x;
+}
+
+static bfd_signed_vma
+get32 ()
+{
+  bfd_signed_vma x = 0;
+
+  FETCH_DATA (the_info, codep + 4);
+  x = *codep++ & (bfd_signed_vma) 0xff;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
+  return x;
+}
+
+static bfd_signed_vma
+get32s ()
+{
+  bfd_signed_vma x = 0;
+
+  FETCH_DATA (the_info, codep + 4);
+  x = *codep++ & (bfd_signed_vma) 0xff;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
+  x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
+
+  x = (x ^ ((bfd_signed_vma) 1 << 31)) - ((bfd_signed_vma) 1 << 31);
+
+  return x;
+}
+
+static int
+get16 ()
+{
+  int x = 0;
+
+  FETCH_DATA (the_info, codep + 2);
+  x = *codep++ & 0xff;
+  x |= (*codep++ & 0xff) << 8;
+  return x;
+}
+
+static void
+set_op (op, riprel)
+     bfd_vma op;
+     int riprel;
+{
+  op_index[op_ad] = op_ad;
+  if (mode_64bit)
+    {
+      op_address[op_ad] = op;
+      op_riprel[op_ad] = riprel;
+    }
+  else
+    {
+      /* Mask to get a 32-bit address.  */
+      op_address[op_ad] = op & 0xffffffff;
+      op_riprel[op_ad] = riprel & 0xffffffff;
+    }
+}
+
+static void
+OP_REG (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  const char *s;
+  int add = 0;
+  USED_REX (REX_EXTZ);
+  if (rex & REX_EXTZ)
+    add = 8;
+
+  switch (code)
+    {
+    case indir_dx_reg:
+      if (intel_syntax)
+        s = "[dx]";
+      else
+        s = "(%dx)";
+      break;
+    case ax_reg: case cx_reg: case dx_reg: case bx_reg:
+    case sp_reg: case bp_reg: case si_reg: case di_reg:
+      s = names16[code - ax_reg + add];
+      break;
+    case es_reg: case ss_reg: case cs_reg:
+    case ds_reg: case fs_reg: case gs_reg:
+      s = names_seg[code - es_reg + add];
+      break;
+    case al_reg: case ah_reg: case cl_reg: case ch_reg:
+    case dl_reg: case dh_reg: case bl_reg: case bh_reg:
+      USED_REX (0);
+      if (rex)
+       s = names8rex[code - al_reg + add];
+      else
+       s = names8[code - al_reg];
+      break;
+    case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
+    case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
+      if (mode_64bit)
+       {
+         s = names64[code - rAX_reg + add];
+         break;
+       }
+      code += eAX_reg - rAX_reg;
+      /* Fall through.  */
+    case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
+    case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       s = names64[code - eAX_reg + add];
+      else if (sizeflag & DFLAG)
+       s = names32[code - eAX_reg + add];
+      else
+       s = names16[code - eAX_reg + add];
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    default:
+      s = INTERNAL_DISASSEMBLER_ERROR;
+      break;
+    }
+  oappend (s);
+}
+
+static void
+OP_IMREG (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  const char *s;
+
+  switch (code)
+    {
+    case indir_dx_reg:
+      if (intel_syntax)
+        s = "[dx]";
+      else
+        s = "(%dx)";
+      break;
+    case ax_reg: case cx_reg: case dx_reg: case bx_reg:
+    case sp_reg: case bp_reg: case si_reg: case di_reg:
+      s = names16[code - ax_reg];
+      break;
+    case es_reg: case ss_reg: case cs_reg:
+    case ds_reg: case fs_reg: case gs_reg:
+      s = names_seg[code - es_reg];
+      break;
+    case al_reg: case ah_reg: case cl_reg: case ch_reg:
+    case dl_reg: case dh_reg: case bl_reg: case bh_reg:
+      USED_REX (0);
+      if (rex)
+       s = names8rex[code - al_reg];
+      else
+       s = names8[code - al_reg];
+      break;
+    case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
+    case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       s = names64[code - eAX_reg];
+      else if (sizeflag & DFLAG)
+       s = names32[code - eAX_reg];
+      else
+       s = names16[code - eAX_reg];
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    default:
+      s = INTERNAL_DISASSEMBLER_ERROR;
+      break;
+    }
+  oappend (s);
+}
+
+static void
+OP_I (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_signed_vma op;
+  bfd_signed_vma mask = -1;
+
+  switch (bytemode)
+    {
+    case b_mode:
+      FETCH_DATA (the_info, codep + 1);
+      op = *codep++;
+      mask = 0xff;
+      break;
+    case q_mode:
+      if (mode_64bit)
+       {
+         op = get32s ();
+         break;
+       }
+      /* Fall through.  */
+    case v_mode:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       op = get32s ();
+      else if (sizeflag & DFLAG)
+       {
+         op = get32 ();
+         mask = 0xffffffff;
+       }
+      else
+       {
+         op = get16 ();
+         mask = 0xfffff;
+       }
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    case w_mode:
+      mask = 0xfffff;
+      op = get16 ();
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      return;
+    }
+
+  op &= mask;
+  scratchbuf[0] = '$';
+  print_operand_value (scratchbuf + 1, 1, op);
+  oappend (scratchbuf + intel_syntax);
+  scratchbuf[0] = '\0';
+}
+
+static void
+OP_I64 (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_signed_vma op;
+  bfd_signed_vma mask = -1;
+
+  if (!mode_64bit)
+    {
+      OP_I (bytemode, sizeflag);
+      return;
+    }
+
+  switch (bytemode)
+    {
+    case b_mode:
+      FETCH_DATA (the_info, codep + 1);
+      op = *codep++;
+      mask = 0xff;
+      break;
+    case v_mode:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       op = get64 ();
+      else if (sizeflag & DFLAG)
+       {
+         op = get32 ();
+         mask = 0xffffffff;
+       }
+      else
+       {
+         op = get16 ();
+         mask = 0xfffff;
+       }
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    case w_mode:
+      mask = 0xfffff;
+      op = get16 ();
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      return;
+    }
+
+  op &= mask;
+  scratchbuf[0] = '$';
+  print_operand_value (scratchbuf + 1, 1, op);
+  oappend (scratchbuf + intel_syntax);
+  scratchbuf[0] = '\0';
+}
+
+static void
+OP_sI (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_signed_vma op;
+  bfd_signed_vma mask = -1;
+
+  switch (bytemode)
+    {
+    case b_mode:
+      FETCH_DATA (the_info, codep + 1);
+      op = *codep++;
+      if ((op & 0x80) != 0)
+       op -= 0x100;
+      mask = 0xffffffff;
+      break;
+    case v_mode:
+      USED_REX (REX_MODE64);
+      if (rex & REX_MODE64)
+       op = get32s ();
+      else if (sizeflag & DFLAG)
+       {
+         op = get32s ();
+         mask = 0xffffffff;
+       }
+      else
+       {
+         mask = 0xffffffff;
+         op = get16 ();
+         if ((op & 0x8000) != 0)
+           op -= 0x10000;
+       }
+      used_prefixes |= (prefixes & PREFIX_DATA);
+      break;
+    case w_mode:
+      op = get16 ();
+      mask = 0xffffffff;
+      if ((op & 0x8000) != 0)
+       op -= 0x10000;
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      return;
+    }
+
+  scratchbuf[0] = '$';
+  print_operand_value (scratchbuf + 1, 1, op);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_J (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  bfd_vma disp;
+  bfd_vma mask = -1;
+
+  switch (bytemode)
+    {
+    case b_mode:
+      FETCH_DATA (the_info, codep + 1);
+      disp = *codep++;
+      if ((disp & 0x80) != 0)
+       disp -= 0x100;
+      break;
+    case v_mode:
+      if (sizeflag & DFLAG)
+       disp = get32s ();
+      else
+       {
+         disp = get16 ();
+         /* For some reason, a data16 prefix on a jump instruction
+            means that the pc is masked to 16 bits after the
+            displacement is added!  */
+         mask = 0xffff;
+       }
+      break;
+    default:
+      oappend (INTERNAL_DISASSEMBLER_ERROR);
+      return;
+    }
+  disp = (start_pc + codep - start_codep + disp) & mask;
+  set_op (disp, 0);
+  print_operand_value (scratchbuf, 1, disp);
+  oappend (scratchbuf);
+}
+
+static void
+OP_SEG (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  oappend (names_seg[reg]);
+}
+
+static void
+OP_DIR (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag;
+{
+  int seg, offset;
+
+  if (sizeflag & DFLAG)
+    {
+      offset = get32 ();
+      seg = get16 ();
+    }
+  else
+    {
+      offset = get16 ();
+      seg = get16 ();
+    }
+  used_prefixes |= (prefixes & PREFIX_DATA);
+  if (intel_syntax)
+    sprintf (scratchbuf, "0x%x,0x%x", seg, offset);
+  else
+    sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
+  oappend (scratchbuf);
+}
+
+static void
+OP_OFF (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag;
+{
+  bfd_vma off;
+
+  append_seg ();
+
+  if ((sizeflag & AFLAG) || mode_64bit)
+    off = get32 ();
+  else
+    off = get16 ();
+
+  if (intel_syntax)
+    {
+      if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
+                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
+       {
+         oappend (names_seg[ds_reg - es_reg]);
+         oappend (":");
+       }
+    }
+  print_operand_value (scratchbuf, 1, off);
+  oappend (scratchbuf);
+}
+
+static void
+OP_OFF64 (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  bfd_vma off;
+
+  if (!mode_64bit)
+    {
+      OP_OFF (bytemode, sizeflag);
+      return;
+    }
+
+  append_seg ();
+
+  off = get64 ();
+
+  if (intel_syntax)
+    {
+      if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
+                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
+       {
+         oappend (names_seg[ds_reg - es_reg]);
+         oappend (":");
+       }
+    }
+  print_operand_value (scratchbuf, 1, off);
+  oappend (scratchbuf);
+}
+
+static void
+ptr_reg (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  const char *s;
+  if (intel_syntax)
+    oappend ("[");
+  else
+    oappend ("(");
+
+  USED_REX (REX_MODE64);
+  if (rex & REX_MODE64)
+    {
+      if (!(sizeflag & AFLAG))
+        s = names32[code - eAX_reg];
+      else
+        s = names64[code - eAX_reg];
+    }
+  else if (sizeflag & AFLAG)
+    s = names32[code - eAX_reg];
+  else
+    s = names16[code - eAX_reg];
+  oappend (s);
+  if (intel_syntax)
+    oappend ("]");
+  else
+    oappend (")");
+}
+
+static void
+OP_ESreg (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  oappend ("%es:" + intel_syntax);
+  ptr_reg (code, sizeflag);
+}
+
+static void
+OP_DSreg (code, sizeflag)
+     int code;
+     int sizeflag;
+{
+  if ((prefixes
+       & (PREFIX_CS
+         | PREFIX_DS
+         | PREFIX_SS
+         | PREFIX_ES
+         | PREFIX_FS
+         | PREFIX_GS)) == 0)
+    prefixes |= PREFIX_DS;
+  append_seg ();
+  ptr_reg (code, sizeflag);
+}
+
+static void
+OP_C (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add = 8;
+  sprintf (scratchbuf, "%%cr%d", reg + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_D (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add = 8;
+  if (intel_syntax)
+    sprintf (scratchbuf, "db%d", reg + add);
+  else
+    sprintf (scratchbuf, "%%db%d", reg + add);
+  oappend (scratchbuf);
+}
+
+static void
+OP_T (dummy, sizeflag)
+     int dummy ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  sprintf (scratchbuf, "%%tr%d", reg);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_Rd (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (mod == 3)
+    OP_E (bytemode, sizeflag);
+  else
+    BadOp ();
+}
+
+static void
+OP_MMX (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add = 8;
+  used_prefixes |= (prefixes & PREFIX_DATA);
+  if (prefixes & PREFIX_DATA)
+    sprintf (scratchbuf, "%%xmm%d", reg + add);
+  else
+    sprintf (scratchbuf, "%%mm%d", reg + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_XMM (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  int add = 0;
+  USED_REX (REX_EXTX);
+  if (rex & REX_EXTX)
+    add = 8;
+  sprintf (scratchbuf, "%%xmm%d", reg + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_EM (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  int add = 0;
+  if (mod != 3)
+    {
+      OP_E (bytemode, sizeflag);
+      return;
+    }
+  USED_REX (REX_EXTZ);
+  if (rex & REX_EXTZ)
+    add = 8;
+
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+  used_prefixes |= (prefixes & PREFIX_DATA);
+  if (prefixes & PREFIX_DATA)
+    sprintf (scratchbuf, "%%xmm%d", rm + add);
+  else
+    sprintf (scratchbuf, "%%mm%d", rm + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_EX (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  int add = 0;
+  if (mod != 3)
+    {
+      OP_E (bytemode, sizeflag);
+      return;
+    }
+  USED_REX (REX_EXTZ);
+  if (rex & REX_EXTZ)
+    add = 8;
+
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+  sprintf (scratchbuf, "%%xmm%d", rm + add);
+  oappend (scratchbuf + intel_syntax);
+}
+
+static void
+OP_MS (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (mod == 3)
+    OP_EM (bytemode, sizeflag);
+  else
+    BadOp ();
+}
+
+static void
+OP_XS (bytemode, sizeflag)
+     int bytemode;
+     int sizeflag;
+{
+  if (mod == 3)
+    OP_EX (bytemode, sizeflag);
+  else
+    BadOp ();
+}
+
+static const char *Suffix3DNow[] = {
+/* 00 */       NULL,           NULL,           NULL,           NULL,
+/* 04 */       NULL,           NULL,           NULL,           NULL,
+/* 08 */       NULL,           NULL,           NULL,           NULL,
+/* 0C */       "pi2fw",        "pi2fd",        NULL,           NULL,
+/* 10 */       NULL,           NULL,           NULL,           NULL,
+/* 14 */       NULL,           NULL,           NULL,           NULL,
+/* 18 */       NULL,           NULL,           NULL,           NULL,
+/* 1C */       "pf2iw",        "pf2id",        NULL,           NULL,
+/* 20 */       NULL,           NULL,           NULL,           NULL,
+/* 24 */       NULL,           NULL,           NULL,           NULL,
+/* 28 */       NULL,           NULL,           NULL,           NULL,
+/* 2C */       NULL,           NULL,           NULL,           NULL,
+/* 30 */       NULL,           NULL,           NULL,           NULL,
+/* 34 */       NULL,           NULL,           NULL,           NULL,
+/* 38 */       NULL,           NULL,           NULL,           NULL,
+/* 3C */       NULL,           NULL,           NULL,           NULL,
+/* 40 */       NULL,           NULL,           NULL,           NULL,
+/* 44 */       NULL,           NULL,           NULL,           NULL,
+/* 48 */       NULL,           NULL,           NULL,           NULL,
+/* 4C */       NULL,           NULL,           NULL,           NULL,
+/* 50 */       NULL,           NULL,           NULL,           NULL,
+/* 54 */       NULL,           NULL,           NULL,           NULL,
+/* 58 */       NULL,           NULL,           NULL,           NULL,
+/* 5C */       NULL,           NULL,           NULL,           NULL,
+/* 60 */       NULL,           NULL,           NULL,           NULL,
+/* 64 */       NULL,           NULL,           NULL,           NULL,
+/* 68 */       NULL,           NULL,           NULL,           NULL,
+/* 6C */       NULL,           NULL,           NULL,           NULL,
+/* 70 */       NULL,           NULL,           NULL,           NULL,
+/* 74 */       NULL,           NULL,           NULL,           NULL,
+/* 78 */       NULL,           NULL,           NULL,           NULL,
+/* 7C */       NULL,           NULL,           NULL,           NULL,
+/* 80 */       NULL,           NULL,           NULL,           NULL,
+/* 84 */       NULL,           NULL,           NULL,           NULL,
+/* 88 */       NULL,           NULL,           "pfnacc",       NULL,
+/* 8C */       NULL,           NULL,           "pfpnacc",      NULL,
+/* 90 */       "pfcmpge",      NULL,           NULL,           NULL,
+/* 94 */       "pfmin",        NULL,           "pfrcp",        "pfrsqrt",
+/* 98 */       NULL,           NULL,           "pfsub",        NULL,
+/* 9C */       NULL,           NULL,           "pfadd",        NULL,
+/* A0 */       "pfcmpgt",      NULL,           NULL,           NULL,
+/* A4 */       "pfmax",        NULL,           "pfrcpit1",     "pfrsqit1",
+/* A8 */       NULL,           NULL,           "pfsubr",       NULL,
+/* AC */       NULL,           NULL,           "pfacc",        NULL,
+/* B0 */       "pfcmpeq",      NULL,           NULL,           NULL,
+/* B4 */       "pfmul",        NULL,           "pfrcpit2",     "pfmulhrw",
+/* B8 */       NULL,           NULL,           NULL,           "pswapd",
+/* BC */       NULL,           NULL,           NULL,           "pavgusb",
+/* C0 */       NULL,           NULL,           NULL,           NULL,
+/* C4 */       NULL,           NULL,           NULL,           NULL,
+/* C8 */       NULL,           NULL,           NULL,           NULL,
+/* CC */       NULL,           NULL,           NULL,           NULL,
+/* D0 */       NULL,           NULL,           NULL,           NULL,
+/* D4 */       NULL,           NULL,           NULL,           NULL,
+/* D8 */       NULL,           NULL,           NULL,           NULL,
+/* DC */       NULL,           NULL,           NULL,           NULL,
+/* E0 */       NULL,           NULL,           NULL,           NULL,
+/* E4 */       NULL,           NULL,           NULL,           NULL,
+/* E8 */       NULL,           NULL,           NULL,           NULL,
+/* EC */       NULL,           NULL,           NULL,           NULL,
+/* F0 */       NULL,           NULL,           NULL,           NULL,
+/* F4 */       NULL,           NULL,           NULL,           NULL,
+/* F8 */       NULL,           NULL,           NULL,           NULL,
+/* FC */       NULL,           NULL,           NULL,           NULL,
+};
+
+static void
+OP_3DNowSuffix (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  const char *mnemonic;
+
+  FETCH_DATA (the_info, codep + 1);
+  /* AMD 3DNow! instructions are specified by an opcode suffix in the
+     place where an 8-bit immediate would normally go.  ie. the last
+     byte of the instruction.  */
+  obufp = obuf + strlen (obuf);
+  mnemonic = Suffix3DNow[*codep++ & 0xff];
+  if (mnemonic)
+    oappend (mnemonic);
+  else
+    {
+      /* Since a variable sized modrm/sib chunk is between the start
+        of the opcode (0x0f0f) and the opcode suffix, we need to do
+        all the modrm processing first, and don't know until now that
+        we have a bad opcode.  This necessitates some cleaning up.  */
+      op1out[0] = '\0';
+      op2out[0] = '\0';
+      BadOp ();
+    }
+}
+
+static const char *simd_cmp_op[] = {
+  "eq",
+  "lt",
+  "le",
+  "unord",
+  "neq",
+  "nlt",
+  "nle",
+  "ord"
+};
+
+static void
+OP_SIMD_Suffix (bytemode, sizeflag)
+     int bytemode ATTRIBUTE_UNUSED;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  unsigned int cmp_type;
+
+  FETCH_DATA (the_info, codep + 1);
+  obufp = obuf + strlen (obuf);
+  cmp_type = *codep++ & 0xff;
+  if (cmp_type < 8)
+    {
+      char suffix1 = 'p', suffix2 = 's';
+      used_prefixes |= (prefixes & PREFIX_REPZ);
+      if (prefixes & PREFIX_REPZ)
+       suffix1 = 's';
+      else
+       {
+         used_prefixes |= (prefixes & PREFIX_DATA);
+         if (prefixes & PREFIX_DATA)
+           suffix2 = 'd';
+         else
+           {
+             used_prefixes |= (prefixes & PREFIX_REPNZ);
+             if (prefixes & PREFIX_REPNZ)
+               suffix1 = 's', suffix2 = 'd';
+           }
+       }
+      sprintf (scratchbuf, "cmp%s%c%c",
+              simd_cmp_op[cmp_type], suffix1, suffix2);
+      used_prefixes |= (prefixes & PREFIX_REPZ);
+      oappend (scratchbuf);
+    }
+  else
+    {
+      /* We have a bad extension byte.  Clean up.  */
+      op1out[0] = '\0';
+      op2out[0] = '\0';
+      BadOp ();
+    }
+}
+
+static void
+SIMD_Fixup (extrachar, sizeflag)
+     int extrachar;
+     int sizeflag ATTRIBUTE_UNUSED;
+{
+  /* Change movlps/movhps to movhlps/movlhps for 2 register operand
+     forms of these instructions.  */
+  if (mod == 3)
+    {
+      char *p = obuf + strlen (obuf);
+      *(p + 1) = '\0';
+      *p       = *(p - 1);
+      *(p - 1) = *(p - 2);
+      *(p - 2) = *(p - 3);
+      *(p - 3) = extrachar;
+    }
+}
+
+static void
+BadOp (void)
+{
+  /* Throw away prefixes and 1st. opcode byte.  */
+  codep = insn_codep + 1;
+  oappend ("(bad)");
+}
diff --git a/src/vm/jit/i386/types.h b/src/vm/jit/i386/types.h
new file mode 100644 (file)
index 0000000..d083ee6
--- /dev/null
@@ -0,0 +1,95 @@
+/* jit/i386/types.h - machine specific definitions for i386 processor
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+            Andreas  Krall
+            Michael Gschwind
+
+   Changes: Christan Thalinger
+
+   $Id: types.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _TYPES_H
+#define _TYPES_H
+
+#define POINTERSIZE         4
+#define WORDS_BIGENDIAN     0
+
+#define SUPPORT_DIVISION    1
+#define SUPPORT_LONG        1
+#define SUPPORT_FLOAT       1
+#define SUPPORT_DOUBLE      1
+
+#define SUPPORT_LONG_ADD    1
+#define SUPPORT_LONG_CMP    1
+#define SUPPORT_LONG_LOG    1
+#define SUPPORT_LONG_SHIFT  1
+#define SUPPORT_LONG_MULDIV 0
+#define SUPPORT_LONG_ICVT   1
+#define SUPPORT_LONG_FCVT   1
+
+#define CONDITIONAL_LOADCONST
+#define NO_DIV_OPT
+
+#define U8_AVAILABLE        1
+
+
+typedef signed char             s1;
+typedef unsigned char           u1;
+typedef signed short int        s2;
+typedef unsigned short int      u2;
+
+typedef signed int              s4;
+typedef unsigned int            u4;
+
+#if U8_AVAILABLE
+typedef signed long long int    s8;
+typedef unsigned long long int  u8;
+#else
+typedef struct {u4 low, high;}  u8;
+#define s8 u8
+#endif
+
+#endif /* _TYPES_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b5488f4107176a6e1d9ad1cd105027d30fb55114..6c486de3fbf56d838c4f119bc50c2b44393dcbc1 100644 (file)
@@ -1,59 +1,44 @@
-static void descriptor2types (methodinfo *m);
-
-/*typedef struct {
-        listnode linkage;
-        instruction *iptr;
-        } t_patchlistnode;*/
-
-
-typedef struct {
-        listnode linkage;
-
-        methodinfo *method;
-        int startgp;
-        int stopgp;
-        int firstlocal;
-
-        bool *readonly;
-        int  *label_index;
-        
-        list *inlinedmethods;
-} inlining_methodinfo;
-
-typedef struct {
-        listnode linkage;
-        
-       // saved static compiler variables
-        
-        methodinfo *method;
-        
-       // restored through method
-
-       // int jcodelength;
-       // u1 *jcode;
-       // classinfo *class;
-
-       // descriptor never used
-       // maxstack used outside of main for loop
-       // maxlocals never used
-       
-       // exceptiontablelength
-       // raw_extable used outside of main for loop
-       // mreturntype used outside of main for loop
-       // mparamcount used outside of main for loop
-       // mparamtypes used outside of main for loop
+/* jit/inline.c - code inliner
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       //local variables used in parse()  
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-       int  i;                     /* temporary for different uses (counters)    */
-       int  p;                     /* java instruction counter                   */
-       int  nextp;                 /* start of next java instruction             */
-       int  opcode;                /* java opcode                                */
+   Contact: cacao@complang.tuwien.ac.at
 
-       inlining_methodinfo *inlinfo;
+   Authors: Dieter Thuernbeck
+
+   $Id: inline.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "inline.h"
+#include "jit.h"
+#include "parse.h"
+#include "loader.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
 
-       /*      list *patchlist; */
-} t_inlining_stacknode;
 
 // checked functions and macros: LOADCONST code_get OP1 BUILTIN block_insert bound_check ALIGN
 
@@ -61,28 +46,16 @@ typedef struct {
 
 static list *inlining_stack;
 //static list *inlining_patchlist;
-static bool isinlinedmethod;
-static int cumjcodelength;         /* cumulative immediate intruction length      */
+bool isinlinedmethod;
+int cumjcodelength;         /* cumulative immediate intruction length      */
 static int cumlocals;
-static int cummaxstack;
-static int cumextablelength;
+int cummaxstack;
+int cumextablelength;
 static int cummethods;
-static inlining_methodinfo *inlining_rootinfo;
-
+inlining_methodinfo *inlining_rootinfo;
 
-void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlining_methodinfo* inlinfo);
-void inlining_pop_compiler_variables(int *i, int *p, int *nextp, int *opcode, inlining_methodinfo** inlinfo); 
-void inlining_init(void);
-inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp, int firstlocal, int maxstackdepth);
 
-#define inlining_save_compiler_variables() inlining_push_compiler_variables(i,p,nextp,opcode,inlinfo)
-#define inlining_restore_compiler_variables() inlining_pop_compiler_variables(&i,&p,&nextp,&opcode,&inlinfo)
-#define inlining_set_compiler_variables(i) p=nextp=0; inlining_set_compiler_variables_fun(i->method); inlinfo=i;
-#define INLINING_MAXDEPTH 1
-#define INLINING_MAXCODESIZE 32
-#define INLINING_MAXMETHODS 8
-
-void inlining_init(void) 
+void inlining_init()
 {
        inlining_stack = NULL;
        //      inlining_patchlist = NULL;
@@ -101,11 +74,13 @@ void inlining_init(void)
        maxstack = cummaxstack;
 }
 
+
 void inlining_cleanup(void)
 {
        FREE(inlining_stack, t_inlining_stacknode);
 }
 
+
 void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlining_methodinfo *inlinfo) 
 {
        t_inlining_stacknode *new = NEW(t_inlining_stacknode);
@@ -122,6 +97,7 @@ void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlin
        isinlinedmethod++;
 }
 
+
 void inlining_pop_compiler_variables(int *i, int *p, int *nextp, int *opcode, inlining_methodinfo **inlinfo) 
 {
        t_inlining_stacknode *tmp = (t_inlining_stacknode *) list_first(inlining_stack);
@@ -156,6 +132,7 @@ void inlining_set_compiler_variables_fun(methodinfo *m)
        //      list_init(inlining_patchlist, OFFSET(t_patchlistnode, linkage));
 }
 
+
 /*void inlining_addpatch(instruction *iptr)  
   {
   t_patchlistnode *patch = DNEW(t_patchlistnode);
@@ -175,6 +152,7 @@ classinfo *first_occurence(classinfo* class, utf* name, utf* desc) {
                return first;
 }
 
+
 bool is_unique_rec(classinfo *class, methodinfo *m, utf* name, utf* desc) {
        methodinfo *tmp = class_findmethod(class, name, desc);
        if ((tmp != NULL) && (tmp != m))
@@ -188,6 +166,7 @@ bool is_unique_rec(classinfo *class, methodinfo *m, utf* name, utf* desc) {
        return true;
 }
 
+
 bool is_unique_method(classinfo *class, methodinfo *m, utf* name, utf* desc) {
        classinfo *firstclass;
        
@@ -440,6 +419,7 @@ inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp, i
     return newnode;
 }
 
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
@@ -452,5 +432,3 @@ inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp, i
  * tab-width: 4
  * End:
  */
-
-       
diff --git a/src/vm/jit/inline/inline.h b/src/vm/jit/inline/inline.h
new file mode 100644 (file)
index 0000000..84cb4ae
--- /dev/null
@@ -0,0 +1,147 @@
+/* jit/inline.c - code inliner
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Dieter Thuernbeck
+
+   $Id: inline.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _INLINE_H
+#define _INLINE_H
+
+#include "global.h"
+#include "toolbox/list.h"
+
+#define INLINING_MAXDEPTH       1
+#define INLINING_MAXCODESIZE    32
+#define INLINING_MAXMETHODS     8
+
+
+/*typedef struct {
+        listnode linkage;
+        instruction *iptr;
+        } t_patchlistnode;*/
+
+
+typedef struct {
+    listnode linkage;
+
+    methodinfo *method;
+    int startgp;
+    int stopgp;
+    int firstlocal;
+
+    bool *readonly;
+    int  *label_index;
+        
+    list *inlinedmethods;
+} inlining_methodinfo;
+
+
+typedef struct {
+    listnode linkage;
+        
+    // saved static compiler variables
+        
+    methodinfo *method;
+        
+    // restored through method
+
+    // int jcodelength;
+    // u1 *jcode;
+    // classinfo *class;
+
+    // descriptor never used
+    // maxstack used outside of main for loop
+    // maxlocals never used
+       
+    // exceptiontablelength
+    // raw_extable used outside of main for loop
+    // mreturntype used outside of main for loop
+    // mparamcount used outside of main for loop
+    // mparamtypes used outside of main for loop
+
+    //local variables used in parse()  
+
+    int  i;                     /* temporary for different uses (counters)    */
+    int  p;                     /* java instruction counter                   */
+    int  nextp;                 /* start of next java instruction             */
+    int  opcode;                /* java opcode                                */
+
+    inlining_methodinfo *inlinfo;
+
+    /* list *patchlist; */
+} t_inlining_stacknode;
+
+
+/* extern variables */
+extern bool isinlinedmethod;
+extern int cumjcodelength;
+extern int cummaxstack;
+extern int cumextablelength;
+extern inlining_methodinfo *inlining_rootinfo;
+
+
+/* function prototypes*/
+void inlining_init();
+void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, 
+                                      inlining_methodinfo* inlinfo);
+void inlining_pop_compiler_variables(int *i, int *p, int *nextp, int *opcode, 
+                                     inlining_methodinfo** inlinfo); 
+void inlining_init(void);
+inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp,
+                                             int firstlocal, int maxstackdepth);
+
+
+#define inlining_save_compiler_variables() \
+    inlining_push_compiler_variables(i,p,nextp,opcode,inlinfo)
+
+#define inlining_restore_compiler_variables() \
+    inlining_pop_compiler_variables(&i,&p,&nextp,&opcode,&inlinfo)
+
+#define inlining_set_compiler_variables(i) \
+    do { \
+        p = nextp = 0; \
+        inlining_set_compiler_variables_fun(i->method); \
+        inlinfo = i; \
+    } while (0)
+
+#endif /* _INLINE_H */
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/inline/parseRT.c b/src/vm/jit/inline/parseRT.c
new file mode 100644 (file)
index 0000000..f0bf40b
--- /dev/null
@@ -0,0 +1,1686 @@
+/* jit/parseRT.c - parser and print functions for Rapid Type Analyis
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: parseRT.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include <string.h>
+#include "jit.h"
+#include "parse.h"
+#include "loader.h"
+#include "natcalls.h"
+#include "parseRTprint.h"
+#include "parseRTstats.h"
+#include "sets.h"
+#include "tables.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+/*------------ global variables -----------------------------------------*/
+#define MAXCALLGRAPH 5000
+
+bool XTAOPTbypass = false;
+bool XTAOPTbypass2 = false;   /* for now  invokeinterface     */
+bool XTAOPTbypass3 = false;   /* print XTA classsets in stats */
+int  XTAdebug = 0;
+int  XTAfld = 0;
+
+int methRT = 0;
+int methRTlast = -1;
+int methRTmax = MAXCALLGRAPH;
+methodinfo **callgraph;
+/*methodinfo *callgraph[MAXCALLGRAPH];*/ 
+
+int methXTA = 0;            
+int methXTAlast = -1;;      
+int methXTAmax=MAXCALLGRAPH;        
+methodinfo **XTAcallgraph;
+/*methodinfo *XTAcallgraph[MAXCALLGRAPH];*/
+
+static bool nativecallcompdone=0 ;
+
+static bool firstCall= true;
+static bool AfterMain = false;
+static FILE *rtMissed;   /* Methods missed during RTA parse of Main  */
+/*   so easier to build dynmanic calls file */
+
+static utf *utf_MAIN;   /*  utf_new_char("main"); */
+static utf *INIT    ;   /*  utf_new_char("<init>"); */
+static utf *CLINIT  ;   /*  utf_new_char("<clinit>"); */
+static utf *FINALIZE;   /*  utf_new_char("finalize"); */
+static utf *EMPTY_DESC; /*  utf_new_char("V()");  */
+static int missedCnt = 0;
+
+
+/*--------------------------------------------------------------*/
+/* addToCallgraph - adds to RTA callgraph and                   */ 
+/*                  sets  meth->methodUsed  to USED             */
+/*--------------------------------------------------------------*/  
+#define ADDTOCALLGRAPH(meth)  if ((meth->methodUsed != USED) && (!(meth->flags & ACC_ABSTRACT)) ) { \
+       callgraph[++methRTlast] = meth ; \
+       meth->methodUsed = USED; \
+                       if(pWhenMarked>=1) \
+                               {printf("\n Added to Call Graph #%i:",  \
+                               methRTlast); \
+                               printf("\t <used flags c/m> <%i/%i> %i\t",  \
+                                 meth->class->classUsed, \
+                                 meth->methodUsed, \
+                                 USED);  \
+                               printf(" method name =");   \
+                               utf_display(meth->class->name);printf("."); \
+                               method_display(meth);fflush(stdout);} \
+       }
+
+
+/*--------------------------------------------------------------*/
+bool rtaSubUsed(classinfo *class, methodinfo *meth) {
+       classinfo *subs;
+
+       for (subs=class->sub; subs != NULL; subs = subs->nextsub) {
+               if (subs->classUsed == USED) {
+                       if (class_findmethod(class, meth->name, meth->descriptor) == NULL)
+                               return false;
+                       else    
+                               return true;
+               }
+               if (rtaSubUsed(subs, meth)) 
+                       return false;
+       }
+       return false;
+}
+
+
+/*--------------------------------------------------------------*/
+/* Mark the method with same name /descriptor in topmethod      */
+/* in class                                                     */
+/*                                                              */
+/* Class not marked USED and method defined in this class ->    */
+/*    -> if Method NOTUSED mark method as MARKED                */
+/* Class marked USED and method defined in this class ->        */
+/*    -> mark method as USED                                    */
+/*                                                              */
+/* Class USED, but method not defined in this class ->          */
+/*    -> search up the heirarchy and mark method where defined  */
+/*       if class where method is defined is not USED ->        */
+/*      -> mark class with defined method as PARTUSED          */
+/*--------------------------------------------------------------*/
+
+void rtaMarkMethod(classinfo *class, methodinfo *topmethod) {
+
+       utf *name = topmethod -> name; 
+       utf *descriptor = topmethod -> descriptor;
+       methodinfo *submeth;
+
+       submeth = class_resolvemethod(class, name, descriptor); 
+       if (submeth == NULL)
+               panic("parse RT: Method not found in class hierarchy");
+       if (submeth->methodUsed == USED) return;
+  
+       if (submeth->class == class) { 
+
+               /*--- Method defined in class -----------------------------*/
+       if (submeth->class->classUsed != USED) { 
+                       if (submeth->methodUsed == NOTUSED) { 
+
+                /* Class NOT marked USED and method defined in this class -> */
+                               /*    -> if Method NOTUSED mark method as  MARKED            */
+                               if (pWhenMarked >= 1) {
+                                       printf("MARKED class.method\t"); 
+                                       utf_display(submeth->class->name);printf(".");method_display(submeth);
+                               }
+                               if (rtaSubUsed(submeth->class,submeth)) {
+                                       submeth->class->classUsed = PARTUSED;
+                                       ADDTOCALLGRAPH(submeth) 
+                                               }
+                               else    {
+                                       submeth->methodUsed = MARKED;
+                                       RTAPRINTmarkMethod1
+                                               }
+               } }
+       else    {
+                       /* Class IS  marked USED and method defined in this class -> */
+                       /*    -> mark method as USED  */
+                       ADDTOCALLGRAPH(submeth) 
+                               }
+       } /* end defined in class */
+
+       else {
+               /*--- Method NOT defined in class -----------------------------*/
+               if (submeth->class->classUsed == NOTUSED) {
+                       submeth->class->classUsed = PARTUSED;
+                       if (class->classUsed != USED) {
+                               submeth->methodUsed = MARKED;
+                       }
+               }
+               if ( (submeth->class->classUsed == USED) 
+                        || (class->classUsed == USED)) {
+                       ADDTOCALLGRAPH(submeth)
+                               }
+       } /* end NOT defined in class */
+} 
+
+/*-------------------------------------------------------------------------------*/
+/* Mark the method with the same name and descriptor as topmethod                */
+/*   and any subclass where the method is defined and/or class is used           */
+/*                                                                               */
+/*-------------------------------------------------------------------------------*/
+void rtaMarkSubs(classinfo *class, methodinfo *topmethod) {
+       RTAPRINTmarkSubs1
+               rtaMarkMethod(class, topmethod);   /* Mark method in class where it was found */
+       if (class->sub != NULL) {
+               classinfo *subs;
+       
+               if (!(topmethod->flags & ACC_FINAL )) {
+                       for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
+                               RTAPRINTmarkSubs1
+                                       rtaMarkSubs(subs, topmethod); 
+                       }
+               }
+    }
+       return;
+}
+
+/*-------------------------------------------------------------------------------*/
+/* Add Marked methods for input class ci                                         */
+/* Add methods with the same name and descriptor as implemented interfaces       */
+/*   with the same method name                                                   */
+/*                                                                               */
+/*-------------------------------------------------------------------------------*/
+void addMarkedMethods(classinfo *ci) {
+       int ii,jj,mm;
+
+       /* add marked methods to callgraph */ 
+       for (ii=0; ii<ci->methodscount; ii++) { 
+               methodinfo *mi = &(ci->methods[ii]);
+               if (mi->methodUsed == MARKED) { 
+                       if (pWhenMarked >= 1) {
+                               printf("ADDED a method that was MARKED\n");
+                       }
+                       ADDTOCALLGRAPH(mi)  
+                               }
+               else {
+       
+                       for (jj=0; jj < ci -> interfacescount; jj++) {
+                               classinfo *ici = ci -> interfaces [jj];
+                               /*  use resolve method....!!!! */
+                               if (ici -> classUsed != NOTUSED) {
+                                       for (mm=0; mm< ici->methodscount; mm++) {
+                                               methodinfo *imi = &(ici->methods[mm]);
+
+                                               if  (      (imi->methodUsed == USED) 
+                                                                  &&    ( (imi->name == mi->name) 
+                                                                                  &&      (imi->descriptor == mi->descriptor))) {
+                                                       if (pWhenMarked >= 1) 
+                                                               printf("ADDED a method that was used by an interface\n");
+                                                       ADDTOCALLGRAPH(mi)  
+                                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+}    
+/*-------------------------------------------------------------------------------*/
+/*  XTA Functions                                                                */
+/*-------------------------------------------------------------------------------*/
+
+xtainfo * xtainfoInit (methodinfo *m) {
+
+       if (m->xta != NULL) return m->xta;
+       m ->xta = (xtainfo *)malloc(sizeof(xtainfo));
+       m ->xta-> XTAmethodUsed = NOTUSED;
+       m ->xta-> XTAclassSet   = NULL;
+       /* PartClassSet */
+       m ->xta-> paramClassSet = NULL;
+       m ->xta-> calls         = NULL;
+       m ->xta-> calledBy      = NULL;
+
+       m ->xta-> marked       = NULL;
+       /*m ->xta-> markedBy     = NULL */
+       m ->xta-> fldsUsed     = NULL;
+       /*m ->xta-> interfaceCalls    = NULL*/
+       m ->xta-> chgdSinceLastParse = false;
+       return m->xta;
+}
+
+xtafldinfo * xtafldinfoInit (fieldinfo *f) {
+
+       if (f->xta != NULL) return f->xta;
+
+       f ->xta = (xtafldinfo *)malloc(sizeof(xtafldinfo));
+       f -> xta-> fieldChecked = false;   /*XTA*/
+       f -> xta-> fldClassType = NULL;    /*XTA*/
+       f -> xta-> XTAclassSet = NULL;     /*XTA*/
+       return f->xta;
+
+}
+bool xtaPassParams (methodinfo *SmCalled, methodinfo *SmCalls, methSetNode *lastptrInto) {
+
+       classSetNode *p;
+       classSetNode *c;
+       classSetNode *c1;
+       classSetNode *cprev;
+       bool          rc = false;
+
+       if (XTAdebug >= 1) {
+               printf("\n>>>>>>>>>>>>>>>>><<<xtaPassParams \n");fflush(stdout);
+
+               printf("\tIN SmCalled set : "); 
+               utf_display(SmCalled->class->name);printf("."); method_display(SmCalled);
+               printClassSet(SmCalled->xta->XTAclassSet); printf("\n"); 
+
+               printf("\tIN SmCalls set: "); 
+               utf_display(SmCalls->class->name);printf("."); method_display(SmCalls);
+               printClassSet(SmCalls->xta->XTAclassSet); printf("\n"); 
+               
+               printf("\tIN lastptrInto : (");
+               if (lastptrInto->lastptrIntoClassSet2 != NULL) {
+                       utf_display(lastptrInto->lastptrIntoClassSet2->classType->name); printf(") ");
+               }
+               else {printf("NULL) ");}
+               fflush(stdout);
+               utf_display(lastptrInto->methRef->class->name);printf("."); fflush(stdout);
+               method_display(lastptrInto->methRef); fflush(stdout);
+               printf("\n");fflush(stdout);
+       }
+
+       /* Get SmCalled ParamType set if null */
+       if (SmCalled->xta->paramClassSet == NULL) {
+               SmCalled->xta->paramClassSet = descriptor2typesL(SmCalled); 
+       }
+       if (XTAdebug >= 1) {
+               printf("\tParamPassed\n"); fflush(stdout);
+               printSet(SmCalled->xta->paramClassSet);fflush(stdout);
+               printf("\n"); fflush(stdout);
+       }
+
+       if (lastptrInto->lastptrIntoClassSet2 == NULL) {
+               if (SmCalls->xta->XTAclassSet != NULL) 
+                       c1 = SmCalls->xta->XTAclassSet->head;
+               else
+                       c1 = NULL;
+       }
+       else    {
+               /* start with type where left off */
+               c1 = lastptrInto->lastptrIntoClassSet2;  
+               c1 = c1 -> nextClass;  /* even if NULL */
+       }
+       cprev = NULL;
+       if (XTAdebug >= 1) {
+               if (c1 == NULL){
+                       printf("\tIN SmCalls ... start with NULL\n"); fflush(stdout);
+               }
+               else    {
+                       printf("\tIN SmCalls ... start with :");fflush(stdout);
+                       utf_display(c1->classType->name); printf("\n");
+               }
+       }
+
+       /* for each Param Class */
+       for (   p=SmCalled->xta->paramClassSet; p != NULL; p = p->nextClass) {
+
+               /* for each SmCalls class */
+               for (c=c1; c != NULL; c = c->nextClass) {
+                       vftbl *p_cl_vt = p->classType->vftbl; 
+                       vftbl *c_cl_vt = c->classType->vftbl; 
+
+                       /* if SmCalls class is in the Params Class range */
+                       if (  (p_cl_vt->baseval <=  c_cl_vt->baseval)
+                                 && (c_cl_vt->baseval <= (p_cl_vt->baseval+p_cl_vt->diffval)) ) {
+
+                               /*    add SmCalls class to SmCalledBy Class set */
+                               SmCalled->xta->XTAclassSet = SmCalled->xta->XTAclassSet = add2ClassSet(SmCalled->xta->XTAclassSet, c->classType); 
+                               rc = true;
+                       }
+                       cprev = c;
+               }       
+       }
+       lastptrInto->lastptrIntoClassSet2 = cprev;
+       if (XTAdebug >= 1) {
+               printf("\tOUT SmCalled set: ");fflush(stdout);
+               printClassSet(SmCalled->xta->XTAclassSet);fflush(stdout);
+
+               printf("\tOUT SmCalls set: ");fflush(stdout);
+               printClassSet(SmCalls->xta->XTAclassSet);fflush(stdout);
+
+               printf("\tOUT  lastptrInto="); fflush(stdout);
+               if (lastptrInto->lastptrIntoClassSet2 != NULL)
+                       utf_display(lastptrInto->lastptrIntoClassSet2->classType->name);
+
+               printf("<rc=%i>\n",rc);fflush(stdout);
+       }
+       return rc;
+}
+
+/*-------------------------------------------------------------------------------*/
+bool xtaPassReturnType(methodinfo *SmCalled, methodinfo *SmCalls) {
+
+       classSetNode* cs;
+       classSetNode* cs1;
+       bool          rc = false;
+
+       if (XTAdebug >= 1)
+               printf("xtaPassReturnType \n");
+
+       /* Get SmCalled return class is null */
+       if ((SmCalled->returnclass == NULL) && (SmCalled->xta->paramClassSet == NULL)) {
+               SmCalled->xta->paramClassSet = descriptor2typesL(SmCalled); 
+       }
+
+       if (SmCalled->returnclass == NULL) {
+               if (XTAdebug >= 1)
+                       printf("\tReturn type is NULL\n");
+               return rc;
+       }
+       
+       if (XTAdebug >= 1) {
+               printf("\tReturn type is: ");
+               utf_display(SmCalled->returnclass->name);
+               printf("\n");
+
+               printf("\tIN SmCalls set: ");
+               utf_display(SmCalls->class->name); printf("."); method_display(SmCalls);
+               printClassSet(SmCalls->xta->XTAclassSet);
+
+               printf("\tIN SmCalled set: ");
+               utf_display(SmCalled->class->name); printf("."); method_display(SmCalled);
+               printClassSet(SmCalled->xta->XTAclassSet);
+       }
+
+
+       if (SmCalled->xta->XTAclassSet == NULL) 
+               cs1 = NULL;
+       else
+               cs1 =  SmCalled->xta->XTAclassSet->head;
+       for (cs =cs1; cs != NULL; cs = cs->nextClass) {
+               classinfo *c = cs->classType;
+               vftbl *r_cl_vt = SmCalled->returnclass->vftbl; 
+               vftbl *c_cl_vt = c->vftbl; 
+
+               /* if class is a subtype of the return type, then add to SmCalls class set (ie.interscection)*/
+               if (  (r_cl_vt->baseval <=  r_cl_vt->baseval)
+                         && (c_cl_vt->baseval <= (r_cl_vt->baseval+r_cl_vt->diffval)) ) {
+                       SmCalls->xta->XTAclassSet = add2ClassSet(SmCalls->xta->XTAclassSet, c);  
+                       rc = true;
+               }
+       } 
+
+       if (XTAdebug >= 1) {
+               printf("\tOUT SmCalls set: ");
+               printClassSet(SmCalls->xta->XTAclassSet);
+       }
+       return rc;
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaAddCallEdges(methodinfo *mi, s4 monoPoly) {
+
+       if (mi->xta == NULL)
+               mi->xta = xtainfoInit(mi);
+       if (mi->xta->XTAmethodUsed  != USED) {  /* if static method not in callgraph */
+               XTAcallgraph[++methXTAlast] = mi;
+               mi->xta->XTAmethodUsed = USED;
+               //                              XTAPRINTcallgraph2
+
+               if(pWhenMarked>=1) {  
+                       printf("\n XTA Added to Call Graph #%i:", 
+                                  methXTAlast); 
+                       printf(" method name ="); fflush(stdout);
+                       if (mi == NULL) panic ("Method ptr NULL!!!");
+                       if (mi->class == NULL) panic ("Method class ptr NULL!!!");
+                       if (mi->class->name == NULL) panic ("Method class name ptr NULL!!!");
+                       utf_display(mi->class->name);fflush(stdout); printf(".");fflush(stdout); 
+                       method_display(mi);fflush(stdout); 
+        }
+
+       }
+       /* add call edges */
+       printf("AA1 "); fflush(stdout);
+       rt_method->xta->calls = add2MethSet(rt_method->xta->calls, mi);
+       rt_method->xta->calls->tail->monoPoly = monoPoly;
+       mi->xta->calledBy     = add2MethSet(mi->xta->calledBy,     rt_method); 
+       if (mi->xta->calledBy     == NULL) panic("mi->xta->calledBy is NULL!!!");
+       if (rt_method->xta->calls == NULL) panic("rt_method->xta->calls is NULL!!!");
+}
+
+
+/*--------------------------------------------------------------*/
+bool xtaSubUsed(classinfo *class, methodinfo *meth, classSetNode *subtypesUsedSet) {
+       classinfo *subs;
+
+       for (subs=class->sub; subs != NULL; subs = subs->nextsub) {
+               /* if class used */
+               if (inSet(subtypesUsedSet,subs)) {
+                       if (class_findmethod(class, meth->name, meth->descriptor) == NULL) 
+                               return false;
+                       else    
+                               return true;
+               }
+               if (xtaSubUsed(subs, meth,  subtypesUsedSet)) 
+                       return false;
+       }
+       return false;
+}
+
+
+/*-------------------------------------------------------------------------------*/
+void xtaMarkMethod(classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet)
+{
+       methodinfo *submeth;
+
+       utf *name = topmethod -> name;
+       utf *descriptor = topmethod -> descriptor;
+       /****
+                printf("xtaMarkMethod for:"); utf_display(class->name);fflush(stdout); 
+                method_display(topmethod);
+       **/
+
+       submeth = class_resolvemethod(class, name, descriptor);
+
+       /***
+               printf(" def: "); utf_display(submeth->class->name);fflush(stdout);
+               method_display(submeth);
+       ****/
+
+       /* Basic checks */
+       if (submeth == NULL)
+        panic("parse XTA: Method not found in class hierarchy");
+       if (submeth->xta == NULL) 
+               submeth->xta = xtainfoInit(submeth);
+
+       if (rt_method->xta->calls != NULL) {
+               if (inMethSet(rt_method->xta->calls->head,submeth)) return;
+       }
+       /*----*/
+       if (submeth->class == class) {
+
+        /*--- Method defined in class -----------------------------*/
+               if (inSet(subtypesUsedSet,submeth->class)) {
+                       xtaAddCallEdges(submeth,POLY);  
+               }
+               else    {
+                       if (subtypesUsedSet != NULL) {  
+                               if (xtaSubUsed (class,submeth,subtypesUsedSet)) {
+                                       xtaAddCallEdges(submeth,POLY);
+                               }
+                       }
+                       else    {
+                               rt_method->xta->marked = add2MethSet(rt_method->xta->marked, submeth);
+                       }
+               }
+       }
+       else  {
+        /*--- Method NOT defined in class -----------------------------*/
+               if (!(inSet(subtypesUsedSet,submeth->class) )){  /* class with method def     is not used */
+                       if (!(inSet(subtypesUsedSet,class) )) { /* class currently resolving is not used */ 
+                               rt_method->xta->marked = add2MethSet(rt_method->xta->marked, submeth);
+                               /*printf("Added to marked Set: "); fflush(stdout);printMethodSet(rt_method->xta->marked);*/
+                       }
+               }
+               if ( (inSet(subtypesUsedSet,submeth->class))  /* class with method def     is used */
+                        || (inSet(subtypesUsedSet,class)) ) {       /* class currently resolving is used */ 
+                       xtaAddCallEdges(submeth,POLY);
+               }
+
+       } /* end defined in class */
+
+}
+/*-------------------------------------------------------------------------------*/
+void xtaMarkSubs(classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet) {
+       /* xtaPRINTmarkSubs1*/
+       xtaMarkMethod(class, topmethod,subtypesUsedSet);   /* Mark method in class where it was found */
+       if (class->sub != NULL) {
+               classinfo *subs;
+
+               if (!(topmethod->flags & ACC_FINAL )) {
+                       for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
+                               /* xtaPRINTmarkSubs1 */
+                               xtaMarkSubs(subs, topmethod, subtypesUsedSet);
+                       }
+               }
+    }
+       return;
+}
+
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+
+int addClassInit(classinfo *ci) {
+       /* CHANGE to a kind of table look-up for a list of class/methods (currently 3)
+        */
+
+       utf* utf_java_lang_system = utf_new_char("java/lang/System"); 
+       utf* utf_initializeSystemClass = utf_new_char("initializeSystemClass"); 
+       utf* utf_java_lang_Object = utf_new_char("java/lang/Object"); 
+
+       int m, m1=-1, m2=-1, mf=-1;
+       methodinfo *mi;
+
+       for  (m=0; m < ci->methodscount; m++) {
+               /*<clnit> class init method */
+               if (ci->methods[m].name == CLINIT) {
+                       m1=m;
+               }
+               /* Special case: System class has an extra initializer method */
+               if        ((utf_java_lang_system == ci->name) 
+                          && (utf_initializeSystemClass == ci->methods[m].name)) {
+                       m2=m;  
+        }
+
+               /* Finalize methods */
+               if    ((ci->methods[m].name == FINALIZE) 
+                          && (ci->name != utf_java_lang_Object)) {
+                       mf=m;  
+        }
+
+    }
+
+       if (m1 >= 0) { /* No <clinit>  available - ignore */  
+
+               /* Get clinit methodinfo ptr */
+               mi = class_findmethod (ci,ci->methods[m1].name , NULL); 
+
+               /*--- RTA ---*/
+               if ( mi->methodUsed != USED) {
+                       mi->class->classUsed = PARTUSED;  
+                       ADDTOCALLGRAPH(mi)  
+                               }
+
+               /*--- XTA ---*/
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       xtaAddCallEdges(mi,MONO); 
+               }
+
+       }
+
+       if (mf >= 0) {   
+
+               /* Get finalize methodinfo ptr */
+               mi = class_findmethod (ci,ci->methods[mf].name , NULL); 
+
+               /*--- RTA ---*/
+               if ( mi->methodUsed != USED) {
+                       mi->class->classUsed = PARTUSED;  
+                       ADDTOCALLGRAPH(mi)  
+                               }
+
+               /*--- XTA ---*/
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       xtaAddCallEdges(mi,MONO); 
+               }
+       }
+
+       /*Special Case for System class init:  
+       add java/lang/initializeSystemClass to callgraph */
+       if (m2 >= 0) {
+               /* Get clinit methodinfo ptr */
+               mi = class_findmethod (ci,ci->methods[m2].name , NULL); 
+
+               /*--- RTA ---*/
+               if ( mi->methodUsed != USED) {
+                       mi->class->classUsed = PARTUSED;
+                       ADDTOCALLGRAPH(mi)  
+                               }
+
+               /*--- XTA ---*/
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       xtaAddCallEdges(mi,MONO);
+               }
+       }
+
+       /* add marked methods to callgraph */ 
+       addMarkedMethods(ci); 
+               
+       return m;
+} 
+
+
+#define rt_code_get_u1(p)  rt_jcode[p]
+#define rt_code_get_s1(p)  ((s1)rt_jcode[p])
+#define rt_code_get_u2(p)  ((((u2)rt_jcode[p])<<8)+rt_jcode[p+1])
+#define rt_code_get_s2(p)  ((s2)((((u2)rt_jcode[p])<<8)+rt_jcode[p+1]))
+#define rt_code_get_u4(p)  ((((u4)rt_jcode[p])<<24)+(((u4)rt_jcode[p+1])<<16)\
+                           +(((u4)rt_jcode[p+2])<<8)+rt_jcode[p+3])
+#define rt_code_get_s4(p)  ((s4)((((u4)rt_jcode[p])<<24)+(((u4)rt_jcode[p+1])<<16)\
+                           +(((u4)rt_jcode[p+2])<<8)+rt_jcode[p+3]))
+
+
+
+/*-------------------------------------------------------------------------------*/
+/*xx*/ void addUsedInterfaceMethods(classinfo *ci) {
+       int jj,mm;
+
+       /* add used interfaces methods to callgraph */
+       for (jj=0; jj < ci -> interfacescount; jj++) {
+               classinfo *ici = ci -> interfaces [jj];
+       
+               if (pWhenMarked >= 1) { 
+                       printf("BInterface used: ");fflush(stdout); 
+                       utf_display(ici->name);
+                       printf("<%i>\t",ici -> classUsed ); fflush(stdout); 
+                       if (ici -> classUsed == NOTUSED) printf("\t classUsed=NOTUSED\n" );
+                       if (ici -> classUsed == USED) printf("\t classUsed=USED\n");
+                       if (ici -> classUsed == PARTUSED) printf("\t classUsed=PARTUSED\n");
+                       fflush(stdout);
+               }
+               /* add class to interfaces list of classes that implement it */
+               ici -> impldBy =  addElement(ici -> impldBy,  ci);
+
+               /* if interface class is used */
+        if (ici -> classUsed != NOTUSED) {
+
+                       /* for each interface method implementation that has already been used */
+                       for (mm=0; mm< ici->methodscount; mm++) {
+                               methodinfo *imi = &(ici->methods[mm]);
+                               if (pWhenMarked >= 1) { 
+                                       if  (imi->methodUsed != USED) {
+                                               if (imi->methodUsed == NOTUSED) printf("Interface Method notused: "); 
+                                               if (imi->methodUsed == MARKED) printf("Interface Method marked: "); 
+                                               utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+                                       }
+                               } 
+                               if  (imi->methodUsed == USED) {
+                                       if (pWhenMarked >= 1) { 
+                                               printf("Interface Method used: "); utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+
+                                               /* Mark this method used in the (used) implementing class and its subclasses */
+                                               printf("MAY ADD methods that was used by an interface\n");
+                                       }
+                                       rtaMarkSubs(ci,imi);
+                               }
+                       }
+               }
+       }
+
+}
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+
+
+/*-------------------------------------------------------------------------------*/
+void xtaMarkInterfaceSubs(methodinfo *mCalled) {
+       classSetNode * Si;
+       
+       /* for every class that implements the interface of the method called */
+       for (Si = mCalled->class->impldBy; Si != NULL; Si = Si->nextClass) {
+               /* add all definitions of this method for this interface */
+               methodinfo *submeth;
+
+               submeth = class_findmethod(Si->classType, mCalled->name, mCalled->descriptor); 
+               if (submeth == NULL) ; /* search up the heir - ignore for now!!! */
+               else    {
+                       classSetNode *subtypesUsedSet = NULL;
+                                       
+                       if (rt_method->xta->XTAclassSet != NULL)
+                               subtypesUsedSet = intersectSubtypesWithSet(submeth->class, rt_method->xta->XTAclassSet->head);
+                               
+                       printf(" \nXTA subtypesUsedSet: "); fflush(stdout);
+                       printSet(subtypesUsedSet);
+                       xtaMarkSubs(submeth->class, submeth, subtypesUsedSet);   
+               }
+       }
+}
+
+/*-------------------------------------------------------------------------------*/
+bool xtaAddFldClassTypeInfo(fieldinfo *fi) {
+
+       bool rc = false;
+
+       if (fi->xta->fieldChecked) {
+               if (fi->xta->fldClassType != NULL)
+                       return true;  /* field has a class type */
+               else
+                       return false;
+       }
+       fi->xta->fieldChecked = true;
+
+       if (fi->type == TYPE_ADDRESS) {
+               char *utf_ptr = fi->descriptor->text;  /* current position in utf text */
+
+               if (*utf_ptr != 'L') {
+                       while (*utf_ptr++ =='[') ;
+               }
+
+               if (*utf_ptr =='L') {
+                       rc = true;
+                       if  (fi->xta->fldClassType== NULL) {
+                               char *desc;
+                               char *cname;
+                               classinfo * class;
+
+                               desc = MNEW(char, 256);
+                               strcpy(desc,++utf_ptr);
+                               cname = strtok(desc,";");
+                               if (XTAdebug >= 1) {
+                                       printf("STATIC field's type is: %s\n",cname);
+                                       fflush(stdout);
+                               }
+                               class = class_get(utf_new_char(cname));
+                               fi->xta->fldClassType= class;    /* save field's type class ptr */      
+                       } 
+               }
+       }
+       return rc;
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaPassFldPUT(fldSetNode *fN)
+{
+       /* Field type is a class */
+       classSetNode *c;
+       classSetNode *c1 = NULL;
+       classSetNode *cp = NULL;
+       classSetNode *cprev= NULL;
+
+       fieldinfo *fi;
+       if (fN != NULL)
+               fi = fN->fldRef;
+       else
+               return;
+
+/* Use lastptr  so don't check whole XTA class set each time */
+       cp = fN->lastptrPUT;
+       if (cp != NULL) {
+               if (cp->nextClass != NULL)
+                       c1 = cp -> nextClass;
+       } 
+       else    {
+               if (rt_method->xta->XTAclassSet != NULL)
+                       c1  = rt_method->xta->XTAclassSet->head;
+
+               if (XTAfld >=1 ) {
+                       printf("rt XTA class set =");fflush(stdout);
+                       printClassSet(rt_method->xta->XTAclassSet);
+                       printf("\t\tField class type = ");fflush(stdout);
+                       utf_display(fi->xta->fldClassType->name); printf("\n");
+               }
+       }
+
+       /*--- PUTSTATIC specific ---*/
+       /* Sx = intersection of type+subtypes(field x)   */
+       /*   and Sm (where putstatic code is)            */
+       for (c=c1; c != NULL; c=c->nextClass) {
+               vftbl *f_cl_vt = fi->xta->fldClassType->vftbl;
+               vftbl *c_cl_vt =  c->   classType->vftbl;
+               if (XTAfld >=2 ) {
+                       printf("\tXTA class = ");fflush(stdout);
+                       utf_display(c->classType->name);
+                       printf("<b=%i> ",c_cl_vt->baseval); fflush(stdout);
+                       if (c->nextClass == NULL) {
+                               printf("next=NULL ");fflush(stdout);
+                       }
+                       else    {
+                               printf("next="); fflush(stdout);
+                               utf_display(c->nextClass->classType->name);
+                               printf("\n"); fflush(stdout);
+                       }
+
+                       printf("\t\tField class type = ");fflush(stdout);
+                       utf_display(fi->xta->fldClassType->name);
+                       printf("<b=%i/+d=%i> \n",f_cl_vt->baseval,(f_cl_vt->baseval+f_cl_vt->diffval)); fflush(stdout);
+               }
+
+               if ((f_cl_vt->baseval <= c_cl_vt->baseval)
+                       && (c_cl_vt->baseval <= (f_cl_vt->baseval+f_cl_vt->diffval)) ) {
+                       fi->xta->XTAclassSet = add2ClassSet(fi->xta->XTAclassSet,c->classType);
+               }
+               cprev = c;
+       }
+       fN->lastptrPUT = cprev;
+}
+/*-------------------------------------------------------------------------------*/
+void xtaPassFldGET(fldSetNode *fN)
+{
+       /* Field type is a class */
+       classSetNode *c;
+       classSetNode *c1 = NULL;
+       classSetNode *cp = NULL;
+       classSetNode *cprev= NULL;
+
+       fieldinfo *fi;
+       if (fN != NULL)
+               fi = fN->fldRef;
+       else
+               return;
+
+/* Use lastptr  so don't check whole XTA class set each time */
+       cp = fN->lastptrGET;
+       if (cp != NULL) {
+               if (cp->nextClass != NULL)
+                       c1 = cp -> nextClass;
+       } 
+       else    {
+               if (fi->xta->XTAclassSet != NULL)
+                       c1  = fi->xta->XTAclassSet->head;
+
+               if (XTAfld >=1 ) {
+                       printf("fld XTA class set =");fflush(stdout);
+                       printClassSet(fi->xta->XTAclassSet);
+                       printf("\t\tField class type = ");fflush(stdout);
+                       utf_display(fi->xta->fldClassType->name); printf("\n");
+               }
+       }
+
+       /*--- GETSTATIC specific ---*/
+       /* Sm = union of Sm and Sx */
+       for (c=c1; c != NULL; c=c->nextClass) {
+               bool addFlg = false;
+               if (rt_method->xta->XTAclassSet ==NULL) 
+                       addFlg = true;
+               else    {
+                       if (!(inSet (rt_method->xta->XTAclassSet->head, c->classType) )) 
+                               addFlg = true;
+               }
+               if (addFlg) {
+                       rt_method->xta->XTAclassSet 
+                               = add2ClassSet(rt_method->xta->XTAclassSet,c->classType);
+               }
+               cprev = c;
+       }
+
+       fN->lastptrGET = cprev;
+
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaPassAllCalledByParams () {
+       methSetNode *SmCalled;
+       methSetNode *s1;
+       if (XTAdebug >= 1) {
+               printf("xta->calledBy method set: "); fflush(stdout);
+               printMethodSet(rt_method->xta->calledBy); fflush(stdout);
+       }
+       if (rt_method->xta->calledBy == NULL)
+               s1 = NULL;
+       else
+               s1 = rt_method->xta->calledBy->head;
+       for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
+               if (XTAdebug >= 1) {
+                       printf("SmCalled = "); fflush(stdout);
+                       utf_display(SmCalled->methRef->class->name); fflush(stdout);
+                       printf(".");fflush(stdout); method_display(SmCalled->methRef);
+               }
+                               
+               rt_method->xta->chgdSinceLastParse = false;             
+               xtaPassParams(rt_method, SmCalled->methRef,SmCalled);   /* chg flag output ignored for 1st regular parse */
+       }
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaAllFldsUsed ( ){
+       fldSetNode  *f;
+       fldSetNode *f1=NULL; 
+       /*      bool chgd = false */
+
+       if (rt_method->xta->fldsUsed == NULL) return;
+
+       /* for each field that this method uses */
+       f1 = rt_method->xta->fldsUsed->head;
+
+       for (f=f1; f != NULL; f = f->nextfldRef) {
+
+               if (f->writePUT)
+                       xtaPassFldPUT(f);
+               if (f->readGET)
+                       xtaPassFldGET(f);
+       }
+}
+/*-------------------------------------------------------------------------------*/
+void  xtaMethodCalls_and_sendReturnType() 
+{
+       methSetNode *SmCalled;  /* for return type       */
+       methSetNode *SmCalls;   /* for calls param types */
+       methSetNode *s1=NULL; 
+       bool chgd = false;
+       if (XTAdebug >= 1) {
+               printf("calls method set Return type: ");
+               printMethodSet(rt_method->xta->calls);
+               printf("AAAAAAAAAAAAAAFTER printMethSett(rt_method->xta->calls)\n");fflush(stdout);
+       }
+       xtaAllFldsUsed ( );
+
+       /* for each method that this method calls */
+       if (rt_method->xta->calls == NULL)
+               s1 = NULL;
+       else
+               s1 = SmCalls=rt_method->xta->calls->head;
+
+       for (SmCalls=s1; SmCalls != NULL; SmCalls = SmCalls->nextmethRef) {
+               /*    pass param types  */
+               bool chgd = false;
+               chgd = xtaPassParams (SmCalls->methRef, rt_method, SmCalls);  
+               /* if true chgd after its own parse */
+               if (!(SmCalls->methRef->xta->chgdSinceLastParse)) {
+                       SmCalls->methRef->xta->chgdSinceLastParse = true;
+               }
+       }
+
+       /* for each calledBy method */
+       /*    send return type */
+       if (rt_method->xta->calledBy == NULL)
+               s1 = NULL;
+       else
+               s1 = rt_method->xta->calledBy->head;
+       for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
+
+               if (XTAdebug >= 1) {
+                       printf("\tSmCalled = ");fflush(stdout); utf_display(SmCalled->methRef->class->name);
+                       printf("."); method_display(SmCalled->methRef);
+               }
+                               
+               chgd = xtaPassReturnType(rt_method, SmCalled->methRef); 
+               if (!(SmCalled->methRef->xta->chgdSinceLastParse)) {
+                       SmCalled->methRef->xta->chgdSinceLastParse = chgd;              
+               }
+       }
+}
+
+
+/*-------------------------------------------------------------------------------*/
+static void parseRT()
+{
+       int  p;                     /* java instruction counter                   */
+       int  nextp;                 /* start of next java instruction             */
+       int  opcode;                /* java opcode                                */
+       int  i;                     /* temporary for different uses (counters)    */
+       bool iswide = false;        /* true if last instruction was a wide        */
+
+       RTAPRINT01method
+
+               if ( ((XTAOPTbypass) || (opt_xta)) && (rt_method->name != utf_MAIN)) {
+
+                       xtaPassAllCalledByParams (); 
+               }
+
+       /* scan all java instructions */
+
+       for (p = 0; p < rt_jcodelength; p = nextp) {
+               opcode = rt_code_get_u1 (p);           /* fetch op code                  */
+               RTAPRINT02opcode
+                       fflush(stdout); 
+               nextp = p + jcommandsize[opcode];   /* compute next instruction start */
+               switch (opcode) {
+
+                       /*--------------------------------*/
+                       /* Code just to get the correct  next instruction */
+                       /* 21- 25 */
+               case JAVA_ILOAD:
+               case JAVA_LLOAD:
+               case JAVA_FLOAD:
+               case JAVA_DLOAD:
+
+               case JAVA_ALOAD:
+                       if (iswide)
+                               {
+                                       nextp = p+3;
+                                       iswide = false;
+                               }
+                       break;
+
+                       /* 54 -58 */
+               case JAVA_ISTORE:
+               case JAVA_LSTORE:
+               case JAVA_FSTORE:
+               case JAVA_DSTORE:
+
+               case JAVA_ASTORE:
+                       if (iswide)
+                               {
+                                       iswide=false;
+                                       nextp = p+3;
+                               }
+                       break;
+
+                       /* 132 */
+               case JAVA_IINC:
+                       {
+                               if (iswide) {
+                                       iswide = false;
+                                       nextp = p+5;
+                               }
+                       }
+                       break;
+
+                       /* wider index for loading, storing and incrementing */
+                       /* 196 */
+               case JAVA_WIDE:
+                       iswide = true;
+                       nextp = p + 1;
+                       break;
+                       /* 169 */
+               case JAVA_RET:
+                       if (iswide) {
+                               nextp = p+3;
+                               iswide = false;
+                       }
+                       break;
+
+                       /* table jumps ********************************/
+
+               case JAVA_LOOKUPSWITCH:
+                       {
+                               s4 num;
+                               nextp = ALIGN((p + 1), 4);
+                               num = rt_code_get_u4(nextp + 4);
+                               nextp = nextp + 8 + 8 * num;
+                               break;
+                       }
+
+
+               case JAVA_TABLESWITCH:
+                       {
+                               s4 num;
+                               nextp = ALIGN ((p + 1),4);
+                               num = rt_code_get_s4(nextp + 4);
+                               num = rt_code_get_s4(nextp + 8) - num;
+                               nextp = nextp + 16 + 4 * num;
+                               break;
+                       }
+
+                       /*-------------------------------*/
+               case JAVA_PUTSTATIC:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *fr;
+                               fieldinfo *fi;
+
+                               fr = class_getconstant (rt_class, i, CONSTANT_Fieldref);
+                               /* descr has type of field ref'd  */
+                               fi = class_findfield (fr->class,fr->name, fr->descriptor);
+                               RTAPRINT03putstatic1
+
+                                       /*--- RTA ---*/
+                                /* class with field - marked in addClassinit */
+                                       addClassInit(fr->class);
+
+                               /*--- XTA ---*/
+                               if   ((XTAOPTbypass) || (opt_xta))
+                                       {
+                                               if (fi->xta == NULL)
+                                                       fi->xta = xtafldinfoInit(fi);
+                                               if (xtaAddFldClassTypeInfo(fi)) {  
+                                                       rt_method->xta->fldsUsed = add2FldSet(rt_method->xta->fldsUsed, fi, true,false);
+                                               }
+                                       }
+                       }
+                       break;
+
+               case JAVA_GETSTATIC:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *fr;
+                               fieldinfo *fi;
+
+                               fr = class_getconstant (rt_class, i, CONSTANT_Fieldref);
+                               /* descr has type of field ref'd  */
+                               fi = class_findfield (fr->class,fr->name, fr->descriptor);
+                               RTAPRINT03putstatic1
+
+                                       /*--- RTA ---*/
+                                /* class with field - marked in addClassinit */
+                                       addClassInit(fr->class);
+
+                               /*--- XTA ---*/
+                               if  ((XTAOPTbypass) || (opt_xta) ) 
+                                       {
+                                               if (fi->xta == NULL)
+                                                       fi->xta = xtafldinfoInit(fi);
+                                               if (xtaAddFldClassTypeInfo(fi)) {
+                                                       rt_method->xta->fldsUsed = add2FldSet(rt_method->xta->fldsUsed, fi, false, true);
+                                               }
+                                       }
+
+                       }
+                       break;
+
+
+                       /*--------------------  method invocation ---------------------*/
+
+               case JAVA_INVOKESTATIC:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *mr;
+                               methodinfo *mi;
+
+                               mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
+                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
+                               /*-- RTA --*/
+                               RTAPRINT04invokestatic1
+                                       if (mi->class->classUsed == NOTUSED) {
+                                               mi->class->classUsed = USED;
+                                               RTAPRINT05invokestatic2
+                                                       }
+                               addClassInit(mi->class);
+       
+                               ADDTOCALLGRAPH(mi)  
+                                       fflush(stdout);
+                               /*-- XTA --*/
+                               if ((XTAOPTbypass) || (opt_xta)) {
+                                       xtaAddCallEdges(mi,MONO); 
+                               } /* end XTA */
+                       }
+                       break;
+
+               case JAVA_INVOKESPECIAL:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *mr;
+                               methodinfo *mi;
+                               classinfo  *ci;
+                               
+                               mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
+                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
+                               ci = mi->class;
+                               RTAPRINT06invoke_spec_virt1
+                                       /*--- PRIVATE Method -----------------------------------------------------*/ 
+                                       if (mi->name        != INIT) {     /* if method called is PRIVATE */ 
+                                               RTAPRINT07invoke_spec_virt2
+                                                       RTAPRINT04invokestatic1
+                                                       /*-- RTA --*/   /* was just markSubs(mi); */
+                                                       ADDTOCALLGRAPH(mi)  
+
+                                                       /*--- XTA ---*/
+                                                       if ((XTAOPTbypass) || (opt_xta)) {
+                                                               xtaAddCallEdges(mi,MONO);
+                                                       } /* end XTA */
+                                       }
+
+                                       else    {
+                                               /*--- Test for super <init> which is: <init> calling its super class <init> -*/
+
+                                               /* new class so add marked methods */
+                                               if (( mi->methodUsed != USED) || (mi->class->classUsed == PARTUSED))  {
+                                                       /*--- process NORMAL <init> method ---------------------------------------------*/
+                                                       if ( mi->methodUsed != USED) {
+                                                               /* Normal <init> 
+                                                                  - mark class as USED and <init> to callgraph */
+                               
+                                                               /*-- RTA --*/
+                                                               ci->classUsed = USED;
+                                                               addMarkedMethods(ci);    /* add to callgraph marked methods */
+                                                               RTAPRINT06Binvoke_spec_init
+                                                                       addUsedInterfaceMethods(ci); 
+                                                       ADDTOCALLGRAPH(mi)  
+
+                                                                       /*-- XTA --*/
+                                                                       if ((XTAOPTbypass) || (opt_xta)) { 
+                                                                               rt_method->xta->XTAclassSet = add2ClassSet(rt_method->xta->XTAclassSet,ci ); 
+                                                                               xtaAddCallEdges(mi,MONO);
+                                                                               RTAPRINT06CXTAinvoke_spec_init1
+                                                                                       } /* end XTA */
+                                                       }
+                                               }
+                                       }
+
+                       }                                                
+                       break;
+
+
+               case JAVA_INVOKEVIRTUAL:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *mr;
+                               methodinfo *mi;
+                               
+                               mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
+                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
+
+                               /*--- RTA ---*/
+                               RTAPRINT07invoke_spec_virt2
+                                       mi->monoPoly = POLY;
+                               rtaMarkSubs(mi->class,mi); 
+
+                               /*--- XTA ---*/
+                               if ((XTAOPTbypass) || (opt_xta)) { 
+                                       classSetNode *subtypesUsedSet = NULL;
+                                       if (rt_method->xta->XTAclassSet != NULL)
+                                               subtypesUsedSet = intersectSubtypesWithSet(mi->class, rt_method->xta->XTAclassSet->head);
+                                       /*****  
+                                                       printf(" \nXTA subtypesUsedSet: "); fflush(stdout);
+                                                       printSet(subtypesUsedSet);
+                                       *****/
+                                       xtaMarkSubs(mi->class, mi, subtypesUsedSet);   
+                               } /* end XTA */
+                       }
+                       break;
+
+               case JAVA_INVOKEINTERFACE:
+                       i = rt_code_get_u2(p + 1);
+                       {
+                               constant_FMIref *mr;
+                               methodinfo *mi;
+                               classSetNode *subs;
+                               
+                               mr = class_getconstant (rt_class, i, CONSTANT_InterfaceMethodref);
+                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
+
+                               if (mi->flags & ACC_STATIC)
+                                       panic ("Static/Nonstatic mismatch calling static method");
+
+                               /*--- RTA ---*/
+                               RTAPRINT08AinvokeInterface0
+                                       if (mi->class->classUsed == NOTUSED) {
+                                               mi->class->classUsed = USED; /*??PARTUSED;*/
+                                               class_java_lang_Object->impldBy =  addElement(class_java_lang_Object -> impldBy,  mi->class);
+                                       }
+
+                               /* add interface class to list kept in Object */
+                               mi->methodUsed = USED;
+                               mi->monoPoly   = POLY;
+
+                               subs =  mi->class->impldBy; 
+                               RTAPRINT08invokeInterface1
+                                       while (subs != NULL) { 
+                                               classinfo * isubs = subs->classType;
+                                               RTAPRINT09invokeInterface2
+                                                       /* Mark method (mark/used) in classes that implement the method */
+                                                       if (isubs->classUsed != NOTUSED) {
+                                                               methodinfo *submeth;
+                                               
+                                                               submeth = class_findmethod(isubs,mi->name, mi->descriptor); 
+                                                               if (submeth != NULL)
+                                                                       submeth->monoPoly = POLY; /*  poly even if nosubs */
+                                                               rtaMarkSubs(isubs, mi);  
+                                                       }
+                                               subs = subs->nextClass;
+                                       }
+
+                               /*--- XTA ---*/
+                               if ((XTAOPTbypass2) || (opt_xta))
+                                       {
+                                               xtaMarkInterfaceSubs(mi);
+                                       }
+                       }
+                       break;
+
+                       /* miscellaneous object operations *******/
+
+               case JAVA_NEW:
+                       i = rt_code_get_u2 (p+1);
+                       {
+                               classinfo *ci;
+
+                               ci = class_getconstant (rt_class, i, CONSTANT_Class); 
+                               if (pWhenMarked >= 1) {
+                                       printf("\tclass=");fflush(stdout);
+                                       utf_display(ci->name); fflush(stdout);
+                                       printf("=\n");fflush(stdout);
+                               }
+                               /*--- RTA ---*/
+                               if (ci->classUsed != USED) {
+                                       RTAPRINT10new
+                                               ci->classUsed = USED;    /* add to heirarchy    */
+                                       /* Add this class to the implemented by list of the abstract interface */
+                                       addUsedInterfaceMethods(ci);
+                                       addClassInit(ci);
+                               } 
+                               /*--- XTA ---*/
+                               if ((XTAOPTbypass) || (opt_xta))
+                                       {
+                                               rt_method->xta->XTAclassSet = add2ClassSet(rt_method->xta->XTAclassSet,ci ); /*XTA*/
+                                               RTAPRINT10newXTA
+                                                       }
+                       }
+                       break;
+
+               default:
+                       break;
+
+               } /* end switch */
+
+
+       } /* end for */
+
+       if (p != rt_jcodelength)
+               panic("Command-sequence crosses code-boundary");
+
+       if ((XTAOPTbypass) || (opt_xta))
+               xtaMethodCalls_and_sendReturnType();
+
+
+}
+
+/*-------------------------------------------------------------------------------*/
+/* RTA add Native Methods/ Class functions  */
+/*-------------------------------------------------------------------------------*/
+void   findMarkNativeUsedMeth (utf * c1, utf* m1, utf* d1) {
+
+       classinfo  *class;
+       methodinfo *meth;
+
+       class = class_get(c1);
+       if (class == NULL)  {
+               return;    /*Note: Since NativeCalls is for mult programs some may not be loaded - that's ok */
+       }
+
+       if (class->classUsed == NOTUSED) {
+               class->classUsed = USED; /* MARK CLASS USED */
+               /* add marked methods to callgraph */ 
+               addMarkedMethods(class);
+       }
+
+       meth = class_findmethod (class, m1, d1);
+       if (meth == NULL) {
+               utf_display(class->name);printf(".");utf_display(m1);printf(" ");utf_display(d1);
+               printf("WARNING from parseRT:  Method given is used by Native method call, but NOT FOUND\n");
+       }
+       else
+               rtaMarkSubs(class,meth);
+}
+
+/*-------------------------------------------------------------------------------*/
+
+void   findMarkNativeUsedClass (utf * c) {
+       classinfo  *class;
+
+       class = class_get(c);
+       if (class == NULL)  panic("parseRT: Class used by Native method called not loaded!!!");
+       class->classUsed = USED;
+
+       /* add marked methods to callgraph */
+       addMarkedMethods(class);
+}
+
+
+/*-------------------------------------------------------------------------------*/
+
+void markNativeMethodsRT(utf *rt_class, utf* rt_method, utf* rt_descriptor) {
+       int i,j,k;
+       bool found = false;
+
+       nativecallcompdone = natcall2utf(nativecallcompdone); 
+
+       for (i=0; i<NATIVECALLSSIZE; i++) {
+               if (rt_class  == nativeCompCalls[i].classname) {
+       
+                       /* find native class.method invoked */
+                       for (j=0; (!(found) && (j<nativeCompCalls[i].methCnt)); j++) {
+
+                               if ( (rt_method     == nativeCompCalls[i].methods[j].methodname)
+                                        && (rt_descriptor == nativeCompCalls[i].methods[j].descriptor)) {
+
+                                       found=true;
+
+                                       /* mark methods and classes used by this native class.method */
+                                       for (k=0; k < nativeCompCalls[i].callCnt[j]; k++) {
+                                               if (nativeCompCalls[i].methods[j].methodCalls[k].methodname != NULL) {
+                                                       /* mark method used */
+                                                       findMarkNativeUsedMeth(
+                                                                                                  nativeCompCalls[i].methods[j].methodCalls[k].classname,
+                                                                                                  nativeCompCalls[i].methods[j].methodCalls[k].methodname,
+                                                                                                  nativeCompCalls[i].methods[j].methodCalls[k].descriptor); 
+
+                                                       /*RTprint 
+                                                         printf("\nmark method used: "); fflush(stdout);
+                                                         utf_display(nativeCompCalls[i].methods[j].methodCalls[k].classname); printf(".");fflush(stdout);
+                                                         utf_display(nativeCompCalls[i].methods[j].methodCalls[k].methodname); printf("=="); fflush(stdout);
+                                                         utf_display(nativeCompCalls[i].methods[j].methodCalls[k].descriptor); printf("==\n"); fflush(stdout);
+                                                       */
+                                               }
+                                               else {
+                                                       /* mark class used */
+                                                       findMarkNativeUsedClass( nativeCompCalls[i].methods[j].methodCalls[k].classname);
+                                               } /* if-else k  */ 
+
+                                       }  /* for k */ 
+
+                               }  /* if j */
+                       }  /* for j */
+
+               }  /* if i */  
+       }  /* for i */
+
+}
+
+
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+void mainRTAparseInit (methodinfo *m )
+{
+       /*printf("MAIN_NOT_STARTED \n");*/ 
+       if (class_java_lang_Object->sub != NULL) { 
+               RTAPRINT16stats1;
+       }
+
+       if (firstCall) {
+               firstCall=false;
+
+               utf_MAIN  = utf_new_char("main");
+               INIT      = utf_new_char("<init>");
+               CLINIT    = utf_new_char("<clinit>");
+               FINALIZE  = utf_new_char("finalize");
+               EMPTY_DESC= utf_new_char("()V");
+
+               if ( (rtMissed = fopen("rtMissed", "w")) == NULL) {
+               printf("CACAO - rtMissed file: can't open file to write\n");
+               }
+               else {
+                       fprintf(rtMissed,"To Help User create a dymLoad file \n");
+                       fprintf(rtMissed,
+                                       "Not parsed in the static analysis parse of Main: #rt parse / #missed class.method (descriptor) \n");
+                       fprintf(rtMissed,"\n\tBEFORE MAIN RT PARSE\n");
+                       fflush(rtMissed);
+                       fclose(rtMissed);
+               }
+               callgraph = MNEW (methodinfo*, MAXCALLGRAPH);   /****/
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       printf("XTAXTA  CALLGRAPHS allocated\n");
+                       XTAcallgraph = MNEW (methodinfo*, MAXCALLGRAPH);
+               }
+       }
+
+       if (m->name == utf_MAIN) {
+               rtMissed = fopen("rtMissed","a");
+               fprintf(rtMissed,"\n\n\tAFTER MAIN RT PARSE\n");
+               fclose(rtMissed);
+               AfterMain = true;
+       }
+       else {  
+               if ( (rtMissed = fopen("rtMissed", "a")) == NULL) {
+                       printf("CACAO - rtMissed file: can't open file to write\n");
+               }
+               else {
+                       fprintf(rtMissed,"#%i/#%i ",methRTlast+1,missedCnt++ );
+                       utf_fprint(rtMissed,m->class->name);
+                       fprintf(rtMissed," ");
+                       fprintflags(rtMissed,m->flags);
+                       fprintf(rtMissed," ");
+                       utf_fprint(rtMissed,m->name);
+                       fprintf(rtMissed," ");
+                       utf_fprint(rtMissed,m->descriptor);
+                       fprintf(rtMissed,"\n");
+                       fflush(rtMissed);
+                       fclose(rtMissed);
+               }
+               if (AfterMain) {
+                       printf("#%i : ",methRT);
+                       printf("Method missed by static analysis Main parse. See rtMissed file");
+                       /***    panic ("Method missed by static analysis Main parse. See rtMissed file");**/
+               }
+       }
+
+       /* At moment start RTA before main when parsed                      */
+       /* Will definitely use flag with to know if ok to apply in-lining.  */
+}
+
+
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+/* still need to look at field sets in 2nd pass and clinit .....  */
+void XTA_jit_parse2(methodinfo *m)
+{
+       if (XTAdebug >= 1) 
+               printf("\n\nStarting Round 2 XTA !!!!!!!!!!!!!!\n");
+
+       /* for each method in XTA worklist = callgraph (use RTA for now) */
+       methRT=0;
+       while (methRT <= methRTlast) {
+               rt_method      = callgraph[methRT];
+               rt_class       = rt_method->class;
+               rt_descriptor  = rt_method->descriptor;
+               rt_jcodelength = rt_method->jcodelength;
+               rt_jcode       = rt_method->jcode;
+
+               if (! (  (rt_method->flags & ACC_NATIVE  )
+                                ||   (rt_method->flags & ACC_ABSTRACT) ) ) {
+                       if (XTAdebug >= 1) {
+                               printf("\n!!!!! XTA Round 2 Parse of #%i:",methRT);fflush(stdout);
+                               utf_display(rt_class->name); printf("."); fflush(stdout);
+                               method_display(rt_method);
+                       }
+                       /*   if XTA type set changed since last parse */
+                       if (rt_method->xta->chgdSinceLastParse) {
+
+                               /*     get types from methods it is calledBy */
+                               xtaPassAllCalledByParams ();
+
+                               /* Pass parameter types to methods it calls and  send the return type those called by  */
+                               xtaMethodCalls_and_sendReturnType();
+                       }
+               }
+               methRT++;
+       }
+       if (XTAdebug >= 1) {
+
+               printf("\n\nEND_OF Round 2 XTA !!!!!!!!!!!!!!\n");
+               printXTACallgraph ();
+       }
+       
+       RTAPRINT14CallgraphLast  /*was >=2 */
+               RTAPRINT15HeirarchyiLast /*was >= 2 */
+               }
+
+
+/*-------------------------------------------------------------------------------*/
+
+void RT_jit_parse(methodinfo *m)
+{
+       /*-- RTA --*/
+       if (m->methodUsed == USED) return;
+       mainRTAparseInit (m);
+               
+       /* initialise parameter type descriptor */
+       callgraph[++methRTlast] = m;          /*-- RTA --*/
+       m->methodUsed = USED;
+       RTAPRINT11addedtoCallgraph 
+               /* <init> then like a new class so add marked methods to callgraph */
+               if (m->name == INIT)  {  /* need for <init>s parsed efore Main */
+                       classinfo *ci;
+                       ci = m->class;
+                       ci->classUsed = USED;
+                       if (pWhenMarked >= 1) {
+                               printf("Class=");utf_display(ci->name);
+                       }
+                       /* add marked methods to callgraph */
+                       RTAPRINT11addedtoCallgraph2
+                               addMarkedMethods(ci);
+               } /* if */
+
+       /*-- XTA --*/
+       if ((XTAOPTbypass) || (opt_xta)) {
+               XTAcallgraph[++methXTAlast] = m;
+               if (m->xta == NULL) {
+                       m->xta = xtainfoInit(m);
+               }
+               m->xta->XTAmethodUsed = USED;
+               {methodinfo *mi = m;
+               XTAPRINTcallgraph2
+                       }
+       }
+
+       /*-- Call graph work list loop -----------------*/
+
+       while (methRT <= methRTlast) {
+               rt_method      = callgraph[methRT];
+           rt_class       = rt_method->class;
+           rt_descriptor  = rt_method->descriptor;
+           rt_jcodelength = rt_method->jcodelength;
+           rt_jcode       = rt_method->jcode;
+
+               if (! (  (rt_method->flags & ACC_NATIVE  )
+                                ||   (rt_method->flags & ACC_ABSTRACT) ) ) {
+                       parseRT();
+               }
+           else {
+                       RTAPRINT12bAbstractNative
+               if (rt_method->flags & ACC_NATIVE ) {
+                                       RTAPRINT12aNative
+                                               /* mark used and add to callgraph methods and classes used by NATIVE method */
+                                               markNativeMethodsRT(rt_class->name,rt_method->name,rt_descriptor);                
+                               }
+                       if (rt_method->flags & ACC_ABSTRACT) {
+                               panic("ABSTRACT_SHOULD not ever get into the callgraph!!!!!****!!!****!!!!****!!!!\n"); 
+                       }
+               }
+               methRT++;
+               RTAPRINT12Callgraph 
+                       RTAPRINT13Heirarchy 
+                       } /* while */
+
+
+       if (m->class->classUsed == NOTUSED)
+               m->class->classUsed = USED; /* say Main's class has a method used ??*/ 
+       printXTACallgraph ();
+       RTAPRINT14CallgraphLast  /*  was >=2*/
+               //RTAPRINT15HeirarchyiLast /*was >= 2 */
+
+               if ((XTAOPTbypass) || (opt_xta)) {
+                       /*--- XTA round 2+ "parse" - use info structures only so not a real parse */
+                       XTA_jit_parse2(m);
+               }
+       /**** DO NOT free if RTA or XTA for now
+if (m->name == utf_MAIN) {
+       MFREE(callgraph,methodinfo*,MAXCALLGRAPH);
+       if ((XTAOPTbypass) || (opt_xta)) {
+               printf("XTAXTA  CALLGRAPHS returned \n");
+               MFREE(XTAcallgraph,methodinfo*,MAXCALLGRAPH);
+               }
+       }
+****/
+
+       return;
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 8af2b4dadf26712060204bd2f969f0f600c7d37e..d9527a3f78711261617fd90c011d15f58909c3f8 100644 (file)
-/********************** parseRT.h ******************************************
-  Parser and print functions for Rapid Type Analyis
-  used to only compile methods that may actually be used.
-***************************************************************************/
-#include "natcalls.h"
+/* jit/parseRT.h - RTA parser header
 
-#include "parseRTprint.h"    /* RTAPRINT trace/info/debug prints  */
-#include "sets.h"
-/*------------ global variables -----------------------------------------*/
-#define MAXCALLGRAPH 5000
-
-bool XTAOPTbypass = false;
-bool XTAOPTbypass2 = false;   /* for now  invokeinterface     */
-bool XTAOPTbypass3 = false;   /* print XTA classsets in stats */
-int  XTAdebug = 0; 
-int  XTAfld = 0; 
-
-int methRT = 0;            
-int methRTlast = -1;;      
-int methRTmax=MAXCALLGRAPH;        
-static methodinfo **callgraph;
-/*methodinfo *callgraph[MAXCALLGRAPH];*/ 
-
-int methXTA = 0;            
-int methXTAlast = -1;;      
-int methXTAmax=MAXCALLGRAPH;        
-static methodinfo **XTAcallgraph;
-/*methodinfo *XTAcallgraph[MAXCALLGRAPH];*/
-
-static bool nativecallcompdone=0 ;
-
-static bool firstCall= true;
-static bool AfterMain = false;
-static FILE *rtMissed;   /* Methods missed during RTA parse of Main  */
-                        /*   so easier to build dynmanic calls file */
-
-static utf *utf_MAIN;   /*  utf_new_char("main"); */
-static utf *INIT    ;   /*  utf_new_char("<init>"); */
-static utf *CLINIT  ;   /*  utf_new_char("<clinit>"); */
-static utf *FINALIZE;   /*  utf_new_char("finalize"); */
-static utf *EMPTY_DESC; /*  utf_new_char("V()");  */
-static int missedCnt = 0;
-
-#include "jit/parseRTstats.h"
-
-/*--------------------------------------------------------------*/
-/* addToCallgraph - adds to RTA callgraph and                   */ 
-/*                  sets  meth->methodUsed  to USED             */
-/*--------------------------------------------------------------*/  
-#define ADDTOCALLGRAPH(meth)  if ((meth->methodUsed != USED) && (!(meth->flags & ACC_ABSTRACT)) ) { \
-       callgraph[++methRTlast] = meth ; \
-       meth->methodUsed = USED; \
-                       if(pWhenMarked>=1) \
-                               {printf("\n Added to Call Graph #%i:",  \
-                               methRTlast); \
-                               printf("\t <used flags c/m> <%i/%i> %i\t",  \
-                                 meth->class->classUsed, \
-                                 meth->methodUsed, \
-                                 USED);  \
-                               printf(" method name =");   \
-                               utf_display(meth->class->name);printf("."); \
-                               method_display(meth);fflush(stdout);} \
-       }
-
-
-/*--------------------------------------------------------------*/
-bool rtaSubUsed(classinfo *class, methodinfo *meth) {
-       classinfo *subs;
-
-       for (subs=class->sub; subs != NULL; subs = subs->nextsub) {
-               if (subs->classUsed == USED) {
-                       if (class_findmethod(class, meth->name, meth->descriptor) == NULL) 
-                               return false;
-                       else    
-                               return true;
-                       }
-               if (rtaSubUsed(subs, meth)) 
-                       return false;
-               }
-       return false;
-}
-
-
-/*--------------------------------------------------------------*/
-/* Mark the method with same name /descriptor in topmethod      */
-/* in class                                                     */
-/*                                                              */
-/* Class not marked USED and method defined in this class ->    */
-/*    -> if Method NOTUSED mark method as MARKED                */
-/* Class marked USED and method defined in this class ->        */
-/*    -> mark method as USED                                    */
-/*                                                              */
-/* Class USED, but method not defined in this class ->          */
-/*    -> search up the heirarchy and mark method where defined  */
-/*       if class where method is defined is not USED ->        */
-/*      -> mark class with defined method as PARTUSED          */
-/*--------------------------------------------------------------*/
-
-void rtaMarkMethod(classinfo *class, methodinfo *topmethod) {
-
-  utf *name = topmethod -> name; 
-  utf *descriptor = topmethod -> descriptor;
-  methodinfo *submeth;
-
-  submeth = class_resolvemethod(class, name, descriptor); 
-  if (submeth == NULL)
-       panic("parse RT: Method not found in class hierarchy");
-  if (submeth->methodUsed == USED) return;
-  
-  if (submeth->class == class) { 
-
-       /*--- Method defined in class -----------------------------*/
-       if (submeth->class->classUsed != USED) { 
-               if (submeth->methodUsed == NOTUSED) { 
-
-                /* Class NOT marked USED and method defined in this class -> */
-               /*    -> if Method NOTUSED mark method as  MARKED            */
-                               if (pWhenMarked >= 1) {
-                                       printf("MARKED class.method\t"); 
-                                       utf_display(submeth->class->name);printf(".");method_display(submeth);
-                                       }
-                       if (rtaSubUsed(submeth->class,submeth)) {
-                               submeth->class->classUsed = PARTUSED;
-                               ADDTOCALLGRAPH(submeth) 
-                               }
-                       else    {
-                               submeth->methodUsed = MARKED;
-                                       RTAPRINTmarkMethod1
-                               }
-               } }
-       else    {
-                /* Class IS  marked USED and method defined in this class -> */
-               /*    -> mark method as USED  */
-               ADDTOCALLGRAPH(submeth) 
-               }
-       } /* end defined in class */
-
-  else {
-       /*--- Method NOT defined in class -----------------------------*/
-       if (submeth->class->classUsed == NOTUSED) {
-               submeth->class->classUsed = PARTUSED;
-               if (class->classUsed != USED) {
-                       submeth->methodUsed = MARKED;
-                       }
-               }
-       if ( (submeth->class->classUsed == USED) 
-         || (class->classUsed == USED)) {
-               ADDTOCALLGRAPH(submeth)
-               }
-               } /* end NOT defined in class */
-} 
-
-/*-------------------------------------------------------------------------------*/
-/* Mark the method with the same name and descriptor as topmethod                */
-/*   and any subclass where the method is defined and/or class is used           */
-/*                                                                               */
-/*-------------------------------------------------------------------------------*/
-void rtaMarkSubs(classinfo *class, methodinfo *topmethod) {
-               RTAPRINTmarkSubs1
-  rtaMarkMethod(class, topmethod);   /* Mark method in class where it was found */
-  if (class->sub != NULL) {
-     classinfo *subs;
-       
-    if (!(topmethod->flags & ACC_FINAL )) {
-       for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
-               RTAPRINTmarkSubs1
-         rtaMarkSubs(subs, topmethod); 
-         }
-       }
-    }
-return;
-}
-
-/*-------------------------------------------------------------------------------*/
-/* Add Marked methods for input class ci                                         */
-/* Add methods with the same name and descriptor as implemented interfaces       */
-/*   with the same method name                                                   */
-/*                                                                               */
-/*-------------------------------------------------------------------------------*/
-void addMarkedMethods(classinfo *ci) {
-int ii,jj,mm;
-
-/* add marked methods to callgraph */ 
-for (ii=0; ii<ci->methodscount; ii++) { 
-       methodinfo *mi = &(ci->methods[ii]);
-       if (mi->methodUsed == MARKED) { 
-                       if (pWhenMarked >= 1) {
-                       printf("ADDED a method that was MARKED\n");
-                       }
-               ADDTOCALLGRAPH(mi)  
-               }
-       else {
-       
-               for (jj=0; jj < ci -> interfacescount; jj++) {
-                       classinfo *ici = ci -> interfaces [jj];
-/*  use resolve method....!!!! */
-                       if (ici -> classUsed != NOTUSED) {
-                               for (mm=0; mm< ici->methodscount; mm++) {
-                                       methodinfo *imi = &(ici->methods[mm]);
-
-                                       if  (      (imi->methodUsed == USED) 
-                                       &&       ( (imi->name == mi->name) 
-                                       &&         (imi->descriptor == mi->descriptor))) {
-                                                       if (pWhenMarked >= 1) 
-                                                               printf("ADDED a method that was used by an interface\n");
-                                               ADDTOCALLGRAPH(mi)  
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-}    
-/*-------------------------------------------------------------------------------*/
-/*  XTA Functions                                                                */
-/*-------------------------------------------------------------------------------*/
-
-xtainfo * xtainfoInit (methodinfo *m) {
-
-if (m->xta != NULL) return m->xta;
-       m ->xta = (xtainfo *)malloc(sizeof(xtainfo));
-       m ->xta-> XTAmethodUsed = NOTUSED;
-       m ->xta-> XTAclassSet   = NULL;
-       /* PartClassSet */
-       m ->xta-> paramClassSet = NULL;
-       m ->xta-> calls         = NULL;
-       m ->xta-> calledBy      = NULL;
-
-       m ->xta-> marked       = NULL;
-       /*m ->xta-> markedBy     = NULL */
-       m ->xta-> fldsUsed     = NULL;
-       /*m ->xta-> interfaceCalls    = NULL*/
-       m ->xta-> chgdSinceLastParse = false;
-       return m->xta;
-}
-
-xtafldinfo * xtafldinfoInit (fieldinfo *f) {
-
-if (f->xta != NULL) return f->xta;
-
-       f ->xta = (xtafldinfo *)malloc(sizeof(xtafldinfo));
-       f -> xta-> fieldChecked = false;   /*XTA*/
-       f -> xta-> fldClassType = NULL;    /*XTA*/
-       f -> xta-> XTAclassSet = NULL;     /*XTA*/
-       return f->xta;
-
-}
-bool xtaPassParams (methodinfo *SmCalled, methodinfo *SmCalls, methSetNode *lastptrInto) {
-
-classSetNode *p;
-classSetNode *c;
-classSetNode *c1;
-classSetNode *cprev;
-bool          rc = false;
-
-       if (XTAdebug >= 1) {
-               printf("\n>>>>>>>>>>>>>>>>><<<xtaPassParams \n");fflush(stdout);
-
-               printf("\tIN SmCalled set : "); 
-               utf_display(SmCalled->class->name);printf("."); method_display(SmCalled);
-               printClassSet(SmCalled->xta->XTAclassSet); printf("\n"); 
-
-               printf("\tIN SmCalls set: "); 
-               utf_display(SmCalls->class->name);printf("."); method_display(SmCalls);
-               printClassSet(SmCalls->xta->XTAclassSet); printf("\n"); 
-               
-               printf("\tIN lastptrInto : (");
-               if (lastptrInto->lastptrIntoClassSet2 != NULL) {
-                       utf_display(lastptrInto->lastptrIntoClassSet2->classType->name); printf(") ");
-                       }
-               else {printf("NULL) ");}
-               fflush(stdout);
-               utf_display(lastptrInto->methRef->class->name);printf("."); fflush(stdout);
-                       method_display(lastptrInto->methRef); fflush(stdout);
-               printf("\n");fflush(stdout);
-               }
-
-/* Get SmCalled ParamType set if null */
-if (SmCalled->xta->paramClassSet == NULL) {
-       SmCalled->xta->paramClassSet = descriptor2typesL(SmCalled); 
-       }
-       if (XTAdebug >= 1) {
-               printf("\tParamPassed\n"); fflush(stdout);
-               printSet(SmCalled->xta->paramClassSet);fflush(stdout);
-               printf("\n"); fflush(stdout);
-               }
-
-if (lastptrInto->lastptrIntoClassSet2 == NULL) {
-       if (SmCalls->xta->XTAclassSet != NULL) 
-               c1 = SmCalls->xta->XTAclassSet->head;
-       else
-               c1 = NULL;
-       }
-else   {
-       /* start with type where left off */
-       c1 = lastptrInto->lastptrIntoClassSet2;  
-       c1 = c1 -> nextClass;  /* even if NULL */
-       }
-cprev = NULL;
-       if (XTAdebug >= 1) {
-               if (c1 == NULL){
-                       printf("\tIN SmCalls ... start with NULL\n"); fflush(stdout);
-                       }
-               else    {
-                       printf("\tIN SmCalls ... start with :");fflush(stdout);
-                       utf_display(c1->classType->name); printf("\n");
-                       }
-               }
-
-/* for each Param Class */
-for (  p=SmCalled->xta->paramClassSet; p != NULL; p = p->nextClass) {
-
-       /* for each SmCalls class */
-       for (c=c1; c != NULL; c = c->nextClass) {
-               vftbl *p_cl_vt = p->classType->vftbl; 
-               vftbl *c_cl_vt = c->classType->vftbl; 
-
-               /* if SmCalls class is in the Params Class range */
-               if (  (p_cl_vt->baseval <=  c_cl_vt->baseval)
-                  && (c_cl_vt->baseval <= (p_cl_vt->baseval+p_cl_vt->diffval)) ) {
-
-                       /*    add SmCalls class to SmCalledBy Class set */
-                       SmCalled->xta->XTAclassSet = SmCalled->xta->XTAclassSet = add2ClassSet(SmCalled->xta->XTAclassSet, c->classType); 
-                       rc = true;
-                       }
-               cprev = c;
-               }       
-       }
-lastptrInto->lastptrIntoClassSet2 = cprev;
-                       if (XTAdebug >= 1) {
-                               printf("\tOUT SmCalled set: ");fflush(stdout);
-                               printClassSet(SmCalled->xta->XTAclassSet);fflush(stdout);
-
-                               printf("\tOUT SmCalls set: ");fflush(stdout);
-                               printClassSet(SmCalls->xta->XTAclassSet);fflush(stdout);
-
-                               printf("\tOUT  lastptrInto="); fflush(stdout);
-                               if (lastptrInto->lastptrIntoClassSet2 != NULL)
-                                       utf_display(lastptrInto->lastptrIntoClassSet2->classType->name);
-
-                               printf("<rc=%i>\n",rc);fflush(stdout);
-                               }
-return rc;
-}
-
-/*-------------------------------------------------------------------------------*/
-bool xtaPassReturnType(methodinfo *SmCalled, methodinfo *SmCalls) {
-
-classSetNode* cs;
-classSetNode* cs1;
-bool          rc = false;
-
-       if (XTAdebug >= 1)
-               printf("xtaPassReturnType \n");
-
-/* Get SmCalled return class is null */
-if ((SmCalled->returnclass == NULL) && (SmCalled->xta->paramClassSet == NULL)) {
-       SmCalled->xta->paramClassSet = descriptor2typesL(SmCalled); 
-       }
-
-if (SmCalled->returnclass == NULL) {
-               if (XTAdebug >= 1)
-                       printf("\tReturn type is NULL\n");
-       return rc;
-       }
-       
-       if (XTAdebug >= 1) {
-               printf("\tReturn type is: ");
-               utf_display(SmCalled->returnclass->name);
-               printf("\n");
-
-               printf("\tIN SmCalls set: ");
-               utf_display(SmCalls->class->name); printf("."); method_display(SmCalls);
-               printClassSet(SmCalls->xta->XTAclassSet);
-
-               printf("\tIN SmCalled set: ");
-               utf_display(SmCalled->class->name); printf("."); method_display(SmCalled);
-               printClassSet(SmCalled->xta->XTAclassSet);
-               }
-
-
-if (SmCalled->xta->XTAclassSet == NULL) 
-       cs1 = NULL;
-else
-       cs1 =  SmCalled->xta->XTAclassSet->head;
-for (cs =cs1; cs != NULL; cs = cs->nextClass) {
-       classinfo *c = cs->classType;
-       vftbl *r_cl_vt = SmCalled->returnclass->vftbl; 
-       vftbl *c_cl_vt = c->vftbl; 
-
-       /* if class is a subtype of the return type, then add to SmCalls class set (ie.interscection)*/
-       if (  (r_cl_vt->baseval <=  r_cl_vt->baseval)
-          && (c_cl_vt->baseval <= (r_cl_vt->baseval+r_cl_vt->diffval)) ) {
-               SmCalls->xta->XTAclassSet = add2ClassSet(SmCalls->xta->XTAclassSet, c);  
-               rc = true;
-               }
-       } 
-
-       if (XTAdebug >= 1) {
-               printf("\tOUT SmCalls set: ");
-               printClassSet(SmCalls->xta->XTAclassSet);
-               }
-return rc;
-}
-
-/*-------------------------------------------------------------------------------*/
-void xtaAddCallEdges(methodinfo *mi, s4 monoPoly) {
-
-       if (mi->xta == NULL)
-               mi->xta = xtainfoInit(mi);
-       if (mi->xta->XTAmethodUsed  != USED) {  /* if static method not in callgraph */
-               XTAcallgraph[++methXTAlast] = mi;
-               mi->xta->XTAmethodUsed = USED;
-//                             XTAPRINTcallgraph2
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-if(pWhenMarked>=1) {  
-        printf("\n XTA Added to Call Graph #%i:", 
-                methXTAlast); 
-        printf(" method name ="); fflush(stdout);
-if (mi == NULL) panic ("Method ptr NULL!!!");
-if (mi->class == NULL) panic ("Method class ptr NULL!!!");
-if (mi->class->name == NULL) panic ("Method class name ptr NULL!!!");
-        utf_display(mi->class->name);fflush(stdout); printf(".");fflush(stdout); 
-        method_display(mi);fflush(stdout); 
-        }
+   This file is part of CACAO.
 
-               }
-       /* add call edges */
-printf("AA1 "); fflush(stdout);
-       rt_method->xta->calls = add2MethSet(rt_method->xta->calls, mi);
-       rt_method->xta->calls->tail->monoPoly = monoPoly;
-       mi->xta->calledBy     = add2MethSet(mi->xta->calledBy,     rt_method); 
-if (mi->xta->calledBy     == NULL) panic("mi->xta->calledBy is NULL!!!");
-if (rt_method->xta->calls == NULL) panic("rt_method->xta->calls is NULL!!!");
-}
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-/*--------------------------------------------------------------*/
-bool xtaSubUsed(classinfo *class, methodinfo *meth, classSetNode *subtypesUsedSet) {
-       classinfo *subs;
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-       for (subs=class->sub; subs != NULL; subs = subs->nextsub) {
-               /* if class used */
-               if (inSet(subtypesUsedSet,subs)) {
-                       if (class_findmethod(class, meth->name, meth->descriptor) == NULL) 
-                               return false;
-                       else    
-                               return true;
-                       }
-               if (xtaSubUsed(subs, meth,  subtypesUsedSet)) 
-                       return false;
-               }
-       return false;
-}
+   Contact: cacao@complang.tuwien.ac.at
 
+   Authors: Carolyn Oates
 
-/*-------------------------------------------------------------------------------*/
-void xtaMarkMethod(classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet)
-{
-  methodinfo *submeth;
+   $Id: parseRT.h 557 2003-11-02 22:51:59Z twisti $
 
-  utf *name = topmethod -> name;
-  utf *descriptor = topmethod -> descriptor;
-/****
-printf("xtaMarkMethod for:"); utf_display(class->name);fflush(stdout); 
-  method_display(topmethod);
-**/
-
-  submeth = class_resolvemethod(class, name, descriptor);
-
-/***
-printf(" def: "); utf_display(submeth->class->name);fflush(stdout);
-  method_display(submeth);
-****/
-
-  /* Basic checks */
-  if (submeth == NULL)
-        panic("parse XTA: Method not found in class hierarchy");
-  if (submeth->xta == NULL) 
-       submeth->xta = xtainfoInit(submeth);
-
-  if (rt_method->xta->calls != NULL) {
-       if (inMethSet(rt_method->xta->calls->head,submeth)) return;
-       }
-  /*----*/
-  if (submeth->class == class) {
-
-        /*--- Method defined in class -----------------------------*/
-       if (inSet(subtypesUsedSet,submeth->class)) {
-               xtaAddCallEdges(submeth,POLY);  
-               }
-       else    {
-               if (subtypesUsedSet != NULL) {  
-                       if (xtaSubUsed (class,submeth,subtypesUsedSet)) {
-                               xtaAddCallEdges(submeth,POLY);
-                               }
-                       }
-               else    {
-                       rt_method->xta->marked = add2MethSet(rt_method->xta->marked, submeth);
-                       }
-               }
-       }
-  else  {
-        /*--- Method NOT defined in class -----------------------------*/
-       if (!(inSet(subtypesUsedSet,submeth->class) )){  /* class with method def     is not used */
-               if (!(inSet(subtypesUsedSet,class) )) { /* class currently resolving is not used */ 
-                       rt_method->xta->marked = add2MethSet(rt_method->xta->marked, submeth);
-                       /*printf("Added to marked Set: "); fflush(stdout);printMethodSet(rt_method->xta->marked);*/
-                        }
-                }
-       if ( (inSet(subtypesUsedSet,submeth->class))  /* class with method def     is used */
-         || (inSet(subtypesUsedSet,class)) ) {       /* class currently resolving is used */ 
-               xtaAddCallEdges(submeth,POLY);
-                }
-
-        } /* end defined in class */
-
-}
-/*-------------------------------------------------------------------------------*/
-void xtaMarkSubs(classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet) {
-               /* xtaPRINTmarkSubs1*/
-  xtaMarkMethod(class, topmethod,subtypesUsedSet);   /* Mark method in class where it was found */
-  if (class->sub != NULL) {
-     classinfo *subs;
-
-    if (!(topmethod->flags & ACC_FINAL )) {
-       for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
-               /* xtaPRINTmarkSubs1 */
-         xtaMarkSubs(subs, topmethod, subtypesUsedSet);
-         }
-       }
-    }
-return;
-}
-
-/*-------------------------------------------------------------------------------*/
-/*-------------------------------------------------------------------------------*/
-
-int addClassInit(classinfo *ci) {
-/* CHANGE to a kind of table look-up for a list of class/methods (currently 3)
 */
 
-utf* utf_java_lang_system = utf_new_char("java/lang/System"); 
-utf* utf_initializeSystemClass = utf_new_char("initializeSystemClass"); 
-utf* utf_java_lang_Object = utf_new_char("java/lang/Object"); 
-
-int m, m1=-1, m2=-1, mf=-1;
-methodinfo *mi;
-
-for  (m=0; m < ci->methodscount; m++) {
-    /*<clnit> class init method */
-    if (ci->methods[m].name == CLINIT) {
-       m1=m;
-       }
-    /* Special case: System class has an extra initializer method */
-    if           ((utf_java_lang_system == ci->name) 
-       && (utf_initializeSystemClass == ci->methods[m].name)) {
-        m2=m;  
-        }
-
-    /* Finalize methods */
-    if    ((ci->methods[m].name == FINALIZE) 
-       && (ci->name != utf_java_lang_Object)) {
-        mf=m;  
-        }
-
-    }
-
-if (m1 >= 0) { /* No <clinit>  available - ignore */  
-
-       /* Get clinit methodinfo ptr */
-       mi = class_findmethod (ci,ci->methods[m1].name , NULL); 
-
-       /*--- RTA ---*/
-       if ( mi->methodUsed != USED) {
-               mi->class->classUsed = PARTUSED;  
-               ADDTOCALLGRAPH(mi)  
-               }
-
-       /*--- XTA ---*/
-       if ((XTAOPTbypass) || (opt_xta)) {
-               xtaAddCallEdges(mi,MONO); 
-       }
-
-       }
-
-if (mf >= 0) {   
-
-       /* Get finalize methodinfo ptr */
-       mi = class_findmethod (ci,ci->methods[mf].name , NULL); 
-
-       /*--- RTA ---*/
-       if ( mi->methodUsed != USED) {
-               mi->class->classUsed = PARTUSED;  
-               ADDTOCALLGRAPH(mi)  
-               }
-
-       /*--- XTA ---*/
-       if ((XTAOPTbypass) || (opt_xta)) {
-       xtaAddCallEdges(mi,MONO); 
-       }
-       }
-
-/*Special Case for System class init:  
-       add java/lang/initializeSystemClass to callgraph */
-if (m2 >= 0) {
-       /* Get clinit methodinfo ptr */
-       mi = class_findmethod (ci,ci->methods[m2].name , NULL); 
-
-       /*--- RTA ---*/
-       if ( mi->methodUsed != USED) {
-               mi->class->classUsed = PARTUSED;
-               ADDTOCALLGRAPH(mi)  
-               }
-
-       /*--- XTA ---*/
-       if ((XTAOPTbypass) || (opt_xta)) {
-       xtaAddCallEdges(mi,MONO);
-       }
-       }
-
-/* add marked methods to callgraph */ 
-addMarkedMethods(ci); 
-               
-return m;
-} 
-
-
-#define rt_code_get_u1(p)  rt_jcode[p]
-#define rt_code_get_s1(p)  ((s1)rt_jcode[p])
-#define rt_code_get_u2(p)  ((((u2)rt_jcode[p])<<8)+rt_jcode[p+1])
-#define rt_code_get_s2(p)  ((s2)((((u2)rt_jcode[p])<<8)+rt_jcode[p+1]))
-#define rt_code_get_u4(p)  ((((u4)rt_jcode[p])<<24)+(((u4)rt_jcode[p+1])<<16)\
-                           +(((u4)rt_jcode[p+2])<<8)+rt_jcode[p+3])
-#define rt_code_get_s4(p)  ((s4)((((u4)rt_jcode[p])<<24)+(((u4)rt_jcode[p+1])<<16)\
-                           +(((u4)rt_jcode[p+2])<<8)+rt_jcode[p+3]))
-
-
-
-/*-------------------------------------------------------------------------------*/
-/*xx*/ void addUsedInterfaceMethods(classinfo *ci) {
-int jj,mm;
-
-/* add used interfaces methods to callgraph */
-for (jj=0; jj < ci -> interfacescount; jj++) {
-       classinfo *ici = ci -> interfaces [jj];
-       
-if (pWhenMarked >= 1) { 
- printf("BInterface used: ");fflush(stdout); 
-               utf_display(ici->name);
-               printf("<%i>\t",ici -> classUsed ); fflush(stdout); 
- if (ici -> classUsed == NOTUSED) printf("\t classUsed=NOTUSED\n" );
- if (ici -> classUsed == USED) printf("\t classUsed=USED\n");
- if (ici -> classUsed == PARTUSED) printf("\t classUsed=PARTUSED\n");
- fflush(stdout);
- }
-       /* add class to interfaces list of classes that implement it */
-       ici -> impldBy =  addElement(ici -> impldBy,  ci);
-
-       /* if interface class is used */
-        if (ici -> classUsed != NOTUSED) {
-
-               /* for each interface method implementation that has already been used */
-               for (mm=0; mm< ici->methodscount; mm++) {
-                               methodinfo *imi = &(ici->methods[mm]);
-if (pWhenMarked >= 1) { 
-       if  (imi->methodUsed != USED) {
-               if (imi->methodUsed == NOTUSED) printf("Interface Method notused: "); 
-               if (imi->methodUsed == MARKED) printf("Interface Method marked: "); 
-               utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
-               }
-       } 
-                       if  (imi->methodUsed == USED) {
-if (pWhenMarked >= 1) { 
-       printf("Interface Method used: "); utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
-
-       /* Mark this method used in the (used) implementing class and its subclasses */
-       printf("MAY ADD methods that was used by an interface\n");
-       }
-                               rtaMarkSubs(ci,imi);
-                                }
-                        }
-                }
-       }
-
-}
-/*-------------------------------------------------------------------------------*/
-/*-------------------------------------------------------------------------------*/
-
-
-/*-------------------------------------------------------------------------------*/
-void xtaMarkInterfaceSubs(methodinfo *mCalled) {
-       classSetNode * Si;
-       
-       /* for every class that implements the interface of the method called */
-       for (Si = mCalled->class->impldBy; Si != NULL; Si = Si->nextClass) {
-               /* add all definitions of this method for this interface */
-               methodinfo *submeth;
-
-               submeth = class_findmethod(Si->classType, mCalled->name, mCalled->descriptor); 
-               if (submeth == NULL) ; /* search up the heir - ignore for now!!! */
-               else    {
-                       classSetNode *subtypesUsedSet = NULL;
-                                       
-                       if (rt_method->xta->XTAclassSet != NULL)
-                               subtypesUsedSet = intersectSubtypesWithSet(submeth->class, rt_method->xta->XTAclassSet->head);
-                               
-                                               printf(" \nXTA subtypesUsedSet: "); fflush(stdout);
-                                               printSet(subtypesUsedSet);
-                       xtaMarkSubs(submeth->class, submeth, subtypesUsedSet);   
-                       }
-               }
-}
-
-/*-------------------------------------------------------------------------------*/
-bool xtaAddFldClassTypeInfo(fieldinfo *fi) {
-
-bool rc = false;
-
-if (fi->xta->fieldChecked) {
-       if (fi->xta->fldClassType != NULL)
-               return true;  /* field has a class type */
-       else
-               return false;
-       }
-fi->xta->fieldChecked = true;
-
-if (fi->type == TYPE_ADDRESS) {
-       char *utf_ptr = fi->descriptor->text;  /* current position in utf text */
-
-       if (*utf_ptr != 'L') {
-               while (*utf_ptr++ =='[') ;
-                       }
-
-       if (*utf_ptr =='L') {
-               rc = true;
-               if  (fi->xta->fldClassType== NULL) {
-                       char *desc;
-                       char *cname;
-                       classinfo * class;
-
-                       desc =       MNEW (char, 256);
-                       strcpy (desc,++utf_ptr);
-                       cname = strtok(desc,";");
-                                       if (XTAdebug >= 1) {
-                                               printf("STATIC field's type is: %s\n",cname);
-                                               fflush(stdout);
-                                               }
-                       class = class_get(utf_new_char(cname));
-                       fi->xta->fldClassType= class;    /* save field's type class ptr */      
-                       } 
-               }
-       }
-return rc;
-}
-
-/*-------------------------------------------------------------------------------*/
-void xtaPassFldPUT(fldSetNode *fN)
-{
-/* Field type is a class */
-classSetNode *c;
-classSetNode *c1 = NULL;
-classSetNode *cp = NULL;
-classSetNode *cprev= NULL;
-
-fieldinfo *fi;
-if (fN != NULL)
-       fi = fN->fldRef;
-else
-       return;
-
-/* Use lastptr  so don't check whole XTA class set each time */
-cp = fN->lastptrPUT;
-if (cp != NULL) {
-       if (cp->nextClass != NULL)
-               c1 = cp -> nextClass;
-       } 
-else   {
-       if (rt_method->xta->XTAclassSet != NULL)
-               c1  = rt_method->xta->XTAclassSet->head;
-
-                       if (XTAfld >=1 ) {
-                               printf("rt XTA class set =");fflush(stdout);
-                               printClassSet(rt_method->xta->XTAclassSet);
-                               printf("\t\tField class type = ");fflush(stdout);
-                               utf_display(fi->xta->fldClassType->name); printf("\n");
-                               }
-               }
-
-/*--- PUTSTATIC specific ---*/
-/* Sx = intersection of type+subtypes(field x)   */
-/*   and Sm (where putstatic code is)            */
-for (c=c1; c != NULL; c=c->nextClass) {
-       vftbl *f_cl_vt = fi->xta->fldClassType->vftbl;
-       vftbl *c_cl_vt =  c->   classType->vftbl;
-               if (XTAfld >=2 ) {
-                       printf("\tXTA class = ");fflush(stdout);
-                       utf_display(c->classType->name);
-                       printf("<b=%i> ",c_cl_vt->baseval); fflush(stdout);
-                       if (c->nextClass == NULL) {
-                               printf("next=NULL ");fflush(stdout);
-                               }
-                       else    {
-                               printf("next="); fflush(stdout);
-                               utf_display(c->nextClass->classType->name);
-                               printf("\n"); fflush(stdout);
-                               }
-
-                       printf("\t\tField class type = ");fflush(stdout);
-                       utf_display(fi->xta->fldClassType->name);
-                       printf("<b=%i/+d=%i> \n",f_cl_vt->baseval,(f_cl_vt->baseval+f_cl_vt->diffval)); fflush(stdout);
-                       }
-
-       if ((f_cl_vt->baseval <= c_cl_vt->baseval)
-       && (c_cl_vt->baseval <= (f_cl_vt->baseval+f_cl_vt->diffval)) ) {
-               fi->xta->XTAclassSet = add2ClassSet(fi->xta->XTAclassSet,c->classType);
-               }
-       cprev = c;
-       }
-fN->lastptrPUT = cprev;
-}
-/*-------------------------------------------------------------------------------*/
-void xtaPassFldGET(fldSetNode *fN)
-{
-/* Field type is a class */
-classSetNode *c;
-classSetNode *c1 = NULL;
-classSetNode *cp = NULL;
-classSetNode *cprev= NULL;
-
-fieldinfo *fi;
-if (fN != NULL)
-       fi = fN->fldRef;
-else
-       return;
-
-/* Use lastptr  so don't check whole XTA class set each time */
-cp = fN->lastptrGET;
-if (cp != NULL) {
-       if (cp->nextClass != NULL)
-               c1 = cp -> nextClass;
-       } 
-else   {
-       if (fi->xta->XTAclassSet != NULL)
-               c1  = fi->xta->XTAclassSet->head;
-
-                       if (XTAfld >=1 ) {
-                               printf("fld XTA class set =");fflush(stdout);
-                               printClassSet(fi->xta->XTAclassSet);
-                               printf("\t\tField class type = ");fflush(stdout);
-                               utf_display(fi->xta->fldClassType->name); printf("\n");
-                               }
-       }
 
-/*--- GETSTATIC specific ---*/
-/* Sm = union of Sm and Sx */
-for (c=c1; c != NULL; c=c->nextClass) {
-       bool addFlg = false;
-       if (rt_method->xta->XTAclassSet ==NULL) 
-               addFlg = true;
-       else    {
-               if (!(inSet (rt_method->xta->XTAclassSet->head, c->classType) )) 
-                       addFlg = true;
-               }
-       if (addFlg) {
-               rt_method->xta->XTAclassSet 
-                       = add2ClassSet(rt_method->xta->XTAclassSet,c->classType);
-               }
-       cprev = c;
-       }
+#ifndef _PARSERT_H
+#define _PARSERT_H
 
-fN->lastptrGET = cprev;
+#include "global.h"
 
-}
+extern bool XTAOPTbypass;
+extern bool XTAOPTbypass2;
+extern bool XTAOPTbypass3;
+extern int XTAdebug;
+extern int XTAfld;
 
-/*-------------------------------------------------------------------------------*/
-void xtaPassAllCalledByParams () {
-methSetNode *SmCalled;
-methSetNode *s1;
-               if (XTAdebug >= 1) {
-                       printf("xta->calledBy method set: "); fflush(stdout);
-                       printMethodSet(rt_method->xta->calledBy); fflush(stdout);
-                       }
-if (rt_method->xta->calledBy == NULL)
-       s1 = NULL;
-else
-       s1 = rt_method->xta->calledBy->head;
-for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
-               if (XTAdebug >= 1) {
-                       printf("SmCalled = "); fflush(stdout);
-                       utf_display(SmCalled->methRef->class->name); fflush(stdout);
-                       printf(".");fflush(stdout); method_display(SmCalled->methRef);
-                       }
-                               
-       rt_method->xta->chgdSinceLastParse = false;             
-       xtaPassParams(rt_method, SmCalled->methRef,SmCalled);   /* chg flag output ignored for 1st regular parse */
-       }
-}
-
-/*-------------------------------------------------------------------------------*/
-void xtaAllFldsUsed ( ){
-       fldSetNode  *f;
-       fldSetNode *f1=NULL; 
-/*     bool chgd = false */
-
-if (rt_method->xta->fldsUsed == NULL) return;
-
-/* for each field that this method uses */
-f1 = rt_method->xta->fldsUsed->head;
-
-for (f=f1; f != NULL; f = f->nextfldRef) {
-
-       if (f->writePUT)
-               xtaPassFldPUT(f);
-       if (f->readGET)
-               xtaPassFldGET(f);
-       }
-}
-/*-------------------------------------------------------------------------------*/
-void  xtaMethodCalls_and_sendReturnType() 
-{
-       methSetNode *SmCalled;  /* for return type       */
-       methSetNode *SmCalls;   /* for calls param types */
-       methSetNode *s1=NULL; 
-       bool chgd = false;
-               if (XTAdebug >= 1) {
-                       printf("calls method set Return type: ");
-                       printMethodSet(rt_method->xta->calls);
-                       printf("AAAAAAAAAAAAAAFTER printMethSett(rt_method->xta->calls)\n");fflush(stdout);
-                       }
-xtaAllFldsUsed ( );
-
-/* for each method that this method calls */
-if (rt_method->xta->calls == NULL)
-       s1 = NULL;
-else
-       s1 = SmCalls=rt_method->xta->calls->head;
-
-for (SmCalls=s1; SmCalls != NULL; SmCalls = SmCalls->nextmethRef) {
-       /*    pass param types  */
-       bool chgd = false;
-       chgd = xtaPassParams (SmCalls->methRef, rt_method, SmCalls);  
-       /* if true chgd after its own parse */
-       if (!(SmCalls->methRef->xta->chgdSinceLastParse)) {
-               SmCalls->methRef->xta->chgdSinceLastParse = true;
-               }
-       }
-
-/* for each calledBy method */
-/*    send return type */
-if (rt_method->xta->calledBy == NULL)
-       s1 = NULL;
-else
-       s1 = rt_method->xta->calledBy->head;
-for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
-
-               if (XTAdebug >= 1) {
-                       printf("\tSmCalled = ");fflush(stdout); utf_display(SmCalled->methRef->class->name);
-                       printf("."); method_display(SmCalled->methRef);
-                       }
-                               
-       chgd = xtaPassReturnType(rt_method, SmCalled->methRef); 
-       if (!(SmCalled->methRef->xta->chgdSinceLastParse)) {
-               SmCalled->methRef->xta->chgdSinceLastParse = chgd;              
-               }
-       }
-}
-
-
-/*-------------------------------------------------------------------------------*/
-static void parseRT()
-{
-       int  p;                     /* java instruction counter                   */
-       int  nextp;                 /* start of next java instruction             */
-       int  opcode;                /* java opcode                                */
-       int  i;                     /* temporary for different uses (counters)    */
-        bool iswide = false;        /* true if last instruction was a wide        */
-
-               RTAPRINT01method
-
-       if ( ((XTAOPTbypass) || (opt_xta)) && (rt_method->name != utf_MAIN)) {
-
-               xtaPassAllCalledByParams (); 
-               }
-
-       /* scan all java instructions */
-
-       for (p = 0; p < rt_jcodelength; p = nextp) {
-               opcode = rt_code_get_u1 (p);           /* fetch op code                  */
-       RTAPRINT02opcode
-       fflush(stdout); 
-               nextp = p + jcommandsize[opcode];   /* compute next instruction start */
-   switch (opcode) {
-
-/*--------------------------------*/
-/* Code just to get the correct  next instruction */
-                       /* 21- 25 */
-                        case JAVA_ILOAD:
-                        case JAVA_LLOAD:
-                        case JAVA_FLOAD:
-                        case JAVA_DLOAD:
-
-                        case JAVA_ALOAD:
-                                if (iswide)
-                                  {
-                                  nextp = p+3;
-                                  iswide = false;
-                                  }
-                                break;
-
-                       /* 54 -58 */
-                       case JAVA_ISTORE:
-                        case JAVA_LSTORE:
-                        case JAVA_FSTORE:
-                        case JAVA_DSTORE:
-
-                        case JAVA_ASTORE:
-                                if (iswide)
-                                  {
-                                  iswide=false;
-                                  nextp = p+3;
-                                  }
-                               break;
-
-                       /* 132 */
-                       case JAVA_IINC:
-                                {
-                                if (iswide) {
-                                        iswide = false;
-                                        nextp = p+5;
-                                        }
-                                }
-                                break;
-
-                        /* wider index for loading, storing and incrementing */
-                       /* 196 */
-                        case JAVA_WIDE:
-                                iswide = true;
-                                nextp = p + 1;
-                                break;
-                       /* 169 */
-                       case JAVA_RET:
-                                if (iswide) {
-                                        nextp = p+3;
-                                        iswide = false;
-                                        }
-                                break;
-
-   /* table jumps ********************************/
-
-                        case JAVA_LOOKUPSWITCH:
-                                {
-                               s4 num;
-                               nextp = ALIGN((p + 1), 4);
-                                num = rt_code_get_u4(nextp + 4);
-                                nextp = nextp + 8 + 8 * num;
-                                break;
-                                }
-
-
-                       case JAVA_TABLESWITCH:
-                                {
-                               s4 num;
-                               nextp = ALIGN ((p + 1),4);
-                                num = rt_code_get_s4(nextp + 4);
-                                num = rt_code_get_s4(nextp + 8) - num;
-                                nextp = nextp + 16 + 4 * num;
-                                break;
-                                }
-
-/*-------------------------------*/
-                        case JAVA_PUTSTATIC:
-                                i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *fr;
-                                fieldinfo *fi;
-
-                                fr = class_getconstant (rt_class, i, CONSTANT_Fieldref);
-                                                                          /* descr has type of field ref'd  */
-                                fi = class_findfield (fr->class,fr->name, fr->descriptor);
-                                        RTAPRINT03putstatic1
-
-                               /*--- RTA ---*/
-                                /* class with field - marked in addClassinit */
-                                addClassInit(fr->class);
-
-                               /*--- XTA ---*/
-                               if   ((XTAOPTbypass) || (opt_xta))
-                               {
-                               if (fi->xta == NULL)
-                                       fi->xta = xtafldinfoInit(fi);
-                               if (xtaAddFldClassTypeInfo(fi)) {  
-                                       rt_method->xta->fldsUsed = add2FldSet(rt_method->xta->fldsUsed, fi, true,false);
-                                       }
-                               }
-                               }
-                                break;
-
-                        case JAVA_GETSTATIC:
-                                i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *fr;
-                                fieldinfo *fi;
-
-                                fr = class_getconstant (rt_class, i, CONSTANT_Fieldref);
-                                                                          /* descr has type of field ref'd  */
-                                fi = class_findfield (fr->class,fr->name, fr->descriptor);
-                                       RTAPRINT03putstatic1
-
-                               /*--- RTA ---*/
-                                /* class with field - marked in addClassinit */
-                                addClassInit(fr->class);
-
-                               /*--- XTA ---*/
-                               if  ((XTAOPTbypass) || (opt_xta) ) 
-                               {
-                               if (fi->xta == NULL)
-                                       fi->xta = xtafldinfoInit(fi);
-                               if (xtaAddFldClassTypeInfo(fi)) {
-                                       rt_method->xta->fldsUsed = add2FldSet(rt_method->xta->fldsUsed, fi, false, true);
-                                       }
-                               }
-
-                                }
-                                break;
-
-
-                        /*--------------------  method invocation ---------------------*/
-
-                        case JAVA_INVOKESTATIC:
-                                i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *mr;
-                                methodinfo *mi;
-
-                                mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-                               /*-- RTA --*/
-                                       RTAPRINT04invokestatic1
-                                if (mi->class->classUsed == NOTUSED) {
-                                    mi->class->classUsed = USED;
-                                       RTAPRINT05invokestatic2
-                                    }
-                               addClassInit(mi->class);
-       
-                               ADDTOCALLGRAPH(mi)  
-fflush(stdout);
-                               /*-- XTA --*/
-                               if ((XTAOPTbypass) || (opt_xta)) {
-                               xtaAddCallEdges(mi,MONO); 
-                               } /* end XTA */
-                                }
-                                break;
-
-                        case JAVA_INVOKESPECIAL:
-                                       i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *mr;
-                                methodinfo *mi;
-                               classinfo  *ci;
-                               
-                                       mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-                               ci = mi->class;
-                                                               RTAPRINT06invoke_spec_virt1
-                               /*--- PRIVATE Method -----------------------------------------------------*/ 
-                                       if (mi->name        != INIT) {     /* if method called is PRIVATE */ 
-                                                               RTAPRINT07invoke_spec_virt2
-                                                               RTAPRINT04invokestatic1
-                                       /*-- RTA --*/   /* was just markSubs(mi); */
-                                       ADDTOCALLGRAPH(mi)  
-
-                                       /*--- XTA ---*/
-                                       if ((XTAOPTbypass) || (opt_xta)) {
-                                       xtaAddCallEdges(mi,MONO);
-                                       } /* end XTA */
-                                       }
-
-                               else    {
-                               /*--- Test for super <init> which is: <init> calling its super class <init> -*/
-
-                                       /* new class so add marked methods */
-                                       if (( mi->methodUsed != USED) || (mi->class->classUsed == PARTUSED))  {
-                               /*--- process NORMAL <init> method ---------------------------------------------*/
-                                               if ( mi->methodUsed != USED) {
-                                                       /* Normal <init> 
-                                                               - mark class as USED and <init> to callgraph */
-                               
-                                                       /*-- RTA --*/
-                                                       ci->classUsed = USED;
-                                                       addMarkedMethods(ci);    /* add to callgraph marked methods */
-                                                                       RTAPRINT06Binvoke_spec_init
-                                                       addUsedInterfaceMethods(ci); 
-                                                       ADDTOCALLGRAPH(mi)  
-
-                                                       /*-- XTA --*/
-                                                       if ((XTAOPTbypass) || (opt_xta)) { 
-                                                       rt_method->xta->XTAclassSet = add2ClassSet(rt_method->xta->XTAclassSet,ci ); 
-                                                       xtaAddCallEdges(mi,MONO);
-                                                                               RTAPRINT06CXTAinvoke_spec_init1
-                                                       } /* end XTA */
-                                                       }
-                                               }
-                                       }
-
-                               }                                                
-                                break;
-
-
-                        case JAVA_INVOKEVIRTUAL:
-                               i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *mr;
-                                methodinfo *mi;
-                               
-                               mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                               mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-
-                               /*--- RTA ---*/
-                                               RTAPRINT07invoke_spec_virt2
-                               mi->monoPoly = POLY;
-                               rtaMarkSubs(mi->class,mi); 
-
-                               /*--- XTA ---*/
-                               if ((XTAOPTbypass) || (opt_xta)) { 
-                               classSetNode *subtypesUsedSet = NULL;
-                               if (rt_method->xta->XTAclassSet != NULL)
-                                       subtypesUsedSet = intersectSubtypesWithSet(mi->class, rt_method->xta->XTAclassSet->head);
-                                               /*****  
-                                               printf(" \nXTA subtypesUsedSet: "); fflush(stdout);
-                                               printSet(subtypesUsedSet);
-                                               *****/
-                               xtaMarkSubs(mi->class, mi, subtypesUsedSet);   
-                               } /* end XTA */
-                               }
-                                break;
-
-                        case JAVA_INVOKEINTERFACE:
-                                i = rt_code_get_u2(p + 1);
-                                {
-                                constant_FMIref *mr;
-                                methodinfo *mi;
-                               classSetNode *subs;
-                               
-                                mr = class_getconstant (rt_class, i, CONSTANT_InterfaceMethodref);
-                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-
-                                if (mi->flags & ACC_STATIC)
-                                        panic ("Static/Nonstatic mismatch calling static method");
-
-                               /*--- RTA ---*/
-                                               RTAPRINT08AinvokeInterface0
-                               if (mi->class->classUsed == NOTUSED) {
-                                       mi->class->classUsed = USED; /*??PARTUSED;*/
-                                       class_java_lang_Object->impldBy =  addElement(class_java_lang_Object -> impldBy,  mi->class);
-                                       }
-
-                               /* add interface class to list kept in Object */
-                               mi->methodUsed = USED;
-                               mi->monoPoly   = POLY;
-
-                               subs =  mi->class->impldBy; 
-                                                                       RTAPRINT08invokeInterface1
-                               while (subs != NULL) { 
-                                       classinfo * isubs = subs->classType;
-                                                                       RTAPRINT09invokeInterface2
-                                       /* Mark method (mark/used) in classes that implement the method */
-                                       if (isubs->classUsed != NOTUSED) {
-                                               methodinfo *submeth;
-                                               
-                                               submeth = class_findmethod(isubs,mi->name, mi->descriptor); 
-                                               if (submeth != NULL)
-                                                       submeth->monoPoly = POLY; /*  poly even if nosubs */
-                                               rtaMarkSubs(isubs, mi);  
-                                               }
-                                       subs = subs->nextClass;
-                                       }
-
-                               /*--- XTA ---*/
-                               if ((XTAOPTbypass2) || (opt_xta))
-                               {
-                               xtaMarkInterfaceSubs(mi);
-                               }
-                                }
-                                break;
-
-                       /* miscellaneous object operations *******/
-
-                        case JAVA_NEW:
-                                i = rt_code_get_u2 (p+1);
-                                {
-                                classinfo *ci;
-
-                                ci = class_getconstant (rt_class, i, CONSTANT_Class); 
-if (pWhenMarked >= 1) {
-       printf("\tclass=");fflush(stdout);
-       utf_display(ci->name); fflush(stdout);
-       printf("=\n");fflush(stdout);
-       }
-                               /*--- RTA ---*/
-                               if (ci->classUsed != USED) {
-                                               RTAPRINT10new
-                                        ci->classUsed = USED;    /* add to heirarchy    */
-                                       /* Add this class to the implemented by list of the abstract interface */
-                                       addUsedInterfaceMethods(ci);
-                                       addClassInit(ci);
-                                       } 
-                               /*--- XTA ---*/
-                               if ((XTAOPTbypass) || (opt_xta))
-                               {
-                               rt_method->xta->XTAclassSet = add2ClassSet(rt_method->xta->XTAclassSet,ci ); /*XTA*/
-                                               RTAPRINT10newXTA
-                               }
-                                }
-                                break;
-
-                        default:
-                                break;
-
-                        } /* end switch */
-
-
-               } /* end for */
-
-       if (p != rt_jcodelength)
-               panic("Command-sequence crosses code-boundary");
-
-if ((XTAOPTbypass) || (opt_xta))
-       xtaMethodCalls_and_sendReturnType();
-
-
-}
-
-/*-------------------------------------------------------------------------------*/
-/* RTA add Native Methods/ Class functions  */
-/*-------------------------------------------------------------------------------*/
-void   findMarkNativeUsedMeth (utf * c1, utf* m1, utf* d1) {
-
-classinfo  *class;
-methodinfo *meth;
-
-class = class_get(c1);
-if (class == NULL)  {
-       return;    /*Note: Since NativeCalls is for mult programs some may not be loaded - that's ok */
-       }
-
-if (class->classUsed == NOTUSED) {
-       class->classUsed = USED; /* MARK CLASS USED */
-       /* add marked methods to callgraph */ 
-       addMarkedMethods(class);
-       }
-
-meth = class_findmethod (class, m1, d1);
-if (meth == NULL) {
-       utf_display(class->name);printf(".");utf_display(m1);printf(" ");utf_display(d1);
-       printf("WARNING from parseRT:  Method given is used by Native method call, but NOT FOUND\n");
-       }
-else
-       rtaMarkSubs(class,meth);
-}
-
-/*-------------------------------------------------------------------------------*/
-
-void   findMarkNativeUsedClass (utf * c) {
-classinfo  *class;
-
-class = class_get(c);
-if (class == NULL)  panic("parseRT: Class used by Native method called not loaded!!!");
-class->classUsed = USED;
-
-/* add marked methods to callgraph */
-addMarkedMethods(class);
-}
-
-
-/*-------------------------------------------------------------------------------*/
-
-void markNativeMethodsRT(utf *rt_class, utf* rt_method, utf* rt_descriptor) {
-int i,j,k;
-bool found = false;
-
-nativecallcompdone = natcall2utf(nativecallcompdone); 
-
-for (i=0; i<NATIVECALLSSIZE; i++) {
-  if (rt_class  == nativeCompCalls[i].classname) {
-       
-    /* find native class.method invoked */
-    for (j=0; (!(found) && (j<nativeCompCalls[i].methCnt)); j++) {
-
-      if ( (rt_method     == nativeCompCalls[i].methods[j].methodname)
-        && (rt_descriptor == nativeCompCalls[i].methods[j].descriptor)) {
-
-        found=true;
-
-        /* mark methods and classes used by this native class.method */
-        for (k=0; k < nativeCompCalls[i].callCnt[j]; k++) {
-          if (nativeCompCalls[i].methods[j].methodCalls[k].methodname != NULL) {
-            /* mark method used */
-            findMarkNativeUsedMeth(
-                       nativeCompCalls[i].methods[j].methodCalls[k].classname,
-                       nativeCompCalls[i].methods[j].methodCalls[k].methodname,
-                       nativeCompCalls[i].methods[j].methodCalls[k].descriptor); 
-
-               /*RTprint 
-                       printf("\nmark method used: "); fflush(stdout);
-                       utf_display(nativeCompCalls[i].methods[j].methodCalls[k].classname); printf(".");fflush(stdout);
-                       utf_display(nativeCompCalls[i].methods[j].methodCalls[k].methodname); printf("=="); fflush(stdout);
-                       utf_display(nativeCompCalls[i].methods[j].methodCalls[k].descriptor); printf("==\n"); fflush(stdout);
-               */
-            }
-          else {
-            /* mark class used */
-            findMarkNativeUsedClass( nativeCompCalls[i].methods[j].methodCalls[k].classname);
-            } /* if-else k  */ 
-
-          }  /* for k */ 
-
-        }  /* if j */
-      }  /* for j */
-
-    }  /* if i */  
-  }  /* for i */
-
-}
-
-
-/*-------------------------------------------------------------------------------*/
-/*-------------------------------------------------------------------------------*/
-void mainRTAparseInit (methodinfo *m )
-{
-/*printf("MAIN_NOT_STARTED \n");*/ 
-if (class_java_lang_Object->sub != NULL) { 
-       RTAPRINT16stats1
-       }
-
-if (firstCall) {
-       firstCall=false;
-
-       utf_MAIN  = utf_new_char("main");
-       INIT      = utf_new_char("<init>");
-       CLINIT    = utf_new_char("<clinit>");
-       FINALIZE  = utf_new_char("finalize");
-       EMPTY_DESC= utf_new_char("()V");
-
-       if ( (rtMissed = fopen("rtMissed", "w")) == NULL) {
-               printf("CACAO - rtMissed file: can't open file to write\n");
-                }
-       else {
-               fprintf(rtMissed,"To Help User create a dymLoad file \n");
-               fprintf(rtMissed,
-                 "Not parsed in the static analysis parse of Main: #rt parse / #missed class.method (descriptor) \n");
-               fprintf(rtMissed,"\n\tBEFORE MAIN RT PARSE\n");
-               fflush(rtMissed);
-               fclose(rtMissed);
-               }
-       callgraph = MNEW (methodinfo*, MAXCALLGRAPH);   /****/
-       if ((XTAOPTbypass) || (opt_xta)) {
-               printf("XTAXTA  CALLGRAPHS allocated\n");
-               XTAcallgraph = MNEW (methodinfo*, MAXCALLGRAPH);
-               }
-       }
-
-if (m->name == utf_MAIN) {
-       rtMissed = fopen("rtMissed","a");
-       fprintf(rtMissed,"\n\n\tAFTER MAIN RT PARSE\n");
-       fclose(rtMissed);
-       AfterMain = true;
-       }
-else {  
-       if ( (rtMissed = fopen("rtMissed", "a")) == NULL) {
-               printf("CACAO - rtMissed file: can't open file to write\n");
-               }
-       else {
-               fprintf(rtMissed,"#%i/#%i ",methRTlast+1,missedCnt++ );
-               utf_fprint(rtMissed,m->class->name);
-               fprintf(rtMissed," ");
-               fprintflags(rtMissed,m->flags);
-               fprintf(rtMissed," ");
-               utf_fprint(rtMissed,m->name);
-               fprintf(rtMissed," ");
-               utf_fprint(rtMissed,m->descriptor);
-               fprintf(rtMissed,"\n");
-               fflush(rtMissed);
-               fclose(rtMissed);
-               }
-       if (AfterMain) {
-               printf("#%i : ",methRT);
-               printf("Method missed by static analysis Main parse. See rtMissed file");
-       /***    panic ("Method missed by static analysis Main parse. See rtMissed file");**/
-               }
-       }
-
-       /* At moment start RTA before main when parsed                      */
-       /* Will definitely use flag with to know if ok to apply in-lining.  */
-}
-
-
-/*-------------------------------------------------------------------------------*/
-/*-------------------------------------------------------------------------------*/
-/* still need to look at field sets in 2nd pass and clinit .....  */
-void XTA_jit_parse2(methodinfo *m)
-{
-                       if (XTAdebug >= 1) 
-                               printf("\n\nStarting Round 2 XTA !!!!!!!!!!!!!!\n");
-
-/* for each method in XTA worklist = callgraph (use RTA for now) */
-methRT=0;
-while (methRT <= methRTlast) {
-       rt_method      = callgraph[methRT];
-       rt_class       = rt_method->class;
-       rt_descriptor  = rt_method->descriptor;
-       rt_jcodelength = rt_method->jcodelength;
-       rt_jcode       = rt_method->jcode;
-
-       if (! (  (rt_method->flags & ACC_NATIVE  )
-           ||   (rt_method->flags & ACC_ABSTRACT) ) ) {
-if (XTAdebug >= 1) {
-       printf("\n!!!!! XTA Round 2 Parse of #%i:",methRT);fflush(stdout);
-       utf_display(rt_class->name); printf("."); fflush(stdout);
-       method_display(rt_method);
-       }
-               /*   if XTA type set changed since last parse */
-               if (rt_method->xta->chgdSinceLastParse) {
-
-                       /*     get types from methods it is calledBy */
-                       xtaPassAllCalledByParams ();
-
-                       /* Pass parameter types to methods it calls and  send the return type those called by  */
-                       xtaMethodCalls_and_sendReturnType();
-                       }
-               }
-       methRT++;
-       }
-               if (XTAdebug >= 1) {
-
-                               printf("\n\nEND_OF Round 2 XTA !!!!!!!!!!!!!!\n");
-                               printXTACallgraph ();
-                               }
-       
-                               RTAPRINT14CallgraphLast  /*was >=2 */
-                               RTAPRINT15HeirarchyiLast /*was >= 2 */
-}
-
-
-/*-------------------------------------------------------------------------------*/
-
-void RT_jit_parse(methodinfo *m)
-{
-       /*-- RTA --*/
-       if (m->methodUsed == USED) return;
-       mainRTAparseInit (m);
-               
-       /* initialise parameter type descriptor */
-        callgraph[++methRTlast] = m;          /*-- RTA --*/
-       m->methodUsed = USED;
-                       RTAPRINT11addedtoCallgraph 
-       /* <init> then like a new class so add marked methods to callgraph */
-       if (m->name == INIT)  {  /* need for <init>s parsed efore Main */
-         classinfo *ci;
-               ci = m->class;
-               ci->classUsed = USED;
-               if (pWhenMarked >= 1) {
-                       printf("Class=");utf_display(ci->name);
-                       }
-               /* add marked methods to callgraph */
-                       RTAPRINT11addedtoCallgraph2
-               addMarkedMethods(ci);
-         } /* if */
-
-       /*-- XTA --*/
-       if ((XTAOPTbypass) || (opt_xta)) {
-                XTAcallgraph[++methXTAlast] = m;
-               if (m->xta == NULL) {
-                       m->xta = xtainfoInit(m);
-                       }
-                m->xta->XTAmethodUsed = USED;
-                       {methodinfo *mi = m;
-                       XTAPRINTcallgraph2
-                       }
-       }
-
-       /*-- Call graph work list loop -----------------*/
-
-        while (methRT <= methRTlast) {
-            rt_method      = callgraph[methRT];
-           rt_class       = rt_method->class;
-           rt_descriptor  = rt_method->descriptor;
-           rt_jcodelength = rt_method->jcodelength;
-           rt_jcode       = rt_method->jcode;
-
-            if (! (  (rt_method->flags & ACC_NATIVE  )
-               ||   (rt_method->flags & ACC_ABSTRACT) ) ) {
-             parseRT();
-               }
-           else {
-                                               RTAPRINT12bAbstractNative
-               if (rt_method->flags & ACC_NATIVE ) {
-                                               RTAPRINT12aNative
-                 /* mark used and add to callgraph methods and classes used by NATIVE method */
-                 markNativeMethodsRT(rt_class->name,rt_method->name,rt_descriptor);              
-                 }
-               if (rt_method->flags & ACC_ABSTRACT) {
-                 panic("ABSTRACT_SHOULD not ever get into the callgraph!!!!!****!!!****!!!!****!!!!\n"); 
-                 }
-               }
-             methRT++;
-                       RTAPRINT12Callgraph 
-                       RTAPRINT13Heirarchy 
-        } /* while */
-
-
-       if (m->class->classUsed == NOTUSED)
-               m->class->classUsed = USED; /* say Main's class has a method used ??*/ 
-                       printXTACallgraph ();
-                       RTAPRINT14CallgraphLast  /*  was >=2*/
-                       //RTAPRINT15HeirarchyiLast /*was >= 2 */
-
-       if ((XTAOPTbypass) || (opt_xta)) {
-               /*--- XTA round 2+ "parse" - use info structures only so not a real parse */
-               XTA_jit_parse2(m);
-               }
-/**** DO NOT free if RTA or XTA for now
-if (m->name == utf_MAIN) {
-       MFREE(callgraph,methodinfo*,MAXCALLGRAPH);
-       if ((XTAOPTbypass) || (opt_xta)) {
-               printf("XTAXTA  CALLGRAPHS returned \n");
-               MFREE(XTAcallgraph,methodinfo*,MAXCALLGRAPH);
-               }
-       }
-****/
-
-return;
-}
+extern int methRT;
+extern int methRTlast;
+extern int methRTmax;
+extern methodinfo **callgraph;
+extern int methXTA;
+extern int methXTAlast;
+extern int methXTAmax;
+extern methodinfo **XTAcallgraph;
+
+#endif /* _PARSERT_H */
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b9d5c90beccc2437f51e52d1d9ddf879edfc7cc1..4d473cb435fa39ba8a8932804ca077bfc5760d4f 100644 (file)
@@ -7,6 +7,8 @@
  */
 
 
+#include "parseRTstats.h"
+
 
 #define XTAPRINTcallgraph1  if(pWhenMarked>=1) \
         {printf("\n XTA Added to Call Graph #%i:",  \
diff --git a/src/vm/jit/inline/parseRTstats.c b/src/vm/jit/inline/parseRTstats.c
new file mode 100644 (file)
index 0000000..34124c4
--- /dev/null
@@ -0,0 +1,558 @@
+/* jit/parseRTstats.c -
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: parseRTstats.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "parseRT.h"
+#include "loader.h"
+#include "toolbox/loging.h"
+
+
+/*--- Statistics ----------------------------------------------------------*/
+
+int unRTclassHeirCnt=0;
+int unRTmethodCnt = 0;
+
+/*-----*/
+int RTclassHeirNotUsedCnt=0; 
+int RTclassHeirUsedCnt=0;    
+int RTclassHeirPartUsedCnt=0;
+int RTclassHeirSuperCnt=0;
+
+int RTmethodNotUsedCnt = 0;
+int RTmethodNotUsedCnt1= 0;
+int RTmethodNotUsedCnt2= 0;
+int RTmethodUsedCnt = 0;
+int RTmethodMarkedCnt= 0;
+
+/* What might be inlined of the Used Methods */
+int RTmethodFinal  = 0;
+int RTmethodStatic = 0;
+int RTmethodFinalStatic = 0;
+int RTmethodNoSubs = 0;
+
+int RTmethodMono; 
+int RTmethodPossiblePoly;
+int RTmethodPolyReallyMono;
+int RTmethodPoly;
+
+int RTmethodFinal100  = 0;
+int RTmethodStatic100 = 0;
+int RTmethodFinalStatic100 = 0;
+int RTmethodNoSubs100 = 0;
+
+#define MAXCODLEN 10
+
+int RTmethodNoSubsAbstract = 0;
+int RTmethod1Used  = 0;
+
+int RTmethodAbstract = 0;
+
+int subRedefsCnt =0;
+int subRedefsCntUsed =0;
+
+/*------------- RTAprint flags ------------------------------------------------------------------*/
+int pCallgraph  = 0;    /* 0 - dont print 1 - print at end from main                             */ 
+/* 2 - print at end of RT parse call                                     */
+/* 3- print after each method RT parse                                   */
+int pClassHeir  = 1;    /* 0 - dont print 1 - print at end from main                             */
+/* 2 - print at end of RT parse call  3-print after each method RT parse */
+int pClassHeirStatsOnly = 1;  /* usually 2 Print only the statistical summary info for class heirarchy     */
+
+int pOpcodes    = 0;    /* 0 - don't print 1- print in parse RT 2- print in parse                */
+/* 3 - print in both                                                     */
+int pWhenMarked = 0;    /* 0 - don't print 1 - print when added to callgraph + when native parsed*/
+/* 2 - print when marked+methods called                                  */
+/* 3 - print when class/method looked at                                 */
+int pStats = 0;         /* 0 - don't print; 1= analysis only; 2= whole unanalysed class heirarchy*/
+
+/*-----------------------------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------------------------------*/
+void printXTACallgraph ()
+{ 
+       int i;
+
+       if (XTAdebug >= 1) {
+               printf("----- XTA Callgraph Worklist:<%i>\n",methXTAlast);
+               for (i=0;i<=methXTAlast;i++) {
+                       printf("  (%i): ",i);
+                       utf_display(XTAcallgraph[i]->class->name);
+                       printf(":");
+                       method_display(XTAcallgraph[i]);
+               }
+
+               printf("\n\n");
+       }
+}
+
+/*-----------------------------------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------------------------------*/
+
+void printCallgraph ()
+{ int i;
+
+ printf("----- RTA Callgraph Worklist:<%i>\n",methRTlast);
+ for (i=0;i<=methRTlast;i++) {
+        printf("  (%i): ",i);
+        utf_display(callgraph[i]->class->name);
+        printf(":");
+        method_display(callgraph[i]);
+ }
+
+ printf("\n\n");
+}
+/*--------------------------------------------------------------*/
+void printObjectClassHeirarchy1() {
+       if (pStats >= 1) {
+        unRTclassHeirCnt=0;
+        unRTmethodCnt = 0;
+               printObjectClassHeirarchy(class_java_lang_Object);
+        printf("\n >>>>>>>>>>>>>>>>>>>>  END of unanalysed Class Heirarchy: #%i classes /  #%i methods\n\n",
+                          unRTclassHeirCnt,unRTmethodCnt);
+       }
+
+}
+/*--------------------------------------------------------------*/
+void printObjectClassHeirarchy(classinfo  *class) {
+  
+       classinfo  *subs;
+       methodinfo *meth;
+       int t,m,cnt;
+
+       if (class == NULL) {return;}
+       unRTclassHeirCnt++; unRTmethodCnt += class->methodscount;
+       if (pStats == 2) {
+               printf("\n");
+               /* Class Name */
+               for (t=0;t<class->index;t++) printf("\t"); 
+               if (class->flags & ACC_INTERFACE) printf("ABSTRACT ");
+
+               printf("Class: "); 
+               utf_display(class->name);    
+               printf(" <%i> (depth=%i) \n",class->classUsed,class->index);
+               /* Print methods used */
+               cnt=0; 
+               for (m=0; m < class->methodscount; m++) {
+            meth = &class->methods[m];
+                       if (cnt == 0) {
+                               for (t=0;t<class->index;t++) printf("\t");
+                               printf("aMethods used:\n");
+                       }
+                       for (t=0;t<class->index;t++) printf("\t");
+                       printf("\t");
+                       utf_display(meth->class->name); 
+                       printf(".");
+                       method_display(meth);
+                       cnt++;
+           }
+               if (cnt > 0) printf("> %i of %i methods\n",cnt, class->methodscount);
+    }
+
+    for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
+               printObjectClassHeirarchy(subs);
+       }
+
+}
+/*--------------------------------------------------------------*/
+/*--------------------------------------------------------------*/
+int subdefd(methodinfo *meth) {
+    classinfo *subs;
+    methodinfo *submeth;
+
+       /*printf("subdefd for:");utf_display(meth->class->name);printf(".");method_display(meth); fflush(stdout);*/
+
+    if (  (meth->flags & ACC_STATIC) && (meth->flags & ACC_FINAL ) )  
+       panic("Possible Poly call for FINAL or STATIC\n");
+
+    if ((meth->class->sub == NULL)  && (!(meth->flags & ACC_ABSTRACT )) ) { 
+               return 0;
+       }
+    if (meth->flags & ACC_ABSTRACT ) ; /*printf("AB\n"); fflush(stdout); */
+
+       /*printf("s exist for:");utf_display(meth->class->name);printf(".");method_display(meth);*/
+
+    for (subs = meth->class->sub;subs != NULL;subs = subs->nextsub) {
+               submeth = class_findmethod(subs, meth->name, meth->descriptor); 
+               if (submeth != NULL) {
+                       subRedefsCnt++;
+                       if (submeth->methodUsed == USED) {
+                               subRedefsCntUsed++;
+                               /*return 1;*/
+                       }
+                       else {
+                               if (subdefd(submeth) > 0)
+                                       ; /*return 1;*/
+                       }
+               }
+       }
+    if (subRedefsCntUsed > 0) return 1;
+    return 0;
+}
+/*--------------------------------------------------------------*/
+
+void printRTClassHeirarchy(classinfo  *class) {
+  
+       classinfo  *subs;
+       methodinfo *meth;
+       int m,cnt;
+
+       if (class == NULL) {return;}
+    /* Class Name */
+    if (class->classUsed == NOTUSED) {
+               RTclassHeirNotUsedCnt++;
+               RTmethodNotUsedCnt = RTmethodNotUsedCnt + class->methodscount;
+               RTmethodNotUsedCnt1 = RTmethodNotUsedCnt1 + class->methodscount;
+               for (m=0; m < class->methodscount; m++) {
+                       meth = &class->methods[m];
+                       if (meth->methodUsed == USED) {
+                               if (pClassHeirStatsOnly >= 2) {
+                                       printf("METHOD marked used in CLASS marked NOTUSED: "); 
+                                       utf_display(class->name);
+                                       printf(".");
+                                       method_display(meth);
+                                       printf("<%i>\n\t",meth->methodUsed);
+                                       fflush(stdout);
+                                       printf("\n\n\n\nMETHOD marked used in CLASS marked NOTUSED\n\n\n\n"); 
+                               }
+                       }
+               }
+       }
+
+    if (class->classUsed != NOTUSED) {
+        if (pClassHeirStatsOnly >= 2) {
+                       printf("\nClass: "); 
+                       utf_display(class->name);    
+                       printf(" <%i> (depth=%i) ",class->classUsed,class->index);
+
+                       printf("\tbase/diff =%3d/%3d\n",
+                                  class->vftbl->baseval,
+                                  class->vftbl->diffval);
+               }
+
+        if (class->classUsed == PARTUSED) {
+            if (pClassHeirStatsOnly >= 2) {
+                               printf("\tClass not instanciated - but  methods/fields resolved to this class' code (static,inits,fields,super)\n");
+                       }
+                       RTclassHeirPartUsedCnt++;
+           }   
+        else {
+                       if (pClassHeirStatsOnly >= 2) {
+                printf("\n");
+                       }
+                       RTclassHeirUsedCnt++;
+               }
+
+
+               /* Print methods used */
+               cnt=0;
+        for (m=0; m < class->methodscount; m++) {
+
+            meth = &class->methods[m];
+               
+                       if (meth->methodUsed == NOTUSED)        RTmethodNotUsedCnt2++; 
+                       if (meth->methodUsed == MARKED)   RTmethodMarkedCnt++;
+                       if (meth->methodUsed == USED) {
+                               RTmethodUsedCnt++;
+                               if (  (meth->flags & ACC_FINAL ) && (!(meth->flags & ACC_STATIC)) ) { 
+                                       RTmethodFinal++;
+                                       if (meth->jcodelength < MAXCODLEN)  RTmethodFinal100++;
+                               }
+
+                               if (  (meth->flags & ACC_STATIC) && (!(meth->flags & ACC_FINAL )) ) { 
+                                       RTmethodStatic++;
+                                       if (meth->jcodelength < MAXCODLEN)  RTmethodStatic100++;
+                               }
+
+                               if (  (meth->flags & ACC_STATIC) && (meth->flags & ACC_FINAL ) ) { 
+                                       RTmethodFinalStatic++;
+                                       if (meth->jcodelength < MAXCODLEN)  RTmethodFinalStatic100++;
+                               }
+
+                               if ((! ((meth->flags & ACC_FINAL ) && (meth->flags & ACC_STATIC)) ) 
+                                       && ((meth->class->sub == NULL)  && (!(meth->flags & ACC_ABSTRACT)) ))    {
+                                       RTmethodNoSubs++;
+                                       if (meth->jcodelength < MAXCODLEN)  RTmethodNoSubs100++;
+                               }
+
+                               if ((! ((meth->flags & ACC_FINAL ) && (meth->flags & ACC_STATIC)) ) 
+                                       && ((meth->class->sub == NULL)  &&   (meth->flags & ACC_ABSTRACT)  ))    RTmethodNoSubsAbstract++;
+
+                               if (meth->flags & ACC_ABSTRACT) RTmethodAbstract++;
+                                                       
+                               if (meth->monoPoly == MONO) RTmethodMono++;
+                               if (meth->monoPoly == POLY) {
+                                       RTmethodPossiblePoly++;
+                                       subRedefsCnt = 0;
+                                       subRedefsCntUsed = 0;
+                                       if (meth->flags & ACC_ABSTRACT ) {
+                                               if (pClassHeirStatsOnly >= 2) {
+                                                       printf("STATS: abstract_method=");
+                                                       utf_display(meth->class->name);printf(".");
+                                                       method_display(meth);
+                                               }
+                                       }
+                                       else    {
+                                               if (subdefd(meth) == 0) {
+                                                       meth->monoPoly = MONO1;
+                                                       RTmethodPolyReallyMono++;
+                                               }                       
+                                               else    {
+                                                       RTmethodPoly++;
+                                                       meth->subRedefs = subRedefsCnt;
+                                                       meth->subRedefsUsed = subRedefsCntUsed;
+                                               }
+                                       }
+                               }
+
+                               if (pClassHeirStatsOnly >= 2) {
+                                       if (cnt == 0) {
+                                               printf("bMethods used:\n");
+                                       }
+                                       cnt++;
+                                       printf("\t");
+                                       utf_display(meth->class->name); 
+                                       printf(".");
+                                       method_display(meth);
+                                       printf("\t\t");
+                                       if (meth->monoPoly != MONO) printf("\t\tRedefs used/total<%i/%i>\t", meth->subRedefsUsed, meth->subRedefs);
+                                       if ( (XTAOPTbypass3) || (opt_xta)) {
+                                               if (meth->xta->XTAclassSet == NULL)
+                                                       printf("class set never created\n");
+                                               else
+                                                       printSet(meth->xta->XTAclassSet->head);
+                                       }
+                               }
+                       }
+               }
+               if (pClassHeirStatsOnly >= 2) {
+                       if (cnt > 0) printf("> %i of %i methods used\n",cnt, class->methodscount);
+               }
+       }
+
+    for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
+               printRTClassHeirarchy(subs);
+       }
+}
+/*--------------------------------------------------------------*/
+void printRTInterfaceClasses() {
+       int mm;
+       classinfo *ci = class_java_lang_Object;
+       classSetNode *subs;
+
+       int RTmethodInterfaceClassImplementedCnt        = 0;
+       int RTmethodInterfaceClassUsedCnt               = 0;
+
+       int RTmethodInterfaceMethodTotalCnt             = 0;
+       int RTmethodInterfaceMethodNotUsedCnt   = 0;
+       int RTmethodInterfaceMethodUsedCnt              = 0;
+
+       int RTmethodClassesImpldByTotalCnt              = 0;
+
+       int RTmethodInterfaceMonoCnt                    = 0;
+       int RTmethodInterfacePolyReallyMonoCnt=0;  /* look at every method that implments and see if its poly or mono1*/
+
+       int RTmethodNoSubsAbstractCnt = 0;
+
+       for (subs = ci->impldBy; subs != NULL; subs = subs->nextClass) {
+        classinfo * ici = subs->classType;
+               classinfo * isubs = subs->classType;
+               classSetNode * inBy;
+               int impldBycnt;
+
+               if (isubs->sub == NULL) RTmethodNoSubsAbstractCnt++;
+               if (pClassHeir >= 2) {
+                       printf("Interface class: ");fflush(stdout);
+                       utf_display(ici->name); printf("\t#Methods=%i",ici->methodscount);
+               }
+               RTmethodInterfaceClassImplementedCnt++;
+               if (ici -> classUsed == USED)     {RTmethodInterfaceClassUsedCnt++;}
+               if (pClassHeir >= 2) {
+                       printf("\n\t\t\tImplemented by classes:\n");
+               }
+               impldBycnt = 0;
+               /* get the total impldBy classes Used */
+               for (inBy = ici->impldBy; inBy != NULL; inBy = inBy->nextClass) {
+                       impldBycnt++;
+                       RTmethodClassesImpldByTotalCnt++;
+                       if (pClassHeir >= 2) {
+                               printf("\t\t\t");utf_display(inBy->classType->name);
+                               printf("\n");
+                       }
+                       if (inBy->classType->classUsed == NOTUSED) 
+                               panic("printRTInterfaceClasses: class in the implemented list without being used!!!??");
+               }
+               if (pClassHeir >= 2) {
+                       printf("\t\t\tImpld by: %i\n",impldBycnt);
+               }
+               if (impldBycnt== 1) RTmethodInterfaceMonoCnt++;
+
+        /* if interface class is used */
+        if (ici -> classUsed != NOTUSED) {
+                       if (pClassHeir >= 2) {
+                       printf("    cMethods used:\n");
+                       }
+
+                       /* for each interface method implementation that has been used */
+                       for (mm=0; mm< ici->methodscount; mm++) {
+                               methodinfo *imi = &(ici->methods[mm]);
+                               RTmethodInterfaceMethodTotalCnt++;
+                               if  (imi->methodUsed != USED) {
+                                       RTmethodInterfaceMethodNotUsedCnt++;
+                               }
+                               if  (imi->methodUsed == USED) {
+                                       RTmethodInterfaceMethodUsedCnt++;
+                                       if (pClassHeirStatsOnly >= 2) {
+                                               printf("\t\t"); 
+                                               utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+                                       }
+                                       if (impldBycnt == 1) {
+                                               classinfo  *cii;
+                                               methodinfo *mii;
+
+                                               /* if only 1 implementing class then possibly really mono call */
+                                       inBy = ici->impldBy;
+                                               cii = inBy->classType;
+                                               
+                                               mii = class_findmethod(cii, imi->name, imi->descriptor); 
+                                               if (mii == NULL) {
+                                                       /* assume its resolved up the heirarchy and just 1 possiblity so MONO1 */
+                                                       imi->monoPoly = MONO1;
+                                                       RTmethodInterfacePolyReallyMonoCnt++;
+                                               }
+                                               else    {
+                                                       if (imi->monoPoly != POLY) 
+                                                               panic ("interface monopoly not POLY");
+
+                                                       if (mii->monoPoly != POLY) {
+                                                               imi->monoPoly = MONO1;
+                                                               RTmethodInterfacePolyReallyMonoCnt++;
+                                                       }
+                                                       else    {
+                                                               imi->monoPoly = POLY;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       if (pClassHeir >= 2) {
+                               printf("\n");
+                       }
+               }
+       }
+       if (pClassHeirStatsOnly >= 1) {
+               printf("\n\n  >>>>>>>>>>>>>>>>>>>>  Interface Statistics Summary: \n");
+               printf("Classes:  Total:   %i \tUSED:      %i \tIMPLD BY:   \t%i \tJUST 1 IMPLD BY:  %i \tNOSUB:     %i \n",
+                          RTmethodInterfaceClassImplementedCnt,
+                          RTmethodInterfaceClassUsedCnt,RTmethodClassesImpldByTotalCnt, RTmethodInterfaceMonoCnt,
+                          RTmethodNoSubsAbstractCnt);
+               printf("Methods:  Total:   %i \tNOTUSED:   %i  \tUSED:      \t%i \tPoly that resolves to Mono  %i \n",
+                          RTmethodInterfaceMethodTotalCnt,
+                          RTmethodInterfaceMethodNotUsedCnt,RTmethodInterfaceMethodUsedCnt, RTmethodInterfacePolyReallyMonoCnt);
+       }
+}
+/*--------------------------------------------------------------*/
+
+void printRThierarchyInfo(methodinfo *m) {
+
+       /*-- init for statistics --*/
+       RTclassHeirNotUsedCnt=0; 
+       RTclassHeirUsedCnt=0;    
+       RTclassHeirPartUsedCnt=0;   
+       RTclassHeirSuperCnt=0;   
+       RTmethodNotUsedCnt = 0; 
+       RTmethodNotUsedCnt1 = 0; 
+       RTmethodNotUsedCnt2 = 0;  
+       RTmethodUsedCnt = 0;   
+       RTmethodMarkedCnt= 0;  
+
+
+       /*-- --*/
+       if (pClassHeirStatsOnly >= 2) {
+               printf("\nRT Class Hierarchy for ");
+               printf("--- start of RT info --------------- after :\n");
+               if (m != NULL) {
+                       utf_display(m->class->name); 
+                       printf(".");
+                       method_display(m);
+                       printf("\n");
+               }
+    }
+       printRTClassHeirarchy(class_java_lang_Object);
+       if (pClassHeirStatsOnly >= 2) {
+               printf("--- end  of RT info ---------------\n");
+    }
+       if (pClassHeirStatsOnly >= 1) {
+
+               /*--  statistic results --*/
+               printRTInterfaceClasses();
+       
+               printf("\n  >>>>>>>>>>>>>>>>>>>>  Analysed Class Hierarchy Statistics:\n"); 
+               printf(" Used            \t%i \tclasses\t/ Used       \t%i methods \t of USED: %i%% \t  of ALL: %i%% \n",
+                          RTclassHeirUsedCnt,RTmethodUsedCnt,
+                          ((100*RTmethodUsedCnt)/(RTmethodUsedCnt + RTmethodNotUsedCnt2)) ,
+                          ((100*RTmethodUsedCnt)/ (RTmethodNotUsedCnt    + RTmethodUsedCnt    + RTmethodMarkedCnt)) );
+               printf(" Part Used       \t%i \tclasses\t/\n",RTclassHeirPartUsedCnt); 
+               printf(" Not Used        \t%i \tclasses\t/\n\n",RTclassHeirNotUsedCnt); 
+               printf("                 \t    \t       \t/ Just Marked \t%i methods\n\n",RTmethodMarkedCnt); 
+               printf(" In Not Used     \t    \tclasses\t/ Not Used    \t%i methods\n",RTmethodNotUsedCnt1); 
+               printf(" In Used         \t    \tclasses\t/ Not Used    \t%i methods\n",RTmethodNotUsedCnt2);
+               printf(" Total           \t%i \tclasses\t/ Total       \t%i methods\n\n",
+                          RTclassHeirNotUsedCnt + RTclassHeirUsedCnt + RTclassHeirPartUsedCnt,  
+                          RTmethodNotUsedCnt1 + RTmethodNotUsedCnt2    + RTmethodUsedCnt    + RTmethodMarkedCnt ); 
+
+               printf(" Mono vs. Polymorphic calls:\n");
+               printf(" Mono calls     \t%i   \tPoly that resolves to Mono \t%i \tPoly calls     \t%i\n\n",
+                          RTmethodMono, RTmethodPolyReallyMono, RTmethodPoly);
+
+               printf(" No Subs: Total=\t%i   \tAbstract No Subs=           \t%i \tAbstract methods used =\t%i\n",
+                          RTmethodNoSubs, RTmethodNoSubsAbstract, RTmethodAbstract);
+
+               printf(" Inlining possible:  \tFINALs %i \tSTATICs %i \t FINAL & STATIC %i \t Class has No Subs %i \n",
+                          RTmethodFinal, RTmethodStatic,RTmethodFinalStatic,  RTmethodNoSubs);
+               printf("    Code size < 100  \tFINALs %i \tSTATICs %i \t FINAL & STATIC %i \t Class has No Subs %i \n",
+                          RTmethodFinal100, RTmethodStatic100,RTmethodFinalStatic100,  RTmethodNoSubs100);
+       }
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 5d2fec633d1acaa1c0799e115b41b9212225871d..2a3167ce7b02e852590f9a643957593d360cfd0f 100644 (file)
+/* jit/parseRTstats.c -
 
-/*--- Statistics ----------------------------------------------------------*/
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-int unRTclassHeirCnt=0;
-int unRTmethodCnt = 0;
+   This file is part of CACAO.
 
-/*-----*/
-int RTclassHeirNotUsedCnt=0; 
-int RTclassHeirUsedCnt=0;    
-int RTclassHeirPartUsedCnt=0;
-int RTclassHeirSuperCnt=0;
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-int RTmethodNotUsedCnt = 0;
-int RTmethodNotUsedCnt1= 0;
-int RTmethodNotUsedCnt2= 0;
-int RTmethodUsedCnt = 0;
-int RTmethodMarkedCnt= 0;
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-/* What might be inlined of the Used Methods */
-int RTmethodFinal  = 0;
-int RTmethodStatic = 0;
-int RTmethodFinalStatic = 0;
-int RTmethodNoSubs = 0;
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-int RTmethodMono; 
-int RTmethodPossiblePoly;
-int RTmethodPolyReallyMono;
-int RTmethodPoly;
+   Contact: cacao@complang.tuwien.ac.at
 
-int RTmethodFinal100  = 0;
-int RTmethodStatic100 = 0;
-int RTmethodFinalStatic100 = 0;
-int RTmethodNoSubs100 = 0;
+   Authors: Carolyn Oates
 
-#define MAXCODLEN 10
+   $Id: parseRTstats.h 557 2003-11-02 22:51:59Z twisti $
 
-int RTmethodNoSubsAbstract = 0;
-int RTmethod1Used  = 0;
+*/
 
-int RTmethodAbstract = 0;
 
-int subRedefsCnt =0;
-int subRedefsCntUsed =0;
+#ifndef _PARSERTSTATS_H
+#define _PARSERTSTATS_H
 
-/*------------- RTAprint flags ------------------------------------------------------------------*/
-int pCallgraph  = 0;    /* 0 - dont print 1 - print at end from main                             */ 
-                        /* 2 - print at end of RT parse call                                     */
-                        /* 3- print after each method RT parse                                   */
-int pClassHeir  = 1;    /* 0 - dont print 1 - print at end from main                             */
-                        /* 2 - print at end of RT parse call  3-print after each method RT parse */
-int pClassHeirStatsOnly = 1;  /* usually 2 Print only the statistical summary info for class heirarchy     */
+extern int unRTclassHeirCnt;
+extern int unRTmethodCnt;
+extern int pWhenMarked;
 
-int pOpcodes    = 0;    /* 0 - don't print 1- print in parse RT 2- print in parse                */
-                        /* 3 - print in both                                                     */
-int pWhenMarked = 0;    /* 0 - don't print 1 - print when added to callgraph + when native parsed*/
-                        /* 2 - print when marked+methods called                                  */
-                        /* 3 - print when class/method looked at                                 */
-int pStats = 0;         /* 0 - don't print; 1= analysis only; 2= whole unanalysed class heirarchy*/
+#endif /* _PARSERTSTATS_H */
 
-/*-----------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------------*/
-void printXTACallgraph ()
-  { int i;
-if (XTAdebug >= 1) {
-printf("----- XTA Callgraph Worklist:<%i>\n",methXTAlast);
-  for (i=0;i<=methXTAlast;i++) {
-    printf("  (%i): ",i);
-    utf_display(XTAcallgraph[i]->class->name);
-    printf(":");
-    method_display(XTAcallgraph[i]);
-    }
-
-  printf("\n\n");
-  }
-  }
-
-/*-----------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------------*/
-
-void printCallgraph ()
-  { int i;
-
-printf("----- RTA Callgraph Worklist:<%i>\n",methRTlast);
-  for (i=0;i<=methRTlast;i++) {
-    printf("  (%i): ",i);
-    utf_display(callgraph[i]->class->name);
-    printf(":");
-    method_display(callgraph[i]);
-    }
-
-  printf("\n\n");
-  }
-/*--------------------------------------------------------------*/
-void printObjectClassHeirarchy1() {
-if (pStats >= 1) {
-        unRTclassHeirCnt=0;
-        unRTmethodCnt = 0;
-                printObjectClassHeirarchy(class_java_lang_Object);
-        printf("\n >>>>>>>>>>>>>>>>>>>>  END of unanalysed Class Heirarchy: #%i classes /  #%i methods\n\n",
-                unRTclassHeirCnt,unRTmethodCnt);
-        }
-
-}
-/*--------------------------------------------------------------*/
-void printObjectClassHeirarchy(classinfo  *class) {
-  
-classinfo  *subs;
-methodinfo *meth;
-int t,m,cnt;
-
-if (class == NULL) {return;}
-  unRTclassHeirCnt++; unRTmethodCnt += class->methodscount;
-  if (pStats == 2) {
-    printf("\n");
-    /* Class Name */
-    for (t=0;t<class->index;t++) printf("\t"); 
-    if (class->flags & ACC_INTERFACE) printf("ABSTRACT ");
-
-    printf("Class: "); 
-    utf_display(class->name);    
-    printf(" <%i> (depth=%i) \n",class->classUsed,class->index);
-    /* Print methods used */
-    cnt=0; 
-    for (m=0; m < class->methodscount; m++) {
-            meth = &class->methods[m];
-           if (cnt == 0) {
-             for (t=0;t<class->index;t++) printf("\t");
-                printf("aMethods used:\n");
-                }
-            for (t=0;t<class->index;t++) printf("\t");
-            printf("\t");
-            utf_display(meth->class->name); 
-            printf(".");
-            method_display(meth);
-            cnt++;
-           }
-    if (cnt > 0) printf("> %i of %i methods\n",cnt, class->methodscount);
-    }
-
-    for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
-       printObjectClassHeirarchy(subs);
-        }
-
-}
-/*--------------------------------------------------------------*/
-/*--------------------------------------------------------------*/
-int subdefd(methodinfo *meth) {
-    classinfo *subs;
-    methodinfo *submeth;
-
-/*printf("subdefd for:");utf_display(meth->class->name);printf(".");method_display(meth); fflush(stdout);*/
-
-    if (  (meth->flags & ACC_STATIC) && (meth->flags & ACC_FINAL ) )  
-       panic("Possible Poly call for FINAL or STATIC\n");
-
-    if ((meth->class->sub == NULL)  && (!(meth->flags & ACC_ABSTRACT )) ) { 
-       return 0;
-       }
-    if (meth->flags & ACC_ABSTRACT ) ; /*printf("AB\n"); fflush(stdout); */
-
-/*printf("s exist for:");utf_display(meth->class->name);printf(".");method_display(meth);*/
-
-    for (subs = meth->class->sub;subs != NULL;subs = subs->nextsub) {
-       submeth = class_findmethod(subs, meth->name, meth->descriptor); 
-       if (submeth != NULL) {
-               subRedefsCnt++;
-               if (submeth->methodUsed == USED) {
-                       subRedefsCntUsed++;
-                       /*return 1;*/
-                       }
-               else {
-                  if (subdefd(submeth) > 0)
-                       ; /*return 1;*/
-                  }
-               }
-       }
-    if (subRedefsCntUsed > 0) return 1;
-    return 0;
-}
-/*--------------------------------------------------------------*/
-
-void printRTClassHeirarchy(classinfo  *class) {
-  
-classinfo  *subs;
-methodinfo *meth;
-int m,cnt;
-
-if (class == NULL) {return;}
-    /* Class Name */
-    if (class->classUsed == NOTUSED) {
-       RTclassHeirNotUsedCnt++;
-       RTmethodNotUsedCnt = RTmethodNotUsedCnt + class->methodscount;
-       RTmethodNotUsedCnt1 = RTmethodNotUsedCnt1 + class->methodscount;
-       for (m=0; m < class->methodscount; m++) {
-         meth = &class->methods[m];
-         if (meth->methodUsed == USED) {
-           if (pClassHeirStatsOnly >= 2) {
-               printf("METHOD marked used in CLASS marked NOTUSED: "); 
-               utf_display(class->name);
-               printf(".");
-               method_display(meth);
-               printf("<%i>\n\t",meth->methodUsed);
-               fflush(stdout);
-               printf("\n\n\n\nMETHOD marked used in CLASS marked NOTUSED\n\n\n\n"); 
-               }
-            }
-         }
-       }
-
-    if (class->classUsed != NOTUSED) {
-        if (pClassHeirStatsOnly >= 2) {
-         printf("\nClass: "); 
-          utf_display(class->name);    
-         printf(" <%i> (depth=%i) ",class->classUsed,class->index);
-
-                 printf("\tbase/diff =%3d/%3d\n",
-                       class->vftbl->baseval,
-                       class->vftbl->diffval);
-         }
-
-        if (class->classUsed == PARTUSED) {
-            if (pClassHeirStatsOnly >= 2) {
-  printf("\tClass not instanciated - but  methods/fields resolved to this class' code (static,inits,fields,super)\n");
-             }
-           RTclassHeirPartUsedCnt++;
-           }   
-        else {
-              if (pClassHeirStatsOnly >= 2) {
-                printf("\n");
-               }
-             RTclassHeirUsedCnt++;
-              }
-
-
-       /* Print methods used */
-       cnt=0;
-        for (m=0; m < class->methodscount; m++) {
-
-            meth = &class->methods[m];
-               
-           if (meth->methodUsed == NOTUSED)    RTmethodNotUsedCnt2++; 
-           if (meth->methodUsed == MARKED)   RTmethodMarkedCnt++;
-           if (meth->methodUsed == USED) {
-               RTmethodUsedCnt++;
-               if (  (meth->flags & ACC_FINAL ) && (!(meth->flags & ACC_STATIC)) ) { 
-                       RTmethodFinal++;
-                       if (meth->jcodelength < MAXCODLEN)  RTmethodFinal100++;
-                       }
-
-               if (  (meth->flags & ACC_STATIC) && (!(meth->flags & ACC_FINAL )) ) { 
-                       RTmethodStatic++;
-                       if (meth->jcodelength < MAXCODLEN)  RTmethodStatic100++;
-                       }
-
-               if (  (meth->flags & ACC_STATIC) && (meth->flags & ACC_FINAL ) ) { 
-                       RTmethodFinalStatic++;
-                       if (meth->jcodelength < MAXCODLEN)  RTmethodFinalStatic100++;
-                       }
-
-               if ((! ((meth->flags & ACC_FINAL ) && (meth->flags & ACC_STATIC)) ) 
-                  && ((meth->class->sub == NULL)  && (!(meth->flags & ACC_ABSTRACT)) ))    {
-                       RTmethodNoSubs++;
-                       if (meth->jcodelength < MAXCODLEN)  RTmethodNoSubs100++;
-                       }
-
-               if ((! ((meth->flags & ACC_FINAL ) && (meth->flags & ACC_STATIC)) ) 
-                  && ((meth->class->sub == NULL)  &&   (meth->flags & ACC_ABSTRACT)  ))    RTmethodNoSubsAbstract++;
-
-               if (meth->flags & ACC_ABSTRACT) RTmethodAbstract++;
-                                                       
-               if (meth->monoPoly == MONO) RTmethodMono++;
-               if (meth->monoPoly == POLY) {
-                       RTmethodPossiblePoly++;
-                               subRedefsCnt = 0;
-                               subRedefsCntUsed = 0;
-                       if (meth->flags & ACC_ABSTRACT ) {
-                               if (pClassHeirStatsOnly >= 2) {
-                                       printf("STATS: abstract_method=");
-                                       utf_display(meth->class->name);printf(".");
-                                       method_display(meth);
-                                       }
-                               }
-                       else    {
-                               if (subdefd(meth) == 0) {
-                                       meth->monoPoly = MONO1;
-                                       RTmethodPolyReallyMono++;
-                                       }                       
-                               else    {
-                                       RTmethodPoly++;
-                                       meth->subRedefs = subRedefsCnt;
-                                       meth->subRedefsUsed = subRedefsCntUsed;
-                                       }
-                               }
-                       }
-
-               if (pClassHeirStatsOnly >= 2) {
-                 if (cnt == 0) {
-                    printf("bMethods used:\n");
-                    }
-                 cnt++;
-                 printf("\t");
-                 utf_display(meth->class->name); 
-                 printf(".");
-                 method_display(meth);
-                       printf("\t\t");
-                 if (meth->monoPoly != MONO) printf("\t\tRedefs used/total<%i/%i>\t", meth->subRedefsUsed, meth->subRedefs);
-                    if ( (XTAOPTbypass3) || (opt_xta)) {
-                       if (meth->xta->XTAclassSet == NULL)
-                               printf("class set never created\n");
-                       else
-                               printSet(meth->xta->XTAclassSet->head);
-                       }
-                 }
-              }
-            }
-         if (pClassHeirStatsOnly >= 2) {
-          if (cnt > 0) printf("> %i of %i methods used\n",cnt, class->methodscount);
-          }
-         }
-
-    for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
-       printRTClassHeirarchy(subs);
-        }
-}
-/*--------------------------------------------------------------*/
-void printRTInterfaceClasses() {
-  int mm;
-  classinfo *ci = class_java_lang_Object;
-  classSetNode *subs;
-
-  int RTmethodInterfaceClassImplementedCnt     = 0;
-  int RTmethodInterfaceClassUsedCnt            = 0;
-
-  int RTmethodInterfaceMethodTotalCnt          = 0;
-  int RTmethodInterfaceMethodNotUsedCnt        = 0;
-  int RTmethodInterfaceMethodUsedCnt           = 0;
-
-  int RTmethodClassesImpldByTotalCnt           = 0;
-
-  int RTmethodInterfaceMonoCnt                 = 0;
-  int RTmethodInterfacePolyReallyMonoCnt=0;  /* look at every method that implments and see if its poly or mono1*/
-
-  int RTmethodNoSubsAbstractCnt = 0;
-
-for (subs = ci->impldBy; subs != NULL; subs = subs->nextClass) {
-        classinfo * ici = subs->classType;
-       classinfo * isubs = subs->classType;
-       classSetNode * inBy;
-       int impldBycnt;
-
-       if (isubs->sub == NULL) RTmethodNoSubsAbstractCnt++;
-       if (pClassHeir >= 2) {
-               printf("Interface class: ");fflush(stdout);
-                       utf_display(ici->name); printf("\t#Methods=%i",ici->methodscount);
-               }
-       RTmethodInterfaceClassImplementedCnt++;
-       if (ici -> classUsed == USED)     {RTmethodInterfaceClassUsedCnt++;}
-       if (pClassHeir >= 2) {
-               printf("\n\t\t\tImplemented by classes:\n");
-               }
-       impldBycnt = 0;
-       /* get the total impldBy classes Used */
-       for (inBy = ici->impldBy; inBy != NULL; inBy = inBy->nextClass) {
-               impldBycnt++;
-               RTmethodClassesImpldByTotalCnt++;
-               if (pClassHeir >= 2) {
-                       printf("\t\t\t");utf_display(inBy->classType->name);
-                       printf("\n");
-                       }
-               if (inBy->classType->classUsed == NOTUSED) 
-                       panic("printRTInterfaceClasses: class in the implemented list without being used!!!??");
-               }
-       if (pClassHeir >= 2) {
-               printf("\t\t\tImpld by: %i\n",impldBycnt);
-               }
-       if (impldBycnt== 1) RTmethodInterfaceMonoCnt++;
-
-        /* if interface class is used */
-        if (ici -> classUsed != NOTUSED) {
-               if (pClassHeir >= 2) {
-                       printf("    cMethods used:\n");
-                       }
-
-                /* for each interface method implementation that has been used */
-                for (mm=0; mm< ici->methodscount; mm++) {
-                        methodinfo *imi = &(ici->methods[mm]);
-                       RTmethodInterfaceMethodTotalCnt++;
-                       if  (imi->methodUsed != USED) {
-                               RTmethodInterfaceMethodNotUsedCnt++;
-                               }
-                        if  (imi->methodUsed == USED) {
-                       RTmethodInterfaceMethodUsedCnt++;
-                               if (pClassHeirStatsOnly >= 2) {
-                                       printf("\t\t"); 
-                                       utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
-                                       }
-                               if (impldBycnt == 1) {
-                                       classinfo  *cii;
-                                       methodinfo *mii;
-
-                                       /* if only 1 implementing class then possibly really mono call */
-                                       inBy = ici->impldBy;
-                                       cii = inBy->classType;
-                                               
-                                       mii = class_findmethod(cii, imi->name, imi->descriptor); 
-                                       if (mii == NULL) {
-                                               /* assume its resolved up the heirarchy and just 1 possiblity so MONO1 */
-                                               imi->monoPoly = MONO1;
-                                               RTmethodInterfacePolyReallyMonoCnt++;
-                                               }
-                                       else    {
-                                               if (imi->monoPoly != POLY) 
-                                                       panic ("interface monopoly not POLY");
-
-                                               if (mii->monoPoly != POLY) {
-                                                       imi->monoPoly = MONO1;
-                                                       RTmethodInterfacePolyReallyMonoCnt++;
-                                                       }
-                                               else    {
-                                                       imi->monoPoly = POLY;
-                                                       }
-                                               }
-                                       }
-                                }
-                        }
-               if (pClassHeir >= 2) {
-                       printf("\n");
-                       }
-                }
-        }
-if (pClassHeirStatsOnly >= 1) {
-       printf("\n\n  >>>>>>>>>>>>>>>>>>>>  Interface Statistics Summary: \n");
-       printf("Classes:  Total:   %i \tUSED:      %i \tIMPLD BY:   \t%i \tJUST 1 IMPLD BY:  %i \tNOSUB:     %i \n",
-               RTmethodInterfaceClassImplementedCnt,
-               RTmethodInterfaceClassUsedCnt,RTmethodClassesImpldByTotalCnt, RTmethodInterfaceMonoCnt,
-               RTmethodNoSubsAbstractCnt);
-       printf("Methods:  Total:   %i \tNOTUSED:   %i  \tUSED:      \t%i \tPoly that resolves to Mono  %i \n",
-               RTmethodInterfaceMethodTotalCnt,
-               RTmethodInterfaceMethodNotUsedCnt,RTmethodInterfaceMethodUsedCnt, RTmethodInterfacePolyReallyMonoCnt);
-       }
-}
-/*--------------------------------------------------------------*/
-
-void printRThierarchyInfo(methodinfo *m) {
-
-  /*-- init for statistics --*/
-  RTclassHeirNotUsedCnt=0; 
-  RTclassHeirUsedCnt=0;    
-  RTclassHeirPartUsedCnt=0;   
-  RTclassHeirSuperCnt=0;   
-  RTmethodNotUsedCnt = 0; 
-  RTmethodNotUsedCnt1 = 0; 
-  RTmethodNotUsedCnt2 = 0;  
-  RTmethodUsedCnt = 0;   
-  RTmethodMarkedCnt= 0;  
-
-
-  /*-- --*/
-  if (pClassHeirStatsOnly >= 2) {
-    printf("\nRT Class Hierarchy for ");
-    printf("--- start of RT info --------------- after :\n");
-    if (m != NULL) {
-       utf_display(m->class->name); 
-        printf(".");
-        method_display(m);
-       printf("\n");
-       }
-    }
-  printRTClassHeirarchy(class_java_lang_Object);
-  if (pClassHeirStatsOnly >= 2) {
-    printf("--- end  of RT info ---------------\n");
-    }
- if (pClassHeirStatsOnly >= 1) {
-
-  /*--  statistic results --*/
-  printRTInterfaceClasses();
-       
-  printf("\n  >>>>>>>>>>>>>>>>>>>>  Analysed Class Hierarchy Statistics:\n"); 
-  printf(" Used            \t%i \tclasses\t/ Used       \t%i methods \t of USED: %i%% \t  of ALL: %i%% \n",
-               RTclassHeirUsedCnt,RTmethodUsedCnt,
-               ((100*RTmethodUsedCnt)/(RTmethodUsedCnt + RTmethodNotUsedCnt2)) ,
-               ((100*RTmethodUsedCnt)/ (RTmethodNotUsedCnt    + RTmethodUsedCnt    + RTmethodMarkedCnt)) );
-  printf(" Part Used       \t%i \tclasses\t/\n",RTclassHeirPartUsedCnt); 
-  printf(" Not Used        \t%i \tclasses\t/\n\n",RTclassHeirNotUsedCnt); 
-  printf("                 \t    \t       \t/ Just Marked \t%i methods\n\n",RTmethodMarkedCnt); 
-  printf(" In Not Used     \t    \tclasses\t/ Not Used    \t%i methods\n",RTmethodNotUsedCnt1); 
-  printf(" In Used         \t    \tclasses\t/ Not Used    \t%i methods\n",RTmethodNotUsedCnt2);
-  printf(" Total           \t%i \tclasses\t/ Total       \t%i methods\n\n",
-       RTclassHeirNotUsedCnt + RTclassHeirUsedCnt + RTclassHeirPartUsedCnt,  
-       RTmethodNotUsedCnt1 + RTmethodNotUsedCnt2    + RTmethodUsedCnt    + RTmethodMarkedCnt ); 
-
-  printf(" Mono vs. Polymorphic calls:\n");
-  printf(" Mono calls     \t%i   \tPoly that resolves to Mono \t%i \tPoly calls     \t%i\n\n",
-          RTmethodMono, RTmethodPolyReallyMono, RTmethodPoly);
-
-  printf(" No Subs: Total=\t%i   \tAbstract No Subs=           \t%i \tAbstract methods used =\t%i\n",
-         RTmethodNoSubs, RTmethodNoSubsAbstract, RTmethodAbstract);
-
-  printf(" Inlining possible:  \tFINALs %i \tSTATICs %i \t FINAL & STATIC %i \t Class has No Subs %i \n",
-       RTmethodFinal, RTmethodStatic,RTmethodFinalStatic,  RTmethodNoSubs);
-  printf("    Code size < 100  \tFINALs %i \tSTATICs %i \t FINAL & STATIC %i \t Class has No Subs %i \n",
-       RTmethodFinal100, RTmethodStatic100,RTmethodFinalStatic100,  RTmethodNoSubs100);
-  }
-}
 
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b240bebef5444c309e29b63bb52e060ab82e5e54..fe658d55a2328062be55d6bb8877ea578324005e 100644 (file)
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+/* jit/sets.c -
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: sets.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
 #include "sets.h"
+#include "types.h"
+#include "global.h"
 
 
 /*
  * set.c - functions to manipulate ptr sets.
  */
+
  
 /*------------------------------------------------------------*/
 /*-- fieldinfo call set fns */
 /*------------------------------------------------------------*/
-fldSetNode  *inFldSet    (fldSetNode *s, fieldinfo *f)
- {
- fldSetNode* i;
- for (i=s; i != NULL; i = i->nextfldRef) {
-   if (i->fldRef == f) {
-      return i; /* true = found */
-      }
-   }
- return NULL;
- }
+fldSetNode *inFldSet(fldSetNode *s, fieldinfo *f)
+{
+       fldSetNode* i;
+       for (i=s; i != NULL; i = i->nextfldRef) {
+               if (i->fldRef == f) {
+                       return i; /* true = found */
+               }
+       }
+       return NULL;
+}
+
 
 /*------------------------------------------------------------*/
 /* */
-fldSetNode *addFldRef(fldSetNode *s,  fieldinfo *f)
- {
- fldSetNode *s1 = s;
- if (!inFldSet(s,f)) {
-   s1 = (fldSetNode *)malloc(sizeof(fldSetNode));
-   s1->nextfldRef  = s;
-   s1->fldRef      = f;
-   s1->writePUT     = false;
-   s1->readGET    = false;
-   s1->lastptrPUT = NULL;
-   s1->lastptrGET = NULL;
-
-   if (s == NULL)
-     s1->index = 1;
-   else
-     s1->index = s->index+1; 
-   }
- return s1;
- }
+fldSetNode *addFldRef(fldSetNode *s, fieldinfo *f)
+{
+       fldSetNode *s1 = s;
+       if (!inFldSet(s,f)) {
+               s1 = (fldSetNode *)malloc(sizeof(fldSetNode));
+               s1->nextfldRef  = s;
+               s1->fldRef      = f;
+               s1->writePUT     = false;
+               s1->readGET    = false;
+               s1->lastptrPUT = NULL;
+               s1->lastptrGET = NULL;
+
+               if (s == NULL)
+                       s1->index = 1;
+               else
+                       s1->index = s->index+1; 
+       }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 fldSet *add2FldSet(fldSet *sf,  fieldinfo *f, bool wput, bool rget)
- {
- fldSetNode *s1;
- fldSetNode *s;
+{
      fldSetNode *s1;
      fldSetNode *s;
  
- if (sf == NULL) {
-       sf = createFldSet();
      if (sf == NULL) {
+               sf = createFldSet();
        }
- s = sf->head;
- s1 = inFldSet(s,f);
- if (s1 == NULL) {
-   s1 = (fldSetNode *)malloc(sizeof(fldSetNode));
-   if (sf->head == NULL) {
-       sf->head  = s1;
-       sf->pos   = s1;
-       s1->index = 1;
-       }        
-   else {
-       sf->tail->nextfldRef  = s1;
-       sf->length++;
-       s1->index = sf->length;
      s = sf->head;
      s1 = inFldSet(s,f);
      if (s1 == NULL) {
+               s1 = (fldSetNode *)malloc(sizeof(fldSetNode));
+               if (sf->head == NULL) {
+                       sf->head  = s1;
+                       sf->pos   = s1;
+                       s1->index = 1;
+               }        
+               else {
+                       sf->tail->nextfldRef  = s1;
+                       sf->length++;
+                       s1->index = sf->length;
        } 
-   s1->nextfldRef  = NULL;
-   s1->fldRef      = f;
-   s1->writePUT    = wput;
-   s1->readGET     = rget;
-   s1->lastptrPUT = NULL;
-   s1->lastptrGET = NULL;
-   sf->tail = s1;
-   }
- else  {
-       if ((s1->writePUT == false) && (wput)) 
-               s1->writePUT = wput;
-       if ((s1->readGET == false)  && (rget)) 
-               s1->readGET  = rget;
+               s1->nextfldRef  = NULL;
+               s1->fldRef      = f;
+               s1->writePUT    = wput;
+               s1->readGET     = rget;
+               s1->lastptrPUT = NULL;
+               s1->lastptrGET = NULL;
+               sf->tail = s1;
        }
- return sf;
- }
+       else    {
+               if ((s1->writePUT == false) && (wput)) 
+                       s1->writePUT = wput;
+               if ((s1->readGET == false)  && (rget)) 
+                       s1->readGET  = rget;
+       }
+       return sf;
+}
+
 
 /*------------------------------------------------------------*/
 fldSet *createFldSet( )
- {
- fldSet *s;
- s = (fldSet *)malloc(sizeof(fldSet));
- s->head = NULL;
- s->tail = NULL;
- s->pos  = NULL;
- s->length = 0;
- return s;
- }
+{
+       fldSet *s;
+       s = (fldSet *)malloc(sizeof(fldSet));
+       s->head = NULL;
+       s->tail = NULL;
+       s->pos  = NULL;
+       s->length = 0;
+       return s;
+}
+
 
 /*------------------------------------------------------------*/
 /*-- methodinfo call set fns */
 /*------------------------------------------------------------*/
 int  inMethSet    (methSetNode *s, methodinfo *m)
- {
- methSetNode* i;
- for (i=s; i != NULL; i = i->nextmethRef) {
-   if (i->methRef == m) {
-      return (int)1; /* true = found */
-      }
-   }
- return (int)0;
- }
+{
+       methSetNode* i;
+       for (i=s; i != NULL; i = i->nextmethRef) {
+               if (i->methRef == m) {
+                       return (int)1; /* true = found */
+               }
+       }
+       return (int)0;
+}
+
 
 /*------------------------------------------------------------*/
 methSetNode *addMethRef(methSetNode *s,  methodinfo *m)
- {
- methSetNode *s1 = s;
- if (!inMethSet(s,m)) {
-   s1 = (methSetNode *)malloc(sizeof(methSetNode));
-   s1->nextmethRef= s;
-   s1->methRef = m;
-   s1->lastptrIntoClassSet2 = NULL;
-   if (s == NULL)
-     s1->index = 1;
-   else
-     s1->index = s->index+1; 
-   s1->monoPoly = MONO; 
-   }
+{
      methSetNode *s1 = s;
      if (!inMethSet(s,m)) {
+               s1 = (methSetNode *)malloc(sizeof(methSetNode));
+               s1->nextmethRef= s;
+               s1->methRef = m;
+               s1->lastptrIntoClassSet2 = NULL;
+               if (s == NULL)
+                       s1->index = 1;
+               else
+                       s1->index = s->index+1; 
+               s1->monoPoly = MONO; 
+       }
   
- return s1;
- }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 methSet *add2MethSet(methSet *sm,  methodinfo *m)
- {
- methSetNode *s1;
- methSetNode *s;
+{
      methSetNode *s1;
      methSetNode *s;
  
- if (sm == NULL) {
-       sm = createMethSet();
      if (sm == NULL) {
+               sm = createMethSet();
        }
- s = sm->head;
- if (!inMethSet(s,m)) {
-   s1 = (methSetNode *)malloc(sizeof(methSetNode));
-   if (sm->head == NULL) {
-       sm->head = s1;
-       sm->pos   = s1;
-       s1->index = 1;
-       }        
-   else {
-       sm->tail->nextmethRef  = s1;
-       sm->length++;
-       s1->index = sm->length;
      s = sm->head;
      if (!inMethSet(s,m)) {
+               s1 = (methSetNode *)malloc(sizeof(methSetNode));
+               if (sm->head == NULL) {
+                       sm->head = s1;
+                       sm->pos   = s1;
+                       s1->index = 1;
+               }        
+               else {
+                       sm->tail->nextmethRef  = s1;
+                       sm->length++;
+                       s1->index = sm->length;
        }
-   s1->monoPoly = MONO; 
-   s1->nextmethRef= NULL;
-   s1->methRef = m;
-   s1->lastptrIntoClassSet2 = NULL;
-   sm->tail = s1;
-   }
- return sm;
- }
+               s1->monoPoly = MONO; 
+               s1->nextmethRef= NULL;
+               s1->methRef = m;
+               s1->lastptrIntoClassSet2 = NULL;
+               sm->tail = s1;
+       }
+       return sm;
+}
+
  
 /*------------------------------------------------------------*/
 methSet *createMethSet( )
- {
- methSet *s;
- s = (methSet *)malloc(sizeof(methSet));
- s->head = NULL;
- s->tail = NULL;
- s->pos  = NULL;
- s->length = 0;
- return s;
- }
+{
+       methSet *s;
+       s = (methSet *)malloc(sizeof(methSet));
+       s->head = NULL;
+       s->tail = NULL;
+       s->pos  = NULL;
+       s->length = 0;
+       return s;
+}
+
 
 /*------------------------------------------------------------*/
 /*-- classinfo XTA set fns  */
 /*------------------------------------------------------------*/
 int  inSet    (classSetNode *s, classinfo *c)
- {
- classSetNode* i;
- for (i=s; i != NULL; i = i->nextClass) {
-   if (i->classType == c) {
-      return  ((i->index)+1); /* true = found */
-      }
-   }
- return (int)0;
- }
+{
+       classSetNode* i;
+       for (i=s; i != NULL; i = i->nextClass) {
+               if (i->classType == c) {
+                       return  ((i->index)+1); /* true = found */
+               }
+       }
+       return (int)0;
+}
+
 
 /*------------------------------------------------------------*/
 classSetNode *addElement(classSetNode *s,  classinfo *c)
- {
- classSetNode *s1 = s;
- if (!inSet(s,c)) {
-   s1 = (classSetNode *)malloc(sizeof(classSetNode));
-   s1->nextClass= s;
-   s1->classType = c;
-   if (s == NULL)
-     s1->index = 1;
-   else
-     s1->index = s->index+1; 
-   }
- return s1;
- }
+{
+       classSetNode *s1 = s;
+       if (!inSet(s,c)) {
+               s1 = (classSetNode *)malloc(sizeof(classSetNode));
+               s1->nextClass= s;
+               s1->classType = c;
+               if (s == NULL)
+                       s1->index = 1;
+               else
+                       s1->index = s->index+1; 
+       }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 classSet *add2ClassSet(classSet *sc,  classinfo *c)
- {
- classSetNode *s1;
- classSetNode *s;
+{
      classSetNode *s1;
      classSetNode *s;
  
- if (sc == NULL) {
-       sc = createClassSet();
      if (sc == NULL) {
+               sc = createClassSet();
        }
- s = sc->head;
      s = sc->head;
        
- if (!inSet(s,c)) {
-   s1 = (classSetNode *)malloc(sizeof(classSetNode));
-   if (sc->head == NULL) {
-       sc->head  = s1;
-       sc->pos   = s1;
-       s1->index = 1;
-       }        
-   else {
-       sc->tail->nextClass  = s1;
-       sc->length++;
-       s1->index = sc->length;
      if (!inSet(s,c)) {
+               s1 = (classSetNode *)malloc(sizeof(classSetNode));
+               if (sc->head == NULL) {
+                       sc->head  = s1;
+                       sc->pos   = s1;
+                       s1->index = 1;
+               }        
+               else {
+                       sc->tail->nextClass  = s1;
+                       sc->length++;
+                       s1->index = sc->length;
        } 
-   s1->classType = c;
-   s1->nextClass= NULL;
-   sc->tail  = s1;
-   }
- return sc;
- }
+               s1->classType = c;
+               s1->nextClass= NULL;
+               sc->tail  = s1;
+       }
+       return sc;
+}
+
 
 /*------------------------------------------------------------*/
 classSet *createClassSet( )
- {
- classSet *s;
- s = (classSet *)malloc(sizeof(classSet));
- s->head = NULL;
- s->tail = NULL;
- s->pos  = NULL;
- s->length = 0;
- return s;
- }
+{
+       classSet *s;
+       s = (classSet *)malloc(sizeof(classSet));
+       s->head = NULL;
+       s->tail = NULL;
+       s->pos  = NULL;
+       s->length = 0;
+       return s;
+}
+
 
 /*------------------------------------------------------------*/
 /* Returns:                                                   */
@@ -253,26 +298,27 @@ classSet *createClassSet( )
 /*     1  c is a superclass of an existing set element        */
 
 int inRange (classSetNode *s, classinfo *c)
- {
- classSetNode* i;
- int rc=0;
-
- for (i=s; i != NULL; i = i->nextClass) {
-    classinfo *cs = i->classType;
-    if (cs->vftbl->baseval <= c->vftbl->baseval) {
-       if (c->vftbl->baseval <= (cs->vftbl->baseval+cs->vftbl->diffval)) {
-               rc = -1;  /* subtype */
+{
+       classSetNode* i;
+       int rc=0;
+
+       for (i=s; i != NULL; i = i->nextClass) {
+               classinfo *cs = i->classType;
+               if (cs->vftbl->baseval <= c->vftbl->baseval) {
+                       if (c->vftbl->baseval <= (cs->vftbl->baseval+cs->vftbl->diffval)) {
+                               rc = -1;  /* subtype */
+                       }
                }
-       }
-    else {
-       if (cs->vftbl->baseval < (c->vftbl->baseval+c->vftbl->diffval)) {
-               i->classType = c;   /* replace element with its new super */
-               rc  = 1; /* super */
+               else {
+                       if (cs->vftbl->baseval < (c->vftbl->baseval+c->vftbl->diffval)) {
+                               i->classType = c;   /* replace element with its new super */
+                               rc  = 1; /* super */
+                       }
                }
-       }
     }
- return rc;
- }
+       return rc;
+}
+
 
 /*------------------------------------------------------------*/
 /* adds class if not subtype of an existing set element       */
@@ -280,165 +326,189 @@ int inRange (classSetNode *s, classinfo *c)
 /* then replace the existing element with the "new" class     */
 
 classSetNode *addClassCone(classSetNode *s,  classinfo *c)
- {
- classSetNode *s1 = s;
+{
      classSetNode *s1 = s;
  
-if (inRange(s,c) == 0) {
-       /* not in set nor cone of an existing element so add */
-       s1 = (classSetNode *)malloc(sizeof(classSetNode));
-       s1->nextClass= s;
-       s1->classType = c;
-       if (s == NULL)
-               s1->index = 1;
-       else
-               s1->index = s->index+1; 
+       if (inRange(s,c) == 0) {
+               /* not in set nor cone of an existing element so add */
+               s1 = (classSetNode *)malloc(sizeof(classSetNode));
+               s1->nextClass= s;
+               s1->classType = c;
+               if (s == NULL)
+                       s1->index = 1;
+               else
+                       s1->index = s->index+1; 
        }
- return s1;
- }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 classSetNode * intersectSubtypesWithSet(classinfo *t, classSetNode *s) {
- classSetNode *s1 = NULL;
- classSetNode *c;
      classSetNode *s1 = NULL;
      classSetNode *c;
 
- /* for each s class */
- for (c=s; c != NULL; c = c->nextClass) {
-       vftbl *t_cl_vt = t->vftbl;
-       vftbl *c_cl_vt = c->classType->vftbl;
      /* for each s class */
      for (c=s; c != NULL; c = c->nextClass) {
+               vftbl *t_cl_vt = t->vftbl;
+               vftbl *c_cl_vt = c->classType->vftbl;
 
-       /* if s class is in the t Class range */
-       if (  (t_cl_vt->baseval <=  c_cl_vt->baseval)
-       && (c_cl_vt->baseval <= (t_cl_vt->baseval+t_cl_vt->diffval)) ) {
+               /* if s class is in the t Class range */
+               if (  (t_cl_vt->baseval <=  c_cl_vt->baseval)
+                         && (c_cl_vt->baseval <= (t_cl_vt->baseval+t_cl_vt->diffval)) ) {
 
-               /*    add s class to return class set */
-               s1 = addElement(s1,c->classType);
+                       /*    add s class to return class set */
+                       s1 = addElement(s1,c->classType);
                }
        }
- return s1;
- }
+       return s1;
+}
+
 
 /*------------------------------------------------------------*/
 int sizeOfSet(classSetNode *s) {
-/*** need to update */
-  int cnt=0;
-  classSetNode * i;
-  for (i=s; i != NULL; i = i->nextClass) cnt++;
-  return cnt;
-  }
+       /*** need to update */
+       int cnt=0;
+       classSetNode * i;
+       for (i=s; i != NULL; i = i->nextClass) cnt++;
+       return cnt;
+}
+
   
 /*------------------------------------------------------------*/
 int printSet(classSetNode *s)
-  {
-  classSetNode* i;
-  int cnt=0;
+{
+       classSetNode* i;
+       int cnt=0;
 
-  if (s == NULL) {
-       printf("Set of types: <");
-       printf("\t\tEmpty Set\n");
+       if (s == NULL) {
+               printf("Set of types: <");
+               printf("\t\tEmpty Set\n");
        }
-  else         {
-       printf("<%i>Set of types: ",s->index);
-       for (i=s; i != NULL; i = i->nextClass) {
+       else    {
+               printf("<%i>Set of types: ",s->index);
+               for (i=s; i != NULL; i = i->nextClass) {
                printf("\t#%i: ",cnt);
-               if (i->classType == NULL)  {
-                       printf("NULL CLASS");
-                       fflush(stdout);
+                       if (i->classType == NULL)  {
+                               printf("NULL CLASS");
+                               fflush(stdout);
                        }
-               else    {
-                       utf_display(i->classType->name);
-                       fflush(stdout); 
-                       printf("<b%i/d%i> ",i->classType->vftbl->baseval,i->classType->vftbl->diffval); 
-                       fflush(stdout);
+                       else    {
+                               utf_display(i->classType->name);
+                               fflush(stdout); 
+                               printf("<b%i/d%i> ",i->classType->vftbl->baseval,i->classType->vftbl->diffval); 
+                               fflush(stdout);
                        }
-               cnt++;
+                       cnt++;
                }
-       printf(">\n");
+               printf(">\n");
        }
-  return cnt;
-  }
+       return cnt;
+}
+
+
 /*------------------------------------------------------------*/
 int printClassSet(classSet *sc) {
-if (sc == NULL) {
-       printf("Class Set not yet created\n");
-       return 0;
+       if (sc == NULL) {
+               printf("Class Set not yet created\n");
+               return 0;
        }
-else
-       return (printSet(sc->head));
+       else
+               return (printSet(sc->head));
 }
 
+
 /*------------------------------------------------------------*/
 int printMethSet(methSetNode *s)
-  {
-  methSetNode* i;
-  int cnt=0;
+{
+       methSetNode* i;
+       int cnt=0;
 
-  if (s == NULL) {
-       printf("Set of Methods: "); fflush(stdout);
+       if (s == NULL) {
+               printf("Set of Methods: "); fflush(stdout);
        printf("\t\tEmpty Set\n"); fflush(stdout);
-        }
-  else         {
-       printf("<%i>Set of Methods: ",s->index);fflush(stdout); 
-       for (i=s; i != NULL; i = i->nextmethRef) {
+       }
+       else    {
+               printf("<%i>Set of Methods: ",s->index);fflush(stdout); 
+               for (i=s; i != NULL; i = i->nextmethRef) {
                printf("\t#%i: ",cnt);
 
-               /* class.method */
-               utf_display(i->methRef->class->name);
-               printf(".");
-               method_display(i->methRef);
+                       /* class.method */
+                       utf_display(i->methRef->class->name);
+                       printf(".");
+                       method_display(i->methRef);
 
-               /* lastptr <class> */
-               printf("\t<");
-               if (i->lastptrIntoClassSet2 != NULL)
-                       utf_display(i->lastptrIntoClassSet2->classType->name);
-               printf(">\n");
+                       /* lastptr <class> */
+                       printf("\t<");
+                       if (i->lastptrIntoClassSet2 != NULL)
+                               utf_display(i->lastptrIntoClassSet2->classType->name);
+                       printf(">\n");
 
-               cnt++;
+                       cnt++;
                }
-       printf("\n");
+               printf("\n");
        }
-  return cnt;
-  }
+       return cnt;
+}
+
+
 /*------------------------------------------------------------*/
 int printMethodSet(methSet *sm) {
-if (sm == NULL) {
-       printf("Method Set not yet created\n");
-       return 0;
+       if (sm == NULL) {
+               printf("Method Set not yet created\n");
+               return 0;
        }
-else
-       return (printMethSet(sm->head));
+       else
+               return (printMethSet(sm->head));
 }
+
+
 /*------------------------------------------------------------*/
 int printFldSet(fldSetNode *s)
-  {
-  fldSetNode* i;
-  int cnt=0;
+{
+       fldSetNode* i;
+       int cnt=0;
 
-  if (s == NULL) {
-       printf("Set of Fields: ");
-       printf("\tEmpty Set\n");
+       if (s == NULL) {
+               printf("Set of Fields: ");
+               printf("\tEmpty Set\n");
        }
-  else         {
-       printf("<%i>Set of Fields: ",s->index);
-       for (i=s; i != NULL; i = i->nextfldRef) {
+       else    {
+               printf("<%i>Set of Fields: ",s->index);
+               for (i=s; i != NULL; i = i->nextfldRef) {
                printf("\t#%i: ",cnt);
-               printf("(%ir/%iw)",i->writePUT,i->readGET);
-               field_display(i->fldRef);
-               cnt++;
+                       printf("(%ir/%iw)",i->writePUT,i->readGET);
+                       field_display(i->fldRef);
+                       cnt++;
                }
-       printf("\n");
+               printf("\n");
        }
-  return cnt;
-  }
+       return cnt;
+}
+
 
 /*------------------------------------------------------------*/
 int printFieldSet(fldSet *sf) {
-if (sf == NULL) {
-       printf("Field Set not yet created\n");
-       return 0;
+       if (sf == NULL) {
+               printf("Field Set not yet created\n");
+               return 0;
        }
-else
-       return (printFldSet(sf->head));
+       else
+               return (printFldSet(sf->head));
 }
 /*------------------------------------------------------------*/
 /*void destroy_set */
 
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index aee298f3c6775395a471fa4f2e39df9c0fa80287..aff16c52e4c2c63fc451af90b25653fdc668df51 100644 (file)
-#ifndef __SET__
-#define __SET__
+/* jit/sets.h -
 
-typedef struct methSet     methSet;
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Carolyn Oates
+
+   $Id: sets.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _SET_H
+#define _SET_H
+
+#include "types.h"
+
+typedef struct methSet      methSet;
 typedef struct methSetNode  methSetNode;
-typedef struct fldSet      fldSet;
+typedef struct fldSet       fldSet;
 typedef struct fldSetNode   fldSetNode;
-typedef struct classSet    classSet;
+typedef struct classSet     classSet;
 typedef struct classSetNode classSetNode;
 
 
+#include "global.h"
+
+
+/*------------ Method /Class Used Markers -------------------------------*/                 
+
+/* Class flags =
+   USED all methods and fields are available; 
+   PARTUSED = specific methods (static, <init>, <clinit>, inherited def used, special) used, 
+             but not instanciated
+   NOTUSED = nothing used in class - not needed 
+*/
+
+/* Method Flags =
+   USED = method definition is used
+   PARTUSED = method definition will be used if class instanciated
+   NOTUSED  = method defintion never used
+*/
+
+#define USED      2
+#define PARTUSED  1
+#define MARKED    1
+#define NOTUSED   0
+
+#define MONO      0
+#define MONO1    1 /* potential poly that is really mono */
+#define POLY      2
+
+
 /*------------------------------------------------------------*/
 /*-- flds used by a method set fns */
 /*------------------------------------------------------------*/
 struct fldSet {
-  fldSetNode *head;
-  fldSetNode *tail;
-  fldSetNode *pos;
-  s4 length;
-  };
+       fldSetNode *head;
+       fldSetNode *tail;
+       fldSetNode *pos;
+       s4 length;
+};
 
 
 struct fldSetNode {
-  fieldinfo *fldRef;
-  fldSetNode *nextfldRef;
-  bool writePUT;
-  bool readGET;
-  classSetNode *lastptrPUT; 
-  classSetNode *lastptrGET; 
-  s2 index;
-  };
-fldSetNode      *inFldSet (fldSetNode *, fieldinfo *);
-fldSetNode     *addFldRef(fldSetNode *, fieldinfo *);
-fldSet          *add2FldSet(fldSet    *, fieldinfo *, bool, bool);
-fldSet          *createFldSet();
-int             printFldSet  (fldSetNode *);
-int             printFieldSet (fldSet *);
+       fieldinfo *fldRef;
+       fldSetNode *nextfldRef;
+       bool writePUT;
+       bool readGET;
+       classSetNode *lastptrPUT; 
+       classSetNode *lastptrGET; 
+       s2 index;
+};
+
+
+fldSetNode *inFldSet (fldSetNode *, fieldinfo *);
+fldSetNode *addFldRef(fldSetNode *, fieldinfo *);
+fldSet *add2FldSet(fldSet *, fieldinfo *, bool, bool);
+fldSet *createFldSet();
+int printFldSet(fldSetNode *);
+int printFieldSet(fldSet *);
 
 
 /*------------------------------------------------------------*/
 /*-- methodinfo call set fns */
 /*------------------------------------------------------------*/
 struct methSet {
-  methSetNode *head;
-  methSetNode *tail;
-  methSetNode *pos;
-  s4 length;
-  };
+       methSetNode *head;
+       methSetNode *tail;
+       methSetNode *pos;
+       s4 length;
+};
+
 
 struct methSetNode {
-  methodinfo   *methRef;
-  methSetNode  *nextmethRef;
-  classSetNode *lastptrIntoClassSet2;
-  s2            index;
-  s4            monoPoly;
-  };
-
-int             inMethSet (methSetNode *, methodinfo *);
-methSetNode    *addMethRef(methSetNode *, methodinfo *);
-methSet         *add2MethSet(methSet    *, methodinfo *);
-methSet         *createMethSet();
-int             printMethSet   (methSetNode *);
-int             printMethodSet (methSet *);
+       methodinfo   *methRef;
+       methSetNode  *nextmethRef;
+       classSetNode *lastptrIntoClassSet2;
+       s2            index;
+       s4            monoPoly;
+};
+
+
+int inMethSet (methSetNode *, methodinfo *);
+methSetNode *addMethRef(methSetNode *, methodinfo *);
+methSet *add2MethSet(methSet    *, methodinfo *);
+methSet *createMethSet();
+int printMethSet   (methSetNode *);
+int printMethodSet (methSet *);
+
 
 /*------------------------------------------------------------*/
 /*-- classinfo XTA set fns  */
 /*------------------------------------------------------------*/
 
 struct classSet {
-  classSetNode *head;
-  classSetNode *tail;
-  classSetNode *pos;
-  s4 length;
-  };
+       classSetNode *head;
+       classSetNode *tail;
+       classSetNode *pos;
+       s4 length;
+};
+
 
 struct classSetNode {
-  classinfo *classType;
-  classSetNode *nextClass;
-  s2 index;
-  };
-
-int            inSet    (classSetNode *, classinfo *);
-classSetNode * addElement(classSetNode *,  classinfo *);
-classSet     *  add2ClassSet(classSet *,  classinfo *);
-classSet     *  createClassSet();
-int             inRange (classSetNode *, classinfo *);
-classSetNode * addClassCone(classSetNode *,  classinfo *);
-classSetNode *   intersectSubtypesWithSet(classinfo *, classSetNode *); 
-int             sizeOfSet(classSetNode *s);
-int            setSize(classSetNode *);
-int            printSet(classSetNode *);
-int            printClassSet(classSet *);
-
-#endif
+       classinfo *classType;
+       classSetNode *nextClass;
+       s2 index;
+};
+
+
+int inSet(classSetNode *, classinfo *);
+classSetNode *addElement(classSetNode *,  classinfo *);
+classSet *add2ClassSet(classSet *,  classinfo *);
+classSet *createClassSet();
+int inRange(classSetNode *, classinfo *);
+classSetNode *addClassCone(classSetNode *,  classinfo *);
+classSetNode *intersectSubtypesWithSet(classinfo *, classSetNode *); 
+int sizeOfSet(classSetNode *s);
+int setSize(classSetNode *);
+int printSet(classSetNode *);
+int printClassSet(classSet *);
+
+#endif /* _SETS_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/jit.c b/src/vm/jit/jit.c
new file mode 100644 (file)
index 0000000..768e1ac
--- /dev/null
@@ -0,0 +1,1572 @@
+/* jit/jit.c - calls the code generation functions
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   $Id: jit.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <string.h>
+#include "global.h"    /* we define _GNU_SOURCE there */
+#include "tables.h"
+#include "loader.h"
+#include "jit.h"
+#include "parse.h"
+#include "stack.h"
+#include "reg.h"
+#include "inline.h"
+#include "builtin.h"
+#include "native.h"
+#include "asmpart.h"
+#include "threads/thread.h"
+#include "disass.h"
+#include "loop/loop.h"
+#include "loop/graph.h"
+#include "loop/analyze.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+
+/* global switches ************************************************************/
+bool compileverbose =  false;
+bool showstack = false;
+bool showdisassemble = false; 
+bool showddatasegment = false; 
+bool showintermediate = false;
+int  optimizelevel = 0;
+
+bool useinlining = false;
+bool inlinevirtuals = false;
+bool inlineexceptions = false;
+bool inlineparamopt = false;
+bool inlineoutsiders = false;
+
+bool checkbounds = true;
+bool checknull = true;
+bool opt_noieee = false;
+bool checksync = true;
+bool opt_loops = false;
+
+bool getcompilingtime = false;
+long compilingtime = 0;
+
+int  has_ext_instr_set = 0;
+
+bool statistics = false;         
+
+int count_jit_calls = 0;
+int count_methods = 0;
+int count_spills = 0;
+int count_pcmd_activ = 0;
+int count_pcmd_drop = 0;
+int count_pcmd_zero = 0;
+int count_pcmd_const_store = 0;
+int count_pcmd_const_alu = 0;
+int count_pcmd_const_bra = 0;
+int count_pcmd_load = 0;
+int count_pcmd_move = 0;
+int count_load_instruction = 0;
+int count_pcmd_store = 0;
+int count_pcmd_store_comb = 0;
+int count_dup_instruction = 0;
+int count_pcmd_op = 0;
+int count_pcmd_mem = 0;
+int count_pcmd_met = 0;
+int count_pcmd_bra = 0;
+int count_pcmd_table = 0;
+int count_pcmd_return = 0;
+int count_pcmd_returnx = 0;
+int count_check_null = 0;
+int count_check_bound = 0;
+int count_max_basic_blocks = 0;
+int count_basic_blocks = 0;
+int count_javainstr = 0;
+int count_max_javainstr = 0;
+int count_javacodesize = 0;
+int count_javaexcsize = 0;
+int count_calls = 0;
+int count_tryblocks = 0;
+int count_code_len = 0;
+int count_data_len = 0;
+int count_cstub_len = 0;
+int count_nstub_len = 0;
+int count_max_new_stack = 0;
+int count_upper_bound_new_stack = 0;
+static int count_block_stack_init[11] = {
+       0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 
+       0
+};
+int *count_block_stack = count_block_stack_init;
+static int count_analyse_iterations_init[5] = {
+       0, 0, 0, 0, 0
+};
+int *count_analyse_iterations = count_analyse_iterations_init;
+static int count_method_bb_distribution_init[9] = {
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0
+};
+int *count_method_bb_distribution = count_method_bb_distribution_init;
+static int count_block_size_distribution_init[18] = {
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0
+};
+int *count_block_size_distribution = count_block_size_distribution_init;
+static int count_store_length_init[21] = {
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0
+};
+int *count_store_length = count_store_length_init;
+static int count_store_depth_init[11] = {
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0
+};
+int *count_store_depth = count_store_depth_init;
+
+
+
+/* global compiler variables **************************************************/
+
+                                /* data about the currently compiled method   */
+
+classinfo  *class;              /* class the compiled method belongs to       */
+methodinfo *method;             /* pointer to method info of compiled method  */
+static utf        *descriptor;  /* type descriptor of compiled method         */
+int         mparamcount;        /* number of parameters (incl. this)          */
+u1         *mparamtypes;        /* types of all parameters (TYPE_INT, ...)    */
+static int         mreturntype; /* return type of method                      */
+       
+int maxstack;                   /* maximal JavaVM stack size                  */
+int maxlocals;                  /* maximal number of local JavaVM variables   */
+int jcodelength;                /* length of JavaVM-codes                     */
+u1 *jcode;                      /* pointer to start of JavaVM-code            */
+int exceptiontablelength;       /* length of exception table                  */
+xtable *extable;                /* pointer to start of exception table        */
+exceptiontable *raw_extable;
+
+int block_count;                /* number of basic blocks                     */
+basicblock *block;              /* points to basic block array                */
+int *block_index;               /* a table which contains for every byte of   */
+                                /* JavaVM code a basic block index if at this */
+                                /* byte there is the start of a basic block   */
+
+int instr_count;                /* number of JavaVM instructions              */
+instruction *instr;             /* points to intermediate code instructions   */
+
+int stack_count;                /* number of stack elements                   */
+stackelement *stack;            /* points to intermediate code instructions   */
+
+bool isleafmethod;              /* true if a method doesn't call subroutines  */
+
+basicblock *last_block;         /* points to the end of the BB list           */
+
+/* list of all classes used by the compiled method which have to be           */
+/* initialised (if not already done) before execution of this method          */
+chain *uninitializedclasses;
+
+int stackreq[256];
+                                
+
+int jcommandsize[256] = {
+
+#define JAVA_NOP               0
+#define ICMD_NOP               0
+       1,
+#define JAVA_ACONST_NULL       1
+#define ICMD_ACONST            1        /* val.a = constant                   */
+       1,
+#define JAVA_ICONST_M1         2
+#define ICMD_NULLCHECKPOP      2
+       1,
+#define JAVA_ICONST_0          3
+#define ICMD_ICONST            3        /* val.i = constant                   */
+       1,
+#define JAVA_ICONST_1          4
+#define ICMD_IREM0X10001       4
+       1,
+#define JAVA_ICONST_2          5
+#define ICMD_IDIVPOW2          5        /* val.i = constant                   */
+       1,
+#define JAVA_ICONST_3          6
+#define ICMD_LDIVPOW2          6        /* val.l = constant                   */
+       1,
+#define JAVA_ICONST_4          7
+       1,
+#define JAVA_ICONST_5          8
+#define ICMD_LREM0X10001       8
+       1,
+#define JAVA_LCONST_0          9
+#define ICMD_LCONST            9        /* val.l = constant                   */
+       1,
+#define JAVA_LCONST_1         10
+#define ICMD_LCMPCONST        10        /* val.l = constant                   */
+       1,
+#define JAVA_FCONST_0         11
+#define ICMD_FCONST           11        /* val.f = constant                   */
+       1,
+#define JAVA_FCONST_1         12
+       1,
+#define JAVA_FCONST_2         13
+#define ICMD_ELSE_ICONST      13
+       1,
+#define JAVA_DCONST_0         14
+#define ICMD_DCONST           14        /* val.d = constant                   */
+       1,
+#define JAVA_DCONST_1         15
+#define ICMD_IFEQ_ICONST      15
+       1,
+#define JAVA_BIPUSH           16
+#define ICMD_IFNE_ICONST      16
+       2,
+#define JAVA_SIPUSH           17
+#define ICMD_IFLT_ICONST      17
+       3,
+#define JAVA_LDC1             18
+#define ICMD_IFGE_ICONST      18
+       2,
+#define JAVA_LDC2             19
+#define ICMD_IFGT_ICONST      19
+       3,
+#define JAVA_LDC2W            20
+#define ICMD_IFLE_ICONST      20
+       3,
+                                           /* order of LOAD instructions must be */
+                                           /* equal to order of TYPE_XXX defines */
+#define JAVA_ILOAD            21
+#define ICMD_ILOAD            21        /* op1 = local variable               */
+       2,                      
+#define JAVA_LLOAD            22
+#define ICMD_LLOAD            22        /* op1 = local variable               */
+       2,
+#define JAVA_FLOAD            23
+#define ICMD_FLOAD            23        /* op1 = local variable               */
+       2,
+#define JAVA_DLOAD            24
+#define ICMD_DLOAD            24        /* op1 = local variable               */
+       2,
+#define JAVA_ALOAD            25
+#define ICMD_ALOAD            25        /* op1 = local variable               */
+       2,
+#define JAVA_ILOAD_0          26
+#define ICMD_IADDCONST        26        /* val.i = constant                   */
+       1,
+#define JAVA_ILOAD_1          27
+#define ICMD_ISUBCONST        27        /* val.i = constant                   */
+       1,
+#define JAVA_ILOAD_2          28
+#define ICMD_IMULCONST        28        /* val.i = constant                   */
+       1,
+#define JAVA_ILOAD_3          29
+#define ICMD_IANDCONST        29        /* val.i = constant                   */
+       1,
+#define JAVA_LLOAD_0          30
+#define ICMD_IORCONST         30        /* val.i = constant                   */
+       1,
+#define JAVA_LLOAD_1          31
+#define ICMD_IXORCONST        31        /* val.i = constant                   */
+       1,
+#define JAVA_LLOAD_2          32
+#define ICMD_ISHLCONST        32        /* val.i = constant                   */
+       1,
+#define JAVA_LLOAD_3          33
+#define ICMD_ISHRCONST        33        /* val.i = constant                   */
+       1,
+#define JAVA_FLOAD_0          34
+#define ICMD_IUSHRCONST       34        /* val.i = constant                   */
+       1,
+#define JAVA_FLOAD_1          35
+#define ICMD_IREMPOW2         35        /* val.i = constant                   */
+       1,
+#define JAVA_FLOAD_2          36
+#define ICMD_LADDCONST        36        /* val.l = constant                   */
+       1,
+#define JAVA_FLOAD_3          37
+#define ICMD_LSUBCONST        37        /* val.l = constant                   */
+       1,
+#define JAVA_DLOAD_0          38
+#define ICMD_LMULCONST        38        /* val.l = constant                   */
+       1,
+#define JAVA_DLOAD_1          39
+#define ICMD_LANDCONST        39        /* val.l = constant                   */
+       1,
+#define JAVA_DLOAD_2          40
+#define ICMD_LORCONST         40        /* val.l = constant                   */
+       1,
+#define JAVA_DLOAD_3          41
+#define ICMD_LXORCONST        41        /* val.l = constant                   */
+       1,
+#define JAVA_ALOAD_0          42
+#define ICMD_LSHLCONST        42        /* val.l = constant                   */
+       1,
+#define JAVA_ALOAD_1          43
+#define ICMD_LSHRCONST        43        /* val.l = constant                   */
+       1,
+#define JAVA_ALOAD_2          44
+#define ICMD_LUSHRCONST       44        /* val.l = constant                   */
+       1,
+#define JAVA_ALOAD_3          45
+#define ICMD_LREMPOW2         45        /* val.l = constant                   */
+       1,
+#define JAVA_IALOAD           46
+#define ICMD_IALOAD           46
+       1,
+#define JAVA_LALOAD           47
+#define ICMD_LALOAD           47
+       1,
+#define JAVA_FALOAD           48
+#define ICMD_FALOAD           48
+       1,
+#define JAVA_DALOAD           49
+#define ICMD_DALOAD           49
+       1,
+#define JAVA_AALOAD           50
+#define ICMD_AALOAD           50
+       1,
+#define JAVA_BALOAD           51
+#define ICMD_BALOAD           51
+       1,
+#define JAVA_CALOAD           52
+#define ICMD_CALOAD           52
+       1,
+#define JAVA_SALOAD           53
+#define ICMD_SALOAD           53
+       1,
+                                           /* order of STORE instructions must be*/
+                                           /* equal to order of TYPE_XXX defines */
+#define JAVA_ISTORE           54
+#define ICMD_ISTORE           54        /* op1 = local variable               */
+       2,
+#define JAVA_LSTORE           55
+#define ICMD_LSTORE           55        /* op1 = local variable               */
+       2,
+#define JAVA_FSTORE           56
+#define ICMD_FSTORE           56        /* op1 = local variable               */
+       2,
+#define JAVA_DSTORE           57
+#define ICMD_DSTORE           57        /* op1 = local variable               */
+       2,
+#define JAVA_ASTORE           58
+#define ICMD_ASTORE           58        /* op1 = local variable               */
+       2,
+#define JAVA_ISTORE_0         59
+#define ICMD_IF_LEQ           59        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_ISTORE_1         60
+#define ICMD_IF_LNE           60        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_ISTORE_2         61
+#define ICMD_IF_LLT           61        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_ISTORE_3         62
+#define ICMD_IF_LGE           62        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_LSTORE_0         63
+#define ICMD_IF_LGT           63        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_LSTORE_1         64
+#define ICMD_IF_LLE           64        /* op1 = target JavaVM pc, val.l      */
+       1,
+#define JAVA_LSTORE_2         65
+#define ICMD_IF_LCMPEQ        65        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_LSTORE_3         66
+#define ICMD_IF_LCMPNE        66        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_FSTORE_0         67
+#define ICMD_IF_LCMPLT        67        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_FSTORE_1         68
+#define ICMD_IF_LCMPGE        68        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_FSTORE_2         69
+#define ICMD_IF_LCMPGT        69        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_FSTORE_3         70
+#define ICMD_IF_LCMPLE        70        /* op1 = target JavaVM pc             */
+       1,
+#define JAVA_DSTORE_0         71
+       1,
+#define JAVA_DSTORE_1         72
+       1,
+#define JAVA_DSTORE_2         73
+       1,
+#define JAVA_DSTORE_3         74
+       1,
+#define JAVA_ASTORE_0         75
+       1,
+#define JAVA_ASTORE_1         76
+       1,
+#define JAVA_ASTORE_2         77
+       1,
+#define JAVA_ASTORE_3         78
+       1,
+#define JAVA_IASTORE          79
+#define ICMD_IASTORE          79
+       1,
+#define JAVA_LASTORE          80
+#define ICMD_LASTORE          80
+       1,
+#define JAVA_FASTORE          81
+#define ICMD_FASTORE          81
+       1,
+#define JAVA_DASTORE          82
+#define ICMD_DASTORE          82
+       1,
+#define JAVA_AASTORE          83
+#define ICMD_AASTORE          83
+       1,
+#define JAVA_BASTORE          84
+#define ICMD_BASTORE          84
+       1,
+#define JAVA_CASTORE          85
+#define ICMD_CASTORE          85
+       1,
+#define JAVA_SASTORE          86
+#define ICMD_SASTORE          86
+       1,
+#define JAVA_POP              87
+#define ICMD_POP              87
+       1,
+#define JAVA_POP2             88
+#define ICMD_POP2             88
+       1,
+#define JAVA_DUP              89
+#define ICMD_DUP              89
+       1,
+#define JAVA_DUP_X1           90
+#define ICMD_DUP_X1           90
+       1,
+#define JAVA_DUP_X2           91
+#define ICMD_DUP_X2           91
+       1,
+#define JAVA_DUP2             92
+#define ICMD_DUP2             92
+       1,
+#define JAVA_DUP2_X1          93
+#define ICMD_DUP2_X1          93
+       1,
+#define JAVA_DUP2_X2          94
+#define ICMD_DUP2_X2          94
+       1,
+#define JAVA_SWAP             95
+#define ICMD_SWAP             95
+       1,
+#define JAVA_IADD             96
+#define ICMD_IADD             96
+       1,
+#define JAVA_LADD             97
+#define ICMD_LADD             97
+       1,
+#define JAVA_FADD             98
+#define ICMD_FADD             98
+       1,
+#define JAVA_DADD             99
+#define ICMD_DADD             99
+       1,
+#define JAVA_ISUB             100
+#define ICMD_ISUB             100
+       1,
+#define JAVA_LSUB             101
+#define ICMD_LSUB             101
+       1,
+#define JAVA_FSUB             102
+#define ICMD_FSUB             102
+       1,
+#define JAVA_DSUB             103
+#define ICMD_DSUB             103
+       1,
+#define JAVA_IMUL             104
+#define ICMD_IMUL             104
+       1,
+#define JAVA_LMUL             105
+#define ICMD_LMUL             105
+       1,
+#define JAVA_FMUL             106
+#define ICMD_FMUL             106
+       1,
+#define JAVA_DMUL             107
+#define ICMD_DMUL             107
+       1,
+#define JAVA_IDIV             108
+#define ICMD_IDIV             108
+       1,
+#define JAVA_LDIV             109
+#define ICMD_LDIV             109
+       1,
+#define JAVA_FDIV             110
+#define ICMD_FDIV             110
+       1,
+#define JAVA_DDIV             111
+#define ICMD_DDIV             111
+       1,
+#define JAVA_IREM             112
+#define ICMD_IREM             112
+       1,
+#define JAVA_LREM             113
+#define ICMD_LREM             113
+       1,
+#define JAVA_FREM             114
+#define ICMD_FREM             114
+       1,
+#define JAVA_DREM             115
+#define ICMD_DREM             115
+       1,
+#define JAVA_INEG             116
+#define ICMD_INEG             116
+       1,
+#define JAVA_LNEG             117
+#define ICMD_LNEG             117
+       1,
+#define JAVA_FNEG             118
+#define ICMD_FNEG             118
+       1,
+#define JAVA_DNEG             119
+#define ICMD_DNEG             119
+       1,
+#define JAVA_ISHL             120
+#define ICMD_ISHL             120
+       1,
+#define JAVA_LSHL             121
+#define ICMD_LSHL             121
+       1,
+#define JAVA_ISHR             122
+#define ICMD_ISHR             122
+       1,
+#define JAVA_LSHR             123
+#define ICMD_LSHR             123
+       1,
+#define JAVA_IUSHR            124
+#define ICMD_IUSHR            124
+       1,
+#define JAVA_LUSHR            125
+#define ICMD_LUSHR            125
+       1,
+#define JAVA_IAND             126
+#define ICMD_IAND             126
+       1,
+#define JAVA_LAND             127
+#define ICMD_LAND             127
+       1,
+#define JAVA_IOR              128
+#define ICMD_IOR              128
+       1,
+#define JAVA_LOR              129
+#define ICMD_LOR              129
+       1,
+#define JAVA_IXOR             130
+#define ICMD_IXOR             130
+       1,
+#define JAVA_LXOR             131
+#define ICMD_LXOR             131
+       1,
+#define JAVA_IINC             132
+#define ICMD_IINC             132   /* op1 = local variable, val.i = constant */
+       3,
+#define JAVA_I2L              133
+#define ICMD_I2L              133
+       1,
+#define JAVA_I2F              134
+#define ICMD_I2F              134
+       1,
+#define JAVA_I2D              135
+#define ICMD_I2D              135
+       1,
+#define JAVA_L2I              136
+#define ICMD_L2I              136
+       1,
+#define JAVA_L2F              137
+#define ICMD_L2F              137
+       1,
+#define JAVA_L2D              138
+#define ICMD_L2D              138
+       1,
+#define JAVA_F2I              139
+#define ICMD_F2I              139
+       1,
+#define JAVA_F2L              140
+#define ICMD_F2L              140
+       1,
+#define JAVA_F2D              141
+#define ICMD_F2D              141
+       1,
+#define JAVA_D2I              142
+#define ICMD_D2I              142
+       1,
+#define JAVA_D2L              143
+#define ICMD_D2L              143
+       1,
+#define JAVA_D2F              144
+#define ICMD_D2F              144
+       1,
+#define JAVA_INT2BYTE         145
+#define ICMD_INT2BYTE         145
+       1,
+#define JAVA_INT2CHAR         146
+#define ICMD_INT2CHAR         146
+       1,
+#define JAVA_INT2SHORT        147
+#define ICMD_INT2SHORT        147
+       1,
+#define JAVA_LCMP             148
+#define ICMD_LCMP             148
+       1,
+#define JAVA_FCMPL            149
+#define ICMD_FCMPL            149
+       1,
+#define JAVA_FCMPG            150
+#define ICMD_FCMPG            150
+       1,
+#define JAVA_DCMPL            151
+#define ICMD_DCMPL            151
+       1,
+#define JAVA_DCMPG            152
+#define ICMD_DCMPG            152
+       1,
+#define JAVA_IFEQ             153
+#define ICMD_IFEQ             153       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFNE             154
+#define ICMD_IFNE             154       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFLT             155
+#define ICMD_IFLT             155       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFGE             156
+#define ICMD_IFGE             156       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFGT             157
+#define ICMD_IFGT             157       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IFLE             158
+#define ICMD_IFLE             158       /* op1 = target JavaVM pc, val.i      */
+       3,
+#define JAVA_IF_ICMPEQ        159
+#define ICMD_IF_ICMPEQ        159       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPNE        160
+#define ICMD_IF_ICMPNE        160       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPLT        161
+#define ICMD_IF_ICMPLT        161       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPGE        162
+#define ICMD_IF_ICMPGE        162       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPGT        163
+#define ICMD_IF_ICMPGT        163       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ICMPLE        164
+#define ICMD_IF_ICMPLE        164       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ACMPEQ        165
+#define ICMD_IF_ACMPEQ        165       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IF_ACMPNE        166
+#define ICMD_IF_ACMPNE        166       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_GOTO             167
+#define ICMD_GOTO             167       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_JSR              168
+#define ICMD_JSR              168       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_RET              169
+#define ICMD_RET              169       /* op1 = local variable               */
+       2,
+#define JAVA_TABLESWITCH      170
+#define ICMD_TABLESWITCH      170       /* val.a = pointer to s4 table        */
+       0,                                  /* length must be computed            */
+#define JAVA_LOOKUPSWITCH     171
+#define ICMD_LOOKUPSWITCH     171       /* val.a = pointer to s4 table        */
+       0,                                  /* length must be computed            */
+#define JAVA_IRETURN          172
+#define ICMD_IRETURN          172
+       1,
+#define JAVA_LRETURN          173
+#define ICMD_LRETURN          173
+       1,
+#define JAVA_FRETURN          174
+#define ICMD_FRETURN          174
+       1,
+#define JAVA_DRETURN          175
+#define ICMD_DRETURN          175
+       1,
+#define JAVA_ARETURN          176
+#define ICMD_ARETURN          176
+       1,
+#define JAVA_RETURN           177
+#define ICMD_RETURN           177
+       1,
+#define JAVA_GETSTATIC        178
+#define ICMD_GETSTATIC        178       /* op1 = type, val.a = field address  */
+       3,
+#define JAVA_PUTSTATIC        179
+#define ICMD_PUTSTATIC        179       /* op1 = type, val.a = field address  */
+       3,
+#define JAVA_GETFIELD         180
+#define ICMD_GETFIELD         180       /* op1 = type, val.i = field offset   */
+       3,
+#define JAVA_PUTFIELD         181
+#define ICMD_PUTFIELD         181       /* op1 = type, val.i = field offset   */
+       3,
+#define JAVA_INVOKEVIRTUAL    182
+#define ICMD_INVOKEVIRTUAL    182       /* val.a = method info pointer        */
+       3,
+#define JAVA_INVOKESPECIAL    183
+#define ICMD_INVOKESPECIAL    183       /* val.a = method info pointer        */
+       3,
+#define JAVA_INVOKESTATIC     184
+#define ICMD_INVOKESTATIC     184       /* val.a = method info pointer        */
+       3,
+#define JAVA_INVOKEINTERFACE  185
+#define ICMD_INVOKEINTERFACE  185       /* val.a = method info pointer        */
+       5,
+#define ICMD_CHECKASIZE       186       /*                                    */
+       1, /* unused */
+#define JAVA_NEW              187
+#define ICMD_NEW              187       /* op1 = 1, val.a = class pointer     */
+       3,
+#define JAVA_NEWARRAY         188
+#define ICMD_NEWARRAY         188       /* op1 = basic type                   */
+       2,
+#define JAVA_ANEWARRAY        189
+#define ICMD_ANEWARRAY        189       /* op1 = 0, val.a = array pointer     */
+       3,                                  /* op1 = 1, val.a = class pointer     */
+#define JAVA_ARRAYLENGTH      190
+#define ICMD_ARRAYLENGTH      190
+       1,
+#define JAVA_ATHROW           191
+#define ICMD_ATHROW           191
+       1,
+#define JAVA_CHECKCAST        192
+#define ICMD_CHECKCAST        192       /* op1 = 0, val.a = array pointer     */
+       3,                                  /* op1 = 1, val.a = class pointer     */
+#define JAVA_INSTANCEOF       193
+#define ICMD_INSTANCEOF       193       /* op1 = 0, val.a = array pointer     */
+       3,                                  /* op1 = 1, val.a = class pointer     */
+#define JAVA_MONITORENTER     194
+#define ICMD_MONITORENTER     194
+       1,
+#define JAVA_MONITOREXIT      195
+#define ICMD_MONITOREXIT      195
+       1,
+#define JAVA_WIDE             196
+       0, /* length must be computed */
+#define JAVA_MULTIANEWARRAY   197
+#define ICMD_MULTIANEWARRAY   197       /* op1 = dimension, val.a = array     */
+       4,                                  /* pointer                            */
+#define JAVA_IFNULL           198
+#define ICMD_IFNULL           198       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_IFNONNULL        199
+#define ICMD_IFNONNULL        199       /* op1 = target JavaVM pc             */
+       3,
+#define JAVA_GOTO_W           200
+       5,
+#define JAVA_JSR_W            201
+       5,
+#define JAVA_BREAKPOINT       202
+       1,
+
+           1,1,1,1,1,1,1,1,            /* unused */
+       1,1,1,1,1,1,1,1,1,1,
+       1,1,1,1,1,1,1,1,1,1,
+       1,1,1,1,1,1,1,1,1,1,
+       1,1,1,1,1,1,1,1,1,1,
+       1,1,1,1,1
+};
+
+
+char *icmd_names[256] = {
+       "NOP          ", /*               0 */
+       "ACONST       ", /*               1 */
+       "NULLCHECKPOP ", /* ICONST_M1     2 */
+       "ICONST       ", /*               3 */
+       "IREM0X10001  ", /* ICONST_1      4 */
+       "IDIVPOW2     ", /* ICONST_2      5 */
+       "LDIVPOW2     ", /* ICONST_3      6 */
+       "UNDEF__7     ", /* ICONST_4      7 */
+       "LREM0X10001  ", /* ICONST_5      8 */
+       "LCONST       ", /*               9 */
+       "LCMPCONST    ", /* LCONST_1     10 */
+       "FCONST       ", /*              11 */
+       "UNDEF_12     ", /* FCONST_1     12 */
+       "ELSE_ICONST  ", /* FCONST_2     13 */
+       "DCONST       ", /*              14 */
+       "IFEQ_ICONST  ", /* DCONST_1     15 */
+       "IFNE_ICONST  ", /* BIPUSH       16 */
+       "IFLT_ICONST  ", /* SIPUSH       17 */
+       "IFGE_ICONST  ", /* LDC1         18 */
+       "IFGT_ICONST  ", /* LDC2         19 */
+       "IFLE_ICONST  ", /* LDC2W        20 */
+       "ILOAD        ", /*              21 */
+       "LLOAD        ", /*              22 */
+       "FLOAD        ", /*              23 */
+       "DLOAD        ", /*              24 */
+       "ALOAD        ", /*              25 */
+       "IADDCONST    ", /* ILOAD_0      26 */
+       "ISUBCONST    ", /* ILOAD_1      27 */
+       "IMULCONST    ", /* ILOAD_2      28 */
+       "IANDCONST    ", /* ILOAD_3      29 */
+       "IORCONST     ", /* LLOAD_0      30 */
+       "IXORCONST    ", /* LLOAD_1      31 */
+       "ISHLCONST    ", /* LLOAD_2      32 */
+       "ISHRCONST    ", /* LLOAD_3      33 */
+       "IUSHRCONST   ", /* FLOAD_0      34 */
+       "IREMPOW2     ", /* FLOAD_1      35 */
+       "LADDCONST    ", /* FLOAD_2      36 */
+       "LSUBCONST    ", /* FLOAD_3      37 */
+       "LMULCONST    ", /* DLOAD_0      38 */
+       "LANDCONST    ", /* DLOAD_1      39 */
+       "LORCONST     ", /* DLOAD_2      40 */
+       "LXORCONST    ", /* DLOAD_3      41 */
+       "LSHLCONST    ", /* ALOAD_0      42 */
+       "LSHRCONST    ", /* ALOAD_1      43 */
+       "LUSHRCONST   ", /* ALOAD_2      44 */
+       "LREMPOW2     ", /* ALOAD_3      45 */
+       "IALOAD       ", /*              46 */
+       "LALOAD       ", /*              47 */
+       "FALOAD       ", /*              48 */
+       "DALOAD       ", /*              49 */
+       "AALOAD       ", /*              50 */
+       "BALOAD       ", /*              51 */
+       "CALOAD       ", /*              52 */
+       "SALOAD       ", /*              53 */
+       "ISTORE       ", /*              54 */
+       "LSTORE       ", /*              55 */
+       "FSTORE       ", /*              56 */
+       "DSTORE       ", /*              57 */
+       "ASTORE       ", /*              58 */
+       "IF_LEQ       ", /* ISTORE_0     59 */
+       "IF_LNE       ", /* ISTORE_1     60 */
+       "IF_LLT       ", /* ISTORE_2     61 */
+       "IF_LGE       ", /* ISTORE_3     62 */
+       "IF_LGT       ", /* LSTORE_0     63 */
+       "IF_LLE       ", /* LSTORE_1     64 */
+       "IF_LCMPEQ    ", /* LSTORE_2     65 */
+       "IF_LCMPNE    ", /* LSTORE_3     66 */
+       "IF_LCMPLT    ", /* FSTORE_0     67 */
+       "IF_LCMPGE    ", /* FSTORE_1     68 */
+       "IF_LCMPGT    ", /* FSTORE_2     69 */
+       "IF_LCMPLE    ", /* FSTORE_3     70 */
+       "UNDEF_71     ", /* DSTORE_0     71 */
+       "UNDEF_72     ", /* DSTORE_1     72 */
+       "UNDEF_73     ", /* DSTORE_2     73 */
+       "UNDEF_74     ", /* DSTORE_3     74 */
+       "UNDEF_75     ", /* ASTORE_0     75 */
+       "UNDEF_76     ", /* ASTORE_1     76 */
+       "UNDEF_77     ", /* ASTORE_2     77 */
+       "UNDEF_78     ", /* ASTORE_3     78 */
+       "IASTORE      ", /*              79 */
+       "LASTORE      ", /*              80 */
+       "FASTORE      ", /*              81 */
+       "DASTORE      ", /*              82 */
+       "AASTORE      ", /*              83 */
+       "BASTORE      ", /*              84 */
+       "CASTORE      ", /*              85 */
+       "SASTORE      ", /*              86 */
+       "POP          ", /*              87 */
+       "POP2         ", /*              88 */
+       "DUP          ", /*              89 */
+       "DUP_X1       ", /*              90 */
+       "DUP_X2       ", /*              91 */
+       "DUP2         ", /*              92 */
+       "DUP2_X1      ", /*              93 */
+       "DUP2_X2      ", /*              94 */
+       "SWAP         ", /*              95 */
+       "IADD         ", /*              96 */
+       "LADD         ", /*              97 */
+       "FADD         ", /*              98 */
+       "DADD         ", /*              99 */
+       "ISUB         ", /*             100 */
+       "LSUB         ", /*             101 */
+       "FSUB         ", /*             102 */
+       "DSUB         ", /*             103 */
+       "IMUL         ", /*             104 */
+       "LMUL         ", /*             105 */
+       "FMUL         ", /*             106 */
+       "DMUL         ", /*             107 */
+       "IDIV         ", /*             108 */
+       "LDIV         ", /*             109 */
+       "FDIV         ", /*             110 */
+       "DDIV         ", /*             111 */
+       "IREM         ", /*             112 */
+       "LREM         ", /*             113 */
+       "FREM         ", /*             114 */
+       "DREM         ", /*             115 */
+       "INEG         ", /*             116 */
+       "LNEG         ", /*             117 */
+       "FNEG         ", /*             118 */
+       "DNEG         ", /*             119 */
+       "ISHL         ", /*             120 */
+       "LSHL         ", /*             121 */
+       "ISHR         ", /*             122 */
+       "LSHR         ", /*             123 */
+       "IUSHR        ", /*             124 */
+       "LUSHR        ", /*             125 */
+       "IAND         ", /*             126 */
+       "LAND         ", /*             127 */
+       "IOR          ", /*             128 */
+       "LOR          ", /*             129 */
+       "IXOR         ", /*             130 */
+       "LXOR         ", /*             131 */
+       "IINC         ", /*             132 */
+       "I2L          ", /*             133 */
+       "I2F          ", /*             134 */
+       "I2D          ", /*             135 */
+       "L2I          ", /*             136 */
+       "L2F          ", /*             137 */
+       "L2D          ", /*             138 */
+       "F2I          ", /*             139 */
+       "F2L          ", /*             140 */
+       "F2D          ", /*             141 */
+       "D2I          ", /*             142 */
+       "D2L          ", /*             143 */
+       "D2F          ", /*             144 */
+       "INT2BYTE     ", /*             145 */
+       "INT2CHAR     ", /*             146 */
+       "INT2SHORT    ", /*             147 */
+       "LCMP         ", /*             148 */
+       "FCMPL        ", /*             149 */
+       "FCMPG        ", /*             150 */
+       "DCMPL        ", /*             151 */
+       "DCMPG        ", /*             152 */
+       "IFEQ         ", /*             153 */
+       "IFNE         ", /*             154 */
+       "IFLT         ", /*             155 */
+       "IFGE         ", /*             156 */
+       "IFGT         ", /*             157 */
+       "IFLE         ", /*             158 */
+       "IF_ICMPEQ    ", /*             159 */
+       "IF_ICMPNE    ", /*             160 */
+       "IF_ICMPLT    ", /*             161 */
+       "IF_ICMPGE    ", /*             162 */
+       "IF_ICMPGT    ", /*             163 */
+       "IF_ICMPLE    ", /*             164 */
+       "IF_ACMPEQ    ", /*             165 */
+       "IF_ACMPNE    ", /*             166 */
+       "GOTO         ", /*             167 */
+       "JSR          ", /*             168 */
+       "RET          ", /*             169 */
+       "TABLESWITCH  ", /*             170 */
+       "LOOKUPSWITCH ", /*             171 */
+       "IRETURN      ", /*             172 */
+       "LRETURN      ", /*             173 */
+       "FRETURN      ", /*             174 */
+       "DRETURN      ", /*             175 */
+       "ARETURN      ", /*             176 */
+       "RETURN       ", /*             177 */
+       "GETSTATIC    ", /*             178 */
+       "PUTSTATIC    ", /*             179 */
+       "GETFIELD     ", /*             180 */
+       "PUTFIELD     ", /*             181 */
+       "INVOKEVIRTUAL", /*             182 */
+       "INVOKESPECIAL", /*             183 */
+       "INVOKESTATIC ", /*             184 */
+       "INVOKEINTERFACE",/*            185 */
+       "CHECKASIZE   ", /* UNDEF186    186 */
+       "NEW          ", /*             187 */
+       "NEWARRAY     ", /*             188 */
+       "ANEWARRAY    ", /*             189 */
+       "ARRAYLENGTH  ", /*             190 */
+       "ATHROW       ", /*             191 */
+       "CHECKCAST    ", /*             192 */
+       "INSTANCEOF   ", /*             193 */
+       "MONITORENTER ", /*             194 */
+       "MONITOREXIT  ", /*             195 */
+       "UNDEF196     ", /* WIDE        196 */
+       "MULTIANEWARRAY",/*             197 */
+       "IFNULL       ", /*             198 */
+       "IFNONNULL    ", /*             199 */
+       "UNDEF200     ", /* GOTO_W      200 */
+       "UNDEF201     ", /* JSR_W       201 */
+       "UNDEF202     ", /* BREAKPOINT  202 */
+
+                             "UNDEF203","UNDEF204","UNDEF205",
+       "UNDEF206","UNDEF207","UNDEF208","UNDEF209","UNDEF210",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF216","UNDEF217","UNDEF218","UNDEF219","UNDEF220",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF226","UNDEF227","UNDEF228","UNDEF229","UNDEF230",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
+       "UNDEF251","UNDEF252",
+
+       "BUILTIN3     ", /*             253 */
+       "BUILTIN2     ", /*             254 */
+       "BUILTIN1     "  /*             255 */
+};
+
+
+char *opcode_names[256] = {
+       "NOP          ", /*               0 */
+       "ACONST       ", /*               1 */
+       "ICONST_M1    ", /* ICONST_M1     2 */
+       "ICONST_0     ", /* ICONST_0      3 */
+       "ICONST_1     ", /* ICONST_1      4 */
+       "ICONST_2     ", /* ICONST_2      5 */
+       "ICONST_3     ", /* ICONST_3      6 */
+       "ICONST_4     ", /* ICONST_4      7 */
+       "ICONST_5     ", /* ICONST_5      8 */
+       "LCONST_0     ", /* LCONST_0      9 */
+       "LCONST_1     ", /* LCONST_1     10 */
+       "FCONST_0     ", /* FCONST_0     11 */
+       "FCONST_1     ", /* FCONST_1     12 */
+       "FCONST_2     ", /* FCONST_2     13 */
+       "DCONST_0     ", /* DCONST_0     14 */
+       "DCONST_1     ", /* DCONST_1     15 */
+       "BIPUSH       ", /* BIPUSH       16 */
+       "SIPUSH       ", /* SIPUSH       17 */
+       "LDC          ", /* LDC          18 */
+       "LDC_W        ", /* LDC_W        19 */
+       "LDC2_W       ", /* LDC2_W       20 */
+       "ILOAD        ", /*              21 */
+       "LLOAD        ", /*              22 */
+       "FLOAD        ", /*              23 */
+       "DLOAD        ", /*              24 */
+       "ALOAD        ", /*              25 */
+       "ILOAD_0      ", /* ILOAD_0      26 */
+       "ILOAD_1      ", /* ILOAD_1      27 */
+       "ILOAD_2      ", /* ILOAD_2      28 */
+       "ILOAD_3      ", /* ILOAD_3      29 */
+       "LLOAD_0      ", /* LLOAD_0      30 */
+       "LLOAD_1      ", /* LLOAD_1      31 */
+       "LLOAD_2      ", /* LLOAD_2      32 */
+       "LLOAD_3      ", /* LLOAD_3      33 */
+       "FLOAD_0      ", /* FLOAD_0      34 */
+       "FLOAD_1      ", /* FLOAD_1      35 */
+       "FLOAD_2      ", /* FLOAD_2      36 */
+       "FLOAD_3      ", /* FLOAD_3      37 */
+       "DLOAD_0      ", /* DLOAD_0      38 */
+       "DLOAD_1      ", /* DLOAD_1      39 */
+       "DLOAD_2      ", /* DLOAD_2      40 */ 
+       "DLOAD_3      ", /* DLOAD_3      41 */
+       "ALOAD_0      ", /* ALOAD_0      42 */
+       "ALOAD_1      ", /* ALOAD_1      43 */
+       "ALOAD_2      ", /* ALOAD_2      44 */
+       "ALOAD_3      ", /* ALOAD_3      45 */
+       "IALOAD       ", /*              46 */
+       "LALOAD       ", /*              47 */
+       "FALOAD       ", /*              48 */
+       "DALOAD       ", /*              49 */
+       "AALOAD       ", /*              50 */
+       "BALOAD       ", /*              51 */
+       "CALOAD       ", /*              52 */
+       "SALOAD       ", /*              53 */
+       "ISTORE       ", /*              54 */
+       "LSTORE       ", /*              55 */
+       "FSTORE       ", /*              56 */
+       "DSTORE       ", /*              57 */
+       "ASTORE       ", /*              58 */
+       "ISTORE_0     ", /* ISTORE_0     59 */
+       "ISTORE_1     ", /* ISTORE_1     60 */
+       "ISTORE_2     ", /* ISTORE_2     61 */
+       "ISTORE_3     ", /* ISTORE_3     62 */
+       "LSTORE_0     ", /* LSTORE_0     63 */
+       "LSTORE_1     ", /* LSTORE_1     64 */
+       "LSTORE_2     ", /* LSTORE_2     65 */
+       "LSTORE_3     ", /* LSTORE_3     66 */
+       "FSTORE_0     ", /* FSTORE_0     67 */
+       "FSTORE_1     ", /* FSTORE_1     68 */
+       "FSTORE_2     ", /* FSTORE_2     69 */
+       "FSTORE_3     ", /* FSTORE_3     70 */
+       "DSTORE_0     ", /* DSTORE_0     71 */
+       "DSTORE_1     ", /* DSTORE_1     72 */
+       "DSTORE_2     ", /* DSTORE_2     73 */
+       "DSTORE_3     ", /* DSTORE_3     74 */
+       "ASTORE_0     ", /* ASTORE_0     75 */
+       "ASTORE_1     ", /* ASTORE_1     76 */
+       "ASTORE_2     ", /* ASTORE_2     77 */
+       "ASTORE_3     ", /* ASTORE_3     78 */
+       "IASTORE      ", /*              79 */
+       "LASTORE      ", /*              80 */
+       "FASTORE      ", /*              81 */
+       "DASTORE      ", /*              82 */
+       "AASTORE      ", /*              83 */
+       "BASTORE      ", /*              84 */
+       "CASTORE      ", /*              85 */
+       "SASTORE      ", /*              86 */
+       "POP          ", /*              87 */
+       "POP2         ", /*              88 */
+       "DUP          ", /*              89 */
+       "DUP_X1       ", /*              90 */
+       "DUP_X2       ", /*              91 */
+       "DUP2         ", /*              92 */
+       "DUP2_X1      ", /*              93 */
+       "DUP2_X2      ", /*              94 */
+       "SWAP         ", /*              95 */
+       "IADD         ", /*              96 */
+       "LADD         ", /*              97 */
+       "FADD         ", /*              98 */
+       "DADD         ", /*              99 */
+       "ISUB         ", /*             100 */
+       "LSUB         ", /*             101 */
+       "FSUB         ", /*             102 */
+       "DSUB         ", /*             103 */
+       "IMUL         ", /*             104 */
+       "LMUL         ", /*             105 */
+       "FMUL         ", /*             106 */
+       "DMUL         ", /*             107 */
+       "IDIV         ", /*             108 */
+       "LDIV         ", /*             109 */
+       "FDIV         ", /*             110 */
+       "DDIV         ", /*             111 */
+       "IREM         ", /*             112 */
+       "LREM         ", /*             113 */
+       "FREM         ", /*             114 */
+       "DREM         ", /*             115 */
+       "INEG         ", /*             116 */
+       "LNEG         ", /*             117 */
+       "FNEG         ", /*             118 */
+       "DNEG         ", /*             119 */
+       "ISHL         ", /*             120 */
+       "LSHL         ", /*             121 */
+       "ISHR         ", /*             122 */
+       "LSHR         ", /*             123 */
+       "IUSHR        ", /*             124 */
+       "LUSHR        ", /*             125 */
+       "IAND         ", /*             126 */
+       "LAND         ", /*             127 */
+       "IOR          ", /*             128 */
+       "LOR          ", /*             129 */
+       "IXOR         ", /*             130 */
+       "LXOR         ", /*             131 */
+       "IINC         ", /*             132 */
+       "I2L          ", /*             133 */
+       "I2F          ", /*             134 */
+       "I2D          ", /*             135 */
+       "L2I          ", /*             136 */
+       "L2F          ", /*             137 */
+       "L2D          ", /*             138 */
+       "F2I          ", /*             139 */
+       "F2L          ", /*             140 */
+       "F2D          ", /*             141 */
+       "D2I          ", /*             142 */
+       "D2L          ", /*             143 */
+       "D2F          ", /*             144 */
+       "INT2BYTE     ", /*             145 */
+       "INT2CHAR     ", /*             146 */
+       "INT2SHORT    ", /*             147 */
+       "LCMP         ", /*             148 */
+       "FCMPL        ", /*             149 */
+       "FCMPG        ", /*             150 */
+       "DCMPL        ", /*             151 */
+       "DCMPG        ", /*             152 */
+       "IFEQ         ", /*             153 */
+       "IFNE         ", /*             154 */
+       "IFLT         ", /*             155 */
+       "IFGE         ", /*             156 */
+       "IFGT         ", /*             157 */
+       "IFLE         ", /*             158 */
+       "IF_ICMPEQ    ", /*             159 */
+       "IF_ICMPNE    ", /*             160 */
+       "IF_ICMPLT    ", /*             161 */
+       "IF_ICMPGE    ", /*             162 */
+       "IF_ICMPGT    ", /*             163 */
+       "IF_ICMPLE    ", /*             164 */
+       "IF_ACMPEQ    ", /*             165 */
+       "IF_ACMPNE    ", /*             166 */
+       "GOTO         ", /*             167 */
+       "JSR          ", /*             168 */
+       "RET          ", /*             169 */
+       "TABLESWITCH  ", /*             170 */
+       "LOOKUPSWITCH ", /*             171 */
+       "IRETURN      ", /*             172 */
+       "LRETURN      ", /*             173 */
+       "FRETURN      ", /*             174 */
+       "DRETURN      ", /*             175 */
+       "ARETURN      ", /*             176 */
+       "RETURN       ", /*             177 */
+       "GETSTATIC    ", /*             178 */
+       "PUTSTATIC    ", /*             179 */
+       "GETFIELD     ", /*             180 */
+       "PUTFIELD     ", /*             181 */
+       "INVOKEVIRTUAL", /*             182 */
+       "INVOKESPECIAL", /*             183 */
+       "INVOKESTATIC ", /*             184 */
+       "INVOKEINTERFACE",/*            185 */
+       "CHECKASIZE   ", /* UNDEF186    186 */
+       "NEW          ", /*             187 */
+       "NEWARRAY     ", /*             188 */
+       "ANEWARRAY    ", /*             189 */
+       "ARRAYLENGTH  ", /*             190 */
+       "ATHROW       ", /*             191 */
+       "CHECKCAST    ", /*             192 */
+       "INSTANCEOF   ", /*             193 */
+       "MONITORENTER ", /*             194 */
+       "MONITOREXIT  ", /*             195 */
+       "WIDE         ", /* WIDE        196 */
+       "MULTIANEWARRAY",/*             197 */
+       "IFNULL       ", /*             198 */
+       "IFNONNULL    ", /*             199 */
+       "GOTO_W       ", /* GOTO_W      200 */
+       "JSR_W        ", /* JSR_W       201 */
+       "BREAKPOINT   ", /* BREAKPOINT  202 */
+
+                             "UNDEF203","UNDEF204","UNDEF205",
+       "UNDEF206","UNDEF207","UNDEF208","UNDEF209","UNDEF210",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF216","UNDEF217","UNDEF218","UNDEF219","UNDEF220",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF226","UNDEF227","UNDEF228","UNDEF229","UNDEF230",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
+       "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
+       "UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
+       "UNDEF251","UNDEF252",
+
+       "BUILTIN3     ", /*             253 */
+       "BUILTIN2     ", /*             254 */
+       "BUILTIN1     "  /*             255 */
+};
+
+
+/* include compiler subsystems ************************************************/
+
+/* from codegen.inc */
+extern int dseglen;
+
+
+/* dummy function, used when there is no JavaVM code available                */
+
+static void* do_nothing_function()
+{
+       return NULL;
+}
+
+
+/* jit_compile *****************************************************************
+
+       jit_compile, new version of compiler, translates one method to machine code
+
+*******************************************************************************/
+
+methodptr jit_compile(methodinfo *m)
+{
+       int dumpsize;
+       long starttime = 0;
+       long stoptime  = 0;
+
+       count_jit_calls++;
+
+       /* if method has been already compiled return immediately */
+
+       if (m->entrypoint)
+               return m->entrypoint;
+
+       count_methods++;
+
+       intsDisable();      /* disable interrupts */
+       
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size ();
+
+       /* measure time */
+
+       if (getcompilingtime)
+               starttime = getcputime();
+
+       /* if there is no javacode print error message and return empty method    */
+
+       if (!m->jcode) {
+               sprintf(logtext, "No code given for: ");
+               utf_sprint(logtext+strlen(logtext), m->class->name);
+               strcpy(logtext+strlen(logtext), ".");
+               utf_sprint(logtext+strlen(logtext), m->name);
+               utf_sprint(logtext+strlen(logtext), m->descriptor);
+               dolog();
+               intsRestore();                             /* enable interrupts again */
+               return (methodptr) do_nothing_function;    /* return empty method     */
+       }
+
+       /* print log message for compiled method */
+
+       if (compileverbose) {
+               sprintf(logtext, "Compiling: ");
+               utf_sprint(logtext+strlen(logtext), m->class->name);
+               strcpy(logtext+strlen(logtext), ".");
+               utf_sprint(logtext+strlen(logtext), m->name);
+               utf_sprint(logtext+strlen(logtext), m->descriptor);
+               dolog();
+       }
+
+
+       /* initialisation of variables and subsystems */
+
+       isleafmethod = true;
+
+       method = m;
+       class = m->class;
+       descriptor = m->descriptor;
+       maxstack = m->maxstack;
+       maxlocals = m->maxlocals;
+       jcodelength = m->jcodelength;
+       jcode = m->jcode;
+       exceptiontablelength = m->exceptiontablelength;
+       raw_extable = m->exceptiontable;
+
+#ifdef STATISTICS
+       count_tryblocks += exceptiontablelength;
+       count_javacodesize += jcodelength + 18;
+       count_javaexcsize += exceptiontablelength * POINTERSIZE;
+#endif
+
+       /* initialise parameter type descriptor */
+
+       descriptor2types(m);
+       mreturntype = m->returntype;
+       mparamcount = m->paramcount;
+       mparamtypes = m->paramtypes;
+
+       /* initialize class list with class the compiled method belongs to */
+
+       uninitializedclasses = chain_new(); 
+       compiler_addinitclass(m->class);
+
+
+       /* call the compiler passes ***********************************************/
+       
+       reg_init();
+
+       if (useinlining) inlining_init();
+
+       codegen_init();
+
+       parse();
+       analyse_stack();
+   
+       if (opt_loops) {
+               depthFirst();
+               analyseGraph();         
+               optimize_loops();
+       }
+   
+#ifdef SPECIALMEMUSE
+       preregpass();
+#endif
+
+       regalloc();
+       codegen();
+
+       /* intermediate and assembly code listings ********************************/
+               
+       if (showintermediate)
+               show_icmd_method();
+       else if (showdisassemble)
+               disassemble((void*) (m->mcode + dseglen), m->mcodelength - dseglen);
+
+       if (showddatasegment)
+               dseg_display((void*) (m->mcode));
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       /* measure time */
+
+       if (getcompilingtime) {
+               stoptime = getcputime();
+               compilingtime += (stoptime-starttime); 
+       }
+
+       /* initialize all used classes */
+       /* because of reentrant code global variables are not allowed here        */
+
+       {
+               chain *ul = uninitializedclasses;   /* list of uninitialized classes      */ 
+               classinfo *c;                       /* single class                       */
+
+               while ((c = chain_first(ul)) != NULL) {
+                       chain_remove (ul);
+                       class_init (c);                         /* may again call the compiler        */
+               }
+               chain_free (ul);
+       }
+
+       intsRestore();    /* enable interrupts again */
+
+       /* return pointer to the methods entry point */
+       
+       return m->entrypoint;
+} 
+
+
+
+/* functions for compiler initialisation and finalisation *********************/
+
+#ifdef USEBUILTINTABLE
+static int stdopcompare(const void *a, const void *b)
+{
+       stdopdescriptor *o1 = (stdopdescriptor *) a;
+       stdopdescriptor *o2 = (stdopdescriptor *) b;
+       return (o1->opcode < o2->opcode) ? -1 : (o1->opcode > o2->opcode);
+}
+
+
+
+static inline void testsort()
+{
+       int len;
+
+       len = sizeof(stdopdescriptortable) / sizeof(stdopdescriptor);
+       qsort(stdopdescriptortable, len, sizeof(stdopdescriptor), stdopcompare);
+       len = sizeof(builtintable) / sizeof(stdopdescriptor);
+       qsort(builtintable, len, sizeof(stdopdescriptor), stdopcompare);
+}
+#endif
+
+
+
+void jit_init()
+{
+       int i;
+
+#ifdef USEBUILTINTABLE
+       testsort();
+#endif
+
+#if defined(__ALPHA__)
+       has_ext_instr_set = ! has_no_x_instr_set();
+#endif
+
+       for (i = 0; i < 256; i++)
+               stackreq[i] = 1;
+
+       stackreq[JAVA_NOP]          = 0;
+       stackreq[JAVA_ISTORE]       = 0;
+       stackreq[JAVA_LSTORE]       = 0;
+       stackreq[JAVA_FSTORE]       = 0;
+       stackreq[JAVA_DSTORE]       = 0;
+       stackreq[JAVA_ASTORE]       = 0;
+       stackreq[JAVA_ISTORE_0]     = 0;
+       stackreq[JAVA_ISTORE_1]     = 0;
+       stackreq[JAVA_ISTORE_2]     = 0;
+       stackreq[JAVA_ISTORE_3]     = 0;
+       stackreq[JAVA_LSTORE_0]     = 0;
+       stackreq[JAVA_LSTORE_1]     = 0;
+       stackreq[JAVA_LSTORE_2]     = 0;
+       stackreq[JAVA_LSTORE_3]     = 0;
+       stackreq[JAVA_FSTORE_0]     = 0;
+       stackreq[JAVA_FSTORE_1]     = 0;
+       stackreq[JAVA_FSTORE_2]     = 0;
+       stackreq[JAVA_FSTORE_3]     = 0;
+       stackreq[JAVA_DSTORE_0]     = 0;
+       stackreq[JAVA_DSTORE_1]     = 0;
+       stackreq[JAVA_DSTORE_2]     = 0;
+       stackreq[JAVA_DSTORE_3]     = 0;
+       stackreq[JAVA_ASTORE_0]     = 0;
+       stackreq[JAVA_ASTORE_1]     = 0;
+       stackreq[JAVA_ASTORE_2]     = 0;
+       stackreq[JAVA_ASTORE_3]     = 0;
+       stackreq[JAVA_IASTORE]      = 0;
+       stackreq[JAVA_LASTORE]      = 0;
+       stackreq[JAVA_FASTORE]      = 0;
+       stackreq[JAVA_DASTORE]      = 0;
+       stackreq[JAVA_AASTORE]      = 0;
+       stackreq[JAVA_BASTORE]      = 0;
+       stackreq[JAVA_CASTORE]      = 0;
+       stackreq[JAVA_SASTORE]      = 0;
+       stackreq[JAVA_POP]          = 0;
+       stackreq[JAVA_POP2]         = 0;
+       stackreq[JAVA_IINC]         = 0;
+       stackreq[JAVA_IFEQ]         = 0;
+       stackreq[JAVA_IFNE]         = 0;
+       stackreq[JAVA_IFLT]         = 0;
+       stackreq[JAVA_IFGE]         = 0;
+       stackreq[JAVA_IFGT]         = 0;
+       stackreq[JAVA_IFLE]         = 0;
+       stackreq[JAVA_IF_ICMPEQ]    = 0;
+       stackreq[JAVA_IF_ICMPNE]    = 0;
+       stackreq[JAVA_IF_ICMPLT]    = 0;
+       stackreq[JAVA_IF_ICMPGE]    = 0;
+       stackreq[JAVA_IF_ICMPGT]    = 0;
+       stackreq[JAVA_IF_ICMPLE]    = 0;
+       stackreq[JAVA_IF_ACMPEQ]    = 0;
+       stackreq[JAVA_IF_ACMPNE]    = 0;
+       stackreq[JAVA_GOTO]         = 0;
+       stackreq[JAVA_RET]          = 0;
+       stackreq[JAVA_TABLESWITCH]  = 0;
+       stackreq[JAVA_LOOKUPSWITCH] = 0;
+       stackreq[JAVA_IRETURN]      = 0;
+       stackreq[JAVA_LRETURN]      = 0;
+       stackreq[JAVA_FRETURN]      = 0;
+       stackreq[JAVA_DRETURN]      = 0;
+       stackreq[JAVA_ARETURN]      = 0;
+       stackreq[JAVA_RETURN]       = 0;
+       stackreq[JAVA_PUTSTATIC]    = 0;
+       stackreq[JAVA_PUTFIELD]     = 0;
+       stackreq[JAVA_MONITORENTER] = 0;
+       stackreq[JAVA_MONITOREXIT]  = 0;
+       stackreq[JAVA_WIDE]         = 0;
+       stackreq[JAVA_IFNULL]       = 0;
+       stackreq[JAVA_IFNONNULL]    = 0;
+       stackreq[JAVA_GOTO_W]       = 0;
+       stackreq[JAVA_BREAKPOINT]   = 0;
+
+       stackreq[JAVA_SWAP] = 2;
+       stackreq[JAVA_DUP2] = 2;
+       stackreq[JAVA_DUP_X1] = 3;
+       stackreq[JAVA_DUP_X2] = 4;
+       stackreq[JAVA_DUP2_X1] = 3;
+       stackreq[JAVA_DUP2_X2] = 4;
+       
+       init_exceptions();
+}
+
+
+
+void jit_close()
+{
+       codegen_close();
+       reg_close();
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/jit.h b/src/vm/jit/jit.h
new file mode 100644 (file)
index 0000000..f69a365
--- /dev/null
@@ -0,0 +1,1024 @@
+/* jit/jit.h - code generation header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Reinhard Grafl
+
+   Changes: Christian Thalinger
+
+   $Id: jit.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _JIT_H
+#define _JIT_H
+
+#include "global.h"
+#include "toolbox/chain.h"
+
+
+/**************************** resolve typedef-cycles **************************/
+
+typedef struct stackelement stackelement;
+typedef stackelement *stackptr;
+typedef struct basicblock basicblock;
+typedef struct instruction instruction;
+typedef struct subroutineinfo subroutineinfo;
+typedef struct varinfo varinfo;
+typedef struct branchref branchref;
+typedef struct jumpref jumpref;
+typedef struct dataref dataref;
+typedef varinfo *varinfoptr;
+
+
+/************************** stack element structure ***************************/
+
+/* slot types */
+
+#define TYPE_INT   0            /* the stack slot types must numbered in the  */
+#define TYPE_LNG   1            /* same order as the ICMD_Ixxx to ICMD_Axxx   */
+#define TYPE_FLT   2            /* instructions (LOAD and STORE)              */
+#define TYPE_DBL   3            /* integer, long, float, double, address      */
+#define TYPE_ADR   4
+
+#define IS_INT_LNG_TYPE(a)      (!((a)&TYPE_FLT))
+#define IS_FLT_DBL_TYPE(a)      ((a)&TYPE_FLT)
+#define IS_2_WORD_TYPE(a)       ((a)&TYPE_LNG)
+
+
+/* flags */
+
+#define SAVEDVAR   1            /* variable has to survive method invocations */
+#define INMEMORY   2            /* variable stored in memory                  */
+#define SAVEDTMP   4            /* temporary variable using a saved register  */
+
+/* variable kinds */
+
+#define UNDEFVAR   0            /* stack slot will become temp during regalloc*/
+#define TEMPVAR    1            /* stack slot is temp register                */
+#define STACKVAR   2            /* stack slot is numbered stack slot          */
+#define LOCALVAR   3            /* stack slot is local variable               */
+#define ARGVAR     4            /* stack slot is argument variable            */
+
+
+struct stackelement {
+       stackptr prev;              /* pointer to next element towards bottom     */
+       int type;                   /* slot type of stack element                 */
+       int flags;                  /* flags (SAVED, INMEMORY)                    */
+       int varkind;                /* kind of variable or register               */
+       int varnum;                 /* number of variable                         */
+       int regoff;                 /* register number or memory offset           */
+};
+
+
+/**************************** instruction structure ***************************/
+
+struct instruction {
+       stackptr dst;               /* stack index of destination operand stack   */
+       u2  opc;                    /* opcode of intermediate code command        */
+       s4  op1;                    /* first operand, usually variable number     */
+
+       union {
+               s4 i;                   /* integer operand    */
+               s8 l;                   /* long operand       */
+               float f;                /* float operand      */
+               double d;               /* double operand     */
+               void *a;                /* address operand    */
+       } val;                  /* immediate constant */
+
+       void *target;                           /* used for targets of branches and jumps         */
+                                                               /* and as address for list of targets for         */
+                                                               /* statements                                                             */
+};
+
+
+/**************************** basic block structure ***************************/
+/*                    flags                                                   */
+
+#define BBDELETED  -2
+#define BBUNDEF    -1
+#define BBREACHED  0
+#define BBFINISHED 1
+
+#define BBTYPE_STD 0            /* standard basic block type                  */
+#define BBTYPE_EXH 1            /* exception handler basic block type         */
+#define BBTYPE_SBR 2            /* subroutine basic block type                */
+
+struct basicblock { 
+       int          flags;         /* used during stack analysis, init with -1   */
+       int          type;          /* basic block type (std, xhandler, subroutine*/
+       instruction *iinstr;        /* pointer to intermediate code instructions  */
+       int          icount;        /* number of intermediate code instructions   */
+       int          mpc;           /* machine code pc at start of block          */
+       stackptr     instack;       /* stack at begin of basic block              */
+       stackptr     outstack;      /* stack at end of basic block                */
+       int          indepth;       /* stack depth at begin of basic block        */
+       int          outdepth;      /* stack depth end of basic block             */
+       int          pre_count;     /* count of predecessor basic blocks          */
+       branchref   *branchrefs;    /* list of branches to be patched             */
+
+       basicblock  *next;          /* used to build a BB list (instead of array) */
+       int          lflags;        /* used during loop copying, init with 0      */
+       basicblock  *copied_to;     /* points to the copy of this basic block     */
+                                /* when loop nodes are copied                 */
+       int debug_nr;
+};
+
+
+/************************* pseudo variable structure **************************/
+
+struct varinfo {
+       int type;                   /* basic type of variable                     */
+       int flags;                  /* flags (SAVED, INMEMORY)                    */
+       int regoff;                 /* register number or memory offset           */
+};
+
+typedef varinfo varinfo5[5];
+
+
+/***************** forward references in branch instructions ******************/
+
+struct branchref {
+       s4 branchpos;               /* patching position in code segment          */
+       branchref *next;            /* next element in branchref list             */
+};
+
+
+/******************** forward references in tables  ***************************/
+
+struct jumpref {
+       s4 tablepos;                /* patching position in data segment          */
+       basicblock *target;         /* target basic block                         */
+       jumpref *next;              /* next element in jumpref list               */
+};
+
+
+struct dataref {
+       u1 *pos;                    /* patching position in generated code        */
+       dataref *next;              /* next element in dataref list               */
+};
+
+
+/********** JavaVM operation codes (sorted) and instruction lengths ***********/
+
+extern char *icmd_names[256];
+extern char *opcode_names[256];
+extern int jcommandsize[256];
+
+#define JAVA_NOP               0
+#define ICMD_NOP               0
+
+#define JAVA_ACONST_NULL       1
+#define ICMD_ACONST            1        /* val.a = constant                   */
+
+#define JAVA_ICONST_M1         2
+#define ICMD_NULLCHECKPOP      2
+
+#define JAVA_ICONST_0          3
+#define ICMD_ICONST            3        /* val.i = constant                   */
+
+#define JAVA_ICONST_1          4
+#define ICMD_IREM0X10001       4
+
+#define JAVA_ICONST_2          5
+#define ICMD_IDIVPOW2          5        /* val.i = constant                   */
+
+#define JAVA_ICONST_3          6
+#define ICMD_LDIVPOW2          6        /* val.l = constant                   */
+
+#define JAVA_ICONST_4          7
+
+#define JAVA_ICONST_5          8
+#define ICMD_LREM0X10001       8
+
+#define JAVA_LCONST_0          9
+#define ICMD_LCONST            9        /* val.l = constant                   */
+
+#define JAVA_LCONST_1         10
+#define ICMD_LCMPCONST        10        /* val.l = constant                   */
+
+#define JAVA_FCONST_0         11
+#define ICMD_FCONST           11        /* val.f = constant                   */
+
+#define JAVA_FCONST_1         12
+
+#define JAVA_FCONST_2         13
+#define ICMD_ELSE_ICONST      13
+
+#define JAVA_DCONST_0         14
+#define ICMD_DCONST           14        /* val.d = constant                   */
+
+#define JAVA_DCONST_1         15
+#define ICMD_IFEQ_ICONST      15
+
+#define JAVA_BIPUSH           16
+#define ICMD_IFNE_ICONST      16
+
+#define JAVA_SIPUSH           17
+#define ICMD_IFLT_ICONST      17
+
+#define JAVA_LDC1             18
+#define ICMD_IFGE_ICONST      18
+
+#define JAVA_LDC2             19
+#define ICMD_IFGT_ICONST      19
+
+#define JAVA_LDC2W            20
+#define ICMD_IFLE_ICONST      20
+
+                                           /* order of LOAD instructions must be */
+                                           /* equal to order of TYPE_XXX defines */
+#define JAVA_ILOAD            21
+#define ICMD_ILOAD            21        /* op1 = local variable               */
+
+#define JAVA_LLOAD            22
+#define ICMD_LLOAD            22        /* op1 = local variable               */
+
+#define JAVA_FLOAD            23
+#define ICMD_FLOAD            23        /* op1 = local variable               */
+
+#define JAVA_DLOAD            24
+#define ICMD_DLOAD            24        /* op1 = local variable               */
+
+#define JAVA_ALOAD            25
+#define ICMD_ALOAD            25        /* op1 = local variable               */
+
+#define JAVA_ILOAD_0          26
+#define ICMD_IADDCONST        26        /* val.i = constant                   */
+
+#define JAVA_ILOAD_1          27
+#define ICMD_ISUBCONST        27        /* val.i = constant                   */
+
+#define JAVA_ILOAD_2          28
+#define ICMD_IMULCONST        28        /* val.i = constant                   */
+
+#define JAVA_ILOAD_3          29
+#define ICMD_IANDCONST        29        /* val.i = constant                   */
+
+#define JAVA_LLOAD_0          30
+#define ICMD_IORCONST         30        /* val.i = constant                   */
+
+#define JAVA_LLOAD_1          31
+#define ICMD_IXORCONST        31        /* val.i = constant                   */
+
+#define JAVA_LLOAD_2          32
+#define ICMD_ISHLCONST        32        /* val.i = constant                   */
+
+#define JAVA_LLOAD_3          33
+#define ICMD_ISHRCONST        33        /* val.i = constant                   */
+
+#define JAVA_FLOAD_0          34
+#define ICMD_IUSHRCONST       34        /* val.i = constant                   */
+
+#define JAVA_FLOAD_1          35
+#define ICMD_IREMPOW2         35        /* val.i = constant                   */
+
+#define JAVA_FLOAD_2          36
+#define ICMD_LADDCONST        36        /* val.l = constant                   */
+
+#define JAVA_FLOAD_3          37
+#define ICMD_LSUBCONST        37        /* val.l = constant                   */
+
+#define JAVA_DLOAD_0          38
+#define ICMD_LMULCONST        38        /* val.l = constant                   */
+
+#define JAVA_DLOAD_1          39
+#define ICMD_LANDCONST        39        /* val.l = constant                   */
+
+#define JAVA_DLOAD_2          40
+#define ICMD_LORCONST         40        /* val.l = constant                   */
+
+#define JAVA_DLOAD_3          41
+#define ICMD_LXORCONST        41        /* val.l = constant                   */
+
+#define JAVA_ALOAD_0          42
+#define ICMD_LSHLCONST        42        /* val.l = constant                   */
+
+#define JAVA_ALOAD_1          43
+#define ICMD_LSHRCONST        43        /* val.l = constant                   */
+
+#define JAVA_ALOAD_2          44
+#define ICMD_LUSHRCONST       44        /* val.l = constant                   */
+
+#define JAVA_ALOAD_3          45
+#define ICMD_LREMPOW2         45        /* val.l = constant                   */
+
+#define JAVA_IALOAD           46
+#define ICMD_IALOAD           46
+
+#define JAVA_LALOAD           47
+#define ICMD_LALOAD           47
+
+#define JAVA_FALOAD           48
+#define ICMD_FALOAD           48
+
+#define JAVA_DALOAD           49
+#define ICMD_DALOAD           49
+
+#define JAVA_AALOAD           50
+#define ICMD_AALOAD           50
+
+#define JAVA_BALOAD           51
+#define ICMD_BALOAD           51
+
+#define JAVA_CALOAD           52
+#define ICMD_CALOAD           52
+
+#define JAVA_SALOAD           53
+#define ICMD_SALOAD           53
+
+                                           /* order of STORE instructions must be*/
+                                           /* equal to order of TYPE_XXX defines */
+#define JAVA_ISTORE           54
+#define ICMD_ISTORE           54        /* op1 = local variable               */
+
+#define JAVA_LSTORE           55
+#define ICMD_LSTORE           55        /* op1 = local variable               */
+
+#define JAVA_FSTORE           56
+#define ICMD_FSTORE           56        /* op1 = local variable               */
+
+#define JAVA_DSTORE           57
+#define ICMD_DSTORE           57        /* op1 = local variable               */
+
+#define JAVA_ASTORE           58
+#define ICMD_ASTORE           58        /* op1 = local variable               */
+
+#define JAVA_ISTORE_0         59
+#define ICMD_IF_LEQ           59        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_ISTORE_1         60
+#define ICMD_IF_LNE           60        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_ISTORE_2         61
+#define ICMD_IF_LLT           61        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_ISTORE_3         62
+#define ICMD_IF_LGE           62        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_LSTORE_0         63
+#define ICMD_IF_LGT           63        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_LSTORE_1         64
+#define ICMD_IF_LLE           64        /* op1 = target JavaVM pc, val.l      */
+
+#define JAVA_LSTORE_2         65
+#define ICMD_IF_LCMPEQ        65        /* op1 = target JavaVM pc             */
+
+#define JAVA_LSTORE_3         66
+#define ICMD_IF_LCMPNE        66        /* op1 = target JavaVM pc             */
+
+#define JAVA_FSTORE_0         67
+#define ICMD_IF_LCMPLT        67        /* op1 = target JavaVM pc             */
+
+#define JAVA_FSTORE_1         68
+#define ICMD_IF_LCMPGE        68        /* op1 = target JavaVM pc             */
+
+#define JAVA_FSTORE_2         69
+#define ICMD_IF_LCMPGT        69        /* op1 = target JavaVM pc             */
+
+#define JAVA_FSTORE_3         70
+#define ICMD_IF_LCMPLE        70        /* op1 = target JavaVM pc             */
+
+#define JAVA_DSTORE_0         71
+
+#define JAVA_DSTORE_1         72
+
+#define JAVA_DSTORE_2         73
+
+#define JAVA_DSTORE_3         74
+
+#define JAVA_ASTORE_0         75
+
+#define JAVA_ASTORE_1         76
+
+#define JAVA_ASTORE_2         77
+
+#define JAVA_ASTORE_3         78
+
+#define JAVA_IASTORE          79
+#define ICMD_IASTORE          79
+
+#define JAVA_LASTORE          80
+#define ICMD_LASTORE          80
+
+#define JAVA_FASTORE          81
+#define ICMD_FASTORE          81
+
+#define JAVA_DASTORE          82
+#define ICMD_DASTORE          82
+
+#define JAVA_AASTORE          83
+#define ICMD_AASTORE          83
+
+#define JAVA_BASTORE          84
+#define ICMD_BASTORE          84
+
+#define JAVA_CASTORE          85
+#define ICMD_CASTORE          85
+
+#define JAVA_SASTORE          86
+#define ICMD_SASTORE          86
+
+#define JAVA_POP              87
+#define ICMD_POP              87
+
+#define JAVA_POP2             88
+#define ICMD_POP2             88
+
+#define JAVA_DUP              89
+#define ICMD_DUP              89
+
+#define JAVA_DUP_X1           90
+#define ICMD_DUP_X1           90
+
+#define JAVA_DUP_X2           91
+#define ICMD_DUP_X2           91
+
+#define JAVA_DUP2             92
+#define ICMD_DUP2             92
+
+#define JAVA_DUP2_X1          93
+#define ICMD_DUP2_X1          93
+
+#define JAVA_DUP2_X2          94
+#define ICMD_DUP2_X2          94
+
+#define JAVA_SWAP             95
+#define ICMD_SWAP             95
+
+#define JAVA_IADD             96
+#define ICMD_IADD             96
+
+#define JAVA_LADD             97
+#define ICMD_LADD             97
+
+#define JAVA_FADD             98
+#define ICMD_FADD             98
+
+#define JAVA_DADD             99
+#define ICMD_DADD             99
+
+#define JAVA_ISUB             100
+#define ICMD_ISUB             100
+
+#define JAVA_LSUB             101
+#define ICMD_LSUB             101
+
+#define JAVA_FSUB             102
+#define ICMD_FSUB             102
+
+#define JAVA_DSUB             103
+#define ICMD_DSUB             103
+
+#define JAVA_IMUL             104
+#define ICMD_IMUL             104
+
+#define JAVA_LMUL             105
+#define ICMD_LMUL             105
+
+#define JAVA_FMUL             106
+#define ICMD_FMUL             106
+
+#define JAVA_DMUL             107
+#define ICMD_DMUL             107
+
+#define JAVA_IDIV             108
+#define ICMD_IDIV             108
+
+#define JAVA_LDIV             109
+#define ICMD_LDIV             109
+
+#define JAVA_FDIV             110
+#define ICMD_FDIV             110
+
+#define JAVA_DDIV             111
+#define ICMD_DDIV             111
+
+#define JAVA_IREM             112
+#define ICMD_IREM             112
+
+#define JAVA_LREM             113
+#define ICMD_LREM             113
+
+#define JAVA_FREM             114
+#define ICMD_FREM             114
+
+#define JAVA_DREM             115
+#define ICMD_DREM             115
+
+#define JAVA_INEG             116
+#define ICMD_INEG             116
+
+#define JAVA_LNEG             117
+#define ICMD_LNEG             117
+
+#define JAVA_FNEG             118
+#define ICMD_FNEG             118
+
+#define JAVA_DNEG             119
+#define ICMD_DNEG             119
+
+#define JAVA_ISHL             120
+#define ICMD_ISHL             120
+
+#define JAVA_LSHL             121
+#define ICMD_LSHL             121
+
+#define JAVA_ISHR             122
+#define ICMD_ISHR             122
+
+#define JAVA_LSHR             123
+#define ICMD_LSHR             123
+
+#define JAVA_IUSHR            124
+#define ICMD_IUSHR            124
+
+#define JAVA_LUSHR            125
+#define ICMD_LUSHR            125
+
+#define JAVA_IAND             126
+#define ICMD_IAND             126
+
+#define JAVA_LAND             127
+#define ICMD_LAND             127
+
+#define JAVA_IOR              128
+#define ICMD_IOR              128
+
+#define JAVA_LOR              129
+#define ICMD_LOR              129
+
+#define JAVA_IXOR             130
+#define ICMD_IXOR             130
+
+#define JAVA_LXOR             131
+#define ICMD_LXOR             131
+
+#define JAVA_IINC             132
+#define ICMD_IINC             132   /* op1 = local variable, val.i = constant */
+
+#define JAVA_I2L              133
+#define ICMD_I2L              133
+
+#define JAVA_I2F              134
+#define ICMD_I2F              134
+
+#define JAVA_I2D              135
+#define ICMD_I2D              135
+
+#define JAVA_L2I              136
+#define ICMD_L2I              136
+
+#define JAVA_L2F              137
+#define ICMD_L2F              137
+
+#define JAVA_L2D              138
+#define ICMD_L2D              138
+
+#define JAVA_F2I              139
+#define ICMD_F2I              139
+
+#define JAVA_F2L              140
+#define ICMD_F2L              140
+
+#define JAVA_F2D              141
+#define ICMD_F2D              141
+
+#define JAVA_D2I              142
+#define ICMD_D2I              142
+
+#define JAVA_D2L              143
+#define ICMD_D2L              143
+
+#define JAVA_D2F              144
+#define ICMD_D2F              144
+
+#define JAVA_INT2BYTE         145
+#define ICMD_INT2BYTE         145
+
+#define JAVA_INT2CHAR         146
+#define ICMD_INT2CHAR         146
+
+#define JAVA_INT2SHORT        147
+#define ICMD_INT2SHORT        147
+
+#define JAVA_LCMP             148
+#define ICMD_LCMP             148
+
+#define JAVA_FCMPL            149
+#define ICMD_FCMPL            149
+
+#define JAVA_FCMPG            150
+#define ICMD_FCMPG            150
+
+#define JAVA_DCMPL            151
+#define ICMD_DCMPL            151
+
+#define JAVA_DCMPG            152
+#define ICMD_DCMPG            152
+
+#define JAVA_IFEQ             153
+#define ICMD_IFEQ             153       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFNE             154
+#define ICMD_IFNE             154       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFLT             155
+#define ICMD_IFLT             155       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFGE             156
+#define ICMD_IFGE             156       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFGT             157
+#define ICMD_IFGT             157       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IFLE             158
+#define ICMD_IFLE             158       /* op1 = target JavaVM pc, val.i      */
+
+#define JAVA_IF_ICMPEQ        159
+#define ICMD_IF_ICMPEQ        159       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPNE        160
+#define ICMD_IF_ICMPNE        160       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPLT        161
+#define ICMD_IF_ICMPLT        161       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPGE        162
+#define ICMD_IF_ICMPGE        162       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPGT        163
+#define ICMD_IF_ICMPGT        163       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ICMPLE        164
+#define ICMD_IF_ICMPLE        164       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ACMPEQ        165
+#define ICMD_IF_ACMPEQ        165       /* op1 = target JavaVM pc             */
+
+#define JAVA_IF_ACMPNE        166
+#define ICMD_IF_ACMPNE        166       /* op1 = target JavaVM pc             */
+
+#define JAVA_GOTO             167
+#define ICMD_GOTO             167       /* op1 = target JavaVM pc             */
+
+#define JAVA_JSR              168
+#define ICMD_JSR              168       /* op1 = target JavaVM pc             */
+
+#define JAVA_RET              169
+#define ICMD_RET              169       /* op1 = local variable               */
+
+#define JAVA_TABLESWITCH      170
+#define ICMD_TABLESWITCH      170       /* val.a = pointer to s4 table        */
+                                        /* length must be computed            */
+#define JAVA_LOOKUPSWITCH     171
+#define ICMD_LOOKUPSWITCH     171       /* val.a = pointer to s4 table        */
+                                        /* length must be computed            */
+#define JAVA_IRETURN          172
+#define ICMD_IRETURN          172
+
+#define JAVA_LRETURN          173
+#define ICMD_LRETURN          173
+
+#define JAVA_FRETURN          174
+#define ICMD_FRETURN          174
+
+#define JAVA_DRETURN          175
+#define ICMD_DRETURN          175
+
+#define JAVA_ARETURN          176
+#define ICMD_ARETURN          176
+
+#define JAVA_RETURN           177
+#define ICMD_RETURN           177
+
+#define JAVA_GETSTATIC        178
+#define ICMD_GETSTATIC        178       /* op1 = type, val.a = field address  */
+
+#define JAVA_PUTSTATIC        179
+#define ICMD_PUTSTATIC        179       /* op1 = type, val.a = field address  */
+
+#define JAVA_GETFIELD         180
+#define ICMD_GETFIELD         180       /* op1 = type, val.i = field offset   */
+
+#define JAVA_PUTFIELD         181
+#define ICMD_PUTFIELD         181       /* op1 = type, val.i = field offset   */
+
+#define JAVA_INVOKEVIRTUAL    182
+#define ICMD_INVOKEVIRTUAL    182       /* val.a = method info pointer        */
+
+#define JAVA_INVOKESPECIAL    183
+#define ICMD_INVOKESPECIAL    183       /* val.a = method info pointer        */
+
+#define JAVA_INVOKESTATIC     184
+#define ICMD_INVOKESTATIC     184       /* val.a = method info pointer        */
+
+#define JAVA_INVOKEINTERFACE  185
+#define ICMD_INVOKEINTERFACE  185       /* val.a = method info pointer        */
+
+#define ICMD_CHECKASIZE       186       /*                                    */
+
+#define JAVA_NEW              187
+#define ICMD_NEW              187       /* op1 = 1, val.a = class pointer     */
+
+#define JAVA_NEWARRAY         188
+#define ICMD_NEWARRAY         188       /* op1 = basic type                   */
+
+#define JAVA_ANEWARRAY        189
+#define ICMD_ANEWARRAY        189       /* op1 = 0, val.a = array pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
+#define JAVA_ARRAYLENGTH      190
+#define ICMD_ARRAYLENGTH      190
+
+#define JAVA_ATHROW           191
+#define ICMD_ATHROW           191
+
+#define JAVA_CHECKCAST        192
+#define ICMD_CHECKCAST        192       /* op1 = 0, val.a = array pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
+#define JAVA_INSTANCEOF       193
+#define ICMD_INSTANCEOF       193       /* op1 = 0, val.a = array pointer     */
+                                        /* op1 = 1, val.a = class pointer     */
+#define JAVA_MONITORENTER     194
+#define ICMD_MONITORENTER     194
+
+#define JAVA_MONITOREXIT      195
+#define ICMD_MONITOREXIT      195
+
+#define JAVA_WIDE             196
+
+#define JAVA_MULTIANEWARRAY   197
+#define ICMD_MULTIANEWARRAY   197       /* op1 = dimension, val.a = array     */
+                                        /* pointer                            */
+#define JAVA_IFNULL           198
+#define ICMD_IFNULL           198       /* op1 = target JavaVM pc             */
+
+#define JAVA_IFNONNULL        199
+#define ICMD_IFNONNULL        199       /* op1 = target JavaVM pc             */
+
+#define JAVA_GOTO_W           200
+
+#define JAVA_JSR_W            201
+
+#define JAVA_BREAKPOINT       202
+
+
+#define ICMD_BUILTIN3         253       /* internal opcode */
+#define ICMD_BUILTIN2         254       /* internal opcode */
+#define ICMD_BUILTIN1         255       /* internal opcode */
+#define ICMD_READONLY_ARG     1024      /* used for inlining, opcodes 1024-1028 are used */
+#define ICMD_CLEAR_ARGREN     1029      /* indicates the start of a new inlined method argument renaming must be reset */
+
+
+/******************* description of JavaVM instructions ***********************/
+
+#if defined(USEBUILTINTABLE)
+typedef struct {
+       u1 opcode;
+       u1 type_s1;
+       u1 type_s2;
+       u1 type_d;      
+       int icmd;
+       functionptr builtin;
+       bool supported;
+       bool isfloat;
+} stdopdescriptor;
+
+static stdopdescriptor builtintable[] = {
+       { ICMD_LCMP,   TYPE_LONG, TYPE_LONG, TYPE_INT, ICMD_BUILTIN2,
+              (functionptr) builtin_lcmp , SUPPORT_LONG && SUPPORT_LONG_CMP, false },
+       { ICMD_LAND,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_land , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+       { ICMD_LOR,    TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+       { ICMD_LXOR,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lxor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+       { ICMD_LSHL,   TYPE_LONG, TYPE_INT,  TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lshl , SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
+       { ICMD_LSHR,   TYPE_LONG, TYPE_INT,  TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lshr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
+       { ICMD_LUSHR,  TYPE_LONG, TYPE_INT,  TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lushr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
+       { ICMD_LADD,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_ladd , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
+       { ICMD_LSUB,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lsub , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
+       { ICMD_LNEG,   TYPE_LONG, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1, 
+              (functionptr) builtin_lneg, SUPPORT_LONG && SUPPORT_LONG_ADD, true },
+       { ICMD_LMUL,   TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
+              (functionptr) builtin_lmul , SUPPORT_LONG && SUPPORT_LONG_MULDIV, false },
+       { ICMD_FREM,   TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, ICMD_BUILTIN2,
+              (functionptr) builtin_frem, SUPPORT_FLOAT && SUPPORT_FMOD, true },
+       { ICMD_DREM,   TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, ICMD_BUILTIN2,
+              (functionptr) builtin_drem, SUPPORT_DOUBLE && SUPPORT_FMOD, true },
+       { ICMD_I2F,    TYPE_INT, TYPE_VOID, TYPE_FLOAT, ICMD_BUILTIN1,
+              (functionptr) builtin_i2f, SUPPORT_FLOAT && SUPPORT_IFCVT, true },
+       { ICMD_I2D,    TYPE_INT, TYPE_VOID, TYPE_DOUBLE, ICMD_BUILTIN1, 
+              (functionptr) builtin_i2d, SUPPORT_DOUBLE && SUPPORT_IFCVT, true },
+       { ICMD_L2F,    TYPE_LONG, TYPE_VOID, TYPE_FLOAT, ICMD_BUILTIN1,
+              (functionptr) builtin_l2f, SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_LONG_FCVT, true },
+       { ICMD_L2D,    TYPE_LONG, TYPE_VOID, TYPE_DOUBLE, ICMD_BUILTIN1, 
+              (functionptr) builtin_l2d, SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_LONG_FCVT, true },
+       { ICMD_F2L,    TYPE_FLOAT, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1,
+              (functionptr) builtin_f2l, SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_LONG_FCVT, true },
+       { ICMD_D2L,    TYPE_DOUBLE, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1,
+              (functionptr) builtin_d2l, SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_LONG_FCVT, true },
+       { ICMD_F2I,    TYPE_FLOAT, TYPE_VOID, TYPE_INT, ICMD_BUILTIN1,
+              (functionptr) builtin_f2i, SUPPORT_FLOAT && SUPPORT_FICVT, true },
+       { ICMD_D2I,    TYPE_DOUBLE, TYPE_VOID, TYPE_INT, ICMD_BUILTIN1,
+              (functionptr) builtin_d2i, SUPPORT_DOUBLE && SUPPORT_FICVT, true },
+};
+
+#endif /* USEBUILTINTABLE */
+
+
+/***************************** register types *********************************/
+
+#define REG_RES   0         /* reserved register for OS or code generator     */
+#define REG_RET   1         /* return value register                          */
+#define REG_EXC   2         /* exception value register                       */
+#define REG_SAV   3         /* (callee) saved register                        */
+#define REG_TMP   4         /* scratch temporary register (caller saved)      */
+#define REG_ARG   5         /* argument register (caller saved)               */
+
+#define REG_END   -1        /* last entry in tables                           */
+#define PARAMMODE_NUMBERED  0 
+#define PARAMMODE_STUFFED   1
+
+
+/***************************** register info block ****************************/
+
+extern int nregdescint[];   /* description of integer registers               */
+extern int nregdescfloat[]; /* description of floating point registers        */
+
+extern int nreg_parammode;
+
+
+/* compiler switches (set by main function) ***********************************/
+
+extern bool runverbose;         /* trace all method invocation                */
+extern bool compileverbose;     /* trace compiler actions                     */
+extern bool showdisassemble;    /* generate disassembler listing              */
+extern bool showddatasegment;   /* generate data segment listing              */
+extern bool showintermediate;   /* generate intermediate code listing         */
+extern int  optimizelevel;      /* optimzation level  (0 = no optimization)   */
+
+extern bool useinlining;        /* use method inlining                        */
+extern bool inlinevirtuals;     /* inline unique virtual methods              */
+extern bool inlineexceptions;   /* inline methods, that contain excptions     */
+extern bool inlineparamopt;     /* optimize parameter passing to inlined methods */
+extern bool inlineoutsiders;    /* inline methods, that are not member of the invoker's class */
+
+
+extern bool checkbounds;        /* check array bounds                         */
+extern bool opt_loops;          /* optimize array accesses in loops           */
+extern bool checknull;          /* check null pointers                        */
+extern bool opt_noieee;         /* don't implement ieee compliant floats      */
+extern bool checksync;          /* do synchronization                         */
+
+extern bool getcompilingtime;   /* compute compile time                       */
+extern long compilingtime;      /* accumulated compile time                   */
+
+extern int  has_ext_instr_set;  /* has instruction set extensions */
+
+extern bool statistics;         
+
+extern int count_jit_calls;
+extern int count_methods;
+extern int count_spills;
+extern int count_pcmd_activ;
+extern int count_pcmd_drop;
+extern int count_pcmd_zero;
+extern int count_pcmd_const_store;
+extern int count_pcmd_const_alu;
+extern int count_pcmd_const_bra;
+extern int count_pcmd_load;
+extern int count_pcmd_move;
+extern int count_load_instruction;
+extern int count_pcmd_store;
+extern int count_pcmd_store_comb;
+extern int count_dup_instruction;
+extern int count_pcmd_op;
+extern int count_pcmd_mem;
+extern int count_pcmd_met;
+extern int count_pcmd_bra;
+extern int count_pcmd_table;
+extern int count_pcmd_return;
+extern int count_pcmd_returnx;
+extern int count_check_null;
+extern int count_check_bound;
+extern int count_max_basic_blocks;
+extern int count_basic_blocks;
+extern int count_max_javainstr;
+extern int count_javainstr;
+extern int count_javacodesize;
+extern int count_javaexcsize;
+extern int count_calls;
+extern int count_tryblocks;
+extern int count_code_len;
+extern int count_data_len;
+extern int count_cstub_len;
+extern int count_nstub_len;
+extern int count_max_new_stack;
+extern int count_upper_bound_new_stack;
+extern int *count_block_stack;
+extern int *count_analyse_iterations;
+extern int *count_method_bb_distribution;
+extern int *count_block_size_distribution;
+extern int *count_store_length;
+extern int *count_store_depth;
+
+
+/* global compiler variables */
+
+extern classinfo  *class;       /* class the compiled method belongs to       */
+extern methodinfo *method;      /* pointer to method info of compiled method  */
+extern int         mparamcount; /* number of parameters (incl. this)          */
+extern u1         *mparamtypes; /* types of all parameters (TYPE_INT, ...)    */
+       
+extern int maxstack;            /* maximal JavaVM stack size                  */
+extern int maxlocals;           /* maximal number of local JavaVM variables   */
+extern int jcodelength;         /* length of JavaVM-codes                     */
+extern u1 *jcode;               /* pointer to start of JavaVM-code            */
+extern int exceptiontablelength;/* length of exception table                  */
+extern xtable *extable;         /* pointer to start of exception table        */
+extern exceptiontable *raw_extable;
+
+extern int block_count;         /* number of basic blocks                     */
+extern basicblock *block;       /* points to basic block array                */
+extern int *block_index;        /* a table which contains for every byte of   */
+                                /* JavaVM code a basic block index if at this */
+                                /* byte there is the start of a basic block   */
+
+extern int instr_count;         /* number of JavaVM instructions              */
+extern instruction *instr;      /* points to intermediate code instructions   */
+
+extern int stack_count;         /* number of stack elements                   */
+extern stackelement *stack;     /* points to intermediate code instructions   */
+
+extern bool isleafmethod;       /* true if a method doesn't call subroutines  */
+
+extern basicblock *last_block;  /* points to the end of the BB list           */
+
+/* list of all classes used by the compiled method which have to be           */
+/* initialised (if not already done) before execution of this method          */
+extern chain *uninitializedclasses;
+
+extern int stackreq[256];
+
+
+/* function prototypes */
+
+methodptr jit_compile (methodinfo *m);  /* compile a method with jit compiler */
+
+void jit_init();                        /* compiler initialisation            */
+void jit_close();                       /* compiler finalisation              */
+
+u1 *createcompilerstub(methodinfo *m);
+u1 *createnativestub(functionptr f, methodinfo *m);
+
+void removecompilerstub(u1 *stub);
+void removenativestub(u1 *stub);
+
+#endif /* _JIT_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/loop/Makefile.am b/src/vm/jit/loop/Makefile.am
new file mode 100644 (file)
index 0000000..23dc941
--- /dev/null
@@ -0,0 +1,25 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+INCLUDES = -I$(top_srcdir)/jit/@ARCH_DIR@ -I$(top_srcdir)/jit
+
+EXTRA_DIST = \
+       graph.c \
+       loop.c \
+       loop.h \
+       analyze.c \
+       tracing.c
+
+noinst_LIBRARIES = libloop.a
+
+libloop_a_SOURCES = loop.c analyze.c graph.c tracing.c
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
diff --git a/src/vm/jit/loop/analyze.c b/src/vm/jit/loop/analyze.c
new file mode 100644 (file)
index 0000000..ede8b50
--- /dev/null
@@ -0,0 +1,3607 @@
+/* jit/loop/analyze.c - bound check removal functions
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel
+
+   Contains the functions which perform the bound check removals. With
+   the loops identified, these functions scan the code for array
+   accesses that take place in loops and try to guarantee that their
+   bounds are never violated. The function to call is
+   optimize_loops().
+
+   $Id: analyze.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdlib.h>
+#include "analyze.h"
+#include "loop.h"
+#include "graph.h"
+#include "tracing.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+#ifdef LOOP_DEBUG
+
+/*     Test functions -> will be removed in final release
+*/
+
+void show_trace(struct Trace *trace)
+{
+       if (trace != NULL) {
+               switch (trace->type) {
+               case TRACE_IVAR:
+                       printf("int-var");
+                       printf("\nNr.:\t%d", trace->var);
+                       printf("\nValue:\t%d", trace->constant);
+                       break;
+      
+               case TRACE_AVAR:
+                       printf("object-var");
+                       printf("\nNr.:\t%d", trace->var);
+                       break;
+      
+               case TRACE_ALENGTH:
+                       printf("array-length");
+                       printf("\nNr.:\t%d", trace->var);
+                       printf("\nValue:\t%d", trace->constant);
+                       break;
+
+               case TRACE_ICONST:
+                       printf("int-const");
+                       printf("\nValue:\t%d", trace->constant);
+                       break;
+      
+               case TRACE_UNKNOWN:
+                       printf("unknown");
+                       break;
+                       }
+               }
+       else
+               printf("Trace is null");
+       
+       printf("\n");
+}
+
+
+void show_change(struct Changes *c)
+{
+       printf("*** Changes ***\n");
+       if (c != NULL)
+               printf("Lower/Upper Bound:\t%d/%d\n", c->lower_bound, c->upper_bound);
+       else
+               printf("Unrestricted\n");
+}
+
+show_varinfo(struct LoopVar *lv)
+{
+       printf("   *** Loop Info ***\n");
+       printf("Value:\t%d\n", lv->value);
+       printf("Static:\t\t%d/%d\n", lv->static_l, lv->static_u);
+       printf("D-Valid:\t%d/%d\n", lv->dynamic_l_v, lv->dynamic_u_v);
+       printf("Dynamic\t\t%d/%d\n", lv->dynamic_l, lv->dynamic_u);
+}
+
+void show_right_side()
+{
+       int i;
+       printf("\n   *** Head ***   \nType:\t");
+       show_trace(c_rightside);
+
+       printf("\n   *** Nested Loops: ***\n");
+       for (i=0; i<block_count; ++i) 
+               printf("%d\t", c_nestedLoops[i]);
+       printf("\n");
+
+       printf("\n   *** Hierarchie: ***\n");   
+       for (i=0; i<block_count; ++i) 
+               printf("%d\t", c_hierarchie[i]);
+       printf("\n");
+       
+
+       printf("\n   *** Current Loop ***\n");
+       for (i=0; i<block_count; ++i)
+           printf("%d\t", c_current_loop[i]);
+       printf("\n");
+}
+
+void resultPass3()
+{
+       int i;
+       struct LoopContainer *lc = c_allLoops;
+  
+       printf("\n\n****** PASS 3 ******\n\n");
+  
+       while (lc != NULL) {
+               printf("Loop Analysis:\n");
+               printf("Optimize:\t%d\n", lc->toOpt);
+               printf("Modified Vars: ");
+               /*
+               for (i=0; i<lc->num_vars; ++i)
+                 printf("%d ", lc->vars[i]);
+               printf("\n\n");
+               */
+               lc = lc->next;
+               }
+
+       printf("\nNested Loops:\n");
+       for (i=0; i<block_count; ++i)
+           printf("%d ", c_nestedLoops[i]);
+       printf("\n");
+       for (i=0; i<block_count; ++i) 
+               printf("%d ", c_hierarchie[i]);
+       printf("\n");
+       fflush(stdout);
+}
+
+void show_tree(struct LoopContainer *lc, int tabs) 
+{
+       int cnt;
+
+       while (lc != NULL) {
+               for (cnt = 0; cnt < tabs; ++cnt)
+                       printf("  ");
+               printf("%d\n", lc->loop_head);
+
+               show_tree(lc->tree_down, tabs+1);
+
+               lc = lc->tree_right;
+       }
+}
+
+#endif
+
+#ifdef STATISTICS
+
+void show_loop_statistics()
+{
+       printf("\n\n****** LOOP STATISTICS ****** \n\n");
+       if (c_stat_or) 
+           printf("Optimization cancelled by or\n");
+       else if (c_stat_exception)
+           printf("Optimization cancelled by exception\n");
+       else {
+               printf("Number of array accesses:\t%d\n", c_stat_array_accesses);
+               if (c_stat_array_accesses) {
+                       printf("\nFully optimized:\t%d\n", c_stat_full_opt);
+                       printf("Not optimized:\t\t%d\n", c_stat_no_opt);
+                       printf("Upper optimized:\t%d\n", c_stat_upper_opt);
+                       printf("Lower optimized:\t%d\n", c_stat_lower_opt);
+                       }
+               }
+}
+
+void show_procedure_statistics()
+{
+       printf("\n\n****** PROCEDURE STATISTICS ****** \n\n");
+       printf("Number of loops:\t\t%d\n", c_stat_num_loops);
+       printf("Number of array accesses:\t%d\n", c_stat_sum_accesses);
+       if (c_stat_sum_accesses) {
+               printf("\nFully optimized:\t%d\n", c_stat_sum_full);
+               printf("Not optimized:\t\t%d\n", c_stat_sum_no);
+               printf("Upper optimized:\t%d\n", c_stat_sum_upper);
+               printf("Lower optimized:\t%d\n", c_stat_sum_lower);
+               }
+       printf("Opt. cancelled by or:\t\t%d\n", c_stat_sum_or);
+       printf("Opt. cancelled by exception:\t%d\n", c_stat_sum_exception);
+}
+
+#endif
+
+
+/*     This function is used to merge two loops with the same header together.
+       A simple merge sort of the lists nodes of both loops is performed.
+*/
+void analyze_merge(struct LoopContainer *l1, struct LoopContainer *l2)
+{
+       struct LoopElement *start, *last, *le1, *le2; 
+       /* start and last are pointers to the newly built list, le1 and le2 step  */
+       /* step through the lists, that have to be merged.                        */
+
+       le1 = l1->nodes;
+       le2 = l2->nodes;
+
+       /* start a simple merge sort of the nodes of both loops. These lists are  */
+       /* already sorted, so merging is easy.                                    */
+       if (le1->node < le2->node) {
+               start = last = le1;
+               le1 = le1->next;
+               }
+       else if (le1->node == le2->node) {
+               start = last = le1;
+               le1 = le1->next;
+               le2 = le2->next;
+               }
+       else {
+               start = last = le2;
+               le2 = le2->next;
+               }
+
+       /* while the first loop != NULL, depending of the first element of second */
+       /* loop, add new node to result list                                      */
+       while (le1 != NULL) {
+
+               if (le2 == NULL) {
+                       last->next = le1;
+                       break;
+                       }
+               if (le1->node < le2->node) {
+                       last->next = le1;
+                       le1 = le1->next;
+                       }
+               else if (le1->node == le2->node) {
+                       last->next = le1;
+                       le1 = le1->next;
+                       le2 = le2->next;
+                       last = last->next;
+                       }
+               else {
+                       last->next = le2;
+                       le2 = le2->next;
+                       last = last->next;
+                       }
+               }
+
+       last->next = le2;                       
+}
+
+
+/*     This function is used to merge loops with the same header node to a single 
+       one. O(n^2) of number of loops. This merginig is necessary, because the loop
+       finding algorith sometimes (eg. when loopbody ends with a if-else construct)
+       reports a single loop as two loops with the same header node.
+*/
+void analyze_double_headers()
+{
+       int toCheck;
+       struct LoopContainer *t1, *t2, *t3;
+
+       t1 = c_allLoops;
+
+       while (t1 != NULL)      {                       /* for all loops do                                                     */
+               toCheck = t1->loop_head;        /* get header node                                                      */
+               t2 = t1->next;
+
+               while (t2 != NULL) {            /* compare it to headers of rest                        */
+                       if (t2->loop_head == toCheck) {
+
+                               /* found overlapping loops -> merge them together                               */
+                               /* printf("C_INFO: found overlapping loops - merging");         */
+                               analyze_merge(t1, t2);
+                               
+                               /* remove second loop from the list     of all loops                            */
+                               t3 = t1;       
+                               while (t3->next != t2)
+                                       t3 = t3->next;
+                               t3->next = t2->next;
+                               }
+                       t2 = t2->next;
+                   }
+
+               t1 = t1->next;
+           }
+}
+
+
+/* After the hierarchie of loops has been built, we have to insert the exceptions
+   into this tree. The exception ex is inserted into the subtree pointed to by
+   LoopContainer lc.
+*/
+void insert_exception(struct LoopContainer *lc, xtable *ex)
+{
+       struct LoopContainer *temp;
+       struct LoopElement *le;
+
+#ifdef LOOP_DEBUG
+       /* printf("insert_exception called with %d-%d and loop %d\n", ex->start->debug_nr, ex->end->debug_nr, lc->loop_head); */
+#endif
+       
+       /* if child node is reached immediately insert exception into the tree    */
+       if (lc->tree_down == NULL) {
+               ex->next = lc->exceptions;
+               lc->exceptions = ex;
+           }
+       else {
+       /* if we are inside the tree, there are two possibilities:                */
+       /* 1. the exception is inside a nested loop or                            */
+       /* 2. in the loop body of the current loop                                */
+
+               /* check all children (= nested loops)                                */
+               temp = lc->tree_down;
+               
+               while (temp != NULL) {
+                       
+                       le = temp->nodes;
+                       while (le != NULL) {
+
+#ifdef LOOP_DEBUG
+                               printf("%d.%d\n", le->node, block_index[ex->startpc]);
+#endif
+                               /* if the start of the exception is part of the loop, the     */
+                               /* whole exception must be part of the loop                   */
+                               if (le->node == block_index[ex->startpc])
+                                       break;
+                               le = le->next;
+                           }
+                       
+                       /* Exception is part of a nested loop (Case 1) -> insert it there */
+                       if (le != NULL) {
+                               insert_exception(temp, ex);
+                               return;
+                           }
+                       else if ((temp->loop_head >= block_index[ex->startpc]) && (temp->loop_head < block_index[ex->endpc])) {
+                               
+                               /* optimization: if nested loop is part of the exception, the */
+                               /* exception cannot be part of a differnet nested loop.       */
+                               ex->next = lc->exceptions;
+                               lc->exceptions = ex;
+                               return;
+                           }
+                       else
+                               temp = temp->tree_right;
+                   }
+                   
+               /* Exception is not contained in any nested loop (Case 2)             */
+               if (temp == NULL) {
+                       ex->next = lc->exceptions;
+                       lc->exceptions = ex;
+                   }
+           } 
+}
+
+
+/*     This function builds a loop hierarchie. The header node of the innermost loop,
+       each basic block belongs to, is stored in the array c_nestedLoops. The array
+       c_hierarchie stores the relationship between differnt loops in as follows: 
+    Each loop, that is a nested loop, stores its direct surrounding loop as a 
+    parent. Top level loops have no parents.
+*/
+void analyze_nested()
+{
+       /* i/count/tmp are counters                                               */
+       /* toOverwrite is used while loop hierarchie is built (see below)         */
+       int i, header, toOverwrite, tmp, len;
+
+       /* first/last are used during topological sort to build ordered loop list */
+       struct LoopContainer *first, *last, *start, *t, *temp;
+
+       /* Used to step through all nodes of a loop.                              */
+       struct LoopElement *le; 
+
+       /* init global structures                                                 */
+       c_nestedLoops = DMNEW(int, block_count);
+       c_hierarchie = DMNEW(int, block_count);         
+       for (i=0; i<block_count; ++i) {
+               c_nestedLoops[i] = -1;
+               c_hierarchie[i] = -1;
+           }
+
+       /* if there are no optimizable loops -> return                            */
+       if (c_allLoops == NULL)
+               return;
+
+       temp = c_allLoops;
+       while (temp != NULL) {              /* for all loops, do                  */
+               header = temp->loop_head;
+
+               /* toOverwrite is number of current parent loop (-1 if none)          */
+               toOverwrite = c_nestedLoops[header];    
+
+               c_hierarchie[header] = toOverwrite;
+
+               if (toOverwrite == header)      /* check for loops with same header   */
+                       printf("C_ERROR: Loops have same header\n");
+
+               le = temp->nodes;
+               while (le != NULL) {            /* for all loop nodes, do             */
+                       tmp = c_nestedLoops[le->node];
+
+                   /* if node is part of parent loop -> overwrite it with nested     */
+                       if (tmp == toOverwrite)
+                               c_nestedLoops[le->node] = header;
+                       else {
+                               c_hierarchie[tmp] = header;
+#ifdef LOOP_DEBUG
+                               /* printf("set head of %d to %d", tmp, header);               */
+#endif
+                           }
+
+                       le = le->next;
+                       }
+
+               temp = temp->next;
+               }
+
+       /* init root of hierarchie tree                                           */
+       root = DMNEW(struct LoopContainer, 1);
+       LoopContainerInit(root, -1);
+
+    /* obtain parent pointer and build hierarchie tree                        */
+    start = c_allLoops;    
+    while (start != NULL) {
+               
+               /* look for parent of loop pointed at by start                        */
+               first = c_allLoops;
+               while (first != NULL) {
+
+                       /* the parent of the loop, pointed at by start has been found     */
+                       if (first->loop_head == c_hierarchie[start->loop_head]) {
+#ifdef LOOP_DEBUG
+                               /* printf("set parent to pointer\n");                         */
+#endif
+
+                               start->parent = first;
+                               start->tree_right = first->tree_down;
+                               first->tree_down = start;
+
+                               break;
+                           }
+                       first = first->next;
+                   }
+
+               /* no parent loop found, set parent to root                           */
+               if (first == NULL) {
+#ifdef LOOP_DEBUG
+                       /* printf("set parent to root\n");                                */
+#endif
+                       start->parent = root;
+                       start->tree_right = root->tree_down;
+                       root->tree_down = start;                
+                   }
+               /* if a parent exists, increase this nodes indegree                   */
+               else
+                       start->parent->in_degree += 1;
+
+               start = start->next;
+           }
+
+       /* insert exceptions into tree                                            */
+#ifdef LOOP_DEBUG
+       printf("--- Showing tree ---\n");
+       show_tree(root, 0);
+       printf(" --- End ---\n");
+#endif
+       for (len = 0; len < exceptiontablelength; ++len) 
+               insert_exception(root, extable + len);
+
+
+       /* determine sequence of loops for optimization by topological sort       */
+
+       /* init queue                                                             */
+       start = NULL;
+       temp = c_allLoops;
+       while (temp != NULL) {
+
+               /* a loops with indegree == 0 are pushed onto the stack               */
+               if (temp->in_degree == 0) {
+                       t = temp->next;
+                       temp->next = start;
+                       start = temp;
+                       }
+               else 
+                       t = temp->next;
+                   
+               temp = t;
+               }
+
+       /* sort loops                                                             */
+       first = last = start;
+       start = start->next;
+
+       if (last == NULL) {
+               printf("C_ERROR: loops are looped\n");
+               exit(-1);
+           }
+
+       /* pop each node from the stack and decrease its parents indegree by one  */
+       /* when the parents indegree reaches zero, push it onto the stack as well */
+       if ((last->parent != root) && (--last->parent->in_degree == 0)) {
+               last->parent->next = start;
+               start = last->parent;
+               }
+       while (start != NULL) {
+
+               last->next = start;
+
+               start = start->next;
+               last = last->next;
+               
+               if ((last->parent != root) && (--last->parent->in_degree == 0)) {
+                       last->parent->next = start;
+                       start = last->parent;
+                       }
+               }
+
+       last->next = NULL;
+       c_allLoops = first;
+
+#ifdef LOOP_DEBUG
+       printf("*** Hierarchie Results \n");
+       while (first != NULL) {
+               printf("%d ", first->loop_head);
+               first = first->next;
+           }
+       printf("\n");
+       fflush(stdout);
+#endif 
+}
+
+/*     This function is used to add variables that occur as index variables in
+       array accesses (ARRAY_INDEX) or as variables, that change their value (VAR_MOD)
+       to the list of interesting vars (c_loopvars) for the current loop.
+*/
+void add_to_vars(int var, int type, int direction)
+{
+       struct LoopVar *lv;     
+
+       /* printf("Added to vars %d %d %d\n", var, type, direction);              */
+       lv = c_loopvars;
+       while (lv != NULL) {            /* check if var has been previously added */
+               if (lv->value == var) {
+                       if (type == ARRAY_INDEX)
+                               lv->index = 1;              /* var is used as index           */
+                       else if (type == VAR_MOD) {
+                               lv->modified = 1;           /* var is used in assignment      */
+                               switch (direction) {        /* how was var modified ?         */
+                               case D_UP:
+                                       lv->static_u = 0;       /* incremented, no static upper   */
+                                       break;                  /* bound can be guaranteeed       */
+                               case D_DOWN:
+                                       lv->static_l = 0;       /* decremented, no static lower   */
+                                       break;                  /* bound can be guaranteeed       */
+                               case D_UNKNOWN:
+                                       lv->static_u = lv->static_l = 0;
+                                       break;                  /* no info at all                 */
+                               default:
+                                       printf("C_ERROR: unknown direction\n");
+                                       break;
+                                       }
+                               }
+                       return;
+                       }
+               lv = lv->next;
+               }
+
+       /* variable is not found in list -> add variable to list                                        */
+       lv = DNEW(struct LoopVar);
+
+       lv->modified = lv->index = 0;
+       lv->value = var;
+
+       if (type == ARRAY_INDEX) {
+               lv->index = 1;
+               lv->static_u = lv->static_l = 1;    /* arrayindex -> var not modified */
+               }
+       else if (type == VAR_MOD) {
+               lv->modified = 1;
+               switch (direction) {                /* var used in assignment -> set  */
+               case D_UP:                          /* proper static bounds           */
+                       lv->static_u = 0; lv->static_l = 1;
+                       break;
+               case D_DOWN:
+                       lv->static_u = 1; lv->static_l = 0;
+                       break;
+               case D_UNKNOWN:
+                       lv->static_u = lv->static_l = 0;
+                       break;
+               default:
+                       printf("C_ERROR: unknown direction\n");
+                       break;
+                       }
+               }
+
+       /* no dynamic bounds have been determined so far                          */
+       lv->dynamic_l = lv->dynamic_l_v = lv->dynamic_u = lv->dynamic_u_v = 0;
+
+       lv->next = c_loopvars;                  /* add var to list                */
+       c_loopvars = lv;
+}
+
+/*     This function checks, whether a given loop with header node contains array
+       accesses. If so, it returns 1, else it returns 0 and the loops needs no
+       further consideration in the optimization process. When array accesses are 
+       found, a list of all variables, that are used as array index, is built and 
+       stored in c_loopvars. For all variables (integer), which values are changed, 
+       a flag in c_var_modified is set.
+*/
+int analyze_for_array_access(int node)
+{
+       basicblock bp;
+       instruction *ip;
+       int ic, i, access;
+       struct depthElement *d;
+       struct Trace *t;
+
+       if (c_toVisit[node] > 0) {          /* node has not been visited yet      */
+               c_toVisit[node] = 0;
+   
+               bp = block[node];               /* prepare an instruction scan        */
+               ip = bp.iinstr;
+               ic = bp.icount;
+
+               access = 0;                     /* number of array accesses in loop   */
+
+               for (i=0; i<ic; ++i, ++ip) {    /* for each instruction, check opcode */
+                       switch (ip->opc) {
+                       case ICMD_IASTORE:          /* array store                        */
+                       case ICMD_LASTORE:          
+                       case ICMD_FASTORE:          
+                       case ICMD_DASTORE:          
+                       case ICMD_AASTORE:          
+                       case ICMD_BASTORE:          
+                       case ICMD_CASTORE:          
+                       case ICMD_SASTORE:
+                               t = tracing(&bp, i-1, 1);   /* try to identify index variable */
+
+                               if (t->type == TRACE_IVAR) {
+                                       /* if it is a variable, add it to list of index variables */
+                                       add_to_vars(t->var, ARRAY_INDEX, D_UNKNOWN);
+                                       access++;                               
+                               }
+                               else if (t->type == TRACE_ICONST)
+                                       access++;
+                               break;
+      
+                       case ICMD_IALOAD:                               /* array load                                           */
+                   case ICMD_LALOAD:       
+                       case ICMD_FALOAD:
+                       case ICMD_DALOAD:
+                       case ICMD_AALOAD:
+                       case ICMD_BALOAD:
+                       case ICMD_CALOAD:
+                       case ICMD_SALOAD:
+                               t = tracing(&bp, i-1, 0);   /* try to identify index variable */
+               
+                               if (t->type == TRACE_IVAR) {
+                                       /* if it is a variable, add it to list of index variables */
+                                       add_to_vars(t->var, ARRAY_INDEX, D_UNKNOWN);
+                                       access++;
+                                       }
+                               else if (t->type == TRACE_ICONST)
+                                       access++;
+                               break;
+
+                       case ICMD_ISTORE:                               /* integer store                                        */
+                               c_var_modified[ip->op1] = 1;
+
+                               /* try to find out, how it was modified                                                 */
+                               t = tracing(&bp, i-1, 0);       
+                               if (t->type == TRACE_IVAR) {
+                                       if ((t->constant > 0) && (t->var == ip->op1))
+                                               /* a constant was added to the same var                                 */
+                                               add_to_vars(t->var, VAR_MOD, D_UP);
+                                       else if (t->var == ip->op1)     
+                                               /* a constant was subtracted from the same var                  */
+                                               add_to_vars(t->var, VAR_MOD, D_DOWN);
+                                       else
+                                               add_to_vars(t->var, VAR_MOD, D_UNKNOWN);
+                                       }
+                               else
+                                       add_to_vars(ip->op1, VAR_MOD, D_UNKNOWN);
+                               break;
+
+                       case ICMD_IINC:                                 /* simple add/sub of a constant         */
+                               c_var_modified[ip->op1] = 1;
+               
+                               if (ip->val.i > 0)
+                                       add_to_vars(ip->op1, VAR_MOD, D_UP);
+                               else
+                                       add_to_vars(ip->op1, VAR_MOD, D_DOWN);
+                               break;
+
+                       case ICMD_LSTORE:
+                       case ICMD_FSTORE:
+                       case ICMD_DSTORE:
+                       case ICMD_ASTORE:
+                               c_var_modified[ip->op1] = 1;
+                               break;
+                       }
+               }
+
+               d = c_dTable[node];
+               while (d != NULL) {                                     /* check all successors of block        */
+                       access += analyze_for_array_access(d->value);
+                       d = d->next;
+                       }
+
+               return access;
+               }
+       else
+               return 0;
+}
+
+/*     This function scans the exception graph structure to find modifications of
+       array index variables of the current loop. If any modifications are found,
+       1 is returned, else 0.
+*/
+int quick_scan(int node)
+{
+       basicblock bp;
+       instruction *ip;
+       int count, i;
+       struct LoopVar *lv;
+       struct depthElement *d;
+  
+       /*  printf("QS: %d - %d\n", node, c_exceptionVisit[node]);                                      */
+   
+
+       if (c_exceptionVisit[node] > 0) {       /* node is part of exception graph              */
+               c_exceptionVisit[node] = -1;
+               
+               bp = block[node];                               /* setup scan of all instructions               */
+               ip = bp.iinstr;
+               count = bp.icount;                              
+
+               for (i=0; i<count; ++i, ++ip) { /* for each instruction do                              */
+                       switch (ip->opc) {
+                       case ICMD_ISTORE:
+                       case ICMD_IINC:                         /* a variable is modified                               */
+       
+                               lv = c_loopvars;                /* is it an array index var ?                   */
+                               while (lv != NULL) {
+                                       if ((lv->index) && (lv->value == ip->op1))
+                                               return 1;               /* yes, so return 1                                             */
+                                       lv = lv->next;
+                                       }
+                               break;
+                               }
+                       }
+  
+           d = c_exceptionGraph[node];         /* check all successor nodes                    */
+               while (d != NULL) {
+                       if (quick_scan(d->value) > 0)
+                               return 1;                               /* if an access is found return 1               */
+                       d = d->next;
+                       }
+
+               return 0;                                               /* nothing found, so return 0                   */
+               }
+       else
+               return 0;
+}
+
+/*     This function returns 1, when the condition of the loop contains 
+       or statements or when an array index variable is modified in any
+       catch block within the loop.
+*/
+int analyze_or_exceptions(int head, struct LoopContainer *lc)
+{
+       struct depthElement *d;
+       int i, k, value, flag, count;
+       struct LoopElement *le;
+
+       d = c_dTable[head];
+       count = flag = 0;
+
+       /* analyze for or-statements                                                                                            */
+#ifdef LOOP_DEBUG
+       printf("*** Analyze for OR ... ");                                                                              
+       fflush(stdout);
+#endif
+
+       while (d != NULL) {                             /* for all successor nodes check if they        */
+               value = d->value;                       /* are part of the loop                                         */
+
+               le = lc->nodes;
+
+               while (le != NULL) {
+                       if (le->node == value)
+                               break;
+                       le = le->next;
+                       }
+
+               if (le == NULL)                         /* node is not part of the loop                         */
+                       ++flag;                                 
+
+               d = d->next;
+               ++count;
+               }
+
+       if ((count > 1) && (flag == 0)){/* if all successors part of the loop, exit */
+#ifdef STATISTICS
+               c_stat_or++;
+#endif
+               return 0;
+               }
+
+       /* check for exceptions */
+       /* printf("done\n*** Analyze for EXCEPTIONS(%d) . ", exceptiontablelength);     */
+
+       if (!exceptiontablelength)              /* when there are no exceptions, exit           */
+               return 1;
+
+       if ((c_exceptionGraph = (struct depthElement **) malloc(sizeof(struct depthElement *) * block_count)) == NULL)
+               c_mem_error();
+       if ((c_exceptionVisit = (int *) malloc(sizeof(int) * block_count)) == NULL)
+               c_mem_error();
+       
+       for (k=0; k<block_count; ++k) {
+               c_exceptionVisit[k] = -1;
+               c_exceptionGraph[k] = NULL;
+               }
+
+
+       /* for all nodes that start catch block check whether they are part of loop     */
+       for (i = 0; i < c_old_xtablelength; i++) {      
+               value = block_index[extable[i].startpc];
+   
+               le = lc->nodes;
+               while (le != NULL) {
+
+                       if (le->node == value)  {                       /* exception is in loop                 */
+#ifdef LOOP_DEBUG
+                               printf("C_INFO: Loop contains exception\n");                                    
+                               fflush(stdout);
+#endif
+
+                               /* build a graph structure, that contains all nodes that are    */
+                               /* part of the catc block                                                                               */
+                               dF_Exception(-1, block_index[extable[i].handlerpc]);
+
+                               /* if array index variables are modified there, return 0                */
+                               if (quick_scan(block_index[extable[i].handlerpc]) > 0) {
+#ifdef STATISTICS
+                                       c_stat_exception++;
+#endif
+                                       /* printf("C_INFO: loopVar modified in exception\n");           */
+                                       return 0;
+                                       }
+                               }
+                       le = le->next;
+                       }
+               }
+
+#ifdef LOOP_DEBUG
+       printf("none ... done\n");                                                                                              
+       fflush(stdout);
+#endif
+       return 1;
+}
+
+/*     This function sets a flag in c_var_modified for all variables that have
+       been found as part of an assigment in the loop.
+*/
+void scan_global_list()
+{
+       struct LoopVar *lv;
+       lv = c_loopvars;
+
+       while (lv != NULL) {
+               if (lv->modified)
+                       c_var_modified[lv->value] = 1;
+               lv = lv->next;
+               }
+}
+
+/*     This function analyses the condition in the loop header and trys to find
+       out, whether some dynamic guarantees can be set up.
+*/
+void init_constraints(int head)
+{
+       basicblock bp;
+       instruction *ip;
+       int ic, l_mod, r_mod, changed, operand;
+       struct Trace *left, *right, *th;
+       struct LoopVar *lv_left, *lv_right, *lh;
+
+       bp = block[head];
+       ic = bp.icount;
+       ip = bp.iinstr+(ic-1);  /* set ip to last instruction in header node            */
+
+       switch (ip->opc) {              /* check op-code                                                                        */
+               
+       /* comparison against constant value                                                                            */
+       case ICMD_IFEQ:                 /* ..., value ==> ...                                                           */
+       case ICMD_IFLT:         /* ..., value ==> ...                                                           */
+       case ICMD_IFLE:         /* ..., value ==> ...                                                           */
+       case ICMD_IFGT:         /* ..., value ==> ...                                                           */
+       case ICMD_IFGE:         /* ..., value ==> ...                                                           */
+                                                       /* op1 = target JavaVM pc, val.i = constant                     */
+
+               left = tracing(&bp, ic-2, 0);   /* analyse left arg., right is constant */
+               right = create_trace(TRACE_ICONST, -1, ip->val.i, 0);
+               break;
+
+       /* standard comparison                                                                                                          */
+       case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                                            */
+       case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                                            */
+       case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                                            */
+       case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                                            */
+       case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                                            */
+               
+               left = tracing(&bp, ic-2, 1);   /* get left and right argument                  */
+               right = tracing(&bp, ic-2, 0);
+               break;
+       
+       /* other condition                                                                                                                      */
+       default:
+               left = create_trace(TRACE_UNKNOWN, -1, 0, 0);
+               right = create_trace(TRACE_UNKNOWN, -1, 0, 0);
+               break;
+               }
+
+       /* analyse left and right side of comparison                                                            */
+       l_mod = r_mod = 0;
+
+       if (left->type == TRACE_IVAR) { /* is a loop variable on left side ?            */
+               lv_left = c_loopvars;
+               while (lv_left != NULL) {
+                       if (lv_left->value == left->var) {
+                               l_mod = lv_left->modified;      /* yes, but has it been modified ?      */       
+                               break;                          
+                               }
+                       lv_left = lv_left->next;
+                       }
+               }
+
+       if (right->type == TRACE_IVAR){ /* is a loop variable on right side ?           */
+               lv_right = c_loopvars;
+               while (lv_right != NULL) {
+                       if (lv_right->value == right->var) {
+                               r_mod = lv_right->modified;     /* yes, but has it been modified ?      */
+                               break;
+                               }
+                       lv_right = lv_right->next;
+                       }
+               }
+
+       if ((l_mod - r_mod) == 0) {             /* both 1 or both 0 -> no dynamic contraints*/
+               c_rightside = NULL;                     /* possible                                                                     */
+               return;
+               }
+
+       /* to simplify processing, make the left side the one, that contains the        */
+       /* modified variable                                                                                                            */
+       if (r_mod > l_mod) {
+               th = left;    left = right;        right = th;
+               lh = lv_left; lv_left = lv_right;  lv_right = lh;
+               changed = 1;                            /* set changed to true                                          */
+               }
+       else
+               changed = 0;                            /* no change needed                                                     */ 
+
+       /* make sure that right side's value does not change during loop execution      */ 
+       if (right->type == TRACE_UNKNOWN) {
+               c_rightside = NULL;
+               return;
+               }
+
+       /* determine operands:                                                                                                          */
+       /* for further explaination a is modified, b nonmodified var                            */
+       switch (ip->opc) {              /* check opcode again                                                           */      
+       case ICMD_IFEQ:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                                            */
+               operand = OP_EQ;                                /* a == b                                                               */
+               break;
+
+       case ICMD_IFLE:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                                            */
+               if (changed)
+                       operand = OP_GE;                        /* b<=a         -> a>=b                                         */
+               else {
+                       operand = OP_LT;                        /* a<=b         -> a<(b+1)                                      */ 
+                       if (left->constant != 0)
+                               left->constant -= 1;
+                       else
+                               right->constant += 1;   
+                       }
+               break;
+
+       case ICMD_IFLT:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                                            */
+               if (changed) {
+                       operand = OP_GE;                        /* b<a          -> a>=(b+1)                                     */
+                       if (left->constant != 0)
+                               left->constant -= 1;
+                       else
+                               right->constant += 1;   
+                       }
+               else
+                       operand = OP_LT;                        /* a<b          -> a<b                                          */
+               break;
+
+       case ICMD_IFGT:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                                            */
+               if (changed)
+                       operand = OP_LT;                        /* b>a          -> a<b                                          */
+               else {
+                       operand = OP_GE;                        /* a>b          ->      a>=(b+1)                                */
+                       if (left->constant != 0)
+                               left->constant -= 1;
+                       else
+                               right->constant += 1;
+                       }
+               break;
+               
+       case ICMD_IFGE:         /* ..., value ==> ...                                                           */
+       case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                                            */
+               if (changed) {
+                       operand = OP_LT;                        /* b>=a         -> a<(b+1)                                      */
+                       if (left->constant != 0)
+                               left->constant -= 1;
+                       else
+                               right->constant += 1;
+                       }
+               else
+                       operand = OP_GE;                        /* a>=b         -> a>=b                                         */
+               break;
+
+       default:
+               printf("C_ERROR: debugging error 0x00\n");
+               }
+
+
+       /* NOW: left/lv_left -> loopVar                                                                                         */
+       /*              right/lv_right -> const, nonmod. var, arraylength                                       */
+       switch (operand) {                                      /* check operand                                                */
+       case OP_EQ:
+               lv_left->dynamic_u_v = 1;               /* upper + lower bound tested                   */
+               lv_left->dynamic_l_v = 1;
+       
+               lv_left->dynamic_l = lv_left->dynamic_u = left->constant;
+               break;
+
+       case OP_LT:
+               lv_left->dynamic_u_v = 1;               /* upper bound tested                                   */
+       
+               lv_left->dynamic_u = left->constant;
+               break;
+
+       case OP_GE:
+               lv_left->dynamic_l_v = 1;               /* lower bound tested                                   */
+       
+               lv_left->dynamic_l = left->constant;
+               break;
+
+       default:
+               printf("C_ERROR: debugging error 0x01\n");
+               }
+
+       c_rightside = right;
+
+       switch (c_rightside->type) {
+       case TRACE_ICONST:
+               c_rs_needed_instr = 1;
+               break;
+       case TRACE_ALENGTH:
+               c_rs_needed_instr = 2;
+               break;
+       case TRACE_IVAR:
+               c_rs_needed_instr = 3;
+               break;
+       default:
+               printf("C_ERROR: wrong right-side type\n");
+               }
+}
+
+/*     This function is needed to add and record new static tests (before loop
+       entry) of variables to make guaratees for index variables. type states
+       the kind of the test. arrayRef is the array, which length is tested
+       against, varRef is the variable, that is testes and constant is the
+       constant value, that is tested.
+*/
+void add_new_constraint(int type, int arrayRef, int varRef, int constant)
+{
+       struct Constraint *tc;
+
+       switch (type) {
+       case TEST_ZERO:                                 /* a variable is tested against a const         */
+
+               tc = c_constraints[varRef];     /* does a test already exist for this var ?     */
+               while (tc != NULL) {
+                       if (tc->type == TEST_ZERO) {
+                               if (constant < tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes. update constant and return                      */
+                               }
+                               tc = tc->next;
+                       }
+
+               /* insert a new test for this variable                                                                  */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type     = TEST_ZERO;
+               tc->varRef   = varRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[varRef];
+               c_constraints[varRef] = tc;
+               c_needed_instr += 3;
+
+               break;
+
+       case TEST_ALENGTH:                              /* variable is tested against array length      */
+
+               tc = c_constraints[varRef];     /* does a test already exist for this var ?     */
+               while (tc != NULL) {
+                       if ((tc->type == TEST_ALENGTH) && (tc->arrayRef == arrayRef)) {
+                               if (constant > tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes. update constant and return                      */
+                               }
+                       tc = tc->next;
+                       }
+
+               /* insert a new test for this variable                                                                  */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_ALENGTH;
+               tc->arrayRef = arrayRef;
+               tc->varRef   = varRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[varRef];
+               c_constraints[varRef] = tc;
+               c_needed_instr += 6;
+
+               /* if arrayRef is not already tested against null, insert that test     */
+               if (!(c_null_check[arrayRef])) {
+                       c_null_check[arrayRef] = 1;
+                       c_needed_instr +=2;
+                   }
+                       
+               break;
+
+       case TEST_CONST_ZERO:           
+               /* done earlier                                                                                                                 */
+               break;
+
+       case TEST_CONST_ALENGTH:                /* a const is tested against array length       */
+
+               /* does a test already exist for this array                                                             */
+               tc = c_constraints[maxlocals];
+               while (tc != NULL) {
+                       if ((tc->type == TEST_CONST_ALENGTH) && (tc->arrayRef == arrayRef)) {
+                               if (constant > tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes. update constant and return                      */
+                               }
+                       tc = tc->next;
+                       }
+               
+               /* insert a new test for this array                                                                             */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_CONST_ALENGTH;
+               tc->arrayRef = arrayRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[maxlocals];
+               c_constraints[maxlocals] = tc;
+               c_needed_instr += 4;
+
+               /* if arrayRef is not already tested against null, insert that test     */
+               if (!(c_null_check[arrayRef])) {
+                       c_null_check[arrayRef] = 1;
+                       c_needed_instr +=2;
+                   }
+
+               break;
+
+       case TEST_UNMOD_ZERO:                   /* test unmodified var against constant         */
+
+               /* search if test already exists                                                                                */
+               tc = c_constraints[varRef];
+               while (tc != NULL) {
+                       if (tc->type == TEST_UNMOD_ZERO) {
+                               if (constant < tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes, so update constant                                      */
+                               }
+                       tc = tc->next;
+                       }
+               
+               /* else, a new test is inserted                                                                                 */              
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_UNMOD_ZERO;
+               tc->varRef   = varRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[varRef];
+               c_constraints[varRef] = tc;
+               c_needed_instr += 3;
+
+               break;
+       
+       case TEST_UNMOD_ALENGTH:                /* test unmodified var against array length     */
+
+               /* search if test alreay exists                                                                                 */
+               tc = c_constraints[varRef];
+               while (tc != NULL) {
+                       if ((tc->type == TEST_UNMOD_ALENGTH) && (tc->arrayRef == arrayRef)) {
+                               if (constant > tc->constant)
+                                       tc->constant = constant;        
+                               return;                         /* yes, so modify constants                                     */
+                               }
+                       tc = tc->next;
+                       }
+               
+               /* create new entry                                                                                                             */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_UNMOD_ALENGTH;
+               tc->varRef   = varRef;
+               tc->arrayRef = arrayRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[varRef];
+               c_constraints[varRef] = tc;
+               c_needed_instr += 6;
+
+               /* if arrayRef is not already tested against null, insert that test     */
+               if (!(c_null_check[arrayRef])) {
+                       c_null_check[arrayRef] = 1;
+                       c_needed_instr +=2;
+                   }
+
+               break;
+       
+       case TEST_RS_ZERO:                              /* test right side of the loop condition        */
+                                                                       /* against a constant - needed by dynamic       */
+                                                                       /* checks                                                                       */
+               /*!! varRef -> maxlocals */
+               /* search if test already exists                                                                                */
+               tc = c_constraints[maxlocals];
+               while (tc != NULL) {
+                       if (tc->type == TEST_RS_ZERO) {
+                               if (constant < tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes, so modify constants                                     */
+                               }
+                       tc = tc->next;
+                       }
+
+               /* create new entry                                                                                                             */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type     = TEST_RS_ZERO;
+               tc->constant = constant;
+               tc->next     = c_constraints[maxlocals];
+               c_constraints[maxlocals] = tc;
+               c_needed_instr += (2 + c_rs_needed_instr);
+
+               /* if arrayRef on right side is not already tested against null,        */
+               /* insert that test                                                     */
+               if ((c_rightside->type == TRACE_ALENGTH) && (!(c_null_check[c_rightside->var]))) {
+                       c_null_check[c_rightside->var] = 1;
+                       c_needed_instr +=2;
+                   }
+
+               break;
+               
+       case TEST_RS_ALENGTH:                   /* test right side of the loop condition        */
+                                                                       /* against array length - needed by dynamic     */
+                                                                       /* checks                                                                       */
+               /*!! varRef -> maxlocals */
+               /* search if test already exists                                                                                */
+               tc = c_constraints[maxlocals];
+               while (tc != NULL)
+               {
+                       if ((tc->type == TEST_RS_ALENGTH) && (tc->arrayRef == arrayRef))
+                       {
+                               if (constant > tc->constant)
+                                       tc->constant = constant;
+                               return;                         /* yes, so modify constants                                     */
+                       }
+                       tc = tc->next;
+               }
+
+               /* create new entry                                                                                                             */
+               if ((tc = (struct Constraint *) malloc(sizeof(struct Constraint))) == NULL)
+                       c_mem_error();
+               tc->type         = TEST_RS_ALENGTH;
+               tc->arrayRef = arrayRef;
+               tc->constant = constant;
+               tc->next     = c_constraints[maxlocals];
+               c_constraints[maxlocals] = tc;
+               c_needed_instr += (3 + c_rs_needed_instr);
+
+               /* if arrayRef is not already tested against null, insert that test     */
+               if (!(c_null_check[arrayRef])) {
+                       c_null_check[arrayRef] = 1;
+                       c_needed_instr +=2;
+                   }
+
+               /* if arrayRef on right side is not already tested against null,        */
+               /* insert that test                                                     */
+               if ((c_rightside->type == TRACE_ALENGTH) && (!(c_null_check[c_rightside->var]))) {
+                       c_null_check[c_rightside->var] = 1;
+                       c_needed_instr +=2;
+                   }
+               break;
+
+       }
+}
+
+/*     This functions adds new static (before loop enry) tests of variables to the
+       program to be able to guarantee certain values for index variables in array
+       access (to safely remove bound checks).
+*/
+int insert_static(int arrayRef, struct Trace *index, struct Changes *varChanges, int special)
+{
+       struct LoopVar *lv;
+       int varRef;
+       int high, low;
+       
+       /* printf("insert static check - %d\n", arrayRef);
+          show_trace(index);
+          show_change(varChanges);
+       */
+
+       if (varChanges == NULL) {                       /* the variable hasn't changed / const  */
+               if ((varChanges = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                       c_mem_error();
+               varChanges->lower_bound = varChanges->upper_bound = 0;
+               }
+
+       switch (index->type) {                          /* check index type                                             */
+       case TRACE_IVAR:                                        /* it is a variable                                             */
+               if (index->neg < 0) {                   /* if it's a negated var, return                */
+#ifdef STATISTICS
+                       c_stat_no_opt++;                        
+#endif
+                       return OPT_NONE;
+                       }
+
+               varRef = index->var;
+               high = low = 0;
+
+               if (c_var_modified[varRef])     {       /* volatile var                                                 */
+                       
+                       lv = c_loopvars;                        /* get reference to loop variable               */
+
+                       while ((lv != NULL) && (lv->value != varRef))
+                               lv = lv->next;
+                       if (lv == NULL)
+                         printf("C_ERROR: debugging error 0x02\n");
+
+                       /* show_varinfo(lv);                                                                                            */
+                       
+                       /* check existing static bounds and add new contraints on variable      */
+                       /* to possibly remove bound checks                                                                      */
+                       if (lv->static_l) {
+                               /* the var is never decremented, so we add a static test againt */
+                               /* constant                                                                                                             */
+                               if (varChanges->lower_bound > varChanges->upper_bound)
+                                       add_new_constraint(TEST_ZERO, arrayRef, varRef, index->constant);
+                               else
+                                       add_new_constraint(TEST_ZERO, arrayRef, varRef, varChanges->lower_bound+index->constant);
+                               low = 1;
+                               }
+                       else if ((lv->dynamic_l_v) && (!special)) {
+                               /* the variable is decremented, but it is checked against a             */
+                               /* bound in the loop condition                                                                  */
+                               if (varChanges->lower_bound <= varChanges->upper_bound) {
+                                       add_new_constraint(TEST_RS_ZERO, arrayRef, varRef, varChanges->lower_bound+index->constant+lv->dynamic_l);
+                                       low = 1;
+                                       }
+                               }
+
+                       if (lv->static_u) {
+                               /* the var is never incremented, so we add a static test againt */
+                               /* constant                                                                                                             */
+                               if (varChanges->lower_bound > varChanges->upper_bound)
+                                       add_new_constraint(TEST_ALENGTH, arrayRef, varRef, index->constant);
+                               else
+                                       add_new_constraint(TEST_ALENGTH, arrayRef, varRef, varChanges->upper_bound+index->constant);
+                               high = 1;
+                               }
+                       else if ((lv->dynamic_u_v) &&  (!special)) {
+                               /* the variable is decremented, but it is checked against a             */
+                               /* bound in the loop condition                                                                  */
+                               if (varChanges->lower_bound <= varChanges->upper_bound) {
+                                       add_new_constraint(TEST_RS_ALENGTH, arrayRef, varRef, varChanges->upper_bound+index->constant+lv->dynamic_u);
+                                       high = 1;
+                                       }
+                               }
+                       }
+               else {                                                  /* the var is never modified at all             */
+                       add_new_constraint(TEST_UNMOD_ZERO, arrayRef, index->var, index->constant);
+                       add_new_constraint(TEST_UNMOD_ALENGTH, arrayRef, index->var, index->constant);
+                       low = high = 1;
+                       }
+               
+               /* if the addition of new variable tests made guarantees possible,              */
+               /* return the best possible optimization                                                                */
+               if ((high > 0) && (low > 0)) {
+                       /* printf("fully optimzed\n");                                                                          */
+#ifdef STATISTICS
+                       c_stat_full_opt++;                      
+#endif
+                       return OPT_FULL;
+                       }
+               else if (high > 0) {
+                       /* printf("upper optimzed\n");                                                                          */
+#ifdef STATISTICS
+                       c_stat_upper_opt++;                     
+#endif
+                       return OPT_UPPER;
+                       }
+               else if (low > 0) {
+                       /* printf("lower optimzed\n");                                                                          */
+#ifdef STATISTICS
+                       c_stat_lower_opt++;                     
+#endif
+                       return OPT_LOWER;
+                       }
+               else {
+                       /* printf("not optimzed\n");                                                                            */
+#ifdef STATISTICS
+                       c_stat_no_opt++;                        
+#endif
+                       return OPT_NONE;
+                       }
+               break;
+
+       case TRACE_ICONST:                      /* if it is a constant, optimization is easy    */
+               if (index->constant < 0) {
+#ifdef STATISTICS
+                       c_stat_no_opt++;                        
+#endif
+                       return OPT_NONE;        /* negative index -> bad                                                */
+                       }
+               else {
+                       add_new_constraint(TEST_CONST_ALENGTH, arrayRef, 0, index->constant);
+#ifdef STATISTICS
+                       c_stat_full_opt++;                      
+#endif
+                       return OPT_FULL;        /* else just test constant against array length */
+                       }
+               break;
+
+       case TRACE_ALENGTH:                     /* else, no optimizations possible                              */
+       case TRACE_UNKNOWN: 
+       case TRACE_AVAR:    
+#ifdef STATISTICS
+               c_stat_no_opt++;                        
+#endif
+               return OPT_NONE;
+       }
+
+       /* keep compiler happy */
+       return 0;
+}
+
+
+
+/*     copy a stack and return the start pointer of the newly created one
+*/
+stackptr copy_stack_from(stackptr source) { 
+       stackptr current, top;
+
+       if (source == NULL)
+               return NULL;
+
+       /* copy first element                                                       */
+       current = DMNEW(stackelement, 1);
+       current->type = source->type;
+       current->flags = source->flags;
+       current->varkind = source->varkind;
+       current->varnum = source->varnum;
+       current->regoff = source->regoff;
+       
+       top = current;
+
+       /* if there exist more, then copy the rest                                  */
+       while (source->prev != NULL) {
+               source = source->prev;
+               current->prev = DMNEW(stackelement, 1);
+               current->type = source->type;
+               current->flags = source->flags;
+               current->varkind = source->varkind;
+               current->varnum = source->varnum;
+               current->regoff = source->regoff;
+               current = current->prev;
+               }
+
+       current->prev = NULL;
+       return top;
+}
+
+
+/* The following defines are used in the procedure void create_static_checks(...)
+   They add a new instruction with its corresponding stack manipulation and
+   are used to build the new loop header of an optimized loop, where we have
+   to check certain variables and constants against values to guarantee that 
+   index values in array accesses remain with array bounds.
+
+   inst: pointer to the new instruction
+   tos: stackpointer before this operation is executed
+   newstack: temporary stackptr
+   stackdepth: counts the current stackdepth
+   original start: blockpointer to the head of the new, optimized loop 
+*/
+
+/* Load a local integer variable v                                              */
+#define LOAD_VAR(v) { \
+       inst->opc = ICMD_ILOAD; \
+       inst->op1 = v; \
+       newstack = DMNEW(stackelement, 1); \
+    inst->dst = newstack; \
+       newstack->prev = tos; \
+       newstack->type = TYPE_INT; \
+       newstack->flags = 0; \
+       newstack->varkind = LOCALVAR; \
+       newstack->varnum = v; \
+       tos = newstack; \
+       inst++; \
+       stackdepth++; \
+       }
+
+/* Load a constant with value c                                                 */
+#define LOAD_CONST(c) { \
+       inst->opc = ICMD_ICONST; \
+       inst->op1 = 0; \
+       inst->val.i = (c); \
+       newstack = DMNEW(stackelement, 1); \
+       newstack->prev = tos; \
+       newstack->type = TYPE_INT; \
+       newstack->flags = 0; \
+       newstack->varkind = UNDEFVAR; \
+       newstack->varnum = stackdepth; \
+       tos = newstack; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth++; \
+       }
+
+/* Load a local reference (adress) variable a                                   */
+#define LOAD_ADDR(a) { \
+       inst->opc = ICMD_ALOAD; \
+       inst->op1 = a; \
+       newstack = DMNEW(stackelement, 1); \
+       newstack->prev = tos; \
+       newstack->type = TYPE_ADR; \
+       newstack->flags = 0; \
+       newstack->varkind = LOCALVAR; \
+       newstack->varnum = a; \
+       tos = newstack; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth++; \
+       }
+
+/* Insert a compare greater-or-equal and jump to the unoptimized loop, if the   */
+/* comparison is true                                                           */
+#define GOTO_NOOPT_IF_GE { \
+       inst->opc = ICMD_IF_ICMPGE; \
+    inst->target = original_start->copied_to; \
+       if (tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+    if (tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth -= 2; \
+       }
+
+/* Insert a compare greater than and jump to the unoptimized loop, if the       */
+/* comparison is true                                                           */
+#define GOTO_NOOPT_IF_GT { \
+       inst->opc = ICMD_IF_ICMPGT; \
+    inst->target = original_start->copied_to; \
+       if (tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+    if (tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth -= 2; \
+       }
+
+
+/* Insert a compare less-than and jump to the unoptimized loop, if the          */
+/* comparison is true                                                           */
+#define GOTO_NOOPT_IF_LT { \
+       inst->opc = ICMD_IF_ICMPLT; \
+    inst->target = original_start->copied_to; \
+       if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+    if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth -= 2; \
+       }
+
+/* Insert a compare if-not-null and jump to the unoptimized loop, if the        */
+/* comparison is true                                                           */
+#define GOTO_NOOPT_IF_NULL { \
+       inst->opc = ICMD_IFNULL; \
+    inst->target = original_start->copied_to; \
+    if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth -= 1; \
+       }
+
+/* Insert an add instruction, that adds two integer values on top of the stack  */
+/* together                                                                     */
+#define ADD { \
+       inst->opc = ICMD_IADD; \
+       if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+    if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       newstack = DMNEW(stackelement, 1); \
+       newstack->prev = tos; \
+       newstack->type = TYPE_INT; \
+       newstack->flags = 0; \
+       newstack->varkind = UNDEFVAR; \
+       newstack->varnum = stackdepth; \
+       tos = newstack; \
+       inst->dst = tos; \
+       inst++; \
+       stackdepth--; \
+       }
+               
+/* Insert instructions to load the arraylength of an array with reference a     */
+/* fisrt, the reference must be loaded, then a null-pointer check is inserted   */
+/* if not already done earlier. Finally an arraylength instruction is added     */
+#define LOAD_ARRAYLENGTH(a) { \
+    if (c_null_check[a]) { \
+               LOAD_ADDR(a); \
+               GOTO_NOOPT_IF_NULL; \
+               c_null_check[a] = 0; \
+           }  \
+       LOAD_ADDR(a); \
+    inst->opc = ICMD_ARRAYLENGTH; \
+       if(tos->varkind == UNDEFVAR) \
+               tos->varkind = TEMPVAR;  \
+    tos = tos->prev; \
+       newstack = DMNEW(stackelement, 1); \
+       newstack->prev = tos; \
+       newstack->type = TYPE_INT; \
+       newstack->flags = 0; \
+       newstack->varkind = UNDEFVAR; \
+       newstack->varnum = stackdepth; \
+       tos = newstack; \
+       inst->dst = tos; \
+       inst++; \
+       }       
+
+
+/* Inserts the instructions to load the value of the right side of comparison   */
+/* Depending of the type of the right side, the apropriate instructions are     */
+/* created.                                                                     */
+#define LOAD_RIGHT_SIDE { \
+       switch (c_rightside->type) { \
+       case TRACE_ICONST: \
+               LOAD_CONST(c_rightside->constant); \
+               break; \
+       case TRACE_IVAR: \
+               LOAD_VAR(c_rightside->var); \
+               LOAD_CONST(c_rightside->constant); \
+               ADD; \
+               break; \
+       case TRACE_ALENGTH: \
+               LOAD_ARRAYLENGTH(c_rightside->var); \
+               break; \
+       default: \
+               panic("C_ERROR: illegal trace on rightside of loop-header"); \
+       } \
+}
+
+/*     Patch jumps in original loop and in copied loop, add gotos in copied loop.
+       All jumps in the original loop to the loop head have to be redirected to
+       the newly inserted one. For the copied loop, it is necessay to redirect all
+       jumps inside that loop to the copied nodes. lc points to the current loop, 
+       loop_head is a pointer to the newly inserted head and original start was
+       the old head and is now the head of the optimized variant of the loop.
+*/
+void patch_jumps(basicblock *original_start, basicblock *loop_head, struct LoopContainer *lc)
+{
+       /* step through all nodes of a loop                                         */
+       struct LoopElement *le;
+       basicblock *bptr;
+       instruction *inst, *temp_instr;
+       int i;
+
+       le = lc->nodes;
+       while (le != NULL) {
+
+               /* do nothing for new loop head                                         */
+               if (le->block == loop_head) {
+                       le = le->next;
+                       continue;
+                   }
+
+               /* for original version                                                 */
+               bptr = le->block;
+               inst = bptr->iinstr;
+               for (i = 0; i < bptr->icount; ++i, ++inst) {
+                       switch (inst->opc) {
+
+                       case ICMD_IF_ICMPEQ:
+                       case ICMD_IF_ICMPLT:
+                       case ICMD_IF_ICMPLE:
+                       case ICMD_IF_ICMPNE:
+                       case ICMD_IF_ICMPGT:
+                       case ICMD_IF_ICMPGE:
+
+                       case ICMD_IF_LCMPEQ:
+                       case ICMD_IF_LCMPLT:
+                       case ICMD_IF_LCMPLE:
+                       case ICMD_IF_LCMPNE:
+                       case ICMD_IF_LCMPGT:
+                       case ICMD_IF_LCMPGE:
+
+                       case ICMD_IF_ACMPEQ:
+                       case ICMD_IF_ACMPNE:
+
+                       case ICMD_IFEQ:
+                       case ICMD_IFNE:
+                       case ICMD_IFLT:
+                       case ICMD_IFGE:
+                       case ICMD_IFGT:
+                       case ICMD_IFLE:
+
+                       case ICMD_IF_LEQ:
+                       case ICMD_IF_LNE:
+                       case ICMD_IF_LLT:
+                       case ICMD_IF_LGE:
+                       case ICMD_IF_LGT:
+                       case ICMD_IF_LLE:
+
+                       case ICMD_GOTO:
+                       case ICMD_JSR:
+                       case ICMD_IFNULL:
+                       case ICMD_IFNONNULL:
+
+                               /* jump to newly inserted loopheader has to be redirected       */
+                               if (((basicblock *) inst->target) == loop_head)
+                                       inst->target = (void *) original_start;
+                               break;
+
+                       case ICMD_TABLESWITCH:
+                               {
+                                       s4 *s4ptr, l, i;
+                                       void **tptr;
+
+                                       tptr = (void **) inst->target;
+
+                                       s4ptr = inst->val.a;
+                                       l = s4ptr[1];                          /* low     */
+                                       i = s4ptr[2];                          /* high    */
+
+                                       i = i - l + 1;
+
+                                       /* jump to newly inserted loopheader has to be redirected   */
+                                       for (tptr = inst->target; i >= 0; --i, ++tptr) {
+                                               if (((basicblock *) *tptr) == loop_head)
+                                                       tptr[0] = (void *) original_start;
+                                               }
+                               }
+                               break;
+
+                       case ICMD_LOOKUPSWITCH:
+                               {
+                                       s4 i, l, *s4ptr;
+                                       void **tptr;
+
+                                       tptr = (void **) inst->target;
+
+                                       s4ptr = inst->val.a;
+                                       l = s4ptr[0];                          /* default  */
+                                       i = s4ptr[1];                          /* count    */
+
+                                       /* jump to newly inserted loopheader has to be redirected   */
+                                       for (tptr = inst->target; i >= 0; --i, ++tptr) {
+                                               if (((basicblock *) *tptr) == loop_head)
+                                                       tptr[0] = (void *) original_start;
+                                               }
+                               }
+                               break;
+                       }
+               }
+
+               /* if node is part of loop and has fall through to original start, that */
+               /* must be redirected. Unfortunately the instructions have to be copied */
+
+               if (bptr->next == loop_head) {
+                       temp_instr = DMNEW(instruction, bptr->icount + 1);
+                       memcpy(temp_instr, bptr->iinstr, sizeof(instruction)*bptr->icount);
+                       bptr->iinstr = temp_instr;
+
+                       bptr->iinstr[bptr->icount].opc = ICMD_GOTO;
+                       bptr->iinstr[bptr->icount].target = original_start;
+                       bptr->iinstr[bptr->icount].dst = NULL;
+                       ++bptr->icount;
+                       }       
+               
+               /* for copied version - which gets the unoptimized variant              */
+               bptr = le->block->copied_to;
+               inst = bptr->iinstr;
+               for (i = 0; i < bptr->icount; ++i, ++inst) {
+
+                       switch (inst->opc) {
+
+                       case ICMD_IASTORE:                      /* array store                                                  */
+                       case ICMD_LASTORE:          
+                       case ICMD_FASTORE:          
+                       case ICMD_DASTORE:          
+                       case ICMD_AASTORE:          
+                       case ICMD_BASTORE:          
+                       case ICMD_CASTORE:          
+                       case ICMD_SASTORE:
+                       case ICMD_IALOAD:                       /* array load                                               */
+                   case ICMD_LALOAD:       
+                       case ICMD_FALOAD:
+                       case ICMD_DALOAD:
+                       case ICMD_AALOAD:
+                       case ICMD_BALOAD:
+                       case ICMD_CALOAD:
+                       case ICMD_SALOAD:
+
+                               /* undo previous optimizations in new loop                      */
+                               inst->op1 = 0;
+                               break;
+
+                       case ICMD_IF_ICMPEQ:
+                       case ICMD_IF_ICMPLT:
+                       case ICMD_IF_ICMPLE:
+                       case ICMD_IF_ICMPNE:
+                       case ICMD_IF_ICMPGT:
+                       case ICMD_IF_ICMPGE:
+
+                       case ICMD_IF_LCMPEQ:
+                       case ICMD_IF_LCMPLT:
+                       case ICMD_IF_LCMPLE:
+                       case ICMD_IF_LCMPNE:
+                       case ICMD_IF_LCMPGT:
+                       case ICMD_IF_LCMPGE:
+
+                       case ICMD_IF_ACMPEQ:
+                       case ICMD_IF_ACMPNE:
+
+                       case ICMD_IFEQ:
+                       case ICMD_IFNE:
+                       case ICMD_IFLT:
+                       case ICMD_IFGE:
+                       case ICMD_IFGT:
+                       case ICMD_IFLE:
+
+                       case ICMD_IF_LEQ:
+                       case ICMD_IF_LNE:
+                       case ICMD_IF_LLT:
+                       case ICMD_IF_LGE:
+                       case ICMD_IF_LGT:
+                       case ICMD_IF_LLE:
+
+                       case ICMD_GOTO:
+                       case ICMD_JSR:
+                       case ICMD_IFNULL:
+                       case ICMD_IFNONNULL:
+
+                               /* jump to newly inserted loopheader has to be redirected       */
+                               if (((basicblock *) inst->target) == loop_head)
+                                       inst->target = (void *) original_start->copied_to;
+                               /* jump to loop internal nodes has to be redirected             */
+                               else if (((basicblock *) inst->target)->lflags & LOOP_PART)
+                                       inst->target = (void *) ((basicblock *) inst->target)->copied_to;
+                               break;
+                               
+                       case ICMD_TABLESWITCH:
+                               {
+                                       s4 *s4ptr, l, i;
+                                       
+                                       void **copy_ptr, *base_ptr;
+                                       void **tptr;
+
+                                       tptr = (void **) inst->target;
+
+                                       s4ptr = inst->val.a;
+                                       l = s4ptr[1];                          /* low     */
+                                       i = s4ptr[2];                          /* high    */
+
+                                       i = i - l + 1;
+                                       
+                                       copy_ptr = (void**) DMNEW(void*, i+1);
+                                       base_ptr = (void*) copy_ptr;
+
+                                       /* Targets for switch instructions are stored in an extra   */
+                                       /* that must be copied for new inserted loop.               */
+
+                                       for (tptr = inst->target; i >= 0; --i, ++tptr, ++copy_ptr) {
+                                               /* jump to newly inserted loopheader must be redirected */
+                                               if (((basicblock *) *tptr) == loop_head)
+                                                       copy_ptr[0] = (void *) original_start->copied_to;
+                                               /* jump to loop internal nodes has to be redirected     */
+                                               else if (((basicblock *) *tptr)->lflags & LOOP_PART)
+                                                       copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                               else
+                                                       copy_ptr[0] = tptr[0];
+                                               }
+
+                                       inst->target = base_ptr;
+                               }
+                               break;
+
+                       case ICMD_LOOKUPSWITCH:
+                               {
+                                       s4 i, l, *s4ptr;
+
+                                       void **copy_ptr, **base_ptr;
+                                       void **tptr;
+
+                                       tptr = (void **) inst->target;
+
+                                       s4ptr = inst->val.a;
+                                       l = s4ptr[0];                          /* default  */
+                                       i = s4ptr[1];                          /* count    */
+
+                                       copy_ptr = (void**) DMNEW(void*, i+1);
+                                       base_ptr = (void*) copy_ptr;
+
+                                       /* Targets for switch instructions are stored in an extra   */
+                                       /* that must be copied for new inserted loop.               */
+
+                                       for (tptr = inst->target; i >= 0; --i, ++tptr, ++copy_ptr) {
+                                               /* jump to newly inserted loopheader must be redirected */
+                                               if (((basicblock *) *tptr) == loop_head)
+                                                       copy_ptr[0] = (void *) original_start->copied_to;
+                                               /* jump to loop internal nodes has to be redirected     */
+                                               else if (((basicblock *) *tptr)->lflags & LOOP_PART)
+                                                       copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                               else 
+                                                       copy_ptr[0] = tptr[0];
+                                               }
+
+                                       inst->target = base_ptr;
+                               }
+                               break;
+                               
+                               }
+                       }
+
+               /* if fall through exits loop, goto is needed                           */
+               if (!(le->block->next->lflags & LOOP_PART)) {
+                       bptr->iinstr[bptr->icount].opc = ICMD_GOTO;
+                       bptr->iinstr[bptr->icount].dst = NULL;
+                       bptr->iinstr[bptr->icount].target = le->block->next;
+                       bptr->icount++;
+                       }
+               
+               le = le->next;
+               }
+}
+
+/*     Add the new header node of a loop that has been duplicated to all parent 
+    loops in nesting hierarchie.
+*/
+void header_into_parent_loops(struct LoopContainer *lc, basicblock *to_insert, basicblock *replace, basicblock *after)
+{
+       /* we have to insert the node to_insert before the node after and replace   */
+       /* the pointer of to_insert by the node replace                             */
+
+       struct LoopElement *le, *t;
+
+       /* if the top of the tree is reached, then return                           */
+       if ((lc == NULL) || (lc == root))
+               return;
+
+       /* create new node, that should be inserted                                 */
+       t = DMNEW(struct LoopElement, 1);
+       t->block = to_insert;
+       t->node = -1;
+
+       /* first, find the node, that has to be replaced (= "to_insert") and        */
+       /* replace it by the node "replace"                                         */
+       le = lc->nodes;
+       while (le->block != to_insert)
+               le = le->next;
+       le->block = replace;
+
+       /* BUGFIX                                                                   */
+       if (after == to_insert)
+               after = replace;
+
+       /* now find the node after and insert the newly create node before "after"  */
+       le = lc->nodes;
+       if (le->block == after) {
+               t->next = lc->nodes;
+               lc->nodes = t;
+           }
+       else {
+               while (le->next->block != after)
+                       le = le->next;
+
+               t->next = le->next;
+               le->next = t;
+           }
+
+       /* go up one hierarchie level                                               */
+       header_into_parent_loops(lc->parent, to_insert, replace, after);
+}
+
+/*     Add a new node (not header) of a duplicated loop to all parent loops in 
+    nesting hierarchie
+*/
+void node_into_parent_loops(struct LoopContainer *lc, basicblock *to_insert)
+{
+       struct LoopElement *le, *t;
+
+       /* if the top of the tree is reached, then return                           */
+       if ((lc == NULL) || (lc == root))
+               return;
+
+       /* create new node, that should be inserted                                 */
+       t = DMNEW(struct LoopElement, 1);
+       t->block = to_insert;
+       t->node = -1;
+
+       le = lc->nodes;
+
+       /* append new node to node list of loop                                     */
+       while (le->next != NULL)
+               le = le->next;
+
+       t->next = le->next;
+       le->next = t;
+
+       /* go up one hierarchie level                                               */
+       node_into_parent_loops(NULL, to_insert);
+}
+
+
+/* void patch_handler(...) is very similar to parts of the function patch_jumps. 
+   Its task is to redirect all jumps from the original head to the new head and
+   to redirect internal jumps inside the exception handler to the newly
+   created (copied) nodes.
+*/
+void patch_handler(struct LoopContainer *lc, basicblock *bptr, basicblock *original_head, basicblock *new_head)
+{
+       instruction *ip;
+       int i;
+
+       /* If node is not part of exception handler or has been visited, exit       */
+       if (!(bptr->lflags & HANDLER_PART) || (bptr->lflags & HANDLER_VISITED))
+               return;
+
+       /* mark block as visited                                                    */
+       bptr->lflags |= HANDLER_VISITED;
+
+       /* for all instructions in the copied block, do                             */
+       for (i = 0, ip = bptr->copied_to->iinstr; i < bptr->copied_to->icount; ++i, ++ip) {
+               switch (ip->opc) {
+               case ICMD_RETURN:
+               case ICMD_IRETURN:
+               case ICMD_LRETURN:
+               case ICMD_FRETURN:
+               case ICMD_DRETURN:
+               case ICMD_ARETURN:
+               case ICMD_ATHROW:
+                       break;                                 
+
+               case ICMD_IF_ICMPEQ:
+               case ICMD_IF_ICMPLT:
+               case ICMD_IF_ICMPLE:
+               case ICMD_IF_ICMPNE:
+               case ICMD_IF_ICMPGT:
+               case ICMD_IF_ICMPGE:
+                       
+               case ICMD_IF_LCMPEQ:
+               case ICMD_IF_LCMPLT:
+               case ICMD_IF_LCMPLE:
+               case ICMD_IF_LCMPNE:
+               case ICMD_IF_LCMPGT:
+               case ICMD_IF_LCMPGE:
+
+               case ICMD_IF_ACMPEQ:
+               case ICMD_IF_ACMPNE:
+
+               case ICMD_IFEQ:
+               case ICMD_IFNE:
+               case ICMD_IFLT:
+               case ICMD_IFGE:
+               case ICMD_IFGT:
+               case ICMD_IFLE:
+                               
+               case ICMD_IF_LEQ:
+               case ICMD_IF_LNE:
+               case ICMD_IF_LLT:
+               case ICMD_IF_LGE:
+               case ICMD_IF_LGT:
+               case ICMD_IF_LLE:
+
+               case ICMD_JSR:
+               case ICMD_IFNULL:
+               case ICMD_IFNONNULL:
+
+                       patch_handler(lc, bptr->next, original_head, new_head); 
+
+                       /* fall through */
+
+               case ICMD_GOTO:
+
+                       patch_handler(lc, ip->target, original_head, new_head);
+
+                       /* jumps to old header have to be redirected                        */
+                       if (((basicblock *) ip->target) == original_head)
+                               ip->target = (void *) new_head->copied_to;
+                       /* jumps to handler internal nodes have to be redirected            */
+                       else if (((basicblock *) ip->target)->lflags & HANDLER_PART)
+                               ip->target = (void *) ((basicblock *) ip->target)->copied_to;
+                       /* jumps to loop internal nodes have to be redirected               */
+                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
+                               ip->target = (void *) ((basicblock *) ip->target)->copied_to;
+                  
+                  
+                       break;
+                               
+               case ICMD_TABLESWITCH:
+                       {
+                               s4 *s4ptr, l, i;
+                               void **tptr;
+                               void **copy_ptr, **base_ptr;
+                               tptr = (void **) ip->target;
+                               s4ptr = ip->val.a;
+                               l = s4ptr[1];                          /* low                   */
+                               i = s4ptr[2];                          /* high                  */
+                               i = i - l + 1;
+                               
+                               copy_ptr = (void**) DMNEW(void*, i+1);
+                               base_ptr = (void*) copy_ptr;
+
+                               for (tptr = ip->target; i >= 0; --i, ++tptr, ++copy_ptr) {
+                                       patch_handler(lc, ((basicblock *) *tptr), original_head, new_head);
+                                       /* jumps to old header have to be redirected                */
+                                       if (((basicblock *) *tptr) == original_head)
+                                               copy_ptr[0] = (void *) new_head->copied_to;
+                                       /* jumps to handler internal nodes have to be redirected    */
+                                       else if (((basicblock *) *tptr)->lflags & HANDLER_PART)
+                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                       /* jumps to loop internal nodes have to be redirected       */
+                                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
+                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                       else
+                                               copy_ptr[0] = tptr[0];
+                                   }
+
+                               ip->target = base_ptr;
+                       }
+                       break;
+
+               case ICMD_LOOKUPSWITCH:
+                       {
+                               s4 i, l, *s4ptr;
+
+                               void **tptr;
+                               void **copy_ptr, **base_ptr;
+
+                               tptr = (void **) ip->target;
+                               s4ptr = ip->val.a;
+                               l = s4ptr[0];                          /* default               */
+                               i = s4ptr[1];                          /* count                 */
+
+                               copy_ptr = (void**) DMNEW(void*, i+1);
+                               base_ptr = (void*) copy_ptr;
+
+                               for (tptr = ip->target; i >= 0; --i, ++tptr, ++copy_ptr) {
+
+                                       patch_handler(lc, ((basicblock *) *tptr), original_head, new_head);
+                                       /* jumps to old header have to be redirected                */
+                                       if (((basicblock *) *tptr) == original_head)
+                                               copy_ptr[0] = (void *) new_head->copied_to;
+                                       /* jumps to handler internal nodes have to be redirected    */
+                                       else if (((basicblock *) *tptr)->lflags & HANDLER_PART)
+                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                       /* jumps to loop internal nodes have to be redirected       */
+                                       else if (((basicblock *) ip->target)->lflags & LOOP_PART)
+                                               copy_ptr[0] = (void *) ((basicblock *) tptr[0])->copied_to;
+                                       else
+                                               copy_ptr[0] = tptr[0];
+                                   }
+
+                               ip->target = base_ptr;
+                       }
+                       break;
+                               
+                   }   /* switch */
+                  
+           }       /* for    */
+
+               /* if fall through exits loop, goto is needed                           */
+               if (!(bptr->next->lflags & HANDLER_PART)) {
+                       bptr->copied_to->iinstr[bptr->copied_to->icount].opc = ICMD_GOTO;
+                       bptr->copied_to->iinstr[bptr->copied_to->icount].dst = NULL;
+                       bptr->copied_to->iinstr[bptr->copied_to->icount].target = bptr->next;
+                       bptr->copied_to->icount++;
+                       }               
+}
+
+
+/* This function copys the exception handler and redirects all jumps from the
+   original head to the new head in the original exception handler. All
+   redirection in the copied exception handler is done in patch_handler(...).
+*/
+void copy_handler(struct LoopContainer *lc, basicblock *bptr, basicblock *original_head, basicblock *new_head)
+{
+       instruction *ip;
+       s4 *s4ptr;
+       void **tptr;
+       int high, low, count;
+       struct LoopElement *le;
+       basicblock *new;
+
+       /* If this node has already been copied, return                             */
+       if (bptr->lflags & HANDLER_PART)
+               return;
+
+       /* The exception handler exists, when control flow enters loop again        */
+
+       if (bptr->lflags & LOOP_PART)
+               return;
+       for (le = lc->nodes; le != NULL; le = le->next) {
+               if (le->block == bptr) {
+                       printf("C_PANIC: should not happen\n");
+                       exit(-1);
+            }
+           }
+
+       /* mark block as part of handler                                            */
+       bptr->lflags |= HANDLER_PART;
+
+       /* copy node                                                                */
+       new = DMNEW(basicblock, 1);    
+       memcpy(new, bptr, sizeof(basicblock));
+       new->debug_nr = c_debug_nr++;
+
+       c_last_block_copied = new;
+
+       /* copy instructions and allow one more slot for possible GOTO              */
+       new->iinstr = DMNEW(instruction, bptr->icount + 1);
+       memcpy(new->iinstr, bptr->iinstr, bptr->icount*sizeof(instruction));
+
+       /* update original block                                                    */
+       bptr->copied_to = new;
+
+       /* append block to global list of basic blocks                              */
+       last_block->next = new;
+       last_block = new;
+       new->next = NULL;
+
+
+       /* find next block to copy, depending on last instruction of BB             */
+       if (bptr->icount == 0) {
+               copy_handler(lc, bptr->next, original_head, new_head);
+               return;
+           }
+
+       ip = bptr->iinstr + (bptr->icount - 1);
+       
+               switch (ip->opc) {
+               case ICMD_RETURN:
+               case ICMD_IRETURN:
+               case ICMD_LRETURN:
+               case ICMD_FRETURN:
+               case ICMD_DRETURN:
+               case ICMD_ARETURN:
+               case ICMD_ATHROW:
+                       break;                                 
+               
+               case ICMD_IFEQ:
+               case ICMD_IFNE:
+               case ICMD_IFLT:
+               case ICMD_IFGE:
+               case ICMD_IFGT:
+               case ICMD_IFLE:
+                       
+               case ICMD_IF_LCMPEQ:
+               case ICMD_IF_LCMPLT:
+               case ICMD_IF_LCMPLE:
+               case ICMD_IF_LCMPNE:
+               case ICMD_IF_LCMPGT:
+               case ICMD_IF_LCMPGE:
+                       
+               case ICMD_IF_LEQ:
+               case ICMD_IF_LNE:
+               case ICMD_IF_LLT:
+               case ICMD_IF_LGE:
+               case ICMD_IF_LGT:
+               case ICMD_IF_LLE:
+                       
+               case ICMD_IFNULL:
+               case ICMD_IFNONNULL:
+                       
+               case ICMD_IF_ICMPEQ:
+               case ICMD_IF_ICMPNE:
+               case ICMD_IF_ICMPLT:
+               case ICMD_IF_ICMPGE:
+               case ICMD_IF_ICMPGT:
+               case ICMD_IF_ICMPLE:
+               case ICMD_IF_ACMPEQ:
+               case ICMD_IF_ACMPNE:
+                       copy_handler(lc, bptr->next, original_head, new_head);
+                       /* fall through */
+         
+               case ICMD_GOTO:
+
+                       /* redirect jump from original_head to new_head                    */
+                       if ((basicblock *) ip->target == original_head)
+                               ip->target = (void *) new_head;
+                               
+                       copy_handler(lc, (basicblock *) (ip->target), original_head, new_head);
+                       
+                       break;
+         
+               case ICMD_TABLESWITCH:
+                       s4ptr = ip->val.a;
+                       tptr = (void **) ip->target;
+                       
+                       /* default branch */
+                       if (((basicblock *) *tptr) == original_head)
+                               tptr[0] = (void *) new_head;
+                       
+                       copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
+                       
+                       s4ptr++;
+                       low = *s4ptr;
+                       s4ptr++;
+                       high = *s4ptr;
+                       
+                       count = (high-low+1);
+                       
+                       while (--count >= 0) {
+                               tptr++;
+                               /* redirect jump from original_head to new_head                 */
+                               if (((basicblock *) *tptr) == original_head)
+                                       tptr[0] = (void *) new_head;
+                               copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
+                       }
+                       break;
+
+               case ICMD_LOOKUPSWITCH:
+                       s4ptr = ip->val.a;
+                       tptr = (void **) ip->target;
+                       
+                       /* default branch */
+                       if (((basicblock *) *tptr) == original_head)
+                               tptr[0] = (void *) new_head;
+                       
+                       copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
+                       
+                       ++s4ptr;
+                       count = *s4ptr;
+                       
+                       while (--count >= 0) {
+                               ++tptr;
+                               /* redirect jump from original_head to new_head                 */
+                               if (((basicblock *) *tptr) == original_head)
+                                       tptr[0] = (void *) new_head;
+                               copy_handler(lc, (basicblock *) *tptr, original_head, new_head);
+                       }  
+                       break;
+
+               case ICMD_JSR:
+                       c_last_target = bptr;
+                       copy_handler(lc, (basicblock *) (ip->target), original_head, new_head);         
+                       break;
+                       
+               case ICMD_RET:
+                       copy_handler(lc, c_last_target->next, original_head, new_head);
+                       break;
+                       
+               default:
+                       copy_handler(lc, bptr->next, original_head, new_head);
+                       break;  
+                   } 
+           
+}           
+
+
+/* If a loop is duplicated, all exceptions, that are contained in this loops' body
+   have to be duplicated as well. The following function together with the
+   two helper functions copy_handler and patch_handler perform this task.
+*/
+void update_internal_exceptions(struct LoopContainer *lc, basicblock *original_head, basicblock *new_head)
+{
+       xtable *ex, *new;
+       struct LoopContainer *l;
+
+       /* Bottom of tree reached -> return                                         */
+       if (lc == NULL)
+               return;
+
+       /* Call update_internal for all nested (=child) loops                       */
+       l = lc->tree_down;
+       while (l != NULL) {
+               update_internal_exceptions(l, original_head, new_head);
+               l = l->tree_right;
+           }
+
+       /* For all exceptions of this loop, do                                      */
+       ex = lc->exceptions;
+       while (ex != NULL) {
+               
+               /* Copy the exception and patch the jumps                               */
+               copy_handler(lc, ex->handler, original_head, new_head);
+               patch_handler(lc, ex->handler, original_head, new_head);                
+
+               /* Insert a new exception into the global exception table               */
+               new = DMNEW(xtable, 1);
+               memcpy(new, ex, sizeof(xtable));
+
+               /* Increase number of exceptions                                        */
+               ++exceptiontablelength;
+
+               ex->next = new;
+               ex->down = new;
+
+               /* Set new start and end point of this exception                        */
+               new->start = ex->start->copied_to;
+               new->end = ex->end->copied_to;
+
+               /* Set handler pointer to copied exception handler                      */
+               new->handler = ex->handler->copied_to;
+
+               ex = new->next;
+           }
+
+}
+
+/* If a loop is duplicated, all exceptions that contain this loop have to be
+   extended to the copied nodes as well. The following function checks for
+   all exceptions of all parent loops, whether they contain the loop pointed to
+   by lc. If so, the exceptions are extended to contain all newly created nodes.
+*/
+void update_external_exceptions(struct LoopContainer *lc, int loop_head)
+{
+       xtable *ex, *new;
+
+       /* Top of tree reached -> return                                            */
+       if (lc == NULL)
+               return;
+       
+       ex = lc->exceptions;
+
+       /* For all exceptions of this loop do                                       */
+       while (ex != NULL) {
+                  
+               /* It is possible that the loop contains exceptions that do not protect */
+               /* the loop just duplicated. It must be checked, if this is the case    */
+               if ((loop_head >= block_index[ex->startpc]) && (loop_head < block_index[ex->endpc])) {
+
+                       /* loop is really inside exception, so create new exception entry   */
+                       /* in global exception list                                         */
+                       new = DMNEW(xtable, 1);
+                       memcpy(new, ex, sizeof(xtable));
+
+
+                       /* Increase number of exceptions                                    */
+                       ++exceptiontablelength;
+
+                       ex->next = new;
+                       ex->down = new;
+
+                       /* Set new start and end point of this exception                    */
+                       new->start = c_first_block_copied;
+                       new->end = c_last_block_copied;
+
+                       ex = new->next;
+               }
+               /* exception does not contain the duplicated loop -> do nothing         */
+               else
+                       ex = ex->next;
+           }
+
+       /* Call update_external for parent node                                     */
+       update_external_exceptions(lc->parent, loop_head);
+}
+       
+
+
+/*     This function is needed to insert the static checks, stored in c_constraints
+       into the intermediate code.
+*/
+void create_static_checks(struct LoopContainer *lc)
+{
+       int i, stackdepth, cnt;
+       struct Constraint *tc1;
+       struct LoopElement *le; 
+
+       /* loop_head points to the newly inserted loop_head, original_start to      */
+       /* the old loop header                                                      */
+       basicblock *bptr, *loop_head, *original_start, *temp;
+       instruction *inst, *tiptr;
+
+       /* tos and newstack are needed by the macros, that insert instructions into */
+       /* the new loop head                                                        */
+       stackptr newstack, tos;
+       xtable *ex;
+
+#ifdef STATISTICS
+       /* show_loop_statistics(); */ 
+#endif
+
+       loop_head = &block[c_current_head];
+       c_first_block_copied = c_last_block_copied = NULL;
+
+       /* the loop nodes are copied                                                */
+       le = lc->nodes;
+       while (le != NULL)
+       {
+               bptr = DMNEW(basicblock, 1);    
+               memcpy(bptr, le->block, sizeof(basicblock));
+               bptr->debug_nr = c_debug_nr++;
+
+               /* determine beginning of copied loop to extend exception handler, that */
+               /* protect this loop                                                    */
+               if (c_first_block_copied == NULL)
+                       c_first_block_copied = bptr;
+
+               /* copy instructions and add one more slot for possible GOTO            */
+               bptr->iinstr = DMNEW(instruction, bptr->icount + 1);
+
+               memcpy(bptr->iinstr, le->block->iinstr, (bptr->icount+1)*sizeof(instruction));
+
+               le->block->copied_to = bptr;
+
+               /* add block to global list of BBs                                      */
+               last_block->next = bptr;
+               last_block = bptr;
+               bptr->next = NULL;
+
+               node_into_parent_loops(lc->parent, bptr);
+               le = le->next;
+       }
+
+       c_last_block_copied = bptr;
+
+       /* create an additional basicblock for dynamic checks                       */
+       original_start = bptr = DMNEW(basicblock, 1);    
+
+       /* copy current loop header to new basic block                              */
+       memcpy(bptr, loop_head, sizeof(basicblock));
+    bptr->debug_nr = c_debug_nr++;
+
+       /* insert the new basic block and move header before first loop node        */
+       le = lc->nodes;
+       temp = le->block;
+
+       /* if header is first node of loop, insert original header after it         */
+       if (temp == loop_head)
+               loop_head->next = bptr;
+       else {
+       /* else, we have to find the predecessor of loop header                     */
+               while (temp->next != loop_head)
+                       temp = temp->next;
+
+               /* insert original header after newly created block                     */
+               temp->next = bptr;
+
+               /* if predecessor is not loop part, insert a goto                       */
+               if (!(temp->lflags & LOOP_PART)) {
+
+                       /* copy instructions and add an additional slot                     */
+                       tiptr = DMNEW(instruction, temp->icount + 1);
+                       memcpy(tiptr, temp->iinstr, sizeof(instruction)*temp->icount);
+                       
+                       temp->iinstr = tiptr;
+                       tiptr = temp->iinstr + temp->icount;
+                       
+                       /* add goto to loop header. If node is part of exception handler    */
+                       /* jmp is automagically redirected during patch_handler and works   */
+                       /* correct                                                          */
+                       tiptr->opc = ICMD_GOTO;
+                       tiptr->dst = NULL;
+                       tiptr->target = (void*) loop_head;
+                       
+                       ++temp->icount;
+                   }
+               
+               
+               temp = block;
+               /* if first loop block is first BB of global list, insert loop_head at  */
+               /* beginning of global BB list                                          */
+               if (temp == le->block) {
+                       if (c_newstart == NULL) {
+                               c_needs_redirection = true;
+                               c_newstart = loop_head;
+                               loop_head->next = block;
+                           }
+                       else {
+                               loop_head->next = c_newstart;
+                               c_newstart = loop_head;
+                           }
+                   }
+               else {
+          
+                       while (temp->next != le->block)
+                               temp = temp->next;
+
+                       loop_head->next = temp->next;
+                       temp->next = loop_head;
+               
+                       /* to be on the safe side insert a jump from the previous instr     */
+                       /* over thr new inserted node                                       */
+       
+                       /* special case - jump from node to loop_head: then remove          */
+                       /* goto / happens rather often due to loop layout                   */
+                       tiptr = temp->iinstr + (temp->icount-1);
+               
+                       if ((tiptr->opc == ICMD_GOTO) && (tiptr->target == loop_head)) {
+                               tiptr->opc = ICMD_NOP;
+                               tiptr->dst = NULL;
+                       }
+                       else {
+
+                               tiptr = DMNEW(instruction, temp->icount + 1);
+                               memcpy(tiptr, temp->iinstr, sizeof(instruction)*temp->icount);
+
+                               temp->iinstr = tiptr;
+                               tiptr = temp->iinstr + temp->icount;
+
+                               tiptr->opc = ICMD_GOTO;
+                               tiptr->dst = NULL;
+                               tiptr->target = (void*) loop_head->next;
+
+                               ++temp->icount;
+                   }
+                   }
+           }
+
+       /* adjust exceptions                                                        */
+       ex = extable;
+       while (ex != NULL) {
+
+               /* if an exception covers whole loop and starts at first loop node, it  */
+               /* has to be extended to cover the new first node as well               */
+               if (ex->start == le->block) {
+                       
+                       if ((lc->loop_head >= block_index[ex->startpc]) && (lc->loop_head < block_index[ex->endpc])) 
+                               ex->start = loop_head;
+                   }
+
+               /* an exception that ended at the old loop header now must contains the */
+               /* new loop header as well                                              */
+               if (ex->end == loop_head)
+                       ex->end = original_start;
+
+               ex = ex->down;
+           }
+       
+
+       /* insert new header node into nodelists of all enclosing loops             */
+       header_into_parent_loops(lc, loop_head, original_start, le->block);
+
+       /* prepare instruction array to insert checks                               */
+       inst = loop_head->iinstr = DMNEW(instruction, c_needed_instr + 2); 
+       loop_head->icount = c_needed_instr + 1;
+
+       /* init instruction array                                                   */
+       for (cnt=0; cnt<c_needed_instr + 1; ++cnt) {
+               inst[0].opc = ICMD_NOP;
+               inst[0].dst = NULL;
+           }
+
+       loop_head->copied_to = NULL; 
+
+       /* prepare stack                                                            */
+       loop_head->instack = copy_stack_from(bptr->instack);
+       loop_head->outstack = copy_stack_from(bptr->instack);
+       
+       tos = loop_head->instack;
+       stackdepth = loop_head->indepth;
+       
+       /* step through all inserted checks and create instructions for them        */
+       for (i=0; i<maxlocals+1; ++i)
+       {
+               tc1 = c_constraints[i];
+               while (tc1 != NULL)
+               {
+                       switch (tc1->type)
+                       {
+                       
+                               /* check a variable against a constant                          */
+                       case TEST_ZERO:
+                       case TEST_UNMOD_ZERO: 
+
+#ifdef LOOP_DEBUG
+                               printf("insert ZERO-test\n");
+                               fflush(stdout);
+#endif
+
+                               /* optimize if tc1->varRef >= tc1->constant                     */
+                               LOAD_VAR(tc1->varRef);
+                               LOAD_CONST(tc1->constant);
+                               GOTO_NOOPT_IF_LT;
+                               break;
+
+                               /* check a variable against an array length                     */
+                       case TEST_ALENGTH:       
+                       case TEST_UNMOD_ALENGTH:
+                               
+                               /* optimize if                                                  */
+                               /* tc1->varRef + tc1->constant < lengthOf(tc1->arrayRef)        */
+#ifdef LOOP_DEBUG
+                               printf("insert ALENGTH-test\n");
+                               fflush(stdout);
+#endif
+
+                               LOAD_VAR(tc1->varRef);
+                               LOAD_CONST(tc1->constant);
+                               ADD;
+                               LOAD_ARRAYLENGTH(tc1->arrayRef);
+                               GOTO_NOOPT_IF_GE;
+                               break;
+                               
+                               /* test right side of comparison against constant               */
+                       case TEST_RS_ZERO:      
+
+#ifdef LOOP_DEBUG
+                               printf("insert RS-ZERO-test\n");
+                               fflush(stdout);
+#endif
+
+                               /* optimize if right-side >= tc1->constant                      */
+                               LOAD_RIGHT_SIDE;
+                               LOAD_CONST(tc1->constant);
+                               GOTO_NOOPT_IF_LT;
+                               break;
+                               
+                               /* test right side of comparison against array length           */
+                       case TEST_RS_ALENGTH: 
+
+#ifdef LOOP_DEBUG
+                               printf("insert RS-ALENGTH-test\n");
+                               fflush(stdout);
+#endif
+                               /* optimize if right-side < lengthOf(arrayRef)                  */
+                               LOAD_RIGHT_SIDE;
+                               LOAD_ARRAYLENGTH(tc1->arrayRef);
+                               GOTO_NOOPT_IF_GT;
+                               break;
+                               
+                               /* test unmodified variable against arraylength                 */
+                       case TEST_CONST_ALENGTH:
+
+#ifdef LOOP_DEBUG
+                               printf("insert CONST ALENGTH-test\n");
+                               fflush(stdout);
+#endif
+
+                               /* optimize if tc1->constant < lengthOf(tc1->arrayRef)          */
+                               LOAD_CONST(tc1->constant);
+                               LOAD_ARRAYLENGTH(tc1->arrayRef);
+                               GOTO_NOOPT_IF_GE;
+                               break;              
+                       }
+                       
+                       tc1 = tc1->next;
+               }
+               c_constraints[i] = NULL;
+       }
+   
+       /* if all tests succeed, jump to optimized loop header                      */
+       if (loop_head->next != original_start) {
+               inst->opc = ICMD_GOTO;
+               inst->dst = NULL;
+               inst->target = original_start;
+           }
+
+       /* redirect jumps from original loop head to newly inserted one             */
+       patch_jumps(original_start, loop_head, lc); 
+
+       /* if exceptions have to be correct due to loop duplication these two       */
+       /* functions perform this task.                                             */
+       update_internal_exceptions(lc, loop_head, original_start);
+       update_external_exceptions(lc->parent, lc->loop_head);
+}
+
+
+/*     This function performs an update between two arrays of struct Changes (that
+       reflect variable changes). The merge is performed unrstricted in the way, that
+       all variable changes in c1 took place in a nested loop and therefore are
+       considered to be without limit. Beside that, the merge is a simple union of the
+       changes recorded in both arrays. A variable, which limits are undefinied, is
+       represented by its lower bound being higher than the upper bound. The result 
+       of the union is stored in c1.
+*/
+struct Changes ** constraints_unrestricted_merge(struct Changes **c1, struct Changes **c2)
+{
+       int i, changed;
+
+       if ((c1 == NULL) || (c2 == NULL))
+               printf("C_ERROR: debugging error 0x03\n");
+
+       changed = 0;
+       for (i=0; i<maxlocals; ++i) {
+               if (c1[i] == NULL) {
+                       if (c2[i] != NULL) {            /* a change in c2 is updated in c1              */
+                               changed = 1;
+                               c1[i] = c2[i];
+                               c1[i]->lower_bound = c1[i]->upper_bound+1;
+                               }
+                       }
+               else {
+                       if (c1[i]->lower_bound > c1[i]->upper_bound)
+                               continue;                               /* variable's bounds already undefined  */
+
+                       if (c2[i] == NULL) {            /* variable changed in c1 -> now undef. */
+                               changed = 1;
+                               c1[i]->lower_bound = c1[i]->upper_bound+1;
+                               }
+                       else {
+                               if ((c1[i]->lower_bound == c2[i]->lower_bound) &&
+                                       (c1[i]->upper_bound == c2[i]->upper_bound))
+                                       continue;                       /* variable's bounds remain the same    */
+                               else {
+                                       changed = 1;
+                                       c1[i]->lower_bound = c1[i]->upper_bound+1;
+                                       }                                       /* variable changed in c1 -> now undef. */
+                               }
+                       }
+               }
+       
+       if (changed)
+               return c1;
+       else
+               return NULL;
+}
+
+/*     This function performs an update between two arrays of struct Changes (that
+       reflect variable changes). The merge is a simple union of the bounds
+       changes recorded in both arrays. A variable, which limits are undefinied, is
+       represented by its lower bound being higher than the upper bound. The result 
+       of the union is stored in c1.
+*/
+struct Changes ** constraints_merge(struct Changes **c1, struct Changes **c2)
+{
+       int i, changed;
+
+       if ((c1 == NULL) || (c2 == NULL))
+               printf("C_ERROR: debugging error 0x04\n");
+
+       changed = 0;
+
+       for (i=0; i<maxlocals; ++i) {
+               if (c1[i] == NULL) {
+                       if (c2[i] != NULL) {            /* update changes in c2 in c1                   */
+                               if ((c1[i] = (struct Changes *) malloc (sizeof(struct Changes))) == NULL)
+                                       c_mem_error();
+
+                                       c1[i]->lower_bound = c2[i]->lower_bound; 
+                                       c1[i]->upper_bound = c2[i]->upper_bound;
+                                       changed = 1;
+                               }       
+               }
+               else {
+                       if (c2[i] != NULL) {
+
+                               if (c1[i]->lower_bound > c1[i]->upper_bound)
+                                       continue;                       /* var in c1 is unrestricted                    */
+
+                               if (c1[i]->lower_bound > c2[i]->lower_bound) {
+                                       c1[i]->lower_bound = c2[i]->lower_bound;
+                                       changed = 1;            /* write new lower bound                                */
+                                       }
+                               if (c1[i]->upper_bound < c2[i]->upper_bound) {
+                                       c1[i]->upper_bound = c2[i]->upper_bound;
+                                       changed = 1;            /* write new higher bound                               */
+                                       }
+                               }
+                       }
+               }
+
+       if (changed)
+               return c1;
+       else
+               return NULL;
+}
+
+
+/*     This function simply copies an array of changes 
+*/
+struct Changes** constraints_clone(struct Changes **c)
+{
+       int i;
+       struct Changes **t;
+       
+       if ((t = (struct Changes **) malloc(maxlocals * sizeof(struct Changes *))) == NULL)
+               c_mem_error();
+
+       for (i=0; i<maxlocals; ++i) {           /* for all array elements (vars) do             */
+               if (c[i] == NULL)
+                       t[i] = NULL;
+               else {
+                       if ((t[i] = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                               c_mem_error();
+                       t[i]->lower_bound = c[i]->lower_bound;
+                       t[i]->upper_bound = c[i]->upper_bound;
+                       }
+               }
+       
+       return t;
+}
+
+/*     This function is used to reset the changes of a variable to the time, it was
+       pushed onto the stack. If a variable has been modified between an instruction
+       and a previous push onto the stack, its value in the changes array does not
+       correctly reflect its bounds the time, it was pushed onto the stack. This 
+       function corrects the situation.
+       */
+struct Changes* backtrack_var(int node, int from, int to, int varRef, struct Changes *changes)
+{
+       struct Changes *tmp;
+       basicblock bp;
+       instruction *ip;
+       struct Trace *t;
+
+       if (changes == NULL)    /* if there are no changes, immediately return          */
+               return NULL;
+       else {                                  /* init a Changes structure with current values         */
+               if ((tmp = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                       c_mem_error();
+               
+               tmp->upper_bound = changes->upper_bound;
+               tmp->lower_bound = changes->lower_bound;
+               }
+
+       if (tmp->upper_bound < tmp->lower_bound)
+               return tmp;                     /* if it is unrestricted no backtracking can happen     */
+
+       bp = block[node];
+       ip = bp.iinstr + to;
+
+       for (; from < to; --to, --ip) {         /* scan instructions backwards                  */
+               switch (ip->opc) {
+               case ICMD_IINC:                                 /* a var has been modified                              */
+                       if (varRef != ip->op1)          /* not the one, we are interested in    */
+                               break;
+                       tmp->upper_bound -= ip->val.i;          /* take back modifications              */
+                       tmp->lower_bound -= ip->val.i;
+                       break;
+
+               case ICMD_ISTORE:                               /* a var has been modified                              */
+                       if (varRef != ip->op1)          /* not the one, we are interested in    */
+                               break;
+
+                       /* it is our variable, so trace its origin                                                      */
+                       t = tracing(&block[node],to, 0);                
+       
+                       switch (t->type) {
+                               case TRACE_IVAR:  
+                                       if ((t->var = ip->op1) && (t->neg > 0)) {
+                                               /* it was the same var -> take back modifications               */
+                                               tmp->upper_bound -= t->constant;
+                                               tmp->lower_bound -= t->constant;
+                                               }               
+                                       else
+                                               tmp->lower_bound = tmp->upper_bound+1;  /* unknown              */
+                                       break;
+
+                               /* cannot restore it -> invalidate t                                                    */
+                               case TRACE_ICONST:
+                               case TRACE_ALENGTH:   
+                               case TRACE_UNKNOWN: 
+                               case TRACE_AVAR: 
+                                       tmp->lower_bound = tmp->upper_bound+1;   
+                                       break;
+                               }
+
+                       break;
+                       }
+               }
+       return tmp;
+}
+
+/*     This function performs the main task of bound check removal. It removes
+       all bound-checks in node. change is a pointer to an array of struct Changes
+       that reflect for all local variables, how their values have changed from
+       the start of the loop. The special flag is needed to deal with the header
+       node.
+*/
+void remove_boundchecks(int node, int from, struct Changes **change, int special)
+{
+       basicblock bp;
+       instruction *ip;
+       int i, count, ignore, degrade_checks, opt_level;
+       struct depthElement *d;
+       struct Changes **t1, **tmp, *t;
+       struct Trace *t_array, *t_index;
+
+       /* printf("remove_bc called: %d - %d - %d\n", node, from, special);                     */
+          
+       /* a flag, that is set, when previous optimzations have to be taken back        */
+       degrade_checks = 0;                     
+
+       if (c_current_loop[node] > 0) {         /* this node is part of the loop                */
+               if (c_current_loop[node] > 1) { /* it is not the header node                    */
+
+                       /* get variable changes, already recorded for this node                         */
+                       t1 = c_dTable[node]->changes;
+                       
+                       if (t1 != NULL) {                       /* it is not the first visit                    */
+                               if ((c_nestedLoops[node] != c_current_head) && (c_nestedLoops[node] == c_nestedLoops[from])) {
+                               /* we are looping in a nested loop, so made optimizations               */
+                               /* need to be reconsidered                                                                              */
+                                       degrade_checks = 1;
+                                       if (constraints_unrestricted_merge(t1, change) == NULL) 
+                                               return;                 /* no changes since previous visit              */
+                                               /* if there have been changes, they are updated by              */
+                                               /* constraints_unrestricted_merge in t1                                 */
+                                       }
+                               else {
+                                       if (constraints_merge(t1, change) == NULL)
+                                               return;                 /* no changes since previous visit              */
+                                               /* if there have been changes, they are updated by              */
+                                               /* constraints_merge in t1                                                              */
+                                       }
+                               }
+                       else {                                          /* first visit                                                  */
+                               /* printf("first visit - constraints cloned\n");                                */
+                               c_dTable[node]->changes = constraints_clone(change);
+                               }
+
+                       /* tmp now holds a copy of the updated variable changes                         */
+                       tmp = constraints_clone(c_dTable[node]->changes);       
+                       }
+               else if (special) {                             /* header and need special traetment    */
+                       /* printf("special treatment called\n");                                                        */
+                       /* tmp now holds a copy of the current new variable changes                     */
+                       tmp = constraints_clone(change);
+                       }
+               else
+                       return;
+
+               bp = block[node];                               /* scan all instructions                                */
+               count = bp.icount;
+               ip = bp.iinstr;
+               ignore = 0;
+
+               for (i=0; i<count; ++i, ++ip) {
+                       switch (ip->opc) {
+                       case ICMD_IASTORE:                      /* found an array store                                 */
+                       case ICMD_LASTORE:          
+                       case ICMD_FASTORE:          
+                       case ICMD_DASTORE:          
+                       case ICMD_AASTORE:          
+                       case ICMD_BASTORE:          
+                       case ICMD_CASTORE:          
+                       case ICMD_SASTORE:
+
+                               t_index = tracing(&bp, i-1, 1); /* get index                                    */
+                               t_array = tracing(&bp, i-1, 2); /* get array refernce                   */
+                               ignore = 1;
+                               /* fall through */
+
+                       case ICMD_IALOAD:                       /* found an array load                                  */
+                       case ICMD_LALOAD:       
+                       case ICMD_FALOAD:
+                       case ICMD_DALOAD:
+                       case ICMD_AALOAD:
+                       case ICMD_BALOAD:
+                       case ICMD_CALOAD:
+                       case ICMD_SALOAD:
+                               if (!ignore) {
+                                       t_index = tracing(&bp, i-1, 0); /* get index                            */
+                                       t_array = tracing(&bp, i-1, 1); /* get array refernce           */
+                                       ignore = 0;
+                                       }
+
+                               /* printf("Array access with params:\n");
+                               printf("Array:\n");
+                               show_trace(t_array);
+                               printf("Index:\n");
+                               show_trace(t_index);
+                               */
+
+#ifdef STATISTICS
+                               if (ip->op1 == OPT_UNCHECKED) {         /* found new access                     */
+                                  c_stat_array_accesses++;
+                                  ip->op1 = OPT_NONE;
+                                  c_stat_no_opt++;
+                                  }
+#endif
+
+                               /* can only optimize known arrays that do not change                    */
+                               if ((t_array->type != TRACE_AVAR) || (c_var_modified[t_array->var])) 
+                                       break;
+                               
+                               switch (t_index->type) {        /* now we look at the index                     */
+                               case TRACE_ICONST:                      /* it is a constant value or an         */
+                               case TRACE_ALENGTH:                     /* array length                                         */
+#ifdef STATISTICS
+                                       switch (ip->op1) {              /* take back old optimzation            */
+                                       case OPT_UNCHECKED:
+                                               break;
+                                       case OPT_NONE:
+                                               c_stat_no_opt--;
+                                               break;
+                                       case OPT_FULL:
+                                               c_stat_full_opt--;
+                                               break;
+                                       case OPT_UPPER:
+                                               c_stat_upper_opt--;
+                                               break;
+                                       case OPT_LOWER:
+                                               c_stat_lower_opt--;
+                                               break;
+                                               }
+#endif
+                                       if (degrade_checks)             /* replace existing optimization        */
+                                               ip->op1 = insert_static(t_array->var, t_index, NULL, special);
+                                       else {
+                                               /* Check current optimization and try to improve it     by      */
+                                               /* inserting new checks                                                                 */
+                                               switch (ip->op1) {      
+                                               case OPT_UNCHECKED:
+                                                       ip->op1 = insert_static(t_array->var, t_index, NULL, special);
+                                                       break;
+                                               case OPT_NONE:          
+                                                       ip->op1 = insert_static(t_array->var, t_index, NULL, special);
+                                                       break;
+                                               case OPT_UPPER:         
+                                                       opt_level = insert_static(t_array->var, t_index, NULL, special);
+                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_LOWER))
+                                                               ip->op1 = OPT_FULL;
+                                                       break;
+                                               case OPT_LOWER: 
+                                                       opt_level = insert_static(t_array->var, t_index, NULL, special);
+                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_UPPER))
+                                                               ip->op1 = OPT_FULL;
+                                                       break;
+                                               case OPT_FULL:
+#ifdef STATISTICS
+                                                       c_stat_full_opt++;
+#endif
+                                                       break;
+                                                       }
+                                               }
+                                       break;
+
+                               case TRACE_IVAR:                        /* it's a variable                                      */
+
+                                       /* if the variable is changed between its usage as an index     */
+                                       /* of the array access and its push onto the stack, we have     */
+                                       /* to set the changes back to the time, it is pushed onto       */
+                                       /* the stack as an index variable.                                                      */
+                                       t = backtrack_var(node, t_index->nr, i-1, t_index->var, tmp[t_index->var]);
+#ifdef STATISTICS
+                                       switch (ip->op1) {              /* take back old optimzation            */
+                                       case OPT_UNCHECKED:
+                                               break;
+                                       case OPT_NONE:
+                                               c_stat_no_opt--;
+                                               break;
+                                       case OPT_FULL:
+                                               c_stat_full_opt--;
+                                               break;
+                                       case OPT_UPPER:
+                                               c_stat_upper_opt--;
+                                               break;
+                                       case OPT_LOWER:
+                                               c_stat_lower_opt--;
+                                               break;
+                                               }
+#endif
+                                       if (degrade_checks)
+                                               ip->op1 = insert_static(t_array->var, t_index, t, special);
+                                       else {
+                                               /* Check current optimization and try to improve it     by      */
+                                               /* insert new check. t reflects var changes for index   */
+                                               switch (ip->op1) {
+                                               case OPT_UNCHECKED:
+                                                       ip->op1 = insert_static(t_array->var, t_index, t, special);
+                                                       break;
+                                               case OPT_NONE:
+                                                       ip->op1 = insert_static(t_array->var, t_index, t, special);
+                                                       break;
+                                               case OPT_UPPER:
+                                                       opt_level = insert_static(t_array->var, t_index, t, special);
+                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_LOWER))
+                                                               ip->op1 = OPT_FULL;
+                                                       break;
+                                               case OPT_LOWER: 
+                                                       opt_level = insert_static(t_array->var, t_index, t, special);
+                                                       if ((opt_level == OPT_FULL) || (opt_level == OPT_UPPER))
+                                                               ip->op1 = OPT_FULL;
+                                                       break;
+                                               case OPT_FULL:
+#ifdef STATISTICS
+                                                       c_stat_full_opt++;
+#endif
+                                                       break;
+                                                       }
+                                               }
+                                       break;
+
+                               case TRACE_UNKNOWN: 
+                               case TRACE_AVAR:    
+                                       break;
+                                       }
+                               break;
+               
+                       case ICMD_ISTORE:               /* an integer value is stored                           */
+                               t_index = tracing(&bp, i-1, 0); /* trace back its origin                */
+
+                               /* the struct Changes for this variable needs to be updated             */
+                               t = tmp[ip->op1];
+                               if (t == NULL) {        /* if it's the first one, create new entry      */
+                                       if ((t = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                                               c_mem_error();
+                                       t->upper_bound = t->lower_bound = 0;
+                                       tmp[ip->op1] = t;
+                                       }
+
+                               switch (t_index->type) {                /* check origin of store                */
+
+                               case TRACE_ICONST:      /* constant -> set bounds to const value        */
+                                       t->upper_bound = t->lower_bound = t_index->constant;
+                                       break;  
+
+                               case TRACE_IVAR:        /* if it's the same variable, update consts     */  
+                                       if ((t_index->var = ip->op1) && (t_index->neg > 0)) {
+                                               t->upper_bound += t_index->constant;
+                                               t->lower_bound += t_index->constant;
+                                               }
+                                       else
+                                               t->lower_bound = t->upper_bound+1;
+                                       break;
+
+                               case TRACE_ALENGTH:   /* else -> unknown                                                */
+                               case TRACE_UNKNOWN: 
+                               case TRACE_AVAR: 
+                                       t->lower_bound = t->upper_bound+1;   
+                                       break;
+                                       }
+
+                               break;
+
+                       case ICMD_IINC:                 
+
+                               /* the struct Changes for this variable needs to be updated             */
+                               if ((t = tmp[ip->op1]) == NULL) {       /* first one -> create new      */
+                                       if ((t = (struct Changes *) malloc(sizeof(struct Changes))) == NULL)
+                                               c_mem_error();
+                                       t->upper_bound = t->lower_bound = ip->val.i;
+                                       tmp[ip->op1] = t;
+                                       }  
+                               else {                          /* update changes, made by iinc                         */
+                                       t->upper_bound += ip->val.i;
+                                       t->lower_bound += ip->val.i;
+                                       }
+                               break;
+                               }       /* switch */
+                       }               /* for    */
+               
+               if (!special) {                         /* we are not interested in only the header     */
+                       d = c_dTable[node];
+                       while (d != NULL) {             /* check all sucessors of current node          */
+                               remove_boundchecks(d->value, node, tmp, special);       
+                               d = d->next;
+                               }
+                       }
+           }   /* if */
+}
+
+/*     This function calls the bound-check removal function for the header node
+       with a special flag. It is important to notice, that no dynamic 
+       constraint hold in the header node (because the comparison is done at
+       block end).
+*/
+void remove_header_boundchecks(int node, struct Changes **changes)
+{
+       remove_boundchecks(node, -1, changes, BOUNDCHECK_SPECIAL);
+}
+
+/*     Marks all basicblocks that are part of the loop
+*/
+void mark_loop_nodes(struct LoopContainer *lc)
+{
+       struct LoopElement *le = lc->nodes;
+
+       while (le != NULL) {
+               le->block->lflags |= LOOP_PART;
+               le = le->next;
+               }
+}
+
+/*     Clears mark for all basicblocks that are part of the loop
+*/
+void unmark_loop_nodes(struct LoopContainer *lc)
+{
+       struct LoopElement *le = lc->nodes;
+
+       while (le != NULL) {
+               le->block->lflags = 0;
+               le = le->next;
+               }
+}
+
+
+/*     This function performs the analysis of code in detected loops and trys to
+       identify array accesses suitable for optimization (bound check removal). The
+       intermediate code is then modified to reflect these optimizations.
+*/
+void optimize_single_loop(struct LoopContainer *lc)
+{
+       struct LoopElement *le;
+       struct depthElement *d;
+       int i, head, node;
+       struct Changes **changes;
+
+       if ((changes = (struct Changes **) malloc(maxlocals * sizeof(struct Changes *))) == NULL)
+               c_mem_error();
+
+    head = c_current_head = lc->loop_head;
+       c_needed_instr = c_rs_needed_instr = 0;
+
+       /* init array for null ptr checks */
+       for (i=0; i<maxlocals; ++i) 
+               c_null_check[i] = 0;
+
+
+       /* don't optimize root node (it is the main procedure, not a loop)                      */
+       if (head < 0)
+               return;
+
+       /* setup variables with initial values                                                                          */
+       c_loopvars = NULL;
+       for (i=0; i < block_count; ++i) {
+               c_toVisit[i] = 0;
+               c_current_loop[i] = -1;
+               if ((d = c_dTable[i]) != NULL)
+                       d->changes = NULL;
+               }
+
+       for (i=0; i < maxlocals; ++i) {
+               c_var_modified[i] = 0;
+               if (changes[i] != NULL) {
+                       changes[i] = NULL;
+                       }
+               }
+
+       for (i=0; i < (maxlocals+1); ++i) {
+               if (c_constraints[i] != NULL) {
+                   c_constraints[i] = NULL;
+                       }
+               }
+
+       le = lc->nodes;
+       while (le != NULL) {
+               node = le->node;
+
+               if (node == head)
+                       c_current_loop[node] = 1;   /* the header node gets 1               */
+               else if (c_nestedLoops[node] == head)
+                       c_current_loop[node] = 2;       /* top level nodes get 2                                */
+               else
+                       c_current_loop[node] = 3;       /* nodes, part of nested loop get 3             */
+               
+               c_toVisit[node] = 1;
+               le = le->next;
+               }
+
+       /* After setup work has been performed, start to analyse                                        */
+#ifdef LOOP_DEBUG
+       printf("****** Starting analysis (%d)******\n", head);                  
+       fflush(stdout);
+#endif
+
+       if (analyze_for_array_access(head) > 0) {/* loop contains array access          */
+
+#ifdef LOOP_DEBUG
+               struct LoopVar *lv;
+
+               printf("analyze for array access finished and found\n");        
+               fflush(stdout);
+               lv = c_loopvars;
+               while (lv != NULL) {
+                       if (lv->modified)
+                               printf("Var --> %d\n", lv->value);
+                       lv = lv->next;
+               }
+#endif
+
+               /* for performance reasons the list of all interesting loop vars is             */
+               /* scaned and for all modified vars a flag in c_var_modified is set             */
+               scan_global_list();                                     
+
+#ifdef LOOP_DEBUG
+               printf("global list scanned\n");
+               fflush(stdout);
+#endif
+
+               /* if the loop header contains or-conditions or an index variable               */
+               /* is modified in the catch-block within the loop, a conservative               */
+               /* approach is taken and optimizations are cancelled                                    */
+               if (analyze_or_exceptions(head, lc) > 0) {
+
+#ifdef LOOP_DEBUG
+                       printf("Analyzed for or/exception - no problems \n");            
+                       fflush(stdout);
+#endif
+
+                       init_constraints(head); /* analyze dynamic bounds in header                     */
+
+#ifdef LOOP_DEBUG                      
+                       show_right_side();
+#endif                                                                                         
+
+                       if (c_rightside == NULL)
+                               return;
+
+                       /* single pass bound check removal - for all successors, do                     */
+                       remove_header_boundchecks(head, changes);
+
+                       d = c_dTable[head];
+                       while (d != NULL) {
+                               remove_boundchecks(d->value, -1, changes, BOUNDCHECK_REGULAR);
+                               d = d->next;
+                               }
+           
+#ifdef LOOP_DEBUG
+                       printf("Array-bound checks finished\n");                                                        
+                       fflush(stdout);
+#endif
+
+                       mark_loop_nodes(lc);
+
+#ifdef LOOP_DEBUG                      
+                       printf("START: create static checks\n");
+                       fflush(stdout);
+#endif
+
+                       create_static_checks(lc);       /* create checks                                                */
+
+#ifdef LOOP_DEBUG
+                       printf("END: create static checks\n");
+                       fflush(stdout);
+#endif
+                       unmark_loop_nodes(lc);
+                       }
+               }
+       /* else
+               printf("No array accesses found\n");                                                                    */
+
+#ifdef STATISTICS
+       c_stat_num_loops++;             /* increase number of loops                                                     */      
+
+       c_stat_sum_accesses += c_stat_array_accesses;
+       c_stat_sum_full += c_stat_full_opt;
+       c_stat_sum_no += c_stat_no_opt;
+       c_stat_sum_lower += c_stat_lower_opt;
+       c_stat_sum_upper += c_stat_upper_opt;
+       c_stat_sum_or += c_stat_or;
+       c_stat_sum_exception += c_stat_exception;
+
+       c_stat_array_accesses = 0;              
+       c_stat_full_opt = 0;
+       c_stat_no_opt = 0;
+       c_stat_lower_opt = 0;
+       c_stat_upper_opt = 0;   
+       c_stat_or = c_stat_exception = 0;
+#endif
+       
+}
+
+/*     This function preforms necessary setup work, before the recursive function
+       optimize_single loop can be called.
+*/
+void optimize_loops()
+{
+       struct LoopContainer *lc = c_allLoops;
+
+       /* first, merge loops with same header node - all loops with the same           */
+       /* header node are optimizied in one pass, because they all depend on the       */
+       /* same dynamic loop condition                                                                                          */
+
+#ifdef LOOP_DEBUG
+       printf("start analyze_double_headers\n");
+       fflush(stdout);
+#endif
+
+       analyze_double_headers();
+
+       /* create array with loop nesting levels - nested loops cause problems,         */
+       /* especially, when they modify index variables used in surrounding     loops   */
+       /* store results in array c_nestedLoops and c_hierarchie                                        */
+
+#ifdef LOOP_DEBUG
+       printf("double done\n");
+       fflush(stdout);
+#endif
+
+       analyze_nested();
+
+#ifdef LOOP_DEBUG
+       printf("analyze nested done\n");
+       fflush(stdout);
+#endif
+
+       /* create array with entries for current loop                                                           */
+       c_current_loop = DMNEW(int, block_count);       
+       c_toVisit = DMNEW(int, block_count);
+       c_var_modified = DMNEW(int, maxlocals);
+       c_null_check = DMNEW(int, maxlocals);
+
+       if ((c_constraints = (struct Constraint **) malloc((maxlocals+1) * sizeof(struct Constraint *))) == NULL)
+               c_mem_error();
+
+#ifdef STATISTICS
+       c_stat_num_loops = 0;           /* set statistic vars to zero                                   */
+       c_stat_array_accesses = c_stat_sum_accesses = 0;                
+       c_stat_full_opt = c_stat_sum_full = 0;
+       c_stat_no_opt = c_stat_sum_no = 0;
+       c_stat_lower_opt = c_stat_sum_lower = 0;
+       c_stat_upper_opt = c_stat_sum_upper = 0;
+       c_stat_or = c_stat_sum_or = 0;
+       c_stat_exception = c_stat_sum_exception = 0;
+#endif
+       /* init vars needed by all loops                                            */
+       c_needs_redirection = false;
+       c_newstart = NULL;
+       c_old_xtablelength = exceptiontablelength;
+
+       /* loops have been topologically sorted                                     */
+       lc = c_allLoops;
+       while (lc != NULL) {
+               optimize_single_loop(lc);
+
+#ifdef LOOP_DEBUG
+               printf(" *** Optimized loop *** \n");
+               fflush(stdout);
+#endif
+
+               lc = lc->next;
+               }
+#ifdef LOOP_DEBUG
+       printf("---*** All loops finished ***---\n");
+       fflush(stdout);
+#endif
+
+       /* if global BB list start is modified, set block to new start              */
+       if (c_needs_redirection == true)
+               block = c_newstart;
+
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/loop/analyze.h b/src/vm/jit/loop/analyze.h
new file mode 100644 (file)
index 0000000..3daa949
--- /dev/null
@@ -0,0 +1,53 @@
+/* jit/loop/analyze.h - bound check removal header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: analyze.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _ANALYZE_H
+#define _ANALYZE_H
+
+void optimize_loops();
+
+#endif /* _ANALYZE_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/loop/graph.c b/src/vm/jit/loop/graph.c
new file mode 100644 (file)
index 0000000..e8acc0c
--- /dev/null
@@ -0,0 +1,434 @@
+/* jit/loop/graph.c - control flow graph
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel
+
+   Changes: Christian Thalinger
+
+   Contains the functions which build a list, that represents the
+   control flow graph of the procedure, that is being analyzed.
+
+   $Id: graph.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "graph.h"
+#include "loop.h"
+#include "jit.h"
+#include "toolbox/memory.h"
+
+
+void LoopContainerInit(struct LoopContainer *lc, int i)
+{
+       struct LoopElement *le = DMNEW(struct LoopElement, 1);
+
+       le->next = NULL;
+
+       lc->parent = NULL;
+
+       lc->tree_right = NULL;
+       lc->tree_down = NULL;
+
+       lc->exceptions = NULL;
+
+       lc->in_degree = 0;
+       le->node = lc->loop_head = i;
+       le->block = &block[i];
+
+       /* lc->nodes = (int *) malloc(sizeof(int)*block_count);
+       lc->nodes[0] = i; */
+
+       lc->nodes = le;
+}
+       
+
+/*
+   depthFirst() builds the control flow graph out of the intermediate code of  
+   the procedure, that is to be optimized and stores the list in the global 
+   variable c_dTable 
+*/                                                                     
+void depthFirst()
+{
+       int i;
+
+/*     allocate memory and init gobal variables needed by function dF(int, int)        */
+  
+       if ((c_defnum = (int *) malloc(block_count * sizeof(int))) == NULL)             
+               c_mem_error();
+       if ((c_numPre = (int *) malloc(block_count * sizeof(int))) == NULL)
+               c_mem_error();
+       if ((c_parent = (int *) malloc(block_count * sizeof(int))) == NULL)
+               c_mem_error();
+       if ((c_reverse = (int *) malloc(block_count * sizeof(int))) == NULL)
+               c_mem_error();
+       
+       if ((c_pre = (int **) malloc(block_count * sizeof(int *))) == NULL)
+               c_mem_error(); 
+
+       if ((c_dTable = (struct depthElement **) malloc(block_count * sizeof(struct depthElement *))) == NULL)
+               c_mem_error();
+       
+       for (i = 0; i < block_count; ++i) {
+               c_defnum[i] = c_parent[i] = -1;
+               c_numPre[i] = c_reverse[i] = 0;
+
+               if ((c_pre[i] = (int *) malloc(block_count * sizeof(int))) == NULL)
+                       c_mem_error();
+               c_dTable[i] = NULL;
+           }
+  
+       c_globalCount = 0;
+       c_allLoops = NULL;
+  
+       dF(-1, 0);      /* call helper function dF that traverses basic block structure */
+}
+
+
+/*     
+   dF starts from the first block of the given procedure and traverses the 
+   control flow graph in a depth-first order, thereby building up the adeacency
+   list c_dTable
+*/ 
+void dF(int from, int blockIndex)
+{
+       instruction *ip;
+       s4 *s4ptr;
+       int high, low, count;
+       struct depthElement *hp;
+       struct LoopContainer *tmp; 
+       int cnt, *ptr;
+       
+       if (from >= 0) {        
+/*     the current basic block has a predecessor (ie. is not the first one)            */
+               if ((hp = (struct depthElement *) malloc(sizeof(struct depthElement))) == NULL)
+                       c_mem_error();                  /* cretae new depth element                                     */
+
+               hp->next = c_dTable[from];      /* insert values                                                        */
+               hp->value = blockIndex;
+               hp->changes = NULL;
+               
+               c_dTable[from] = hp;    /* insert into table                                                    */
+           }
+  
+       if (from == blockIndex) {       /* insert one node loops into loop container    */
+               if ((tmp = (struct LoopContainer *) malloc(sizeof(struct LoopContainer))) == NULL)
+                       c_mem_error();
+               LoopContainerInit(tmp, blockIndex);
+               tmp->next = c_allLoops;
+               c_allLoops = tmp;
+           }
+
+#ifdef C_DEBUG
+       if (blockIndex > block_count) {
+               fprintf(stderr, "DepthFirst: BlockIndex exceeded\n");
+               exit(1);
+               }               
+#endif
+
+       ip = block[blockIndex].iinstr + block[blockIndex].icount -1;
+                                                                               /* set ip to last instruction                   */
+                                                                       
+       if (c_defnum[blockIndex] == -1) {       /* current block has not been visited   */
+           c_defnum[blockIndex] = c_globalCount;       /* update global count                  */
+           c_parent[blockIndex] = from;        /* write parent block of current one    */
+               c_reverse[c_globalCount] = blockIndex;
+               ++c_globalCount;
+               
+               if (!block[blockIndex].icount) {
+                                                                               /* block does not contain instructions  */
+                       dF(blockIndex, blockIndex+1);
+                   }
+               else {                                                  /* for all successors, do                               */
+                       switch (ip->opc) {                      /* check type of last instruction               */
+                       case ICMD_RETURN:
+                       case ICMD_IRETURN:
+                       case ICMD_LRETURN:
+                       case ICMD_FRETURN:
+                       case ICMD_DRETURN:
+                       case ICMD_ARETURN:
+                       case ICMD_ATHROW:
+                               break;                                  /* function returns -> end of graph             */        
+                               
+                       case ICMD_IFEQ:
+                       case ICMD_IFNE:
+                       case ICMD_IFLT:
+                       case ICMD_IFGE:
+                       case ICMD_IFGT:
+                       case ICMD_IFLE:
+                       case ICMD_IFNULL:
+                       case ICMD_IFNONNULL:
+                       case ICMD_IF_ICMPEQ:
+                       case ICMD_IF_ICMPNE:
+                       case ICMD_IF_ICMPLT:
+                       case ICMD_IF_ICMPGE:
+                       case ICMD_IF_ICMPGT:
+                       case ICMD_IF_ICMPLE:
+                       case ICMD_IF_ACMPEQ:
+                       case ICMD_IF_ACMPNE:                            /* branch -> check next block   */
+                          dF(blockIndex, blockIndex + 1);
+                          /* fall throu */
+                          
+                       case ICMD_GOTO:
+                               dF(blockIndex, block_index[ip->op1]);         
+                               break;                                                  /* visit branch (goto) target   */
+                               
+                       case ICMD_TABLESWITCH:                          /* switch statement                             */
+                               s4ptr = ip->val.a;
+                               
+                               dF(blockIndex, block_index[*s4ptr]);    /* default branch               */
+                               
+                               s4ptr++;
+                               low = *s4ptr;
+                               s4ptr++;
+                               high = *s4ptr;
+                               
+                               count = (high-low+1);
+                               
+                               while (--count >= 0) {
+                                       s4ptr++;
+                                       dF(blockIndex, block_index[*s4ptr]);
+                                   }
+                               break;
+                               
+                       case ICMD_LOOKUPSWITCH:                         /* switch statement                             */
+                               s4ptr = ip->val.a;
+                          
+                               dF(blockIndex, block_index[*s4ptr]);    /* default branch               */
+                               
+                               ++s4ptr;
+                               count = *s4ptr++;
+                               
+                               while (--count >= 0) {
+                                       dF(blockIndex, block_index[s4ptr[1]]);
+                                       s4ptr += 2;
+                                   }
+                               break;
+
+                       case ICMD_JSR:
+                               c_last_jump = blockIndex;
+                               dF(blockIndex, block_index[ip->op1]);         
+                               break;
+                               
+                       case ICMD_RET:
+                               dF(blockIndex, c_last_jump+1);
+                               break;
+                               
+                       default:
+                               dF(blockIndex, blockIndex + 1);
+                               break;  
+                           }                         
+                   }
+           } 
+
+       for (ptr = c_pre[blockIndex], cnt = 0; cnt < c_numPre[blockIndex]; ++cnt, ++ptr)
+       {
+               if (*ptr == from)
+                       break;
+       }
+
+       if (cnt >= c_numPre[blockIndex]) {      
+               c_pre[blockIndex][c_numPre[blockIndex]] = from;
+                                                   /* add predeccessors to list c_pre          */
+               c_numPre[blockIndex]++;                         /* increase number of predecessors      */              
+           }
+    
+}
+
+/* 
+   a slightly modified version of dF(int, int) that is used to traverse the part 
+   of the control graph that is not reached by normal program flow but by the 
+   raising of exceptions (code of catch blocks)
+*/
+void dF_Exception(int from, int blockIndex)
+{
+       instruction *ip;
+       s4 *s4ptr;
+       int high, low, count;
+       struct depthElement *hp;
+
+       if (c_exceptionVisit[blockIndex] < 0)   /* has block been visited, return       */
+               c_exceptionVisit[blockIndex] = 1;
+       else
+               return;
+
+       if (c_dTable[blockIndex] != NULL)               /* back to regular code section         */
+               return;
+
+       if (from >= 0) {                /* build exception graph (in c_exceptionGraph)          */
+           if ((hp = (struct depthElement *) malloc(sizeof(struct depthElement))) == NULL)
+                       c_mem_error();
+
+               hp->next = c_exceptionGraph[from];              
+               hp->value = blockIndex;
+               hp->changes = NULL;
+
+               c_exceptionGraph[from] = hp;
+           }
+       
+#ifdef C_DEBUG
+       if (blockIndex > block_count) {
+               fprintf(stderr, "DepthFirst: BlockIndex exceeded\n");
+               exit(1);
+        }
+#endif
+
+       ip = block[blockIndex].iinstr + block[blockIndex].icount -1;
+       
+       if (!block[blockIndex].icount)
+               dF_Exception(blockIndex, blockIndex+1);
+       else {
+               switch (ip->opc) {
+               case ICMD_RETURN:
+               case ICMD_IRETURN:
+               case ICMD_LRETURN:
+               case ICMD_FRETURN:
+               case ICMD_DRETURN:
+               case ICMD_ARETURN:
+               case ICMD_ATHROW:
+                       break;                                 
+               
+               case ICMD_IFEQ:
+               case ICMD_IFNE:
+               case ICMD_IFLT:
+               case ICMD_IFGE:
+               case ICMD_IFGT:
+               case ICMD_IFLE:
+               case ICMD_IFNULL:
+               case ICMD_IFNONNULL:
+               case ICMD_IF_ICMPEQ:
+               case ICMD_IF_ICMPNE:
+               case ICMD_IF_ICMPLT:
+               case ICMD_IF_ICMPGE:
+               case ICMD_IF_ICMPGT:
+               case ICMD_IF_ICMPLE:
+               case ICMD_IF_ACMPEQ:
+               case ICMD_IF_ACMPNE:
+                       dF_Exception(blockIndex, blockIndex + 1);
+                       /* fall throu */
+         
+               case ICMD_GOTO:
+                       dF_Exception(blockIndex, block_index[ip->op1]);         
+                       break;
+         
+               case ICMD_TABLESWITCH:
+                       s4ptr = ip->val.a;
+                       
+                       /* default branch */
+                       dF_Exception(blockIndex, block_index[*s4ptr]);
+                       
+                       s4ptr++;
+                       low = *s4ptr;
+                       s4ptr++;
+                       high = *s4ptr;
+                       
+                       count = (high-low+1);
+
+                       while (--count >= 0) {
+                               s4ptr++;
+                               dF_Exception(blockIndex, block_index[*s4ptr]);
+                           }
+                       break;
+
+               case ICMD_LOOKUPSWITCH:
+                       s4ptr = ip->val.a;
+                       /* default branch */
+                       dF_Exception(blockIndex, block_index[*s4ptr]);
+                       
+                       ++s4ptr;
+                       count = *s4ptr++;
+
+                       while (--count >= 0) {
+                               dF_Exception(blockIndex, block_index[s4ptr[1]]);
+                               s4ptr += 2;
+                           }  
+                       break;
+
+               case ICMD_JSR:
+                       c_last_jump = blockIndex;
+                       dF_Exception(blockIndex, block_index[ip->op1]);         
+                       break;
+       
+               case ICMD_RET:
+                       dF_Exception(blockIndex, c_last_jump+1);
+                       break;
+                       
+               default:
+                       dF_Exception(blockIndex, blockIndex + 1);
+                       break;  
+                   }                         
+        }
+}
+
+
+/*
+  Test function -> will be removed in final release
+*/
+void resultPass1()
+{
+       int i, j;
+       struct depthElement *hp;
+       
+       printf("\n\n****** PASS 1 ******\n\n");
+       printf("Number of Nodes: %d\n\n", c_globalCount);
+       printf("Predecessors:\n");
+       for (i=0; i<block_count; ++i) {
+               printf("Block %d:\t", i);
+               for (j=0; j<c_numPre[i]; ++j)
+                       printf("%d ", c_pre[i][j]);
+               printf("\n");
+       }
+       printf("\n");
+
+       printf("Graph:\n");
+       for (i=0; i<block_count; ++i) {
+               printf("Block %d:\t", i);
+               hp = c_dTable[i];
+               
+               while (hp != NULL) {
+                       printf("%d ", hp->value);
+                       hp = hp->next;
+                   }
+               printf("\n");
+           }
+       printf("\n");
+}
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/loop/graph.h b/src/vm/jit/loop/graph.h
new file mode 100644 (file)
index 0000000..139ff28
--- /dev/null
@@ -0,0 +1,47 @@
+/* jit/loop/graph.h - control flow graph header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: graph.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _GRAPH_H
+#define _GRAPH_H
+
+#include "loop.h"
+
+void LoopContainerInit(struct LoopContainer *lc, int i);
+void depthFirst();
+void dF(int from, int blockIndex);
+void dF_Exception(int from, int blockIndex);
+
+void resultPass1();
+
+#endif /* _GRAPH_H */
+
diff --git a/src/vm/jit/loop/loop.c b/src/vm/jit/loop/loop.c
new file mode 100644 (file)
index 0000000..8f5b111
--- /dev/null
@@ -0,0 +1,478 @@
+/* jit/loop/loop.c - array bound removal
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel      EMAIL: cacao@complang.tuwien.ac.at
+
+   The loop detection is performed according to Lengauer-Tarjan
+   algorithm that uses dominator trees (found eg. in modern compiler
+   implementation by a.w. appel)
+
+   $Id: loop.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "loop.h"
+#include "graph.h"
+#include "tracing.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+
+/* GLOBAL VARS                                                                                                                         */
+
+int c_debug_nr;                 /* a counter to number all BB with an unique    */
+                                /* value                                        */
+
+/* modified by graph.c                                                                                                                 */
+
+int *c_defnum;                                 /* array that stores a number for each node     when*/
+                                                               /* control flow graph is traveres depth first   */
+int *c_parent;                                 /* for each node that array stores its parent   */
+int *c_reverse;                                        /* for each def number that array stores the    */
+                                                               /* corresponding node                                                   */
+int c_globalCount;                             /* counter for def numbering                                    */
+int *c_numPre;                                 /* array that stores for each node its number   */
+                                                               /* predecessors                                                                 */
+int **c_pre;                                   /* array of array that stores predecessors              */
+int c_last_jump;                               /* stores the source node of the last jsr instr */
+basicblock *c_last_target;      /* stores the source BB of the last jsr instr  */
+
+struct depthElement **c_dTable;        /* adjacency list for control flow graph                */
+struct depthElement **c_exceptionGraph;        /* adjacency list for exception graph   */
+
+struct LoopContainer *c_allLoops;              /* list of all loops                                    */
+struct LoopContainer *c_loop_root;             /* root of loop hierarchie tree                 */
+
+int *c_exceptionVisit;                 /* array that stores a flag for each node part  */
+                                                               /* of the exception graph                                               */
+
+/* modified by loop.c                                                                                                                  */
+
+int *c_semi_dom;                               /* store for each node its semi dominator               */
+int *c_idom;                                   /* store for each node its dominator                    */
+int *c_same_dom;                               /* temp array to hold nodes with same dominator */
+int *c_ancestor;                               /* store for each node its ancestor with lowest */
+                                                               /* semi dominator                                                               */
+int *c_numBucket;                              
+int **c_bucket;
+
+int *c_contains;                               /* store for each node whether it's part of loop*/
+int *c_stack;                                  /* a simple stack as array                                              */
+int c_stackPointer;                            /* stackpointer                                                                 */
+
+
+/* modified by analyze.c                                                                                                               */
+
+struct LoopContainer *root;     /* the root pointer for the hierarchie tree of  */
+                                /* all loops in that procedure                  */
+
+int c_needed_instr;                            /* number of instructions that have to be               */
+                                                               /* inserted before loop header to make sure             */
+                                                               /* array optimization is legal                                  */
+int c_rs_needed_instr;                 /* number of instructions needed to load the    */
+                                                               /* value ofthe right side of the loop condition */
+int *c_nestedLoops;                            /* store for each node the header node of the   */
+                                                               /* loop this node belongs to, -1 for none               */
+int *c_hierarchie;              /* store a loop hierarchie                      */
+int *c_toVisit;                                        /* set for each node that is part of the loop   */
+
+int *c_current_loop;                   /* for each node:                               */
+                                                               /* store 0:     node is not part of loop                        */
+                                                               /* store 1:     node is loop header                                     */
+                                                               /* store 2:     node is in loop but not part of any     */
+                                                               /*                      nested loop                         */
+                                                               /* store 3:     node is part of nested loop                     */
+
+int c_current_head;                            /* store number of node that is header of loop  */
+int *c_var_modified;                   /* store for each local variable whether its    */
+                                                               /* value is changed in the loop                                 */
+
+struct Trace *c_rightside;             /* right side of loop condition                                 */
+struct Constraint **c_constraints;
+                                                               /* array that stores for each variable a list   */
+                                                               /* static tests (constraints) that have to be   */
+                                                               /* performed before loop entry                                  */
+                                                               /* IMPORTANT: c_constraints[maxlocals] stores   */
+                                                               /*                        the tests for constants and the       */
+                                                               /*                        right side of loop condition          */
+       
+struct LoopVar *c_loopvars;            /* a list of all intersting variables of the    */
+                                                               /* current loop (variables that are modified or */
+                                                               /* used as array index                                                  */
+
+basicblock *c_first_block_copied; /* pointer to the first block, that is copied */
+                                  /* during loop duplication                    */
+
+basicblock *c_last_block_copied;  /* last block, that is copied during loop     */
+                                  /* duplication                                */
+
+int *c_null_check;              /* array to store for local vars, whether they  */
+                                /* need to be checked against the null reference*/
+                                /* in the loop head                             */
+
+bool c_needs_redirection;       /* if a loop header is inserted as first block  */
+                                /* into the global BB list, this is set to true */
+                                 
+basicblock *c_newstart;         /* if a loop header is inserted as first block  */
+                                /* into the gloal BB list, this pointer is the  */
+                                /* new start                                    */
+int c_old_xtablelength;         /* used to store the original tablelength       */
+
+/* set debug mode                                                                                                                              */
+#define C_DEBUG
+
+
+/* declare statistic variables                                                                                                 */
+#ifdef STATISTICS
+
+int c_stat_num_loops;                  /* number of loops                                                              */
+
+/* statistics per loop                                                                                                                 */
+int c_stat_array_accesses;             /* number of array accesses                                             */
+
+int c_stat_full_opt;                   /* number of fully optimized accesses                   */
+int c_stat_no_opt;                             /* number of not optimized accesses                             */
+int c_stat_lower_opt;                  /* number of accesses where check against zero  */
+                                                               /* is removed                                                                   */
+int c_stat_upper_opt;                  /* number of accesses where check against array */
+                                                               /* lengh is removed                                                             */
+int c_stat_or;                                 /* set if optimization is cancelled because of  */
+                                                               /* or in loop condition                                                 */
+int c_stat_exception;                  /* set if optimization is cancelled because of  */
+                                                               /* index var modified in catch block                    */
+
+/* statistics per procedure                                                                                                            */
+int c_stat_sum_accesses;               /* number of array accesses                                             */
+
+int c_stat_sum_full;                   /* number of fully optimized accesses                   */
+int c_stat_sum_no;                             /* number of not optimized accesses                             */
+int c_stat_sum_lower;                  /* number of accesses where check against zero  */
+                                                               /* is removed                                                                   */
+int c_stat_sum_upper;                  /* number of accesses where check against array */
+                                                               /* lengh is removed                                                             */
+int c_stat_sum_or;                             /* set if optimization is cancelled because of  */
+                                                               /* or in loop condition                                                 */
+int c_stat_sum_exception;              /* set if optimization is cancelled because of  */
+
+#endif
+
+
+/*     
+   This function allocates and initializes variables, that are used by the
+   loop detection algorithm
+*/
+void setup()
+{
+       int i;
+
+       c_semi_dom = DMNEW(int, block_count);
+       c_idom = DMNEW(int, block_count);
+       c_same_dom = DMNEW(int, block_count);
+       c_numBucket = DMNEW(int, block_count);
+       c_ancestor = DMNEW(int, block_count);
+       c_contains = DMNEW(int, block_count);
+       c_stack = DMNEW(int, block_count);
+       c_bucket = DMNEW(int*, block_count);
+  
+       for (i = 0; i < block_count; ++i) {
+               c_numBucket[i] = 0;
+               c_stack[i] = c_ancestor[i] = c_semi_dom[i] = c_same_dom[i] = c_idom[i] = -1;
+         
+               c_bucket[i] = DMNEW(int, block_count);
+       }
+}
+
+
+/*     This function is a helper function for dominators and has to find the 
+       ancestor of the node v in the control graph, which semi-dominator has the  
+       lowest def-num.
+*/
+int findLowAnc(int v)
+{
+       int u = v;                      /* u is the node which has the current lowest semi-dom  */
+  
+       while (c_ancestor[v] != -1) {   /* as long as v has an ancestor, continue       */
+               if (c_defnum[c_semi_dom[v]] < c_defnum[c_semi_dom[u]])  
+                                                                       /* if v's semi-dom is smaller                           */
+                       u = v;                                  /* it gets the new current node u                       */
+               v = c_ancestor[v];                      /* climb one step up in the tree                        */
+               }
+       return u;                       /* return node with the lowest semi-dominator def-num   */
+}
+
+
+/*     This function builds the dominator tree out of a given control flow graph and 
+       stores its results in c_idom[]. It first calculates the number of possible
+       dominators in c_bucket and eventually determines the single dominator in a 
+       final pass.
+*/
+void dominators()
+{
+       int i, j, semi, s, n, v, actual, p, y;
+  
+       for (n=(c_globalCount-1); n>0; --n) {   /* for all nodes (except last), do      */
+               actual = c_reverse[n];
+               semi = p = c_parent[actual];            
+       
+               /* for all predecessors of current node, do                                                             */
+               for (i=0; i<c_numPre[actual]; ++i) {
+                       v = c_pre[actual][i];
+      
+                       if (c_defnum[v] <= c_defnum[actual])
+                               s = v;                  /* if predecessor has lower def-num     than node       */
+                                                               /* it becomes candidate for semi dominator              */
+                       else
+                               s = c_semi_dom[findLowAnc(v)];
+                                                               /* else the semi-dominator of it's ancestor             */
+                                                               /* with lowest def-num becomes candidate                */
+                       
+                       if (c_defnum[s] < c_defnum[semi])
+                               semi = s;               /* if the def-num of the new candidate is lower */
+                                                               /* than old one, it gets new semi dominator             */
+                       }
+    
+               /* write semi dominator -> according to SEMIDOMINATOR THEOREM                   */
+               c_semi_dom[actual] = semi;                              
+               c_ancestor[actual] = p;                                 
+    
+               c_bucket[semi][c_numBucket[semi]] = actual;
+               c_numBucket[semi]++;    /* defer calculation of dominator to final pass */
+      
+
+               /* first clause of DOMINATOR THEOREM, try to find dominator now                 */
+               for (j=0; j<c_numBucket[p]; ++j) {
+                       v = c_bucket[p][j];
+                       y = findLowAnc(v);
+      
+                       if (c_semi_dom[y] == c_semi_dom[v])     
+                               c_idom[v] = p;                  /* if y's dominator is already known    */
+                                                                               /* found it and write to c_idom                 */
+                       else
+                               c_same_dom[v] = y;              /* wait till final pass                                 */
+                       }
+               
+               c_numBucket[p] = 0;
+               }
+  
+       /* final pass to get missing dominators ->second clause of DOMINATOR THEORM     */
+       for (j=1; j<(c_globalCount-1); ++j) {           
+               if (c_same_dom[c_reverse[j]] != -1)     
+                       c_idom[c_reverse[j]] = c_idom[c_same_dom[c_reverse[j]]];
+               }
+}
+
+
+/*     
+   A helper function needed by detectLoops() that checks, whether a given 
+   connection between two nodes in the control flow graph is possibly part
+   of a loop (is a backEdge).
+*/
+int isBackEdge(int from, int to)
+{
+       int tmp = c_idom[to];   /* speed optimization: if the to-node is dominated      */
+       while (tmp != -1) {             /* by the from node as it is most of the time,          */
+               if (tmp == from)        /* there is no backEdge                                                         */
+                       return 0;
+               tmp = c_idom[tmp];
+               }
+
+       tmp = c_idom[from];             /* if from-node doesn't dominate to-node, we have       */
+       while (tmp != -1) {             /* to climb all the way up from the from-node to        */
+               if (tmp == to)          /* the top to check, whether it is dominated by to      */
+                       return 1;               /* if so, return a backedge                                                     */
+               tmp = c_idom[tmp];
+               }
+
+       return 0;                               /* else, there is no backedge                                           */
+}
+
+
+/*     
+   These stack functions are helper functions for createLoop(int, int)  
+   to manage the set of nodes in the current loop.
+*/
+void push(int i, struct LoopContainer *lc)
+{
+       struct LoopElement *le = lc->nodes, *t;
+
+       if (!c_contains[i])     {
+               t = DMNEW(struct LoopElement, 1);
+               
+               t->node = i;
+               t->block = &block[i];
+
+               c_contains[i] = 1;
+
+               if (i < le->node)
+               {
+                       t->next = lc->nodes;
+                       lc->nodes = t;
+               }
+               else
+               {
+                       while ((le->next != NULL) && (le->next->node < i))
+                               le = le->next;
+
+                       t->next = le->next;
+                       le->next = t;
+               }
+
+               c_stack[c_stackPointer++] = i;
+       }
+}
+
+
+int pop()
+{
+       return (c_stack[--c_stackPointer]);
+}
+
+
+int isFull()
+{
+       return (c_stackPointer);
+}
+
+
+/*     
+   This function is a helper function, that finds all nodes, that belong to 
+   the loop with a known header node and a member node of the loop (and a 
+   back edge between these two nodes).
+*/
+void createLoop(int header, int member)
+{
+       int i, nextMember;
+
+       struct LoopContainer *currentLoop = (struct LoopContainer *) malloc(sizeof(struct LoopContainer));
+       LoopContainerInit(currentLoop, header);         /* set up loop structure                */
+       
+       for (i=0; i<block_count; ++i)
+               c_contains[i] = 0;
+       c_contains[header] = 1;
+
+       c_stackPointer = 0;                             /* init stack with first node of the loop       */
+       push(member, currentLoop);
+
+       while (isFull()) {                              /* while there are still unvisited nodes        */
+               nextMember = pop();
+               
+               /* push all predecessors, while they are not equal to loop header               */
+               for (i=0; i<c_numPre[nextMember]; ++i)                  
+                       push(c_pre[nextMember][i], currentLoop);                
+               }
+
+       currentLoop->next = c_allLoops;
+       c_allLoops = currentLoop;
+}
+
+
+/*     After all dominators have been calculated, the loops can be detected and
+        added to the global list c_allLoops.
+*/
+void detectLoops()
+{
+       int i;
+       struct depthElement *h;
+       
+       /* for all edges in the control flow graph do                                                           */
+       for (i=0; i<block_count; ++i) {                 
+               h = c_dTable[i];
+
+               while (h != NULL) {
+                       /* if it's a backedge, than add a new loop to list                                      */
+                       if (isBackEdge(i, h->value))     
+                               createLoop(h->value, i);
+                       h = h->next;
+                       }
+               }
+}
+
+
+/*     
+   This function is called by higher level routines to perform the loop 
+   detection and set up the c_allLoops list.
+*/
+void analyseGraph()
+{
+  setup();
+  dominators();
+  detectLoops();
+}
+
+
+/*
+   Test function -> will be removed in final release
+*/
+void resultPass2()
+{
+  int i;
+  struct LoopContainer *lc = c_allLoops;
+  struct LoopElement *le;
+  
+  printf("\n\n****** PASS 2 ******\n\n");
+  
+  printf("Loops:\n\n");
+  
+  i = 0;
+  while (lc != NULL) {
+         printf("Loop [%d]: ", ++i);
+
+         le = lc->nodes;
+         while (le != NULL) {
+           printf("%d ", le->node);
+               printf("\n");
+               le = le->next;
+         }
+
+         lc = lc->next;
+  }
+
+  printf("\n");
+
+}
+
+
+void c_mem_error()
+{
+  panic("C_ERROR: Not enough memeory");
+} 
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/loop/loop.h b/src/vm/jit/loop/loop.h
new file mode 100644 (file)
index 0000000..69fa377
--- /dev/null
@@ -0,0 +1,264 @@
+/* jit/loop/loop.h - array bound removal header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel
+
+   $Id: loop.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _LOOP_H
+#define _LOOP_H
+
+#include "jit.h"
+
+
+/*     Different types for struct Trace                                                                                */
+#define TRACE_UNKNOWN 0                        /* unknown                                                                      */
+#define TRACE_ICONST  1                        /* integer constant value                                       */
+#define TRACE_ALENGTH 2                        /* array length value                                           */
+#define TRACE_IVAR    3                        /* integer variable reference                           */
+#define TRACE_AVAR    4                        /* object (array) reference                                     */
+
+/*     The ways a variable can be used in a loop                                                               */
+#define ARRAY_INDEX      0                     /* var used as array index                                      */
+#define VAR_MOD                  1                     /* var changes its value                                        */
+
+/*     The way, integer variables change their values                                                  */
+#define D_UP             0                     /* var is only increased                                        */
+#define D_DOWN           1                     /* var is only decreased                                        */
+#define D_UNKNOWN        2                     /* not known                                                            */
+
+/*     The different types of operators in loop conditions                                             */
+#define OP_EQ            0                     /* operator:    ==                                                      */
+#define OP_LT         1                        /* operator:    <                                                       */
+#define OP_GE        2                 /* operator:    >=                                                      */
+#define OP_UNKNOWN       3                     /* operator:    unknown                                         */
+
+/*     Possible types of static tests (constraints) in struct Constraint               */
+#define TEST_ZERO                      0       /* check variable against const. lower bound*/
+#define TEST_ALENGTH           1       /* check variable against array length          */
+#define TEST_CONST_ZERO                2       /* check constant against const. lower bound*/
+#define TEST_CONST_ALENGTH     3       /* check variable against array length          */
+#define TEST_UNMOD_ZERO                4       /* check var. that is constant in loop against*/
+                                                               /* constant lower bound                                         */
+#define TEST_UNMOD_ALENGTH     5       /* check var. that is constant in loop against*/
+                                                               /* array length                                                         */
+#define TEST_RS_ZERO           6       /* check constant part of loop condition against*/
+                                                               /* constant lower bound                                                 */
+#define TEST_RS_ALENGTH                7       /* check constant part of loop condition against*/
+                                                               /* array length                                                                 */
+
+/*     Possible types of bound check optimizations                                                                     */
+#define OPT_UNCHECKED  0               /* access not checked yet - first visit                 */
+#define OPT_NONE               1               /* no optimization                                                              */
+#define OPT_FULL               2               /* fully remove bound check                                             */
+#define OPT_LOWER              3               /* remove check againt zero                                             */
+#define OPT_UPPER              4               /* remove check against array length                    */
+
+/*     The different ways, remove_boundcheck(.) can be called                                          */ 
+#define BOUNDCHECK_REGULAR     0       /* perform regular optimization                                 */
+#define BOUNDCHECK_SPECIAL     1       /* only optimize header node - and ignore               */
+                                                               /* information from loop condition                              */
+
+#define LOOP_PART       0x1     /* a flag that marks a BB part of a loop        */
+#define HANDLER_PART    0x2     /* a flag that marks a BB part of ex-handler    */
+#define HANDLER_VISITED 0x4     /* flag to prevent loop if copying catch blocks */
+
+
+
+/*     This struct records information about interesting vars (vars that are modified
+       or used as an array index in loops.
+*/
+struct LoopVar {
+       int value;                                      /* reference to array of local variables                */
+       int modified;                           /* set if value of var is changed                               */
+       int index;                                      /* set if var is used as array index                    */
+       int static_l;                           /* var is never decremented -> static lower             */
+                                                               /* bound possible                                                               */
+       int static_u;                           /* var is never incremented -> static upper             */
+                                                               /* bound possible                                                               */
+       int dynamic_l;
+       int dynamic_l_v;                        /* variable is left side of loop condition in   */
+                                                               /* variable + dynamic_l >= right side                   */
+       int dynamic_u;
+       int dynamic_u_v;                        /* variable is left side of loop condition in   */
+                                                               /* variable + dynamic_u < right side                    */
+       struct LoopVar *next;           /* list pointer                                                                 */
+};
+
+
+/*     This struct records the needed static test of variables before loop entry.      */
+struct Constraint {
+       int type;                                       /* type of test to perform                                              */
+       int arrayRef;                           /* array reference involved in test (if any)    */
+       int varRef;                                     /* which variable to test (if involved)                 */
+       int constant;                           /* which constant to test (if involved)                 */
+       struct Constraint *next;        /* list pointer                                                                 */
+};
+
+
+/* This structure is used to record variables that change their value in loops.        */
+struct Changes {
+       int var;                                        /* variable involved                                                    */
+       int lower_bound;                        /* a minimum lower bound that is guaranteed             */
+       int upper_bound;                        /* a maximum upper bound that is guaranteed             */
+                                                               /* IMPORTANT: if lower_bound > upper_bound              */
+                                                               /* there are no guarantees at all                               */
+};
+
+
+/*     This struct is used to build the control flow graph and stores the variable     
+       changes at the beginning of each basic block.
+*/
+struct depthElement {
+       int value;                                      /* number of successor of this block                    */
+       struct depthElement *next;      /* list pointer                                                                 */
+       struct Changes **changes;       /* pointer to array of variable changes                 */
+};
+
+
+/*     Used to build a list of all basicblock, the loop consists of                            
+*/
+struct LoopElement {
+       int node;
+       basicblock      *block;                 
+       struct LoopElement *next;
+};
+
+
+/*
+   This structure stores informations about a single loop
+*/
+struct LoopContainer {
+       int toOpt;                                                      /* does this loop need optimization             */
+       struct LoopElement *nodes;          /* list of BBs this loop consists of    */
+       int loop_head;                      
+       int in_degree;                      /* needed to topological sort loops to  */
+                                           /* get the order of optimizing them     */
+       struct LoopContainer *next;                     /* list pointer                                                 */
+       struct LoopContainer *parent;           /* points to parent loop, if this BB    */
+                                                                               /* is head of a loop                                    */
+       struct LoopContainer *tree_right;   /* used for tree hierarchie of loops    */
+       struct LoopContainer *tree_down;
+       xtable *exceptions;                 /* list of exception in that loop       */
+};
+
+
+/* global variables */
+extern int c_debug_nr;
+extern int *c_defnum;
+extern int *c_parent;
+extern int *c_reverse;
+extern int c_globalCount;
+extern int *c_numPre;
+extern int **c_pre;
+extern int c_last_jump;
+extern basicblock *c_last_target;
+extern struct depthElement **c_dTable;
+extern struct depthElement **c_exceptionGraph;
+extern struct LoopContainer *c_allLoops;
+extern struct LoopContainer *c_loop_root;
+extern int *c_exceptionVisit;
+
+
+/* global loop variables */
+extern int *c_semi_dom;
+extern int *c_idom;
+extern int *c_same_dom;
+extern int *c_ancestor;
+extern int *c_numBucket;                               
+extern int **c_bucket;
+extern int *c_contains;
+extern int *c_stack;
+extern int c_stackPointer;
+
+
+/* global analyze variables    */
+extern struct LoopContainer *root;
+extern int c_needed_instr;
+extern int c_rs_needed_instr;
+extern int *c_nestedLoops;
+extern int *c_hierarchie;
+extern int *c_toVisit;
+extern int *c_current_loop;
+extern int c_current_head;
+extern int *c_var_modified;
+extern struct Trace *c_rightside;
+extern struct Constraint **c_constraints;
+extern struct LoopVar *c_loopvars;
+extern basicblock *c_first_block_copied;
+extern basicblock *c_last_block_copied;
+extern int *c_null_check;
+extern bool c_needs_redirection;
+extern basicblock *c_newstart;
+extern int c_old_xtablelength;
+
+
+/* global statistic variables */
+#ifdef STATISTICS
+
+extern int c_stat_num_loops;
+extern int c_stat_array_accesses;
+extern int c_stat_full_opt;
+extern int c_stat_no_opt;
+extern int c_stat_lower_opt;
+extern int c_stat_upper_opt;
+extern int c_stat_or;
+extern int c_stat_exception;
+extern int c_stat_sum_accesses;
+extern int c_stat_sum_full;
+extern int c_stat_sum_no;
+extern int c_stat_sum_lower;
+extern int c_stat_sum_upper;
+extern int c_stat_sum_or;
+extern int c_stat_sum_exception;
+
+#endif
+
+
+/* function prototypes */
+void analyseGraph();
+void c_mem_error();
+
+#endif /* _LOOP_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+
diff --git a/src/vm/jit/loop/tracing.c b/src/vm/jit/loop/tracing.c
new file mode 100644 (file)
index 0000000..7df83eb
--- /dev/null
@@ -0,0 +1,679 @@
+/* jit/loop/tracing.c - trace functions
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christopher Kruegel
+
+   Contains the functions which create a trace. A trace is a
+   structure, that contains the source of the arguments of a given
+   instruction. For more details see function tracing(basicblock, int,
+   int) below.
+
+   $Id: tracing.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include <stdio.h>
+#include "tracing.h"
+#include "loop.h"
+
+
+/*     Test function -> will be removed in final release
+*/
+void printTraceResult(struct Trace *p)
+{
+       printf("TRACE: ");
+
+       switch (p->type) {
+       case TRACE_UNKNOWN:
+               printf("\tUnknown");
+               break;
+       case TRACE_ICONST:
+               printf("\tconst - %d", p->constant);
+               break;
+       case TRACE_ALENGTH:
+               printf("\tarray - (%d)%d - %d", p->neg, p->var, p->constant);
+               break;
+       case TRACE_IVAR:
+               printf("\tivar - (%d)%d - %d", p->neg, p->var, p->constant);
+               break;
+       case TRACE_AVAR:
+               printf("\tavar - %d", p->var);
+               break;
+               }
+       
+       printf("\n");
+}
+
+    
+/*     A function that creates a new trace structure and initializes its values
+*/
+struct Trace* create_trace(int type, int var, int constant, int nr)
+{
+       struct Trace *t;
+       if ((t = (struct Trace *) malloc(sizeof(struct Trace))) == NULL)
+               c_mem_error();
+
+       t->type = type;
+
+       t->neg = 1;
+       t->var = var;
+       t->nr = nr;
+
+       t->constant = constant;
+
+       return t;
+}
+
+
+/*     When the function tracing(...) encounters an add instruction during its 
+       backward scan over the instructions, it trys to identify the source of the
+       arguments of this add function. The following function performs this task.
+*/
+struct Trace* add(struct Trace* a, struct Trace* b)
+{
+       switch (a->type) {                      /* check the first argument of add. when it             */
+       case TRACE_UNKNOWN:                     /* is unknown or array-address, return unknown  */
+       case TRACE_AVAR:
+               return create_trace(TRACE_UNKNOWN, -1, 0, 0);
+
+       case TRACE_ICONST:                      /* when it is constant, check second argument   */
+               switch (b->type) {
+               case TRACE_IVAR:                        /* when second argument is a variable value */
+               case TRACE_ALENGTH:                     /* or array length, just add the constant       */
+                       a->type = b->type;
+                       a->var  = b->var;
+                       a->neg  = b->neg;
+                       a->constant += b->constant;
+                       break;
+               case TRACE_UNKNOWN:                     /* when unknown/array ref. return unknown       */
+               case TRACE_AVAR:
+                     return create_trace(TRACE_UNKNOWN, -1, 0, 0);
+           case TRACE_ICONST:                  /* when both are constant, just add them        */
+                       a->constant += b->constant;
+                       break;
+                       }
+               break;
+
+       case TRACE_IVAR:                        /* when it is a variable value or array length, */
+       case TRACE_ALENGTH:                     /* check second argument                                                */
+               switch (b->type) {
+               case TRACE_IVAR:                        /* when it is not a constant return unknown     */
+               case TRACE_ALENGTH:
+               case TRACE_UNKNOWN:
+               case TRACE_AVAR:
+                       return create_trace(TRACE_UNKNOWN, -1, 0, 0);
+               case TRACE_ICONST:                      /* when it is a constant, just add it           */
+                       a->constant += b->constant;
+                       break;
+                       }
+               break;
+               }
+
+       return a;
+}
+
+
+/*     When the function tracing(...) encounters a neg instruction during its 
+       backward scan over the instructions, it trys to identify the source of the
+       argument of this neg function. The following function performs this task.
+*/
+struct Trace* negate(struct Trace* a)
+{
+       switch (a->type) {                              /* check argument type                                          */
+       case TRACE_IVAR:                                /* when it is variable/array length value       */
+       case TRACE_ALENGTH:                                     
+               a->neg = -(a->neg);                             /* invert negate flag                                   */
+               a->constant = -(a->constant);   /* and negate constant                                  */
+               break;
+       
+       case TRACE_ICONST:                              /* when it is a constant, negate it                     */
+               a->constant = -(a->constant);
+               break;
+
+       default:
+               a->type = TRACE_UNKNOWN;        /* else return unknown                                          */
+               break;
+               }
+
+  return a;
+}
+
+
+/*     When the function tracing(...) encounters a sub instruction during its backward
+       scan over the instructions, it trys to identify the source of the arguments of
+       this sub function. The following function performs this task, by applaying the
+       negate function on the second argument and then adds the values.
+*/
+struct Trace* sub(struct Trace* a, struct Trace* b)
+{
+       struct Trace *c = negate(b);
+       return add(a, c);
+}
+
+
+/*     When the function tracing(...) encounters an array length instruction during
+       its backward scan over the instructions, it trys to identify the source of 
+       the argument ofthis array length function. The following function performs 
+       this task.
+*/
+struct Trace* array_length(struct Trace* a)
+{
+       if (a->type == TRACE_AVAR)      /* if argument is an array ref., mark the type  */
+               a->type = TRACE_ALENGTH;        /* as array length of this array reference      */
+       else
+               a->type = TRACE_UNKNOWN;        /* else it's unknown                                    */
+
+       return a;
+}
+
+
+/*     This function is used to identify the types of operands of an intermediate 
+       code instruction.It is needed by functions, that analyze array accesses. If 
+       something is stored into or loaded from an array, we have to find out, which 
+       array really has been accessed. When a compare instruction is encountered at
+       a loop header, the type of its operands have to be detected to construct
+       dynamic bounds for some variables in the loop. This function returns a struct
+       Trace (see loop.h for more details about this structure). block is the basic
+       block to be examined, index holds the offset of the examined instruction in
+       this block. The arguments are retrieved by using the stack structure, the 
+       compilation process sets up. During the backwards scan of the code, it is 
+       possible, that other instructions temporaray put or get values from the stack
+       and hide the value, we are interested in below them. The value temp counts
+       the number of values on the stack, the are located beyond the target value.
+*/
+struct Trace* tracing(basicblock *block, int index, int temp)
+{
+       int args, retval;
+       instruction *ip;
+       methodinfo *m;
+
+       if (index >= 0) {
+               ip = block->iinstr+index;
+
+/*     printf("TRACING with %d %d %d\n", index, temp, ip->opc);
+*/
+               switch (ip->opc) {
+               
+               /* nop, nullcheckpop                                                                                                    */
+               case ICMD_NOP:                          /* ...  ==> ...                                                         */
+                       return tracing(block, index-1, temp);
+                       break;
+      
+               case ICMD_NULLCHECKPOP:         /* ..., objectref  ==> ...                                      */
+                       return tracing(block, index-1, temp+1);
+                       break;
+
+               /* Constants                                                                                                                    */
+               case ICMD_LCONST:                               
+               case ICMD_DCONST:
+               case ICMD_FCONST:
+               case ICMD_ACONST:
+                       if (temp > 0)                           
+                               return tracing(block, index-1, temp-1);         
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;                                          
+
+               case ICMD_ICONST:
+                       if (temp > 0)           /* if the target argument is not on top                 */
+                               return tracing(block, index-1, temp-1); /* look further                 */
+                       else
+                               return create_trace(TRACE_ICONST, -1, ip->val.i, index);
+                       break;                          /* else, return the value, found at this instr. */
+
+               /* Load/Store                                                                                                                   */
+        case ICMD_LLOAD:               
+               case ICMD_DLOAD:    
+               case ICMD_FLOAD:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+    
+               case ICMD_ILOAD:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                   else
+                               return create_trace(TRACE_IVAR, ip->op1, 0, index);
+                       break;
+
+               case ICMD_ALOAD:    
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                       else
+                               return create_trace(TRACE_AVAR, ip->op1, 0, index);                     
+                       break;
+               
+               case ICMD_LSTORE:    
+               case ICMD_DSTORE:    
+               case ICMD_FSTORE:
+               case ICMD_ISTORE:
+               case ICMD_ASTORE:    
+                       return tracing(block, index-1, temp+1);
+                       break;
+       
+
+               /* pop/dup/swap                                                                                                                 */
+               case ICMD_POP:      
+                       return tracing(block, index-1, temp+1);
+                       break;
+     
+               case ICMD_POP2:  
+                       return tracing(block, index-1, temp+2);
+                       break;
+
+               case ICMD_DUP:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                       else
+                               return tracing(block, index-1, temp);
+                       break;
+
+               case ICMD_DUP_X1:                       /* ..., a, b ==> ..., b, a, b                           */
+                       switch (temp) {
+                       case 0:                                 /* when looking for top or third element,       */
+                       case 2:                                 /* just return top element                                      */
+                               return tracing(block, index-1, 0);
+                       case 1:
+                               return tracing(block, index-1, 1);
+                       default:
+                               return tracing(block, index-1, temp-1);
+                               }
+                       break;
+
+               case ICMD_DUP2:                         /* ..., a, b ==> ..., a, b, a, b                        */
+                       switch (temp) { 
+                       case 0:                                 /* when looking for top or third element        */
+                       case 2:                                 /* just return top element                                      */
+                               return tracing(block, index-1, 0);
+                       case 1:                                 /* when looking for second or fourth element*/
+                       case 3:                                 /* just return second element                           */
+                               return tracing(block, index-1, 1);
+                       default:
+                               return tracing(block, index-1, temp-2);
+                               }
+                       break;
+
+               case ICMD_DUP2_X1:                      /* ..., a, b, c ==> ..., b, c, a, b, c          */
+                       switch (temp) {
+                       case 0:
+                       case 3:
+                               return tracing(block, index-1, 0);
+                       case 1:
+                       case 4:
+                               return tracing(block, index-1, 1);
+                       case 2:
+                               return tracing(block, index-1, 2);
+                       default:
+                               return tracing(block, index-1, temp-2);
+                               }
+                       break;
+
+               case ICMD_DUP_X2:                       /* ..., a, b, c ==> ..., c, a, b, c                     */
+                       switch (temp) {    
+                       case 0:
+                       case 3:
+                               return tracing(block, index-1, 0);
+                       case 1:
+                       case 4:
+                               return tracing(block, index-1, 1);
+                       case 2:
+                               return tracing(block, index-1, 2);
+                       default:
+                               return tracing(block, index-1, temp-2);
+                               }
+                       break;
+
+               case ICMD_DUP2_X2:                      /* .., a, b, c, d ==> ..., c, d, a, b, c, d     */
+                       switch (temp) {
+                       case 0:
+                       case 4:
+                               return tracing(block, index-1, 0);
+                       case 1:
+                       case 5:
+                               return tracing(block, index-1, 1);
+                       case 2:
+                               return tracing(block, index-1, 2);
+                       case 3:
+                               return tracing(block, index-1, 3);
+                       default:
+                               return tracing(block, index-1, temp-2);
+                               }
+                       break;
+
+               case ICMD_SWAP:                         /* ..., a, b ==> ..., b, a                                      */
+                       switch (temp) {
+                       case 0:
+                               return tracing(block, index-1, 1);
+                       case 1:
+                               return tracing(block, index-1, 0);
+                       default:
+                               return tracing(block, index-1, temp);
+                               }
+                       break;
+      
+               /* Interger operations                                                                                                  */
+           case ICMD_INEG:                             /* ..., value  ==> ..., - value                         */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else                                    /* if an inter neg. operation is found,         */
+                                                                       /* invokethe negate function                            */
+                               return negate(tracing(block, index-1, temp));
+                       break;
+
+               case ICMD_LNEG:                         /* ..., value  ==> ..., - value                         */
+               case ICMD_I2L:                          /* ..., value  ==> ..., value                           */
+               case ICMD_L2I:                          /* ..., value  ==> ..., value                           */
+               case ICMD_INT2BYTE:                     /* ..., value  ==> ..., value                           */
+               case ICMD_INT2CHAR:                     /* ..., value  ==> ..., value                           */
+               case ICMD_INT2SHORT:            /* ..., value  ==> ..., value                           */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_IADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+1);
+                       else                                    /* when add is encountered, invoke add func     */
+                               return add(tracing(block, index-1, 0), tracing(block, index-1, 1));
+                       break;
+
+               case ICMD_IADDCONST:            /* ..., value  ==> ..., value + constant        */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else                                    /* when a constant is added, create a           */
+                                                                       /* constant-trace and use add function          */
+                               return add(tracing(block, index-1, 0), create_trace(TRACE_ICONST, -1, ip->val.i, index));
+                       break;
+
+               case ICMD_ISUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+1);
+                       else                                    /* use sub function for sub instructions        */
+                               return sub(tracing(block, index-1, 1), tracing(block, index-1, 0));
+                       break;
+
+               case ICMD_ISUBCONST:            /* ..., value  ==> ..., value + constant        */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return sub(tracing(block, index-1, 0), create_trace(TRACE_ICONST, -1, ip->val.i, index));
+                       break;
+
+               case ICMD_LADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
+               case ICMD_LSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
+               case ICMD_IMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
+               case ICMD_LMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
+               case ICMD_ISHL:                         /* ..., val1, val2  ==> ..., val1 << val2       */
+               case ICMD_ISHR:                         /* ..., val1, val2  ==> ..., val1 >> val2       */
+               case ICMD_IUSHR:                        /* ..., val1, val2  ==> ..., val1 >>> val2      */
+               case ICMD_LSHL:                         /* ..., val1, val2  ==> ..., val1 << val2       */
+               case ICMD_LSHR:                         /* ..., val1, val2  ==> ..., val1 >> val2       */
+               case ICMD_LUSHR:                        /* ..., val1, val2  ==> ..., val1 >>> val2      */
+               case ICMD_IAND:                         /* ..., val1, val2  ==> ..., val1 & val2        */
+               case ICMD_LAND:  
+               case ICMD_IOR:                          /* ..., val1, val2  ==> ..., val1 | val2        */
+               case ICMD_LOR:
+               case ICMD_IXOR:                         /* ..., val1, val2  ==> ..., val1 ^ val2        */
+               case ICMD_LXOR:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+     
+               case ICMD_LADDCONST:            /* ..., value  ==> ..., value + constant        */
+               case ICMD_LSUBCONST:            /* ..., value  ==> ..., value - constant        */
+               case ICMD_IMULCONST:            /* ..., value  ==> ..., value * constant        */
+               case ICMD_LMULCONST:            /* ..., value  ==> ..., value * constant        */
+               case ICMD_IDIVPOW2:                     /* ..., value  ==> ..., value << constant       */
+               case ICMD_LDIVPOW2:                     /* val.i = constant                                                     */
+               case ICMD_ISHLCONST:            /* ..., value  ==> ..., value << constant       */
+               case ICMD_ISHRCONST:            /* ..., value  ==> ..., value >> constant       */
+               case ICMD_IUSHRCONST:           /* ..., value  ==> ..., value >>> constant      */
+               case ICMD_LSHLCONST:            /* ..., value  ==> ..., value << constant       */
+               case ICMD_LSHRCONST:            /* ..., value  ==> ..., value >> constant       */
+               case ICMD_LUSHRCONST:           /* ..., value  ==> ..., value >>> constant      */
+               case ICMD_IANDCONST:            /* ..., value  ==> ..., value & constant        */
+               case ICMD_IREMPOW2:                     /* ..., value  ==> ..., value % constant        */
+               case ICMD_IREM0X10001:          /* ..., value  ==> ..., value % 0x100001        */
+               case ICMD_LANDCONST:            /* ..., value  ==> ..., value & constant        */
+               case ICMD_LREMPOW2:                     /* ..., value  ==> ..., value % constant        */
+               case ICMD_LREM0X10001:          /* ..., value  ==> ..., value % 0x10001         */
+               case ICMD_IORCONST:                     /* ..., value  ==> ..., value | constant        */
+               case ICMD_LORCONST:                     /* ..., value  ==> ..., value | constant        */  
+               case ICMD_IXORCONST:            /* ..., value  ==> ..., value ^ constant        */
+               case ICMD_LXORCONST:            /* ..., value  ==> ..., value ^ constant        */
+               case ICMD_LCMP:                         /* ..., val1, val2  ==> ..., val1 cmp val2      */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_IINC:                         /* ..., value  ==> ..., value + constant        */
+                       return tracing(block, index-1, temp);
+                       break;
+
+
+               /* floating operations                                                                                                  */
+               case ICMD_FADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
+               case ICMD_DADD:                         /* ..., val1, val2  ==> ..., val1 + val2        */
+               case ICMD_FSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
+               case ICMD_DSUB:                         /* ..., val1, val2  ==> ..., val1 - val2        */
+               case ICMD_FMUL:                         /* ..., val1, val2  ==> ..., val1 * val2        */
+               case ICMD_DMUL:                         /* ..., val1, val2  ==> ..., val1 *** val2      */
+               case ICMD_FDIV:                         /* ..., val1, val2  ==> ..., val1 / val2        */
+               case ICMD_DDIV:                         /* ..., val1, val2  ==> ..., val1 / val2        */
+               case ICMD_FREM:                         /* ..., val1, val2  ==> ..., val1 % val2        */
+               case ICMD_DREM:                         /* ..., val1, val2  ==> ..., val1 % val2        */
+               case ICMD_FCMPL:                        /* .., val1, val2  ==> ..., val1 fcmpl val2     */
+               case ICMD_DCMPL:
+               case ICMD_FCMPG:                        /* .., val1, val2  ==> ..., val1 fcmpg val2     */
+               case ICMD_DCMPG:
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_FNEG:                         /* ..., value  ==> ..., - value                         */
+               case ICMD_DNEG:                         /* ..., value  ==> ..., - value                         */  
+               case ICMD_I2F:                          /* ..., value  ==> ..., (float) value           */
+               case ICMD_L2F:
+               case ICMD_I2D:                          /* ..., value  ==> ..., (double) value          */
+               case ICMD_L2D:
+               case ICMD_F2I:                          /* ..., value  ==> ..., (int) value                     */
+               case ICMD_D2I:
+               case ICMD_F2L:                          /* ..., value  ==> ..., (long) value            */
+               case ICMD_D2L:  
+               case ICMD_F2D:                          /* ..., value  ==> ..., (double) value          */
+               case ICMD_D2F:                          /* ..., value  ==> ..., (double) value          */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+   
+               /* memory operations                                                                                                    */
+                case ICMD_ARRAYLENGTH:         /* ..., arrayref  ==> ..., length                       */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return array_length(tracing(block, index-1, 0));
+                       break;
+
+               case ICMD_AALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_LALOAD:                       /* ..., arrayref, index  ==> ..., value         */  
+               case ICMD_IALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_FALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_DALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_CALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_SALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+               case ICMD_BALOAD:                       /* ..., arrayref, index  ==> ..., value         */
+                       if (temp > 0)           
+                               return tracing(block, index-1, temp+1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_AASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_LASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_IASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_FASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_DASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_CASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_SASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+               case ICMD_BASTORE:                      /* ..., arrayref, index, value  ==> ...         */
+                       return tracing(block, index-1, temp+3);
+                       break;
+               case ICMD_PUTSTATIC:            /* ..., value  ==> ...                                          */
+               case ICMD_PUTFIELD:                     /* ..., value  ==> ...                                          */
+                       return tracing(block, index-1, temp+1);
+                       break;
+               case ICMD_GETSTATIC:            /* ...  ==> ..., value                                          */
+               case ICMD_GETFIELD:                     /* ...  ==> ..., value                                          */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp-1);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+
+               /* branch: should not be encountered, but function calls possible               */
+               case ICMD_INVOKESTATIC:         /* ..., [arg1, [arg2 ...]] ==> ...                      */
+                       m = ip->val.a;                  /* get method pointer and                                       */
+                       args = ip->op1;                 /* number of arguments                                          */
+                       if (m->returntype != TYPE_VOID)
+                               retval = 1;                     /* if function returns a value, it is on        */
+                       else                                    /* top of stack                                                         */
+                               retval = 0;
+      
+                       if (temp > 0)                   /* temp is increased by number of arguments     */
+                                                                       /* less a possible result value                         */
+                               return tracing(block, index-1, temp+(args-retval));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_INVOKESPECIAL:        /* ..., objectref, [arg1, [arg2 ...]] ==> .     */
+               case ICMD_INVOKEVIRTUAL:        /* ..., objectref, [arg1, [arg2 ...]] ==> .     */
+               case ICMD_INVOKEINTERFACE:      /* ..., objectref, [arg1, [arg2 ...]] ==> . */
+                       m = ip->val.a;
+                       args = ip->op1; 
+                       if (m->returntype != TYPE_VOID)
+                               retval = 1;
+                       else
+                               retval = 0;
+                       
+                       if (temp > 0)                   /* same as above but add 1 for object ref       */
+                               return tracing(block, index-1, temp+(args-retval+1));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+               /* special                                                                                                                              */  
+               case ICMD_INSTANCEOF:           /* ..., objectref ==> ..., intresult            */
+               case ICMD_CHECKCAST:            /* ..., objectref ==> ..., objectref            */
+                       if (temp > 0)
+                               return tracing(block, index-1, temp);
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+      
+               case ICMD_MULTIANEWARRAY:       /* ..., cnt1, [cnt2, ...] ==> ..., arrayref     */
+                                                                       /* op1 = dimension                                                      */ 
+
+                       if (temp > 0)                   /* temp increased by number of dimensions       */
+                                                                       /* minus one for array ref                                      */
+                               return tracing(block, index-1, temp+(ip->op1 - 1));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+       
+               case ICMD_BUILTIN3:                     /* ..., arg1, arg2, arg3 ==> ...                        */
+                       if (ip->op1 != TYPE_VOID)
+                               retval = 1;
+                       else
+                               retval = 0;
+      
+                       if (temp > 0)                   /* increase temp by 3 minus possible return     */
+                                                                       /* value                                                                        */
+                               return tracing(block, index-1, temp+(3-retval));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_BUILTIN2:                     /* ..., arg1, arg2 ==> ...                                      */
+                       if (ip->op1 != TYPE_VOID)
+                               retval = 1;
+                       else
+                               retval = 0;
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+(2-retval));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                                                    */
+                       if (ip->op1 != TYPE_VOID)
+                               retval = 1;
+                       else
+                               retval = 0;
+                       if (temp > 0)
+                               return tracing(block, index-1, temp+(1-retval));
+                       else
+                               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       break;
+
+               /* others                                                                                                                               */
+               default:
+                       return create_trace(TRACE_UNKNOWN, -1, 0, index);
+                       }       /* switch       */
+               }               /* if           */
+       else
+               return create_trace(TRACE_UNKNOWN, -1, 0, index);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/loop/tracing.h b/src/vm/jit/loop/tracing.h
new file mode 100644 (file)
index 0000000..5117c70
--- /dev/null
@@ -0,0 +1,79 @@
+/* jit/loop/tracing.h - trace functions header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: tracing.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _TRACING_H
+#define _TRACING_H
+
+#include "jit.h"
+
+/*     
+   This struct is needed to record the source of operands of intermediate code
+   instructions. The instructions are scanned backwards and the stack is 
+   analyzed in order to determine the type of operand.
+*/
+struct Trace {
+       int type;                  /* the type of the operand                                           */
+       int neg;                   /* set if negated                                                            */
+       int var;                   /* variable reference        for IVAR                                */
+                                          /* array reference           for AVAR/ARRAY                  */
+       int nr;                    /* instruction number in the basic block, where */
+                                          /* the trace is defined                                                      */
+       int constant;              /* constant value            for ICONST                              */
+                                              /* modifiers                     for IVAR                                */
+};
+
+
+
+/* function protoypes */
+struct Trace* create_trace(int type, int var, int constant, int nr);
+struct Trace* add(struct Trace* a, struct Trace* b);
+struct Trace* negate(struct Trace* a);
+struct Trace* sub(struct Trace* a, struct Trace* b);
+struct Trace* array_length(struct Trace* a);
+struct Trace* tracing(basicblock *block, int index, int temp);
+
+#endif /* _TRACING_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 3b0b4fa377a45bc9426797c0a7b2a9270eea3b1f..baf6147853694b1e45ec0a544b98c025d8138b55 100644 (file)
@@ -1,59 +1,77 @@
-/* jit/parse.c *****************************************************************
+/* jit/parse.c - parser for JavaVM to intermediate code translation
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Parser for JavaVM to intermediate code translation
-       
-       Author: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Last Change: $Id: parse.c 553 2003-11-01 20:50:03Z twisti $
-                     include Rapid Type Analysis parse - 5/2003 - carolyn
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-#include "math.h"
-#include "sets.h"
-                                /* data about the currently parsed   method   */
+   Author: Andreas Krall
 
-static classinfo  *rt_class;    /* class the compiled method belongs to       */
-static methodinfo *rt_method;   /* pointer to method info of compiled method  */
-static utf      *rt_descriptor; /* type descriptor of compiled method         */
-static int       rt_jcodelength; /*length of JavaVM-codes                     */
-static u1       *rt_jcode;      /* pointer to start of JavaVM-code            */
+   Changes: Carolyn Oates
 
+   $Id: parse.c 557 2003-11-02 22:51:59Z twisti $
 
-/* macros for byte code fetching ***********************************************
+*/
 
-       fetch a byte code of given size from position p in code array jcode
 
-*******************************************************************************/
+#include <string.h>
+#include "parse.h"
+#include "global.h"
+#include "jit.h"
+#include "inline.h"
+#include "loop/loop.h"
+#include "types.h"
+#include "builtin.h"
+#include "tables.h"
+#include "native.h"
+#include "loader.h"
+#include "toolbox/memory.h"
+#include "toolbox/loging.h"
+
+
+/* data about the currently parsed method */
 
-#define code_get_u1(p)  jcode[p]
-#define code_get_s1(p)  ((s1)jcode[p])
-#define code_get_u2(p)  ((((u2)jcode[p])<<8)+jcode[p+1])
-#define code_get_s2(p)  ((s2)((((u2)jcode[p])<<8)+jcode[p+1]))
-#define code_get_u4(p)  ((((u4)jcode[p])<<24)+(((u4)jcode[p+1])<<16)\
-                           +(((u4)jcode[p+2])<<8)+jcode[p+3])
-#define code_get_s4(p)  ((s4)((((u4)jcode[p])<<24)+(((u4)jcode[p+1])<<16)\
-                           +(((u4)jcode[p+2])<<8)+jcode[p+3]))
+classinfo  *rt_class;    /* class the compiled method belongs to       */
+methodinfo *rt_method;   /* pointer to method info of compiled method  */
+utf *rt_descriptor;      /* type descriptor of compiled method         */
+int rt_jcodelength;      /*length of JavaVM-codes                      */
+u1  *rt_jcode;           /* pointer to start of JavaVM-code            */
 
 
 
 /*INLINING*/
-#include "inline.c"
+//#include "inline.c"
 /*#define debug_writebranch printf("op: %s i: %d label_index[i]: %d\n",icmd_names[opcode], i, label_index[i]);*/
 #define debug_writebranch
 
+
+
 /* functionc compiler_addinitclass *********************************************
 
        add class into the list of classes to initialize
 
 *******************************************************************************/
                                 
-static void compiler_addinitclass (classinfo *c)
+void compiler_addinitclass(classinfo *c)
 {
        classinfo *cl;
 
@@ -73,24 +91,25 @@ static void compiler_addinitclass (classinfo *c)
                                sprintf(logtext, "compiler_addinitclass: ");
                                utf_sprint(logtext+strlen(logtext), c->name);
                                dolog();
-                               }
+                       }
                        chain_addlast(uninitializedclasses, c);
                        return;
-                       }
+               }
                if (c < cl) {
                        if (runverbose) {
                                sprintf(logtext, "compiler_addinitclass: ");
                                utf_sprint(logtext+strlen(logtext), c->name);
                                dolog();
-                               }
+                       }
                        chain_addbefore(uninitializedclasses, c);
                        return;
-                       }
-               cl = chain_next(uninitializedclasses);
                }
+               cl = chain_next(uninitializedclasses);
+       }
 }                       
 
 
+
 /* function descriptor2typesL ***************************************************
 
        decodes a already checked method descriptor. The parameter count, the
@@ -99,9 +118,9 @@ static void compiler_addinitclass (classinfo *c)
 
 *******************************************************************************/               
 
-classSetNode * descriptor2typesL (methodinfo *m)
+classSetNode *descriptor2typesL(methodinfo *m)
 {
-int debugInfo = 0;
+       int debugInfo = 0;
        int i;
        u1 *types, *tptr;
        int pcount, c;
@@ -110,10 +129,10 @@ int debugInfo = 0;
        char *class; 
        char *desc;
        classSetNode *p=NULL;
-if (debugInfo >= 1) {
-       printf("In descriptor2typesL >>>\t"); fflush(stdout);
-       utf_display(m->class->name); printf(".");
-       method_display(m);fflush(stdout);
+       if (debugInfo >= 1) {
+               printf("In descriptor2typesL >>>\t"); fflush(stdout);
+               utf_display(m->class->name); printf(".");
+               method_display(m);fflush(stdout);
        }
 
        pcount = 0;
@@ -126,11 +145,11 @@ if (debugInfo >= 1) {
                *tptr++ = TYPE_ADR;
                if (debugInfo >= 1) {
                        printf("param #0 (this?) method class =");utf_display(m->class->name);printf("\n");
-                       }
+               }
                classtypes[pcount] = m->class;
                p = addClassCone(p,  m->class);
                pcount++;
-               }
+       }
 
        utf_ptr = m->descriptor->text + 1;
        strcpy (desc,utf_ptr);
@@ -138,123 +157,125 @@ if (debugInfo >= 1) {
        while ((c = *desc++) != ')') {
                pcount++;
                switch (c) {
-                       case 'B':
-                       case 'C':
-                       case 'I':
-                       case 'S':
-                       case 'Z':  *tptr++ = TYPE_INT;
-                                  break;
-                       case 'J':  *tptr++ = TYPE_LNG;
-                                  break;
-                       case 'F':  *tptr++ = TYPE_FLT;
-                                  break;
-                       case 'D':  *tptr++ = TYPE_DBL;
-                                  break;
-                       case 'L':  *tptr++ = TYPE_ADR;
-                                   /* get class string */
-                                   class = strtok(desc,";");
-                                  desc = strtok(NULL,"\0");
-                                   /* get/save classinfo ptr */
-                                  classtypes[pcount-1] = class_get(utf_new_char(class));
-                                  p = addClassCone(p,  class_get(utf_new_char(class)));
-                                       if (debugInfo >= 1) {
-                                               printf("LParam#%i 's class type is: %s\n",pcount-1,class);fflush(stdout);
-                                               printf("Lclasstypes[%i]=",pcount-1);fflush(stdout);
-                                               utf_display(classtypes[pcount-1]->name);
-                                               }
-                                  break;
-                       case '[':  *tptr++ = TYPE_ADR;
-                                  while (c == '[')
-                                      c = *desc++;
-                                   /* get class string */
-                                  if (c == 'L') {
-                                       class = strtok(desc,";");
-                                       desc = strtok(NULL,"\0");
-                                       /* get/save classinfo ptr */
-                                       classtypes[pcount-1] = class_get(utf_new_char(class));
-                                       p= addClassCone(p,  class_get(utf_new_char(class)));
-                                       if (debugInfo >= 1) {
-                                               printf("[Param#%i 's class type is: %s\n",pcount-1,class);
-                                               printf("[classtypes[%i]=",pcount-1);fflush(stdout);
-                                               utf_display(classtypes[pcount-1]->name);
-                                               printf("\n");
-                                               }
-                                       }
-                                  else
-                                       classtypes[pcount-1] = NULL;
-                                  break;
-                       default:   
-                               panic("Ill formed methodtype-descriptor");
+               case 'B':
+               case 'C':
+               case 'I':
+               case 'S':
+               case 'Z':  *tptr++ = TYPE_INT;
+                       break;
+               case 'J':  *tptr++ = TYPE_LNG;
+                       break;
+               case 'F':  *tptr++ = TYPE_FLT;
+                       break;
+               case 'D':  *tptr++ = TYPE_DBL;
+                       break;
+               case 'L':  *tptr++ = TYPE_ADR;
+                       /* get class string */
+                       class = strtok(desc,";");
+                       desc = strtok(NULL,"\0");
+                       /* get/save classinfo ptr */
+                       classtypes[pcount-1] = class_get(utf_new_char(class));
+                       p = addClassCone(p,  class_get(utf_new_char(class)));
+                       if (debugInfo >= 1) {
+                               printf("LParam#%i 's class type is: %s\n",pcount-1,class);fflush(stdout);
+                               printf("Lclasstypes[%i]=",pcount-1);fflush(stdout);
+                               utf_display(classtypes[pcount-1]->name);
+                       }
+                       break;
+               case '[':  *tptr++ = TYPE_ADR;
+                       while (c == '[')
+                               c = *desc++;
+                       /* get class string */
+                       if (c == 'L') {
+                               class = strtok(desc,";");
+                               desc = strtok(NULL,"\0");
+                               /* get/save classinfo ptr */
+                               classtypes[pcount-1] = class_get(utf_new_char(class));
+                               p= addClassCone(p,  class_get(utf_new_char(class)));
+                               if (debugInfo >= 1) {
+                                       printf("[Param#%i 's class type is: %s\n",pcount-1,class);
+                                       printf("[classtypes[%i]=",pcount-1);fflush(stdout);
+                                       utf_display(classtypes[pcount-1]->name);
+                                       printf("\n");
+                               }
                        }
+                       else
+                               classtypes[pcount-1] = NULL;
+                       break;
+               default:   
+                       panic("Ill formed methodtype-descriptor");
                }
+       }
 
        /* compute return type */
        switch (*desc++) {
-               case 'B':
-               case 'C':
-               case 'I':
-               case 'S':
-               case 'Z':  m->returntype = TYPE_INT;
-                          break;
-               case 'J':  m->returntype = TYPE_LNG;
-                          break;
-               case 'F':  m->returntype = TYPE_FLT;
-                          break;
-               case 'D':  m->returntype = TYPE_DBL;
-                          break;
-               case '[':
-                          m->returntype = TYPE_ADR;
-                          c = *desc;
-                          while (c == '[')
-                              c = *desc++;
-                          if (c != 'L') break;
-                          *(desc++);
+       case 'B':
+       case 'C':
+       case 'I':
+       case 'S':
+       case 'Z':  m->returntype = TYPE_INT;
+               break;
+       case 'J':  m->returntype = TYPE_LNG;
+               break;
+       case 'F':  m->returntype = TYPE_FLT;
+               break;
+       case 'D':  m->returntype = TYPE_DBL;
+               break;
+       case '[':
+               m->returntype = TYPE_ADR;
+               c = *desc;
+               while (c == '[')
+                       c = *desc++;
+               if (c != 'L') break;
+               *(desc++);
                           
-               case 'L':  
-                          m->returntype = TYPE_ADR;
+       case 'L':  
+               m->returntype = TYPE_ADR;
                          
-                            /* get class string */
-                           class = strtok(desc,";");
-                           m->returnclass = class_get(utf_new_char(class));
-                           if (m->returnclass == NULL) {
-                               printf("class=%s :\t",class);
-                               panic ("return class not found");
-                               }
-                          break;
-               case 'V':  m->returntype = TYPE_VOID;
-                          break;
+               /* get class string */
+               class = strtok(desc,";");
+               m->returnclass = class_get(utf_new_char(class));
+               if (m->returnclass == NULL) {
+                       printf("class=%s :\t",class);
+                       panic ("return class not found");
+               }
+               break;
+       case 'V':  m->returntype = TYPE_VOID;
+               break;
 
        default:   panic("Ill formed methodtype-descriptor-ReturnType");
-               }
+       }
 
        m->paramcount = pcount;
        m->paramtypes = types;
        m->paramclass = classtypes;
 
-if (debugInfo >=1) {
-       if (pcount > 0) {
-               for (i=0; i< m->paramcount; i++) {
+       if (debugInfo >=1) {
+               if (pcount > 0) {
+                       for (i=0; i< m->paramcount; i++) {
                        if ((m->paramtypes[i] == TYPE_ADR) && (m->paramclass[i] != NULL)) {
-                             printf("Param #%i is:\t",i);
-                             utf_display(m->paramclass[i]->name);
-                             printf("\n");
-                             }
-                        }
-               }
-       if ((m->returntype == TYPE_ADR) && (m->returnclass != NULL)) { 
-                 printf("\tReturn Type is:\t"); fflush(stdout);
-                 utf_display(m->returnclass->name);
-                 printf("\n");
-                 }
-
-       printf("params2types: START  results in a set \n");
-       printf("param2types: A Set size=%i=\n",sizeOfSet(p));
-       printSet(p);
+                                       printf("Param #%i is:\t",i);
+                                       utf_display(m->paramclass[i]->name);
+                                       printf("\n");
+                               }
+                       }
+               }
+               if ((m->returntype == TYPE_ADR) && (m->returnclass != NULL)) { 
+                       printf("\tReturn Type is:\t"); fflush(stdout);
+                       utf_display(m->returnclass->name);
+                       printf("\n");
+               }
+
+               printf("params2types: START  results in a set \n");
+               printf("param2types: A Set size=%i=\n",sizeOfSet(p));
+               printSet(p);
        }
 
-return p;
+       return p;
 }
 
+
+
 /* function descriptor2types ***************************************************
 
        decodes a already checked method descriptor. The parameter count, the
@@ -262,79 +283,80 @@ return p;
 
 *******************************************************************************/               
 
-static void descriptor2types (methodinfo *m)
+void descriptor2types(methodinfo *m)
 {
        u1 *types, *tptr;
        int pcount, c;
        char *utf_ptr;
        pcount = 0;
-       types = DMNEW (u1, m->descriptor->blength); 
+       types = DMNEW(u1, m->descriptor->blength); 
        
        tptr = types;
        if (!(m->flags & ACC_STATIC)) {
                *tptr++ = TYPE_ADR;
                pcount++;
-               }
+       }
 
        utf_ptr = m->descriptor->text + 1;
    
        while ((c = *utf_ptr++) != ')') {
                pcount++;
                switch (c) {
-                       case 'B':
-                       case 'C':
-                       case 'I':
-                       case 'S':
-                       case 'Z':  *tptr++ = TYPE_INT;
-                                  break;
-                       case 'J':  *tptr++ = TYPE_LNG;
-                                  break;
-                       case 'F':  *tptr++ = TYPE_FLT;
-                                  break;
-                       case 'D':  *tptr++ = TYPE_DBL;
-                                  break;
-                       case 'L':  *tptr++ = TYPE_ADR;
-                                  while (*utf_ptr++ != ';');
-                                  break;
-                       case '[':  *tptr++ = TYPE_ADR;
-                                  while (c == '[')
-                                      c = *utf_ptr++;
-                                  if (c == 'L')
-                                      while (*utf_ptr++ != ';') /* skip */;
-                                  break;
-                       default:   panic ("Ill formed methodtype-descriptor");
-                       }
-               }
-
-       /* compute return type */
-
-       switch (*utf_ptr++) {
                case 'B':
                case 'C':
                case 'I':
                case 'S':
-               case 'Z':  m->returntype = TYPE_INT;
-                          break;
-               case 'J':  m->returntype = TYPE_LNG;
-                          break;
-               case 'F':  m->returntype = TYPE_FLT;
-                          break;
-               case 'D':  m->returntype = TYPE_DBL;
-                          break;
-               case '[':
-               case 'L':  m->returntype = TYPE_ADR;
-                          break;
-               case 'V':  m->returntype = TYPE_VOID;
-                          break;
-
+               case 'Z':  *tptr++ = TYPE_INT;
+                       break;
+               case 'J':  *tptr++ = TYPE_LNG;
+                       break;
+               case 'F':  *tptr++ = TYPE_FLT;
+                       break;
+               case 'D':  *tptr++ = TYPE_DBL;
+                       break;
+               case 'L':  *tptr++ = TYPE_ADR;
+                       while (*utf_ptr++ != ';');
+                       break;
+               case '[':  *tptr++ = TYPE_ADR;
+                       while (c == '[')
+                               c = *utf_ptr++;
+                       if (c == 'L')
+                               while (*utf_ptr++ != ';') /* skip */;
+                       break;
                default:   panic ("Ill formed methodtype-descriptor");
                }
+       }
+
+       /* compute return type */
+
+       switch (*utf_ptr++) {
+       case 'B':
+       case 'C':
+       case 'I':
+       case 'S':
+       case 'Z':  m->returntype = TYPE_INT;
+               break;
+       case 'J':  m->returntype = TYPE_LNG;
+               break;
+       case 'F':  m->returntype = TYPE_FLT;
+               break;
+       case 'D':  m->returntype = TYPE_DBL;
+               break;
+       case '[':
+       case 'L':  m->returntype = TYPE_ADR;
+               break;
+       case 'V':  m->returntype = TYPE_VOID;
+               break;
+
+       default:   panic ("Ill formed methodtype-descriptor");
+       }
 
        m->paramcount = pcount;
        m->paramtypes = types;
 }
 
 
+
 /*******************************************************************************
 
        function 'parse' scans the JavaVM code and generates intermediate code
@@ -369,15 +391,34 @@ static void descriptor2types (methodinfo *m)
 
 /* block generating and checking macros */
 
-#define block_insert(i)    {if(!(block_index[i]&1))\
-                               {b_count++;block_index[i] |= 1;}}
-#define bound_check(i)     {if((i< 0) || (i>=cumjcodelength)) \
-                               panic("branch target out of code-boundary");}
-#define bound_check1(i)    {if((i< 0) || (i>cumjcodelength)) \
-                               panic("branch target out of code-boundary");}
+#define block_insert(i) \
+    do { \
+        if (!(block_index[(i)] & 1)) { \
+            b_count++; \
+            block_index[(i)] |= 1; \
+        } \
+    } while (0)
+
+
 /* FIXME really use cumjcodelength for the bound_checkers ? */
 
-static xtable* fillextable (xtable* extable, exceptiontable *raw_extable, int exceptiontablelength, int *label_index, int *block_count)
+#define bound_check(i) \
+    do { \
+        if (i < 0 || i >= cumjcodelength) { \
+            panic("branch target out of code-boundary"); \
+        } \
+    } while (0)
+
+#define bound_check1(i) \
+    do { \
+        if (i < 0 || i > cumjcodelength) { \
+            panic("branch target out of code-boundary"); \
+        } \
+    } while (0)
+
+
+
+static xtable* fillextable(xtable* extable, exceptiontable *raw_extable, int exceptiontablelength, int *label_index, int *block_count)
 {
        int b_count, i, p;
        
@@ -415,7 +456,9 @@ static xtable* fillextable (xtable* extable, exceptiontable *raw_extable, int ex
        return &extable[i];  /* return the next free xtable* */
 }
 
-static void parse()
+
+
+void parse()
 {
        int  p;                     /* java instruction counter                   */
        int  nextp;                 /* start of next java instruction             */
@@ -428,8 +471,9 @@ static void parse()
        bool iswide = false;        /* true if last instruction was a wide        */
        instruction *iptr;          /* current pointer into instruction array     */
        int gp;                     /* global java instruction counter            */
-                                   /* inlining info for current method           */
-       inlining_methodinfo *inlinfo = inlining_rootinfo, *tmpinlinf; 
+                                   /* inlining info for current method           */
+       inlining_methodinfo *inlinfo = inlining_rootinfo;
+       inlining_methodinfo *tmpinlinf;
        int nextgp = -1;            /* start of next method to be inlined         */
        int *label_index = NULL;    /* label redirection table                    */
        int firstlocal = 0;         /* first local variable of method             */
@@ -437,35 +481,40 @@ static void parse()
 
        bool useinltmp;
 
-/*INLINING*/
-       if (useinlining)
-               {
-                       label_index = inlinfo->label_index;
-                       maxstack = cummaxstack;
-                       exceptiontablelength=cumextablelength;
-               }
+       /* INLINING */
+       if (useinlining) {
+               label_index = inlinfo->label_index;
+               maxstack = cummaxstack;
+               exceptiontablelength = cumextablelength;
+       }
        
-       useinltmp = useinlining; /*FIXME remove this after debugging */
+       useinltmp = useinlining; /* FIXME remove this after debugging */
     /*useinlining = false;*/    /* and merge the if-statements  */
        
        if (!useinlining) {
-         cumjcodelength = jcodelength;
+               cumjcodelength = jcodelength;
+
        } else {
-         tmpinlinf = (inlining_methodinfo*) list_first(inlinfo->inlinedmethods);
-         if (tmpinlinf != NULL) nextgp = tmpinlinf->startgp;
+               tmpinlinf = (inlining_methodinfo*) list_first(inlinfo->inlinedmethods);
+               if (tmpinlinf != NULL) nextgp = tmpinlinf->startgp;
        }
 
-                /*RTAprint*/ if  ( ((opt_rt) ||(opt_xta) || (opt_vta)) && ((pOpcodes == 2) || (pOpcodes == 3)) )
-                /*RTAprint*/    {printf("PARSE method name =");
-                /*RTAprint*/    utf_display(method->class->name);printf(".");
-                /*RTAprint*/    method_display(method); printf(">\n\n");fflush(stdout);}
-       if ((opt_rt) || (opt_xta)) { 
-            RT_jit_parse(method);
-           }
-       else    {
+       if ((opt_rt || opt_xta || opt_vta) && (pOpcodes == 2 || pOpcodes == 3)) {
+               printf("PARSE method name =");
+               utf_display(method->class->name);
+               printf(".");
+               method_display(method);
+               printf(">\n\n");
+               fflush(stdout);
+       }
+
+       if (opt_rt || opt_xta) { 
+               RT_jit_parse(method);
+
+       } else {
                if (opt_vta) 
                        printf("VTA requested, but not yet implemented\n");
-               }
+       }
         
 
        /* allocate instruction array and block index table */
@@ -477,18 +526,18 @@ static void parse()
        /* 1 additional for TRACEBUILTIN and 4 for MONITORENTER/EXIT */
        /* additional MONITOREXITS are reached by branches which are 3 bytes */
        
-       iptr = instr = DMNEW(instruction, cumjcodelength + 5); 
+       iptr = instr = DMNEW(instruction, cumjcodelength + 5);
        
        /* initialize block_index table (unrolled four times) */
 
        {
-       int *ip;
+               int *ip;
        
-       for (i = 0, ip = block_index; i <= cumjcodelength; i += 4, ip += 4) {
-               ip[0] = 0;
-               ip[1] = 0;
-               ip[2] = 0;
-               ip[3] = 0;
+               for (i = 0, ip = block_index; i <= cumjcodelength; i += 4, ip += 4) {
+                       ip[0] = 0;
+                       ip[1] = 0;
+                       ip[2] = 0;
+                       ip[3] = 0;
                }
        }
 
@@ -496,28 +545,28 @@ static void parse()
 
        extable = DMNEW(xtable, exceptiontablelength + 1);
        /*
-       for (i = 0; i < method->exceptiontablelength; i++) {
+         for (i = 0; i < method->exceptiontablelength; i++) {
 
-               p = extable[i].startpc = raw_extable[i].startpc;
-               if (useinlining) p = label_index[p];
-               bound_check(p);
-               block_insert(p);
+         p = extable[i].startpc = raw_extable[i].startpc;
+         if (useinlining) p = label_index[p];
+         bound_check(p);
+         block_insert(p);
 
-               p = extable[i].endpc = raw_extable[i].endpc;
-               if (useinlining) p = label_index[p];
-               bound_check1(p);
-               if (p < cumjcodelength)
-                       block_insert(p);
+         p = extable[i].endpc = raw_extable[i].endpc;
+         if (useinlining) p = label_index[p];
+         bound_check1(p);
+         if (p < cumjcodelength)
+         block_insert(p);
 
-               p = extable[i].handlerpc = raw_extable[i].handlerpc;
-               bound_check(p);
-               block_insert(p);
+         p = extable[i].handlerpc = raw_extable[i].handlerpc;
+         bound_check(p);
+         block_insert(p);
 
-               extable[i].catchtype  = raw_extable[i].catchtype;
+         extable[i].catchtype  = raw_extable[i].catchtype;
 
-               extable[i].next = NULL;
-               extable[i].down = &extable[i+1];
-               }
+         extable[i].next = NULL;
+         extable[i].down = &extable[i+1];
+         }
        */
 
        nextex = fillextable(extable, raw_extable, method->exceptiontablelength, label_index, &b_count);
@@ -527,444 +576,446 @@ static void parse()
 #ifdef USE_THREADS
        if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
                isleafmethod=false;
-               }                       
+       }                       
 #endif
 
        /* scan all java instructions */
 
        for (p = 0, gp = 0; p < jcodelength; gp += (nextp - p), p = nextp) {
          
-         /* DEBUG        printf("p:%d gp:%d ",p,gp); */
+               /* DEBUG          printf("p:%d gp:%d ",p,gp); */
+
+               /*INLINING*/
+               if ((useinlining) && (gp == nextgp)) {
+                       u1 *tptr;
+                       bool *readonly = NULL;
+
+                       opcode = code_get_u1 (p);
+                       nextp = p += jcommandsize[opcode];
+                       tmpinlinf = list_first(inlinfo->inlinedmethods);
+                       firstlocal = tmpinlinf->firstlocal;
+                       label_index = tmpinlinf->label_index;
+                       readonly = tmpinlinf->readonly;
+                       for (i=0, tptr=tmpinlinf->method->paramtypes + tmpinlinf->method->paramcount - 1 ; i<tmpinlinf->method->paramcount; i++, tptr--) {
+                               int op;
+
+                               if ( (i==0) && inlineparamopt) {
+                                       OP1(ICMD_CLEAR_ARGREN, firstlocal);
+                               }
 
-/*INLINING*/
-         if ((useinlining) && (gp == nextgp)) {
-                 u1 *tptr;
-                 bool *readonly = NULL;
-
-                 opcode = code_get_u1 (p);
-                 nextp = p += jcommandsize[opcode];
-                 tmpinlinf = list_first(inlinfo->inlinedmethods);
-                 firstlocal = tmpinlinf->firstlocal;
-                 label_index = tmpinlinf->label_index;
-                 readonly = tmpinlinf->readonly;
-                 for (i=0, tptr=tmpinlinf->method->paramtypes + tmpinlinf->method->paramcount - 1 ; i<tmpinlinf->method->paramcount; i++, tptr--)
-                         {
-                                 int op;
-
-                                 if ( (i==0) && inlineparamopt) {
-                                         OP1(ICMD_CLEAR_ARGREN, firstlocal);
-                                 }
-
-                                 if ( !inlineparamopt || !readonly[i] )
-                                         op = ICMD_ISTORE;
-                                 else op = ICMD_READONLY_ARG;   
-
-                                 op += *tptr;
-                                 OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i);
-
-                                 /* block_index[gp] |= (ipc << 1);*/  /*FIXME: necessary ? */
-                         }
-                 inlining_save_compiler_variables();
-                 inlining_set_compiler_variables(tmpinlinf);
-                 if (inlinfo->inlinedmethods == NULL) gp = -1;
-                 else {
-                         tmpinlinf = list_first(inlinfo->inlinedmethods);
-                         nextgp = (tmpinlinf != NULL) ? tmpinlinf->startgp : -1;
-                 }
-                 if (method->exceptiontablelength > 0) 
-                         nextex = fillextable(nextex, method->exceptiontable, method->exceptiontablelength, label_index, &b_count);
-                 continue;
-         }
+                               if ( !inlineparamopt || !readonly[i] )
+                                       op = ICMD_ISTORE;
+                               else op = ICMD_READONLY_ARG;   
+
+                               op += *tptr;
+                               OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i);
+
+                               /* block_index[gp] |= (ipc << 1);*/  /*FIXME: necessary ? */
+                       }
+
+                       inlining_save_compiler_variables();
+                       inlining_set_compiler_variables(tmpinlinf);
+
+                       if (inlinfo->inlinedmethods == NULL) {
+                               gp = -1;
+                       } else {
+                               tmpinlinf = list_first(inlinfo->inlinedmethods);
+                               nextgp = (tmpinlinf != NULL) ? tmpinlinf->startgp : -1;
+                       }
+                       if (method->exceptiontablelength > 0) 
+                               nextex = fillextable(nextex, method->exceptiontable, method->exceptiontablelength, label_index, &b_count);
+                       continue;
+               }
          
-         opcode = code_get_u1 (p);           /* fetch op code                  */
+               opcode = code_get_u1(p);            /* fetch op code                  */
 
          
-         /*RTAprint*/ if  ((opt_rt) && ((pOpcodes == 2) || (pOpcodes == 3)) )
-         /*RTAprint*/    {printf("Parse<%i> p=%i<%i<   opcode=<%i> %s\n",
-         /*RTAprint*/            pOpcodes, p,rt_jcodelength,opcode,icmd_names[opcode]);}
+               if (opt_rt && (pOpcodes == 2) || (pOpcodes == 3)) {
+                       printf("Parse<%i> p=%i<%i<   opcode=<%i> %s\n",
+                                  pOpcodes, p, rt_jcodelength, opcode, icmd_names[opcode]);
+               }
          
-         block_index[gp] |= (ipc << 1);       /* store intermediate count       */
+               block_index[gp] |= (ipc << 1);      /* store intermediate count       */
 
-         if (blockend) {
-                 block_insert(gp);                /* start new block                */
-                 blockend = false;
-         }
+               if (blockend) {
+                       block_insert(gp);               /* start new block                */
+                       blockend = false;
+               }
 
                nextp = p + jcommandsize[opcode];   /* compute next instruction start */
                s_count += stackreq[opcode];            /* compute stack element count    */
 
                switch (opcode) {
-
-                       case JAVA_NOP:
-                               break;
+               case JAVA_NOP:
+                       break;
 
                        /* pushing constants onto the stack p */
 
-                       case JAVA_BIPUSH:
-                               LOADCONST_I(code_get_s1(p+1));
-                               break;
+               case JAVA_BIPUSH:
+                       LOADCONST_I(code_get_s1(p+1));
+                       break;
 
-                       case JAVA_SIPUSH:
-                               LOADCONST_I(code_get_s2(p+1));
-                               break;
+               case JAVA_SIPUSH:
+                       LOADCONST_I(code_get_s2(p+1));
+                       break;
 
-                       case JAVA_LDC1:
-                               i = code_get_u1(p+1);
-                               goto pushconstantitem;
-                       case JAVA_LDC2:
-                       case JAVA_LDC2W:
-                               i = code_get_u2(p + 1);
-
-                       pushconstantitem:
-
-                               if (i >= class->cpcount) 
-                                       panic ("Attempt to access constant outside range");
-
-                               switch (class->cptags[i]) {
-                                       case CONSTANT_Integer:
-                                               LOADCONST_I(((constant_integer*)
-                                                            (class->cpinfos[i]))->value);
-                                               break;
-                                       case CONSTANT_Long:
-                                               LOADCONST_L(((constant_long*)
-                                                            (class->cpinfos[i]))->value);
-                                               break;
-                                       case CONSTANT_Float:
-                                               LOADCONST_F(((constant_float*)
-                                                            (class->cpinfos[i]))->value);
-                                               break;
-                                       case CONSTANT_Double:
-                                               LOADCONST_D(((constant_double*)
-                                                            (class->cpinfos[i]))->value);
-                                               break;
-                                       case CONSTANT_String:
-                                               LOADCONST_A(literalstring_new((utf*)
-                                                                             (class->cpinfos[i])));
-                                               break;
-                                       default: panic("Invalid constant type to push");
-                                       }
-                               break;
-
-                       case JAVA_ACONST_NULL:
-                               LOADCONST_A(NULL);
-                               break;
-
-                       case JAVA_ICONST_M1:
-                       case JAVA_ICONST_0:
-                       case JAVA_ICONST_1:
-                       case JAVA_ICONST_2:
-                       case JAVA_ICONST_3:
-                       case JAVA_ICONST_4:
-                       case JAVA_ICONST_5:
-                               LOADCONST_I(opcode - JAVA_ICONST_0);
-                               break;
+               case JAVA_LDC1:
+                       i = code_get_u1(p+1);
+                       goto pushconstantitem;
+               case JAVA_LDC2:
+               case JAVA_LDC2W:
+                       i = code_get_u2(p + 1);
 
-                       case JAVA_LCONST_0:
-                       case JAVA_LCONST_1:
-                               LOADCONST_L(opcode - JAVA_LCONST_0);
-                               break;
+               pushconstantitem:
 
-                       case JAVA_FCONST_0:
-                       case JAVA_FCONST_1:
-                       case JAVA_FCONST_2:
-                               LOADCONST_F(opcode - JAVA_FCONST_0);
-                               break;
+                       if (i >= class->cpcount) 
+                               panic ("Attempt to access constant outside range");
 
-                       case JAVA_DCONST_0:
-                       case JAVA_DCONST_1:
-                               LOADCONST_D(opcode - JAVA_DCONST_0);
+                       switch (class->cptags[i]) {
+                       case CONSTANT_Integer:
+                               LOADCONST_I(((constant_integer*)
+                                                        (class->cpinfos[i]))->value);
                                break;
-
-                       /* loading variables onto the stack */
-
-                       case JAVA_ILOAD:
-                       case JAVA_LLOAD:
-                       case JAVA_FLOAD:
-                       case JAVA_DLOAD:
-                       case JAVA_ALOAD:
-                               if (!iswide)
-                                       i = code_get_u1(p+1);
-                               else {
-                                       i = code_get_u2(p+1);
-                                       nextp = p+3;
-                                       iswide = false;
-                                       }
-                               OP1(opcode, i + firstlocal);
+                       case CONSTANT_Long:
+                               LOADCONST_L(((constant_long*)
+                                                        (class->cpinfos[i]))->value);
                                break;
-
-                       case JAVA_ILOAD_0:
-                       case JAVA_ILOAD_1:
-                       case JAVA_ILOAD_2:
-                       case JAVA_ILOAD_3:
-                               OP1(ICMD_ILOAD, opcode - JAVA_ILOAD_0 + firstlocal);
+                       case CONSTANT_Float:
+                               LOADCONST_F(((constant_float*)
+                                                        (class->cpinfos[i]))->value);
                                break;
-
-                       case JAVA_LLOAD_0:
-                       case JAVA_LLOAD_1:
-                       case JAVA_LLOAD_2:
-                       case JAVA_LLOAD_3:
-                               OP1(ICMD_LLOAD, opcode - JAVA_LLOAD_0 + firstlocal);
+                       case CONSTANT_Double:
+                               LOADCONST_D(((constant_double*)
+                                                        (class->cpinfos[i]))->value);
                                break;
-
-                       case JAVA_FLOAD_0:
-                       case JAVA_FLOAD_1:
-                       case JAVA_FLOAD_2:
-                       case JAVA_FLOAD_3:
-                               OP1(ICMD_FLOAD, opcode - JAVA_FLOAD_0 + firstlocal);
+                       case CONSTANT_String:
+                               LOADCONST_A(literalstring_new((utf*)
+                                                                                         (class->cpinfos[i])));
                                break;
+                       default: panic("Invalid constant type to push");
+                       }
+                       break;
+
+               case JAVA_ACONST_NULL:
+                       LOADCONST_A(NULL);
+                       break;
+
+               case JAVA_ICONST_M1:
+               case JAVA_ICONST_0:
+               case JAVA_ICONST_1:
+               case JAVA_ICONST_2:
+               case JAVA_ICONST_3:
+               case JAVA_ICONST_4:
+               case JAVA_ICONST_5:
+                       LOADCONST_I(opcode - JAVA_ICONST_0);
+                       break;
+
+               case JAVA_LCONST_0:
+               case JAVA_LCONST_1:
+                       LOADCONST_L(opcode - JAVA_LCONST_0);
+                       break;
+
+               case JAVA_FCONST_0:
+               case JAVA_FCONST_1:
+               case JAVA_FCONST_2:
+                       LOADCONST_F(opcode - JAVA_FCONST_0);
+                       break;
+
+               case JAVA_DCONST_0:
+               case JAVA_DCONST_1:
+                       LOADCONST_D(opcode - JAVA_DCONST_0);
+                       break;
 
-                       case JAVA_DLOAD_0:
-                       case JAVA_DLOAD_1:
-                       case JAVA_DLOAD_2:
-                       case JAVA_DLOAD_3:
-                               OP1(ICMD_DLOAD, opcode - JAVA_DLOAD_0 + firstlocal);
-                               break;
+                       /* loading variables onto the stack */
 
-                       case JAVA_ALOAD_0:
-                       case JAVA_ALOAD_1:
-                       case JAVA_ALOAD_2:
-                       case JAVA_ALOAD_3:
-                               OP1(ICMD_ALOAD, opcode - JAVA_ALOAD_0 + firstlocal);
-                               break;
+               case JAVA_ILOAD:
+               case JAVA_LLOAD:
+               case JAVA_FLOAD:
+               case JAVA_DLOAD:
+               case JAVA_ALOAD:
+                       if (!iswide)
+                               i = code_get_u1(p+1);
+                       else {
+                               i = code_get_u2(p+1);
+                               nextp = p+3;
+                               iswide = false;
+                       }
+                       OP1(opcode, i + firstlocal);
+                       break;
+
+               case JAVA_ILOAD_0:
+               case JAVA_ILOAD_1:
+               case JAVA_ILOAD_2:
+               case JAVA_ILOAD_3:
+                       OP1(ICMD_ILOAD, opcode - JAVA_ILOAD_0 + firstlocal);
+                       break;
+
+               case JAVA_LLOAD_0:
+               case JAVA_LLOAD_1:
+               case JAVA_LLOAD_2:
+               case JAVA_LLOAD_3:
+                       OP1(ICMD_LLOAD, opcode - JAVA_LLOAD_0 + firstlocal);
+                       break;
+
+               case JAVA_FLOAD_0:
+               case JAVA_FLOAD_1:
+               case JAVA_FLOAD_2:
+               case JAVA_FLOAD_3:
+                       OP1(ICMD_FLOAD, opcode - JAVA_FLOAD_0 + firstlocal);
+                       break;
+
+               case JAVA_DLOAD_0:
+               case JAVA_DLOAD_1:
+               case JAVA_DLOAD_2:
+               case JAVA_DLOAD_3:
+                       OP1(ICMD_DLOAD, opcode - JAVA_DLOAD_0 + firstlocal);
+                       break;
+
+               case JAVA_ALOAD_0:
+               case JAVA_ALOAD_1:
+               case JAVA_ALOAD_2:
+               case JAVA_ALOAD_3:
+                       OP1(ICMD_ALOAD, opcode - JAVA_ALOAD_0 + firstlocal);
+                       break;
 
                        /* storing stack values into local variables */
 
-                       case JAVA_ISTORE:
-                       case JAVA_LSTORE:
-                       case JAVA_FSTORE:
-                       case JAVA_DSTORE:
-                       case JAVA_ASTORE:
-                               if (!iswide)
-                                       i = code_get_u1(p+1);
-                               else {
-                                       i = code_get_u2(p+1);
-                                       iswide=false;
-                                       nextp = p+3;
-                                       }
-                               OP1(opcode, i + firstlocal);
-                               break;
-
-                       case JAVA_ISTORE_0:
-                       case JAVA_ISTORE_1:
-                       case JAVA_ISTORE_2:
-                       case JAVA_ISTORE_3:
-                               OP1(ICMD_ISTORE, opcode - JAVA_ISTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_LSTORE_0:
-                       case JAVA_LSTORE_1:
-                       case JAVA_LSTORE_2:
-                       case JAVA_LSTORE_3:
-                               OP1(ICMD_LSTORE, opcode - JAVA_LSTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_FSTORE_0:
-                       case JAVA_FSTORE_1:
-                       case JAVA_FSTORE_2:
-                       case JAVA_FSTORE_3:
-                               OP1(ICMD_FSTORE, opcode - JAVA_FSTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_DSTORE_0:
-                       case JAVA_DSTORE_1:
-                       case JAVA_DSTORE_2:
-                       case JAVA_DSTORE_3:
-                               OP1(ICMD_DSTORE, opcode - JAVA_DSTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_ASTORE_0:
-                       case JAVA_ASTORE_1:
-                       case JAVA_ASTORE_2:
-                       case JAVA_ASTORE_3:
-                               OP1(ICMD_ASTORE, opcode - JAVA_ASTORE_0 + firstlocal);
-                               break;
-
-                       case JAVA_IINC:
-                               {
+               case JAVA_ISTORE:
+               case JAVA_LSTORE:
+               case JAVA_FSTORE:
+               case JAVA_DSTORE:
+               case JAVA_ASTORE:
+                       if (!iswide)
+                               i = code_get_u1(p+1);
+                       else {
+                               i = code_get_u2(p+1);
+                               iswide=false;
+                               nextp = p+3;
+                       }
+                       OP1(opcode, i + firstlocal);
+                       break;
+
+               case JAVA_ISTORE_0:
+               case JAVA_ISTORE_1:
+               case JAVA_ISTORE_2:
+               case JAVA_ISTORE_3:
+                       OP1(ICMD_ISTORE, opcode - JAVA_ISTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_LSTORE_0:
+               case JAVA_LSTORE_1:
+               case JAVA_LSTORE_2:
+               case JAVA_LSTORE_3:
+                       OP1(ICMD_LSTORE, opcode - JAVA_LSTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_FSTORE_0:
+               case JAVA_FSTORE_1:
+               case JAVA_FSTORE_2:
+               case JAVA_FSTORE_3:
+                       OP1(ICMD_FSTORE, opcode - JAVA_FSTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_DSTORE_0:
+               case JAVA_DSTORE_1:
+               case JAVA_DSTORE_2:
+               case JAVA_DSTORE_3:
+                       OP1(ICMD_DSTORE, opcode - JAVA_DSTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_ASTORE_0:
+               case JAVA_ASTORE_1:
+               case JAVA_ASTORE_2:
+               case JAVA_ASTORE_3:
+                       OP1(ICMD_ASTORE, opcode - JAVA_ASTORE_0 + firstlocal);
+                       break;
+
+               case JAVA_IINC:
+                       {
                                int v;
                                
                                if (!iswide) {
                                        i = code_get_u1(p + 1);
                                        v = code_get_s1(p + 2);
-                                       }
-                               else {
+
+                               else {
                                        i = code_get_u2(p + 1);
                                        v = code_get_s2(p + 3);
                                        iswide = false;
-                                       nextp = p+5;
-                                       }
-                               OP2I(opcode, i + firstlocal, v);
+                                       nextp = p + 5;
                                }
-                               break;
+                               OP2I(opcode, i + firstlocal, v);
+                       }
+                       break;
 
                        /* wider index for loading, storing and incrementing */
 
-                       case JAVA_WIDE:
-                               iswide = true;
-                               nextp = p + 1;
-                               break;
+               case JAVA_WIDE:
+                       iswide = true;
+                       nextp = p + 1;
+                       break;
 
                        /* managing arrays ************************************************/
 
-                       case JAVA_NEWARRAY:
-                               OP2I(ICMD_CHECKASIZE, 0, 0);
-                               switch (code_get_s1(p+1)) {
-                                       case 4:
-                                               BUILTIN1((functionptr)builtin_newarray_boolean, TYPE_ADR);
-                                               break;
-                                       case 5:
-                                               BUILTIN1((functionptr)builtin_newarray_char, TYPE_ADR);
-                                               break;
-                                       case 6:
-                                               BUILTIN1((functionptr)builtin_newarray_float, TYPE_ADR);
-                                               break;
-                                       case 7:
-                                               BUILTIN1((functionptr)builtin_newarray_double, TYPE_ADR);
-                                               break;
-                                       case 8:
-                                               BUILTIN1((functionptr)builtin_newarray_byte, TYPE_ADR);
-                                               break;
-                                       case 9:
-                                               BUILTIN1((functionptr)builtin_newarray_short, TYPE_ADR);
-                                               break;
-                                       case 10:
-                                               BUILTIN1((functionptr)builtin_newarray_int, TYPE_ADR);
-                                               break;
-                                       case 11:
-                                               BUILTIN1((functionptr)builtin_newarray_long, TYPE_ADR);
-                                               break;
-                                       default: panic("Invalid array-type to create");
-                                       }
+               case JAVA_NEWARRAY:
+                       OP2I(ICMD_CHECKASIZE, 0, 0);
+                       switch (code_get_s1(p + 1)) {
+                       case 4:
+                               BUILTIN1((functionptr)builtin_newarray_boolean, TYPE_ADR);
+                               break;
+                       case 5:
+                               BUILTIN1((functionptr)builtin_newarray_char, TYPE_ADR);
+                               break;
+                       case 6:
+                               BUILTIN1((functionptr)builtin_newarray_float, TYPE_ADR);
+                               break;
+                       case 7:
+                               BUILTIN1((functionptr)builtin_newarray_double, TYPE_ADR);
+                               break;
+                       case 8:
+                               BUILTIN1((functionptr)builtin_newarray_byte, TYPE_ADR);
+                               break;
+                       case 9:
+                               BUILTIN1((functionptr)builtin_newarray_short, TYPE_ADR);
+                               break;
+                       case 10:
+                               BUILTIN1((functionptr)builtin_newarray_int, TYPE_ADR);
+                               break;
+                       case 11:
+                               BUILTIN1((functionptr)builtin_newarray_long, TYPE_ADR);
                                break;
+                       default: panic("Invalid array-type to create");
+                       }
+                       break;
 
-                       case JAVA_ANEWARRAY:
-                               OP2I(ICMD_CHECKASIZE, 0, 0);
-                               i = code_get_u2(p+1);
-                               /* array or class type ? */
-                               if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
-                                       s_count++;
-                                       LOADCONST_A(class_getconstant(class, i,
-                                                                     CONSTANT_Arraydescriptor));
+               case JAVA_ANEWARRAY:
+                       OP2I(ICMD_CHECKASIZE, 0, 0);
+                       i = code_get_u2(p+1);
+                       /* array or class type ? */
+                       if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
+                               s_count++;
+                               LOADCONST_A(class_getconstant(class, i,
+                                                                                         CONSTANT_Arraydescriptor));
 #if defined(__I386__)
-                                       BUILTIN2((functionptr) asm_builtin_newarray_array, TYPE_ADR);
+                               BUILTIN2((functionptr) asm_builtin_newarray_array, TYPE_ADR);
 #else
-                                       BUILTIN2((functionptr)builtin_newarray_array, TYPE_ADR);
+                               BUILTIN2((functionptr) builtin_newarray_array, TYPE_ADR);
 #endif
-                                       }
-                               else {
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
-                                       s_count++;
+                       }
+                       else {
+                               LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                               s_count++;
 #if defined(__I386__)
-                                       BUILTIN2((functionptr) asm_builtin_anewarray, TYPE_ADR);
+                               BUILTIN2((functionptr) asm_builtin_anewarray, TYPE_ADR);
 #else
-                                       BUILTIN2((functionptr)builtin_anewarray, TYPE_ADR);
+                               BUILTIN2((functionptr) builtin_anewarray, TYPE_ADR);
 #endif
-                                       }
-                               break;
+                       }
+                       break;
 
-                       case JAVA_MULTIANEWARRAY:
-                               isleafmethod=false;
-                               i = code_get_u2(p+1);
-                               {
-                               int v = code_get_u1(p+3);
+               case JAVA_MULTIANEWARRAY:
+                       isleafmethod=false;
+                       i = code_get_u2(p + 1);
+                       {
+                               int v = code_get_u1(p + 3);
                                constant_arraydescriptor *desc =
                                    class_getconstant (class, i, CONSTANT_Arraydescriptor);
                                OP2A(opcode, v, desc);
-                               }
-                               break;
-
-                       case JAVA_IFEQ:
-                       case JAVA_IFLT:
-                       case JAVA_IFLE:
-                       case JAVA_IFNE:
-                       case JAVA_IFGT:
-                       case JAVA_IFGE:
-                       case JAVA_IFNULL:
-                       case JAVA_IFNONNULL:
-                       case JAVA_IF_ICMPEQ:
-                       case JAVA_IF_ICMPNE:
-                       case JAVA_IF_ICMPLT:
-                       case JAVA_IF_ICMPGT:
-                       case JAVA_IF_ICMPLE:
-                       case JAVA_IF_ICMPGE:
-                       case JAVA_IF_ACMPEQ:
-                       case JAVA_IF_ACMPNE:
-                       case JAVA_GOTO:
-                       case JAVA_JSR:
-                               i = p + code_get_s2(p+1);
-                               if (useinlining) { 
-                                 debug_writebranch
-                                 i = label_index[i];
-                               }
-                               bound_check(i);
-                               block_insert(i);
-                               blockend = true;
-                               OP1(opcode, i);
-                               break;
-                       case JAVA_GOTO_W:
-                       case JAVA_JSR_W:
-                               i = p + code_get_s4(p+1);
-                               if (useinlining) { 
-                                 debug_writebranch
-                                 i = label_index[i];
-                               }
-                               bound_check(i);
-                               block_insert(i);
-                               blockend = true;
-                               OP1(opcode, i);
-                               break;
-
-                       case JAVA_RET:
-                               if (!iswide)
-                                       i = code_get_u1(p+1);
-                               else {
-                                       i = code_get_u2(p+1);
-                                       nextp = p+3;
-                                       iswide = false;
-                                       }
-                               blockend = true;
+                       }
+                       break;
+
+               case JAVA_IFEQ:
+               case JAVA_IFLT:
+               case JAVA_IFLE:
+               case JAVA_IFNE:
+               case JAVA_IFGT:
+               case JAVA_IFGE:
+               case JAVA_IFNULL:
+               case JAVA_IFNONNULL:
+               case JAVA_IF_ICMPEQ:
+               case JAVA_IF_ICMPNE:
+               case JAVA_IF_ICMPLT:
+               case JAVA_IF_ICMPGT:
+               case JAVA_IF_ICMPLE:
+               case JAVA_IF_ICMPGE:
+               case JAVA_IF_ACMPEQ:
+               case JAVA_IF_ACMPNE:
+               case JAVA_GOTO:
+               case JAVA_JSR:
+                       i = p + code_get_s2(p+1);
+                       if (useinlining) { 
+                               debug_writebranch
+                                       i = label_index[i];
+                       }
+                       bound_check(i);
+                       block_insert(i);
+                       blockend = true;
+                       OP1(opcode, i);
+                       break;
+               case JAVA_GOTO_W:
+               case JAVA_JSR_W:
+                       i = p + code_get_s4(p+1);
+                       if (useinlining) { 
+                               debug_writebranch
+                                       i = label_index[i];
+                       }
+                       bound_check(i);
+                       block_insert(i);
+                       blockend = true;
+                       OP1(opcode, i);
+                       break;
+
+               case JAVA_RET:
+                       if (!iswide)
+                               i = code_get_u1(p+1);
+                       else {
+                               i = code_get_u2(p+1);
+                               nextp = p+3;
+                               iswide = false;
+                       }
+                       blockend = true;
                                
-                               /*
-                               if (isinlinedmethod) {
-                                 OP1(ICMD_GOTO, inlinfo->stopgp);
-                                 break;
-                                 }*/
-
-                               OP1(opcode, i + firstlocal);
-                               break;
-
-                       case JAVA_IRETURN:
-                       case JAVA_LRETURN:
-                       case JAVA_FRETURN:
-                       case JAVA_DRETURN:
-                       case JAVA_ARETURN:
-                       case JAVA_RETURN:
-
-
-                               if (isinlinedmethod) {
-/*                                     if (p==jcodelength-1) {*/ /* return is at end of inlined method */
-/*                                             OP(ICMD_NOP); */
-/*                                             break; */
-/*                                     } */
-                                       blockend = true;
-                                       OP1(ICMD_GOTO, inlinfo->stopgp);
-                                       break;
-                               }
-
+                       /*
+                         if (isinlinedmethod) {
+                         OP1(ICMD_GOTO, inlinfo->stopgp);
+                         break;
+                         }*/
+
+                       OP1(opcode, i + firstlocal);
+                       break;
+
+               case JAVA_IRETURN:
+               case JAVA_LRETURN:
+               case JAVA_FRETURN:
+               case JAVA_DRETURN:
+               case JAVA_ARETURN:
+               case JAVA_RETURN:
+
+
+                       if (isinlinedmethod) {
+                               /*                                      if (p==jcodelength-1) {*/ /* return is at end of inlined method */
+                               /*                                              OP(ICMD_NOP); */
+                               /*                                              break; */
+                               /*                                      } */
                                blockend = true;
-                               OP(opcode);
+                               OP1(ICMD_GOTO, inlinfo->stopgp);
                                break;
+                       }
 
-                       case JAVA_ATHROW:
-                               blockend = true;
-                               OP(opcode);
-                               break;
+                       blockend = true;
+                       OP(opcode);
+                       break;
+
+               case JAVA_ATHROW:
+                       blockend = true;
+                       OP(opcode);
+                       break;
                                
 
                        /* table jumps ********************************/
 
-                       case JAVA_LOOKUPSWITCH:
-                               {
+               case JAVA_LOOKUPSWITCH:
+                       {
                                s4 num, j;
                                s4 *tablep;
 
@@ -1015,14 +1066,14 @@ static void parse()
                                        nextp += 4;
                                        bound_check(j);
                                        block_insert(j);
-                                       }
+                               }
 
                                break;
-                               }
+                       }
 
 
-                       case JAVA_TABLESWITCH:
-                               {
+               case JAVA_TABLESWITCH:
+                       {
                                s4 num, j;
                                s4 *tablep;
 
@@ -1072,92 +1123,94 @@ static void parse()
                                        nextp += 4;
                                        bound_check(j);
                                        block_insert(j);
-                                       }
+                               }
 
                                break;
-                               }
+                       }
 
 
                        /* load and store of object fields *******************/
 
-                       case JAVA_AASTORE:
-                               BUILTIN3((functionptr) asm_builtin_aastore, TYPE_VOID);
-                               break;
+               case JAVA_AASTORE:
+                       BUILTIN3((functionptr) asm_builtin_aastore, TYPE_VOID);
+                       break;
 
-                       case JAVA_PUTSTATIC:
-                       case JAVA_GETSTATIC:
-                               i = code_get_u2(p + 1);
-                               {
+               case JAVA_PUTSTATIC:
+               case JAVA_GETSTATIC:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *fr;
                                fieldinfo *fi;
                                fr = class_getconstant (class, i, CONSTANT_Fieldref);
                                fi = class_findfield (fr->class, fr->name, fr->descriptor);
                                compiler_addinitclass (fr->class);
                                OP2A(opcode, fi->type, fi);
-                               }
-                               break;
-                       case JAVA_PUTFIELD:
-                       case JAVA_GETFIELD:
-                               i = code_get_u2(p + 1);
-                               {
+                       }
+                       break;
+               case JAVA_PUTFIELD:
+               case JAVA_GETFIELD:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *fr;
                                fieldinfo *fi;
                                fr = class_getconstant (class, i, CONSTANT_Fieldref);
                                fi = class_findfield (fr->class, fr->name, fr->descriptor);
                                OP2A(opcode, fi->type, fi);
-                               }
-                               break;
+                       }
+                       break;
 
 
                        /* method invocation *****/
 
-                       case JAVA_INVOKESTATIC:
-                               i = code_get_u2(p + 1);
-                               {
+               case JAVA_INVOKESTATIC:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *mr;
                                methodinfo *mi;
                                
                                mr = class_getconstant (class, i, CONSTANT_Methodref);
                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-                                       /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
-                                        /*RTAprint*/    {printf(" method name =");
-                                        /*RTAprint*/    utf_display(mi->class->name); printf(".");
-                                        /*RTAprint*/    utf_display(mi->name);printf("\tINVOKE STATIC\n");
-                                        /*RTAprint*/    fflush(stdout);}
+                               /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
+                                       /*RTAprint*/    {printf(" method name =");
+                                       /*RTAprint*/    utf_display(mi->class->name); printf(".");
+                                       /*RTAprint*/    utf_display(mi->name);printf("\tINVOKE STATIC\n");
+                                       /*RTAprint*/    fflush(stdout);}
                                if (! (mi->flags & ACC_STATIC))
                                        panic ("Static/Nonstatic mismatch calling static method");
                                descriptor2types(mi);
 
                                isleafmethod=false;
                                OP2A(opcode, mi->paramcount, mi);
-                               }
-                               break;
-                       case JAVA_INVOKESPECIAL:
-                       case JAVA_INVOKEVIRTUAL:
-                               i = code_get_u2(p + 1);
-                               {
+                       }
+                       break;
+
+               case JAVA_INVOKESPECIAL:
+               case JAVA_INVOKEVIRTUAL:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *mr;
                                methodinfo *mi;
                                
                                mr = class_getconstant (class, i, CONSTANT_Methodref);
                                mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-                                       /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
-                                        /*RTAprint*/    {printf(" method name =");
-                                                       method_display(mi);
-                                        /*RTAprint*/    utf_display(mi->class->name); printf(".");
-                                        /*RTAprint*/    utf_display(mi->name);printf("\tINVOKE SPECIAL/VIRTUAL\n");
-                                        /*RTAprint*/    fflush(stdout);}
+                               /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
+                                       /*RTAprint*/    {printf(" method name =");
+                                       method_display(mi);
+                                       /*RTAprint*/    utf_display(mi->class->name); printf(".");
+                                       /*RTAprint*/    utf_display(mi->name);printf("\tINVOKE SPECIAL/VIRTUAL\n");
+                                       /*RTAprint*/    fflush(stdout);}
 
                                if (mi->flags & ACC_STATIC)
                                        panic ("Static/Nonstatic mismatch calling static method");
                                descriptor2types(mi);
                                isleafmethod=false;
                                OP2A(opcode, mi->paramcount, mi);
-                               }
-                               break;
-                       case JAVA_INVOKEINTERFACE:
-                               i = code_get_u2(p + 1);
-                               {
+                       }
+                       break;
+
+               case JAVA_INVOKEINTERFACE:
+                       i = code_get_u2(p + 1);
+                       {
                                constant_FMIref *mr;
                                methodinfo *mi;
                                
@@ -1168,247 +1221,247 @@ static void parse()
                                descriptor2types(mi);
                                isleafmethod=false;
                                OP2A(opcode, mi->paramcount, mi);
-                               }
-                               break;
+                       }
+                       break;
 
                        /* miscellaneous object operations *******/
 
-                       case JAVA_NEW:
-                               i = code_get_u2 (p+1);
+               case JAVA_NEW:
+                       i = code_get_u2 (p+1);
 
-                               LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
-                               s_count++;
-                               BUILTIN1((functionptr) builtin_new, TYPE_ADR);
-                               break;
+                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                       s_count++;
+                       BUILTIN1((functionptr) builtin_new, TYPE_ADR);
+                       break;
 
-                       case JAVA_CHECKCAST:
-                               i = code_get_u2(p+1);
+               case JAVA_CHECKCAST:
+                       i = code_get_u2(p+1);
 
-                               /* array type cast-check */
-                               if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Arraydescriptor));
-                                       s_count++;
-                                       BUILTIN2((functionptr) asm_builtin_checkarraycast, TYPE_ADR);
-                                       }
-                               else { /* object type cast-check */
-                                       /*
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
-                                       s_count++;
-                                       BUILTIN2((functionptr) asm_builtin_checkcast, TYPE_ADR);
-                                       */
-                                       OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
-                                       }
-                               break;
+                       /* array type cast-check */
+                       if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
+                               LOADCONST_A(class_getconstant(class, i, CONSTANT_Arraydescriptor));
+                               s_count++;
+                               BUILTIN2((functionptr) asm_builtin_checkarraycast, TYPE_ADR);
+                       }
+                       else { /* object type cast-check */
+                               /*
+                                 LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                                 s_count++;
+                                 BUILTIN2((functionptr) asm_builtin_checkcast, TYPE_ADR);
+                               */
+                               OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
+                       }
+                       break;
 
-                       case JAVA_INSTANCEOF:
-                               i = code_get_u2(p+1);
+               case JAVA_INSTANCEOF:
+                       i = code_get_u2(p+1);
 
-                               /* array type cast-check */
-                               if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Arraydescriptor));
-                                       s_count++;
+                       /* array type cast-check */
+                       if (class_constanttype (class, i) == CONSTANT_Arraydescriptor) {
+                               LOADCONST_A(class_getconstant(class, i, CONSTANT_Arraydescriptor));
+                               s_count++;
 #if defined(__I386__)
-                                       BUILTIN2((functionptr) asm_builtin_arrayinstanceof, TYPE_INT);
+                               BUILTIN2((functionptr) asm_builtin_arrayinstanceof, TYPE_INT);
 #else
-                                       BUILTIN2((functionptr) builtin_arrayinstanceof, TYPE_INT);
+                               BUILTIN2((functionptr) builtin_arrayinstanceof, TYPE_INT);
 #endif
-                                       }
-                               else { /* object type cast-check */
-                                       /*
-                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
-                                       s_count++;
-                                       BUILTIN2((functionptr) builtin_instanceof, TYPE_INT);
-                                       */
-                                       OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
-                                       }
-                               break;
+                       }
+                       else { /* object type cast-check */
+                               /*
+                                 LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                                 s_count++;
+                                 BUILTIN2((functionptr) builtin_instanceof, TYPE_INT);
+                               */
+                               OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
+                       }
+                       break;
 
-                       case JAVA_MONITORENTER:
+               case JAVA_MONITORENTER:
 #ifdef USE_THREADS
-                               if (checksync) {
-                                       BUILTIN1((functionptr) asm_builtin_monitorenter, TYPE_VOID);
-                               } else
+                       if (checksync) {
+                               BUILTIN1((functionptr) asm_builtin_monitorenter, TYPE_VOID);
+                       } else
 #endif
-                                       {
+                               {
                                        OP(ICMD_NULLCHECKPOP);
-                                       }
-                               break;
+                               }
+                       break;
 
-                       case JAVA_MONITOREXIT:
+               case JAVA_MONITOREXIT:
 #ifdef USE_THREADS
-                               if (checksync) {
-                                       BUILTIN1((functionptr) asm_builtin_monitorexit, TYPE_VOID);
-                                       }
-                               else
+                       if (checksync) {
+                               BUILTIN1((functionptr) asm_builtin_monitorexit, TYPE_VOID);
+                       }
+                       else
 #endif
-                                       {
+                               {
                                        OP(ICMD_POP);
-                                       }
-                               break;
+                               }
+                       break;
 
                        /* any other basic operation **************************************/
 
-                       case JAVA_IDIV:
-                               OP(opcode);
-                               break;
+               case JAVA_IDIV:
+                       OP(opcode);
+                       break;
 
-                       case JAVA_IREM:
-                               OP(opcode);
-                               break;
+               case JAVA_IREM:
+                       OP(opcode);
+                       break;
 
-                       case JAVA_LDIV:
-                               OP(opcode);
-                               break;
+               case JAVA_LDIV:
+                       OP(opcode);
+                       break;
 
-                       case JAVA_LREM:
-                               OP(opcode);
-                               break;
+               case JAVA_LREM:
+                       OP(opcode);
+                       break;
 
-                       case JAVA_FREM:
+               case JAVA_FREM:
 #if defined(__I386__)
-                               OP(opcode);
+                       OP(opcode);
 #else
-                               BUILTIN2((functionptr) builtin_frem, TYPE_FLOAT);
+                       BUILTIN2((functionptr) builtin_frem, TYPE_FLOAT);
 #endif
-                               break;
+                       break;
 
-                       case JAVA_DREM:
+               case JAVA_DREM:
 #if defined(__I386__)
-                               OP(opcode);
+                       OP(opcode);
 #else
-                               BUILTIN2((functionptr) builtin_drem, TYPE_DOUBLE);
+                       BUILTIN2((functionptr) builtin_drem, TYPE_DOUBLE);
 #endif
-                               break;
+                       break;
 
-                       case JAVA_F2I:
+               case JAVA_F2I:
 #if defined(__ALPHA__)
-                               if (!opt_noieee) {
-                                       BUILTIN1((functionptr) builtin_f2i, TYPE_INT);
-                               } else
+                       if (!opt_noieee) {
+                               BUILTIN1((functionptr) builtin_f2i, TYPE_INT);
+                       } else
 #endif
                                {
                                        OP(opcode);
                                }
-                               break;
+                       break;
 
-                       case JAVA_F2L:
+               case JAVA_F2L:
 #if defined(__ALPHA__)
-                               if (!opt_noieee) {
-                                       BUILTIN1((functionptr) builtin_f2l, TYPE_LONG);
-                               } else 
+                       if (!opt_noieee) {
+                               BUILTIN1((functionptr) builtin_f2l, TYPE_LONG);
+                       } else 
 #endif
                                {
                                        OP(opcode);
                                }
-                               break;
+                       break;
 
-                       case JAVA_D2I:
+               case JAVA_D2I:
 #if defined(__ALPHA__)
-                               if (!opt_noieee) {
-                                       BUILTIN1((functionptr) builtin_d2i, TYPE_INT);
-                               } else
+                       if (!opt_noieee) {
+                               BUILTIN1((functionptr) builtin_d2i, TYPE_INT);
+                       } else
 #endif
                                {
                                        OP(opcode);
                                }
-                               break;
+                       break;
 
-                       case JAVA_D2L:
+               case JAVA_D2L:
 #if defined(__ALPHA__)
-                               if (!opt_noieee) {
-                                       BUILTIN1((functionptr) builtin_d2l, TYPE_LONG);
-                               } else
+                       if (!opt_noieee) {
+                               BUILTIN1((functionptr) builtin_d2l, TYPE_LONG);
+                       } else
 #endif
                                {
                                        OP(opcode);
                                }
-                               break;
-
-                       case JAVA_BREAKPOINT:
-                               panic("Illegal opcode Breakpoint encountered");
-                               break;
-
-                       case 203:
-                       case 204:
-                       case 205:
-                       case 206:
-                       case 207:
-                       case 208:
-                       case 209:
-                       case 210:
-                       case 211:
-                       case 212:
-                       case 213:
-                       case 214:
-                       case 215:
-                       case 216:
-                       case 217:
-                       case 218:
-                       case 219:
-                       case 220:
-                       case 221:
-                       case 222:
-                       case 223:
-                       case 224:
-                       case 225:
-                       case 226:
-                       case 227:
-                       case 228:
-                       case 229:
-                       case 230:
-                       case 231:
-                       case 232:
-                       case 233:
-                       case 234:
-                       case 235:
-                       case 236:
-                       case 237:
-                       case 238:
-                       case 239:
-                       case 240:
-                       case 241:
-                       case 242:
-                       case 243:
-                       case 244:
-                       case 245:
-                       case 246:
-                       case 247:
-                       case 248:
-                       case 249:
-                       case 250:
-                       case 251:
-                       case 252:
-                       case 253:
-                       case 254:
-                       case 255:
-                               printf("Illegal opcode %d at instr %d", opcode, ipc);
-                               panic("encountered");
-                               break;
-
-                       default:
-                               OP(opcode);
-                               break;
+                       break;
+
+               case JAVA_BREAKPOINT:
+                       panic("Illegal opcode Breakpoint encountered");
+                       break;
+
+               case 203:
+               case 204:
+               case 205:
+               case 206:
+               case 207:
+               case 208:
+               case 209:
+               case 210:
+               case 211:
+               case 212:
+               case 213:
+               case 214:
+               case 215:
+               case 216:
+               case 217:
+               case 218:
+               case 219:
+               case 220:
+               case 221:
+               case 222:
+               case 223:
+               case 224:
+               case 225:
+               case 226:
+               case 227:
+               case 228:
+               case 229:
+               case 230:
+               case 231:
+               case 232:
+               case 233:
+               case 234:
+               case 235:
+               case 236:
+               case 237:
+               case 238:
+               case 239:
+               case 240:
+               case 241:
+               case 242:
+               case 243:
+               case 244:
+               case 245:
+               case 246:
+               case 247:
+               case 248:
+               case 249:
+               case 250:
+               case 251:
+               case 252:
+               case 253:
+               case 254:
+               case 255:
+                       printf("Illegal opcode %d at instr %d", opcode, ipc);
+                       panic("encountered");
+                       break;
+
+               default:
+                       OP(opcode);
+                       break;
                                
-                   } /* end switch */
+               } /* end switch */
                
                /* INLINING */
                  
-               if ((isinlinedmethod) && (p==jcodelength-1)) { /*end of an inlined method */
-                 /*              printf("setting gp from %d to %d\n",gp, inlinfo->stopgp); */
-                 gp = inlinfo->stopgp; 
-                 inlining_restore_compiler_variables();
-                 list_remove(inlinfo->inlinedmethods, list_first(inlinfo->inlinedmethods));
-                 if (inlinfo->inlinedmethods == NULL) nextgp = -1;
-                 else {
-                         tmpinlinf = list_first(inlinfo->inlinedmethods);
-                         nextgp = (tmpinlinf != NULL) ? tmpinlinf->startgp : -1;
-                 }
-                 /*              printf("nextpgp: %d\n", nextgp); */
-                 label_index=inlinfo->label_index;
-                 firstlocal = inlinfo->firstlocal;
+               if (isinlinedmethod && p == jcodelength - 1) { /* end of an inlined method */
+                       /*                printf("setting gp from %d to %d\n",gp, inlinfo->stopgp); */
+                       gp = inlinfo->stopgp; 
+                       inlining_restore_compiler_variables();
+                       list_remove(inlinfo->inlinedmethods, list_first(inlinfo->inlinedmethods));
+                       if (inlinfo->inlinedmethods == NULL) nextgp = -1;
+                       else {
+                               tmpinlinf = list_first(inlinfo->inlinedmethods);
+                               nextgp = (tmpinlinf != NULL) ? tmpinlinf->startgp : -1;
+                       }
+                       /*                printf("nextpgp: %d\n", nextgp); */
+                       label_index=inlinfo->label_index;
+                       firstlocal = inlinfo->firstlocal;
                }
+       } /* end for */
 
-               } /* end for */
        if (p != jcodelength)
                panic("Command-sequence crosses code-boundary");
 
@@ -1431,95 +1484,89 @@ static void parse()
        stack = DMNEW(stackelement, stack_count);
 
        {
-       basicblock  *bptr;
+               basicblock  *bptr;
 
-       bptr = block = DMNEW(basicblock, b_count + 1);    /* one more for end ipc */
+               bptr = block = DMNEW(basicblock, b_count + 1);    /* one more for end ipc */
 
-       b_count = 0;
-       c_debug_nr = 0;
+               b_count = 0;
+               c_debug_nr = 0;
        
-       /* additional block if target 0 is not first intermediate instruction     */
+               /* additional block if target 0 is not first intermediate instruction     */
+
+               if (!block_index[0] || (block_index[0] > 1)) {
+                       bptr->iinstr = instr;
+                       bptr->mpc = -1;
+                       bptr->flags = -1;
+                       bptr->type = BBTYPE_STD;
+                       bptr->branchrefs = NULL;
+                       bptr->pre_count = 0;
+                       bptr->debug_nr = c_debug_nr++;
+                       bptr++;
+                       b_count++;
+                       (bptr - 1)->next = bptr;
+               }
+
+               /* allocate blocks */
+
+               for (p = 0; p < cumjcodelength; p++) {
+                       if (block_index[p] & 1) {
+                               bptr->iinstr = instr + (block_index[p] >> 1);
+                               bptr->debug_nr = c_debug_nr++;
+                               if (b_count != 0)
+                                       (bptr - 1)->icount = bptr->iinstr - (bptr - 1)->iinstr;
+                               bptr->mpc = -1;
+                               bptr->flags = -1;
+                               bptr->lflags = 0;
+                               bptr->type = BBTYPE_STD;
+                               bptr->branchrefs = NULL;
+                               block_index[p] = b_count;
+                               bptr->pre_count = 0;
+                               bptr++;
+                               b_count++;
+                               (bptr - 1)->next = bptr;
+                       }
+               }
+
+               /* allocate additional block at end */
 
-       if (!block_index[0] || (block_index[0] > 1)) {
-               bptr->iinstr = instr;
+               bptr->instack = bptr->outstack = NULL;
+               bptr->indepth = bptr->outdepth = 0;
+               bptr->iinstr = NULL;
+               (bptr - 1)->icount = (instr + instr_count) - (bptr - 1)->iinstr;
+               bptr->icount = 0;
                bptr->mpc = -1;
                bptr->flags = -1;
+               bptr->lflags = 0;
                bptr->type = BBTYPE_STD;
                bptr->branchrefs = NULL;
                bptr->pre_count = 0;
                bptr->debug_nr = c_debug_nr++;
-               bptr++;
-               b_count++;
                (bptr - 1)->next = bptr;
-       
-               }
+               bptr->next = NULL;
 
-       /* allocate blocks */
+               last_block = bptr;
 
+               if (exceptiontablelength > 0)
+                       extable[exceptiontablelength - 1].down = NULL;
+               else
+                       extable = NULL;
 
-       for (p = 0; p < cumjcodelength; p++)
-               
-               if (block_index[p] & 1) {
-                       bptr->iinstr = instr + (block_index[p] >> 1);
-                       bptr->debug_nr = c_debug_nr++;
-                       if (b_count != 0)
-                               (bptr - 1)->icount = bptr->iinstr - (bptr - 1)->iinstr;
-                       bptr->mpc = -1;
-                       bptr->flags = -1;
-                       bptr->lflags = 0;
-                       bptr->type = BBTYPE_STD;
-                       bptr->branchrefs = NULL;
-                       block_index[p] = b_count;
-                       bptr->pre_count = 0;
-                       bptr++;
-                       b_count++;
+               for (i = 0; i < exceptiontablelength; ++i) {
+                       p = extable[i].startpc;
+                       extable[i].start = block + block_index[p];
 
-                       (bptr - 1)->next = bptr;
-                       }
-
-       /* allocate additional block at end */
+                       p = extable[i].endpc;
+                       extable[i].end = block + block_index[p]; 
 
-       
-       bptr->instack = bptr->outstack = NULL;
-       bptr->indepth = bptr->outdepth = 0;
-       bptr->iinstr = NULL;
-       (bptr - 1)->icount = (instr + instr_count) - (bptr - 1)->iinstr;
-       bptr->icount = 0;
-       bptr->mpc = -1;
-       bptr->flags = -1;
-       bptr->lflags = 0;
-       bptr->type = BBTYPE_STD;
-       bptr->branchrefs = NULL;
-       bptr->pre_count = 0;
-       bptr->debug_nr = c_debug_nr++;
-                       
-       (bptr - 1)->next = bptr;
-       bptr->next = NULL;
-
-       last_block = bptr;
-
-       if (exceptiontablelength > 0)
-               extable[exceptiontablelength-1].down = NULL;
-       else
-               extable = NULL;
-
-       for (i = 0; i < exceptiontablelength; ++i) {
-               p = extable[i].startpc;
-               extable[i].start = block + block_index[p];
-
-               p = extable[i].endpc;
-               extable[i].end = block + block_index[p]; 
-
-               p = extable[i].handlerpc;
-               extable[i].handler = block + block_index[p];
+                       p = extable[i].handlerpc;
+                       extable[i].handler = block + block_index[p];
            }
        }
        
        if (useinlining) inlining_cleanup();
        useinlining = useinltmp;
 }
-#include "sets.c"
-#include "parseRT.h"
+
 
 /*
  * These are local overrides for various environment variables in Emacs.
diff --git a/src/vm/jit/parse.h b/src/vm/jit/parse.h
new file mode 100644 (file)
index 0000000..f6b8d8f
--- /dev/null
@@ -0,0 +1,84 @@
+/* jit/parse.h - parser header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Author: Christian Thalinger
+
+   $Id: parse.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _PARSE_H
+#define _PARSE_H
+
+#include "global.h"
+
+/* macros for byte code fetching ***********************************************
+
+       fetch a byte code of given size from position p in code array jcode
+
+*******************************************************************************/
+
+#define code_get_u1(p)  jcode[p]
+#define code_get_s1(p)  ((s1)jcode[p])
+#define code_get_u2(p)  ((((u2)jcode[p]) << 8) + jcode[p + 1])
+#define code_get_s2(p)  ((s2)((((u2)jcode[p]) << 8) + jcode[p + 1]))
+#define code_get_u4(p)  ((((u4)jcode[p]) << 24) + (((u4)jcode[p + 1]) << 16) \
+                        +(((u4)jcode[p + 2]) << 8) + jcode[p + 3])
+#define code_get_s4(p)  ((s4)((((u4)jcode[p]) << 24) + (((u4)jcode[p + 1]) << 16) \
+                             +(((u4)jcode[p + 2]) << 8) + jcode[p + 3]))
+
+
+extern classinfo  *rt_class;
+extern methodinfo *rt_method;
+extern utf *rt_descriptor;
+extern int rt_jcodelength;
+extern u1  *rt_jcode;
+
+
+/* function prototypes */
+void compiler_addinitclass(classinfo *c);
+classSetNode * descriptor2typesL(methodinfo *m);
+void descriptor2types(methodinfo *m);
+void parse();
+
+#endif /* _PARSE_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+
+
diff --git a/src/vm/jit/reg.h b/src/vm/jit/reg.h
new file mode 100644 (file)
index 0000000..bbd454f
--- /dev/null
@@ -0,0 +1,68 @@
+/* jit/reg.h - register allocator header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: reg.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _REG_H
+#define _REG_H
+
+/* global variables */
+extern varinfo5 *locals;
+extern varinfo5 *interfaces;
+extern int intreg_argnum;
+extern int arguments_num;
+
+
+/* function prototypes */
+void reg_init();
+void reg_close();
+void local_init();
+void regalloc();
+static void interface_regalloc();
+static void local_regalloc();
+static void allocate_scratch_registers();
+
+#endif /* _REG_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/vm/jit/reg.inc b/src/vm/jit/reg.inc
new file mode 100644 (file)
index 0000000..009bbfc
--- /dev/null
@@ -0,0 +1,1307 @@
+/* jit/reg.inc - register allocator
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+
+   Changes: Stefan Ring
+            Christian Thalinger
+
+   $Id: reg.inc 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#include "toolbox/memory.h"
+
+
+varinfo5 *locals;
+varinfo5 *interfaces;
+
+static int intregsnum;              /* absolute number of integer registers   */
+static int floatregsnum;            /* absolute number of float registers     */
+
+static int intreg_ret;              /* register to return integer values      */
+int intreg_argnum;                  /* number of integer argument registers   */
+
+static int floatreg_ret;            /* register for return float values       */
+static int fltreg_argnum;           /* number of float argument registers     */
+
+
+static int *argintregs;             /* scratch integer registers              */
+static int *tmpintregs;             /* scratch integer registers              */
+static int *savintregs;             /* saved integer registers                */
+static int *argfltregs;             /* scratch float registers                */
+static int *tmpfltregs;             /* scratch float registers                */
+static int *savfltregs;             /* saved float registers                  */
+static int *freeargintregs;         /* free argument integer registers        */
+static int *freetmpintregs;         /* free scratch integer registers         */
+static int *freesavintregs;         /* free saved integer registers           */
+static int *freeargfltregs;         /* free argument float registers          */
+static int *freetmpfltregs;         /* free scratch float registers           */
+static int *freesavfltregs;         /* free saved float registers             */
+
+#ifdef USETWOREGS
+static int *secondregs;             /* used for longs in 2 32 bit registers   */
+#endif
+
+static int *freemem;                /* free scratch memory                    */
+static int memuse;                  /* used memory count                      */
+static int ifmemuse;                /* interface used memory count            */
+static int maxmemuse;               /* maximal used memory count (spills)     */
+static int freememtop;              /* free memory count                      */
+
+static int tmpintregcnt;            /* scratch integer register count         */
+static int savintregcnt;            /* saved integer register count           */
+static int tmpfltregcnt;            /* scratch float register count           */
+static int savfltregcnt;            /* saved float register count             */
+
+static int iftmpintregcnt;          /* iface scratch integer register count   */
+static int ifsavintregcnt;          /* iface saved integer register count     */
+static int iftmpfltregcnt;          /* iface scratch float register count     */
+static int ifsavfltregcnt;          /* iface saved float register count       */
+
+static int argintreguse;            /* used argument integer register count   */
+static int tmpintreguse;            /* used scratch integer register count    */
+static int savintreguse;            /* used saved integer register count      */
+static int argfltreguse;            /* used argument float register count     */
+static int tmpfltreguse;            /* used scratch float register count      */
+static int savfltreguse;            /* used saved float register count        */
+
+static int maxargintreguse;         /* max used argument int register count   */
+static int maxtmpintreguse;         /* max used scratch int register count    */
+static int maxsavintreguse;         /* max used saved int register count      */
+static int maxargfltreguse;         /* max used argument float register count */
+static int maxtmpfltreguse;         /* max used scratch float register count  */
+static int maxsavfltreguse;         /* max used saved float register count    */
+
+static int freearginttop;           /* free argument integer register count   */
+static int freetmpinttop;           /* free scratch integer register count    */
+static int freesavinttop;           /* free saved integer register count      */
+static int freeargflttop;           /* free argument float register count     */
+static int freetmpflttop;           /* free scratch float register count      */
+static int freesavflttop;           /* free saved float register count        */
+
+static int savedregs_num;              /* total number of registers to be saved      */
+int arguments_num;              /* size of parameter field in the stackframe  */
+
+
+
+/* function reg_init ***********************************************************
+
+       initialises the register-allocator
+       
+*******************************************************************************/
+
+void reg_init()
+{
+       int n;
+       int i;
+       varinfo5 *v;
+       
+       if (!tmpintregs) {
+               if (TYPE_INT != 0 || TYPE_ADR != 4) 
+                       panic ("JAVA-Basictypes have been changed");
+
+               intreg_argnum = 0;
+               tmpintregcnt = 0;
+               savintregcnt = 0;
+
+               for (intregsnum = 0; nregdescint[intregsnum] != REG_END; intregsnum++) {
+                       switch (nregdescint[intregsnum]) {
+                       case REG_SAV: savintregcnt++;
+                               break;
+                       case REG_TMP: tmpintregcnt++;
+                               break;
+                       case REG_ARG: intreg_argnum++;
+                       }
+               }
+
+               argintregs = MNEW(int, intreg_argnum);
+               tmpintregs = MNEW(int, tmpintregcnt);
+               savintregs = MNEW(int, savintregcnt);
+               freeargintregs = MNEW(int, intreg_argnum);
+               freetmpintregs = MNEW(int, tmpintregcnt);
+               freesavintregs = MNEW(int, savintregcnt);
+#ifdef USETWOREGS
+               secondregs = MNEW(int, intregsnum);
+#endif
+
+               intreg_argnum = 0;
+               argintreguse = 0;
+               tmpintreguse = 0;
+               savintreguse = 0;
+
+               for (n = 0; n < intregsnum; n++) {
+                       switch (nregdescint[n]) {
+                       case REG_RET: intreg_ret = n; 
+                               break;
+                       case REG_SAV: savintregs[savintreguse++] = n;
+                               break;
+                       case REG_TMP: tmpintregs[tmpintreguse++] = n;
+                               break;
+                       case REG_ARG: argintregs[intreg_argnum++] = n;
+                               argintreguse++;
+                               break;
+                       }
+               }
+
+#if defined(__X86_64__)
+               /* 
+                * on x86_64 the argument registers are not in ascending order 
+                * a00 (%rdi) <-> a03 (%rcx) and a01 (%rsi) <-> a02 (%rdx)
+                */
+
+               n = argintregs[3];
+               argintregs[3] = argintregs[0];
+               argintregs[0] = n;
+
+               n = argintregs[2];
+               argintregs[2] = argintregs[1];
+               argintregs[1] = n;
+#endif
+               
+#ifdef USETWOREGS
+               for (n = 1; n < intreg_argnum; n++)
+                       secondregs[argintregs[n - 1]] = argintregs[n];
+               for (n = 1; n < tmpintregcnt; n++)
+                       secondregs[tmpintregs[n - 1]] = tmpintregs[n];
+               for (n = 1; n < savintregcnt; n++)
+                       secondregs[savintregs[n - 1]] = savintregs[n];
+
+               secondregs[REG_ITMP1] = REG_ITMP2;
+               secondregs[REG_ITMP3] = REG_ITMP2;
+               secondregs[REG_RESULT] = REG_RESULT + 1;
+               secondregs[argintregs[intreg_argnum - 1]] = REG_ITMP3;
+#endif
+
+               fltreg_argnum = 0;
+               tmpfltregcnt = 0;
+               savfltregcnt = 0;
+
+               for (floatregsnum = 0; nregdescfloat[floatregsnum] != REG_END; floatregsnum++) {
+                       switch (nregdescfloat[floatregsnum]) {
+                       case REG_SAV: savfltregcnt++;
+                               break;
+                       case REG_TMP: tmpfltregcnt++;
+                               break;
+                       case REG_ARG: fltreg_argnum++;
+                               break;
+                       }
+               }
+
+               argfltregs = MNEW(int, fltreg_argnum);
+               tmpfltregs = MNEW(int, tmpfltregcnt);
+               savfltregs = MNEW(int, savfltregcnt);
+               freeargfltregs = MNEW(int, fltreg_argnum);
+               freetmpfltregs = MNEW(int, tmpfltregcnt);
+               freesavfltregs = MNEW(int, savfltregcnt);
+
+               fltreg_argnum = 0;
+               argfltreguse = 0;
+               tmpfltreguse = 0;
+               savfltreguse = 0;
+
+               for (n = 0; n < floatregsnum; n++) {
+                       switch (nregdescfloat[n]) {
+                       case REG_RET:
+                               floatreg_ret = n; 
+                               break;
+                       case REG_SAV: savfltregs[savfltreguse++] = n;
+                               break;
+                       case REG_TMP: tmpfltregs[tmpfltreguse++] = n;
+                               break;
+                       case REG_ARG: argfltregs[fltreg_argnum++] = n;
+                               argfltreguse++;
+                               break;
+                       }
+               }
+                                       
+       }
+
+
+       freemem    = DMNEW(int, maxstack);
+       locals     = DMNEW(varinfo5, maxlocals);
+       interfaces = DMNEW(varinfo5, maxstack);
+
+       for (v = locals, i = maxlocals; i > 0; v++, i--) {
+               v[0][TYPE_INT].type = -1;
+               v[0][TYPE_LNG].type = -1;
+               v[0][TYPE_FLT].type = -1;
+               v[0][TYPE_DBL].type = -1;
+               v[0][TYPE_ADR].type = -1;
+       }
+
+       for (v = interfaces, i = maxstack; i > 0; v++, i--) {
+               v[0][TYPE_INT].type = -1;
+               v[0][TYPE_INT].flags = 0;
+               v[0][TYPE_LNG].type = -1;
+               v[0][TYPE_LNG].flags = 0;
+               v[0][TYPE_FLT].type = -1;
+               v[0][TYPE_FLT].flags = 0;
+               v[0][TYPE_DBL].type = -1;
+               v[0][TYPE_DBL].flags = 0;
+               v[0][TYPE_ADR].type = -1;
+               v[0][TYPE_ADR].flags = 0;
+       }
+}
+
+
+
+/* function reg_close **********************************************************
+
+       releases all allocated space for registers
+
+*******************************************************************************/
+
+void reg_close()
+{
+       if (argintregs) MFREE(argintregs, int, intreg_argnum);
+       if (argfltregs) MFREE(argfltregs, int, fltreg_argnum);
+       if (tmpintregs) MFREE(tmpintregs, int, tmpintregcnt);
+       if (savintregs) MFREE(savintregs, int, savintregcnt);
+       if (tmpfltregs) MFREE(tmpfltregs, int, tmpfltregcnt);
+       if (savfltregs) MFREE(savfltregs, int, savfltregcnt);
+
+       if (freeargintregs) MFREE(freeargintregs, int, intreg_argnum);
+       if (freeargfltregs) MFREE(freeargfltregs, int, fltreg_argnum);
+       if (freetmpintregs) MFREE(freetmpintregs, int, tmpintregcnt);
+       if (freesavintregs) MFREE(freesavintregs, int, savintregcnt);
+       if (freetmpfltregs) MFREE(freetmpfltregs, int, tmpfltregcnt);
+       if (freesavfltregs) MFREE(freesavfltregs, int, savfltregcnt);
+
+#ifdef USETWOREGS
+       if (secondregs) MFREE(secondregs, int, intregsnum);
+#endif
+}
+
+
+/* function interface_regalloc *************************************************
+
+       allocates registers for all interface variables
+       
+*******************************************************************************/
+       
+void regalloc()
+{
+       interface_regalloc();
+       allocate_scratch_registers();
+       local_regalloc();
+}
+
+
+/* function interface_regalloc *************************************************
+
+       allocates registers for all interface variables
+       
+*******************************************************************************/
+       
+static void interface_regalloc ()
+{
+       int     s, t, saved;
+       int     intalloc, fltalloc;
+       varinfo *v;
+       int             regsneeded = 0;
+       
+       /* allocate stack space for passing arguments to called methods */
+
+#ifndef SPECIALMEMUSE
+#if defined(__X86_64__)
+       /*
+        * XXX: we have a problem here, but allocating a little more stack space
+        *      is better than having a bug
+        */
+       /*      if (arguments_num > (intreg_argnum + fltreg_argnum)) */
+       /*              ifmemuse = arguments_num - (intreg_argnum + fltreg_argnum); */
+       if (arguments_num > fltreg_argnum)
+               ifmemuse = arguments_num - fltreg_argnum;
+#else
+       if (arguments_num > intreg_argnum)
+               ifmemuse = arguments_num - intreg_argnum;
+#endif
+       else
+               ifmemuse = 0;
+#endif
+
+       iftmpintregcnt = tmpintregcnt;
+       ifsavintregcnt = savintregcnt;
+       iftmpfltregcnt = tmpfltregcnt;
+       ifsavfltregcnt = savfltregcnt;
+
+       for (s = 0; s < maxstack; s++) {
+               intalloc = -1; fltalloc = -1;
+               saved = (interfaces[s][TYPE_INT].flags | interfaces[s][TYPE_LNG].flags |
+                        interfaces[s][TYPE_FLT].flags | interfaces[s][TYPE_DBL].flags |
+                        interfaces[s][TYPE_ADR].flags) & SAVEDVAR;
+               for (t = TYPE_INT; t <= TYPE_ADR; t++) {
+                       v = &interfaces[s][t];
+                       if (v->type >= 0) {
+#ifdef USETWOREGS
+                               regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
+#endif
+                               if (!saved) {
+                                       if (IS_FLT_DBL_TYPE(t)) {
+                                               if (fltalloc >= 0) {
+                                                       v->flags |= interfaces[s][fltalloc].flags & INMEMORY;
+                                                       v->regoff = interfaces[s][fltalloc].regoff;
+                                               }
+                                               else if (iftmpfltregcnt > 0) {
+                                                       iftmpfltregcnt--;
+                                                       v->regoff = tmpfltregs[iftmpfltregcnt];
+                                               }
+                                               else if (ifsavfltregcnt > 0) {
+                                                       ifsavfltregcnt--;
+                                                       v->regoff = savfltregs[ifsavfltregcnt];
+                                               }
+                                               else {
+                                                       v->flags |= INMEMORY;
+                                                       v->regoff = ifmemuse;
+                                                       ifmemuse += regsneeded+1;
+                                               }
+                                               fltalloc = t;
+                                       }
+                                       else {
+#if defined(__I386__)
+                                               /*
+                                                * for i386 put all longs in memory
+                                                */
+                                               if (IS_2_WORD_TYPE(t)) {
+                                                       v->flags |= INMEMORY;
+                                                       v->regoff = ifmemuse++;
+                                               } else {
+#endif
+                                                       if (intalloc >= 0) {
+                                                               v->flags |= interfaces[s][intalloc].flags & INMEMORY;
+                                                               v->regoff = interfaces[s][intalloc].regoff;
+                                                       }
+                                                       else if (iftmpintregcnt > regsneeded) {
+                                                               iftmpintregcnt -= regsneeded+1;
+                                                               v->regoff = tmpintregs[iftmpintregcnt];
+                                                       }
+                                                       else if (ifsavintregcnt > regsneeded) {
+                                                               ifsavintregcnt -= regsneeded+1;
+                                                               v->regoff = savintregs[ifsavintregcnt];
+                                                       }
+                                                       else {
+                                                               v->flags |= INMEMORY;
+                                                               v->regoff = ifmemuse;
+                                                               ifmemuse += regsneeded+1;
+                                                       }
+#if defined(__I386__)
+                                               }
+#endif
+                                               intalloc = t;
+                                       }
+                               }
+                               else {
+                                       if (IS_FLT_DBL_TYPE(t)) {
+                                               if (fltalloc >= 0) {
+                                                       v->flags |= interfaces[s][fltalloc].flags & INMEMORY;
+                                                       v->regoff = interfaces[s][fltalloc].regoff;
+                                               }
+                                               else if (ifsavfltregcnt > 0) {
+                                                       ifsavfltregcnt--;
+                                                       v->regoff = savfltregs[ifsavfltregcnt];
+                                               }
+                                               else {
+                                                       v->flags |= INMEMORY;
+                                                       v->regoff = ifmemuse;
+                                                       ifmemuse += regsneeded+1;
+                                               }
+                                               fltalloc = t;
+                                       }
+                                       else {
+#if defined(__I386__)
+                                               /*
+                                                * for i386 put all longs in memory
+                                                */
+                                               if (IS_2_WORD_TYPE(t)) {
+                                                       v->flags |= INMEMORY;
+                                                       v->regoff = ifmemuse++;
+                                               } else {
+#endif
+                                                       if (intalloc >= 0) {
+                                                               v->flags |= interfaces[s][intalloc].flags & INMEMORY;
+                                                               v->regoff = interfaces[s][intalloc].regoff;
+                                                       }
+                                                       else if (ifsavintregcnt > regsneeded) {
+                                                               ifsavintregcnt -= regsneeded+1;
+                                                               v->regoff = savintregs[ifsavintregcnt];
+                                                       }
+                                                       else {
+                                                               v->flags |= INMEMORY;
+                                                               v->regoff = ifmemuse;
+                                                               ifmemuse += regsneeded+1;
+                                                       }
+#if defined(__I386__)
+                                               }
+#endif
+                                               intalloc = t;
+                                       }
+                               }
+                       } /* if (type >= 0) */
+               } /* for t */
+       } /* for s */
+
+       maxmemuse = ifmemuse;
+       maxtmpintreguse = iftmpintregcnt;
+       maxsavintreguse = ifsavintregcnt;
+       maxtmpfltreguse = iftmpfltregcnt;
+       maxsavfltreguse = ifsavfltregcnt;
+}
+
+
+
+/* function local_regalloc *****************************************************
+
+       allocates registers for all local variables
+       
+*******************************************************************************/
+       
+static void local_regalloc()
+{
+       int      s, t, tt;
+       int      intalloc, fltalloc;
+       varinfo *v;
+       int      regsneeded = 0;
+       int typeloop[] = { TYPE_LNG, TYPE_DBL, TYPE_INT, TYPE_FLT, TYPE_ADR };
+       
+       if (isleafmethod) {
+               int arg, doublewordarg, iargcnt, fargcnt;
+
+               arg = 0, iargcnt = 0, fargcnt = 0;
+               doublewordarg = 0;
+               for (s = 0; s < maxlocals; s++) {
+                       intalloc = -1; fltalloc = -1;
+                       for (tt = 0; tt <= 4; tt++) {
+                               t = typeloop[tt];
+                               v = &locals[s][t];
+
+                               if (v->type >= 0) {
+#ifdef USETWOREGS
+                                       regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
+#endif
+                                       if (IS_FLT_DBL_TYPE(t)) {
+#if !defined(CONSECUTIVE_FLOATARGS)
+                                               fargcnt = arg;
+#endif
+                                               if (fltalloc >= 0) {
+                                                       v->flags = locals[s][fltalloc].flags;
+                                                       v->regoff = locals[s][fltalloc].regoff;
+                                               }
+                                               else if (!doublewordarg && (arg < mparamcount)
+                                                                && (fargcnt < fltreg_argnum)) {
+                                                       v->flags = 0;
+                                                       v->regoff = argfltregs[fargcnt];
+                                               }
+                                               else if (maxtmpfltreguse > 0) {
+                                                       maxtmpfltreguse--;
+                                                       v->flags = 0;
+                                                       v->regoff = tmpfltregs[maxtmpfltreguse];
+                                               }
+                                               else if (maxsavfltreguse > 0) {
+                                                       maxsavfltreguse--;
+                                                       v->flags = 0;
+                                                       v->regoff = savfltregs[maxsavfltreguse];
+                                               }
+                                               else {
+                                                       v->flags = INMEMORY;
+                                                       v->regoff = maxmemuse;
+                                                       maxmemuse += regsneeded+1;
+                                               }
+                                               fltalloc = t;
+
+                                       } else {
+                                               int regtouse;
+#if defined(__I386__)
+                                               /*
+                                                * for i386 put all longs in memory
+                                                */
+                                               if (IS_2_WORD_TYPE(t)) {
+                                                       v->flags = INMEMORY;
+                                                       v->regoff = maxmemuse++;
+                                               } else {
+#endif
+#if !defined(CONSECUTIVE_INTARGS)
+                                                       iargcnt = arg;
+#endif
+                                                       if (intalloc >= 0) {
+                                                               v->flags = locals[s][intalloc].flags;
+                                                               v->regoff = locals[s][intalloc].regoff;
+                                                       }
+                                                       else if (!doublewordarg && (arg < mparamcount)
+#ifndef USETWOREGS
+                                                                        && ((regtouse = iargcnt) < intreg_argnum)
+#else
+                                                                        && ((regtouse = s) < intreg_argnum - regsneeded)
+#endif
+                                                                        ) {
+                                                               v->flags = 0;
+                                                               v->regoff = argintregs[regtouse];
+                                                       }
+                                                       else if (maxtmpintreguse > regsneeded) {
+                                                               maxtmpintreguse -= regsneeded + 1;
+                                                               v->flags = 0;
+                                                               v->regoff = tmpintregs[maxtmpintreguse];
+                                                       }
+                                                       else if (maxsavintreguse > regsneeded) {
+                                                               maxsavintreguse -= regsneeded + 1;
+                                                               v->flags = 0;
+                                                               v->regoff = savintregs[maxsavintreguse];
+                                                       }
+                                                       /*
+                                                        * use unused argument registers as local registers
+                                                        */
+                                                       else if (!doublewordarg && (arg >= mparamcount)
+                                                                        && (iargcnt < intreg_argnum)) {
+                                                               v->flags = 0;
+                                                               v->regoff = argintregs[iargcnt];
+                                                               iargcnt++;
+                                                               arg++;
+                                                       }
+                                                       else {
+                                                               v->flags = INMEMORY;
+                                                               v->regoff = maxmemuse;
+                                                               maxmemuse += regsneeded+1;
+                                                       }
+#if defined(__I386__)
+                                               }
+#endif
+                                               intalloc = t;
+                                       }
+                               }
+                       }
+                       if (arg < mparamcount) {
+                               if (doublewordarg) {
+                                       doublewordarg = 0;
+                                       /* what type was the double arg? */
+                                       if (IS_FLT_DBL_TYPE(mparamtypes[arg])) {
+                                               fargcnt++;
+
+                                       } else {
+                                               iargcnt++;
+                                       }
+                                       arg++;
+
+                               } else if (IS_2_WORD_TYPE(mparamtypes[arg])) {
+                                       doublewordarg = 1;
+
+                               } else {
+                                       if (IS_FLT_DBL_TYPE(mparamtypes[arg])) {
+                                               fargcnt++;
+
+                                       } else {
+                                               iargcnt++;
+                                       }
+                                       arg++;
+                               }
+                       }
+               }
+               return;
+       }
+
+       for (s = 0; s < maxlocals; s++) {
+               intalloc = -1; fltalloc = -1;
+               for (tt=0; tt<=4; tt++) {
+                       t = typeloop[tt];
+                       v = &locals[s][t];
+                       if (v->type >= 0) {
+#ifdef USETWOREGS
+                               regsneeded = (IS_2_WORD_TYPE(t)) ? 1 : 0;
+#endif
+                               if (IS_FLT_DBL_TYPE(t)) {
+                                       if (fltalloc >= 0) {
+                                               v->flags = locals[s][fltalloc].flags;
+                                               v->regoff = locals[s][fltalloc].regoff;
+                                       }
+                                       else if (maxsavfltreguse > 0) {
+                                               maxsavfltreguse--;
+                                               v->flags = 0;
+                                               v->regoff = savfltregs[maxsavfltreguse];
+                                       }
+                                       else {
+                                               v->flags = INMEMORY;
+                                               v->regoff = maxmemuse;
+                                               maxmemuse += regsneeded+1;
+                                       }
+                                       fltalloc = t;
+                               }
+                               else {
+#if defined(__I386__)
+                                       /*
+                                        * for i386 put all longs in memory
+                                        */
+                                       if (IS_2_WORD_TYPE(t)) {
+                                               v->flags = INMEMORY;
+                                               v->regoff = maxmemuse++;
+                                       } else {
+#endif
+                                               if (intalloc >= 0) {
+                                                       v->flags = locals[s][intalloc].flags;
+                                                       v->regoff = locals[s][intalloc].regoff;
+                                               }
+                                               else if (maxsavintreguse > regsneeded) {
+                                                       maxsavintreguse -= regsneeded+1;
+                                                       v->flags = 0;
+                                                       v->regoff = savintregs[maxsavintreguse];
+                                               }
+                                               else {
+                                                       v->flags = INMEMORY;
+                                                       v->regoff = maxmemuse;
+                                                       maxmemuse += regsneeded+1;
+                                               }
+#if defined(__I386__)
+                                       }
+#endif
+                                       intalloc = t;
+                               }
+                       }
+               }
+       }
+}
+
+
+
+static void reg_init_temp()
+{
+       freememtop = 0;
+       memuse = ifmemuse;
+
+       freearginttop = 0;
+       freetmpinttop = 0;
+       freesavinttop = 0;
+       freeargflttop = 0;
+       freetmpflttop = 0;
+       freesavflttop = 0;
+
+       tmpintreguse = iftmpintregcnt;
+       savintreguse = ifsavintregcnt;
+       tmpfltreguse = iftmpfltregcnt;
+       savfltreguse = ifsavfltregcnt;
+
+       /*
+        * all argument registers are available
+        */
+       argintreguse = intreg_argnum;
+       argfltreguse = fltreg_argnum;
+}
+
+
+
+#define reg_new_temp(s) if (s->varkind == TEMPVAR) reg_new_temp_func(s)
+
+static void reg_new_temp_func(stackptr s)
+{
+       int regsneeded = 0;
+
+       /* Try to allocate a saved register if there is no temporary one available.   */
+       /* This is what happens during the second run.                                */
+       int tryagain = (s->flags & SAVEDVAR) ? 1 : 2;
+
+#ifdef USETWOREGS
+       regsneeded = (IS_2_WORD_TYPE(s->type)) ? 1 : 0;
+#endif
+
+       for(; tryagain; --tryagain) {
+               if (tryagain == 1) {
+                       if (!(s->flags & SAVEDVAR))
+                               s->flags |= SAVEDTMP;
+                       if (IS_FLT_DBL_TYPE(s->type)) {
+                               if (freesavflttop > 0) {
+                                       freesavflttop--;
+                                       s->regoff = freesavfltregs[freesavflttop];
+                                       return;
+                               }
+                               else if (savfltreguse > 0) {
+                                       savfltreguse--;
+                                       if (savfltreguse < maxsavfltreguse)
+                                               maxsavfltreguse = savfltreguse;
+                                       s->regoff = savfltregs[savfltreguse];
+                                       return;
+                               }
+                       }
+                       else {
+#if defined(__I386__)
+                               /*
+                                * for i386 put all longs in memory
+                                */
+                               if (!IS_2_WORD_TYPE(s->type)) {
+#endif
+                                       if (freesavinttop > regsneeded) {
+                                               freesavinttop -= regsneeded + 1;
+                                               s->regoff = freesavintregs[freesavinttop];
+                                               return;
+                                       }
+                                       else if (savintreguse > regsneeded) {
+                                               savintreguse -= regsneeded + 1;
+                                               if (savintreguse < maxsavintreguse)
+                                                       maxsavintreguse = savintreguse;
+                                               s->regoff = savintregs[savintreguse];
+                                               return;
+                                       }
+#if defined(__I386__)
+                               }
+#endif
+                       }
+               }
+               else {
+                       if (IS_FLT_DBL_TYPE(s->type)) {
+                               if (freetmpflttop > 0) {
+                                       freetmpflttop--;
+                                       s->regoff = freetmpfltregs[freetmpflttop];
+                                       return;
+                               }
+                               else if (tmpfltreguse > 0) {
+                                       tmpfltreguse--;
+                                       if (tmpfltreguse < maxtmpfltreguse)
+                                               maxtmpfltreguse = tmpfltreguse;
+                                       s->regoff = tmpfltregs[tmpfltreguse];
+                                       return;
+                               }
+                       }
+                       else {
+#if defined(__I386__)
+                               /*
+                                * for i386 put all longs in memory
+                                */
+                               if (!IS_2_WORD_TYPE(s->type)) {
+#endif
+                                       if (freetmpinttop > regsneeded) {
+                                               freetmpinttop -= regsneeded + 1;
+                                               s->regoff = freetmpintregs[freetmpinttop];
+                                               return;
+                                       }
+                                       else if (tmpintreguse > regsneeded) {
+                                               tmpintreguse -= regsneeded + 1;
+                                               if (tmpintreguse < maxtmpintreguse)
+                                                       maxtmpintreguse = tmpintreguse;
+                                               s->regoff = tmpintregs[tmpintreguse];
+                                               return;
+                                       }
+#if defined(__I386__)
+                               }
+#endif
+                       }
+               }
+       }
+
+       if (freememtop > regsneeded) {
+               freememtop -= regsneeded+1;
+               s->regoff = freemem[freememtop];
+       }
+       else {
+               s->regoff = memuse;
+               memuse += regsneeded+1;
+               if (memuse > maxmemuse)
+                       maxmemuse = memuse;
+       }
+       s->flags |= INMEMORY;
+}
+
+
+
+#define reg_free_temp(s) if (s->varkind == TEMPVAR) reg_free_temp_func(s)
+
+static void reg_free_temp_func(stackptr s)
+{
+       int regsneeded = 0;
+
+#ifdef USETWOREGS
+       regsneeded = (IS_2_WORD_TYPE(s->type)) ? 1 : 0;
+#endif
+
+       if (s->flags & INMEMORY) {
+               freemem[freememtop] = s->regoff;
+               if (regsneeded)
+                       freemem[freememtop + 1] = s->regoff + 1;
+               freememtop += regsneeded + 1;
+       }
+       else if (IS_FLT_DBL_TYPE(s->type)) {
+               if (s->flags & (SAVEDVAR | SAVEDTMP)) {
+                       s->flags &= ~SAVEDTMP;
+                       freesavfltregs[freesavflttop++] = s->regoff;
+               } else
+                       freetmpfltregs[freetmpflttop++] = s->regoff;
+       }
+       else {
+               if (s->flags & (SAVEDVAR | SAVEDTMP)) {
+                       s->flags &= ~SAVEDTMP;
+                       freesavintregs[freesavinttop] = s->regoff;
+#ifdef USETWOREGS
+                       if (regsneeded)
+                               freesavintregs[freesavinttop + 1] = secondregs[s->regoff];
+#endif
+                       freesavinttop += regsneeded + 1;
+               } else {
+                       freetmpintregs[freetmpinttop] = s->regoff;
+#ifdef USETWOREGS
+                       if (regsneeded)
+                               freetmpintregs[freetmpinttop + 1] = secondregs[s->regoff];
+#endif
+                       freetmpinttop += regsneeded + 1;
+               }
+       }
+}
+
+
+
+static void allocate_scratch_registers()
+{
+       int opcode;
+       int i;
+       int len;
+       stackptr    src;
+       stackptr    dst;
+       instruction *iptr;
+       basicblock  *bptr;
+
+       /* b_count = block_count; */
+
+       bptr = block;
+       while (bptr != NULL) {
+
+               if (bptr->flags >= BBREACHED) {
+                       dst = bptr->instack;
+                       reg_init_temp();
+                       iptr = bptr->iinstr;
+                       len = bptr->icount;
+  
+                       while (--len >= 0)  {
+                               src = dst;
+                               dst = iptr->dst;
+                               opcode = iptr->opc;
+
+                               switch (opcode) {
+
+                                       /* pop 0 push 0 */
+
+                               case ICMD_NOP:
+                               case ICMD_ELSE_ICONST:
+                               case ICMD_CHECKASIZE:
+                               case ICMD_IINC:
+                               case ICMD_JSR:
+                               case ICMD_RET:
+                               case ICMD_RETURN:
+                               case ICMD_GOTO:
+                                       break;
+
+                                       /* pop 0 push 1 const */
+                                       
+                               case ICMD_ICONST:
+                               case ICMD_LCONST:
+                               case ICMD_FCONST:
+                               case ICMD_DCONST:
+                               case ICMD_ACONST:
+
+                                       /* pop 0 push 1 load */
+                                       
+                               case ICMD_ILOAD:
+                               case ICMD_LLOAD:
+                               case ICMD_FLOAD:
+                               case ICMD_DLOAD:
+                               case ICMD_ALOAD:
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 2 push 1 */
+
+                               case ICMD_IALOAD:
+                               case ICMD_LALOAD:
+                               case ICMD_FALOAD:
+                               case ICMD_DALOAD:
+                               case ICMD_AALOAD:
+
+                               case ICMD_BALOAD:
+                               case ICMD_CALOAD:
+                               case ICMD_SALOAD:
+
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 3 push 0 */
+
+                               case ICMD_IASTORE:
+                               case ICMD_LASTORE:
+                               case ICMD_FASTORE:
+                               case ICMD_DASTORE:
+                               case ICMD_AASTORE:
+
+                               case ICMD_BASTORE:
+                               case ICMD_CASTORE:
+                               case ICMD_SASTORE:
+
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_free_temp(src->prev->prev);
+                                       break;
+
+                                       /* pop 1 push 0 store */
+
+                               case ICMD_ISTORE:
+                               case ICMD_LSTORE:
+                               case ICMD_FSTORE:
+                               case ICMD_DSTORE:
+                               case ICMD_ASTORE:
+
+                                       /* pop 1 push 0 */
+
+                               case ICMD_POP:
+
+                               case ICMD_IRETURN:
+                               case ICMD_LRETURN:
+                               case ICMD_FRETURN:
+                               case ICMD_DRETURN:
+                               case ICMD_ARETURN:
+
+                               case ICMD_ATHROW:
+
+                               case ICMD_PUTSTATIC:
+
+                                       /* pop 1 push 0 branch */
+
+                               case ICMD_IFNULL:
+                               case ICMD_IFNONNULL:
+
+                               case ICMD_IFEQ:
+                               case ICMD_IFNE:
+                               case ICMD_IFLT:
+                               case ICMD_IFGE:
+                               case ICMD_IFGT:
+                               case ICMD_IFLE:
+
+                               case ICMD_IF_LEQ:
+                               case ICMD_IF_LNE:
+                               case ICMD_IF_LLT:
+                               case ICMD_IF_LGE:
+                               case ICMD_IF_LGT:
+                               case ICMD_IF_LLE:
+
+                                       /* pop 1 push 0 table branch */
+
+                               case ICMD_TABLESWITCH:
+                               case ICMD_LOOKUPSWITCH:
+
+                               case ICMD_NULLCHECKPOP:
+                               case ICMD_MONITORENTER:
+                               case ICMD_MONITOREXIT:
+                                       reg_free_temp(src);
+                                       break;
+
+                                       /* pop 2 push 0 branch */
+
+                               case ICMD_IF_ICMPEQ:
+                               case ICMD_IF_ICMPNE:
+                               case ICMD_IF_ICMPLT:
+                               case ICMD_IF_ICMPGE:
+                               case ICMD_IF_ICMPGT:
+                               case ICMD_IF_ICMPLE:
+
+                               case ICMD_IF_LCMPEQ:
+                               case ICMD_IF_LCMPNE:
+                               case ICMD_IF_LCMPLT:
+                               case ICMD_IF_LCMPGE:
+                               case ICMD_IF_LCMPGT:
+                               case ICMD_IF_LCMPLE:
+
+                               case ICMD_IF_ACMPEQ:
+                               case ICMD_IF_ACMPNE:
+
+                                       /* pop 2 push 0 */
+
+                               case ICMD_POP2:
+
+                               case ICMD_PUTFIELD:
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       break;
+
+                                       /* pop 0 push 1 dup */
+                                       
+                               case ICMD_DUP:
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 0 push 2 dup */
+                                       
+                               case ICMD_DUP2:
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 2 push 3 dup */
+                                       
+                               case ICMD_DUP_X1:
+                                       reg_new_temp(dst->prev->prev);
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       break;
+
+                                       /* pop 3 push 4 dup */
+                                       
+                               case ICMD_DUP_X2:
+                                       reg_new_temp(dst->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev);
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_free_temp(src->prev->prev);
+                                       break;
+
+                                       /* pop 3 push 5 dup */
+                                       
+                               case ICMD_DUP2_X1:
+                                       reg_new_temp(dst->prev->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev);
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_free_temp(src->prev->prev);
+                                       break;
+
+                                       /* pop 4 push 6 dup */
+                                       
+                               case ICMD_DUP2_X2:
+                                       reg_new_temp(dst->prev->prev->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev->prev);
+                                       reg_new_temp(dst->prev->prev);
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_free_temp(src->prev->prev);
+                                       reg_free_temp(src->prev->prev->prev);
+                                       break;
+
+                                       /* pop 2 push 2 swap */
+                                       
+                               case ICMD_SWAP:
+                                       reg_new_temp(dst->prev);
+                                       reg_new_temp(dst);
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       break;
+
+                                       /* pop 2 push 1 */
+                                       
+                               case ICMD_IADD:
+                               case ICMD_ISUB:
+                               case ICMD_IMUL:
+                               case ICMD_IDIV:
+                               case ICMD_IREM:
+
+                               case ICMD_ISHL:
+                               case ICMD_ISHR:
+                               case ICMD_IUSHR:
+                               case ICMD_IAND:
+                               case ICMD_IOR:
+                               case ICMD_IXOR:
+
+                               case ICMD_LADD:
+                               case ICMD_LSUB:
+                               case ICMD_LMUL:
+                               case ICMD_LDIV:
+                               case ICMD_LREM:
+
+                               case ICMD_LOR:
+                               case ICMD_LAND:
+                               case ICMD_LXOR:
+
+                               case ICMD_LSHL:
+                               case ICMD_LSHR:
+                               case ICMD_LUSHR:
+
+                               case ICMD_FADD:
+                               case ICMD_FSUB:
+                               case ICMD_FMUL:
+                               case ICMD_FDIV:
+                               case ICMD_FREM:
+
+                               case ICMD_DADD:
+                               case ICMD_DSUB:
+                               case ICMD_DMUL:
+                               case ICMD_DDIV:
+                               case ICMD_DREM:
+
+                               case ICMD_LCMP:
+                               case ICMD_FCMPL:
+                               case ICMD_FCMPG:
+                               case ICMD_DCMPL:
+                               case ICMD_DCMPG:
+                                       reg_free_temp(src);
+                                       reg_free_temp(src->prev);
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 1 push 1 */
+                                       
+                               case ICMD_IADDCONST:
+                               case ICMD_ISUBCONST:
+                               case ICMD_IMULCONST:
+                               case ICMD_IDIVPOW2:
+                               case ICMD_IREMPOW2:
+                               case ICMD_IREM0X10001:
+                               case ICMD_IANDCONST:
+                               case ICMD_IORCONST:
+                               case ICMD_IXORCONST:
+                               case ICMD_ISHLCONST:
+                               case ICMD_ISHRCONST:
+                               case ICMD_IUSHRCONST:
+
+                               case ICMD_LADDCONST:
+                               case ICMD_LSUBCONST:
+                               case ICMD_LMULCONST:
+                               case ICMD_LDIVPOW2:
+                               case ICMD_LREMPOW2:
+                               case ICMD_LREM0X10001:
+                               case ICMD_LANDCONST:
+                               case ICMD_LORCONST:
+                               case ICMD_LXORCONST:
+                               case ICMD_LSHLCONST:
+                               case ICMD_LSHRCONST:
+                               case ICMD_LUSHRCONST:
+
+                               case ICMD_IFEQ_ICONST:
+                               case ICMD_IFNE_ICONST:
+                               case ICMD_IFLT_ICONST:
+                               case ICMD_IFGE_ICONST:
+                               case ICMD_IFGT_ICONST:
+                               case ICMD_IFLE_ICONST:
+
+                               case ICMD_INEG:
+                               case ICMD_INT2BYTE:
+                               case ICMD_INT2CHAR:
+                               case ICMD_INT2SHORT:
+                               case ICMD_LNEG:
+                               case ICMD_FNEG:
+                               case ICMD_DNEG:
+
+                               case ICMD_I2L:
+                               case ICMD_I2F:
+                               case ICMD_I2D:
+                               case ICMD_L2I:
+                               case ICMD_L2F:
+                               case ICMD_L2D:
+                               case ICMD_F2I:
+                               case ICMD_F2L:
+                               case ICMD_F2D:
+                               case ICMD_D2I:
+                               case ICMD_D2L:
+                               case ICMD_D2F:
+
+                               case ICMD_CHECKCAST:
+
+                               case ICMD_ARRAYLENGTH:
+                               case ICMD_INSTANCEOF:
+
+                               case ICMD_NEWARRAY:
+                               case ICMD_ANEWARRAY:
+
+                               case ICMD_GETFIELD:
+                                       reg_free_temp(src);
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop 0 push 1 */
+                                       
+                               case ICMD_GETSTATIC:
+
+                               case ICMD_NEW:
+
+                                       reg_new_temp(dst);
+                                       break;
+
+                                       /* pop many push any */
+                                       
+                               case ICMD_INVOKEVIRTUAL:
+                               case ICMD_INVOKESPECIAL:
+                               case ICMD_INVOKESTATIC:
+                               case ICMD_INVOKEINTERFACE:
+                                       {
+                                               i = iptr->op1;
+                                               while (--i >= 0) {
+                                                       reg_free_temp(src);
+                                                       src = src->prev;
+                                               }
+                                               if (((methodinfo*)iptr->val.a)->returntype != TYPE_VOID)
+                                                       reg_new_temp(dst);
+                                               break;
+                                       }
+
+                               case ICMD_BUILTIN3:
+                                       reg_free_temp(src);
+                                       src = src->prev;
+                               case ICMD_BUILTIN2:
+                                       reg_free_temp(src);
+                                       src = src->prev;
+                               case ICMD_BUILTIN1:
+                                       reg_free_temp(src);
+                                       src = src->prev;
+                                       if (iptr->op1 != TYPE_VOID)
+                                               reg_new_temp(dst);
+                                       break;
+
+                               case ICMD_MULTIANEWARRAY:
+                                       i = iptr->op1;
+                                       while (--i >= 0) {
+                                               reg_free_temp(src);
+                                               src = src->prev;
+                                       }
+                                       reg_new_temp(dst);
+                                       break;
+
+                               default:
+                                       printf("ICMD %d at %d\n", iptr->opc, (int)(iptr-instr));
+                                       panic("Missing ICMD code during register allocation");
+                               } /* switch */
+                               iptr++;
+                       } /* while instructions */
+               } /* if */
+               bptr = bptr->next;
+       } /* while blocks */
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index ccdc20131108dc3cd012476d50793a657f43964a..536754d06bbb0da3375ad635e415ba6ff3940ae0 100644 (file)
@@ -1,16 +1,49 @@
-/* jit/stack.c *****************************************************************
+/* jit/stack.c - stack analysis
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+
+   $Id: stack.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-       Parser for JavaVM to intermediate code translation
-       
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: 1997/11/18
+#include <stdio.h>
+#include "stack.h"
+#include "jit.h"
+#include "builtin.h"
+#include "disass.h"
+#include "reg.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
+
+/* from codegen.inc */
+extern int dseglen;
 
-*******************************************************************************/
 
 #ifdef STATISTICS
 #define COUNT(cnt) cnt++
 
 #ifdef USEBUILTINTABLE
 static stdopdescriptor *find_builtin(stdopdescriptor *first, stdopdescriptor *last,
-               int icmd)
+                                                                        int icmd)
 {
        int len = last - first;
        int half;
@@ -173,24 +206,27 @@ static stdopdescriptor *find_builtin(stdopdescriptor *first, stdopdescriptor *la
 }
 #endif
 
-static void show_icmd_method();
 
-static void analyse_stack()
+void analyse_stack()
 {
-       int b_count, b_index;
+       int b_count;
+       int b_index;
        int stackdepth;
-       stackptr curstack, new, copy;
+       stackptr curstack;
+       stackptr new;
+       stackptr copy;
        int opcode, i, len, loops;
        int superblockend, repeat, deadcode;
-       instruction *iptr = instr;
-       basicblock *bptr, *tbptr;
+       instruction *iptr;
+       basicblock *bptr;
+       basicblock *tbptr;
        s4 *s4ptr;
        void* *tptr;
 
        //      int *argren = DMNEW(int, maxlocals); 
        int *argren = (int *)alloca(maxlocals * sizeof(int)); /* table for argument renaming */
        for (i = 0; i < maxlocals; i++)
-               argren[i]=i;
+               argren[i] = i;
        
        arguments_num = 0;
        new = stack;
@@ -208,7 +244,7 @@ static void analyse_stack()
                bptr->pre_count = 10000;
                STACKRESET;
                NEWXSTACK;
-               }
+       }
 
 #ifdef CONDITIONAL_LOADCONST
        b_count = block_count;
@@ -217,66 +253,66 @@ static void analyse_stack()
                if (bptr->icount != 0) {
                        iptr = bptr->iinstr + bptr->icount - 1;
                        switch (iptr->opc) {
-                               case ICMD_RET:
-                               case ICMD_RETURN:
-                               case ICMD_IRETURN:
-                               case ICMD_LRETURN:
-                               case ICMD_FRETURN:
-                               case ICMD_DRETURN:
-                               case ICMD_ARETURN:
-                               case ICMD_ATHROW:
-                                       break;
-
-                               case ICMD_IFEQ:
-                               case ICMD_IFNE:
-                               case ICMD_IFLT:
-                               case ICMD_IFGE:
-                               case ICMD_IFGT:
-                               case ICMD_IFLE:
-
-                               case ICMD_IFNULL:
-                               case ICMD_IFNONNULL:
-
-                               case ICMD_IF_ICMPEQ:
-                               case ICMD_IF_ICMPNE:
-                               case ICMD_IF_ICMPLT:
-                               case ICMD_IF_ICMPGE:
-                               case ICMD_IF_ICMPGT:
-                               case ICMD_IF_ICMPLE:
-
-                               case ICMD_IF_ACMPEQ:
-                               case ICMD_IF_ACMPNE:
-                                       bptr[1].pre_count++;
-                               case ICMD_GOTO:
-                                       block[block_index[iptr->op1]].pre_count++;
-                                       break;
-
-                               case ICMD_TABLESWITCH:
-                                       s4ptr = iptr->val.a;
-                                       block[block_index[*s4ptr++]].pre_count++;   /* default */
-                                       i = *s4ptr++;                               /* low     */
-                                       i = *s4ptr++ - i + 1;                       /* high    */
-                                       while (--i >= 0) {
-                                               block[block_index[*s4ptr++]].pre_count++;
-                                               }
-                                       break;
+                       case ICMD_RET:
+                       case ICMD_RETURN:
+                       case ICMD_IRETURN:
+                       case ICMD_LRETURN:
+                       case ICMD_FRETURN:
+                       case ICMD_DRETURN:
+                       case ICMD_ARETURN:
+                       case ICMD_ATHROW:
+                               break;
+
+                       case ICMD_IFEQ:
+                       case ICMD_IFNE:
+                       case ICMD_IFLT:
+                       case ICMD_IFGE:
+                       case ICMD_IFGT:
+                       case ICMD_IFLE:
+
+                       case ICMD_IFNULL:
+                       case ICMD_IFNONNULL:
+
+                       case ICMD_IF_ICMPEQ:
+                       case ICMD_IF_ICMPNE:
+                       case ICMD_IF_ICMPLT:
+                       case ICMD_IF_ICMPGE:
+                       case ICMD_IF_ICMPGT:
+                       case ICMD_IF_ICMPLE:
+
+                       case ICMD_IF_ACMPEQ:
+                       case ICMD_IF_ACMPNE:
+                               bptr[1].pre_count++;
+                       case ICMD_GOTO:
+                               block[block_index[iptr->op1]].pre_count++;
+                               break;
+
+                       case ICMD_TABLESWITCH:
+                               s4ptr = iptr->val.a;
+                               block[block_index[*s4ptr++]].pre_count++;   /* default */
+                               i = *s4ptr++;                               /* low     */
+                               i = *s4ptr++ - i + 1;                       /* high    */
+                               while (--i >= 0) {
+                                       block[block_index[*s4ptr++]].pre_count++;
+                               }
+                               break;
                                        
-                               case ICMD_LOOKUPSWITCH:
-                                       s4ptr = iptr->val.a;
-                                       block[block_index[*s4ptr++]].pre_count++;   /* default */
-                                       i = *s4ptr++;                               /* count   */
-                                       while (--i >= 0) {
-                                               block[block_index[s4ptr[1]]].pre_count++;
-                                               s4ptr += 2;
-                                               }
-                                       break;
-                               default:
-                                       bptr[1].pre_count++;
-                                       break;
+                       case ICMD_LOOKUPSWITCH:
+                               s4ptr = iptr->val.a;
+                               block[block_index[*s4ptr++]].pre_count++;   /* default */
+                               i = *s4ptr++;                               /* count   */
+                               while (--i >= 0) {
+                                       block[block_index[s4ptr[1]]].pre_count++;
+                                       s4ptr += 2;
                                }
+                               break;
+                       default:
+                               bptr[1].pre_count++;
+                               break;
                        }
-               bptr++;
                }
+               bptr++;
+       }
 #endif
 
 
@@ -291,7 +327,7 @@ static void analyse_stack()
                while (--b_count >= 0) {
                        if (bptr->flags == BBDELETED) {
                                /* do nothing */
-                               }
+                       }
                        else if (superblockend && (bptr->flags < BBREACHED))
                                repeat = true;
                        else if (bptr->flags <= BBREACHED) {
@@ -301,12 +337,12 @@ static void analyse_stack()
                                        COPYCURSTACK(copy);
                                        bptr->instack = copy;
                                        bptr->indepth = stackdepth;
-                                       }
+                               }
                                else if (bptr->indepth != stackdepth) {
                                        show_icmd_method();
                                        panic("Stack depth mismatch");
                                        
-                                       }
+                               }
                                curstack = bptr->instack;
                                deadcode = false;
                                superblockend = false;
@@ -342,608 +378,608 @@ static void analyse_stack()
 
                                                /* pop 0 push 0 */
 
-                                               case ICMD_NOP:
-                                               case ICMD_CHECKASIZE:
-
-                                               case ICMD_IFEQ_ICONST:
-                                               case ICMD_IFNE_ICONST:
-                                               case ICMD_IFLT_ICONST:
-                                               case ICMD_IFGE_ICONST:
-                                               case ICMD_IFGT_ICONST:
-                                               case ICMD_IFLE_ICONST:
-                                               case ICMD_ELSE_ICONST:
-                                                       SETDST;
-                                                       break;
-
-                                               case ICMD_RET:
-                                                       locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
-                                               case ICMD_RETURN:
-                                                       COUNT(count_pcmd_return);
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
+                                       case ICMD_NOP:
+                                       case ICMD_CHECKASIZE:
+
+                                       case ICMD_IFEQ_ICONST:
+                                       case ICMD_IFNE_ICONST:
+                                       case ICMD_IFLT_ICONST:
+                                       case ICMD_IFGE_ICONST:
+                                       case ICMD_IFGT_ICONST:
+                                       case ICMD_IFLE_ICONST:
+                                       case ICMD_ELSE_ICONST:
+                                               SETDST;
+                                               break;
+
+                                       case ICMD_RET:
+                                               locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
+                                       case ICMD_RETURN:
+                                               COUNT(count_pcmd_return);
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
 
                                                /* pop 0 push 1 const */
                                                
-                                               case ICMD_ICONST:
-                                                       COUNT(count_pcmd_load);
-                                                       if (len > 0) {
-                                                               switch (iptr[1].opc) {
-                                                                       case ICMD_IADD:
-                                                                               iptr[0].opc = ICMD_IADDCONST;
-icmd_iconst_tail:
-                                                                               iptr[1].opc = ICMD_NOP;
-                                                                               OP1_1(TYPE_INT,TYPE_INT);
-                                                                               COUNT(count_pcmd_op);
-                                                                               break;
-                                                                       case ICMD_ISUB:
-                                                                               iptr[0].opc = ICMD_ISUBCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IMUL:
-                                                                               iptr[0].opc = ICMD_IMULCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IDIV:
-                                                                               if (iptr[0].val.i == 0x00000002)
-                                                                                       iptr[0].val.i = 1;
-                                                                               else if (iptr[0].val.i == 0x00000004)
-                                                                                       iptr[0].val.i = 2;
-                                                                               else if (iptr[0].val.i == 0x00000008)
-                                                                                       iptr[0].val.i = 3;
-                                                                               else if (iptr[0].val.i == 0x00000010)
-                                                                                       iptr[0].val.i = 4;
-                                                                               else if (iptr[0].val.i == 0x00000020)
-                                                                                       iptr[0].val.i = 5;
-                                                                               else if (iptr[0].val.i == 0x00000040)
-                                                                                       iptr[0].val.i = 6;
-                                                                               else if (iptr[0].val.i == 0x00000080)
-                                                                                       iptr[0].val.i = 7;
-                                                                               else if (iptr[0].val.i == 0x00000100)
-                                                                                       iptr[0].val.i = 8;
-                                                                               else if (iptr[0].val.i == 0x00000200)
-                                                                                       iptr[0].val.i = 9;
-                                                                               else if (iptr[0].val.i == 0x00000400)
-                                                                                       iptr[0].val.i = 10;
-                                                                               else if (iptr[0].val.i == 0x00000800)
-                                                                                       iptr[0].val.i = 11;
-                                                                               else if (iptr[0].val.i == 0x00001000)
-                                                                                       iptr[0].val.i = 12;
-                                                                               else if (iptr[0].val.i == 0x00002000)
-                                                                                       iptr[0].val.i = 13;
-                                                                               else if (iptr[0].val.i == 0x00004000)
-                                                                                       iptr[0].val.i = 14;
-                                                                               else if (iptr[0].val.i == 0x00008000)
-                                                                                       iptr[0].val.i = 15;
-                                                                               else if (iptr[0].val.i == 0x00010000)
-                                                                                       iptr[0].val.i = 16;
-                                                                               else if (iptr[0].val.i == 0x00020000)
-                                                                                       iptr[0].val.i = 17;
-                                                                               else if (iptr[0].val.i == 0x00040000)
-                                                                                       iptr[0].val.i = 18;
-                                                                               else if (iptr[0].val.i == 0x00080000)
-                                                                                       iptr[0].val.i = 19;
-                                                                               else if (iptr[0].val.i == 0x00100000)
-                                                                                       iptr[0].val.i = 20;
-                                                                               else if (iptr[0].val.i == 0x00200000)
-                                                                                       iptr[0].val.i = 21;
-                                                                               else if (iptr[0].val.i == 0x00400000)
-                                                                                       iptr[0].val.i = 22;
-                                                                               else if (iptr[0].val.i == 0x00800000)
-                                                                                       iptr[0].val.i = 23;
-                                                                               else if (iptr[0].val.i == 0x01000000)
-                                                                                       iptr[0].val.i = 24;
-                                                                               else if (iptr[0].val.i == 0x02000000)
-                                                                                       iptr[0].val.i = 25;
-                                                                               else if (iptr[0].val.i == 0x04000000)
-                                                                                       iptr[0].val.i = 26;
-                                                                               else if (iptr[0].val.i == 0x08000000)
-                                                                                       iptr[0].val.i = 27;
-                                                                               else if (iptr[0].val.i == 0x10000000)
-                                                                                       iptr[0].val.i = 28;
-                                                                               else if (iptr[0].val.i == 0x20000000)
-                                                                                       iptr[0].val.i = 29;
-                                                                               else if (iptr[0].val.i == 0x40000000)
-                                                                                       iptr[0].val.i = 30;
-                                                                               else if (iptr[0].val.i == 0x80000000)
-                                                                                       iptr[0].val.i = 31;
-                                                                               else {
-                                                                                       PUSHCONST(TYPE_INT);
-                                                                                       break;
-                                                                                       }
-                                                                               iptr[0].opc = ICMD_IDIVPOW2;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IREM:
+                                       case ICMD_ICONST:
+                                               COUNT(count_pcmd_load);
+                                               if (len > 0) {
+                                                       switch (iptr[1].opc) {
+                                                       case ICMD_IADD:
+                                                               iptr[0].opc = ICMD_IADDCONST;
+                                                       icmd_iconst_tail:
+                                                               iptr[1].opc = ICMD_NOP;
+                                                               OP1_1(TYPE_INT,TYPE_INT);
+                                                               COUNT(count_pcmd_op);
+                                                               break;
+                                                       case ICMD_ISUB:
+                                                               iptr[0].opc = ICMD_ISUBCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IMUL:
+                                                               iptr[0].opc = ICMD_IMULCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IDIV:
+                                                               if (iptr[0].val.i == 0x00000002)
+                                                                       iptr[0].val.i = 1;
+                                                               else if (iptr[0].val.i == 0x00000004)
+                                                                       iptr[0].val.i = 2;
+                                                               else if (iptr[0].val.i == 0x00000008)
+                                                                       iptr[0].val.i = 3;
+                                                               else if (iptr[0].val.i == 0x00000010)
+                                                                       iptr[0].val.i = 4;
+                                                               else if (iptr[0].val.i == 0x00000020)
+                                                                       iptr[0].val.i = 5;
+                                                               else if (iptr[0].val.i == 0x00000040)
+                                                                       iptr[0].val.i = 6;
+                                                               else if (iptr[0].val.i == 0x00000080)
+                                                                       iptr[0].val.i = 7;
+                                                               else if (iptr[0].val.i == 0x00000100)
+                                                                       iptr[0].val.i = 8;
+                                                               else if (iptr[0].val.i == 0x00000200)
+                                                                       iptr[0].val.i = 9;
+                                                               else if (iptr[0].val.i == 0x00000400)
+                                                                       iptr[0].val.i = 10;
+                                                               else if (iptr[0].val.i == 0x00000800)
+                                                                       iptr[0].val.i = 11;
+                                                               else if (iptr[0].val.i == 0x00001000)
+                                                                       iptr[0].val.i = 12;
+                                                               else if (iptr[0].val.i == 0x00002000)
+                                                                       iptr[0].val.i = 13;
+                                                               else if (iptr[0].val.i == 0x00004000)
+                                                                       iptr[0].val.i = 14;
+                                                               else if (iptr[0].val.i == 0x00008000)
+                                                                       iptr[0].val.i = 15;
+                                                               else if (iptr[0].val.i == 0x00010000)
+                                                                       iptr[0].val.i = 16;
+                                                               else if (iptr[0].val.i == 0x00020000)
+                                                                       iptr[0].val.i = 17;
+                                                               else if (iptr[0].val.i == 0x00040000)
+                                                                       iptr[0].val.i = 18;
+                                                               else if (iptr[0].val.i == 0x00080000)
+                                                                       iptr[0].val.i = 19;
+                                                               else if (iptr[0].val.i == 0x00100000)
+                                                                       iptr[0].val.i = 20;
+                                                               else if (iptr[0].val.i == 0x00200000)
+                                                                       iptr[0].val.i = 21;
+                                                               else if (iptr[0].val.i == 0x00400000)
+                                                                       iptr[0].val.i = 22;
+                                                               else if (iptr[0].val.i == 0x00800000)
+                                                                       iptr[0].val.i = 23;
+                                                               else if (iptr[0].val.i == 0x01000000)
+                                                                       iptr[0].val.i = 24;
+                                                               else if (iptr[0].val.i == 0x02000000)
+                                                                       iptr[0].val.i = 25;
+                                                               else if (iptr[0].val.i == 0x04000000)
+                                                                       iptr[0].val.i = 26;
+                                                               else if (iptr[0].val.i == 0x08000000)
+                                                                       iptr[0].val.i = 27;
+                                                               else if (iptr[0].val.i == 0x10000000)
+                                                                       iptr[0].val.i = 28;
+                                                               else if (iptr[0].val.i == 0x20000000)
+                                                                       iptr[0].val.i = 29;
+                                                               else if (iptr[0].val.i == 0x40000000)
+                                                                       iptr[0].val.i = 30;
+                                                               else if (iptr[0].val.i == 0x80000000)
+                                                                       iptr[0].val.i = 31;
+                                                               else {
+                                                                       PUSHCONST(TYPE_INT);
+                                                                       break;
+                                                               }
+                                                               iptr[0].opc = ICMD_IDIVPOW2;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IREM:
 #if !defined(NO_DIV_OPT)
-                                                                               if (iptr[0].val.i == 0x10001) {
-                                                                                       iptr[0].opc = ICMD_IREM0X10001;
-                                                                                       goto icmd_iconst_tail;
-                                                                                       }
+                                                               if (iptr[0].val.i == 0x10001) {
+                                                                       iptr[0].opc = ICMD_IREM0X10001;
+                                                                       goto icmd_iconst_tail;
+                                                               }
 #endif
-                                                                               if ((iptr[0].val.i == 0x00000002) ||
-                                                                                   (iptr[0].val.i == 0x00000004) ||
-                                                                                   (iptr[0].val.i == 0x00000008) ||
-                                                                                   (iptr[0].val.i == 0x00000010) ||
-                                                                                   (iptr[0].val.i == 0x00000020) ||
-                                                                                   (iptr[0].val.i == 0x00000040) ||
-                                                                                   (iptr[0].val.i == 0x00000080) ||
-                                                                                   (iptr[0].val.i == 0x00000100) ||
-                                                                                   (iptr[0].val.i == 0x00000200) ||
-                                                                                   (iptr[0].val.i == 0x00000400) ||
-                                                                                   (iptr[0].val.i == 0x00000800) ||
-                                                                                   (iptr[0].val.i == 0x00001000) ||
-                                                                                   (iptr[0].val.i == 0x00002000) ||
-                                                                                   (iptr[0].val.i == 0x00004000) ||
-                                                                                   (iptr[0].val.i == 0x00008000) ||
-                                                                                   (iptr[0].val.i == 0x00010000) ||
-                                                                                   (iptr[0].val.i == 0x00020000) ||
-                                                                                   (iptr[0].val.i == 0x00040000) ||
-                                                                                   (iptr[0].val.i == 0x00080000) ||
-                                                                                   (iptr[0].val.i == 0x00100000) ||
-                                                                                   (iptr[0].val.i == 0x00200000) ||
-                                                                                   (iptr[0].val.i == 0x00400000) ||
-                                                                                   (iptr[0].val.i == 0x00800000) ||
-                                                                                   (iptr[0].val.i == 0x01000000) ||
-                                                                                   (iptr[0].val.i == 0x02000000) ||
-                                                                                   (iptr[0].val.i == 0x04000000) ||
-                                                                                   (iptr[0].val.i == 0x08000000) ||
-                                                                                   (iptr[0].val.i == 0x10000000) ||
-                                                                                   (iptr[0].val.i == 0x20000000) ||
-                                                                                   (iptr[0].val.i == 0x40000000) ||
-                                                                                   (iptr[0].val.i == 0x80000000)) {
-                                                                                       iptr[0].opc = ICMD_IREMPOW2;
-                                                                                       iptr[0].val.i -= 1;
-                                                                                       goto icmd_iconst_tail;
-                                                                                       }
-                                                                               PUSHCONST(TYPE_INT);
-                                                                               break;
-                                                                       case ICMD_IAND:
-                                                                               iptr[0].opc = ICMD_IANDCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IOR:
-                                                                               iptr[0].opc = ICMD_IORCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IXOR:
-                                                                               iptr[0].opc = ICMD_IXORCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_ISHL:
-                                                                               iptr[0].opc = ICMD_ISHLCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_ISHR:
-                                                                               iptr[0].opc = ICMD_ISHRCONST;
-                                                                               goto icmd_iconst_tail;
-                                                                       case ICMD_IUSHR:
-                                                                               iptr[0].opc = ICMD_IUSHRCONST;
-                                                                               goto icmd_iconst_tail;
+                                                               if ((iptr[0].val.i == 0x00000002) ||
+                                                                       (iptr[0].val.i == 0x00000004) ||
+                                                                       (iptr[0].val.i == 0x00000008) ||
+                                                                       (iptr[0].val.i == 0x00000010) ||
+                                                                       (iptr[0].val.i == 0x00000020) ||
+                                                                       (iptr[0].val.i == 0x00000040) ||
+                                                                       (iptr[0].val.i == 0x00000080) ||
+                                                                       (iptr[0].val.i == 0x00000100) ||
+                                                                       (iptr[0].val.i == 0x00000200) ||
+                                                                       (iptr[0].val.i == 0x00000400) ||
+                                                                       (iptr[0].val.i == 0x00000800) ||
+                                                                       (iptr[0].val.i == 0x00001000) ||
+                                                                       (iptr[0].val.i == 0x00002000) ||
+                                                                       (iptr[0].val.i == 0x00004000) ||
+                                                                       (iptr[0].val.i == 0x00008000) ||
+                                                                       (iptr[0].val.i == 0x00010000) ||
+                                                                       (iptr[0].val.i == 0x00020000) ||
+                                                                       (iptr[0].val.i == 0x00040000) ||
+                                                                       (iptr[0].val.i == 0x00080000) ||
+                                                                       (iptr[0].val.i == 0x00100000) ||
+                                                                       (iptr[0].val.i == 0x00200000) ||
+                                                                       (iptr[0].val.i == 0x00400000) ||
+                                                                       (iptr[0].val.i == 0x00800000) ||
+                                                                       (iptr[0].val.i == 0x01000000) ||
+                                                                       (iptr[0].val.i == 0x02000000) ||
+                                                                       (iptr[0].val.i == 0x04000000) ||
+                                                                       (iptr[0].val.i == 0x08000000) ||
+                                                                       (iptr[0].val.i == 0x10000000) ||
+                                                                       (iptr[0].val.i == 0x20000000) ||
+                                                                       (iptr[0].val.i == 0x40000000) ||
+                                                                       (iptr[0].val.i == 0x80000000)) {
+                                                                       iptr[0].opc = ICMD_IREMPOW2;
+                                                                       iptr[0].val.i -= 1;
+                                                                       goto icmd_iconst_tail;
+                                                               }
+                                                               PUSHCONST(TYPE_INT);
+                                                               break;
+                                                       case ICMD_IAND:
+                                                               iptr[0].opc = ICMD_IANDCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IOR:
+                                                               iptr[0].opc = ICMD_IORCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IXOR:
+                                                               iptr[0].opc = ICMD_IXORCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_ISHL:
+                                                               iptr[0].opc = ICMD_ISHLCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_ISHR:
+                                                               iptr[0].opc = ICMD_ISHRCONST;
+                                                               goto icmd_iconst_tail;
+                                                       case ICMD_IUSHR:
+                                                               iptr[0].opc = ICMD_IUSHRCONST;
+                                                               goto icmd_iconst_tail;
 #if SUPPORT_LONG_SHIFT
-                                                                       case ICMD_LSHL:
-                                                                               iptr[0].opc = ICMD_LSHLCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LSHR:
-                                                                               iptr[0].opc = ICMD_LSHRCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LUSHR:
-                                                                               iptr[0].opc = ICMD_LUSHRCONST;
-                                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LSHL:
+                                                               iptr[0].opc = ICMD_LSHLCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LSHR:
+                                                               iptr[0].opc = ICMD_LSHRCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LUSHR:
+                                                               iptr[0].opc = ICMD_LUSHRCONST;
+                                                               goto icmd_lconst_tail;
 #endif
-                                                                       case ICMD_IF_ICMPEQ:
-                                                                               iptr[0].opc = ICMD_IFEQ;
-icmd_if_icmp_tail:
-                                                                               iptr[0].op1 = iptr[1].op1;
-                                                                               bptr->icount--;
-                                                                               len--;
-                                                                               /* iptr[1].opc = ICMD_NOP; */
-                                                                               OP1_0(TYPE_INT);
-                                                                               tbptr = block + block_index[iptr->op1];
-
-                                                                               iptr[0].target = (void *) tbptr;
+                                                       case ICMD_IF_ICMPEQ:
+                                                               iptr[0].opc = ICMD_IFEQ;
+                                                       icmd_if_icmp_tail:
+                                                               iptr[0].op1 = iptr[1].op1;
+                                                               bptr->icount--;
+                                                               len--;
+                                                               /* iptr[1].opc = ICMD_NOP; */
+                                                               OP1_0(TYPE_INT);
+                                                               tbptr = block + block_index[iptr->op1];
+
+                                                               iptr[0].target = (void *) tbptr;
 
-                                                                               MARKREACHED(tbptr, copy);
-                                                                               COUNT(count_pcmd_bra);
-                                                                               break;
-                                                                       case ICMD_IF_ICMPLT:
-                                                                               iptr[0].opc = ICMD_IFLT;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       case ICMD_IF_ICMPLE:
-                                                                               iptr[0].opc = ICMD_IFLE;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       case ICMD_IF_ICMPNE:
-                                                                               iptr[0].opc = ICMD_IFNE;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       case ICMD_IF_ICMPGT:
-                                                                               iptr[0].opc = ICMD_IFGT;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       case ICMD_IF_ICMPGE:
-                                                                               iptr[0].opc = ICMD_IFGE;
-                                                                               goto icmd_if_icmp_tail;
-                                                                       default:
-                                                                               PUSHCONST(TYPE_INT);
-                                                                       }
-                                                               }
-                                                       else
+                                                               MARKREACHED(tbptr, copy);
+                                                               COUNT(count_pcmd_bra);
+                                                               break;
+                                                       case ICMD_IF_ICMPLT:
+                                                               iptr[0].opc = ICMD_IFLT;
+                                                               goto icmd_if_icmp_tail;
+                                                       case ICMD_IF_ICMPLE:
+                                                               iptr[0].opc = ICMD_IFLE;
+                                                               goto icmd_if_icmp_tail;
+                                                       case ICMD_IF_ICMPNE:
+                                                               iptr[0].opc = ICMD_IFNE;
+                                                               goto icmd_if_icmp_tail;
+                                                       case ICMD_IF_ICMPGT:
+                                                               iptr[0].opc = ICMD_IFGT;
+                                                               goto icmd_if_icmp_tail;
+                                                       case ICMD_IF_ICMPGE:
+                                                               iptr[0].opc = ICMD_IFGE;
+                                                               goto icmd_if_icmp_tail;
+                                                       default:
                                                                PUSHCONST(TYPE_INT);
-                                                       break;
-                                               case ICMD_LCONST:
-                                                       COUNT(count_pcmd_load);
-                                                       if (len > 0) {
-                                                               switch (iptr[1].opc) {
+                                                       }
+                                               }
+                                               else
+                                                       PUSHCONST(TYPE_INT);
+                                               break;
+                                       case ICMD_LCONST:
+                                               COUNT(count_pcmd_load);
+                                               if (len > 0) {
+                                                       switch (iptr[1].opc) {
 #if SUPPORT_LONG_ADD
-                                                                       case ICMD_LADD:
-                                                                               iptr[0].opc = ICMD_LADDCONST;
-icmd_lconst_tail:
-                                                                               iptr[1].opc = ICMD_NOP;
-                                                                               OP1_1(TYPE_LNG,TYPE_LNG);
-                                                                               COUNT(count_pcmd_op);
-                                                                               break;
-                                                                       case ICMD_LSUB:
-                                                                               iptr[0].opc = ICMD_LSUBCONST;
-                                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LADD:
+                                                               iptr[0].opc = ICMD_LADDCONST;
+                                                       icmd_lconst_tail:
+                                                               iptr[1].opc = ICMD_NOP;
+                                                               OP1_1(TYPE_LNG,TYPE_LNG);
+                                                               COUNT(count_pcmd_op);
+                                                               break;
+                                                       case ICMD_LSUB:
+                                                               iptr[0].opc = ICMD_LSUBCONST;
+                                                               goto icmd_lconst_tail;
 #endif
 #if SUPPORT_LONG_MULDIV
-                                                                       case ICMD_LMUL:
-                                                                               iptr[0].opc = ICMD_LMULCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LDIV:
-                                                                               if (iptr[0].val.l == 0x00000002)
-                                                                                       iptr[0].val.i = 1;
-                                                                               else if (iptr[0].val.l == 0x00000004)
-                                                                                       iptr[0].val.i = 2;
-                                                                               else if (iptr[0].val.l == 0x00000008)
-                                                                                       iptr[0].val.i = 3;
-                                                                               else if (iptr[0].val.l == 0x00000010)
-                                                                                       iptr[0].val.i = 4;
-                                                                               else if (iptr[0].val.l == 0x00000020)
-                                                                                       iptr[0].val.i = 5;
-                                                                               else if (iptr[0].val.l == 0x00000040)
-                                                                                       iptr[0].val.i = 6;
-                                                                               else if (iptr[0].val.l == 0x00000080)
-                                                                                       iptr[0].val.i = 7;
-                                                                               else if (iptr[0].val.l == 0x00000100)
-                                                                                       iptr[0].val.i = 8;
-                                                                               else if (iptr[0].val.l == 0x00000200)
-                                                                                       iptr[0].val.i = 9;
-                                                                               else if (iptr[0].val.l == 0x00000400)
-                                                                                       iptr[0].val.i = 10;
-                                                                               else if (iptr[0].val.l == 0x00000800)
-                                                                                       iptr[0].val.i = 11;
-                                                                               else if (iptr[0].val.l == 0x00001000)
-                                                                                       iptr[0].val.i = 12;
-                                                                               else if (iptr[0].val.l == 0x00002000)
-                                                                                       iptr[0].val.i = 13;
-                                                                               else if (iptr[0].val.l == 0x00004000)
-                                                                                       iptr[0].val.i = 14;
-                                                                               else if (iptr[0].val.l == 0x00008000)
-                                                                                       iptr[0].val.i = 15;
-                                                                               else if (iptr[0].val.l == 0x00010000)
-                                                                                       iptr[0].val.i = 16;
-                                                                               else if (iptr[0].val.l == 0x00020000)
-                                                                                       iptr[0].val.i = 17;
-                                                                               else if (iptr[0].val.l == 0x00040000)
-                                                                                       iptr[0].val.i = 18;
-                                                                               else if (iptr[0].val.l == 0x00080000)
-                                                                                       iptr[0].val.i = 19;
-                                                                               else if (iptr[0].val.l == 0x00100000)
-                                                                                       iptr[0].val.i = 20;
-                                                                               else if (iptr[0].val.l == 0x00200000)
-                                                                                       iptr[0].val.i = 21;
-                                                                               else if (iptr[0].val.l == 0x00400000)
-                                                                                       iptr[0].val.i = 22;
-                                                                               else if (iptr[0].val.l == 0x00800000)
-                                                                                       iptr[0].val.i = 23;
-                                                                               else if (iptr[0].val.l == 0x01000000)
-                                                                                       iptr[0].val.i = 24;
-                                                                               else if (iptr[0].val.l == 0x02000000)
-                                                                                       iptr[0].val.i = 25;
-                                                                               else if (iptr[0].val.l == 0x04000000)
-                                                                                       iptr[0].val.i = 26;
-                                                                               else if (iptr[0].val.l == 0x08000000)
-                                                                                       iptr[0].val.i = 27;
-                                                                               else if (iptr[0].val.l == 0x10000000)
-                                                                                       iptr[0].val.i = 28;
-                                                                               else if (iptr[0].val.l == 0x20000000)
-                                                                                       iptr[0].val.i = 29;
-                                                                               else if (iptr[0].val.l == 0x40000000)
-                                                                                       iptr[0].val.i = 30;
-                                                                               else if (iptr[0].val.l == 0x80000000)
-                                                                                       iptr[0].val.i = 31;
-                                                                               else {
-                                                                                       PUSHCONST(TYPE_LNG);
-                                                                                       break;
-                                                                                       }
-                                                                               iptr[0].opc = ICMD_LDIVPOW2;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LREM:
+                                                       case ICMD_LMUL:
+                                                               iptr[0].opc = ICMD_LMULCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LDIV:
+                                                               if (iptr[0].val.l == 0x00000002)
+                                                                       iptr[0].val.i = 1;
+                                                               else if (iptr[0].val.l == 0x00000004)
+                                                                       iptr[0].val.i = 2;
+                                                               else if (iptr[0].val.l == 0x00000008)
+                                                                       iptr[0].val.i = 3;
+                                                               else if (iptr[0].val.l == 0x00000010)
+                                                                       iptr[0].val.i = 4;
+                                                               else if (iptr[0].val.l == 0x00000020)
+                                                                       iptr[0].val.i = 5;
+                                                               else if (iptr[0].val.l == 0x00000040)
+                                                                       iptr[0].val.i = 6;
+                                                               else if (iptr[0].val.l == 0x00000080)
+                                                                       iptr[0].val.i = 7;
+                                                               else if (iptr[0].val.l == 0x00000100)
+                                                                       iptr[0].val.i = 8;
+                                                               else if (iptr[0].val.l == 0x00000200)
+                                                                       iptr[0].val.i = 9;
+                                                               else if (iptr[0].val.l == 0x00000400)
+                                                                       iptr[0].val.i = 10;
+                                                               else if (iptr[0].val.l == 0x00000800)
+                                                                       iptr[0].val.i = 11;
+                                                               else if (iptr[0].val.l == 0x00001000)
+                                                                       iptr[0].val.i = 12;
+                                                               else if (iptr[0].val.l == 0x00002000)
+                                                                       iptr[0].val.i = 13;
+                                                               else if (iptr[0].val.l == 0x00004000)
+                                                                       iptr[0].val.i = 14;
+                                                               else if (iptr[0].val.l == 0x00008000)
+                                                                       iptr[0].val.i = 15;
+                                                               else if (iptr[0].val.l == 0x00010000)
+                                                                       iptr[0].val.i = 16;
+                                                               else if (iptr[0].val.l == 0x00020000)
+                                                                       iptr[0].val.i = 17;
+                                                               else if (iptr[0].val.l == 0x00040000)
+                                                                       iptr[0].val.i = 18;
+                                                               else if (iptr[0].val.l == 0x00080000)
+                                                                       iptr[0].val.i = 19;
+                                                               else if (iptr[0].val.l == 0x00100000)
+                                                                       iptr[0].val.i = 20;
+                                                               else if (iptr[0].val.l == 0x00200000)
+                                                                       iptr[0].val.i = 21;
+                                                               else if (iptr[0].val.l == 0x00400000)
+                                                                       iptr[0].val.i = 22;
+                                                               else if (iptr[0].val.l == 0x00800000)
+                                                                       iptr[0].val.i = 23;
+                                                               else if (iptr[0].val.l == 0x01000000)
+                                                                       iptr[0].val.i = 24;
+                                                               else if (iptr[0].val.l == 0x02000000)
+                                                                       iptr[0].val.i = 25;
+                                                               else if (iptr[0].val.l == 0x04000000)
+                                                                       iptr[0].val.i = 26;
+                                                               else if (iptr[0].val.l == 0x08000000)
+                                                                       iptr[0].val.i = 27;
+                                                               else if (iptr[0].val.l == 0x10000000)
+                                                                       iptr[0].val.i = 28;
+                                                               else if (iptr[0].val.l == 0x20000000)
+                                                                       iptr[0].val.i = 29;
+                                                               else if (iptr[0].val.l == 0x40000000)
+                                                                       iptr[0].val.i = 30;
+                                                               else if (iptr[0].val.l == 0x80000000)
+                                                                       iptr[0].val.i = 31;
+                                                               else {
+                                                                       PUSHCONST(TYPE_LNG);
+                                                                       break;
+                                                               }
+                                                               iptr[0].opc = ICMD_LDIVPOW2;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LREM:
 #if !defined(NO_DIV_OPT)
-                                                                               if (iptr[0].val.l == 0x10001) {
-                                                                                       iptr[0].opc = ICMD_LREM0X10001;
-                                                                                       goto icmd_lconst_tail;
-                                                                                       }
+                                                               if (iptr[0].val.l == 0x10001) {
+                                                                       iptr[0].opc = ICMD_LREM0X10001;
+                                                                       goto icmd_lconst_tail;
+                                                               }
 #endif
-                                                                               if ((iptr[0].val.l == 0x00000002) ||
-                                                                                   (iptr[0].val.l == 0x00000004) ||
-                                                                                   (iptr[0].val.l == 0x00000008) ||
-                                                                                   (iptr[0].val.l == 0x00000010) ||
-                                                                                   (iptr[0].val.l == 0x00000020) ||
-                                                                                   (iptr[0].val.l == 0x00000040) ||
-                                                                                   (iptr[0].val.l == 0x00000080) ||
-                                                                                   (iptr[0].val.l == 0x00000100) ||
-                                                                                   (iptr[0].val.l == 0x00000200) ||
-                                                                                   (iptr[0].val.l == 0x00000400) ||
-                                                                                   (iptr[0].val.l == 0x00000800) ||
-                                                                                   (iptr[0].val.l == 0x00001000) ||
-                                                                                   (iptr[0].val.l == 0x00002000) ||
-                                                                                   (iptr[0].val.l == 0x00004000) ||
-                                                                                   (iptr[0].val.l == 0x00008000) ||
-                                                                                   (iptr[0].val.l == 0x00010000) ||
-                                                                                   (iptr[0].val.l == 0x00020000) ||
-                                                                                   (iptr[0].val.l == 0x00040000) ||
-                                                                                   (iptr[0].val.l == 0x00080000) ||
-                                                                                   (iptr[0].val.l == 0x00100000) ||
-                                                                                   (iptr[0].val.l == 0x00200000) ||
-                                                                                   (iptr[0].val.l == 0x00400000) ||
-                                                                                   (iptr[0].val.l == 0x00800000) ||
-                                                                                   (iptr[0].val.l == 0x01000000) ||
-                                                                                   (iptr[0].val.l == 0x02000000) ||
-                                                                                   (iptr[0].val.l == 0x04000000) ||
-                                                                                   (iptr[0].val.l == 0x08000000) ||
-                                                                                   (iptr[0].val.l == 0x10000000) ||
-                                                                                   (iptr[0].val.l == 0x20000000) ||
-                                                                                   (iptr[0].val.l == 0x40000000) ||
-                                                                                   (iptr[0].val.l == 0x80000000)) {
-                                                                                       iptr[0].opc = ICMD_LREMPOW2;
-                                                                                       iptr[0].val.l -= 1;
-                                                                                       goto icmd_lconst_tail;
-                                                                                       }
-                                                                               PUSHCONST(TYPE_LNG);
-                                                                               break;
+                                                               if ((iptr[0].val.l == 0x00000002) ||
+                                                                       (iptr[0].val.l == 0x00000004) ||
+                                                                       (iptr[0].val.l == 0x00000008) ||
+                                                                       (iptr[0].val.l == 0x00000010) ||
+                                                                       (iptr[0].val.l == 0x00000020) ||
+                                                                       (iptr[0].val.l == 0x00000040) ||
+                                                                       (iptr[0].val.l == 0x00000080) ||
+                                                                       (iptr[0].val.l == 0x00000100) ||
+                                                                       (iptr[0].val.l == 0x00000200) ||
+                                                                       (iptr[0].val.l == 0x00000400) ||
+                                                                       (iptr[0].val.l == 0x00000800) ||
+                                                                       (iptr[0].val.l == 0x00001000) ||
+                                                                       (iptr[0].val.l == 0x00002000) ||
+                                                                       (iptr[0].val.l == 0x00004000) ||
+                                                                       (iptr[0].val.l == 0x00008000) ||
+                                                                       (iptr[0].val.l == 0x00010000) ||
+                                                                       (iptr[0].val.l == 0x00020000) ||
+                                                                       (iptr[0].val.l == 0x00040000) ||
+                                                                       (iptr[0].val.l == 0x00080000) ||
+                                                                       (iptr[0].val.l == 0x00100000) ||
+                                                                       (iptr[0].val.l == 0x00200000) ||
+                                                                       (iptr[0].val.l == 0x00400000) ||
+                                                                       (iptr[0].val.l == 0x00800000) ||
+                                                                       (iptr[0].val.l == 0x01000000) ||
+                                                                       (iptr[0].val.l == 0x02000000) ||
+                                                                       (iptr[0].val.l == 0x04000000) ||
+                                                                       (iptr[0].val.l == 0x08000000) ||
+                                                                       (iptr[0].val.l == 0x10000000) ||
+                                                                       (iptr[0].val.l == 0x20000000) ||
+                                                                       (iptr[0].val.l == 0x40000000) ||
+                                                                       (iptr[0].val.l == 0x80000000)) {
+                                                                       iptr[0].opc = ICMD_LREMPOW2;
+                                                                       iptr[0].val.l -= 1;
+                                                                       goto icmd_lconst_tail;
+                                                               }
+                                                               PUSHCONST(TYPE_LNG);
+                                                               break;
 #endif
 #if SUPPORT_LONG_LOG
-                                                                       case ICMD_LAND:
-                                                                               iptr[0].opc = ICMD_LANDCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LOR:
-                                                                               iptr[0].opc = ICMD_LORCONST;
-                                                                               goto icmd_lconst_tail;
-                                                                       case ICMD_LXOR:
-                                                                               iptr[0].opc = ICMD_LXORCONST;
-                                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LAND:
+                                                               iptr[0].opc = ICMD_LANDCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LOR:
+                                                               iptr[0].opc = ICMD_LORCONST;
+                                                               goto icmd_lconst_tail;
+                                                       case ICMD_LXOR:
+                                                               iptr[0].opc = ICMD_LXORCONST;
+                                                               goto icmd_lconst_tail;
 #endif
 #if defined(NOLONG_CONDITIONAL)
-                                                                       case ICMD_LCMP:
-                                                                               if ((len > 1) && (iptr[2].val.i == 0)) {
-                                                                                       switch (iptr[2].opc) {
-                                                                                       case ICMD_IFEQ:
-                                                                                               iptr[0].opc = ICMD_IF_LEQ;
-icmd_lconst_lcmp_tail:
-                                                                                               iptr[0].op1 = iptr[2].op1;
-                                                                                               bptr->icount -= 2;
-                                                                                               len -= 2;
-                                                                                               /* iptr[1].opc = ICMD_NOP;
-                                                                                               iptr[2].opc = ICMD_NOP; */
-                                                                                               OP1_0(TYPE_LNG);
-                                                                                               tbptr = block + block_index[iptr->op1];
-
-                                                                                               iptr[0].target = (void *) tbptr;
-
-                                                                                               MARKREACHED(tbptr, copy);
-                                                                                               COUNT(count_pcmd_bra);
-                                                                                               COUNT(count_pcmd_op);
-                                                                                               break;
-                                                                                       case ICMD_IFNE:
-                                                                                               iptr[0].opc = ICMD_IF_LNE;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       case ICMD_IFLT:
-                                                                                               iptr[0].opc = ICMD_IF_LLT;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       case ICMD_IFGT:
-                                                                                               iptr[0].opc = ICMD_IF_LGT;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       case ICMD_IFLE:
-                                                                                               iptr[0].opc = ICMD_IF_LLE;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       case ICMD_IFGE:
-                                                                                               iptr[0].opc = ICMD_IF_LGE;
-                                                                                               goto icmd_lconst_lcmp_tail;
-                                                                                       default:
-                                                                                               PUSHCONST(TYPE_LNG);
-                                                                                       } /* switch (iptr[2].opc) */
-                                                                                       } /* if (iptr[2].val.i == 0) */
-                                                                               else
-                                                                                       PUSHCONST(TYPE_LNG);
+                                                       case ICMD_LCMP:
+                                                               if ((len > 1) && (iptr[2].val.i == 0)) {
+                                                                       switch (iptr[2].opc) {
+                                                                       case ICMD_IFEQ:
+                                                                               iptr[0].opc = ICMD_IF_LEQ;
+                                                                       icmd_lconst_lcmp_tail:
+                                                                               iptr[0].op1 = iptr[2].op1;
+                                                                               bptr->icount -= 2;
+                                                                               len -= 2;
+                                                                               /* iptr[1].opc = ICMD_NOP;
+                                                                                  iptr[2].opc = ICMD_NOP; */
+                                                                               OP1_0(TYPE_LNG);
+                                                                               tbptr = block + block_index[iptr->op1];
+
+                                                                               iptr[0].target = (void *) tbptr;
+
+                                                                               MARKREACHED(tbptr, copy);
+                                                                               COUNT(count_pcmd_bra);
+                                                                               COUNT(count_pcmd_op);
                                                                                break;
-#endif
+                                                                       case ICMD_IFNE:
+                                                                               iptr[0].opc = ICMD_IF_LNE;
+                                                                               goto icmd_lconst_lcmp_tail;
+                                                                       case ICMD_IFLT:
+                                                                               iptr[0].opc = ICMD_IF_LLT;
+                                                                               goto icmd_lconst_lcmp_tail;
+                                                                       case ICMD_IFGT:
+                                                                               iptr[0].opc = ICMD_IF_LGT;
+                                                                               goto icmd_lconst_lcmp_tail;
+                                                                       case ICMD_IFLE:
+                                                                               iptr[0].opc = ICMD_IF_LLE;
+                                                                               goto icmd_lconst_lcmp_tail;
+                                                                       case ICMD_IFGE:
+                                                                               iptr[0].opc = ICMD_IF_LGE;
+                                                                               goto icmd_lconst_lcmp_tail;
                                                                        default:
                                                                                PUSHCONST(TYPE_LNG);
-                                                                       }
-                                                               }
-                                                       else
+                                                                       } /* switch (iptr[2].opc) */
+                                                               } /* if (iptr[2].val.i == 0) */
+                                                               else
+                                                                       PUSHCONST(TYPE_LNG);
+                                                               break;
+#endif
+                                                       default:
                                                                PUSHCONST(TYPE_LNG);
-                                                       break;
-                                               case ICMD_FCONST:
-                                                       COUNT(count_pcmd_load);
-                                                       PUSHCONST(TYPE_FLT);
-                                                       break;
-                                               case ICMD_DCONST:
-                                                       COUNT(count_pcmd_load);
-                                                       PUSHCONST(TYPE_DBL);
-                                                       break;
-                                               case ICMD_ACONST:
-                                                       COUNT(count_pcmd_load);
-                                                       PUSHCONST(TYPE_ADR);
-                                                       break;
+                                                       }
+                                               }
+                                               else
+                                                       PUSHCONST(TYPE_LNG);
+                                               break;
+                                       case ICMD_FCONST:
+                                               COUNT(count_pcmd_load);
+                                               PUSHCONST(TYPE_FLT);
+                                               break;
+                                       case ICMD_DCONST:
+                                               COUNT(count_pcmd_load);
+                                               PUSHCONST(TYPE_DBL);
+                                               break;
+                                       case ICMD_ACONST:
+                                               COUNT(count_pcmd_load);
+                                               PUSHCONST(TYPE_ADR);
+                                               break;
 
                                                /* pop 0 push 1 load */
                                                
-                                               case ICMD_ILOAD:
-                                               case ICMD_LLOAD:
-                                               case ICMD_FLOAD:
-                                               case ICMD_DLOAD:
-                                               case ICMD_ALOAD:
-                                                       COUNT(count_load_instruction);
-                                                       i = opcode-ICMD_ILOAD;
-                                                       iptr->op1 = argren[iptr->op1];
-                                                       locals[ iptr->op1 ][i].type = i;
-                                                       LOAD(i, LOCALVAR, iptr->op1);
-                                                       break;
+                                       case ICMD_ILOAD:
+                                       case ICMD_LLOAD:
+                                       case ICMD_FLOAD:
+                                       case ICMD_DLOAD:
+                                       case ICMD_ALOAD:
+                                               COUNT(count_load_instruction);
+                                               i = opcode-ICMD_ILOAD;
+                                               iptr->op1 = argren[iptr->op1];
+                                               locals[iptr->op1][i].type = i;
+                                               LOAD(i, LOCALVAR, iptr->op1);
+                                               break;
 
                                                /* pop 2 push 1 */
 
-                                               case ICMD_IALOAD:
-                                               case ICMD_LALOAD:
-                                               case ICMD_FALOAD:
-                                               case ICMD_DALOAD:
-                                               case ICMD_AALOAD:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_check_bound);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP2IAT_1(opcode-ICMD_IALOAD);
-                                                       break;
-
-                                               case ICMD_BALOAD:
-                                               case ICMD_CALOAD:
-                                               case ICMD_SALOAD:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_check_bound);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP2IAT_1(TYPE_INT);
-                                                       break;
+                                       case ICMD_IALOAD:
+                                       case ICMD_LALOAD:
+                                       case ICMD_FALOAD:
+                                       case ICMD_DALOAD:
+                                       case ICMD_AALOAD:
+                                               COUNT(count_check_null);
+                                               COUNT(count_check_bound);
+                                               COUNT(count_pcmd_mem);
+                                               OP2IAT_1(opcode-ICMD_IALOAD);
+                                               break;
+
+                                       case ICMD_BALOAD:
+                                       case ICMD_CALOAD:
+                                       case ICMD_SALOAD:
+                                               COUNT(count_check_null);
+                                               COUNT(count_check_bound);
+                                               COUNT(count_pcmd_mem);
+                                               OP2IAT_1(TYPE_INT);
+                                               break;
 
                                                /* pop 0 push 0 iinc */
 
-                                               case ICMD_IINC:
+                                       case ICMD_IINC:
 #ifdef STATISTICS
-                                                       i = stackdepth;
-                                                       if (i >= 10)
-                                                               count_store_depth[10]++;
-                                                       else
-                                                               count_store_depth[i]++;
+                                               i = stackdepth;
+                                               if (i >= 10)
+                                                       count_store_depth[10]++;
+                                               else
+                                                       count_store_depth[i]++;
 #endif
-                                                       copy = curstack;
-                                                       i = stackdepth - 1;
-                                                       while (copy) {
-                                                               if ((copy->varkind == LOCALVAR) &&
-                                                                   (copy->varnum == iptr->op1)) {
-                                                                       copy->varkind = TEMPVAR;
-                                                                       copy->varnum = i;
-                                                                       }
-                                                               i--;
-                                                               copy = copy->prev;
-                                                               }
-                                                       SETDST;
-                                                       break;
+                                               copy = curstack;
+                                               i = stackdepth - 1;
+                                               while (copy) {
+                                                       if ((copy->varkind == LOCALVAR) &&
+                                                               (copy->varnum == iptr->op1)) {
+                                                               copy->varkind = TEMPVAR;
+                                                               copy->varnum = i;
+                                                       }
+                                                       i--;
+                                                       copy = copy->prev;
+                                               }
+                                               SETDST;
+                                               break;
 
                                                /* pop 1 push 0 store */
 
-                                               case ICMD_ISTORE:
-                                               case ICMD_LSTORE:
-                                               case ICMD_FSTORE:
-                                               case ICMD_DSTORE:
-                                               case ICMD_ASTORE:
-icmd_store:
+                                       case ICMD_ISTORE:
+                                       case ICMD_LSTORE:
+                                       case ICMD_FSTORE:
+                                       case ICMD_DSTORE:
+                                       case ICMD_ASTORE:
+                                       icmd_store:
 
-                                               i = opcode-ICMD_ISTORE;
-                                                       locals[iptr->op1][i].type = i;
+                                       i = opcode-ICMD_ISTORE;
+                                       locals[iptr->op1][i].type = i;
 #ifdef STATISTICS
-                                                       count_pcmd_store++;
-                                                       i = new - curstack;
-                                                       if (i >= 20)
-                                                               count_store_length[20]++;
-                                                       else
-                                                               count_store_length[i]++;
-                                                       i = stackdepth - 1;
-                                                       if (i >= 10)
-                                                               count_store_depth[10]++;
-                                                       else
-                                                               count_store_depth[i]++;
+                                       count_pcmd_store++;
+                                       i = new - curstack;
+                                       if (i >= 20)
+                                               count_store_length[20]++;
+                                       else
+                                               count_store_length[i]++;
+                                       i = stackdepth - 1;
+                                       if (i >= 10)
+                                               count_store_depth[10]++;
+                                       else
+                                               count_store_depth[i]++;
 #endif
-                                                       copy = curstack->prev;
-                                                       i = stackdepth - 2;
-                                                       while (copy) {
-                                                               if ((copy->varkind == LOCALVAR) &&
-                                                                   (copy->varnum == iptr->op1)) {
-                                                                       copy->varkind = TEMPVAR;
-                                                                       copy->varnum = i;
-                                                                       }
-                                                               i--;
-                                                               copy = copy->prev;
-                                                               }
-                                                       if ((new - curstack) == 1) {
-                                                               curstack->varkind = LOCALVAR;
-                                                               curstack->varnum = iptr->op1;
-                                                               };
-                                                       STORE(opcode-ICMD_ISTORE);
-                                                       break;
+                                       copy = curstack->prev;
+                                       i = stackdepth - 2;
+                                       while (copy) {
+                                               if ((copy->varkind == LOCALVAR) &&
+                                                       (copy->varnum == iptr->op1)) {
+                                                       copy->varkind = TEMPVAR;
+                                                       copy->varnum = i;
+                                               }
+                                               i--;
+                                               copy = copy->prev;
+                                       }
+                                       if ((new - curstack) == 1) {
+                                               curstack->varkind = LOCALVAR;
+                                               curstack->varnum = iptr->op1;
+                                       };
+                                       STORE(opcode-ICMD_ISTORE);
+                                       break;
 
-                                               /* pop 3 push 0 */
-
-                                               case ICMD_IASTORE:
-                                               case ICMD_LASTORE:
-                                               case ICMD_FASTORE:
-                                               case ICMD_DASTORE:
-                                               case ICMD_AASTORE:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_check_bound);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP3TIA_0(opcode-ICMD_IASTORE);
-                                                       break;
-                                               case ICMD_BASTORE:
-                                               case ICMD_CASTORE:
-                                               case ICMD_SASTORE:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_check_bound);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP3TIA_0(TYPE_INT);
-                                                       break;
+                                       /* pop 3 push 0 */
+
+                                       case ICMD_IASTORE:
+                                       case ICMD_LASTORE:
+                                       case ICMD_FASTORE:
+                                       case ICMD_DASTORE:
+                                       case ICMD_AASTORE:
+                                               COUNT(count_check_null);
+                                               COUNT(count_check_bound);
+                                               COUNT(count_pcmd_mem);
+                                               OP3TIA_0(opcode-ICMD_IASTORE);
+                                               break;
+                                       case ICMD_BASTORE:
+                                       case ICMD_CASTORE:
+                                       case ICMD_SASTORE:
+                                               COUNT(count_check_null);
+                                               COUNT(count_check_bound);
+                                               COUNT(count_pcmd_mem);
+                                               OP3TIA_0(TYPE_INT);
+                                               break;
 
                                                /* pop 1 push 0 */
 
-                                               case ICMD_POP:
-                                                       OP1_0ANY;
-                                                       break;
-
-                                               case ICMD_IRETURN:
-                                               case ICMD_LRETURN:
-                                               case ICMD_FRETURN:
-                                               case ICMD_DRETURN:
-                                               case ICMD_ARETURN:
-                                                       COUNT(count_pcmd_return);
-                                                       OP1_0(opcode-ICMD_IRETURN);
-                                                       superblockend = true;
-                                                       break;
-
-                                               case ICMD_ATHROW:
-                                                       COUNT(count_check_null);
-                                                       OP1_0(TYPE_ADR);
-                                                       STACKRESET;
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
-
-                                               case ICMD_PUTSTATIC:
-                                                       COUNT(count_pcmd_mem);
-                                                       OP1_0(iptr->op1);
-                                                       break;
+                                       case ICMD_POP:
+                                               OP1_0ANY;
+                                               break;
+
+                                       case ICMD_IRETURN:
+                                       case ICMD_LRETURN:
+                                       case ICMD_FRETURN:
+                                       case ICMD_DRETURN:
+                                       case ICMD_ARETURN:
+                                               COUNT(count_pcmd_return);
+                                               OP1_0(opcode-ICMD_IRETURN);
+                                               superblockend = true;
+                                               break;
+
+                                       case ICMD_ATHROW:
+                                               COUNT(count_check_null);
+                                               OP1_0(TYPE_ADR);
+                                               STACKRESET;
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
+
+                                       case ICMD_PUTSTATIC:
+                                               COUNT(count_pcmd_mem);
+                                               OP1_0(iptr->op1);
+                                               break;
 
                                                /* pop 1 push 0 branch */
 
-                                               case ICMD_IFNULL:
-                                               case ICMD_IFNONNULL:
-                                                       COUNT(count_pcmd_bra);
-                                                       OP1_0(TYPE_ADR);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_IFNULL:
+                                       case ICMD_IFNONNULL:
+                                               COUNT(count_pcmd_bra);
+                                               OP1_0(TYPE_ADR);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               break;
 
-                                               case ICMD_IFEQ:
-                                               case ICMD_IFNE:
-                                               case ICMD_IFLT:
-                                               case ICMD_IFGE:
-                                               case ICMD_IFGT:
-                                               case ICMD_IFLE:
-                                                       COUNT(count_pcmd_bra);
+                                       case ICMD_IFEQ:
+                                       case ICMD_IFNE:
+                                       case ICMD_IFLT:
+                                       case ICMD_IFGE:
+                                       case ICMD_IFGT:
+                                       case ICMD_IFLE:
+                                               COUNT(count_pcmd_bra);
 #ifdef CONDITIONAL_LOADCONST
-                                                       {
+                                               {
                                                        tbptr = block + b_index;
                                                        if ((b_count >= 3) &&
                                                            ((b_index + 2) == block_index[iptr[0].op1]) &&
@@ -955,25 +991,25 @@ icmd_store:
                                                            (iptr[3].opc == ICMD_ICONST)) {
                                                                OP1_1(TYPE_INT, TYPE_INT);
                                                                switch (iptr[0].opc) {
-                                                                       case ICMD_IFEQ:
-                                                                               iptr[0].opc = ICMD_IFNE_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFNE:
-                                                                               iptr[0].opc = ICMD_IFEQ_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFLT:
-                                                                               iptr[0].opc = ICMD_IFGE_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFGE:
-                                                                               iptr[0].opc = ICMD_IFLT_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFGT:
-                                                                               iptr[0].opc = ICMD_IFLE_ICONST;
-                                                                               break;
-                                                                       case ICMD_IFLE:
-                                                                               iptr[0].opc = ICMD_IFGT_ICONST;
-                                                                               break;
-                                                                       }
+                                                               case ICMD_IFEQ:
+                                                                       iptr[0].opc = ICMD_IFNE_ICONST;
+                                                                       break;
+                                                               case ICMD_IFNE:
+                                                                       iptr[0].opc = ICMD_IFEQ_ICONST;
+                                                                       break;
+                                                               case ICMD_IFLT:
+                                                                       iptr[0].opc = ICMD_IFGE_ICONST;
+                                                                       break;
+                                                               case ICMD_IFGE:
+                                                                       iptr[0].opc = ICMD_IFLT_ICONST;
+                                                                       break;
+                                                               case ICMD_IFGT:
+                                                                       iptr[0].opc = ICMD_IFLE_ICONST;
+                                                                       break;
+                                                               case ICMD_IFLE:
+                                                                       iptr[0].opc = ICMD_IFGT_ICONST;
+                                                                       break;
+                                                               }
                                                                iptr[0].val.i = iptr[1].val.i;
                                                                iptr[1].opc = ICMD_ELSE_ICONST;
                                                                iptr[1].val.i = iptr[3].val.i;
@@ -989,488 +1025,488 @@ icmd_store:
                                                                        tbptr[3].flags = BBDELETED;
                                                                        tbptr[3].icount = 0;
                                                                        b_index++;
-                                                                       }
+                                                               }
                                                                else {
                                                                        bptr->icount++;
                                                                        len ++;
-                                                                       }
+                                                               }
                                                                b_index += 2;
                                                                break;
-                                                               }
                                                        }
+                                               }
 #endif
-                                                       OP1_0(TYPE_INT);
-                                                       tbptr = block + block_index[iptr->op1];
+                                               OP1_0(TYPE_INT);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               break;
 
                                                /* pop 0 push 0 branch */
 
-                                               case ICMD_GOTO:
-                                                       COUNT(count_pcmd_bra);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_GOTO:
+                                               COUNT(count_pcmd_bra);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
 
                                                /* pop 1 push 0 table branch */
 
-                                               case ICMD_TABLESWITCH:
-                                                       COUNT(count_pcmd_table);
-                                                       OP1_0(TYPE_INT);
-                                                       s4ptr = iptr->val.a;
-                                                       tbptr = block + block_index[*s4ptr++]; /* default */
-                                                       MARKREACHED(tbptr, copy);
-                                                       i = *s4ptr++;                          /* low     */
-                                                       i = *s4ptr++ - i + 1;                  /* high    */
+                                       case ICMD_TABLESWITCH:
+                                               COUNT(count_pcmd_table);
+                                               OP1_0(TYPE_INT);
+                                               s4ptr = iptr->val.a;
+                                               tbptr = block + block_index[*s4ptr++]; /* default */
+                                               MARKREACHED(tbptr, copy);
+                                               i = *s4ptr++;                          /* low     */
+                                               i = *s4ptr++ - i + 1;                  /* high    */
 
-                                                       tptr = DMNEW(void*, i+1);
-                                                       iptr->target = (void *) tptr;
+                                               tptr = DMNEW(void*, i+1);
+                                               iptr->target = (void *) tptr;
 
-                                                       tptr[0] = (void *) tbptr;
-                                                       tptr++;
+                                               tptr[0] = (void *) tbptr;
+                                               tptr++;
 
-                                                       while (--i >= 0) {
-                                                               tbptr = block + block_index[*s4ptr++];
+                                               while (--i >= 0) {
+                                                       tbptr = block + block_index[*s4ptr++];
 
-                                                               tptr[0] = (void *) tbptr;
-                                                               tptr++;
+                                                       tptr[0] = (void *) tbptr;
+                                                       tptr++;
 
-                                                               MARKREACHED(tbptr, copy);
-                                                               }
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
+                                                       MARKREACHED(tbptr, copy);
+                                               }
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
                                                        
                                                /* pop 1 push 0 table branch */
 
-                                               case ICMD_LOOKUPSWITCH:
-                                                       COUNT(count_pcmd_table);
-                                                       OP1_0(TYPE_INT);
-                                                       s4ptr = iptr->val.a;
-                                                       tbptr = block + block_index[*s4ptr++]; /* default */
-                                                       MARKREACHED(tbptr, copy);
-                                                       i = *s4ptr++;                          /* count   */
+                                       case ICMD_LOOKUPSWITCH:
+                                               COUNT(count_pcmd_table);
+                                               OP1_0(TYPE_INT);
+                                               s4ptr = iptr->val.a;
+                                               tbptr = block + block_index[*s4ptr++]; /* default */
+                                               MARKREACHED(tbptr, copy);
+                                               i = *s4ptr++;                          /* count   */
 
-                                                       tptr = DMNEW(void*, i+1);
-                                                       iptr->target = (void *) tptr;
+                                               tptr = DMNEW(void*, i+1);
+                                               iptr->target = (void *) tptr;
 
-                                                       tptr[0] = (void *) tbptr;
-                                                       tptr++;
+                                               tptr[0] = (void *) tbptr;
+                                               tptr++;
 
-                                                       while (--i >= 0) {
-                                                               tbptr = block + block_index[s4ptr[1]];
+                                               while (--i >= 0) {
+                                                       tbptr = block + block_index[s4ptr[1]];
 
-                                                               tptr[0] = (void *) tbptr;
-                                                               tptr++;
+                                                       tptr[0] = (void *) tbptr;
+                                                       tptr++;
                                                                
-                                                               MARKREACHED(tbptr, copy);
-                                                               s4ptr += 2;
-                                                               }
-                                                       SETDST;
-                                                       superblockend = true;
-                                                       break;
+                                                       MARKREACHED(tbptr, copy);
+                                                       s4ptr += 2;
+                                               }
+                                               SETDST;
+                                               superblockend = true;
+                                               break;
 
-                                               case ICMD_NULLCHECKPOP:
-                                               case ICMD_MONITORENTER:
-                                                       COUNT(count_check_null);
-                                               case ICMD_MONITOREXIT:
-                                                       OP1_0(TYPE_ADR);
-                                                       break;
+                                       case ICMD_NULLCHECKPOP:
+                                       case ICMD_MONITORENTER:
+                                               COUNT(count_check_null);
+                                       case ICMD_MONITOREXIT:
+                                               OP1_0(TYPE_ADR);
+                                               break;
 
                                                /* pop 2 push 0 branch */
 
-                                               case ICMD_IF_ICMPEQ:
-                                               case ICMD_IF_ICMPNE:
-                                               case ICMD_IF_ICMPLT:
-                                               case ICMD_IF_ICMPGE:
-                                               case ICMD_IF_ICMPGT:
-                                               case ICMD_IF_ICMPLE:
-                                                       COUNT(count_pcmd_bra);
-                                                       OP2_0(TYPE_INT);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_IF_ICMPEQ:
+                                       case ICMD_IF_ICMPNE:
+                                       case ICMD_IF_ICMPLT:
+                                       case ICMD_IF_ICMPGE:
+                                       case ICMD_IF_ICMPGT:
+                                       case ICMD_IF_ICMPLE:
+                                               COUNT(count_pcmd_bra);
+                                               OP2_0(TYPE_INT);
+                                               tbptr = block + block_index[iptr->op1];
                                                        
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               break;
 
-                                               case ICMD_IF_ACMPEQ:
-                                               case ICMD_IF_ACMPNE:
-                                                       COUNT(count_pcmd_bra);
-                                                       OP2_0(TYPE_ADR);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_IF_ACMPEQ:
+                                       case ICMD_IF_ACMPNE:
+                                               COUNT(count_pcmd_bra);
+                                               OP2_0(TYPE_ADR);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       MARKREACHED(tbptr, copy);
-                                                       break;
+                                               MARKREACHED(tbptr, copy);
+                                               break;
 
                                                /* pop 2 push 0 */
 
-                                               case ICMD_PUTFIELD:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_pcmd_mem);
-                                                       OPTT2_0(iptr->op1,TYPE_ADR);
-                                                       break;
+                                       case ICMD_PUTFIELD:
+                                               COUNT(count_check_null);
+                                               COUNT(count_pcmd_mem);
+                                               OPTT2_0(iptr->op1,TYPE_ADR);
+                                               break;
 
-                                               case ICMD_POP2:
-                                                       if (! IS_2_WORD_TYPE(curstack->type)) {
-                                                               OP1_0ANY;                /* second pop */
-                                                               }
-                                                       else
-                                                               iptr->opc = ICMD_POP;
-                                                       OP1_0ANY;
-                                                       break;
+                                       case ICMD_POP2:
+                                               if (! IS_2_WORD_TYPE(curstack->type)) {
+                                                       OP1_0ANY;                /* second pop */
+                                               }
+                                               else
+                                                       iptr->opc = ICMD_POP;
+                                               OP1_0ANY;
+                                               break;
 
                                                /* pop 0 push 1 dup */
                                                
-                                               case ICMD_DUP:
-                                                       COUNT(count_dup_instruction);
+                                       case ICMD_DUP:
+                                               COUNT(count_dup_instruction);
+                                               DUP;
+                                               break;
+
+                                       case ICMD_DUP2:
+                                               if (IS_2_WORD_TYPE(curstack->type)) {
+                                                       iptr->opc = ICMD_DUP;
                                                        DUP;
-                                                       break;
-
-                                               case ICMD_DUP2:
-                                                       if (IS_2_WORD_TYPE(curstack->type)) {
-                                                               iptr->opc = ICMD_DUP;
-                                                               DUP;
-                                                               }
-                                                       else {
-                                                               copy = curstack;
-                                                               NEWSTACK(copy->prev->type, copy->prev->varkind,
-                                                                        copy->prev->varnum);
-                                                               NEWSTACK(copy->type, copy->varkind,
-                                                                        copy->varnum);
-                                                               SETDST;
-                                                               stackdepth+=2;
-                                                               }
-                                                       break;
+                                               }
+                                               else {
+                                                       copy = curstack;
+                                                       NEWSTACK(copy->prev->type, copy->prev->varkind,
+                                                                        copy->prev->varnum);
+                                                       NEWSTACK(copy->type, copy->varkind,
+                                                                        copy->varnum);
+                                                       SETDST;
+                                                       stackdepth+=2;
+                                               }
+                                               break;
 
                                                /* pop 2 push 3 dup */
                                                
-                                               case ICMD_DUP_X1:
-                                                       DUP_X1;
-                                                       break;
+                                       case ICMD_DUP_X1:
+                                               DUP_X1;
+                                               break;
 
-                                               case ICMD_DUP2_X1:
-                                                       if (IS_2_WORD_TYPE(curstack->type)) {
-                                                               iptr->opc = ICMD_DUP_X1;
-                                                               DUP_X1;
-                                                               }
-                                                       else {
-                                                               DUP2_X1;
-                                                               }
-                                                       break;
+                                       case ICMD_DUP2_X1:
+                                               if (IS_2_WORD_TYPE(curstack->type)) {
+                                                       iptr->opc = ICMD_DUP_X1;
+                                                       DUP_X1;
+                                               }
+                                               else {
+                                                       DUP2_X1;
+                                               }
+                                               break;
 
                                                /* pop 3 push 4 dup */
                                                
-                                               case ICMD_DUP_X2:
+                                       case ICMD_DUP_X2:
+                                               if (IS_2_WORD_TYPE(curstack->prev->type)) {
+                                                       iptr->opc = ICMD_DUP_X1;
+                                                       DUP_X1;
+                                               }
+                                               else {
+                                                       DUP_X2;
+                                               }
+                                               break;
+
+                                       case ICMD_DUP2_X2:
+                                               if (IS_2_WORD_TYPE(curstack->type)) {
                                                        if (IS_2_WORD_TYPE(curstack->prev->type)) {
                                                                iptr->opc = ICMD_DUP_X1;
                                                                DUP_X1;
-                                                               }
+                                                       }
                                                        else {
+                                                               iptr->opc = ICMD_DUP_X2;
                                                                DUP_X2;
-                                                               }
-                                                       break;
-
-                                               case ICMD_DUP2_X2:
-                                                       if (IS_2_WORD_TYPE(curstack->type)) {
-                                                               if (IS_2_WORD_TYPE(curstack->prev->type)) {
-                                                                       iptr->opc = ICMD_DUP_X1;
-                                                                       DUP_X1;
-                                                                       }
-                                                               else {
-                                                                       iptr->opc = ICMD_DUP_X2;
-                                                                       DUP_X2;
-                                                                       }
-                                                               }
-                                                       else
-                                                               if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
-                                                                       iptr->opc = ICMD_DUP2_X1;
-                                                                       DUP2_X1;
-                                                                       }
-                                                               else {
-                                                                       DUP2_X2;
-                                                                       }
-                                                       break;
+                                                       }
+                                               }
+                                               else
+                                                       if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
+                                                               iptr->opc = ICMD_DUP2_X1;
+                                                               DUP2_X1;
+                                                       }
+                                                       else {
+                                                               DUP2_X2;
+                                                       }
+                                               break;
 
                                                /* pop 2 push 2 swap */
                                                
-                                               case ICMD_SWAP:
-                                                       SWAP;
-                                                       break;
+                                       case ICMD_SWAP:
+                                               SWAP;
+                                               break;
 
                                                /* pop 2 push 1 */
                                                
-                                               case ICMD_IDIV:
+                                       case ICMD_IDIV:
 #if !SUPPORT_DIVISION
-                                                       iptr[0].opc = ICMD_BUILTIN2;
-                                                       iptr[0].op1 = TYPE_INT;
-                                                       iptr[0].val.a = (functionptr) asm_builtin_idiv;
-                                                       isleafmethod = false;
-                                                       goto builtin2;
+                                               iptr[0].opc = ICMD_BUILTIN2;
+                                               iptr[0].op1 = TYPE_INT;
+                                               iptr[0].val.a = (functionptr) asm_builtin_idiv;
+                                               isleafmethod = false;
+                                               goto builtin2;
 #endif
 
-                                               case ICMD_IREM:
+                                       case ICMD_IREM:
 #if !SUPPORT_DIVISION
-                                                       iptr[0].opc = ICMD_BUILTIN2;
-                                                       iptr[0].op1 = TYPE_INT;
-                                                       iptr[0].val.a = (functionptr) asm_builtin_irem;
-                                                       isleafmethod = false;
-                                                       goto builtin2;
+                                               iptr[0].opc = ICMD_BUILTIN2;
+                                               iptr[0].op1 = TYPE_INT;
+                                               iptr[0].val.a = (functionptr) asm_builtin_irem;
+                                               isleafmethod = false;
+                                               goto builtin2;
 #endif
 
-                                               case ICMD_IADD:
-                                               case ICMD_ISUB:
-                                               case ICMD_IMUL:
-
-                                               case ICMD_ISHL:
-                                               case ICMD_ISHR:
-                                               case ICMD_IUSHR:
-                                               case ICMD_IAND:
-                                               case ICMD_IOR:
-                                               case ICMD_IXOR:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2_1(TYPE_INT);
-                                                       break;
-
-                                               case ICMD_LDIV:
+                                       case ICMD_IADD:
+                                       case ICMD_ISUB:
+                                       case ICMD_IMUL:
+
+                                       case ICMD_ISHL:
+                                       case ICMD_ISHR:
+                                       case ICMD_IUSHR:
+                                       case ICMD_IAND:
+                                       case ICMD_IOR:
+                                       case ICMD_IXOR:
+                                               COUNT(count_pcmd_op);
+                                               OP2_1(TYPE_INT);
+                                               break;
+
+                                       case ICMD_LDIV:
 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_MULDIV)
-                                                       iptr[0].opc = ICMD_BUILTIN2;
-                                                       iptr[0].op1 = TYPE_LNG;
-                                                       iptr[0].val.a = (functionptr) asm_builtin_ldiv;
-                                                       isleafmethod = false;
-                                                       goto builtin2;
+                                               iptr[0].opc = ICMD_BUILTIN2;
+                                               iptr[0].op1 = TYPE_LNG;
+                                               iptr[0].val.a = (functionptr) asm_builtin_ldiv;
+                                               isleafmethod = false;
+                                               goto builtin2;
 #endif
 
-                                               case ICMD_LREM:
+                                       case ICMD_LREM:
 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_MULDIV)
-                                                       iptr[0].opc = ICMD_BUILTIN2;
-                                                       iptr[0].op1 = TYPE_LNG;
-                                                       iptr[0].val.a = (functionptr) asm_builtin_lrem;
-                                                       isleafmethod = false;
-                                                       goto builtin2;
+                                               iptr[0].opc = ICMD_BUILTIN2;
+                                               iptr[0].op1 = TYPE_LNG;
+                                               iptr[0].val.a = (functionptr) asm_builtin_lrem;
+                                               isleafmethod = false;
+                                               goto builtin2;
 #endif
 
-                                               case ICMD_LADD:
-                                               case ICMD_LSUB:
-                                               case ICMD_LMUL:
-
-                                               case ICMD_LOR:
-                                               case ICMD_LAND:
-                                               case ICMD_LXOR:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2_1(TYPE_LNG);
-                                                       break;
-
-                                               case ICMD_LSHL:
-                                               case ICMD_LSHR:
-                                               case ICMD_LUSHR:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2IT_1(TYPE_LNG);
-                                                       break;
-
-                                               case ICMD_FADD:
-                                               case ICMD_FSUB:
-                                               case ICMD_FMUL:
-                                               case ICMD_FDIV:
-                                               case ICMD_FREM:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2_1(TYPE_FLT);
-                                                       break;
-
-                                               case ICMD_DADD:
-                                               case ICMD_DSUB:
-                                               case ICMD_DMUL:
-                                               case ICMD_DDIV:
-                                               case ICMD_DREM:
-                                                       COUNT(count_pcmd_op);
-                                                       OP2_1(TYPE_DBL);
-                                                       break;
-
-                                               case ICMD_LCMP:
-                                                       COUNT(count_pcmd_op);
+                                       case ICMD_LADD:
+                                       case ICMD_LSUB:
+                                       case ICMD_LMUL:
+
+                                       case ICMD_LOR:
+                                       case ICMD_LAND:
+                                       case ICMD_LXOR:
+                                               COUNT(count_pcmd_op);
+                                               OP2_1(TYPE_LNG);
+                                               break;
+
+                                       case ICMD_LSHL:
+                                       case ICMD_LSHR:
+                                       case ICMD_LUSHR:
+                                               COUNT(count_pcmd_op);
+                                               OP2IT_1(TYPE_LNG);
+                                               break;
+
+                                       case ICMD_FADD:
+                                       case ICMD_FSUB:
+                                       case ICMD_FMUL:
+                                       case ICMD_FDIV:
+                                       case ICMD_FREM:
+                                               COUNT(count_pcmd_op);
+                                               OP2_1(TYPE_FLT);
+                                               break;
+
+                                       case ICMD_DADD:
+                                       case ICMD_DSUB:
+                                       case ICMD_DMUL:
+                                       case ICMD_DDIV:
+                                       case ICMD_DREM:
+                                               COUNT(count_pcmd_op);
+                                               OP2_1(TYPE_DBL);
+                                               break;
+
+                                       case ICMD_LCMP:
+                                               COUNT(count_pcmd_op);
 #ifndef NOLONG_CONDITIONAL
-                                                       if ((len > 0) && (iptr[1].val.i == 0)) {
-                                                               switch (iptr[1].opc) {
-                                                                       case ICMD_IFEQ:
-                                                                               iptr[0].opc = ICMD_IF_LCMPEQ;
-icmd_lcmp_if_tail:
-                                                                               iptr[0].op1 = iptr[1].op1;
-                                                                               len--;
-                                                                               bptr->icount--;
-                                                                               /* iptr[1].opc = ICMD_NOP; */
-                                                                               OP2_0(TYPE_LNG);
-                                                                               tbptr = block + block_index[iptr->op1];
+                                               if ((len > 0) && (iptr[1].val.i == 0)) {
+                                                       switch (iptr[1].opc) {
+                                                       case ICMD_IFEQ:
+                                                               iptr[0].opc = ICMD_IF_LCMPEQ;
+                                                       icmd_lcmp_if_tail:
+                                                               iptr[0].op1 = iptr[1].op1;
+                                                               len--;
+                                                               bptr->icount--;
+                                                               /* iptr[1].opc = ICMD_NOP; */
+                                                               OP2_0(TYPE_LNG);
+                                                               tbptr = block + block_index[iptr->op1];
                        
-                                                                               iptr[0].target = (void *) tbptr;
+                                                               iptr[0].target = (void *) tbptr;
 
-                                                                               MARKREACHED(tbptr, copy);
-                                                                               COUNT(count_pcmd_bra);
-                                                                               break;
-                                                                       case ICMD_IFNE:
-                                                                               iptr[0].opc = ICMD_IF_LCMPNE;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       case ICMD_IFLT:
-                                                                               iptr[0].opc = ICMD_IF_LCMPLT;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       case ICMD_IFGT:
-                                                                               iptr[0].opc = ICMD_IF_LCMPGT;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       case ICMD_IFLE:
-                                                                               iptr[0].opc = ICMD_IF_LCMPLE;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       case ICMD_IFGE:
-                                                                               iptr[0].opc = ICMD_IF_LCMPGE;
-                                                                               goto icmd_lcmp_if_tail;
-                                                                       default:
-                                                                               OPTT2_1(TYPE_LNG, TYPE_INT);
-                                                                       }
-                                                               }
-                                                       else
-#endif
+                                                               MARKREACHED(tbptr, copy);
+                                                               COUNT(count_pcmd_bra);
+                                                               break;
+                                                       case ICMD_IFNE:
+                                                               iptr[0].opc = ICMD_IF_LCMPNE;
+                                                               goto icmd_lcmp_if_tail;
+                                                       case ICMD_IFLT:
+                                                               iptr[0].opc = ICMD_IF_LCMPLT;
+                                                               goto icmd_lcmp_if_tail;
+                                                       case ICMD_IFGT:
+                                                               iptr[0].opc = ICMD_IF_LCMPGT;
+                                                               goto icmd_lcmp_if_tail;
+                                                       case ICMD_IFLE:
+                                                               iptr[0].opc = ICMD_IF_LCMPLE;
+                                                               goto icmd_lcmp_if_tail;
+                                                       case ICMD_IFGE:
+                                                               iptr[0].opc = ICMD_IF_LCMPGE;
+                                                               goto icmd_lcmp_if_tail;
+                                                       default:
                                                                OPTT2_1(TYPE_LNG, TYPE_INT);
-                                                       break;
-                                               case ICMD_FCMPL:
-                                               case ICMD_FCMPG:
-                                                       COUNT(count_pcmd_op);
-                                                       OPTT2_1(TYPE_FLT, TYPE_INT);
-                                                       break;
-                                               case ICMD_DCMPL:
-                                               case ICMD_DCMPG:
-                                                       COUNT(count_pcmd_op);
-                                                       OPTT2_1(TYPE_DBL, TYPE_INT);
-                                                       break;
+                                                       }
+                                               }
+                                               else
+#endif
+                                                       OPTT2_1(TYPE_LNG, TYPE_INT);
+                                               break;
+                                       case ICMD_FCMPL:
+                                       case ICMD_FCMPG:
+                                               COUNT(count_pcmd_op);
+                                               OPTT2_1(TYPE_FLT, TYPE_INT);
+                                               break;
+                                       case ICMD_DCMPL:
+                                       case ICMD_DCMPG:
+                                               COUNT(count_pcmd_op);
+                                               OPTT2_1(TYPE_DBL, TYPE_INT);
+                                               break;
 
                                                /* pop 1 push 1 */
                                                
-                                               case ICMD_INEG:
-                                               case ICMD_INT2BYTE:
-                                               case ICMD_INT2CHAR:
-                                               case ICMD_INT2SHORT:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_INT, TYPE_INT);
-                                                       break;
-                                               case ICMD_LNEG:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_LNG, TYPE_LNG);
-                                                       break;
-                                               case ICMD_FNEG:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_FLT, TYPE_FLT);
-                                                       break;
-                                               case ICMD_DNEG:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_DBL, TYPE_DBL);
-                                                       break;
-
-                                               case ICMD_I2L:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_INT, TYPE_LNG);
-                                                       break;
-                                               case ICMD_I2F:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_INT, TYPE_FLT);
-                                                       break;
-                                               case ICMD_I2D:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_INT, TYPE_DBL);
-                                                       break;
-                                               case ICMD_L2I:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_LNG, TYPE_INT);
-                                                       break;
-                                               case ICMD_L2F:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_LNG, TYPE_FLT);
-                                                       break;
-                                               case ICMD_L2D:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_LNG, TYPE_DBL);
-                                                       break;
-                                               case ICMD_F2I:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_FLT, TYPE_INT);
-                                                       break;
-                                               case ICMD_F2L:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_FLT, TYPE_LNG);
-                                                       break;
-                                               case ICMD_F2D:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_FLT, TYPE_DBL);
-                                                       break;
-                                               case ICMD_D2I:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_DBL, TYPE_INT);
-                                                       break;
-                                               case ICMD_D2L:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_DBL, TYPE_LNG);
-                                                       break;
-                                               case ICMD_D2F:
-                                                       COUNT(count_pcmd_op);
-                                                       OP1_1(TYPE_DBL, TYPE_FLT);
-                                                       break;
-
-                                               case ICMD_CHECKCAST:
-                                                       OP1_1(TYPE_ADR, TYPE_ADR);
-                                                       break;
-
-                                               case ICMD_ARRAYLENGTH:
-                                               case ICMD_INSTANCEOF:
-                                                       OP1_1(TYPE_ADR, TYPE_INT);
-                                                       break;
-
-                                               case ICMD_NEWARRAY:
-                                               case ICMD_ANEWARRAY:
-                                                       OP1_1(TYPE_INT, TYPE_ADR);
-                                                       break;
-
-                                               case ICMD_GETFIELD:
-                                                       COUNT(count_check_null);
-                                                       COUNT(count_pcmd_mem);
-                                                       OP1_1(TYPE_ADR, iptr->op1);
-                                                       break;
+                                       case ICMD_INEG:
+                                       case ICMD_INT2BYTE:
+                                       case ICMD_INT2CHAR:
+                                       case ICMD_INT2SHORT:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_INT, TYPE_INT);
+                                               break;
+                                       case ICMD_LNEG:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_LNG, TYPE_LNG);
+                                               break;
+                                       case ICMD_FNEG:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_FLT, TYPE_FLT);
+                                               break;
+                                       case ICMD_DNEG:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_DBL, TYPE_DBL);
+                                               break;
+
+                                       case ICMD_I2L:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_INT, TYPE_LNG);
+                                               break;
+                                       case ICMD_I2F:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_INT, TYPE_FLT);
+                                               break;
+                                       case ICMD_I2D:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_INT, TYPE_DBL);
+                                               break;
+                                       case ICMD_L2I:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_LNG, TYPE_INT);
+                                               break;
+                                       case ICMD_L2F:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_LNG, TYPE_FLT);
+                                               break;
+                                       case ICMD_L2D:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_LNG, TYPE_DBL);
+                                               break;
+                                       case ICMD_F2I:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_FLT, TYPE_INT);
+                                               break;
+                                       case ICMD_F2L:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_FLT, TYPE_LNG);
+                                               break;
+                                       case ICMD_F2D:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_FLT, TYPE_DBL);
+                                               break;
+                                       case ICMD_D2I:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_DBL, TYPE_INT);
+                                               break;
+                                       case ICMD_D2L:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_DBL, TYPE_LNG);
+                                               break;
+                                       case ICMD_D2F:
+                                               COUNT(count_pcmd_op);
+                                               OP1_1(TYPE_DBL, TYPE_FLT);
+                                               break;
+
+                                       case ICMD_CHECKCAST:
+                                               OP1_1(TYPE_ADR, TYPE_ADR);
+                                               break;
+
+                                       case ICMD_ARRAYLENGTH:
+                                       case ICMD_INSTANCEOF:
+                                               OP1_1(TYPE_ADR, TYPE_INT);
+                                               break;
+
+                                       case ICMD_NEWARRAY:
+                                       case ICMD_ANEWARRAY:
+                                               OP1_1(TYPE_INT, TYPE_ADR);
+                                               break;
+
+                                       case ICMD_GETFIELD:
+                                               COUNT(count_check_null);
+                                               COUNT(count_pcmd_mem);
+                                               OP1_1(TYPE_ADR, iptr->op1);
+                                               break;
 
                                                /* pop 0 push 1 */
                                                
-                                               case ICMD_GETSTATIC:
-                                                       COUNT(count_pcmd_mem);
-                                                       OP0_1(iptr->op1);
-                                                       break;
+                                       case ICMD_GETSTATIC:
+                                               COUNT(count_pcmd_mem);
+                                               OP0_1(iptr->op1);
+                                               break;
 
-                                               case ICMD_NEW:
-                                                       OP0_1(TYPE_ADR);
-                                                       break;
+                                       case ICMD_NEW:
+                                               OP0_1(TYPE_ADR);
+                                               break;
 
-                                               case ICMD_JSR:
-                                                       OP0_1(TYPE_ADR);
-                                                       tbptr = block + block_index[iptr->op1];
+                                       case ICMD_JSR:
+                                               OP0_1(TYPE_ADR);
+                                               tbptr = block + block_index[iptr->op1];
 
-                                                       iptr[0].target = (void *) tbptr;
+                                               iptr[0].target = (void *) tbptr;
 
-                                                       tbptr->type=BBTYPE_SBR;
-                                                       MARKREACHED(tbptr, copy);
-                                                       OP1_0ANY;
-                                                       break;
+                                               tbptr->type=BBTYPE_SBR;
+                                               MARKREACHED(tbptr, copy);
+                                               OP1_0ANY;
+                                               break;
 
                                                /* pop many push any */
                                                
-                                               case ICMD_INVOKEVIRTUAL:
-                                               case ICMD_INVOKESPECIAL:
-                                               case ICMD_INVOKEINTERFACE:
-                                               case ICMD_INVOKESTATIC:
-                                                       COUNT(count_pcmd_met);
-                                                       {
+                                       case ICMD_INVOKEVIRTUAL:
+                                       case ICMD_INVOKESPECIAL:
+                                       case ICMD_INVOKEINTERFACE:
+                                       case ICMD_INVOKESTATIC:
+                                               COUNT(count_pcmd_met);
+                                               {
                                                        methodinfo *m = iptr->val.a;
                                                        if (m->flags & ACC_STATIC)
                                                                {COUNT(count_check_null);}
@@ -1522,120 +1558,120 @@ icmd_lcmp_if_tail:
                                                                if (! (copy->flags & SAVEDVAR)) {
                                                                        copy->varkind = ARGVAR;
                                                                        copy->varnum = i;
-                                                                       }
-                                                               copy = copy->prev;
                                                                }
+                                                               copy = copy->prev;
+                                                       }
 #endif
                                                        while (copy) {
                                                                copy->flags |= SAVEDVAR;
                                                                copy = copy->prev;
-                                                               }
+                                                       }
                                                        i = iptr->op1;
                                                        POPMANY(i);
                                                        if (m->returntype != TYPE_VOID) {
                                                                OP0_1(m->returntype);
-                                                               }
-                                                       break;
                                                        }
+                                                       break;
+                                               }
 
-                                               case ICMD_BUILTIN3:
-                                                       if (! (curstack->flags & SAVEDVAR)) {
-                                                               curstack->varkind = ARGVAR;
-                                                               curstack->varnum = 2;
-                                                               }
-                                                       if (3 > arguments_num) {
-                                                               arguments_num = 3;
-                                                       }
-                                                       OP1_0ANY;
+                                       case ICMD_BUILTIN3:
+                                               if (! (curstack->flags & SAVEDVAR)) {
+                                                       curstack->varkind = ARGVAR;
+                                                       curstack->varnum = 2;
+                                               }
+                                               if (3 > arguments_num) {
+                                                       arguments_num = 3;
+                                               }
+                                               OP1_0ANY;
 
-                                               case ICMD_BUILTIN2:
-builtin2:
-                                                       if (! (curstack->flags & SAVEDVAR)) {
-                                                               curstack->varkind = ARGVAR;
-                                                               curstack->varnum = 1;
-                                                               }
-                                                       if (2 > arguments_num) {
-                                                               arguments_num = 2;
-                                                       }
-                                                       OP1_0ANY;
+                                       case ICMD_BUILTIN2:
+                                       builtin2:
+                                       if (! (curstack->flags & SAVEDVAR)) {
+                                               curstack->varkind = ARGVAR;
+                                               curstack->varnum = 1;
+                                       }
+                                       if (2 > arguments_num) {
+                                               arguments_num = 2;
+                                       }
+                                       OP1_0ANY;
 
-                                               case ICMD_BUILTIN1:
-                                                       if (! (curstack->flags & SAVEDVAR)) {
-                                                               curstack->varkind = ARGVAR;
-                                                               curstack->varnum = 0;
-                                                               }
-                                                       if (1 > arguments_num) {
-                                                               arguments_num = 1;
+                                       case ICMD_BUILTIN1:
+                                               if (! (curstack->flags & SAVEDVAR)) {
+                                                       curstack->varkind = ARGVAR;
+                                                       curstack->varnum = 0;
+                                               }
+                                               if (1 > arguments_num) {
+                                                       arguments_num = 1;
+                                               }
+                                               OP1_0ANY;
+                                               copy = curstack;
+                                               while (copy) {
+                                                       copy->flags |= SAVEDVAR;
+                                                       copy = copy->prev;
+                                               }
+                                               if (iptr->op1 != TYPE_VOID)
+                                                       OP0_1(iptr->op1);
+                                               break;
+
+                                       case ICMD_MULTIANEWARRAY:
+                                               i = iptr->op1;
+                                               if ((i + intreg_argnum) > arguments_num)
+                                                       arguments_num = i + intreg_argnum;
+                                               copy = curstack;
+                                               while (--i >= 0) {
+                                                       if (! (copy->flags & SAVEDVAR)) {
+                                                               copy->varkind = ARGVAR;
+                                                               copy->varnum = i + intreg_argnum;
                                                        }
-                                                       OP1_0ANY;
-                                                       copy = curstack;
-                                                       while (copy) {
-                                                               copy->flags |= SAVEDVAR;
-                                                               copy = copy->prev;
-                                                               }
-                                                       if (iptr->op1 != TYPE_VOID)
-                                                               OP0_1(iptr->op1);
-                                                       break;
-
-                                               case ICMD_MULTIANEWARRAY:
-                                                       i = iptr->op1;
-                                                       if ((i + intreg_argnum) > arguments_num)
-                                                               arguments_num = i + intreg_argnum;
-                                                       copy = curstack;
-                                                       while (--i >= 0) {
-                                                               if (! (copy->flags & SAVEDVAR)) {
-                                                                       copy->varkind = ARGVAR;
-                                                                       copy->varnum = i + intreg_argnum;
-                                                                       }
-                                                               copy = copy->prev;
-                                                               }
-                                                       while (copy) {
-                                                               copy->flags |= SAVEDVAR;
-                                                               copy = copy->prev;
-                                                               }
-                                                       i = iptr->op1;
-                                                       POPMANY(i);
-                                                       OP0_1(TYPE_ADR);
-                                                       break;
-
-                                           case ICMD_CLEAR_ARGREN:
-                                                       for (i = iptr->op1; i<maxlocals; i++) 
-                                                               argren[i] = i;
-                                                       iptr->opc = opcode = ICMD_NOP;
-                                                       SETDST;
-                                                       break;
+                                                       copy = copy->prev;
+                                               }
+                                               while (copy) {
+                                                       copy->flags |= SAVEDVAR;
+                                                       copy = copy->prev;
+                                               }
+                                               i = iptr->op1;
+                                               POPMANY(i);
+                                               OP0_1(TYPE_ADR);
+                                               break;
+
+                                       case ICMD_CLEAR_ARGREN:
+                                               for (i = iptr->op1; i<maxlocals; i++) 
+                                                       argren[i] = i;
+                                               iptr->opc = opcode = ICMD_NOP;
+                                               SETDST;
+                                               break;
                                                
-                                           case ICMD_READONLY_ARG:
-                                           case ICMD_READONLY_ARG+1:
-                                           case ICMD_READONLY_ARG+2:
-                                           case ICMD_READONLY_ARG+3:
-                                           case ICMD_READONLY_ARG+4:
-
-                                                       if (curstack->varkind == LOCALVAR) {
-                                                               i = curstack->varnum;
-                                                               argren[iptr->op1] = i;
-                                                               iptr->op1 = i;
-                                                       }
-                                                       opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
-                                                       goto icmd_store;
+                                       case ICMD_READONLY_ARG:
+                                       case ICMD_READONLY_ARG+1:
+                                       case ICMD_READONLY_ARG+2:
+                                       case ICMD_READONLY_ARG+3:
+                                       case ICMD_READONLY_ARG+4:
+
+                                               if (curstack->varkind == LOCALVAR) {
+                                                       i = curstack->varnum;
+                                                       argren[iptr->op1] = i;
+                                                       iptr->op1 = i;
+                                               }
+                                               opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
+                                               goto icmd_store;
 
-                                                       break;
+                                               break;
 
-                                           default:
-                                                       printf("ICMD %d at %d\n", iptr->opc, (int)(iptr-instr));
-                                                       panic("Missing ICMD code during stack analysis");
-                                               } /* switch */
+                                       default:
+                                               printf("ICMD %d at %d\n", iptr->opc, (int)(iptr-instr));
+                                               panic("Missing ICMD code during stack analysis");
+                                       } /* switch */
                                        iptr++;
-                                       } /* while instructions */
+                               } /* while instructions */
                                bptr->outstack = curstack;
                                bptr->outdepth = stackdepth;
                                BBEND(curstack, i);
-                               } /* if */
+                       } /* if */
                        else
                                superblockend = true;
                        bptr++;
                } /* while blocks */
-       } while (repeat && ! deadcode);
+       } while (repeat && !deadcode);
 
 #ifdef STATISTICS
        if (block_count > count_max_basic_blocks)
@@ -1676,9 +1712,9 @@ builtin2:
                                count_block_size_distribution[16]++;
                        else
                                count_block_size_distribution[17]++;
-                       }
-               bptr++;
                }
+               bptr++;
+       }
 
        if (loops == 1)
                count_analyse_iterations[0]++;
@@ -1713,7 +1749,8 @@ builtin2:
 }
 
 
-static void print_stack(stackptr s) {
+static void print_stack(stackptr s)
+{
        int i, j;
        stackptr t;
 
@@ -1723,7 +1760,7 @@ static void print_stack(stackptr s) {
        while (t) {
                i--;
                t = t->prev;
-               }
+       }
        j = maxstack - i;
        while (--i >= 0)
                printf("    ");
@@ -1731,50 +1768,50 @@ static void print_stack(stackptr s) {
                j--;
                if (s->flags & SAVEDVAR)
                        switch (s->varkind) {
-                               case TEMPVAR:
-                                       if (s->flags & INMEMORY)
-                                               printf(" M%02d", s->regoff);
-                                       else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
-                                               printf(" F%02d", s->regoff);
-                                       else
-                                               printf(" %3s", regs[s->regoff]);
-                                       break;
-                               case STACKVAR:
-                                       printf(" I%02d", s->varnum);
-                                       break;
-                               case LOCALVAR:
-                                       printf(" L%02d", s->varnum);
-                                       break;
-                               case ARGVAR:
-                                       printf(" A%02d", s->varnum);
-                                       break;
-                               default:
-                                       printf(" !%02d", j);
-                               }
+                       case TEMPVAR:
+                               if (s->flags & INMEMORY)
+                                       printf(" M%02d", s->regoff);
+                               else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
+                                       printf(" F%02d", s->regoff);
+                               else
+                                       printf(" %3s", regs[s->regoff]);
+                               break;
+                       case STACKVAR:
+                               printf(" I%02d", s->varnum);
+                               break;
+                       case LOCALVAR:
+                               printf(" L%02d", s->varnum);
+                               break;
+                       case ARGVAR:
+                               printf(" A%02d", s->varnum);
+                               break;
+                       default:
+                               printf(" !%02d", j);
+                       }
                else
                        switch (s->varkind) {
-                               case TEMPVAR:
-                                       if (s->flags & INMEMORY)
-                                               printf(" m%02d", s->regoff);
-                                       else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
-                                               printf(" f%02d", s->regoff);
-                                       else
-                                               printf(" %3s", regs[s->regoff]);
-                                       break;
-                               case STACKVAR:
-                                       printf(" i%02d", s->varnum);
-                                       break;
-                               case LOCALVAR:
-                                       printf(" l%02d", s->varnum);
-                                       break;
-                               case ARGVAR:
-                                       printf(" a%02d", s->varnum);
-                                       break;
-                               default:
-                                       printf(" ?%02d", j);
-                               }
+                       case TEMPVAR:
+                               if (s->flags & INMEMORY)
+                                       printf(" m%02d", s->regoff);
+                               else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
+                                       printf(" f%02d", s->regoff);
+                               else
+                                       printf(" %3s", regs[s->regoff]);
+                               break;
+                       case STACKVAR:
+                               printf(" i%02d", s->varnum);
+                               break;
+                       case LOCALVAR:
+                               printf(" l%02d", s->varnum);
+                               break;
+                       case ARGVAR:
+                               printf(" a%02d", s->varnum);
+                               break;
+                       default:
+                               printf(" ?%02d", j);
+                       }
                s = s->prev;
-               }
+       }
 }
 
 
@@ -1783,45 +1820,45 @@ static void print_reg(stackptr s) {
        if (s) {
                if (s->flags & SAVEDVAR)
                        switch (s->varkind) {
-                               case TEMPVAR:
-                                       if (s->flags & INMEMORY)
-                                               printf(" tm%02d", s->regoff);
-                                       else
-                                               printf(" tr%02d", s->regoff);
-                                       break;
-                               case STACKVAR:
-                                       printf(" s %02d", s->varnum);
-                                       break;
-                               case LOCALVAR:
-                                       printf(" l %02d", s->varnum);
-                                       break;
-                               case ARGVAR:
-                                       printf(" a %02d", s->varnum);
-                                       break;
-                               default:
-                                       printf(" ! %02d", s->varnum);
-                               }
+                       case TEMPVAR:
+                               if (s->flags & INMEMORY)
+                                       printf(" tm%02d", s->regoff);
+                               else
+                                       printf(" tr%02d", s->regoff);
+                               break;
+                       case STACKVAR:
+                               printf(" s %02d", s->varnum);
+                               break;
+                       case LOCALVAR:
+                               printf(" l %02d", s->varnum);
+                               break;
+                       case ARGVAR:
+                               printf(" a %02d", s->varnum);
+                               break;
+                       default:
+                               printf(" ! %02d", s->varnum);
+                       }
                else
                        switch (s->varkind) {
-                               case TEMPVAR:
-                                       if (s->flags & INMEMORY)
-                                               printf(" Tm%02d", s->regoff);
-                                       else
-                                               printf(" Tr%02d", s->regoff);
-                                       break;
-                               case STACKVAR:
-                                       printf(" S %02d", s->varnum);
-                                       break;
-                               case LOCALVAR:
-                                       printf(" L %02d", s->varnum);
-                                       break;
-                               case ARGVAR:
-                                       printf(" A %02d", s->varnum);
-                                       break;
-                               default:
-                                       printf(" ? %02d", s->varnum);
-                               }
-               }
+                       case TEMPVAR:
+                               if (s->flags & INMEMORY)
+                                       printf(" Tm%02d", s->regoff);
+                               else
+                                       printf(" Tr%02d", s->regoff);
+                               break;
+                       case STACKVAR:
+                               printf(" S %02d", s->varnum);
+                               break;
+                       case LOCALVAR:
+                               printf(" L %02d", s->varnum);
+                               break;
+                       case ARGVAR:
+                               printf(" A %02d", s->varnum);
+                               break;
+                       default:
+                               printf(" ? %02d", s->varnum);
+                       }
+       }
        else
                printf("     ");
                
@@ -1847,7 +1884,7 @@ static char *jit_type[] = {
 };
 
 
-static void show_icmd_method()
+void show_icmd_method()
 {
        int i, j;
        int deadcode;
@@ -1871,7 +1908,7 @@ static void show_icmd_method()
                printf("    L%03d ... ", ex->start->debug_nr );
                printf("L%03d  = ", ex->end->debug_nr);
                printf("L%03d\n", ex->handler->debug_nr);
-               }
+       }
        
        printf ("Local Table:\n");
        for (i = 0; i < maxlocals; i++) {
@@ -1885,9 +1922,9 @@ static void show_icmd_method()
                                        printf("f%02d", locals[i][j].regoff);
                                else
                                        printf("%3s", regs[locals[i][j].regoff]);
-                               }
+                       }
                printf("\n");
-               }
+       }
        printf("\n");
 
        printf ("Interface Table:\n");
@@ -1906,7 +1943,7 @@ static void show_icmd_method()
                                                        printf("F%02d", interfaces[i][j].regoff);
                                                else
                                                        printf("%3s", regs[interfaces[i][j].regoff]);
-                                               }
+                                       }
                                        else {
                                                if (interfaces[i][j].flags & INMEMORY)
                                                        printf("m%2d", interfaces[i][j].regoff);
@@ -1914,56 +1951,57 @@ static void show_icmd_method()
                                                        printf("f%02d", interfaces[i][j].regoff);
                                                else
                                                        printf("%3s", regs[interfaces[i][j].regoff]);
-                                               }
                                        }
+                               }
                        printf("\n");
-                       }
                }
+       }
        printf("\n");
 
        if (showdisassemble) {
 #if defined(__I386__) || defined(__X86_64__)
                u1 *u1ptr;
+               int a;
 
                u1ptr = method->mcode + dseglen;
                for (i = 0; i < block[0].mpc; i++, u1ptr++) {
-                       disassinstr(u1ptr, i);
-                       i = pstatic;
-                       u1ptr = codestatic;
+                       a = disassinstr(u1ptr, i);
+                       i += a;
+                       u1ptr += a;
                }
                printf("\n");
 #else
                s4ptr = (s4 *) (method->mcode + dseglen);
                for (i = 0; i < block[0].mpc; i += 4, s4ptr++) {
                        disassinstr(*s4ptr, i); 
-                       }
+               }
                printf("\n");
 #endif
-               }
+       }
 
        
-       for (bptr = block; bptr != NULL; bptr = bptr->next)
+       for (bptr = block; bptr != NULL; bptr = bptr->next) {
                if (bptr->flags != BBDELETED) {
-               deadcode = bptr->flags <= BBREACHED;
-               printf("[");
-               if (deadcode)
-                       for (j = maxstack; j > 0; j--)
-                               printf(" ?  ");
-               else
-                       print_stack(bptr->instack);
-               printf("] L%03d(%d - %d):\n", bptr->debug_nr, bptr->icount, bptr->pre_count);
-               iptr = bptr->iinstr;
-
-               for (i=0; i < bptr->icount; i++, iptr++) {
+                       deadcode = bptr->flags <= BBREACHED;
                        printf("[");
-                       if (deadcode) {
+                       if (deadcode)
                                for (j = maxstack; j > 0; j--)
                                        printf(" ?  ");
-                               }
                        else
-                               print_stack(iptr->dst);
-                       printf("]     %4d  %s", i, icmd_names[iptr->opc]);
-                       switch ((int) iptr->opc) {
+                               print_stack(bptr->instack);
+                       printf("] L%03d(%d - %d):\n", bptr->debug_nr, bptr->icount, bptr->pre_count);
+                       iptr = bptr->iinstr;
+
+                       for (i=0; i < bptr->icount; i++, iptr++) {
+                               printf("[");
+                               if (deadcode) {
+                                       for (j = maxstack; j > 0; j--)
+                                               printf(" ?  ");
+                               }
+                               else
+                                       print_stack(iptr->dst);
+                               printf("]     %4d  %s", i, icmd_names[iptr->opc]);
+                               switch ((int) iptr->opc) {
                                case ICMD_IADDCONST:
                                case ICMD_ISUBCONST:
                                case ICMD_IMULCONST:
@@ -2020,7 +2058,7 @@ static void show_icmd_method()
                                case ICMD_GETSTATIC:
                                        printf(" ");
                                        utf_fprint(stdout,
-                                                       ((fieldinfo *) iptr->val.a)->name);
+                                                          ((fieldinfo *) iptr->val.a)->name);
                                        break;
                                case ICMD_IINC:
                                        printf(" %d + %d", iptr->op1, iptr->val.i);
@@ -2063,42 +2101,42 @@ static void show_icmd_method()
                                case ICMD_NEW:
                                        printf(" ");
                                        utf_fprint(stdout,
-                                                      ((classinfo *) iptr->val.a)->name);
+                                                          ((classinfo *) iptr->val.a)->name);
                                        break;
                                case ICMD_NEWARRAY:
                                        switch (iptr->op1) {
-                                               case 4:
-                                                       printf(" boolean");
-                                                       break;
-                                               case 5:
-                                                       printf(" char");
-                                                       break;
-                                               case 6:
-                                                       printf(" float");
-                                                       break;
-                                               case 7:
-                                                       printf(" double");
-                                                       break;
-                                               case 8:
-                                                       printf(" byte");
-                                                       break;
-                                               case 9:
-                                                       printf(" short");
-                                                       break;
-                                               case 10:
-                                                       printf(" int");
-                                                       break;
-                                               case 11:
-                                                       printf(" long");
-                                                       break;
-                                               }
+                                       case 4:
+                                               printf(" boolean");
+                                               break;
+                                       case 5:
+                                               printf(" char");
+                                               break;
+                                       case 6:
+                                               printf(" float");
+                                               break;
+                                       case 7:
+                                               printf(" double");
+                                               break;
+                                       case 8:
+                                               printf(" byte");
+                                               break;
+                                       case 9:
+                                               printf(" short");
+                                               break;
+                                       case 10:
+                                               printf(" int");
+                                               break;
+                                       case 11:
+                                               printf(" long");
+                                               break;
+                                       }
                                        break;
                                case ICMD_ANEWARRAY:
                                        if (iptr->op1) {
                                                printf(" ");
                                                utf_fprint(stdout,
-                                                              ((classinfo *) iptr->val.a)->name);
-                                               }
+                                                                  ((classinfo *) iptr->val.a)->name);
+                                       }
                                        break;
                                case ICMD_CHECKCAST:
                                case ICMD_INSTANCEOF:
@@ -2109,7 +2147,7 @@ static void show_icmd_method()
                                                else
                                                        printf(" (CLASS,%3d) ", c->vftbl->diffval);
                                                utf_fprint(stdout, c->name);
-                                               }
+                                       }
                                        break;
                                case ICMD_BUILTIN3:
                                case ICMD_BUILTIN2:
@@ -2122,10 +2160,10 @@ static void show_icmd_method()
                                case ICMD_INVOKEINTERFACE:
                                        printf(" ");
                                        utf_fprint(stdout,
-                                                      ((methodinfo *) iptr->val.a)->class->name);
+                                                          ((methodinfo *) iptr->val.a)->class->name);
                                        printf(".");
                                        utf_fprint(stdout,
-                                                      ((methodinfo *) iptr->val.a)->name);
+                                                          ((methodinfo *) iptr->val.a)->name);
                                        break;
                                case ICMD_IFEQ:
                                case ICMD_IFNE:
@@ -2169,7 +2207,7 @@ static void show_icmd_method()
                                        tptr = (void **) iptr->target;
 
                                        printf(" L%03d;", ((basicblock *) *tptr)->debug_nr); 
-                                                                                   /* default */
+                                       /* default */
 
                                        s4ptr++;
                                        tptr++;
@@ -2180,7 +2218,7 @@ static void show_icmd_method()
                                                printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
                                                tptr++;
                                                j--;
-                                               }
+                                       }
                                        break;
                                case ICMD_LOOKUPSWITCH:
                                        s4ptr = iptr->val.a;
@@ -2194,68 +2232,58 @@ static void show_icmd_method()
                                        while (--j >= 0) {
                                                printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
                                                tptr++;
-                                               }
+                                       }
                                        break;
                                }
-                       printf("\n");
+                               printf("\n");
                        }
 
-               if (showdisassemble && (!deadcode)) {
+                       if (showdisassemble && (!deadcode)) {
 #if defined(__I386__) || defined(__X86_64__)
-                       u1 *u1ptr;
+                               u1 *u1ptr;
+                               int a;
 
-                       printf("\n");
-                       i = bptr->mpc;
-                       u1ptr = method->mcode + dseglen + i;
-
-                       if (bptr->next != NULL) {
-                               for (; i < bptr->next->mpc; i++, u1ptr++) {
-                                       disassinstr(u1ptr, i);
-                                       i = pstatic;
-                                       u1ptr = codestatic;
-                               }
                                printf("\n");
+                               i = bptr->mpc;
+                               u1ptr = method->mcode + dseglen + i;
+
+                               if (bptr->next != NULL) {
+                                       for (; i < bptr->next->mpc; i++, u1ptr++) {
+                                               a = disassinstr(u1ptr, i);
+                                               i += a;
+                                               u1ptr += a;
+                                       }
+                                       printf("\n");
 
-                       } else {
-                               for (; u1ptr < (u1 *) (method->mcode + method->mcodelength); i++, u1ptr++) {
-                                       disassinstr(u1ptr, i); 
-                                       i = pstatic;
-                                       u1ptr = codestatic;
+                               } else {
+                                       for (; u1ptr < (u1 *) (method->mcode + method->mcodelength); i++, u1ptr++) {
+                                               a = disassinstr(u1ptr, i); 
+                                               i += a;
+                                               u1ptr += a;
+                                       }
+                                       printf("\n");
                                }
-                               printf("\n");
-                       }
 #else
-                       printf("\n");
-                       i = bptr->mpc;
-                       s4ptr = (s4 *) (method->mcode + dseglen + i);
+                               printf("\n");
+                               i = bptr->mpc;
+                               s4ptr = (s4 *) (method->mcode + dseglen + i);
 
-                       if (bptr->next != NULL) {
-                               for (; i < bptr->next->mpc; i += 4, s4ptr++) {
-                                       disassinstr(*s4ptr, i); 
+                               if (bptr->next != NULL) {
+                                       for (; i < bptr->next->mpc; i += 4, s4ptr++) {
+                                               disassinstr(*s4ptr, i); 
                                    }
-                               printf("\n");
+                                       printf("\n");
                            }
-                       else {
-                               for (; s4ptr < (s4 *) (method->mcode + method->mcodelength); i += 4, s4ptr++) {
-                                       disassinstr(*s4ptr, i); 
+                               else {
+                                       for (; s4ptr < (s4 *) (method->mcode + method->mcodelength); i += 4, s4ptr++) {
+                                               disassinstr(*s4ptr, i); 
                                    }
-                               printf("\n");
+                                       printf("\n");
                            }
 #endif
                    }
-       }
-
-       /*
-       i = bptr->mpc;
-       s4ptr = (s4 *) (method->mcode + dseglen + i);
-       if (showdisassemble && (s4ptr < (s4 *) (method->mcode + method->mcodelength))) {
-               printf("\n");
-               for (; s4ptr < (s4 *) (method->mcode + method->mcodelength); i += 4, s4ptr++) {
-                       disassinstr(*s4ptr, i); 
-                       }
-               printf("\n");
                }
-       */
+       }
 }
 
 
diff --git a/src/vm/jit/stack.h b/src/vm/jit/stack.h
new file mode 100644 (file)
index 0000000..a09eac3
--- /dev/null
@@ -0,0 +1,55 @@
+/* jit/stack.h - stack analysis header
+
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Christian Thalinger
+
+   $Id: stack.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _STACK_H
+#define _STACK_H
+
+/* function prototypes */
+void analyse_stack();
+void show_icmd_method();
+
+#endif /* _STACK_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 016054bb82500aaa8fafbcfca66f2fa2a4b2f120..a13cd4ed9eda8bb2d4693f3cb2ceff454b2061f4 100644 (file)
@@ -1,20 +1,38 @@
+/* loader.c - class loader functions
 
-/* loader.c ********************************************************************
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       Copyright (c) 1999 A. Krall, R. Grafl, R. Obermaiser, M. Probst
+   This file is part of CACAO.
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Contains the functions of the class loader.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
-                Roman Obermaiser    EMAIL: cacao@complang.tuwien.ac.at
-                Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-       Last Change: 1999/11/08
+   Contact: cacao@complang.tuwien.ac.at
 
-*******************************************************************************/
+   Authors: Reinhard Grafl
+
+   Changes: Andreas Krall
+            Roman Obermaiser
+            Mark Probst
+
+   $Id: loader.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
 
 #include <assert.h>
@@ -105,15 +123,16 @@ static classinfo *class_java_lang_ThreadDeath;
  ******************************************************************************/
  
 primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = { 
-               { NULL, NULL, "java/lang/Integer",   'I', "int"     },
-               { NULL, NULL, "java/lang/Long",      'J', "long"    },
-               { NULL, NULL, "java/lang/Float",     'F', "float"   },
-               { NULL, NULL, "java/lang/Double",    'D', "double"  },
-               { NULL, NULL, "java/lang/Byte",      'B', "byte"    },
-               { NULL, NULL, "java/lang/Character", 'C', "char"    },
-               { NULL, NULL, "java/lang/Short",     'S', "short"   },
-               { NULL, NULL, "java/lang/Boolean",   'Z', "boolean" },
-               { NULL, NULL, "java/lang/Void",      'V', "void"    }};
+       { NULL, NULL, "java/lang/Integer",   'I', "int"     },
+       { NULL, NULL, "java/lang/Long",      'J', "long"    },
+       { NULL, NULL, "java/lang/Float",     'F', "float"   },
+       { NULL, NULL, "java/lang/Double",    'D', "double"  },
+       { NULL, NULL, "java/lang/Byte",      'B', "byte"    },
+       { NULL, NULL, "java/lang/Character", 'C', "char"    },
+       { NULL, NULL, "java/lang/Short",     'S', "short"   },
+       { NULL, NULL, "java/lang/Boolean",   'Z', "boolean" },
+       { NULL, NULL, "java/lang/Void",      'V', "void"    }
+};
 
 
 /* instances of important system classes **************************************/
@@ -2538,7 +2557,7 @@ classinfo *create_array_class(utf *u)
 
 *******************************************************************************/
  
-void loader_init ()
+void loader_init()
 {
        utf *string_class;
        interfaceindex = 0;
@@ -2777,4 +2796,3 @@ void loader_close ()
  * tab-width: 4
  * End:
  */
-
index e732a1482c45e88aa73d7bd0ea3126cd311b2983..afb29456f4be614076ca42911ffe2f8e3b544803 100644 (file)
@@ -1,18 +1,38 @@
-/******************************* loader.h **************************************
+/* loader.c - class loader header
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains the prototypes for the class loader.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1997/11/14
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
+   Authors: Reinhard Grafl
 
+   $Id: loader.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _LOADER_H
+#define _LOADER_H
 
 /************************* program switches ***********************************/
 
@@ -69,8 +89,10 @@ bool class_issubclass (classinfo *sub, classinfo *super);
 void class_init (classinfo *c);
 
 /* debug purposes */
-void class_showmethods (classinfo *c);
 void class_showconstantpool (classinfo *c);
+void class_showmethods (classinfo *c);
+
+classinfo *loader_load(utf *topname);
 
 /* set buffer for reading classdata */
 void classload_buffer(u1 *buf,int len);
@@ -86,3 +108,19 @@ extern void class_link (classinfo *c);
 void field_display (fieldinfo *f);
 
 void method_display(methodinfo *m);
+
+#endif /* _LOADER_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b0823e6b5d56365117e800cc7d671edc59a62f18..a9e6bd7eef45d33c78d3ba06c2b778507001272f 100644 (file)
@@ -1,35 +1,58 @@
-/* -*- mode: c; tab-width: 4; c-basic-offset: 4 -*- */
-/****************************** tables.c ***************************************
+/* tables.c - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains support functions for:
-               - Reading of Java class files
-               - Unicode symbols
-               - the heap
-               - additional support functions
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                       
-       Last Change: 1998/03/24
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+
+   Changes: Mark Probst
+            Andreas Krall
+
+   Contains support functions for:
+       - Reading of Java class files
+       - Unicode symbols
+       - the heap
+       - additional support functions
+
+   $Id: tables.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include <assert.h>
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <unistd.h>
+#include "types.h"
 #include "global.h"
 #include "tables.h"
 #include "asmpart.h"
-#include "callargs.h"
-
-#include "threads/thread.h"                  /* schani */
+#include "threads/thread.h"
 #include "threads/locks.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
 
 bool runverbose = false;
 
@@ -65,10 +88,10 @@ void init_hashtable(hashtable *hash, u4 size)
 
        hash->entries = 0;
        hash->size    = size;
-       hash->ptr     = MNEW (void*, size);
+       hash->ptr     = MNEW(void*, size);
 
        /* clear table */
-       for (i=0; i<size; i++) hash->ptr[i] = NULL;
+       for (i = 0; i < size; i++) hash->ptr[i] = NULL;
 }
 
 /*********************** function: tables_init  *****************************
@@ -104,15 +127,15 @@ void tables_close (stringdeleter del)
        
        /* dispose utf symbols */
        for (i=0; i<utf_hash.size; i++) {
-       u = utf_hash.ptr[i];
+               u = utf_hash.ptr[i];
                while (u) {
                        /* process elements in external hash chain */
                        utf *nextu = u->hashlink;
                        MFREE (u->text, u1, u->blength);
                        FREE (u, utf);
                        u = nextu;
-                       }       
-               }
+               }       
+       }
 
        /* dispose javastrings */
        for (i=0; i<string_hash.size; i++) {
@@ -123,8 +146,8 @@ void tables_close (stringdeleter del)
                        del(s->string);
                        FREE(s, literalstring);
                        s = nexts;
-                       }       
-               }
+               }       
+       }
 
        /* dispose hashtable structures */
        MFREE (utf_hash.ptr,    void*, utf_hash.size);
@@ -148,7 +171,7 @@ void utf_display (utf *u)
                /* read next unicode character */                
                u2 c = utf_nextu2(&utf_ptr);                            
                if (c>=32 && c<=127) printf ("%c",c);
-                               else printf ("?");
+               else printf ("?");
        }
 
        fflush (stdout);
@@ -191,8 +214,8 @@ void utf_fprint (FILE *file, utf *u)
                u2 c = utf_nextu2(&utf_ptr);                            
 
                if (c>=32 && c<=127) fprintf (file,"%c",c);
-                               else fprintf (file,"?");
-               }
+               else fprintf (file,"?");
+       }
 } 
 
 
@@ -227,71 +250,71 @@ static u4 utf_hashkey (char *text, u4 length)
        case 8: return fbs(0) ^ nbs(1) ^ nbs(2) ^ nbs(3) ^ nbs(4) ^ nbs(5) ^ nbs(6) ^ nbs(7);
 
        case 9: a = fbs(0) ^ nbs(1) ^ nbs(2);                
-                text++; 
-                return a ^ nbs(4) ^ nbs(5) ^ nbs(6) ^ nbs(7) ^ nbs(8);
+               text++; 
+               return a ^ nbs(4) ^ nbs(5) ^ nbs(6) ^ nbs(7) ^ nbs(8);
 
        case 10: a = fbs(0);
-                 text++;
-                 a^= nbs(2) ^ nbs(3) ^ nbs(4);
-                 text++;
-                 return a ^ nbs(6) ^ nbs(7) ^ nbs(8) ^ nbs(9);
+               text++;
+               a^= nbs(2) ^ nbs(3) ^ nbs(4);
+               text++;
+               return a ^ nbs(6) ^ nbs(7) ^ nbs(8) ^ nbs(9);
 
        case 11: a = fbs(0);
-                 text++;
-                 a^= nbs(2) ^ nbs(3) ^ nbs(4);
-                 text++;
-                 return a ^ nbs(6) ^ nbs(7) ^ nbs(8) ^ nbs(9) ^ nbs(10);
+               text++;
+               a^= nbs(2) ^ nbs(3) ^ nbs(4);
+               text++;
+               return a ^ nbs(6) ^ nbs(7) ^ nbs(8) ^ nbs(9) ^ nbs(10);
 
        case 12: a = fbs(0);
-                 text+=2;
-                 a^= nbs(2) ^ nbs(3);
-                 text+=1;
-                 a^= nbs(5) ^ nbs(6) ^ nbs(7);
-                 text+=1;
-                 return a ^ nbs(9) ^ nbs(10);     
+               text+=2;
+               a^= nbs(2) ^ nbs(3);
+               text+=1;
+               a^= nbs(5) ^ nbs(6) ^ nbs(7);
+               text+=1;
+               return a ^ nbs(9) ^ nbs(10);       
 
        case 13: a = fbs(0) ^ nbs(1);
-                 text+=1;      
-                 a^= nbs(3) ^ nbs(4);
-                 text+=2;      
-                 a^= nbs(7) ^ nbs(8);
-                 text+=2;
-                 return a ^ nbs(9) ^ nbs(10);
+               text+=1;        
+               a^= nbs(3) ^ nbs(4);
+               text+=2;        
+               a^= nbs(7) ^ nbs(8);
+               text+=2;
+               return a ^ nbs(9) ^ nbs(10);
 
        case 14: a = fbs(0);
-                 text+=2;      
-                 a^= nbs(3) ^ nbs(4);
-                 text+=2;      
-                 a^= nbs(7) ^ nbs(8);
-                 text+=2;
-                 return a ^ nbs(9) ^ nbs(10) ^ nbs(11);
+               text+=2;        
+               a^= nbs(3) ^ nbs(4);
+               text+=2;        
+               a^= nbs(7) ^ nbs(8);
+               text+=2;
+               return a ^ nbs(9) ^ nbs(10) ^ nbs(11);
 
        case 15: a = fbs(0);
-                 text+=2;      
-                 a^= nbs(3) ^ nbs(4);
-                 text+=2;      
-                 a^= nbs(7) ^ nbs(8);
-                 text+=2;
-                 return a ^ nbs(9) ^ nbs(10) ^ nbs(11);
+               text+=2;        
+               a^= nbs(3) ^ nbs(4);
+               text+=2;        
+               a^= nbs(7) ^ nbs(8);
+               text+=2;
+               return a ^ nbs(9) ^ nbs(10) ^ nbs(11);
 
        default:  /* 3 characters from beginning */
-                  a = fbs(0);
-                  text+=2;
-                  a^= nbs(3) ^ nbs(4);
+               a = fbs(0);
+               text+=2;
+               a^= nbs(3) ^ nbs(4);
 
-                  /* 2 characters from middle */
-                  text = start_pos + (length / 2);
-                  a^= fbs(5);
-                  text+=2;
-                  a^= nbs(6);  
+               /* 2 characters from middle */
+               text = start_pos + (length / 2);
+               a^= fbs(5);
+               text+=2;
+               a^= nbs(6);     
 
-                  /* 3 characters from end */
-                  text = start_pos + length - 4;
+               /* 3 characters from end */
+               text = start_pos + length - 4;
 
-                  a^= fbs(7);
-                  text+=1;
+               a^= fbs(7);
+               text+=1;
 
-                  return a ^ nbs(10) ^ nbs(11);
+               return a ^ nbs(10) ^ nbs(11);
     }
 }
 
@@ -349,7 +372,7 @@ utf *utf_new (char *text, u2 length)
                        /* symbol found in hashtable */                                 
                        return u;
                }
-               nomatch:
+       nomatch:
                u = u->hashlink; /* next element in external chain */
        }
 
@@ -372,36 +395,36 @@ utf *utf_new (char *text, u2 length)
         /* reorganization of hashtable, average length of 
            the external chains is approx. 2                */  
 
-         u4 i;
-         utf *u;
-         hashtable newhash; /* the new hashtable */
+               u4 i;
+               utf *u;
+               hashtable newhash; /* the new hashtable */
 
-         /* create new hashtable, double the size */
-         init_hashtable(&newhash, utf_hash.size*2);
-         newhash.entries=utf_hash.entries;
+               /* create new hashtable, double the size */
+               init_hashtable(&newhash, utf_hash.size*2);
+               newhash.entries=utf_hash.entries;
 
 #ifdef STATISTICS
-         count_utf_len += sizeof(utf*) * utf_hash.size;
+               count_utf_len += sizeof(utf*) * utf_hash.size;
 #endif
 
-         /* transfer elements to new hashtable */
-         for (i=0; i<utf_hash.size; i++) {
-               u = (utf*) utf_hash.ptr[i];
-               while (u) {
-                       utf *nextu = u -> hashlink;
-                       u4 slot = (utf_hashkey(u->text,u->blength)) & (newhash.size-1);
+               /* transfer elements to new hashtable */
+               for (i=0; i<utf_hash.size; i++) {
+                       u = (utf*) utf_hash.ptr[i];
+                       while (u) {
+                               utf *nextu = u -> hashlink;
+                               u4 slot = (utf_hashkey(u->text,u->blength)) & (newhash.size-1);
                                                
-                       u->hashlink = (utf*) newhash.ptr[slot];
-                       newhash.ptr[slot] = u;
+                               u->hashlink = (utf*) newhash.ptr[slot];
+                               newhash.ptr[slot] = u;
 
-                       /* follow link in external hash chain */
-                       u = nextu;
+                               /* follow link in external hash chain */
+                               u = nextu;
                        }
                }
        
-         /* dispose old table */
-         MFREE (utf_hash.ptr, void*, utf_hash.size);
-         utf_hash = newhash;
+               /* dispose old table */
+               MFREE (utf_hash.ptr, void*, utf_hash.size);
+               utf_hash = newhash;
        }
        
        return u;
@@ -452,14 +475,14 @@ void utf_show ()
                                utf_display (u);
                                printf ("' ");
                                u = u->hashlink;
-                               }       
+                       }       
                        printf ("\n");
-                       }
-               
                }
+               
+       }
 
        printf ("UTF-HASH: %d slots for %d entries\n", 
-                (int) utf_hash.size, (int) utf_hash.entries );
+                       (int) utf_hash.size, (int) utf_hash.entries );
 
 
        if (utf_hash.entries == 0)
@@ -480,7 +503,7 @@ void utf_show ()
                while (u) {
                        u = u->hashlink;
                        chain_length++;
-                       }
+               }
 
                /* update sum of all chainlengths */
                sum_chainlength+=chain_length;
@@ -497,7 +520,7 @@ void utf_show ()
 
                /* update number of hashchains of current length */
                chain_count[chain_length]++;
-               }
+       }
 
        /* display results */  
        for (i=1;i<CHAIN_LIMIT-1;i++) 
@@ -524,11 +547,11 @@ void utf_show ()
        
 ******************************************************************************/
 
-u2 desc_to_type (utf *descriptor)
+u2 desc_to_type(utf *descriptor)
 {
        char *utf_ptr = descriptor->text;  /* current position in utf text */
 
-       if (descriptor->blength < 1) panic ("Type-Descriptor is empty string");
+       if (descriptor->blength < 1) panic("Type-Descriptor is empty string");
        
        switch (*utf_ptr++) {
        case 'B': 
@@ -543,9 +566,10 @@ u2 desc_to_type (utf *descriptor)
        case '[':  return TYPE_ADDRESS;
        }
                        
-       sprintf (logtext, "Invalid Type-Descriptor: "); 
-       utf_sprint (logtext+strlen(logtext), descriptor);
-       error (); 
+       sprintf(logtext, "Invalid Type-Descriptor: ");
+       utf_sprint(logtext+strlen(logtext), descriptor);
+       error();
+
        return 0;
 }
 
@@ -589,37 +613,38 @@ u2 utf_nextu2(char **utf_ptr)
     int len;           
        
     switch ((ch1 = utf[0]) >> 4) {
-      default: /* 1 byte */
-               (*utf_ptr)++;
-               return ch1;
-       case 0xC: 
-       case 0xD: /* 2 bytes */
-                 if (((ch2 = utf[1]) & 0xC0) == 0x80) {
-                   unsigned char high = ch1 & 0x1F;
-                   unsigned char low  = ch2 & 0x3F;
-                   unicode_char = (high << 6) + low;
-                   len = 2;
-                 
-                 break;
-
-       case 0xE: /* 2 or 3 bytes */
-                 if (((ch2 = utf[1]) & 0xC0) == 0x80) {
-                    if (((ch3 = utf[2]) & 0xC0) == 0x80) {
-                       unsigned char low  = ch3 & 0x3f;
-                       unsigned char mid  = ch2 & 0x3f;
-                       unsigned char high = ch1 & 0x0f;
-                       unicode_char = (((high << 6) + mid) << 6) + low;
-                       len = 3;
-                    } else
-                       len = 2;                                           
-                }
-                 break;
+       default: /* 1 byte */
+               (*utf_ptr)++;
+               return ch1;
+       case 0xC: 
+       case 0xD: /* 2 bytes */
+               if (((ch2 = utf[1]) & 0xC0) == 0x80) {
+                       unsigned char high = ch1 & 0x1F;
+                       unsigned char low  = ch2 & 0x3F;
+                       unicode_char = (high << 6) + low;
+                       len = 2;
+               } 
+               break;
+
+       case 0xE: /* 2 or 3 bytes */
+               if (((ch2 = utf[1]) & 0xC0) == 0x80) {
+                       if (((ch3 = utf[2]) & 0xC0) == 0x80) {
+                               unsigned char low  = ch3 & 0x3f;
+                               unsigned char mid  = ch2 & 0x3f;
+                               unsigned char high = ch1 & 0x0f;
+                               unicode_char = (((high << 6) + mid) << 6) + low;
+                               len = 3;
+                       } else
+                               len = 2;                                           
+               }
+               break;
     }
 
     /* update position in utf-text */
     *utf_ptr = (char *) (utf + len);
     return unicode_char;
 }
+
  
 /******************** Function: class_new **************************************
 
@@ -629,7 +654,7 @@ u2 utf_nextu2(char **utf_ptr)
 
 *******************************************************************************/
 
-classinfo *class_new (utf *u)
+classinfo *class_new(utf *u)
 {
        classinfo *c;     /* hashtable element */ 
        u4 key;           /* hashkey computed from classname */   
@@ -646,13 +671,13 @@ classinfo *class_new (utf *u)
                        for (i=0; i<u->blength; i++) 
                                if (u->text[i] != c->name->text[i]) goto nomatch;
                                                
-                               /* class found in hashtable */                                                                  
-                               return c;
-                       }
+                       /* class found in hashtable */                                                                  
+                       return c;
+               }
                        
-               nomatch:
+       nomatch:
                c = c->hashlink; /* next element in external chain */
-               }
+       }
 
        /* location in hashtable found, create new classinfo structure */
 
@@ -660,33 +685,33 @@ classinfo *class_new (utf *u)
        count_class_infos += sizeof(classinfo);
 #endif
 
-       c = NEW (classinfo);
-       c -> flags = 0;
-       c -> name = u;
-       c -> cpcount = 0;
-       c -> cptags = NULL;
-       c -> cpinfos = NULL;
-       c -> super = NULL;
-       c -> sub = NULL;
-       c -> nextsub = NULL;
-       c -> interfacescount = 0;
-       c -> interfaces = NULL;
-       c -> fieldscount = 0;
-       c -> fields = NULL;
-       c -> methodscount = 0;
-       c -> methods = NULL;
-       c -> linked = false;
-       c -> index = 0;
-       c -> instancesize = 0;
-       c -> header.vftbl = NULL;
-       c -> innerclasscount = 0;
-       c -> innerclass = NULL;
-       c -> vftbl = NULL;
-       c -> initialized = false;
-       c -> classvftbl = false;
+       c = NEW(classinfo);
+       c->flags = 0;
+       c->name = u;
+       c->cpcount = 0;
+       c->cptags = NULL;
+       c->cpinfos = NULL;
+       c->super = NULL;
+       c->sub = NULL;
+       c->nextsub = NULL;
+       c->interfacescount = 0;
+       c->interfaces = NULL;
+       c->fieldscount = 0;
+       c->fields = NULL;
+       c->methodscount = 0;
+       c->methods = NULL;
+       c->linked = false;
+       c->index = 0;
+       c->instancesize = 0;
+       c->header.vftbl = NULL;
+       c->innerclasscount = 0;
+       c->innerclass = NULL;
+       c->vftbl = NULL;
+       c->initialized = false;
+       c->classvftbl = false;
        
        /* prepare loading of the class */
-       list_addlast (&unloadedclasses, c);
+       list_addlast(&unloadedclasses, c);
 
        /* insert class into the hashtable */
        c->hashlink = class_hash.ptr[slot];
@@ -695,36 +720,36 @@ classinfo *class_new (utf *u)
        /* update number of hashtable-entries */
        class_hash.entries++;
 
-       if ( class_hash.entries > (class_hash.size*2)) {  
+       if (class_hash.entries > (class_hash.size*2)) {  
 
-          /* reorganization of hashtable, average length of 
-             the external chains is approx. 2                */  
+               /* reorganization of hashtable, average length of 
+                  the external chains is approx. 2                */  
 
-         u4 i;
-         classinfo *c;
-         hashtable newhash;  /* the new hashtable */
+               u4 i;
+               classinfo *c;
+               hashtable newhash;  /* the new hashtable */
 
-         /* create new hashtable, double the size */
-         init_hashtable(&newhash, class_hash.size*2);
-         newhash.entries = class_hash.entries;
+               /* create new hashtable, double the size */
+               init_hashtable(&newhash, class_hash.size*2);
+               newhash.entries = class_hash.entries;
 
-         /* transfer elements to new hashtable */
-         for (i=0; i<class_hash.size; i++) {
-               c = (classinfo*) class_hash.ptr[i];
-               while (c) {
-                       classinfo *nextc = c -> hashlink;
-                       u4 slot = (utf_hashkey(c->name->text,c->name->blength)) & (newhash.size-1);
+               /* transfer elements to new hashtable */
+               for (i = 0; i < class_hash.size; i++) {
+                       c = (classinfo*) class_hash.ptr[i];
+                       while (c) {
+                               classinfo *nextc = c->hashlink;
+                               u4 slot = (utf_hashkey(c->name->text, c->name->blength)) & (newhash.size - 1);
                                                
-                       c->hashlink = newhash.ptr[slot];
-                       newhash.ptr[slot] = c;
+                               c->hashlink = newhash.ptr[slot];
+                               newhash.ptr[slot] = c;
 
-                       c = nextc;
+                               c = nextc;
                        }
                }
        
-         /* dispose old table */       
-         MFREE (class_hash.ptr, void*, class_hash.size);
-         class_hash = newhash;
+               /* dispose old table */ 
+               MFREE(class_hash.ptr, void*, class_hash.size);
+               class_hash = newhash;
        }
                        
        return c;
@@ -737,7 +762,7 @@ classinfo *class_new (utf *u)
 
 *******************************************************************************/
 
-classinfo *class_get (utf *u)
+classinfo *class_get(utf *u)
 {
        classinfo *c;  /* hashtable element */ 
        u4 key;        /* hashkey computed from classname */   
@@ -758,11 +783,11 @@ classinfo *class_get (utf *u)
 
                        /* class found in hashtable */                          
                        return c;
-                       }
+               }
                        
-               nomatch:
+       nomatch:
                c = c->hashlink;
-               }
+       }
 
        /* class not found */
        return NULL;
@@ -782,40 +807,28 @@ u4 utf_strlen(utf *u)
     u4 len = 0;                         /* number of unicode characters   */
 
     while (utf_ptr<endpos) {
-      len++;
-      /* next unicode character */
-      utf_nextu2(&utf_ptr);
+               len++;
+               /* next unicode character */
+               utf_nextu2(&utf_ptr);
     }
 
     if (utf_ptr!=endpos)
        /* string ended abruptly */
-       panic("illegal utf string"); 
+               panic("illegal utf string"); 
 
     return len;
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 8ae42bcf457bc775e5348352972e4cc1e66cd89d..a386c42acf5f8275a76cc6e5c6e44a25c8e2c454 100644 (file)
@@ -1,15 +1,40 @@
-/****************************** tables.h ***************************************
+/* tables.h - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Last Change: 1996/11/20
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-*******************************************************************************/
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+
+   $Id: tables.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _TABLES_H
+#define _TABLES_H
+
+#include <stdio.h>
 #include "global.h" /* for unicode. -- phil */
 
 #define CLASS(name)     (unicode_getclasslink(unicode_new_char(name)))
@@ -22,25 +47,25 @@ extern bool collectverbose;
 extern list unloadedclasses;
 
 /* function for disposing javastrings */
-typedef void (*stringdeleter) ( java_objectheader *string );
+typedef void (*stringdeleter) (java_objectheader *string);
     
 /* creates hashtables for symboltables */
-void tables_init ();
+void tables_init();
 
 /* free memory for hashtables */ 
-void tables_close (stringdeleter del);
+void tables_close(stringdeleter del);
 
 /* write utf symbol to file/buffer */
-void utf_sprint (char *buffer, utf *u);
-void utf_fprint (FILE *file, utf *u);
-void utf_display (utf *u);
+void utf_sprint(char *buffer, utf *u);
+void utf_fprint(FILE *file, utf *u);
+void utf_display(utf *u);
 
 /* create new utf-symbol */
-utf *utf_new (char *text, u2 length);
-utf *utf_new_char (char *text);
+utf *utf_new(char *text, u2 length);
+utf *utf_new_char(char *text);
 
 /* show utf-table */
-void utf_show ();
+void utf_show();
 
 /* get next unicode character of a utf-string */
 u2 utf_nextu2(char **utf);
@@ -49,34 +74,41 @@ u2 utf_nextu2(char **utf);
 u4 utf_strlen(utf *u);
 
 /* search for class and create it if not found */
-classinfo *class_new (utf *u);
+classinfo *class_new(utf *u);
 
 /* get javatype according to a typedescriptor */
-u2 desc_to_type (utf *descriptor);
+u2 desc_to_type(utf *descriptor);
 
 /* get length of a datatype */
-u2 desc_typesize (utf *descriptor);
+u2 desc_typesize(utf *descriptor);
 
 /* determine hashkey of a unicode-symbol */
-u4 unicode_hashkey (u2 *text, u2 length);
+u4 unicode_hashkey(u2 *text, u2 length);
 
 /* create hashtable */
 void init_hashtable(hashtable *hash, u4 size);
 
 /* search for class in classtable */
-classinfo *class_get (utf *u);
+classinfo *class_get(utf *u);
 
 
 void heap_init (u4 size, u4 startsize, void **stackbottom);
-void heap_close ();
-void *heap_allocate (u4 bytelength, bool references, methodinfo *finalizer);
-void heap_addreference (void **reflocation);
-
-void gc_init (void);
-void gc_thread (void);
-void gc_call (void);
-
-
-
-
-
+void heap_close();
+void *heap_allocate(u4 bytelength, bool references, methodinfo *finalizer);
+void heap_addreference(void **reflocation);
+
+#endif /* _TABLES_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index b0823e6b5d56365117e800cc7d671edc59a62f18..a9e6bd7eef45d33c78d3ba06c2b778507001272f 100644 (file)
--- a/tables.c
+++ b/tables.c
@@ -1,35 +1,58 @@
-/* -*- mode: c; tab-width: 4; c-basic-offset: 4 -*- */
-/****************************** tables.c ***************************************
+/* tables.c - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains support functions for:
-               - Reading of Java class files
-               - Unicode symbols
-               - the heap
-               - additional support functions
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-       Changes: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-                Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                       
-       Last Change: 1998/03/24
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+
+   Changes: Mark Probst
+            Andreas Krall
+
+   Contains support functions for:
+       - Reading of Java class files
+       - Unicode symbols
+       - the heap
+       - additional support functions
+
+   $Id: tables.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include <assert.h>
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <unistd.h>
+#include "types.h"
 #include "global.h"
 #include "tables.h"
 #include "asmpart.h"
-#include "callargs.h"
-
-#include "threads/thread.h"                  /* schani */
+#include "threads/thread.h"
 #include "threads/locks.h"
+#include "toolbox/loging.h"
+#include "toolbox/memory.h"
+
 
 bool runverbose = false;
 
@@ -65,10 +88,10 @@ void init_hashtable(hashtable *hash, u4 size)
 
        hash->entries = 0;
        hash->size    = size;
-       hash->ptr     = MNEW (void*, size);
+       hash->ptr     = MNEW(void*, size);
 
        /* clear table */
-       for (i=0; i<size; i++) hash->ptr[i] = NULL;
+       for (i = 0; i < size; i++) hash->ptr[i] = NULL;
 }
 
 /*********************** function: tables_init  *****************************
@@ -104,15 +127,15 @@ void tables_close (stringdeleter del)
        
        /* dispose utf symbols */
        for (i=0; i<utf_hash.size; i++) {
-       u = utf_hash.ptr[i];
+               u = utf_hash.ptr[i];
                while (u) {
                        /* process elements in external hash chain */
                        utf *nextu = u->hashlink;
                        MFREE (u->text, u1, u->blength);
                        FREE (u, utf);
                        u = nextu;
-                       }       
-               }
+               }       
+       }
 
        /* dispose javastrings */
        for (i=0; i<string_hash.size; i++) {
@@ -123,8 +146,8 @@ void tables_close (stringdeleter del)
                        del(s->string);
                        FREE(s, literalstring);
                        s = nexts;
-                       }       
-               }
+               }       
+       }
 
        /* dispose hashtable structures */
        MFREE (utf_hash.ptr,    void*, utf_hash.size);
@@ -148,7 +171,7 @@ void utf_display (utf *u)
                /* read next unicode character */                
                u2 c = utf_nextu2(&utf_ptr);                            
                if (c>=32 && c<=127) printf ("%c",c);
-                               else printf ("?");
+               else printf ("?");
        }
 
        fflush (stdout);
@@ -191,8 +214,8 @@ void utf_fprint (FILE *file, utf *u)
                u2 c = utf_nextu2(&utf_ptr);                            
 
                if (c>=32 && c<=127) fprintf (file,"%c",c);
-                               else fprintf (file,"?");
-               }
+               else fprintf (file,"?");
+       }
 } 
 
 
@@ -227,71 +250,71 @@ static u4 utf_hashkey (char *text, u4 length)
        case 8: return fbs(0) ^ nbs(1) ^ nbs(2) ^ nbs(3) ^ nbs(4) ^ nbs(5) ^ nbs(6) ^ nbs(7);
 
        case 9: a = fbs(0) ^ nbs(1) ^ nbs(2);                
-                text++; 
-                return a ^ nbs(4) ^ nbs(5) ^ nbs(6) ^ nbs(7) ^ nbs(8);
+               text++; 
+               return a ^ nbs(4) ^ nbs(5) ^ nbs(6) ^ nbs(7) ^ nbs(8);
 
        case 10: a = fbs(0);
-                 text++;
-                 a^= nbs(2) ^ nbs(3) ^ nbs(4);
-                 text++;
-                 return a ^ nbs(6) ^ nbs(7) ^ nbs(8) ^ nbs(9);
+               text++;
+               a^= nbs(2) ^ nbs(3) ^ nbs(4);
+               text++;
+               return a ^ nbs(6) ^ nbs(7) ^ nbs(8) ^ nbs(9);
 
        case 11: a = fbs(0);
-                 text++;
-                 a^= nbs(2) ^ nbs(3) ^ nbs(4);
-                 text++;
-                 return a ^ nbs(6) ^ nbs(7) ^ nbs(8) ^ nbs(9) ^ nbs(10);
+               text++;
+               a^= nbs(2) ^ nbs(3) ^ nbs(4);
+               text++;
+               return a ^ nbs(6) ^ nbs(7) ^ nbs(8) ^ nbs(9) ^ nbs(10);
 
        case 12: a = fbs(0);
-                 text+=2;
-                 a^= nbs(2) ^ nbs(3);
-                 text+=1;
-                 a^= nbs(5) ^ nbs(6) ^ nbs(7);
-                 text+=1;
-                 return a ^ nbs(9) ^ nbs(10);     
+               text+=2;
+               a^= nbs(2) ^ nbs(3);
+               text+=1;
+               a^= nbs(5) ^ nbs(6) ^ nbs(7);
+               text+=1;
+               return a ^ nbs(9) ^ nbs(10);       
 
        case 13: a = fbs(0) ^ nbs(1);
-                 text+=1;      
-                 a^= nbs(3) ^ nbs(4);
-                 text+=2;      
-                 a^= nbs(7) ^ nbs(8);
-                 text+=2;
-                 return a ^ nbs(9) ^ nbs(10);
+               text+=1;        
+               a^= nbs(3) ^ nbs(4);
+               text+=2;        
+               a^= nbs(7) ^ nbs(8);
+               text+=2;
+               return a ^ nbs(9) ^ nbs(10);
 
        case 14: a = fbs(0);
-                 text+=2;      
-                 a^= nbs(3) ^ nbs(4);
-                 text+=2;      
-                 a^= nbs(7) ^ nbs(8);
-                 text+=2;
-                 return a ^ nbs(9) ^ nbs(10) ^ nbs(11);
+               text+=2;        
+               a^= nbs(3) ^ nbs(4);
+               text+=2;        
+               a^= nbs(7) ^ nbs(8);
+               text+=2;
+               return a ^ nbs(9) ^ nbs(10) ^ nbs(11);
 
        case 15: a = fbs(0);
-                 text+=2;      
-                 a^= nbs(3) ^ nbs(4);
-                 text+=2;      
-                 a^= nbs(7) ^ nbs(8);
-                 text+=2;
-                 return a ^ nbs(9) ^ nbs(10) ^ nbs(11);
+               text+=2;        
+               a^= nbs(3) ^ nbs(4);
+               text+=2;        
+               a^= nbs(7) ^ nbs(8);
+               text+=2;
+               return a ^ nbs(9) ^ nbs(10) ^ nbs(11);
 
        default:  /* 3 characters from beginning */
-                  a = fbs(0);
-                  text+=2;
-                  a^= nbs(3) ^ nbs(4);
+               a = fbs(0);
+               text+=2;
+               a^= nbs(3) ^ nbs(4);
 
-                  /* 2 characters from middle */
-                  text = start_pos + (length / 2);
-                  a^= fbs(5);
-                  text+=2;
-                  a^= nbs(6);  
+               /* 2 characters from middle */
+               text = start_pos + (length / 2);
+               a^= fbs(5);
+               text+=2;
+               a^= nbs(6);     
 
-                  /* 3 characters from end */
-                  text = start_pos + length - 4;
+               /* 3 characters from end */
+               text = start_pos + length - 4;
 
-                  a^= fbs(7);
-                  text+=1;
+               a^= fbs(7);
+               text+=1;
 
-                  return a ^ nbs(10) ^ nbs(11);
+               return a ^ nbs(10) ^ nbs(11);
     }
 }
 
@@ -349,7 +372,7 @@ utf *utf_new (char *text, u2 length)
                        /* symbol found in hashtable */                                 
                        return u;
                }
-               nomatch:
+       nomatch:
                u = u->hashlink; /* next element in external chain */
        }
 
@@ -372,36 +395,36 @@ utf *utf_new (char *text, u2 length)
         /* reorganization of hashtable, average length of 
            the external chains is approx. 2                */  
 
-         u4 i;
-         utf *u;
-         hashtable newhash; /* the new hashtable */
+               u4 i;
+               utf *u;
+               hashtable newhash; /* the new hashtable */
 
-         /* create new hashtable, double the size */
-         init_hashtable(&newhash, utf_hash.size*2);
-         newhash.entries=utf_hash.entries;
+               /* create new hashtable, double the size */
+               init_hashtable(&newhash, utf_hash.size*2);
+               newhash.entries=utf_hash.entries;
 
 #ifdef STATISTICS
-         count_utf_len += sizeof(utf*) * utf_hash.size;
+               count_utf_len += sizeof(utf*) * utf_hash.size;
 #endif
 
-         /* transfer elements to new hashtable */
-         for (i=0; i<utf_hash.size; i++) {
-               u = (utf*) utf_hash.ptr[i];
-               while (u) {
-                       utf *nextu = u -> hashlink;
-                       u4 slot = (utf_hashkey(u->text,u->blength)) & (newhash.size-1);
+               /* transfer elements to new hashtable */
+               for (i=0; i<utf_hash.size; i++) {
+                       u = (utf*) utf_hash.ptr[i];
+                       while (u) {
+                               utf *nextu = u -> hashlink;
+                               u4 slot = (utf_hashkey(u->text,u->blength)) & (newhash.size-1);
                                                
-                       u->hashlink = (utf*) newhash.ptr[slot];
-                       newhash.ptr[slot] = u;
+                               u->hashlink = (utf*) newhash.ptr[slot];
+                               newhash.ptr[slot] = u;
 
-                       /* follow link in external hash chain */
-                       u = nextu;
+                               /* follow link in external hash chain */
+                               u = nextu;
                        }
                }
        
-         /* dispose old table */
-         MFREE (utf_hash.ptr, void*, utf_hash.size);
-         utf_hash = newhash;
+               /* dispose old table */
+               MFREE (utf_hash.ptr, void*, utf_hash.size);
+               utf_hash = newhash;
        }
        
        return u;
@@ -452,14 +475,14 @@ void utf_show ()
                                utf_display (u);
                                printf ("' ");
                                u = u->hashlink;
-                               }       
+                       }       
                        printf ("\n");
-                       }
-               
                }
+               
+       }
 
        printf ("UTF-HASH: %d slots for %d entries\n", 
-                (int) utf_hash.size, (int) utf_hash.entries );
+                       (int) utf_hash.size, (int) utf_hash.entries );
 
 
        if (utf_hash.entries == 0)
@@ -480,7 +503,7 @@ void utf_show ()
                while (u) {
                        u = u->hashlink;
                        chain_length++;
-                       }
+               }
 
                /* update sum of all chainlengths */
                sum_chainlength+=chain_length;
@@ -497,7 +520,7 @@ void utf_show ()
 
                /* update number of hashchains of current length */
                chain_count[chain_length]++;
-               }
+       }
 
        /* display results */  
        for (i=1;i<CHAIN_LIMIT-1;i++) 
@@ -524,11 +547,11 @@ void utf_show ()
        
 ******************************************************************************/
 
-u2 desc_to_type (utf *descriptor)
+u2 desc_to_type(utf *descriptor)
 {
        char *utf_ptr = descriptor->text;  /* current position in utf text */
 
-       if (descriptor->blength < 1) panic ("Type-Descriptor is empty string");
+       if (descriptor->blength < 1) panic("Type-Descriptor is empty string");
        
        switch (*utf_ptr++) {
        case 'B': 
@@ -543,9 +566,10 @@ u2 desc_to_type (utf *descriptor)
        case '[':  return TYPE_ADDRESS;
        }
                        
-       sprintf (logtext, "Invalid Type-Descriptor: "); 
-       utf_sprint (logtext+strlen(logtext), descriptor);
-       error (); 
+       sprintf(logtext, "Invalid Type-Descriptor: ");
+       utf_sprint(logtext+strlen(logtext), descriptor);
+       error();
+
        return 0;
 }
 
@@ -589,37 +613,38 @@ u2 utf_nextu2(char **utf_ptr)
     int len;           
        
     switch ((ch1 = utf[0]) >> 4) {
-      default: /* 1 byte */
-               (*utf_ptr)++;
-               return ch1;
-       case 0xC: 
-       case 0xD: /* 2 bytes */
-                 if (((ch2 = utf[1]) & 0xC0) == 0x80) {
-                   unsigned char high = ch1 & 0x1F;
-                   unsigned char low  = ch2 & 0x3F;
-                   unicode_char = (high << 6) + low;
-                   len = 2;
-                 
-                 break;
-
-       case 0xE: /* 2 or 3 bytes */
-                 if (((ch2 = utf[1]) & 0xC0) == 0x80) {
-                    if (((ch3 = utf[2]) & 0xC0) == 0x80) {
-                       unsigned char low  = ch3 & 0x3f;
-                       unsigned char mid  = ch2 & 0x3f;
-                       unsigned char high = ch1 & 0x0f;
-                       unicode_char = (((high << 6) + mid) << 6) + low;
-                       len = 3;
-                    } else
-                       len = 2;                                           
-                }
-                 break;
+       default: /* 1 byte */
+               (*utf_ptr)++;
+               return ch1;
+       case 0xC: 
+       case 0xD: /* 2 bytes */
+               if (((ch2 = utf[1]) & 0xC0) == 0x80) {
+                       unsigned char high = ch1 & 0x1F;
+                       unsigned char low  = ch2 & 0x3F;
+                       unicode_char = (high << 6) + low;
+                       len = 2;
+               } 
+               break;
+
+       case 0xE: /* 2 or 3 bytes */
+               if (((ch2 = utf[1]) & 0xC0) == 0x80) {
+                       if (((ch3 = utf[2]) & 0xC0) == 0x80) {
+                               unsigned char low  = ch3 & 0x3f;
+                               unsigned char mid  = ch2 & 0x3f;
+                               unsigned char high = ch1 & 0x0f;
+                               unicode_char = (((high << 6) + mid) << 6) + low;
+                               len = 3;
+                       } else
+                               len = 2;                                           
+               }
+               break;
     }
 
     /* update position in utf-text */
     *utf_ptr = (char *) (utf + len);
     return unicode_char;
 }
+
  
 /******************** Function: class_new **************************************
 
@@ -629,7 +654,7 @@ u2 utf_nextu2(char **utf_ptr)
 
 *******************************************************************************/
 
-classinfo *class_new (utf *u)
+classinfo *class_new(utf *u)
 {
        classinfo *c;     /* hashtable element */ 
        u4 key;           /* hashkey computed from classname */   
@@ -646,13 +671,13 @@ classinfo *class_new (utf *u)
                        for (i=0; i<u->blength; i++) 
                                if (u->text[i] != c->name->text[i]) goto nomatch;
                                                
-                               /* class found in hashtable */                                                                  
-                               return c;
-                       }
+                       /* class found in hashtable */                                                                  
+                       return c;
+               }
                        
-               nomatch:
+       nomatch:
                c = c->hashlink; /* next element in external chain */
-               }
+       }
 
        /* location in hashtable found, create new classinfo structure */
 
@@ -660,33 +685,33 @@ classinfo *class_new (utf *u)
        count_class_infos += sizeof(classinfo);
 #endif
 
-       c = NEW (classinfo);
-       c -> flags = 0;
-       c -> name = u;
-       c -> cpcount = 0;
-       c -> cptags = NULL;
-       c -> cpinfos = NULL;
-       c -> super = NULL;
-       c -> sub = NULL;
-       c -> nextsub = NULL;
-       c -> interfacescount = 0;
-       c -> interfaces = NULL;
-       c -> fieldscount = 0;
-       c -> fields = NULL;
-       c -> methodscount = 0;
-       c -> methods = NULL;
-       c -> linked = false;
-       c -> index = 0;
-       c -> instancesize = 0;
-       c -> header.vftbl = NULL;
-       c -> innerclasscount = 0;
-       c -> innerclass = NULL;
-       c -> vftbl = NULL;
-       c -> initialized = false;
-       c -> classvftbl = false;
+       c = NEW(classinfo);
+       c->flags = 0;
+       c->name = u;
+       c->cpcount = 0;
+       c->cptags = NULL;
+       c->cpinfos = NULL;
+       c->super = NULL;
+       c->sub = NULL;
+       c->nextsub = NULL;
+       c->interfacescount = 0;
+       c->interfaces = NULL;
+       c->fieldscount = 0;
+       c->fields = NULL;
+       c->methodscount = 0;
+       c->methods = NULL;
+       c->linked = false;
+       c->index = 0;
+       c->instancesize = 0;
+       c->header.vftbl = NULL;
+       c->innerclasscount = 0;
+       c->innerclass = NULL;
+       c->vftbl = NULL;
+       c->initialized = false;
+       c->classvftbl = false;
        
        /* prepare loading of the class */
-       list_addlast (&unloadedclasses, c);
+       list_addlast(&unloadedclasses, c);
 
        /* insert class into the hashtable */
        c->hashlink = class_hash.ptr[slot];
@@ -695,36 +720,36 @@ classinfo *class_new (utf *u)
        /* update number of hashtable-entries */
        class_hash.entries++;
 
-       if ( class_hash.entries > (class_hash.size*2)) {  
+       if (class_hash.entries > (class_hash.size*2)) {  
 
-          /* reorganization of hashtable, average length of 
-             the external chains is approx. 2                */  
+               /* reorganization of hashtable, average length of 
+                  the external chains is approx. 2                */  
 
-         u4 i;
-         classinfo *c;
-         hashtable newhash;  /* the new hashtable */
+               u4 i;
+               classinfo *c;
+               hashtable newhash;  /* the new hashtable */
 
-         /* create new hashtable, double the size */
-         init_hashtable(&newhash, class_hash.size*2);
-         newhash.entries = class_hash.entries;
+               /* create new hashtable, double the size */
+               init_hashtable(&newhash, class_hash.size*2);
+               newhash.entries = class_hash.entries;
 
-         /* transfer elements to new hashtable */
-         for (i=0; i<class_hash.size; i++) {
-               c = (classinfo*) class_hash.ptr[i];
-               while (c) {
-                       classinfo *nextc = c -> hashlink;
-                       u4 slot = (utf_hashkey(c->name->text,c->name->blength)) & (newhash.size-1);
+               /* transfer elements to new hashtable */
+               for (i = 0; i < class_hash.size; i++) {
+                       c = (classinfo*) class_hash.ptr[i];
+                       while (c) {
+                               classinfo *nextc = c->hashlink;
+                               u4 slot = (utf_hashkey(c->name->text, c->name->blength)) & (newhash.size - 1);
                                                
-                       c->hashlink = newhash.ptr[slot];
-                       newhash.ptr[slot] = c;
+                               c->hashlink = newhash.ptr[slot];
+                               newhash.ptr[slot] = c;
 
-                       c = nextc;
+                               c = nextc;
                        }
                }
        
-         /* dispose old table */       
-         MFREE (class_hash.ptr, void*, class_hash.size);
-         class_hash = newhash;
+               /* dispose old table */ 
+               MFREE(class_hash.ptr, void*, class_hash.size);
+               class_hash = newhash;
        }
                        
        return c;
@@ -737,7 +762,7 @@ classinfo *class_new (utf *u)
 
 *******************************************************************************/
 
-classinfo *class_get (utf *u)
+classinfo *class_get(utf *u)
 {
        classinfo *c;  /* hashtable element */ 
        u4 key;        /* hashkey computed from classname */   
@@ -758,11 +783,11 @@ classinfo *class_get (utf *u)
 
                        /* class found in hashtable */                          
                        return c;
-                       }
+               }
                        
-               nomatch:
+       nomatch:
                c = c->hashlink;
-               }
+       }
 
        /* class not found */
        return NULL;
@@ -782,40 +807,28 @@ u4 utf_strlen(utf *u)
     u4 len = 0;                         /* number of unicode characters   */
 
     while (utf_ptr<endpos) {
-      len++;
-      /* next unicode character */
-      utf_nextu2(&utf_ptr);
+               len++;
+               /* next unicode character */
+               utf_nextu2(&utf_ptr);
     }
 
     if (utf_ptr!=endpos)
        /* string ended abruptly */
-       panic("illegal utf string"); 
+               panic("illegal utf string"); 
 
     return len;
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 8ae42bcf457bc775e5348352972e4cc1e66cd89d..a386c42acf5f8275a76cc6e5c6e44a25c8e2c454 100644 (file)
--- a/tables.h
+++ b/tables.h
@@ -1,15 +1,40 @@
-/****************************** tables.h ***************************************
+/* tables.h - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Last Change: 1996/11/20
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-*******************************************************************************/
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+
+   $Id: tables.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _TABLES_H
+#define _TABLES_H
+
+#include <stdio.h>
 #include "global.h" /* for unicode. -- phil */
 
 #define CLASS(name)     (unicode_getclasslink(unicode_new_char(name)))
@@ -22,25 +47,25 @@ extern bool collectverbose;
 extern list unloadedclasses;
 
 /* function for disposing javastrings */
-typedef void (*stringdeleter) ( java_objectheader *string );
+typedef void (*stringdeleter) (java_objectheader *string);
     
 /* creates hashtables for symboltables */
-void tables_init ();
+void tables_init();
 
 /* free memory for hashtables */ 
-void tables_close (stringdeleter del);
+void tables_close(stringdeleter del);
 
 /* write utf symbol to file/buffer */
-void utf_sprint (char *buffer, utf *u);
-void utf_fprint (FILE *file, utf *u);
-void utf_display (utf *u);
+void utf_sprint(char *buffer, utf *u);
+void utf_fprint(FILE *file, utf *u);
+void utf_display(utf *u);
 
 /* create new utf-symbol */
-utf *utf_new (char *text, u2 length);
-utf *utf_new_char (char *text);
+utf *utf_new(char *text, u2 length);
+utf *utf_new_char(char *text);
 
 /* show utf-table */
-void utf_show ();
+void utf_show();
 
 /* get next unicode character of a utf-string */
 u2 utf_nextu2(char **utf);
@@ -49,34 +74,41 @@ u2 utf_nextu2(char **utf);
 u4 utf_strlen(utf *u);
 
 /* search for class and create it if not found */
-classinfo *class_new (utf *u);
+classinfo *class_new(utf *u);
 
 /* get javatype according to a typedescriptor */
-u2 desc_to_type (utf *descriptor);
+u2 desc_to_type(utf *descriptor);
 
 /* get length of a datatype */
-u2 desc_typesize (utf *descriptor);
+u2 desc_typesize(utf *descriptor);
 
 /* determine hashkey of a unicode-symbol */
-u4 unicode_hashkey (u2 *text, u2 length);
+u4 unicode_hashkey(u2 *text, u2 length);
 
 /* create hashtable */
 void init_hashtable(hashtable *hash, u4 size);
 
 /* search for class in classtable */
-classinfo *class_get (utf *u);
+classinfo *class_get(utf *u);
 
 
 void heap_init (u4 size, u4 startsize, void **stackbottom);
-void heap_close ();
-void *heap_allocate (u4 bytelength, bool references, methodinfo *finalizer);
-void heap_addreference (void **reflocation);
-
-void gc_init (void);
-void gc_thread (void);
-void gc_call (void);
-
-
-
-
-
+void heap_close();
+void *heap_allocate(u4 bytelength, bool references, methodinfo *finalizer);
+void heap_addreference(void **reflocation);
+
+#endif /* _TABLES_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 71ced9d6bbc070c6ab91135a22db93fea67fe2b9..8ab8526462b776a8269cc966c8d788b45df09983 100644 (file)
@@ -59,22 +59,19 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 host_alias = @host_alias@
 host_triplet = @host@
-ASMPART = @ASMPART@
-BOEHM_LIB = @BOEHM_LIB@
+ARCH_DIR = @ARCH_DIR@
 CC = @CC@
 COMPILER_OBJECTS = @COMPILER_OBJECTS@
-GC_OBJ = @GC_OBJ@
 LIBTHREAD = @LIBTHREAD@
 MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
-SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
 SUBDIRS = kaffe
 
-EXTRA_DIST = x.java x.output jctest.java fptest.java jctest.output fptest.output               GCBench.java
+EXTRA_DIST = x.java x.output   jctest.java jctest.output       fp.java fp.output       fptest.java fptest.output       GCBench.java
 
 
 check_DATA = checkall
@@ -287,17 +284,17 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
-checkall: x.tst jctest.tst fptest.tst GCBench.tstrun
+checkall: x.tst jctest.tst fp.tst fptest.tst GCBench.tstrun
 
 %.tst:
-       ../cacao -ieee sun.tools.javac.Main $*.java
-       ../cacao -ieee $* >$*.thisoutput
+       ../cacao sun.tools.javac.Main $*.java
+       ../cacao $* >$*.thisoutput
        diff --brief $*.thisoutput $*.output
        rm -f $*.thisoutput
 
 %.tstrun:
-       ../cacao -ieee sun.tools.javac.Main $*.java
-       ../cacao -ieee $*
+       ../cacao sun.tools.javac.Main $*.java
+       ../cacao $*
 
 # 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.
index 2d820ff56804182647cf44143f2f81d488501daf..fb3970d0868e4bf70cd5d14aa75f5f3fb58f29ae 100644 (file)
@@ -1,8 +1,26 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
+
 noinst_LIBRARIES = @LIBTHREAD@
 EXTRA_LIBRARIES = libthreads.a
 
-libthreads_a_SOURCES = locks.c locks.h \
-                      thread.c thread.h \
-                      threadio.c threadio.h
+libthreads_a_SOURCES = \
+       locks.c \
+       locks.h \
+       thread.c \
+       thread.h \
+       threadio.c \
+       threadio.h
+
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@
+
 
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
index e3e92983bd918b56dfa7316781ba62148fcfba00..ed25220f154d1a5458c0df516c6297e070c96cb5 100644 (file)
@@ -10,6 +10,8 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+# $Id: Makefile.in 557 2003-11-02 22:51:59Z twisti $
+
 
 SHELL = @SHELL@
 
@@ -59,26 +61,23 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 host_alias = @host_alias@
 host_triplet = @host@
-ASMPART = @ASMPART@
-BOEHM_LIB = @BOEHM_LIB@
+ARCH_DIR = @ARCH_DIR@
 CC = @CC@
 COMPILER_OBJECTS = @COMPILER_OBJECTS@
-GC_OBJ = @GC_OBJ@
 LIBTHREAD = @LIBTHREAD@
 MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
-SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
 noinst_LIBRARIES = @LIBTHREAD@
 EXTRA_LIBRARIES = libthreads.a
 
-libthreads_a_SOURCES = locks.c locks.h                        thread.c thread.h                       threadio.c threadio.h
+libthreads_a_SOURCES =         locks.c         locks.h         thread.c        thread.h        threadio.c      threadio.h
 
 
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
index 0d1eac2372b76907a5f35de1a398ab0187c2b03d..a0d4c2547e129cbbafdb0537fb813e878d9150cb 100644 (file)
  * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
  */
 
-#include "config.h"
-
 #include <assert.h>
-
 #include <sys/types.h>
 #include <sys/mman.h>                   /* for mprotect */
 #include <unistd.h>
 #include <signal.h>
 #include <sys/time.h>
 
+#include "config.h"
 #include "thread.h"
 #include "locks.h"
 #include "threads.h"
-
 #include "tables.h"
 #include "native.h"
 #include "loader.h"
 #include "builtin.h"
 #include "asmpart.h"
-
+#include "toolbox/loging.h"
 #include "toolbox/memory.h"
 
+
 static classinfo *class_java_lang_ThreadDeath;
 
 thread* currentThread = NULL;
index 93ce98b6914d74f63fc068433c518a77db779744..cc7b20b66feea92387372ac44c85b29145a5d379 100644 (file)
@@ -10,8 +10,8 @@
  * Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.
  */
 
-#include "config.h"
 
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <assert.h>
 #include <unistd.h>
 
+#include "config.h"
 #include "thread.h"
 
+
 #define        TH_READ         0
 #define        TH_WRITE        1
 #define        TH_ACCEPT       TH_READ
@@ -134,8 +136,8 @@ void clear_thread_flags(void)
 #endif
 #endif
 
-    fflush (stdout);
-    fflush (stderr);
+    fflush(stdout);
+    fflush(stderr);
 }
 
 
index c50a3e67fcbaf0e1f37bbf9a95af98dc922dc7a7..04061b02f2dab699d672c2b981ed14f1280aed44 100644 (file)
@@ -1,9 +1,28 @@
+## Process this file with automake to produce Makefile.in
+
+# $Id: Makefile.am 557 2003-11-02 22:51:59Z twisti $
+
 noinst_LIBRARIES = libtoolbox.a
 
-libtoolbox_a_SOURCES = memory.c memory.h \
-                      loging.c loging.h \
-                      chain.c chain.h \
-                      tree.c tree.h \
-                      list.c list.h
+libtoolbox_a_SOURCES = \
+       memory.c \
+       memory.h \
+       loging.c \
+       loging.h \
+       chain.c \
+       chain.h \
+       tree.c \
+       tree.h \
+       list.c \
+       list.h
+
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@
+
 
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
index f1a7f2a929d8a9130ca509bbb0a6439a29e7d7cd..e7b0ee01fabaf388a0d4d5e241a66bae10548760 100644 (file)
@@ -10,6 +10,8 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+# $Id: Makefile.in 557 2003-11-02 22:51:59Z twisti $
+
 
 SHELL = @SHELL@
 
@@ -59,25 +61,22 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 host_alias = @host_alias@
 host_triplet = @host@
-ASMPART = @ASMPART@
-BOEHM_LIB = @BOEHM_LIB@
+ARCH_DIR = @ARCH_DIR@
 CC = @CC@
 COMPILER_OBJECTS = @COMPILER_OBJECTS@
-GC_OBJ = @GC_OBJ@
 LIBTHREAD = @LIBTHREAD@
 MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
-SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
 noinst_LIBRARIES = libtoolbox.a
 
-libtoolbox_a_SOURCES = memory.c memory.h                      loging.c loging.h                       chain.c chain.h                 tree.c tree.h                   list.c list.h
+libtoolbox_a_SOURCES =         memory.c        memory.h        loging.c        loging.h        chain.c         chain.h         tree.c  tree.h  list.c  list.h
 
 
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/jit -I$(top_srcdir)/jit/@ARCH_DIR@
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
index c550f5adf7cf09e36f0964e164de1b9dcd4f4747..5e551b2a9087e7e3918df098082c15ba8bab1894 100644 (file)
@@ -1,41 +1,63 @@
-/************************* toolbox/chain.h *************************************
+/* toolbox/chain.h - management of doubly linked lists with external linking
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Management of doubly linked lists with external linking
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1996/10/03
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-#ifndef CHAIN_H
-#define CHAIN_H
+   Authors: Reinhard Grafl
+
+   $Id: chain.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _CHAIN_H
+#define _CHAIN_H
 
 typedef struct chainlink {          /* structure for list element */
-       struct chainlink *next,*prev;
+       struct chainlink *next;
+       struct chainlink *prev;
        void *element;
-       } chainlink;
+} chainlink;
 
 typedef struct chain {             /* structure for list */
        int  usedump;   
 
-       chainlink *first,*last;
+       chainlink *first;
+       chainlink *last;
        chainlink *active;
-       } chain;
+} chain;
 
 
-chain *chain_new ();
-chain *chain_dnew ();
+/* function prototypes */
+chain *chain_new();
+chain *chain_dnew();
 void chain_free(chain *c);
 
 void chain_addafter(chain *c, void *element);
 void chain_addbefore(chain *c, void *element);
-void chain_addlast (chain *c, void *element);
-void chain_addfirst (chain *c, void *element);
+void chain_addlast(chain *c, void *element);
+void chain_addfirst(chain *c, void *element);
 
 void chain_remove(chain *c);
 void *chain_remove_go_prev(chain *c);
@@ -87,4 +109,18 @@ insertion/deletion occurs at a position relative to this cursor.
 
 */
 
-#endif
+#endif /* _CHAIN_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 866241778e444716ae384facc62bb2fc4efc1780..7b007bd98bf507d8237512a6e219234fd84d29a7 100644 (file)
@@ -1,16 +1,35 @@
-/************************* toolbox/memory.c ************************************
+/* toolbox/memory.c - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Not documented, see memory.h.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1996/10/03
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+
+   $Id: memory.c 557 2003-11-02 22:51:59Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 
 #include "global.h"
-#include "callargs.h"
 #include "loging.h"
 #include "memory.h"
 
 
-       /********* general types, variables and auxiliary functions *********/
+/********* general types, variables and auxiliary functions *********/
 
 #define DUMPBLOCKSIZE  (2<<21)
 #define ALIGNSIZE           8
@@ -46,13 +64,14 @@ dumplist *topdumpblock = NULL;
 long int maxmemusage = 0;
 long int maxdumpsize = 0;
 
-/* #define TRACECALLARGS */
+#define TRACECALLARGS
 
 #ifdef TRACECALLARGS
 static char *nomallocmem = NULL;
 static char *nomalloctop;
 static char *nomallocptr;
 
+
 static void *lit_checked_alloc (int length)
 {
        void *m;
@@ -90,9 +109,11 @@ static void *checked_alloc (int length)
        return m;
 }
 
+
 static int mmapcodesize = 0;
 static void *mmapcodeptr = NULL;
 
+
 void *mem_mmap(int length)
 {
        void *retptr;
@@ -104,11 +125,11 @@ void *mem_mmap(int length)
                        mmapcodesize = length;
                mmapcodesize = (ALIGN(mmapcodesize, getpagesize()));
                mmapcodeptr = mmap (NULL, (size_t) mmapcodesize,
-                             PROT_READ | PROT_WRITE | PROT_EXEC,
-                             MAP_PRIVATE | MAP_ANONYMOUS, -1, (off_t) 0);
+                                                       PROT_READ | PROT_WRITE | PROT_EXEC,
+                                                       MAP_PRIVATE | MAP_ANONYMOUS, -1, (off_t) 0);
                if (mmapcodeptr == (void*) -1)
                        panic ("Out of memory");
-               }
+       }
        retptr = mmapcodeptr;
        mmapcodeptr = (void*) ((char*) mmapcodeptr + length);
        mmapcodesize -= length;
@@ -118,7 +139,7 @@ void *mem_mmap(int length)
 
 #ifdef DEBUG
 
-       /************ Memory manager, safe version **************/
+/************ Memory manager, safe version **************/
 
 
 typedef struct memblock {
@@ -180,19 +201,19 @@ void mem_free(void *m, int length)
        if (!m) {
                if (length==0) return;
                panic ("returned memoryblock with address NULL, length != 0");
-               }
+       }
 
        mb = (memblock*) (((char*) m) - BLOCKOFFSET);
        
        if (mb->length != length) {
                sprintf (logtext, 
-                        "Memory block of size %d has been return as size %d",
+                                "Memory block of size %d has been return as size %d",
                         mb->length, length);
                error();
-               }
+       }
                
        if (mb->prev) mb->prev->next = mb->next;
-                else firstmemblock = mb->next;
+       else firstmemblock = mb->next;
        if (mb->next) mb->next->prev = mb->prev;
 
        free (mb);
@@ -207,19 +228,19 @@ void lit_mem_free(void *m, int length)
        if (!m) {
                if (length==0) return;
                panic ("returned memoryblock with address NULL, length != 0");
-               }
+       }
 
        mb = (memblock*) (((char*) m) - BLOCKOFFSET);
        
        if (mb->length != length) {
                sprintf (logtext, 
-                        "Memory block of size %d has been return as size %d",
+                                "Memory block of size %d has been return as size %d",
                         mb->length, length);
                error();
-               }
+       }
                
        if (mb->prev) mb->prev->next = mb->next;
-                else firstmemblock = mb->next;
+       else firstmemblock = mb->next;
        if (mb->next) mb->next->prev = mb->prev;
 
 #ifdef TRACECALLARGS
@@ -255,23 +276,23 @@ static void mem_characterlog (unsigned char *m, int len)
                        
                for (i=z; i<(z+LINESIZE) && i<len; i++) {
                        sprintf (logtext+strlen(logtext), "%2x ", m[i]);
-                       }
+               }
                for (; i<(z+LINESIZE); i++) {
                        sprintf (logtext+strlen(logtext), "   ");
-                       }
+               }
                                        
                sprintf (logtext+strlen(logtext),"   ");
                for (i=z; i<(z+LINESIZE) && i<len; i++) {
                        sprintf (logtext+strlen(logtext),
-                            "%c", (m[i]>=' ' && m[i]<=127) ? m[i] : '.');
-                       }
+                                        "%c", (m[i]>=' ' && m[i]<=127) ? m[i] : '.');
+               }
                        
                dolog();
-               }
+       }
 }
 
 #else
-               /******* Memory manager, fast version ******/
+/******* Memory manager, fast version ******/
 
 
 void *mem_alloc(int length)
@@ -301,7 +322,7 @@ void mem_free(void *m, int length)
        if (!m) {
                if (length==0) return;
                panic ("returned memoryblock with address NULL, length != 0");
-               }
+       }
 
        memoryusage -= length;
 
@@ -314,7 +335,7 @@ void lit_mem_free(void *m, int length)
        if (!m) {
                if (length==0) return;
                panic ("returned memoryblock with address NULL, length != 0");
-               }
+       }
 
        memoryusage -= length;
 
@@ -331,8 +352,8 @@ void *mem_realloc (void *m1, int len1, int len2)
 
        if (!m1) {
                if (len1!=0) 
-                 panic ("reallocating memoryblock with address NULL, length != 0");
-               }
+                       panic ("reallocating memoryblock with address NULL, length != 0");
+       }
                
        memoryusage = (memoryusage - len1) + len2;
 
@@ -344,9 +365,7 @@ void *mem_realloc (void *m1, int len1, int len2)
 
 #endif
 
-               /******* common memory manager parts ******/
-
-
+/******* common memory manager parts ******/
 
 long int mem_usage()
 {
@@ -354,38 +373,35 @@ long int mem_usage()
 }
 
 
-
-
-
 void *dump_alloc(int length)
 {
        void *m;
 
-        if (length==0) return NULL;
+       if (length == 0) return NULL;
        
-       length = ALIGN (length, ALIGNSIZE);
+       length = ALIGN(length, ALIGNSIZE);
 
-       assert (length <= DUMPBLOCKSIZE);
-       assert (length > 0);
+       assert(length <= DUMPBLOCKSIZE);
+       assert(length > 0);
 
        if (dumpsize + length > dumpspace) {
-               dumplist *newdumpblock = checked_alloc (sizeof(dumplist));
+               dumplist *newdumpblock = checked_alloc(sizeof(dumplist));
 
-               newdumpblock -> prev = topdumpblock;
+               newdumpblock->prev = topdumpblock;
                topdumpblock = newdumpblock;
 
-               newdumpblock -> dumpmem = checked_alloc (DUMPBLOCKSIZE);
+               newdumpblock->dumpmem = checked_alloc(DUMPBLOCKSIZE);
 
                dumpsize = dumpspace;
                dumpspace += DUMPBLOCKSIZE;             
-               }
+       }
        
-       m = topdumpblock -> dumpmem + DUMPBLOCKSIZE - (dumpspace - dumpsize);
+       m = topdumpblock->dumpmem + DUMPBLOCKSIZE - (dumpspace - dumpsize);
        dumpsize += length;
        
        if (dumpsize > maxdumpsize) {
                maxdumpsize = dumpsize;
-               }
+       }
                
        return m;
 }   
@@ -393,8 +409,8 @@ void *dump_alloc(int length)
 
 void *dump_realloc(void *ptr, int len1, int len2)
 {
-       void *p2 = dump_alloc (len2);
-       memcpy (p2, ptr, len1); 
+       void *p2 = dump_alloc(len2);
+       memcpy(p2, ptr, len1);  
        return p2;
 }
 
@@ -407,59 +423,70 @@ long int dump_size()
 
 void dump_release(long int size)
 {
-       assert (size >= 0 && size <= dumpsize);
+       assert(size >= 0 && size <= dumpsize);
 
        dumpsize = size;
        
-       while (dumpspace  >  dumpsize + DUMPBLOCKSIZE) {
+       while (dumpspace > dumpsize + DUMPBLOCKSIZE) {
                dumplist *oldtop = topdumpblock;
                
-               topdumpblock = oldtop -> prev;
+               topdumpblock = oldtop->prev;
                dumpspace -= DUMPBLOCKSIZE;
                
 #ifdef TRACECALLARGS
 #else
-               free (oldtop -> dumpmem);
-               free (oldtop);
+               free(oldtop->dumpmem);
+               free(oldtop);
 #endif
-               }               
+       }               
 }
 
 
-
-
 void mem_usagelog (int givewarnings)
 {
        if ((memoryusage!=0) && givewarnings) {
                sprintf (logtext, "Allocated memory not returned: %d",
-                     (int)memoryusage);
+                                (int)memoryusage);
                dolog();
 
 #ifdef DEBUG
                { 
-               memblock *mb = firstmemblock;
-               while (mb) {
-                       sprintf (logtext, "   Memory block size: %d", 
-                         (int)(mb->length) );
-                       dolog();
-                       mem_characterlog ( ((unsigned char*)mb) + BLOCKOFFSET, mb->length);
-                       mb = mb->next;
+                       memblock *mb = firstmemblock;
+                       while (mb) {
+                               sprintf (logtext, "   Memory block size: %d", 
+                                                (int)(mb->length) );
+                               dolog();
+                               mem_characterlog ( ((unsigned char*)mb) + BLOCKOFFSET, mb->length);
+                               mb = mb->next;
                        }
                }
 #endif
                        
-               }
+       }
 
        if ((dumpsize!=0) && givewarnings) {
                sprintf (logtext, "Dump memory not returned: %d",(int)dumpsize);
                dolog();
-               }
+       }
 
 
-       sprintf (logtext, "Random/Dump - memory usage: %dK/%dK", 
-             (int)((maxmemusage+1023)/1024), 
-             (int)((maxdumpsize+1023)/1024) );
+       sprintf(logtext, "Random/Dump - memory usage: %dK/%dK", 
+                       (int)((maxmemusage+1023)/1024), 
+                       (int)((maxdumpsize+1023)/1024) );
        dolog();
        
 }
 
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index fbcf7f59c3b1bf7639a177b95a0aa0c4a18997d6..f1c378d373f87232da767967f91dee3fc7cf6c5f 100644 (file)
@@ -1,16 +1,38 @@
-/************************* toolbox/memory.h ************************************
+/* toolbox/memory.h - macros for memory management
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Macros for memory management
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1996/10/03
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Reinhard Grafl
+
+   $Id: memory.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
+
+
+#ifndef _MEMORY_H
+#define _MEMORY_H
 
 #include "types.h"
 
 void *heap_alloc_uncollectable(u4 bytelen);
 #define GCNEW(type,num)       heap_alloc_uncollectable(sizeof(type) * (num))
 
-#define ALIGN(pos,size)       ( ( ((pos)+(size)-1) / (size))*(size) )
-#define PADDING(pos,size)     ( ALIGN((pos),(size)) - (pos) )
-#define OFFSET(s,el)          ( (int) ( (size_t) &( ((s*)0) -> el ) ) )
+#define ALIGN(pos,size)       ((((pos) + (size) - 1) / (size)) * (size))
+#define PADDING(pos,size)     (ALIGN((pos),(size)) - (pos))
+#define OFFSET(s,el)          ((int) ((size_t) & (((s*) 0)->el)))
 
 
-#define NEW(type)             ((type*) mem_alloc ( sizeof(type) ))
-#define FREE(ptr,type)        mem_free (ptr, sizeof(type) )
+#define NEW(type)             ((type*) mem_alloc(sizeof(type)))
+#define FREE(ptr,type)        mem_free(ptr, sizeof(type))
 
-#define LNEW(type)             ((type*) lit_mem_alloc ( sizeof(type) ))
-#define LFREE(ptr,type)        lit_mem_free (ptr, sizeof(type) )
+#define LNEW(type)            ((type*) lit_mem_alloc(sizeof(type)))
+#define LFREE(ptr,type)       lit_mem_free(ptr, sizeof(type))
 
-#define MNEW(type,num)        ((type*) mem_alloc ( sizeof(type) * (num) ))
-#define MFREE(ptr,type,num)   mem_free (ptr, sizeof(type) * (num) )
-#define MREALLOC(ptr,type,num1,num2) mem_realloc (ptr, sizeof(type) * (num1), \
-                                                       sizeof(type) * (num2) )
+#define MNEW(type,num)        ((type*) mem_alloc(sizeof(type) * (num)))
+#define MFREE(ptr,type,num)   mem_free(ptr, sizeof(type) * (num))
+#define MREALLOC(ptr,type,num1,num2) mem_realloc(ptr, sizeof(type) * (num1), \
+                                                      sizeof(type) * (num2))
 
-#define DNEW(type)            ((type*) dump_alloc ( sizeof(type) ))
-#define DMNEW(type,num)       ((type*) dump_alloc ( sizeof(type) * (num) ))
-#define DMREALLOC(ptr,type,num1,num2)  dump_realloc (ptr, sizeof(type)*(num1),\
-                                                       sizeof(type) * (num2) )
+#define DNEW(type)            ((type*) dump_alloc(sizeof(type)))
+#define DMNEW(type,num)       ((type*) dump_alloc(sizeof(type) * (num)))
+#define DMREALLOC(ptr,type,num1,num2)  dump_realloc(ptr, sizeof(type) * (num1),\
+                                                         sizeof(type) * (num2))
 
-#define MCOPY(dest,src,type,num)  memcpy (dest,src, sizeof(type)* (num) )
+#define MCOPY(dest,src,type,num)  memcpy(dest,src, sizeof(type)* (num))
 
 #ifdef USE_CODEMMAP
-#define CNEW(type,num)        ((type*) mem_mmap ( sizeof(type) * (num) ))
+#define CNEW(type,num)        ((type*) mem_mmap( sizeof(type) * (num)))
 #define CFREE(ptr,num)
 #else
-#define CNEW(type,num)        ((type*) mem_alloc ( sizeof(type) * (num) ))
-#define CFREE(ptr,num)        mem_free (ptr, num)
+#define CNEW(type,num)        ((type*) mem_alloc(sizeof(type) * (num)))
+#define CFREE(ptr,num)        mem_free(ptr, num)
 #endif
 
+
 void *mem_alloc(int length);
 void *mem_mmap(int length);
 void *lit_mem_alloc(int length);
@@ -116,3 +139,19 @@ Some more macros:
        
 
 */
+
+#endif /* _MEMORY_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/x86_64/Makefile.am b/x86_64/Makefile.am
deleted file mode 100644 (file)
index 64e2107..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-EXTRA_DIST = asmpart.S disass.c ngen.c \
-            defines.h native-math.h ngen.h \
-                methodtable.c methodtable.h \
-            types.h threads.h dis-asm.h bfd.h
-
-noinst_LIBRARIES = libdisass.a
-
-libdisass_a_SOURCES = i386-dis.c dis-buf.c
diff --git a/x86_64/ansidecl.h b/x86_64/ansidecl.h
deleted file mode 100644 (file)
index 9a7c577..0000000
+++ /dev/null
@@ -1,295 +0,0 @@
-/* ANSI and traditional C compatability macros
-   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-/* ANSI and traditional C compatibility macros
-
-   ANSI C is assumed if __STDC__ is #defined.
-
-   Macro               ANSI C definition       Traditional C definition
-   -----               ---- - ----------       ----------- - ----------
-   ANSI_PROTOTYPES     1                       not defined
-   PTR                 `void *'                `char *'
-   PTRCONST            `void *const'           `char *'
-   LONG_DOUBLE         `long double'           `double'
-   const               not defined             `'
-   volatile            not defined             `'
-   signed              not defined             `'
-   VA_START(ap, var)   va_start(ap, var)       va_start(ap)
-
-   Note that it is safe to write "void foo();" indicating a function
-   with no return value, in all K+R compilers we have been able to test.
-
-   For declaring functions with prototypes, we also provide these:
-
-   PARAMS ((prototype))
-   -- for functions which take a fixed number of arguments.  Use this
-   when declaring the function.  When defining the function, write a
-   K+R style argument list.  For example:
-
-       char *strcpy PARAMS ((char *dest, char *source));
-       ...
-       char *
-       strcpy (dest, source)
-            char *dest;
-            char *source;
-       { ... }
-
-
-   VPARAMS ((prototype, ...))
-   -- for functions which take a variable number of arguments.  Use
-   PARAMS to declare the function, VPARAMS to define it.  For example:
-
-       int printf PARAMS ((const char *format, ...));
-       ...
-       int
-       printf VPARAMS ((const char *format, ...))
-       {
-          ...
-       }
-
-   For writing functions which take variable numbers of arguments, we
-   also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros.  These
-   hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
-   thoroughly than the simple VA_START() macro mentioned above.
-
-   VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
-   Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
-   corresponding to the list of fixed arguments.  Then use va_arg
-   normally to get the variable arguments, or pass your va_list object
-   around.  You do not declare the va_list yourself; VA_OPEN does it
-   for you.
-
-   Here is a complete example:
-
-       int
-       printf VPARAMS ((const char *format, ...))
-       {
-          int result;
-
-          VA_OPEN (ap, format);
-          VA_FIXEDARG (ap, const char *, format);
-
-          result = vfprintf (stdout, format, ap);
-          VA_CLOSE (ap);
-
-          return result;
-       }
-
-
-   You can declare variables either before or after the VA_OPEN,
-   VA_FIXEDARG sequence.  Also, VA_OPEN and VA_CLOSE are the beginning
-   and end of a block.  They must appear at the same nesting level,
-   and any variables declared after VA_OPEN go out of scope at
-   VA_CLOSE.  Unfortunately, with a K+R compiler, that includes the
-   argument list.  You can have multiple instances of VA_OPEN/VA_CLOSE
-   pairs in a single function in case you need to traverse the
-   argument list more than once.
-
-   For ease of writing code which uses GCC extensions but needs to be
-   portable to other compilers, we provide the GCC_VERSION macro that
-   simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
-   wrappers around __attribute__.  Also, __extension__ will be #defined
-   to nothing if it doesn't work.  See below.
-
-   This header also defines a lot of obsolete macros:
-   CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
-   AND, DOTS, NOARGS.  Don't use them.  */
-
-#ifndef        _ANSIDECL_H
-#define _ANSIDECL_H    1
-
-/* Every source file includes this file,
-   so they will all get the switch for lint.  */
-/* LINTLIBRARY */
-
-/* Using MACRO(x,y) in cpp #if conditionals does not work with some
-   older preprocessors.  Thus we can't define something like this:
-
-#define HAVE_GCC_VERSION(MAJOR, MINOR) \
-  (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
-
-and then test "#if HAVE_GCC_VERSION(2,7)".
-
-So instead we use the macro below and test it against specific values.  */
-
-/* This macro simplifies testing whether we are using gcc, and if it
-   is of a particular minimum version. (Both major & minor numbers are
-   significant.)  This macro will evaluate to 0 if we are not using
-   gcc at all.  */
-#ifndef GCC_VERSION
-#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
-#endif /* GCC_VERSION */
-
-#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
-/* All known AIX compilers implement these things (but don't always
-   define __STDC__).  The RISC/OS MIPS compiler defines these things
-   in SVR4 mode, but does not define __STDC__.  */
-
-#define ANSI_PROTOTYPES        1
-#define PTR            void *
-#define PTRCONST       void *const
-#define LONG_DOUBLE    long double
-
-#define PARAMS(ARGS)           ARGS
-#define VPARAMS(ARGS)          ARGS
-#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
-
-/* variadic function helper macros */
-/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
-   use without inhibiting further decls and without declaring an
-   actual variable.  */
-#define VA_OPEN(AP, VAR)       { va_list AP; va_start(AP, VAR); { struct Qdmy
-#define VA_CLOSE(AP)           } va_end(AP); }
-#define VA_FIXEDARG(AP, T, N)  struct Qdmy
-#undef const
-#undef volatile
-#undef signed
-
-/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
-   it too, but it's not in C89.  */
-#undef inline
-#if __STDC_VERSION__ > 199901L
-/* it's a keyword */
-#else
-# if GCC_VERSION >= 2007
-#  define inline __inline__   /* __inline__ prevents -pedantic warnings */
-# else
-#  define inline  /* nothing */
-# endif
-#endif
-
-/* These are obsolete.  Do not use.  */
-#ifndef IN_GCC
-#define CONST          const
-#define VOLATILE       volatile
-#define SIGNED         signed
-
-#define PROTO(type, name, arglist)     type name arglist
-#define EXFUN(name, proto)             name proto
-#define DEFUN(name, arglist, args)     name(args)
-#define DEFUN_VOID(name)               name(void)
-#define AND            ,
-#define DOTS           , ...
-#define NOARGS         void
-#endif /* ! IN_GCC */
-
-#else  /* Not ANSI C.  */
-
-#undef  ANSI_PROTOTYPES
-#define PTR            char *
-#define PTRCONST       PTR
-#define LONG_DOUBLE    double
-
-#define PARAMS(args)           ()
-#define VPARAMS(args)          (va_alist) va_dcl
-#define VA_START(va_list, var) va_start(va_list)
-
-#define VA_OPEN(AP, VAR)               { va_list AP; va_start(AP); { struct Qdmy
-#define VA_CLOSE(AP)                   } va_end(AP); }
-#define VA_FIXEDARG(AP, TYPE, NAME)    TYPE NAME = va_arg(AP, TYPE)
-
-/* some systems define these in header files for non-ansi mode */
-#undef const
-#undef volatile
-#undef signed
-#undef inline
-#define const
-#define volatile
-#define signed
-#define inline
-
-#ifndef IN_GCC
-#define CONST
-#define VOLATILE
-#define SIGNED
-
-#define PROTO(type, name, arglist)     type name ()
-#define EXFUN(name, proto)             name()
-#define DEFUN(name, arglist, args)     name arglist args;
-#define DEFUN_VOID(name)               name()
-#define AND            ;
-#define DOTS
-#define NOARGS
-#endif /* ! IN_GCC */
-
-#endif /* ANSI C.  */
-
-/* Define macros for some gcc attributes.  This permits us to use the
-   macros freely, and know that they will come into play for the
-   version of gcc in which they are supported.  */
-
-#if (GCC_VERSION < 2007)
-# define __attribute__(x)
-#endif
-
-/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
-#ifndef ATTRIBUTE_MALLOC
-# if (GCC_VERSION >= 2096)
-#  define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-# else
-#  define ATTRIBUTE_MALLOC
-# endif /* GNUC >= 2.96 */
-#endif /* ATTRIBUTE_MALLOC */
-
-/* Attributes on labels were valid as of gcc 2.93. */
-#ifndef ATTRIBUTE_UNUSED_LABEL
-# if (GCC_VERSION >= 2093)
-#  define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
-# else
-#  define ATTRIBUTE_UNUSED_LABEL
-# endif /* GNUC >= 2.93 */
-#endif /* ATTRIBUTE_UNUSED_LABEL */
-
-#ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#endif /* ATTRIBUTE_UNUSED */
-
-#ifndef ATTRIBUTE_NORETURN
-#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
-#endif /* ATTRIBUTE_NORETURN */
-
-#ifndef ATTRIBUTE_PRINTF
-#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
-#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
-#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
-#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
-#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
-#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
-#endif /* ATTRIBUTE_PRINTF */
-
-/* We use __extension__ in some places to suppress -pedantic warnings
-   about GCC extensions.  This feature didn't work properly before
-   gcc 2.8.  */
-#if GCC_VERSION < 2008
-#define __extension__
-#endif
-
-/* Bootstrap support:  Adjust certain macros defined by Autoconf,
-   which are only valid for the stage1 compiler.  If we detect
-   a modern version of GCC, we are probably in stage2 or beyond,
-   so unconditionally reset the values.  Note that const, inline,
-   etc. have been dealt with above.  */
-#if (GCC_VERSION >= 2007)
-# ifndef HAVE_LONG_DOUBLE
-#  define HAVE_LONG_DOUBLE 1
-# endif
-#endif /* GCC >= 2.7 */
-
-#endif /* ansidecl.h   */
diff --git a/x86_64/asmpart.S b/x86_64/asmpart.S
deleted file mode 100644 (file)
index da6e393..0000000
+++ /dev/null
@@ -1,1069 +0,0 @@
-/* -*- mode: asm; tab-width: 4 -*- */
-/* x86_64/asmpart.S ************************************************************
-*                                                                              *
-*   It contains the Java-C interface functions for x86_64 processors.          *
-*                                                                              *
-*   Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst              *
-*                                                                              *
-*   See file COPYRIGHT for information on usage and disclaimer of warranties   *
-*                                                                              *
-*   Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at            *
-*            Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at            *
-*            Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at            *
-*                                                                              *
-*   Last Change: $Id: asmpart.S 547 2003-11-01 19:22:40Z twisti $         *
-*                                                                              *
-*******************************************************************************/
-
-#include "offsets.h"
-
-       .text
-
-
-/********************* exported functions and variables ***********************/
-
-       .globl asm_calljavamethod
-       .globl asm_calljavafunction
-       .globl asm_call_jit_compiler
-       .globl asm_dumpregistersandcall
-       .globl asm_handle_exception
-       .globl asm_handle_nat_exception
-       .globl asm_builtin_checkcast    
-       .globl asm_builtin_checkarraycast
-       .globl asm_builtin_anewarray
-       .globl asm_builtin_newarray_array
-       .globl asm_builtin_aastore
-       .globl asm_builtin_monitorenter
-       .globl asm_builtin_monitorexit
-    .globl asm_builtin_f2i
-    .globl asm_builtin_f2l
-    .globl asm_builtin_d2i
-    .globl asm_builtin_d2l
-       .globl asm_builtin_arrayinstanceof
-       .globl asm_perform_threadswitch
-       .globl asm_initialize_thread_stack
-       .globl asm_switchstackandcall
-       .globl asm_getcallingmethod
-    .globl asm_builtin_trace
-    .globl asm_builtin_exittrace
-    
-/*************************** imported functions *******************************/
-
-       .globl jit_compile
-       .globl builtin_monitorexit
-       .globl builtin_throw_exception
-       .globl builtin_trace_exception
-       .globl findmethod
-
-        
-/********************* function asm_calljavamethod *****************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 parameters.                                                   *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   An possibly throwed exception will be returned to the caller as function   *
-*   return value, so the java method cannot return a fucntion value (this      *
-*   function usually calls 'main' and '<clinit>' which do not return a         *
-*   function value).                                                           *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-#define        MethodPointer   -8
-#define        FrameSize       -12
-#define     IsSync          -16
-#define     IsLeaf          -20
-#define     IntSave         -24
-#define     FltSave         -28
-#define     ExTableSize     -32
-#define     ExTableStart    -32
-
-#define     ExEntrySize     -32
-#define     ExStartPC       -8
-#define     ExEndPC         -16
-#define     ExHandlerPC     -24
-#define     ExCatchType     -32
-
-call_name:
-       .ascii  "calljavamethod\0\0"
-
-       .align  8
-       .quad   0                         /* catch type all                       */
-       .quad   calljava_xhandler         /* handler pc                           */
-       .quad   calljava_xhandler         /* end pc                               */
-       .quad   asm_calljavamethod        /* start pc                             */
-       .long   1                         /* extable size                         */
-       .long   0                         /* fltsave                              */
-       .long   0                         /* intsave                              */
-       .long   0                         /* isleaf                               */
-       .long   0                         /* IsSync                               */
-       .long   8                         /* frame size                           */
-       .quad   0                         /* method pointer (pointer to name)     */
-
-asm_calljavamethod:
-        sub     $8,%rsp               /* keep %rsp 16-byte aligned            */
-        mov     %rbp,(%rsp)
-        
-        mov     %rdi,%rax             /* move function pointer to %rax        */
-                                      /* compilerstub uses this               */
-        
-        mov     %rsi,%rdi             /* pass remaining parameters            */
-        mov     %rdx,%rsi
-        mov     %rcx,%rdx
-        mov     %r8,%rcx
-        
-        lea            asm_call_jit_compiler,%r11
-        call   *%r11                 /* call JIT compiler                    */
-               
-calljava_jit:
-calljava_return:
-calljava_ret:
-        xor     %rax,%rax
-        mov     (%rsp),%rbp
-        add     $8,%rsp               /* keep %rsp 16-byte aligned            */
-        ret
-
-calljava_xhandler:
-        mov     %rax,%rdi                        /* pass exception pointer               */
-        call    builtin_throw_exception
-        mov     (%rsp),%rbp
-        add     $8,%rsp
-        ret
-
-
-/********************* function asm_calljavafunction ***************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 address parameters.                                           *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-call_name2:
-       .ascii  "calljavafunction\0\0"
-
-       .align  8
-       .quad   0                         /* catch type all                       */
-       .quad   calljava_xhandler2        /* handler pc                           */
-       .quad   calljava_xhandler2        /* end pc                               */
-       .quad   asm_calljavafunction      /* start pc                             */
-       .long   1                         /* extable size                         */
-       .long   0                         /* fltsave                              */
-       .long   0                         /* intsave                              */
-       .long   0                         /* isleaf                               */
-       .long   0                         /* IsSync                               */
-       .long   8                         /* frame size                           */
-       .quad   0                         /* method pointer (pointer to name)     */
-
-asm_calljavafunction:
-        sub     $8,%rsp               /* keep stack 16-byte aligned           */
-        mov     %rbp,(%rsp)
-        mov     %rdi,%rax             /* move function pointer to %rax        */
-                                      /* compilerstub uses this               */
-
-        mov     %rsi,%rdi             /* pass remaining parameters            */
-        mov     %rdx,%rsi
-        mov     %rcx,%rdx
-        mov     %r8,%rcx
-        
-        lea     asm_call_jit_compiler,%r11
-        call    *%r11                 /* call JIT compiler                    */
-       
-calljava_jit2:
-calljava_return2:
-calljava_ret2:
-        mov     (%rsp),%rbp
-        add     $8,%rsp               /* free stack space                     */
-        ret
-
-calljava_xhandler2:
-        mov     %rax,%rdi                /* pass exception pointer               */
-        call    builtin_throw_exception
-        mov     (%rsp),%rbp
-        add     $8,%rsp
-        ret
-                                               
-
-/****************** function asm_call_jit_compiler *****************************
-*                                                                              *
-*   invokes the compiler for untranslated JavaVM methods.                      *
-*                                                                              *
-*   Register R0 contains a pointer to the method info structure (prepared      *
-*   by createcompilerstub). Using the return address in R26 and the            *
-*   offset in the LDA instruction or using the value in methodptr R28 the      *
-*   patching address for storing the method address can be computed:           *
-*                                                                              *
-*   method address was either loaded using                                     *
-*                                                                              *
-*   i386_mov_imm_reg(a, REG_ITMP2)                ; invokestatic/special       *
-*   i386_call_reg(REG_ITMP2)                                                   *
-*                                                                              *
-*   or                                                                         *
-*                                                                              *
-*   i386_mov_membase_reg(REG_SP, 0, REG_ITMP2)    ; invokevirtual/interface    *
-*   i386_mov_membase_reg(REG_ITMP2, OFFSET(, vftbl), REG_ITMP3)                *
-*   i386_mov_membase_reg(REG_ITMP3, OFFSET(vftbl, table[0]) + \                *
-*       sizeof(methodptr) * m->vftblindex, REG_ITMP1)                          *
-*   i386_call_reg(REG_ITMP1)                                                   *
-*                                                                              *
-*   in the static case the method pointer can be computed using the            *
-*   return address and the lda function following the jmp instruction          *
-*                                                                              *
-*******************************************************************************/
-
-
-asm_call_jit_compiler:
-        sub     $8,%rsp         /* keep stack 16-byte aligned                 */
-
-        mov     %rbx,(%rsp)     /* save register                              */
-        
-        mov     8(%rsp),%r11    /* get return address                         */
-        mov     -1(%r11),%bl   /* get function code                          */
-        cmp     $0xd2,%bl              /* called with `call *REG_ITMP2' (%r10)?      */
-        jne     L_not_static_special
-
-        sub     $11,%r11        /* calculate address of immediate             */
-        jmp            L_call_jit_compile
-               
-L_not_static_special:
-               cmp     $0xd0,%bl               /* called with `call *REG_ITMP1' (%rax)       */
-               jne     L_not_virtual_interface
-               
-               sub     $7,%r11         /* calculate address of offset                */
-               mov     (%r11),%r11d    /* get offset (32-bit)                        */
-               add     %r10,%r11       /* add base address to get method address     */
-               jmp     L_call_jit_compile
-
-L_not_virtual_interface:        /* a call from asm_calljavamethod             */
-               xor     %r11,%r11
-               
-L_call_jit_compile:
-        mov     (%rsp),%rbx     /* restore register                           */
-        
-        sub     $(24*8),%rsp    /* 8 + 48 + 64 + 64                           */
-        
-               mov     %r11,0*8(%rsp)  /* save address for method pointer            */
-
-        mov     %rdi,1*8(%rsp)  /* save arguments                             */
-        mov     %rsi,2*8(%rsp)
-        mov     %rdx,3*8(%rsp)
-        mov     %rcx,4*8(%rsp)
-        mov     %r8,5*8(%rsp)
-        mov     %r9,6*8(%rsp)
-
-        movq    %xmm0,7*8(%rsp)
-        movq    %xmm1,8*8(%rsp)
-        movq    %xmm2,9*8(%rsp)
-        movq    %xmm3,10*8(%rsp)
-        movq    %xmm4,11*8(%rsp)
-        movq    %xmm5,12*8(%rsp)
-        movq    %xmm6,13*8(%rsp)
-        movq    %xmm7,14*8(%rsp)
-
-        movq    %xmm8,15*8(%rsp) /* we use them as callee saved registers      */
-        movq    %xmm9,16*8(%rsp)
-        movq    %xmm10,17*8(%rsp)
-        movq    %xmm11,18*8(%rsp)
-        movq    %xmm12,19*8(%rsp)
-        movq    %xmm13,20*8(%rsp)
-        movq    %xmm14,21*8(%rsp)
-        movq    %xmm15,22*8(%rsp)
-
-        mov     %rax,%rdi       /* pass method pointer                        */
-               call    jit_compile
-
-        mov     0*8(%rsp),%r11
-        
-        mov     1*8(%rsp),%rdi
-        mov     2*8(%rsp),%rsi
-        mov     3*8(%rsp),%rdx
-        mov     4*8(%rsp),%rcx
-        mov     5*8(%rsp),%r8
-        mov     6*8(%rsp),%r9
-
-        movq    7*8(%rsp),%xmm0
-        movq    8*8(%rsp),%xmm1
-        movq    9*8(%rsp),%xmm2
-        movq    10*8(%rsp),%xmm3
-        movq    11*8(%rsp),%xmm4
-        movq    12*8(%rsp),%xmm5
-        movq    13*8(%rsp),%xmm6
-        movq    14*8(%rsp),%xmm7
-
-        movq    15*8(%rsp),%xmm8
-        movq    16*8(%rsp),%xmm9
-        movq    17*8(%rsp),%xmm10
-        movq    18*8(%rsp),%xmm11
-        movq    19*8(%rsp),%xmm12
-        movq    20*8(%rsp),%xmm13
-        movq    21*8(%rsp),%xmm14
-        movq    22*8(%rsp),%xmm15
-
-        add     $(24*8),%rsp
-
-               test    %r11,%r11               /* is address == 0 (asm_calljavamethod)       */
-               je              L_call_method
-               
-               mov     %rax,(%r11)             /* and now save the new pointer               */
-
-L_call_method:
-        add     $8,%rsp         /* keep stack 16-byte aligned                 */
-               jmp             *%rax                   /* ...and now call the new method             */
-
-
-
-/****************** function asm_dumpregistersandcall **************************
-*                                                                              *
-*   This funtion saves all callee saved registers and calls the function       *
-*   which is passed as parameter.                                              *
-*                                                                              *
-*   This function is needed by the garbage collector, which needs to access    *
-*   all registers which are stored on the stack. Unused registers are          *
-*   cleared to avoid interferances with the GC.                                *
-*                                                                              *
-*   void asm_dumpregistersandcall (functionptr f);                             *
-*                                                                              *
-*******************************************************************************/
-
-asm_dumpregistersandcall:
-        sub     $(7*8),%rsp             /* allocate stack space               */
-
-        mov     %rbx,0*8(%rsp)          /* save all callee saved registers    */
-        mov     %rsp,1*8(%rsp)
-        mov     %rbp,2*8(%rsp)
-        mov     %r12,3*8(%rsp)
-        mov     %r13,4*8(%rsp)
-        mov     %r14,5*8(%rsp)
-        mov     %r15,6*8(%rsp)
-
-        xor     %rax,%rax               /* intialize the remaining registers  */
-        xor     %rcx,%rcx
-        xor     %rdx,%rdx
-        xor     %rsi,%rsi
-        xor     %r8,%r8
-        xor     %r9,%r9
-        xor     %r10,%r10
-        xor     %r11,%r11
-        
-        call    *%rdi                   /* call function                      */
-
-        mov     0*8(%rsp),%rbx
-        mov     1*8(%rsp),%rsp
-        mov     2*8(%rsp),%rbp
-        mov     3*8(%rsp),%r12
-        mov     4*8(%rsp),%r13
-        mov     5*8(%rsp),%r14
-        mov     6*8(%rsp),%r15
-
-        add     $(7*8),%rsp        
-        ret
-
-
-/********************* function asm_handle_exception ***************************
-*                                                                              *
-*   This function handles an exception. It does not use the usual calling      *
-*   conventions. The exception pointer is passed in REG_ITMP1 and the          *
-*   pc from the exception raising position is passed in REG_ITMP2. It searches *
-*   the local exception table for a handler. If no one is found, it unwinds    *
-*   stacks and continues searching the callers.                                *
-*                                                                              *
-*   void asm_handle_exception (exceptionptr, exceptionpc);                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_handle_nat_exception:
-        add     $8,%rsp                                                /* clear return address of native stub */
-               
-asm_handle_exception:
-        sub     $(4*8),%rsp
-        mov     %rax,0*8(%rsp)              /* save exception pointer         */
-        mov     %r10,1*8(%rsp)              /* save exception pc              */
-        
-        mov     %r10,%rdi                   /* exception pc                   */
-        call   findmethod
-        mov     %rax,%r11
-        mov     %rax,2*8(%rsp)                         /* save data segment pointer      */
-        
-        mov     0*8(%rsp),%rax              /* restore exception pointer      */
-        mov     1*8(%rsp),%r10              /* restore exception pc           */
-        
-ex_stack_loop:
-        mov     %rax,%rdi                                      /* exception pointer              */
-        mov     MethodPointer(%r11),%rsi       /* method pointer                 */
-        mov     %r10,%rdx                   /* exception pc                   */
-        mov     $1,%rcx                                        /* set no unwind flag             */
-        call   builtin_trace_exception
-
-               mov     2*8(%rsp),%r11                          /* %r11 = data segment pointer    */
-               mov     ExTableSize(%r11),%rcx          /* %rcx = exception table size    */
-               test    %rcx,%rcx                                       /* if empty table skip            */
-               je              empty_table
-
-               lea             ExTableStart(%r11),%rdi         /* %rdi = start of exception table */
-               mov     0*8(%rsp),%rax                          /* get xptr                       */
-               
-ex_table_loop:
-               mov     1*8(%rsp),%r10                          /* get xpc                        */
-               
-               mov     ExStartPC(%rdi),%rdx            /* %rdx = exception start pc      */
-               cmp     %r10,%rdx                                       /* %rdx = (startpc <= xpc)        */
-               jg              ex_table_cont                           /* if (false) continue            */
-               mov     ExEndPC(%rdi),%rdx                      /* %rdx = exception end pc        */
-               cmp     %rdx,%r10                                       /* %rdx = (xpc < endpc)           */
-               jge             ex_table_cont                           /* if (false) continue            */
-               mov     ExCatchType(%rdi),%rdx          /* %rdx = exception catch type    */
-               test    %rdx,%rdx                                       /* NULL catches everything        */
-               je              ex_handle_it
-
-               mov     offobjvftbl(%rax),%rsi          /* %rsi = vftblptr(xptr)          */
-               mov     offobjvftbl(%rdx),%rdx          /* %rdx = vftblptr(catchtype) class (not obj) */
-               mov     offbaseval(%rsi),%esi           /* %esi = baseval(xptr)           */
-               mov     offbaseval(%rdx),%r10d          /* %r10d = baseval(catchtype)     */
-               mov     offdiffval(%rdx),%edx           /* %edx = diffval(catchtype)      */
-               sub     %r10d,%esi                                      /* %esi = baseval(xptr) - baseval(catchtype) */
-               cmp     %edx,%esi                                       /* xptr is instanceof catchtype   */
-               ja              ex_table_cont
-               
-ex_handle_it:
-               mov     ExHandlerPC(%rdi),%r10      /* xpc = exception handler pc     */
-
-        mov     0*8(%rsp),%rax              /* restore exception pointer      */
-        add     $(4*8),%rsp                 /* free stack frame               */
-
-        jmp            *%r10                       /* jump to the handler            */
-
-ex_table_cont:
-        lea            ExEntrySize(%rdi),%rdi      /* next exception table entry     */
-        dec     %rcx                        /* decrement entry counter        */
-        test   %rcx,%rcx                   /* if (t0 > 0) next entry         */
-        jg             ex_table_loop
-               
-empty_table:
-        mov     0*8(%rsp),%rax              /* restore exception pointer      */
-        mov     1*8(%rsp),%r10              /* restore exception pc           */
-        mov     2*8(%rsp),%r11                         /* restore data segment pointer   */
-        add     $(4*8),%rsp
-        
-               mov     %rax,%rcx                                       /* save exception pointer         */
-                               
-ex_already_cleared:            
-               movl    IsSync(%r11),%eax                       /* %rax = SyncOffset              */
-               test    %rax,%rax                                       /* if zero no monitorexit         */
-               je              no_monitor_exit
-               
-               add     %rsp,%rax
-               mov     -8(%rax),%rdi
-
-        sub     $(4*8),%rsp
-        mov     %rcx,0*8(%rsp)
-        mov     %r10,1*8(%rsp)
-        mov     %r11,2*8(%rsp)
-        
-               call    builtin_monitorexit
-
-        mov     0*8(%rsp),%rcx
-        mov     1*8(%rsp),%r10
-        mov     2*8(%rsp),%r11
-        add     $(4*8),%rsp
-                
-no_monitor_exit:
-               movl    FrameSize(%r11),%eax            /* %eax = frame size              */
-               add     %rax,%rsp                                       /* unwind stack                   */
-               mov     %rsp,%rax                                       /* %rax = pointer to save area    */
-
-               movl    IntSave(%r11),%edx                      /* %edx = saved int register count */
-        testl   %edx,%edx
-        je      noint
-        
-               cmpl    $1,%edx
-               je              int1
-               cmpl    $2,%edx
-               je              int2
-               cmpl    $3,%edx
-               je              int3
-               cmpl    $4,%edx
-               je              int4
-               cmpl    $5,%edx
-               je              int5
-        
-        mov     -48(%rax),%rbx
-int5:   
-        mov     -40(%rax),%rbp
-int4:   
-        mov     -32(%rax),%r12
-int3:   
-        mov     -24(%rax),%r13
-int2:   
-               mov     -16(%rax),%r14
-int1:   
-               mov     -8(%rax),%r15
-
-               shll    $3,%edx                                         /* multiply by 8 bytes             */
-               sub     %rdx,%rax
-               
-noint:
-               mov     FltSave(%r11),%edx                      /* %edx = saved flt register count */
-               testl   %edx,%edx
-               je      noflt
-
-        cmpl    $1,%edx
-        je      flt1
-        cmpl    $2,%edx
-        je      flt2
-        cmpl    $3,%edx
-        je      flt3
-        cmpl    $4,%edx
-        je      flt4
-        cmpl    $5,%edx
-        je      flt5
-        cmpl    $6,%edx
-        je      flt7
-        cmpl    $7,%edx
-        je      flt7
-
-        movq    -64(%rax),%xmm8
-flt7:   
-        movq    -56(%rax),%xmm9
-flt6:   
-        movq    -48(%rax),%xmm10
-flt5:   
-        movq    -40(%rax),%xmm11
-flt4:   
-        movq    -32(%rax),%xmm12
-flt3:   
-        movq    -24(%rax),%xmm13
-flt2:   
-        movq    -16(%rax),%xmm14
-flt1:   
-        movq    -8(%rax),%xmm15
-                
-noflt:                                 
-               pop     %r10                                            /* the new xpc is return address  */
-               sub     $3,%r10                     /* subtract 3 bytes for call      */
-
-        sub     $(2*8),%rsp
-        mov     %rcx,0*8(%rsp)
-        mov     %r10,1*8(%rsp)
-
-        mov     %r10,%rdi
-        call   findmethod                              /* get the new data segment ptr   */
-        mov     %rax,%r11
-        
-        mov     0*8(%rsp),%rcx
-        mov     1*8(%rsp),%r10
-        add     $(2*8),%rsp
-
-        mov     %rcx,%rax                                      /* restore saved exception pointer */
-
-        sub     $(4*8),%rsp
-                                       
-        mov     %rax,0*8(%rsp)              /* save exception pointer         */
-        mov     %r10,1*8(%rsp)              /* save exception pc              */
-               mov     %r11,2*8(%rsp)                          /* save data segment pointer      */
-               
-               jmp             ex_stack_loop
-
-
-/********************* function asm_builtin_monitorenter ***********************
-*                                                                              *
-*   Does null check and calls monitorenter or throws an exception              *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_monitorenter:
-        test    %rdi,%rdi
-        je      nb_monitorenter                        /* if (null) throw exception          */
-        jmp     builtin_monitorenter   /* else call builtin_monitorenter     */
-
-nb_monitorenter:
-        pop     %r10                                   /* delete return address */
-        sub     $3,%r10                                        /* faulting address is return adress - 3 */
-        mov     proto_java_lang_NullPointerException,%rax
-        jmp     asm_handle_exception
-               
-
-/********************* function asm_builtin_monitorexit ************************
-*                                                                              *
-*   Does null check and calls monitorexit or throws an exception               *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_monitorexit:
-        test    %rdi,%rdi
-        je      nb_monitorexit                 /* if (null) throw exception          */
-        jmp     builtin_monitorexit            /* else call builtin_monitorenter     */
-
-nb_monitorexit:
-        pop     %r10                                   /* delete return address */
-        sub     $3,%r10                                        /* faulting address is return adress - 3 */
-        mov     proto_java_lang_NullPointerException,%rax
-        jmp     asm_handle_exception
-
-
-/********************* function asm_builtin_x2x ********************************
-*                                                                              *
-*   Wrapper functions for float to int corner cases                            *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_f2i:
-        sub     $(14*8),%rsp
-
-        mov     %rdi,0*8(%rsp)
-        mov     %rsi,1*8(%rsp)
-        mov     %rdx,2*8(%rsp)
-        mov     %rcx,3*8(%rsp)
-        mov     %r8,4*8(%rsp)
-        mov     %r9,5*8(%rsp)
-        
-        movq    %xmm0,6*8(%rsp)
-        movq    %xmm1,7*8(%rsp)
-        movq    %xmm2,8*8(%rsp)
-        movq    %xmm3,9*8(%rsp)
-        movq    %xmm4,10*8(%rsp)
-        movq    %xmm5,11*8(%rsp)
-        movq    %xmm6,12*8(%rsp)
-        movq    %xmm7,13*8(%rsp)
-
-        movq    %xmm8,%xmm0
-        call    builtin_f2i
-        
-        mov     0*8(%rsp),%rdi
-        mov     1*8(%rsp),%rsi
-        mov     2*8(%rsp),%rdx
-        mov     3*8(%rsp),%rcx
-        mov     4*8(%rsp),%r8
-        mov     5*8(%rsp),%r9
-
-        movq    6*8(%rsp),%xmm0
-        movq    7*8(%rsp),%xmm1
-        movq    8*8(%rsp),%xmm2
-        movq    9*8(%rsp),%xmm3
-        movq    10*8(%rsp),%xmm4
-        movq    11*8(%rsp),%xmm5
-        movq    12*8(%rsp),%xmm6
-        movq    13*8(%rsp),%xmm7
-        
-        add     $(14*8),%rsp
-        ret
-
-asm_builtin_f2l:
-        sub     $(14*8),%rsp
-
-        mov     %rdi,0*8(%rsp)
-        mov     %rsi,1*8(%rsp)
-        mov     %rdx,2*8(%rsp)
-        mov     %rcx,3*8(%rsp)
-        mov     %r8,4*8(%rsp)
-        mov     %r9,5*8(%rsp)
-        
-        movq    %xmm0,6*8(%rsp)
-        movq    %xmm1,7*8(%rsp)
-        movq    %xmm2,8*8(%rsp)
-        movq    %xmm3,9*8(%rsp)
-        movq    %xmm4,10*8(%rsp)
-        movq    %xmm5,11*8(%rsp)
-        movq    %xmm6,12*8(%rsp)
-        movq    %xmm7,13*8(%rsp)
-
-        movq    %xmm8,%xmm0
-        call    builtin_f2l
-        
-        mov     0*8(%rsp),%rdi
-        mov     1*8(%rsp),%rsi
-        mov     2*8(%rsp),%rdx
-        mov     3*8(%rsp),%rcx
-        mov     4*8(%rsp),%r8
-        mov     5*8(%rsp),%r9
-
-        movq    6*8(%rsp),%xmm0
-        movq    7*8(%rsp),%xmm1
-        movq    8*8(%rsp),%xmm2
-        movq    9*8(%rsp),%xmm3
-        movq    10*8(%rsp),%xmm4
-        movq    11*8(%rsp),%xmm5
-        movq    12*8(%rsp),%xmm6
-        movq    13*8(%rsp),%xmm7
-        
-        add     $(14*8),%rsp
-        ret
-
-                
-asm_builtin_d2i:
-        sub     $(14*8),%rsp
-
-        mov     %rdi,0*8(%rsp)
-        mov     %rsi,1*8(%rsp)
-        mov     %rdx,2*8(%rsp)
-        mov     %rcx,3*8(%rsp)
-        mov     %r8,4*8(%rsp)
-        mov     %r9,5*8(%rsp)
-        
-        movq    %xmm0,6*8(%rsp)
-        movq    %xmm1,7*8(%rsp)
-        movq    %xmm2,8*8(%rsp)
-        movq    %xmm3,9*8(%rsp)
-        movq    %xmm4,10*8(%rsp)
-        movq    %xmm5,11*8(%rsp)
-        movq    %xmm6,12*8(%rsp)
-        movq    %xmm7,13*8(%rsp)
-
-        movq    %xmm8,%xmm0
-        call    builtin_d2i
-        
-        mov     0*8(%rsp),%rdi
-        mov     1*8(%rsp),%rsi
-        mov     2*8(%rsp),%rdx
-        mov     3*8(%rsp),%rcx
-        mov     4*8(%rsp),%r8
-        mov     5*8(%rsp),%r9
-
-        movq    6*8(%rsp),%xmm0
-        movq    7*8(%rsp),%xmm1
-        movq    8*8(%rsp),%xmm2
-        movq    9*8(%rsp),%xmm3
-        movq    10*8(%rsp),%xmm4
-        movq    11*8(%rsp),%xmm5
-        movq    12*8(%rsp),%xmm6
-        movq    13*8(%rsp),%xmm7
-        
-        add     $(14*8),%rsp
-        ret
-
-
-asm_builtin_d2l:
-        sub     $(14*8),%rsp
-
-        mov     %rdi,0*8(%rsp)
-        mov     %rsi,1*8(%rsp)
-        mov     %rdx,2*8(%rsp)
-        mov     %rcx,3*8(%rsp)
-        mov     %r8,4*8(%rsp)
-        mov     %r9,5*8(%rsp)
-        
-        movq    %xmm0,6*8(%rsp)
-        movq    %xmm1,7*8(%rsp)
-        movq    %xmm2,8*8(%rsp)
-        movq    %xmm3,9*8(%rsp)
-        movq    %xmm4,10*8(%rsp)
-        movq    %xmm5,11*8(%rsp)
-        movq    %xmm6,12*8(%rsp)
-        movq    %xmm7,13*8(%rsp)
-
-        movq    %xmm8,%xmm0
-        call    builtin_d2l
-        
-        mov     0*8(%rsp),%rdi
-        mov     1*8(%rsp),%rsi
-        mov     2*8(%rsp),%rdx
-        mov     3*8(%rsp),%rcx
-        mov     4*8(%rsp),%r8
-        mov     5*8(%rsp),%r9
-
-        movq    6*8(%rsp),%xmm0
-        movq    7*8(%rsp),%xmm1
-        movq    8*8(%rsp),%xmm2
-        movq    9*8(%rsp),%xmm3
-        movq    10*8(%rsp),%xmm4
-        movq    11*8(%rsp),%xmm5
-        movq    12*8(%rsp),%xmm6
-        movq    13*8(%rsp),%xmm7
-        
-        add     $(14*8),%rsp
-        ret
-
-        
-/*********************** function new_builtin_checkcast ************************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_checkcast:
-        xor     %rax,%rax
-        mov     %rax,(%rax)
-        ret
-
-               
-/******************* function asm_builtin_checkarraycast ***********************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_checkarraycast:
-        sub     $24,%rsp                               /* keep stack 16-byte aligned         */
-        mov     %rdi,(%rsp)                            /* save object pointer                */
-        call    builtin_checkarraycast  /* builtin_checkarraycast             */
-        test    %rax,%rax               /* if (false) throw exception         */
-        je      nb_carray_throw
-        mov     (%rsp),%rax             /* return object pointer              */
-        add     $24,%rsp                /* free stack space                   */
-        ret
-
-nb_carray_throw:
-        add     $24,%rsp
-        pop     %r10                                   /* delete return address              */
-        sub     $3,%r10                                        /* faulting address is return adress - 3 */
-        mov     proto_java_lang_ClassCastException,%rax
-        jmp     asm_handle_exception
-
-               
-/******************* function asm_builtin_aastore ******************************
-*                                                                              *
-*   Does the cast check and eventually throws an exception                     *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_aastore:
-        sub     $24,%rsp                       /* allocate stack space               */
-        test    %rdi,%rdi                              /* if null pointer throw exception    */
-        je      nb_aastore_null
-
-        movl    offarraysize(%rdi),%eax /* load size                          */
-        cmpl    %eax,%esi                              /* do bound check                     */
-        ja      nb_aastore_bound               /* if out of bounds throw exception   */
-
-        shl     $3,%rsi                                        /* index * 8                          */
-        mov     %rdi,%r10
-        add     %rsi,%r10                              /* add index * 8 to arrayref          */
-               
-        mov     %r10,(%rsp)                    /* save store position                */
-        mov     %rdx,8(%rsp)            /* save object                        */
-        
-        mov     %rdx,%rsi               /* object is second argument          */
-        call    builtin_canstore               /* builtin_canstore(arrayref,object)  */
-        test    %rax,%rax                              /* if (false) throw exception         */
-        je      nb_aastore_throw
-
-        mov     (%rsp),%r10             /* restore store position             */
-        mov     8(%rsp),%rdx            /* restore object                     */
-        mov     %rdx,offobjarrdata(%r10)/* store objectptr in array           */
-        add     $24,%rsp                /* free stack space                   */
-        ret
-
-nb_aastore_null:
-        add     $24,%rsp
-        pop     %r10                                   /* delete return address */
-        sub     $3,%r10                                        /* faulting address is return adress - 3 */
-               
-        mov     proto_java_lang_NullPointerException,%rax
-        jmp     asm_handle_exception
-
-nb_aastore_bound:
-        add     $24,%rsp
-        pop     %r10                                   /* delete return address */
-        sub     $3,%r10                                        /* faulting address is return adress - 3 */
-               
-        mov     proto_java_lang_ArrayIndexOutOfBoundsException,%rax
-        jmp     asm_handle_exception
-               
-nb_aastore_throw:
-        add     $24,%rsp
-        pop     %r10                                   /* delete return address */
-        sub     $3,%r10                                        /* faulting address is return adress - 3 */
-               
-        mov     proto_java_lang_ArrayStoreException,%rax
-        jmp            asm_handle_exception
-
-               
-/******************* function asm_initialize_thread_stack **********************
-*                                                                              *
-* initialized a thread stack                                                   *
-* (to)->restorePoint = asm_initialize_thread_stack((u1*)(func), (to)->stackEnd)*
-*                                                                              *
-*******************************************************************************/
-
-asm_initialize_thread_stack:
-        sub     $(7*8),%rsi
-
-        xor     %r10,%r10
-        mov     %r10,0*8(%rsi)
-        mov     %r10,1*8(%rsi)
-        mov     %r10,2*8(%rsi)
-        mov     %r10,3*8(%rsi)
-        mov     %r10,4*8(%rsi)
-        mov     %r10,5*8(%rsi)
-
-        mov     %rdi,6*8(%rsi)          /* save (u1*) (func)                  */
-        mov     %rsi,%rax               /* return restorepoint in %rax        */
-        ret
-
-
-/******************* function asm_perform_threadswitch *************************
-*                                                                              *
-*   void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);         *
-*                                                                              *
-*   performs a threadswitch                                                    *
-*                                                                              *
-*******************************************************************************/
-
-asm_perform_threadswitch:
-        sub     $(7*8),%rsp             /* allocate stack frame               */
-
-        mov     %rbx,0*8(%rsp)
-        mov     %rbp,1*8(%rsp)
-        mov     %r12,2*8(%rsp)
-        mov     %r13,3*8(%rsp)
-        mov     %r14,4*8(%rsp)
-        mov     %r15,5*8(%rsp)
-
-        mov     7*8(%rsp),%rax                 /* save current return address        */
-        mov     %rax,6*8(%rsp)
-
-        mov     %rsp,(%rdi)                    /* first argument **from              */
-        mov     %rsp,(%rdx)                    /* third argument **stackTop          */
-
-        mov     (%rsi),%rsp                    /* load new stack pointer             */
-
-        mov     0*8(%rsp),%rbx
-        mov     1*8(%rsp),%rbp
-        mov     2*8(%rsp),%r12
-        mov     3*8(%rsp),%r13
-        mov     4*8(%rsp),%r14
-        mov     5*8(%rsp),%r15
-
-        mov     6*8(%rsp),%rax          /* restore return address             */
-        add     $(7*8),%rsp             /* free stack frame                   */
-        mov     %rax,(%rsp)
-        ret
-               
-
-/********************* function asm_switchstackandcall *************************
-*                                                                              *
-*  int asm_switchstackandcall (void *stack, void *func, void **stacktopsave,   *
-*                                     void *p);                                       *
-*                                                                              *
-*   Switches to a new stack, calls a function and switches back.               *
-*       a0 (%rdi)     new stack pointer                                        *
-*       a1 (%rsi)     function pointer                                         *
-*              a2 (%rdx)     pointer to variable where stack top should be stored     *
-*       a3 (%rcx)     pointer to user data, is passed to the function          *
-*                                                                              *
-*******************************************************************************/
-
-asm_switchstackandcall:
-        sub     $8,%rsp                 /* keep stack 16-byte aligned         */
-        sub     $16,%rdi                               /* allocate new stack                 */
-
-        mov     8(%rsp),%rax                   /* save return address on new stack   */
-        mov     %rax,(%rdi)
-        mov     %rsp,8(%rdi)                   /* save old stack pointer on new stack */
-        mov     %rsp,(%rdx)                            /* save old stack pointer to variable */
-
-        mov     %rdi,%rsp                              /* switch to new stack                */
-
-        mov     %rcx,%rdi                      /* pass pointer                       */
-        call   *%rsi                                   /* and call function                  */
-
-        mov     (%rsp),%r10                            /* load return address                */
-        mov     8(%rsp),%rsp                   /* switch to old stack                */
-        add     $8,%rsp                 /* free stack space                   */
-        mov     %r10,(%rsp)             /* write return adress                */
-        ret
-
-               
-/********************* function asm_getcallingmethod ***************************
-*                                                                              *
-*   classinfo *asm_getcallingmethod ();                                                                   *
-*                                                                                                                                                         *    
-*   goes back stack frames to get the calling method                                              *
-*                                                                                                                                                         *
-*                              t2 .. sp                                                                                                       *
-*                              t3 .. ra                                                                                                       *
-*                              t4 .. pv                                                                                                       *
-*                                                                              *
-*   Stack:                                                                     *
-*       java function                                                          *
-*       native stub                                                            *
-*       Java_java_lang_System_getCallerClass                                   *
-*                                                                              *
-*******************************************************************************/
-
-asm_getcallingmethod:
-        mov     %rbp,%rax               /* return address of native function  */
-        add     $(2*8),%rax             /* %rsp, return address               */
-        add     $(7*8),%rax             /* native stub stackframe             */
-        mov     (%rax),%rdi             /* return address to java function    */
-        call    findmethod
-        mov     MethodPointer(%rax),%rax
-        ret
-
-
-/*********************** function asm_builtin_trace ****************************
-*                                                                              *
-*   Intended to be called from the native stub. Saves all argument registers   *
-*   and calls builtin_trace_args.                                              *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_trace:
-        sub     $(15*8),%rsp       /* 14 + 1 */
-        
-        mov     %rdi,0*8(%rsp)  /* save arguments                             */
-        mov     %rsi,1*8(%rsp)
-        mov     %rdx,2*8(%rsp)
-        mov     %rcx,3*8(%rsp)
-        mov     %r8,4*8(%rsp)
-        mov     %r9,5*8(%rsp)
-
-        movq    %xmm0,6*8(%rsp)
-        movq    %xmm1,7*8(%rsp)
-        movq    %xmm2,8*8(%rsp)
-        movq    %xmm3,9*8(%rsp)
-        movq    %xmm4,10*8(%rsp)
-        movq    %xmm5,11*8(%rsp)
-        movq    %xmm6,12*8(%rsp)
-        movq    %xmm7,13*8(%rsp)
-
-        call   builtin_trace_args
-
-        mov     0*8(%rsp),%rdi
-        mov     1*8(%rsp),%rsi
-        mov     2*8(%rsp),%rdx
-        mov     3*8(%rsp),%rcx
-        mov     4*8(%rsp),%r8
-        mov     5*8(%rsp),%r9
-
-        movq    6*8(%rsp),%xmm0
-        movq    7*8(%rsp),%xmm1
-        movq    8*8(%rsp),%xmm2
-        movq    9*8(%rsp),%xmm3
-        movq    10*8(%rsp),%xmm4
-        movq    11*8(%rsp),%xmm5
-        movq    12*8(%rsp),%xmm6
-        movq    13*8(%rsp),%xmm7
-
-        add     $(15*8),%rsp
-        ret
-
-
-/********************* function asm_builtin_exittrace **************************
-*                                                                              *
-*   Intended to be called from the native stub. Saves return value and calls   *
-*   builtin_displaymethodstop.                                                 *
-*                                                                              *
-*******************************************************************************/
-
-asm_builtin_exittrace:
-        sub     $(3*8),%rsp
-        mov     %rax,0*8(%rsp)
-        movq    %xmm0,1*8(%rsp)
-        movq    %xmm0,%xmm1
-        call    builtin_displaymethodstop
-        mov     0*8(%rsp),%rax
-        movq    1*8(%rsp),%xmm0
-        add     $(3*8),%rsp
-        ret
diff --git a/x86_64/bfd.h b/x86_64/bfd.h
deleted file mode 100644 (file)
index baaa0c2..0000000
+++ /dev/null
@@ -1,4177 +0,0 @@
-/* DO NOT EDIT!  This file is automatically 
-   generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c", 
-   "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c", 
-   "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c", 
-   "linker.c" and "simple.c".
-   Run "make headers" in your build bfd/ to regenerate.  */
-
-/* Main header file for the bfd library -- portable access to object files.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
-   Free Software Foundation, Inc.
-   Contributed by Cygnus Support.
-
-   This file is part of BFD, the Binary File Descriptor library.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-#ifndef __BFD_H_SEEN__
-#define __BFD_H_SEEN__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "ansidecl.h"
-#include "symcat.h"
-#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-#ifndef SABER
-/* This hack is to avoid a problem with some strict ANSI C preprocessors.
-   The problem is, "32_" is not a valid preprocessing token, and we don't
-   want extra underscores (e.g., "nlm_32_").  The XCONCAT2 macro will
-   cause the inner CONCAT2 macros to be evaluated first, producing
-   still-valid pp-tokens.  Then the final concatenation can be done.  */
-#undef CONCAT4
-#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
-#endif
-#endif
-
-/* The word size used by BFD on the host.  This may be 64 with a 32
-   bit target if the host is 64 bit, or if other 64 bit targets have
-   been selected with --enable-targets, or if --enable-64-bit-bfd.  */
-#define BFD_ARCH_SIZE 64
-
-/* The word size of the default bfd target.  */
-#define BFD_DEFAULT_TARGET_SIZE 64
-
-#define BFD_HOST_64BIT_LONG 1
-#if 0
-#define BFD_HOST_64_BIT 
-#define BFD_HOST_U_64_BIT 
-#endif
-
-#if BFD_ARCH_SIZE >= 64
-#define BFD64
-#endif
-
-#ifndef INLINE
-#if __GNUC__ >= 2
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-#endif
-
-/* Forward declaration.  */
-typedef struct _bfd bfd;
-
-/* To squelch erroneous compiler warnings ("illegal pointer
-   combination") from the SVR3 compiler, we would like to typedef
-   boolean to int (it doesn't like functions which return boolean.
-   Making sure they are never implicitly declared to return int
-   doesn't seem to help).  But this file is not configured based on
-   the host.  */
-/* General rules: functions which are boolean return true on success
-   and false on failure (unless they're a predicate).   -- bfd.doc */
-/* I'm sure this is going to break something and someone is going to
-   force me to change it.  */
-/* typedef enum boolean {false, true} boolean; */
-/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
-/* It gets worse if the host also defines a true/false enum... -sts */
-/* And even worse if your compiler has built-in boolean types... -law */
-/* And even worse if your compiler provides a stdbool.h that conflicts
-   with these definitions... gcc 2.95 and later do.  If so, it must
-   be included first.  -drow */
-#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
-#define TRUE_FALSE_ALREADY_DEFINED
-#else
-#if defined (__bool_true_false_are_defined)
-/* We have <stdbool.h>.  */
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif
-#endif
-#ifdef MPW
-/* Pre-emptive strike - get the file with the enum.  */
-#include <Types.h>
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif /* MPW */
-#ifndef TRUE_FALSE_ALREADY_DEFINED
-/*typedef enum bfd_boolean {false, true} boolean;*/
-typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
-#define BFD_TRUE_FALSE
-#else
-/* Use enum names that will appear nowhere else.  */
-typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
-#endif
-
-/* Support for different sizes of target format ints and addresses.
-   If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
-   set to 1 above.  Otherwise, if gcc is being used, this code will
-   use gcc's "long long" type.  Otherwise, BFD_HOST_64_BIT must be
-   defined above.  */
-
-#ifndef BFD_HOST_64_BIT
-# if BFD_HOST_64BIT_LONG
-#  define BFD_HOST_64_BIT long
-#  define BFD_HOST_U_64_BIT unsigned long
-# else
-#  ifdef __GNUC__
-#   if __GNUC__ >= 2
-#    define BFD_HOST_64_BIT long long
-#    define BFD_HOST_U_64_BIT unsigned long long
-#   endif /* __GNUC__ >= 2 */
-#  endif /* ! defined (__GNUC__) */
-# endif /* ! BFD_HOST_64BIT_LONG */
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
-#ifdef BFD64
-
-#ifndef BFD_HOST_64_BIT
- #error No 64 bit integer type available
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
-typedef BFD_HOST_U_64_BIT bfd_vma;
-typedef BFD_HOST_64_BIT bfd_signed_vma;
-typedef BFD_HOST_U_64_BIT bfd_size_type;
-typedef BFD_HOST_U_64_BIT symvalue;
-
-#ifndef fprintf_vma
-#if BFD_HOST_64BIT_LONG
-#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
-#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
-#else
-#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
-#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
-#define fprintf_vma(s,x) \
-  fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#define sprintf_vma(s,x) \
-  sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
-#endif
-#endif
-
-#else /* not BFD64  */
-
-/* Represent a target address.  Also used as a generic unsigned type
-   which is guaranteed to be big enough to hold any arithmetic types
-   we need to deal with.  */
-typedef unsigned long bfd_vma;
-
-/* A generic signed type which is guaranteed to be big enough to hold any
-   arithmetic types we need to deal with.  Can be assumed to be compatible
-   with bfd_vma in the same way that signed and unsigned ints are compatible
-   (as parameters, in assignment, etc).  */
-typedef long bfd_signed_vma;
-
-typedef unsigned long symvalue;
-typedef unsigned long bfd_size_type;
-
-/* Print a bfd_vma x on stream s.  */
-#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
-#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
-
-#endif /* not BFD64  */
-
-/* A pointer to a position in a file.  */
-/* FIXME:  This should be using off_t from <sys/types.h>.
-   For now, try to avoid breaking stuff by not including <sys/types.h> here.
-   This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
-   Probably the best long-term answer is to avoid using file_ptr AND off_t
-   in this header file, and to handle this in the BFD implementation
-   rather than in its interface.  */
-/* typedef off_t       file_ptr; */
-typedef bfd_signed_vma file_ptr;
-typedef bfd_vma ufile_ptr;
-
-extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
-extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
-
-#define printf_vma(x) fprintf_vma(stdout,x)
-#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
-
-typedef unsigned int flagword; /* 32 bits of flags */
-typedef unsigned char bfd_byte;
-\f
-/* File formats.  */
-
-typedef enum bfd_format
-{
-  bfd_unknown = 0,     /* File format is unknown.  */
-  bfd_object,          /* Linker/assember/compiler output.  */
-  bfd_archive,         /* Object archive file.  */
-  bfd_core,            /* Core dump.  */
-  bfd_type_end         /* Marks the end; don't use it!  */
-}
-bfd_format;
-
-/* Values that may appear in the flags field of a BFD.  These also
-   appear in the object_flags field of the bfd_target structure, where
-   they indicate the set of flags used by that backend (not all flags
-   are meaningful for all object file formats) (FIXME: at the moment,
-   the object_flags values have mostly just been copied from backend
-   to another, and are not necessarily correct).  */
-
-/* No flags.  */
-#define BFD_NO_FLAGS           0x00
-
-/* BFD contains relocation entries.  */
-#define HAS_RELOC      0x01
-
-/* BFD is directly executable.  */
-#define EXEC_P         0x02
-
-/* BFD has line number information (basically used for F_LNNO in a
-   COFF header).  */
-#define HAS_LINENO     0x04
-
-/* BFD has debugging information.  */
-#define HAS_DEBUG      0x08
-
-/* BFD has symbols.  */
-#define HAS_SYMS       0x10
-
-/* BFD has local symbols (basically used for F_LSYMS in a COFF
-   header).  */
-#define HAS_LOCALS     0x20
-
-/* BFD is a dynamic object.  */
-#define DYNAMIC        0x40
-
-/* Text section is write protected (if D_PAGED is not set, this is
-   like an a.out NMAGIC file) (the linker sets this by default, but
-   clears it for -r or -N).  */
-#define WP_TEXT        0x80
-
-/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
-   linker sets this by default, but clears it for -r or -n or -N).  */
-#define D_PAGED        0x100
-
-/* BFD is relaxable (this means that bfd_relax_section may be able to
-   do something) (sometimes bfd_relax_section can do something even if
-   this is not set).  */
-#define BFD_IS_RELAXABLE 0x200
-
-/* This may be set before writing out a BFD to request using a
-   traditional format.  For example, this is used to request that when
-   writing out an a.out object the symbols not be hashed to eliminate
-   duplicates.  */
-#define BFD_TRADITIONAL_FORMAT 0x400
-
-/* This flag indicates that the BFD contents are actually cached in
-   memory.  If this is set, iostream points to a bfd_in_memory struct.  */
-#define BFD_IN_MEMORY 0x800
-/* The sections in this BFD specify a memory page.  */
-#define HAS_LOAD_PAGE 0x1000
-\f
-/* Symbols and relocation.  */
-
-/* A count of carsyms (canonical archive symbols).  */
-typedef unsigned long symindex;
-
-/* How to perform a relocation.  */
-typedef const struct reloc_howto_struct reloc_howto_type;
-
-#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-
-/* General purpose part of a symbol X;
-   target specific parts are in libcoff.h, libaout.h, etc.  */
-
-#define bfd_get_section(x) ((x)->section)
-#define bfd_get_output_section(x) ((x)->section->output_section)
-#define bfd_set_section(x,y) ((x)->section) = (y)
-#define bfd_asymbol_base(x) ((x)->section->vma)
-#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
-#define bfd_asymbol_name(x) ((x)->name)
-/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
-#define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
-
-/* A canonical archive symbol.  */
-/* This is a type pun with struct ranlib on purpose!  */
-typedef struct carsym
-{
-  char *name;
-  file_ptr file_offset;        /* Look here to find the file.  */
-}
-carsym;                        /* To make these you call a carsymogen.  */
-
-/* Used in generating armaps (archive tables of contents).
-   Perhaps just a forward definition would do?  */
-struct orl                     /* Output ranlib.  */
-{
-  char **name;         /* Symbol name.  */
-  union
-  {
-    file_ptr pos;
-    bfd *abfd;
-  } u;                 /* bfd* or file position.  */
-  int namidx;          /* Index into string table.  */
-};
-\f
-/* Linenumber stuff.  */
-typedef struct lineno_cache_entry
-{
-  unsigned int line_number;    /* Linenumber from start of function.  */
-  union
-  {
-    struct symbol_cache_entry *sym;    /* Function name.  */
-    bfd_vma offset;                    /* Offset into section.  */
-  } u;
-}
-alent;
-\f
-/* Object and core file sections.  */
-
-#define        align_power(addr, align)        \
-  (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
-
-typedef struct sec *sec_ptr;
-
-#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
-#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
-#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
-#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
-#define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
-#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
-#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
-#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
-#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
-
-#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)true), true)
-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
-
-typedef struct stat stat_type;
-\f
-typedef enum bfd_print_symbol
-{
-  bfd_print_symbol_name,
-  bfd_print_symbol_more,
-  bfd_print_symbol_all
-} bfd_print_symbol_type;
-
-/* Information about a symbol that nm needs.  */
-
-typedef struct _symbol_info
-{
-  symvalue value;
-  char type;
-  const char *name;            /* Symbol name.  */
-  unsigned char stab_type;     /* Stab type.  */
-  char stab_other;             /* Stab other.  */
-  short stab_desc;             /* Stab desc.  */
-  const char *stab_name;       /* String for stab type.  */
-} symbol_info;
-
-/* Get the name of a stabs type code.  */
-
-extern const char *bfd_get_stab_name PARAMS ((int));
-\f
-/* Hash table routines.  There is no way to free up a hash table.  */
-
-/* An element in the hash table.  Most uses will actually use a larger
-   structure, and an instance of this will be the first field.  */
-
-struct bfd_hash_entry
-{
-  /* Next entry for this hash code.  */
-  struct bfd_hash_entry *next;
-  /* String being hashed.  */
-  const char *string;
-  /* Hash code.  This is the full hash code, not the index into the
-     table.  */
-  unsigned long hash;
-};
-
-/* A hash table.  */
-
-struct bfd_hash_table
-{
-  /* The hash array.  */
-  struct bfd_hash_entry **table;
-  /* The number of slots in the hash table.  */
-  unsigned int size;
-  /* A function used to create new elements in the hash table.  The
-     first entry is itself a pointer to an element.  When this
-     function is first invoked, this pointer will be NULL.  However,
-     having the pointer permits a hierarchy of method functions to be
-     built each of which calls the function in the superclass.  Thus
-     each function should be written to allocate a new block of memory
-     only if the argument is NULL.  */
-  struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
-                                            struct bfd_hash_table *,
-                                            const char *));
-   /* An objalloc for this hash table.  This is a struct objalloc *,
-     but we use PTR to avoid requiring the inclusion of objalloc.h.  */
-  PTR memory;
-};
-
-/* Initialize a hash table.  */
-extern boolean bfd_hash_table_init
-  PARAMS ((struct bfd_hash_table *,
-          struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
-                                      struct bfd_hash_table *,
-                                      const char *)));
-
-/* Initialize a hash table specifying a size.  */
-extern boolean bfd_hash_table_init_n
-  PARAMS ((struct bfd_hash_table *,
-          struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
-                                      struct bfd_hash_table *,
-                                      const char *),
-          unsigned int size));
-
-/* Free up a hash table.  */
-extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
-
-/* Look up a string in a hash table.  If CREATE is true, a new entry
-   will be created for this string if one does not already exist.  The
-   COPY argument must be true if this routine should copy the string
-   into newly allocated memory when adding an entry.  */
-extern struct bfd_hash_entry *bfd_hash_lookup
-  PARAMS ((struct bfd_hash_table *, const char *, boolean create,
-          boolean copy));
-
-/* Replace an entry in a hash table.  */
-extern void bfd_hash_replace
-  PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
-          struct bfd_hash_entry *nw));
-
-/* Base method for creating a hash table entry.  */
-extern struct bfd_hash_entry *bfd_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
-          const char *));
-
-/* Grab some space for a hash table entry.  */
-extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
-                                     unsigned int));
-
-/* Traverse a hash table in a random order, calling a function on each
-   element.  If the function returns false, the traversal stops.  The
-   INFO argument is passed to the function.  */
-extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
-                                      boolean (*) (struct bfd_hash_entry *,
-                                                   PTR),
-                                      PTR info));
-
-#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
-
-/* User program access to BFD facilities.  */
-
-/* Direct I/O routines, for programs which know more about the object
-   file than BFD does.  Use higher level routines if possible.  */
-
-extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *));
-extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *));
-extern int bfd_seek PARAMS ((bfd *, file_ptr, int));
-extern ufile_ptr bfd_tell PARAMS ((bfd *));
-extern int bfd_flush PARAMS ((bfd *));
-extern int bfd_stat PARAMS ((bfd *, struct stat *));
-
-/* Deprecated old routines.  */
-#if __GNUC__
-#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
-  (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__),     \
-   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
-#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
-  (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__),    \
-   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
-#else
-#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
-  (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
-   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
-#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
-  (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
-   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
-#endif
-extern void warn_deprecated
-  PARAMS ((const char *, const char *, int, const char *));
-
-/* Cast from const char * to char * so that caller can assign to
-   a char * without a warning.  */
-#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
-#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
-#define bfd_get_format(abfd) ((abfd)->format)
-#define bfd_get_target(abfd) ((abfd)->xvec->name)
-#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
-#define bfd_family_coff(abfd) \
-  (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
-   bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
-#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
-#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_header_big_endian(abfd) \
-  ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
-#define bfd_header_little_endian(abfd) \
-  ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
-#define bfd_get_file_flags(abfd) ((abfd)->flags)
-#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
-#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
-#define bfd_my_archive(abfd) ((abfd)->my_archive)
-#define bfd_has_map(abfd) ((abfd)->has_armap)
-
-#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
-#define bfd_usrdata(abfd) ((abfd)->usrdata)
-
-#define bfd_get_start_address(abfd) ((abfd)->start_address)
-#define bfd_get_symcount(abfd) ((abfd)->symcount)
-#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
-#define bfd_count_sections(abfd) ((abfd)->section_count)
-
-#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
-
-#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
-
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
-
-extern boolean bfd_cache_close PARAMS ((bfd *abfd));
-/* NB: This declaration should match the autogenerated one in libbfd.h.  */
-
-extern boolean bfd_record_phdr
-  PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
-          boolean, boolean, unsigned int, struct sec **));
-
-/* Byte swapping routines.  */
-
-bfd_vma                bfd_getb64         PARAMS ((const unsigned char *));
-bfd_vma        bfd_getl64         PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
-bfd_vma                bfd_getb32         PARAMS ((const unsigned char *));
-bfd_vma                bfd_getl32         PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
-bfd_vma                bfd_getb16         PARAMS ((const unsigned char *));
-bfd_vma                bfd_getl16         PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
-void           bfd_putb64         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putl64         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putb32         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putl32         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putb16         PARAMS ((bfd_vma, unsigned char *));
-void           bfd_putl16         PARAMS ((bfd_vma, unsigned char *));
-
-/* Byte swapping routines which take size and endiannes as arguments.  */
-
-bfd_vma         bfd_get_bits       PARAMS ((bfd_byte *, int, boolean));
-void            bfd_put_bits       PARAMS ((bfd_vma, bfd_byte *, int, boolean));
-\f
-/* Externally visible ECOFF routines.  */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct symbol_cache_entry;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
-struct bfd_elf_version_tree;
-#endif
-extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
-extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
-extern boolean bfd_ecoff_set_regmasks
-  PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
-          unsigned long *cprmask));
-extern PTR bfd_ecoff_debug_init
-  PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
-          const struct ecoff_debug_swap *output_swap,
-          struct bfd_link_info *));
-extern void bfd_ecoff_debug_free
-  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
-          const struct ecoff_debug_swap *output_swap,
-          struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate
-  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
-          const struct ecoff_debug_swap *output_swap,
-          bfd *input_bfd, struct ecoff_debug_info *input_debug,
-          const struct ecoff_debug_swap *input_swap,
-          struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate_other
-  PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
-          const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
-          struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_externals
-  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap,
-          boolean relocateable,
-          boolean (*get_extr) (struct symbol_cache_entry *,
-                               struct ecoff_extr *),
-          void (*set_index) (struct symbol_cache_entry *,
-                             bfd_size_type)));
-extern boolean bfd_ecoff_debug_one_external
-  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap,
-          const char *name, struct ecoff_extr *esym));
-extern bfd_size_type bfd_ecoff_debug_size
-  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap));
-extern boolean bfd_ecoff_write_debug
-  PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap, file_ptr where));
-extern boolean bfd_ecoff_write_accumulated_debug
-  PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
-          const struct ecoff_debug_swap *swap,
-          struct bfd_link_info *info, file_ptr where));
-extern boolean bfd_mips_ecoff_create_embedded_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
-          char **));
-
-/* Externally visible ELF routines.  */
-
-struct bfd_link_needed_list
-{
-  struct bfd_link_needed_list *next;
-  bfd *by;
-  const char *name;
-};
-
-extern boolean bfd_elf32_record_link_assignment
-  PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
-extern boolean bfd_elf64_record_link_assignment
-  PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
-extern struct bfd_link_needed_list *bfd_elf_get_needed_list
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf_get_bfd_needed_list
-  PARAMS ((bfd *, struct bfd_link_needed_list **));
-extern boolean bfd_elf32_size_dynamic_sections
-  PARAMS ((bfd *, const char *, const char *, const char *,
-          const char * const *, struct bfd_link_info *, struct sec **,
-          struct bfd_elf_version_tree *));
-extern boolean bfd_elf64_size_dynamic_sections
-  PARAMS ((bfd *, const char *, const char *, const char *,
-          const char * const *, struct bfd_link_info *, struct sec **,
-          struct bfd_elf_version_tree *));
-extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
-extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
-extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
-extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf32_discard_info
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf64_discard_info
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* Return an upper bound on the number of bytes required to store a
-   copy of ABFD's program header table entries.  Return -1 if an error
-   occurs; bfd_get_error will return an appropriate code.  */
-extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
-
-/* Copy ABFD's program header table entries to *PHDRS.  The entries
-   will be stored as an array of Elf_Internal_Phdr structures, as
-   defined in include/elf/internal.h.  To find out how large the
-   buffer needs to be, call bfd_get_elf_phdr_upper_bound.
-
-   Return the number of program header table entries read, or -1 if an
-   error occurs; bfd_get_error will return an appropriate code.  */
-extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
-
-/* Return the arch_size field of an elf bfd, or -1 if not elf.  */
-extern int bfd_get_arch_size PARAMS ((bfd *));
-
-/* Return true if address "naturally" sign extends, or -1 if not elf.  */
-extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
-
-extern boolean bfd_m68k_elf32_create_embedded_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
-          char **));
-extern boolean bfd_mips_elf32_create_embedded_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
-          char **));
-
-/* SunOS shared library support routines for the linker.  */
-
-extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sunos_record_link_assignment
-  PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_sunos_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
-          struct sec **));
-
-/* Linux shared library support routines for the linker.  */
-
-extern boolean bfd_i386linux_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_m68klinux_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sparclinux_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* mmap hacks */
-
-struct _bfd_window_internal;
-typedef struct _bfd_window_internal bfd_window_internal;
-
-typedef struct _bfd_window
-{
-  /* What the user asked for.  */
-  PTR data;
-  bfd_size_type size;
-  /* The actual window used by BFD.  Small user-requested read-only
-     regions sharing a page may share a single window into the object
-     file.  Read-write versions shouldn't until I've fixed things to
-     keep track of which portions have been claimed by the
-     application; don't want to give the same region back when the
-     application wants two writable copies!  */
-  struct _bfd_window_internal *i;
-}
-bfd_window;
-
-extern void bfd_init_window PARAMS ((bfd_window *));
-extern void bfd_free_window PARAMS ((bfd_window *));
-extern boolean bfd_get_file_window
-  PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
-
-/* XCOFF support routines for the linker.  */
-
-extern boolean bfd_xcoff_link_record_set
-  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
-          bfd_size_type));
-extern boolean bfd_xcoff_import_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
-          bfd_vma, const char *, const char *, const char *, unsigned int));
-extern boolean bfd_xcoff_export_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
-extern boolean bfd_xcoff_link_count_reloc
-  PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_record_link_assignment
-  PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
-          unsigned long, unsigned long, unsigned long, boolean,
-          int, boolean, boolean, struct sec **, boolean));
-extern boolean bfd_xcoff_link_generate_rtinit
-  PARAMS ((bfd *, const char *, const char *, boolean));
-
-/* XCOFF support routines for ar.  */
-extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *));
-
-/* Externally visible COFF routines.  */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct internal_syment;
-union internal_auxent;
-#endif
-
-extern boolean bfd_coff_get_syment
-  PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
-
-extern boolean bfd_coff_get_auxent
-  PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
-
-extern boolean bfd_coff_set_symbol_class
-  PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
-
-extern boolean bfd_m68k_coff_create_embedded_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
-          char **));
-
-/* ARM Interworking support.  Called from linker.  */
-extern boolean bfd_arm_allocate_interworking_sections
-  PARAMS ((struct bfd_link_info *));
-
-extern boolean bfd_arm_process_before_allocation
-  PARAMS ((bfd *, struct bfd_link_info *, int));
-
-extern boolean bfd_arm_get_bfd_for_interworking
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* PE ARM Interworking support.  Called from linker.  */
-extern boolean bfd_arm_pe_allocate_interworking_sections
-  PARAMS ((struct bfd_link_info *));
-
-extern boolean bfd_arm_pe_process_before_allocation
-  PARAMS ((bfd *, struct bfd_link_info *, int));
-
-extern boolean bfd_arm_pe_get_bfd_for_interworking
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* ELF ARM Interworking support.  Called from linker.  */
-extern boolean bfd_elf32_arm_allocate_interworking_sections
-  PARAMS ((struct bfd_link_info *));
-
-extern boolean bfd_elf32_arm_process_before_allocation
-  PARAMS ((bfd *, struct bfd_link_info *, int));
-
-extern boolean bfd_elf32_arm_get_bfd_for_interworking
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-/* TI COFF load page support.  */
-extern void bfd_ticoff_set_section_load_page
-  PARAMS ((struct sec *, int));
-
-extern int bfd_ticoff_get_section_load_page
-  PARAMS ((struct sec *));
-
-/* Extracted from init.c.  */
-void
-bfd_init PARAMS ((void));
-
-/* Extracted from opncls.c.  */
-bfd *
-bfd_openr PARAMS ((const char *filename, const char *target));
-
-bfd *
-bfd_fdopenr PARAMS ((const char *filename, const char *target, int fd));
-
-bfd *
-bfd_openstreamr PARAMS ((const char *, const char *, PTR));
-
-bfd *
-bfd_openw PARAMS ((const char *filename, const char *target));
-
-boolean
-bfd_close PARAMS ((bfd *abfd));
-
-boolean
-bfd_close_all_done PARAMS ((bfd *));
-
-bfd *
-bfd_create PARAMS ((const char *filename, bfd *templ));
-
-boolean
-bfd_make_writable PARAMS ((bfd *abfd));
-
-boolean
-bfd_make_readable PARAMS ((bfd *abfd));
-
-/* Extracted from libbfd.c.  */
-
-/* Byte swapping macros for user section data.  */
-
-#define bfd_put_8(abfd, val, ptr) \
-                ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
-#define bfd_put_signed_8 \
-               bfd_put_8
-#define bfd_get_8(abfd, ptr) \
-                (*(unsigned char *) (ptr) & 0xff)
-#define bfd_get_signed_8(abfd, ptr) \
-               (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
-
-#define bfd_put_16(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
-#define bfd_put_signed_16 \
-                bfd_put_16
-#define bfd_get_16(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx16, (ptr))
-#define bfd_get_signed_16(abfd, ptr) \
-                BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-
-#define bfd_put_32(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
-#define bfd_put_signed_32 \
-                bfd_put_32
-#define bfd_get_32(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx32, (ptr))
-#define bfd_get_signed_32(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
-
-#define bfd_put_64(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
-#define bfd_put_signed_64 \
-                bfd_put_64
-#define bfd_get_64(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx64, (ptr))
-#define bfd_get_signed_64(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
-
-#define bfd_get(bits, abfd, ptr)                               \
-                ( (bits) ==  8 ? (bfd_vma) bfd_get_8 (abfd, ptr)       \
-                : (bits) == 16 ? bfd_get_16 (abfd, ptr)        \
-                : (bits) == 32 ? bfd_get_32 (abfd, ptr)        \
-                : (bits) == 64 ? bfd_get_64 (abfd, ptr)        \
-                : (abort (), (bfd_vma) - 1))
-
-#define bfd_put(bits, abfd, val, ptr)                          \
-                ( (bits) ==  8 ? bfd_put_8  (abfd, val, ptr)   \
-                : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)   \
-                : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)   \
-                : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)   \
-                : (abort (), (void) 0))
-
-
-/* Byte swapping macros for file header data.  */
-
-#define bfd_h_put_8(abfd, val, ptr) \
-  bfd_put_8 (abfd, val, ptr)
-#define bfd_h_put_signed_8(abfd, val, ptr) \
-  bfd_put_8 (abfd, val, ptr)
-#define bfd_h_get_8(abfd, ptr) \
-  bfd_get_8 (abfd, ptr)
-#define bfd_h_get_signed_8(abfd, ptr) \
-  bfd_get_signed_8 (abfd, ptr)
-
-#define bfd_h_put_16(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
-#define bfd_h_put_signed_16 \
-  bfd_h_put_16
-#define bfd_h_get_16(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx16, (ptr))
-#define bfd_h_get_signed_16(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
-
-#define bfd_h_put_32(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
-#define bfd_h_put_signed_32 \
-  bfd_h_put_32
-#define bfd_h_get_32(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx32, (ptr))
-#define bfd_h_get_signed_32(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
-
-#define bfd_h_put_64(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
-#define bfd_h_put_signed_64 \
-  bfd_h_put_64
-#define bfd_h_get_64(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx64, (ptr))
-#define bfd_h_get_signed_64(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
-
-/* Refinements on the above, which should eventually go away.  Save
-   cluttering the source with (bfd_vma) and (bfd_byte *) casts.  */
-
-#define H_PUT_64(abfd, val, where) \
-  bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_32(abfd, val, where) \
-  bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_16(abfd, val, where) \
-  bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_8 bfd_h_put_8
-
-#define H_PUT_S64(abfd, val, where) \
-  bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S32(abfd, val, where) \
-  bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S16(abfd, val, where) \
-  bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S8 bfd_h_put_signed_8
-
-#define H_GET_64(abfd, where) \
-  bfd_h_get_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_32(abfd, where) \
-  bfd_h_get_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_16(abfd, where) \
-  bfd_h_get_16 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_8 bfd_h_get_8
-
-#define H_GET_S64(abfd, where) \
-  bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S32(abfd, where) \
-  bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S16(abfd, where) \
-  bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S8 bfd_h_get_signed_8
-
-
-/* Extracted from bfdio.c.  */
-long
-bfd_get_mtime PARAMS ((bfd *abfd));
-
-long
-bfd_get_size PARAMS ((bfd *abfd));
-
-/* Extracted from bfdwin.c.  */
-/* Extracted from section.c.  */
-/* This structure is used for a comdat section, as in PE.  A comdat
-   section is associated with a particular symbol.  When the linker
-   sees a comdat section, it keeps only one of the sections with a
-   given name and associated with a given symbol.  */
-
-struct bfd_comdat_info
-{
-  /* The name of the symbol associated with a comdat section.  */
-  const char *name;
-
-  /* The local symbol table index of the symbol associated with a
-     comdat section.  This is only meaningful to the object file format
-     specific code; it is not an index into the list returned by
-     bfd_canonicalize_symtab.  */
-  long symbol;
-};
-
-typedef struct sec
-{
-  /* The name of the section; the name isn't a copy, the pointer is
-     the same as that passed to bfd_make_section.  */
-  const char *name;
-
-  /* A unique sequence number.  */
-  int id;
-
-  /* Which section in the bfd; 0..n-1 as sections are created in a bfd.  */
-  int index;
-
-  /* The next section in the list belonging to the BFD, or NULL.  */
-  struct sec *next;
-
-  /* The field flags contains attributes of the section. Some
-     flags are read in from the object file, and some are
-     synthesized from other information.  */
-  flagword flags;
-
-#define SEC_NO_FLAGS   0x000
-
-  /* Tells the OS to allocate space for this section when loading.
-     This is clear for a section containing debug information only.  */
-#define SEC_ALLOC      0x001
-
-  /* Tells the OS to load the section from the file when loading.
-     This is clear for a .bss section.  */
-#define SEC_LOAD       0x002
-
-  /* The section contains data still to be relocated, so there is
-     some relocation information too.  */
-#define SEC_RELOC      0x004
-
-  /* ELF reserves 4 processor specific bits and 8 operating system
-     specific bits in sh_flags; at present we can get away with just
-     one in communicating between the assembler and BFD, but this
-     isn't a good long-term solution.  */
-#define SEC_ARCH_BIT_0 0x008
-
-  /* A signal to the OS that the section contains read only data.  */
-#define SEC_READONLY   0x010
-
-  /* The section contains code only.  */
-#define SEC_CODE       0x020
-
-  /* The section contains data only.  */
-#define SEC_DATA       0x040
-
-  /* The section will reside in ROM.  */
-#define SEC_ROM        0x080
-
-  /* The section contains constructor information. This section
-     type is used by the linker to create lists of constructors and
-     destructors used by <<g++>>. When a back end sees a symbol
-     which should be used in a constructor list, it creates a new
-     section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
-     the symbol to it, and builds a relocation. To build the lists
-     of constructors, all the linker has to do is catenate all the
-     sections called <<__CTOR_LIST__>> and relocate the data
-     contained within - exactly the operations it would peform on
-     standard data.  */
-#define SEC_CONSTRUCTOR 0x100
-
-  /* The section has contents - a data section could be
-     <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
-     <<SEC_HAS_CONTENTS>>  */
-#define SEC_HAS_CONTENTS 0x200
-
-  /* An instruction to the linker to not output the section
-     even if it has information which would normally be written.  */
-#define SEC_NEVER_LOAD 0x400
-
-  /* The section is a COFF shared library section.  This flag is
-     only for the linker.  If this type of section appears in
-     the input file, the linker must copy it to the output file
-     without changing the vma or size.  FIXME: Although this
-     was originally intended to be general, it really is COFF
-     specific (and the flag was renamed to indicate this).  It
-     might be cleaner to have some more general mechanism to
-     allow the back end to control what the linker does with
-     sections.  */
-#define SEC_COFF_SHARED_LIBRARY 0x800
-
-  /* The section contains thread local data.  */
-#define SEC_THREAD_LOCAL 0x1000
-
-  /* The section has GOT references.  This flag is only for the
-     linker, and is currently only used by the elf32-hppa back end.
-     It will be set if global offset table references were detected
-     in this section, which indicate to the linker that the section
-     contains PIC code, and must be handled specially when doing a
-     static link.  */
-#define SEC_HAS_GOT_REF 0x4000
-
-  /* The section contains common symbols (symbols may be defined
-     multiple times, the value of a symbol is the amount of
-     space it requires, and the largest symbol value is the one
-     used).  Most targets have exactly one of these (which we
-     translate to bfd_com_section_ptr), but ECOFF has two.  */
-#define SEC_IS_COMMON 0x8000
-
-  /* The section contains only debugging information.  For
-     example, this is set for ELF .debug and .stab sections.
-     strip tests this flag to see if a section can be
-     discarded.  */
-#define SEC_DEBUGGING 0x10000
-
-  /* The contents of this section are held in memory pointed to
-     by the contents field.  This is checked by bfd_get_section_contents,
-     and the data is retrieved from memory if appropriate.  */
-#define SEC_IN_MEMORY 0x20000
-
-  /* The contents of this section are to be excluded by the
-     linker for executable and shared objects unless those
-     objects are to be further relocated.  */
-#define SEC_EXCLUDE 0x40000
-
-  /* The contents of this section are to be sorted based on the sum of
-     the symbol and addend values specified by the associated relocation
-     entries.  Entries without associated relocation entries will be
-     appended to the end of the section in an unspecified order.  */
-#define SEC_SORT_ENTRIES 0x80000
-
-  /* When linking, duplicate sections of the same name should be
-     discarded, rather than being combined into a single section as
-     is usually done.  This is similar to how common symbols are
-     handled.  See SEC_LINK_DUPLICATES below.  */
-#define SEC_LINK_ONCE 0x100000
-
-  /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
-     should handle duplicate sections.  */
-#define SEC_LINK_DUPLICATES 0x600000
-
-  /* This value for SEC_LINK_DUPLICATES means that duplicate
-     sections with the same name should simply be discarded.  */
-#define SEC_LINK_DUPLICATES_DISCARD 0x0
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if there are any duplicate sections, although
-     it should still only link one copy.  */
-#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if any duplicate sections are a different size.  */
-#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if any duplicate sections contain different
-     contents.  */
-#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
-
-  /* This section was created by the linker as part of dynamic
-     relocation or other arcane processing.  It is skipped when
-     going through the first-pass output, trusting that someone
-     else up the line will take care of it later.  */
-#define SEC_LINKER_CREATED 0x800000
-
-  /* This section should not be subject to garbage collection.  */
-#define SEC_KEEP 0x1000000
-
-  /* This section contains "short" data, and should be placed
-     "near" the GP.  */
-#define SEC_SMALL_DATA 0x2000000
-
-  /* This section contains data which may be shared with other
-     executables or shared objects.  */
-#define SEC_SHARED 0x4000000
-
-  /* When a section with this flag is being linked, then if the size of
-     the input section is less than a page, it should not cross a page
-     boundary.  If the size of the input section is one page or more, it
-     should be aligned on a page boundary.  */
-#define SEC_BLOCK 0x8000000
-
-  /* Conditionally link this section; do not link if there are no
-     references found to any symbol in the section.  */
-#define SEC_CLINK 0x10000000
-
-  /* Attempt to merge identical entities in the section.
-     Entity size is given in the entsize field.  */
-#define SEC_MERGE 0x20000000
-
-  /* If given with SEC_MERGE, entities to merge are zero terminated
-     strings where entsize specifies character size instead of fixed
-     size entries.  */
-#define SEC_STRINGS 0x40000000
-
-  /* This section contains data about section groups.  */
-#define SEC_GROUP 0x80000000
-
-  /*  End of section flags.  */
-
-  /* Some internal packed boolean fields.  */
-
-  /* See the vma field.  */
-  unsigned int user_set_vma : 1;
-
-  /* Whether relocations have been processed.  */
-  unsigned int reloc_done : 1;
-
-  /* A mark flag used by some of the linker backends.  */
-  unsigned int linker_mark : 1;
-
-  /* Another mark flag used by some of the linker backends.  Set for
-     output sections that have an input section.  */
-  unsigned int linker_has_input : 1;
-
-  /* A mark flag used by some linker backends for garbage collection.  */
-  unsigned int gc_mark : 1;
-
-  /* Used by the ELF code to mark sections which have been allocated
-     to segments.  */
-  unsigned int segment_mark : 1;
-
-  /* End of internal packed boolean fields.  */
-
-  /*  The virtual memory address of the section - where it will be
-      at run time.  The symbols are relocated against this.  The
-      user_set_vma flag is maintained by bfd; if it's not set, the
-      backend can assign addresses (for example, in <<a.out>>, where
-      the default address for <<.data>> is dependent on the specific
-      target and various flags).  */
-  bfd_vma vma;
-
-  /*  The load address of the section - where it would be in a
-      rom image; really only used for writing section header
-      information.  */
-  bfd_vma lma;
-
-  /* The size of the section in octets, as it will be output.
-     Contains a value even if the section has no contents (e.g., the
-     size of <<.bss>>).  This will be filled in after relocation.  */
-  bfd_size_type _cooked_size;
-
-  /* The original size on disk of the section, in octets.  Normally this
-     value is the same as the size, but if some relaxing has
-     been done, then this value will be bigger.  */
-  bfd_size_type _raw_size;
-
-  /* If this section is going to be output, then this value is the
-     offset in *bytes* into the output section of the first byte in the
-     input section (byte ==> smallest addressable unit on the
-     target).  In most cases, if this was going to start at the
-     100th octet (8-bit quantity) in the output section, this value
-     would be 100.  However, if the target byte size is 16 bits
-     (bfd_octets_per_byte is "2"), this value would be 50.  */
-  bfd_vma output_offset;
-
-  /* The output section through which to map on output.  */
-  struct sec *output_section;
-
-  /* The alignment requirement of the section, as an exponent of 2 -
-     e.g., 3 aligns to 2^3 (or 8).  */
-  unsigned int alignment_power;
-
-  /* If an input section, a pointer to a vector of relocation
-     records for the data in this section.  */
-  struct reloc_cache_entry *relocation;
-
-  /* If an output section, a pointer to a vector of pointers to
-     relocation records for the data in this section.  */
-  struct reloc_cache_entry **orelocation;
-
-  /* The number of relocation records in one of the above.  */
-  unsigned reloc_count;
-
-  /* Information below is back end specific - and not always used
-     or updated.  */
-
-  /* File position of section data.  */
-  file_ptr filepos;
-
-  /* File position of relocation info.  */
-  file_ptr rel_filepos;
-
-  /* File position of line data.  */
-  file_ptr line_filepos;
-
-  /* Pointer to data for applications.  */
-  PTR userdata;
-
-  /* If the SEC_IN_MEMORY flag is set, this points to the actual
-     contents.  */
-  unsigned char *contents;
-
-  /* Attached line number information.  */
-  alent *lineno;
-
-  /* Number of line number records.  */
-  unsigned int lineno_count;
-
-  /* Entity size for merging purposes.  */
-  unsigned int entsize;
-
-  /* Optional information about a COMDAT entry; NULL if not COMDAT.  */
-  struct bfd_comdat_info *comdat;
-
-  /* When a section is being output, this value changes as more
-     linenumbers are written out.  */
-  file_ptr moving_line_filepos;
-
-  /* What the section number is in the target world.  */
-  int target_index;
-
-  PTR used_by_bfd;
-
-  /* If this is a constructor section then here is a list of the
-     relocations created to relocate items within it.  */
-  struct relent_chain *constructor_chain;
-
-  /* The BFD which owns the section.  */
-  bfd *owner;
-
-  /* A symbol which points at this section only.  */
-  struct symbol_cache_entry *symbol;
-  struct symbol_cache_entry **symbol_ptr_ptr;
-
-  struct bfd_link_order *link_order_head;
-  struct bfd_link_order *link_order_tail;
-} asection;
-
-/* These sections are global, and are managed by BFD.  The application
-   and target back end are not permitted to change the values in
-   these sections.  New code should use the section_ptr macros rather
-   than referring directly to the const sections.  The const sections
-   may eventually vanish.  */
-#define BFD_ABS_SECTION_NAME "*ABS*"
-#define BFD_UND_SECTION_NAME "*UND*"
-#define BFD_COM_SECTION_NAME "*COM*"
-#define BFD_IND_SECTION_NAME "*IND*"
-
-/* The absolute section.  */
-extern const asection bfd_abs_section;
-#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-/* Pointer to the undefined section.  */
-extern const asection bfd_und_section;
-#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-/* Pointer to the common section.  */
-extern const asection bfd_com_section;
-#define bfd_com_section_ptr ((asection *) &bfd_com_section)
-/* Pointer to the indirect section.  */
-extern const asection bfd_ind_section;
-#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
-#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-
-#define bfd_is_const_section(SEC)              \
- (   ((SEC) == bfd_abs_section_ptr)            \
-  || ((SEC) == bfd_und_section_ptr)            \
-  || ((SEC) == bfd_com_section_ptr)            \
-  || ((SEC) == bfd_ind_section_ptr))
-
-extern const struct symbol_cache_entry * const bfd_abs_symbol;
-extern const struct symbol_cache_entry * const bfd_com_symbol;
-extern const struct symbol_cache_entry * const bfd_und_symbol;
-extern const struct symbol_cache_entry * const bfd_ind_symbol;
-#define bfd_get_section_size_before_reloc(section) \
-     ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
-                            : (section)->_raw_size)
-#define bfd_get_section_size_after_reloc(section) \
-     ((section)->reloc_done ? (section)->_cooked_size \
-                            : (abort (), (bfd_size_type) 1))
-
-/* Macros to handle insertion and deletion of a bfd's sections.  These
-   only handle the list pointers, ie. do not adjust section_count,
-   target_index etc.  */
-#define bfd_section_list_remove(ABFD, PS) \
-  do                                                   \
-    {                                                  \
-      asection **_ps = PS;                             \
-      asection *_s = *_ps;                             \
-      *_ps = _s->next;                                 \
-      if (_s->next == NULL)                            \
-        (ABFD)->section_tail = _ps;                    \
-    }                                                  \
-  while (0)
-#define bfd_section_list_insert(ABFD, PS, S) \
-  do                                                   \
-    {                                                  \
-      asection **_ps = PS;                             \
-      asection *_s = S;                                \
-      _s->next = *_ps;                                 \
-      *_ps = _s;                                       \
-      if (_s->next == NULL)                            \
-        (ABFD)->section_tail = &_s->next;              \
-    }                                                  \
-  while (0)
-
-void
-bfd_section_list_clear PARAMS ((bfd *));
-
-asection *
-bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
-
-char *
-bfd_get_unique_section_name PARAMS ((bfd *abfd,
-    const char *templat,
-    int *count));
-
-asection *
-bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name));
-
-asection *
-bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name));
-
-asection *
-bfd_make_section PARAMS ((bfd *, const char *name));
-
-boolean
-bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
-
-void
-bfd_map_over_sections PARAMS ((bfd *abfd,
-    void (*func) (bfd *abfd,
-    asection *sect,
-    PTR obj),
-    PTR obj));
-
-boolean
-bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
-
-boolean
-bfd_set_section_contents PARAMS ((bfd *abfd, asection *section,
-    PTR data, file_ptr offset,
-    bfd_size_type count));
-
-boolean
-bfd_get_section_contents PARAMS ((bfd *abfd, asection *section,
-    PTR location, file_ptr offset,
-    bfd_size_type count));
-
-boolean
-bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec,
-    bfd *obfd, asection *osec));
-
-#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
-     BFD_SEND (obfd, _bfd_copy_private_section_data, \
-               (ibfd, isection, obfd, osection))
-void
-_bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section));
-
-boolean
-bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group));
-
-/* Extracted from archures.c.  */
-enum bfd_architecture
-{
-  bfd_arch_unknown,   /* File arch not known.  */
-  bfd_arch_obscure,   /* Arch known, not one of these.  */
-  bfd_arch_m68k,      /* Motorola 68xxx */
-#define bfd_mach_m68000 1
-#define bfd_mach_m68008 2
-#define bfd_mach_m68010 3
-#define bfd_mach_m68020 4
-#define bfd_mach_m68030 5
-#define bfd_mach_m68040 6
-#define bfd_mach_m68060 7
-#define bfd_mach_cpu32  8
-#define bfd_mach_mcf5200  9
-#define bfd_mach_mcf5206e 10
-#define bfd_mach_mcf5307  11
-#define bfd_mach_mcf5407  12
-  bfd_arch_vax,       /* DEC Vax */
-  bfd_arch_i960,      /* Intel 960 */
-    /* The order of the following is important.
-       lower number indicates a machine type that
-       only accepts a subset of the instructions
-       available to machines with higher numbers.
-       The exception is the "ca", which is
-       incompatible with all other machines except
-       "core".  */
-
-#define bfd_mach_i960_core      1
-#define bfd_mach_i960_ka_sa     2
-#define bfd_mach_i960_kb_sb     3
-#define bfd_mach_i960_mc        4
-#define bfd_mach_i960_xa        5
-#define bfd_mach_i960_ca        6
-#define bfd_mach_i960_jx        7
-#define bfd_mach_i960_hx        8
-
-  bfd_arch_or32,      /* OpenRISC 32 */
-
-  bfd_arch_a29k,      /* AMD 29000 */
-  bfd_arch_sparc,     /* SPARC */
-#define bfd_mach_sparc                 1
-/* The difference between v8plus and v9 is that v9 is a true 64 bit env.  */
-#define bfd_mach_sparc_sparclet        2
-#define bfd_mach_sparc_sparclite       3
-#define bfd_mach_sparc_v8plus          4
-#define bfd_mach_sparc_v8plusa         5 /* with ultrasparc add'ns.  */
-#define bfd_mach_sparc_sparclite_le    6
-#define bfd_mach_sparc_v9              7
-#define bfd_mach_sparc_v9a             8 /* with ultrasparc add'ns.  */
-#define bfd_mach_sparc_v8plusb         9 /* with cheetah add'ns.  */
-#define bfd_mach_sparc_v9b             10 /* with cheetah add'ns.  */
-/* Nonzero if MACH has the v9 instruction set.  */
-#define bfd_mach_sparc_v9_p(mach) \
-  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
-   && (mach) != bfd_mach_sparc_sparclite_le)
-  bfd_arch_mips,      /* MIPS Rxxxx */
-#define bfd_mach_mips3000              3000
-#define bfd_mach_mips3900              3900
-#define bfd_mach_mips4000              4000
-#define bfd_mach_mips4010              4010
-#define bfd_mach_mips4100              4100
-#define bfd_mach_mips4111              4111
-#define bfd_mach_mips4120              4120
-#define bfd_mach_mips4300              4300
-#define bfd_mach_mips4400              4400
-#define bfd_mach_mips4600              4600
-#define bfd_mach_mips4650              4650
-#define bfd_mach_mips5000              5000
-#define bfd_mach_mips5400              5400
-#define bfd_mach_mips5500              5500
-#define bfd_mach_mips6000              6000
-#define bfd_mach_mips8000              8000
-#define bfd_mach_mips10000             10000
-#define bfd_mach_mips12000             12000
-#define bfd_mach_mips16                16
-#define bfd_mach_mips5                 5
-#define bfd_mach_mips_sb1              12310201 /* octal 'SB', 01 */
-#define bfd_mach_mipsisa32             32
-#define bfd_mach_mipsisa64             64
-  bfd_arch_i386,      /* Intel 386 */
-#define bfd_mach_i386_i386 1
-#define bfd_mach_i386_i8086 2
-#define bfd_mach_i386_i386_intel_syntax 3
-#define bfd_mach_x86_64 64
-#define bfd_mach_x86_64_intel_syntax 65
-  bfd_arch_we32k,     /* AT&T WE32xxx */
-  bfd_arch_tahoe,     /* CCI/Harris Tahoe */
-  bfd_arch_i860,      /* Intel 860 */
-  bfd_arch_i370,      /* IBM 360/370 Mainframes */
-  bfd_arch_romp,      /* IBM ROMP PC/RT */
-  bfd_arch_alliant,   /* Alliant */
-  bfd_arch_convex,    /* Convex */
-  bfd_arch_m88k,      /* Motorola 88xxx */
-  bfd_arch_m98k,      /* Motorola 98xxx */
-  bfd_arch_pyramid,   /* Pyramid Technology */
-  bfd_arch_h8300,     /* Hitachi H8/300 */
-#define bfd_mach_h8300   1
-#define bfd_mach_h8300h  2
-#define bfd_mach_h8300s  3
-  bfd_arch_pdp11,     /* DEC PDP-11 */
-  bfd_arch_powerpc,   /* PowerPC */
-#define bfd_mach_ppc           32
-#define bfd_mach_ppc64         64
-#define bfd_mach_ppc_403       403
-#define bfd_mach_ppc_403gc     4030
-#define bfd_mach_ppc_505       505
-#define bfd_mach_ppc_601       601
-#define bfd_mach_ppc_602       602
-#define bfd_mach_ppc_603       603
-#define bfd_mach_ppc_ec603e    6031
-#define bfd_mach_ppc_604       604
-#define bfd_mach_ppc_620       620
-#define bfd_mach_ppc_630       630
-#define bfd_mach_ppc_750       750
-#define bfd_mach_ppc_860       860
-#define bfd_mach_ppc_a35       35
-#define bfd_mach_ppc_rs64ii    642
-#define bfd_mach_ppc_rs64iii   643
-#define bfd_mach_ppc_7400      7400
-#define bfd_mach_ppc_e500      500
-  bfd_arch_rs6000,    /* IBM RS/6000 */
-#define bfd_mach_rs6k          6000
-#define bfd_mach_rs6k_rs1      6001
-#define bfd_mach_rs6k_rsc      6003
-#define bfd_mach_rs6k_rs2      6002
-  bfd_arch_hppa,      /* HP PA RISC */
-  bfd_arch_d10v,      /* Mitsubishi D10V */
-#define bfd_mach_d10v          1
-#define bfd_mach_d10v_ts2      2
-#define bfd_mach_d10v_ts3      3
-  bfd_arch_d30v,      /* Mitsubishi D30V */
-  bfd_arch_dlx,       /* DLX */
-  bfd_arch_m68hc11,   /* Motorola 68HC11 */
-  bfd_arch_m68hc12,   /* Motorola 68HC12 */
-  bfd_arch_z8k,       /* Zilog Z8000 */
-#define bfd_mach_z8001         1
-#define bfd_mach_z8002         2
-  bfd_arch_h8500,     /* Hitachi H8/500 */
-  bfd_arch_sh,        /* Hitachi SH */
-#define bfd_mach_sh            1
-#define bfd_mach_sh2        0x20
-#define bfd_mach_sh_dsp     0x2d
-#define bfd_mach_sh3        0x30
-#define bfd_mach_sh3_dsp    0x3d
-#define bfd_mach_sh3e       0x3e
-#define bfd_mach_sh4        0x40
-#define bfd_mach_sh5        0x50
-  bfd_arch_alpha,     /* Dec Alpha */
-#define bfd_mach_alpha_ev4  0x10
-#define bfd_mach_alpha_ev5  0x20
-#define bfd_mach_alpha_ev6  0x30
-  bfd_arch_arm,       /* Advanced Risc Machines ARM.  */
-#define bfd_mach_arm_2         1
-#define bfd_mach_arm_2a        2
-#define bfd_mach_arm_3         3
-#define bfd_mach_arm_3M        4
-#define bfd_mach_arm_4         5
-#define bfd_mach_arm_4T        6
-#define bfd_mach_arm_5         7
-#define bfd_mach_arm_5T        8
-#define bfd_mach_arm_5TE       9
-#define bfd_mach_arm_XScale    10
-  bfd_arch_ns32k,     /* National Semiconductors ns32000 */
-  bfd_arch_w65,       /* WDC 65816 */
-  bfd_arch_tic30,     /* Texas Instruments TMS320C30 */
-  bfd_arch_tic4x,     /* Texas Instruments TMS320C3X/4X */
-#define bfd_mach_c3x           30
-#define bfd_mach_c4x           40
-  bfd_arch_tic54x,    /* Texas Instruments TMS320C54X */
-  bfd_arch_tic80,     /* TI TMS320c80 (MVP) */
-  bfd_arch_v850,      /* NEC V850 */
-#define bfd_mach_v850          1
-#define bfd_mach_v850e         'E'
-  bfd_arch_arc,       /* ARC Cores */
-#define bfd_mach_arc_5         5
-#define bfd_mach_arc_6         6
-#define bfd_mach_arc_7         7
-#define bfd_mach_arc_8         8
-  bfd_arch_m32r,      /* Mitsubishi M32R/D */
-#define bfd_mach_m32r          1 /* For backwards compatibility.  */
-#define bfd_mach_m32rx         'x'
-  bfd_arch_mn10200,   /* Matsushita MN10200 */
-  bfd_arch_mn10300,   /* Matsushita MN10300 */
-#define bfd_mach_mn10300               300
-#define bfd_mach_am33          330
-  bfd_arch_fr30,
-#define bfd_mach_fr30          0x46523330
-  bfd_arch_frv,
-#define bfd_mach_frv           1
-#define bfd_mach_frvsimple     2
-#define bfd_mach_fr300         300
-#define bfd_mach_fr400         400
-#define bfd_mach_frvtomcat     499     /* fr500 prototype */
-#define bfd_mach_fr500         500
-  bfd_arch_mcore,
-  bfd_arch_ia64,      /* HP/Intel ia64 */
-#define bfd_mach_ia64_elf64    64
-#define bfd_mach_ia64_elf32    32
-  bfd_arch_ip2k,      /* Ubicom IP2K microcontrollers. */
-#define bfd_mach_ip2022        1
-#define bfd_mach_ip2022ext     2
-  bfd_arch_pj,
-  bfd_arch_avr,       /* Atmel AVR microcontrollers.  */
-#define bfd_mach_avr1          1
-#define bfd_mach_avr2          2
-#define bfd_mach_avr3          3
-#define bfd_mach_avr4          4
-#define bfd_mach_avr5          5
-  bfd_arch_cris,      /* Axis CRIS */
-  bfd_arch_s390,      /* IBM s390 */
-#define bfd_mach_s390_31       31
-#define bfd_mach_s390_64       64
-  bfd_arch_openrisc,  /* OpenRISC */
-  bfd_arch_mmix,      /* Donald Knuth's educational processor.  */
-  bfd_arch_xstormy16,
-#define bfd_mach_xstormy16     1
-  bfd_arch_last
-  };
-
-typedef struct bfd_arch_info
-{
-  int bits_per_word;
-  int bits_per_address;
-  int bits_per_byte;
-  enum bfd_architecture arch;
-  unsigned long mach;
-  const char *arch_name;
-  const char *printable_name;
-  unsigned int section_align_power;
-  /* True if this is the default machine for the architecture.
-     The default arch should be the first entry for an arch so that
-     all the entries for that arch can be accessed via <<next>>.  */
-  boolean the_default;
-  const struct bfd_arch_info * (*compatible)
-       PARAMS ((const struct bfd_arch_info *a,
-                const struct bfd_arch_info *b));
-
-  boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
-
-  const struct bfd_arch_info *next;
-}
-bfd_arch_info_type;
-
-const char *
-bfd_printable_name PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_scan_arch PARAMS ((const char *string));
-
-const char **
-bfd_arch_list PARAMS ((void));
-
-const bfd_arch_info_type *
-bfd_arch_get_compatible PARAMS ((
-    const bfd *abfd,
-    const bfd *bbfd));
-
-void
-bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
-
-enum bfd_architecture
-bfd_get_arch PARAMS ((bfd *abfd));
-
-unsigned long
-bfd_get_mach PARAMS ((bfd *abfd));
-
-unsigned int
-bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
-
-unsigned int
-bfd_arch_bits_per_address PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_get_arch_info PARAMS ((bfd *abfd));
-
-const bfd_arch_info_type *
-bfd_lookup_arch PARAMS ((enum bfd_architecture
-    arch,
-    unsigned long machine));
-
-const char *
-bfd_printable_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long machine));
-
-unsigned int
-bfd_octets_per_byte PARAMS ((bfd *abfd));
-
-unsigned int
-bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
-    unsigned long machine));
-
-/* Extracted from reloc.c.  */
-typedef enum bfd_reloc_status
-{
-  /* No errors detected.  */
-  bfd_reloc_ok,
-
-  /* The relocation was performed, but there was an overflow.  */
-  bfd_reloc_overflow,
-
-  /* The address to relocate was not within the section supplied.  */
-  bfd_reloc_outofrange,
-
-  /* Used by special functions.  */
-  bfd_reloc_continue,
-
-  /* Unsupported relocation size requested.  */
-  bfd_reloc_notsupported,
-
-  /* Unused.  */
-  bfd_reloc_other,
-
-  /* The symbol to relocate against was undefined.  */
-  bfd_reloc_undefined,
-
-  /* The relocation was performed, but may not be ok - presently
-     generated only when linking i960 coff files with i960 b.out
-     symbols.  If this type is returned, the error_message argument
-     to bfd_perform_relocation will be set.  */
-  bfd_reloc_dangerous
- }
- bfd_reloc_status_type;
-
-
-typedef struct reloc_cache_entry
-{
-  /* A pointer into the canonical table of pointers.  */
-  struct symbol_cache_entry **sym_ptr_ptr;
-
-  /* offset in section.  */
-  bfd_size_type address;
-
-  /* addend for relocation value.  */
-  bfd_vma addend;
-
-  /* Pointer to how to perform the required relocation.  */
-  reloc_howto_type *howto;
-
-}
-arelent;
-
-enum complain_overflow
-{
-  /* Do not complain on overflow.  */
-  complain_overflow_dont,
-
-  /* Complain if the bitfield overflows, whether it is considered
-     as signed or unsigned.  */
-  complain_overflow_bitfield,
-
-  /* Complain if the value overflows when considered as signed
-     number.  */
-  complain_overflow_signed,
-
-  /* Complain if the value overflows when considered as an
-     unsigned number.  */
-  complain_overflow_unsigned
-};
-
-struct reloc_howto_struct
-{
-  /*  The type field has mainly a documentary use - the back end can
-      do what it wants with it, though normally the back end's
-      external idea of what a reloc number is stored
-      in this field.  For example, a PC relative word relocation
-      in a coff environment has the type 023 - because that's
-      what the outside world calls a R_PCRWORD reloc.  */
-  unsigned int type;
-
-  /*  The value the final relocation is shifted right by.  This drops
-      unwanted data from the relocation.  */
-  unsigned int rightshift;
-
-  /*  The size of the item to be relocated.  This is *not* a
-      power-of-two measure.  To get the number of bytes operated
-      on by a type of relocation, use bfd_get_reloc_size.  */
-  int size;
-
-  /*  The number of bits in the item to be relocated.  This is used
-      when doing overflow checking.  */
-  unsigned int bitsize;
-
-  /*  Notes that the relocation is relative to the location in the
-      data section of the addend.  The relocation function will
-      subtract from the relocation value the address of the location
-      being relocated.  */
-  boolean pc_relative;
-
-  /*  The bit position of the reloc value in the destination.
-      The relocated value is left shifted by this amount.  */
-  unsigned int bitpos;
-
-  /* What type of overflow error should be checked for when
-     relocating.  */
-  enum complain_overflow complain_on_overflow;
-
-  /* If this field is non null, then the supplied function is
-     called rather than the normal function.  This allows really
-     strange relocation methods to be accomodated (e.g., i960 callj
-     instructions).  */
-  bfd_reloc_status_type (*special_function)
-    PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
-             bfd *, char **));
-
-  /* The textual name of the relocation type.  */
-  char *name;
-
-  /* Some formats record a relocation addend in the section contents
-     rather than with the relocation.  For ELF formats this is the
-     distinction between USE_REL and USE_RELA (though the code checks
-     for USE_REL == 1/0).  The value of this field is TRUE if the
-     addend is recorded with the section contents; when performing a
-     partial link (ld -r) the section contents (the data) will be
-     modified.  The value of this field is FALSE if addends are
-     recorded with the relocation (in arelent.addend); when performing
-     a partial link the relocation will be modified.
-     All relocations for all ELF USE_RELA targets should set this field
-     to FALSE (values of TRUE should be looked on with suspicion).
-     However, the converse is not true: not all relocations of all ELF
-     USE_REL targets set this field to TRUE.  Why this is so is peculiar
-     to each particular target.  For relocs that aren't used in partial
-     links (e.g. GOT stuff) it doesn't matter what this is set to.  */
-  boolean partial_inplace;
-
-  /* The src_mask selects which parts of the read in data
-     are to be used in the relocation sum.  E.g., if this was an 8 bit
-     byte of data which we read and relocated, this would be
-     0x000000ff.  When we have relocs which have an addend, such as
-     sun4 extended relocs, the value in the offset part of a
-     relocating field is garbage so we never use it.  In this case
-     the mask would be 0x00000000.  */
-  bfd_vma src_mask;
-
-  /* The dst_mask selects which parts of the instruction are replaced
-     into the instruction.  In most cases src_mask == dst_mask,
-     except in the above special case, where dst_mask would be
-     0x000000ff, and src_mask would be 0x00000000.  */
-  bfd_vma dst_mask;
-
-  /* When some formats create PC relative instructions, they leave
-     the value of the pc of the place being relocated in the offset
-     slot of the instruction, so that a PC relative relocation can
-     be made just by adding in an ordinary offset (e.g., sun3 a.out).
-     Some formats leave the displacement part of an instruction
-     empty (e.g., m88k bcs); this flag signals the fact.  */
-  boolean pcrel_offset;
-};
-
-#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
-  { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
-#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
-  HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
-         NAME, false, 0, 0, IN)
-
-#define EMPTY_HOWTO(C) \
-  HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \
-         NULL, false, 0, 0, false)
-
-#define HOWTO_PREPARE(relocation, symbol)               \
-  {                                                     \
-    if (symbol != (asymbol *) NULL)                     \
-      {                                                 \
-        if (bfd_is_com_section (symbol->section))       \
-          {                                             \
-            relocation = 0;                             \
-          }                                             \
-        else                                            \
-          {                                             \
-            relocation = symbol->value;                 \
-          }                                             \
-      }                                                 \
-  }
-
-unsigned int
-bfd_get_reloc_size PARAMS ((reloc_howto_type *));
-
-typedef struct relent_chain
-{
-  arelent relent;
-  struct relent_chain *next;
-}
-arelent_chain;
-
-bfd_reloc_status_type
-bfd_check_overflow PARAMS ((enum complain_overflow how,
-    unsigned int bitsize,
-    unsigned int rightshift,
-    unsigned int addrsize,
-    bfd_vma relocation));
-
-bfd_reloc_status_type
-bfd_perform_relocation PARAMS ((bfd *abfd,
-    arelent *reloc_entry,
-    PTR data,
-    asection *input_section,
-    bfd *output_bfd,
-    char **error_message));
-
-bfd_reloc_status_type
-bfd_install_relocation PARAMS ((bfd *abfd,
-    arelent *reloc_entry,
-    PTR data, bfd_vma data_start,
-    asection *input_section,
-    char **error_message));
-
-enum bfd_reloc_code_real {
-  _dummy_first_bfd_reloc_code_real,
-
-
-/* Basic absolute relocations of N bits.  */
-  BFD_RELOC_64,
-  BFD_RELOC_32,
-  BFD_RELOC_26,
-  BFD_RELOC_24,
-  BFD_RELOC_16,
-  BFD_RELOC_14,
-  BFD_RELOC_8,
-
-/* PC-relative relocations.  Sometimes these are relative to the address
-of the relocation itself; sometimes they are relative to the start of
-the section containing the relocation.  It depends on the specific target.
-
-The 24-bit relocation is used in some Intel 960 configurations.  */
-  BFD_RELOC_64_PCREL,
-  BFD_RELOC_32_PCREL,
-  BFD_RELOC_24_PCREL,
-  BFD_RELOC_16_PCREL,
-  BFD_RELOC_12_PCREL,
-  BFD_RELOC_8_PCREL,
-
-/* For ELF.  */
-  BFD_RELOC_32_GOT_PCREL,
-  BFD_RELOC_16_GOT_PCREL,
-  BFD_RELOC_8_GOT_PCREL,
-  BFD_RELOC_32_GOTOFF,
-  BFD_RELOC_16_GOTOFF,
-  BFD_RELOC_LO16_GOTOFF,
-  BFD_RELOC_HI16_GOTOFF,
-  BFD_RELOC_HI16_S_GOTOFF,
-  BFD_RELOC_8_GOTOFF,
-  BFD_RELOC_64_PLT_PCREL,
-  BFD_RELOC_32_PLT_PCREL,
-  BFD_RELOC_24_PLT_PCREL,
-  BFD_RELOC_16_PLT_PCREL,
-  BFD_RELOC_8_PLT_PCREL,
-  BFD_RELOC_64_PLTOFF,
-  BFD_RELOC_32_PLTOFF,
-  BFD_RELOC_16_PLTOFF,
-  BFD_RELOC_LO16_PLTOFF,
-  BFD_RELOC_HI16_PLTOFF,
-  BFD_RELOC_HI16_S_PLTOFF,
-  BFD_RELOC_8_PLTOFF,
-
-/* Relocations used by 68K ELF.  */
-  BFD_RELOC_68K_GLOB_DAT,
-  BFD_RELOC_68K_JMP_SLOT,
-  BFD_RELOC_68K_RELATIVE,
-
-/* Linkage-table relative.  */
-  BFD_RELOC_32_BASEREL,
-  BFD_RELOC_16_BASEREL,
-  BFD_RELOC_LO16_BASEREL,
-  BFD_RELOC_HI16_BASEREL,
-  BFD_RELOC_HI16_S_BASEREL,
-  BFD_RELOC_8_BASEREL,
-  BFD_RELOC_RVA,
-
-/* Absolute 8-bit relocation, but used to form an address like 0xFFnn.  */
-  BFD_RELOC_8_FFnn,
-
-/* These PC-relative relocations are stored as word displacements --
-i.e., byte displacements shifted right two bits.  The 30-bit word
-displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
-SPARC.  (SPARC tools generally refer to this as <<WDISP30>>.)  The
-signed 16-bit displacement is used on the MIPS, and the 23-bit
-displacement is used on the Alpha.  */
-  BFD_RELOC_32_PCREL_S2,
-  BFD_RELOC_16_PCREL_S2,
-  BFD_RELOC_23_PCREL_S2,
-
-/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
-the target word.  These are used on the SPARC.  */
-  BFD_RELOC_HI22,
-  BFD_RELOC_LO10,
-
-/* For systems that allocate a Global Pointer register, these are
-displacements off that register.  These relocation types are
-handled specially, because the value the register will have is
-decided relatively late.  */
-  BFD_RELOC_GPREL16,
-  BFD_RELOC_GPREL32,
-
-/* Reloc types used for i960/b.out.  */
-  BFD_RELOC_I960_CALLJ,
-
-/* SPARC ELF relocations.  There is probably some overlap with other
-relocation types already defined.  */
-  BFD_RELOC_NONE,
-  BFD_RELOC_SPARC_WDISP22,
-  BFD_RELOC_SPARC22,
-  BFD_RELOC_SPARC13,
-  BFD_RELOC_SPARC_GOT10,
-  BFD_RELOC_SPARC_GOT13,
-  BFD_RELOC_SPARC_GOT22,
-  BFD_RELOC_SPARC_PC10,
-  BFD_RELOC_SPARC_PC22,
-  BFD_RELOC_SPARC_WPLT30,
-  BFD_RELOC_SPARC_COPY,
-  BFD_RELOC_SPARC_GLOB_DAT,
-  BFD_RELOC_SPARC_JMP_SLOT,
-  BFD_RELOC_SPARC_RELATIVE,
-  BFD_RELOC_SPARC_UA16,
-  BFD_RELOC_SPARC_UA32,
-  BFD_RELOC_SPARC_UA64,
-
-/* I think these are specific to SPARC a.out (e.g., Sun 4).  */
-  BFD_RELOC_SPARC_BASE13,
-  BFD_RELOC_SPARC_BASE22,
-
-/* SPARC64 relocations  */
-#define BFD_RELOC_SPARC_64 BFD_RELOC_64
-  BFD_RELOC_SPARC_10,
-  BFD_RELOC_SPARC_11,
-  BFD_RELOC_SPARC_OLO10,
-  BFD_RELOC_SPARC_HH22,
-  BFD_RELOC_SPARC_HM10,
-  BFD_RELOC_SPARC_LM22,
-  BFD_RELOC_SPARC_PC_HH22,
-  BFD_RELOC_SPARC_PC_HM10,
-  BFD_RELOC_SPARC_PC_LM22,
-  BFD_RELOC_SPARC_WDISP16,
-  BFD_RELOC_SPARC_WDISP19,
-  BFD_RELOC_SPARC_7,
-  BFD_RELOC_SPARC_6,
-  BFD_RELOC_SPARC_5,
-#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
-  BFD_RELOC_SPARC_PLT32,
-  BFD_RELOC_SPARC_PLT64,
-  BFD_RELOC_SPARC_HIX22,
-  BFD_RELOC_SPARC_LOX10,
-  BFD_RELOC_SPARC_H44,
-  BFD_RELOC_SPARC_M44,
-  BFD_RELOC_SPARC_L44,
-  BFD_RELOC_SPARC_REGISTER,
-
-/* SPARC little endian relocation  */
-  BFD_RELOC_SPARC_REV32,
-
-/* Alpha ECOFF and ELF relocations.  Some of these treat the symbol or
-"addend" in some special way.
-For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
-writing; when reading, it will be the absolute section symbol.  The
-addend is the displacement in bytes of the "lda" instruction from
-the "ldah" instruction (which is at the address of this reloc).  */
-  BFD_RELOC_ALPHA_GPDISP_HI16,
-
-/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
-with GPDISP_HI16 relocs.  The addend is ignored when writing the
-relocations out, and is filled in with the file's GP value on
-reading, for convenience.  */
-  BFD_RELOC_ALPHA_GPDISP_LO16,
-
-/* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
-relocation except that there is no accompanying GPDISP_LO16
-relocation.  */
-  BFD_RELOC_ALPHA_GPDISP,
-
-/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
-the assembler turns it into a LDQ instruction to load the address of
-the symbol, and then fills in a register in the real instruction.
-
-The LITERAL reloc, at the LDQ instruction, refers to the .lita
-section symbol.  The addend is ignored when writing, but is filled
-in with the file's GP value on reading, for convenience, as with the
-GPDISP_LO16 reloc.
-
-The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
-It should refer to the symbol to be referenced, as with 16_GOTOFF,
-but it generates output not based on the position within the .got
-section, but relative to the GP value chosen for the file during the
-final link stage.
-
-The LITUSE reloc, on the instruction using the loaded address, gives
-information to the linker that it might be able to use to optimize
-away some literal section references.  The symbol is ignored (read
-as the absolute section symbol), and the "addend" indicates the type
-of instruction using the register:
-1 - "memory" fmt insn
-2 - byte-manipulation (byte offset reg)
-3 - jsr (target of branch)  */
-  BFD_RELOC_ALPHA_LITERAL,
-  BFD_RELOC_ALPHA_ELF_LITERAL,
-  BFD_RELOC_ALPHA_LITUSE,
-
-/* The HINT relocation indicates a value that should be filled into the
-"hint" field of a jmp/jsr/ret instruction, for possible branch-
-prediction logic which may be provided on some processors.  */
-  BFD_RELOC_ALPHA_HINT,
-
-/* The LINKAGE relocation outputs a linkage pair in the object file,
-which is filled by the linker.  */
-  BFD_RELOC_ALPHA_LINKAGE,
-
-/* The CODEADDR relocation outputs a STO_CA in the object file,
-which is filled by the linker.  */
-  BFD_RELOC_ALPHA_CODEADDR,
-
-/* The GPREL_HI/LO relocations together form a 32-bit offset from the
-GP register.  */
-  BFD_RELOC_ALPHA_GPREL_HI16,
-  BFD_RELOC_ALPHA_GPREL_LO16,
-
-/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must
-share a common GP, and the target address is adjusted for 
-STO_ALPHA_STD_GPLOAD.  */
-  BFD_RELOC_ALPHA_BRSGP,
-
-/* Alpha thread-local storage relocations.  */
-  BFD_RELOC_ALPHA_TLSGD,
-  BFD_RELOC_ALPHA_TLSLDM,
-  BFD_RELOC_ALPHA_DTPMOD64,
-  BFD_RELOC_ALPHA_GOTDTPREL16,
-  BFD_RELOC_ALPHA_DTPREL64,
-  BFD_RELOC_ALPHA_DTPREL_HI16,
-  BFD_RELOC_ALPHA_DTPREL_LO16,
-  BFD_RELOC_ALPHA_DTPREL16,
-  BFD_RELOC_ALPHA_GOTTPREL16,
-  BFD_RELOC_ALPHA_TPREL64,
-  BFD_RELOC_ALPHA_TPREL_HI16,
-  BFD_RELOC_ALPHA_TPREL_LO16,
-  BFD_RELOC_ALPHA_TPREL16,
-
-/* Bits 27..2 of the relocation address shifted right 2 bits;
-simple reloc otherwise.  */
-  BFD_RELOC_MIPS_JMP,
-
-/* The MIPS16 jump instruction.  */
-  BFD_RELOC_MIPS16_JMP,
-
-/* MIPS16 GP relative reloc.  */
-  BFD_RELOC_MIPS16_GPREL,
-
-/* High 16 bits of 32-bit value; simple reloc.  */
-  BFD_RELOC_HI16,
-
-/* High 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result.  If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added.  */
-  BFD_RELOC_HI16_S,
-
-/* Low 16 bits.  */
-  BFD_RELOC_LO16,
-
-/* Like BFD_RELOC_HI16_S, but PC relative.  */
-  BFD_RELOC_PCREL_HI16_S,
-
-/* Like BFD_RELOC_LO16, but PC relative.  */
-  BFD_RELOC_PCREL_LO16,
-
-/* Relocation against a MIPS literal section.  */
-  BFD_RELOC_MIPS_LITERAL,
-
-/* MIPS ELF relocations.  */
-  BFD_RELOC_MIPS_GOT16,
-  BFD_RELOC_MIPS_CALL16,
-  BFD_RELOC_MIPS_GOT_HI16,
-  BFD_RELOC_MIPS_GOT_LO16,
-  BFD_RELOC_MIPS_CALL_HI16,
-  BFD_RELOC_MIPS_CALL_LO16,
-  BFD_RELOC_MIPS_SUB,
-  BFD_RELOC_MIPS_GOT_PAGE,
-  BFD_RELOC_MIPS_GOT_OFST,
-  BFD_RELOC_MIPS_GOT_DISP,
-  BFD_RELOC_MIPS_SHIFT5,
-  BFD_RELOC_MIPS_SHIFT6,
-  BFD_RELOC_MIPS_INSERT_A,
-  BFD_RELOC_MIPS_INSERT_B,
-  BFD_RELOC_MIPS_DELETE,
-  BFD_RELOC_MIPS_HIGHEST,
-  BFD_RELOC_MIPS_HIGHER,
-  BFD_RELOC_MIPS_SCN_DISP,
-  BFD_RELOC_MIPS_REL16,
-  BFD_RELOC_MIPS_RELGOT,
-  BFD_RELOC_MIPS_JALR,
-
-/* Fujitsu Frv Relocations.  */
-  BFD_RELOC_FRV_LABEL16,
-  BFD_RELOC_FRV_LABEL24,
-  BFD_RELOC_FRV_LO16,
-  BFD_RELOC_FRV_HI16,
-  BFD_RELOC_FRV_GPREL12,
-  BFD_RELOC_FRV_GPRELU12,
-  BFD_RELOC_FRV_GPREL32,
-  BFD_RELOC_FRV_GPRELHI,
-  BFD_RELOC_FRV_GPRELLO,
-
-
-/* i386/elf relocations  */
-  BFD_RELOC_386_GOT32,
-  BFD_RELOC_386_PLT32,
-  BFD_RELOC_386_COPY,
-  BFD_RELOC_386_GLOB_DAT,
-  BFD_RELOC_386_JUMP_SLOT,
-  BFD_RELOC_386_RELATIVE,
-  BFD_RELOC_386_GOTOFF,
-  BFD_RELOC_386_GOTPC,
-  BFD_RELOC_386_TLS_TPOFF,
-  BFD_RELOC_386_TLS_IE,
-  BFD_RELOC_386_TLS_GOTIE,
-  BFD_RELOC_386_TLS_LE,
-  BFD_RELOC_386_TLS_GD,
-  BFD_RELOC_386_TLS_LDM,
-  BFD_RELOC_386_TLS_LDO_32,
-  BFD_RELOC_386_TLS_IE_32,
-  BFD_RELOC_386_TLS_LE_32,
-  BFD_RELOC_386_TLS_DTPMOD32,
-  BFD_RELOC_386_TLS_DTPOFF32,
-  BFD_RELOC_386_TLS_TPOFF32,
-
-/* x86-64/elf relocations  */
-  BFD_RELOC_X86_64_GOT32,
-  BFD_RELOC_X86_64_PLT32,
-  BFD_RELOC_X86_64_COPY,
-  BFD_RELOC_X86_64_GLOB_DAT,
-  BFD_RELOC_X86_64_JUMP_SLOT,
-  BFD_RELOC_X86_64_RELATIVE,
-  BFD_RELOC_X86_64_GOTPCREL,
-  BFD_RELOC_X86_64_32S,
-  BFD_RELOC_X86_64_DTPMOD64,
-  BFD_RELOC_X86_64_DTPOFF64,
-  BFD_RELOC_X86_64_TPOFF64,
-  BFD_RELOC_X86_64_TLSGD,
-  BFD_RELOC_X86_64_TLSLD,
-  BFD_RELOC_X86_64_DTPOFF32,
-  BFD_RELOC_X86_64_GOTTPOFF,
-  BFD_RELOC_X86_64_TPOFF32,
-
-/* ns32k relocations  */
-  BFD_RELOC_NS32K_IMM_8,
-  BFD_RELOC_NS32K_IMM_16,
-  BFD_RELOC_NS32K_IMM_32,
-  BFD_RELOC_NS32K_IMM_8_PCREL,
-  BFD_RELOC_NS32K_IMM_16_PCREL,
-  BFD_RELOC_NS32K_IMM_32_PCREL,
-  BFD_RELOC_NS32K_DISP_8,
-  BFD_RELOC_NS32K_DISP_16,
-  BFD_RELOC_NS32K_DISP_32,
-  BFD_RELOC_NS32K_DISP_8_PCREL,
-  BFD_RELOC_NS32K_DISP_16_PCREL,
-  BFD_RELOC_NS32K_DISP_32_PCREL,
-
-/* PDP11 relocations  */
-  BFD_RELOC_PDP11_DISP_8_PCREL,
-  BFD_RELOC_PDP11_DISP_6_PCREL,
-
-/* Picojava relocs.  Not all of these appear in object files.  */
-  BFD_RELOC_PJ_CODE_HI16,
-  BFD_RELOC_PJ_CODE_LO16,
-  BFD_RELOC_PJ_CODE_DIR16,
-  BFD_RELOC_PJ_CODE_DIR32,
-  BFD_RELOC_PJ_CODE_REL16,
-  BFD_RELOC_PJ_CODE_REL32,
-
-/* Power(rs6000) and PowerPC relocations.  */
-  BFD_RELOC_PPC_B26,
-  BFD_RELOC_PPC_BA26,
-  BFD_RELOC_PPC_TOC16,
-  BFD_RELOC_PPC_B16,
-  BFD_RELOC_PPC_B16_BRTAKEN,
-  BFD_RELOC_PPC_B16_BRNTAKEN,
-  BFD_RELOC_PPC_BA16,
-  BFD_RELOC_PPC_BA16_BRTAKEN,
-  BFD_RELOC_PPC_BA16_BRNTAKEN,
-  BFD_RELOC_PPC_COPY,
-  BFD_RELOC_PPC_GLOB_DAT,
-  BFD_RELOC_PPC_JMP_SLOT,
-  BFD_RELOC_PPC_RELATIVE,
-  BFD_RELOC_PPC_LOCAL24PC,
-  BFD_RELOC_PPC_EMB_NADDR32,
-  BFD_RELOC_PPC_EMB_NADDR16,
-  BFD_RELOC_PPC_EMB_NADDR16_LO,
-  BFD_RELOC_PPC_EMB_NADDR16_HI,
-  BFD_RELOC_PPC_EMB_NADDR16_HA,
-  BFD_RELOC_PPC_EMB_SDAI16,
-  BFD_RELOC_PPC_EMB_SDA2I16,
-  BFD_RELOC_PPC_EMB_SDA2REL,
-  BFD_RELOC_PPC_EMB_SDA21,
-  BFD_RELOC_PPC_EMB_MRKREF,
-  BFD_RELOC_PPC_EMB_RELSEC16,
-  BFD_RELOC_PPC_EMB_RELST_LO,
-  BFD_RELOC_PPC_EMB_RELST_HI,
-  BFD_RELOC_PPC_EMB_RELST_HA,
-  BFD_RELOC_PPC_EMB_BIT_FLD,
-  BFD_RELOC_PPC_EMB_RELSDA,
-  BFD_RELOC_PPC64_HIGHER,
-  BFD_RELOC_PPC64_HIGHER_S,
-  BFD_RELOC_PPC64_HIGHEST,
-  BFD_RELOC_PPC64_HIGHEST_S,
-  BFD_RELOC_PPC64_TOC16_LO,
-  BFD_RELOC_PPC64_TOC16_HI,
-  BFD_RELOC_PPC64_TOC16_HA,
-  BFD_RELOC_PPC64_TOC,
-  BFD_RELOC_PPC64_PLTGOT16,
-  BFD_RELOC_PPC64_PLTGOT16_LO,
-  BFD_RELOC_PPC64_PLTGOT16_HI,
-  BFD_RELOC_PPC64_PLTGOT16_HA,
-  BFD_RELOC_PPC64_ADDR16_DS,
-  BFD_RELOC_PPC64_ADDR16_LO_DS,
-  BFD_RELOC_PPC64_GOT16_DS,
-  BFD_RELOC_PPC64_GOT16_LO_DS,
-  BFD_RELOC_PPC64_PLT16_LO_DS,
-  BFD_RELOC_PPC64_SECTOFF_DS,
-  BFD_RELOC_PPC64_SECTOFF_LO_DS,
-  BFD_RELOC_PPC64_TOC16_DS,
-  BFD_RELOC_PPC64_TOC16_LO_DS,
-  BFD_RELOC_PPC64_PLTGOT16_DS,
-  BFD_RELOC_PPC64_PLTGOT16_LO_DS,
-
-/* IBM 370/390 relocations  */
-  BFD_RELOC_I370_D12,
-
-/* The type of reloc used to build a contructor table - at the moment
-probably a 32 bit wide absolute relocation, but the target can choose.
-It generally does map to one of the other relocation types.  */
-  BFD_RELOC_CTOR,
-
-/* ARM 26 bit pc-relative branch.  The lowest two bits must be zero and are
-not stored in the instruction.  */
-  BFD_RELOC_ARM_PCREL_BRANCH,
-
-/* ARM 26 bit pc-relative branch.  The lowest bit must be zero and is
-not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
-field in the instruction.  */
-  BFD_RELOC_ARM_PCREL_BLX,
-
-/* Thumb 22 bit pc-relative branch.  The lowest bit must be zero and is
-not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
-field in the instruction.  */
-  BFD_RELOC_THUMB_PCREL_BLX,
-
-/* These relocs are only used within the ARM assembler.  They are not
-(at present) written to any object files.  */
-  BFD_RELOC_ARM_IMMEDIATE,
-  BFD_RELOC_ARM_ADRL_IMMEDIATE,
-  BFD_RELOC_ARM_OFFSET_IMM,
-  BFD_RELOC_ARM_SHIFT_IMM,
-  BFD_RELOC_ARM_SWI,
-  BFD_RELOC_ARM_MULTI,
-  BFD_RELOC_ARM_CP_OFF_IMM,
-  BFD_RELOC_ARM_ADR_IMM,
-  BFD_RELOC_ARM_LDR_IMM,
-  BFD_RELOC_ARM_LITERAL,
-  BFD_RELOC_ARM_IN_POOL,
-  BFD_RELOC_ARM_OFFSET_IMM8,
-  BFD_RELOC_ARM_HWLITERAL,
-  BFD_RELOC_ARM_THUMB_ADD,
-  BFD_RELOC_ARM_THUMB_IMM,
-  BFD_RELOC_ARM_THUMB_SHIFT,
-  BFD_RELOC_ARM_THUMB_OFFSET,
-  BFD_RELOC_ARM_GOT12,
-  BFD_RELOC_ARM_GOT32,
-  BFD_RELOC_ARM_JUMP_SLOT,
-  BFD_RELOC_ARM_COPY,
-  BFD_RELOC_ARM_GLOB_DAT,
-  BFD_RELOC_ARM_PLT32,
-  BFD_RELOC_ARM_RELATIVE,
-  BFD_RELOC_ARM_GOTOFF,
-  BFD_RELOC_ARM_GOTPC,
-
-/* Hitachi SH relocs.  Not all of these appear in object files.  */
-  BFD_RELOC_SH_PCDISP8BY2,
-  BFD_RELOC_SH_PCDISP12BY2,
-  BFD_RELOC_SH_IMM4,
-  BFD_RELOC_SH_IMM4BY2,
-  BFD_RELOC_SH_IMM4BY4,
-  BFD_RELOC_SH_IMM8,
-  BFD_RELOC_SH_IMM8BY2,
-  BFD_RELOC_SH_IMM8BY4,
-  BFD_RELOC_SH_PCRELIMM8BY2,
-  BFD_RELOC_SH_PCRELIMM8BY4,
-  BFD_RELOC_SH_SWITCH16,
-  BFD_RELOC_SH_SWITCH32,
-  BFD_RELOC_SH_USES,
-  BFD_RELOC_SH_COUNT,
-  BFD_RELOC_SH_ALIGN,
-  BFD_RELOC_SH_CODE,
-  BFD_RELOC_SH_DATA,
-  BFD_RELOC_SH_LABEL,
-  BFD_RELOC_SH_LOOP_START,
-  BFD_RELOC_SH_LOOP_END,
-  BFD_RELOC_SH_COPY,
-  BFD_RELOC_SH_GLOB_DAT,
-  BFD_RELOC_SH_JMP_SLOT,
-  BFD_RELOC_SH_RELATIVE,
-  BFD_RELOC_SH_GOTPC,
-  BFD_RELOC_SH_GOT_LOW16,
-  BFD_RELOC_SH_GOT_MEDLOW16,
-  BFD_RELOC_SH_GOT_MEDHI16,
-  BFD_RELOC_SH_GOT_HI16,
-  BFD_RELOC_SH_GOTPLT_LOW16,
-  BFD_RELOC_SH_GOTPLT_MEDLOW16,
-  BFD_RELOC_SH_GOTPLT_MEDHI16,
-  BFD_RELOC_SH_GOTPLT_HI16,
-  BFD_RELOC_SH_PLT_LOW16,
-  BFD_RELOC_SH_PLT_MEDLOW16,
-  BFD_RELOC_SH_PLT_MEDHI16,
-  BFD_RELOC_SH_PLT_HI16,
-  BFD_RELOC_SH_GOTOFF_LOW16,
-  BFD_RELOC_SH_GOTOFF_MEDLOW16,
-  BFD_RELOC_SH_GOTOFF_MEDHI16,
-  BFD_RELOC_SH_GOTOFF_HI16,
-  BFD_RELOC_SH_GOTPC_LOW16,
-  BFD_RELOC_SH_GOTPC_MEDLOW16,
-  BFD_RELOC_SH_GOTPC_MEDHI16,
-  BFD_RELOC_SH_GOTPC_HI16,
-  BFD_RELOC_SH_COPY64,
-  BFD_RELOC_SH_GLOB_DAT64,
-  BFD_RELOC_SH_JMP_SLOT64,
-  BFD_RELOC_SH_RELATIVE64,
-  BFD_RELOC_SH_GOT10BY4,
-  BFD_RELOC_SH_GOT10BY8,
-  BFD_RELOC_SH_GOTPLT10BY4,
-  BFD_RELOC_SH_GOTPLT10BY8,
-  BFD_RELOC_SH_GOTPLT32,
-  BFD_RELOC_SH_SHMEDIA_CODE,
-  BFD_RELOC_SH_IMMU5,
-  BFD_RELOC_SH_IMMS6,
-  BFD_RELOC_SH_IMMS6BY32,
-  BFD_RELOC_SH_IMMU6,
-  BFD_RELOC_SH_IMMS10,
-  BFD_RELOC_SH_IMMS10BY2,
-  BFD_RELOC_SH_IMMS10BY4,
-  BFD_RELOC_SH_IMMS10BY8,
-  BFD_RELOC_SH_IMMS16,
-  BFD_RELOC_SH_IMMU16,
-  BFD_RELOC_SH_IMM_LOW16,
-  BFD_RELOC_SH_IMM_LOW16_PCREL,
-  BFD_RELOC_SH_IMM_MEDLOW16,
-  BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
-  BFD_RELOC_SH_IMM_MEDHI16,
-  BFD_RELOC_SH_IMM_MEDHI16_PCREL,
-  BFD_RELOC_SH_IMM_HI16,
-  BFD_RELOC_SH_IMM_HI16_PCREL,
-  BFD_RELOC_SH_PT_16,
-  BFD_RELOC_SH_TLS_GD_32,
-  BFD_RELOC_SH_TLS_LD_32,
-  BFD_RELOC_SH_TLS_LDO_32,
-  BFD_RELOC_SH_TLS_IE_32,
-  BFD_RELOC_SH_TLS_LE_32,
-  BFD_RELOC_SH_TLS_DTPMOD32,
-  BFD_RELOC_SH_TLS_DTPOFF32,
-  BFD_RELOC_SH_TLS_TPOFF32,
-
-/* Thumb 23-, 12- and 9-bit pc-relative branches.  The lowest bit must
-be zero and is not stored in the instruction.  */
-  BFD_RELOC_THUMB_PCREL_BRANCH9,
-  BFD_RELOC_THUMB_PCREL_BRANCH12,
-  BFD_RELOC_THUMB_PCREL_BRANCH23,
-
-/* ARC Cores relocs.
-ARC 22 bit pc-relative branch.  The lowest two bits must be zero and are
-not stored in the instruction.  The high 20 bits are installed in bits 26
-through 7 of the instruction.  */
-  BFD_RELOC_ARC_B22_PCREL,
-
-/* ARC 26 bit absolute branch.  The lowest two bits must be zero and are not
-stored in the instruction.  The high 24 bits are installed in bits 23
-through 0.  */
-  BFD_RELOC_ARC_B26,
-
-/* Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0.  */
-  BFD_RELOC_D10V_10_PCREL_R,
-
-/* Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0.  This is the same as the previous reloc
-except it is in the left container, i.e.,
-shifted left 15 bits.  */
-  BFD_RELOC_D10V_10_PCREL_L,
-
-/* This is an 18-bit reloc with the right 2 bits
-assumed to be 0.  */
-  BFD_RELOC_D10V_18,
-
-/* This is an 18-bit reloc with the right 2 bits
-assumed to be 0.  */
-  BFD_RELOC_D10V_18_PCREL,
-
-/* Mitsubishi D30V relocs.
-This is a 6-bit absolute reloc.  */
-  BFD_RELOC_D30V_6,
-
-/* This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0.  */
-  BFD_RELOC_D30V_9_PCREL,
-
-/* This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.  */
-  BFD_RELOC_D30V_9_PCREL_R,
-
-/* This is a 12-bit absolute reloc with the
-right 3 bitsassumed to be 0.  */
-  BFD_RELOC_D30V_15,
-
-/* This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0.  */
-  BFD_RELOC_D30V_15_PCREL,
-
-/* This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.  */
-  BFD_RELOC_D30V_15_PCREL_R,
-
-/* This is an 18-bit absolute reloc with
-the right 3 bits assumed to be 0.  */
-  BFD_RELOC_D30V_21,
-
-/* This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0.  */
-  BFD_RELOC_D30V_21_PCREL,
-
-/* This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.  */
-  BFD_RELOC_D30V_21_PCREL_R,
-
-/* This is a 32-bit absolute reloc.  */
-  BFD_RELOC_D30V_32,
-
-/* This is a 32-bit pc-relative reloc.  */
-  BFD_RELOC_D30V_32_PCREL,
-
-/* DLX relocs  */
-  BFD_RELOC_DLX_HI16_S,
-
-/* DLX relocs  */
-  BFD_RELOC_DLX_LO16,
-
-/* DLX relocs  */
-  BFD_RELOC_DLX_JMP26,
-
-/* Mitsubishi M32R relocs.
-This is a 24 bit absolute address.  */
-  BFD_RELOC_M32R_24,
-
-/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0.  */
-  BFD_RELOC_M32R_10_PCREL,
-
-/* This is an 18-bit reloc with the right 2 bits assumed to be 0.  */
-  BFD_RELOC_M32R_18_PCREL,
-
-/* This is a 26-bit reloc with the right 2 bits assumed to be 0.  */
-  BFD_RELOC_M32R_26_PCREL,
-
-/* This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as unsigned.  */
-  BFD_RELOC_M32R_HI16_ULO,
-
-/* This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as signed.  */
-  BFD_RELOC_M32R_HI16_SLO,
-
-/* This is a 16-bit reloc containing the lower 16 bits of an address.  */
-  BFD_RELOC_M32R_LO16,
-
-/* This is a 16-bit reloc containing the small data area offset for use in
-add3, load, and store instructions.  */
-  BFD_RELOC_M32R_SDA16,
-
-/* This is a 9-bit reloc  */
-  BFD_RELOC_V850_9_PCREL,
-
-/* This is a 22-bit reloc  */
-  BFD_RELOC_V850_22_PCREL,
-
-/* This is a 16 bit offset from the short data area pointer.  */
-  BFD_RELOC_V850_SDA_16_16_OFFSET,
-
-/* This is a 16 bit offset (of which only 15 bits are used) from the
-short data area pointer.  */
-  BFD_RELOC_V850_SDA_15_16_OFFSET,
-
-/* This is a 16 bit offset from the zero data area pointer.  */
-  BFD_RELOC_V850_ZDA_16_16_OFFSET,
-
-/* This is a 16 bit offset (of which only 15 bits are used) from the
-zero data area pointer.  */
-  BFD_RELOC_V850_ZDA_15_16_OFFSET,
-
-/* This is an 8 bit offset (of which only 6 bits are used) from the
-tiny data area pointer.  */
-  BFD_RELOC_V850_TDA_6_8_OFFSET,
-
-/* This is an 8bit offset (of which only 7 bits are used) from the tiny
-data area pointer.  */
-  BFD_RELOC_V850_TDA_7_8_OFFSET,
-
-/* This is a 7 bit offset from the tiny data area pointer.  */
-  BFD_RELOC_V850_TDA_7_7_OFFSET,
-
-/* This is a 16 bit offset from the tiny data area pointer.  */
-  BFD_RELOC_V850_TDA_16_16_OFFSET,
-
-/* This is a 5 bit offset (of which only 4 bits are used) from the tiny
-data area pointer.  */
-  BFD_RELOC_V850_TDA_4_5_OFFSET,
-
-/* This is a 4 bit offset from the tiny data area pointer.  */
-  BFD_RELOC_V850_TDA_4_4_OFFSET,
-
-/* This is a 16 bit offset from the short data area pointer, with the
-bits placed non-contigously in the instruction.  */
-  BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
-
-/* This is a 16 bit offset from the zero data area pointer, with the
-bits placed non-contigously in the instruction.  */
-  BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
-
-/* This is a 6 bit offset from the call table base pointer.  */
-  BFD_RELOC_V850_CALLT_6_7_OFFSET,
-
-/* This is a 16 bit offset from the call table base pointer.  */
-  BFD_RELOC_V850_CALLT_16_16_OFFSET,
-
-/* Used for relaxing indirect function calls.  */
-  BFD_RELOC_V850_LONGCALL,
-
-/* Used for relaxing indirect jumps.  */
-  BFD_RELOC_V850_LONGJUMP,
-
-/* Used to maintain alignment whilst relaxing.  */
-  BFD_RELOC_V850_ALIGN,
-
-/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.  */
-  BFD_RELOC_MN10300_32_PCREL,
-
-/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.  */
-  BFD_RELOC_MN10300_16_PCREL,
-
-/* This is a 8bit DP reloc for the tms320c30, where the most
-significant 8 bits of a 24 bit word are placed into the least
-significant 8 bits of the opcode.  */
-  BFD_RELOC_TIC30_LDP,
-
-/* This is a 7bit reloc for the tms320c54x, where the least
-significant 7 bits of a 16 bit word are placed into the least
-significant 7 bits of the opcode.  */
-  BFD_RELOC_TIC54X_PARTLS7,
-
-/* This is a 9bit DP reloc for the tms320c54x, where the most
-significant 9 bits of a 16 bit word are placed into the least
-significant 9 bits of the opcode.  */
-  BFD_RELOC_TIC54X_PARTMS9,
-
-/* This is an extended address 23-bit reloc for the tms320c54x.  */
-  BFD_RELOC_TIC54X_23,
-
-/* This is a 16-bit reloc for the tms320c54x, where the least
-significant 16 bits of a 23-bit extended address are placed into
-the opcode.  */
-  BFD_RELOC_TIC54X_16_OF_23,
-
-/* This is a reloc for the tms320c54x, where the most
-significant 7 bits of a 23-bit extended address are placed into
-the opcode.  */
-  BFD_RELOC_TIC54X_MS7_OF_23,
-
-/* This is a 48 bit reloc for the FR30 that stores 32 bits.  */
-  BFD_RELOC_FR30_48,
-
-/* This is a 32 bit reloc for the FR30 that stores 20 bits split up into
-two sections.  */
-  BFD_RELOC_FR30_20,
-
-/* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
-4 bits.  */
-  BFD_RELOC_FR30_6_IN_4,
-
-/* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
-into 8 bits.  */
-  BFD_RELOC_FR30_8_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
-into 8 bits.  */
-  BFD_RELOC_FR30_9_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
-into 8 bits.  */
-  BFD_RELOC_FR30_10_IN_8,
-
-/* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
-short offset into 8 bits.  */
-  BFD_RELOC_FR30_9_PCREL,
-
-/* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
-short offset into 11 bits.  */
-  BFD_RELOC_FR30_12_PCREL,
-
-/* Motorola Mcore relocations.  */
-  BFD_RELOC_MCORE_PCREL_IMM8BY4,
-  BFD_RELOC_MCORE_PCREL_IMM11BY2,
-  BFD_RELOC_MCORE_PCREL_IMM4BY2,
-  BFD_RELOC_MCORE_PCREL_32,
-  BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
-  BFD_RELOC_MCORE_RVA,
-
-/* These are relocations for the GETA instruction.  */
-  BFD_RELOC_MMIX_GETA,
-  BFD_RELOC_MMIX_GETA_1,
-  BFD_RELOC_MMIX_GETA_2,
-  BFD_RELOC_MMIX_GETA_3,
-
-/* These are relocations for a conditional branch instruction.  */
-  BFD_RELOC_MMIX_CBRANCH,
-  BFD_RELOC_MMIX_CBRANCH_J,
-  BFD_RELOC_MMIX_CBRANCH_1,
-  BFD_RELOC_MMIX_CBRANCH_2,
-  BFD_RELOC_MMIX_CBRANCH_3,
-
-/* These are relocations for the PUSHJ instruction.  */
-  BFD_RELOC_MMIX_PUSHJ,
-  BFD_RELOC_MMIX_PUSHJ_1,
-  BFD_RELOC_MMIX_PUSHJ_2,
-  BFD_RELOC_MMIX_PUSHJ_3,
-
-/* These are relocations for the JMP instruction.  */
-  BFD_RELOC_MMIX_JMP,
-  BFD_RELOC_MMIX_JMP_1,
-  BFD_RELOC_MMIX_JMP_2,
-  BFD_RELOC_MMIX_JMP_3,
-
-/* This is a relocation for a relative address as in a GETA instruction or
-a branch.  */
-  BFD_RELOC_MMIX_ADDR19,
-
-/* This is a relocation for a relative address as in a JMP instruction.  */
-  BFD_RELOC_MMIX_ADDR27,
-
-/* This is a relocation for an instruction field that may be a general
-register or a value 0..255.  */
-  BFD_RELOC_MMIX_REG_OR_BYTE,
-
-/* This is a relocation for an instruction field that may be a general
-register.  */
-  BFD_RELOC_MMIX_REG,
-
-/* This is a relocation for two instruction fields holding a register and
-an offset, the equivalent of the relocation.  */
-  BFD_RELOC_MMIX_BASE_PLUS_OFFSET,
-
-/* This relocation is an assertion that the expression is not allocated as
-a global register.  It does not modify contents.  */
-  BFD_RELOC_MMIX_LOCAL,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
-short offset into 7 bits.  */
-  BFD_RELOC_AVR_7_PCREL,
-
-/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
-short offset into 12 bits.  */
-  BFD_RELOC_AVR_13_PCREL,
-
-/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
-program memory address) into 16 bits.  */
-  BFD_RELOC_AVR_16_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-data memory address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_LO8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of data memory address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_HI8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of program memory address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_HH8_LDI,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually data memory address) into 8 bit immediate value of SUBI insn.  */
-  BFD_RELOC_AVR_LO8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of data memory address) into 8 bit immediate value of
-SUBI insn.  */
-  BFD_RELOC_AVR_HI8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(most high 8 bit of program memory address) into 8 bit immediate value
-of LDI or SUBI insn.  */
-  BFD_RELOC_AVR_HH8_LDI_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-command address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_LO8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of command address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_HI8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of command address) into 8 bit immediate value of LDI insn.  */
-  BFD_RELOC_AVR_HH8_LDI_PM,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually command address) into 8 bit immediate value of SUBI insn.  */
-  BFD_RELOC_AVR_LO8_LDI_PM_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of 16 bit command address) into 8 bit immediate value
-of SUBI insn.  */
-  BFD_RELOC_AVR_HI8_LDI_PM_NEG,
-
-/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 6 bit of 22 bit command address) into 8 bit immediate
-value of SUBI insn.  */
-  BFD_RELOC_AVR_HH8_LDI_PM_NEG,
-
-/* This is a 32 bit reloc for the AVR that stores 23 bit value
-into 22 bits.  */
-  BFD_RELOC_AVR_CALL,
-
-/* Direct 12 bit.  */
-  BFD_RELOC_390_12,
-
-/* 12 bit GOT offset.  */
-  BFD_RELOC_390_GOT12,
-
-/* 32 bit PC relative PLT address.  */
-  BFD_RELOC_390_PLT32,
-
-/* Copy symbol at runtime.  */
-  BFD_RELOC_390_COPY,
-
-/* Create GOT entry.  */
-  BFD_RELOC_390_GLOB_DAT,
-
-/* Create PLT entry.  */
-  BFD_RELOC_390_JMP_SLOT,
-
-/* Adjust by program base.  */
-  BFD_RELOC_390_RELATIVE,
-
-/* 32 bit PC relative offset to GOT.  */
-  BFD_RELOC_390_GOTPC,
-
-/* 16 bit GOT offset.  */
-  BFD_RELOC_390_GOT16,
-
-/* PC relative 16 bit shifted by 1.  */
-  BFD_RELOC_390_PC16DBL,
-
-/* 16 bit PC rel. PLT shifted by 1.  */
-  BFD_RELOC_390_PLT16DBL,
-
-/* PC relative 32 bit shifted by 1.  */
-  BFD_RELOC_390_PC32DBL,
-
-/* 32 bit PC rel. PLT shifted by 1.  */
-  BFD_RELOC_390_PLT32DBL,
-
-/* 32 bit PC rel. GOT shifted by 1.  */
-  BFD_RELOC_390_GOTPCDBL,
-
-/* 64 bit GOT offset.  */
-  BFD_RELOC_390_GOT64,
-
-/* 64 bit PC relative PLT address.  */
-  BFD_RELOC_390_PLT64,
-
-/* 32 bit rel. offset to GOT entry.  */
-  BFD_RELOC_390_GOTENT,
-
-/* Scenix IP2K - 9-bit register number / data address  */
-  BFD_RELOC_IP2K_FR9,
-
-/* Scenix IP2K - 4-bit register/data bank number  */
-  BFD_RELOC_IP2K_BANK,
-
-/* Scenix IP2K - low 13 bits of instruction word address  */
-  BFD_RELOC_IP2K_ADDR16CJP,
-
-/* Scenix IP2K - high 3 bits of instruction word address  */
-  BFD_RELOC_IP2K_PAGE3,
-
-/* Scenix IP2K - ext/low/high 8 bits of data address  */
-  BFD_RELOC_IP2K_LO8DATA,
-  BFD_RELOC_IP2K_HI8DATA,
-  BFD_RELOC_IP2K_EX8DATA,
-
-/* Scenix IP2K - low/high 8 bits of instruction word address  */
-  BFD_RELOC_IP2K_LO8INSN,
-  BFD_RELOC_IP2K_HI8INSN,
-
-/* Scenix IP2K - even/odd PC modifier to modify snb pcl.0  */
-  BFD_RELOC_IP2K_PC_SKIP,
-
-/* Scenix IP2K - 16 bit word address in text section.  */
-  BFD_RELOC_IP2K_TEXT,
-
-/* Scenix IP2K - 7-bit sp or dp offset  */
-  BFD_RELOC_IP2K_FR_OFFSET,
-
-/* Scenix VPE4K coprocessor - data/insn-space addressing  */
-  BFD_RELOC_VPE4KMATH_DATA,
-  BFD_RELOC_VPE4KMATH_INSN,
-
-/* These two relocations are used by the linker to determine which of
-the entries in a C++ virtual function table are actually used.  When
-the --gc-sections option is given, the linker will zero out the entries
-that are not used, so that the code for those functions need not be
-included in the output.
-
-VTABLE_INHERIT is a zero-space relocation used to describe to the
-linker the inheritence tree of a C++ virtual function table.  The
-relocation's symbol should be the parent class' vtable, and the
-relocation should be located at the child vtable.
-
-VTABLE_ENTRY is a zero-space relocation that describes the use of a
-virtual function table entry.  The reloc's symbol should refer to the
-table of the class mentioned in the code.  Off of that base, an offset
-describes the entry that is being used.  For Rela hosts, this offset
-is stored in the reloc's addend.  For Rel hosts, we are forced to put
-this offset in the reloc's section offset.  */
-  BFD_RELOC_VTABLE_INHERIT,
-  BFD_RELOC_VTABLE_ENTRY,
-
-/* Intel IA64 Relocations.  */
-  BFD_RELOC_IA64_IMM14,
-  BFD_RELOC_IA64_IMM22,
-  BFD_RELOC_IA64_IMM64,
-  BFD_RELOC_IA64_DIR32MSB,
-  BFD_RELOC_IA64_DIR32LSB,
-  BFD_RELOC_IA64_DIR64MSB,
-  BFD_RELOC_IA64_DIR64LSB,
-  BFD_RELOC_IA64_GPREL22,
-  BFD_RELOC_IA64_GPREL64I,
-  BFD_RELOC_IA64_GPREL32MSB,
-  BFD_RELOC_IA64_GPREL32LSB,
-  BFD_RELOC_IA64_GPREL64MSB,
-  BFD_RELOC_IA64_GPREL64LSB,
-  BFD_RELOC_IA64_LTOFF22,
-  BFD_RELOC_IA64_LTOFF64I,
-  BFD_RELOC_IA64_PLTOFF22,
-  BFD_RELOC_IA64_PLTOFF64I,
-  BFD_RELOC_IA64_PLTOFF64MSB,
-  BFD_RELOC_IA64_PLTOFF64LSB,
-  BFD_RELOC_IA64_FPTR64I,
-  BFD_RELOC_IA64_FPTR32MSB,
-  BFD_RELOC_IA64_FPTR32LSB,
-  BFD_RELOC_IA64_FPTR64MSB,
-  BFD_RELOC_IA64_FPTR64LSB,
-  BFD_RELOC_IA64_PCREL21B,
-  BFD_RELOC_IA64_PCREL21BI,
-  BFD_RELOC_IA64_PCREL21M,
-  BFD_RELOC_IA64_PCREL21F,
-  BFD_RELOC_IA64_PCREL22,
-  BFD_RELOC_IA64_PCREL60B,
-  BFD_RELOC_IA64_PCREL64I,
-  BFD_RELOC_IA64_PCREL32MSB,
-  BFD_RELOC_IA64_PCREL32LSB,
-  BFD_RELOC_IA64_PCREL64MSB,
-  BFD_RELOC_IA64_PCREL64LSB,
-  BFD_RELOC_IA64_LTOFF_FPTR22,
-  BFD_RELOC_IA64_LTOFF_FPTR64I,
-  BFD_RELOC_IA64_LTOFF_FPTR32MSB,
-  BFD_RELOC_IA64_LTOFF_FPTR32LSB,
-  BFD_RELOC_IA64_LTOFF_FPTR64MSB,
-  BFD_RELOC_IA64_LTOFF_FPTR64LSB,
-  BFD_RELOC_IA64_SEGREL32MSB,
-  BFD_RELOC_IA64_SEGREL32LSB,
-  BFD_RELOC_IA64_SEGREL64MSB,
-  BFD_RELOC_IA64_SEGREL64LSB,
-  BFD_RELOC_IA64_SECREL32MSB,
-  BFD_RELOC_IA64_SECREL32LSB,
-  BFD_RELOC_IA64_SECREL64MSB,
-  BFD_RELOC_IA64_SECREL64LSB,
-  BFD_RELOC_IA64_REL32MSB,
-  BFD_RELOC_IA64_REL32LSB,
-  BFD_RELOC_IA64_REL64MSB,
-  BFD_RELOC_IA64_REL64LSB,
-  BFD_RELOC_IA64_LTV32MSB,
-  BFD_RELOC_IA64_LTV32LSB,
-  BFD_RELOC_IA64_LTV64MSB,
-  BFD_RELOC_IA64_LTV64LSB,
-  BFD_RELOC_IA64_IPLTMSB,
-  BFD_RELOC_IA64_IPLTLSB,
-  BFD_RELOC_IA64_COPY,
-  BFD_RELOC_IA64_LTOFF22X,
-  BFD_RELOC_IA64_LDXMOV,
-  BFD_RELOC_IA64_TPREL14,
-  BFD_RELOC_IA64_TPREL22,
-  BFD_RELOC_IA64_TPREL64I,
-  BFD_RELOC_IA64_TPREL64MSB,
-  BFD_RELOC_IA64_TPREL64LSB,
-  BFD_RELOC_IA64_LTOFF_TPREL22,
-  BFD_RELOC_IA64_DTPMOD64MSB,
-  BFD_RELOC_IA64_DTPMOD64LSB,
-  BFD_RELOC_IA64_LTOFF_DTPMOD22,
-  BFD_RELOC_IA64_DTPREL14,
-  BFD_RELOC_IA64_DTPREL22,
-  BFD_RELOC_IA64_DTPREL64I,
-  BFD_RELOC_IA64_DTPREL32MSB,
-  BFD_RELOC_IA64_DTPREL32LSB,
-  BFD_RELOC_IA64_DTPREL64MSB,
-  BFD_RELOC_IA64_DTPREL64LSB,
-  BFD_RELOC_IA64_LTOFF_DTPREL22,
-
-/* Motorola 68HC11 reloc.
-This is the 8 bit high part of an absolute address.  */
-  BFD_RELOC_M68HC11_HI8,
-
-/* Motorola 68HC11 reloc.
-This is the 8 bit low part of an absolute address.  */
-  BFD_RELOC_M68HC11_LO8,
-
-/* Motorola 68HC11 reloc.
-This is the 3 bit of a value.  */
-  BFD_RELOC_M68HC11_3B,
-
-/* Motorola 68HC11 reloc.
-This reloc marks the beginning of a jump/call instruction.
-It is used for linker relaxation to correctly identify beginning
-of instruction and change some branchs to use PC-relative
-addressing mode.  */
-  BFD_RELOC_M68HC11_RL_JUMP,
-
-/* Motorola 68HC11 reloc.
-This reloc marks a group of several instructions that gcc generates
-and for which the linker relaxation pass can modify and/or remove
-some of them.  */
-  BFD_RELOC_M68HC11_RL_GROUP,
-
-/* Motorola 68HC11 reloc.
-This is the 16-bit lower part of an address.  It is used for 'call'
-instruction to specify the symbol address without any special
-transformation (due to memory bank window).  */
-  BFD_RELOC_M68HC11_LO16,
-
-/* Motorola 68HC11 reloc.
-This is a 8-bit reloc that specifies the page number of an address.
-It is used by 'call' instruction to specify the page number of
-the symbol.  */
-  BFD_RELOC_M68HC11_PAGE,
-
-/* Motorola 68HC11 reloc.
-This is a 24-bit reloc that represents the address with a 16-bit
-value and a 8-bit page number.  The symbol address is transformed
-to follow the 16K memory bank of 68HC12 (seen as mapped in the window).  */
-  BFD_RELOC_M68HC11_24,
-
-/* These relocs are only used within the CRIS assembler.  They are not
-(at present) written to any object files.  */
-  BFD_RELOC_CRIS_BDISP8,
-  BFD_RELOC_CRIS_UNSIGNED_5,
-  BFD_RELOC_CRIS_SIGNED_6,
-  BFD_RELOC_CRIS_UNSIGNED_6,
-  BFD_RELOC_CRIS_UNSIGNED_4,
-
-/* Relocs used in ELF shared libraries for CRIS.  */
-  BFD_RELOC_CRIS_COPY,
-  BFD_RELOC_CRIS_GLOB_DAT,
-  BFD_RELOC_CRIS_JUMP_SLOT,
-  BFD_RELOC_CRIS_RELATIVE,
-
-/* 32-bit offset to symbol-entry within GOT.  */
-  BFD_RELOC_CRIS_32_GOT,
-
-/* 16-bit offset to symbol-entry within GOT.  */
-  BFD_RELOC_CRIS_16_GOT,
-
-/* 32-bit offset to symbol-entry within GOT, with PLT handling.  */
-  BFD_RELOC_CRIS_32_GOTPLT,
-
-/* 16-bit offset to symbol-entry within GOT, with PLT handling.  */
-  BFD_RELOC_CRIS_16_GOTPLT,
-
-/* 32-bit offset to symbol, relative to GOT.  */
-  BFD_RELOC_CRIS_32_GOTREL,
-
-/* 32-bit offset to symbol with PLT entry, relative to GOT.  */
-  BFD_RELOC_CRIS_32_PLT_GOTREL,
-
-/* 32-bit offset to symbol with PLT entry, relative to this relocation.  */
-  BFD_RELOC_CRIS_32_PLT_PCREL,
-
-/* Intel i860 Relocations.  */
-  BFD_RELOC_860_COPY,
-  BFD_RELOC_860_GLOB_DAT,
-  BFD_RELOC_860_JUMP_SLOT,
-  BFD_RELOC_860_RELATIVE,
-  BFD_RELOC_860_PC26,
-  BFD_RELOC_860_PLT26,
-  BFD_RELOC_860_PC16,
-  BFD_RELOC_860_LOW0,
-  BFD_RELOC_860_SPLIT0,
-  BFD_RELOC_860_LOW1,
-  BFD_RELOC_860_SPLIT1,
-  BFD_RELOC_860_LOW2,
-  BFD_RELOC_860_SPLIT2,
-  BFD_RELOC_860_LOW3,
-  BFD_RELOC_860_LOGOT0,
-  BFD_RELOC_860_SPGOT0,
-  BFD_RELOC_860_LOGOT1,
-  BFD_RELOC_860_SPGOT1,
-  BFD_RELOC_860_LOGOTOFF0,
-  BFD_RELOC_860_SPGOTOFF0,
-  BFD_RELOC_860_LOGOTOFF1,
-  BFD_RELOC_860_SPGOTOFF1,
-  BFD_RELOC_860_LOGOTOFF2,
-  BFD_RELOC_860_LOGOTOFF3,
-  BFD_RELOC_860_LOPC,
-  BFD_RELOC_860_HIGHADJ,
-  BFD_RELOC_860_HAGOT,
-  BFD_RELOC_860_HAGOTOFF,
-  BFD_RELOC_860_HAPC,
-  BFD_RELOC_860_HIGH,
-  BFD_RELOC_860_HIGOT,
-  BFD_RELOC_860_HIGOTOFF,
-
-/* OpenRISC Relocations.  */
-  BFD_RELOC_OPENRISC_ABS_26,
-  BFD_RELOC_OPENRISC_REL_26,
-
-/* H8 elf Relocations.  */
-  BFD_RELOC_H8_DIR16A8,
-  BFD_RELOC_H8_DIR16R8,
-  BFD_RELOC_H8_DIR24A8,
-  BFD_RELOC_H8_DIR24R8,
-  BFD_RELOC_H8_DIR32A16,
-
-/* Sony Xstormy16 Relocations.  */
-  BFD_RELOC_XSTORMY16_REL_12,
-  BFD_RELOC_XSTORMY16_24,
-  BFD_RELOC_XSTORMY16_FPTR16,
-
-/* Relocations used by VAX ELF.  */
-  BFD_RELOC_VAX_GLOB_DAT,
-  BFD_RELOC_VAX_JMP_SLOT,
-  BFD_RELOC_VAX_RELATIVE,
-  BFD_RELOC_UNUSED };
-typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-reloc_howto_type *
-bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-
-const char *
-bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
-
-/* Extracted from syms.c.  */
-
-typedef struct symbol_cache_entry
-{
-  /* A pointer to the BFD which owns the symbol. This information
-     is necessary so that a back end can work out what additional
-     information (invisible to the application writer) is carried
-     with the symbol.
-
-     This field is *almost* redundant, since you can use section->owner
-     instead, except that some symbols point to the global sections
-     bfd_{abs,com,und}_section.  This could be fixed by making
-     these globals be per-bfd (or per-target-flavor).  FIXME.  */
-  struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field.  */
-
-  /* The text of the symbol. The name is left alone, and not copied; the
-     application may not alter it.  */
-  const char *name;
-
-  /* The value of the symbol.  This really should be a union of a
-     numeric value with a pointer, since some flags indicate that
-     a pointer to another symbol is stored here.  */
-  symvalue value;
-
-  /* Attributes of a symbol.  */
-#define BSF_NO_FLAGS    0x00
-
-  /* The symbol has local scope; <<static>> in <<C>>. The value
-     is the offset into the section of the data.  */
-#define BSF_LOCAL      0x01
-
-  /* The symbol has global scope; initialized data in <<C>>. The
-     value is the offset into the section of the data.  */
-#define BSF_GLOBAL     0x02
-
-  /* The symbol has global scope and is exported. The value is
-     the offset into the section of the data.  */
-#define BSF_EXPORT     BSF_GLOBAL /* No real difference.  */
-
-  /* A normal C symbol would be one of:
-     <<BSF_LOCAL>>, <<BSF_FORT_COMM>>,  <<BSF_UNDEFINED>> or
-     <<BSF_GLOBAL>>.  */
-
-  /* The symbol is a debugging record. The value has an arbitary
-     meaning, unless BSF_DEBUGGING_RELOC is also set.  */
-#define BSF_DEBUGGING  0x08
-
-  /* The symbol denotes a function entry point.  Used in ELF,
-     perhaps others someday.  */
-#define BSF_FUNCTION    0x10
-
-  /* Used by the linker.  */
-#define BSF_KEEP        0x20
-#define BSF_KEEP_G      0x40
-
-  /* A weak global symbol, overridable without warnings by
-     a regular global symbol of the same name.  */
-#define BSF_WEAK        0x80
-
-  /* This symbol was created to point to a section, e.g. ELF's
-     STT_SECTION symbols.  */
-#define BSF_SECTION_SYM 0x100
-
-  /* The symbol used to be a common symbol, but now it is
-     allocated.  */
-#define BSF_OLD_COMMON  0x200
-
-  /* The default value for common data.  */
-#define BFD_FORT_COMM_DEFAULT_VALUE 0
-
-  /* In some files the type of a symbol sometimes alters its
-     location in an output file - ie in coff a <<ISFCN>> symbol
-     which is also <<C_EXT>> symbol appears where it was
-     declared and not at the end of a section.  This bit is set
-     by the target BFD part to convey this information.  */
-#define BSF_NOT_AT_END    0x400
-
-  /* Signal that the symbol is the label of constructor section.  */
-#define BSF_CONSTRUCTOR   0x800
-
-  /* Signal that the symbol is a warning symbol.  The name is a
-     warning.  The name of the next symbol is the one to warn about;
-     if a reference is made to a symbol with the same name as the next
-     symbol, a warning is issued by the linker.  */
-#define BSF_WARNING       0x1000
-
-  /* Signal that the symbol is indirect.  This symbol is an indirect
-     pointer to the symbol with the same name as the next symbol.  */
-#define BSF_INDIRECT      0x2000
-
-  /* BSF_FILE marks symbols that contain a file name.  This is used
-     for ELF STT_FILE symbols.  */
-#define BSF_FILE          0x4000
-
-  /* Symbol is from dynamic linking information.  */
-#define BSF_DYNAMIC       0x8000
-
-  /* The symbol denotes a data object.  Used in ELF, and perhaps
-     others someday.  */
-#define BSF_OBJECT        0x10000
-
-  /* This symbol is a debugging symbol.  The value is the offset
-     into the section of the data.  BSF_DEBUGGING should be set
-     as well.  */
-#define BSF_DEBUGGING_RELOC 0x20000
-
-  /* This symbol is thread local.  Used in ELF.  */
-#define BSF_THREAD_LOCAL  0x40000
-
-  flagword flags;
-
-  /* A pointer to the section to which this symbol is
-     relative.  This will always be non NULL, there are special
-     sections for undefined and absolute symbols.  */
-  struct sec *section;
-
-  /* Back end special data.  */
-  union
-    {
-      PTR p;
-      bfd_vma i;
-    }
-  udata;
-}
-asymbol;
-
-#define bfd_get_symtab_upper_bound(abfd) \
-     BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
-boolean
-bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
-
-boolean
-bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name));
-
-#define bfd_is_local_label_name(abfd, name) \
-     BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-
-#define bfd_canonicalize_symtab(abfd, location) \
-     BFD_SEND (abfd, _bfd_canonicalize_symtab,\
-                  (abfd, location))
-
-boolean
-bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
-
-void
-bfd_print_symbol_vandf PARAMS ((bfd *abfd, PTR file, asymbol *symbol));
-
-#define bfd_make_empty_symbol(abfd) \
-     BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
-asymbol *
-_bfd_generic_make_empty_symbol PARAMS ((bfd *));
-
-#define bfd_make_debug_symbol(abfd,ptr,size) \
-        BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
-int
-bfd_decode_symclass PARAMS ((asymbol *symbol));
-
-boolean
-bfd_is_undefined_symclass PARAMS ((int symclass));
-
-void
-bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
-
-boolean
-bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
-
-#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
-     BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
-               (ibfd, isymbol, obfd, osymbol))
-
-/* Extracted from bfd.c.  */
-struct _bfd
-{
-  /* The filename the application opened the BFD with.  */
-  const char *filename;
-
-  /* A pointer to the target jump table.  */
-  const struct bfd_target *xvec;
-
-  /* To avoid dragging too many header files into every file that
-     includes `<<bfd.h>>', IOSTREAM has been declared as a "char *",
-     and MTIME as a "long".  Their correct types, to which they
-     are cast when used, are "FILE *" and "time_t".    The iostream
-     is the result of an fopen on the filename.  However, if the
-     BFD_IN_MEMORY flag is set, then iostream is actually a pointer
-     to a bfd_in_memory struct.  */
-  PTR iostream;
-
-  /* Is the file descriptor being cached?  That is, can it be closed as
-     needed, and re-opened when accessed later?  */
-  boolean cacheable;
-
-  /* Marks whether there was a default target specified when the
-     BFD was opened. This is used to select which matching algorithm
-     to use to choose the back end.  */
-  boolean target_defaulted;
-
-  /* The caching routines use these to maintain a
-     least-recently-used list of BFDs.  */
-  struct _bfd *lru_prev, *lru_next;
-
-  /* When a file is closed by the caching routines, BFD retains
-     state information on the file here...  */
-  ufile_ptr where;
-
-  /* ... and here: (``once'' means at least once).  */
-  boolean opened_once;
-
-  /* Set if we have a locally maintained mtime value, rather than
-     getting it from the file each time.  */
-  boolean mtime_set;
-
-  /* File modified time, if mtime_set is true.  */
-  long mtime;
-
-  /* Reserved for an unimplemented file locking extension.  */
-  int ifd;
-
-  /* The format which belongs to the BFD. (object, core, etc.)  */
-  bfd_format format;
-
-  /* The direction with which the BFD was opened.  */
-  enum bfd_direction
-    {
-      no_direction = 0,
-      read_direction = 1,
-      write_direction = 2,
-      both_direction = 3
-    }
-  direction;
-
-  /* Format_specific flags.  */
-  flagword flags;
-
-  /* Currently my_archive is tested before adding origin to
-     anything. I believe that this can become always an add of
-     origin, with origin set to 0 for non archive files.  */
-  ufile_ptr origin;
-
-  /* Remember when output has begun, to stop strange things
-     from happening.  */
-  boolean output_has_begun;
-
-  /* A hash table for section names.  */
-  struct bfd_hash_table section_htab;
-
-  /* Pointer to linked list of sections.  */
-  struct sec *sections;
-
-  /* The place where we add to the section list.  */
-  struct sec **section_tail;
-
-  /* The number of sections.  */
-  unsigned int section_count;
-
-  /* Stuff only useful for object files:
-     The start address.  */
-  bfd_vma start_address;
-
-  /* Used for input and output.  */
-  unsigned int symcount;
-
-  /* Symbol table for output BFD (with symcount entries).  */
-  struct symbol_cache_entry  **outsymbols;
-
-  /* Used for slurped dynamic symbol tables.  */
-  unsigned int dynsymcount;
-
-  /* Pointer to structure which contains architecture information.  */
-  const struct bfd_arch_info *arch_info;
-
-  /* Stuff only useful for archives.  */
-  PTR arelt_data;
-  struct _bfd *my_archive;     /* The containing archive BFD.  */
-  struct _bfd *next;           /* The next BFD in the archive.  */
-  struct _bfd *archive_head;   /* The first BFD in the archive.  */
-  boolean has_armap;
-
-  /* A chain of BFD structures involved in a link.  */
-  struct _bfd *link_next;
-
-  /* A field used by _bfd_generic_link_add_archive_symbols.  This will
-     be used only for archive elements.  */
-  int archive_pass;
-
-  /* Used by the back end to hold private data.  */
-  union
-    {
-      struct aout_data_struct *aout_data;
-      struct artdata *aout_ar_data;
-      struct _oasys_data *oasys_obj_data;
-      struct _oasys_ar_data *oasys_ar_data;
-      struct coff_tdata *coff_obj_data;
-      struct pe_tdata *pe_obj_data;
-      struct xcoff_tdata *xcoff_obj_data;
-      struct ecoff_tdata *ecoff_obj_data;
-      struct ieee_data_struct *ieee_data;
-      struct ieee_ar_data_struct *ieee_ar_data;
-      struct srec_data_struct *srec_data;
-      struct ihex_data_struct *ihex_data;
-      struct tekhex_data_struct *tekhex_data;
-      struct elf_obj_tdata *elf_obj_data;
-      struct nlm_obj_tdata *nlm_obj_data;
-      struct bout_data_struct *bout_data;
-      struct mmo_data_struct *mmo_data;
-      struct sun_core_struct *sun_core_data;
-      struct sco5_core_struct *sco5_core_data;
-      struct trad_core_struct *trad_core_data;
-      struct som_data_struct *som_data;
-      struct hpux_core_struct *hpux_core_data;
-      struct hppabsd_core_struct *hppabsd_core_data;
-      struct sgi_core_struct *sgi_core_data;
-      struct lynx_core_struct *lynx_core_data;
-      struct osf_core_struct *osf_core_data;
-      struct cisco_core_struct *cisco_core_data;
-      struct versados_data_struct *versados_data;
-      struct netbsd_core_struct *netbsd_core_data;
-      struct mach_o_data_struct *mach_o_data;
-      struct mach_o_fat_data_struct *mach_o_fat_data;
-      struct bfd_pef_data_struct *pef_data;
-      struct bfd_pef_xlib_data_struct *pef_xlib_data;
-      struct bfd_sym_data_struct *sym_data;
-      PTR any;
-    }
-  tdata;
-
-  /* Used by the application to hold private data.  */
-  PTR usrdata;
-
-  /* Where all the allocated stuff under this BFD goes.  This is a
-     struct objalloc *, but we use PTR to avoid requiring the inclusion of
-     objalloc.h.  */
-  PTR memory;
-};
-
-typedef enum bfd_error
-{
-  bfd_error_no_error = 0,
-  bfd_error_system_call,
-  bfd_error_invalid_target,
-  bfd_error_wrong_format,
-  bfd_error_wrong_object_format,
-  bfd_error_invalid_operation,
-  bfd_error_no_memory,
-  bfd_error_no_symbols,
-  bfd_error_no_armap,
-  bfd_error_no_more_archived_files,
-  bfd_error_malformed_archive,
-  bfd_error_file_not_recognized,
-  bfd_error_file_ambiguously_recognized,
-  bfd_error_no_contents,
-  bfd_error_nonrepresentable_section,
-  bfd_error_no_debug_section,
-  bfd_error_bad_value,
-  bfd_error_file_truncated,
-  bfd_error_file_too_big,
-  bfd_error_invalid_error_code
-}
-bfd_error_type;
-
-bfd_error_type
-bfd_get_error PARAMS ((void));
-
-void
-bfd_set_error PARAMS ((bfd_error_type error_tag));
-
-const char *
-bfd_errmsg PARAMS ((bfd_error_type error_tag));
-
-void
-bfd_perror PARAMS ((const char *message));
-
-typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
-
-bfd_error_handler_type
-bfd_set_error_handler PARAMS ((bfd_error_handler_type));
-
-void
-bfd_set_error_program_name PARAMS ((const char *));
-
-bfd_error_handler_type
-bfd_get_error_handler PARAMS ((void));
-
-const char *
-bfd_archive_filename PARAMS ((bfd *));
-
-long
-bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
-
-long
-bfd_canonicalize_reloc PARAMS ((bfd *abfd,
-    asection *sec,
-    arelent **loc,
-    asymbol **syms));
-
-void
-bfd_set_reloc PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count));
-
-boolean
-bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
-
-int
-bfd_get_arch_size PARAMS ((bfd *abfd));
-
-int
-bfd_get_sign_extend_vma PARAMS ((bfd *abfd));
-
-boolean
-bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
-
-unsigned int
-bfd_get_gp_size PARAMS ((bfd *abfd));
-
-void
-bfd_set_gp_size PARAMS ((bfd *abfd, unsigned int i));
-
-bfd_vma
-bfd_scan_vma PARAMS ((const char *string, const char **end, int base));
-
-boolean
-bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
-
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
-     BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
-               (ibfd, obfd))
-boolean
-bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
-
-#define bfd_merge_private_bfd_data(ibfd, obfd) \
-     BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
-               (ibfd, obfd))
-boolean
-bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
-
-#define bfd_set_private_flags(abfd, flags) \
-     BFD_SEND (abfd, _bfd_set_private_flags, \
-               (abfd, flags))
-#define bfd_sizeof_headers(abfd, reloc) \
-     BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
-     BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, sec, syms, off, file, func, line))
-
-       /* Do these three do anything useful at all, for any back end?  */
-#define bfd_debug_info_start(abfd) \
-        BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
-        BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
-        BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-
-#define bfd_stat_arch_elt(abfd, stat) \
-        BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
-        BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
-        BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
-       BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_gc_sections(abfd, link_info) \
-       BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-
-#define bfd_merge_sections(abfd, link_info) \
-       BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
-
-#define bfd_discard_group(abfd, sec) \
-       BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-
-#define bfd_link_hash_table_create(abfd) \
-       BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_hash_table_free(abfd, hash) \
-       BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
-
-#define bfd_link_add_symbols(abfd, info) \
-       BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_link_just_syms(sec, info) \
-       BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-
-#define bfd_final_link(abfd, info) \
-       BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
-       BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
-       BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
-       BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
-       BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
-       BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
-       BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
-       PARAMS ((bfd *, struct bfd_link_info *,
-                 struct bfd_link_order *, bfd_byte *,
-                 boolean, asymbol **));
-
-boolean
-bfd_alt_mach_code PARAMS ((bfd *abfd, int alternative));
-
-struct bfd_preserve
-{
-  PTR marker;
-  PTR tdata;
-  flagword flags;
-  const struct bfd_arch_info *arch_info;
-  struct sec *sections;
-  struct sec **section_tail;
-  unsigned int section_count;
-  struct bfd_hash_table section_htab;
-};
-
-boolean
-bfd_preserve_save PARAMS ((bfd *, struct bfd_preserve *));
-
-void
-bfd_preserve_restore PARAMS ((bfd *, struct bfd_preserve *));
-
-void
-bfd_preserve_finish PARAMS ((bfd *, struct bfd_preserve *));
-
-/* Extracted from archive.c.  */
-symindex
-bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
-
-boolean
-bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
-
-bfd *
-bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
-
-/* Extracted from corefile.c.  */
-const char *
-bfd_core_file_failing_command PARAMS ((bfd *abfd));
-
-int
-bfd_core_file_failing_signal PARAMS ((bfd *abfd));
-
-boolean
-core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-
-/* Extracted from targets.c.  */
-#define BFD_SEND(bfd, message, arglist) \
-               ((*((bfd)->xvec->message)) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND
-#define BFD_SEND(bfd, message, arglist) \
-  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-    ((*((bfd)->xvec->message)) arglist) : \
-    (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-#define BFD_SEND_FMT(bfd, message, arglist) \
-            (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND_FMT
-#define BFD_SEND_FMT(bfd, message, arglist) \
-  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
-   (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-
-enum bfd_flavour
-{
-  bfd_target_unknown_flavour,
-  bfd_target_aout_flavour,
-  bfd_target_coff_flavour,
-  bfd_target_ecoff_flavour,
-  bfd_target_xcoff_flavour,
-  bfd_target_elf_flavour,
-  bfd_target_ieee_flavour,
-  bfd_target_nlm_flavour,
-  bfd_target_oasys_flavour,
-  bfd_target_tekhex_flavour,
-  bfd_target_srec_flavour,
-  bfd_target_ihex_flavour,
-  bfd_target_som_flavour,
-  bfd_target_os9k_flavour,
-  bfd_target_versados_flavour,
-  bfd_target_msdos_flavour,
-  bfd_target_ovax_flavour,
-  bfd_target_evax_flavour,
-  bfd_target_mmo_flavour,
-  bfd_target_mach_o_flavour,
-  bfd_target_pef_flavour,
-  bfd_target_pef_xlib_flavour,
-  bfd_target_sym_flavour
-};
-
-enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-
-/* Forward declaration.  */
-typedef struct bfd_link_info _bfd_link_info;
-
-typedef struct bfd_target
-{
-  /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  */
-  char *name;
-
- /* The "flavour" of a back end is a general indication about
-    the contents of a file.  */
-  enum bfd_flavour flavour;
-
-  /* The order of bytes within the data area of a file.  */
-  enum bfd_endian byteorder;
-
- /* The order of bytes within the header parts of a file.  */
-  enum bfd_endian header_byteorder;
-
-  /* A mask of all the flags which an executable may have set -
-     from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.  */
-  flagword object_flags;
-
- /* A mask of all the flags which a section may have set - from
-    the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.  */
-  flagword section_flags;
-
- /* The character normally found at the front of a symbol.
-    (if any), perhaps `_'.  */
-  char symbol_leading_char;
-
- /* The pad character for file names within an archive header.  */
-  char ar_pad_char;
-
-  /* The maximum number of characters in an archive header.  */
-  unsigned short ar_max_namelen;
-
-  /* Entries for byte swapping for data. These are different from the
-     other entry points, since they don't take a BFD asthe first argument.
-     Certain other handlers could do the same.  */
-  bfd_vma        (*bfd_getx64) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
-  void           (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
-  bfd_vma        (*bfd_getx32) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
-  void           (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
-  bfd_vma        (*bfd_getx16) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
-  void           (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
-
-  /* Byte swapping for the headers.  */
-  bfd_vma        (*bfd_h_getx64) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
-  void           (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
-  bfd_vma        (*bfd_h_getx32) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
-  void           (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
-  bfd_vma        (*bfd_h_getx16) PARAMS ((const bfd_byte *));
-  bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
-  void           (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
-
-  /* Format dependent routines: these are vectors of entry points
-     within the target vector structure, one for each format to check.  */
-
-  /* Check the format of a file being read.  Return a <<bfd_target *>> or zero.  */
-  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
-
-  /* Set the format of a file being written.  */
-  boolean  (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
-
-  /* Write cached information into a file being written, at <<bfd_close>>.  */
-  boolean  (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
-
-
-  /* Generic entry points.  */
-#define BFD_JUMP_TABLE_GENERIC(NAME) \
-CONCAT2 (NAME,_close_and_cleanup), \
-CONCAT2 (NAME,_bfd_free_cached_info), \
-CONCAT2 (NAME,_new_section_hook), \
-CONCAT2 (NAME,_get_section_contents), \
-CONCAT2 (NAME,_get_section_contents_in_window)
-
-  /* Called when the BFD is being closed to do any necessary cleanup.  */
-  boolean  (*_close_and_cleanup) PARAMS ((bfd *));
-  /* Ask the BFD to free all cached information.  */
-  boolean  (*_bfd_free_cached_info) PARAMS ((bfd *));
-  /* Called when a new section is created.  */
-  boolean  (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
-  /* Read the contents of a section.  */
-  boolean  (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
-                                                 file_ptr, bfd_size_type));
-  boolean  (*_bfd_get_section_contents_in_window)
-    PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
-
-  /* Entry points to copy private data.  */
-#define BFD_JUMP_TABLE_COPY(NAME) \
-CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
-CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
-CONCAT2 (NAME,_bfd_copy_private_section_data), \
-CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
-CONCAT2 (NAME,_bfd_set_private_flags), \
-CONCAT2 (NAME,_bfd_print_private_bfd_data) \
-  /* Called to copy BFD general private data from one object file
-     to another.  */
-  boolean  (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
-  /* Called to merge BFD general private data from one object file
-     to a common output file when linking.  */
-  boolean  (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
-  /* Called to copy BFD private section data from one object file
-     to another.  */
-  boolean  (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
-                                                      bfd *, sec_ptr));
-  /* Called to copy BFD private symbol data from one symbol
-     to another.  */
-  boolean  (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
-                                                     bfd *, asymbol *));
-  /* Called to set private backend flags.  */
-  boolean  (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
-
-  /* Called to print private BFD data.  */
-  boolean  (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
-
-  /* Core file entry points.  */
-#define BFD_JUMP_TABLE_CORE(NAME) \
-CONCAT2 (NAME,_core_file_failing_command), \
-CONCAT2 (NAME,_core_file_failing_signal), \
-CONCAT2 (NAME,_core_file_matches_executable_p)
-  char *   (*_core_file_failing_command) PARAMS ((bfd *));
-  int      (*_core_file_failing_signal) PARAMS ((bfd *));
-  boolean  (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
-
-  /* Archive entry points.  */
-#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
-CONCAT2 (NAME,_slurp_armap), \
-CONCAT2 (NAME,_slurp_extended_name_table), \
-CONCAT2 (NAME,_construct_extended_name_table), \
-CONCAT2 (NAME,_truncate_arname), \
-CONCAT2 (NAME,_write_armap), \
-CONCAT2 (NAME,_read_ar_hdr), \
-CONCAT2 (NAME,_openr_next_archived_file), \
-CONCAT2 (NAME,_get_elt_at_index), \
-CONCAT2 (NAME,_generic_stat_arch_elt), \
-CONCAT2 (NAME,_update_armap_timestamp)
-  boolean  (*_bfd_slurp_armap) PARAMS ((bfd *));
-  boolean  (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
-  boolean  (*_bfd_construct_extended_name_table)
-    PARAMS ((bfd *, char **, bfd_size_type *, const char **));
-  void     (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
-  boolean  (*write_armap)
-    PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-  PTR      (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
-  bfd *    (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
-#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
-  bfd *    (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
-  int      (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
-  boolean  (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
-
-  /* Entry points used for symbols.  */
-#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
-CONCAT2 (NAME,_get_symtab_upper_bound), \
-CONCAT2 (NAME,_get_symtab), \
-CONCAT2 (NAME,_make_empty_symbol), \
-CONCAT2 (NAME,_print_symbol), \
-CONCAT2 (NAME,_get_symbol_info), \
-CONCAT2 (NAME,_bfd_is_local_label_name), \
-CONCAT2 (NAME,_get_lineno), \
-CONCAT2 (NAME,_find_nearest_line), \
-CONCAT2 (NAME,_bfd_make_debug_symbol), \
-CONCAT2 (NAME,_read_minisymbols), \
-CONCAT2 (NAME,_minisymbol_to_symbol)
-  long     (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
-  long     (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
-                                                struct symbol_cache_entry **));
-  struct symbol_cache_entry *
-           (*_bfd_make_empty_symbol) PARAMS ((bfd *));
-  void     (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
-                                         struct symbol_cache_entry *,
-                                         bfd_print_symbol_type));
-#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
-  void     (*_bfd_get_symbol_info) PARAMS ((bfd *,
-                                            struct symbol_cache_entry *,
-                                            symbol_info *));
-#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
-  boolean  (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
-
-  alent *  (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
-  boolean  (*_bfd_find_nearest_line)
-    PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
-             const char **, const char **, unsigned int *));
- /* Back-door to allow format-aware applications to create debug symbols
-    while using BFD for everything else.  Currently used by the assembler
-    when creating COFF files.  */
-  asymbol *(*_bfd_make_debug_symbol) PARAMS ((bfd *, void *,
-                                              unsigned long size));
-#define bfd_read_minisymbols(b, d, m, s) \
-  BFD_SEND (b, _read_minisymbols, (b, d, m, s))
-  long     (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
-                                         unsigned int *));
-#define bfd_minisymbol_to_symbol(b, d, m, f) \
-  BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
-  asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
-                                             asymbol *));
-
-  /* Routines for relocs.  */
-#define BFD_JUMP_TABLE_RELOCS(NAME) \
-CONCAT2 (NAME,_get_reloc_upper_bound), \
-CONCAT2 (NAME,_canonicalize_reloc), \
-CONCAT2 (NAME,_bfd_reloc_type_lookup)
-  long     (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
-  long     (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
-                                               struct symbol_cache_entry **));
-  /* See documentation on reloc types.  */
-  reloc_howto_type *
-           (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-  /* Routines used when writing an object file.  */
-#define BFD_JUMP_TABLE_WRITE(NAME) \
-CONCAT2 (NAME,_set_arch_mach), \
-CONCAT2 (NAME,_set_section_contents)
-  boolean  (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
-                                          unsigned long));
-  boolean  (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
-                                                 file_ptr, bfd_size_type));
-
-  /* Routines used by the linker.  */
-#define BFD_JUMP_TABLE_LINK(NAME) \
-CONCAT2 (NAME,_sizeof_headers), \
-CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
-CONCAT2 (NAME,_bfd_relax_section), \
-CONCAT2 (NAME,_bfd_link_hash_table_create), \
-CONCAT2 (NAME,_bfd_link_hash_table_free), \
-CONCAT2 (NAME,_bfd_link_add_symbols), \
-CONCAT2 (NAME,_bfd_link_just_syms), \
-CONCAT2 (NAME,_bfd_final_link), \
-CONCAT2 (NAME,_bfd_link_split_section), \
-CONCAT2 (NAME,_bfd_gc_sections), \
-CONCAT2 (NAME,_bfd_merge_sections), \
-CONCAT2 (NAME,_bfd_discard_group)
-  int      (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
-  bfd_byte *(*_bfd_get_relocated_section_contents)
-    PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
-             bfd_byte *, boolean, struct symbol_cache_entry **));
-
-  boolean  (*_bfd_relax_section)
-    PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
-
-  /* Create a hash table for the linker.  Different backends store
-     different information in this table.  */
-  struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
-
-  /* Release the memory associated with the linker hash table.  */
-  void (*_bfd_link_hash_table_free) PARAMS ((struct bfd_link_hash_table *));
-
-  /* Add symbols from this object file into the hash table.  */
-  boolean  (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
-
-  /* Indicate that we are only retrieving symbol values from this section.  */
-  void     (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
-
-  /* Do a link based on the link_order structures attached to each
-     section of the BFD.  */
-  boolean  (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
-
-  /* Should this section be split up into smaller pieces during linking.  */
-  boolean  (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
-
-  /* Remove sections that are not referenced from the output.  */
-  boolean  (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
-
-  /* Attempt to merge SEC_MERGE sections.  */
-  boolean  (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
-
-  /* Discard members of a group.  */
-  boolean  (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
-
-  /* Routines to handle dynamic symbols and relocs.  */
-#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
-CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
-CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
-CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
-CONCAT2 (NAME,_canonicalize_dynamic_reloc)
-  /* Get the amount of memory required to hold the dynamic symbols.  */
-  long     (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
-  /* Read in the dynamic symbols.  */
-  long     (*_bfd_canonicalize_dynamic_symtab)
-    PARAMS ((bfd *, struct symbol_cache_entry **));
-  /* Get the amount of memory required to hold the dynamic relocs.  */
-  long     (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
-  /* Read in the dynamic relocs.  */
-  long     (*_bfd_canonicalize_dynamic_reloc)
-    PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
-
-  /* Opposite endian version of this target.  */
-  const struct bfd_target * alternative_target;
-
-  /* Data for use by back-end routines, which isn't
-     generic enough to belong in this structure.  */
-  PTR backend_data;
-
-} bfd_target;
-
-boolean
-bfd_set_default_target PARAMS ((const char *name));
-
-const bfd_target *
-bfd_find_target PARAMS ((const char *target_name, bfd *abfd));
-
-const char **
-bfd_target_list PARAMS ((void));
-
-const bfd_target *
-bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
-
-/* Extracted from format.c.  */
-boolean
-bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
-
-boolean
-bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
-
-boolean
-bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
-
-const char *
-bfd_format_string PARAMS ((bfd_format format));
-
-/* Extracted from linker.c.  */
-boolean
-bfd_link_split_section PARAMS ((bfd *abfd, asection *sec));
-
-#define bfd_link_split_section(abfd, sec) \
-       BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
-/* Extracted from simple.c.  */
-bfd_byte *
-bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf));
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/x86_64/defines.h b/x86_64/defines.h
deleted file mode 100644 (file)
index 59a96e5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* i386/defines.h **************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    system-dependent definitions
-
-    Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: defines.h 388 2003-07-10 16:49:05Z twisti $
-
-*******************************************************************************/
-
-#define USE_INTERNAL_THREADS
-
-#define HAVE_FCNTL
-#define HAVE_IOCTL
diff --git a/x86_64/dis-asm.h b/x86_64/dis-asm.h
deleted file mode 100644 (file)
index 2f3418e..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/* Interface between the opcode library and its callers.
-
-   Copyright 2001, 2002 Free Software Foundation, Inc.
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-   
-   Written by Cygnus Support, 1993.
-
-   The opcode library (libopcodes.a) provides instruction decoders for
-   a large variety of instruction sets, callable with an identical
-   interface, for making instruction-processing programs more independent
-   of the instruction set being processed.  */
-
-#ifndef DIS_ASM_H
-#define DIS_ASM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include "bfd.h"
-
-#include "types.h"
-#include "ansidecl.h"
-
-#define _(String) (String)
-
-typedef int (*fprintf_ftype) PARAMS((PTR, const char*, ...));
-
-enum dis_insn_type {
-  dis_noninsn,                 /* Not a valid instruction */
-  dis_nonbranch,               /* Not a branch instruction */
-  dis_branch,                  /* Unconditional branch */
-  dis_condbranch,              /* Conditional branch */
-  dis_jsr,                     /* Jump to subroutine */
-  dis_condjsr,                 /* Conditional jump to subroutine */
-  dis_dref,                    /* Data reference instruction */
-  dis_dref2                    /* Two data references in instruction */
-};
-
-/* This struct is passed into the instruction decoding routine, 
-   and is passed back out into each callback.  The various fields are used
-   for conveying information from your main routine into your callbacks,
-   for passing information into the instruction decoders (such as the
-   addresses of the callback functions), or for passing information
-   back from the instruction decoders to their callers.
-
-   It must be initialized before it is first passed; this can be done
-   by hand, or using one of the initialization macros below.  */
-
-typedef struct disassemble_info {
-  fprintf_ftype fprintf_func;
-  PTR stream;
-  PTR application_data;
-
-  /* Target description.  We could replace this with a pointer to the bfd,
-     but that would require one.  There currently isn't any such requirement
-     so to avoid introducing one we record these explicitly.  */
-  /* The bfd_flavour.  This can be bfd_target_unknown_flavour.  */
-  enum bfd_flavour flavour;
-  /* The bfd_arch value.  */
-  enum bfd_architecture arch;
-  /* The bfd_mach value.  */
-  unsigned long mach;
-  /* Endianness (for bi-endian cpus).  Mono-endian cpus can ignore this.  */
-  enum bfd_endian endian;
-  /* An arch/mach-specific bitmask of selected instruction subsets, mainly
-     for processors with run-time-switchable instruction sets.  The default,
-     zero, means that there is no constraint.  CGEN-based opcodes ports
-     may use ISA_foo masks.  */
-  unsigned long insn_sets;
-
-  /* Some targets need information about the current section to accurately
-     display insns.  If this is NULL, the target disassembler function
-     will have to make its best guess.  */
-  asection *section;
-
-  /* An array of pointers to symbols either at the location being disassembled
-     or at the start of the function being disassembled.  The array is sorted
-     so that the first symbol is intended to be the one used.  The others are
-     present for any misc. purposes.  This is not set reliably, but if it is
-     not NULL, it is correct.  */
-  asymbol **symbols;
-  /* Number of symbols in array.  */
-  int num_symbols;
-
-  /* For use by the disassembler.
-     The top 16 bits are reserved for public use (and are documented here).
-     The bottom 16 bits are for the internal use of the disassembler.  */
-  unsigned long flags;
-#define INSN_HAS_RELOC 0x80000000
-  PTR private_data;
-
-  /* Function used to get bytes to disassemble.  MEMADDR is the
-     address of the stuff to be disassembled, MYADDR is the address to
-     put the bytes in, and LENGTH is the number of bytes to read.
-     INFO is a pointer to this struct.
-     Returns an errno value or 0 for success.  */
-  int (*read_memory_func)
-    PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
-            struct disassemble_info *info));
-
-  /* Function which should be called if we get an error that we can't
-     recover from.  STATUS is the errno value from read_memory_func and
-     MEMADDR is the address that we were trying to read.  INFO is a
-     pointer to this struct.  */
-  void (*memory_error_func)
-    PARAMS ((int status, bfd_vma memaddr, struct disassemble_info *info));
-
-  /* Function called to print ADDR.  */
-  void (*print_address_func)
-    PARAMS ((bfd_vma addr, struct disassemble_info *info));
-
-  /* Function called to determine if there is a symbol at the given ADDR.
-     If there is, the function returns 1, otherwise it returns 0.
-     This is used by ports which support an overlay manager where
-     the overlay number is held in the top part of an address.  In
-     some circumstances we want to include the overlay number in the
-     address, (normally because there is a symbol associated with
-     that address), but sometimes we want to mask out the overlay bits.  */
-  int (* symbol_at_address_func)
-    PARAMS ((bfd_vma addr, struct disassemble_info * info));
-
-  /* These are for buffer_read_memory.  */
-  bfd_byte *buffer;
-  bfd_vma buffer_vma;
-  unsigned int buffer_length;
-
-  /* This variable may be set by the instruction decoder.  It suggests
-      the number of bytes objdump should display on a single line.  If
-      the instruction decoder sets this, it should always set it to
-      the same value in order to get reasonable looking output.  */
-  int bytes_per_line;
-
-  /* the next two variables control the way objdump displays the raw data */
-  /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */
-  /* output will look like this:
-     00:   00000000 00000000
-     with the chunks displayed according to "display_endian". */
-  int bytes_per_chunk;
-  enum bfd_endian display_endian;
-
-  /* Number of octets per incremented target address 
-     Normally one, but some DSPs have byte sizes of 16 or 32 bits.  */
-  unsigned int octets_per_byte;
-
-  /* Results from instruction decoders.  Not all decoders yet support
-     this information.  This info is set each time an instruction is
-     decoded, and is only valid for the last such instruction.
-
-     To determine whether this decoder supports this information, set
-     insn_info_valid to 0, decode an instruction, then check it.  */
-
-  char insn_info_valid;                /* Branch info has been set. */
-  char branch_delay_insns;     /* How many sequential insn's will run before
-                                  a branch takes effect.  (0 = normal) */
-  char data_size;              /* Size of data reference in insn, in bytes */
-  enum dis_insn_type insn_type;        /* Type of instruction */
-  bfd_vma target;              /* Target address of branch or dref, if known;
-                                  zero if unknown.  */
-  bfd_vma target2;             /* Second target address for dref2 */
-
-  /* Command line options specific to the target disassembler.  */
-  char * disassembler_options;
-
-} disassemble_info;
-
-\f
-/* Standard disassemblers.  Disassemble one instruction at the given
-   target address.  Return number of octets processed.  */
-typedef int (*disassembler_ftype)
-     PARAMS((bfd_vma, disassemble_info *));
-
-extern int print_insn_big_mips         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_mips      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i386             PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_i386_att         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i386_intel       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ia64             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i370             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68hc11          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68hc12          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_z8001            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_z8002            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300h           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300s           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8500            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_alpha            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_arm          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_arm       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sparc            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_a29k         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_a29k      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_avr              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_d10v             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_d30v             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_dlx              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_fr30             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_hppa             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i860             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i960             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ip2k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m32r             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m88k             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mcore            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mmix             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mn10200          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mn10300          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ns32k            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_openrisc         PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_or32          PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_or32       PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_pdp11            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_pj               PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_powerpc      PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_powerpc   PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_rs6000           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_s390              PARAMS ((bfd_vma, disassemble_info*)); 
-extern int print_insn_sh               PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic30            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic4x            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic54x           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic80            PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_v850             PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_vax              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_w65              PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_xstormy16                PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sh64             PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_sh64x_media      PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_frv              PARAMS ((bfd_vma, disassemble_info *));
-
-extern disassembler_ftype arc_get_disassembler PARAMS ((void *));
-extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *));
-
-extern void print_arm_disassembler_options PARAMS ((FILE *));
-extern void parse_arm_disassembler_option  PARAMS ((char *));
-extern int  get_arm_regname_num_options    PARAMS ((void));
-extern int  set_arm_regname_option         PARAMS ((int));
-extern int  get_arm_regnames               PARAMS ((int, const char **, const char **, const char ***));
-
-/* Fetch the disassembler for a given BFD, if that support is available.  */
-extern disassembler_ftype disassembler PARAMS ((bfd *));
-
-/* Document any target specific options available from the disassembler.  */
-extern void disassembler_usage          PARAMS ((FILE *));
-
-\f
-/* This block of definitions is for particular callers who read instructions
-   into a buffer before calling the instruction decoder.  */
-
-/* Here is a function which callers may wish to use for read_memory_func.
-   It gets bytes from a buffer.  */
-extern int buffer_read_memory
-  PARAMS ((bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *));
-
-/* This function goes with buffer_read_memory.
-   It prints a message using info->fprintf_func and info->stream.  */
-extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *));
-
-
-/* Just print the address in hex.  This is included for completeness even
-   though both GDB and objdump provide their own (to print symbolic
-   addresses).  */
-extern void generic_print_address
-  PARAMS ((bfd_vma, struct disassemble_info *));
-
-/* Always true.  */
-extern int generic_symbol_at_address
-  PARAMS ((bfd_vma, struct disassemble_info *));
-
-/* Macro to initialize a disassemble_info struct.  This should be called
-   by all applications creating such a struct.  */
-#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
-  (INFO).flavour = bfd_target_unknown_flavour, \
-  (INFO).arch = bfd_arch_unknown, \
-  (INFO).mach = 0, \
-  (INFO).insn_sets = 0, \
-  (INFO).endian = BFD_ENDIAN_UNKNOWN, \
-  (INFO).octets_per_byte = 1, \
-  INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC)
-
-/* Call this macro to initialize only the internal variables for the
-   disassembler.  Architecture dependent things such as byte order, or machine
-   variant are not touched by this macro.  This makes things much easier for
-   GDB which must initialize these things separately.  */
-
-#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
-  (INFO).fprintf_func = (fprintf_ftype)(FPRINTF_FUNC), \
-  (INFO).stream = (PTR)(STREAM), \
-  (INFO).section = NULL, \
-  (INFO).symbols = NULL, \
-  (INFO).num_symbols = 0, \
-  (INFO).private_data = NULL, \
-  (INFO).buffer = NULL, \
-  (INFO).buffer_vma = 0, \
-  (INFO).buffer_length = 0, \
-  (INFO).read_memory_func = buffer_read_memory, \
-  (INFO).memory_error_func = perror_memory, \
-  (INFO).print_address_func = generic_print_address, \
-  (INFO).symbol_at_address_func = generic_symbol_at_address, \
-  (INFO).flags = 0, \
-  (INFO).bytes_per_line = 0, \
-  (INFO).bytes_per_chunk = 0, \
-  (INFO).display_endian = BFD_ENDIAN_UNKNOWN, \
-  (INFO).disassembler_options = NULL, \
-  (INFO).insn_info_valid = 0
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* ! defined (DIS_ASM_H) */
diff --git a/x86_64/dis-buf.c b/x86_64/dis-buf.c
deleted file mode 100644 (file)
index de297b6..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Disassemble from a buffer, for GNU.
-   Copyright 1993, 1994, 1996, 1997, 1998, 1999, 2000
-   Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-/*  #include "sysdep.h" */
-#include "dis-asm.h"
-#include <errno.h>
-/*  #include "opintl.h" */
-
-/* Get LENGTH bytes from info's buffer, at target address memaddr.
-   Transfer them to myaddr.  */
-#if 0
-int
-buffer_read_memory (memaddr, myaddr, length, info)
-     bfd_vma memaddr;
-     bfd_byte *myaddr;
-     unsigned int length;
-     struct disassemble_info *info;
-{
-  unsigned int opb = info->octets_per_byte;
-  unsigned int end_addr_offset = length / opb;
-  unsigned int max_addr_offset = info->buffer_length / opb; 
-  unsigned int octets = (memaddr - info->buffer_vma) * opb;
-
-  printf("%d %d\n", memaddr, info->buffer_vma);
-  if (memaddr < info->buffer_vma
-      || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
-    /* Out of bounds.  Use EIO because GDB uses it.  */
-    return EIO;
-  memcpy (myaddr, info->buffer + octets, length);
-
-  return 0;
-}
-#endif
-
-/* Print an error message.  We can assume that this is in response to
-   an error return from buffer_read_memory.  */
-void
-perror_memory (status, memaddr, info)
-     int status;
-     bfd_vma memaddr;
-     struct disassemble_info *info;
-{
-  if (status != EIO)
-    /* Can't happen.  */
-    info->fprintf_func (info->stream, _("Unknown error %d\n"), status);
-  else
-    /* Actually, address between memaddr and memaddr + len was
-       out of bounds.  */
-    info->fprintf_func (info->stream,
-                       _("Address 0x%x is out of bounds.\n"), memaddr);
-}
-
-/* This could be in a separate file, to save miniscule amounts of space
-   in statically linked executables.  */
-
-/* Just print the address is hex.  This is included for completeness even
-   though both GDB and objdump provide their own (to print symbolic
-   addresses).  */
-
-void
-generic_print_address (addr, info)
-     bfd_vma addr;
-     struct disassemble_info *info;
-{
-  char buf[30];
-
-  sprintf_vma (buf, addr);
-  (*info->fprintf_func) (info->stream, "0x%s", buf);
-}
-
-#if 0
-/* Just concatenate the address as hex.  This is included for
-   completeness even though both GDB and objdump provide their own (to
-   print symbolic addresses).  */
-
-void generic_strcat_address PARAMS ((bfd_vma, char *, int));
-
-void
-generic_strcat_address (addr, buf, len)
-     bfd_vma addr;
-     char *buf;
-     int len;
-{
-  if (buf != (char *)NULL && len > 0)
-    {
-      char tmpBuf[30];
-
-      sprintf_vma (tmpBuf, addr);
-      if ((strlen (buf) + strlen (tmpBuf)) <= (unsigned int) len)
-       strcat (buf, tmpBuf);
-      else
-       strncat (buf, tmpBuf, (len - strlen(buf)));
-    }
-  return;
-}
-#endif
-
-/* Just return the given address.  */
-
-int
-generic_symbol_at_address (addr, info)
-     bfd_vma addr ATTRIBUTE_UNUSED;
-     struct disassemble_info *info ATTRIBUTE_UNUSED;
-{
-  return 1;
-}
diff --git a/x86_64/disass.c b/x86_64/disass.c
deleted file mode 100644 (file)
index 0ab613f..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/* x86_64/disass.c *************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Wrapper functions to call the disassembler from the GNU binutils.
-
-    Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-             Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-             Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: disass.c 518 2003-10-22 20:55:48Z twisti $
-
-*******************************************************************************/
-
-#include "dis-asm.h"
-
-static u1 *codestatic = 0;
-static int pstatic = 0;
-
-char mylinebuf[512];
-int mylen;
-
-
-static void myprintf(PTR p, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       mylen += vsprintf(mylinebuf + mylen, fmt, ap);
-       va_end(ap);
-}
-
-static int buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info)
-{
-       if (length == 1) {
-               *myaddr = *((u1 *) memaddr);
-
-       } else {
-               memcpy(myaddr, (void *) memaddr, length);
-       }
-
-       return 0;
-}
-
-
-/* name table for 16 integer registers */
-static char *regs[] = {
-       "rax",
-       "rcx",
-       "rdx",
-       "rbx",
-       "rsp",
-       "rbp",
-       "rsi",
-       "rdi",
-    "r8",
-    "r9",
-    "r10",
-    "r11",
-    "r12",
-    "r13",
-    "r14",
-    "r15"
-};
-
-
-/* function disassinstr ********************************************************
-
-       outputs a disassembler listing of one machine code instruction on 'stdout'
-       c:   instructions machine code
-       pos: instructions address relative to method start
-
-*******************************************************************************/
-
-static void disassinstr(u1 *code, int pos)
-{
-       static disassemble_info info;
-       static int dis_initialized;
-       int seqlen;
-       int i;
-
-       if (!dis_initialized) {
-               INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
-               info.mach = bfd_mach_x86_64;
-               dis_initialized = 1;
-       }
-
-       printf("0x%016lx:   ", (s8) code);
-       mylen = 0;
-       seqlen = print_insn_i386((bfd_vma) code, &info);
-
-       for (i = 0; i < seqlen; i++) {
-               printf("%02x ", *(code++));
-       }
-       
-       for (; i < 10; i++) {
-               printf("   ");
-       }
-
-       printf("   %s\n", mylinebuf);
-
-       codestatic = code - 1;
-       pstatic = pos + seqlen - 1;
-}
-
-
-/* function disassemble ********************************************************
-
-       outputs a disassembler listing of some machine code on 'stdout'
-       code: pointer to first instruction
-       len:  code size (number of instructions * 4)
-
-*******************************************************************************/
-
-static void disassemble(u1 *code, int len)
-{
-       int p;
-       int seqlen;
-       int i;
-       disassemble_info info;
-
-       INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
-       info.mach = bfd_mach_x86_64;
-
-       printf("  --- disassembler listing ---\n");
-       for (p = 0; p < len;) {
-               printf("0x%016lx:   ", (s8) code);
-               mylen = 0;
-
-               seqlen = print_insn_i386((bfd_vma) code, &info);
-               p += seqlen;
-
-               for (i = 0; i < seqlen; i++) {
-                       printf("%02x ", *(code++));
-               }
-
-               for (; i < 10; i++) {
-                       printf("   ");
-               }
-
-               printf("   %s\n", mylinebuf);
-       }
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/x86_64/i386-dis.c b/x86_64/i386-dis.c
deleted file mode 100644 (file)
index 453c57e..0000000
+++ /dev/null
@@ -1,4145 +0,0 @@
-/* Print i386 instructions for GDB, the GNU debugger.
-   Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2001
-   Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-/*
- * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
- * July 1988
- *  modified by John Hassey (hassey@dg-rtp.dg.com)
- *  x86-64 support added by Jan Hubicka (jh@suse.cz)
- */
-
-/*
- * The main tables describing the instructions is essentially a copy
- * of the "Opcode Map" chapter (Appendix A) of the Intel 80386
- * Programmers Manual.  Usually, there is a capital letter, followed
- * by a small letter.  The capital letter tell the addressing mode,
- * and the small letter tells about the operand size.  Refer to
- * the Intel manual for details.
- */
-
-#include "dis-asm.h"
-
-#define MAXLEN 20
-
-#include <setjmp.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifndef UNIXWARE_COMPAT
-/* Set non-zero for broken, compatible instructions.  Set to zero for
-   non-broken opcodes.  */
-#define UNIXWARE_COMPAT 1
-#endif
-
-static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *));
-static void ckprefix PARAMS ((void));
-static const char *prefix_name PARAMS ((int, int));
-static int print_insn PARAMS ((bfd_vma, disassemble_info *));
-static void dofloat PARAMS ((int));
-static void OP_ST PARAMS ((int, int));
-static void OP_STi  PARAMS ((int, int));
-static int putop PARAMS ((const char *, int));
-static void oappend PARAMS ((const char *));
-static void append_seg PARAMS ((void));
-static void OP_indirE PARAMS ((int, int));
-static void print_operand_value PARAMS ((char *, int, bfd_vma));
-static void OP_E PARAMS ((int, int));
-static void OP_G PARAMS ((int, int));
-static bfd_vma get64 PARAMS ((void));
-static bfd_signed_vma get32 PARAMS ((void));
-static bfd_signed_vma get32s PARAMS ((void));
-static int get16 PARAMS ((void));
-static void set_op PARAMS ((bfd_vma, int));
-static void OP_REG PARAMS ((int, int));
-static void OP_IMREG PARAMS ((int, int));
-static void OP_I PARAMS ((int, int));
-static void OP_I64 PARAMS ((int, int));
-static void OP_sI PARAMS ((int, int));
-static void OP_J PARAMS ((int, int));
-static void OP_SEG PARAMS ((int, int));
-static void OP_DIR PARAMS ((int, int));
-static void OP_OFF PARAMS ((int, int));
-static void OP_OFF64 PARAMS ((int, int));
-static void ptr_reg PARAMS ((int, int));
-static void OP_ESreg PARAMS ((int, int));
-static void OP_DSreg PARAMS ((int, int));
-static void OP_C PARAMS ((int, int));
-static void OP_D PARAMS ((int, int));
-static void OP_T PARAMS ((int, int));
-static void OP_Rd PARAMS ((int, int));
-static void OP_MMX PARAMS ((int, int));
-static void OP_XMM PARAMS ((int, int));
-static void OP_EM PARAMS ((int, int));
-static void OP_EX PARAMS ((int, int));
-static void OP_MS PARAMS ((int, int));
-static void OP_XS PARAMS ((int, int));
-static void OP_3DNowSuffix PARAMS ((int, int));
-static void OP_SIMD_Suffix PARAMS ((int, int));
-static void SIMD_Fixup PARAMS ((int, int));
-static void BadOp PARAMS ((void));
-
-struct dis_private {
-  /* Points to first byte not fetched.  */
-  bfd_byte *max_fetched;
-  bfd_byte the_buffer[MAXLEN];
-  bfd_vma insn_start;
-  int orig_sizeflag;
-  jmp_buf bailout;
-};
-
-/* The opcode for the fwait instruction, which we treat as a prefix
-   when we can.  */
-#define FWAIT_OPCODE (0x9b)
-
-/* Set to 1 for 64bit mode disassembly.  */
-static int mode_64bit;
-
-/* Flags for the prefixes for the current instruction.  See below.  */
-static int prefixes;
-
-/* REX prefix the current instruction.  See below.  */
-static int rex;
-/* Bits of REX we've already used.  */
-static int rex_used;
-#define REX_MODE64     8
-#define REX_EXTX       4
-#define REX_EXTY       2
-#define REX_EXTZ       1
-/* Mark parts used in the REX prefix.  When we are testing for
-   empty prefix (for 8bit register REX extension), just mask it
-   out.  Otherwise test for REX bit is excuse for existence of REX
-   only in case value is nonzero.  */
-#define USED_REX(value)                                        \
-  {                                                    \
-    if (value)                                         \
-      rex_used |= (rex & value) ? (value) | 0x40 : 0;  \
-    else                                               \
-      rex_used |= 0x40;                                        \
-  }
-
-/* Flags for prefixes which we somehow handled when printing the
-   current instruction.  */
-static int used_prefixes;
-
-/* Flags stored in PREFIXES.  */
-#define PREFIX_REPZ 1
-#define PREFIX_REPNZ 2
-#define PREFIX_LOCK 4
-#define PREFIX_CS 8
-#define PREFIX_SS 0x10
-#define PREFIX_DS 0x20
-#define PREFIX_ES 0x40
-#define PREFIX_FS 0x80
-#define PREFIX_GS 0x100
-#define PREFIX_DATA 0x200
-#define PREFIX_ADDR 0x400
-#define PREFIX_FWAIT 0x800
-
-/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
-   to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
-   on error.  */
-#define FETCH_DATA(info, addr) \
-  ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
-   ? 1 : fetch_data ((info), (addr)))
-
-static int
-fetch_data (info, addr)
-     struct disassemble_info *info;
-     bfd_byte *addr;
-{
-  int status;
-  struct dis_private *priv = (struct dis_private *) info->private_data;
-  bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer);
-
-  status = (*info->read_memory_func) (start,
-                                     priv->max_fetched,
-                                     addr - priv->max_fetched,
-                                     info);
-  if (status != 0)
-    {
-      /* If we did manage to read at least one byte, then
-         print_insn_i386 will do something sensible.  Otherwise, print
-         an error.  We do that here because this is where we know
-         STATUS.  */
-      if (priv->max_fetched == priv->the_buffer)
-       (*info->memory_error_func) (status, start, info);
-      longjmp (priv->bailout, 1);
-    }
-  else
-    priv->max_fetched = addr;
-  return 1;
-}
-
-#define XX NULL, 0
-
-#define Eb OP_E, b_mode
-#define Ev OP_E, v_mode
-#define Ed OP_E, d_mode
-#define indirEb OP_indirE, b_mode
-#define indirEv OP_indirE, v_mode
-#define Ew OP_E, w_mode
-#define Ma OP_E, v_mode
-#define M OP_E, 0              /* lea, lgdt, etc. */
-#define Mp OP_E, 0             /* 32 or 48 bit memory operand for LDS, LES etc */
-#define Gb OP_G, b_mode
-#define Gv OP_G, v_mode
-#define Gd OP_G, d_mode
-#define Gw OP_G, w_mode
-#define Rd OP_Rd, d_mode
-#define Rm OP_Rd, m_mode
-#define Ib OP_I, b_mode
-#define sIb OP_sI, b_mode      /* sign extened byte */
-#define Iv OP_I, v_mode
-#define Iq OP_I, q_mode
-#define Iv64 OP_I64, v_mode
-#define Iw OP_I, w_mode
-#define Jb OP_J, b_mode
-#define Jv OP_J, v_mode
-#define Cm OP_C, m_mode
-#define Dm OP_D, m_mode
-#define Td OP_T, d_mode
-
-#define RMeAX OP_REG, eAX_reg
-#define RMeBX OP_REG, eBX_reg
-#define RMeCX OP_REG, eCX_reg
-#define RMeDX OP_REG, eDX_reg
-#define RMeSP OP_REG, eSP_reg
-#define RMeBP OP_REG, eBP_reg
-#define RMeSI OP_REG, eSI_reg
-#define RMeDI OP_REG, eDI_reg
-#define RMrAX OP_REG, rAX_reg
-#define RMrBX OP_REG, rBX_reg
-#define RMrCX OP_REG, rCX_reg
-#define RMrDX OP_REG, rDX_reg
-#define RMrSP OP_REG, rSP_reg
-#define RMrBP OP_REG, rBP_reg
-#define RMrSI OP_REG, rSI_reg
-#define RMrDI OP_REG, rDI_reg
-#define RMAL OP_REG, al_reg
-#define RMAL OP_REG, al_reg
-#define RMCL OP_REG, cl_reg
-#define RMDL OP_REG, dl_reg
-#define RMBL OP_REG, bl_reg
-#define RMAH OP_REG, ah_reg
-#define RMCH OP_REG, ch_reg
-#define RMDH OP_REG, dh_reg
-#define RMBH OP_REG, bh_reg
-#define RMAX OP_REG, ax_reg
-#define RMDX OP_REG, dx_reg
-
-#define eAX OP_IMREG, eAX_reg
-#define eBX OP_IMREG, eBX_reg
-#define eCX OP_IMREG, eCX_reg
-#define eDX OP_IMREG, eDX_reg
-#define eSP OP_IMREG, eSP_reg
-#define eBP OP_IMREG, eBP_reg
-#define eSI OP_IMREG, eSI_reg
-#define eDI OP_IMREG, eDI_reg
-#define AL OP_IMREG, al_reg
-#define AL OP_IMREG, al_reg
-#define CL OP_IMREG, cl_reg
-#define DL OP_IMREG, dl_reg
-#define BL OP_IMREG, bl_reg
-#define AH OP_IMREG, ah_reg
-#define CH OP_IMREG, ch_reg
-#define DH OP_IMREG, dh_reg
-#define BH OP_IMREG, bh_reg
-#define AX OP_IMREG, ax_reg
-#define DX OP_IMREG, dx_reg
-#define indirDX OP_IMREG, indir_dx_reg
-
-#define Sw OP_SEG, w_mode
-#define Ap OP_DIR, 0
-#define Ob OP_OFF, b_mode
-#define Ob64 OP_OFF64, b_mode
-#define Ov OP_OFF, v_mode
-#define Ov64 OP_OFF64, v_mode
-#define Xb OP_DSreg, eSI_reg
-#define Xv OP_DSreg, eSI_reg
-#define Yb OP_ESreg, eDI_reg
-#define Yv OP_ESreg, eDI_reg
-#define DSBX OP_DSreg, eBX_reg
-
-#define es OP_REG, es_reg
-#define ss OP_REG, ss_reg
-#define cs OP_REG, cs_reg
-#define ds OP_REG, ds_reg
-#define fs OP_REG, fs_reg
-#define gs OP_REG, gs_reg
-
-#define MX OP_MMX, 0
-#define XM OP_XMM, 0
-#define EM OP_EM, v_mode
-#define EX OP_EX, v_mode
-#define MS OP_MS, v_mode
-#define XS OP_XS, v_mode
-#define None OP_E, 0
-#define OPSUF OP_3DNowSuffix, 0
-#define OPSIMD OP_SIMD_Suffix, 0
-
-#define cond_jump_flag NULL, cond_jump_mode
-#define loop_jcxz_flag NULL, loop_jcxz_mode
-
-/* bits in sizeflag */
-#define SUFFIX_ALWAYS 4
-#define AFLAG 2
-#define DFLAG 1
-
-#define b_mode 1  /* byte operand */
-#define v_mode 2  /* operand size depends on prefixes */
-#define w_mode 3  /* word operand */
-#define d_mode 4  /* double word operand  */
-#define q_mode 5  /* quad word operand */
-#define x_mode 6
-#define m_mode 7  /* d_mode in 32bit, q_mode in 64bit mode.  */
-#define cond_jump_mode 8
-#define loop_jcxz_mode 9
-
-#define es_reg 100
-#define cs_reg 101
-#define ss_reg 102
-#define ds_reg 103
-#define fs_reg 104
-#define gs_reg 105
-
-#define eAX_reg 108
-#define eCX_reg 109
-#define eDX_reg 110
-#define eBX_reg 111
-#define eSP_reg 112
-#define eBP_reg 113
-#define eSI_reg 114
-#define eDI_reg 115
-
-#define al_reg 116
-#define cl_reg 117
-#define dl_reg 118
-#define bl_reg 119
-#define ah_reg 120
-#define ch_reg 121
-#define dh_reg 122
-#define bh_reg 123
-
-#define ax_reg 124
-#define cx_reg 125
-#define dx_reg 126
-#define bx_reg 127
-#define sp_reg 128
-#define bp_reg 129
-#define si_reg 130
-#define di_reg 131
-
-#define rAX_reg 132
-#define rCX_reg 133
-#define rDX_reg 134
-#define rBX_reg 135
-#define rSP_reg 136
-#define rBP_reg 137
-#define rSI_reg 138
-#define rDI_reg 139
-
-#define indir_dx_reg 150
-
-#define FLOATCODE 1
-#define USE_GROUPS 2
-#define USE_PREFIX_USER_TABLE 3
-#define X86_64_SPECIAL 4
-
-#define FLOAT    NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
-
-#define GRP1b    NULL, NULL, USE_GROUPS, NULL,  0, NULL, 0
-#define GRP1S    NULL, NULL, USE_GROUPS, NULL,  1, NULL, 0
-#define GRP1Ss   NULL, NULL, USE_GROUPS, NULL,  2, NULL, 0
-#define GRP2b    NULL, NULL, USE_GROUPS, NULL,  3, NULL, 0
-#define GRP2S    NULL, NULL, USE_GROUPS, NULL,  4, NULL, 0
-#define GRP2b_one NULL, NULL, USE_GROUPS, NULL,  5, NULL, 0
-#define GRP2S_one NULL, NULL, USE_GROUPS, NULL,  6, NULL, 0
-#define GRP2b_cl  NULL, NULL, USE_GROUPS, NULL,  7, NULL, 0
-#define GRP2S_cl  NULL, NULL, USE_GROUPS, NULL,  8, NULL, 0
-#define GRP3b    NULL, NULL, USE_GROUPS, NULL,  9, NULL, 0
-#define GRP3S    NULL, NULL, USE_GROUPS, NULL, 10, NULL, 0
-#define GRP4     NULL, NULL, USE_GROUPS, NULL, 11, NULL, 0
-#define GRP5     NULL, NULL, USE_GROUPS, NULL, 12, NULL, 0
-#define GRP6     NULL, NULL, USE_GROUPS, NULL, 13, NULL, 0
-#define GRP7     NULL, NULL, USE_GROUPS, NULL, 14, NULL, 0
-#define GRP8     NULL, NULL, USE_GROUPS, NULL, 15, NULL, 0
-#define GRP9     NULL, NULL, USE_GROUPS, NULL, 16, NULL, 0
-#define GRP10    NULL, NULL, USE_GROUPS, NULL, 17, NULL, 0
-#define GRP11    NULL, NULL, USE_GROUPS, NULL, 18, NULL, 0
-#define GRP12    NULL, NULL, USE_GROUPS, NULL, 19, NULL, 0
-#define GRP13    NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0
-#define GRP14    NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0
-#define GRPAMD   NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0
-
-#define PREGRP0   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  0, NULL, 0
-#define PREGRP1   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  1, NULL, 0
-#define PREGRP2   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  2, NULL, 0
-#define PREGRP3   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  3, NULL, 0
-#define PREGRP4   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  4, NULL, 0
-#define PREGRP5   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  5, NULL, 0
-#define PREGRP6   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  6, NULL, 0
-#define PREGRP7   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  7, NULL, 0
-#define PREGRP8   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  8, NULL, 0
-#define PREGRP9   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  9, NULL, 0
-#define PREGRP10  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 10, NULL, 0
-#define PREGRP11  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 11, NULL, 0
-#define PREGRP12  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 12, NULL, 0
-#define PREGRP13  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 13, NULL, 0
-#define PREGRP14  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 14, NULL, 0
-#define PREGRP15  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 15, NULL, 0
-#define PREGRP16  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 16, NULL, 0
-#define PREGRP17  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 17, NULL, 0
-#define PREGRP18  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 18, NULL, 0
-#define PREGRP19  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 19, NULL, 0
-#define PREGRP20  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 20, NULL, 0
-#define PREGRP21  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 21, NULL, 0
-#define PREGRP22  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 22, NULL, 0
-#define PREGRP23  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 23, NULL, 0
-#define PREGRP24  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 24, NULL, 0
-#define PREGRP25  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 25, NULL, 0
-#define PREGRP26  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 26, NULL, 0
-
-#define X86_64_0  NULL, NULL, X86_64_SPECIAL, NULL,  0, NULL, 0
-
-typedef void (*op_rtn) PARAMS ((int bytemode, int sizeflag));
-
-struct dis386 {
-  const char *name;
-  op_rtn op1;
-  int bytemode1;
-  op_rtn op2;
-  int bytemode2;
-  op_rtn op3;
-  int bytemode3;
-};
-
-/* Upper case letters in the instruction names here are macros.
-   'A' => print 'b' if no register operands or suffix_always is true
-   'B' => print 'b' if suffix_always is true
-   'E' => print 'e' if 32-bit form of jcxz
-   'F' => print 'w' or 'l' depending on address size prefix (loop insns)
-   'H' => print ",pt" or ",pn" branch hint
-   'L' => print 'l' if suffix_always is true
-   'N' => print 'n' if instruction has no wait "prefix"
-   'O' => print 'd', or 'o'
-   'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
-   .      or suffix_always is true.  print 'q' if rex prefix is present.
-   'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always
-   .      is true
-   'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode)
-   'S' => print 'w', 'l' or 'q' if suffix_always is true
-   'T' => print 'q' in 64bit mode and behave as 'P' otherwise
-   'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
-   'X' => print 's', 'd' depending on data16 prefix (for XMM)
-   'W' => print 'b' or 'w' ("w" or "de" in intel mode)
-   'Y' => 'q' if instruction has an REX 64bit overwrite prefix
-
-   Many of the above letters print nothing in Intel mode.  See "putop"
-   for the details.
-
-   Braces '{' and '}', and vertical bars '|', indicate alternative
-   mnemonic strings for AT&T, Intel, X86_64 AT&T, and X86_64 Intel
-   modes.  In cases where there are only two alternatives, the X86_64
-   instruction is reserved, and "(bad)" is printed.
-*/
-
-static const struct dis386 dis386[] = {
-  /* 00 */
-  { "addB",            Eb, Gb, XX },
-  { "addS",            Ev, Gv, XX },
-  { "addB",            Gb, Eb, XX },
-  { "addS",            Gv, Ev, XX },
-  { "addB",            AL, Ib, XX },
-  { "addS",            eAX, Iv, XX },
-  { "push{T|}",                es, XX, XX },
-  { "pop{T|}",         es, XX, XX },
-  /* 08 */
-  { "orB",             Eb, Gb, XX },
-  { "orS",             Ev, Gv, XX },
-  { "orB",             Gb, Eb, XX },
-  { "orS",             Gv, Ev, XX },
-  { "orB",             AL, Ib, XX },
-  { "orS",             eAX, Iv, XX },
-  { "push{T|}",                cs, XX, XX },
-  { "(bad)",           XX, XX, XX },   /* 0x0f extended opcode escape */
-  /* 10 */
-  { "adcB",            Eb, Gb, XX },
-  { "adcS",            Ev, Gv, XX },
-  { "adcB",            Gb, Eb, XX },
-  { "adcS",            Gv, Ev, XX },
-  { "adcB",            AL, Ib, XX },
-  { "adcS",            eAX, Iv, XX },
-  { "push{T|}",                ss, XX, XX },
-  { "popT|}",          ss, XX, XX },
-  /* 18 */
-  { "sbbB",            Eb, Gb, XX },
-  { "sbbS",            Ev, Gv, XX },
-  { "sbbB",            Gb, Eb, XX },
-  { "sbbS",            Gv, Ev, XX },
-  { "sbbB",            AL, Ib, XX },
-  { "sbbS",            eAX, Iv, XX },
-  { "push{T|}",                ds, XX, XX },
-  { "pop{T|}",         ds, XX, XX },
-  /* 20 */
-  { "andB",            Eb, Gb, XX },
-  { "andS",            Ev, Gv, XX },
-  { "andB",            Gb, Eb, XX },
-  { "andS",            Gv, Ev, XX },
-  { "andB",            AL, Ib, XX },
-  { "andS",            eAX, Iv, XX },
-  { "(bad)",           XX, XX, XX },   /* SEG ES prefix */
-  { "daa{|}",          XX, XX, XX },
-  /* 28 */
-  { "subB",            Eb, Gb, XX },
-  { "subS",            Ev, Gv, XX },
-  { "subB",            Gb, Eb, XX },
-  { "subS",            Gv, Ev, XX },
-  { "subB",            AL, Ib, XX },
-  { "subS",            eAX, Iv, XX },
-  { "(bad)",           XX, XX, XX },   /* SEG CS prefix */
-  { "das{|}",          XX, XX, XX },
-  /* 30 */
-  { "xorB",            Eb, Gb, XX },
-  { "xorS",            Ev, Gv, XX },
-  { "xorB",            Gb, Eb, XX },
-  { "xorS",            Gv, Ev, XX },
-  { "xorB",            AL, Ib, XX },
-  { "xorS",            eAX, Iv, XX },
-  { "(bad)",           XX, XX, XX },   /* SEG SS prefix */
-  { "aaa{|}",          XX, XX, XX },
-  /* 38 */
-  { "cmpB",            Eb, Gb, XX },
-  { "cmpS",            Ev, Gv, XX },
-  { "cmpB",            Gb, Eb, XX },
-  { "cmpS",            Gv, Ev, XX },
-  { "cmpB",            AL, Ib, XX },
-  { "cmpS",            eAX, Iv, XX },
-  { "(bad)",           XX, XX, XX },   /* SEG DS prefix */
-  { "aas{|}",          XX, XX, XX },
-  /* 40 */
-  { "inc{S|}",         RMeAX, XX, XX },
-  { "inc{S|}",         RMeCX, XX, XX },
-  { "inc{S|}",         RMeDX, XX, XX },
-  { "inc{S|}",         RMeBX, XX, XX },
-  { "inc{S|}",         RMeSP, XX, XX },
-  { "inc{S|}",         RMeBP, XX, XX },
-  { "inc{S|}",         RMeSI, XX, XX },
-  { "inc{S|}",         RMeDI, XX, XX },
-  /* 48 */
-  { "dec{S|}",         RMeAX, XX, XX },
-  { "dec{S|}",         RMeCX, XX, XX },
-  { "dec{S|}",         RMeDX, XX, XX },
-  { "dec{S|}",         RMeBX, XX, XX },
-  { "dec{S|}",         RMeSP, XX, XX },
-  { "dec{S|}",         RMeBP, XX, XX },
-  { "dec{S|}",         RMeSI, XX, XX },
-  { "dec{S|}",         RMeDI, XX, XX },
-  /* 50 */
-  { "pushS",           RMrAX, XX, XX },
-  { "pushS",           RMrCX, XX, XX },
-  { "pushS",           RMrDX, XX, XX },
-  { "pushS",           RMrBX, XX, XX },
-  { "pushS",           RMrSP, XX, XX },
-  { "pushS",           RMrBP, XX, XX },
-  { "pushS",           RMrSI, XX, XX },
-  { "pushS",           RMrDI, XX, XX },
-  /* 58 */
-  { "popS",            RMrAX, XX, XX },
-  { "popS",            RMrCX, XX, XX },
-  { "popS",            RMrDX, XX, XX },
-  { "popS",            RMrBX, XX, XX },
-  { "popS",            RMrSP, XX, XX },
-  { "popS",            RMrBP, XX, XX },
-  { "popS",            RMrSI, XX, XX },
-  { "popS",            RMrDI, XX, XX },
-  /* 60 */
-  { "pusha{P|}",       XX, XX, XX },
-  { "popa{P|}",                XX, XX, XX },
-  { "bound{S|}",       Gv, Ma, XX },
-  { X86_64_0 },
-  { "(bad)",           XX, XX, XX },   /* seg fs */
-  { "(bad)",           XX, XX, XX },   /* seg gs */
-  { "(bad)",           XX, XX, XX },   /* op size prefix */
-  { "(bad)",           XX, XX, XX },   /* adr size prefix */
-  /* 68 */
-  { "pushT",           Iq, XX, XX },
-  { "imulS",           Gv, Ev, Iv },
-  { "pushT",           sIb, XX, XX },
-  { "imulS",           Gv, Ev, sIb },
-  { "ins{b||b|}",      Yb, indirDX, XX },
-  { "ins{R||R|}",      Yv, indirDX, XX },
-  { "outs{b||b|}",     indirDX, Xb, XX },
-  { "outs{R||R|}",     indirDX, Xv, XX },
-  /* 70 */
-  { "joH",             Jb, XX, cond_jump_flag },
-  { "jnoH",            Jb, XX, cond_jump_flag },
-  { "jbH",             Jb, XX, cond_jump_flag },
-  { "jaeH",            Jb, XX, cond_jump_flag },
-  { "jeH",             Jb, XX, cond_jump_flag },
-  { "jneH",            Jb, XX, cond_jump_flag },
-  { "jbeH",            Jb, XX, cond_jump_flag },
-  { "jaH",             Jb, XX, cond_jump_flag },
-  /* 78 */
-  { "jsH",             Jb, XX, cond_jump_flag },
-  { "jnsH",            Jb, XX, cond_jump_flag },
-  { "jpH",             Jb, XX, cond_jump_flag },
-  { "jnpH",            Jb, XX, cond_jump_flag },
-  { "jlH",             Jb, XX, cond_jump_flag },
-  { "jgeH",            Jb, XX, cond_jump_flag },
-  { "jleH",            Jb, XX, cond_jump_flag },
-  { "jgH",             Jb, XX, cond_jump_flag },
-  /* 80 */
-  { GRP1b },
-  { GRP1S },
-  { "(bad)",           XX, XX, XX },
-  { GRP1Ss },
-  { "testB",           Eb, Gb, XX },
-  { "testS",           Ev, Gv, XX },
-  { "xchgB",           Eb, Gb, XX },
-  { "xchgS",           Ev, Gv, XX },
-  /* 88 */
-  { "movB",            Eb, Gb, XX },
-  { "movS",            Ev, Gv, XX },
-  { "movB",            Gb, Eb, XX },
-  { "movS",            Gv, Ev, XX },
-  { "movQ",            Ev, Sw, XX },
-  { "leaS",            Gv, M, XX },
-  { "movQ",            Sw, Ev, XX },
-  { "popU",            Ev, XX, XX },
-  /* 90 */
-  { "nop",             XX, XX, XX },
-  /* FIXME: NOP with REPz prefix is called PAUSE.  */
-  { "xchgS",           RMeCX, eAX, XX },
-  { "xchgS",           RMeDX, eAX, XX },
-  { "xchgS",           RMeBX, eAX, XX },
-  { "xchgS",           RMeSP, eAX, XX },
-  { "xchgS",           RMeBP, eAX, XX },
-  { "xchgS",           RMeSI, eAX, XX },
-  { "xchgS",           RMeDI, eAX, XX },
-  /* 98 */
-  { "cW{tR||tR|}",     XX, XX, XX },
-  { "cR{tO||tO|}",     XX, XX, XX },
-  { "lcall{T|}",       Ap, XX, XX },
-  { "(bad)",           XX, XX, XX },   /* fwait */
-  { "pushfT",          XX, XX, XX },
-  { "popfT",           XX, XX, XX },
-  { "sahf{|}",         XX, XX, XX },
-  { "lahf{|}",         XX, XX, XX },
-  /* a0 */
-  { "movB",            AL, Ob64, XX },
-  { "movS",            eAX, Ov64, XX },
-  { "movB",            Ob64, AL, XX },
-  { "movS",            Ov64, eAX, XX },
-  { "movs{b||b|}",     Yb, Xb, XX },
-  { "movs{R||R|}",     Yv, Xv, XX },
-  { "cmps{b||b|}",     Xb, Yb, XX },
-  { "cmps{R||R|}",     Xv, Yv, XX },
-  /* a8 */
-  { "testB",           AL, Ib, XX },
-  { "testS",           eAX, Iv, XX },
-  { "stosB",           Yb, AL, XX },
-  { "stosS",           Yv, eAX, XX },
-  { "lodsB",           AL, Xb, XX },
-  { "lodsS",           eAX, Xv, XX },
-  { "scasB",           AL, Yb, XX },
-  { "scasS",           eAX, Yv, XX },
-  /* b0 */
-  { "movB",            RMAL, Ib, XX },
-  { "movB",            RMCL, Ib, XX },
-  { "movB",            RMDL, Ib, XX },
-  { "movB",            RMBL, Ib, XX },
-  { "movB",            RMAH, Ib, XX },
-  { "movB",            RMCH, Ib, XX },
-  { "movB",            RMDH, Ib, XX },
-  { "movB",            RMBH, Ib, XX },
-  /* b8 */
-  { "movS",            RMeAX, Iv64, XX },
-  { "movS",            RMeCX, Iv64, XX },
-  { "movS",            RMeDX, Iv64, XX },
-  { "movS",            RMeBX, Iv64, XX },
-  { "movS",            RMeSP, Iv64, XX },
-  { "movS",            RMeBP, Iv64, XX },
-  { "movS",            RMeSI, Iv64, XX },
-  { "movS",            RMeDI, Iv64, XX },
-  /* c0 */
-  { GRP2b },
-  { GRP2S },
-  { "retT",            Iw, XX, XX },
-  { "retT",            XX, XX, XX },
-  { "les{S|}",         Gv, Mp, XX },
-  { "ldsS",            Gv, Mp, XX },
-  { "movA",            Eb, Ib, XX },
-  { "movQ",            Ev, Iv, XX },
-  /* c8 */
-  { "enterT",          Iw, Ib, XX },
-  { "leaveT",          XX, XX, XX },
-  { "lretP",           Iw, XX, XX },
-  { "lretP",           XX, XX, XX },
-  { "int3",            XX, XX, XX },
-  { "int",             Ib, XX, XX },
-  { "into{|}",         XX, XX, XX },
-  { "iretP",           XX, XX, XX },
-  /* d0 */
-  { GRP2b_one },
-  { GRP2S_one },
-  { GRP2b_cl },
-  { GRP2S_cl },
-  { "aam{|}",          sIb, XX, XX },
-  { "aad{|}",          sIb, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "xlat",            DSBX, XX, XX },
-  /* d8 */
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  { FLOAT },
-  /* e0 */
-  { "loopneFH",                Jb, XX, loop_jcxz_flag },
-  { "loopeFH",         Jb, XX, loop_jcxz_flag },
-  { "loopFH",          Jb, XX, loop_jcxz_flag },
-  { "jEcxzH",          Jb, XX, loop_jcxz_flag },
-  { "inB",             AL, Ib, XX },
-  { "inS",             eAX, Ib, XX },
-  { "outB",            Ib, AL, XX },
-  { "outS",            Ib, eAX, XX },
-  /* e8 */
-  { "callT",           Jv, XX, XX },
-  { "jmpT",            Jv, XX, XX },
-  { "ljmp{T|}",                Ap, XX, XX },
-  { "jmp",             Jb, XX, XX },
-  { "inB",             AL, indirDX, XX },
-  { "inS",             eAX, indirDX, XX },
-  { "outB",            indirDX, AL, XX },
-  { "outS",            indirDX, eAX, XX },
-  /* f0 */
-  { "(bad)",           XX, XX, XX },   /* lock prefix */
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },   /* repne */
-  { "(bad)",           XX, XX, XX },   /* repz */
-  { "hlt",             XX, XX, XX },
-  { "cmc",             XX, XX, XX },
-  { GRP3b },
-  { GRP3S },
-  /* f8 */
-  { "clc",             XX, XX, XX },
-  { "stc",             XX, XX, XX },
-  { "cli",             XX, XX, XX },
-  { "sti",             XX, XX, XX },
-  { "cld",             XX, XX, XX },
-  { "std",             XX, XX, XX },
-  { GRP4 },
-  { GRP5 },
-};
-
-static const struct dis386 dis386_twobyte[] = {
-  /* 00 */
-  { GRP6 },
-  { GRP7 },
-  { "larS",            Gv, Ew, XX },
-  { "lslS",            Gv, Ew, XX },
-  { "(bad)",           XX, XX, XX },
-  { "syscall",         XX, XX, XX },
-  { "clts",            XX, XX, XX },
-  { "sysretP",         XX, XX, XX },
-  /* 08 */
-  { "invd",            XX, XX, XX },
-  { "wbinvd",          XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "ud2a",            XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { GRPAMD },
-  { "femms",           XX, XX, XX },
-  { "",                        MX, EM, OPSUF }, /* See OP_3DNowSuffix.  */
-  /* 10 */
-  { PREGRP8 },
-  { PREGRP9 },
-  { "movlpX",          XM, EX, SIMD_Fixup, 'h' }, /* really only 2 operands */
-  { "movlpX",          EX, XM, SIMD_Fixup, 'h' },
-  { "unpcklpX",                XM, EX, XX },
-  { "unpckhpX",                XM, EX, XX },
-  { "movhpX",          XM, EX, SIMD_Fixup, 'l' },
-  { "movhpX",          EX, XM, SIMD_Fixup, 'l' },
-  /* 18 */
-  { GRP14 },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  /* 20 */
-  { "movL",            Rm, Cm, XX },
-  { "movL",            Rm, Dm, XX },
-  { "movL",            Cm, Rm, XX },
-  { "movL",            Dm, Rm, XX },
-  { "movL",            Rd, Td, XX },
-  { "(bad)",           XX, XX, XX },
-  { "movL",            Td, Rd, XX },
-  { "(bad)",           XX, XX, XX },
-  /* 28 */
-  { "movapX",          XM, EX, XX },
-  { "movapX",          EX, XM, XX },
-  { PREGRP2 },
-  { "movntpX",         Ev, XM, XX },
-  { PREGRP4 },
-  { PREGRP3 },
-  { "ucomisX",         XM,EX, XX },
-  { "comisX",          XM,EX, XX },
-  /* 30 */
-  { "wrmsr",           XX, XX, XX },
-  { "rdtsc",           XX, XX, XX },
-  { "rdmsr",           XX, XX, XX },
-  { "rdpmc",           XX, XX, XX },
-  { "sysenter",                XX, XX, XX },
-  { "sysexit",         XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  /* 38 */
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  /* 40 */
-  { "cmovo",           Gv, Ev, XX },
-  { "cmovno",          Gv, Ev, XX },
-  { "cmovb",           Gv, Ev, XX },
-  { "cmovae",          Gv, Ev, XX },
-  { "cmove",           Gv, Ev, XX },
-  { "cmovne",          Gv, Ev, XX },
-  { "cmovbe",          Gv, Ev, XX },
-  { "cmova",           Gv, Ev, XX },
-  /* 48 */
-  { "cmovs",           Gv, Ev, XX },
-  { "cmovns",          Gv, Ev, XX },
-  { "cmovp",           Gv, Ev, XX },
-  { "cmovnp",          Gv, Ev, XX },
-  { "cmovl",           Gv, Ev, XX },
-  { "cmovge",          Gv, Ev, XX },
-  { "cmovle",          Gv, Ev, XX },
-  { "cmovg",           Gv, Ev, XX },
-  /* 50 */
-  { "movmskpX",                Gd, XS, XX },
-  { PREGRP13 },
-  { PREGRP12 },
-  { PREGRP11 },
-  { "andpX",           XM, EX, XX },
-  { "andnpX",          XM, EX, XX },
-  { "orpX",            XM, EX, XX },
-  { "xorpX",           XM, EX, XX },
-  /* 58 */
-  { PREGRP0 },
-  { PREGRP10 },
-  { PREGRP17 },
-  { PREGRP16 },
-  { PREGRP14 },
-  { PREGRP7 },
-  { PREGRP5 },
-  { PREGRP6 },
-  /* 60 */
-  { "punpcklbw",       MX, EM, XX },
-  { "punpcklwd",       MX, EM, XX },
-  { "punpckldq",       MX, EM, XX },
-  { "packsswb",                MX, EM, XX },
-  { "pcmpgtb",         MX, EM, XX },
-  { "pcmpgtw",         MX, EM, XX },
-  { "pcmpgtd",         MX, EM, XX },
-  { "packuswb",                MX, EM, XX },
-  /* 68 */
-  { "punpckhbw",       MX, EM, XX },
-  { "punpckhwd",       MX, EM, XX },
-  { "punpckhdq",       MX, EM, XX },
-  { "packssdw",                MX, EM, XX },
-  { PREGRP26 },
-  { PREGRP24 },
-  { "movd",            MX, Ed, XX },
-  { PREGRP19 },
-  /* 70 */
-  { PREGRP22 },
-  { GRP10 },
-  { GRP11 },
-  { GRP12 },
-  { "pcmpeqb",         MX, EM, XX },
-  { "pcmpeqw",         MX, EM, XX },
-  { "pcmpeqd",         MX, EM, XX },
-  { "emms",            XX, XX, XX },
-  /* 78 */
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  { PREGRP23 },
-  { PREGRP20 },
-  /* 80 */
-  { "joH",             Jv, XX, cond_jump_flag },
-  { "jnoH",            Jv, XX, cond_jump_flag },
-  { "jbH",             Jv, XX, cond_jump_flag },
-  { "jaeH",            Jv, XX, cond_jump_flag },
-  { "jeH",             Jv, XX, cond_jump_flag },
-  { "jneH",            Jv, XX, cond_jump_flag },
-  { "jbeH",            Jv, XX, cond_jump_flag },
-  { "jaH",             Jv, XX, cond_jump_flag },
-  /* 88 */
-  { "jsH",             Jv, XX, cond_jump_flag },
-  { "jnsH",            Jv, XX, cond_jump_flag },
-  { "jpH",             Jv, XX, cond_jump_flag },
-  { "jnpH",            Jv, XX, cond_jump_flag },
-  { "jlH",             Jv, XX, cond_jump_flag },
-  { "jgeH",            Jv, XX, cond_jump_flag },
-  { "jleH",            Jv, XX, cond_jump_flag },
-  { "jgH",             Jv, XX, cond_jump_flag },
-  /* 90 */
-  { "seto",            Eb, XX, XX },
-  { "setno",           Eb, XX, XX },
-  { "setb",            Eb, XX, XX },
-  { "setae",           Eb, XX, XX },
-  { "sete",            Eb, XX, XX },
-  { "setne",           Eb, XX, XX },
-  { "setbe",           Eb, XX, XX },
-  { "seta",            Eb, XX, XX },
-  /* 98 */
-  { "sets",            Eb, XX, XX },
-  { "setns",           Eb, XX, XX },
-  { "setp",            Eb, XX, XX },
-  { "setnp",           Eb, XX, XX },
-  { "setl",            Eb, XX, XX },
-  { "setge",           Eb, XX, XX },
-  { "setle",           Eb, XX, XX },
-  { "setg",            Eb, XX, XX },
-  /* a0 */
-  { "pushT",           fs, XX, XX },
-  { "popT",            fs, XX, XX },
-  { "cpuid",           XX, XX, XX },
-  { "btS",             Ev, Gv, XX },
-  { "shldS",           Ev, Gv, Ib },
-  { "shldS",           Ev, Gv, CL },
-  { "(bad)",           XX, XX, XX },
-  { "(bad)",           XX, XX, XX },
-  /* a8 */
-  { "pushT",           gs, XX, XX },
-  { "popT",            gs, XX, XX },
-  { "rsm",             XX, XX, XX },
-  { "btsS",            Ev, Gv, XX },
-  { "shrdS",           Ev, Gv, Ib },
-  { "shrdS",           Ev, Gv, CL },
-  { GRP13 },
-  { "imulS",           Gv, Ev, XX },
-  /* b0 */
-  { "cmpxchgB",                Eb, Gb, XX },
-  { "cmpxchgS",                Ev, Gv, XX },
-  { "lssS",            Gv, Mp, XX },
-  { "btrS",            Ev, Gv, XX },
-  { "lfsS",            Gv, Mp, XX },
-  { "lgsS",            Gv, Mp, XX },
-  { "movz{bR|x|bR|x}", Gv, Eb, XX },
-  { "movz{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movzww ! */
-  /* b8 */
-  { "(bad)",           XX, XX, XX },
-  { "ud2b",            XX, XX, XX },
-  { GRP8 },
-  { "btcS",            Ev, Gv, XX },
-  { "bsfS",            Gv, Ev, XX },
-  { "bsrS",            Gv, Ev, XX },
-  { "movs{bR|x|bR|x}", Gv, Eb, XX },
-  { "movs{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movsww ! */
-  /* c0 */
-  { "xaddB",           Eb, Gb, XX },
-  { "xaddS",           Ev, Gv, XX },
-  { PREGRP1 },
-  { "movntiS",         Ev, Gv, XX },
-  { "pinsrw",          MX, Ed, Ib },
-  { "pextrw",          Gd, MS, Ib },
-  { "shufpX",          XM, EX, Ib },
-  { GRP9 },
-  /* c8 */
-  { "bswap",           RMeAX, XX, XX },
-  { "bswap",           RMeCX, XX, XX },
-  { "bswap",           RMeDX, XX, XX },
-  { "bswap",           RMeBX, XX, XX },
-  { "bswap",           RMeSP, XX, XX },
-  { "bswap",           RMeBP, XX, XX },
-  { "bswap",           RMeSI, XX, XX },
-  { "bswap",           RMeDI, XX, XX },
-  /* d0 */
-  { "(bad)",           XX, XX, XX },
-  { "psrlw",           MX, EM, XX },
-  { "psrld",           MX, EM, XX },
-  { "psrlq",           MX, EM, XX },
-  { "paddq",           MX, EM, XX },
-  { "pmullw",          MX, EM, XX },
-  { PREGRP21 },
-  { "pmovmskb",                Gd, MS, XX },
-  /* d8 */
-  { "psubusb",         MX, EM, XX },
-  { "psubusw",         MX, EM, XX },
-  { "pminub",          MX, EM, XX },
-  { "pand",            MX, EM, XX },
-  { "paddusb",         MX, EM, XX },
-  { "paddusw",         MX, EM, XX },
-  { "pmaxub",          MX, EM, XX },
-  { "pandn",           MX, EM, XX },
-  /* e0 */
-  { "pavgb",           MX, EM, XX },
-  { "psraw",           MX, EM, XX },
-  { "psrad",           MX, EM, XX },
-  { "pavgw",           MX, EM, XX },
-  { "pmulhuw",         MX, EM, XX },
-  { "pmulhw",          MX, EM, XX },
-  { PREGRP15 },
-  { PREGRP25 },
-  /* e8 */
-  { "psubsb",          MX, EM, XX },
-  { "psubsw",          MX, EM, XX },
-  { "pminsw",          MX, EM, XX },
-  { "por",             MX, EM, XX },
-  { "paddsb",          MX, EM, XX },
-  { "paddsw",          MX, EM, XX },
-  { "pmaxsw",          MX, EM, XX },
-  { "pxor",            MX, EM, XX },
-  /* f0 */
-  { "(bad)",           XX, XX, XX },
-  { "psllw",           MX, EM, XX },
-  { "pslld",           MX, EM, XX },
-  { "psllq",           MX, EM, XX },
-  { "pmuludq",         MX, EM, XX },
-  { "pmaddwd",         MX, EM, XX },
-  { "psadbw",          MX, EM, XX },
-  { PREGRP18 },
-  /* f8 */
-  { "psubb",           MX, EM, XX },
-  { "psubw",           MX, EM, XX },
-  { "psubd",           MX, EM, XX },
-  { "psubq",           MX, EM, XX },
-  { "paddb",           MX, EM, XX },
-  { "paddw",           MX, EM, XX },
-  { "paddd",           MX, EM, XX },
-  { "(bad)",           XX, XX, XX }
-};
-
-static const unsigned char onebyte_has_modrm[256] = {
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-  /*       -------------------------------        */
-  /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
-  /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
-  /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
-  /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
-  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
-  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
-  /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
-  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
-  /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
-  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
-  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
-  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
-  /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
-  /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
-  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
-  /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1  /* f0 */
-  /*       -------------------------------        */
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-};
-
-static const unsigned char twobyte_has_modrm[256] = {
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-  /*       -------------------------------        */
-  /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
-  /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
-  /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
-  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
-  /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
-  /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
-  /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
-  /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
-  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
-  /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
-  /* a0 */ 0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1, /* af */
-  /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
-  /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
-  /* d0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
-  /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
-  /* f0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
-  /*       -------------------------------        */
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-};
-
-static const unsigned char twobyte_uses_SSE_prefix[256] = {
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-  /*       -------------------------------        */
-  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
-  /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
-  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
-  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
-  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
-  /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
-  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
-  /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
-  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
-  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
-  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
-  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
-  /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
-  /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
-  /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
-  /* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0  /* ff */
-  /*       -------------------------------        */
-  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
-};
-
-static char obuf[100];
-static char *obufp;
-static char scratchbuf[100];
-static unsigned char *start_codep;
-static unsigned char *insn_codep;
-static unsigned char *codep;
-static disassemble_info *the_info;
-static int mod;
-static int rm;
-static int reg;
-static unsigned char need_modrm;
-
-/* If we are accessing mod/rm/reg without need_modrm set, then the
-   values are stale.  Hitting this abort likely indicates that you
-   need to update onebyte_has_modrm or twobyte_has_modrm.  */
-#define MODRM_CHECK  if (!need_modrm) abort ()
-
-static const char **names64;
-static const char **names32;
-static const char **names16;
-static const char **names8;
-static const char **names8rex;
-static const char **names_seg;
-static const char **index16;
-
-static const char *intel_names64[] = {
-  "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
-  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
-};
-static const char *intel_names32[] = {
-  "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
-  "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
-};
-static const char *intel_names16[] = {
-  "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
-  "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
-};
-static const char *intel_names8[] = {
-  "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
-};
-static const char *intel_names8rex[] = {
-  "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
-  "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
-};
-static const char *intel_names_seg[] = {
-  "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
-};
-static const char *intel_index16[] = {
-  "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
-};
-
-static const char *att_names64[] = {
-  "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
-  "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
-};
-static const char *att_names32[] = {
-  "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
-  "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
-};
-static const char *att_names16[] = {
-  "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
-  "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
-};
-static const char *att_names8[] = {
-  "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
-};
-static const char *att_names8rex[] = {
-  "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
-  "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
-};
-static const char *att_names_seg[] = {
-  "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
-};
-static const char *att_index16[] = {
-  "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
-};
-
-static const struct dis386 grps[][8] = {
-  /* GRP1b */
-  {
-    { "addA",  Eb, Ib, XX },
-    { "orA",   Eb, Ib, XX },
-    { "adcA",  Eb, Ib, XX },
-    { "sbbA",  Eb, Ib, XX },
-    { "andA",  Eb, Ib, XX },
-    { "subA",  Eb, Ib, XX },
-    { "xorA",  Eb, Ib, XX },
-    { "cmpA",  Eb, Ib, XX }
-  },
-  /* GRP1S */
-  {
-    { "addQ",  Ev, Iv, XX },
-    { "orQ",   Ev, Iv, XX },
-    { "adcQ",  Ev, Iv, XX },
-    { "sbbQ",  Ev, Iv, XX },
-    { "andQ",  Ev, Iv, XX },
-    { "subQ",  Ev, Iv, XX },
-    { "xorQ",  Ev, Iv, XX },
-    { "cmpQ",  Ev, Iv, XX }
-  },
-  /* GRP1Ss */
-  {
-    { "addQ",  Ev, sIb, XX },
-    { "orQ",   Ev, sIb, XX },
-    { "adcQ",  Ev, sIb, XX },
-    { "sbbQ",  Ev, sIb, XX },
-    { "andQ",  Ev, sIb, XX },
-    { "subQ",  Ev, sIb, XX },
-    { "xorQ",  Ev, sIb, XX },
-    { "cmpQ",  Ev, sIb, XX }
-  },
-  /* GRP2b */
-  {
-    { "rolA",  Eb, Ib, XX },
-    { "rorA",  Eb, Ib, XX },
-    { "rclA",  Eb, Ib, XX },
-    { "rcrA",  Eb, Ib, XX },
-    { "shlA",  Eb, Ib, XX },
-    { "shrA",  Eb, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarA",  Eb, Ib, XX },
-  },
-  /* GRP2S */
-  {
-    { "rolQ",  Ev, Ib, XX },
-    { "rorQ",  Ev, Ib, XX },
-    { "rclQ",  Ev, Ib, XX },
-    { "rcrQ",  Ev, Ib, XX },
-    { "shlQ",  Ev, Ib, XX },
-    { "shrQ",  Ev, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarQ",  Ev, Ib, XX },
-  },
-  /* GRP2b_one */
-  {
-    { "rolA",  Eb, XX, XX },
-    { "rorA",  Eb, XX, XX },
-    { "rclA",  Eb, XX, XX },
-    { "rcrA",  Eb, XX, XX },
-    { "shlA",  Eb, XX, XX },
-    { "shrA",  Eb, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarA",  Eb, XX, XX },
-  },
-  /* GRP2S_one */
-  {
-    { "rolQ",  Ev, XX, XX },
-    { "rorQ",  Ev, XX, XX },
-    { "rclQ",  Ev, XX, XX },
-    { "rcrQ",  Ev, XX, XX },
-    { "shlQ",  Ev, XX, XX },
-    { "shrQ",  Ev, XX, XX },
-    { "(bad)", XX, XX, XX},
-    { "sarQ",  Ev, XX, XX },
-  },
-  /* GRP2b_cl */
-  {
-    { "rolA",  Eb, CL, XX },
-    { "rorA",  Eb, CL, XX },
-    { "rclA",  Eb, CL, XX },
-    { "rcrA",  Eb, CL, XX },
-    { "shlA",  Eb, CL, XX },
-    { "shrA",  Eb, CL, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarA",  Eb, CL, XX },
-  },
-  /* GRP2S_cl */
-  {
-    { "rolQ",  Ev, CL, XX },
-    { "rorQ",  Ev, CL, XX },
-    { "rclQ",  Ev, CL, XX },
-    { "rcrQ",  Ev, CL, XX },
-    { "shlQ",  Ev, CL, XX },
-    { "shrQ",  Ev, CL, XX },
-    { "(bad)", XX, XX, XX },
-    { "sarQ",  Ev, CL, XX }
-  },
-  /* GRP3b */
-  {
-    { "testA", Eb, Ib, XX },
-    { "(bad)", Eb, XX, XX },
-    { "notA",  Eb, XX, XX },
-    { "negA",  Eb, XX, XX },
-    { "mulA",  Eb, XX, XX },   /* Don't print the implicit %al register,  */
-    { "imulA", Eb, XX, XX },   /* to distinguish these opcodes from other */
-    { "divA",  Eb, XX, XX },   /* mul/imul opcodes.  Do the same for div  */
-    { "idivA", Eb, XX, XX }    /* and idiv for consistency.               */
-  },
-  /* GRP3S */
-  {
-    { "testQ", Ev, Iv, XX },
-    { "(bad)", XX, XX, XX },
-    { "notQ",  Ev, XX, XX },
-    { "negQ",  Ev, XX, XX },
-    { "mulQ",  Ev, XX, XX },   /* Don't print the implicit register.  */
-    { "imulQ", Ev, XX, XX },
-    { "divQ",  Ev, XX, XX },
-    { "idivQ", Ev, XX, XX },
-  },
-  /* GRP4 */
-  {
-    { "incA",  Eb, XX, XX },
-    { "decA",  Eb, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP5 */
-  {
-    { "incQ",  Ev, XX, XX },
-    { "decQ",  Ev, XX, XX },
-    { "callT", indirEv, XX, XX },
-    { "lcallT",        indirEv, XX, XX },
-    { "jmpT",  indirEv, XX, XX },
-    { "ljmpT", indirEv, XX, XX },
-    { "pushU", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP6 */
-  {
-    { "sldtQ", Ev, XX, XX },
-    { "strQ",  Ev, XX, XX },
-    { "lldt",  Ew, XX, XX },
-    { "ltr",   Ew, XX, XX },
-    { "verr",  Ew, XX, XX },
-    { "verw",  Ew, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX }
-  },
-  /* GRP7 */
-  {
-    { "sgdtQ",  M, XX, XX },
-    { "sidtQ",  M, XX, XX },
-    { "lgdtQ",  M, XX, XX },
-    { "lidtQ",  M, XX, XX },
-    { "smswQ", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "lmsw",  Ew, XX, XX },
-    { "invlpg",        Ew, XX, XX },
-  },
-  /* GRP8 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "btQ",   Ev, Ib, XX },
-    { "btsQ",  Ev, Ib, XX },
-    { "btrQ",  Ev, Ib, XX },
-    { "btcQ",  Ev, Ib, XX },
-  },
-  /* GRP9 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "cmpxchg8b", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP10 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "psrlw", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "psraw", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "psllw", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP11 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "psrld", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "psrad", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "pslld", MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRP12 */
-  {
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "psrlq", MS, Ib, XX },
-    { "psrldq",        MS, Ib, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "psllq", MS, Ib, XX },
-    { "pslldq",        MS, Ib, XX },
-  },
-  /* GRP13 */
-  {
-    { "fxsave", Ev, XX, XX },
-    { "fxrstor", Ev, XX, XX },
-    { "ldmxcsr", Ev, XX, XX },
-    { "stmxcsr", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "lfence", None, XX, XX },
-    { "mfence", None, XX, XX },
-    { "sfence", None, XX, XX },
-    /* FIXME: the sfence with memory operand is clflush!  */
-  },
-  /* GRP14 */
-  {
-    { "prefetchnta", Ev, XX, XX },
-    { "prefetcht0", Ev, XX, XX },
-    { "prefetcht1", Ev, XX, XX },
-    { "prefetcht2", Ev, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* GRPAMD */
-  {
-    { "prefetch", Eb, XX, XX },
-    { "prefetchw", Eb, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  }
-};
-
-static const struct dis386 prefix_user_table[][4] = {
-  /* PREGRP0 */
-  {
-    { "addps", XM, EX, XX },
-    { "addss", XM, EX, XX },
-    { "addpd", XM, EX, XX },
-    { "addsd", XM, EX, XX },
-  },
-  /* PREGRP1 */
-  {
-    { "", XM, EX, OPSIMD },    /* See OP_SIMD_SUFFIX.  */
-    { "", XM, EX, OPSIMD },
-    { "", XM, EX, OPSIMD },
-    { "", XM, EX, OPSIMD },
-  },
-  /* PREGRP2 */
-  {
-    { "cvtpi2ps", XM, EM, XX },
-    { "cvtsi2ssY", XM, Ev, XX },
-    { "cvtpi2pd", XM, EM, XX },
-    { "cvtsi2sdY", XM, Ev, XX },
-  },
-  /* PREGRP3 */
-  {
-    { "cvtps2pi", MX, EX, XX },
-    { "cvtss2siY", Gv, EX, XX },
-    { "cvtpd2pi", MX, EX, XX },
-    { "cvtsd2siY", Gv, EX, XX },
-  },
-  /* PREGRP4 */
-  {
-    { "cvttps2pi", MX, EX, XX },
-    { "cvttss2siY", Gv, EX, XX },
-    { "cvttpd2pi", MX, EX, XX },
-    { "cvttsd2siY", Gv, EX, XX },
-  },
-  /* PREGRP5 */
-  {
-    { "divps", XM, EX, XX },
-    { "divss", XM, EX, XX },
-    { "divpd", XM, EX, XX },
-    { "divsd", XM, EX, XX },
-  },
-  /* PREGRP6 */
-  {
-    { "maxps", XM, EX, XX },
-    { "maxss", XM, EX, XX },
-    { "maxpd", XM, EX, XX },
-    { "maxsd", XM, EX, XX },
-  },
-  /* PREGRP7 */
-  {
-    { "minps", XM, EX, XX },
-    { "minss", XM, EX, XX },
-    { "minpd", XM, EX, XX },
-    { "minsd", XM, EX, XX },
-  },
-  /* PREGRP8 */
-  {
-    { "movups", XM, EX, XX },
-    { "movss", XM, EX, XX },
-    { "movupd", XM, EX, XX },
-    { "movsd", XM, EX, XX },
-  },
-  /* PREGRP9 */
-  {
-    { "movups", EX, XM, XX },
-    { "movss", EX, XM, XX },
-    { "movupd", EX, XM, XX },
-    { "movsd", EX, XM, XX },
-  },
-  /* PREGRP10 */
-  {
-    { "mulps", XM, EX, XX },
-    { "mulss", XM, EX, XX },
-    { "mulpd", XM, EX, XX },
-    { "mulsd", XM, EX, XX },
-  },
-  /* PREGRP11 */
-  {
-    { "rcpps", XM, EX, XX },
-    { "rcpss", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP12 */
-  {
-    { "rsqrtps", XM, EX, XX },
-    { "rsqrtss", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP13 */
-  {
-    { "sqrtps", XM, EX, XX },
-    { "sqrtss", XM, EX, XX },
-    { "sqrtpd", XM, EX, XX },
-    { "sqrtsd", XM, EX, XX },
-  },
-  /* PREGRP14 */
-  {
-    { "subps", XM, EX, XX },
-    { "subss", XM, EX, XX },
-    { "subpd", XM, EX, XX },
-    { "subsd", XM, EX, XX },
-  },
-  /* PREGRP15 */
-  {
-    { "(bad)", XM, EX, XX },
-    { "cvtdq2pd", XM, EX, XX },
-    { "cvttpd2dq", XM, EX, XX },
-    { "cvtpd2dq", XM, EX, XX },
-  },
-  /* PREGRP16 */
-  {
-    { "cvtdq2ps", XM, EX, XX },
-    { "cvttps2dq",XM, EX, XX },
-    { "cvtps2dq",XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP17 */
-  {
-    { "cvtps2pd", XM, EX, XX },
-    { "cvtss2sd", XM, EX, XX },
-    { "cvtpd2ps", XM, EX, XX },
-    { "cvtsd2ss", XM, EX, XX },
-  },
-  /* PREGRP18 */
-  {
-    { "maskmovq", MX, MS, XX },
-    { "(bad)", XM, EX, XX },
-    { "maskmovdqu", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP19 */
-  {
-    { "movq", MX, EM, XX },
-    { "movdqu", XM, EX, XX },
-    { "movdqa", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP20 */
-  {
-    { "movq", EM, MX, XX },
-    { "movdqu", EX, XM, XX },
-    { "movdqa", EX, XM, XX },
-    { "(bad)", EX, XM, XX },
-  },
-  /* PREGRP21 */
-  {
-    { "(bad)", EX, XM, XX },
-    { "movq2dq", XM, MS, XX },
-    { "movq", EX, XM, XX },
-    { "movdq2q", MX, XS, XX },
-  },
-  /* PREGRP22 */
-  {
-    { "pshufw", MX, EM, Ib },
-    { "pshufhw", XM, EX, Ib },
-    { "pshufd", XM, EX, Ib },
-    { "pshuflw", XM, EX, Ib },
-  },
-  /* PREGRP23 */
-  {
-    { "movd", Ed, MX, XX },
-    { "movq", XM, EX, XX },
-    { "movd", Ed, XM, XX },
-    { "(bad)", Ed, XM, XX },
-  },
-  /* PREGRP24 */
-  {
-    { "(bad)", MX, EX, XX },
-    { "(bad)", XM, EX, XX },
-    { "punpckhqdq", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-  /* PREGRP25 */
-  {
-  { "movntq", Ev, MX, XX },
-  { "(bad)", Ev, XM, XX },
-  { "movntdq", Ev, XM, XX },
-  { "(bad)", Ev, XM, XX },
-  },
-  /* PREGRP26 */
-  {
-    { "(bad)", MX, EX, XX },
-    { "(bad)", XM, EX, XX },
-    { "punpcklqdq", XM, EX, XX },
-    { "(bad)", XM, EX, XX },
-  },
-};
-
-static const struct dis386 x86_64_table[][2] = {
-  {
-    { "arpl", Ew, Gw, XX },
-    { "movs{||lq|xd}", Gv, Ed, XX },
-  },
-};
-
-#define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
-
-static void
-ckprefix ()
-{
-  int newrex;
-  rex = 0;
-  prefixes = 0;
-  used_prefixes = 0;
-  rex_used = 0;
-  while (1)
-    {
-      FETCH_DATA (the_info, codep + 1);
-      newrex = 0;
-      switch (*codep)
-       {
-       /* REX prefixes family.  */
-       case 0x40:
-       case 0x41:
-       case 0x42:
-       case 0x43:
-       case 0x44:
-       case 0x45:
-       case 0x46:
-       case 0x47:
-       case 0x48:
-       case 0x49:
-       case 0x4a:
-       case 0x4b:
-       case 0x4c:
-       case 0x4d:
-       case 0x4e:
-       case 0x4f:
-           if (mode_64bit)
-             newrex = *codep;
-           else
-             return;
-         break;
-       case 0xf3:
-         prefixes |= PREFIX_REPZ;
-         break;
-       case 0xf2:
-         prefixes |= PREFIX_REPNZ;
-         break;
-       case 0xf0:
-         prefixes |= PREFIX_LOCK;
-         break;
-       case 0x2e:
-         prefixes |= PREFIX_CS;
-         break;
-       case 0x36:
-         prefixes |= PREFIX_SS;
-         break;
-       case 0x3e:
-         prefixes |= PREFIX_DS;
-         break;
-       case 0x26:
-         prefixes |= PREFIX_ES;
-         break;
-       case 0x64:
-         prefixes |= PREFIX_FS;
-         break;
-       case 0x65:
-         prefixes |= PREFIX_GS;
-         break;
-       case 0x66:
-         prefixes |= PREFIX_DATA;
-         break;
-       case 0x67:
-         prefixes |= PREFIX_ADDR;
-         break;
-       case FWAIT_OPCODE:
-         /* fwait is really an instruction.  If there are prefixes
-            before the fwait, they belong to the fwait, *not* to the
-            following instruction.  */
-         if (prefixes)
-           {
-             prefixes |= PREFIX_FWAIT;
-             codep++;
-             return;
-           }
-         prefixes = PREFIX_FWAIT;
-         break;
-       default:
-         return;
-       }
-      /* Rex is ignored when followed by another prefix.  */
-      if (rex)
-       {
-         oappend (prefix_name (rex, 0));
-         oappend (" ");
-       }
-      rex = newrex;
-      codep++;
-    }
-}
-
-/* Return the name of the prefix byte PREF, or NULL if PREF is not a
-   prefix byte.  */
-
-static const char *
-prefix_name (pref, sizeflag)
-     int pref;
-     int sizeflag;
-{
-  switch (pref)
-    {
-    /* REX prefixes family.  */
-    case 0x40:
-      return "rex";
-    case 0x41:
-      return "rexZ";
-    case 0x42:
-      return "rexY";
-    case 0x43:
-      return "rexYZ";
-    case 0x44:
-      return "rexX";
-    case 0x45:
-      return "rexXZ";
-    case 0x46:
-      return "rexXY";
-    case 0x47:
-      return "rexXYZ";
-    case 0x48:
-      return "rex64";
-    case 0x49:
-      return "rex64Z";
-    case 0x4a:
-      return "rex64Y";
-    case 0x4b:
-      return "rex64YZ";
-    case 0x4c:
-      return "rex64X";
-    case 0x4d:
-      return "rex64XZ";
-    case 0x4e:
-      return "rex64XY";
-    case 0x4f:
-      return "rex64XYZ";
-    case 0xf3:
-      return "repz";
-    case 0xf2:
-      return "repnz";
-    case 0xf0:
-      return "lock";
-    case 0x2e:
-      return "cs";
-    case 0x36:
-      return "ss";
-    case 0x3e:
-      return "ds";
-    case 0x26:
-      return "es";
-    case 0x64:
-      return "fs";
-    case 0x65:
-      return "gs";
-    case 0x66:
-      return (sizeflag & DFLAG) ? "data16" : "data32";
-    case 0x67:
-      if (mode_64bit)
-        return (sizeflag & AFLAG) ? "addr32" : "addr64";
-      else
-        return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32";
-    case FWAIT_OPCODE:
-      return "fwait";
-    default:
-      return NULL;
-    }
-}
-
-static char op1out[100], op2out[100], op3out[100];
-static int op_ad, op_index[3];
-static bfd_vma op_address[3];
-static bfd_vma op_riprel[3];
-static bfd_vma start_pc;
-\f
-/*
- *   On the 386's of 1988, the maximum length of an instruction is 15 bytes.
- *   (see topic "Redundant prefixes" in the "Differences from 8086"
- *   section of the "Virtual 8086 Mode" chapter.)
- * 'pc' should be the address of this instruction, it will
- *   be used to print the target address if this is a relative jump or call
- * The function returns the length of this instruction in bytes.
- */
-
-static char intel_syntax;
-static char open_char;
-static char close_char;
-static char separator_char;
-static char scale_char;
-
-/* Here for backwards compatibility.  When gdb stops using
-   print_insn_i386_att and print_insn_i386_intel these functions can
-   disappear, and print_insn_i386 be merged into print_insn.  */
-int
-print_insn_i386_att (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  intel_syntax = 0;
-
-  return print_insn (pc, info);
-}
-
-int
-print_insn_i386_intel (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  intel_syntax = 1;
-
-  return print_insn (pc, info);
-}
-
-int
-print_insn_i386 (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  intel_syntax = -1;
-
-  return print_insn (pc, info);
-}
-
-static int
-print_insn (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  const struct dis386 *dp;
-  int i;
-  int two_source_ops;
-  char *first, *second, *third;
-  int needcomma;
-  unsigned char uses_SSE_prefix;
-  int sizeflag;
-  const char *p;
-  struct dis_private priv;
-
-  mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
-               || info->mach == bfd_mach_x86_64);
-
-  if (intel_syntax == -1)
-    intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
-                   || info->mach == bfd_mach_x86_64_intel_syntax);
-
-  if (info->mach == bfd_mach_i386_i386
-      || info->mach == bfd_mach_x86_64
-      || info->mach == bfd_mach_i386_i386_intel_syntax
-      || info->mach == bfd_mach_x86_64_intel_syntax)
-    priv.orig_sizeflag = AFLAG | DFLAG;
-  else if (info->mach == bfd_mach_i386_i8086)
-    priv.orig_sizeflag = 0;
-  else
-    abort ();
-
-  for (p = info->disassembler_options; p != NULL; )
-    {
-      if (strncmp (p, "x86-64", 6) == 0)
-       {
-         mode_64bit = 1;
-         priv.orig_sizeflag = AFLAG | DFLAG;
-       }
-      else if (strncmp (p, "i386", 4) == 0)
-       {
-         mode_64bit = 0;
-         priv.orig_sizeflag = AFLAG | DFLAG;
-       }
-      else if (strncmp (p, "i8086", 5) == 0)
-       {
-         mode_64bit = 0;
-         priv.orig_sizeflag = 0;
-       }
-      else if (strncmp (p, "intel", 5) == 0)
-       {
-         intel_syntax = 1;
-       }
-      else if (strncmp (p, "att", 3) == 0)
-       {
-         intel_syntax = 0;
-       }
-      else if (strncmp (p, "addr", 4) == 0)
-       {
-         if (p[4] == '1' && p[5] == '6')
-           priv.orig_sizeflag &= ~AFLAG;
-         else if (p[4] == '3' && p[5] == '2')
-           priv.orig_sizeflag |= AFLAG;
-       }
-      else if (strncmp (p, "data", 4) == 0)
-       {
-         if (p[4] == '1' && p[5] == '6')
-           priv.orig_sizeflag &= ~DFLAG;
-         else if (p[4] == '3' && p[5] == '2')
-           priv.orig_sizeflag |= DFLAG;
-       }
-      else if (strncmp (p, "suffix", 6) == 0)
-       priv.orig_sizeflag |= SUFFIX_ALWAYS;
-
-      p = strchr (p, ',');
-      if (p != NULL)
-       p++;
-    }
-
-  if (intel_syntax)
-    {
-      names64 = intel_names64;
-      names32 = intel_names32;
-      names16 = intel_names16;
-      names8 = intel_names8;
-      names8rex = intel_names8rex;
-      names_seg = intel_names_seg;
-      index16 = intel_index16;
-      open_char = '[';
-      close_char = ']';
-      separator_char = '+';
-      scale_char = '*';
-    }
-  else
-    {
-      names64 = att_names64;
-      names32 = att_names32;
-      names16 = att_names16;
-      names8 = att_names8;
-      names8rex = att_names8rex;
-      names_seg = att_names_seg;
-      index16 = att_index16;
-      open_char = '(';
-      close_char =  ')';
-      separator_char = ',';
-      scale_char = ',';
-    }
-
-  /* The output looks better if we put 7 bytes on a line, since that
-     puts most long word instructions on a single line.  */
-  info->bytes_per_line = 7;
-
-  info->private_data = (PTR) &priv;
-  priv.max_fetched = priv.the_buffer;
-  priv.insn_start = pc;
-
-  obuf[0] = 0;
-  op1out[0] = 0;
-  op2out[0] = 0;
-  op3out[0] = 0;
-
-  op_index[0] = op_index[1] = op_index[2] = -1;
-
-  the_info = info;
-  start_pc = pc;
-  start_codep = priv.the_buffer;
-  codep = priv.the_buffer;
-
-  if (setjmp (priv.bailout) != 0)
-    {
-      const char *name;
-
-      /* Getting here means we tried for data but didn't get it.  That
-        means we have an incomplete instruction of some sort.  Just
-        print the first byte as a prefix or a .byte pseudo-op.  */
-      if (codep > priv.the_buffer)
-       {
-         name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
-         if (name != NULL)
-           (*info->fprintf_func) (info->stream, "%s", name);
-         else
-           {
-             /* Just print the first byte as a .byte instruction.  */
-             (*info->fprintf_func) (info->stream, ".byte 0x%x",
-                                    (unsigned int) priv.the_buffer[0]);
-           }
-
-         return 1;
-       }
-
-      return -1;
-    }
-
-  obufp = obuf;
-  ckprefix ();
-
-  insn_codep = codep;
-  sizeflag = priv.orig_sizeflag;
-
-  FETCH_DATA (info, codep + 1);
-  two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
-
-  if ((prefixes & PREFIX_FWAIT)
-      && ((*codep < 0xd8) || (*codep > 0xdf)))
-    {
-      const char *name;
-
-      /* fwait not followed by floating point instruction.  Print the
-         first prefix, which is probably fwait itself.  */
-      name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
-      if (name == NULL)
-       name = INTERNAL_DISASSEMBLER_ERROR;
-      (*info->fprintf_func) (info->stream, "%s", name);
-      return 1;
-    }
-
-  if (*codep == 0x0f)
-    {
-      FETCH_DATA (info, codep + 2);
-      dp = &dis386_twobyte[*++codep];
-      need_modrm = twobyte_has_modrm[*codep];
-      uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep];
-    }
-  else
-    {
-      dp = &dis386[*codep];
-      need_modrm = onebyte_has_modrm[*codep];
-      uses_SSE_prefix = 0;
-    }
-  codep++;
-
-  if (!uses_SSE_prefix && (prefixes & PREFIX_REPZ))
-    {
-      oappend ("repz ");
-      used_prefixes |= PREFIX_REPZ;
-    }
-  if (!uses_SSE_prefix && (prefixes & PREFIX_REPNZ))
-    {
-      oappend ("repnz ");
-      used_prefixes |= PREFIX_REPNZ;
-    }
-  if (prefixes & PREFIX_LOCK)
-    {
-      oappend ("lock ");
-      used_prefixes |= PREFIX_LOCK;
-    }
-
-  if (prefixes & PREFIX_ADDR)
-    {
-      sizeflag ^= AFLAG;
-      if (dp->bytemode3 != loop_jcxz_mode || intel_syntax)
-       {
-         if ((sizeflag & AFLAG) || mode_64bit)
-           oappend ("addr32 ");
-         else
-           oappend ("addr16 ");
-         used_prefixes |= PREFIX_ADDR;
-       }
-    }
-
-  if (!uses_SSE_prefix && (prefixes & PREFIX_DATA))
-    {
-      sizeflag ^= DFLAG;
-      if (dp->bytemode3 == cond_jump_mode
-         && dp->bytemode1 == v_mode
-         && !intel_syntax)
-       {
-         if (sizeflag & DFLAG)
-           oappend ("data32 ");
-         else
-           oappend ("data16 ");
-         used_prefixes |= PREFIX_DATA;
-       }
-    }
-
-  if (need_modrm)
-    {
-      FETCH_DATA (info, codep + 1);
-      mod = (*codep >> 6) & 3;
-      reg = (*codep >> 3) & 7;
-      rm = *codep & 7;
-    }
-
-  if (dp->name == NULL && dp->bytemode1 == FLOATCODE)
-    {
-      dofloat (sizeflag);
-    }
-  else
-    {
-      int index;
-      if (dp->name == NULL)
-       {
-         switch (dp->bytemode1)
-           {
-           case USE_GROUPS:
-             dp = &grps[dp->bytemode2][reg];
-             break;
-
-           case USE_PREFIX_USER_TABLE:
-             index = 0;
-             used_prefixes |= (prefixes & PREFIX_REPZ);
-             if (prefixes & PREFIX_REPZ)
-               index = 1;
-             else
-               {
-                 used_prefixes |= (prefixes & PREFIX_DATA);
-                 if (prefixes & PREFIX_DATA)
-                   index = 2;
-                 else
-                   {
-                     used_prefixes |= (prefixes & PREFIX_REPNZ);
-                     if (prefixes & PREFIX_REPNZ)
-                       index = 3;
-                   }
-               }
-             dp = &prefix_user_table[dp->bytemode2][index];
-             break;
-
-           case X86_64_SPECIAL:
-             dp = &x86_64_table[dp->bytemode2][mode_64bit];
-             break;
-
-           default:
-             oappend (INTERNAL_DISASSEMBLER_ERROR);
-             break;
-           }
-       }
-
-      if (putop (dp->name, sizeflag) == 0)
-       {
-         obufp = op1out;
-         op_ad = 2;
-         if (dp->op1)
-           (*dp->op1) (dp->bytemode1, sizeflag);
-
-         obufp = op2out;
-         op_ad = 1;
-         if (dp->op2)
-           (*dp->op2) (dp->bytemode2, sizeflag);
-
-         obufp = op3out;
-         op_ad = 0;
-         if (dp->op3)
-           (*dp->op3) (dp->bytemode3, sizeflag);
-       }
-    }
-
-  /* See if any prefixes were not used.  If so, print the first one
-     separately.  If we don't do this, we'll wind up printing an
-     instruction stream which does not precisely correspond to the
-     bytes we are disassembling.  */
-  if ((prefixes & ~used_prefixes) != 0)
-    {
-      const char *name;
-
-      name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
-      if (name == NULL)
-       name = INTERNAL_DISASSEMBLER_ERROR;
-      (*info->fprintf_func) (info->stream, "%s", name);
-      return 1;
-    }
-  if (rex & ~rex_used)
-    {
-      const char *name;
-      name = prefix_name (rex | 0x40, priv.orig_sizeflag);
-      if (name == NULL)
-       name = INTERNAL_DISASSEMBLER_ERROR;
-      (*info->fprintf_func) (info->stream, "%s ", name);
-    }
-
-  obufp = obuf + strlen (obuf);
-  for (i = strlen (obuf); i < 6; i++)
-    oappend (" ");
-  oappend (" ");
-  (*info->fprintf_func) (info->stream, "%s", obuf);
-
-  /* The enter and bound instructions are printed with operands in the same
-     order as the intel book; everything else is printed in reverse order.  */
-  if (intel_syntax || two_source_ops)
-    {
-      first = op1out;
-      second = op2out;
-      third = op3out;
-      op_ad = op_index[0];
-      op_index[0] = op_index[2];
-      op_index[2] = op_ad;
-    }
-  else
-    {
-      first = op3out;
-      second = op2out;
-      third = op1out;
-    }
-  needcomma = 0;
-  if (*first)
-    {
-      if (op_index[0] != -1 && !op_riprel[0])
-       (*info->print_address_func) ((bfd_vma) op_address[op_index[0]], info);
-      else
-       (*info->fprintf_func) (info->stream, "%s", first);
-      needcomma = 1;
-    }
-  if (*second)
-    {
-      if (needcomma)
-       (*info->fprintf_func) (info->stream, ",");
-      if (op_index[1] != -1 && !op_riprel[1])
-       (*info->print_address_func) ((bfd_vma) op_address[op_index[1]], info);
-      else
-       (*info->fprintf_func) (info->stream, "%s", second);
-      needcomma = 1;
-    }
-  if (*third)
-    {
-      if (needcomma)
-       (*info->fprintf_func) (info->stream, ",");
-      if (op_index[2] != -1 && !op_riprel[2])
-       (*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info);
-      else
-       (*info->fprintf_func) (info->stream, "%s", third);
-    }
-  for (i = 0; i < 3; i++)
-    if (op_index[i] != -1 && op_riprel[i])
-      {
-       (*info->fprintf_func) (info->stream, "        # ");
-       (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
-                                               + op_address[op_index[i]]), info);
-      }
-  return codep - priv.the_buffer;
-}
-
-static const char *float_mem[] = {
-  /* d8 */
-  "fadd{s||s|}",
-  "fmul{s||s|}",
-  "fcom{s||s|}",
-  "fcomp{s||s|}",
-  "fsub{s||s|}",
-  "fsubr{s||s|}",
-  "fdiv{s||s|}",
-  "fdivr{s||s|}",
-  /*  d9 */
-  "fld{s||s|}",
-  "(bad)",
-  "fst{s||s|}",
-  "fstp{s||s|}",
-  "fldenv",
-  "fldcw",
-  "fNstenv",
-  "fNstcw",
-  /* da */
-  "fiadd{l||l|}",
-  "fimul{l||l|}",
-  "ficom{l||l|}",
-  "ficomp{l||l|}",
-  "fisub{l||l|}",
-  "fisubr{l||l|}",
-  "fidiv{l||l|}",
-  "fidivr{l||l|}",
-  /* db */
-  "fild{l||l|}",
-  "(bad)",
-  "fist{l||l|}",
-  "fistp{l||l|}",
-  "(bad)",
-  "fld{t||t|}",
-  "(bad)",
-  "fstp{t||t|}",
-  /* dc */
-  "fadd{l||l|}",
-  "fmul{l||l|}",
-  "fcom{l||l|}",
-  "fcomp{l||l|}",
-  "fsub{l||l|}",
-  "fsubr{l||l|}",
-  "fdiv{l||l|}",
-  "fdivr{l||l|}",
-  /* dd */
-  "fld{l||l|}",
-  "(bad)",
-  "fst{l||l|}",
-  "fstp{l||l|}",
-  "frstor",
-  "(bad)",
-  "fNsave",
-  "fNstsw",
-  /* de */
-  "fiadd",
-  "fimul",
-  "ficom",
-  "ficomp",
-  "fisub",
-  "fisubr",
-  "fidiv",
-  "fidivr",
-  /* df */
-  "fild",
-  "(bad)",
-  "fist",
-  "fistp",
-  "fbld",
-  "fild{ll||ll|}",
-  "fbstp",
-  "fistpll",
-};
-
-#define ST OP_ST, 0
-#define STi OP_STi, 0
-
-#define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0
-#define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0
-#define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0
-#define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0
-#define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0
-#define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0
-#define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0
-#define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0
-#define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0
-
-static const struct dis386 float_reg[][8] = {
-  /* d8 */
-  {
-    { "fadd",  ST, STi, XX },
-    { "fmul",  ST, STi, XX },
-    { "fcom",  STi, XX, XX },
-    { "fcomp", STi, XX, XX },
-    { "fsub",  ST, STi, XX },
-    { "fsubr", ST, STi, XX },
-    { "fdiv",  ST, STi, XX },
-    { "fdivr", ST, STi, XX },
-  },
-  /* d9 */
-  {
-    { "fld",   STi, XX, XX },
-    { "fxch",  STi, XX, XX },
-    { FGRPd9_2 },
-    { "(bad)", XX, XX, XX },
-    { FGRPd9_4 },
-    { FGRPd9_5 },
-    { FGRPd9_6 },
-    { FGRPd9_7 },
-  },
-  /* da */
-  {
-    { "fcmovb",        ST, STi, XX },
-    { "fcmove",        ST, STi, XX },
-    { "fcmovbe",ST, STi, XX },
-    { "fcmovu",        ST, STi, XX },
-    { "(bad)", XX, XX, XX },
-    { FGRPda_5 },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* db */
-  {
-    { "fcmovnb",ST, STi, XX },
-    { "fcmovne",ST, STi, XX },
-    { "fcmovnbe",ST, STi, XX },
-    { "fcmovnu",ST, STi, XX },
-    { FGRPdb_4 },
-    { "fucomi",        ST, STi, XX },
-    { "fcomi", ST, STi, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* dc */
-  {
-    { "fadd",  STi, ST, XX },
-    { "fmul",  STi, ST, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-#if UNIXWARE_COMPAT
-    { "fsub",  STi, ST, XX },
-    { "fsubr", STi, ST, XX },
-    { "fdiv",  STi, ST, XX },
-    { "fdivr", STi, ST, XX },
-#else
-    { "fsubr", STi, ST, XX },
-    { "fsub",  STi, ST, XX },
-    { "fdivr", STi, ST, XX },
-    { "fdiv",  STi, ST, XX },
-#endif
-  },
-  /* dd */
-  {
-    { "ffree", STi, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "fst",   STi, XX, XX },
-    { "fstp",  STi, XX, XX },
-    { "fucom", STi, XX, XX },
-    { "fucomp",        STi, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-  },
-  /* de */
-  {
-    { "faddp", STi, ST, XX },
-    { "fmulp", STi, ST, XX },
-    { "(bad)", XX, XX, XX },
-    { FGRPde_3 },
-#if UNIXWARE_COMPAT
-    { "fsubp", STi, ST, XX },
-    { "fsubrp",        STi, ST, XX },
-    { "fdivp", STi, ST, XX },
-    { "fdivrp",        STi, ST, XX },
-#else
-    { "fsubrp",        STi, ST, XX },
-    { "fsubp", STi, ST, XX },
-    { "fdivrp",        STi, ST, XX },
-    { "fdivp", STi, ST, XX },
-#endif
-  },
-  /* df */
-  {
-    { "ffreep",        STi, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { "(bad)", XX, XX, XX },
-    { FGRPdf_4 },
-    { "fucomip",ST, STi, XX },
-    { "fcomip", ST, STi, XX },
-    { "(bad)", XX, XX, XX },
-  },
-};
-
-static char *fgrps[][8] = {
-  /* d9_2  0 */
-  {
-    "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
-  },
-
-  /* d9_4  1 */
-  {
-    "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
-  },
-
-  /* d9_5  2 */
-  {
-    "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
-  },
-
-  /* d9_6  3 */
-  {
-    "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
-  },
-
-  /* d9_7  4 */
-  {
-    "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
-  },
-
-  /* da_5  5 */
-  {
-    "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
-  },
-
-  /* db_4  6 */
-  {
-    "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
-    "fNsetpm(287 only)","(bad)","(bad)","(bad)",
-  },
-
-  /* de_3  7 */
-  {
-    "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
-  },
-
-  /* df_4  8 */
-  {
-    "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
-  },
-};
-
-static void
-dofloat (sizeflag)
-     int sizeflag;
-{
-  const struct dis386 *dp;
-  unsigned char floatop;
-
-  floatop = codep[-1];
-
-  if (mod != 3)
-    {
-      putop (float_mem[(floatop - 0xd8) * 8 + reg], sizeflag);
-      obufp = op1out;
-      if (floatop == 0xdb)
-        OP_E (x_mode, sizeflag);
-      else if (floatop == 0xdd)
-        OP_E (d_mode, sizeflag);
-      else
-        OP_E (v_mode, sizeflag);
-      return;
-    }
-  /* Skip mod/rm byte.  */
-  MODRM_CHECK;
-  codep++;
-
-  dp = &float_reg[floatop - 0xd8][reg];
-  if (dp->name == NULL)
-    {
-      putop (fgrps[dp->bytemode1][rm], sizeflag);
-
-      /* Instruction fnstsw is only one with strange arg.  */
-      if (floatop == 0xdf && codep[-1] == 0xe0)
-       strcpy (op1out, names16[0]);
-    }
-  else
-    {
-      putop (dp->name, sizeflag);
-
-      obufp = op1out;
-      if (dp->op1)
-       (*dp->op1) (dp->bytemode1, sizeflag);
-      obufp = op2out;
-      if (dp->op2)
-       (*dp->op2) (dp->bytemode2, sizeflag);
-    }
-}
-
-static void
-OP_ST (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  oappend ("%st");
-}
-
-static void
-OP_STi (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  sprintf (scratchbuf, "%%st(%d)", rm);
-  oappend (scratchbuf + intel_syntax);
-}
-
-/* Capital letters in template are macros.  */
-static int
-putop (template, sizeflag)
-     const char *template;
-     int sizeflag;
-{
-  const char *p;
-  int alt;
-
-  for (p = template; *p; p++)
-    {
-      switch (*p)
-       {
-       default:
-         *obufp++ = *p;
-         break;
-       case '{':
-         alt = 0;
-         if (intel_syntax)
-           alt += 1;
-         if (mode_64bit)
-           alt += 2;
-         while (alt != 0)
-           {
-             while (*++p != '|')
-               {
-                 if (*p == '}')
-                   {
-                     /* Alternative not valid.  */
-                     strcpy (obuf, "(bad)");
-                     obufp = obuf + 5;
-                     return 1;
-                   }
-                 else if (*p == '\0')
-                   abort ();
-               }
-             alt--;
-           }
-         break;
-       case '|':
-         while (*++p != '}')
-           {
-             if (*p == '\0')
-               abort ();
-           }
-         break;
-       case '}':
-         break;
-       case 'A':
-          if (intel_syntax)
-            break;
-         if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
-           *obufp++ = 'b';
-         break;
-       case 'B':
-          if (intel_syntax)
-            break;
-         if (sizeflag & SUFFIX_ALWAYS)
-           *obufp++ = 'b';
-         break;
-       case 'E':               /* For jcxz/jecxz */
-         if (mode_64bit)
-           {
-             if (sizeflag & AFLAG)
-               *obufp++ = 'r';
-             else
-               *obufp++ = 'e';
-           }
-         else
-           if (sizeflag & AFLAG)
-             *obufp++ = 'e';
-         used_prefixes |= (prefixes & PREFIX_ADDR);
-         break;
-       case 'F':
-          if (intel_syntax)
-            break;
-         if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
-           {
-             if (sizeflag & AFLAG)
-               *obufp++ = mode_64bit ? 'q' : 'l';
-             else
-               *obufp++ = mode_64bit ? 'l' : 'w';
-             used_prefixes |= (prefixes & PREFIX_ADDR);
-           }
-         break;
-       case 'H':
-          if (intel_syntax)
-            break;
-         if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
-             || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
-           {
-             used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS);
-             *obufp++ = ',';
-             *obufp++ = 'p';
-             if (prefixes & PREFIX_DS)
-               *obufp++ = 't';
-             else
-               *obufp++ = 'n';
-           }
-         break;
-       case 'L':
-          if (intel_syntax)
-            break;
-         if (sizeflag & SUFFIX_ALWAYS)
-           *obufp++ = 'l';
-         break;
-       case 'N':
-         if ((prefixes & PREFIX_FWAIT) == 0)
-           *obufp++ = 'n';
-         else
-           used_prefixes |= PREFIX_FWAIT;
-         break;
-       case 'O':
-         USED_REX (REX_MODE64);
-         if (rex & REX_MODE64)
-           *obufp++ = 'o';
-         else
-           *obufp++ = 'd';
-         break;
-       case 'T':
-          if (intel_syntax)
-            break;
-         if (mode_64bit)
-           {
-             *obufp++ = 'q';
-             break;
-           }
-         /* Fall through.  */
-       case 'P':
-          if (intel_syntax)
-            break;
-         if ((prefixes & PREFIX_DATA)
-             || (rex & REX_MODE64)
-             || (sizeflag & SUFFIX_ALWAYS))
-           {
-             USED_REX (REX_MODE64);
-             if (rex & REX_MODE64)
-               *obufp++ = 'q';
-             else
-               {
-                  if (sizeflag & DFLAG)
-                     *obufp++ = 'l';
-                  else
-                    *obufp++ = 'w';
-                  used_prefixes |= (prefixes & PREFIX_DATA);
-               }
-           }
-         break;
-       case 'U':
-          if (intel_syntax)
-            break;
-         if (mode_64bit)
-           {
-             *obufp++ = 'q';
-             break;
-           }
-         /* Fall through.  */
-       case 'Q':
-          if (intel_syntax)
-            break;
-         USED_REX (REX_MODE64);
-         if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
-           {
-             if (rex & REX_MODE64)
-               *obufp++ = 'q';
-             else
-               {
-                 if (sizeflag & DFLAG)
-                   *obufp++ = 'l';
-                 else
-                   *obufp++ = 'w';
-                 used_prefixes |= (prefixes & PREFIX_DATA);
-               }
-           }
-         break;
-       case 'R':
-         USED_REX (REX_MODE64);
-          if (intel_syntax)
-           {
-             if (rex & REX_MODE64)
-               {
-                 *obufp++ = 'q';
-                 *obufp++ = 't';
-               }
-             else if (sizeflag & DFLAG)
-               {
-                 *obufp++ = 'd';
-                 *obufp++ = 'q';
-               }
-             else
-               {
-                 *obufp++ = 'w';
-                 *obufp++ = 'd';
-               }
-           }
-         else
-           {
-             if (rex & REX_MODE64)
-               *obufp++ = 'q';
-             else if (sizeflag & DFLAG)
-               *obufp++ = 'l';
-             else
-               *obufp++ = 'w';
-           }
-         if (!(rex & REX_MODE64))
-           used_prefixes |= (prefixes & PREFIX_DATA);
-         break;
-       case 'S':
-          if (intel_syntax)
-            break;
-         if (sizeflag & SUFFIX_ALWAYS)
-           {
-             if (rex & REX_MODE64)
-               *obufp++ = 'q';
-             else
-               {
-                 if (sizeflag & DFLAG)
-                   *obufp++ = 'l';
-                 else
-                   *obufp++ = 'w';
-                 used_prefixes |= (prefixes & PREFIX_DATA);
-               }
-           }
-         break;
-       case 'X':
-         if (prefixes & PREFIX_DATA)
-           *obufp++ = 'd';
-         else
-           *obufp++ = 's';
-          used_prefixes |= (prefixes & PREFIX_DATA);
-         break;
-       case 'Y':
-          if (intel_syntax)
-            break;
-         if (rex & REX_MODE64)
-           {
-             USED_REX (REX_MODE64);
-             *obufp++ = 'q';
-           }
-         break;
-         /* implicit operand size 'l' for i386 or 'q' for x86-64 */
-       case 'W':
-         /* operand size flag for cwtl, cbtw */
-         USED_REX (0);
-         if (rex)
-           *obufp++ = 'l';
-         else if (sizeflag & DFLAG)
-           *obufp++ = 'w';
-         else
-           *obufp++ = 'b';
-          if (intel_syntax)
-           {
-             if (rex)
-               {
-                 *obufp++ = 'q';
-                 *obufp++ = 'e';
-               }
-             if (sizeflag & DFLAG)
-               {
-                 *obufp++ = 'd';
-                 *obufp++ = 'e';
-               }
-             else
-               {
-                 *obufp++ = 'w';
-               }
-           }
-         if (!rex)
-           used_prefixes |= (prefixes & PREFIX_DATA);
-         break;
-       }
-    }
-  *obufp = 0;
-  return 0;
-}
-
-static void
-oappend (s)
-     const char *s;
-{
-  strcpy (obufp, s);
-  obufp += strlen (s);
-}
-
-static void
-append_seg ()
-{
-  if (prefixes & PREFIX_CS)
-    {
-      used_prefixes |= PREFIX_CS;
-      oappend ("%cs:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_DS)
-    {
-      used_prefixes |= PREFIX_DS;
-      oappend ("%ds:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_SS)
-    {
-      used_prefixes |= PREFIX_SS;
-      oappend ("%ss:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_ES)
-    {
-      used_prefixes |= PREFIX_ES;
-      oappend ("%es:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_FS)
-    {
-      used_prefixes |= PREFIX_FS;
-      oappend ("%fs:" + intel_syntax);
-    }
-  if (prefixes & PREFIX_GS)
-    {
-      used_prefixes |= PREFIX_GS;
-      oappend ("%gs:" + intel_syntax);
-    }
-}
-
-static void
-OP_indirE (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  if (!intel_syntax)
-    oappend ("*");
-  OP_E (bytemode, sizeflag);
-}
-
-static void
-print_operand_value (buf, hex, disp)
-  char *buf;
-  int hex;
-  bfd_vma disp;
-{
-  if (mode_64bit)
-    {
-      if (hex)
-       {
-         char tmp[30];
-         int i;
-         buf[0] = '0';
-         buf[1] = 'x';
-         sprintf_vma (tmp, disp);
-         for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
-         strcpy (buf + 2, tmp + i);
-       }
-      else
-       {
-         bfd_signed_vma v = disp;
-         char tmp[30];
-         int i;
-         if (v < 0)
-           {
-             *(buf++) = '-';
-             v = -disp;
-             /* Check for possible overflow on 0x8000000000000000.  */
-             if (v < 0)
-               {
-                 strcpy (buf, "9223372036854775808");
-                 return;
-               }
-           }
-         if (!v)
-           {
-             strcpy (buf, "0");
-             return;
-           }
-
-         i = 0;
-         tmp[29] = 0;
-         while (v)
-           {
-             tmp[28 - i] = (v % 10) + '0';
-             v /= 10;
-             i++;
-           }
-         strcpy (buf, tmp + 29 - i);
-       }
-    }
-  else
-    {
-      if (hex)
-       sprintf (buf, "0x%x", (unsigned int) disp);
-      else
-       sprintf (buf, "%d", (int) disp);
-    }
-}
-
-static void
-OP_E (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_vma disp;
-  int add = 0;
-  int riprel = 0;
-  USED_REX (REX_EXTZ);
-  if (rex & REX_EXTZ)
-    add += 8;
-
-  /* Skip mod/rm byte.  */
-  MODRM_CHECK;
-  codep++;
-
-  if (mod == 3)
-    {
-      switch (bytemode)
-       {
-       case b_mode:
-         USED_REX (0);
-         if (rex)
-           oappend (names8rex[rm + add]);
-         else
-           oappend (names8[rm + add]);
-         break;
-       case w_mode:
-         oappend (names16[rm + add]);
-         break;
-       case d_mode:
-         oappend (names32[rm + add]);
-         break;
-       case q_mode:
-         oappend (names64[rm + add]);
-         break;
-       case m_mode:
-         if (mode_64bit)
-           oappend (names64[rm + add]);
-         else
-           oappend (names32[rm + add]);
-         break;
-       case v_mode:
-         USED_REX (REX_MODE64);
-         if (rex & REX_MODE64)
-           oappend (names64[rm + add]);
-         else if (sizeflag & DFLAG)
-           oappend (names32[rm + add]);
-         else
-           oappend (names16[rm + add]);
-         used_prefixes |= (prefixes & PREFIX_DATA);
-         break;
-       case 0:
-         if (!(codep[-2] == 0xAE && codep[-1] == 0xF8 /* sfence */)
-             && !(codep[-2] == 0xAE && codep[-1] == 0xF0 /* mfence */)
-             && !(codep[-2] == 0xAE && codep[-1] == 0xe8 /* lfence */))
-           BadOp ();   /* bad sfence,lea,lds,les,lfs,lgs,lss modrm */
-         break;
-       default:
-         oappend (INTERNAL_DISASSEMBLER_ERROR);
-         break;
-       }
-      return;
-    }
-
-  disp = 0;
-  append_seg ();
-
-  if ((sizeflag & AFLAG) || mode_64bit) /* 32 bit address mode */
-    {
-      int havesib;
-      int havebase;
-      int base;
-      int index = 0;
-      int scale = 0;
-
-      havesib = 0;
-      havebase = 1;
-      base = rm;
-
-      if (base == 4)
-       {
-         havesib = 1;
-         FETCH_DATA (the_info, codep + 1);
-         scale = (*codep >> 6) & 3;
-         index = (*codep >> 3) & 7;
-         base = *codep & 7;
-         USED_REX (REX_EXTY);
-         USED_REX (REX_EXTZ);
-         if (rex & REX_EXTY)
-           index += 8;
-         if (rex & REX_EXTZ)
-           base += 8;
-         codep++;
-       }
-
-      switch (mod)
-       {
-       case 0:
-         if ((base & 7) == 5)
-           {
-             havebase = 0;
-             if (mode_64bit && !havesib && (sizeflag & AFLAG))
-               riprel = 1;
-             disp = get32s ();
-           }
-         break;
-       case 1:
-         FETCH_DATA (the_info, codep + 1);
-         disp = *codep++;
-         if ((disp & 0x80) != 0)
-           disp -= 0x100;
-         break;
-       case 2:
-         disp = get32s ();
-         break;
-       }
-
-      if (!intel_syntax)
-        if (mod != 0 || (base & 7) == 5)
-          {
-           print_operand_value (scratchbuf, !riprel, disp);
-            oappend (scratchbuf);
-           if (riprel)
-             {
-               set_op (disp, 1);
-               oappend ("(%rip)");
-             }
-          }
-
-      if (havebase || (havesib && (index != 4 || scale != 0)))
-       {
-          if (intel_syntax)
-            {
-              switch (bytemode)
-                {
-                case b_mode:
-                  oappend ("BYTE PTR ");
-                  break;
-                case w_mode:
-                  oappend ("WORD PTR ");
-                  break;
-                case v_mode:
-                  oappend ("DWORD PTR ");
-                  break;
-                case d_mode:
-                  oappend ("QWORD PTR ");
-                  break;
-                case m_mode:
-                 if (mode_64bit)
-                   oappend ("DWORD PTR ");
-                 else
-                   oappend ("QWORD PTR ");
-                 break;
-                case x_mode:
-                  oappend ("XWORD PTR ");
-                  break;
-                default:
-                  break;
-                }
-             }
-         *obufp++ = open_char;
-         if (intel_syntax && riprel)
-           oappend ("rip + ");
-          *obufp = '\0';
-         USED_REX (REX_EXTZ);
-         if (!havesib && (rex & REX_EXTZ))
-           base += 8;
-         if (havebase)
-           oappend (mode_64bit && (sizeflag & AFLAG)
-                    ? names64[base] : names32[base]);
-         if (havesib)
-           {
-             if (index != 4)
-               {
-                  if (intel_syntax)
-                    {
-                      if (havebase)
-                        {
-                          *obufp++ = separator_char;
-                          *obufp = '\0';
-                        }
-                      sprintf (scratchbuf, "%s",
-                              mode_64bit && (sizeflag & AFLAG)
-                              ? names64[index] : names32[index]);
-                    }
-                  else
-                   sprintf (scratchbuf, ",%s",
-                            mode_64bit && (sizeflag & AFLAG)
-                            ? names64[index] : names32[index]);
-                 oappend (scratchbuf);
-               }
-              if (!intel_syntax
-                  || (intel_syntax
-                      && bytemode != b_mode
-                      && bytemode != w_mode
-                      && bytemode != v_mode))
-                {
-                  *obufp++ = scale_char;
-                  *obufp = '\0';
-                 sprintf (scratchbuf, "%d", 1 << scale);
-                 oappend (scratchbuf);
-                }
-           }
-          if (intel_syntax)
-            if (mod != 0 || (base & 7) == 5)
-              {
-               /* Don't print zero displacements.  */
-                if (disp != 0)
-                  {
-                   if ((bfd_signed_vma) disp > 0)
-                     {
-                       *obufp++ = '+';
-                       *obufp = '\0';
-                     }
-
-                   print_operand_value (scratchbuf, 0, disp);
-                    oappend (scratchbuf);
-                  }
-              }
-
-         *obufp++ = close_char;
-          *obufp = '\0';
-       }
-      else if (intel_syntax)
-        {
-          if (mod != 0 || (base & 7) == 5)
-            {
-             if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
-                             | PREFIX_ES | PREFIX_FS | PREFIX_GS))
-               ;
-             else
-               {
-                 oappend (names_seg[ds_reg - es_reg]);
-                 oappend (":");
-               }
-             print_operand_value (scratchbuf, 1, disp);
-              oappend (scratchbuf);
-            }
-        }
-    }
-  else
-    { /* 16 bit address mode */
-      switch (mod)
-       {
-       case 0:
-         if ((rm & 7) == 6)
-           {
-             disp = get16 ();
-             if ((disp & 0x8000) != 0)
-               disp -= 0x10000;
-           }
-         break;
-       case 1:
-         FETCH_DATA (the_info, codep + 1);
-         disp = *codep++;
-         if ((disp & 0x80) != 0)
-           disp -= 0x100;
-         break;
-       case 2:
-         disp = get16 ();
-         if ((disp & 0x8000) != 0)
-           disp -= 0x10000;
-         break;
-       }
-
-      if (!intel_syntax)
-        if (mod != 0 || (rm & 7) == 6)
-          {
-           print_operand_value (scratchbuf, 0, disp);
-            oappend (scratchbuf);
-          }
-
-      if (mod != 0 || (rm & 7) != 6)
-       {
-         *obufp++ = open_char;
-          *obufp = '\0';
-         oappend (index16[rm + add]);
-          *obufp++ = close_char;
-          *obufp = '\0';
-       }
-    }
-}
-
-static void
-OP_G (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add += 8;
-  switch (bytemode)
-    {
-    case b_mode:
-      USED_REX (0);
-      if (rex)
-       oappend (names8rex[reg + add]);
-      else
-       oappend (names8[reg + add]);
-      break;
-    case w_mode:
-      oappend (names16[reg + add]);
-      break;
-    case d_mode:
-      oappend (names32[reg + add]);
-      break;
-    case q_mode:
-      oappend (names64[reg + add]);
-      break;
-    case v_mode:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       oappend (names64[reg + add]);
-      else if (sizeflag & DFLAG)
-       oappend (names32[reg + add]);
-      else
-       oappend (names16[reg + add]);
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      break;
-    }
-}
-
-static bfd_vma
-get64 ()
-{
-  bfd_vma x;
-#ifdef BFD64
-  unsigned int a;
-  unsigned int b;
-
-  FETCH_DATA (the_info, codep + 8);
-  a = *codep++ & 0xff;
-  a |= (*codep++ & 0xff) << 8;
-  a |= (*codep++ & 0xff) << 16;
-  a |= (*codep++ & 0xff) << 24;
-  b = *codep++ & 0xff;
-  b |= (*codep++ & 0xff) << 8;
-  b |= (*codep++ & 0xff) << 16;
-  b |= (*codep++ & 0xff) << 24;
-  x = a + ((bfd_vma) b << 32);
-#else
-  abort ();
-  x = 0;
-#endif
-  return x;
-}
-
-static bfd_signed_vma
-get32 ()
-{
-  bfd_signed_vma x = 0;
-
-  FETCH_DATA (the_info, codep + 4);
-  x = *codep++ & (bfd_signed_vma) 0xff;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
-  return x;
-}
-
-static bfd_signed_vma
-get32s ()
-{
-  bfd_signed_vma x = 0;
-
-  FETCH_DATA (the_info, codep + 4);
-  x = *codep++ & (bfd_signed_vma) 0xff;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
-  x |= (*codep++ & (bfd_signed_vma) 0xff) << 24;
-
-  x = (x ^ ((bfd_signed_vma) 1 << 31)) - ((bfd_signed_vma) 1 << 31);
-
-  return x;
-}
-
-static int
-get16 ()
-{
-  int x = 0;
-
-  FETCH_DATA (the_info, codep + 2);
-  x = *codep++ & 0xff;
-  x |= (*codep++ & 0xff) << 8;
-  return x;
-}
-
-static void
-set_op (op, riprel)
-     bfd_vma op;
-     int riprel;
-{
-  op_index[op_ad] = op_ad;
-  if (mode_64bit)
-    {
-      op_address[op_ad] = op;
-      op_riprel[op_ad] = riprel;
-    }
-  else
-    {
-      /* Mask to get a 32-bit address.  */
-      op_address[op_ad] = op & 0xffffffff;
-      op_riprel[op_ad] = riprel & 0xffffffff;
-    }
-}
-
-static void
-OP_REG (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  const char *s;
-  int add = 0;
-  USED_REX (REX_EXTZ);
-  if (rex & REX_EXTZ)
-    add = 8;
-
-  switch (code)
-    {
-    case indir_dx_reg:
-      if (intel_syntax)
-        s = "[dx]";
-      else
-        s = "(%dx)";
-      break;
-    case ax_reg: case cx_reg: case dx_reg: case bx_reg:
-    case sp_reg: case bp_reg: case si_reg: case di_reg:
-      s = names16[code - ax_reg + add];
-      break;
-    case es_reg: case ss_reg: case cs_reg:
-    case ds_reg: case fs_reg: case gs_reg:
-      s = names_seg[code - es_reg + add];
-      break;
-    case al_reg: case ah_reg: case cl_reg: case ch_reg:
-    case dl_reg: case dh_reg: case bl_reg: case bh_reg:
-      USED_REX (0);
-      if (rex)
-       s = names8rex[code - al_reg + add];
-      else
-       s = names8[code - al_reg];
-      break;
-    case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
-    case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
-      if (mode_64bit)
-       {
-         s = names64[code - rAX_reg + add];
-         break;
-       }
-      code += eAX_reg - rAX_reg;
-      /* Fall through.  */
-    case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
-    case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       s = names64[code - eAX_reg + add];
-      else if (sizeflag & DFLAG)
-       s = names32[code - eAX_reg + add];
-      else
-       s = names16[code - eAX_reg + add];
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    default:
-      s = INTERNAL_DISASSEMBLER_ERROR;
-      break;
-    }
-  oappend (s);
-}
-
-static void
-OP_IMREG (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  const char *s;
-
-  switch (code)
-    {
-    case indir_dx_reg:
-      if (intel_syntax)
-        s = "[dx]";
-      else
-        s = "(%dx)";
-      break;
-    case ax_reg: case cx_reg: case dx_reg: case bx_reg:
-    case sp_reg: case bp_reg: case si_reg: case di_reg:
-      s = names16[code - ax_reg];
-      break;
-    case es_reg: case ss_reg: case cs_reg:
-    case ds_reg: case fs_reg: case gs_reg:
-      s = names_seg[code - es_reg];
-      break;
-    case al_reg: case ah_reg: case cl_reg: case ch_reg:
-    case dl_reg: case dh_reg: case bl_reg: case bh_reg:
-      USED_REX (0);
-      if (rex)
-       s = names8rex[code - al_reg];
-      else
-       s = names8[code - al_reg];
-      break;
-    case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg:
-    case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       s = names64[code - eAX_reg];
-      else if (sizeflag & DFLAG)
-       s = names32[code - eAX_reg];
-      else
-       s = names16[code - eAX_reg];
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    default:
-      s = INTERNAL_DISASSEMBLER_ERROR;
-      break;
-    }
-  oappend (s);
-}
-
-static void
-OP_I (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_signed_vma op;
-  bfd_signed_vma mask = -1;
-
-  switch (bytemode)
-    {
-    case b_mode:
-      FETCH_DATA (the_info, codep + 1);
-      op = *codep++;
-      mask = 0xff;
-      break;
-    case q_mode:
-      if (mode_64bit)
-       {
-         op = get32s ();
-         break;
-       }
-      /* Fall through.  */
-    case v_mode:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       op = get32s ();
-      else if (sizeflag & DFLAG)
-       {
-         op = get32 ();
-         mask = 0xffffffff;
-       }
-      else
-       {
-         op = get16 ();
-         mask = 0xfffff;
-       }
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    case w_mode:
-      mask = 0xfffff;
-      op = get16 ();
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      return;
-    }
-
-  op &= mask;
-  scratchbuf[0] = '$';
-  print_operand_value (scratchbuf + 1, 1, op);
-  oappend (scratchbuf + intel_syntax);
-  scratchbuf[0] = '\0';
-}
-
-static void
-OP_I64 (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_signed_vma op;
-  bfd_signed_vma mask = -1;
-
-  if (!mode_64bit)
-    {
-      OP_I (bytemode, sizeflag);
-      return;
-    }
-
-  switch (bytemode)
-    {
-    case b_mode:
-      FETCH_DATA (the_info, codep + 1);
-      op = *codep++;
-      mask = 0xff;
-      break;
-    case v_mode:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       op = get64 ();
-      else if (sizeflag & DFLAG)
-       {
-         op = get32 ();
-         mask = 0xffffffff;
-       }
-      else
-       {
-         op = get16 ();
-         mask = 0xfffff;
-       }
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    case w_mode:
-      mask = 0xfffff;
-      op = get16 ();
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      return;
-    }
-
-  op &= mask;
-  scratchbuf[0] = '$';
-  print_operand_value (scratchbuf + 1, 1, op);
-  oappend (scratchbuf + intel_syntax);
-  scratchbuf[0] = '\0';
-}
-
-static void
-OP_sI (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_signed_vma op;
-  bfd_signed_vma mask = -1;
-
-  switch (bytemode)
-    {
-    case b_mode:
-      FETCH_DATA (the_info, codep + 1);
-      op = *codep++;
-      if ((op & 0x80) != 0)
-       op -= 0x100;
-      mask = 0xffffffff;
-      break;
-    case v_mode:
-      USED_REX (REX_MODE64);
-      if (rex & REX_MODE64)
-       op = get32s ();
-      else if (sizeflag & DFLAG)
-       {
-         op = get32s ();
-         mask = 0xffffffff;
-       }
-      else
-       {
-         mask = 0xffffffff;
-         op = get16 ();
-         if ((op & 0x8000) != 0)
-           op -= 0x10000;
-       }
-      used_prefixes |= (prefixes & PREFIX_DATA);
-      break;
-    case w_mode:
-      op = get16 ();
-      mask = 0xffffffff;
-      if ((op & 0x8000) != 0)
-       op -= 0x10000;
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      return;
-    }
-
-  scratchbuf[0] = '$';
-  print_operand_value (scratchbuf + 1, 1, op);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_J (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  bfd_vma disp;
-  bfd_vma mask = -1;
-
-  switch (bytemode)
-    {
-    case b_mode:
-      FETCH_DATA (the_info, codep + 1);
-      disp = *codep++;
-      if ((disp & 0x80) != 0)
-       disp -= 0x100;
-      break;
-    case v_mode:
-      if (sizeflag & DFLAG)
-       disp = get32s ();
-      else
-       {
-         disp = get16 ();
-         /* For some reason, a data16 prefix on a jump instruction
-            means that the pc is masked to 16 bits after the
-            displacement is added!  */
-         mask = 0xffff;
-       }
-      break;
-    default:
-      oappend (INTERNAL_DISASSEMBLER_ERROR);
-      return;
-    }
-  disp = (start_pc + codep - start_codep + disp) & mask;
-  set_op (disp, 0);
-  print_operand_value (scratchbuf, 1, disp);
-  oappend (scratchbuf);
-}
-
-static void
-OP_SEG (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  oappend (names_seg[reg]);
-}
-
-static void
-OP_DIR (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag;
-{
-  int seg, offset;
-
-  if (sizeflag & DFLAG)
-    {
-      offset = get32 ();
-      seg = get16 ();
-    }
-  else
-    {
-      offset = get16 ();
-      seg = get16 ();
-    }
-  used_prefixes |= (prefixes & PREFIX_DATA);
-  if (intel_syntax)
-    sprintf (scratchbuf, "0x%x,0x%x", seg, offset);
-  else
-    sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
-  oappend (scratchbuf);
-}
-
-static void
-OP_OFF (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag;
-{
-  bfd_vma off;
-
-  append_seg ();
-
-  if ((sizeflag & AFLAG) || mode_64bit)
-    off = get32 ();
-  else
-    off = get16 ();
-
-  if (intel_syntax)
-    {
-      if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
-                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
-       {
-         oappend (names_seg[ds_reg - es_reg]);
-         oappend (":");
-       }
-    }
-  print_operand_value (scratchbuf, 1, off);
-  oappend (scratchbuf);
-}
-
-static void
-OP_OFF64 (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  bfd_vma off;
-
-  if (!mode_64bit)
-    {
-      OP_OFF (bytemode, sizeflag);
-      return;
-    }
-
-  append_seg ();
-
-  off = get64 ();
-
-  if (intel_syntax)
-    {
-      if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
-                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
-       {
-         oappend (names_seg[ds_reg - es_reg]);
-         oappend (":");
-       }
-    }
-  print_operand_value (scratchbuf, 1, off);
-  oappend (scratchbuf);
-}
-
-static void
-ptr_reg (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  const char *s;
-  if (intel_syntax)
-    oappend ("[");
-  else
-    oappend ("(");
-
-  USED_REX (REX_MODE64);
-  if (rex & REX_MODE64)
-    {
-      if (!(sizeflag & AFLAG))
-        s = names32[code - eAX_reg];
-      else
-        s = names64[code - eAX_reg];
-    }
-  else if (sizeflag & AFLAG)
-    s = names32[code - eAX_reg];
-  else
-    s = names16[code - eAX_reg];
-  oappend (s);
-  if (intel_syntax)
-    oappend ("]");
-  else
-    oappend (")");
-}
-
-static void
-OP_ESreg (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  oappend ("%es:" + intel_syntax);
-  ptr_reg (code, sizeflag);
-}
-
-static void
-OP_DSreg (code, sizeflag)
-     int code;
-     int sizeflag;
-{
-  if ((prefixes
-       & (PREFIX_CS
-         | PREFIX_DS
-         | PREFIX_SS
-         | PREFIX_ES
-         | PREFIX_FS
-         | PREFIX_GS)) == 0)
-    prefixes |= PREFIX_DS;
-  append_seg ();
-  ptr_reg (code, sizeflag);
-}
-
-static void
-OP_C (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add = 8;
-  sprintf (scratchbuf, "%%cr%d", reg + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_D (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add = 8;
-  if (intel_syntax)
-    sprintf (scratchbuf, "db%d", reg + add);
-  else
-    sprintf (scratchbuf, "%%db%d", reg + add);
-  oappend (scratchbuf);
-}
-
-static void
-OP_T (dummy, sizeflag)
-     int dummy ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  sprintf (scratchbuf, "%%tr%d", reg);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_Rd (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  if (mod == 3)
-    OP_E (bytemode, sizeflag);
-  else
-    BadOp ();
-}
-
-static void
-OP_MMX (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add = 8;
-  used_prefixes |= (prefixes & PREFIX_DATA);
-  if (prefixes & PREFIX_DATA)
-    sprintf (scratchbuf, "%%xmm%d", reg + add);
-  else
-    sprintf (scratchbuf, "%%mm%d", reg + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_XMM (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  int add = 0;
-  USED_REX (REX_EXTX);
-  if (rex & REX_EXTX)
-    add = 8;
-  sprintf (scratchbuf, "%%xmm%d", reg + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_EM (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  int add = 0;
-  if (mod != 3)
-    {
-      OP_E (bytemode, sizeflag);
-      return;
-    }
-  USED_REX (REX_EXTZ);
-  if (rex & REX_EXTZ)
-    add = 8;
-
-  /* Skip mod/rm byte.  */
-  MODRM_CHECK;
-  codep++;
-  used_prefixes |= (prefixes & PREFIX_DATA);
-  if (prefixes & PREFIX_DATA)
-    sprintf (scratchbuf, "%%xmm%d", rm + add);
-  else
-    sprintf (scratchbuf, "%%mm%d", rm + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_EX (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  int add = 0;
-  if (mod != 3)
-    {
-      OP_E (bytemode, sizeflag);
-      return;
-    }
-  USED_REX (REX_EXTZ);
-  if (rex & REX_EXTZ)
-    add = 8;
-
-  /* Skip mod/rm byte.  */
-  MODRM_CHECK;
-  codep++;
-  sprintf (scratchbuf, "%%xmm%d", rm + add);
-  oappend (scratchbuf + intel_syntax);
-}
-
-static void
-OP_MS (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  if (mod == 3)
-    OP_EM (bytemode, sizeflag);
-  else
-    BadOp ();
-}
-
-static void
-OP_XS (bytemode, sizeflag)
-     int bytemode;
-     int sizeflag;
-{
-  if (mod == 3)
-    OP_EX (bytemode, sizeflag);
-  else
-    BadOp ();
-}
-
-static const char *Suffix3DNow[] = {
-/* 00 */       NULL,           NULL,           NULL,           NULL,
-/* 04 */       NULL,           NULL,           NULL,           NULL,
-/* 08 */       NULL,           NULL,           NULL,           NULL,
-/* 0C */       "pi2fw",        "pi2fd",        NULL,           NULL,
-/* 10 */       NULL,           NULL,           NULL,           NULL,
-/* 14 */       NULL,           NULL,           NULL,           NULL,
-/* 18 */       NULL,           NULL,           NULL,           NULL,
-/* 1C */       "pf2iw",        "pf2id",        NULL,           NULL,
-/* 20 */       NULL,           NULL,           NULL,           NULL,
-/* 24 */       NULL,           NULL,           NULL,           NULL,
-/* 28 */       NULL,           NULL,           NULL,           NULL,
-/* 2C */       NULL,           NULL,           NULL,           NULL,
-/* 30 */       NULL,           NULL,           NULL,           NULL,
-/* 34 */       NULL,           NULL,           NULL,           NULL,
-/* 38 */       NULL,           NULL,           NULL,           NULL,
-/* 3C */       NULL,           NULL,           NULL,           NULL,
-/* 40 */       NULL,           NULL,           NULL,           NULL,
-/* 44 */       NULL,           NULL,           NULL,           NULL,
-/* 48 */       NULL,           NULL,           NULL,           NULL,
-/* 4C */       NULL,           NULL,           NULL,           NULL,
-/* 50 */       NULL,           NULL,           NULL,           NULL,
-/* 54 */       NULL,           NULL,           NULL,           NULL,
-/* 58 */       NULL,           NULL,           NULL,           NULL,
-/* 5C */       NULL,           NULL,           NULL,           NULL,
-/* 60 */       NULL,           NULL,           NULL,           NULL,
-/* 64 */       NULL,           NULL,           NULL,           NULL,
-/* 68 */       NULL,           NULL,           NULL,           NULL,
-/* 6C */       NULL,           NULL,           NULL,           NULL,
-/* 70 */       NULL,           NULL,           NULL,           NULL,
-/* 74 */       NULL,           NULL,           NULL,           NULL,
-/* 78 */       NULL,           NULL,           NULL,           NULL,
-/* 7C */       NULL,           NULL,           NULL,           NULL,
-/* 80 */       NULL,           NULL,           NULL,           NULL,
-/* 84 */       NULL,           NULL,           NULL,           NULL,
-/* 88 */       NULL,           NULL,           "pfnacc",       NULL,
-/* 8C */       NULL,           NULL,           "pfpnacc",      NULL,
-/* 90 */       "pfcmpge",      NULL,           NULL,           NULL,
-/* 94 */       "pfmin",        NULL,           "pfrcp",        "pfrsqrt",
-/* 98 */       NULL,           NULL,           "pfsub",        NULL,
-/* 9C */       NULL,           NULL,           "pfadd",        NULL,
-/* A0 */       "pfcmpgt",      NULL,           NULL,           NULL,
-/* A4 */       "pfmax",        NULL,           "pfrcpit1",     "pfrsqit1",
-/* A8 */       NULL,           NULL,           "pfsubr",       NULL,
-/* AC */       NULL,           NULL,           "pfacc",        NULL,
-/* B0 */       "pfcmpeq",      NULL,           NULL,           NULL,
-/* B4 */       "pfmul",        NULL,           "pfrcpit2",     "pfmulhrw",
-/* B8 */       NULL,           NULL,           NULL,           "pswapd",
-/* BC */       NULL,           NULL,           NULL,           "pavgusb",
-/* C0 */       NULL,           NULL,           NULL,           NULL,
-/* C4 */       NULL,           NULL,           NULL,           NULL,
-/* C8 */       NULL,           NULL,           NULL,           NULL,
-/* CC */       NULL,           NULL,           NULL,           NULL,
-/* D0 */       NULL,           NULL,           NULL,           NULL,
-/* D4 */       NULL,           NULL,           NULL,           NULL,
-/* D8 */       NULL,           NULL,           NULL,           NULL,
-/* DC */       NULL,           NULL,           NULL,           NULL,
-/* E0 */       NULL,           NULL,           NULL,           NULL,
-/* E4 */       NULL,           NULL,           NULL,           NULL,
-/* E8 */       NULL,           NULL,           NULL,           NULL,
-/* EC */       NULL,           NULL,           NULL,           NULL,
-/* F0 */       NULL,           NULL,           NULL,           NULL,
-/* F4 */       NULL,           NULL,           NULL,           NULL,
-/* F8 */       NULL,           NULL,           NULL,           NULL,
-/* FC */       NULL,           NULL,           NULL,           NULL,
-};
-
-static void
-OP_3DNowSuffix (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  const char *mnemonic;
-
-  FETCH_DATA (the_info, codep + 1);
-  /* AMD 3DNow! instructions are specified by an opcode suffix in the
-     place where an 8-bit immediate would normally go.  ie. the last
-     byte of the instruction.  */
-  obufp = obuf + strlen (obuf);
-  mnemonic = Suffix3DNow[*codep++ & 0xff];
-  if (mnemonic)
-    oappend (mnemonic);
-  else
-    {
-      /* Since a variable sized modrm/sib chunk is between the start
-        of the opcode (0x0f0f) and the opcode suffix, we need to do
-        all the modrm processing first, and don't know until now that
-        we have a bad opcode.  This necessitates some cleaning up.  */
-      op1out[0] = '\0';
-      op2out[0] = '\0';
-      BadOp ();
-    }
-}
-
-static const char *simd_cmp_op[] = {
-  "eq",
-  "lt",
-  "le",
-  "unord",
-  "neq",
-  "nlt",
-  "nle",
-  "ord"
-};
-
-static void
-OP_SIMD_Suffix (bytemode, sizeflag)
-     int bytemode ATTRIBUTE_UNUSED;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  unsigned int cmp_type;
-
-  FETCH_DATA (the_info, codep + 1);
-  obufp = obuf + strlen (obuf);
-  cmp_type = *codep++ & 0xff;
-  if (cmp_type < 8)
-    {
-      char suffix1 = 'p', suffix2 = 's';
-      used_prefixes |= (prefixes & PREFIX_REPZ);
-      if (prefixes & PREFIX_REPZ)
-       suffix1 = 's';
-      else
-       {
-         used_prefixes |= (prefixes & PREFIX_DATA);
-         if (prefixes & PREFIX_DATA)
-           suffix2 = 'd';
-         else
-           {
-             used_prefixes |= (prefixes & PREFIX_REPNZ);
-             if (prefixes & PREFIX_REPNZ)
-               suffix1 = 's', suffix2 = 'd';
-           }
-       }
-      sprintf (scratchbuf, "cmp%s%c%c",
-              simd_cmp_op[cmp_type], suffix1, suffix2);
-      used_prefixes |= (prefixes & PREFIX_REPZ);
-      oappend (scratchbuf);
-    }
-  else
-    {
-      /* We have a bad extension byte.  Clean up.  */
-      op1out[0] = '\0';
-      op2out[0] = '\0';
-      BadOp ();
-    }
-}
-
-static void
-SIMD_Fixup (extrachar, sizeflag)
-     int extrachar;
-     int sizeflag ATTRIBUTE_UNUSED;
-{
-  /* Change movlps/movhps to movhlps/movlhps for 2 register operand
-     forms of these instructions.  */
-  if (mod == 3)
-    {
-      char *p = obuf + strlen (obuf);
-      *(p + 1) = '\0';
-      *p       = *(p - 1);
-      *(p - 1) = *(p - 2);
-      *(p - 2) = *(p - 3);
-      *(p - 3) = extrachar;
-    }
-}
-
-static void
-BadOp (void)
-{
-  /* Throw away prefixes and 1st. opcode byte.  */
-  codep = insn_codep + 1;
-  oappend ("(bad)");
-}
diff --git a/x86_64/methodtable.c b/x86_64/methodtable.c
deleted file mode 100644 (file)
index 31b0219..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/* x86_64/methodtable.c ********************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Contains the codegenerator for an x86_64 processor.
-    This module generates x86_64 machine code for a sequence of
-    pseudo commands (ICMDs).
-
-    Authors: Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: methodtable.c 414 2003-08-23 23:45:58Z twisti $
-
-*******************************************************************************/
-
-#include "methodtable.h"
-
-static mtentry *mtroot = NULL;
-
-
-
-void addmethod(u1 *start, u1 *end)
-{
-  /* boehm makes problems with jvm98 db */
-/*  #ifdef USE_BOEHM */
-/*      mtentry *mte = GCNEW(mtentry, 1); */
-/*  #else */
-    mtentry *mte = NEW(mtentry);
-/*  #endif */
-
-/*      fprintf(stderr, "start=%lx end=%lx\n", start, end); */
-
-    if (mtroot == NULL) {
-/*  #ifdef USE_BOEHM */
-/*          mtentry *tmp = GCNEW(mtentry, 1); */
-/*  #else */
-        mtentry *tmp = NEW(mtentry);
-/*  #endif */
-       tmp->start = (u1 *) asm_calljavamethod;
-       tmp->end = (u1 *) asm_calljavafunction;    /* little hack, but should work */
-       tmp->next = mtroot;
-       mtroot = tmp;
-
-/*  #ifdef USE_BOEHM */
-/*          tmp = GCNEW(mtentry, 1); */
-/*  #else */
-        tmp = NEW(mtentry);
-/*  #endif */
-       tmp->start = (u1 *) asm_calljavafunction;
-       tmp->end = (u1 *) asm_call_jit_compiler;    /* little hack, but should work */
-       tmp->next = mtroot;
-       mtroot = tmp;
-    }
-
-    mte->start = start;
-    mte->end = end;
-    mte->next = mtroot;
-    mtroot = mte;
-}
-
-
-
-u1 *findmethod(u1 *pos)
-{
-    mtentry *mte = mtroot;
-
-/*      printf("findmethod: start\n"); */
-
-    while (mte != NULL) {
-/*          printf("%p <= %p <= %p\n", mte->start, pos, mte->end); */
-          
-       if (mte->start <= pos && pos <= mte->end) {
-           return mte->start;
-
-       } else {
-           mte = mte->next;
-       }
-    }
-       
-    printf("can't find method with rip=%p\n", pos);
-    exit(-1);
-}
-
-
-
-void asmprintf(s8 x)
-{
-    printf("val=%lx\n", x);
-    fflush(stdout);
-}
diff --git a/x86_64/methodtable.h b/x86_64/methodtable.h
deleted file mode 100644 (file)
index f0edd7d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* x86_64/methodtable.h ********************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Contains the codegenerator for an i386 processor.
-    This module generates i386 machine code for a sequence of
-    pseudo commands (ICMDs).
-
-    Authors: Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: methodtable.h 388 2003-07-10 16:49:05Z twisti $
-
-*******************************************************************************/
-
-#ifndef _METHODTABLE_H
-#define _METHODTABLE_H
-
-typedef struct _mtentry mtentry;
-
-struct _mtentry {
-    u1 *start;
-    u1 *end;
-    mtentry *next;
-};
-
-void addmethod(u1 *start, u1 *end);
-u1 *findmethod(u1 *pos);
-
-#endif
diff --git a/x86_64/native-math.h b/x86_64/native-math.h
deleted file mode 100644 (file)
index 37b2396..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* x86_64/native-math.h ********************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Contains the machine-specific floating point definitions.
-
-    Authors: Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-             Andreas Krall       EMAIL: cacao@complang.tuwien.ac.at
-             Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: native-math.h 465 2003-09-17 23:14:48Z twisti $
-
-*******************************************************************************/
-
-#ifndef _NATIVE_MATH_H
-#define _NATIVE_MATH_H
-
-/* include machine-specific math.h */
-
-#include <math.h>
-
-/* define infinity for floating point numbers */
-
-static u4 flt_nan    = 0x7fc00000;
-static u4 flt_posinf = 0x7f800000;
-static u4 flt_neginf = 0xff800000;
-
-#define FLT_NAN     (*((float*) (&flt_nan)))
-#define FLT_POSINF  (*((float*) (&flt_posinf)))
-#define FLT_NEGINF  (*((float*) (&flt_neginf)))
-
-/* define infinity for double floating point numbers */
-
-static u8 dbl_nan    = 0x7ff8000000000000L;
-static u8 dbl_posinf = 0x7ff0000000000000L;
-static u8 dbl_neginf = 0xfff0000000000000L;
-
-#define DBL_NAN     (*((double*) (&dbl_nan)))
-#define DBL_POSINF  (*((double*) (&dbl_posinf)))
-#define DBL_NEGINF  (*((double*) (&dbl_neginf)))
-
-#endif
diff --git a/x86_64/ngen.c b/x86_64/ngen.c
deleted file mode 100644 (file)
index bfa98de..0000000
+++ /dev/null
@@ -1,5594 +0,0 @@
-/* x86_64/ngen.c ***************************************************************
-
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-       See file COPYRIGHT for information on usage and disclaimer of warranties
-
-       Contains the codegenerator for an x86_64 processor.
-       This module generates x86_64 machine code for a sequence of
-       pseudo commands (ICMDs).
-
-       Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-                        Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-       Last Change: $Id: ngen.c 546 2003-11-01 19:21:58Z twisti $
-
-*******************************************************************************/
-
-#include "jitdef.h"   /* phil */
-#include "methodtable.c"
-
-/* additional functions and macros to generate code ***************************/
-
-#define BlockPtrOfPC(pc)  ((basicblock *) iptr->target)
-
-
-#ifdef STATISTICS
-#define COUNT_SPILLS count_spills++
-#else
-#define COUNT_SPILLS
-#endif
-
-
-#define CALCOFFSETBYTES(var, reg, val) \
-    if ((s4) (val) < -128 || (s4) (val) > 127) (var) += 4; \
-    else if ((s4) (val) != 0) (var) += 1; \
-    else if ((reg) == RBP || (reg) == RSP || (reg) == R12 || (reg) == R13) (var) += 1;
-
-
-#define CALCREGOFFBYTES(var, val) \
-    if ((val) > 15) (var) += 4; \
-    else if ((val) != 0) (var) += 1;
-
-
-#define CALCIMMEDIATEBYTES(var, val) \
-    if ((s4) (val) < -128 || (s4) (val) > 127) (var) += 4; \
-    else (var) += 1;
-
-
-/* gen_nullptr_check(objreg) */
-
-#ifdef SOFTNULLPTRCHECK
-#define gen_nullptr_check(objreg) \
-       if (checknull) { \
-        x86_64_test_reg_reg((objreg), (objreg)); \
-        x86_64_jcc(X86_64_CC_E, 0); \
-           mcode_addxnullrefs(mcodeptr); \
-       }
-#else
-#define gen_nullptr_check(objreg)
-#endif
-
-
-/* MCODECHECK(icnt) */
-
-#define MCODECHECK(icnt) \
-       if ((mcodeptr + (icnt)) > (u1*) mcodeend) mcodeptr = (u1*) mcode_increase((u1*) mcodeptr)
-
-/* M_INTMOVE:
-    generates an integer-move from register a to b.
-    if a and b are the same int-register, no code will be generated.
-*/ 
-
-#define M_INTMOVE(reg,dreg) \
-    if ((reg) != (dreg)) { \
-        x86_64_mov_reg_reg((reg),(dreg)); \
-    }
-
-
-/* M_FLTMOVE:
-    generates a floating-point-move from register a to b.
-    if a and b are the same float-register, no code will be generated
-*/ 
-
-#define M_FLTMOVE(reg,dreg) \
-    if ((reg) != (dreg)) { \
-        x86_64_movq_reg_reg((reg),(dreg)); \
-    }
-
-
-/* var_to_reg_xxx:
-    this function generates code to fetch data from a pseudo-register
-    into a real register. 
-    If the pseudo-register has actually been assigned to a real 
-    register, no code will be emitted, since following operations
-    can use this register directly.
-    
-    v: pseudoregister to be fetched from
-    tempregnum: temporary register to be used if v is actually spilled to ram
-
-    return: the register number, where the operand can be found after 
-            fetching (this wil be either tempregnum or the register
-            number allready given to v)
-*/
-
-#define var_to_reg_int(regnr,v,tempnr) \
-    if ((v)->flags & INMEMORY) { \
-        COUNT_SPILLS; \
-        if ((v)->type == TYPE_INT) { \
-            x86_64_movl_membase_reg(REG_SP, (v)->regoff * 8, tempnr); \
-        } else { \
-            x86_64_mov_membase_reg(REG_SP, (v)->regoff * 8, tempnr); \
-        } \
-        regnr = tempnr; \
-    } else { \
-        regnr = (v)->regoff; \
-    }
-
-
-
-#define var_to_reg_flt(regnr,v,tempnr) \
-    if ((v)->flags & INMEMORY) { \
-        COUNT_SPILLS; \
-        if ((v)->type == TYPE_FLT) { \
-            x86_64_movlps_membase_reg(REG_SP, (v)->regoff * 8, tempnr); \
-        } else { \
-            x86_64_movlpd_membase_reg(REG_SP, (v)->regoff * 8, tempnr); \
-        } \
-/*        x86_64_movq_membase_reg(REG_SP, (v)->regoff * 8, tempnr);*/ \
-        regnr = tempnr; \
-    } else { \
-        regnr = (v)->regoff; \
-    }
-
-
-/* reg_of_var:
-    This function determines a register, to which the result of an operation
-    should go, when it is ultimatively intended to store the result in
-    pseudoregister v.
-    If v is assigned to an actual register, this register will be returned.
-    Otherwise (when v is spilled) this function returns tempregnum.
-    If not already done, regoff and flags are set in the stack location.
-*/        
-
-static int reg_of_var(stackptr v, int tempregnum)
-{
-       varinfo      *var;
-
-       switch (v->varkind) {
-               case TEMPVAR:
-                       if (!(v->flags & INMEMORY))
-                               return(v->regoff);
-                       break;
-               case STACKVAR:
-                       var = &(interfaces[v->varnum][v->type]);
-                       v->regoff = var->regoff;
-                       if (!(var->flags & INMEMORY))
-                               return(var->regoff);
-                       break;
-               case LOCALVAR:
-                       var = &(locals[v->varnum][v->type]);
-                       v->regoff = var->regoff;
-                       if (!(var->flags & INMEMORY))
-                               return(var->regoff);
-                       break;
-               case ARGVAR:
-                       v->regoff = v->varnum;
-                       if (IS_FLT_DBL_TYPE(v->type)) {
-                               if (v->varnum < fltreg_argnum) {
-                                       v->regoff = argfltregs[v->varnum];
-                                       return(argfltregs[v->varnum]);
-                               }
-                       } else {
-                               if (v->varnum < intreg_argnum) {
-                                       v->regoff = argintregs[v->varnum];
-                                       return(argintregs[v->varnum]);
-                               }
-                       }
-                       v->regoff -= intreg_argnum;
-                       break;
-               }
-       v->flags |= INMEMORY;
-       return tempregnum;
-}
-
-
-/* store_reg_to_var_xxx:
-    This function generates the code to store the result of an operation
-    back into a spilled pseudo-variable.
-    If the pseudo-variable has not been spilled in the first place, this 
-    function will generate nothing.
-    
-    v ............ Pseudovariable
-    tempregnum ... Number of the temporary registers as returned by
-                   reg_of_var.
-*/     
-
-#define store_reg_to_var_int(sptr, tempregnum) \
-    if ((sptr)->flags & INMEMORY) { \
-        COUNT_SPILLS; \
-        x86_64_mov_reg_membase(tempregnum, REG_SP, (sptr)->regoff * 8); \
-    }
-
-
-#define store_reg_to_var_flt(sptr, tempregnum) \
-    if ((sptr)->flags & INMEMORY) { \
-         COUNT_SPILLS; \
-         x86_64_movq_reg_membase(tempregnum, REG_SP, (sptr)->regoff * 8); \
-    }
-
-
-/* NullPointerException signal handler for hardware null pointer check */
-
-void catch_NullPointerException(int sig, siginfo_t *siginfo, void *_p)
-{
-       sigset_t nsig;
-/*     int      instr; */
-/*     long     faultaddr; */
-
-       struct ucontext *_uc = (struct ucontext *) _p;
-       struct sigcontext *sigctx = (struct sigcontext *) &_uc->uc_mcontext;
-
-       /* Reset signal handler - necessary for SysV, does no harm for BSD */
-
-       
-/*     instr = *((int*)(sigctx->rip)); */
-/*     faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f]; */
-
-/*     if (faultaddr == 0) { */
-               signal(sig, (void *) catch_NullPointerException);          /* reinstall handler */
-               sigemptyset(&nsig);
-               sigaddset(&nsig, sig);
-               sigprocmask(SIG_UNBLOCK, &nsig, NULL);                     /* unblock signal    */
-               sigctx->rax = (long) proto_java_lang_NullPointerException; /* REG_ITMP1_XPTR    */
-               sigctx->r10 = sigctx->rip;                                 /* REG_ITMP2_XPC     */
-               sigctx->rip = (long) asm_handle_exception;
-
-               return;
-
-/*     } else { */
-/*             faultaddr += (long) ((instr << 16) >> 16); */
-/*             fprintf(stderr, "faulting address: 0x%08x\n", faultaddr); */
-/*             panic("Stack overflow"); */
-/*     } */
-}
-
-
-/* ArithmeticException signal handler for hardware divide by zero check */
-
-void catch_ArithmeticException(int sig, siginfo_t *siginfo, void *_p)
-{
-       sigset_t nsig;
-
-       struct ucontext *_uc = (struct ucontext *) _p;
-       struct sigcontext *sigctx = (struct sigcontext *) &_uc->uc_mcontext;
-
-       classinfo *c;
-       java_objectheader *p;
-       methodinfo *m;
-
-       /* Reset signal handler - necessary for SysV, does no harm for BSD */
-
-       signal(sig, (void *) catch_ArithmeticException);     /* reinstall handler */
-       sigemptyset(&nsig);
-       sigaddset(&nsig, sig);
-       sigprocmask(SIG_UNBLOCK, &nsig, NULL);               /* unblock signal    */
-
-       c = loader_load(utf_new_char("java/lang/ArithmeticException"));
-       p = builtin_new(c);
-       m = class_findmethod(c, 
-                                                utf_new_char("<init>"), 
-                                                utf_new_char("(Ljava/lang/String;)V"));
-
-       asm_calljavamethod(m, p, javastring_new_char("/ by zero"), NULL, NULL);
-
-       sigctx->rax = (long) p;                              /* REG_ITMP1_XPTR    */
-       sigctx->r10 = sigctx->rip;                           /* REG_ITMP2_XPC     */
-       sigctx->rip = (long) asm_handle_exception;
-
-       return;
-}
-
-
-void init_exceptions(void)
-{
-       /* install signal handlers we need to convert to exceptions */
-
-       if (!checknull) {
-#if defined(SIGSEGV)
-               signal(SIGSEGV, (void *) catch_NullPointerException);
-#endif
-
-#if defined(SIGBUS)
-               signal(SIGBUS, (void *) catch_NullPointerException);
-#endif
-       }
-
-       signal(SIGFPE, (void *) catch_ArithmeticException);
-}
-
-
-/* function gen_mcode **********************************************************
-
-       generates machine code
-
-*******************************************************************************/
-
-u1          *mcodeptr;
-
-static void gen_mcode()
-{
-       int  len, s1, s2, s3, d /*, bbs */;
-       s8   a;
-       stackptr    src;
-       varinfo     *var;
-/*     varinfo     *dst; */
-       basicblock  *bptr;
-       instruction *iptr;
-
-       xtable *ex;
-
-       {
-       int p, pa, t, l, r;
-
-       savedregs_num = 0;
-
-       /* space to save used callee saved registers */
-
-       savedregs_num += (savintregcnt - maxsavintreguse);
-       savedregs_num += (savfltregcnt - maxsavfltreguse);
-
-       parentargs_base = maxmemuse + savedregs_num;
-
-#ifdef USE_THREADS                 /* space to save argument of monitor_enter */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               parentargs_base++;
-
-#endif
-
-    /* keep stack 16-byte aligned for calls into libc */
-
-       if (!isleafmethod || runverbose) {
-               if ((parentargs_base % 2) == 0) {
-                       parentargs_base++;
-               }
-       }
-
-       /* create method header */
-
-       (void) dseg_addaddress(method);                         /* MethodPointer  */
-       (void) dseg_adds4(parentargs_base * 8);                 /* FrameSize      */
-
-#ifdef USE_THREADS
-
-       /* IsSync contains the offset relative to the stack pointer for the
-          argument of monitor_exit used in the exception handler. Since the
-          offset could be zero and give a wrong meaning of the flag it is
-          offset by one.
-       */
-
-       if (checksync && (method->flags & ACC_SYNCHRONIZED))
-               (void) dseg_adds4((maxmemuse + 1) * 8);             /* IsSync         */
-       else
-
-#endif
-
-       (void) dseg_adds4(0);                                   /* IsSync         */
-                                              
-       (void) dseg_adds4(isleafmethod);                        /* IsLeaf         */
-       (void) dseg_adds4(savintregcnt - maxsavintreguse);      /* IntSave        */
-       (void) dseg_adds4(savfltregcnt - maxsavfltreguse);      /* FltSave        */
-       (void) dseg_adds4(exceptiontablelength);                /* ExTableSize    */
-
-       /* create exception table */
-
-       for (ex = extable; ex != NULL; ex = ex->down) {
-
-#ifdef LOOP_DEBUG      
-               if (ex->start != NULL)
-                       printf("adding start - %d - ", ex->start->debug_nr);
-               else {
-                       printf("PANIC - start is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->start);
-
-#ifdef LOOP_DEBUG                      
-               if (ex->end != NULL)
-                       printf("adding end - %d - ", ex->end->debug_nr);
-               else {
-                       printf("PANIC - end is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->end);
-
-#ifdef LOOP_DEBUG              
-               if (ex->handler != NULL)
-                       printf("adding handler - %d\n", ex->handler->debug_nr);
-               else {
-                       printf("PANIC - handler is NULL");
-                       exit(-1);
-               }
-#endif
-
-               dseg_addtarget(ex->handler);
-          
-               (void) dseg_addaddress(ex->catchtype);
-       }
-       
-       /* initialize mcode variables */
-       
-       mcodeptr = (u1*) mcodebase;
-       mcodeend = (s4*) (mcodebase + mcodesize);
-       MCODECHECK(128 + mparamcount);
-
-       /* create stack frame (if necessary) */
-
-       if (parentargs_base) {
-               x86_64_alu_imm_reg(X86_64_SUB, parentargs_base * 8, REG_SP);
-       }
-
-       /* save return address and used callee saved registers */
-
-       p = parentargs_base;
-       for (r = savintregcnt - 1; r >= maxsavintreguse; r--) {
-               p--; x86_64_mov_reg_membase(savintregs[r], REG_SP, p * 8);
-       }
-       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--) {
-               p--; x86_64_movq_reg_membase(savfltregs[r], REG_SP, p * 8);
-       }
-
-       /* save monitorenter argument */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               if (method->flags & ACC_STATIC) {
-                       x86_64_mov_imm_reg((s8) class, REG_ITMP1);
-                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, maxmemuse * 8);
-
-               } else {
-                       x86_64_mov_reg_membase(argintregs[0], REG_SP, maxmemuse * 8);
-               }
-       }                       
-#endif
-
-       /* copy argument registers to stack and call trace function with pointer
-          to arguments on stack.
-       */
-       if (runverbose) {
-               x86_64_alu_imm_reg(X86_64_SUB, (6 + 8 + 1 + 1) * 8, REG_SP);
-
-               x86_64_mov_reg_membase(argintregs[0], REG_SP, 1 * 8);
-               x86_64_mov_reg_membase(argintregs[1], REG_SP, 2 * 8);
-               x86_64_mov_reg_membase(argintregs[2], REG_SP, 3 * 8);
-               x86_64_mov_reg_membase(argintregs[3], REG_SP, 4 * 8);
-               x86_64_mov_reg_membase(argintregs[4], REG_SP, 5 * 8);
-               x86_64_mov_reg_membase(argintregs[5], REG_SP, 6 * 8);
-
-               x86_64_movq_reg_membase(argfltregs[0], REG_SP, 7 * 8);
-               x86_64_movq_reg_membase(argfltregs[1], REG_SP, 8 * 8);
-               x86_64_movq_reg_membase(argfltregs[2], REG_SP, 9 * 8);
-               x86_64_movq_reg_membase(argfltregs[3], REG_SP, 10 * 8);
-/*             x86_64_movq_reg_membase(argfltregs[4], REG_SP, 11 * 8); */
-/*             x86_64_movq_reg_membase(argfltregs[5], REG_SP, 12 * 8); */
-/*             x86_64_movq_reg_membase(argfltregs[6], REG_SP, 13 * 8); */
-/*             x86_64_movq_reg_membase(argfltregs[7], REG_SP, 14 * 8); */
-
-               for (p = 0, l = 0; p < mparamcount; p++) {
-                       t = mparamtypes[p];
-
-                       if (IS_FLT_DBL_TYPE(t)) {
-                               for (s1 = (mparamcount > intreg_argnum) ? intreg_argnum - 2 : mparamcount - 2; s1 >= p; s1--) {
-                                       x86_64_mov_reg_reg(argintregs[s1], argintregs[s1 + 1]);
-                               }
-
-                               x86_64_movd_freg_reg(argfltregs[l], argintregs[p]);
-                               l++;
-                       }
-               }
-
-               x86_64_mov_imm_reg((s8) method, REG_ITMP2);
-               x86_64_mov_reg_membase(REG_ITMP2, REG_SP, 0 * 8);
-               x86_64_mov_imm_reg((s8) builtin_trace_args, REG_ITMP1);
-               x86_64_call_reg(REG_ITMP1);
-
-               x86_64_mov_membase_reg(REG_SP, 1 * 8, argintregs[0]);
-               x86_64_mov_membase_reg(REG_SP, 2 * 8, argintregs[1]);
-               x86_64_mov_membase_reg(REG_SP, 3 * 8, argintregs[2]);
-               x86_64_mov_membase_reg(REG_SP, 4 * 8, argintregs[3]);
-               x86_64_mov_membase_reg(REG_SP, 5 * 8, argintregs[4]);
-               x86_64_mov_membase_reg(REG_SP, 6 * 8, argintregs[5]);
-
-               x86_64_movq_membase_reg(REG_SP, 7 * 8, argfltregs[0]);
-               x86_64_movq_membase_reg(REG_SP, 8 * 8, argfltregs[1]);
-               x86_64_movq_membase_reg(REG_SP, 9 * 8, argfltregs[2]);
-               x86_64_movq_membase_reg(REG_SP, 10 * 8, argfltregs[3]);
-/*             x86_64_movq_membase_reg(REG_SP, 11 * 8, argfltregs[4]); */
-/*             x86_64_movq_membase_reg(REG_SP, 12 * 8, argfltregs[5]); */
-/*             x86_64_movq_membase_reg(REG_SP, 13 * 8, argfltregs[6]); */
-/*             x86_64_movq_membase_reg(REG_SP, 14 * 8, argfltregs[7]); */
-
-               x86_64_alu_imm_reg(X86_64_ADD, (6 + 8 + 1 + 1) * 8, REG_SP);
-       }
-
-       /* take arguments out of register or stack frame */
-
-       for (p = 0, l = 0, s1 = 0, s2 = 0; p < mparamcount; p++) {
-               t = mparamtypes[p];
-               var = &(locals[l][t]);
-               l++;
-               if (IS_2_WORD_TYPE(t))    /* increment local counter for 2 word types */
-                       l++;
-               if (var->type < 0) {
-                       if (IS_INT_LNG_TYPE(t)) {
-                               s1++;
-                       } else {
-                               s2++;
-                       }
-                       continue;
-               }
-               r = var->regoff; 
-               if (IS_INT_LNG_TYPE(t)) {                    /* integer args          */
-                       if (s1 < intreg_argnum) {                /* register arguments    */
-                               if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
-                                       M_INTMOVE(argintregs[s1], r);
-
-                               } else {                             /* reg arg -> spilled    */
-                                   x86_64_mov_reg_membase(argintregs[s1], REG_SP, r * 8);
-                               }
-                       } else {                                 /* stack arguments       */
-                               pa = s1 - intreg_argnum;
-                               if (s2 >= fltreg_argnum) {
-                                       pa += s2 - fltreg_argnum;
-                               }
-                               if (!(var->flags & INMEMORY)) {      /* stack arg -> register */ 
-                                       x86_64_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 8, r);    /* + 8 for return address */
-                               } else {                             /* stack arg -> spilled  */
-                                       x86_64_mov_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 8, REG_ITMP1);    /* + 8 for return address */
-                                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, r * 8);
-                               }
-                       }
-                       s1++;
-
-               } else {                                     /* floating args         */   
-                       if (s2 < fltreg_argnum) {                /* register arguments    */
-                               if (!(var->flags & INMEMORY)) {      /* reg arg -> register   */
-                                       M_FLTMOVE(argfltregs[s2], r);
-
-                               } else {                                         /* reg arg -> spilled    */
-                                       x86_64_movq_reg_membase(argfltregs[s2], REG_SP, r * 8);
-                               }
-
-                       } else {                                 /* stack arguments       */
-                               pa = s2 - fltreg_argnum;
-                               if (s1 >= intreg_argnum) {
-                                       pa += s1 - intreg_argnum;
-                               }
-                               if (!(var->flags & INMEMORY)) {      /* stack-arg -> register */
-                                       x86_64_movq_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 8, r);
-
-                               } else {
-                                       x86_64_movq_membase_reg(REG_SP, (parentargs_base + pa) * 8 + 8, REG_FTMP1);
-                                       x86_64_movq_reg_membase(REG_FTMP1, REG_SP, r * 8);
-                               }
-                       }
-                       s2++;
-               }
-       }  /* end for */
-
-       /* call monitorenter function */
-
-#ifdef USE_THREADS
-       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-               x86_64_mov_membase_reg(REG_SP, 8 * maxmemuse, argintregs[0]);
-               x86_64_mov_imm_reg((s8) builtin_monitorenter, REG_ITMP1);
-               x86_64_call_reg(REG_ITMP1);
-       }                       
-#endif
-       }
-
-       /* end of header generation */
-
-       /* walk through all basic blocks */
-       for (/* bbs = block_count, */ bptr = block; /* --bbs >= 0 */ bptr != NULL; bptr = bptr->next) {
-
-               bptr->mpc = (int)((u1*) mcodeptr - mcodebase);
-
-               if (bptr->flags >= BBREACHED) {
-
-               /* branch resolving */
-
-               branchref *brefs;
-               for (brefs = bptr->branchrefs; brefs != NULL; brefs = brefs->next) {
-                       gen_resolvebranch((u1*) mcodebase + brefs->branchpos, 
-                                         brefs->branchpos, bptr->mpc);
-               }
-
-               /* copy interface registers to their destination */
-
-               src = bptr->instack;
-               len = bptr->indepth;
-               MCODECHECK(64+len);
-               while (src != NULL) {
-                       len--;
-                       if ((len == 0) && (bptr->type != BBTYPE_STD)) {
-                               if (bptr->type == BBTYPE_SBR) {
-                                       d = reg_of_var(src, REG_ITMP1);
-                                       x86_64_pop_reg(d);
-                                       store_reg_to_var_int(src, d);
-
-                               } else if (bptr->type == BBTYPE_EXH) {
-                                       d = reg_of_var(src, REG_ITMP1);
-                                       M_INTMOVE(REG_ITMP1, d);
-                                       store_reg_to_var_int(src, d);
-                               }
-
-                       } else {
-                               d = reg_of_var(src, REG_ITMP1);
-                               if ((src->varkind != STACKVAR)) {
-                                       s2 = src->type;
-                                       if (IS_FLT_DBL_TYPE(s2)) {
-                                               s1 = interfaces[len][s2].regoff;
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       M_FLTMOVE(s1, d);
-
-                                               } else {
-                                                       x86_64_movq_membase_reg(REG_SP, s1 * 8, d);
-                                               }
-                                               store_reg_to_var_flt(src, d);
-
-                                       } else {
-                                               s1 = interfaces[len][s2].regoff;
-                                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                                       M_INTMOVE(s1, d);
-
-                                               } else {
-                                                       x86_64_mov_membase_reg(REG_SP, s1 * 8, d);
-                                               }
-                                               store_reg_to_var_int(src, d);
-                                       }
-                               }
-                       }
-                       src = src->prev;
-               }
-
-               /* walk through all instructions */
-               
-               src = bptr->instack;
-               len = bptr->icount;
-               for (iptr = bptr->iinstr;
-                   len > 0;
-                   src = iptr->dst, len--, iptr++) {
-
-       MCODECHECK(64);           /* an instruction usually needs < 64 words      */
-       switch (iptr->opc) {
-
-               case ICMD_NOP:        /* ...  ==> ...                                 */
-                       break;
-
-               case ICMD_NULLCHECKPOP: /* ..., objectref  ==> ...                    */
-                       if (src->flags & INMEMORY) {
-                               x86_64_alu_imm_membase(X86_64_CMP, 0, REG_SP, src->regoff * 8);
-
-                       } else {
-                               x86_64_test_reg_reg(src->regoff, src->regoff);
-                       }
-                       x86_64_jcc(X86_64_CC_E, 0);
-                       mcode_addxnullrefs(mcodeptr);
-                       break;
-
-               /* constant operations ************************************************/
-
-               case ICMD_ICONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.i = constant                    */
-
-/*                     d = reg_of_var(iptr->dst, REG_ITMP1); */
-/*                     if (iptr->dst->flags & INMEMORY) { */
-/*                             x86_64_movl_imm_membase(iptr->val.i, REG_SP, iptr->dst->regoff * 8); */
-
-/*                     } else { */
-/*                             x86_64_movl_imm_reg(iptr->val.i, d); */
-/*                     } */
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->val.i == 0) {
-                               x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                       } else {
-                               x86_64_movl_imm_reg(iptr->val.i, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ACONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.a = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->val.a == 0) {
-                               x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                       } else {
-                               x86_64_mov_imm_reg((s8) iptr->val.a, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.l = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if (iptr->val.l == 0) {
-                               x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                       } else {
-                               x86_64_mov_imm_reg(iptr->val.l, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.f = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       a = dseg_addfloat(iptr->val.f);
-                       x86_64_movdl_membase_reg(RIP, -(((s8) mcodeptr + ((d > 7) ? 9 : 8)) - (s8) mcodebase) + a, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-               
-               case ICMD_DCONST:     /* ...  ==> ..., constant                       */
-                                     /* op1 = 0, val.d = constant                    */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       a = dseg_adddouble(iptr->val.d);
-                       x86_64_movd_membase_reg(RIP, -(((s8) mcodeptr + 9) - (s8) mcodebase) + a, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-
-               /* load/store operations **********************************************/
-
-               case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
-                                     /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY) {
-                               x86_64_movl_membase_reg(REG_SP, var->regoff * 8, d);
-                               store_reg_to_var_int(iptr->dst, d);
-
-                       } else {
-                               if (iptr->dst->flags & INMEMORY) {
-                                       x86_64_mov_reg_membase(var->regoff, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       M_INTMOVE(var->regoff, d);
-                               }
-                       }
-                       break;
-
-               case ICMD_LLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_ALOAD:      /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY) {
-                               x86_64_mov_membase_reg(REG_SP, var->regoff * 8, d);
-                               store_reg_to_var_int(iptr->dst, d);
-
-                       } else {
-                               if (iptr->dst->flags & INMEMORY) {
-                                       x86_64_mov_reg_membase(var->regoff, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       M_INTMOVE(var->regoff, d);
-                               }
-                       }
-                       break;
-
-               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_DLOAD:      /* op1 = local variable                         */
-
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       if ((iptr->dst->varkind == LOCALVAR) &&
-                           (iptr->dst->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ILOAD]);
-                       if (var->flags & INMEMORY) {
-                               x86_64_movq_membase_reg(REG_SP, var->regoff * 8, d);
-                               store_reg_to_var_flt(iptr->dst, d);
-
-                       } else {
-                               if (iptr->dst->flags & INMEMORY) {
-                                       x86_64_movq_reg_membase(var->regoff, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       M_FLTMOVE(var->regoff, d);
-                               }
-                       }
-                       break;
-
-               case ICMD_ISTORE:     /* ..., value  ==> ...                          */
-               case ICMD_LSTORE:     /* op1 = local variable                         */
-               case ICMD_ASTORE:
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               x86_64_mov_reg_membase(s1, REG_SP, var->regoff * 8);
-
-                       } else {
-                               var_to_reg_int(s1, src, var->regoff);
-                               M_INTMOVE(s1, var->regoff);
-                       }
-                       break;
-
-               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_DSTORE:     /* op1 = local variable                         */
-
-                       if ((src->varkind == LOCALVAR) &&
-                           (src->varnum == iptr->op1)) {
-                               break;
-                       }
-                       var = &(locals[iptr->op1][iptr->opc - ICMD_ISTORE]);
-                       if (var->flags & INMEMORY) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               x86_64_movq_reg_membase(s1, REG_SP, var->regoff * 8);
-
-                       } else {
-                               var_to_reg_flt(s1, src, var->regoff);
-                               M_FLTMOVE(s1, var->regoff);
-                       }
-                       break;
-
-
-               /* pop/dup/swap operations ********************************************/
-
-               /* attention: double and longs are only one entry in CACAO ICMDs      */
-
-               case ICMD_POP:        /* ..., value  ==> ...                          */
-               case ICMD_POP2:       /* ..., value, value  ==> ...                   */
-                       break;
-
-#define M_COPY(from,to) \
-               d = reg_of_var(to, REG_ITMP1); \
-                       if ((from->regoff != to->regoff) || \
-                           ((from->flags ^ to->flags) & INMEMORY)) { \
-                               if (IS_FLT_DBL_TYPE(from->type)) { \
-                                       var_to_reg_flt(s1, from, d); \
-                                       M_FLTMOVE(s1, d); \
-                                       store_reg_to_var_flt(to, d); \
-                               } else { \
-                                       var_to_reg_int(s1, from, d); \
-                                       M_INTMOVE(s1, d); \
-                                       store_reg_to_var_int(to, d); \
-                               } \
-                       }
-
-               case ICMD_DUP:        /* ..., a ==> ..., a, a                         */
-                       M_COPY(src, iptr->dst);
-                       break;
-
-               case ICMD_DUP_X1:     /* ..., a, b ==> ..., b, a, b                   */
-
-                       M_COPY(src,       iptr->dst->prev->prev);
-
-               case ICMD_DUP2:       /* ..., a, b ==> ..., a, b, a, b                */
-
-                       M_COPY(src,       iptr->dst);
-                       M_COPY(src->prev, iptr->dst->prev);
-                       break;
-
-               case ICMD_DUP2_X1:    /* ..., a, b, c ==> ..., b, c, a, b, c          */
-
-                       M_COPY(src->prev,       iptr->dst->prev->prev->prev);
-
-               case ICMD_DUP_X2:     /* ..., a, b, c ==> ..., c, a, b, c             */
-
-                       M_COPY(src,             iptr->dst);
-                       M_COPY(src->prev,       iptr->dst->prev);
-                       M_COPY(src->prev->prev, iptr->dst->prev->prev);
-                       M_COPY(src, iptr->dst->prev->prev->prev);
-                       break;
-
-               case ICMD_DUP2_X2:    /* ..., a, b, c, d ==> ..., c, d, a, b, c, d    */
-
-                       M_COPY(src,                   iptr->dst);
-                       M_COPY(src->prev,             iptr->dst->prev);
-                       M_COPY(src->prev->prev,       iptr->dst->prev->prev);
-                       M_COPY(src->prev->prev->prev, iptr->dst->prev->prev->prev);
-                       M_COPY(src,       iptr->dst->prev->prev->prev->prev);
-                       M_COPY(src->prev, iptr->dst->prev->prev->prev->prev->prev);
-                       break;
-
-               case ICMD_SWAP:       /* ..., a, b ==> ..., b, a                      */
-
-                       M_COPY(src, iptr->dst->prev);
-                       M_COPY(src->prev, iptr->dst);
-                       break;
-
-
-               /* integer operations *************************************************/
-
-               case ICMD_INEG:       /* ..., value  ==> ..., - value                 */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               x86_64_negl_membase(REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               x86_64_movl_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               x86_64_negl_reg(REG_ITMP1);
-                                               x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else {
-                                       x86_64_movl_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       x86_64_negl_membase(REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       x86_64_movl_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-                                       x86_64_negl_reg(d);
-
-                               } else {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       x86_64_negl_reg(iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-               case ICMD_LNEG:       /* ..., value  ==> ..., - value                 */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               x86_64_neg_membase(REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               x86_64_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               x86_64_neg_reg(REG_ITMP1);
-                                               x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else {
-                                       x86_64_mov_reg_membase(src->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       x86_64_neg_membase(REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       x86_64_mov_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-                                       x86_64_neg_reg(iptr->dst->regoff);
-
-                               } else {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       x86_64_neg_reg(iptr->dst->regoff);
-                               }
-                       }
-                       break;
-
-               case ICMD_I2L:        /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (src->flags & INMEMORY) {
-                               x86_64_movslq_membase_reg(REG_SP, src->regoff * 8, d);
-
-                       } else {
-                               x86_64_movslq_reg_reg(src->regoff, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_L2I:        /* ..., value  ==> ..., value                   */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2BYTE:   /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (src->flags & INMEMORY) {
-                               x86_64_movsbq_membase_reg(REG_SP, src->regoff * 8, d);
-
-                       } else {
-                               x86_64_movsbq_reg_reg(src->regoff, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2CHAR:   /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (src->flags & INMEMORY) {
-                               x86_64_movzwq_membase_reg(REG_SP, src->regoff * 8, d);
-
-                       } else {
-                               x86_64_movzwq_reg_reg(src->regoff, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_INT2SHORT:  /* ..., value  ==> ..., value                   */
-
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (src->flags & INMEMORY) {
-                               x86_64_movswq_membase_reg(REG_SP, src->regoff * 8, d);
-
-                       } else {
-                               x86_64_movswq_reg_reg(src->regoff, d);
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_IADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialu(X86_64_ADD, src, iptr);
-                       break;
-
-               case ICMD_IADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialuconst(X86_64_ADD, src, iptr);
-                       break;
-
-               case ICMD_LADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lalu(X86_64_ADD, src, iptr);
-                       break;
-
-               case ICMD_LADDCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_laluconst(X86_64_ADD, src, iptr);
-                       break;
-
-               case ICMD_ISUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       if (src->prev->regoff == iptr->dst->regoff) {
-                                               x86_64_movl_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               x86_64_alul_reg_membase(X86_64_SUB, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               x86_64_alul_membase_reg(X86_64_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
-                                               x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                                       x86_64_alul_membase_reg(X86_64_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
-                                       x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       if (src->prev->regoff == iptr->dst->regoff) {
-                                               x86_64_alul_reg_membase(X86_64_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               x86_64_alul_reg_reg(X86_64_SUB, src->regoff, REG_ITMP1);
-                                               x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else {
-                                       x86_64_movl_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       x86_64_alul_reg_membase(X86_64_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, d);
-                                       x86_64_alul_membase_reg(X86_64_SUB, REG_SP, src->regoff * 8, d);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, d);
-                                       x86_64_alul_membase_reg(X86_64_SUB, REG_SP, src->regoff * 8, d);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       /* workaround for reg alloc */
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               x86_64_alul_reg_reg(X86_64_SUB, src->regoff, REG_ITMP1);
-                                               M_INTMOVE(REG_ITMP1, d);
-
-                                       } else {
-                                               x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, d);
-                                               x86_64_alul_reg_reg(X86_64_SUB, src->regoff, d);
-                                       }
-
-                               } else {
-                                       /* workaround for reg alloc */
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                                               x86_64_alul_reg_reg(X86_64_SUB, src->regoff, REG_ITMP1);
-                                               M_INTMOVE(REG_ITMP1, d);
-
-                                       } else {
-                                               M_INTMOVE(src->prev->regoff, d);
-                                               x86_64_alul_reg_reg(X86_64_SUB, src->regoff, d);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_ISUBCONST:  /* ..., value  ==> ..., value + constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialuconst(X86_64_SUB, src, iptr);
-                       break;
-
-               case ICMD_LSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       if (src->prev->regoff == iptr->dst->regoff) {
-                                               x86_64_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                               x86_64_alu_reg_membase(X86_64_SUB, REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               x86_64_alu_membase_reg(X86_64_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
-                                               x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                                       x86_64_alu_membase_reg(X86_64_SUB, REG_SP, src->regoff * 8, REG_ITMP1);
-                                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       if (src->prev->regoff == iptr->dst->regoff) {
-                                               x86_64_alu_reg_membase(X86_64_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
-
-                                       } else {
-                                               x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               x86_64_alu_reg_reg(X86_64_SUB, src->regoff, REG_ITMP1);
-                                               x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       }
-
-                               } else {
-                                       x86_64_mov_reg_membase(src->prev->regoff, REG_SP, iptr->dst->regoff * 8);
-                                       x86_64_alu_reg_membase(X86_64_SUB, src->regoff, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, d);
-                                       x86_64_alu_membase_reg(X86_64_SUB, REG_SP, src->regoff * 8, d);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, d);
-                                       x86_64_alu_membase_reg(X86_64_SUB, REG_SP, src->regoff * 8, d);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       /* workaround for reg alloc */
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                               x86_64_alu_reg_reg(X86_64_SUB, src->regoff, REG_ITMP1);
-                                               M_INTMOVE(REG_ITMP1, d);
-
-                                       } else {
-                                               x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, d);
-                                               x86_64_alu_reg_reg(X86_64_SUB, src->regoff, d);
-                                       }
-
-                               } else {
-                                       /* workaround for reg alloc */
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                                               x86_64_alu_reg_reg(X86_64_SUB, src->regoff, REG_ITMP1);
-                                               M_INTMOVE(REG_ITMP1, d);
-
-                                       } else {
-                                               M_INTMOVE(src->prev->regoff, d);
-                                               x86_64_alu_reg_reg(X86_64_SUB, src->regoff, d);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_LSUBCONST:  /* ..., value  ==> ..., value - constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_laluconst(X86_64_SUB, src, iptr);
-                       break;
-
-               case ICMD_IMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                       x86_64_imull_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       x86_64_movl_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       x86_64_imull_reg_reg(src->prev->regoff, REG_ITMP1);
-                                       x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                       x86_64_imull_reg_reg(src->regoff, REG_ITMP1);
-                                       x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                                       x86_64_imull_reg_reg(src->regoff, REG_ITMP1);
-                                       x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-                                       x86_64_imull_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                                       x86_64_imull_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       x86_64_imull_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-
-                               } else {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               x86_64_imull_reg_reg(src->prev->regoff, iptr->dst->regoff);
-
-                                       } else {
-                                               M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                                               x86_64_imull_reg_reg(src->regoff, iptr->dst->regoff);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_IMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       x86_64_imull_imm_membase_reg(iptr->val.i, REG_SP, src->regoff * 8, REG_ITMP1);
-                                       x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       x86_64_imull_imm_reg_reg(iptr->val.i, src->regoff, REG_ITMP1);
-                                       x86_64_movl_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       x86_64_imull_imm_membase_reg(iptr->val.i, REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else {
-                                       if (iptr->val.i == 2) {
-                                               M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                               x86_64_alul_reg_reg(X86_64_ADD, iptr->dst->regoff, iptr->dst->regoff);
-
-                                       } else {
-                                               x86_64_imull_imm_reg_reg(iptr->val.i, src->regoff, iptr->dst->regoff);    /* 3 cycles */
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_LMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                       x86_64_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       x86_64_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       x86_64_imul_reg_reg(src->prev->regoff, REG_ITMP1);
-                                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-                                       x86_64_imul_reg_reg(src->regoff, REG_ITMP1);
-                                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-
-                               } else {
-                                       x86_64_mov_reg_reg(src->prev->regoff, REG_ITMP1);
-                                       x86_64_imul_reg_reg(src->regoff, REG_ITMP1);
-                                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-                                       x86_64_imul_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                                       x86_64_imul_membase_reg(REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                                       M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                       x86_64_imul_membase_reg(REG_SP, src->prev->regoff * 8, iptr->dst->regoff);
-
-                               } else {
-                                       if (src->regoff == iptr->dst->regoff) {
-                                               x86_64_imul_reg_reg(src->prev->regoff, iptr->dst->regoff);
-
-                                       } else {
-                                               M_INTMOVE(src->prev->regoff, iptr->dst->regoff);
-                                               x86_64_imul_reg_reg(src->regoff, iptr->dst->regoff);
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_LMULCONST:  /* ..., value  ==> ..., value * constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (iptr->dst->flags & INMEMORY) {
-                               if (src->flags & INMEMORY) {
-                                       if (x86_64_is_imm32(iptr->val.l)) {
-                                               x86_64_imul_imm_membase_reg(iptr->val.l, REG_SP, src->regoff * 8, REG_ITMP1);
-
-                                       } else {
-                                               x86_64_mov_imm_reg(iptr->val.l, REG_ITMP1);
-                                               x86_64_imul_membase_reg(REG_SP, src->regoff * 8, REG_ITMP1);
-                                       }
-                                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                                       
-                               } else {
-                                       if (x86_64_is_imm32(iptr->val.l)) {
-                                               x86_64_imul_imm_reg_reg(iptr->val.l, src->regoff, REG_ITMP1);
-
-                                       } else {
-                                               x86_64_mov_imm_reg(iptr->val.l, REG_ITMP1);
-                                               x86_64_imul_reg_reg(src->regoff, REG_ITMP1);
-                                       }
-                                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, iptr->dst->regoff * 8);
-                               }
-
-                       } else {
-                               if (src->flags & INMEMORY) {
-                                       x86_64_imul_imm_membase_reg(iptr->val.l, REG_SP, src->regoff * 8, iptr->dst->regoff);
-
-                               } else {
-                                       if (iptr->val.l == 2) {
-                                               M_INTMOVE(src->regoff, iptr->dst->regoff);
-                                               x86_64_alul_reg_reg(X86_64_ADD, iptr->dst->regoff, iptr->dst->regoff);
-
-                                       } else {
-                                               x86_64_imul_imm_reg_reg(iptr->val.l, src->regoff, iptr->dst->regoff);    /* 4 cycles */
-                                       }
-                               }
-                       }
-                       break;
-
-               case ICMD_IDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-               if (src->prev->flags & INMEMORY) {
-                               x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, RAX);
-
-                       } else {
-                               M_INTMOVE(src->prev->regoff, RAX);
-                       }
-                       
-                       if (src->flags & INMEMORY) {
-                               x86_64_movl_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);
-
-                       } else {
-                               M_INTMOVE(src->regoff, REG_ITMP3);
-                       }
-
-                       x86_64_alul_imm_reg(X86_64_CMP, 0x80000000, RAX);    /* check as described in jvm spec */
-                       x86_64_jcc(X86_64_CC_NE, 4 + 6);
-                       x86_64_alul_imm_reg(X86_64_CMP, -1, REG_ITMP3);      /* 4 bytes */
-                       x86_64_jcc(X86_64_CC_E, 3 + 1 + 3);                  /* 6 bytes */
-
-                       x86_64_mov_reg_reg(RDX, REG_ITMP2);    /* save %rdx, cause it's an argument register */
-                       x86_64_cltd();
-                       x86_64_idivl_reg(REG_ITMP3);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               x86_64_mov_reg_membase(RAX, REG_SP, iptr->dst->regoff * 8);
-                               x86_64_mov_reg_reg(REG_ITMP2, RDX);    /* restore %rdx */
-
-                       } else {
-                               M_INTMOVE(RAX, iptr->dst->regoff);
-
-                               if (iptr->dst->regoff != RDX) {
-                                       x86_64_mov_reg_reg(REG_ITMP2, RDX);    /* restore %rdx */
-                               }
-                       }
-                       break;
-
-               case ICMD_IREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (src->prev->flags & INMEMORY) {
-                               x86_64_movl_membase_reg(REG_SP, src->prev->regoff * 8, RAX);
-
-                       } else {
-                               M_INTMOVE(src->prev->regoff, RAX);
-                       }
-                       
-                       if (src->flags & INMEMORY) {
-                               x86_64_movl_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);
-
-                       } else {
-                               M_INTMOVE(src->regoff, REG_ITMP3);
-                       }
-
-                       x86_64_alul_imm_reg(X86_64_CMP, 0x80000000, RAX);    /* check as described in jvm spec */
-                       x86_64_jcc(X86_64_CC_NE, 2 + 4 + 6);
-                       x86_64_alul_reg_reg(X86_64_XOR, RDX, RDX);           /* 2 bytes */
-                       x86_64_alul_imm_reg(X86_64_CMP, -1, REG_ITMP3);      /* 4 bytes */
-                       x86_64_jcc(X86_64_CC_E, 3 + 1 + 3);                  /* 6 bytes */
-
-                       x86_64_mov_reg_reg(RDX, REG_ITMP2);    /* save %rdx, cause it's an argument register */
-                       x86_64_cltd();
-                       x86_64_idivl_reg(REG_ITMP3);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               x86_64_mov_reg_membase(RDX, REG_SP, iptr->dst->regoff * 8);
-                               x86_64_mov_reg_reg(REG_ITMP2, RDX);    /* restore %rdx */
-
-                       } else {
-                               M_INTMOVE(RDX, iptr->dst->regoff);
-
-                               if (iptr->dst->regoff != RDX) {
-                                       x86_64_mov_reg_reg(REG_ITMP2, RDX);    /* restore %rdx */
-                               }
-                       }
-                       break;
-
-               case ICMD_IDIVPOW2:   /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_INTMOVE(s1, REG_ITMP1);
-                       x86_64_alul_imm_reg(X86_64_CMP, -1, REG_ITMP1);
-                       x86_64_leal_membase_reg(REG_ITMP1, (1 << iptr->val.i) - 1, REG_ITMP2);
-                       x86_64_cmovccl_reg_reg(X86_64_CC_LE, REG_ITMP2, REG_ITMP1);
-                       x86_64_shiftl_imm_reg(X86_64_SAR, iptr->val.i, REG_ITMP1);
-                       x86_64_mov_reg_reg(REG_ITMP1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_INTMOVE(s1, REG_ITMP1);
-                       x86_64_alul_imm_reg(X86_64_CMP, -1, REG_ITMP1);
-                       x86_64_leal_membase_reg(REG_ITMP1, iptr->val.i, REG_ITMP2);
-                       x86_64_cmovccl_reg_reg(X86_64_CC_G, REG_ITMP1, REG_ITMP2);
-                       x86_64_alul_imm_reg(X86_64_AND, -1 - (iptr->val.i), REG_ITMP2);
-                       x86_64_alul_reg_reg(X86_64_SUB, REG_ITMP2, REG_ITMP1);
-                       x86_64_mov_reg_reg(REG_ITMP1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_LDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-               if (src->prev->flags & INMEMORY) {
-                               x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-
-                       } else {
-                               M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                       }
-                       
-                       if (src->flags & INMEMORY) {
-                               x86_64_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);
-
-                       } else {
-                               M_INTMOVE(src->regoff, REG_ITMP3);
-                       }
-
-                       x86_64_mov_imm_reg(0x8000000000000000LL, REG_ITMP2);    /* check as described in jvm spec */
-                       x86_64_alu_reg_reg(X86_64_CMP, REG_ITMP2, REG_ITMP1);
-                       x86_64_jcc(X86_64_CC_NE, 4 + 6);
-                       x86_64_alu_imm_reg(X86_64_CMP, -1, REG_ITMP3);          /* 4 bytes */
-                       x86_64_jcc(X86_64_CC_E, 3 + 2 + 3);                     /* 6 bytes */
-
-                       x86_64_mov_reg_reg(RDX, REG_ITMP2);    /* save %rdx, cause it's an argument register */
-                       x86_64_cqto();
-                       x86_64_idiv_reg(REG_ITMP3);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               x86_64_mov_reg_membase(RAX, REG_SP, iptr->dst->regoff * 8);
-                               x86_64_mov_reg_reg(REG_ITMP2, RDX);    /* restore %rdx */
-
-                       } else {
-                               M_INTMOVE(RAX, iptr->dst->regoff);
-
-                               if (iptr->dst->regoff != RDX) {
-                                       x86_64_mov_reg_reg(REG_ITMP2, RDX);    /* restore %rdx */
-                               }
-                       }
-                       break;
-
-               case ICMD_LREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       if (src->prev->flags & INMEMORY) {
-                               x86_64_mov_membase_reg(REG_SP, src->prev->regoff * 8, REG_ITMP1);
-
-                       } else {
-                               M_INTMOVE(src->prev->regoff, REG_ITMP1);
-                       }
-                       
-                       if (src->flags & INMEMORY) {
-                               x86_64_mov_membase_reg(REG_SP, src->regoff * 8, REG_ITMP3);
-
-                       } else {
-                               M_INTMOVE(src->regoff, REG_ITMP3);
-                       }
-
-                       x86_64_mov_imm_reg(0x8000000000000000LL, REG_ITMP2);    /* check as described in jvm spec */
-                       x86_64_alu_reg_reg(X86_64_CMP, REG_ITMP2, REG_ITMP1);
-                       x86_64_jcc(X86_64_CC_NE, 2 + 4 + 6);
-                       x86_64_alul_reg_reg(X86_64_XOR, RDX, RDX);              /* 2 bytes */
-                       x86_64_alu_imm_reg(X86_64_CMP, -1, REG_ITMP3);          /* 4 bytes */
-                       x86_64_jcc(X86_64_CC_E, 3 + 2 + 3);                     /* 6 bytes */
-
-                       x86_64_mov_reg_reg(RDX, REG_ITMP2);    /* save %rdx, cause it's an argument register */
-                       x86_64_cqto();
-                       x86_64_idiv_reg(REG_ITMP3);
-
-                       if (iptr->dst->flags & INMEMORY) {
-                               x86_64_mov_reg_membase(RDX, REG_SP, iptr->dst->regoff * 8);
-                               x86_64_mov_reg_reg(REG_ITMP2, RDX);    /* restore %rdx */
-
-                       } else {
-                               M_INTMOVE(RDX, iptr->dst->regoff);
-
-                               if (iptr->dst->regoff != RDX) {
-                                       x86_64_mov_reg_reg(REG_ITMP2, RDX);    /* restore %rdx */
-                               }
-                       }
-                       break;
-
-               case ICMD_LDIVPOW2:   /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_INTMOVE(s1, REG_ITMP1);
-                       x86_64_alu_imm_reg(X86_64_CMP, -1, REG_ITMP1);
-                       x86_64_lea_membase_reg(REG_ITMP1, (1 << iptr->val.i) - 1, REG_ITMP2);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_LE, REG_ITMP2, REG_ITMP1);
-                       x86_64_shift_imm_reg(X86_64_SAR, iptr->val.i, REG_ITMP1);
-                       x86_64_mov_reg_reg(REG_ITMP1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LREMPOW2:   /* ..., value  ==> ..., value % constant        */
-                                     /* val.l = constant                             */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       M_INTMOVE(s1, REG_ITMP1);
-                       x86_64_alu_imm_reg(X86_64_CMP, -1, REG_ITMP1);
-                       x86_64_lea_membase_reg(REG_ITMP1, iptr->val.i, REG_ITMP2);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_G, REG_ITMP1, REG_ITMP2);
-                       x86_64_alu_imm_reg(X86_64_AND, -1 - (iptr->val.i), REG_ITMP2);
-                       x86_64_alu_reg_reg(X86_64_SUB, REG_ITMP2, REG_ITMP1);
-                       x86_64_mov_reg_reg(REG_ITMP1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_ISHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ishift(X86_64_SHL, src, iptr);
-                       break;
-
-               case ICMD_ISHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ishiftconst(X86_64_SHL, src, iptr);
-                       break;
-
-               case ICMD_ISHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ishift(X86_64_SAR, src, iptr);
-                       break;
-
-               case ICMD_ISHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ishiftconst(X86_64_SAR, src, iptr);
-                       break;
-
-               case ICMD_IUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ishift(X86_64_SHR, src, iptr);
-                       break;
-
-               case ICMD_IUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ishiftconst(X86_64_SHR, src, iptr);
-                       break;
-
-               case ICMD_LSHL:       /* ..., val1, val2  ==> ..., val1 << val2       */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lshift(X86_64_SHL, src, iptr);
-                       break;
-
-        case ICMD_LSHLCONST:  /* ..., value  ==> ..., value << constant       */
-                                         /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lshiftconst(X86_64_SHL, src, iptr);
-                       break;
-
-               case ICMD_LSHR:       /* ..., val1, val2  ==> ..., val1 >> val2       */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lshift(X86_64_SAR, src, iptr);
-                       break;
-
-               case ICMD_LSHRCONST:  /* ..., value  ==> ..., value >> constant       */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lshiftconst(X86_64_SAR, src, iptr);
-                       break;
-
-               case ICMD_LUSHR:      /* ..., val1, val2  ==> ..., val1 >>> val2      */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lshift(X86_64_SHR, src, iptr);
-                       break;
-
-               case ICMD_LUSHRCONST: /* ..., value  ==> ..., value >>> constant      */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lshiftconst(X86_64_SHR, src, iptr);
-                       break;
-
-               case ICMD_IAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialu(X86_64_AND, src, iptr);
-                       break;
-
-               case ICMD_IANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialuconst(X86_64_AND, src, iptr);
-                       break;
-
-               case ICMD_LAND:       /* ..., val1, val2  ==> ..., val1 & val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lalu(X86_64_AND, src, iptr);
-                       break;
-
-               case ICMD_LANDCONST:  /* ..., value  ==> ..., value & constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_laluconst(X86_64_AND, src, iptr);
-                       break;
-
-               case ICMD_IOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialu(X86_64_OR, src, iptr);
-                       break;
-
-               case ICMD_IORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialuconst(X86_64_OR, src, iptr);
-                       break;
-
-               case ICMD_LOR:        /* ..., val1, val2  ==> ..., val1 | val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lalu(X86_64_OR, src, iptr);
-                       break;
-
-               case ICMD_LORCONST:   /* ..., value  ==> ..., value | constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_laluconst(X86_64_OR, src, iptr);
-                       break;
-
-               case ICMD_IXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialu(X86_64_XOR, src, iptr);
-                       break;
-
-               case ICMD_IXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.i = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_ialuconst(X86_64_XOR, src, iptr);
-                       break;
-
-               case ICMD_LXOR:       /* ..., val1, val2  ==> ..., val1 ^ val2        */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_lalu(X86_64_XOR, src, iptr);
-                       break;
-
-               case ICMD_LXORCONST:  /* ..., value  ==> ..., value ^ constant        */
-                                     /* val.l = constant                             */
-
-                       d = reg_of_var(iptr->dst, REG_NULL);
-                       x86_64_emit_laluconst(X86_64_XOR, src, iptr);
-                       break;
-
-
-               case ICMD_IINC:       /* ..., value  ==> ..., value + constant        */
-                                     /* op1 = variable, val.i = constant             */
-
-                       var = &(locals[iptr->op1][TYPE_INT]);
-                       d = var->regoff;
-                       if (var->flags & INMEMORY) {
-                               if (iptr->val.i == 1) {
-                                       x86_64_incl_membase(REG_SP, d * 8);
-                               } else if (iptr->val.i == -1) {
-                                       x86_64_decl_membase(REG_SP, d * 8);
-
-                               } else {
-                                       x86_64_alul_imm_membase(X86_64_ADD, iptr->val.i, REG_SP, d * 8);
-                               }
-
-                       } else {
-                               if (iptr->val.i == 1) {
-                                       x86_64_incl_reg(d);
-                               } else if (iptr->val.i == -1) {
-                                       x86_64_decl_reg(d);
-
-                               } else {
-                                       x86_64_alul_imm_reg(X86_64_ADD, iptr->val.i, d);
-                               }
-                       }
-                       break;
-
-
-               /* floating operations ************************************************/
-
-               case ICMD_FNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       a = dseg_adds4(0x80000000);
-                       M_FLTMOVE(s1, d);
-                       x86_64_movss_membase_reg(RIP, -(((s8) mcodeptr + 9) - (s8) mcodebase) + a, REG_FTMP2);
-                       x86_64_xorps_reg_reg(REG_FTMP2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DNEG:       /* ..., value  ==> ..., - value                 */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       a = dseg_adds8(0x8000000000000000);
-                       M_FLTMOVE(s1, d);
-                       x86_64_movd_membase_reg(RIP, -(((s8) mcodeptr + 9) - (s8) mcodebase) + a, REG_FTMP2);
-                       x86_64_xorpd_reg_reg(REG_FTMP2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (s1 == d) {
-                               x86_64_addss_reg_reg(s2, d);
-                       } else if (s2 == d) {
-                               x86_64_addss_reg_reg(s1, d);
-                       } else {
-                               M_FLTMOVE(s1, d);
-                               x86_64_addss_reg_reg(s2, d);
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DADD:       /* ..., val1, val2  ==> ..., val1 + val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (s1 == d) {
-                               x86_64_addsd_reg_reg(s2, d);
-                       } else if (s2 == d) {
-                               x86_64_addsd_reg_reg(s1, d);
-                       } else {
-                               M_FLTMOVE(s1, d);
-                               x86_64_addsd_reg_reg(s2, d);
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (s2 == d) {
-                               M_FLTMOVE(s2, REG_FTMP2);
-                               s2 = REG_FTMP2;
-                       }
-                       M_FLTMOVE(s1, d);
-                       x86_64_subss_reg_reg(s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DSUB:       /* ..., val1, val2  ==> ..., val1 - val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (s2 == d) {
-                               M_FLTMOVE(s2, REG_FTMP2);
-                               s2 = REG_FTMP2;
-                       }
-                       M_FLTMOVE(s1, d);
-                       x86_64_subsd_reg_reg(s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (s1 == d) {
-                               x86_64_mulss_reg_reg(s2, d);
-                       } else if (s2 == d) {
-                               x86_64_mulss_reg_reg(s1, d);
-                       } else {
-                               M_FLTMOVE(s1, d);
-                               x86_64_mulss_reg_reg(s2, d);
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DMUL:       /* ..., val1, val2  ==> ..., val1 * val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (s1 == d) {
-                               x86_64_mulsd_reg_reg(s2, d);
-                       } else if (s2 == d) {
-                               x86_64_mulsd_reg_reg(s1, d);
-                       } else {
-                               M_FLTMOVE(s1, d);
-                               x86_64_mulsd_reg_reg(s2, d);
-                       }
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (s2 == d) {
-                               M_FLTMOVE(s2, REG_FTMP2);
-                               s2 = REG_FTMP2;
-                       }
-                       M_FLTMOVE(s1, d);
-                       x86_64_divss_reg_reg(s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DDIV:       /* ..., val1, val2  ==> ..., val1 / val2        */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (s2 == d) {
-                               M_FLTMOVE(s2, REG_FTMP2);
-                               s2 = REG_FTMP2;
-                       }
-                       M_FLTMOVE(s1, d);
-                       x86_64_divsd_reg_reg(s2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_I2F:       /* ..., value  ==> ..., (float) value            */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       x86_64_cvtsi2ss_reg_reg(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_I2D:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       x86_64_cvtsi2sd_reg_reg(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_L2F:       /* ..., value  ==> ..., (float) value            */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       x86_64_cvtsi2ssq_reg_reg(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-                       
-               case ICMD_L2D:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                       x86_64_cvtsi2sdq_reg_reg(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-                       
-               case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       x86_64_cvttss2si_reg_reg(s1, d);
-                       x86_64_alul_imm_reg(X86_64_CMP, 0x80000000, d);    /* corner cases */
-                       a = ((s1 == REG_FTMP1) ? 0 : 5) + 10 + 3 + ((REG_RESULT == d) ? 0 : 3);
-                       x86_64_jcc(X86_64_CC_NE, a);
-                       M_FLTMOVE(s1, REG_FTMP1);
-                       x86_64_mov_imm_reg((s8) asm_builtin_f2i, REG_ITMP2);
-                       x86_64_call_reg(REG_ITMP2);
-                       M_INTMOVE(REG_RESULT, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_D2I:       /* ..., value  ==> ..., (int) value              */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       x86_64_cvttsd2si_reg_reg(s1, d);
-                       x86_64_alul_imm_reg(X86_64_CMP, 0x80000000, d);    /* corner cases */
-                       a = ((s1 == REG_FTMP1) ? 0 : 5) + 10 + 3 + ((REG_RESULT == d) ? 0 : 3);
-                       x86_64_jcc(X86_64_CC_NE, a);
-                       M_FLTMOVE(s1, REG_FTMP1);
-                       x86_64_mov_imm_reg((s8) asm_builtin_d2i, REG_ITMP2);
-                       x86_64_call_reg(REG_ITMP2);
-                       M_INTMOVE(REG_RESULT, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_F2L:       /* ..., value  ==> ..., (long) value             */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       x86_64_cvttss2siq_reg_reg(s1, d);
-                       x86_64_mov_imm_reg(0x8000000000000000, REG_ITMP2);
-                       x86_64_alu_reg_reg(X86_64_CMP, REG_ITMP2, d);     /* corner cases */
-                       a = ((s1 == REG_FTMP1) ? 0 : 5) + 10 + 3 + ((REG_RESULT == d) ? 0 : 3);
-                       x86_64_jcc(X86_64_CC_NE, a);
-                       M_FLTMOVE(s1, REG_FTMP1);
-                       x86_64_mov_imm_reg((s8) asm_builtin_f2l, REG_ITMP2);
-                       x86_64_call_reg(REG_ITMP2);
-                       M_INTMOVE(REG_RESULT, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_D2L:       /* ..., value  ==> ..., (long) value             */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                       x86_64_cvttsd2siq_reg_reg(s1, d);
-                       x86_64_mov_imm_reg(0x8000000000000000, REG_ITMP2);
-                       x86_64_alu_reg_reg(X86_64_CMP, REG_ITMP2, d);     /* corner cases */
-                       a = ((s1 == REG_FTMP1) ? 0 : 5) + 10 + 3 + ((REG_RESULT == d) ? 0 : 3);
-                       x86_64_jcc(X86_64_CC_NE, a);
-                       M_FLTMOVE(s1, REG_FTMP1);
-                       x86_64_mov_imm_reg((s8) asm_builtin_d2l, REG_ITMP2);
-                       x86_64_call_reg(REG_ITMP2);
-                       M_INTMOVE(REG_RESULT, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_F2D:       /* ..., value  ==> ..., (double) value           */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       x86_64_cvtss2sd_reg_reg(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_D2F:       /* ..., value  ==> ..., (float) value            */
-
-                       var_to_reg_flt(s1, src, REG_FTMP1);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       x86_64_cvtsd2ss_reg_reg(s1, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_FCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
-                                         /* == => 0, < => 1, > => -1 */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                       x86_64_mov_imm_reg(1, REG_ITMP1);
-                       x86_64_mov_imm_reg(-1, REG_ITMP2);
-                       x86_64_ucomiss_reg_reg(s1, s2);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_B, REG_ITMP1, d);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_A, REG_ITMP2, d);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_P, REG_ITMP2, d);    /* treat unordered as GT */
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
-                                         /* == => 0, < => 1, > => -1 */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                       x86_64_mov_imm_reg(1, REG_ITMP1);
-                       x86_64_mov_imm_reg(-1, REG_ITMP2);
-                       x86_64_ucomiss_reg_reg(s1, s2);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_B, REG_ITMP1, d);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_A, REG_ITMP2, d);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_P, REG_ITMP1, d);    /* treat unordered as LT */
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_DCMPL:      /* ..., val1, val2  ==> ..., val1 fcmpl val2    */
-                                         /* == => 0, < => 1, > => -1 */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                       x86_64_mov_imm_reg(1, REG_ITMP1);
-                       x86_64_mov_imm_reg(-1, REG_ITMP2);
-                       x86_64_ucomisd_reg_reg(s1, s2);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_B, REG_ITMP1, d);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_A, REG_ITMP2, d);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_P, REG_ITMP2, d);    /* treat unordered as GT */
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_DCMPG:      /* ..., val1, val2  ==> ..., val1 fcmpg val2    */
-                                         /* == => 0, < => 1, > => -1 */
-
-                       var_to_reg_flt(s1, src->prev, REG_FTMP1);
-                       var_to_reg_flt(s2, src, REG_FTMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                       x86_64_mov_imm_reg(1, REG_ITMP1);
-                       x86_64_mov_imm_reg(-1, REG_ITMP2);
-                       x86_64_ucomisd_reg_reg(s1, s2);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_B, REG_ITMP1, d);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_A, REG_ITMP2, d);
-                       x86_64_cmovcc_reg_reg(X86_64_CC_P, REG_ITMP1, d);    /* treat unordered as LT */
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               /* memory operations **************************************************/
-
-#define gen_bound_check \
-    if (checkbounds) { \
-        x86_64_alul_membase_reg(X86_64_CMP, s1, OFFSET(java_arrayheader, size), s2); \
-        x86_64_jcc(X86_64_CC_AE, 0); \
-        mcode_addxboundrefs(mcodeptr); \
-    }
-
-               case ICMD_ARRAYLENGTH: /* ..., arrayref  ==> ..., (int) length        */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       gen_nullptr_check(s1);
-                       x86_64_movl_membase_reg(s1, OFFSET(java_arrayheader, size), d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_AALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       x86_64_mov_memindex_reg(OFFSET(java_objectarray, data[0]), s1, s2, 3, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_LALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       x86_64_mov_memindex_reg(OFFSET(java_longarray, data[0]), s1, s2, 3, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       x86_64_movl_memindex_reg(OFFSET(java_intarray, data[0]), s1, s2, 2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_FALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       x86_64_movss_memindex_reg(OFFSET(java_floatarray, data[0]), s1, s2, 2, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_DALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_FTMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       x86_64_movsd_memindex_reg(OFFSET(java_doublearray, data[0]), s1, s2, 3, d);
-                       store_reg_to_var_flt(iptr->dst, d);
-                       break;
-
-               case ICMD_CALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       x86_64_movzwq_memindex_reg(OFFSET(java_chararray, data[0]), s1, s2, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;                  
-
-               case ICMD_SALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       x86_64_movswq_memindex_reg(OFFSET(java_shortarray, data[0]), s1, s2, 1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_BALOAD:     /* ..., arrayref, index  ==> ..., value         */
-
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src, REG_ITMP2);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       x86_64_movsbq_memindex_reg(OFFSET(java_bytearray, data[0]), s1, s2, 0, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_AASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       x86_64_mov_reg_memindex(s3, OFFSET(java_objectarray, data[0]), s1, s2, 3);
-                       break;
-
-               case ICMD_LASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       x86_64_mov_reg_memindex(s3, OFFSET(java_longarray, data[0]), s1, s2, 3);
-                       break;
-
-               case ICMD_IASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       x86_64_movl_reg_memindex(s3, OFFSET(java_intarray, data[0]), s1, s2, 2);
-                       break;
-
-               case ICMD_FASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_flt(s3, src, REG_FTMP3);
-                       x86_64_movss_reg_memindex(s3, OFFSET(java_floatarray, data[0]), s1, s2, 2);
-                       break;
-
-               case ICMD_DASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_flt(s3, src, REG_FTMP3);
-                       x86_64_movsd_reg_memindex(s3, OFFSET(java_doublearray, data[0]), s1, s2, 3);
-                       break;
-
-               case ICMD_CASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       x86_64_movw_reg_memindex(s3, OFFSET(java_chararray, data[0]), s1, s2, 1);
-                       break;
-
-               case ICMD_SASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       x86_64_movw_reg_memindex(s3, OFFSET(java_shortarray, data[0]), s1, s2, 1);
-                       break;
-
-               case ICMD_BASTORE:    /* ..., arrayref, index, value  ==> ...         */
-
-                       var_to_reg_int(s1, src->prev->prev, REG_ITMP1);
-                       var_to_reg_int(s2, src->prev, REG_ITMP2);
-                       if (iptr->op1 == 0) {
-                               gen_nullptr_check(s1);
-                               gen_bound_check;
-                       }
-                       var_to_reg_int(s3, src, REG_ITMP3);
-                       x86_64_movb_reg_memindex(s3, OFFSET(java_bytearray, data[0]), s1, s2, 0);
-                       break;
-
-
-               case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress(&(((fieldinfo *)(iptr->val.a))->value));
-/*                     x86_64_mov_imm_reg(0, REG_ITMP2); */
-/*                     dseg_adddata(mcodeptr); */
-/*                     x86_64_mov_membase_reg(REG_ITMP2, a, REG_ITMP3); */
-                       x86_64_mov_membase_reg(RIP, -(((s8) mcodeptr + 7) - (s8) mcodebase) + a, REG_ITMP2);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s2, src, REG_ITMP1);
-                                       x86_64_movl_reg_membase(s2, REG_ITMP2, 0);
-                                       break;
-                               case TYPE_LNG:
-                               case TYPE_ADR:
-                                       var_to_reg_int(s2, src, REG_ITMP1);
-                                       x86_64_mov_reg_membase(s2, REG_ITMP2, 0);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_flt(s2, src, REG_FTMP1);
-                                       x86_64_movss_reg_membase(s2, REG_ITMP2, 0);
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_flt(s2, src, REG_FTMP1);
-                                       x86_64_movsd_reg_membase(s2, REG_ITMP2, 0);
-                                       break;
-                               default: panic("internal error");
-                               }
-                       break;
-
-               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.a = field address            */
-
-                       a = dseg_addaddress(&(((fieldinfo *)(iptr->val.a))->value));
-/*                     x86_64_mov_imm_reg(0, REG_ITMP2); */
-/*                     dseg_adddata(mcodeptr); */
-/*                     x86_64_mov_membase_reg(REG_ITMP2, a, REG_ITMP3); */
-                       x86_64_mov_membase_reg(RIP, -(((s8) mcodeptr + 7) - (s8) mcodebase) + a, REG_ITMP2);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                                       x86_64_movl_membase_reg(REG_ITMP2, 0, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                               case TYPE_ADR:
-                                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                                       x86_64_mov_membase_reg(REG_ITMP2, 0, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_FLT:
-                                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                                       x86_64_movss_membase_reg(REG_ITMP2, 0, d);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                                       x86_64_movsd_membase_reg(REG_ITMP2, 0, d);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic("internal error");
-                               }
-                       break;
-
-               case ICMD_PUTFIELD:   /* ..., value  ==> ...                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       var_to_reg_int(s1, src->prev, REG_ITMP1);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       x86_64_movl_reg_membase(s2, s1, a);
-                                       break;
-                               case TYPE_LNG:
-                               case TYPE_ADR:
-                                       var_to_reg_int(s2, src, REG_ITMP2);
-                                       gen_nullptr_check(s1);
-                                       x86_64_mov_reg_membase(s2, s1, a);
-                                       break;
-                               case TYPE_FLT:
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       gen_nullptr_check(s1);
-                                       x86_64_movss_reg_membase(s2, s1, a);
-                                       break;
-                               case TYPE_DBL:
-                                       var_to_reg_flt(s2, src, REG_FTMP2);
-                                       gen_nullptr_check(s1);
-                                       x86_64_movsd_reg_membase(s2, s1, a);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-               case ICMD_GETFIELD:   /* ...  ==> ..., value                          */
-                                     /* op1 = type, val.i = field offset             */
-
-                       a = ((fieldinfo *)(iptr->val.a))->offset;
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       switch (iptr->op1) {
-                               case TYPE_INT:
-                                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                                       gen_nullptr_check(s1);
-                                       x86_64_movl_membase_reg(s1, a, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_LNG:
-                               case TYPE_ADR:
-                                       d = reg_of_var(iptr->dst, REG_ITMP1);
-                                       gen_nullptr_check(s1);
-                                       x86_64_mov_membase_reg(s1, a, d);
-                                       store_reg_to_var_int(iptr->dst, d);
-                                       break;
-                               case TYPE_FLT:
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       x86_64_movss_membase_reg(s1, a, d);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               case TYPE_DBL:                          
-                                       d = reg_of_var(iptr->dst, REG_FTMP1);
-                                       gen_nullptr_check(s1);
-                                       x86_64_movsd_membase_reg(s1, a, d);
-                                       store_reg_to_var_flt(iptr->dst, d);
-                                       break;
-                               default: panic ("internal error");
-                               }
-                       break;
-
-
-               /* branch operations **************************************************/
-
-/*  #define ALIGNCODENOP {if((int)((long)mcodeptr&7)){M_NOP;}} */
-#define ALIGNCODENOP do {} while (0)
-
-               case ICMD_ATHROW:       /* ..., objectref ==> ... (, objectref)       */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       M_INTMOVE(s1, REG_ITMP1_XPTR);
-
-                       x86_64_call_imm(0); /* passing exception pointer                  */
-                       x86_64_pop_reg(REG_ITMP2_XPC);
-
-                       x86_64_mov_imm_reg((s8) asm_handle_exception, REG_ITMP3);
-                       x86_64_jmp_reg(REG_ITMP3);
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_GOTO:         /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_jmp_imm(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       ALIGNCODENOP;
-                       break;
-
-               case ICMD_JSR:          /* ... ==> ...                                */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_call_imm(0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-                       
-               case ICMD_RET:          /* ... ==> ...                                */
-                                       /* op1 = local variable                       */
-
-                       var = &(locals[iptr->op1][TYPE_ADR]);
-                       var_to_reg_int(s1, var, REG_ITMP1);
-                       x86_64_jmp_reg(s1);
-                       break;
-
-               case ICMD_IFNULL:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if (src->flags & INMEMORY) {
-                               x86_64_alu_imm_membase(X86_64_CMP, 0, REG_SP, src->regoff * 8);
-
-                       } else {
-                               x86_64_test_reg_reg(src->regoff, src->regoff);
-                       }
-                       x86_64_jcc(X86_64_CC_E, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFNONNULL:    /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc                     */
-
-                       if (src->flags & INMEMORY) {
-                               x86_64_alu_imm_membase(X86_64_CMP, 0, REG_SP, src->regoff * 8);
-
-                       } else {
-                               x86_64_test_reg_reg(src->regoff, src->regoff);
-                       }
-                       x86_64_jcc(X86_64_CC_NE, 0);
-                       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-                       break;
-
-               case ICMD_IFEQ:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       x86_64_emit_ifcc(X86_64_CC_E, src, iptr);
-                       break;
-
-               case ICMD_IFLT:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       x86_64_emit_ifcc(X86_64_CC_L, src, iptr);
-                       break;
-
-               case ICMD_IFLE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       x86_64_emit_ifcc(X86_64_CC_LE, src, iptr);
-                       break;
-
-               case ICMD_IFNE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       x86_64_emit_ifcc(X86_64_CC_NE, src, iptr);
-                       break;
-
-               case ICMD_IFGT:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       x86_64_emit_ifcc(X86_64_CC_G, src, iptr);
-                       break;
-
-               case ICMD_IFGE:         /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.i = constant   */
-
-                       x86_64_emit_ifcc(X86_64_CC_GE, src, iptr);
-                       break;
-
-               case ICMD_IF_LEQ:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       x86_64_emit_if_lcc(X86_64_CC_E, src, iptr);
-                       break;
-
-               case ICMD_IF_LLT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       x86_64_emit_if_lcc(X86_64_CC_L, src, iptr);
-                       break;
-
-               case ICMD_IF_LLE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       x86_64_emit_if_lcc(X86_64_CC_LE, src, iptr);
-                       break;
-
-               case ICMD_IF_LNE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       x86_64_emit_if_lcc(X86_64_CC_NE, src, iptr);
-                       break;
-
-               case ICMD_IF_LGT:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       x86_64_emit_if_lcc(X86_64_CC_G, src, iptr);
-                       break;
-
-               case ICMD_IF_LGE:       /* ..., value ==> ...                         */
-                                       /* op1 = target JavaVM pc, val.l = constant   */
-
-                       x86_64_emit_if_lcc(X86_64_CC_GE, src, iptr);
-                       break;
-
-               case ICMD_IF_ICMPEQ:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_icmpcc(X86_64_CC_E, src, iptr);
-                       break;
-
-               case ICMD_IF_LCMPEQ:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_ACMPEQ:    /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_lcmpcc(X86_64_CC_E, src, iptr);
-                       break;
-
-               case ICMD_IF_ICMPNE:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_icmpcc(X86_64_CC_NE, src, iptr);
-                       break;
-
-               case ICMD_IF_LCMPNE:    /* ..., value, value ==> ...                  */
-               case ICMD_IF_ACMPNE:    /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_lcmpcc(X86_64_CC_NE, src, iptr);
-                       break;
-
-               case ICMD_IF_ICMPLT:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_icmpcc(X86_64_CC_L, src, iptr);
-                       break;
-
-               case ICMD_IF_LCMPLT:    /* ..., value, value ==> ...                  */
-                                   /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_lcmpcc(X86_64_CC_L, src, iptr);
-                       break;
-
-               case ICMD_IF_ICMPGT:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_icmpcc(X86_64_CC_G, src, iptr);
-                       break;
-
-               case ICMD_IF_LCMPGT:    /* ..., value, value ==> ...                  */
-                                /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_lcmpcc(X86_64_CC_G, src, iptr);
-                       break;
-
-               case ICMD_IF_ICMPLE:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_icmpcc(X86_64_CC_LE, src, iptr);
-                       break;
-
-               case ICMD_IF_LCMPLE:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_lcmpcc(X86_64_CC_LE, src, iptr);
-                       break;
-
-               case ICMD_IF_ICMPGE:    /* ..., value, value ==> ...                  */
-                                       /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_icmpcc(X86_64_CC_GE, src, iptr);
-                       break;
-
-               case ICMD_IF_LCMPGE:    /* ..., value, value ==> ...                  */
-                                   /* op1 = target JavaVM pc                     */
-
-                       x86_64_emit_if_lcmpcc(X86_64_CC_GE, src, iptr);
-                       break;
-
-               /* (value xx 0) ? IFxx_ICONST : ELSE_ICONST                           */
-
-               case ICMD_ELSE_ICONST:  /* handled by IFxx_ICONST                     */
-                       break;
-
-               case ICMD_IFEQ_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if (s1 == d) {
-                                       M_INTMOVE(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                               }
-                               x86_64_movl_imm_reg(iptr[1].val.i, d);
-                       }
-                       x86_64_movl_imm_reg(s3, REG_ITMP2);
-                       x86_64_testl_reg_reg(s1, s1);
-                       x86_64_cmovccl_reg_reg(X86_64_CC_E, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFNE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if (s1 == d) {
-                                       M_INTMOVE(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                               }
-                               x86_64_movl_imm_reg(iptr[1].val.i, d);
-                       }
-                       x86_64_movl_imm_reg(s3, REG_ITMP2);
-                       x86_64_testl_reg_reg(s1, s1);
-                       x86_64_cmovccl_reg_reg(X86_64_CC_NE, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFLT_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if (s1 == d) {
-                                       M_INTMOVE(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                               }
-                               x86_64_movl_imm_reg(iptr[1].val.i, d);
-                       }
-                       x86_64_movl_imm_reg(s3, REG_ITMP2);
-                       x86_64_testl_reg_reg(s1, s1);
-                       x86_64_cmovccl_reg_reg(X86_64_CC_L, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFGE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if (s1 == d) {
-                                       M_INTMOVE(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                               }
-                               x86_64_movl_imm_reg(iptr[1].val.i, d);
-                       }
-                       x86_64_movl_imm_reg(s3, REG_ITMP2);
-                       x86_64_testl_reg_reg(s1, s1);
-                       x86_64_cmovccl_reg_reg(X86_64_CC_GE, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFGT_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if (s1 == d) {
-                                       M_INTMOVE(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                               }
-                               x86_64_movl_imm_reg(iptr[1].val.i, d);
-                       }
-                       x86_64_movl_imm_reg(s3, REG_ITMP2);
-                       x86_64_testl_reg_reg(s1, s1);
-                       x86_64_cmovccl_reg_reg(X86_64_CC_G, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_IFLE_ICONST:  /* ..., value ==> ..., constant               */
-                                       /* val.i = constant                           */
-
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       s3 = iptr->val.i;
-                       if (iptr[1].opc == ICMD_ELSE_ICONST) {
-                               if (s1 == d) {
-                                       M_INTMOVE(s1, REG_ITMP1);
-                                       s1 = REG_ITMP1;
-                               }
-                               x86_64_movl_imm_reg(iptr[1].val.i, d);
-                       }
-                       x86_64_movl_imm_reg(s3, REG_ITMP2);
-                       x86_64_testl_reg_reg(s1, s1);
-                       x86_64_cmovccl_reg_reg(X86_64_CC_LE, REG_ITMP2, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-
-               case ICMD_IRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_LRETURN:
-               case ICMD_ARETURN:
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               x86_64_mov_membase_reg(REG_SP, 8 * maxmemuse, argintregs[0]);
-                               x86_64_mov_imm_reg((s8) builtin_monitorexit, REG_ITMP1);
-                               x86_64_call_reg(REG_ITMP1);
-                       }
-#endif
-                       var_to_reg_int(s1, src, REG_RESULT);
-                       M_INTMOVE(s1, REG_RESULT);
-                       goto nowperformreturn;
-
-               case ICMD_FRETURN:      /* ..., retvalue ==> ...                      */
-               case ICMD_DRETURN:
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               x86_64_mov_membase_reg(REG_SP, 8 * maxmemuse, argintregs[0]);
-                               x86_64_mov_imm_reg((s8) builtin_monitorexit, REG_ITMP1);
-                               x86_64_call_reg(REG_ITMP1);
-                       }
-#endif
-                       var_to_reg_flt(s1, src, REG_FRESULT);
-                       M_FLTMOVE(s1, REG_FRESULT);
-                       goto nowperformreturn;
-
-               case ICMD_RETURN:      /* ...  ==> ...                                */
-
-#ifdef USE_THREADS
-                       if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
-                               x86_64_mov_membase_reg(REG_SP, 8 * maxmemuse, argintregs[0]);
-                               x86_64_mov_imm_reg((s8) builtin_monitorexit, REG_ITMP1);
-                               x86_64_call_reg(REG_ITMP1);
-                       }
-#endif
-
-nowperformreturn:
-                       {
-                       int r, p;
-                       
-                       p = parentargs_base;
-                       
-                       /* call trace function */
-                       if (runverbose) {
-                               x86_64_alu_imm_reg(X86_64_SUB, 2 * 8, REG_SP);
-
-                               x86_64_mov_reg_membase(REG_RESULT, REG_SP, 0 * 8);
-                               x86_64_movq_reg_membase(REG_FRESULT, REG_SP, 1 * 8);
-
-                               x86_64_mov_imm_reg((s8) method, argintregs[0]);
-                               x86_64_mov_reg_reg(REG_RESULT, argintregs[1]);
-                               M_FLTMOVE(REG_FRESULT, argfltregs[0]);
-                               M_FLTMOVE(REG_FRESULT, argfltregs[1]);
-
-                               x86_64_mov_imm_reg((s8) builtin_displaymethodstop, REG_ITMP1);
-                               x86_64_call_reg(REG_ITMP1);
-
-                               x86_64_mov_membase_reg(REG_SP, 0 * 8, REG_RESULT);
-                               x86_64_movq_membase_reg(REG_SP, 1 * 8, REG_FRESULT);
-
-                               x86_64_alu_imm_reg(X86_64_ADD, 2 * 8, REG_SP);
-                       }
-
-                       /* restore saved registers                                        */
-                       for (r = savintregcnt - 1; r >= maxsavintreguse; r--) {
-                               p--; x86_64_mov_membase_reg(REG_SP, p * 8, savintregs[r]);
-                       }
-                       for (r = savfltregcnt - 1; r >= maxsavfltreguse; r--) {
-                               p--; x86_64_movq_membase_reg(REG_SP, p * 8, savfltregs[r]);
-                       }
-
-                       /* deallocate stack                                               */
-                       if (parentargs_base) {
-                               x86_64_alu_imm_reg(X86_64_ADD, parentargs_base * 8, REG_SP);
-                       }
-
-                       x86_64_ret();
-                       ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_TABLESWITCH:  /* ..., index ==> ...                         */
-                       {
-                               s4 i, l, *s4ptr;
-                               void **tptr;
-
-                               tptr = (void **) iptr->target;
-
-                               s4ptr = iptr->val.a;
-                               l = s4ptr[1];                          /* low     */
-                               i = s4ptr[2];                          /* high    */
-
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               M_INTMOVE(s1, REG_ITMP1);
-                               if (l != 0) {
-                                       x86_64_alul_imm_reg(X86_64_SUB, l, REG_ITMP1);
-                               }
-                               i = i - l + 1;
-
-                /* range check */
-                               x86_64_alul_imm_reg(X86_64_CMP, i - 1, REG_ITMP1);
-                               x86_64_jcc(X86_64_CC_A, 0);
-
-                /* mcode_addreference(BlockPtrOfPC(s4ptr[0]), mcodeptr); */
-                               mcode_addreference((basicblock *) tptr[0], mcodeptr);
-
-                               /* build jump table top down and use address of lowest entry */
-
-                /* s4ptr += 3 + i; */
-                               tptr += i;
-
-                               while (--i >= 0) {
-                                       /* dseg_addtarget(BlockPtrOfPC(*--s4ptr)); */
-                                       dseg_addtarget((basicblock *) tptr[0]); 
-                                       --tptr;
-                               }
-
-                               /* length of dataseg after last dseg_addtarget is used by load */
-
-                               x86_64_mov_imm_reg(0, REG_ITMP2);
-                               dseg_adddata(mcodeptr);
-                               x86_64_mov_memindex_reg(-dseglen, REG_ITMP2, REG_ITMP1, 3, REG_ITMP1);
-                               x86_64_jmp_reg(REG_ITMP1);
-                               ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_LOOKUPSWITCH: /* ..., key ==> ...                           */
-                       {
-                               s4 i, l, val, *s4ptr;
-                               void **tptr;
-
-                               tptr = (void **) iptr->target;
-
-                               s4ptr = iptr->val.a;
-                               l = s4ptr[0];                          /* default  */
-                               i = s4ptr[1];                          /* count    */
-                       
-                               MCODECHECK((i<<2)+8);
-                               var_to_reg_int(s1, src, REG_ITMP1);    /* reg compare should always be faster */
-                               while (--i >= 0) {
-                                       s4ptr += 2;
-                                       ++tptr;
-
-                                       val = s4ptr[0];
-                                       x86_64_alul_imm_reg(X86_64_CMP, val, s1);
-                                       x86_64_jcc(X86_64_CC_E, 0);
-                                       /* mcode_addreference(BlockPtrOfPC(s4ptr[1]), mcodeptr); */
-                                       mcode_addreference((basicblock *) tptr[0], mcodeptr); 
-                               }
-
-                               x86_64_jmp_imm(0);
-                               /* mcode_addreference(BlockPtrOfPC(l), mcodeptr); */
-                       
-                               tptr = (void **) iptr->target;
-                               mcode_addreference((basicblock *) tptr[0], mcodeptr);
-
-                               ALIGNCODENOP;
-                       }
-                       break;
-
-
-               case ICMD_BUILTIN3:     /* ..., arg1, arg2, arg3 ==> ...              */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 3;
-                       goto gen_method;
-
-               case ICMD_BUILTIN2:     /* ..., arg1, arg2 ==> ...                    */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 2;
-                       goto gen_method;
-
-               case ICMD_BUILTIN1:     /* ..., arg1 ==> ...                          */
-                                       /* op1 = return type, val.a = function pointer*/
-                       s3 = 1;
-                       goto gen_method;
-
-               case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ...            */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEVIRTUAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-               case ICMD_INVOKEINTERFACE:/*.., objectref, [arg1, [arg2 ...]] ==> ... */
-                                       /* op1 = arg count, val.a = method pointer    */
-
-                       s3 = iptr->op1;
-
-gen_method: {
-                       methodinfo   *m;
-                       classinfo    *ci;
-                       stackptr     tmpsrc;
-                       int iarg = 0;
-                       int farg = 0;
-
-                       MCODECHECK((s3 << 1) + 64);
-
-                       tmpsrc = src;
-                       s2 = s3;
-
-                       /* copy arguments to registers or stack location                  */
-                       for (; --s3 >= 0; src = src->prev) {
-                               IS_INT_LNG_TYPE(src->type) ? iarg++ : farg++;
-                       }
-
-                       src = tmpsrc;
-                       s3 = s2;
-
-                       s2 = (iarg > intreg_argnum) ? iarg - intreg_argnum : 0 + (farg > fltreg_argnum) ? farg - fltreg_argnum : 0;
-
-                       for (; --s3 >= 0; src = src->prev) {
-                               IS_INT_LNG_TYPE(src->type) ? iarg-- : farg--;
-                               if (src->varkind == ARGVAR) {
-                                       if (IS_INT_LNG_TYPE(src->type)) {
-                                               if (iarg >= intreg_argnum) {
-                                                       s2--;
-                                               }
-                                       } else {
-                                               if (farg >= fltreg_argnum) {
-                                                       s2--;
-                                               }
-                                       }
-                                       continue;
-                               }
-
-                               if (IS_INT_LNG_TYPE(src->type)) {
-                                       if (iarg < intreg_argnum) {
-                                               s1 = argintregs[iarg];
-                                               var_to_reg_int(d, src, s1);
-                                               M_INTMOVE(d, s1);
-
-                                       } else {
-                                               var_to_reg_int(d, src, REG_ITMP1);
-                                               s2--;
-                                               x86_64_mov_reg_membase(d, REG_SP, s2 * 8);
-                                       }
-
-                               } else {
-                                       if (farg < fltreg_argnum) {
-                                               s1 = argfltregs[farg];
-                                               var_to_reg_flt(d, src, s1);
-                                               M_FLTMOVE(d, s1);
-
-                                       } else {
-                                               var_to_reg_flt(d, src, REG_FTMP1);
-                                               s2--;
-                                               x86_64_movq_reg_membase(d, REG_SP, s2 * 8);
-                                       }
-                               }
-                       } /* end of for */
-
-                       m = iptr->val.a;
-                       switch (iptr->opc) {
-                               case ICMD_BUILTIN3:
-                               case ICMD_BUILTIN2:
-                               case ICMD_BUILTIN1:
-
-                                       a = (s8) m;
-                                       d = iptr->op1;
-
-                                       x86_64_mov_imm_reg(a, REG_ITMP1);
-                                       x86_64_call_reg(REG_ITMP1);
-                                       break;
-
-                               case ICMD_INVOKESTATIC:
-
-                                       a = (s8) m->stubroutine;
-                                       d = m->returntype;
-
-                                       x86_64_mov_imm_reg(a, REG_ITMP2);
-                                       x86_64_call_reg(REG_ITMP2);
-                                       break;
-
-                               case ICMD_INVOKESPECIAL:
-
-                                       a = (s8) m->stubroutine;
-                                       d = m->returntype;
-
-                                       gen_nullptr_check(argintregs[0]);    /* first argument contains pointer */
-                                       x86_64_mov_membase_reg(argintregs[0], 0, REG_ITMP2);    /* access memory for hardware nullptr */
-                                       x86_64_mov_imm_reg(a, REG_ITMP2);
-                                       x86_64_call_reg(REG_ITMP2);
-                                       break;
-
-                               case ICMD_INVOKEVIRTUAL:
-
-                                       d = m->returntype;
-
-                                       gen_nullptr_check(argintregs[0]);
-                                       x86_64_mov_membase_reg(argintregs[0], OFFSET(java_objectheader, vftbl), REG_ITMP2);
-                                       x86_64_mov_membase32_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + sizeof(methodptr) * m->vftblindex, REG_ITMP1);
-                                       x86_64_call_reg(REG_ITMP1);
-                                       break;
-
-                               case ICMD_INVOKEINTERFACE:
-
-                                       ci = m->class;
-                                       d = m->returntype;
-
-                                       gen_nullptr_check(argintregs[0]);
-                                       x86_64_mov_membase_reg(argintregs[0], OFFSET(java_objectheader, vftbl), REG_ITMP2);
-                                       x86_64_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, interfacetable[0]) - sizeof(methodptr) * ci->index, REG_ITMP2);
-                                       x86_64_mov_membase32_reg(REG_ITMP2, sizeof(methodptr) * (m - ci->methods), REG_ITMP1);
-                                       x86_64_call_reg(REG_ITMP1);
-                                       break;
-
-                               default:
-                                       d = 0;
-                                       sprintf(logtext, "Unkown ICMD-Command: %d", iptr->opc);
-                                       error();
-                               }
-
-                       /* d contains return type */
-
-                       if (d != TYPE_VOID) {
-                               if (IS_INT_LNG_TYPE(iptr->dst->type)) {
-                                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                                       M_INTMOVE(REG_RESULT, s1);
-                                       store_reg_to_var_int(iptr->dst, s1);
-
-                               } else {
-                                       s1 = reg_of_var(iptr->dst, REG_FRESULT);
-                                       M_FLTMOVE(REG_FRESULT, s1);
-                                       store_reg_to_var_flt(iptr->dst, s1);
-                               }
-                       }
-                       }
-                       break;
-
-
-               case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          return (sub != NULL) &&
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL);
- *
- *          superclass is a class:
- *
- *          return ((sub != NULL) && (0
- *                  <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                  super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       var_to_reg_int(s1, src, REG_ITMP1);
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       if (s1 == d) {
-                               M_INTMOVE(s1, REG_ITMP1);
-                               s1 = REG_ITMP1;
-                       }
-                       x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                       if (iptr->op1) {                               /* class/interface */
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       x86_64_test_reg_reg(s1, s1);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 3;    /* mov_membase_reg */
-                                       CALCOFFSETBYTES(a, s1, OFFSET(java_objectheader, vftbl));
-
-                                       a += 3;    /* movl_membase_reg - only if REG_ITMP2 == R10 */
-                                       CALCOFFSETBYTES(a, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
-                                       
-                                       a += 3;    /* sub */
-                                       CALCOFFSETBYTES(a, 0, super->index);
-                                       
-                                       a += 3;    /* test */
-
-                                       a += 6;    /* jcc */
-                                       a += 3;    /* mov_membase_reg */
-                                       CALCOFFSETBYTES(a, REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
-
-                                       a += 3;    /* test */
-                                       a += 4;    /* setcc */
-
-                                       x86_64_jcc(X86_64_CC_E, a);
-
-                                       x86_64_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       x86_64_movl_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetablelength), REG_ITMP2);
-                                       x86_64_alu_imm_reg(X86_64_SUB, super->index, REG_ITMP2);
-                                       x86_64_test_reg_reg(REG_ITMP2, REG_ITMP2);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 0;
-                                       a += 3;    /* mov_membase_reg */
-                                       CALCOFFSETBYTES(a, REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
-
-                                       a += 3;    /* test */
-                                       a += 4;    /* setcc */
-
-                                       x86_64_jcc(X86_64_CC_LE, a);
-                                       x86_64_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*), REG_ITMP1);
-                                       x86_64_test_reg_reg(REG_ITMP1, REG_ITMP1);
-                                       x86_64_setcc_reg(X86_64_CC_NE, d);
-
-                               } else {                                   /* class           */
-                                       x86_64_test_reg_reg(s1, s1);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 3;    /* mov_membase_reg */
-                                       CALCOFFSETBYTES(a, s1, OFFSET(java_objectheader, vftbl));
-
-                                       a += 10;   /* mov_imm_reg */
-
-                                       a += 2;    /* movl_membase_reg - only if REG_ITMP1 == RAX */
-                                       CALCOFFSETBYTES(a, REG_ITMP1, OFFSET(vftbl, baseval));
-                                       
-                                       a += 3;    /* movl_membase_reg - only if REG_ITMP2 == R10 */
-                                       CALCOFFSETBYTES(a, REG_ITMP2, OFFSET(vftbl, baseval));
-                                       
-                                       a += 3;    /* movl_membase_reg - only if REG_ITMP2 == R10 */
-                                       CALCOFFSETBYTES(a, REG_ITMP2, OFFSET(vftbl, diffval));
-                                       
-                                       a += 3;    /* sub */
-                                       a += 3;    /* xor */
-                                       a += 3;    /* cmp */
-                                       a += 4;    /* setcc */
-
-                                       x86_64_jcc(X86_64_CC_E, a);
-
-                                       x86_64_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       x86_64_mov_imm_reg((s8) super->vftbl, REG_ITMP2);
-                                       x86_64_movl_membase_reg(REG_ITMP1, OFFSET(vftbl, baseval), REG_ITMP1);
-                                       x86_64_movl_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP3);
-                                       x86_64_movl_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
-                                       x86_64_alu_reg_reg(X86_64_SUB, REG_ITMP3, REG_ITMP1);
-                                       x86_64_alu_reg_reg(X86_64_XOR, d, d);
-                                       x86_64_alu_reg_reg(X86_64_CMP, REG_ITMP2, REG_ITMP1);
-                                       x86_64_setcc_reg(X86_64_CC_BE, d);
-                               }
-                       }
-                       else
-                               panic("internal error: no inlined array instanceof");
-                       }
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
-
-                                     /* op1:   0 == array, 1 == class                */
-                                     /* val.a: (classinfo*) superclass               */
-
-/*          superclass is an interface:
- *
- *          OK if ((sub == NULL) ||
- *                 (sub->vftbl->interfacetablelength > super->index) &&
- *                 (sub->vftbl->interfacetable[-super->index] != NULL));
- *
- *          superclass is a class:
- *
- *          OK if ((sub == NULL) || (0
- *                 <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- *                 super->vftbl->diffvall));
- */
-
-                       {
-                       classinfo *super = (classinfo*) iptr->val.a;
-                       
-                       d = reg_of_var(iptr->dst, REG_ITMP3);
-                       var_to_reg_int(s1, src, d);
-                       if (iptr->op1) {                               /* class/interface */
-                               if (super->flags & ACC_INTERFACE) {        /* interface       */
-                                       x86_64_test_reg_reg(s1, s1);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 3;    /* mov_membase_reg */
-                                       CALCOFFSETBYTES(a, s1, OFFSET(java_objectheader, vftbl));
-
-                                       a += 3;    /* movl_membase_reg - only if REG_ITMP2 == R10 */
-                                       CALCOFFSETBYTES(a, REG_ITMP1, OFFSET(vftbl, interfacetablelength));
-
-                                       a += 3;    /* sub */
-                                       CALCOFFSETBYTES(a, 0, super->index);
-
-                                       a += 3;    /* test */
-                                       a += 6;    /* jcc */
-
-                                       a += 3;    /* mov_membase_reg */
-                                       CALCOFFSETBYTES(a, REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*));
-
-                                       a += 3;    /* test */
-                                       a += 6;    /* jcc */
-
-                                       x86_64_jcc(X86_64_CC_E, a);
-
-                                       x86_64_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       x86_64_movl_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetablelength), REG_ITMP2);
-                                       x86_64_alu_imm_reg(X86_64_SUB, super->index, REG_ITMP2);
-                                       x86_64_test_reg_reg(REG_ITMP2, REG_ITMP2);
-                                       x86_64_jcc(X86_64_CC_LE, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-                                       x86_64_mov_membase_reg(REG_ITMP1, OFFSET(vftbl, interfacetable[0]) - super->index * sizeof(methodptr*), REG_ITMP2);
-                                       x86_64_test_reg_reg(REG_ITMP2, REG_ITMP2);
-                                       x86_64_jcc(X86_64_CC_E, 0);
-                                       mcode_addxcastrefs(mcodeptr);
-
-                               } else {                                     /* class           */
-                                       x86_64_test_reg_reg(s1, s1);
-
-                                       /* TODO: clean up this calculation */
-                                       a = 3;    /* mov_membase_reg */
-                                       CALCOFFSETBYTES(a, s1, OFFSET(java_objectheader, vftbl));
-                                       a += 10;   /* mov_imm_reg */
-                                       a += 2;    /* movl_membase_reg - only if REG_ITMP1 == RAX */
-                                       CALCOFFSETBYTES(a, REG_ITMP1, OFFSET(vftbl, baseval));
-
-                                       if (d != REG_ITMP3) {
-                                               a += 3;    /* movl_membase_reg - only if REG_ITMP2 == R10 */
-                                               CALCOFFSETBYTES(a, REG_ITMP2, OFFSET(vftbl, baseval));
-                                               a += 3;    /* movl_membase_reg - only if REG_ITMP2 == R10 */
-                                               CALCOFFSETBYTES(a, REG_ITMP2, OFFSET(vftbl, diffval));
-                                               a += 3;    /* sub */
-                                               
-                                       } else {
-                                               a += 3;    /* movl_membase_reg - only if REG_ITMP2 == R10 */
-                                               CALCOFFSETBYTES(a, REG_ITMP2, OFFSET(vftbl, baseval));
-                                               a += 3;    /* sub */
-                                               a += 10;   /* mov_imm_reg */
-                                               a += 3;    /* movl_membase_reg - only if REG_ITMP2 == R10 */
-                                               CALCOFFSETBYTES(a, REG_ITMP2, OFFSET(vftbl, diffval));
-                                       }
-
-                                       a += 3;    /* cmp */
-                                       a += 6;    /* jcc */
-
-                                       x86_64_jcc(X86_64_CC_E, a);
-
-                                       x86_64_mov_membase_reg(s1, OFFSET(java_objectheader, vftbl), REG_ITMP1);
-                                       x86_64_mov_imm_reg((s8) super->vftbl, REG_ITMP2);
-                                       x86_64_movl_membase_reg(REG_ITMP1, OFFSET(vftbl, baseval), REG_ITMP1);
-                                       if (d != REG_ITMP3) {
-                                               x86_64_movl_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP3);
-                                               x86_64_movl_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
-                                               x86_64_alu_reg_reg(X86_64_SUB, REG_ITMP3, REG_ITMP1);
-
-                                       } else {
-                                               x86_64_movl_membase_reg(REG_ITMP2, OFFSET(vftbl, baseval), REG_ITMP2);
-                                               x86_64_alu_reg_reg(X86_64_SUB, REG_ITMP2, REG_ITMP1);
-                                               x86_64_mov_imm_reg((s8) super->vftbl, REG_ITMP2);
-                                               x86_64_movl_membase_reg(REG_ITMP2, OFFSET(vftbl, diffval), REG_ITMP2);
-                                       }
-                                       x86_64_alu_reg_reg(X86_64_CMP, REG_ITMP2, REG_ITMP1);
-                                       x86_64_jcc(X86_64_CC_A, 0);    /* (u) REG_ITMP1 > (u) REG_ITMP2 -> jump */
-                                       mcode_addxcastrefs(mcodeptr);
-                               }
-
-                       } else
-                               panic("internal error: no inlined array checkcast");
-                       }
-                       M_INTMOVE(s1, d);
-                       store_reg_to_var_int(iptr->dst, d);
-                       break;
-
-               case ICMD_CHECKASIZE:  /* ..., size ==> ..., size                     */
-
-                       if (src->flags & INMEMORY) {
-                               x86_64_alul_imm_membase(X86_64_CMP, 0, REG_SP, src->regoff * 8);
-                               
-                       } else {
-                               x86_64_testl_reg_reg(src->regoff, src->regoff);
-                       }
-                       x86_64_jcc(X86_64_CC_L, 0);
-                       mcode_addxcheckarefs(mcodeptr);
-                       break;
-
-               case ICMD_MULTIANEWARRAY:/* ..., cnt1, [cnt2, ...] ==> ..., arrayref  */
-                                        /* op1 = dimension, val.a = array descriptor */
-
-                       /* check for negative sizes and copy sizes to stack if necessary  */
-
-                       MCODECHECK((iptr->op1 << 1) + 64);
-
-                       for (s1 = iptr->op1; --s1 >= 0; src = src->prev) {
-                               var_to_reg_int(s2, src, REG_ITMP1);
-                               x86_64_testl_reg_reg(s2, s2);
-                               x86_64_jcc(X86_64_CC_L, 0);
-                               mcode_addxcheckarefs(mcodeptr);
-
-                               /* copy sizes to stack (argument numbers >= INT_ARG_CNT)      */
-
-                               if (src->varkind != ARGVAR) {
-                                       x86_64_mov_reg_membase(s2, REG_SP, (s1 + intreg_argnum) * 8);
-                               }
-                       }
-
-                       /* a0 = dimension count */
-                       x86_64_mov_imm_reg(iptr->op1, argintregs[0]);
-
-                       /* a1 = arraydescriptor */
-                       x86_64_mov_imm_reg((s8) iptr->val.a, argintregs[1]);
-
-                       /* a2 = pointer to dimensions = stack pointer */
-                       x86_64_mov_reg_reg(REG_SP, argintregs[2]);
-
-                       x86_64_mov_imm_reg((s8) (builtin_nmultianewarray), REG_ITMP1);
-                       x86_64_call_reg(REG_ITMP1);
-
-                       s1 = reg_of_var(iptr->dst, REG_RESULT);
-                       M_INTMOVE(REG_RESULT, s1);
-                       store_reg_to_var_int(iptr->dst, s1);
-                       break;
-
-               default: sprintf(logtext, "Unknown pseudo command: %d", iptr->opc);
-                        error();
-       } /* switch */
-               
-       } /* for instruction */
-               
-       /* copy values to interface registers */
-
-       src = bptr->outstack;
-       len = bptr->outdepth;
-       MCODECHECK(64+len);
-       while (src) {
-               len--;
-               if ((src->varkind != STACKVAR)) {
-                       s2 = src->type;
-                       if (IS_FLT_DBL_TYPE(s2)) {
-                               var_to_reg_flt(s1, src, REG_FTMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_FLTMOVE(s1, interfaces[len][s2].regoff);
-
-                               } else {
-                                       x86_64_movq_reg_membase(s1, REG_SP, 8 * interfaces[len][s2].regoff);
-                               }
-
-                       } else {
-                               var_to_reg_int(s1, src, REG_ITMP1);
-                               if (!(interfaces[len][s2].flags & INMEMORY)) {
-                                       M_INTMOVE(s1, interfaces[len][s2].regoff);
-
-                               } else {
-                                       x86_64_mov_reg_membase(s1, REG_SP, interfaces[len][s2].regoff * 8);
-                               }
-                       }
-               }
-               src = src->prev;
-       }
-       } /* if (bptr -> flags >= BBREACHED) */
-       } /* for basic block */
-
-       /* bptr -> mpc = (int)((u1*) mcodeptr - mcodebase); */
-
-       {
-
-       /* generate bound check stubs */
-       u1 *xcodeptr = NULL;
-       
-       for (; xboundrefs != NULL; xboundrefs = xboundrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch(mcodebase + xboundrefs->branchpos, 
-                               xboundrefs->branchpos, xcodeptr - mcodebase - (10 + 10 + 3));
-                       continue;
-               }
-
-               gen_resolvebranch(mcodebase + xboundrefs->branchpos, 
-                                 xboundrefs->branchpos, mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               x86_64_mov_imm_reg(0, REG_ITMP2_XPC);    /* 10 bytes */
-               dseg_adddata(mcodeptr);
-               x86_64_mov_imm_reg(xboundrefs->branchpos - 6, REG_ITMP1);    /* 10 bytes */
-               x86_64_alu_reg_reg(X86_64_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 3 bytes */
-
-               if (xcodeptr != NULL) {
-                       x86_64_jmp_imm((xcodeptr - mcodeptr) - 5);
-
-               } else {
-                       xcodeptr = mcodeptr;
-
-                       x86_64_mov_imm_reg((s8) proto_java_lang_ArrayIndexOutOfBoundsException, REG_ITMP1_XPTR);
-                       x86_64_mov_imm_reg((s8) asm_handle_exception, REG_ITMP3);
-                       x86_64_jmp_reg(REG_ITMP3);
-               }
-       }
-
-       /* generate negative array size check stubs */
-       xcodeptr = NULL;
-       
-       for (; xcheckarefs != NULL; xcheckarefs = xcheckarefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch(mcodebase + xcheckarefs->branchpos, 
-                               xcheckarefs->branchpos, xcodeptr - mcodebase - (10 + 10 + 3));
-                       continue;
-               }
-
-               gen_resolvebranch(mcodebase + xcheckarefs->branchpos, 
-                                 xcheckarefs->branchpos, mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               x86_64_mov_imm_reg(0, REG_ITMP2_XPC);    /* 10 bytes */
-               dseg_adddata(mcodeptr);
-               x86_64_mov_imm_reg(xcheckarefs->branchpos - 6, REG_ITMP1);    /* 10 bytes */
-               x86_64_alu_reg_reg(X86_64_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 3 bytes */
-
-               if (xcodeptr != NULL) {
-                       x86_64_jmp_imm((xcodeptr - mcodeptr) - 5);
-
-               } else {
-                       xcodeptr = mcodeptr;
-
-                       x86_64_mov_imm_reg((s8) proto_java_lang_NegativeArraySizeException, REG_ITMP1_XPTR);
-                       x86_64_mov_imm_reg((s8) asm_handle_exception, REG_ITMP3);
-                       x86_64_jmp_reg(REG_ITMP3);
-               }
-       }
-
-       /* generate cast check stubs */
-       xcodeptr = NULL;
-       
-       for (; xcastrefs != NULL; xcastrefs = xcastrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch(mcodebase + xcastrefs->branchpos, 
-                               xcastrefs->branchpos, xcodeptr - mcodebase - (10 + 10 + 3));
-                       continue;
-               }
-
-               gen_resolvebranch(mcodebase + xcastrefs->branchpos, 
-                                 xcastrefs->branchpos, mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               x86_64_mov_imm_reg(0, REG_ITMP2_XPC);    /* 10 bytes */
-               dseg_adddata(mcodeptr);
-               x86_64_mov_imm_reg(xcastrefs->branchpos - 6, REG_ITMP1);    /* 10 bytes */
-               x86_64_alu_reg_reg(X86_64_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 3 bytes */
-
-               if (xcodeptr != NULL) {
-                       x86_64_jmp_imm((xcodeptr - mcodeptr) - 5);
-               
-               } else {
-                       xcodeptr = mcodeptr;
-
-                       x86_64_mov_imm_reg((s8) proto_java_lang_ClassCastException, REG_ITMP1_XPTR);
-                       x86_64_mov_imm_reg((s8) asm_handle_exception, REG_ITMP3);
-                       x86_64_jmp_reg(REG_ITMP3);
-               }
-       }
-
-#ifdef SOFTNULLPTRCHECK
-       /* generate null pointer check stubs */
-       xcodeptr = NULL;
-       
-       for (; xnullrefs != NULL; xnullrefs = xnullrefs->next) {
-               if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
-                       gen_resolvebranch(mcodebase + xnullrefs->branchpos, 
-                               xnullrefs->branchpos, xcodeptr - mcodebase - (10 + 10 + 3));
-                       continue;
-               }
-
-               gen_resolvebranch(mcodebase + xnullrefs->branchpos, 
-                                 xnullrefs->branchpos, mcodeptr - mcodebase);
-
-               MCODECHECK(8);
-
-               x86_64_mov_imm_reg(0, REG_ITMP2_XPC);    /* 10 bytes */
-               dseg_adddata(mcodeptr);
-               x86_64_mov_imm_reg(xnullrefs->branchpos - 6, REG_ITMP1);    /* 10 bytes */
-               x86_64_alu_reg_reg(X86_64_ADD, REG_ITMP1, REG_ITMP2_XPC);    /* 3 bytes */
-
-               if (xcodeptr != NULL) {
-                       x86_64_jmp_imm((xcodeptr - mcodeptr) - 5);
-               
-               } else {
-                       xcodeptr = mcodeptr;
-
-                       x86_64_mov_imm_reg((s8) proto_java_lang_NullPointerException, REG_ITMP1_XPTR);
-                       x86_64_mov_imm_reg((s8) asm_handle_exception, REG_ITMP3);
-                       x86_64_jmp_reg(REG_ITMP3);
-               }
-       }
-
-#endif
-       }
-
-       mcode_finish((int)((u1*) mcodeptr - mcodebase));
-}
-
-
-/* function createcompilerstub *************************************************
-
-       creates a stub routine which calls the compiler
-       
-*******************************************************************************/
-
-#define COMPSTUBSIZE 23
-
-u1 *createcompilerstub(methodinfo *m)
-{
-       u1 *s = CNEW(u1, COMPSTUBSIZE);     /* memory to hold the stub            */
-       mcodeptr = s;                       /* code generation pointer            */
-
-                                           /* code for the stub                  */
-       x86_64_mov_imm_reg((s8) m, REG_ITMP1); /* pass method pointer to compiler */
-       x86_64_mov_imm_reg((s8) asm_call_jit_compiler, REG_ITMP3);/* load address */
-       x86_64_jmp_reg(REG_ITMP3);          /* jump to compiler                   */
-
-#ifdef STATISTICS
-       count_cstub_len += COMPSTUBSIZE;
-#endif
-
-       return (u1*) s;
-}
-
-
-/* function removecompilerstub *************************************************
-
-     deletes a compilerstub from memory  (simply by freeing it)
-
-*******************************************************************************/
-
-void removecompilerstub(u1 *stub) 
-{
-       CFREE(stub, COMPSTUBSIZE);
-}
-
-/* function: createnativestub **************************************************
-
-       creates a stub routine which calls a native method
-
-*******************************************************************************/
-
-#define NATIVESTUBSIZE 420
-
-u1 *createnativestub(functionptr f, methodinfo *m)
-{
-       u1 *s = CNEW(u1, NATIVESTUBSIZE);   /* memory to hold the stub            */
-       mcodeptr = s;                       /* make macros work                   */
-
-       reg_init();
-
-       if (runverbose) {
-               int p, l, s1;
-
-               x86_64_alu_imm_reg(X86_64_SUB, (6 + 8 + 1) * 8, REG_SP);
-
-               x86_64_mov_reg_membase(argintregs[0], REG_SP, 1 * 8);
-               x86_64_mov_reg_membase(argintregs[1], REG_SP, 2 * 8);
-               x86_64_mov_reg_membase(argintregs[2], REG_SP, 3 * 8);
-               x86_64_mov_reg_membase(argintregs[3], REG_SP, 4 * 8);
-               x86_64_mov_reg_membase(argintregs[4], REG_SP, 5 * 8);
-               x86_64_mov_reg_membase(argintregs[5], REG_SP, 6 * 8);
-
-               x86_64_movq_reg_membase(argfltregs[0], REG_SP, 7 * 8);
-               x86_64_movq_reg_membase(argfltregs[1], REG_SP, 8 * 8);
-               x86_64_movq_reg_membase(argfltregs[2], REG_SP, 9 * 8);
-               x86_64_movq_reg_membase(argfltregs[3], REG_SP, 10 * 8);
-/*             x86_64_movq_reg_membase(argfltregs[4], REG_SP, 11 * 8); */
-/*             x86_64_movq_reg_membase(argfltregs[5], REG_SP, 12 * 8); */
-/*             x86_64_movq_reg_membase(argfltregs[6], REG_SP, 13 * 8); */
-/*             x86_64_movq_reg_membase(argfltregs[7], REG_SP, 14 * 8); */
-
-               descriptor2types(m);                     /* set paramcount and paramtypes */
-
-               /* also show the hex code for floats passed */
-               for (p = 0, l = 0; p < m->paramcount; p++) {
-                       if (IS_FLT_DBL_TYPE(m->paramtypes[p])) {
-                               for (s1 = (m->paramcount > intreg_argnum) ? intreg_argnum - 2 : m->paramcount - 2; s1 >= p; s1--) {
-                                       x86_64_mov_reg_reg(argintregs[s1], argintregs[s1 + 1]);
-                               }
-
-                               x86_64_movd_freg_reg(argfltregs[l], argintregs[p]);
-                               l++;
-                       }
-               }
-
-               x86_64_mov_imm_reg((s8) m, REG_ITMP2);
-               x86_64_mov_reg_membase(REG_ITMP2, REG_SP, 0 * 8);
-/*             x86_64_mov_imm_reg(asm_builtin_trace, REG_ITMP1); */
-               x86_64_mov_imm_reg((s8) builtin_trace_args, REG_ITMP1);
-               x86_64_call_reg(REG_ITMP1);
-
-               x86_64_mov_membase_reg(REG_SP, 1 * 8, argintregs[0]);
-               x86_64_mov_membase_reg(REG_SP, 2 * 8, argintregs[1]);
-               x86_64_mov_membase_reg(REG_SP, 3 * 8, argintregs[2]);
-               x86_64_mov_membase_reg(REG_SP, 4 * 8, argintregs[3]);
-               x86_64_mov_membase_reg(REG_SP, 5 * 8, argintregs[4]);
-               x86_64_mov_membase_reg(REG_SP, 6 * 8, argintregs[5]);
-
-               x86_64_movq_membase_reg(REG_SP, 7 * 8, argfltregs[0]);
-               x86_64_movq_membase_reg(REG_SP, 8 * 8, argfltregs[1]);
-               x86_64_movq_membase_reg(REG_SP, 9 * 8, argfltregs[2]);
-               x86_64_movq_membase_reg(REG_SP, 10 * 8, argfltregs[3]);
-/*             x86_64_movq_membase_reg(REG_SP, 11 * 8, argfltregs[4]); */
-/*             x86_64_movq_membase_reg(REG_SP, 12 * 8, argfltregs[5]); */
-/*             x86_64_movq_membase_reg(REG_SP, 13 * 8, argfltregs[6]); */
-/*             x86_64_movq_membase_reg(REG_SP, 14 * 8, argfltregs[7]); */
-
-               x86_64_alu_imm_reg(X86_64_ADD, (6 + 8 + 1) * 8, REG_SP);
-       }
-
-       x86_64_alu_imm_reg(X86_64_SUB, 7 * 8, REG_SP);    /* keep stack 16-byte aligned */
-
-       /* save callee saved float registers */
-       x86_64_movq_reg_membase(XMM15, REG_SP, 0 * 8);
-       x86_64_movq_reg_membase(XMM14, REG_SP, 1 * 8);
-       x86_64_movq_reg_membase(XMM13, REG_SP, 2 * 8);
-       x86_64_movq_reg_membase(XMM12, REG_SP, 3 * 8);
-       x86_64_movq_reg_membase(XMM11, REG_SP, 4 * 8);
-       x86_64_movq_reg_membase(XMM10, REG_SP, 5 * 8);
-
-       x86_64_mov_reg_reg(argintregs[4], argintregs[5]);
-       x86_64_mov_reg_reg(argintregs[3], argintregs[4]);
-       x86_64_mov_reg_reg(argintregs[2], argintregs[3]);
-       x86_64_mov_reg_reg(argintregs[1], argintregs[2]);
-       x86_64_mov_reg_reg(argintregs[0], argintregs[1]);
-
-       x86_64_mov_imm_reg((s8) &env, argintregs[0]);
-
-       x86_64_mov_imm_reg((s8) f, REG_ITMP1);
-       x86_64_call_reg(REG_ITMP1);
-
-       /* restore callee saved registers */
-       x86_64_movq_membase_reg(REG_SP, 0 * 8, XMM15);
-       x86_64_movq_membase_reg(REG_SP, 1 * 8, XMM14);
-       x86_64_movq_membase_reg(REG_SP, 2 * 8, XMM13);
-       x86_64_movq_membase_reg(REG_SP, 3 * 8, XMM12);
-       x86_64_movq_membase_reg(REG_SP, 4 * 8, XMM11);
-       x86_64_movq_membase_reg(REG_SP, 5 * 8, XMM10);
-
-       x86_64_alu_imm_reg(X86_64_ADD, 7 * 8, REG_SP);    /* keep stack 16-byte aligned */
-
-       if (runverbose) {
-               x86_64_alu_imm_reg(X86_64_SUB, 3 * 8, REG_SP);    /* keep stack 16-byte aligned */
-
-               x86_64_mov_reg_membase(REG_RESULT, REG_SP, 0 * 8);
-               x86_64_movq_reg_membase(REG_FRESULT, REG_SP, 1 * 8);
-
-               x86_64_mov_imm_reg((s8) m, argintregs[0]);
-               x86_64_mov_reg_reg(REG_RESULT, argintregs[1]);
-               M_FLTMOVE(REG_FRESULT, argfltregs[0]);
-               M_FLTMOVE(REG_FRESULT, argfltregs[1]);
-
-/*             x86_64_mov_imm_reg(asm_builtin_exittrace, REG_ITMP1); */
-               x86_64_mov_imm_reg((s8) builtin_displaymethodstop, REG_ITMP1);
-               x86_64_call_reg(REG_ITMP1);
-
-               x86_64_mov_membase_reg(REG_SP, 0 * 8, REG_RESULT);
-               x86_64_movq_membase_reg(REG_SP, 1 * 8, REG_FRESULT);
-
-               x86_64_alu_imm_reg(X86_64_ADD, 3 * 8, REG_SP);    /* keep stack 16-byte aligned */
-       }
-
-       x86_64_mov_imm_reg((s8) &exceptionptr, REG_ITMP3);
-       x86_64_mov_membase_reg(REG_ITMP3, 0, REG_ITMP3);
-       x86_64_test_reg_reg(REG_ITMP3, REG_ITMP3);
-       x86_64_jcc(X86_64_CC_NE, 1);
-
-       x86_64_ret();
-
-       x86_64_mov_reg_reg(REG_ITMP3, REG_ITMP1_XPTR);
-       x86_64_mov_imm_reg((s8) &exceptionptr, REG_ITMP3);
-       x86_64_alu_reg_reg(X86_64_XOR, REG_ITMP2, REG_ITMP2);
-       x86_64_mov_reg_membase(REG_ITMP2, REG_ITMP3, 0);    /* clear exception pointer */
-
-       x86_64_mov_membase_reg(REG_SP, 0, REG_ITMP2_XPC);    /* get return address from stack */
-       x86_64_alu_imm_reg(X86_64_SUB, 3, REG_ITMP2_XPC);    /* callq */
-
-       x86_64_mov_imm_reg((s8) asm_handle_nat_exception, REG_ITMP3);
-       x86_64_jmp_reg(REG_ITMP3);
-
-#if 0
-       {
-               static int stubprinted;
-               if (!stubprinted)
-                       printf("stubsize: %d\n", ((long)mcodeptr - (long) s));
-               stubprinted = 1;
-       }
-#endif
-
-#ifdef STATISTICS
-       count_nstub_len += NATIVESTUBSIZE;
-#endif
-
-       return (u1*) s;
-}
-
-
-
-/* function: removenativestub **************************************************
-
-    removes a previously created native-stub from memory
-    
-*******************************************************************************/
-
-void removenativestub(u1 *stub)
-{
-       CFREE(stub, NATIVESTUBSIZE);
-}
-
-
-
-void x86_64_emit_ialu(s4 alu_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->prev->regoff;
-       s4 s2 = src->regoff;
-       s4 d = iptr->dst->regoff;
-
-       if (iptr->dst->flags & INMEMORY) {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (s2 == d) {
-                               x86_64_movl_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                               x86_64_alul_reg_membase(alu_op, REG_ITMP1, REG_SP, d * 8);
-
-                       } else if (s1 == d) {
-                               x86_64_movl_membase_reg(REG_SP, s2 * 8, REG_ITMP1);
-                               x86_64_alul_reg_membase(alu_op, REG_ITMP1, REG_SP, d * 8);
-
-                       } else {
-                               x86_64_movl_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                               x86_64_alul_membase_reg(alu_op, REG_SP, s2 * 8, REG_ITMP1);
-                               x86_64_movl_reg_membase(REG_ITMP1, REG_SP, d * 8);
-                       }
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       if (s2 == d) {
-                               x86_64_alul_reg_membase(alu_op, s1, REG_SP, d * 8);
-
-                       } else {
-                               x86_64_movl_membase_reg(REG_SP, s2 * 8, REG_ITMP1);
-                               x86_64_alul_reg_reg(alu_op, s1, REG_ITMP1);
-                               x86_64_movl_reg_membase(REG_ITMP1, REG_SP, d * 8);
-                       }
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (s1 == d) {
-                               x86_64_alul_reg_membase(alu_op, s2, REG_SP, d * 8);
-                                               
-                       } else {
-                               x86_64_movl_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                               x86_64_alul_reg_reg(alu_op, s2, REG_ITMP1);
-                               x86_64_movl_reg_membase(REG_ITMP1, REG_SP, d * 8);
-                       }
-
-               } else {
-                       x86_64_movl_reg_membase(s1, REG_SP, d * 8);
-                       x86_64_alul_reg_membase(alu_op, s2, REG_SP, d * 8);
-               }
-
-       } else {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       x86_64_movl_membase_reg(REG_SP, s1 * 8, d);
-                       x86_64_alul_membase_reg(alu_op, REG_SP, s2 * 8, d);
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(s1, d);
-                       x86_64_alul_membase_reg(alu_op, REG_SP, s2 * 8, d);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(s2, d);
-                       x86_64_alul_membase_reg(alu_op, REG_SP, s1 * 8, d);
-
-               } else {
-                       if (s2 == d) {
-                               x86_64_alul_reg_reg(alu_op, s1, d);
-
-                       } else {
-                               M_INTMOVE(s1, d);
-                               x86_64_alul_reg_reg(alu_op, s2, d);
-                       }
-               }
-       }
-}
-
-
-
-void x86_64_emit_lalu(s4 alu_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->prev->regoff;
-       s4 s2 = src->regoff;
-       s4 d = iptr->dst->regoff;
-
-       if (iptr->dst->flags & INMEMORY) {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (s2 == d) {
-                               x86_64_mov_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                               x86_64_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, d * 8);
-
-                       } else if (s1 == d) {
-                               x86_64_mov_membase_reg(REG_SP, s2 * 8, REG_ITMP1);
-                               x86_64_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, d * 8);
-
-                       } else {
-                               x86_64_mov_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                               x86_64_alu_membase_reg(alu_op, REG_SP, s2 * 8, REG_ITMP1);
-                               x86_64_mov_reg_membase(REG_ITMP1, REG_SP, d * 8);
-                       }
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       if (s2 == d) {
-                               x86_64_alu_reg_membase(alu_op, s1, REG_SP, d * 8);
-
-                       } else {
-                               x86_64_mov_membase_reg(REG_SP, s2 * 8, REG_ITMP1);
-                               x86_64_alu_reg_reg(alu_op, s1, REG_ITMP1);
-                               x86_64_mov_reg_membase(REG_ITMP1, REG_SP, d * 8);
-                       }
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (s1 == d) {
-                               x86_64_alu_reg_membase(alu_op, s2, REG_SP, d * 8);
-                                               
-                       } else {
-                               x86_64_mov_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                               x86_64_alu_reg_reg(alu_op, s2, REG_ITMP1);
-                               x86_64_mov_reg_membase(REG_ITMP1, REG_SP, d * 8);
-                       }
-
-               } else {
-                       x86_64_mov_reg_membase(s1, REG_SP, d * 8);
-                       x86_64_alu_reg_membase(alu_op, s2, REG_SP, d * 8);
-               }
-
-       } else {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       x86_64_mov_membase_reg(REG_SP, s1 * 8, d);
-                       x86_64_alu_membase_reg(alu_op, REG_SP, s2 * 8, d);
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(s1, d);
-                       x86_64_alu_membase_reg(alu_op, REG_SP, s2 * 8, d);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(s2, d);
-                       x86_64_alu_membase_reg(alu_op, REG_SP, s1 * 8, d);
-
-               } else {
-                       if (s2 == d) {
-                               x86_64_alu_reg_reg(alu_op, s1, d);
-
-                       } else {
-                               M_INTMOVE(s1, d);
-                               x86_64_alu_reg_reg(alu_op, s2, d);
-                       }
-               }
-       }
-}
-
-
-
-void x86_64_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->regoff;
-       s4 d = iptr->dst->regoff;
-
-       if (iptr->dst->flags & INMEMORY) {
-               if (src->flags & INMEMORY) {
-                       if (s1 == d) {
-                               x86_64_alul_imm_membase(alu_op, iptr->val.i, REG_SP, d * 8);
-
-                       } else {
-                               x86_64_movl_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                               x86_64_alul_imm_reg(alu_op, iptr->val.i, REG_ITMP1);
-                               x86_64_movl_reg_membase(REG_ITMP1, REG_SP, d * 8);
-                       }
-
-               } else {
-                       x86_64_movl_reg_membase(s1, REG_SP, d * 8);
-                       x86_64_alul_imm_membase(alu_op, iptr->val.i, REG_SP, d * 8);
-               }
-
-       } else {
-               if (src->flags & INMEMORY) {
-                       x86_64_movl_membase_reg(REG_SP, s1 * 8, d);
-                       x86_64_alul_imm_reg(alu_op, iptr->val.i, d);
-
-               } else {
-                       M_INTMOVE(s1, d);
-                       x86_64_alul_imm_reg(alu_op, iptr->val.i, d);
-               }
-       }
-}
-
-
-
-void x86_64_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->regoff;
-       s4 d = iptr->dst->regoff;
-
-       if (iptr->dst->flags & INMEMORY) {
-               if (src->flags & INMEMORY) {
-                       if (s1 == d) {
-                               if (x86_64_is_imm32(iptr->val.l)) {
-                                       x86_64_alu_imm_membase(alu_op, iptr->val.l, REG_SP, d * 8);
-
-                               } else {
-                                       x86_64_mov_imm_reg(iptr->val.l, REG_ITMP1);
-                                       x86_64_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, d * 8);
-                               }
-
-                       } else {
-                               x86_64_mov_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-
-                               if (x86_64_is_imm32(iptr->val.l)) {
-                                       x86_64_alu_imm_reg(alu_op, iptr->val.l, REG_ITMP1);
-
-                               } else {
-                                       x86_64_mov_imm_reg(iptr->val.l, REG_ITMP2);
-                                       x86_64_alu_reg_reg(alu_op, REG_ITMP2, REG_ITMP1);
-                               }
-                               x86_64_mov_reg_membase(REG_ITMP1, REG_SP, d * 8);
-                       }
-
-               } else {
-                       x86_64_mov_reg_membase(s1, REG_SP, d * 8);
-
-                       if (x86_64_is_imm32(iptr->val.l)) {
-                               x86_64_alu_imm_membase(alu_op, iptr->val.l, REG_SP, d * 8);
-
-                       } else {
-                               x86_64_mov_imm_reg(iptr->val.l, REG_ITMP1);
-                               x86_64_alu_reg_membase(alu_op, REG_ITMP1, REG_SP, d * 8);
-                       }
-               }
-
-       } else {
-               if (src->flags & INMEMORY) {
-                       x86_64_mov_membase_reg(REG_SP, s1 * 8, d);
-
-               } else {
-                       M_INTMOVE(s1, d);
-               }
-
-               if (x86_64_is_imm32(iptr->val.l)) {
-                       x86_64_alu_imm_reg(alu_op, iptr->val.l, d);
-
-               } else {
-                       x86_64_mov_imm_reg(iptr->val.l, REG_ITMP1);
-                       x86_64_alu_reg_reg(alu_op, REG_ITMP1, d);
-               }
-       }
-}
-
-
-
-void x86_64_emit_ishift(s4 shift_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->prev->regoff;
-       s4 s2 = src->regoff;
-       s4 d = iptr->dst->regoff;
-
-       M_INTMOVE(RCX, REG_ITMP1);    /* save RCX */
-       if (iptr->dst->flags & INMEMORY) {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (s1 == d) {
-                               x86_64_movl_membase_reg(REG_SP, s2 * 8, RCX);
-                               x86_64_shiftl_membase(shift_op, REG_SP, d * 8);
-
-                       } else {
-                               x86_64_movl_membase_reg(REG_SP, s2 * 8, RCX);
-                               x86_64_movl_membase_reg(REG_SP, s1 * 8, REG_ITMP2);
-                               x86_64_shiftl_reg(shift_op, REG_ITMP2);
-                               x86_64_movl_reg_membase(REG_ITMP2, REG_SP, d * 8);
-                       }
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       x86_64_movl_membase_reg(REG_SP, s2 * 8, RCX);
-                       x86_64_movl_reg_membase(s1, REG_SP, d * 8);
-                       x86_64_shiftl_membase(shift_op, REG_SP, d * 8);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (s1 == d) {
-                               M_INTMOVE(s2, RCX);
-                               x86_64_shiftl_membase(shift_op, REG_SP, d * 8);
-
-                       } else {
-                               M_INTMOVE(s2, RCX);
-                               x86_64_movl_membase_reg(REG_SP, s1 * 8, REG_ITMP2);
-                               x86_64_shiftl_reg(shift_op, REG_ITMP2);
-                               x86_64_movl_reg_membase(REG_ITMP2, REG_SP, d * 8);
-                       }
-
-               } else {
-                       M_INTMOVE(s2, RCX);
-                       x86_64_movl_reg_membase(s1, REG_SP, d * 8);
-                       x86_64_shiftl_membase(shift_op, REG_SP, d * 8);
-               }
-               M_INTMOVE(REG_ITMP1, RCX);    /* restore RCX */
-
-       } else {
-               if (d == RCX) {
-                       d = REG_ITMP3;
-               }
-                                       
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       x86_64_movl_membase_reg(REG_SP, s2 * 8, RCX);
-                       x86_64_movl_membase_reg(REG_SP, s1 * 8, d);
-                       x86_64_shiftl_reg(shift_op, d);
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(s1, d);    /* maybe src is RCX */
-                       x86_64_movl_membase_reg(REG_SP, s2 * 8, RCX);
-                       x86_64_shiftl_reg(shift_op, d);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(s2, RCX);
-                       x86_64_movl_membase_reg(REG_SP, s1 * 8, d);
-                       x86_64_shiftl_reg(shift_op, d);
-
-               } else {
-                       if (s1 == RCX) {
-                               M_INTMOVE(s1, d);
-                               M_INTMOVE(s2, RCX);
-
-                       } else {
-                               M_INTMOVE(s2, RCX);
-                               M_INTMOVE(s1, d);
-                       }
-                       x86_64_shiftl_reg(shift_op, d);
-               }
-
-               if (d == RCX) {
-                       M_INTMOVE(REG_ITMP3, RCX);
-
-               } else {
-                       M_INTMOVE(REG_ITMP1, RCX);    /* restore RCX */
-               }
-       }
-}
-
-
-
-void x86_64_emit_lshift(s4 shift_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->prev->regoff;
-       s4 s2 = src->regoff;
-       s4 d = iptr->dst->regoff;
-
-       M_INTMOVE(RCX, REG_ITMP1);    /* save RCX */
-       if (iptr->dst->flags & INMEMORY) {
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (s1 == d) {
-                               x86_64_mov_membase_reg(REG_SP, s2 * 8, RCX);
-                               x86_64_shift_membase(shift_op, REG_SP, d * 8);
-
-                       } else {
-                               x86_64_mov_membase_reg(REG_SP, s2 * 8, RCX);
-                               x86_64_mov_membase_reg(REG_SP, s1 * 8, REG_ITMP2);
-                               x86_64_shift_reg(shift_op, REG_ITMP2);
-                               x86_64_mov_reg_membase(REG_ITMP2, REG_SP, d * 8);
-                       }
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       x86_64_mov_membase_reg(REG_SP, s2 * 8, RCX);
-                       x86_64_mov_reg_membase(s1, REG_SP, d * 8);
-                       x86_64_shift_membase(shift_op, REG_SP, d * 8);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       if (s1 == d) {
-                               M_INTMOVE(s2, RCX);
-                               x86_64_shift_membase(shift_op, REG_SP, d * 8);
-
-                       } else {
-                               M_INTMOVE(s2, RCX);
-                               x86_64_mov_membase_reg(REG_SP, s1 * 8, REG_ITMP2);
-                               x86_64_shift_reg(shift_op, REG_ITMP2);
-                               x86_64_mov_reg_membase(REG_ITMP2, REG_SP, d * 8);
-                       }
-
-               } else {
-                       M_INTMOVE(s2, RCX);
-                       x86_64_mov_reg_membase(s1, REG_SP, d * 8);
-                       x86_64_shift_membase(shift_op, REG_SP, d * 8);
-               }
-               M_INTMOVE(REG_ITMP1, RCX);    /* restore RCX */
-
-       } else {
-               if (d == RCX) {
-                       d = REG_ITMP3;
-               }
-
-               if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       x86_64_mov_membase_reg(REG_SP, s2 * 8, RCX);
-                       x86_64_mov_membase_reg(REG_SP, s1 * 8, d);
-                       x86_64_shift_reg(shift_op, d);
-
-               } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(s1, d);    /* maybe src is RCX */
-                       x86_64_mov_membase_reg(REG_SP, s2 * 8, RCX);
-                       x86_64_shift_reg(shift_op, d);
-
-               } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-                       M_INTMOVE(s2, RCX);
-                       x86_64_mov_membase_reg(REG_SP, s1 * 8, d);
-                       x86_64_shift_reg(shift_op, d);
-
-               } else {
-                       if (s1 == RCX) {
-                               M_INTMOVE(s1, d);
-                               M_INTMOVE(s2, RCX);
-                       } else {
-                               M_INTMOVE(s2, RCX);
-                               M_INTMOVE(s1, d);
-                       }
-                       x86_64_shift_reg(shift_op, d);
-               }
-
-               if (d == RCX) {
-                       M_INTMOVE(REG_ITMP3, RCX);
-
-               } else {
-                       M_INTMOVE(REG_ITMP1, RCX);    /* restore RCX */
-               }
-       }
-}
-
-
-
-void x86_64_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->regoff;
-       s4 d = iptr->dst->regoff;
-
-       if ((src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
-               if (s1 == d) {
-                       x86_64_shiftl_imm_membase(shift_op, iptr->val.i, REG_SP, d * 8);
-
-               } else {
-                       x86_64_movl_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                       x86_64_shiftl_imm_reg(shift_op, iptr->val.i, REG_ITMP1);
-                       x86_64_movl_reg_membase(REG_ITMP1, REG_SP, d * 8);
-               }
-
-       } else if ((src->flags & INMEMORY) && !(iptr->dst->flags & INMEMORY)) {
-               x86_64_movl_membase_reg(REG_SP, s1 * 8, d);
-               x86_64_shiftl_imm_reg(shift_op, iptr->val.i, d);
-                               
-       } else if (!(src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
-               x86_64_movl_reg_membase(s1, REG_SP, d * 8);
-               x86_64_shiftl_imm_membase(shift_op, iptr->val.i, REG_SP, d * 8);
-
-       } else {
-               M_INTMOVE(s1, d);
-               x86_64_shiftl_imm_reg(shift_op, iptr->val.i, d);
-       }
-}
-
-
-
-void x86_64_emit_lshiftconst(s4 shift_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->regoff;
-       s4 d = iptr->dst->regoff;
-
-       if ((src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
-               if (s1 == d) {
-                       x86_64_shift_imm_membase(shift_op, iptr->val.i, REG_SP, d * 8);
-
-               } else {
-                       x86_64_mov_membase_reg(REG_SP, s1 * 8, REG_ITMP1);
-                       x86_64_shift_imm_reg(shift_op, iptr->val.i, REG_ITMP1);
-                       x86_64_mov_reg_membase(REG_ITMP1, REG_SP, d * 8);
-               }
-
-       } else if ((src->flags & INMEMORY) && !(iptr->dst->flags & INMEMORY)) {
-               x86_64_mov_membase_reg(REG_SP, s1 * 8, d);
-               x86_64_shift_imm_reg(shift_op, iptr->val.i, d);
-                               
-       } else if (!(src->flags & INMEMORY) && (iptr->dst->flags & INMEMORY)) {
-               x86_64_mov_reg_membase(s1, REG_SP, d * 8);
-               x86_64_shift_imm_membase(shift_op, iptr->val.i, REG_SP, d * 8);
-
-       } else {
-               M_INTMOVE(s1, d);
-               x86_64_shift_imm_reg(shift_op, iptr->val.i, d);
-       }
-}
-
-
-
-void x86_64_emit_ifcc(s4 if_op, stackptr src, instruction *iptr)
-{
-       if (src->flags & INMEMORY) {
-               x86_64_alul_imm_membase(X86_64_CMP, iptr->val.i, REG_SP, src->regoff * 8);
-
-       } else {
-               x86_64_alul_imm_reg(X86_64_CMP, iptr->val.i, src->regoff);
-       }
-       x86_64_jcc(if_op, 0);
-       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-}
-
-
-
-void x86_64_emit_if_lcc(s4 if_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->regoff;
-
-       if (src->flags & INMEMORY) {
-               if (x86_64_is_imm32(iptr->val.l)) {
-                       x86_64_alu_imm_membase(X86_64_CMP, iptr->val.l, REG_SP, s1 * 8);
-
-               } else {
-                       x86_64_mov_imm_reg(iptr->val.l, REG_ITMP1);
-                       x86_64_alu_reg_membase(X86_64_CMP, REG_ITMP1, REG_SP, s1 * 8);
-               }
-
-       } else {
-               if (x86_64_is_imm32(iptr->val.l)) {
-                       x86_64_alu_imm_reg(X86_64_CMP, iptr->val.l, s1);
-
-               } else {
-                       x86_64_mov_imm_reg(iptr->val.l, REG_ITMP1);
-                       x86_64_alu_reg_reg(X86_64_CMP, REG_ITMP1, s1);
-               }
-       }
-       x86_64_jcc(if_op, 0);
-       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-}
-
-
-
-void x86_64_emit_if_icmpcc(s4 if_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->prev->regoff;
-       s4 s2 = src->regoff;
-
-       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-               x86_64_movl_membase_reg(REG_SP, s2 * 8, REG_ITMP1);
-               x86_64_alul_reg_membase(X86_64_CMP, REG_ITMP1, REG_SP, s1 * 8);
-
-       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-               x86_64_alul_membase_reg(X86_64_CMP, REG_SP, s2 * 8, s1);
-
-       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-               x86_64_alul_reg_membase(X86_64_CMP, s2, REG_SP, s1 * 8);
-
-       } else {
-               x86_64_alul_reg_reg(X86_64_CMP, s2, s1);
-       }
-       x86_64_jcc(if_op, 0);
-       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-}
-
-
-
-void x86_64_emit_if_lcmpcc(s4 if_op, stackptr src, instruction *iptr)
-{
-       s4 s1 = src->prev->regoff;
-       s4 s2 = src->regoff;
-
-       if ((src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-               x86_64_mov_membase_reg(REG_SP, s2 * 8, REG_ITMP1);
-               x86_64_alu_reg_membase(X86_64_CMP, REG_ITMP1, REG_SP, s1 * 8);
-
-       } else if ((src->flags & INMEMORY) && !(src->prev->flags & INMEMORY)) {
-               x86_64_alu_membase_reg(X86_64_CMP, REG_SP, s2 * 8, s1);
-
-       } else if (!(src->flags & INMEMORY) && (src->prev->flags & INMEMORY)) {
-               x86_64_alu_reg_membase(X86_64_CMP, s2, REG_SP, s1 * 8);
-
-       } else {
-               x86_64_alu_reg_reg(X86_64_CMP, s2, s1);
-       }
-       x86_64_jcc(if_op, 0);
-       mcode_addreference(BlockPtrOfPC(iptr->op1), mcodeptr);
-}
-
-
-
-#if 1
-
-/*
- * mov ops
- */
-void x86_64_mov_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(reg),0,(dreg));
-       *(mcodeptr++) = 0x89;
-       x86_64_emit_reg((reg),(dreg));
-}
-
-
-void x86_64_mov_imm_reg(s8 imm, s8 reg) {
-       x86_64_emit_rex(1,0,0,(reg));
-       *(mcodeptr++) = 0xb8 + ((reg) & 0x07);
-       x86_64_emit_imm64((imm));
-}
-
-
-void x86_64_movl_imm_reg(s8 imm, s8 reg) {
-       x86_64_emit_rex(0,0,0,(reg));
-       *(mcodeptr++) = 0xb8 + ((reg) & 0x07);
-       x86_64_emit_imm32((imm));
-}
-
-
-void x86_64_mov_membase_reg(s8 basereg, s8 disp, s8 reg) {
-       x86_64_emit_rex(1,(reg),0,(basereg));
-       *(mcodeptr++) = 0x8b;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_movl_membase_reg(s8 basereg, s8 disp, s8 reg) {
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = 0x8b;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-/*
- * this one is for INVOKEVIRTUAL/INVOKEINTERFACE to have a
- * constant membase immediate length of 32bit
- */
-void x86_64_mov_membase32_reg(s8 basereg, s8 disp, s8 reg) {
-       x86_64_emit_rex(1,(reg),0,(basereg));
-       *(mcodeptr++) = 0x8b;
-       x86_64_address_byte(2, (reg), (basereg));
-       x86_64_emit_imm32((disp));
-}
-
-
-void x86_64_mov_reg_membase(s8 reg, s8 basereg, s8 disp) {
-       x86_64_emit_rex(1,(reg),0,(basereg));
-       *(mcodeptr++) = 0x89;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_movl_reg_membase(s8 reg, s8 basereg, s8 disp) {
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = 0x89;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_mov_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg) {
-       x86_64_emit_rex(1,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x8b;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movl_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg) {
-       x86_64_emit_rex(0,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x8b;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_mov_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale) {
-       x86_64_emit_rex(1,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x89;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movl_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale) {
-       x86_64_emit_rex(0,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x89;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movw_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x89;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movb_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale) {
-       x86_64_emit_rex(0,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x88;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_mov_imm_membase(s8 imm, s8 basereg, s8 disp) {
-       x86_64_emit_rex(1,0,0,(basereg));
-       *(mcodeptr++) = 0xc7;
-       x86_64_emit_membase((basereg),(disp),0);
-       x86_64_emit_imm32((imm));
-}
-
-
-void x86_64_movl_imm_membase(s8 imm, s8 basereg, s8 disp) {
-       x86_64_emit_rex(0,0,0,(basereg));
-       *(mcodeptr++) = 0xc7;
-       x86_64_emit_membase((basereg),(disp),0);
-       x86_64_emit_imm32((imm));
-}
-
-
-void x86_64_movsbq_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xbe;
-       /* XXX: why do reg and dreg have to be exchanged */
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_movsbq_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xbe;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movswq_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xbf;
-       /* XXX: why do reg and dreg have to be exchanged */
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_movswq_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xbf;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movslq_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x63;
-       /* XXX: why do reg and dreg have to be exchanged */
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_movslq_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x63;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movzwq_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xb7;
-       /* XXX: why do reg and dreg have to be exchanged */
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_movzwq_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xb7;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movswq_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg) {
-       x86_64_emit_rex(1,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xbf;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movsbq_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg) {
-       x86_64_emit_rex(1,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xbe;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movzwq_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg) {
-       x86_64_emit_rex(1,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xb7;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-
-/*
- * alu operations
- */
-void x86_64_alu_reg_reg(s8 opc, s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(reg),0,(dreg));
-       *(mcodeptr++) = (((opc)) << 3) + 1;
-       x86_64_emit_reg((reg),(dreg));
-}
-
-
-void x86_64_alul_reg_reg(s8 opc, s8 reg, s8 dreg) {
-       x86_64_emit_rex(0,(reg),0,(dreg));
-       *(mcodeptr++) = (((opc)) << 3) + 1;
-       x86_64_emit_reg((reg),(dreg));
-}
-
-
-void x86_64_alu_reg_membase(s8 opc, s8 reg, s8 basereg, s8 disp) {
-       x86_64_emit_rex(1,(reg),0,(basereg));
-       *(mcodeptr++) = (((opc)) << 3) + 1;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_alul_reg_membase(s8 opc, s8 reg, s8 basereg, s8 disp) {
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = (((opc)) << 3) + 1;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_alu_membase_reg(s8 opc, s8 basereg, s8 disp, s8 reg) {
-       x86_64_emit_rex(1,(reg),0,(basereg));
-       *(mcodeptr++) = (((opc)) << 3) + 3;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_alul_membase_reg(s8 opc, s8 basereg, s8 disp, s8 reg) {
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = (((opc)) << 3) + 3;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_alu_imm_reg(s8 opc, s8 imm, s8 dreg) {
-       if (x86_64_is_imm8(imm)) {
-               x86_64_emit_rex(1,0,0,(dreg));
-               *(mcodeptr++) = 0x83;
-               x86_64_emit_reg((opc),(dreg));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(1,0,0,(dreg));
-               *(mcodeptr++) = 0x81;
-               x86_64_emit_reg((opc),(dreg));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_alul_imm_reg(s8 opc, s8 imm, s8 dreg) {
-       if (x86_64_is_imm8(imm)) {
-               x86_64_emit_rex(0,0,0,(dreg));
-               *(mcodeptr++) = 0x83;
-               x86_64_emit_reg((opc),(dreg));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(0,0,0,(dreg));
-               *(mcodeptr++) = 0x81;
-               x86_64_emit_reg((opc),(dreg));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_alu_imm_membase(s8 opc, s8 imm, s8 basereg, s8 disp) {
-       if (x86_64_is_imm8(imm)) {
-               x86_64_emit_rex(1,(basereg),0,0);
-               *(mcodeptr++) = 0x83;
-               x86_64_emit_membase((basereg),(disp),(opc));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(1,(basereg),0,0);
-               *(mcodeptr++) = 0x81;
-               x86_64_emit_membase((basereg),(disp),(opc));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_alul_imm_membase(s8 opc, s8 imm, s8 basereg, s8 disp) {
-       if (x86_64_is_imm8(imm)) {
-               x86_64_emit_rex(0,(basereg),0,0);
-               *(mcodeptr++) = 0x83;
-               x86_64_emit_membase((basereg),(disp),(opc));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(0,(basereg),0,0);
-               *(mcodeptr++) = 0x81;
-               x86_64_emit_membase((basereg),(disp),(opc));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_test_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(reg),0,(dreg));
-       *(mcodeptr++) = 0x85;
-       x86_64_emit_reg((reg),(dreg));
-}
-
-
-void x86_64_testl_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(0,(reg),0,(dreg));
-       *(mcodeptr++) = 0x85;
-       x86_64_emit_reg((reg),(dreg));
-}
-
-
-void x86_64_test_imm_reg(s8 imm, s8 reg) {
-       *(mcodeptr++) = 0xf7;
-       x86_64_emit_reg(0,(reg));
-       x86_64_emit_imm32((imm));
-}
-
-
-void x86_64_testw_imm_reg(s8 imm, s8 reg) {
-       *(mcodeptr++) = 0x66;
-       *(mcodeptr++) = 0xf7;
-       x86_64_emit_reg(0,(reg));
-       x86_64_emit_imm16((imm));
-}
-
-
-void x86_64_testb_imm_reg(s8 imm, s8 reg) {
-       *(mcodeptr++) = 0xf6;
-       x86_64_emit_reg(0,(reg));
-       x86_64_emit_imm8((imm));
-}
-
-
-void x86_64_lea_membase_reg(s8 basereg, s8 disp, s8 reg) {
-       x86_64_emit_rex(1,(reg),0,(basereg));
-       *(mcodeptr++) = 0x8d;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_leal_membase_reg(s8 basereg, s8 disp, s8 reg) {
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = 0x8d;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-
-/*
- * inc, dec operations
- */
-void x86_64_inc_reg(s8 reg) {
-       x86_64_emit_rex(1,0,0,(reg));
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_reg(0,(reg));
-}
-
-
-void x86_64_incl_reg(s8 reg) {
-       x86_64_emit_rex(0,0,0,(reg));
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_reg(0,(reg));
-}
-
-
-void x86_64_inc_membase(s8 basereg, s8 disp) {
-       x86_64_emit_rex(1,(basereg),0,0);
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_membase((basereg),(disp),0);
-}
-
-
-void x86_64_incl_membase(s8 basereg, s8 disp) {
-       x86_64_emit_rex(0,(basereg),0,0);
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_membase((basereg),(disp),0);
-}
-
-
-void x86_64_dec_reg(s8 reg) {
-       x86_64_emit_rex(1,0,0,(reg));
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_reg(1,(reg));
-}
-
-        
-void x86_64_decl_reg(s8 reg) {
-       x86_64_emit_rex(0,0,0,(reg));
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_reg(1,(reg));
-}
-
-        
-void x86_64_dec_membase(s8 basereg, s8 disp) {
-       x86_64_emit_rex(1,(basereg),0,0);
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_membase((basereg),(disp),1);
-}
-
-
-void x86_64_decl_membase(s8 basereg, s8 disp) {
-       x86_64_emit_rex(0,(basereg),0,0);
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_membase((basereg),(disp),1);
-}
-
-
-
-
-void x86_64_cltd() {
-    *(mcodeptr++) = 0x99;
-}
-
-
-void x86_64_cqto() {
-       x86_64_emit_rex(1,0,0,0);
-       *(mcodeptr++) = 0x99;
-}
-
-
-
-void x86_64_imul_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xaf;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_imull_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xaf;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_imul_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xaf;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_imull_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xaf;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_imul_imm_reg(s8 imm, s8 dreg) {
-       if (x86_64_is_imm8((imm))) {
-               x86_64_emit_rex(1,0,0,(dreg));
-               *(mcodeptr++) = 0x6b;
-               x86_64_emit_reg(0,(dreg));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(1,0,0,(dreg));
-               *(mcodeptr++) = 0x69;
-               x86_64_emit_reg(0,(dreg));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_imul_imm_reg_reg(s8 imm, s8 reg, s8 dreg) {
-       if (x86_64_is_imm8((imm))) {
-               x86_64_emit_rex(1,(dreg),0,(reg));
-               *(mcodeptr++) = 0x6b;
-               x86_64_emit_reg((dreg),(reg));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(1,(dreg),0,(reg));
-               *(mcodeptr++) = 0x69;
-               x86_64_emit_reg((dreg),(reg));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_imull_imm_reg_reg(s8 imm, s8 reg, s8 dreg) {
-       if (x86_64_is_imm8((imm))) {
-               x86_64_emit_rex(0,(dreg),0,(reg));
-               *(mcodeptr++) = 0x6b;
-               x86_64_emit_reg((dreg),(reg));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(0,(dreg),0,(reg));
-               *(mcodeptr++) = 0x69;
-               x86_64_emit_reg((dreg),(reg));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_imul_imm_membase_reg(s8 imm, s8 basereg, s8 disp, s8 dreg) {
-       if (x86_64_is_imm8((imm))) {
-               x86_64_emit_rex(1,(dreg),0,(basereg));
-               *(mcodeptr++) = 0x6b;
-               x86_64_emit_membase((basereg),(disp),(dreg));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(1,(dreg),0,(basereg));
-               *(mcodeptr++) = 0x69;
-               x86_64_emit_membase((basereg),(disp),(dreg));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_imull_imm_membase_reg(s8 imm, s8 basereg, s8 disp, s8 dreg) {
-       if (x86_64_is_imm8((imm))) {
-               x86_64_emit_rex(0,(dreg),0,(basereg));
-               *(mcodeptr++) = 0x6b;
-               x86_64_emit_membase((basereg),(disp),(dreg));
-               x86_64_emit_imm8((imm));
-       } else {
-               x86_64_emit_rex(0,(dreg),0,(basereg));
-               *(mcodeptr++) = 0x69;
-               x86_64_emit_membase((basereg),(disp),(dreg));
-               x86_64_emit_imm32((imm));
-       }
-}
-
-
-void x86_64_idiv_reg(s8 reg) {
-       x86_64_emit_rex(1,0,0,(reg));
-       *(mcodeptr++) = 0xf7;
-       x86_64_emit_reg(7,(reg));
-}
-
-
-void x86_64_idivl_reg(s8 reg) {
-       x86_64_emit_rex(0,0,0,(reg));
-       *(mcodeptr++) = 0xf7;
-       x86_64_emit_reg(7,(reg));
-}
-
-
-
-void x86_64_ret() {
-    *(mcodeptr++) = 0xc3;
-}
-
-
-
-/*
- * shift ops
- */
-void x86_64_shift_reg(s8 opc, s8 reg) {
-       x86_64_emit_rex(1,0,0,(reg));
-       *(mcodeptr++) = 0xd3;
-       x86_64_emit_reg((opc),(reg));
-}
-
-
-void x86_64_shiftl_reg(s8 opc, s8 reg) {
-       x86_64_emit_rex(0,0,0,(reg));
-       *(mcodeptr++) = 0xd3;
-       x86_64_emit_reg((opc),(reg));
-}
-
-
-void x86_64_shift_membase(s8 opc, s8 basereg, s8 disp) {
-       x86_64_emit_rex(1,0,0,(basereg));
-       *(mcodeptr++) = 0xd3;
-       x86_64_emit_membase((basereg),(disp),(opc));
-}
-
-
-void x86_64_shiftl_membase(s8 opc, s8 basereg, s8 disp) {
-       x86_64_emit_rex(0,0,0,(basereg));
-       *(mcodeptr++) = 0xd3;
-       x86_64_emit_membase((basereg),(disp),(opc));
-}
-
-
-void x86_64_shift_imm_reg(s8 opc, s8 imm, s8 dreg) {
-       if ((imm) == 1) {
-               x86_64_emit_rex(1,0,0,(dreg));
-               *(mcodeptr++) = 0xd1;
-               x86_64_emit_reg((opc),(dreg));
-       } else {
-               x86_64_emit_rex(1,0,0,(dreg));
-               *(mcodeptr++) = 0xc1;
-               x86_64_emit_reg((opc),(dreg));
-               x86_64_emit_imm8((imm));
-       }
-}
-
-
-void x86_64_shiftl_imm_reg(s8 opc, s8 imm, s8 dreg) {
-       if ((imm) == 1) {
-               x86_64_emit_rex(0,0,0,(dreg));
-               *(mcodeptr++) = 0xd1;
-               x86_64_emit_reg((opc),(dreg));
-       } else {
-               x86_64_emit_rex(0,0,0,(dreg));
-               *(mcodeptr++) = 0xc1;
-               x86_64_emit_reg((opc),(dreg));
-               x86_64_emit_imm8((imm));
-       }
-}
-
-
-void x86_64_shift_imm_membase(s8 opc, s8 imm, s8 basereg, s8 disp) {
-       if ((imm) == 1) {
-               x86_64_emit_rex(1,0,0,(basereg));
-               *(mcodeptr++) = 0xd1;
-               x86_64_emit_membase((basereg),(disp),(opc));
-       } else {
-               x86_64_emit_rex(1,0,0,(basereg));
-               *(mcodeptr++) = 0xc1;
-               x86_64_emit_membase((basereg),(disp),(opc));
-               x86_64_emit_imm8((imm));
-       }
-}
-
-
-void x86_64_shiftl_imm_membase(s8 opc, s8 imm, s8 basereg, s8 disp) {
-       if ((imm) == 1) {
-               x86_64_emit_rex(0,0,0,(basereg));
-               *(mcodeptr++) = 0xd1;
-               x86_64_emit_membase((basereg),(disp),(opc));
-       } else {
-               x86_64_emit_rex(0,0,0,(basereg));
-               *(mcodeptr++) = 0xc1;
-               x86_64_emit_membase((basereg),(disp),(opc));
-               x86_64_emit_imm8((imm));
-       }
-}
-
-
-
-/*
- * jump operations
- */
-void x86_64_jmp_imm(s8 imm) {
-       *(mcodeptr++) = 0xe9;
-       x86_64_emit_imm32((imm));
-}
-
-
-void x86_64_jmp_reg(s8 reg) {
-       x86_64_emit_rex(0,0,0,(reg));
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_reg(4,(reg));
-}
-
-
-void x86_64_jcc(s8 opc, s8 imm) {
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = (0x80 + x86_64_cc_map[(opc)]);
-       x86_64_emit_imm32((imm));
-}
-
-
-
-/*
- * conditional set and move operations
- */
-
-/* we need the rex byte to get all low bytes */
-void x86_64_setcc_reg(s8 opc, s8 reg) {
-       *(mcodeptr++) = (0x40 | (((reg) >> 3) & 0x01));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = (0x90 + x86_64_cc_map[(opc)]);
-       x86_64_emit_reg(0,(reg));
-}
-
-
-/* we need the rex byte to get all low bytes */
-void x86_64_setcc_membase(s8 opc, s8 basereg, s8 disp) {
-       *(mcodeptr++) = (0x40 | (((basereg) >> 3) & 0x01));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = (0x90 + x86_64_cc_map[(opc)]);
-       x86_64_emit_membase((basereg),(disp),0);
-}
-
-
-void x86_64_cmovcc_reg_reg(s8 opc, s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = (0x40 + x86_64_cc_map[(opc)]);
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cmovccl_reg_reg(s8 opc, s8 reg, s8 dreg) {
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = (0x40 + x86_64_cc_map[(opc)]);
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-
-void x86_64_neg_reg(s8 reg) {
-       x86_64_emit_rex(1,0,0,(reg));
-       *(mcodeptr++) = 0xf7;
-       x86_64_emit_reg(3,(reg));
-}
-
-
-void x86_64_negl_reg(s8 reg) {
-       x86_64_emit_rex(0,0,0,(reg));
-       *(mcodeptr++) = 0xf7;
-       x86_64_emit_reg(3,(reg));
-}
-
-
-void x86_64_neg_membase(s8 basereg, s8 disp) {
-       x86_64_emit_rex(1,0,0,(basereg));
-       *(mcodeptr++) = 0xf7;
-       x86_64_emit_membase((basereg),(disp),3);
-}
-
-
-void x86_64_negl_membase(s8 basereg, s8 disp) {
-       x86_64_emit_rex(0,0,0,(basereg));
-       *(mcodeptr++) = 0xf7;
-       x86_64_emit_membase((basereg),(disp),3);
-}
-
-
-
-void x86_64_push_imm(s8 imm) {
-       *(mcodeptr++) = 0x68;
-       x86_64_emit_imm32((imm));
-}
-
-
-void x86_64_pop_reg(s8 reg) {
-       x86_64_emit_rex(0,0,0,(reg));
-       *(mcodeptr++) = 0x58 + (0x07 & (reg));
-}
-
-
-void x86_64_xchg_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(1,(reg),0,(dreg));
-       *(mcodeptr++) = 0x87;
-       x86_64_emit_reg((reg),(dreg));
-}
-
-
-void x86_64_nop() {
-    *(mcodeptr++) = 0x90;
-}
-
-
-
-/*
- * call instructions
- */
-void x86_64_call_reg(s8 reg) {
-       x86_64_emit_rex(1,0,0,(reg));
-       *(mcodeptr++) = 0xff;
-       x86_64_emit_reg(2,(reg));
-}
-
-
-void x86_64_call_imm(s8 imm) {
-       *(mcodeptr++) = 0xe8;
-       x86_64_emit_imm32((imm));
-}
-
-
-
-/*
- * floating point instructions (SSE2)
- */
-void x86_64_addsd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x58;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_addss_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x58;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvtsi2ssq_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2a;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvtsi2ss_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2a;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvtsi2sdq_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2a;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvtsi2sd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2a;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvtss2sd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x5a;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvtsd2ss_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x5a;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvttss2siq_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2c;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvttss2si_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2c;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvttsd2siq_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(1,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2c;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_cvttsd2si_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2c;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_divss_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x5e;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_divsd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x5e;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_movd_reg_freg(s8 reg, s8 freg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(1,(freg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x6e;
-       x86_64_emit_reg((freg),(reg));
-}
-
-
-void x86_64_movd_freg_reg(s8 freg, s8 reg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(1,(freg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x7e;
-       x86_64_emit_reg((freg),(reg));
-}
-
-
-void x86_64_movd_reg_membase(s8 reg, s8 basereg, s8 disp) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x7e;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_movd_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x7e;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movd_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(1,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x6e;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movdl_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x6e;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movd_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 dreg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(dreg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x6e;
-       x86_64_emit_memindex((dreg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movq_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x7e;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_movq_reg_membase(s8 reg, s8 basereg, s8 disp) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0xd6;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_movq_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x7e;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movss_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(reg),0,(dreg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x10;
-       x86_64_emit_reg((reg),(dreg));
-}
-
-
-void x86_64_movsd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(reg),0,(dreg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x10;
-       x86_64_emit_reg((reg),(dreg));
-}
-
-
-void x86_64_movss_reg_membase(s8 reg, s8 basereg, s8 disp) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x11;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_movsd_reg_membase(s8 reg, s8 basereg, s8 disp) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(reg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x11;
-       x86_64_emit_membase((basereg),(disp),(reg));
-}
-
-
-void x86_64_movss_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x10;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movlps_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x12;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movsd_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x10;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movlpd_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x12;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_movss_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x11;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movsd_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(reg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x11;
-       x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movss_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x10;
-       x86_64_emit_memindex((dreg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_movsd_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),(indexreg),(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x10;
-       x86_64_emit_memindex((dreg),(disp),(basereg),(indexreg),(scale));
-}
-
-
-void x86_64_mulss_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x59;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_mulsd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x59;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_subss_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf3;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x5c;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_subsd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0xf2;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x5c;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_ucomiss_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2e;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_ucomisd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x2e;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_xorps_reg_reg(s8 reg, s8 dreg) {
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x57;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_xorps_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x57;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-
-void x86_64_xorpd_reg_reg(s8 reg, s8 dreg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(dreg),0,(reg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x57;
-       x86_64_emit_reg((dreg),(reg));
-}
-
-
-void x86_64_xorpd_membase_reg(s8 basereg, s8 disp, s8 dreg) {
-       *(mcodeptr++) = 0x66;
-       x86_64_emit_rex(0,(dreg),0,(basereg));
-       *(mcodeptr++) = 0x0f;
-       *(mcodeptr++) = 0x57;
-       x86_64_emit_membase((basereg),(disp),(dreg));
-}
-
-#endif
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/x86_64/ngen.h b/x86_64/ngen.h
deleted file mode 100644 (file)
index 840b5e3..0000000
+++ /dev/null
@@ -1,1947 +0,0 @@
-/* x86_64/ngen.h ***************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Contains the machine dependent code generator definitions and macros for an
-    x86_64 processor.
-
-    Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-             Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-             Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: ngen.h 545 2003-11-01 19:20:38Z twisti $
-
-*******************************************************************************/
-
-#ifndef _NGEN_H
-#define _NGEN_H
-
-/* include here, so function definitions are available in mcode.c */
-#include "methodtable.h"
-
-
-/* see also file calling.doc for explanation of calling conventions           */
-
-/* preallocated registers *****************************************************/
-
-/* integer registers */
-  
-#define REG_RESULT      RAX      /* to deliver method results                 */
-
-#define REG_ITMP1       RAX      /* temporary register                        */
-#define REG_ITMP2       R10      /* temporary register and method pointer     */
-#define REG_ITMP3       R11      /* temporary register                        */
-
-#define REG_NULL        -1       /* used for reg_of_var where d is not needed */
-
-#define REG_ITMP1_XPTR  RAX      /* exception pointer = temporary register 1  */
-#define REG_ITMP2_XPC   R10      /* exception pc = temporary register 2       */
-
-#define REG_SP          RSP      /* stack pointer                             */
-
-/* floating point registers */
-
-#define REG_FRESULT     XMM0     /* to deliver floating point method results  */
-
-#define REG_FTMP1       XMM8     /* temporary floating point register         */
-#define REG_FTMP2       XMM9     /* temporary floating point register         */
-#define REG_FTMP3       XMM10    /* temporary floating point register         */
-
-/* register descripton - array ************************************************/
-
-/* #define REG_RES   0         reserved register for OS or code generator     */
-/* #define REG_RET   1         return value register                          */
-/* #define REG_EXC   2         exception value register (only old jit)        */
-/* #define REG_SAV   3         (callee) saved register                        */
-/* #define REG_TMP   4         scratch temporary register (caller saved)      */
-/* #define REG_ARG   5         argument register (caller saved)               */
-
-/* #define REG_END   -1        last entry in tables                           */
-
-int nregdescint[] = {
-    REG_RET, REG_ARG, REG_ARG, REG_TMP, REG_RES, REG_SAV, REG_ARG, REG_ARG,
-    REG_ARG, REG_ARG, REG_RES, REG_RES, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
-    REG_END
-};
-
-/* for use of reserved registers, see comment above */
-
-int nregdescfloat[] = {
-/*      REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP, REG_TMP, REG_TMP, */
-/*      REG_RES, REG_RES, REG_RES, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, */
-    REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
-    REG_RES, REG_RES, REG_RES, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP,
-    REG_END
-};
-
-/* for use of reserved registers, see comment above */
-
-
-/* stackframe-infos ***********************************************************/
-
-int parentargs_base; /* offset in stackframe for the parameter from the caller*/
-
-
-/* macros to create code ******************************************************/
-
-/*
- * immediate data union
- */
-typedef union {
-    s4 i;
-    s8 l;
-    float f;
-    double d;
-    void *a;
-    u1 b[8];
-} x86_64_imm_buf;
-
-
-/*
- * x86_64 register numbers
- */
-typedef enum {
-    RIP = -1,
-    RAX = 0,
-    RCX = 1,
-    RDX = 2,
-    RBX = 3,
-    RSP = 4,
-    RBP = 5,
-    RSI = 6,
-    RDI = 7,
-    R8 = 8,
-    R9 = 9,
-    R10 = 10,
-    R11 = 11,
-    R12 = 12,
-    R13 = 13,
-    R14 = 14,
-    R15 = 15,
-    NREG
-} X86_64_Reg_No;
-
-typedef enum {
-    XMM0 = 0,
-    XMM1 = 1,
-    XMM2 = 2,
-    XMM3 = 3,
-    XMM4 = 4,
-    XMM5 = 5,
-    XMM6 = 6,
-    XMM7 = 7,
-    XMM8 = 8,
-    XMM9 = 9,
-    XMM10 = 10,
-    XMM11 = 11,
-    XMM12 = 12,
-    XMM13 = 13,
-    XMM14 = 14,
-    XMM15 = 15,
-    NREGF
-} X86_64_RegF_No;
-
-
-/*
- * opcodes for alu instructions
- */
-typedef enum {
-    X86_64_ADD = 0,
-    X86_64_OR  = 1,
-    X86_64_ADC = 2,
-    X86_64_SBB = 3,
-    X86_64_AND = 4,
-    X86_64_SUB = 5,
-    X86_64_XOR = 6,
-    X86_64_CMP = 7,
-    X86_64_NALU
-} X86_64_ALU_Opcode;
-
-typedef enum {
-    X86_64_ROL = 0,
-    X86_64_ROR = 1,
-    X86_64_RCL = 2,
-    X86_64_RCR = 3,
-    X86_64_SHL = 4,
-    X86_64_SHR = 5,
-    X86_64_SAR = 7,
-    X86_64_NSHIFT = 8
-} X86_64_Shift_Opcode;
-
-typedef enum {
-    X86_64_CC_O = 0,
-    X86_64_CC_NO = 1,
-    X86_64_CC_B = 2, X86_64_CC_C = 2, X86_64_CC_NAE = 2,
-    X86_64_CC_BE = 6, X86_64_CC_NA = 6,
-    X86_64_CC_AE = 3, X86_64_CC_NB = 3, X86_64_CC_NC = 3,
-    X86_64_CC_E = 4, X86_64_CC_Z = 4,
-    X86_64_CC_NE = 5, X86_64_CC_NZ = 5,
-    X86_64_CC_A = 7, X86_64_CC_NBE = 7,
-    X86_64_CC_S = 8, X86_64_CC_LZ = 8,
-    X86_64_CC_NS = 9, X86_64_CC_GEZ = 9,
-    X86_64_CC_P = 0x0a, X86_64_CC_PE = 0x0a,
-    X86_64_CC_NP = 0x0b, X86_64_CC_PO = 0x0b,
-    X86_64_CC_L = 0x0c, X86_64_CC_NGE = 0x0c,
-    X86_64_CC_GE = 0x0d, X86_64_CC_NL = 0x0d,
-    X86_64_CC_LE = 0x0e, X86_64_CC_NG = 0x0e,
-    X86_64_CC_G = 0x0f, X86_64_CC_NLE = 0x0f,
-    X86_64_NCC
-} X86_64_CC;
-
-static const unsigned char x86_64_cc_map[] = {
-    0x00, /* o  */
-    0x01, /* no */
-    0x02, /* b, lt  */
-    0x03, /* ae */
-    0x04, /* e  */
-    0x05, /* ne */
-    0x06, /* be */
-    0x07, /* a  */
-    0x08, /* s  */
-    0x09, /* ns */
-    0x0a, /* p  */
-    0x0b, /* np */
-    0x0c, /* l  */
-    0x0d, /* ge */
-    0x0e, /* le */
-    0x0f  /* g  */
-};
-
-
-
-/*
- * modrm and stuff
- */
-#define x86_64_address_byte(mod,reg,rm) \
-    *(mcodeptr++) = ((((mod) & 0x03) << 6) | (((reg) & 0x07) << 3) | ((rm) & 0x07));
-
-
-#define x86_64_emit_reg(reg,rm) \
-    x86_64_address_byte(3,(reg),(rm));
-
-
-#define x86_64_emit_rex(size,reg,index,rm) \
-    if ((size) == 1 || (reg) > 7 || (index) > 7 || (rm) > 7) { \
-        *(mcodeptr++) = (0x40 | (((size) & 0x01) << 3) | ((((reg) >> 3) & 0x01) << 2) | ((((index) >> 3) & 0x01) << 1) | (((rm) >> 3) & 0x01)); \
-    }
-
-
-#define x86_64_emit_mem(r,disp) \
-    do { \
-        x86_64_address_byte(0,(r),5); \
-        x86_64_emit_imm32((disp)); \
-    } while (0)
-
-
-#define x86_64_emit_membase(basereg,disp,dreg) \
-    do { \
-        if ((basereg) == REG_SP || (basereg) == R12) { \
-            if ((disp) == 0) { \
-                x86_64_address_byte(0,(dreg),REG_SP); \
-                x86_64_address_byte(0,REG_SP,REG_SP); \
-            } else if (x86_64_is_imm8((disp))) { \
-                x86_64_address_byte(1,(dreg),REG_SP); \
-                x86_64_address_byte(0,REG_SP,REG_SP); \
-                x86_64_emit_imm8((disp)); \
-            } else { \
-                x86_64_address_byte(2,(dreg),REG_SP); \
-                x86_64_address_byte(0,REG_SP,REG_SP); \
-                x86_64_emit_imm32((disp)); \
-            } \
-            break; \
-        } \
-        if ((disp) == 0 && (basereg) != RBP && (basereg) != R13) { \
-            x86_64_address_byte(0,(dreg),(basereg)); \
-            break; \
-        } \
-        \
-        if ((basereg) == RIP) { \
-            x86_64_address_byte(0,(dreg),RBP); \
-            x86_64_emit_imm32((disp)); \
-            break; \
-        } \
-        \
-        if (x86_64_is_imm8((disp))) { \
-            x86_64_address_byte(1,(dreg),(basereg)); \
-            x86_64_emit_imm8((disp)); \
-        } else { \
-            x86_64_address_byte(2,(dreg),(basereg)); \
-            x86_64_emit_imm32((disp)); \
-        } \
-    } while (0)
-
-
-#define x86_64_emit_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        if ((basereg) == -1) { \
-            x86_64_address_byte(0,(reg),4); \
-            x86_64_address_byte((scale),(indexreg),5); \
-            x86_64_emit_imm32((disp)); \
-        \
-        } else if ((disp) == 0 && (basereg) != RBP && (basereg) != R13) { \
-            x86_64_address_byte(0,(reg),4); \
-            x86_64_address_byte((scale),(indexreg),(basereg)); \
-        \
-        } else if (x86_64_is_imm8((disp))) { \
-            x86_64_address_byte(1,(reg),4); \
-            x86_64_address_byte((scale),(indexreg),(basereg)); \
-            x86_64_emit_imm8 ((disp)); \
-        \
-        } else { \
-            x86_64_address_byte(2,(reg),4); \
-            x86_64_address_byte((scale),(indexreg),(basereg)); \
-            x86_64_emit_imm32((disp)); \
-        }    \
-     } while (0)
-
-
-#define x86_64_is_imm8(imm) \
-    (((long)(imm) >= -128 && (long)(imm) <= 127))
-
-
-#define x86_64_is_imm32(imm) \
-    ((long)(imm) >= (-2147483647-1) && (long)(imm) <= 2147483647)
-
-
-#define x86_64_emit_imm8(imm) \
-    *(mcodeptr++) = (u1) ((imm) & 0xff);
-
-
-#define x86_64_emit_imm16(imm) \
-    do { \
-        x86_64_imm_buf imb; \
-        imb.i = (s4) (imm); \
-        *(mcodeptr++) = imb.b[0]; \
-        *(mcodeptr++) = imb.b[1]; \
-    } while (0)
-
-
-#define x86_64_emit_imm32(imm) \
-    do { \
-        x86_64_imm_buf imb; \
-        imb.i = (s4) (imm); \
-        *(mcodeptr++) = imb.b[0]; \
-        *(mcodeptr++) = imb.b[1]; \
-        *(mcodeptr++) = imb.b[2]; \
-        *(mcodeptr++) = imb.b[3]; \
-    } while (0)
-
-
-#define x86_64_emit_imm64(imm) \
-    do { \
-        x86_64_imm_buf imb; \
-        imb.l = (s8) (imm); \
-        *(mcodeptr++) = imb.b[0]; \
-        *(mcodeptr++) = imb.b[1]; \
-        *(mcodeptr++) = imb.b[2]; \
-        *(mcodeptr++) = imb.b[3]; \
-        *(mcodeptr++) = imb.b[4]; \
-        *(mcodeptr++) = imb.b[5]; \
-        *(mcodeptr++) = imb.b[6]; \
-        *(mcodeptr++) = imb.b[7]; \
-    } while (0)
-
-
-
-void x86_64_emit_ialu(s4 alu_op, stackptr src, instruction *iptr);
-void x86_64_emit_lalu(s4 alu_op, stackptr src, instruction *iptr);
-void x86_64_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr);
-void x86_64_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr);
-void x86_64_emit_ishift(s4 shift_op, stackptr src, instruction *iptr);
-void x86_64_emit_lshift(s4 shift_op, stackptr src, instruction *iptr);
-void x86_64_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr);
-void x86_64_emit_lshiftconst(s4 shift_op, stackptr src, instruction *iptr);
-void x86_64_emit_ifcc(s4 if_op, stackptr src, instruction *iptr);
-void x86_64_emit_if_lcc(s4 if_op, stackptr src, instruction *iptr);
-void x86_64_emit_if_icmpcc(s4 if_op, stackptr src, instruction *iptr);
-void x86_64_emit_if_lcmpcc(s4 if_op, stackptr src, instruction *iptr);
-
-
-
-#if 0
-
-/*
- * mov ops
- */
-#define x86_64_mov_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(dreg)); \
-        *(mcodeptr++) = (u1) 0x89; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_mov_imm_reg(imm,reg) \
-    do { \
-        x86_64_emit_rex(1,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
-        x86_64_emit_imm64((imm)); \
-    } while (0)
-
-
-#define x86_64_mov_fimm_reg(imm,reg) \
-    do { \
-        x86_64_emit_rex(1,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
-        x86_64_emit_fimm64((imm)); \
-    } while (0)
-
-
-#define x86_64_movl_imm_reg(imm,reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
-        x86_64_emit_imm32((imm)); \
-    } while (0)
-
-
-#define x86_64_movl_fimm_reg(imm,reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
-        x86_64_emit_fimm32((imm)); \
-    } while (0)
-
-
-#define x86_64_mov_membase_reg(basereg,disp,reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x8b; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_movl_membase_reg(basereg,disp,reg) \
-    do { \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x8b; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-/*
- * this one is for INVOKEVIRTUAL/INVOKEINTERFACE to have a
- * constant membase immediate length of 32bit
- */
-#define x86_64_mov_membase32_reg(basereg,disp,reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x8b; \
-        x86_64_address_byte(2, (reg), (basereg)); \
-        x86_64_emit_imm32((disp)); \
-    } while (0)
-
-
-#define x86_64_mov_reg_membase(reg,basereg,disp) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x89; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_movl_reg_membase(reg,basereg,disp) \
-    do { \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x89; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_mov_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x8b; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movl_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x8b; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movw_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x66; \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x8b; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movb_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x8a; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_mov_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        x86_64_emit_rex(1,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x89; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movl_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x89; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movw_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = (u1) 0x66; \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x89; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movb_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x88; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_mov_imm_membase(imm,basereg,disp) \
-    do { \
-        x86_64_emit_rex(1,0,0,(basereg)); \
-        *(mcodeptr++) = (u1) 0xc7; \
-        x86_64_emit_membase((basereg),(disp),0); \
-        x86_64_emit_imm32((imm)); \
-    } while (0)
-
-
-#define x86_64_movl_imm_membase(imm,basereg,disp) \
-    do { \
-        x86_64_emit_rex(0,0,0,(basereg)); \
-        *(mcodeptr++) = (u1) 0xc7; \
-        x86_64_emit_membase((basereg),(disp),0); \
-        x86_64_emit_imm32((imm)); \
-    } while (0)
-
-
-#define x86_64_movsbq_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbe; \
-        /* XXX: why do reg and dreg have to be exchanged */ \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_movsbq_membase_reg(basereg,disp,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbe; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movsbl_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(0,(reg),0,(dreg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbe; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movswq_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbf; \
-        /* XXX: why do reg and dreg have to be exchanged */ \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_movswq_membase_reg(basereg,disp,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbf; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movswl_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbf; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movslq_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = (u1) 0x63; \
-        /* XXX: why do reg and dreg have to be exchanged */ \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_movslq_membase_reg(basereg,disp,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x63; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movzwq_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xb7; \
-        /* XXX: why do reg and dreg have to be exchanged */ \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_movzwq_membase_reg(basereg,disp,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xb7; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movswq_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbf; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movsbq_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xbe; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movzwq_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xb7; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movzbq_memindex_reg(disp,basereg,indexreg,scale,reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xb6; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-
-/*
- * alu operations
- */
-#define x86_64_alu_reg_reg(opc,reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(dreg)); \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_alul_reg_reg(opc,reg,dreg) \
-    do { \
-        x86_64_emit_rex(0,(reg),0,(dreg)); \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_alu_reg_membase(opc,reg,basereg,disp) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(basereg)); \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_alul_reg_membase(opc,reg,basereg,disp) \
-    do { \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_alu_membase_reg(opc,basereg,disp,reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(basereg)); \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 3; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_alul_membase_reg(opc,basereg,disp,reg) \
-    do { \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = (((u1) (opc)) << 3) + 3; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_alu_imm_reg(opc,imm,dreg) \
-    do { \
-        if (x86_64_is_imm8(imm)) { \
-            x86_64_emit_rex(1,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0x83; \
-            x86_64_emit_reg((opc),(dreg)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(1,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0x81; \
-            x86_64_emit_reg((opc),(dreg)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_alul_imm_reg(opc,imm,dreg) \
-    do { \
-        if (x86_64_is_imm8(imm)) { \
-            x86_64_emit_rex(0,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0x83; \
-            x86_64_emit_reg((opc),(dreg)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(0,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0x81; \
-            x86_64_emit_reg((opc),(dreg)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_alu_imm_membase(opc,imm,basereg,disp) \
-    do { \
-        if (x86_64_is_imm8(imm)) { \
-            x86_64_emit_rex(1,(basereg),0,0); \
-            *(mcodeptr++) = (u1) 0x83; \
-            x86_64_emit_membase((basereg),(disp),(opc)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(1,(basereg),0,0); \
-            *(mcodeptr++) = (u1) 0x81; \
-            x86_64_emit_membase((basereg),(disp),(opc)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_alul_imm_membase(opc,imm,basereg,disp) \
-    do { \
-        if (x86_64_is_imm8(imm)) { \
-            x86_64_emit_rex(0,(basereg),0,0); \
-            *(mcodeptr++) = (u1) 0x83; \
-            x86_64_emit_membase((basereg),(disp),(opc)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(0,(basereg),0,0); \
-            *(mcodeptr++) = (u1) 0x81; \
-            x86_64_emit_membase((basereg),(disp),(opc)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_test_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(dreg)); \
-        *(mcodeptr++) = (u1) 0x85; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_testl_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(0,(reg),0,(dreg)); \
-        *(mcodeptr++) = (u1) 0x85; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_test_imm_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf7; \
-        x86_64_emit_reg(0,(reg)); \
-        x86_64_emit_imm32((imm)); \
-    } while (0)
-
-
-#define x86_64_testw_imm_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0x66; \
-        *(mcodeptr++) = (u1) 0xf7; \
-        x86_64_emit_reg(0,(reg)); \
-        x86_64_emit_imm16((imm)); \
-    } while (0)
-
-
-#define x86_64_testb_imm_reg(imm,reg) \
-    do { \
-        *(mcodeptr++) = (u1) 0xf6; \
-        x86_64_emit_reg(0,(reg)); \
-        x86_64_emit_imm8((imm)); \
-    } while (0)
-
-
-#define x86_64_lea_membase_reg(basereg, disp, reg) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(basereg)); \
-        *(mcodeptr++) = 0x8d; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_leal_membase_reg(basereg, disp, reg) \
-    do { \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = 0x8d; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-
-/*
- * inc, dec operations
- */
-#define x86_64_inc_reg(reg) \
-    do { \
-        x86_64_emit_rex(1,0,0,(reg)); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_reg(0,(reg)); \
-    } while (0)
-
-
-#define x86_64_incl_reg(reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_reg(0,(reg)); \
-    } while (0)
-
-
-#define x86_64_inc_membase(basereg,disp) \
-    do { \
-        x86_64_emit_rex(1,(basereg),0,0); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define x86_64_incl_membase(basereg,disp) \
-    do { \
-        x86_64_emit_rex(0,(basereg),0,0); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define x86_64_dec_reg(reg) \
-    do { \
-        x86_64_emit_rex(1,0,0,(reg)); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_reg(1,(reg)); \
-    } while (0)
-
-        
-#define x86_64_decl_reg(reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_reg(1,(reg)); \
-    } while (0)
-
-        
-#define x86_64_dec_membase(basereg,disp) \
-    do { \
-        x86_64_emit_rex(1,(basereg),0,0); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_membase((basereg),(disp),1); \
-    } while (0)
-
-
-#define x86_64_decl_membase(basereg,disp) \
-    do { \
-        x86_64_emit_rex(0,(basereg),0,0); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_membase((basereg),(disp),1); \
-    } while (0)
-
-
-
-
-#define x86_64_cltd() \
-    *(mcodeptr++) = 0x99;
-
-
-#define x86_64_cqto() \
-    do { \
-        x86_64_emit_rex(1,0,0,0); \
-        *(mcodeptr++) = 0x99; \
-    } while (0)
-
-
-
-#define x86_64_imul_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xaf; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_imull_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xaf; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_imul_membase_reg(basereg,disp,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xaf; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_imull_membase_reg(basereg,disp,dreg) \
-    do { \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) 0xaf; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_imul_imm_reg(imm,dreg) \
-    do { \
-        if (x86_64_is_imm8((imm))) { \
-            x86_64_emit_rex(1,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0x6b; \
-            x86_64_emit_reg(0,(dreg)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(1,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0x69; \
-            x86_64_emit_reg(0,(dreg)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_imul_imm_reg_reg(imm,reg,dreg) \
-    do { \
-        if (x86_64_is_imm8((imm))) { \
-            x86_64_emit_rex(1,(dreg),0,(reg)); \
-            *(mcodeptr++) = (u1) 0x6b; \
-            x86_64_emit_reg((dreg),(reg)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(1,(dreg),0,(reg)); \
-            *(mcodeptr++) = (u1) 0x69; \
-            x86_64_emit_reg((dreg),(reg)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_imull_imm_reg_reg(imm,reg,dreg) \
-    do { \
-        if (x86_64_is_imm8((imm))) { \
-            x86_64_emit_rex(0,(dreg),0,(reg)); \
-            *(mcodeptr++) = (u1) 0x6b; \
-            x86_64_emit_reg((dreg),(reg)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(0,(dreg),0,(reg)); \
-            *(mcodeptr++) = (u1) 0x69; \
-            x86_64_emit_reg((dreg),(reg)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_imul_imm_membase_reg(imm,basereg,disp,dreg) \
-    do { \
-        if (x86_64_is_imm8((imm))) { \
-            x86_64_emit_rex(1,(dreg),0,(basereg)); \
-            *(mcodeptr++) = (u1) 0x6b; \
-            x86_64_emit_membase((basereg),(disp),(dreg)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(1,(dreg),0,(basereg)); \
-            *(mcodeptr++) = (u1) 0x69; \
-            x86_64_emit_membase((basereg),(disp),(dreg)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_imull_imm_membase_reg(imm,basereg,disp,dreg) \
-    do { \
-        if (x86_64_is_imm8((imm))) { \
-            x86_64_emit_rex(0,(dreg),0,(basereg)); \
-            *(mcodeptr++) = (u1) 0x6b; \
-            x86_64_emit_membase((basereg),(disp),(dreg)); \
-            x86_64_emit_imm8((imm)); \
-        } else { \
-            x86_64_emit_rex(0,(dreg),0,(basereg)); \
-            *(mcodeptr++) = (u1) 0x69; \
-            x86_64_emit_membase((basereg),(disp),(dreg)); \
-            x86_64_emit_imm32((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_idiv_reg(reg) \
-    do { \
-        x86_64_emit_rex(1,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xf7; \
-        x86_64_emit_reg(7,(reg)); \
-    } while (0)
-
-
-#define x86_64_idivl_reg(reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xf7; \
-        x86_64_emit_reg(7,(reg)); \
-    } while (0)
-
-
-
-#define x86_64_ret() \
-    *(mcodeptr++) = (u1) 0xc3;
-
-
-#define x86_64_leave() \
-    *(mcodeptr++) = (u1) 0xc9;
-
-
-
-/*
- * shift ops
- */
-#define x86_64_shift_reg(opc,reg) \
-    do { \
-        x86_64_emit_rex(1,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xd3; \
-        x86_64_emit_reg((opc),(reg)); \
-    } while (0)
-
-
-#define x86_64_shiftl_reg(opc,reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xd3; \
-        x86_64_emit_reg((opc),(reg)); \
-    } while (0)
-
-
-#define x86_64_shift_membase(opc,basereg,disp) \
-    do { \
-        x86_64_emit_rex(1,0,0,(basereg)); \
-        *(mcodeptr++) = (u1) 0xd3; \
-        x86_64_emit_membase((basereg),(disp),(opc)); \
-    } while (0)
-
-
-#define x86_64_shiftl_membase(opc,basereg,disp) \
-    do { \
-        x86_64_emit_rex(0,0,0,(basereg)); \
-        *(mcodeptr++) = (u1) 0xd3; \
-        x86_64_emit_membase((basereg),(disp),(opc)); \
-    } while (0)
-
-
-#define x86_64_shift_imm_reg(opc,imm,dreg) \
-    do { \
-        if ((imm) == 1) { \
-            x86_64_emit_rex(1,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0xd1; \
-            x86_64_emit_reg((opc),(dreg)); \
-        } else { \
-            x86_64_emit_rex(1,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0xc1; \
-            x86_64_emit_reg((opc),(dreg)); \
-            x86_64_emit_imm8((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_shiftl_imm_reg(opc,imm,dreg) \
-    do { \
-        if ((imm) == 1) { \
-            x86_64_emit_rex(0,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0xd1; \
-            x86_64_emit_reg((opc),(dreg)); \
-        } else { \
-            x86_64_emit_rex(0,0,0,(dreg)); \
-            *(mcodeptr++) = (u1) 0xc1; \
-            x86_64_emit_reg((opc),(dreg)); \
-            x86_64_emit_imm8((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_shift_imm_membase(opc,imm,basereg,disp) \
-    do { \
-        if ((imm) == 1) { \
-            x86_64_emit_rex(1,0,0,(basereg)); \
-            *(mcodeptr++) = (u1) 0xd1; \
-            x86_64_emit_membase((basereg),(disp),(opc)); \
-        } else { \
-            x86_64_emit_rex(1,0,0,(basereg)); \
-            *(mcodeptr++) = (u1) 0xc1; \
-            x86_64_emit_membase((basereg),(disp),(opc)); \
-            x86_64_emit_imm8((imm)); \
-        } \
-    } while (0)
-
-
-#define x86_64_shiftl_imm_membase(opc,imm,basereg,disp) \
-    do { \
-        if ((imm) == 1) { \
-            x86_64_emit_rex(0,0,0,(basereg)); \
-            *(mcodeptr++) = (u1) 0xd1; \
-            x86_64_emit_membase((basereg),(disp),(opc)); \
-        } else { \
-            x86_64_emit_rex(0,0,0,(basereg)); \
-            *(mcodeptr++) = (u1) 0xc1; \
-            x86_64_emit_membase((basereg),(disp),(opc)); \
-            x86_64_emit_imm8((imm)); \
-        } \
-    } while (0)
-
-
-
-/*
- * jump operations
- */
-#define x86_64_jmp_imm(imm) \
-    do { \
-        *(mcodeptr++) = 0xe9; \
-        x86_64_emit_imm32((imm)); \
-    } while (0)
-
-
-#define x86_64_jmp_reg(reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = 0xff; \
-        x86_64_emit_reg(4,(reg)); \
-    } while (0)
-
-
-#define x86_64_jcc(opc,imm) \
-    do { \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = (0x80 + x86_64_cc_map[(opc)]); \
-        x86_64_emit_imm32((imm)); \
-    } while (0)
-
-
-
-/*
- * conditional set and move operations
- */
-
-/* we need the rex byte to get all low bytes */
-#define x86_64_setcc_reg(opc,reg) \
-    do { \
-        *(mcodeptr++) = (0x40 | (((reg) >> 3) & 0x01)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = (0x90 + x86_64_cc_map[(opc)]); \
-        x86_64_emit_reg(0,(reg)); \
-    } while (0)
-
-
-/* we need the rex byte to get all low bytes */
-#define x86_64_setcc_membase(opc,basereg,disp) \
-    do { \
-        *(mcodeptr++) = (0x40 | (((basereg) >> 3) & 0x01)); \
-        *(mcodeptr++) = (u1) 0x0f; \
-        *(mcodeptr++) = (u1) (0x90 + x86_64_cc_map[(opc)]); \
-        x86_64_emit_membase((basereg),(disp),0); \
-    } while (0)
-
-
-#define x86_64_cmovcc_reg_reg(opc,reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x40 + x86_64_cc_map[(opc)]; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cmovccl_reg_reg(opc,reg,dreg) \
-    do { \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x40 + x86_64_cc_map[(opc)]; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-
-#define x86_64_neg_reg(reg) \
-    do { \
-        x86_64_emit_rex(1,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xf7; \
-        x86_64_emit_reg(3,(reg)); \
-    } while (0)
-
-
-#define x86_64_negl_reg(reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xf7; \
-        x86_64_emit_reg(3,(reg)); \
-    } while (0)
-
-
-#define x86_64_neg_membase(basereg,disp) \
-    do { \
-        x86_64_emit_rex(1,0,0,(basereg)); \
-        *(mcodeptr++) = (u1) 0xf7; \
-        x86_64_emit_membase((basereg),(disp),3); \
-    } while (0)
-
-
-#define x86_64_negl_membase(basereg,disp) \
-    do { \
-        x86_64_emit_rex(0,0,0,(basereg)); \
-        *(mcodeptr++) = (u1) 0xf7; \
-        x86_64_emit_membase((basereg),(disp),3); \
-    } while (0)
-
-
-
-#define x86_64_push_reg(reg) \
-    *(mcodeptr++) = (u1) 0x50 + (0x07 & (reg));
-
-
-#define x86_64_push_membase(basereg,disp) \
-    do { \
-        *(mcodeptr++) = (u1) 0xff; \
-        x86_64_emit_membase((basereg),(disp),6); \
-    } while (0)
-
-
-#define x86_64_push_imm(imm) \
-    do { \
-        *(mcodeptr++) = (u1) 0x68; \
-        x86_64_emit_imm32((imm)); \
-    } while (0)
-
-
-#define x86_64_pop_reg(reg) \
-    do { \
-        x86_64_emit_rex(0,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0x58 + (0x07 & (reg)); \
-    } while (0)
-
-
-#define x86_64_xchg_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(1,(reg),0,(dreg)); \
-        *(mcodeptr++) = 0x87; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_nop() \
-    *(mcodeptr++) = (u1) 0x90;
-
-
-#define x86_64_hlt() \
-    *(mcodeptr++) = 0xf4;
-
-
-
-/*
- * call instructions
- */
-#define x86_64_call_reg(reg) \
-    do { \
-        x86_64_emit_rex(1,0,0,(reg)); \
-        *(mcodeptr++) = (u1) 0xff; \
-        x86_64_emit_reg(2,(reg)); \
-    } while (0)
-
-
-#define x86_64_call_imm(imm) \
-    do { \
-        *(mcodeptr++) = (u1) 0xe8; \
-        x86_64_emit_imm32((imm)); \
-    } while (0)
-
-
-
-/*
- * floating point instructions (SSE2)
- */
-#define x86_64_addsd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x58; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_addss_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x58; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvtsi2ssq_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2a; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvtsi2ss_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2a; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvtsi2sdq_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2a; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvtsi2sd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2a; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvtss2sd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x5a; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvtsd2ss_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x5a; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvttss2siq_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2c; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvttss2si_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2c; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvttsd2siq_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(1,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2c; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_cvttsd2si_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2c; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_divss_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x5e; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_divsd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x5e; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_movd_reg_freg(reg,freg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(1,(freg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x6e; \
-        x86_64_emit_reg((freg),(reg)); \
-    } while (0)
-
-
-#define x86_64_movd_freg_reg(freg,reg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(1,(freg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x7e; \
-        x86_64_emit_reg((freg),(reg)); \
-    } while (0)
-
-
-#define x86_64_movd_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x7e; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_movd_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x7e; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movd_membase_reg(basereg,disp,dreg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(1,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x6e; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movdl_membase_reg(basereg,disp,dreg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x6e; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movd_memindex_reg(disp,basereg,indexreg,scale,dreg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(dreg),(indexreg),(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x6e; \
-        x86_64_emit_memindex((dreg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movq_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x7e; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_movq_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0xd6; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_movq_membase_reg(basereg,disp,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x7e; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movss_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(reg),0,(dreg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x10; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movsd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(reg),0,(dreg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x10; \
-        x86_64_emit_reg((reg),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movss_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x11; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_movsd_reg_membase(reg,basereg,disp) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(reg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x11; \
-        x86_64_emit_membase((basereg),(disp),(reg)); \
-    } while (0)
-
-
-#define x86_64_movss_membase_reg(basereg,disp,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x10; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movlps_membase_reg(basereg,disp,dreg) \
-    do { \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x12; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movsd_membase_reg(basereg,disp,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x10; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movlpd_membase_reg(basereg,disp,dreg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x12; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_movss_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x11; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movsd_reg_memindex(reg,disp,basereg,indexreg,scale) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(reg),(indexreg),(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x11; \
-        x86_64_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movss_memindex_reg(disp,basereg,indexreg,scale,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),(indexreg),(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x10; \
-        x86_64_emit_memindex((dreg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_movsd_memindex_reg(disp,basereg,indexreg,scale,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),(indexreg),(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x10; \
-        x86_64_emit_memindex((dreg),(disp),(basereg),(indexreg),(scale)); \
-    } while (0)
-
-
-#define x86_64_mulss_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x59; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_mulsd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x59; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_subss_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf3; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x5c; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_subsd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0xf2; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x5c; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_ucomiss_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2e; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_ucomisd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x2e; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_xorps_reg_reg(reg,dreg) \
-    do { \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x57; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_xorps_membase_reg(basereg,disp,dreg) \
-    do { \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x57; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-
-#define x86_64_xorpd_reg_reg(reg,dreg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(dreg),0,(reg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x57; \
-        x86_64_emit_reg((dreg),(reg)); \
-    } while (0)
-
-
-#define x86_64_xorpd_membase_reg(basereg,disp,dreg) \
-    do { \
-        *(mcodeptr++) = 0x66; \
-        x86_64_emit_rex(0,(dreg),0,(basereg)); \
-        *(mcodeptr++) = 0x0f; \
-        *(mcodeptr++) = 0x57; \
-        x86_64_emit_membase((basereg),(disp),(dreg)); \
-    } while (0)
-
-#else
-
-/*
- * integer instructions
- */
-void x86_64_mov_reg_reg(s8 reg, s8 dreg);
-void x86_64_mov_imm_reg(s8 imm, s8 reg);
-void x86_64_movl_imm_reg(s8 imm, s8 reg);
-void x86_64_mov_membase_reg(s8 basereg, s8 disp, s8 reg);
-void x86_64_movl_membase_reg(s8 basereg, s8 disp, s8 reg);
-void x86_64_mov_membase32_reg(s8 basereg, s8 disp, s8 reg);
-void x86_64_mov_reg_membase(s8 reg, s8 basereg, s8 disp);
-void x86_64_movl_reg_membase(s8 reg, s8 basereg, s8 disp);
-void x86_64_mov_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg);
-void x86_64_movl_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg);
-void x86_64_mov_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale);
-void x86_64_movl_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale);
-void x86_64_movw_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale);
-void x86_64_movb_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale);
-void x86_64_mov_imm_membase(s8 imm, s8 basereg, s8 disp);
-void x86_64_movl_imm_membase(s8 imm, s8 basereg, s8 disp);
-void x86_64_movsbq_reg_reg(s8 reg, s8 dreg);
-void x86_64_movsbq_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movswq_reg_reg(s8 reg, s8 dreg);
-void x86_64_movswq_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movslq_reg_reg(s8 reg, s8 dreg);
-void x86_64_movslq_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movzwq_reg_reg(s8 reg, s8 dreg);
-void x86_64_movzwq_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movswq_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg);
-void x86_64_movsbq_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg);
-void x86_64_movzwq_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 reg);
-void x86_64_alu_reg_reg(s8 opc, s8 reg, s8 dreg);
-void x86_64_alul_reg_reg(s8 opc, s8 reg, s8 dreg);
-void x86_64_alu_reg_membase(s8 opc, s8 reg, s8 basereg, s8 disp);
-void x86_64_alul_reg_membase(s8 opc, s8 reg, s8 basereg, s8 disp);
-void x86_64_alu_membase_reg(s8 opc, s8 basereg, s8 disp, s8 reg);
-void x86_64_alul_membase_reg(s8 opc, s8 basereg, s8 disp, s8 reg);
-void x86_64_alu_imm_reg(s8 opc, s8 imm, s8 dreg);
-void x86_64_alul_imm_reg(s8 opc, s8 imm, s8 dreg);
-void x86_64_alu_imm_membase(s8 opc, s8 imm, s8 basereg, s8 disp);
-void x86_64_alul_imm_membase(s8 opc, s8 imm, s8 basereg, s8 disp);
-void x86_64_test_reg_reg(s8 reg, s8 dreg);
-void x86_64_testl_reg_reg(s8 reg, s8 dreg);
-void x86_64_test_imm_reg(s8 imm, s8 reg);
-void x86_64_testw_imm_reg(s8 imm, s8 reg);
-void x86_64_testb_imm_reg(s8 imm, s8 reg);
-void x86_64_lea_membase_reg(s8 basereg, s8 disp, s8 reg);
-void x86_64_leal_membase_reg(s8 basereg, s8 disp, s8 reg);
-void x86_64_inc_reg(s8 reg);
-void x86_64_incl_reg(s8 reg);
-void x86_64_inc_membase(s8 basereg, s8 disp);
-void x86_64_incl_membase(s8 basereg, s8 disp);
-void x86_64_dec_reg(s8 reg);
-void x86_64_decl_reg(s8 reg);
-void x86_64_dec_membase(s8 basereg, s8 disp);
-void x86_64_decl_membase(s8 basereg, s8 disp);
-void x86_64_cltd();
-void x86_64_cqto();
-void x86_64_imul_reg_reg(s8 reg, s8 dreg);
-void x86_64_imull_reg_reg(s8 reg, s8 dreg);
-void x86_64_imul_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_imull_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_imul_imm_reg(s8 imm, s8 dreg);
-void x86_64_imul_imm_reg_reg(s8 imm,s8 reg, s8 dreg);
-void x86_64_imull_imm_reg_reg(s8 imm, s8 reg, s8 dreg);
-void x86_64_imul_imm_membase_reg(s8 imm, s8 basereg, s8 disp, s8 dreg);
-void x86_64_imull_imm_membase_reg(s8 imm, s8 basereg, s8 disp, s8 dreg);
-void x86_64_idiv_reg(s8 reg);
-void x86_64_idivl_reg(s8 reg);
-void x86_64_ret();
-void x86_64_shift_reg(s8 opc, s8 reg);
-void x86_64_shiftl_reg(s8 opc, s8 reg);
-void x86_64_shift_membase(s8 opc, s8 basereg, s8 disp);
-void x86_64_shiftl_membase(s8 opc, s8 basereg, s8 disp);
-void x86_64_shift_imm_reg(s8 opc, s8 imm, s8 dreg);
-void x86_64_shiftl_imm_reg(s8 opc, s8 imm, s8 dreg);
-void x86_64_shift_imm_membase(s8 opc, s8 imm, s8 basereg, s8 disp);
-void x86_64_shiftl_imm_membase(s8 opc, s8 imm, s8 basereg, s8 disp);
-void x86_64_jmp_imm(s8 imm);
-void x86_64_jmp_reg(s8 reg);
-void x86_64_jcc(s8 opc, s8 imm);
-void x86_64_setcc_reg(s8 opc, s8 reg);
-void x86_64_setcc_membase(s8 opc, s8 basereg, s8 disp);
-void x86_64_cmovcc_reg_reg(s8 opc, s8 reg, s8 dreg);
-void x86_64_cmovccl_reg_reg(s8 opc, s8 reg, s8 dreg);
-void x86_64_neg_reg(s8 reg);
-void x86_64_negl_reg(s8 reg);
-void x86_64_neg_membase(s8 basereg, s8 disp);
-void x86_64_negl_membase(s8 basereg, s8 disp);
-void x86_64_push_imm(s8 imm);
-void x86_64_pop_reg(s8 reg);
-void x86_64_xchg_reg_reg(s8 reg, s8 dreg);
-void x86_64_nop();
-void x86_64_call_reg(s8 reg);
-void x86_64_call_imm(s8 imm);
-
-
-
-/*
- * floating point instructions (SSE2)
- */
-void x86_64_addsd_reg_reg(s8 reg, s8 dreg);
-void x86_64_addss_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvtsi2ssq_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvtsi2ss_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvtsi2sdq_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvtsi2sd_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvtss2sd_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvtsd2ss_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvttss2siq_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvttss2si_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvttsd2siq_reg_reg(s8 reg, s8 dreg);
-void x86_64_cvttsd2si_reg_reg(s8 reg, s8 dreg);
-void x86_64_divss_reg_reg(s8 reg, s8 dreg);
-void x86_64_divsd_reg_reg(s8 reg, s8 dreg);
-void x86_64_movd_reg_freg(s8 reg, s8 freg);
-void x86_64_movd_freg_reg(s8 freg, s8 reg);
-void x86_64_movd_reg_membase(s8 reg, s8 basereg, s8 disp);
-void x86_64_movd_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale);
-void x86_64_movd_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movdl_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movd_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 dreg);
-void x86_64_movq_reg_reg(s8 reg, s8 dreg);
-void x86_64_movq_reg_membase(s8 reg, s8 basereg, s8 disp);
-void x86_64_movq_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movss_reg_reg(s8 reg, s8 dreg);
-void x86_64_movsd_reg_reg(s8 reg, s8 dreg);
-void x86_64_movss_reg_membase(s8 reg, s8 basereg, s8 disp);
-void x86_64_movsd_reg_membase(s8 reg, s8 basereg, s8 disp);
-void x86_64_movss_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movlps_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movsd_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movlpd_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_movss_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale);
-void x86_64_movsd_reg_memindex(s8 reg, s8 disp, s8 basereg, s8 indexreg, s8 scale);
-void x86_64_movss_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 dreg);
-void x86_64_movsd_memindex_reg(s8 disp, s8 basereg, s8 indexreg, s8 scale, s8 dreg);
-void x86_64_mulss_reg_reg(s8 reg, s8 dreg);
-void x86_64_mulsd_reg_reg(s8 reg, s8 dreg);
-void x86_64_subss_reg_reg(s8 reg, s8 dreg);
-void x86_64_subsd_reg_reg(s8 reg, s8 dreg);
-void x86_64_ucomiss_reg_reg(s8 reg, s8 dreg);
-void x86_64_ucomisd_reg_reg(s8 reg, s8 dreg);
-void x86_64_xorps_reg_reg(s8 reg, s8 dreg);
-void x86_64_xorps_membase_reg(s8 basereg, s8 disp, s8 dreg);
-void x86_64_xorpd_reg_reg(s8 reg, s8 dreg);
-void x86_64_xorpd_membase_reg(s8 basereg, s8 disp, s8 dreg);
-
-#endif
-
-
-
-/* function gen_resolvebranch **************************************************
-
-    backpatches a branch instruction
-
-    parameters: ip ... pointer to instruction after branch (void*)
-                so ... offset of instruction after branch  (s8)
-                to ... offset of branch target             (s8)
-
-*******************************************************************************/
-
-#define gen_resolvebranch(ip,so,to) \
-    *((s4*) ((ip) - 4)) = (s4) ((to) - (so));
-
-#define SOFTNULLPTRCHECK       /* soft null pointer check supportet as option */
-
-#endif
diff --git a/x86_64/threads.h b/x86_64/threads.h
deleted file mode 100644 (file)
index 28ed4cc..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* x86_64/threads.h ************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    System dependent part of thread header file.
-
-    Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
-             Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-             Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: threads.h 520 2003-10-22 20:56:57Z twisti $
-
-*******************************************************************************/
-
-
-#ifndef __sysdep_threads_h
-#define __sysdep_threads_h
-
-#include "config.h"
-#include "threads/thread.h"
-
-/* Thread handling */
-
-/* prototypes */
-
-void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
-u1*  asm_initialize_thread_stack (void *func, u1 *stack);
-
-/* access macros */
-
-#define        THREADSTACKSIZE         (32 * 1024)
-
-#define        THREADSWITCH(to, from)  asm_perform_threadswitch(&(from)->restorePoint,\
-                                    &(to)->restorePoint, &(from)->usedStackTop)
-
-#define THREADINIT(to, func)    (to)->restorePoint =                         \
-                                    asm_initialize_thread_stack((u1*)(func), \
-                                                            (to)->stackEnd)
-
-#define        THREADINFO(e) \
-    do { \
-        (e)->restorePoint = 0; \
-        (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
-    } while(0)
-
-#endif
diff --git a/x86_64/types.h b/x86_64/types.h
deleted file mode 100644 (file)
index 641b55e..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* x86_64/types.h **************************************************************
-
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
-    See file COPYRIGHT for information on usage and disclaimer of warranties
-
-    Machine specific definitions for the x86_64 processor
-       
-    Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
-             Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-             Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
-             Christian Thalinger EMAIL: cacao@complang.tuwien.ac.at
-
-    Last Change: $Id: types.h 465 2003-09-17 23:14:48Z twisti $
-
-*******************************************************************************/
-
-#ifndef _CACAO_TYPES_H
-#define _CACAO_TYPES_H
-
-#define POINTERSIZE         8
-#define WORDS_BIGENDIAN     0
-
-#define SUPPORT_DIVISION    1
-#define SUPPORT_LONG        1
-#define SUPPORT_FLOAT       1
-#define SUPPORT_DOUBLE      1
-
-#define SUPPORT_LONG_ADD    1
-#define SUPPORT_LONG_CMP    1
-#define SUPPORT_LONG_LOG    1
-#define SUPPORT_LONG_SHIFT  1
-#define SUPPORT_LONG_MULDIV 1
-#define SUPPORT_LONG_ICVT   1
-#define SUPPORT_LONG_FCVT   1
-
-#define CONDITIONAL_LOADCONST
-#define NO_DIV_OPT
-#define CONSECUTIVE_INTARGS
-#define CONSECUTIVE_FLOATARGS
-
-#define U8_AVAILABLE        1
-
-
-typedef signed char             s1;
-typedef unsigned char           u1;
-typedef signed short int        s2;
-typedef unsigned short int      u2;
-
-typedef signed int              s4;
-typedef unsigned int            u4;
-
-#if U8_AVAILABLE
-typedef signed long int         s8;
-typedef unsigned long int       u8;
-#else
-typedef struct {u4 low, high;}  u8;
-#define s8 u8
-#endif
-
-#endif