From: sewardj Date: Wed, 21 Mar 2001 10:56:04 +0000 (+0000) Subject: [project @ 2001-03-21 10:56:04 by sewardj] X-Git-Tag: Approximately_9120_patches~2351 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=44f0f21f7e788f76bb766bab6560f5e8d09826ef;p=ghc-hetmet.git [project @ 2001-03-21 10:56:04 by sewardj] RTS support for the ugly tagToEnum# hack. Actually a very general thing -- just a bytecode unconditional jump, so we can do more general control-flow in BCOs. --- diff --git a/ghc/includes/Bytecodes.h b/ghc/includes/Bytecodes.h index 7e1cd04..2e7842e 100644 --- a/ghc/includes/Bytecodes.h +++ b/ghc/includes/Bytecodes.h @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------------- - * $Id: Bytecodes.h,v 1.5 2001/02/06 12:01:00 sewardj Exp $ + * $Id: Bytecodes.h,v 1.6 2001/03/21 10:56:04 sewardj Exp $ * * (c) The GHC Team, 1998-2000 * @@ -51,6 +51,7 @@ #define bci_ENTER 24 #define bci_RETURN 25 #define bci_STKCHECK 26 +#define bci_JMP 27 /* If a BCO definitely requires less than this many words of stack, diff --git a/ghc/rts/Disassembler.c b/ghc/rts/Disassembler.c index 7e33079..27b6848 100644 --- a/ghc/rts/Disassembler.c +++ b/ghc/rts/Disassembler.c @@ -5,8 +5,8 @@ * Copyright (c) 1994-1998. * * $RCSfile: Disassembler.c,v $ - * $Revision: 1.19 $ - * $Date: 2001/02/11 17:51:07 $ + * $Revision: 1.20 $ + * $Date: 2001/03/21 10:56:04 $ * ---------------------------------------------------------------------------*/ #ifdef DEBUG @@ -98,6 +98,13 @@ int disInstr ( StgBCO *bco, int pc ) fprintf(stderr, "\n"); pc += 2; break; + case bci_CASEFAIL: + fprintf(stderr, "CASEFAIL\n" ); + break; + case bci_JMP: + fprintf(stderr, "JMP to %d\n", instrs[pc]); + pc += 1; break; + case bci_TESTLT_I: fprintf(stderr, "TESTLT_I %d, fail to %d\n", literals[instrs[pc]], instrs[pc+1]); diff --git a/ghc/rts/Interpreter.c b/ghc/rts/Interpreter.c index 2f04ad9..ccbac4a 100644 --- a/ghc/rts/Interpreter.c +++ b/ghc/rts/Interpreter.c @@ -5,8 +5,8 @@ * Copyright (c) 1994-2000. * * $RCSfile: Interpreter.c,v $ - * $Revision: 1.20 $ - * $Date: 2001/02/15 14:30:07 $ + * $Revision: 1.21 $ + * $Date: 2001/03/21 10:56:04 $ * ---------------------------------------------------------------------------*/ #include "Rts.h" @@ -738,6 +738,12 @@ StgThreadReturnCode interpretBCO ( Capability* cap ) } } + case bci_JMP: { + /* BCO_NEXT modifies bciPtr, so be conservative. */ + int nextpc = BCO_NEXT; + bciPtr = nextpc; + goto nextInsn; + } case bci_CASEFAIL: barf("interpretBCO: hit a CASEFAIL");