## Process this file with automake to produce Makefile.in
-# $Id: Makefile.am 470 2003-10-04 18:35:15Z stefan $
+# $Id: Makefile.am 483 2003-10-14 17:08:38Z twisti $
@SET_MAKE@
MAINTAINERCLEANFILES = Makefile.in configure
-ALLSUBDIRS = toolbox mm jit comp nat threads tst doc narray jvmtst
+ALLSUBDIRS = toolbox mm jit nat threads tst doc narray jvmtst
SUBDIRS = $(ALLSUBDIRS) @SYSDEP_DIR@
DIST_SUBDIRS = $(ALLSUBDIRS) alpha mips i386 powerpc x86_64
tables.c \
tables.h
-EXTRA_cacao_SOURCES = \
- compiler.c \
- compiler.h
-
cacao_LDADD = \
@SYSDEP_DIR@/asmpart.o \
@COMPILER_OBJECTS@ \
--- /dev/null
+dnl aclocal.m4 generated automatically by aclocal 1.4
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # 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".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# 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 ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated. We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+ case " <<$>>CONFIG_HEADERS " in
+ *" <<$>>am_file "*<<)>>
+ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
.globl asm_builtin_trace
.globl asm_builtin_exittrace
-/*************************** imported variables *******************************/
-
- .globl newcompiler
-
-
/*************************** imported functions *******************************/
.globl jit_compile
ldq ra,0(sp) /* restore return address */
ldq gp,24(sp) /* restore global pointer */
lda sp,32(sp) /* free stack space */
- ldl v0,newcompiler /* load newcompiler flag */
- subq v0,1,v0 /* negate for clearing v0 */
- beq v0,calljava_ret /* if newcompiler skip ex copying */
- mov $1,v0 /* pass exception to caller (C) */
+ clr v0
+
calljava_ret:
jmp zero,(ra)
ldq gp,24(sp) /* restore global pointer */
lda sp,32(sp) /* free stack space */
-/* ldl v0,newcompiler */ /* load newcompiler flag */
-/* subq v0,1,v0 */ /* negate for clearing v0 */
-/* beq v0,calljava_ret*/ /* if newcompiler skip ex copying */
-/* mov $1,v0 */ /* pass exception to caller (C) */
calljava_ret2:
jmp zero,(ra)
+++ /dev/null
-EXTRA_DIST = block.c local.c parse.c reg.c stack.c var.c \
- defines.c mcode.c pcmd.c regalloc.c tools.c
+++ /dev/null
-/***************************** comp/block.c ************************************
-
- Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
- See file COPYRIGHT for information on usage and disclaimer of warranties
-
- Basic block handling functions.
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1997/01/18
-
-*******************************************************************************/
-
-
-static u2 creatornum; /* Fortlaufende Nummerierung f"ur vom Compiler
- generierte BasicBlocks (nur zu Debug-Zwecken) */
-
-static subroutineinfo *actual_subroutine;
-static u2 subroutinecounter=0;
-
-
-/********************** Funktion: block_new ***********************************
-
- erzeugt eine neue 'basicblock'-Struktur und initialisiert alle
- Komponenten
-
-******************************************************************************/
-
-static basicblock *block_new (u2 type, u4 codepos)
-{
- basicblock *b = DNEW (basicblock);
-
- b -> type = type;
- b -> reached = false;
- b -> finished = false;
- b -> subroutine = NULL;
- b -> jpc = codepos;
- b -> stack = NULL;
- list_init (&(b->pcmdlist), OFFSET (pcmd, linkage) );
- b -> mpc = 0;
-
- b -> exproto = NULL;
- b -> throwpos = 0;
- return b;
-}
-
-
-
-/******************* Funktion: block_find *************************************
-
- Sucht den Basicblock, der an einer gew"unschten Stelle im JavaVM-Code
- anf"angt.
- Wenn dort kein Block anf"angt -> Fehler
-
-******************************************************************************/
-
-static basicblock *block_find (u4 codepos)
-{
- basicblock *b = blocks[codepos];
- if (!b) panic ("Accessed JAVA-Command on no block boundary");
- return b;
-}
-
-
-/****************** Funktion: block_isany *************************************
-
- "uberpr"uft, ob an einer Stelle ein Basicblock anf"angt
-
-******************************************************************************/
-
-static bool block_isany (u4 codepos)
-{
- return (blocks[codepos] != NULL);
-}
-
-
-/***************** Funktion: block_reach **************************************
-
- H"angt einen Basicblock in die Liste der schon erreichten Bl"ocke ein,
- und setzt seinen Blockeintrittsstack auf den aktuellen Stack und
- setzt den Unterprogramminfoblock auf das aktuelle Unterprogramminfo
-
- Wenn der Block bereits vorher als erreicht markiert war (und er deshalb
- schon einen definierten Stack hatte), dann wird im derzeit vom
- Parser durchlaufenen Block (also dort, von wo dieser Block aus
- angesprungen wird) ein entsprechende Codest"uck hinzugef"ugt, der
- die beiden Stacks aufeinander abstimmt.
-
-******************************************************************************/
-
-static void block_reach (basicblock *b)
-{
- if (!b->reached) {
- list_addlast (&reachedblocks, b);
- b -> reached = true;
- b -> subroutine = actual_subroutine;
- b -> stack = stack_get();
- }
- else {
- if (b->subroutine != actual_subroutine)
- panic ("Try to merge different subroutines");
- stack_addjoincode (b->stack);
- }
-}
-
-/*********************** Funktion: subroutine_set *****************************
-
- setzt den aktuellen Subroutine-Infoblock
-
-*******************************************************************************/
-
-static void subroutine_set (subroutineinfo *s)
-{
- actual_subroutine = s;
-}
-
-
-
-/*********************** Funktion: subroutine_new *****************************
-
- erzeugt einen neuen Subroutine-Infoblock
-
-*******************************************************************************/
-
-static subroutineinfo *subroutine_new ()
-{
- subroutineinfo *s = DNEW (subroutineinfo);
- s -> returnfinished = false;
- s -> returnstack = NULL;
- s -> callers = chain_dnew();
- s -> counter = subroutinecounter++;
- return s;
-}
-
-
-
-
-
-
-/********************** Funktion: block_insert ********************************
-
- Erzeugt einen neuen Block, der an einer gew"unschten JavaVM-Code- Stelle
- anf"angt.
- Der Zeiger auf diesen Block wird im (globalen) 'blocks'-Array
- abgelegt.
-
-******************************************************************************/
-
-static void block_insert (u4 codepos)
-{
- if (codepos>=jcodelength) {
- sprintf (logtext,"Basic block border (%d) out of bounds",(int) codepos);
- error ();
- }
-
- if (blocks[codepos]) return;
-
- blocks[codepos] = block_new (BLOCKTYPE_JAVA, codepos);
-}
-
-
-
-/******************** Funktion: block_createexcreator *************************
-
- erzeugt einen neuen Basicblock vom Typ EXCREATOR (=Exception Creator)
-
-******************************************************************************/
-
-static basicblock *block_createexcreator (java_objectheader *exproto, u4 throwpos)
-{
- basicblock *b;
-
- b = block_new (BLOCKTYPE_EXCREATOR, creatornum++);
-
- b -> reached = true;
- list_addlast (&reachedblocks, b);
- b -> subroutine = actual_subroutine;
- b -> exproto = exproto;
- b -> throwpos = throwpos;
- return b;
-}
-
-
-/******************* Funktion: block_createexforwarder ***********************
-
- erzeugt einen neuen Basicblock vom Typ EXFORWARDER (=Exception Forwarder)
-
-*****************************************************************************/
-
-static basicblock *block_createexforwarder (varid exvar, u4 throwpos)
-{
- basicblock *b;
-
- b = block_new (BLOCKTYPE_EXFORWARDER, creatornum++);
-
- b -> reached = true;
- list_addlast (&reachedblocks, b);
- b -> subroutine = actual_subroutine;
- b -> exvar = exvar;
- b -> throwpos = throwpos;
- return b;
-}
-
-
-/********************** Funktion: block_genmcode ******************************
-
- generiert f"ur einen vom Parser fertig abgearbeiteten Block den
- Maschinencode.
- Hintereinanderliegende Bl"ocke durch die der Kontrollflu"s ohne
- Sprungbefehle durchgeht, m"ussen hier auch hintereinander
- abgearbeitet werden.
-
-******************************************************************************/
-
-/* definition of block_genmcode moved to gen.c for inlining by andi */
-
-
-/************************ Funktion: block_firstscann **************************
-
- Liest den JavaVM-Code der ganzen Methode durch und erzeugt soviele
- neue Bl"ocke, wie es verschiedene Sprungziele gibt.
-
-******************************************************************************/
-
-static void block_firstscann ()
-{
- u4 p,nextp;
- int i;
- u1 opcode;
- bool blockend;
-
-
- creatornum=10001;
-
-
- block_insert (0);
-
- for (i=0; i<exceptiontablelength; i++) block_insert(extable[i].handlerpc);
-
- p=0;
- blockend = false;
- while (p<jcodelength) {
- if (blockend) {
- block_insert (p);
- blockend = false;
- }
-
- opcode = jcode[p];
- nextp = p + jcommandsize[opcode];
-
- switch ( opcode ) {
- case CMD_IFEQ:
- case CMD_IFNULL:
- case CMD_IFLT:
- case CMD_IFLE:
- case CMD_IFNE:
- case CMD_IFNONNULL:
- case CMD_IFGT:
- case CMD_IFGE:
- case CMD_IF_ICMPEQ:
- case CMD_IF_ICMPNE:
- case CMD_IF_ICMPLT:
- case CMD_IF_ICMPGT:
- case CMD_IF_ICMPLE:
- case CMD_IF_ICMPGE:
- case CMD_IF_ACMPEQ:
- case CMD_IF_ACMPNE:
- block_insert ( p + code_get_s2 (p+1) );
- break;
-
- case CMD_GOTO:
- block_insert ( p + code_get_s2 (p+1) );
- blockend = true;
- break;
-
- case CMD_GOTO_W:
- block_insert ( p + code_get_s4 (p+1) );
- blockend = true;
- break;
-
- case CMD_JSR:
- block_insert ( p + code_get_s2 (p+1) );
- blockend = true;
- break;
-
- case CMD_JSR_W:
- block_insert ( p + code_get_s4 (p+1) );
- blockend = true;
- break;
-
- case CMD_RET:
- blockend = true;
- break;
-
- case CMD_IRETURN:
- case CMD_LRETURN:
- case CMD_FRETURN:
- case CMD_DRETURN:
- case CMD_ARETURN:
- case CMD_RETURN:
- blockend = true;
- break;
-
- case CMD_ATHROW:
- blockend = true;
- break;
-
-
- case CMD_WIDE:
- switch (code_get_u1(p+1)) {
- case CMD_RET: nextp = p+4;
- blockend = true;
- break;
- case CMD_IINC: nextp = p+6;
- break;
- default: nextp = p+4;
- break;
- }
- break;
-
- case CMD_LOOKUPSWITCH:
- { u4 num,p2,i;
- p2 = ALIGN ((p+1),4);
- num = code_get_u4 (p2+4);
- nextp = p2 + 8 + 8*num;
-
- block_insert ( p + code_get_s4(p2) );
- for (i=0; i<num; i++)
- block_insert ( p + code_get_s4(p2+12+8*i) );
-
- blockend = true;
- }
- break;
-
- case CMD_TABLESWITCH:
- { u4 num,p2,i;
- p2 = ALIGN ((p+1),4);
- num= code_get_u4(p2+8) - code_get_u4 (p2+4) + 1;
- nextp = p2 + 12 + 4*num;
-
- block_insert ( p + code_get_s4(p2) );
-
- for (i=0; i<num; i++)
- block_insert ( p + code_get_s4(p2+12+4*i) );
-
- blockend = true;
- }
- break;
-
- case CMD_LDC1:
- i = code_get_u1(p+1);
- goto pushconstantitem;
- case CMD_LDC2:
- case CMD_LDC2W:
- i = code_get_u2(p + 1);
- pushconstantitem:
- if (class_constanttype(class, i) == CONSTANT_String) {
- utf *s;
- s = class_getconstant(class, i, CONSTANT_String);
- (void) literalstring_new(s);
- }
- break;
- }
-
- if (nextp > jcodelength) panic ("Command-sequence crosses code-boundary");
- p = nextp;
- }
-
- if (!blockend) panic ("Code does not end with branch/return/athrow - stmt");
-
-}
-
-
-
-/************* Funktion: block_display (nur zu Debug-Zwecken) ****************/
-
-void block_display (basicblock *b)
-{
- pcmd *p;
-
- if (b->subroutine) {
- printf ("\n%ld in subroutine: %d", (long int) b->jpc, (int) b->subroutine->counter);
- }
- else {
- printf ("\n%ld:", (long int) b->jpc);
- }
-
- switch (b->type) {
- case BLOCKTYPE_JAVA: printf ("(JavaVM code)\n"); break;
- case BLOCKTYPE_EXCREATOR: printf ("(Exception creator)\n"); break;
- case BLOCKTYPE_EXFORWARDER: printf ("(Exception forwarder)\n"); break;
- }
-
- printf ("binding of stack: ");
- stack_display (b->stack); printf ("\n");
-
- p = list_first (&(b->pcmdlist));
- while (p) {
- pcmd_display (p);
- p = list_next (&(b->pcmdlist), p);
- }
-}
-
-
+++ /dev/null
-/******************************** comp/defines.c *******************************
-
- Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
- See file COPYRIGHT for information on usage and disclaimer of warranties
-
- defines all the constants and data structures of the compiler
-
- 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
-
-*******************************************************************************/
-
-#include "types.h"
-
-/*********************** resolve typedef-cycles *******************************/
-
-typedef struct stackinfo stackinfo;
-typedef struct basicblock basicblock;
-typedef struct varinfo varinfo;
-typedef struct subroutineinfo subroutineinfo;
-
-
-/***************************** basic block structure **************************/
-
-#define BLOCKTYPE_JAVA 1
-#define BLOCKTYPE_EXCREATOR 2
-#define BLOCKTYPE_EXFORWARDER 3
-
-/* there are three kinds of basic blocks:
- JAVA ........ block which contains JavaVM code (normal case)
- EXCREATOR ... block which creates an exception and calls the handler
- EXFORWARDER .. block which does the dispatching to all possible handlers
-*/
-
-struct basicblock {
- u2 type; /* block type */
- bool reached; /* true, when block has been reached; the field stack
- contains the stack valid before entering block */
- bool finished; /* true, if 'pcmdlist' is finished */
- subroutineinfo *subroutine; /* info about blocks reachable by JSR */
- listnode linkage; /* list chaining */
- u4 jpc; /* JavaVM program counter at start of block */
- stackinfo *stack; /* stack description */
- list pcmdlist; /* list of pseudo commands */
- u4 mpc; /* program counter within compiled machine code */
- java_objectheader *exproto;
- /* if (type==EXCREATOR) contains pointer to exception
- raising object */
- varinfo *exvar; /* if (type==EXFORWARDER) contains exception variable */
- u4 throwpos; /* if (type!=JAVA) contains position in program where
- the exception was raised */
- };
-
-
-/***************************** subroutine structure ***************************/
-
-struct subroutineinfo {
- bool returnfinished; /* true if return allready has been processed */
-
- stackinfo *returnstack; /* stack structure at position of return */
- chain *callers; /* a list of all callers */
- u2 counter;
- };
-
-
-/************************** stack element structure ***************************/
-
-struct stackinfo {
- stackinfo *prev; /* pointer to next element towards bootom */
- varinfo *var; /* pointer to variable which contains this value */
- };
-
-
-/************************* pseudo variable structure **************************/
-
-struct varinfo {
- listnode linkage; /* list chaining */
-
- u2 type; /* basic type of variable */
- u2 number; /* sequential numbering (used for debugging) */
-
- bool saved; /* true if variable sould survive subroutine calls */
-
- struct reginfo *reg; /* registerused by variable */
-
- /* temporary fields used during parsing */
-
- list copies; /* list of all variables which are copies */
- listnode copylink; /* chaining for copy list */
- varinfo *original; /* pointer to original variable (self reference
- is possible) */
-
- bool globalscope; /* true if variable is activ in whole subroutine */
- bool active; /* true if variable is currently active (parsing
- a block where the variable is valid ) */
- };
-
-
-typedef varinfo *varid;
-
-#define NOVAR NULL
-
-
-/************************** pseudo command structure **************************/
-
-/* pseudo command tags */
-
-#define TAG_LOADCONST_I 1 /* load integer constant */
-#define TAG_LOADCONST_L 2 /* load long constant */
-#define TAG_LOADCONST_F 3 /* load float constant */
-#define TAG_LOADCONST_D 4 /* load double constant */
-#define TAG_LOADCONST_A 5 /* load address constant */
-#define TAG_MOVE 6
-#define TAG_OP 7
-#define TAG_MEM 8
-#define TAG_BRA 9
-#define TAG_TABLEJUMP 10
-#define TAG_METHOD 11
-#define TAG_DROP 12
-#define TAG_ACTIVATE 13
-
-
-typedef struct pcmd {
- listnode linkage; /* list chaining */
- int tag; /* kind of pseudo command */
- int opcode; /* opcode and kind of pseudo command */
-
- varinfo *dest; /* optional destination operand */
- varinfo *source1; /* 3 optional source operands */
- varinfo *source2;
- varinfo *source3;
-
- union {
- struct { /* load integer constant */
- s4 value;
- } i;
- struct { /* load long constant */
- s8 value;
- } l;
- struct { /* load float constant */
- float value;
- } f;
- struct { /* load double constant */
- double value;
- } d;
- struct { /* load address constant */
- voidptr value;
- } a;
-
- struct { /* move */
- u2 type; /* type of value */
- } move;
-
- struct { /* memory access (load/store) */
- int type; /* access type */
- u4 offset; /* offset relative to base register */
- } mem;
-
- struct { /* branch */
- basicblock *target; /* branch target */
- } bra;
-
- struct { /* branch using table */
- u4 targetcount; /* number of entries */
- basicblock **targets; /* branch target */
- } tablejump;
-
- struct { /* method call */
- methodinfo *method; /* pointer to 'methodinfo'-structure */
- functionptr builtin; /* C function pointer or NULL */
- u2 paramnum; /* number of parameters */
- varid *params; /* table of parameter variables */
- varid exceptionvar; /* exception variable */
- } method;
-
- } u;
-
- } pcmd;
-
-
-
-
-
-
-/***************** forward references in branch instructions ******************/
-
-typedef struct mcodereference {
- listnode linkage; /* list chaining */
-
- bool incode; /* true if code address, false if data address */
- s4 msourcepos; /* patching position in code/data segment */
- basicblock *target; /* target basic block */
- } mcodereference;
-
-
-
-
-/********** JavaVM operation codes (sortet) and instruction lengths ***********/
-
-u1 jcommandsize[256] = {
-
-#define CMD_NOP 0
- 1,
-#define CMD_ACONST_NULL 1
- 1,
-#define CMD_ICONST_M1 2
- 1,
-#define CMD_ICONST_0 3
- 1,
-#define CMD_ICONST_1 4
- 1,
-#define CMD_ICONST_2 5
- 1,
-#define CMD_ICONST_3 6
- 1,
-#define CMD_ICONST_4 7
- 1,
-#define CMD_ICONST_5 8
- 1,
-#define CMD_LCONST_0 9
- 1,
-#define CMD_LCONST_1 10
- 1,
-#define CMD_FCONST_0 11
- 1,
-#define CMD_FCONST_1 12
- 1,
-#define CMD_FCONST_2 13
- 1,
-#define CMD_DCONST_0 14
- 1,
-#define CMD_DCONST_1 15
- 1,
-#define CMD_BIPUSH 16
- 2,
-#define CMD_SIPUSH 17
- 3,
-#define CMD_LDC1 18
- 2,
-#define CMD_LDC2 19
- 3,
-#define CMD_LDC2W 20
- 3,
-#define CMD_ILOAD 21
- 2,
-#define CMD_LLOAD 22
- 2,
-#define CMD_FLOAD 23
- 2,
-#define CMD_DLOAD 24
- 2,
-#define CMD_ALOAD 25
- 2,
-#define CMD_ILOAD_0 26
- 1,
-#define CMD_ILOAD_1 27
- 1,
-#define CMD_ILOAD_2 28
- 1,
-#define CMD_ILOAD_3 29
- 1,
-#define CMD_LLOAD_0 30
- 1,
-#define CMD_LLOAD_1 31
- 1,
-#define CMD_LLOAD_2 32
- 1,
-#define CMD_LLOAD_3 33
- 1,
-#define CMD_FLOAD_0 34
- 1,
-#define CMD_FLOAD_1 35
- 1,
-#define CMD_FLOAD_2 36
- 1,
-#define CMD_FLOAD_3 37
- 1,
-#define CMD_DLOAD_0 38
- 1,
-#define CMD_DLOAD_1 39
- 1,
-#define CMD_DLOAD_2 40
- 1,
-#define CMD_DLOAD_3 41
- 1,
-#define CMD_ALOAD_0 42
- 1,
-#define CMD_ALOAD_1 43
- 1,
-#define CMD_ALOAD_2 44
- 1,
-#define CMD_ALOAD_3 45
- 1,
-#define CMD_IALOAD 46
- 1,
-#define CMD_LALOAD 47
- 1,
-#define CMD_FALOAD 48
- 1,
-#define CMD_DALOAD 49
- 1,
-#define CMD_AALOAD 50
- 1,
-#define CMD_BALOAD 51
- 1,
-#define CMD_CALOAD 52
- 1,
-#define CMD_SALOAD 53
- 1,
-#define CMD_ISTORE 54
- 2,
-#define CMD_LSTORE 55
- 2,
-#define CMD_FSTORE 56
- 2,
-#define CMD_DSTORE 57
- 2,
-#define CMD_ASTORE 58
- 2,
-#define CMD_ISTORE_0 59
- 1,
-#define CMD_ISTORE_1 60
- 1,
-#define CMD_ISTORE_2 61
- 1,
-#define CMD_ISTORE_3 62
- 1,
-#define CMD_LSTORE_0 63
- 1,
-#define CMD_LSTORE_1 64
- 1,
-#define CMD_LSTORE_2 65
- 1,
-#define CMD_LSTORE_3 66
- 1,
-#define CMD_FSTORE_0 67
- 1,
-#define CMD_FSTORE_1 68
- 1,
-#define CMD_FSTORE_2 69
- 1,
-#define CMD_FSTORE_3 70
- 1,
-#define CMD_DSTORE_0 71
- 1,
-#define CMD_DSTORE_1 72
- 1,
-#define CMD_DSTORE_2 73
- 1,
-#define CMD_DSTORE_3 74
- 1,
-#define CMD_ASTORE_0 75
- 1,
-#define CMD_ASTORE_1 76
- 1,
-#define CMD_ASTORE_2 77
- 1,
-#define CMD_ASTORE_3 78
- 1,
-#define CMD_IASTORE 79
- 1,
-#define CMD_LASTORE 80
- 1,
-#define CMD_FASTORE 81
- 1,
-#define CMD_DASTORE 82
- 1,
-#define CMD_AASTORE 83
- 1,
-#define CMD_BASTORE 84
- 1,
-#define CMD_CASTORE 85
- 1,
-#define CMD_SASTORE 86
- 1,
-#define CMD_POP 87
- 1,
-#define CMD_POP2 88
- 1,
-#define CMD_DUP 89
- 1,
-#define CMD_DUP_X1 90
- 1,
-#define CMD_DUP_X2 91
- 1,
-#define CMD_DUP2 92
- 1,
-#define CMD_DUP2_X1 93
- 1,
-#define CMD_DUP2_X2 94
- 1,
-#define CMD_SWAP 95
- 1,
-#define CMD_IADD 96
- 1,
-#define CMD_LADD 97
- 1,
-#define CMD_FADD 98
- 1,
-#define CMD_DADD 99
- 1,
-#define CMD_ISUB 100
- 1,
-#define CMD_LSUB 101
- 1,
-#define CMD_FSUB 102
- 1,
-#define CMD_DSUB 103
- 1,
-#define CMD_IMUL 104
- 1,
-#define CMD_LMUL 105
- 1,
-#define CMD_FMUL 106
- 1,
-#define CMD_DMUL 107
- 1,
-#define CMD_IDIV 108
- 1,
-#define CMD_LDIV 109
- 1,
-#define CMD_FDIV 110
- 1,
-#define CMD_DDIV 111
- 1,
-#define CMD_IREM 112
- 1,
-#define CMD_LREM 113
- 1,
-#define CMD_FREM 114
- 1,
-#define CMD_DREM 115
- 1,
-#define CMD_INEG 116
- 1,
-#define CMD_LNEG 117
- 1,
-#define CMD_FNEG 118
- 1,
-#define CMD_DNEG 119
- 1,
-#define CMD_ISHL 120
- 1,
-#define CMD_LSHL 121
- 1,
-#define CMD_ISHR 122
- 1,
-#define CMD_LSHR 123
- 1,
-#define CMD_IUSHR 124
- 1,
-#define CMD_LUSHR 125
- 1,
-#define CMD_IAND 126
- 1,
-#define CMD_LAND 127
- 1,
-#define CMD_IOR 128
- 1,
-#define CMD_LOR 129
- 1,
-#define CMD_IXOR 130
- 1,
-#define CMD_LXOR 131
- 1,
-#define CMD_IINC 132
- 3,
-#define CMD_I2L 133
- 1,
-#define CMD_I2F 134
- 1,
-#define CMD_I2D 135
- 1,
-#define CMD_L2I 136
- 1,
-#define CMD_L2F 137
- 1,
-#define CMD_L2D 138
- 1,
-#define CMD_F2I 139
- 1,
-#define CMD_F2L 140
- 1,
-#define CMD_F2D 141
- 1,
-#define CMD_D2I 142
- 1,
-#define CMD_D2L 143
- 1,
-#define CMD_D2F 144
- 1,
-#define CMD_INT2BYTE 145
- 1,
-#define CMD_INT2CHAR 146
- 1,
-#define CMD_INT2SHORT 147
- 1,
-#define CMD_LCMP 148
- 1,
-#define CMD_FCMPL 149
- 1,
-#define CMD_FCMPG 150
- 1,
-#define CMD_DCMPL 151
- 1,
-#define CMD_DCMPG 152
- 1,
-#define CMD_IFEQ 153
- 3,
-#define CMD_IFNE 154
- 3,
-#define CMD_IFLT 155
- 3,
-#define CMD_IFGE 156
- 3,
-#define CMD_IFGT 157
- 3,
-#define CMD_IFLE 158
- 3,
-#define CMD_IF_ICMPEQ 159
- 3,
-#define CMD_IF_ICMPNE 160
- 3,
-#define CMD_IF_ICMPLT 161
- 3,
-#define CMD_IF_ICMPGE 162
- 3,
-#define CMD_IF_ICMPGT 163
- 3,
-#define CMD_IF_ICMPLE 164
- 3,
-#define CMD_IF_ACMPEQ 165
- 3,
-#define CMD_IF_ACMPNE 166
- 3,
-#define CMD_GOTO 167
- 3,
-#define CMD_JSR 168
- 3,
-#define CMD_RET 169
- 2,
-#define CMD_TABLESWITCH 170
- 0, /* length must be computed */
-#define CMD_LOOKUPSWITCH 171
- 0, /* length must be computed */
-#define CMD_IRETURN 172
- 1,
-#define CMD_LRETURN 173
- 1,
-#define CMD_FRETURN 174
- 1,
-#define CMD_DRETURN 175
- 1,
-#define CMD_ARETURN 176
- 1,
-#define CMD_RETURN 177
- 1,
-#define CMD_GETSTATIC 178
- 3,
-#define CMD_PUTSTATIC 179
- 3,
-#define CMD_GETFIELD 180
- 3,
-#define CMD_PUTFIELD 181
- 3,
-#define CMD_INVOKEVIRTUAL 182
- 3,
-#define CMD_INVOKESPECIAL 183
- 3,
-#define CMD_INVOKESTATIC 184
- 3,
-#define CMD_INVOKEINTERFACE 185
- 5,
- 1, /* unused */
-#define CMD_NEW 187
- 3,
-#define CMD_NEWARRAY 188
- 2,
-#define CMD_ANEWARRAY 189
- 3,
-#define CMD_ARRAYLENGTH 190
- 1,
-#define CMD_ATHROW 191
- 1,
-#define CMD_CHECKCAST 192
- 3,
-#define CMD_INSTANCEOF 193
- 3,
-#define CMD_MONITORENTER 194
- 1,
-#define CMD_MONITOREXIT 195
- 1,
-#define CMD_WIDE 196
- 0, /* length must be computed */
-#define CMD_MULTIANEWARRAY 197
- 4,
-#define CMD_IFNULL 198
- 3,
-#define CMD_IFNONNULL 199
- 3,
-#define CMD_GOTO_W 200
- 5,
-#define CMD_JSR_W 201
- 5,
-#define CMD_BREAKPOINT 202
- 1,
-
- 1,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
- };
-
-#define CMD_TRACEBUILT 253 /* internal opcode */
-#define CMD_IFEQL 254 /* internal opcode */
-#define CMD_IF_UCMPGE 255 /* internal opcode */
-
-#define CMD_LOADCONST_I (CMD_IF_UCMPGE+TAG_LOADCONST_I) /* internal opcodes */
-#define CMD_LOADCONST_L (CMD_IF_UCMPGE+TAG_LOADCONST_L)
-#define CMD_LOADCONST_F (CMD_IF_UCMPGE+TAG_LOADCONST_F)
-#define CMD_LOADCONST_D (CMD_IF_UCMPGE+TAG_LOADCONST_D)
-#define CMD_LOADCONST_A (CMD_IF_UCMPGE+TAG_LOADCONST_A)
-#define CMD_MOVE (CMD_IF_UCMPGE+TAG_MOVE)
-
-#define CMD_TABLEJUMP (CMD_IF_UCMPGE+TAG_TABLEJUMP)
-#define CMD_BUILTIN (CMD_IF_UCMPGE+TAG_METHOD)
-#define CMD_DROP (CMD_IF_UCMPGE+TAG_DROP)
-#define CMD_ACTIVATE (CMD_IF_UCMPGE+TAG_ACTIVATE)
-
-
-/******************* description of JavaVM instructions ***********************/
-
-typedef struct {
- u1 opcode;
- u1 type_s1;
- u1 type_s2;
- u1 type_d;
- functionptr builtin;
- bool supported;
- bool isfloat;
-} stdopdescriptor;
-
-stdopdescriptor *stdopdescriptors[256];
-
-stdopdescriptor stdopdescriptortable[] = {
- { CMD_IADD, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_ISUB, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_IMUL, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_ISHL, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_ISHR, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_IUSHR, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_IAND, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_IOR, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_IXOR, TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
- { CMD_INEG, TYPE_INT, TYPE_VOID,TYPE_INT, NULL, true, false },
-
- { CMD_LADD, TYPE_LONG, TYPE_LONG, TYPE_LONG,
- (functionptr) builtin_ladd , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
- { CMD_LSUB, TYPE_LONG, TYPE_LONG, TYPE_LONG,
- (functionptr) builtin_lsub , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
- { CMD_LMUL, TYPE_LONG, TYPE_LONG, TYPE_LONG,
- (functionptr) builtin_lmul , SUPPORT_LONG && SUPPORT_LONG_MULDIV, false },
- { CMD_LSHL, TYPE_LONG, TYPE_INT, TYPE_LONG,
- (functionptr) builtin_lshl , SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
- { CMD_LSHR, TYPE_LONG, TYPE_INT, TYPE_LONG,
- (functionptr) builtin_lshr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
- { CMD_LUSHR, TYPE_LONG, TYPE_INT, TYPE_LONG,
- (functionptr) builtin_lushr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
- { CMD_LAND, TYPE_LONG, TYPE_LONG, TYPE_LONG,
- (functionptr) builtin_land, SUPPORT_LONG && SUPPORT_LONG_LOG, false },
- { CMD_LOR, TYPE_LONG, TYPE_LONG, TYPE_LONG,
- (functionptr) builtin_lor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
- { CMD_LXOR, TYPE_LONG, TYPE_LONG, TYPE_LONG,
- (functionptr) builtin_lxor, SUPPORT_LONG && SUPPORT_LONG_LOG, false },
- { CMD_LNEG, TYPE_LONG, TYPE_VOID, TYPE_LONG,
- (functionptr) builtin_lneg, SUPPORT_LONG && SUPPORT_LONG_ADD, false },
- { CMD_LCMP, TYPE_LONG, TYPE_LONG, TYPE_INT,
- (functionptr) builtin_lcmp, SUPPORT_LONG && SUPPORT_LONG_CMP, false },
-
- { CMD_FADD, TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT,
- (functionptr) builtin_fadd, SUPPORT_FLOAT, true },
- { CMD_FSUB, TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT,
- (functionptr) builtin_fsub, SUPPORT_FLOAT, true },
- { CMD_FMUL, TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT,
- (functionptr) builtin_fmul, SUPPORT_FLOAT, true },
- { CMD_FDIV, TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT,
- (functionptr) builtin_fdiv, SUPPORT_FLOAT, true },
- { CMD_FREM, TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT,
- (functionptr) builtin_frem, SUPPORT_FLOAT, true },
- { CMD_FNEG, TYPE_FLOAT, TYPE_VOID, TYPE_FLOAT,
- (functionptr) builtin_fneg, SUPPORT_FLOAT, true },
- { CMD_FCMPL, TYPE_FLOAT, TYPE_FLOAT, TYPE_INT,
- (functionptr) builtin_fcmpl, SUPPORT_FLOAT, true },
- { CMD_FCMPG, TYPE_FLOAT, TYPE_FLOAT, TYPE_INT,
- (functionptr) builtin_fcmpg, SUPPORT_FLOAT, true },
-
- { CMD_DADD, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE,
- (functionptr) builtin_dadd, SUPPORT_DOUBLE, true },
- { CMD_DSUB, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE,
- (functionptr) builtin_dsub, SUPPORT_DOUBLE, true },
- { CMD_DMUL, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE,
- (functionptr) builtin_dmul, SUPPORT_DOUBLE, true },
- { CMD_DDIV, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE,
- (functionptr) builtin_ddiv, SUPPORT_DOUBLE, true },
- { CMD_DREM, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE,
- (functionptr) builtin_drem, SUPPORT_DOUBLE, true },
- { CMD_DNEG, TYPE_DOUBLE, TYPE_VOID, TYPE_DOUBLE,
- (functionptr) builtin_dneg, SUPPORT_DOUBLE, true },
- { CMD_DCMPL, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_INT,
- (functionptr) builtin_dcmpl, SUPPORT_DOUBLE, true },
- { CMD_DCMPG, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_INT,
- (functionptr) builtin_dcmpg, SUPPORT_DOUBLE, true },
-
- { CMD_INT2BYTE, TYPE_INT, TYPE_VOID, TYPE_INT, NULL, true,false },
- { CMD_INT2CHAR, TYPE_INT, TYPE_VOID, TYPE_INT, NULL, true,false },
- { CMD_INT2SHORT, TYPE_INT, TYPE_VOID, TYPE_INT, NULL, true,false },
- { CMD_I2L, TYPE_INT, TYPE_VOID, TYPE_LONG,
- (functionptr) builtin_i2l, SUPPORT_LONG && SUPPORT_LONG_ICVT, false },
- { CMD_I2F, TYPE_INT, TYPE_VOID, TYPE_FLOAT,
- (functionptr) builtin_i2f, SUPPORT_FLOAT, true },
- { CMD_I2D, TYPE_INT, TYPE_VOID, TYPE_DOUBLE,
- (functionptr) builtin_i2d, SUPPORT_DOUBLE, true },
- { CMD_L2I, TYPE_LONG, TYPE_VOID, TYPE_INT,
- (functionptr) builtin_l2i, SUPPORT_LONG && SUPPORT_LONG_ICVT, false },
- { CMD_L2F, TYPE_LONG, TYPE_VOID, TYPE_FLOAT,
- (functionptr) builtin_l2f, SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_LONG_FCVT, true },
- { CMD_L2D, TYPE_LONG, TYPE_VOID, TYPE_DOUBLE,
- (functionptr) builtin_l2d, SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_LONG_FCVT, true },
- { CMD_F2I, TYPE_FLOAT, TYPE_VOID, TYPE_INT,
- (functionptr) builtin_f2i, SUPPORT_FLOAT, true },
- { CMD_F2L, TYPE_FLOAT, TYPE_VOID, TYPE_LONG,
- (functionptr) builtin_f2l, SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_LONG_FCVT, true },
- { CMD_F2D, TYPE_FLOAT, TYPE_VOID, TYPE_DOUBLE,
- (functionptr) builtin_f2d, SUPPORT_FLOAT && SUPPORT_DOUBLE, true },
- { CMD_D2I, TYPE_DOUBLE, TYPE_VOID, TYPE_INT,
- (functionptr) builtin_d2i, SUPPORT_DOUBLE, true },
- { CMD_D2L, TYPE_DOUBLE, TYPE_VOID, TYPE_LONG,
- (functionptr) builtin_d2l, SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_LONG_FCVT, true },
- { CMD_D2F, TYPE_DOUBLE, TYPE_VOID, TYPE_FLOAT,
- (functionptr) builtin_d2f, SUPPORT_DOUBLE && SUPPORT_FLOAT, true },
-
-};
-
-
-
-/***************************** 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 regdescint[]; /* description of integer registers */
-extern int regdescfloat[]; /* description of floating point registers */
-
-extern int reg_parammode;
-
+++ /dev/null
-/**************************** comp/local.c *************************************
-
- Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
- See file COPYRIGHT for information on usage and disclaimer of warranties
-
- behandeln der lokalen Java-Variablen
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1996/11/14
-
-*******************************************************************************/
-
- /* es werden f"ur die lokalen Java-Variablen 5 Tabellen angelegt,
- f"ur jeden m"oglichen Typ eine, weil mehrere Java-Variablen
- verschiendenen Typs die selben Slots belegen k"onnen */
-
-varid *locals[5];
-
-
-/*********************** Funktion: local_get **********************************
-
- erzeugt eine neue Pseudo-Variable f"ur einen JavaVM-Slot und einen
- gew"unschten Typ, oder eine bereits vorhandene Variable.
-
-******************************************************************************/
-
-static varid local_get (int slot, int type)
-{
- varid v;
- int secondslot;
-
- secondslot = ((type==TYPE_DOUBLE) || (type==TYPE_LONG)) ? 1 : 0;
-
- if (slot+secondslot>=maxlocals)
- panic ("Local-variable access out of bounds");
- v = locals[type][slot];
-
- if (v==NULL) {
- v = var_createwithspecialnumber (type, slot);
- v -> globalscope = true;
- locals[type][slot] = v;
- }
-
- return v;
-}
-
-
-
-
-/************************* Funktion: local_init *******************************
-
- legt die 5 Tabellen an, und erzeugt auch gleich die Belegungen
- f"ur die Methodenparameter.
-
-******************************************************************************/
-
-static void local_init()
-{
- int t, i, slot;
-
- if (TYPE_INT != 0 || TYPE_ADDRESS != 4)
- panic ("JAVA-Basictypes have been changed");
-
- for (t=TYPE_INT; t<=TYPE_ADDRESS; t++) {
- locals[t] = DMNEW (varid, maxlocals);
- for (i=0; i<maxlocals; i++) locals[t][i] = NULL;
- }
-
-
- slot =0;
- for (i=0; i<mparamnum; i++) {
- t = mparamtypes[i];
- mparamvars[i] = local_get (slot, t);
- slot += ((t==TYPE_DOUBLE || t==TYPE_LONG) ? 2 : 1);
- }
-}
-
-
-/************************ Funktion: local_regalloc ****************************
-
- f"uhrt die Registerbelegung f"ur die lokalen Java-Variablen durch
-
-******************************************************************************/
-
-
-static void local_regalloc ()
-{
- int s, t;
- varid v;
-
- for (s=0; s<maxlocals; s++)
- for (t=TYPE_INT; t<=TYPE_ADDRESS; t++) {
- v = locals[t][s];
- if (v) {
- if (! isleafmethod)
- var_makesaved (v);
- if (v->reg == NULL)
- v->reg = reg_allocate (v->type, v->saved, true);
- }
- }
-}
-
+++ /dev/null
-/***************************** 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: 1997/04/13
-
-
- 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).
-
-*******************************************************************************/
-
-#include <sys/mman.h>
-#include <errno.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 int mcodesize; /* complete size of code area (bytes) */
-static int mcodelen; /* used 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 list mcodereferences; /* list of branch instruction adresses */
- /* and of jumptable target addresses */
-
-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 void mcode_adds4(s4 code); /* adds an instruction to code area */
-
-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 */
-
-/* s4 dseg_addaddress(void* value); */
-static s4 dseg_addtarget(basicblock *target);
-static void mcode_addreference(basicblock *target);
-static void dseg_display();
-
-/* 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;
- }
-
- mcodelen = 0;
- dseglen = 0;
-
- list_init (&mcodereferences, OFFSET(mcodereference, linkage) );
-}
-
-
-/* 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_adds4_increase doubles code area and adds instruction */
-
-static void mcode_adds4_increase(s4 code)
-{
- mcodebase = MREALLOC(mcodebase, u1, mcodesize, mcodesize * 2);
- mcodesize *= 2;
- *((s4 *) (mcodebase + mcodelen - 4)) = code;
-}
-
-
-/* mcode_adds4 checks code area size and adds instruction */
-
-static void mcode_adds4(s4 code)
-{
- s4 *codeptr;
-
- codeptr = (s4 *) (mcodebase + mcodelen);
- mcodelen += 4;
- if (mcodelen <= mcodesize)
- *codeptr = code;
- else
- mcode_adds4_increase(code);
-}
-
-
-/* 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;
-}
-
-
-#if POINTERSIZE==8
-#define dseg_addaddress(value) dseg_adds8((s8)(value))
-#else
-#define dseg_addaddress(value) dseg_adds4((s4)(value))
-#endif
-
-
-static s4 dseg_addtarget(basicblock *target)
-{
- mcodereference *cr = DNEW(mcodereference);
-
- dseglen = ALIGN (dseglen + sizeof(void*), sizeof(void*));
- if (dseglen > dsegsize)
- dseg_increase();
-
- cr -> incode = false;
- cr -> msourcepos = -dseglen;
- cr -> target = target;
-
- list_addlast (&mcodereferences, cr);
-
- return -dseglen;
-}
-
-
-static void mcode_addreference(basicblock *target)
-{
- mcodereference *cr = DNEW(mcodereference);
-
- cr -> incode = true;
- cr -> msourcepos = mcodelen;
- cr -> target = target;
-
- list_addlast (&mcodereferences, cr);
-}
-
-
-
-static void mcode_blockstart (basicblock *b)
-{
- b -> mpc = mcodelen;
-}
-
-
-
-static void gen_resolvebranch(void* mcodepiece, s4 sourcepos, s4 targetpos);
-
-static void mcode_finish()
-{
- mcodereference *cr;
-
- 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 = (u1*) (method->mcode + dseglen);
-
- cr = list_first (&mcodereferences);
- while (cr != NULL) {
-
- if (cr->incode) { /* branch resolving */
- gen_resolvebranch ( ((u1*)(method->entrypoint)) + cr->msourcepos,
- cr->msourcepos,
- cr->target->mpc);
- }
- else { /* jump table resolving */
- void **p;
- p = (void**) ( ((u1*)(method->entrypoint)) + cr->msourcepos);
-
- *p = ((u1*)(method->entrypoint)) + cr->target->mpc;
- }
-
- cr = list_next (&mcodereferences, cr);
- }
-
-#ifdef CACHE_FLUSH_BLOCK
- synchronize_caches(method->mcode, (mcodelen>>2));
-#endif
-
-}
-
-
-static void dseg_display()
-{
- int i;
- printf (" --- dump of datasegment\n");
- for (i = dseglen - 4; i >= 0 ; i -= 4) {
- printf ("%6x: %8x\n", i, (int)(*((s4*)(dsegtop - i))));
- }
-}
+++ /dev/null
-/****************************** comp/parse.c ***********************************
-
- Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
- See file COPYRIGHT for information on usage and disclaimer of warranties
-
- Enth"alt den Parser f"ur die Bytecode-Darstellung der Methoden
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
- Andreas Krall EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1997/10/17
-
-*******************************************************************************/
-
-
-/* Kurzschreibweise f"ur oft verwendete Funktionen */
-
-#define LOADCONST_I pcmd_loadconst_i
-#define LOADCONST_L pcmd_loadconst_l
-#define LOADCONST_F pcmd_loadconst_f
-#define LOADCONST_D pcmd_loadconst_d
-#define LOADCONST_A pcmd_loadconst_a
-#define MOVE pcmd_move
-#define IINC pcmd_iinc
-#define OP pcmd_op
-#define MEM pcmd_mem
-#define BRA pcmd_bra
-#define TABLEJUMP pcmd_tablejump
-#define METHOD pcmd_method
-
-#define BUILTIN1 pcmd_builtin1
-#define BUILTIN2 pcmd_builtin2
-#define BUILTIN3 pcmd_builtin3
-
-#define DROP pcmd_drop
-#define ACTIVATE pcmd_activate
-#define BRA_N_DROP pcmd_bra_n_drop
-#define MOVE_N_DROP pcmd_move_n_drop
-
-#define OP1(opcode,s,d) OP(opcode,s,NOVAR,NOVAR,d)
-#define OP2(opcode,s1,s2,d) OP(opcode,s1,s2,NOVAR,d)
-#define OP3(opcode,s1,s2,s3,d) OP(opcode,s1,s2,s3,d)
-
-
-#define EXCREATOR(exclass) block_createexcreator (exclass, p)
-#define EXFORWARDER(exvar) block_createexforwarder (exvar, p)
-
-
-
-
-/****************** Funktion: addreturnlog ************************************
-
- f"ugt in den Code einen Aufruf der Methoden-R"uckkehr-Protokollierung
- ein.
-
-******************************************************************************/
-
-static void addreturnhandling()
-{
- if (checksync && (method->flags & ACC_SYNCHRONIZED) ) {
- stack_makesaved ();
-#ifdef USE_THREADS
- if (method->flags & ACC_STATIC) {
- varid v = var_create (TYPE_ADDRESS);
- LOADCONST_A (class, v);
- BUILTIN1 ( (functionptr) builtin_monitorexit, v, NOVAR);
- }
- else {
- BUILTIN1 ( (functionptr) builtin_monitorexit,
- local_get (0, TYPE_ADDRESS) , NOVAR);
- }
-#endif
- }
-}
-
-
-/*************** Funktion: addreturnexceptionlog *****************************
-
- f"ugt in den Code einen Aufruf der Methoden-R"uckkehr-Protokollierung
- mit Exception ein.
-
-******************************************************************************/
-
-static void addreturnexceptionhandling()
-{
-
- if (runverbose) {
- varid v;
-
- stack_makesaved ();
- v = var_create (TYPE_ADDRESS);
- LOADCONST_A (method, v);
- BUILTIN1 ( (functionptr) builtin_displaymethodexception, v, NOVAR);
- }
-
- if (checksync && (method->flags & ACC_SYNCHRONIZED) ) {
- stack_makesaved ();
-#ifdef USE_THREADS
- if (method->flags & ACC_STATIC) {
- varid v = var_create (TYPE_ADDRESS);
- LOADCONST_A (class, v);
- BUILTIN1 ( (functionptr) builtin_monitorexit, v, NOVAR);
- }
- else {
- BUILTIN1 ( (functionptr) builtin_monitorexit,
- local_get (0, TYPE_ADDRESS) , NOVAR);
- }
-#endif
- }
-}
-
-
-
-/******************************************************************************
-*************** Funktion 'parse' zum Durcharbeiten des Bytecodes **************
-******************************************************************************/
-
-static void parse (basicblock *b)
-{
- varid v,v1,v2,v3,ve;
- u4 poolindex;
- s4 type;
- u4 p,i;
- basicblock *target=NULL;
- bool iswide=false;
-
- stack_restore (b->stack);
- subroutine_set (b->subroutine);
-
-
- switch (b->type) {
-
- /* Code fuer einen Exception-Forwarder generieren */
-
-
- case BLOCKTYPE_EXFORWARDER:
- if (!compileall) {
- ACTIVATE (b->exvar);
- stack_repush (b->exvar);
- stack_makesaved ();
-
- for (i=0; i<exceptiontablelength; i++) {
- target = block_find (extable[i].handlerpc);
- if ( extable[i].startpc <= b->throwpos
- && extable[i].endpc > b->throwpos) {
-
- if (!extable[i].catchtype) goto exceptionfits;
-
- stack_makesaved();
- v1 = var_create (TYPE_ADDRESS);
- v2 = var_create (TYPE_ADDRESS);
- v = var_create (TYPE_INT);
- MOVE (TYPE_ADDRESS, b->exvar, v1);
- LOADCONST_A (extable[i].catchtype, v2);
- BUILTIN2 ((functionptr) builtin_instanceof, v1,v2, v);
-
- block_reach (target);
- BRA_N_DROP (CMD_IFNE, v,NOVAR, NOVAR, target);
- }
- }
- target = NULL;
- }
- goto exceptionfits;
-
-
- /* Code fuer einen Exception-Creator generieren */
- case BLOCKTYPE_EXCREATOR:
- if (!compileall) {
- java_objectheader *o = b->exproto;
- LOADCONST_A (o, stack_push(TYPE_ADDRESS) );
-
- for (i=0; i<exceptiontablelength; i++) {
- target = block_find (extable[i].handlerpc);
- if ( extable[i].startpc <= b->throwpos
- && extable[i].endpc > b->throwpos) {
-
- if (!extable[i].catchtype) goto exceptionfits;
- if (builtin_instanceof (o, extable[i].catchtype) ) goto exceptionfits;
- }
- }
- target = NULL;
- }
-
- /*** Der Sprung zum Exception-Handler (oder Methodenbeendigung) ***/
-
- exceptionfits:
- if (!compileall) {
- if (target) {
- block_reach (target);
- BRA (CMD_GOTO, NOVAR,NOVAR,NOVAR, target);
- goto cleanup;
- }
-
-#ifdef STATISTICS
- count_pcmd_returnx++;
-#endif
-
- switch (mreturntype) {
- case TYPE_INT:
- addreturnexceptionhandling();
-
- v1 = var_create (TYPE_INT);
- LOADCONST_I (0, v1);
- BRA_N_DROP (CMD_IRETURN, v1,stack_pop(TYPE_ADDRESS), NOVAR, NULL);
- break;
- case TYPE_LONG:
- addreturnexceptionhandling();
-
- v1 = var_create (TYPE_LONG);
- LOADCONST_I (0, v1);
- BRA_N_DROP (CMD_LRETURN, v1,stack_pop(TYPE_ADDRESS), NOVAR, NULL);
- break;
- case TYPE_FLOAT:
- addreturnexceptionhandling();
-
- v1 = var_create (TYPE_FLOAT);
- LOADCONST_F (0.0, v1);
- BRA_N_DROP (CMD_FRETURN, v1,stack_pop(TYPE_ADDRESS), NOVAR, NULL);
- break;
- case TYPE_DOUBLE:
- addreturnexceptionhandling();
-
- v1 = var_create (TYPE_DOUBLE);
- LOADCONST_D (0.0, v1);
- BRA_N_DROP (CMD_DRETURN, v1,stack_pop(TYPE_ADDRESS), NOVAR, NULL);
- break;
- case TYPE_ADDRESS:
- addreturnexceptionhandling();
-
- v1 = var_create (TYPE_ADDRESS);
- LOADCONST_A (NULL, v1);
- BRA_N_DROP (CMD_ARETURN, v1,stack_pop(TYPE_ADDRESS), NOVAR, NULL);
- break;
- case TYPE_VOID:
- addreturnexceptionhandling();
-
- BRA (CMD_RETURN, NOVAR,stack_pop(TYPE_ADDRESS), NOVAR, NULL);
- break;
- }
- }
- goto cleanup;
- }
-
-
- /* Code fuer einen (normalen) JavaVM - Block generieren */
-
- p = b->jpc;
-
-
-
- if ( p==0) {
- /* Method call protocolling */
-
- if (runverbose) {
- stack_makesaved();
- pcmd_trace (method);
- }
-
- /* Synchronization */
- if (checksync && (method->flags & ACC_SYNCHRONIZED)) {
- stack_makesaved();
-#ifdef USE_THREADS
- if (method->flags & ACC_STATIC) {
- varid v = var_create (TYPE_ADDRESS);
- LOADCONST_A (class, v);
- BUILTIN1 ( (functionptr) builtin_monitorenter, v, NOVAR);
- }
- else {
- BUILTIN1 ( (functionptr) builtin_monitorenter,
- local_get (0, TYPE_ADDRESS), NOVAR );
- }
-#endif
- }
- }
-
- for (;;) {
- u1 opcode;
- u4 nextp;
-
- opcode = code_get_u1 (p);
- nextp = p + jcommandsize[opcode];
-
-
- count_javainstr++;
-
-
- if (showstack) {
- printf ("PC: %3d OPCODE: %3d Stack: ",(int) p, (int) opcode);
- stack_display (stack_get());
- printf ("\n");
- }
-
-
- switch (opcode) {
-
-
- /*** Pushing constants onto the stack ***/
-
- case CMD_BIPUSH:
- LOADCONST_I (code_get_s1 (p+1), stack_push (TYPE_INT) );
- break;
-
- case CMD_SIPUSH:
- LOADCONST_I (code_get_s2 (p+1), stack_push (TYPE_INT) );
- break;
-
- case CMD_LDC1: poolindex = code_get_u1 (p+1);
- goto pushconstantitem;
- case CMD_LDC2:
- case CMD_LDC2W: poolindex = code_get_u2 (p+1);
- pushconstantitem:
- switch (class_constanttype(class, poolindex)) {
- case CONSTANT_Integer:
- { constant_integer *c;
- c = class_getconstant (class, poolindex, CONSTANT_Integer);
- LOADCONST_I (c->value, stack_push(TYPE_INT) );
- }
- break;
- case CONSTANT_Long:
- { constant_long *c;
- c = class_getconstant (class, poolindex, CONSTANT_Long);
- LOADCONST_L (c->value, stack_push(TYPE_LONG) );
- }
- break;
- case CONSTANT_Float:
- { constant_float *c;
- c = class_getconstant (class, poolindex, CONSTANT_Float);
- LOADCONST_F (c->value, stack_push(TYPE_FLOAT) );
- }
- break;
- case CONSTANT_Double:
- { constant_double *c;
- c = class_getconstant (class, poolindex, CONSTANT_Double);
- LOADCONST_D (c->value, stack_push(TYPE_DOUBLE) );
- }
- break;
-
- case CONSTANT_String:
- { utf *s;
-
- s = class_getconstant (class, poolindex, CONSTANT_String);
-
- LOADCONST_A ( literalstring_new (s),
- stack_push(TYPE_ADDRESS) );
- }
- break;
-
- default: panic ("Invalid constant type to push");
- }
- break;
-
-
- case CMD_ACONST_NULL:
- LOADCONST_A (0, stack_push (TYPE_ADDRESS) );
- break;
-
- case CMD_ICONST_M1:
- case CMD_ICONST_0:
- case CMD_ICONST_1:
- case CMD_ICONST_2:
- case CMD_ICONST_3:
- case CMD_ICONST_4:
- case CMD_ICONST_5:
- LOADCONST_I (opcode - CMD_ICONST_0, stack_push (TYPE_INT) );
- break;
-
- case CMD_LCONST_0:
- case CMD_LCONST_1:
-#if U8_AVAILABLE
- LOADCONST_L (opcode - CMD_LCONST_0, stack_push (TYPE_LONG) );
-#else
- { u8 v;
- v.low = opcode - CMD_LCONST_0;
- v.high = 0;
- LOADCONST_L (v, stack_push(TYPE_LONG) );
- }
-#endif
- break;
-
- case CMD_FCONST_0:
- case CMD_FCONST_1:
- case CMD_FCONST_2:
- LOADCONST_F (opcode - CMD_FCONST_0, stack_push (TYPE_FLOAT) );
- break;
-
- case CMD_DCONST_0:
- case CMD_DCONST_1:
- LOADCONST_D (opcode - CMD_DCONST_0, stack_push (TYPE_DOUBLE) );
- break;
-
-
- /*** Loading variables onto the Stack ***/
-
- case CMD_ILOAD:
- if (!iswide) {
- MOVE ( TYPE_INT,
- local_get (code_get_u1 (p+1), TYPE_INT),
- stack_push (TYPE_INT) );
- }
- else {
- MOVE ( TYPE_INT,
- local_get (code_get_u2 (p+1), TYPE_INT),
- stack_push (TYPE_INT) );
- nextp = p+3;
- iswide = false;
- }
- break;
-
- case CMD_ILOAD_0:
- case CMD_ILOAD_1:
- case CMD_ILOAD_2:
- case CMD_ILOAD_3:
- MOVE ( TYPE_INT,
- local_get (opcode - CMD_ILOAD_0, TYPE_INT),
- stack_push (TYPE_INT) );
- break;
-
- case CMD_LLOAD:
- if (!iswide) {
- MOVE ( TYPE_LONG,
- local_get (code_get_u1 (p+1), TYPE_LONG),
- stack_push (TYPE_LONG) );
- }
- else {
- MOVE ( TYPE_LONG,
- local_get (code_get_u2 (p+1), TYPE_LONG),
- stack_push (TYPE_LONG) );
- nextp = p+3;
- iswide = false;
- }
- break;
-
- case CMD_LLOAD_0:
- case CMD_LLOAD_1:
- case CMD_LLOAD_2:
- case CMD_LLOAD_3:
- MOVE ( TYPE_LONG,
- local_get (opcode - CMD_LLOAD_0, TYPE_LONG),
- stack_push (TYPE_LONG) );
- break;
-
- case CMD_FLOAD:
- if (!iswide) {
- MOVE ( TYPE_FLOAT,
- local_get (code_get_u1 (p+1), TYPE_FLOAT),
- stack_push (TYPE_FLOAT) );
- }
- else {
- MOVE ( TYPE_FLOAT,
- local_get (code_get_u2 (p+1), TYPE_FLOAT),
- stack_push (TYPE_FLOAT) );
- nextp = p+3;
- iswide = false;
- }
- break;
-
- case CMD_FLOAD_0:
- case CMD_FLOAD_1:
- case CMD_FLOAD_2:
- case CMD_FLOAD_3:
- MOVE ( TYPE_FLOAT,
- local_get (opcode - CMD_FLOAD_0, TYPE_FLOAT),
- stack_push (TYPE_FLOAT) );
- break;
-
- case CMD_DLOAD:
- if (!iswide) {
- MOVE ( TYPE_DOUBLE,
- local_get (code_get_u1 (p+1), TYPE_DOUBLE),
- stack_push (TYPE_DOUBLE) );
- }
- else {
- MOVE ( TYPE_DOUBLE,
- local_get (code_get_u2 (p+1), TYPE_DOUBLE),
- stack_push (TYPE_DOUBLE) );
- nextp = p+3;
- iswide = false;
- }
- break;
-
- case CMD_DLOAD_0:
- case CMD_DLOAD_1:
- case CMD_DLOAD_2:
- case CMD_DLOAD_3:
- MOVE ( TYPE_DOUBLE,
- local_get (opcode - CMD_DLOAD_0, TYPE_DOUBLE),
- stack_push (TYPE_DOUBLE) );
- break;
-
- case CMD_ALOAD:
- if (!iswide) {
- MOVE ( TYPE_ADDRESS,
- local_get (code_get_u1 (p+1), TYPE_ADDRESS),
- stack_push (TYPE_ADDRESS) );
- }
- else {
- MOVE ( TYPE_ADDRESS,
- local_get (code_get_u2 (p+1), TYPE_ADDRESS),
- stack_push (TYPE_ADDRESS) );
- nextp = p+3;
- iswide = false;
- }
- break;
-
- case CMD_ALOAD_0:
- case CMD_ALOAD_1:
- case CMD_ALOAD_2:
- case CMD_ALOAD_3:
- MOVE ( TYPE_ADDRESS,
- local_get (opcode - CMD_ALOAD_0, TYPE_ADDRESS),
- stack_push (TYPE_ADDRESS) );
- break;
-
-
- /*** Storing Stack Values into Local Variables ***/
-
- case CMD_ISTORE:
- v = stack_pop (TYPE_INT);
- if (!iswide) {
- MOVE_N_DROP (TYPE_INT, v,
- local_get (code_get_u1 (p+1), TYPE_INT) );
- }
- else {
- MOVE_N_DROP (TYPE_INT, v,
- local_get (code_get_u2 (p+1), TYPE_INT) );
- iswide=false;
- nextp = p+3;
- }
- break;
-
- case CMD_ISTORE_0:
- case CMD_ISTORE_1:
- case CMD_ISTORE_2:
- case CMD_ISTORE_3:
- v = stack_pop (TYPE_INT);
- MOVE_N_DROP (TYPE_INT,
- v, local_get (opcode - CMD_ISTORE_0, TYPE_INT) );
- break;
-
- case CMD_LSTORE:
- v = stack_pop (TYPE_LONG);
- if (!iswide) {
- MOVE_N_DROP (TYPE_LONG, v,
- local_get (code_get_u1 (p+1), TYPE_LONG) );
- }
- else {
- MOVE_N_DROP (TYPE_LONG, v,
- local_get (code_get_u2 (p+1), TYPE_LONG) );
- iswide=false;
- nextp = p+3;
- }
- break;
-
- case CMD_LSTORE_0:
- case CMD_LSTORE_1:
- case CMD_LSTORE_2:
- case CMD_LSTORE_3:
- v = stack_pop (TYPE_LONG);
- MOVE_N_DROP (TYPE_LONG,
- v, local_get (opcode - CMD_LSTORE_0, TYPE_LONG) );
- break;
-
- case CMD_FSTORE:
- v = stack_pop (TYPE_FLOAT);
- if (!iswide) {
- MOVE_N_DROP (TYPE_FLOAT, v,
- local_get (code_get_u1 (p+1), TYPE_FLOAT) );
- }
- else {
- MOVE_N_DROP (TYPE_FLOAT, v,
- local_get (code_get_u2 (p+1), TYPE_FLOAT) );
- iswide=false;
- nextp = p+3;
- }
- break;
-
- case CMD_FSTORE_0:
- case CMD_FSTORE_1:
- case CMD_FSTORE_2:
- case CMD_FSTORE_3:
- v = stack_pop (TYPE_FLOAT);
- MOVE_N_DROP (TYPE_FLOAT,
- v, local_get (opcode - CMD_FSTORE_0, TYPE_FLOAT) );
- break;
-
- case CMD_DSTORE:
- v = stack_pop (TYPE_DOUBLE);
- if (!iswide) {
- MOVE_N_DROP (TYPE_DOUBLE, v,
- local_get (code_get_u1 (p+1), TYPE_DOUBLE) );
- }
- else {
- MOVE_N_DROP (TYPE_DOUBLE, v,
- local_get (code_get_u2 (p+1), TYPE_DOUBLE) );
- iswide=false;
- nextp = p+3;
- }
- break;
-
- case CMD_DSTORE_0:
- case CMD_DSTORE_1:
- case CMD_DSTORE_2:
- case CMD_DSTORE_3:
- v = stack_pop (TYPE_DOUBLE);
- MOVE_N_DROP (TYPE_DOUBLE,
- v, local_get (opcode - CMD_DSTORE_0, TYPE_DOUBLE) );
- break;
-
- case CMD_ASTORE:
- v = stack_pop (TYPE_ADDRESS);
- if (!iswide) {
- MOVE_N_DROP (TYPE_ADDRESS, v,
- local_get (code_get_u1 (p+1), TYPE_ADDRESS) );
- }
- else {
- MOVE_N_DROP (TYPE_ADDRESS, v,
- local_get (code_get_u2 (p+1), TYPE_ADDRESS) );
- iswide=false;
- nextp = p+3;
- }
- break;
-
- case CMD_ASTORE_0:
- case CMD_ASTORE_1:
- case CMD_ASTORE_2:
- case CMD_ASTORE_3:
- v = stack_pop (TYPE_ADDRESS);
- MOVE_N_DROP (TYPE_ADDRESS,
- v, local_get (opcode - CMD_ASTORE_0, TYPE_ADDRESS) );
- break;
-
-
- case CMD_IINC:
- if (!iswide) {
- v1 = local_get (code_get_u1 (p+1), TYPE_INT);
- IINC (code_get_s1 (p+2), v1 );
- DROP (v1);
- }
- else {
- v1 = local_get (code_get_u2 (p+1), TYPE_INT);
- IINC (code_get_s2 (p+3), v1 );
- DROP (v1);
- iswide = false;
- nextp = p+5;
- }
- break;
-
-
- /*** Wider index for Loading, Storing and Incrementing ***/
-
- case CMD_WIDE:
- iswide=true;
- nextp = p+1;
- break;
-
-
- /******************** Managing Arrays **************************/
-
- case CMD_NEWARRAY:
- v1 = stack_pop (TYPE_INT);
- BRA (CMD_IFLT, v1,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NegativeArraySizeException) );
-
- stack_makesaved ();
- v = stack_push (TYPE_ADDRESS);
- switch ( code_get_s1 (p+1) ) {
- case 4: BUILTIN1 ((functionptr) builtin_newarray_boolean, v1, v);
- break;
- case 5: BUILTIN1 ((functionptr) builtin_newarray_char, v1, v);
- break;
- case 6: BUILTIN1 ((functionptr) builtin_newarray_float, v1, v);
- break;
- case 7: BUILTIN1 ((functionptr) builtin_newarray_double, v1, v);
- break;
- case 8: BUILTIN1 ((functionptr) builtin_newarray_byte, v1, v);
- break;
- case 9: BUILTIN1 ((functionptr) builtin_newarray_short, v1, v);
- break;
- case 10: BUILTIN1 ((functionptr) builtin_newarray_int, v1, v);
- break;
- case 11: BUILTIN1 ((functionptr) builtin_newarray_long, v1, v);
- break;
- default: panic ("Invalid array-type to create");
- }
-
- BRA (CMD_IFNULL, v,NOVAR, NOVAR, EXCREATOR(proto_java_lang_OutOfMemoryError) );
-
- break;
-
- case CMD_ANEWARRAY:
- poolindex = code_get_u2(p+1);
- if (class_constanttype (class, poolindex) == CONSTANT_Arraydescriptor) {
- /* anewarray mit Array-Typ! */
- constant_arraydescriptor *desc =
- class_getconstant (class, poolindex, CONSTANT_Arraydescriptor);
-
- v1 = stack_pop (TYPE_INT);
- BRA (CMD_IFLT, v1,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NegativeArraySizeException) );
-
- v2 = var_create (TYPE_ADDRESS);
- LOADCONST_A (desc, v2);
-
- stack_makesaved ();
- v = stack_push (TYPE_ADDRESS);
- BUILTIN2 ((functionptr) builtin_newarray_array, v1,v2, v);
- BRA (CMD_IFNULL, v,NOVAR, NOVAR, EXCREATOR(proto_java_lang_OutOfMemoryError) );
- }
- else {
- classinfo *c = class_getconstant (class, poolindex, CONSTANT_Class);
-
- v1 = stack_pop (TYPE_INT);
- BRA (CMD_IFLT, v1,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NegativeArraySizeException) );
-
- v2 = var_create (TYPE_ADDRESS);
- LOADCONST_A (c, v2);
-
- stack_makesaved ();
- v = stack_push (TYPE_ADDRESS);
- BUILTIN2 ((functionptr) builtin_anewarray, v1,v2, v);
- BRA (CMD_IFNULL, v,NOVAR, NOVAR, EXCREATOR(proto_java_lang_OutOfMemoryError) );
- }
-
- break;
-
-
- case CMD_MULTIANEWARRAY:
- { constant_arraydescriptor *desc =
- class_getconstant (class, code_get_u2(p+1), CONSTANT_Arraydescriptor);
- int i, n = code_get_u1 (p+3);
- varid dims = var_create (TYPE_ADDRESS); /* array for dimensions */
- varid dimsdim = var_create (TYPE_INT); /* groesse des arrays */
-
- stack_makesaved ();
- LOADCONST_I (n, dimsdim);
- BUILTIN1 ((functionptr) builtin_newarray_int, dimsdim, dims);
- BRA (CMD_IFNULL, dims,NOVAR, NOVAR, EXCREATOR(proto_java_lang_OutOfMemoryError) );
-
- for (i=0; i<n; i++) {
- varid dimn = stack_pop (TYPE_INT);
- BRA (CMD_IFLT, dimn,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NegativeArraySizeException) );
-
- LOADCONST_I ((n-i)-1, dimsdim);
- OP3 (CMD_IASTORE, dims, dimsdim, dimn, NOVAR);
- DROP (dimsdim);
- DROP (dimn);
- }
-
- v = stack_push (TYPE_ADDRESS);
-
- v1 = var_create (TYPE_ADDRESS);
- LOADCONST_A (desc, v1);
-
- BUILTIN2 ((functionptr) builtin_multianewarray, dims, v1, v);
- BRA (CMD_IFNULL, v,NOVAR, NOVAR, EXCREATOR(proto_java_lang_OutOfMemoryError) );
-
- }
- break;
-
-
- case CMD_ARRAYLENGTH:
- v = stack_pop (TYPE_ADDRESS);
- if (checknull) {
-#ifdef STATISTICS
- count_check_null++;
-#endif
- BRA (CMD_IFNULL, v,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NullPointerException) );
- }
- OP1 (opcode, v, stack_push (TYPE_INT) );
- DROP (v);
- break;
-
- case CMD_AALOAD:
- type = TYPE_ADDRESS; goto do_aXload;
- case CMD_LALOAD:
- type = TYPE_LONG; goto do_aXload;
- case CMD_FALOAD:
- type = TYPE_FLOAT; goto do_aXload;
- case CMD_DALOAD:
- type = TYPE_DOUBLE; goto do_aXload;
- case CMD_IALOAD:
- case CMD_BALOAD:
- case CMD_CALOAD:
- case CMD_SALOAD:
- type = TYPE_INT; goto do_aXload;
- do_aXload:
- v2 = stack_pop (TYPE_INT);
- v1 = stack_pop (TYPE_ADDRESS);
- if (checknull) {
-#ifdef STATISTICS
- count_check_null++;
-#endif
- BRA (CMD_IFNULL, v1,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NullPointerException) );
- }
- if (checkbounds) {
-#ifdef STATISTICS
- count_check_bound++;
-#endif
- v = var_create (TYPE_INT);
- OP1 (CMD_ARRAYLENGTH, v1, v);
- BRA (CMD_IF_UCMPGE, v2,v, NOVAR, EXCREATOR(proto_java_lang_ArrayIndexOutOfBoundsException) );
- DROP (v);
- }
- OP2 (opcode, v1,v2, stack_push (type) );
- DROP (v1);
- DROP (v2);
- break;
-
- case CMD_AASTORE:
- type = TYPE_ADDRESS; goto do_aXstore;
- case CMD_LASTORE:
- type = TYPE_LONG; goto do_aXstore;
- case CMD_FASTORE:
- type = TYPE_FLOAT; goto do_aXstore;
- case CMD_DASTORE:
- type = TYPE_DOUBLE; goto do_aXstore;
- case CMD_IASTORE:
- case CMD_BASTORE:
- case CMD_CASTORE:
- case CMD_SASTORE:
- type = TYPE_INT; goto do_aXstore;
- do_aXstore:
- v3 = stack_pop (type);
- v2 = stack_pop (TYPE_INT);
- v1 = stack_pop (TYPE_ADDRESS);
- if (checknull) {
-#ifdef STATISTICS
- count_check_null++;
-#endif
- BRA (CMD_IFNULL, v1,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NullPointerException) );
- }
- if (checkbounds) {
-#ifdef STATISTICS
- count_check_bound++;
-#endif
- v = var_create (TYPE_INT);
- OP1 (CMD_ARRAYLENGTH, v1, v);
- BRA (CMD_IF_UCMPGE, v2,v, NOVAR, EXCREATOR(proto_java_lang_ArrayIndexOutOfBoundsException) );
- DROP (v);
- }
-
- if (opcode!=CMD_AASTORE) {
- OP3 (opcode, v1,v2,v3, NOVAR);
- DROP (v1);
- DROP (v2);
- DROP (v3);
- } else {
- stack_makesaved ();
-
- v = var_create (TYPE_INT);
- BUILTIN3 ((functionptr) builtin_aastore, v1,v2,v3, v);
- BRA (CMD_IFEQ, v,NOVAR, NOVAR, EXCREATOR(proto_java_lang_ArrayStoreException) );
- DROP (v);
- }
-
- break;
-
-
-
- /******************* Stack instructions **************************/
-
- case CMD_NOP:
- break;
-
- case CMD_POP:
- v1 = stack_popany (1);
- DROP (v1);
- break;
-
- case CMD_POP2:
- { int varcount, i;
- varid vararray[2];
-
- varcount = stack_popmany (vararray, 2);
- for (i=0; i<varcount; i++) DROP(vararray[i]);
- }
- break;
-
- case CMD_DUP:
- v1 = stack_popany(1);
- stack_repush (v1);
- v = stack_push ( var_type (v1) );
- MOVE (var_type(v1), v1,v);
- break;
-
- case CMD_DUP2:
- { int varcount, i;
- varid vararray[2];
-
- varcount = stack_popmany (vararray, 2);
- stack_repushmany (varcount, vararray);
- for (i=0; i<varcount; i++) {
- v = stack_push ( var_type(vararray[varcount-1-i]) );
- MOVE ( var_type(v), vararray[varcount-1-i], v);
- }
- }
- break;
-
- case CMD_DUP_X1:
- v1 = stack_popany(1);
- v2 = stack_popany(1);
-
- stack_repush (v1);
- stack_repush (v2);
- v = stack_push ( var_type (v1) );
- MOVE (var_type(v1), v1,v);
- break;
-
- case CMD_DUP2_X1:
- { int varcount, i;
- varid vararray[2];
-
- varcount = stack_popmany (vararray, 2);
- v3 = stack_popany (1);
- stack_repushmany (varcount, vararray);
- stack_repush (v3);
- for (i=0; i<varcount; i++) {
- v = stack_push ( var_type(vararray[varcount-1-i]) );
- MOVE ( var_type(v), vararray[varcount-1-i], v);
- }
- }
- break;
-
- case CMD_DUP_X2:
- { int varcount;
- varid vararray[2];
-
- v1 = stack_popany(1);
- varcount = stack_popmany (vararray, 2);
- stack_repush (v1);
- stack_repushmany (varcount, vararray);
- MOVE (var_type(v1), v1, stack_push(var_type(v1)) );
- }
- break;
-
- case CMD_DUP2_X2:
- { int varcount1, varcount2, i;
- varid vararray1[2],vararray2[2];
-
- varcount1 = stack_popmany (vararray1, 2);
- varcount2 = stack_popmany (vararray2, 2);
- stack_repushmany (varcount2, vararray2);
- stack_repushmany (varcount1, vararray1);
- for (i=0; i<varcount1; i++) {
- v = stack_push ( var_type(vararray1[varcount1-1-i]) );
- MOVE ( var_type(v), vararray1[varcount1-1-i], v);
- }
- }
- break;
-
- case CMD_SWAP:
- v1 = stack_popany (1);
- v2 = stack_popany (1);
- stack_repush (v1);
- stack_repush (v2);
-
- break;
-
-
- /*** Arithmetic & logical instructions ***/
-
- case CMD_IDIV:
- case CMD_IREM:
- v2 = stack_pop (TYPE_INT);
- v1 = stack_pop (TYPE_INT);
- BRA (CMD_IFEQ, v2,NOVAR, NOVAR, EXCREATOR(proto_java_lang_ArithmeticException) );
-
- if (SUPPORT_DIVISION) {
- OP2 (opcode, v1,v2, stack_push(TYPE_INT));
- DROP (v1);
- DROP (v2);
- }
- else {
- stack_makesaved ();
- BUILTIN2 (
- (opcode == CMD_IDIV) ?
- ((functionptr) builtin_idiv)
- : ((functionptr) builtin_irem)
- ,v1,v2, stack_push (TYPE_INT) );
- }
- break;
-
- case CMD_LDIV:
- case CMD_LREM:
- v2 = stack_pop (TYPE_LONG);
- v1 = stack_pop (TYPE_LONG);
- BRA (CMD_IFEQL, v2,NOVAR, NOVAR, EXCREATOR(proto_java_lang_ArithmeticException) );
-
- if (SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_MULDIV) {
- OP2 (opcode, v1,v2, stack_push(TYPE_LONG));
- DROP (v1);
- DROP (v2);
- }
- else {
- stack_makesaved ();
- BUILTIN2 (
- (opcode == CMD_LDIV) ?
- ((functionptr) builtin_ldiv)
- : ((functionptr) builtin_lrem)
- ,v1,v2, stack_push (TYPE_LONG) );
- }
- break;
-
-
- /*** Control transfer instructions ***/
-
- case CMD_IFEQ:
- case CMD_IFLT:
- case CMD_IFLE:
- case CMD_IFNE:
- case CMD_IFGT:
- case CMD_IFGE:
- target = block_find (p + code_get_s2 (p+1) );
- v = stack_pop (TYPE_INT);
- block_reach (target);
- BRA_N_DROP (opcode, v,NOVAR, NOVAR, target);
- break;
-
- case CMD_IFNULL:
- case CMD_IFNONNULL:
- target = block_find (p + code_get_s2 (p+1));
- v = stack_pop (TYPE_ADDRESS);
- block_reach (target);
- BRA_N_DROP (opcode, v,NOVAR, NOVAR, target);
- break;
-
- case CMD_IF_ICMPEQ:
- case CMD_IF_ICMPNE:
- case CMD_IF_ICMPLT:
- case CMD_IF_ICMPGT:
- case CMD_IF_ICMPLE:
- case CMD_IF_ICMPGE:
- target = block_find (p + code_get_s2 (p+1) );
- v2 = stack_pop (TYPE_INT);
- v1 = stack_pop (TYPE_INT);
- block_reach (target);
- BRA_N_DROP (opcode, v1,v2, NOVAR, target );
- break;
-
- case CMD_IF_ACMPEQ:
- case CMD_IF_ACMPNE:
- target = block_find (p + code_get_s2 (p+1) );
- v2 = stack_pop (TYPE_ADDRESS);
- v1 = stack_pop (TYPE_ADDRESS);
- block_reach (target);
- BRA_N_DROP (opcode, v1,v2, NOVAR, target);
- break;
-
-
- case CMD_GOTO:
- target = block_find (p + code_get_s2 (p+1) );
- goto do_goto;
- case CMD_GOTO_W:
- target = block_find (p + code_get_s4 (p+1) );
- do_goto:
- block_reach (target);
- BRA (CMD_GOTO, NOVAR,NOVAR, NOVAR, target );
- goto cleanup;
-
-
- case CMD_JSR:
- target = block_find (p + code_get_s2 (p+1) );
- goto do_jsr;
- case CMD_JSR_W:
- target = block_find (p + code_get_s4 (p+1) );
- do_jsr:
- {
- subroutineinfo *sub;
-
- ACTIVATE (stack_push (TYPE_ADDRESS) );
-
- sub = target->subroutine;
- if (!sub) {
- sub = subroutine_new();
- target->subroutine = sub;
- }
-
- subroutine_set (sub);
- block_reach (target);
- subroutine_set (b->subroutine);
-
- BRA (CMD_JSR, NOVAR,NOVAR, stack_pop(TYPE_ADDRESS), target );
-
- while (! stack_isempty() ) {
- v = stack_popany ( stack_topslots() );
- DROP (v);
- }
-
- if (sub->returnfinished) {
- stackinfo *s = sub->returnstack;
- stack_restore (s);
- while (s) {
- ACTIVATE (s->var);
- s = s->prev;
- }
- block_reach ( block_find(nextp) );
- }
- else {
- basicblock *n = block_find(nextp);
- n -> subroutine = b->subroutine;
-
- chain_addlast (sub->callers, n );
- }
-
- }
- goto cleanup;
-
-
- case CMD_RET:
- if (!iswide) {
- v = local_get (code_get_u1 (p+1), TYPE_ADDRESS);
- }
- else {
- v = local_get (code_get_u2 (p+1), TYPE_ADDRESS);
- nextp = p+3;
- iswide = false;
- }
-
- {
- subroutineinfo *sub;
- basicblock *bb;
-
- sub = b->subroutine;
- if (!sub) panic ("RET outside of subroutine");
- if (sub->returnfinished) panic ("Multiple RET in a subroutine");
-
- sub->returnfinished = true;
- sub->returnstack = stack_get() ;
-
- while ( (bb = chain_first(sub->callers)) ) {
- chain_remove (sub->callers);
-
- subroutine_set (bb->subroutine);
- block_reach ( bb );
- subroutine_set (sub);
- }
-
- BRA (CMD_RET, v,NOVAR, NOVAR, NULL);
- }
- goto cleanup;
-
-
-
- /*************** Function Return **************/
-
- case CMD_IRETURN:
- addreturnhandling();
-
- v = stack_pop (TYPE_INT);
- ve = var_create (TYPE_ADDRESS);
- LOADCONST_A (NULL, ve);
- BRA_N_DROP (opcode, v, ve, NOVAR, NULL);
-#ifdef STATISTICS
- count_pcmd_return++;
-#endif
- goto cleanup;
-
- case CMD_LRETURN:
- addreturnhandling();
-
- v = stack_pop (TYPE_LONG);
- var_proposereg (v, reg_parlistresult(TYPE_LONG) );
- ve = var_create (TYPE_ADDRESS);
- LOADCONST_A (NULL, ve);
- var_proposereg (ve, reg_parlistexception() );
- BRA_N_DROP (opcode, v, ve, NOVAR, NULL);
-#ifdef STATISTICS
- count_pcmd_return++;
-#endif
- goto cleanup;
-
- case CMD_FRETURN:
- addreturnhandling();
-
- v = stack_pop (TYPE_FLOAT);
- var_proposereg (v, reg_parlistresult(TYPE_FLOAT) );
- ve = var_create (TYPE_ADDRESS);
- LOADCONST_A (NULL, ve);
- var_proposereg (ve, reg_parlistexception() );
- BRA_N_DROP (opcode, v, ve, NOVAR, NULL);
-#ifdef STATISTICS
- count_pcmd_return++;
-#endif
- goto cleanup;
-
- case CMD_DRETURN:
- addreturnhandling();
-
- v = stack_pop (TYPE_DOUBLE);
- var_proposereg (v, reg_parlistresult(TYPE_DOUBLE) );
- ve = var_create (TYPE_ADDRESS);
- LOADCONST_A (NULL, ve);
- var_proposereg (ve, reg_parlistexception() );
- BRA_N_DROP (opcode, v, ve, NOVAR, NULL);
-#ifdef STATISTICS
- count_pcmd_return++;
-#endif
- goto cleanup;
-
- case CMD_ARETURN:
- addreturnhandling();
-
- v = stack_pop (TYPE_ADDRESS);
- var_proposereg (v, reg_parlistresult(TYPE_ADDRESS) );
- ve = var_create (TYPE_ADDRESS);
- LOADCONST_A (NULL, ve);
- var_proposereg (ve, reg_parlistexception() );
- BRA_N_DROP (opcode, v, ve, NOVAR, NULL);
- goto cleanup;
-#ifdef STATISTICS
- count_pcmd_return++;
-#endif
-
- case CMD_RETURN:
- addreturnhandling();
-
- ve = var_create (TYPE_ADDRESS);
- LOADCONST_A (NULL, ve);
- var_proposereg (ve, reg_parlistexception() );
- BRA_N_DROP (opcode, NOVAR,ve, NOVAR, NULL);
-#ifdef STATISTICS
- count_pcmd_return++;
-#endif
- goto cleanup;
-
-
- case CMD_BREAKPOINT:
- break;
-
-
-
- /**************** Table Jumping *****************/
-
- case CMD_LOOKUPSWITCH:
- { u4 p2 = ALIGN((p+1), 4);
- basicblock *defaulttarget;
- u4 num, i;
-
- defaulttarget = block_find (p + code_get_s4 (p2) );
- num = code_get_s4 (p2+4);
-
- v = stack_pop (TYPE_INT);
- for (i=0; i<num; i++) {
- s4 value = code_get_s4 (p2 + 8 + 8*i);
- target = block_find (p + code_get_s4 (p2 + 8 + 4 + 8*i) );
-
- v1 = var_create (TYPE_INT);
- v2 = var_create (TYPE_INT);
- MOVE (TYPE_INT, v, v1);
- LOADCONST_I (value, v2);
- block_reach (target);
- BRA_N_DROP (CMD_IF_ICMPEQ, v1,v2, NOVAR, target );
- }
-
- DROP (v);
- block_reach (defaulttarget);
- BRA (CMD_GOTO, NOVAR,NOVAR, NOVAR, defaulttarget );
-
- nextp = p2 + 8 + 8*num;
- goto cleanup;
- }
- break;
-
- case CMD_TABLESWITCH:
- { u4 p2 = ALIGN((p+1), 4);
- basicblock *target;
- basicblock **targets;
- s4 low,high, i;
-
- low = code_get_s4 (p2+4);
- high = code_get_s4 (p2+8);
- if (high<low) panic ("Tablejump range invalid");
-
- v = stack_pop (TYPE_INT);
-
- target = block_find (p + code_get_s4 (p2) );
- block_reach(target);
-
- v1 = var_create (TYPE_INT);
- LOADCONST_I (high, v1);
- BRA (CMD_IF_ICMPGT, v,v1, NOVAR, target);
- DROP (v1);
-
- if (low!=0) {
- v1 = var_create (TYPE_INT);
- v2 = var_create (TYPE_INT);
- LOADCONST_I (low, v1);
- OP2 (CMD_ISUB, v,v1, v2);
- DROP (v1);
- DROP (v);
- v = v2;
- }
- BRA (CMD_IFLT, v,NOVAR, NOVAR, target);
-
- targets = DMNEW (basicblock*, (high-low)+1);
- for (i=0; i < (high-low)+1; i++) {
- target = block_find (p + code_get_s4 (p2 + 12 + 4*i) );
- block_reach (target);
-
- targets[i] = target;
- }
-
- TABLEJUMP (v, (high-low)+1, targets);
- DROP (v);
-
- nextp = p2 + 12 + 4 * ((high-low)+1);
- goto cleanup;
- }
- break;
-
-
- /************ Manipulating Object Fields ********/
-
- case CMD_PUTSTATIC:
- case CMD_GETSTATIC:
- case CMD_PUTFIELD:
- case CMD_GETFIELD:
-
- poolindex = code_get_u2 (p+1);
- { constant_FMIref *fr;
- fieldinfo *fi;
-
- fr = class_getconstant (class, poolindex, CONSTANT_Fieldref);
- fi = class_findfield (fr->class, fr->name, fr->descriptor);
-
- switch (opcode) {
- case CMD_PUTSTATIC:
- compiler_addinitclass (fr->class);
-
- v1 = var_create (TYPE_ADDRESS);
- v = stack_pop (fi->type);
- LOADCONST_A (&(fi->value), v1);
-
- MEM (CMD_PUTFIELD, fi->type, v1,v, NOVAR, 0);
- DROP (v);
- DROP (v1);
- break;
-
- case CMD_GETSTATIC:
- compiler_addinitclass (fr->class);
-
- v1 = var_create (TYPE_ADDRESS);
- v = stack_push (fi->type);
- LOADCONST_A (&(fi->value), v1);
-
- MEM (CMD_GETFIELD, fi->type, v1,NOVAR, v, 0);
- DROP (v1);
- break;
-
-
- case CMD_PUTFIELD:
- v = stack_pop (fi->type);
- v1 = stack_pop (TYPE_ADDRESS);
- if (checknull) {
-#ifdef STATISTICS
- count_check_null++;
-#endif
- BRA (CMD_IFNULL, v1,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NullPointerException) );
- }
- MEM (CMD_PUTFIELD, fi->type, v1,v, NOVAR, fi->offset);
- DROP (v);
- DROP (v1);
- break;
-
- case CMD_GETFIELD:
- v1 = stack_pop (TYPE_ADDRESS);
- v = stack_push (fi->type);
- if (checknull) {
-#ifdef STATISTICS
- count_check_null++;
-#endif
- BRA (CMD_IFNULL, v1,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NullPointerException) );
- }
- MEM (CMD_GETFIELD, fi->type, v1,NOVAR, v, fi->offset);
- DROP (v1);
- break;
-
-
- }
- }
- break;
-
-
- /*** Method invocation ***/
-
- case CMD_INVOKEVIRTUAL:
- case CMD_INVOKESPECIAL:
- case CMD_INVOKESTATIC:
- case CMD_INVOKEINTERFACE:
-
- count_calls ++;
-
- { constant_FMIref *mr;
- methodinfo *mi;
- u4 i;
- s4 paramnum;
- u1 *paramtypes;
- s4 returntype;
- varid *params;
- bool stat = (opcode == CMD_INVOKESTATIC);
-
- if (opcode==CMD_INVOKEINTERFACE) {
- poolindex = code_get_u2 (p+1);
- mr = class_getconstant (class, poolindex, CONSTANT_InterfaceMethodref);
- }
- else {
- poolindex = code_get_u2 (p+1);
- mr = class_getconstant (class, poolindex, CONSTANT_Methodref);
- }
-
- mi = class_findmethod (mr->class, mr->name, mr->descriptor);
-
- if ( ((mi->flags & ACC_STATIC) != 0) != stat)
- panic ("Static/Nonstatic mismatch on method call");
-
- descriptor2types (mi->descriptor, stat,
- ¶mnum, ¶mtypes, &returntype);
- mi->paramcount = paramnum;
-
- params = DMNEW (varid, paramnum);
- for (i=0; i<paramnum; i++) {
- params[paramnum-i-1] = stack_pop (paramtypes[paramnum-i-1]);
- }
-
- stack_makesaved();
-
- if ((!stat) && checknull) {
-#ifdef STATISTICS
- count_check_null++;
-#endif
- BRA (CMD_IFNULL, params[0],NOVAR, NOVAR, EXCREATOR(proto_java_lang_NullPointerException) );
- }
-
- ve = var_create (TYPE_ADDRESS);
- if (returntype != TYPE_VOID) {
- v = stack_push (returntype);
- METHOD (opcode, mi, NULL, paramnum, params, v, ve);
- }
- else {
- METHOD (opcode, mi, NULL, paramnum, params, NOVAR, ve);
- }
-
- BRA (CMD_IFNONNULL, ve,NOVAR, NOVAR, EXFORWARDER(ve) );
- DROP (ve);
-
- }
- break;
-
-
- /********* Exception Handling *****************/
-
- case CMD_ATHROW:
- v = stack_pop (TYPE_ADDRESS);
- if (checknull) {
-#ifdef STATISTICS
- count_check_null++;
-#endif
- BRA (CMD_IFNULL, v,NOVAR, NOVAR, EXCREATOR(proto_java_lang_NullPointerException) );
- }
- BRA (CMD_GOTO, NOVAR,NOVAR, NOVAR, EXFORWARDER (v) );
- DROP (v);
- goto cleanup;
-
-
- /***** Miscellaneous Object Operations ****/
-
- case CMD_NEW:
- poolindex = code_get_u2 (p+1);
- { classinfo *ci;
-
- ci = class_getconstant (class, poolindex, CONSTANT_Class);
-
- v1 = var_create (TYPE_ADDRESS);
- LOADCONST_A (ci, v1);
-
- stack_makesaved ();
-
- v = stack_push (TYPE_ADDRESS);
- BUILTIN1 ((functionptr) builtin_new, v1, v);
- BRA (CMD_IFNULL, v,NOVAR, NOVAR, EXCREATOR(proto_java_lang_OutOfMemoryError) );
-
- }
- break;
-
-
- case CMD_CHECKCAST:
- poolindex = code_get_u2 (p+1);
-
- if (class_constanttype (class, poolindex) == CONSTANT_Arraydescriptor) {
- /* cast-check auf Array-Typ! */
-
- constant_arraydescriptor *desc =
- class_getconstant (class, poolindex, CONSTANT_Arraydescriptor);
-
- v = stack_pop (TYPE_ADDRESS);
- stack_repush (v);
- v1 = var_create (TYPE_ADDRESS);
- MOVE (TYPE_ADDRESS, v,v1);
- v2 = var_create (TYPE_ADDRESS);
- LOADCONST_A (desc, v2);
-
- stack_makesaved ();
- ve = var_create (TYPE_INT);
- BUILTIN2 ((functionptr) builtin_checkarraycast, v1,v2, ve);
-
- BRA (CMD_IFEQ,ve,NOVAR, NOVAR, EXCREATOR(proto_java_lang_ClassCastException) );
- DROP (ve);
- }
- else {
- /* cast-check auf Object-Typ */
-
- classinfo *ci = class_getconstant (class, poolindex, CONSTANT_Class);
-
- v = stack_pop (TYPE_ADDRESS);
- stack_repush (v);
- v1 = var_create (TYPE_ADDRESS);
- MOVE (TYPE_ADDRESS, v, v1);
- v2 = var_create (TYPE_ADDRESS);
- LOADCONST_A (ci, v2);
-
- stack_makesaved ();
- ve = var_create (TYPE_INT);
- BUILTIN2 ((functionptr) builtin_checkcast, v1,v2, ve);
-
- BRA (CMD_IFEQ,ve,NOVAR, NOVAR, EXCREATOR(proto_java_lang_ClassCastException) );
- DROP (ve);
- }
-
- break;
-
-
- case CMD_INSTANCEOF:
- poolindex = code_get_u2 (p+1);
-
- if (class_constanttype (class, poolindex) == CONSTANT_Arraydescriptor) {
- /* cast-check auf Array-Typ! */
-
- constant_arraydescriptor *desc =
- class_getconstant (class, poolindex, CONSTANT_Arraydescriptor);
-
- v = stack_pop (TYPE_ADDRESS);
- v1 = var_create (TYPE_ADDRESS);
- LOADCONST_A (desc, v1);
-
- stack_makesaved ();
-
- BUILTIN2 ((functionptr) builtin_arrayinstanceof, v,v1,
- stack_push (TYPE_INT) );
- }
- else {
- classinfo *ci;
- ci = class_getconstant (class, poolindex, CONSTANT_Class);
-
- v = stack_pop (TYPE_ADDRESS);
- v1 = var_create (TYPE_ADDRESS);
- LOADCONST_A (ci, v1);
-
- stack_makesaved ();
-
- BUILTIN2 ((functionptr) builtin_instanceof, v,v1,
- stack_push (TYPE_INT) );
- }
- break;
-
-
-
-
- /*************** Monitors ************************/
-
- case CMD_MONITORENTER:
- if (checksync) {
- v = stack_pop (TYPE_ADDRESS);
- if (checknull) {
-#ifdef STATISTICS
- count_check_null++;
-#endif
- BRA (CMD_IFNULL, v, NOVAR, NOVAR,
- EXCREATOR(proto_java_lang_NullPointerException));
- }
- BUILTIN1 ((functionptr) builtin_monitorenter, v, NOVAR);
- } else {
- DROP (stack_pop (TYPE_ADDRESS));
- }
- break;
-
- case CMD_MONITOREXIT:
- if (checksync) {
- BUILTIN1 ((functionptr) builtin_monitorexit,
- stack_pop(TYPE_ADDRESS), NOVAR );
- } else {
- DROP (stack_pop (TYPE_ADDRESS));
- }
- break;
-
-
-
-
- /************** any other Basic-Operation **********/
-
-
- default:
- {
- stdopdescriptor *s = stdopdescriptors[opcode];
- if (s) {
- v2 = NULL;
- if (s->type_s2 != TYPE_VOID) v2 = stack_pop(s->type_s2);
- v1 = stack_pop(s->type_s1);
-
- if (s->supported) {
- v = stack_push (s->type_d);
- if (v2) {
- OP2 (opcode, v1,v2, v);
- DROP (v1);
- DROP (v2);
- }
- else {
- OP1 (opcode, v1, v);
- DROP (v1);
- }
- }
- else {
- stack_makesaved ();
- v = stack_push (s->type_d);
- if (v2) {
- BUILTIN2 (s->builtin, v1,v2, v);
- }
- else {
- BUILTIN1 (s->builtin, v1, v);
- }
- }
- }
-
-
- /*************** invalid Opcode ***************/
-
- else {
- sprintf (logtext, "Invalid opcode %d at position %ld",
- opcode, (long int) p);
- error ();
- }
-
- }
-
- break;
-
-
- } /* end switch */
-
-
- p = nextp;
-
- if ( block_isany (p) ) {
- block_reach ( block_find (p) );
- goto cleanup;
- }
-
- } /* end for */
-
-
-cleanup:
- pcmd_untieall();
-}
-
+++ /dev/null
-/********************************** comp/pcmd.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 parser functions which generate pseude commands and
- eliminating unnecessary copy instructions
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
- Andreas Krall EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1997/09/22
-
-*******************************************************************************/
-
-
-list *pcmdlist; /* list of pseudo commands */
-
-
-/***************************** support functions ******************************/
-
-static void pcmd_init (list *pl)
-{
- pcmdlist = pl;
-}
-
-
-static void pcmd_realmove (u2 type, varid source, varid dest)
-{
- pcmd *c = DNEW(pcmd);
- c -> tag = TAG_MOVE;
- c -> opcode = CMD_MOVE;
- c -> source1 = source;
- c -> source2 = NOVAR;
- c -> source3 = NOVAR;
- c -> dest = dest;
- c -> u.move.type = type;
- list_addlast (pcmdlist, c);
-#ifdef STATISTICS
- count_pcmd_move++;
-#endif
-}
-
-
-static void pcmd_invalidatevar (varid v)
-{
- varid c;
-
- if (!var_isoriginal(v) ) {
- var_unlinkcopy (v);
- }
- else {
- while ( (c = var_nextcopy (v)) != NULL) {
- pcmd_realmove (var_type(v), v,c);
- var_unlinkcopy (c);
- }
-
- }
-}
-
-
-static void pcmd_untievar (varid v)
-{
- varid c;
-
- if (!var_isoriginal(v)) {
- pcmd_realmove (var_type(v), var_findoriginal(v), v);
- var_unlinkcopy (v);
- }
- else {
- while ( (c = var_nextcopy(v)) != NULL) {
- pcmd_realmove (var_type(v), v, c);
- var_unlinkcopy (c);
- }
- }
-}
-
-
-static void pcmd_untieall ()
-{
- varid v;
-
- while ( (v = var_nextcopiedvar()) != NULL) {
- pcmd_realmove (var_type(v), var_findoriginal(v), v);
- var_unlinkcopy (v);
- }
-}
-
-
-/********************** generation of pseudo commands *************************/
-
-static void pcmd_drop (varid var)
-{
- pcmd *c = DNEW(pcmd);
-
- if (var_isoriginal(var)) {
- pcmd_invalidatevar (var);
-
- c -> tag = TAG_DROP;
- c -> opcode = CMD_DROP;
- c -> dest = var;
- c -> source1 = c -> source2 = c -> source3 = NOVAR;
- list_addlast (pcmdlist, c);
-#ifdef STATISTICS
- count_pcmd_drop++;
-#endif
- }
- else {
- pcmd_invalidatevar (var);
- }
-}
-
-
-static void pcmd_activate (varid var)
-{
- pcmd *c = DNEW(pcmd);
-
- pcmd_untieall();
-
- c -> tag = TAG_ACTIVATE;
- c -> opcode = CMD_ACTIVATE;
- c -> dest = var;
- c -> source1 = c -> source2 = c -> source3 = NOVAR;
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- count_pcmd_activ++;
-#endif
-}
-
-
-static void pcmd_loadconst_i (s4 val, varid var)
-{
- pcmd *c = DNEW (pcmd);
- c -> tag = TAG_LOADCONST_I;
- c -> opcode = CMD_LOADCONST_I;
- c -> dest = var;
- c -> source1 = c -> source2 = c -> source3 = NOVAR;
- c -> u.i.value = val;
-
- pcmd_invalidatevar (var);
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- if (val == 0)
- count_pcmd_zero++;
- count_pcmd_load++;
-#endif
-}
-
-
-static void pcmd_loadconst_l (s8 val, varid var)
-{
- pcmd *c = DNEW (pcmd);
- c -> tag = TAG_LOADCONST_L;
- c -> opcode = CMD_LOADCONST_L;
- c -> dest = var;
- c -> source1 = c -> source2 = c -> source3 = NOVAR;
- c -> u.l.value = val;
-
- pcmd_invalidatevar (var);
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- if (val == 0)
- count_pcmd_zero++;
- count_pcmd_load++;
-#endif
-}
-
-
-static void pcmd_loadconst_f (float val, varid var)
-{
- pcmd *c = DNEW (pcmd);
- c -> tag = TAG_LOADCONST_F;
- c -> opcode = CMD_LOADCONST_F;
- c -> dest = var;
- c -> source1 = c -> source2 = c -> source3 = NOVAR;
- c -> u.f.value = val;
-
- pcmd_invalidatevar (var);
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- count_pcmd_load++;
-#endif
-}
-
-
-static void pcmd_loadconst_d (double val, varid var)
-{
- pcmd *c = DNEW (pcmd);
- c -> tag = TAG_LOADCONST_D;
- c -> opcode = CMD_LOADCONST_D;
- c -> dest = var;
- c -> source1 = c -> source2 = c -> source3 = NOVAR;
- c -> u.d.value = val;
-
- pcmd_invalidatevar (var);
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- count_pcmd_load++;
-#endif
-}
-
-
-static void pcmd_loadconst_a (void *val, varid var)
-{
- pcmd *c = DNEW (pcmd);
- c -> tag = TAG_LOADCONST_A;
- c -> opcode = CMD_LOADCONST_A;
- c -> dest = var;
- c -> source1 = c -> source2 = c -> source3 = NOVAR;
- c -> u.a.value = val;
-
- pcmd_invalidatevar (var);
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- if (val == NULL)
- count_pcmd_zero++;
- count_pcmd_load++;
-#endif
-}
-
-
-static void pcmd_move (u2 type, varid source, varid dest)
-{
- pcmd_invalidatevar (dest);
- var_makecopy ( var_findoriginal(source), dest);
-}
-
-
-static void pcmd_move_n_drop (u2 type, varid source, varid dest)
-{
- pcmd *c;
-
- pcmd_untievar (source);
- pcmd_untievar (dest);
-
-#ifdef STATISTICS
- count_pcmd_store++;
-#endif
- c = list_last (pcmdlist);
- while (c) {
- switch (c->tag) {
- case TAG_LOADCONST_I:
- if (c->dest == source) { c->dest = dest; return; }
-#ifdef STATISTICS
- count_pcmd_const_store++;
-#endif
- goto nothingfound;
- case TAG_LOADCONST_L:
- if (c->dest == source) { c->dest = dest; return; }
- goto nothingfound;
- case TAG_LOADCONST_F:
- if (c->dest == source) { c->dest = dest; return; }
- goto nothingfound;
- case TAG_LOADCONST_D:
- if (c->dest == source) { c->dest = dest; return; }
- goto nothingfound;
- case TAG_LOADCONST_A:
- if (c->dest == source) { c->dest = dest; return; }
- goto nothingfound;
- case TAG_OP:
- if (c->dest == source) { c->dest = dest; return; }
- goto nothingfound;
- case TAG_MEM:
- if (c->dest == source) { c->dest = dest; return; }
- goto nothingfound;
-
- case TAG_DROP:
- break;
- default:
- goto nothingfound;
- } /* end switch */
-
- c = list_prev (pcmdlist, c);
- }
-
-nothingfound:
- var_makecopy ( source, dest);
- pcmd_drop (source);
-#ifdef STATISTICS
- count_pcmd_store_comb++;
-#endif
-}
-
-
-static void pcmd_iinc (s4 val, varid sourcedest)
-{
- pcmd *c = DNEW (pcmd);
-
- pcmd_invalidatevar (sourcedest);
-
- c -> tag = TAG_OP;
- c -> opcode = CMD_IINC;
- c -> source1 = var_findoriginal(sourcedest);
- c -> source2 = NOVAR;
- c -> source3 = NOVAR;
- c -> dest = sourcedest;
- c -> u.i.value = val;
-
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- count_pcmd_op++;
-#endif
-}
-
-
-static void pcmd_op (u1 opcode,
- varid source1, varid source2, varid source3, varid dest)
-{
- pcmd *c;
-
-#ifdef STATISTICS
- c = list_last (pcmdlist);
- if (c && (c->tag == TAG_LOADCONST_I))
- switch (opcode) {
- case CMD_IASTORE:
- case CMD_BASTORE:
- case CMD_CASTORE:
- case CMD_SASTORE:
- count_pcmd_const_store++;
- break;
- case CMD_IADD:
- case CMD_ISUB:
- case CMD_IMUL:
- case CMD_ISHL:
- case CMD_ISHR:
- case CMD_IUSHR:
- case CMD_IAND:
- case CMD_IOR:
- case CMD_IXOR:
- count_pcmd_const_alu++;
- }
-#endif
- c = DNEW(pcmd);
- if (dest) pcmd_invalidatevar (dest);
-
- c -> tag = TAG_OP;
- c -> opcode = opcode;
- c -> source1 = source1 ? var_findoriginal(source1) : NOVAR;
- c -> source2 = source2 ? var_findoriginal(source2) : NOVAR;
- c -> source3 = source3 ? var_findoriginal(source3) : NOVAR;
- c -> dest = dest;
- list_addlast (pcmdlist, c);
-#ifdef STATISTICS
- count_pcmd_op++;
-#endif
-}
-
-
-static void pcmd_mem (u1 opcode, u2 type, varid base, varid source,
- varid dest, u2 offset)
-{
- pcmd *c;
-
-#ifdef STATISTICS
- c = list_last (pcmdlist);
- if (c && (c->tag == TAG_LOADCONST_I) && (opcode == CMD_PUTFIELD))
- count_pcmd_const_store++;
-#endif
- c = DNEW(pcmd);
- if (dest) pcmd_invalidatevar (dest);
-
- c -> tag = TAG_MEM;
- c -> opcode = opcode;
- c -> source1 = base ? var_findoriginal(base) : NOVAR;
- c -> source2 = source ? var_findoriginal(source) : NOVAR;
- c -> source3 = NOVAR;
- c -> dest = dest;
- c -> u.mem.type = type;
- c -> u.mem.offset = offset;
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- count_pcmd_mem++;
-#endif
-}
-
-
-static void pcmd_bra (u1 opcode, varid s1, varid s2, varid dest, basicblock *target)
-{
- pcmd *c;
- varid or1,or2;
-
-#ifdef STATISTICS
- c = list_last (pcmdlist);
- if (c && (c->tag == TAG_LOADCONST_I))
- switch (opcode) {
- case CMD_IF_ICMPEQ:
- case CMD_IF_ICMPNE:
- case CMD_IF_ICMPLT:
- case CMD_IF_ICMPGT:
- case CMD_IF_ICMPLE:
- case CMD_IF_ICMPGE:
- count_pcmd_const_bra++;
- }
-#endif
- c = DNEW(pcmd);
- or1 = s1 ? var_findoriginal (s1) : NOVAR;
- or2 = s2 ? var_findoriginal (s2) : NOVAR;
-
- pcmd_untieall();
-
- c -> tag = TAG_BRA;
- c -> opcode = opcode;
- c -> source1 = or1;
- c -> source2 = or2;
- c -> source3 = NOVAR;
- c -> dest = dest;
- c -> u.bra.target = target;
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- count_pcmd_bra++;
-#endif
-}
-
-
-static void pcmd_trace (void *method)
-{
- pcmd *c;
-
- isleafmethod = false;
-
- c = DNEW(pcmd);
- c -> tag = TAG_BRA;
- c -> opcode = CMD_TRACEBUILT;
- c -> source1 = NOVAR;
- c -> source2 = NOVAR;
- c -> source3 = NOVAR;
- c -> dest = NOVAR;
- c -> u.a.value = method;
- list_addlast (pcmdlist, c);
-}
-
-
-static void pcmd_bra_n_drop (u1 opcode, varid s1, varid s2, varid dest, basicblock *target)
-{
- pcmd *c;
- varid or1=NOVAR,or2=NOVAR;
- bool isor1=false,isor2=false;
-
-#ifdef STATISTICS
- c = list_last (pcmdlist);
- if (c && (c->tag == TAG_LOADCONST_I))
- switch (opcode) {
- case CMD_IF_ICMPEQ:
- case CMD_IF_ICMPNE:
- case CMD_IF_ICMPLT:
- case CMD_IF_ICMPGT:
- case CMD_IF_ICMPLE:
- case CMD_IF_ICMPGE:
- count_pcmd_const_bra++;
- }
-#endif
- c = DNEW(pcmd);
- if (s1!=NOVAR) {
- or1 = var_findoriginal (s1);
- if (! (isor1 = var_isoriginal(s1)) ) var_unlinkcopy (s1);
- }
- if (s2!=NOVAR) {
- or2 = var_findoriginal (s2);
- if (! (isor2 = var_isoriginal (s2)) ) var_unlinkcopy (s2);
- }
-
- pcmd_untieall();
-
- c -> tag = TAG_BRA;
- c -> opcode = opcode;
- c -> source1 = or1;
- c -> source2 = or2;
- c -> source3 = NOVAR;
- c -> dest = dest;
- c -> u.bra.target = target;
- list_addlast (pcmdlist, c);
-
- if (isor1) pcmd_drop (s1);
- if (isor2) pcmd_drop (s2);
-
-#ifdef STATISTICS
- count_pcmd_bra++;
-#endif
-}
-
-
-static void pcmd_tablejump (varid s, u4 targetcount, basicblock **targets)
-{
- pcmd *c = DNEW(pcmd);
-
- pcmd_untieall();
-
- c -> tag = TAG_TABLEJUMP;
- c -> opcode = CMD_TABLEJUMP;
- c -> source1 = var_findoriginal(s);
- c -> source2 = NOVAR;
- c -> source3 = NOVAR;
- c -> dest = NOVAR;
- c -> u.tablejump.targetcount = targetcount;
- c -> u.tablejump.targets = targets;
- list_addlast (pcmdlist, c);
-
-#ifdef STATISTICS
- count_pcmd_table++;
-#endif
-}
-
-
-/******* ATTENTION: Method does DROP automatically !!!!! ****/
-
-static void pcmd_method (int opcode, methodinfo *mi, functionptr builtin,
- int paramnum, varid *params, varid result, varid exceptionvar)
-{
- varid v;
- int i;
-
- pcmd *c = DNEW(pcmd);
-
- pcmd_untieall();
-
- isleafmethod = false;
-
- reg_parlistinit();
- for (i = 0; i < paramnum; i++) {
- v = params[i];
- var_proposereg(v, reg_parlistpar(var_type(v)));
- }
-
- if (result) {
- var_proposereg(result, reg_parlistresult(var_type(result)));
- }
- if (exceptionvar) {
- exceptionvar -> reg = reg_parlistexception();
- }
-
- c -> tag = TAG_METHOD;
- c -> opcode = opcode;
- c -> source1 = c -> source2 = c -> source3 = NULL;
- c -> dest = result;
- c -> u.method.method = mi;
- c -> u.method.builtin = builtin;
- c -> u.method.paramnum = paramnum;
- c -> u.method.params = params;
- c -> u.method.exceptionvar = exceptionvar;
- list_addlast (pcmdlist, c);
-
- for (i = 0; i < paramnum; i++) pcmd_drop(params[i]);
-
-#ifdef STATISTICS
- count_pcmd_met++;
-#endif
-}
-
-
-
-static void pcmd_builtin1 (functionptr builtin, varid v1, varid result)
-{
- varid *args = DMNEW (varid, 1);
- args[0] = v1;
- pcmd_method (CMD_BUILTIN, NULL, builtin, 1, args, result,NOVAR);
-}
-
-static void pcmd_builtin2 (functionptr builtin, varid v1, varid v2, varid result)
-{
- varid *args = DMNEW (varid, 2);
- args[0] = v1;
- args[1] = v2;
- pcmd_method (CMD_BUILTIN, NULL, builtin, 2, args, result, NOVAR);
-}
-
-static void pcmd_builtin3 (functionptr builtin, varid v1, varid v2, varid v3, varid result)
-{
- varid *args = DMNEW (varid, 3);
- args[0] = v1;
- args[1] = v2;
- args[2] = v3;
- pcmd_method (CMD_BUILTIN, NULL, builtin, 3, args, result, NOVAR);
-}
-
-
-static void pcmd_display (pcmd *c)
-{
- int i;
-
- switch (c -> tag) {
- case TAG_LOADCONST_I:
- printf (" LOADCONST_I #%ld -> ",
- (long int) c -> u.i.value);
- var_display (c -> dest);
- printf ("\n");
- break;
- case TAG_LOADCONST_L:
-#if U8_AVAILABLE
- printf (" LOADCONST_L #%ld -> ", (long int) c -> u.l.value);
-#else
- printf (" LOADCONST_L #HI: %ld LO: %ld -> ",
- (long int) c->u.l.value.high, (long int) c->u.l.value.low );
-#endif
- var_display (c -> dest);
- printf ("\n");
- break;
- case TAG_LOADCONST_F:
- printf (" LOADCONST_F #%f -> ", (double) c -> u.f.value);
- var_display (c -> dest);
- printf ("\n");
- break;
- case TAG_LOADCONST_D:
- printf (" LOADCONST_D #%f -> ", c -> u.d.value);
- var_display (c -> dest);
- printf ("\n");
- break;
- case TAG_LOADCONST_A:
- printf (" LOADCONST_A #%p -> ", c -> u.a.value);
- var_display (c -> dest);
- printf ("\n");
- break;
-
- case TAG_MOVE:
- printf (" MOVE_%1d ", c -> u.move.type);
- var_display (c-> source1);
- printf (" -> ");
- var_display (c -> dest);
- printf ("\n");
- break;
-
- case TAG_OP:
- printf (" OP%3d ", c -> opcode);
- var_display (c -> source1);
- printf (", ");
- var_display (c -> source2);
- printf (", ");
- var_display (c -> source3);
- printf (" -> ");
- var_display (c -> dest );
- printf ("\n");
- break;
-
- case TAG_BRA:
- printf (" BRA%3d (", c -> opcode);
- var_display (c -> source1);
- printf (", ");
- var_display (c -> source2);
- printf (" -> ");
- var_display (c -> dest);
- if (c->u.bra.target) {
- printf (") to pos %ld\n",
- (long int) c -> u.bra.target -> jpc );
- }
- else printf (")\n");
- break;
-
- case TAG_TABLEJUMP:
- printf (" TABLEJUMP ");
- var_display (c -> source1);
- printf ("\n");
- for (i=0; i < (int) c->u.tablejump.targetcount; i++) {
- printf (" %d: to pos %ld\n", (int) i,
- (long int) c ->u.tablejump.targets[i] -> jpc );
- }
- break;
-
- case TAG_MEM:
- printf (" MEM%3d_%d ", c -> opcode, c -> u.mem.type);
- var_display (c -> source2);
- printf ("/");
- var_display (c -> dest);
- printf (" <-> ");
- printf ("%d [", (int) (c -> u.mem.offset) );
- var_display (c -> source1 );
- printf ("]\n");
- break;
-
- case TAG_METHOD:
- printf (" METHOD%3d ", c -> opcode);
- for (i=0; i < c -> u.method.paramnum; i++) {
- var_display (c -> u.method.params[i]);
- }
- printf (" -> ");
- var_display (c -> dest);
- printf ("/");
- var_display (c->u.method.exceptionvar);
- printf ("\n");
- break;
-
- case TAG_DROP:
- printf (" [ DROP ");
- var_display (c-> dest);
- printf (" ]\n");
- break;
- case TAG_ACTIVATE:
- printf (" [ ACTIVATE ");
- var_display (c-> dest);
- printf (" ]\n");
- break;
-
- default:
- printf (" ???\n");
- break;
- }
-
-}
+++ /dev/null
-/******************************* comp/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: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
- Andreas Krall EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1997/10/23
-
-*******************************************************************************/
-
-/*********************** Structure of a register info *************************/
-
-#define REG_TYPE_FLT 1 /* integer or floating point type */
-#define REG_SIZE_DBL 2 /* int/single or long/double */
-#define REG_INMEMORY 4 /* true if register is in memory */
-#define REG_ISFREE 8 /* true if register is currently free */
-#define REG_ISUNUSED 16 /* true if register never has been used */
-#define REG_ISFREEUNUSED 24
-
-#define IS_INT_LNG_REG(a) (!((a)®_TYPE_FLT))
-#define IS_FLT_DBL_REG(a) ((a)®_TYPE_FLT)
-
-#define REGTYPE_INT 0
-#define REGTYPE_FLT 1
-#define REGTYPE_LNG 2
-#define REGTYPE_DBL 3
-
-#define REGTYPE(a) ((a) & 3)
-
-typedef struct reginfo {
- int typeflags; /* register type, size and flags */
- int num; /* register number or stack offset */
- list *waitlist; /* free list for register allocation */
- listnode linkage;
-} reginfo;
-
-
-
-static reginfo *intregs = NULL; /* table for the integer registers */
-static reginfo *floatregs = NULL; /* table for the float registers */
-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_exc; /* register to return exception value */
-static int intreg_arg1; /* register for first integer argument */
-static int intreg_argnum; /* number of integer argument registers */
-
-static int floatreg_ret; /* register for return float values */
-static int floatreg_arg1; /* register for first float argument */
-static int floatreg_argnum; /* number of float argument registers */
-
-
-static list savedintslist; /* free saved int registers during allocation */
-static list savedfloatslist; /* free saved float registers during allocation*/
-static list scratchintslist; /* free temp int registers during allocation */
-static list scratchfloatslist; /* free temp float registers during allocation */
-static int *freeintregs; /* free int registers table */
-static int *freefloatregs; /* free float registers table */
-
-static int savedregs_num; /* total number of registers to be saved */
-static int localvars_num; /* total number of variables to spilled */
-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 (!intregs) {
- for (intregsnum=0; regdescint[intregsnum] != REG_END; intregsnum++);
- intregs = MNEW (reginfo, intregsnum);
- freeintregs = MNEW (int, intregsnum + 2);
- *freeintregs++ = 0;
- freeintregs[intregsnum] = 0;
-
- intreg_arg1 = -1;
- for (n=0; n<intregsnum; n++) {
- intregs[n].typeflags = 0;
- intregs[n].num = n;
- intregs[n].waitlist = NULL;
- freeintregs[n] = 0;
-
- switch (regdescint[n]) {
- case REG_RES: break;
- case REG_RET: intreg_ret = n;
- break;
- case REG_EXC: intreg_exc = n;
- break;
- case REG_SAV: intregs[n].waitlist = &(savedintslist);
- freeintregs[n] = 1;
- break;
- case REG_TMP: intregs[n].waitlist = &(scratchintslist);
- freeintregs[n] = 1;
- break;
- case REG_ARG: if (intreg_arg1 < 0) intreg_arg1 = n;
- intreg_argnum++;
- break;
- }
- }
-
-
- for (floatregsnum=0; regdescfloat[floatregsnum] != REG_END; floatregsnum++);
- floatregs = MNEW (reginfo, floatregsnum);
- freefloatregs = MNEW (int, floatregsnum + 2);
- *freefloatregs++ = 0;
- freefloatregs[floatregsnum] = 0;
-
- floatreg_arg1 = -1;
- for (n=0; n<floatregsnum; n++) {
- floatregs[n].typeflags = REG_TYPE_FLT;
- floatregs[n].num = n;
- floatregs[n].waitlist = NULL;
- freefloatregs[n] = 0;
-
- switch (regdescfloat[n]) {
- case REG_RES: break;
- case REG_RET: floatreg_ret = n;
- break;
- case REG_EXC: panic ("can not use floating-reg as exception");
- break;
- case REG_SAV: floatregs[n].waitlist = &(savedfloatslist);
- freefloatregs[n] = 1;
- break;
- case REG_TMP: floatregs[n].waitlist = &(scratchfloatslist);
- freefloatregs[n] = 1;
- break;
- case REG_ARG: if (floatreg_arg1 < 0) floatreg_arg1 = n;
- floatreg_argnum++;
- break;
- }
- }
-
- }
-
-
- list_init (&savedintslist, OFFSET(reginfo, linkage));
- list_init (&savedfloatslist, OFFSET(reginfo, linkage));
- list_init (&scratchintslist, OFFSET(reginfo, linkage));
- list_init (&scratchfloatslist, OFFSET(reginfo, linkage));
-
- for (n=0; n<intregsnum; n++) {
- intregs[n].typeflags |= REG_ISFREE | REG_ISUNUSED;
- if (intregs[n].waitlist)
- list_addlast(intregs[n].waitlist, intregs+n);
- }
- for (n=0; n<floatregsnum; n++) {
- floatregs[n].typeflags |= REG_ISFREE | REG_ISUNUSED;
- if (floatregs[n].waitlist)
- list_addlast(floatregs[n].waitlist, floatregs+n);
- }
-
-
- localvars_num = 0;
- arguments_num = 0;
-}
-
-
-/********************** function reg_close *************************************
-
- releases all allocated space for registers
-
-*******************************************************************************/
-
-static void reg_close ()
-{
- if (intregs) MFREE (intregs, reginfo, intregsnum);
- if (floatregs) MFREE (floatregs, reginfo, floatregsnum);
-}
-
-
-/********************* function reg_free ***************************************
-
- put back a register which has been allocated by reg_allocate into the
- corresponding free list
-
-*******************************************************************************/
-
-static void reg_free (reginfo *ri)
-{
- ri -> typeflags |= REG_ISFREE;
-
- if (ri->waitlist) {
- if (ri->typeflags & REG_INMEMORY)
- list_addlast (ri->waitlist, ri);
- else {
-#if (WORDSIZE == 4)
- reginfo *ri1;
-
- if (ri->typeflags & REG_TYPE_FLT) {
- if (ri->typeflags & REG_SIZE_DBL) {
- freefloatregs[ri->num] = 0;
- freefloatregs[ri->num + 1] = 0;
- ri1 = &floatregs[ri->num + 1];
- list_addfirst (ri1->waitlist, ri1);
- }
- else
- freefloatregs[ri->num] = 0;
- }
- else {
- if (ri->typeflags & REG_SIZE_DBL) {
- freeintregs[ri->num] = 0;
- freeintregs[ri->num + 1] = 0;
- ri1 = &intregs[ri->num + 1];
- list_addfirst (ri1->waitlist, ri1);
- }
- else
- freeintregs[ri->num] = 0;
- }
-#endif
- list_addfirst (ri->waitlist, ri);
- }
- }
-}
-
-
-/******************* internal function reg_suckregister ************************
-
- searches for the first register of a list which fullfills the requirements:
- if argument isunused is true ri->typeflags®_ISUNUSED has to be true too
- if register pairs are required two adjacent register are searched
- if a register can be found it is removed from the free list and the
- fields 'isunused' and 'isfree' are set to false
-
-*******************************************************************************/
-
-static reginfo *reg_remove (list *l, int num) {
- reginfo *ri;
-
- ri = list_first (l);
- while (ri->num != num)
- ri = list_next (l, ri);
- if (ri->typeflags & REG_TYPE_FLT)
- freefloatregs[num] = 0;
- else
- freeintregs[num] = 0;
- list_remove (l, ri);
- ri -> typeflags &= ~REG_ISFREEUNUSED;
- return ri;
-}
-
-
-static reginfo *reg_suckregister (list *l, bool isunused)
-{
- reginfo *ri;
-
- ri = list_first (l);
-
- while (ri) {
- if ( (!isunused) || (ri->typeflags & REG_ISUNUSED)) {
-#if (WORDSIZE == 4)
- reginfo *retreg = NULL;
-
- if (ri->typeflags & REG_SIZE_DBL) {
- if (ri->typeflags & REG_TYPE_FLT)
- if (ri->num & 1) {
- if(freefloatregs[ri->num - 1]) {
- freefloatregs[ri->num] = 0;
- retreg = reg_remove(l, ri->num - 1);
- }
- }
- else {
- if (freefloatregs[ri->num + 1]) {
- freefloatregs[ri->num] = 0;
- retreg = ri;
- (void) reg_remove(l, ri->num + 1);
- }
- }
- else if (freeintregs[ri->num + 1]) {
- freeintregs[ri->num] = 0;
- retreg = ri;
- (void) reg_remove(l, ri->num + 1);
- }
- else if(freeintregs[ri->num - 1]) {
- freeintregs[ri->num] = 0;
- retreg = reg_remove(l, ri->num - 1);
- }
- if (retreg) {
- list_remove (l, ri);
- ri -> typeflags &= ~REG_ISFREEUNUSED;
- return retreg;
- }
- }
- else {
- if (ri->typeflags & REG_TYPE_FLT)
- freefloatregs[ri->num] = 0;
- else
- freeintregs[ri->num] = 0;
- list_remove (l, ri);
- ri -> typeflags &= ~REG_ISFREEUNUSED;
- return ri;
- }
-#else
- list_remove (l, ri);
- ri -> typeflags &= ~REG_ISFREEUNUSED;
- return ri;
-#endif
- }
- ri = list_next (l, ri);
- }
- return NULL;
-}
-
-
-/******************** Funktion: reg_allocate **********************************
-
- versucht, ein Register zu belegen, das vom richtigen Typ ist, und
- allen gew"unschten Anforderungen entspricht.
-
- Parameter:
- type .... JAVA-Grundtyp (INT,LONG,DOUBLE,FLOAT,ADDRESS)
- saved ... Das Register soll bei Methodenaufrufen nicht zerst"ort werden
- new ..... Das Register soll noch nie vorher verwendet worden sein
-
- Wenn es (aus verschiedenen Gr"unden) kein geeignetes freies Register f"ur
- den Zweck mehr gibt, dann erzeugt diese Funktion einen Verweis auf
- einen Platz am aktuellen Stackframe (diese Stackframe-Eintr"age erf"ullen
- auf jeden Fall alle obigen Forderungen)
-
-*******************************************************************************/
-
-static reginfo *reg_allocate (u2 type, bool saved, bool new)
-{
- u2 t;
- reginfo *ri;
-
- switch (type) {
- case TYPE_LONG:
- t = REG_SIZE_DBL;
- break;
- case TYPE_INT:
- t = 0;
- break;
- case TYPE_FLOAT:
- t = REG_TYPE_FLT;
- break;
- case TYPE_DOUBLE:
- t = REG_TYPE_FLT | REG_SIZE_DBL;
- break;
- default:
- t = 0;
- }
-
- if (!saved) {
- if (IS_INT_LNG_REG(t))
- ri = reg_suckregister (&scratchintslist, new);
- else
- ri = reg_suckregister (&scratchfloatslist, new);
- if (ri) return ri;
- }
-
- if (IS_INT_LNG_REG(t))
- ri = reg_suckregister (&savedintslist, new);
- else
- ri = reg_suckregister (&savedfloatslist, new);
- if (ri) return ri;
-
- ri = DNEW (reginfo);
- ri -> typeflags = t | REG_INMEMORY;
-#if (WORDSIZE == 4)
- ri -> num = localvars_num;
- if (t & REG_SIZE_DBL)
- localvars_num += 2;
- else
- localvars_num++;
-#else
- ri -> num = (localvars_num++);
-#endif
- ri -> waitlist = (IS_INT_LNG_REG(t)) ? &savedintslist : &savedfloatslist;
- return ri;
-}
-
-
-/********************* Funktion: reg_reallocate *******************************
-
- versucht, ein schon einmal angefordertes (aber in der Zwischenzeit
- wieder freigegebenens) Register neuerlich anzufordern.
- Wenn das Register immer noch unbenutzt ist, dann ist alles OK
- (R"uckgabewert true), sonst wird 'false' zur"uckgeben, und aus der
- neuerlichen Belegung wird nichts.
-
-******************************************************************************/
-
-static bool reg_reallocate (reginfo *ri)
-{
- if (!(ri->typeflags & REG_ISFREE)) return false;
-
- ri->typeflags &= ~REG_ISFREEUNUSED;
-
- if (ri->waitlist) list_remove (ri->waitlist, ri);
-
- return true;
-}
-
-
-
-/****************** Funktion: reg_parlistresult *******************************
-
- Erzeugt eine Registerreferenz auf das Register, das vom System zur
- R"uckgabe von Werten aus Methoden verwendet wird.
- Parameter:
- type ... Der JAVA-Grundtyp des R"uckgabewertes
-
-******************************************************************************/
-
-static reginfo *reg_parlistresult (u2 type)
-{
- if (type==TYPE_FLOAT || type==TYPE_DOUBLE) return &(floatregs[floatreg_ret]);
- else return &(intregs[intreg_ret]);
-}
-
-
-
-/*************** Funktion: reg_parlistexception ******************************
-
- Erzeugt eine Registerreferenz auf das Register, in dem das System die
- Zeiger auf allf"allige Exception-Objekte bei Methodenaufrufen
- zur"uckliefert.
-
-******************************************************************************/
-
-static reginfo *reg_parlistexception ()
-{
- return &(intregs[intreg_exc]);
-}
-
-
-
-/************************ Funktion: reg_parlistpar ****************************
-
- Erzeugt eine Registerreferenz auf ein Register, in dem das n"achste
- Argument (in der Z"ahlung ab dem Zeitpunkt von Aufruf von 'reg_parlistinit')
- bei Methodenaufrufen eingetragen wird.
- Wenn es in Summe mehr als die m"oglichen Parameter-Register werden, dann
- wird auch noch Platz am Stack f"ur die "uberz"ahligen Werte reserviert
-
-******************************************************************************/
-
-static int usedintpar, usedfloatpar;
-static int usedparoverflow;
-
-static reginfo *reg_parlistpar (u2 type)
-{
- reginfo *f;
-
- if (type == TYPE_FLOAT || type == TYPE_DOUBLE) {
- usedfloatpar++;
- if (reg_parammode == PARAMMODE_NUMBERED) usedintpar++;
-
- if (usedfloatpar <= floatreg_argnum) {
- f = &floatregs[floatreg_arg1 + (usedfloatpar - 1) ];
- f->typeflags &= ~REG_ISUNUSED;
- return f;
- }
- else goto overflow;
- }
- else {
- usedintpar++;
- if (reg_parammode == PARAMMODE_NUMBERED) usedfloatpar++;
-
- if (usedintpar <= intreg_argnum) {
- f = &intregs[intreg_arg1 + (usedintpar - 1) ];
- f->typeflags &= ~REG_ISUNUSED;
- return f;
- }
- else goto overflow;
- }
-
-
-
-overflow:
- usedparoverflow++;
- if (usedparoverflow > arguments_num) arguments_num = usedparoverflow;
- return NULL;
-}
-
-
-/****************** Funktion: reg_parlistinit *********************************
-
- initialisiert die Z"ahlung der Parameter-Register
-
-*******************************************************************************/
-
-static void reg_parlistinit()
-{
- usedintpar = 0;
- usedfloatpar = 0;
- usedparoverflow = 0;
-}
-
-
-
-
-
-/***************** Funktion: reg_display *************************************
-
- gibt eine Register-Referenz in lesbarer Form auf 'stdout' aus.
-
-******************************************************************************/
-
-static void reg_display (reginfo *ri)
-{
- if (ri->typeflags & REG_INMEMORY) {
- printf ("[%d]", (int) (ri->num) );
- }
- else {
- printf ("%s%d",
- (IS_INT_LNG_REG(ri->typeflags)) ? "$" : "f$",
- (int) (ri->num) );
- }
-}
-
-
+++ /dev/null
-/************************** comp/regalloc.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-allocator.
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1997/03/05
-
-*******************************************************************************/
-
-
-/******************** Funktion: regalloc_doalloc ******************************
-
- versucht f"ur ein Pseudoregister ein tats"achliches CPU-Register zu
- belegen.
- Wenn noch keine Belegung stattgefunden hat, dann wird ein passendes
- gerade freies Register angefordert.
- Wenn das Pseudoregsiter bereits vorher schon einmal ein Belegung
- hatte, dann wird versucht, das selbe CPU-Register wie vorher wieder
- anzufordern. Wenn es nicht gelingt (weil es schon wieder anderwertig
- verwendet wird), wann wird eben ein ganz neues Register angefordert.
-
-******************************************************************************/
-
-static void regalloc_doalloc (varinfo *v)
-{
- if (v->reg) {
- if (! reg_reallocate (v->reg)) {
- v->reg = reg_allocate (v->type, v->saved, true);
- }
- }
- else {
- v->reg = reg_allocate (v->type, v->saved, false);
- }
-}
-
-
-
-/********************* Funktion: regalloc_activate ****************************
-
- setzt ein Pseudoregister auf aktiv (wenn es nicht schon
- bereits aktiv ist), und fordert gegebenenfalls gleich ein passendes
- CPU-Register an
- Diese Operation wird aber nur bei Variablen mit lokalen Scope
- gemacht.
-
-******************************************************************************/
-
-static void regalloc_activate (varinfo *v)
-{
- if (! v->globalscope) {
- if (! var_isactive(v) ) {
- regalloc_doalloc (v);
- var_activate (v);
- }
- }
-}
-
-
-/******************** Funktion: regalloc_deactivate ***************************
-
- setzt ein Pseudoregister auf inaktiv (wenn es nicht schon inaktiv war)
-
-******************************************************************************/
-
-static void regalloc_deactivate (varinfo *v)
-{
- if (! v->globalscope) {
- if (var_isactive(v) ) {
- var_deactivate (v);
- if (v->reg) reg_free (v->reg);
- }
- }
-}
-
-
-/******************** Funktion: regalloc_cmd **********************************
-
- f"uhrt f"ur ein Pseudo-Command die Registerbelegung durch.
- Wird von regalloc in einer Schleife aufgerufen.
-
-******************************************************************************/
-
-static void regalloc_cmd (pcmd *c)
-{
- switch (c->tag) {
- case TAG_DROP:
- regalloc_deactivate (c->dest);
- break;
- case TAG_METHOD:
- if (c->u.method.exceptionvar)
- regalloc_activate (c->u.method.exceptionvar);
- if (c->dest)
- regalloc_activate (c->dest);
- break;
- default:
- if (c->dest) regalloc_activate (c->dest);
- break;
- }
-}
-
-
-/******************** Funktion: regalloc **************************************
-
- f"uhrt f"ur einen ganzen Block die Registerbelegung durch.
-
-******************************************************************************/
-
-static void regalloc (basicblock *b)
-{
- stackinfo *tos;
- pcmd *c;
- varinfo *v;
-
- /* alle Pseudoregister am Stack, die schon eine Belegung haben,
- wieder aktivieren */
- tos = b->stack;
- while (tos) {
- if (tos -> var -> reg) regalloc_activate(tos->var);
- tos = tos->prev;
- }
-
- /* alle anderen Pseudoregister am Stack belegen */
- tos = b->stack;
- while (tos) {
- regalloc_activate(tos->var);
- tos = tos->prev;
- }
-
-
- /* alle Befehle abarbeiten und Registerbelegung machen */
- c = list_first (&b->pcmdlist);
- while (c) {
- regalloc_cmd (c);
- c = list_next (&b->pcmdlist, c);
- }
-
-
- /* alle noch aktiven Pseudoregister deaktivieren */
- while ( (v = var_nextactive ()) != NULL) {
- regalloc_deactivate (v);
- }
-}
-
+++ /dev/null
-/***************************** 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
-
- behandeln des Java-Stacks
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1996/11/14
-
-*******************************************************************************/
-
-
-static stackinfo *tos; /* Top of Stack */
-
-
-
-/********************* Verwaltungsfunktionen *********************************/
-
-static void stack_init() { tos = NULL; }
-
-static stackinfo *stack_get () { return tos; }
-
-static void stack_restore (stackinfo *s) { tos = s; }
-
-static bool stack_isempty () { return tos == NULL; }
-
-
-
-/********************** Funktion: stack_topslots ******************************
-
- liefert die Anzahl der JavaVM-slots, die die oberste Pseudovariable am
- Stack belegt (entweder 2 bei LONG und DOUBLE, oder 1 sonst)
-
-******************************************************************************/
-
-static u2 stack_topslots ()
-{
- u2 t;
- if (!tos) panic ("Stack is empty on attempt to determine top slots");
-
- t = var_type (tos->var);
- return ( (t==TYPE_LONG) || (t==TYPE_DOUBLE) ) ? 2 : 1;
-}
-
-
-/********************* Funktion: stack_push ***********************************
-
- erzeugt eine neues Pseudoregister eines gew"unschten Typs und gibt
- es oben auf den Stack.
- Ausserdem liefert die Funktion den Zeiger auf dieses Pseudoregister
-
-******************************************************************************/
-
-static varinfo *stack_push (u2 type)
-{
- stackinfo *s = DNEW (stackinfo);
-
- s -> prev = tos;
- s -> var = var_create (type);
-
- tos = s;
- return s -> var;
-}
-
-
-/********************** Funktion: stack_repush ********************************
-
- Gibt ein bereits vorhandenen Pseudoregister auf den Stack
-
-******************************************************************************/
-
-static void stack_repush (varinfo *v)
-{
- stackinfo *s = DNEW (stackinfo);
-
- s -> prev = tos;
- s -> var = v;
-
- tos = s;
-}
-
-
-/********************** Funktion: stack_pop ***********************************
-
- nimmt das oberste Pseudoregister vom Stack, dabei wird aber
- "uberpr"uft, ob der Typ stimmt.
-
-******************************************************************************/
-
-static varinfo *stack_pop (u2 type)
-{
- varinfo *v;
-
- if (!tos) panic ("Stack is empty on attempt to pop");
-
- v = tos -> var;
- tos = tos -> prev;
-
- if (var_type (v) != type) panic ("Popped invalid element from stack");
- return v;
-}
-
-
-/********************* Funktion: stack_popany ********************************
-
- nimmt das oberste Pseudoregister vom stack, ohne Typ"uberpr"ufung
- durchzuf"uhren, wobei aber zumindest die Anzahl der notwendigen
- Slots "ubereinstimmen muss.
-
-******************************************************************************/
-
-static varinfo *stack_popany (u2 slots)
-{
- varinfo *v;
-
- if (!tos) panic ("Stack is empty on attempt to pop");
- if (slots != stack_topslots() )
- panic ("Pop would tear LONG/DOUBLE-Datatype apart");
-
- v = tos -> var;
- tos = tos -> prev;
-
- return v;
-}
-
-
-
-/********************** Funktion: stack_popmany *******************************
-
- nimmt vom Stack soviele Pseudoregister, dass die Anzahl der von
- ihnen belegten Slots die gew"unschte Menge ergeben.
- Zeiger auf dieses Pseudoregister werden im Array vars gespeichert, und
- deren tats"achliche Anzahl als Funktionswert zur"uckgeliefert.
- (Haupts"achlich f"ur die Typneutralen DUP/POP.. Operationen)
-
-******************************************************************************/
-
-static u2 stack_popmany (varid *vars, u2 slots)
-{
- u2 ts;
- u2 varcount=0;
-
- while (slots>0) {
- ts=stack_topslots();
- if (ts > slots) panic ("POP would tear LONG/DOUBLE-Datatype apart");
- vars[(varcount)++] = stack_popany(ts);
- slots -= ts;
- }
- return varcount;
-}
-
-
-/********************** Funktion: stack_pushmany ******************************
-
- Gibt eine Anzahl von Pseudoregister auf den Stack.
-
-******************************************************************************/
-
-static void stack_repushmany (u2 varcount, varid *vars)
-{
- u2 i;
- for (i=0; i<varcount; i++) stack_repush(vars[(varcount-1)-i]);
-}
-
-
-/***************** Funktion: stack_addjoincode ********************************
-
- erzeugt die passenden MOVE-Commandos, sodass alle Pseudoregisterinhalte
- eines Stacks auf die Pseudoregister eines anderen Stacks kopiert
- werden.
- Dann wird der Zielstack als neuer aktueller Stack verwendet.
- (F"ur allem f"ur Verzweigungs- und Sprungbefehle)
-
-*******************************************************************************/
-
-static void stack_jointail (stackinfo *now, stackinfo *then)
-{
- varinfo *v1,*v2;
- u2 t;
-
- if (now==then) return;
- if ( (now==NULL) || (then==NULL) )
- panic ("Stacks of different length on join");
-
- v1 = now->var;
- v2 = then->var;
- if (v1 != v2) {
- t = var_type (v1);
- if (t != var_type (v2))
- panic ("Mismatching stack types on join of control flow");
-
- pcmd_move_n_drop (t, v1,v2);
- }
-
- stack_jointail (now -> prev, then -> prev);
- return;
-}
-
-static void stack_addjoincode (stackinfo *targetstack)
-{
- stack_jointail (tos, targetstack);
- tos = targetstack;
-}
-
-
-/******************* Funktion: stack_makesaved ********************************
-
- Kennzeichnet alle am Stack befindlichen Pseudoregister als
- zu sichernde Register.
-
-*******************************************************************************/
-
-static void stack_makesaved ()
-{
- stackinfo *s = tos;
- while (s) {
- var_makesaved (s->var);
- s = s->prev;
- }
-}
-
-
-/******************* Funktion: stack_display **********************************
-
- Gibt den Inhalt des Stacks aus (also die Pseudoregister, die am
- Stack liegen)
- (Nur zu Debug-Zwecken)
-
-******************************************************************************/
-
-static void stack_display (stackinfo *s)
-{
- if (s) {
- stack_display (s->prev);
- var_display (s->var);
- }
-}
-
+++ /dev/null
-/***************************** comp/tools.c ************************************
-
- Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
- See file COPYRIGHT for information on usage and disclaimer of warranties
-
- Ein paar zus"atzlich notwendige Funktionen, die sonst nirgends
- hinpassen.
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1996/11/14
-
-*******************************************************************************/
-
-
-/***************** Funktion: compiler_addinitclass ****************************
-
- zum Eintragen einer Klasse in die Liste der noch zu initialisierenden
- Klassen
-
-******************************************************************************/
-
-void compiler_addinitclass (classinfo *c)
-{
- classinfo *cl;
-
- if (c->initialized) return;
-
- cl = chain_first(uninitializedclasses);
- if (cl == c)
- return;
-
- if (cl == class)
- cl = chain_next(uninitializedclasses);
- for (;;) {
- if (cl == c)
- return;
- if (cl == NULL) {
- if (runverbose) {
- 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);
- }
-}
-
-
-
-/***************** Hilfsfunktionen zum Decodieren des Bytecodes ***************
-
- lesen ein Datum des gew"unschten Typs aus dem Bytecode an der
- angegebenen Stelle
-
-******************************************************************************/
-
-static u1 code_get_u1 (u4 pos)
-{
- return jcode[pos];
-}
-
-static s1 code_get_s1 (u4 pos)
-{
- return code_get_u1 (pos);
-}
-
-static u2 code_get_u2 (u4 pos)
-{
- return ( ((u2) jcode[pos]) << 8 ) + jcode[pos+1];
-}
-
-static s2 code_get_s2 (u4 pos)
-{
- return code_get_u2 (pos);
-}
-
-static u4 code_get_u4 (u4 pos)
-{
- return ( ((u4) jcode[pos]) << 24 )
- + ( ((u4) jcode[pos+1]) << 16 )
- + ( ((u4) jcode[pos+2]) << 8 )
- + ( jcode[pos+3] );
-}
-
-static s4 code_get_s4 (u4 pos)
-{
- return code_get_u4 (pos);
-}
-
-
-
-/******************** Funktion: descriptor2types *****************************
-
- Decodiert einen Methoddescriptor.
- Beim Aufruf dieser Funktion MUSS (!!!) der Descriptor ein
- gueltiges Format haben (wird eh vorher vom loader ueberprueft).
-
- Die Funktion erzeugt ein Array von integers (u2), in das die
- Parametertypen eingetragen werden, und liefert einen Zeiger auf
- das Array in einem Referenzparameter ('paramtypes') zur"uck.
- Die L"ange dieses Arrays und der Methodenr"uckgabewert werden ebenfalls
- in Referenzparametern zur"uckgeliefert.
-
- Der Parameter 'isstatic' gibt an (wenn true), dass kein zus"atzlicher
- erster Eintrag f"ur den this-Zeiger in das Array eingetragen
- werden soll (sonst wird er n"amlich automatisch erzeugt, mit dem
- Typ TYPE_ADDRESS).
-
-******************************************************************************/
-
-static void descriptor2types (utf *desc, bool isstatic,
- s4 *paramnum, u1 **paramtypes, s4 *returntype)
-{
- u1 *text = desc->text;
- s4 pos;
- u1 *types;
- s4 tnum;
-
- tnum = (isstatic) ? 0 : 1;
- pos=1;
- while (text[pos] != ')') {
- repeatcounting:
-
- switch (text[pos]) {
- case '[': pos++;
- goto repeatcounting;
- case 'L': while (text[pos]!=';') pos++;
- break;
- }
- pos++;
- tnum++;
- }
-
- types = DMNEW (u1, tnum);
-
- if (isstatic) tnum=0;
- else {
- types[0] = TYPE_ADDRESS;
- tnum = 1;
- }
- pos=1;
- while (text[pos] != ')') {
- switch (text[pos]) {
- case 'B':
- case 'C':
- case 'I':
- case 'S':
- case 'Z': types[tnum++] = TYPE_INT;
- break;
- case 'J': types[tnum++] = TYPE_LONG;
- break;
- case 'F': types[tnum++] = TYPE_FLOAT;
- break;
- case 'D': types[tnum++] = TYPE_DOUBLE;
- break;
- case 'L': types[tnum++] = TYPE_ADDRESS;
- while (text[pos] != ';') pos++;
- break;
- case '[': types[tnum++] = TYPE_ADDRESS;
- while (text[pos] == '[') pos++;
- if (text[pos] == 'L') while (text[pos] != ';') pos++;
- break;
- default: panic ("Ill formed methodtype-descriptor");
- }
- pos++;
- }
-
- pos++; /* ueberlesen von ')' */
-
- switch (text[pos]) {
- case 'B':
- case 'C':
- case 'I':
- case 'S':
- case 'Z': *returntype = TYPE_INT;
- break;
- case 'J': *returntype = TYPE_LONG;
- break;
- case 'F': *returntype = TYPE_FLOAT;
- break;
- case 'D': *returntype = TYPE_DOUBLE;
- break;
- case '[':
- case 'L': *returntype = TYPE_ADDRESS;
- break;
- case 'V': *returntype = TYPE_VOID;
- break;
-
- default: panic ("Ill formed methodtype-descriptor");
- }
-
- *paramnum = tnum;
- *paramtypes = types;
-}
-
+++ /dev/null
-/****************************** comp/var.c *************************************
-
- Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
- See file COPYRIGHT for information on usage and disclaimer of warranties
-
- verwaltet die Pseudoregister (die ich manchmal auch einfach nur
- 'Variablen' nenne, daher der Namen des Programmteiles)
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1996/11/14
-
-*******************************************************************************/
-
-
-s4 varnum; /* Anzahl der bereits vergebenen Variablen
- (eigentlich nur, um den Variablen forlaufende
- Nummern zu geben, damit man sie beim Debuggen
- eindeutig kennzeichnen kann) */
-
-list copiedvars; /* Liste aller Variablen die nur eine Kopie einer
- anderen Variablen sind (w"ahrend der
- Parse-Phase notwendig) */
-list activevars; /* Liste aller gerade aktiven Variablen
- (f"ur die Registerbelegungs-phase notwendig) */
-
-list vars; /* Liste aller Variablen, die nicht in einer der
- obigen Listen sind */
-
-
-/********************** Funktion: var_init ************************************
-
- initialisiert die Listen und den Variablen-Index-Z"ahler
-
-******************************************************************************/
-
-static void var_init ()
-{
- varnum = maxlocals;
- list_init (&vars, OFFSET (varinfo, linkage) );
- list_init (&copiedvars, OFFSET (varinfo, linkage) );
- list_init (&activevars, OFFSET (varinfo, linkage) );
-}
-
-
-/********************* Funktion: var_type *************************************
-
- Liefert den JavaVM-Grundtyp einer Variablen
-
-******************************************************************************/
-
-static u2 var_type (varid v)
-{
- return v->type;
-}
-
-
-/********************* Funktion: var_create ***********************************
-
- Erzeugt eine neue Variable des gew"unschten Typs
-
-******************************************************************************/
-
-static varid var_create (u2 type)
-{
- varinfo *v = DNEW (varinfo);
-
- list_addlast (&vars, v);
-
- list_init (&(v -> copies), OFFSET (varinfo, copylink) );
- v -> original = v;
-
- v -> type = type;
- v -> number = varnum++;
- v -> active = false;
- v -> globalscope = false;
- v -> saved = false;
-
- v -> reg = NULL;
-
- return v;
-}
-
-
-/***************** Funktion: var_createwithspecialnumber **********************
-
- Erzeugt eine neue Variable des gew"unschten Typs, dabei wird aber als
- Kennzeichnungsnummer eine vorgegebene Zahl verwendet (das brauche ich
- um die lokalen Java-Variablen mit der Nummer des ihres Slots zu
- kennzeichnen).
-
-******************************************************************************/
-
-static varid var_createwithspecialnumber(u2 type, u4 num)
-{
- varinfo *v = var_create (type);
- varnum--;
- v -> number = num;
- return v;
-}
-
-
-/*************** Funktion: var_makesaved **************************************
-
- Kennzeichnet eine Variable daf"ur, dass sie bei Methodenaufrufen nicht
- zerst"ort werden darf.
-
-******************************************************************************/
-
-static void var_makesaved (varid v)
-{
- v -> saved = true;
- v -> reg = NULL;
-}
-
-
-/*************** Funktion: var_proposereg *************************************
-
- Macht dem Regiserallokator einen Vorschlag, mit welchem Register
- eine Variable belegt werden sollte (bei Methodenaufrufen k"onnen so
- viele Umlade-Befehle in die Argumentregister vermieden werden).
- Aber: Die Anforderung, dass ein Register gesichert sein soll, hat auf
- jeden Fall Priorit"at "uber so einen Vorschlag.
-
-******************************************************************************/
-
-static void var_proposereg (varid v, reginfo *r)
-{
- if (v -> saved) return;
-
- v -> reg = r;
-}
-
-
-/******************** Funktion: var_makecopy **********************************
-
- kennzeichnet eine Variable daf"ur, dass sie nur eine Kopie einer anderen
- Variable enth"alt.
-
-******************************************************************************/
-
-static void var_makecopy (varid original, varid copy)
-{
- list_addlast (&(original->copies), copy);
- copy -> original = original;
-
- list_remove (&vars, copy);
- list_addlast (&copiedvars, copy);
-}
-
-
-/******************** Funktion: var_unlinkcopy ********************************
-
- eine Variable, die bis jetzt in der Liste der Kopien eingetragen
- war, wird wieder auf normalen Zustand gebracht.
-
-******************************************************************************/
-
-static void var_unlinkcopy (varid copy)
-{
- list_remove (&(copy->original->copies), copy);
- copy -> original = copy;
-
- list_remove (&copiedvars, copy);
- list_addlast (&vars, copy);
-}
-
-
-/******************* Funktion: var_isoriginal *********************************
-
- Liefert true, wenn die Variable selber das Original ist, und keine
- Kopie einer anderen Variablen (das heisst, wenn sie nicht in der Liste
- der Kopien eingetragen ist)
-
-******************************************************************************/
-
-static bool var_isoriginal (varid copy)
-{
- return (copy -> original == copy) ? true : false;
-}
-
-
-/******************* Funktion: var_findoriginal *******************************
-
- Sucht zu einer Variablen das Original (wenn die Variable eine Kopie ist),
- oder gibt die Variable selbst zur"uck (im anderen Fall).
-
-******************************************************************************/
-
-static varid var_findoriginal (varid v)
-{
- return v->original;
-}
-
-
-/******************* Funktion: var_nextcopy ***********************************
-
- Gibt die erste noch eingetragene Kopie einer Variablen zur"uck.
- (oder NILL, wenn die Variable keine Kopien hat)
-
-******************************************************************************/
-
-static varid var_nextcopy (varid original)
-{
- return list_first (&original->copies);
-}
-
-
-/******************* Funktion: var_nextcopiedvar ******************************
-
- Gibt die erste "uberhaupt noch vorhandene Variable zu"uck, die eine
- Kopie irgendeiner anderen Variablen ist.
-
-******************************************************************************/
-
-static varid var_nextcopiedvar ()
-{
- return list_first (&copiedvars);
-}
-
-
-
-/*********************** Funktion: var_isactive *******************************
-
- Lieftert true, wenn die Variable gerade aktiviert ist (d.h., wenn
- irgendwann vorher 'var_activate' aufgerufen wurde)
-
-******************************************************************************/
-
-static bool var_isactive (varinfo *v)
-{
- return v->active;
-}
-
-
-/******************** Funktion: var_activate **********************************
-
- Aktiviert eine Variable, d.h. sie wird in die Liste der aktiven
- Variablen eingetragen.
-
-******************************************************************************/
-
-static void var_activate (varinfo *v)
-{
- list_remove (&vars, v);
- list_addlast (&activevars, v);
- v -> active = true;
-}
-
-
-/******************** Funktion: var_deactivate ********************************
-
- Deaktiviert eine Variable (Gegenst"uck zu var_activate)
-
-******************************************************************************/
-
-static void var_deactivate (varinfo *v)
-{
- list_remove (&activevars, v);
- list_addlast (&vars, v);
- v -> active = false;
-}
-
-
-/****************** Funktion: var_nextactive **********************************
-
- Liefert die erste noch aktivierte Variable
-
-******************************************************************************/
-
-static varinfo *var_nextactive ()
-{
- return list_first (&activevars);
-}
-
-
-
-/**************************** Funktion: var_display **************************
-
- Gibt eine abdruckbare Darstellung einer Variablen aus.
- (nur zu Debug-Zwecken)
-
-*****************************************************************************/
-
-static void var_display (varinfo *v)
-{
- if (v==NOVAR) {
- printf ("_ ");
- return;
- }
-
- switch (v->type) {
- case TYPE_INT: printf ("I"); break;
- case TYPE_LONG: printf ("L"); break;
- case TYPE_FLOAT: printf ("F"); break;
- case TYPE_DOUBLE: printf ("D"); break;
- case TYPE_ADDRESS: printf ("A"); break;
- default: printf ("?");
- }
- printf ("%d", v->number);
-
- if (v->reg) {
- printf ("(=");
- reg_display (v->reg);
- printf (")");
- }
- printf (" ");
-}
-
-
-/************************ Funktion: var_displayall **************************
-
- Gibt eine abdruckbare Darstellung aller Variablen aus.
- (nur zu Debug-Zwecken)
-
-*****************************************************************************/
-
-void var_displayall ()
-{
- varid v;
- int num=0;
- varid *sorted = DMNEW (varid, varnum);
-
- printf ("\n Types of all pseudo-variables:\n");
-
- for (num=0; num<varnum; num++) sorted[num] = NULL;
- v = list_first (&vars);
- while (v) {
- if (sorted[v->number]) {
- printf (" Local variable overlay: ");
- if (v->saved) printf ("* ");
- else printf (" ");
-
- var_display (v);
- printf ("\n");
- }
- else sorted[v->number] = v;
-
- v = list_next (&vars, v);
- }
-
-
- for (num=0; num<varnum; num++) {
- v = sorted[num];
- if (v) {
- if (v->saved) printf ("* ");
- else printf (" ");
-
- var_display (v);
- if (!v->reg) printf (" ");
-
- if ( (num%5) == 4 ) printf ("\n");
- else printf ("\t");
- }
- }
-
- printf ("\n");
-}
-
-
+++ /dev/null
-/****************************** compiler.c *************************************
-
- Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
-
- See file COPYRIGHT for information on usage and disclaimer of warranties
-
- Enth"alt die Funktionen mit denen die JavaVM - Methoden in Maschinencode
- "ubersetzt werden.
- Ein Aufruf vom compiler_compile "ubersetzt genau eine Methode.
- Alle in diesem Modul global definierten Variablen gelten nur f"ur
- eben diese gerade in der "Ubersetzung befindlichen Methode.
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
- Andreas Krall EMAIL: cacao@complang.tuwien.ac.at
- Changes: Mark Probst EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1997/10/22
-
-*******************************************************************************/
-
-#include "global.h"
-#include "compiler.h"
-
-#include "loader.h"
-#include "tables.h"
-#include "builtin.h"
-#include "native.h"
-#include "asmpart.h"
-
-#include "threads/thread.h" /* schani */
-
-
-/*************************** globale Schalter ********************************/
-
-/************************** now all in newcomp.c
-
-bool compileverbose = false;
-bool showstack = false;
-bool showintermediate = false;
-bool showdisassemble = false;
-int optimizelevel = 0;
-
-bool checkbounds = true;
-bool checknull = true;
-bool checkfloats = true;
-bool checksync = true;
-
-bool getcompilingtime = false;
-long int 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_pcmd_store = 0;
-int count_pcmd_store_comb = 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_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;
-
-********************/
-
-
-/************************ die Datentypen f"ur den Compiler *******************/
-
-#include "comp/defines.c"
-
-
-
-/******************* globale Variablen fuer den Compiler *********************/
-
-static methodinfo *method; /* Zeiger auf die Methodenstruktur */
-static utf *descriptor; /* Typbeschreibung der Methode */
-static classinfo *class; /* Klasse, in der die Methode steht */
-
-static s4 maxstack; /* maximale Gr"osse des JavaVM-Stacks */
-static s4 maxlocals; /* maximale Anzahl der JavaVM-Variablen */
-static u4 jcodelength; /* L"ange des JavaVM-Codes */
-static u1 *jcode; /* Zeiger auf den JavaVM-Code */
-static s4 exceptiontablelength; /* L"ange der Exceptiontable */
-static exceptiontable *extable; /* Zeiger auf die Exceptiontable */
-
-
-static list reachedblocks; /* Die Listenstruktur f"ur alle vom Parser
- bereits irgendwie erreichten Bl"ocke */
-static list finishedblocks; /* Die Listenstruktur f"ur alle Bl"ocke, die
- vom Parser bereits durchgearbeitet wurden */
-
-static basicblock **blocks; /* Eine Tabelle, so lang wie der JavaVM-Code, */
- /* in der an jeder Stelle, an der ein */
- /* Basicblock beginnt, der Zeiger auf die */
- /* ensprechende Basicblock-Struktur einge- */
- /* tragen ist. */
-
-static bool isleafmethod; /* true, wenn die Methode KEINE weiteren
- Unterprogramme mehr aufruft */
-
-static s4 mparamnum; /* Die Anzahl der Parameter (incl. this) */
-static u1 *mparamtypes; /* Die Typen aller Parameter (TYPE_INT,...) */
-static s4 mreturntype; /* R"uckgabewert der Methode */
-static varinfo **mparamvars; /* Die PCMD-Variablen, die die Parameter */
- /* zu Methodenstart enthalten sollen */
-
-
-static chain *uninitializedclasses;
- /* Eine Tabelle aller von der Methode */
- /* irgendwie ben"otigten Klassen, die */
- /* vor dem Start der Methode initialisiert */
- /* werden m"ussen (wenn sie es noch nicht */
- /* sind) */
-
-
-/************************ Subsysteme des Compilers ***************************/
-
-
-#include "comp/tools.c" /* ein paar n"utzliche Hilfsfunktionen */
-#include "comp/mcode.c" /* systemUNabh"angiger Teil des Codegenerators */
-
-#include "comp/reg.c" /* Registerverwaltung */
-#include "comp/var.c" /* Die Verwaltung der PCMD-Variblen */
-#include "comp/pcmd.c" /* Funktionen f"ur die Pseudocommandos (=PCMD) */
-#include "comp/local.c" /* Verwaltung der lokalen JavaVM-Variablen */
-#include "comp/stack.c" /* Verwaltung des JavaVM-Stacks */
-#include "comp/regalloc.c" /* Registerallokator */
-
-#include "gen.c" /* systemABh"angiger Codegenerator */
-#include "disass.c" /* Disassembler (nur zu Debug-Zwecken) */
-
-#include "comp/block.c" /* Verwaltung der basic blocks */
-#include "comp/parse.c" /* JavaVM - parser */
-
-
-
-
-/****** Die Dummy-Function (wird verwendet, wenn kein Code vorhanden ist) ****/
-
-static void* do_nothing_function()
-{
- return NULL;
-}
-
-
-
-
-/******************************************************************************/
-/*********************** eine Methode compilieren *****************************/
-/******************************************************************************/
-
-
-methodptr compiler_compile (methodinfo *m)
-{
- u4 i;
- basicblock *b;
- long int starttime=0,stoptime=0;
- long int dumpsize;
-
-
- /*** Wenn schon ein Maschinencode vorliegt, dann sofort beenden ****/
-
- count_jit_calls++; /* andi */
- if (m->entrypoint) return m->entrypoint;
-
- intsDisable(); /* schani */
-
-
- /**************** Marke fuer den DUMP-Speicher aufheben *****************/
-
- dumpsize = dump_size ();
-
-
- /**************** Zeit messen *******************************************/
-
- count_methods++; /* andi */
- if (getcompilingtime) starttime=getcputime();
-
- /*** Meldung ausgeben. Wenn kein JavaVM-Code vorhanden ist, beenden ****/
-
- if (m->jcode) {
- 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 ();
- }
- }
- else {
- 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(); /* schani */
- return (methodptr) do_nothing_function;
- }
-
-
- /*********** Initialisieren der Variablen und Subsysteme *****************/
-
- isleafmethod = true; /* bis sich das Gegenteil herausstellt */
-
- method = m;
- descriptor = m->descriptor;
- class = m->class;
-
- maxstack = m->maxstack;
- maxlocals = m->maxlocals;
- jcodelength = m->jcodelength;
- jcode = m->jcode;
- count_tryblocks += (exceptiontablelength = m->exceptiontablelength);
- extable = m->exceptiontable;
-
-#ifdef STATISTICS
- count_javacodesize += jcodelength + 18;
- count_javaexcsize += exceptiontablelength * 8;
-#endif
-
- list_init (&reachedblocks, OFFSET(basicblock, linkage) );
- list_init (&finishedblocks, OFFSET(basicblock, linkage) );
-
- blocks = DMNEW (basicblock*, jcodelength);
- for (i=0; i<jcodelength; i++) blocks[i] = NULL;
-
-
- descriptor2types (descriptor, (m->flags & ACC_STATIC) != 0,
- &mparamnum, &mparamtypes, &mreturntype);
- m->paramcount = mparamnum;
- m->returntype = mreturntype;
- mparamvars = DMNEW (varid, mparamnum);
-
- reg_init ();
- mcode_init ();
- var_init();
- local_init();
-
- uninitializedclasses = chain_new();
- /* aktuelle Klasse zur Liste der m"oglicherweise zu
- initialisierenden Klassen dazugeben */
- compiler_addinitclass (m->class);
-
-
- /************************ Compilieren ************************/
-
- /* Fuer jedes Sprungziel einen eigenen Block erzeugen */
- block_firstscann ();
-
- /* Den ersten Block als erreicht markieren, der Stack ist leer */
- stack_init();
- subroutine_set(NULL);
- block_reach ( block_find(0) );
-
- /* Alle schon erreichten Bl"ocke durchgehen und fertig machen */
- while ( (b = list_first (&reachedblocks)) ) {
- list_remove (&reachedblocks, b);
- list_addlast (&finishedblocks, b);
- b -> finished = true;
-
- pcmd_init ( &(b->pcmdlist) );
- parse (b);
- }
-
- input_args_prealloc ();
-
- /* F"ur alle Bl"ocke die Registerbelegung durchfuehren */
- b = list_first (&finishedblocks);
- while (b) {
- regalloc (b);
- b = list_next (&finishedblocks, b);
- }
-
-
- /* Registerbelegung fuer die lokalen JAVA-Variablen */
- local_regalloc ();
-
-
-
-
- /**************** Maschinencode generieren **********************/
-
- gen_computestackframe ();
- gen_header ();
-
-
- for (i=0; i<jcodelength; i++) {
- b = blocks[i];
- if (b) if (b->reached) block_genmcode (b);
- }
-
- b = list_first (&finishedblocks);
- while (b) {
- if (b->type != BLOCKTYPE_JAVA) block_genmcode (b);
- b = list_next (&finishedblocks, b);
- }
-
-
- mcode_finish ();
-
-
- /*********** Zwischendarstellungen auf Wunsch ausgeben **********/
-
- if (showintermediate) {
- printf ("Leaf-method: %s\n", isleafmethod ? "YES":"NO");
- printf ("Parameters: ");
- for (i=0; i<mparamnum; i++) var_display (mparamvars[i]);
- printf ("\n");
- printf ("Max locals: %d\n", (int) maxlocals);
- printf ("Max stack: %d\n", (int) maxstack);
-
- for (i=0; i<jcodelength; i++) {
- b = blocks[i];
- if (b) if (b->reached) block_display (b);
- }
- b = list_first (&finishedblocks);
- while (b) {
- if (b->type != BLOCKTYPE_JAVA) block_display (b);
- b = list_next (&finishedblocks, b);
- }
-
- var_displayall();
- fflush (stdout);
- }
-
- if (showdisassemble) {
- dseg_display ();
- disassemble ( (void*) (m->mcode + dseglen), mcodelen);
- fflush (stdout);
- }
-
-
-
- /***************** Dump-Speicher zurueckgeben *************/
-
- dump_release (dumpsize);
-
-
- /******************* Zeit messen **************************/
-
- if (getcompilingtime) {
- stoptime = getcputime();
- compilingtime += (stoptime-starttime);
- }
-
- /******** Alle Klassen initialisieren, die gebraucht wurden *******/
-
- {
- chain *u = uninitializedclasses; /* wegen reentrant-F"ahigkeit */
- classinfo *c; /* d"urfen ab hier keine */
- /* globalen Variablen verwendet */
- while ( (c = chain_first(u)) ) { /* werden */
- chain_remove (u);
-
- class_init (c); /* ruft unter Umst"anden wieder */
- /* den Compiler auf */
- }
- chain_free (u);
- }
-
- intsRestore(); /* schani */
-
-
-
- /****** Return pointer to the methods entry point **********/
-
- return m -> entrypoint;
-
-}
-
-
-
-/***************** Funktionen zum Initialisieren und Terminieren *************/
-
-void compiler_init ()
-{
- u4 i;
-
- has_ext_instr_set = ! has_no_x_instr_set();
-
- for (i=0; i<256;i++) stdopdescriptors[i]=NULL;
-
- for (i=0; i<sizeof(stdopdescriptortable)/sizeof(stdopdescriptor); i++) {
-
- if (stdopdescriptortable[i].isfloat && checkfloats) {
- stdopdescriptortable[i].supported = false;
- }
-
- stdopdescriptors[stdopdescriptortable[i].opcode] =
- &(stdopdescriptortable[i]);
- }
-}
-
-
-void compiler_close()
-{
- reg_close ();
- mcode_close();
-}
-
+++ /dev/null
-/* -*- mode: c; tab-width: 4; c-basic-offset: 4 -*- */
-/****************************** compiler.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 Alpha processor.
- This module generates Alpha machine code for a sequence of
- pseudo commands (PCMDs).
-
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
- Changes: Andreas Krall EMAIL: cacao@complang.tuwien.ac.at
-
- Last Change: 1997/10/22
-
-*******************************************************************************/
-
-/************** Compiler-switches (werden von main gesetzt) *****************/
-
-
-extern bool compileverbose;
-extern bool showstack;
-extern bool showdisassemble;
-extern bool showddatasegment;
-extern bool showintermediate;
-extern int optimizelevel;
-
-extern bool checkbounds;
-extern bool checknull;
-extern bool checkfloats;
-extern bool checksync;
-
-extern int has_ext_instr_set;
-
-extern bool getcompilingtime;
-extern long int compilingtime;
-
-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_pcmd_store;
-extern int count_pcmd_store_comb;
-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_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;
-
-
-/******************************* Prototypes *********************************/
-
-methodptr compiler_compile (methodinfo *m);
-
-void compiler_init ();
-void compiler_close ();
-
-u1 *oldcreatenativestub (functionptr f, methodinfo *m);
-
-/*
-u1 *createcompilerstub (methodinfo *m);
-
-void removecompilerstub (u1 *stub);
-void removenativestub (u1 *stub);
-*/
-
--- /dev/null
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* 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
+
+/* Define if mman.h defines MAP_ANONYMOUS */
+#undef HAVE_MAP_ANONYMOUS
+
+#undef TRACE_ARGS_NUM
+
+/* Define to include thread support */
+#undef USE_THREADS
+#undef EXTERNAL_OVERFLOW
+#undef DONT_FREE_FIRST
+
+/* sysdep */
+#undef SYSDEP_DIR
+
+#undef OLD_COMPILER
+#undef USE_CODEMMAP
+
+#undef USE_BOEHM
+
+/* Define if you have the getcwd function. */
+#undef HAVE_GETCWD
+
+/* Define if you have the getpagesize function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the gettimeofday function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the mkdir function. */
+#undef HAVE_MKDIR
+
+/* Define if you have the mktime function. */
+#undef HAVE_MKTIME
+
+/* Define if you have the select function. */
+#undef HAVE_SELECT
+
+/* Define if you have the socket function. */
+#undef HAVE_SOCKET
+
+/* Define if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <ndir.h> header file. */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <sys/dir.h> header file. */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define if you have the <sys/ndir.h> header file. */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* 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
+
+/* Version number of package */
+#undef VERSION
+
--- /dev/null
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_default_prefix=/usr/local/cacao
+ac_help="$ac_help
+ --enable-threads enable threads support"
+ac_help="$ac_help
+ --with-gc[=ARG] use garbage collector [gc2,gc1,boehm]"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+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"
+ ac_prev=
+ continue
+ fi
+
+ 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
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ 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" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ 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=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ 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'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -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 ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ 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" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ 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" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ 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)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ 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-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-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ 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" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ 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=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ 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.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ 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-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" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ 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
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+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
+
+# 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
+ 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
+
+# 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
+
+# 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=jit.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_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=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ 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-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=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+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.
+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 $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:556: 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
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# 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 $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:589: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+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
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ 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"
+ fi
+fi
+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_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:642: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "$*" != "X $srcdir/configure conftestfile" \
+ && test "$*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # 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 "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
+ )
+then
+ # Ok.
+ :
+else
+ { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+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"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ 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:699: 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 > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+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 conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+PACKAGE=cacao
+
+VERSION=0.40
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
+echo "configure:745: checking for working aclocal" >&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 --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal
+ echo "$ac_t""found" 1>&6
+else
+ ACLOCAL="$missing_dir/missing aclocal"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:758: 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 "$ac_t""found" 1>&6
+else
+ AUTOCONF="$missing_dir/missing autoconf"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake""... $ac_c" 1>&6
+echo "configure:771: checking for working automake" >&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 --version) < /dev/null > /dev/null 2>&1; then
+ AUTOMAKE=automake
+ echo "$ac_t""found" 1>&6
+else
+ AUTOMAKE="$missing_dir/missing automake"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:784: 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 "$ac_t""found" 1>&6
+else
+ AUTOHEADER="$missing_dir/missing autoheader"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:797: 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 "$ac_t""found" 1>&6
+else
+ MAKEINFO="$missing_dir/missing makeinfo"
+ echo "$ac_t""missing" 1>&6
+fi
+
+
+
+
+
+
+
+
+
+ASMPART="asmpart.S"
+case "$host_cpu" in
+alpha* )
+ SYSDEP_DIR="alpha"
+ CFLAGS="-mieee -O0 -g3 -D__ALPHA__"
+ COMPILER_OBJECTS=""
+ cat >> confdefs.h <<\EOF
+#define TRACE_ARGS_NUM 6
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define USE_CODEMMAP 1
+EOF
+
+ ;;
+
+mips* )
+ SYSDEP_DIR="mips"
+ ASMPART="asmpart.s"
+ CFLAGS="-64 -O2 -OPT:Olimit=0 -g -DMAP_ANONYMOUS=0 -woff 1110,1164,1515 -D__MIPS__"
+ LIBS="-lelfutil"
+ COMPILER_OBJECTS=""
+ cat >> confdefs.h <<\EOF
+#define TRACE_ARGS_NUM 8
+EOF
+
+ ;;
+
+i386* | i486* | i586* | i686* )
+ SYSDEP_DIR="i386"
+ CFLAGS="-O0 -g3 -D__I386__"
+ COMPILER_OBJECTS="i386/libdisass.a"
+ cat >> confdefs.h <<\EOF
+#define TRACE_ARGS_NUM 8
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define USE_CODEMMAP 1
+EOF
+
+ ;;
+
+x86_64* )
+ SYSDEP_DIR="x86_64"
+ CFLAGS="-O0 -g3 -D__X86_64__"
+ COMPILER_OBJECTS="x86_64/libdisass.a"
+ cat >> confdefs.h <<\EOF
+#define TRACE_ARGS_NUM 6
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define USE_CODEMMAP 1
+EOF
+
+ ;;
+
+powerpc* | ppc* )
+ SYSDEP_DIR="powerpc"
+ CFLAGS="-O2 -g -DMAP_ANONYMOUS=0 -no-cpp-precomp"
+ COMPILER_OBJECTS="powerpc/libdisass.a"
+ cat >> confdefs.h <<\EOF
+#define TRACE_ARGS_NUM 8
+EOF
+
+ ;;
+
+sparc* | * )
+ { echo "configure: error: $target systems are not supported at this time" 1>&2; exit 1; }
+ ;;
+esac
+
+
+
+
+cat >> confdefs.h <<EOF
+#define SYSDEP_DIR "$SYSDEP_DIR"
+EOF
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:900: 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_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"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:930: 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
+ 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 $# -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
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ 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:981: 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_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"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1013: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+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 1024 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1029: \"$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
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ 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:1055: 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:1060: 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:1069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+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:1088: 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
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+# 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:1122: 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
+ 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"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:1150: 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 > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+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 conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
+echo "configure:1178: 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_save_LIBS="$LIBS"
+LIBS="-lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1186 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* 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; }
+EOF
+if { (eval echo configure:1197: \"$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"
+
+fi
+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
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:1230: 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 1235 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:1243: \"$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*
+fi
+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 $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:1268: 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 1276 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* 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; }
+EOF
+if { (eval echo configure:1287: \"$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"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="$LIBS -ldir"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:1309: 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 1317 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* 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; }
+EOF
+if { (eval echo configure:1328: \"$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"
+
+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
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1351: 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 eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # 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.
+ cat > conftest.$ac_ext <<EOF
+#line 1366 "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:1372: \"$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 "$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 1383 "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:1389: \"$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 "$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 1400 "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:1406: \"$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 "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1431: 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 <<EOF
+#line 1436 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1444: \"$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 "$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*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1461 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+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 <<EOF
+#line 1479 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+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
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1500 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#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); }
+
+EOF
+if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+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
+EOF
+
+fi
+
+for ac_hdr in fcntl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1538: 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 1543 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1548: \"$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
+rm -f conftest*
+fi
+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_hdr in sys/time.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1578: 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 1583 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1588: \"$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
+rm -f conftest*
+fi
+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_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1618: 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 1623 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1628: \"$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
+rm -f conftest*
+fi
+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_hdr in sys/ioctl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1658: 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 1663 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1668: \"$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
+rm -f conftest*
+fi
+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 $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1696: 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 1701 "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;
+}
+{ /* 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:1750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+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 $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1771: 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 <<EOF
+#line 1778 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:1785: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:1811: 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 <<EOF
+#line 1816 "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
+ rm -rf conftest*
+ ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+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
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:1844: 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 <<EOF
+#line 1849 "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
+ rm -rf conftest*
+ ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+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
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1877: 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 <<EOF
+#line 1882 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:1891: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+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
+EOF
+
+fi
+
+echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+echo "configure:1912: 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 <<EOF
+#line 1917 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <time.h>
+int main() {
+struct tm *tp; tp->tm_sec;
+; return 0; }
+EOF
+if { (eval echo configure:1925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_tm=time.h
+else
+ 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*
+fi
+
+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
+EOF
+
+fi
+
+
+if test $ac_cv_prog_gcc = yes; then
+ echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
+echo "configure:1948: 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 <<EOF
+#line 1954 "configure"
+#include "confdefs.h"
+#include <sgtty.h>
+Autoconf TIOCGETP
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ 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 <<EOF
+#line 1972 "configure"
+#include "confdefs.h"
+#include <termio.h>
+Autoconf TCGETA
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "$ac_pattern" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+
+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 $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:1994: 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_clean=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2002 "configure"
+#include "confdefs.h"
+
+main()
+{
+ char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+ exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}
+
+EOF
+if { (eval echo configure:2012: \"$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
+
+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_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2033: 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 2038 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2043: \"$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
+rm -f conftest*
+fi
+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
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2072: 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 2077 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* 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();
+
+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
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2100: \"$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 "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+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 $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:2125: 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 <<EOF
+#line 2133 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ 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 filesystem buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ 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>
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure 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 */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+ 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);
+}
+
+EOF
+if { (eval echo configure:2273: \"$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 "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+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
+EOF
+
+fi
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:2296: 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 <<EOF
+#line 2301 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:2318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+for ac_func in getcwd gettimeofday mkdir mktime select socket
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2339: 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 2344 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* 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();
+
+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
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2367: \"$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 "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+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 $ac_n "checking whether MAP_FAILED is defined""... $ac_c" 1>&6
+echo "configure:2394: 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 2399 "configure"
+#include "confdefs.h"
+#include <sys/mman.h>
+ #ifdef MAP_FAILED
+ yes
+ #endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ 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 "$ac_t""$ac_cv_map_failed" 1>&6
+
+ echo $ac_n "checking whether MAP_ANONYMOUS is defined""... $ac_c" 1>&6
+echo "configure:2421: 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 <<EOF
+#line 2426 "configure"
+#include "confdefs.h"
+#include <sys/mman.h>
+ #ifdef MAP_ANONYMOUS
+ yes
+ #endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ 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 "$ac_t""$ac_cv_map_anonymous" 1>&6
+
+ if test $ac_cv_map_failed = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MAP_FAILED 1
+EOF
+
+ fi
+
+ if test $ac_cv_map_anonymous = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MAP_ANONYMOUS 1
+EOF
+
+ fi
+fi
+
+
+
+# Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+ enableval="$enable_threads"
+ :
+fi
+
+# Check whether --with-gc or --without-gc was given.
+if test "${with_gc+set}" = set; then
+ withval="$with_gc"
+ :
+fi
+
+
+echo $ac_n "checking whether to include threads support""... $ac_c" 1>&6
+echo "configure:2478: checking whether to include threads support" >&5
+if test x"$enable_threads" = "xno"; then
+ echo "$ac_t""no" 1>&6
+else
+ echo "$ac_t""yes" 1>&6
+
+ cat >> confdefs.h <<\EOF
+#define USE_THREADS 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define EXTERNAL_OVERFLOW 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define DONT_FREE_FIRST 1
+EOF
+
+
+ LIBTHREAD="libthreads.a"
+ THREAD_OBJ="threads/libthreads.a"
+
+
+fi
+
+echo $ac_n "checking which garbage collector to use""... $ac_c" 1>&6
+echo "configure:2504: checking which garbage collector to use" >&5
+case "$with_gc" in
+gc1 )
+ echo "$ac_t""old garbage collector" 1>&6
+ GC_OBJ="mm/libmm_old.a"
+ ;;
+gc2 )
+ echo "$ac_t""new garbage collector" 1>&6
+ GC_OBJ="mm/libmm_new.a"
+ ;;
+boehm | "" )
+ echo "$ac_t""Boehm garbage collector" 1>&6
+ GC_OBJ="mm/libboehm.a libgc.a"
+ if test ! -e libgc.a; then
+ { echo "configure: error: libgc.a not found, see README.boehm" 1>&2; exit 1; }
+ fi
+ cat >> confdefs.h <<\EOF
+#define USE_BOEHM 1
+EOF
+
+ BOEHM_LIB="libboehm.a"
+ ;;
+* )
+ { echo "configure: error: Invalid GC" 1>&2; exit 1; }
+ ;;
+esac
+
+
+
+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. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# 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.
+#
+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 \
+ -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
+ 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}'
+
+# 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[ ]*=[^:]*$/d'
+fi
+
+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}
+
+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.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ 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
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "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 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%@ASMPART@%$ASMPART%g
+s%@SYSDEP_DIR@%$SYSDEP_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%@GC_OBJ@%$GC_OBJ%g
+s%@BOEHM_LIB@%$BOEHM_LIB%g
+
+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
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ 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
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${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 "}
+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
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # 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
+ ac_dir_suffix= ac_dots=
+ fi
+
+ 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_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ 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
+
+ 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*
+
+# 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
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ 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
+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
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+
+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
+
case "$host_cpu" in
alpha* )
SYSDEP_DIR="alpha"
- CFLAGS="-mieee -O2 -g3 -D__ALPHA__"
- COMPILER_OBJECTS="compiler.o"
- AC_DEFINE(OLD_COMPILER)
+ CFLAGS="-mieee -O0 -g3 -D__ALPHA__"
+ COMPILER_OBJECTS=""
AC_DEFINE(TRACE_ARGS_NUM, 6)
AC_DEFINE(USE_CODEMMAP)
;;
;;
sparc* | * )
- AC_MSG_ERROR($target systems are not supported at this time) ;;
-
+ AC_MSG_ERROR($target systems are not supported at this time)
+ ;;
esac
AC_SUBST(COMPILER_OBJECTS)
dnl garbage collector version
AC_MSG_CHECKING(which garbage collector to use)
case "$with_gc" in
-boehm )
- AC_MSG_RESULT(Boehm garbage collector)
- GC_OBJ="mm/libboehm.a libgc.a"
- if test ! -e libgc.a; then
- AC_MSG_ERROR([libgc.a not found, see README.boehm])
- fi
- AC_DEFINE(USE_BOEHM)
- BOEHM_LIB=libboehm.a
- ;;
gc1 )
AC_MSG_RESULT(old garbage collector)
GC_OBJ="mm/libmm_old.a"
;;
-gc2 | "" )
+gc2 )
AC_MSG_RESULT(new garbage collector)
GC_OBJ="mm/libmm_new.a"
;;
+boehm | "" )
+ AC_MSG_RESULT(Boehm garbage collector)
+ GC_OBJ="mm/libboehm.a libgc.a"
+ if test ! -e libgc.a; then
+ AC_MSG_ERROR([libgc.a not found, see README.boehm])
+ fi
+ AC_DEFINE(USE_BOEHM)
+ BOEHM_LIB="libboehm.a"
+ ;;
* )
AC_MSG_ERROR(Invalid GC)
;;
mips/Makefile \
i386/Makefile \
x86_64/Makefile \
- powerpc/Makefile \
+ powerpc/Makefile \
nat/Makefile \
doc/Makefile \
- comp/Makefile \
narray/Makefile \
tst/Makefile \
tst/kaffe/Makefile \
Changes: Mark Probst EMAIL: cacao@complang.tuwien.ac.at
Philipp Tomsich EMAIL: cacao@complang.tuwien.ac.at
- Last Change: $Id: headers.c 364 2003-06-13 13:55:35Z twisti $
+ Last Change: $Id: headers.c 483 2003-10-14 17:08:38Z twisti $
*******************************************************************************/
/************************ global variables **********************/
java_objectheader *exceptionptr; /* schani */
-int newcompiler = true;
bool verbose = false;
static chain *nativemethod_chain; /* chain with native methods */
Authors: Andreas Krall EMAIL: cacao@complang.tuwien.ac.at
Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
- Last Change: 1997/11/05
+ Last Change: $Id: jit.c 483 2003-10-14 17:08:38Z twisti $
*******************************************************************************/
}
-#ifdef OLD_COMPILER
-extern bool newcompiler;
-methodptr compiler_compile (methodinfo *m); /* compile method with old compiler*/
-#endif
-
-
/* jit_compile *****************************************************************
jit_compile, new version of compiler, translates one method to machine code
int cnt;
-
-#ifdef OLD_COMPILER
- if (!newcompiler) {
- return compiler_compile(m);
- }
-#endif
-
/* if method has been already compiled return immediately */
count_jit_calls++;
#include "tables.h"
#include "builtin.h"
#include "jit.h"
-#ifdef OLD_COMPILER
-#include "compiler.h"
-#endif
#include "asmpart.h"
#ifdef USE_BOEHM
/* global variables ***********************************************************/
-extern bool newcompiler; /* true if new compiler is used */
bool opt_rt = false; /* true if RTA parse should be used RT-CO */
bool opt_xta = false; /* true if XTA parse should be used XTA-CO */
bool opt_vta = false; /* true if VTA parse should be used VTA-CO */
functionptr f = native_findfunction
(c->name, m->name, m->descriptor, (m->flags & ACC_STATIC) != 0);
if (f) {
-#ifdef OLD_COMPILER
- if (newcompiler)
-#endif
m -> stubroutine = createnativestub (f, m);
-#ifdef OLD_COMPILER
- else
- m -> stubroutine = oldcreatenativestub (f, m);
-#endif
}
}
blockInts = 0;
#endif
- exceptionptr = asm_calljavamethod (m, NULL,NULL,NULL,NULL);
+ exceptionptr = asm_calljavamethod(m, NULL, NULL, NULL, NULL);
#ifdef USE_THREADS
assert(blockInts == 0);
blockInts = b;
#endif
- if (exceptionptr) {
- printf ("#### Initializer of ");
- utf_display (c->name);
- printf (" has thrown: ");
- utf_display (exceptionptr->vftbl->class->name);
- printf ("\n");
- fflush (stdout);
- }
+ if (exceptionptr) {
+ printf("#### Initializer of ");
+ utf_display(c->name);
+ printf(" has thrown: ");
+ utf_display(exceptionptr->vftbl->class->name);
+ printf("\n");
+ fflush(stdout);
+ }
if (initverbose) {
- sprintf (logtext, "Finished initializer for class: ");
- utf_sprint (logtext+strlen(logtext), c->name);
- dolog ();
+ sprintf(logtext, "Finished initializer for class: ");
+ utf_sprint(logtext+strlen(logtext), c->name);
+ dolog();
}
if (c->name == utf_systemclass) {
Mark Probst EMAIL: cacao@complang.tuwien.ac.at
Philipp Tomsich EMAIL: cacao@complang.tuwien.ac.at
- Last Change: $Id: main.c 475 2003-10-04 18:59:36Z stefan $
+ Last Change: $Id: main.c 483 2003-10-14 17:08:38Z twisti $
*******************************************************************************/
#include "tables.h"
#include "loader.h"
#include "jit.h"
-#ifdef OLD_COMPILER
-#include "compiler.h"
-#endif
#include "asmpart.h"
#include "builtin.h"
#include "threads/thread.h"
bool compileall = false;
-int newcompiler = true;
bool verbose = false;
#ifdef NEW_GC
bool new_gc = false;
#define OPT_SIGNATURE 18
#define OPT_SHOW 19
#define OPT_ALL 20
-#ifdef OLD_COMPILER
-#define OPT_OLD 21
-#endif
#ifdef NEW_GC
#define OPT_GC1 22
#define OPT_GC2 23
{"sig", true, OPT_SIGNATURE},
{"s", true, OPT_SHOW},
{"all", false, OPT_ALL},
-#ifdef OLD_COMPILER
- {"old", false, OPT_OLD},
-#endif
#ifdef NEW_GC
{"gc1", false, OPT_GC1},
{"gc2", false, OPT_GC2},
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");
-#ifdef OLD_COMPILER
- printf (" -old ................. use old JIT compiler\n");
-#endif
#ifdef NEW_GC
printf (" -gc1 ................. use the old garbage collector (default)\n");
printf (" -gc2 ................. use the new garbage collector\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");
-#ifdef OLD_COMPILER
- printf (" s(tack) ....... show stack for every javaVM-command\n");
-#endif
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 (" -rt .................. use rapid type analysis\n");
+ printf (" -xta ................. use x type analysis\n");
+ printf (" -vta ................. use variable type analysis\n");
}
for (i = 0; i < c -> methodscount; i++) {
m = &(c->methods[i]);
if (m->jcode) {
-#ifdef OLD_COMPILER
- if (newcompiler)
-#endif
- (void) jit_compile(m);
-#ifdef OLD_COMPILER
- else
- (void) compiler_compile(m);
-#endif
+ (void) jit_compile(m);
}
}
c = list_next (&linkedclasses, c);
loader_close because finalization occurs
here */
-#ifdef OLD_COMPILER
- compiler_close ();
-#endif
loader_close ();
tables_close ( literalstring_free );
makeinitializations = false;
break;
-#ifdef OLD_COMPILER
- case OPT_OLD:
- newcompiler = false;
- checknull = true;
- break;
-#endif
-
#ifdef NEW_GC
case OPT_GC2:
new_gc = true;
case 'd': showddatasegment=true; break;
case 'i': showintermediate=true; compileverbose=true; break;
case 'm': showmethods=true; break;
-#ifdef OLD_COMPILER
- case 's': showstack=true; compileverbose=true; break;
-#endif
case 'u': showutf=true; break;
default: print_usage();
exit(10);
tables_init();
heap_init(heapsize, heapstartsize, &dummy);
-#ifdef OLD_COMPILER
- compiler_init();
-#endif
jit_init();
loader_init();
m = class_findmethod(topclass,
utf_new_char(specificmethodname), NULL);
if (!m) panic ("Specific method not found");
-#ifdef OLD_COMPILER
- if (newcompiler)
-#endif
(void) jit_compile(m);
-#ifdef OLD_COMPILER
- else
- (void) compiler_compile(m);
-#endif
}
exit(0);
Mark Probst EMAIL: cacao@complang.tuwien.ac.at
Philipp Tomsich EMAIL: cacao@complang.tuwien.ac.at
- Last Change: $Id: cacao.c 475 2003-10-04 18:59:36Z stefan $
+ Last Change: $Id: cacao.c 483 2003-10-14 17:08:38Z twisti $
*******************************************************************************/
#include "tables.h"
#include "loader.h"
#include "jit.h"
-#ifdef OLD_COMPILER
-#include "compiler.h"
-#endif
#include "asmpart.h"
#include "builtin.h"
#include "threads/thread.h"
bool compileall = false;
-int newcompiler = true;
bool verbose = false;
#ifdef NEW_GC
bool new_gc = false;
#define OPT_SIGNATURE 18
#define OPT_SHOW 19
#define OPT_ALL 20
-#ifdef OLD_COMPILER
-#define OPT_OLD 21
-#endif
#ifdef NEW_GC
#define OPT_GC1 22
#define OPT_GC2 23
{"sig", true, OPT_SIGNATURE},
{"s", true, OPT_SHOW},
{"all", false, OPT_ALL},
-#ifdef OLD_COMPILER
- {"old", false, OPT_OLD},
-#endif
#ifdef NEW_GC
{"gc1", false, OPT_GC1},
{"gc2", false, OPT_GC2},
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");
-#ifdef OLD_COMPILER
- printf (" -old ................. use old JIT compiler\n");
-#endif
#ifdef NEW_GC
printf (" -gc1 ................. use the old garbage collector (default)\n");
printf (" -gc2 ................. use the new garbage collector\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");
-#ifdef OLD_COMPILER
- printf (" s(tack) ....... show stack for every javaVM-command\n");
-#endif
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 (" -rt .................. use rapid type analysis\n");
+ printf (" -xta ................. use x type analysis\n");
+ printf (" -vta ................. use variable type analysis\n");
}
for (i = 0; i < c -> methodscount; i++) {
m = &(c->methods[i]);
if (m->jcode) {
-#ifdef OLD_COMPILER
- if (newcompiler)
-#endif
- (void) jit_compile(m);
-#ifdef OLD_COMPILER
- else
- (void) compiler_compile(m);
-#endif
+ (void) jit_compile(m);
}
}
c = list_next (&linkedclasses, c);
loader_close because finalization occurs
here */
-#ifdef OLD_COMPILER
- compiler_close ();
-#endif
loader_close ();
tables_close ( literalstring_free );
makeinitializations = false;
break;
-#ifdef OLD_COMPILER
- case OPT_OLD:
- newcompiler = false;
- checknull = true;
- break;
-#endif
-
#ifdef NEW_GC
case OPT_GC2:
new_gc = true;
case 'd': showddatasegment=true; break;
case 'i': showintermediate=true; compileverbose=true; break;
case 'm': showmethods=true; break;
-#ifdef OLD_COMPILER
- case 's': showstack=true; compileverbose=true; break;
-#endif
case 'u': showutf=true; break;
default: print_usage();
exit(10);
tables_init();
heap_init(heapsize, heapstartsize, &dummy);
-#ifdef OLD_COMPILER
- compiler_init();
-#endif
jit_init();
loader_init();
m = class_findmethod(topclass,
utf_new_char(specificmethodname), NULL);
if (!m) panic ("Specific method not found");
-#ifdef OLD_COMPILER
- if (newcompiler)
-#endif
(void) jit_compile(m);
-#ifdef OLD_COMPILER
- else
- (void) compiler_compile(m);
-#endif
}
exit(0);
Changes: Mark Probst EMAIL: cacao@complang.tuwien.ac.at
Philipp Tomsich EMAIL: cacao@complang.tuwien.ac.at
- Last Change: $Id: headers.c 364 2003-06-13 13:55:35Z twisti $
+ Last Change: $Id: headers.c 483 2003-10-14 17:08:38Z twisti $
*******************************************************************************/
/************************ global variables **********************/
java_objectheader *exceptionptr; /* schani */
-int newcompiler = true;
bool verbose = false;
static chain *nativemethod_chain; /* chain with native methods */
#include "tables.h"
#include "builtin.h"
#include "jit.h"
-#ifdef OLD_COMPILER
-#include "compiler.h"
-#endif
#include "asmpart.h"
#ifdef USE_BOEHM
/* global variables ***********************************************************/
-extern bool newcompiler; /* true if new compiler is used */
bool opt_rt = false; /* true if RTA parse should be used RT-CO */
bool opt_xta = false; /* true if XTA parse should be used XTA-CO */
bool opt_vta = false; /* true if VTA parse should be used VTA-CO */
functionptr f = native_findfunction
(c->name, m->name, m->descriptor, (m->flags & ACC_STATIC) != 0);
if (f) {
-#ifdef OLD_COMPILER
- if (newcompiler)
-#endif
m -> stubroutine = createnativestub (f, m);
-#ifdef OLD_COMPILER
- else
- m -> stubroutine = oldcreatenativestub (f, m);
-#endif
}
}
blockInts = 0;
#endif
- exceptionptr = asm_calljavamethod (m, NULL,NULL,NULL,NULL);
+ exceptionptr = asm_calljavamethod(m, NULL, NULL, NULL, NULL);
#ifdef USE_THREADS
assert(blockInts == 0);
blockInts = b;
#endif
- if (exceptionptr) {
- printf ("#### Initializer of ");
- utf_display (c->name);
- printf (" has thrown: ");
- utf_display (exceptionptr->vftbl->class->name);
- printf ("\n");
- fflush (stdout);
- }
+ if (exceptionptr) {
+ printf("#### Initializer of ");
+ utf_display(c->name);
+ printf(" has thrown: ");
+ utf_display(exceptionptr->vftbl->class->name);
+ printf("\n");
+ fflush(stdout);
+ }
if (initverbose) {
- sprintf (logtext, "Finished initializer for class: ");
- utf_sprint (logtext+strlen(logtext), c->name);
- dolog ();
+ sprintf(logtext, "Finished initializer for class: ");
+ utf_sprint(logtext+strlen(logtext), c->name);
+ dolog();
}
if (c->name == utf_systemclass) {