Commit 4ee658a7 authored by sewardj's avatar sewardj
Browse files

[project @ 2001-08-09 11:19:16 by sewardj]

C-side FFI support for Byte/Ptr arrays.
parent 70b37ccb
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* $Id: Bytecodes.h,v 1.7 2001/08/02 17:01:33 sewardj Exp $ * $Id: Bytecodes.h,v 1.8 2001/08/09 11:19:16 sewardj Exp $
* *
* (c) The GHC Team, 1998-2000 * (c) The GHC Team, 1998-2000
* *
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#define bci_STKCHECK 26 #define bci_STKCHECK 26
#define bci_JMP 27 #define bci_JMP 27
#define bci_CCALL 28 #define bci_CCALL 28
#define bci_SWIZZLE 29
/* If a BCO definitely requires less than this many words of stack, /* If a BCO definitely requires less than this many words of stack,
don't include an explicit STKCHECK insn in it. The interpreter don't include an explicit STKCHECK insn in it. The interpreter
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* Copyright (c) 1994-1998. * Copyright (c) 1994-1998.
* *
* $RCSfile: Disassembler.c,v $ * $RCSfile: Disassembler.c,v $
* $Revision: 1.22 $ * $Revision: 1.23 $
* $Date: 2001/08/02 17:01:33 $ * $Date: 2001/08/09 11:19:16 $
* ---------------------------------------------------------------------------*/ * ---------------------------------------------------------------------------*/
#ifdef DEBUG #ifdef DEBUG
...@@ -44,9 +44,13 @@ int disInstr ( StgBCO *bco, int pc ) ...@@ -44,9 +44,13 @@ int disInstr ( StgBCO *bco, int pc )
StgInfoTable** itbls = (StgInfoTable**)(&itbls_arr->payload[0]); StgInfoTable** itbls = (StgInfoTable**)(&itbls_arr->payload[0]);
switch (instrs[pc++]) { switch (instrs[pc++]) {
case bci_SWIZZLE:
fprintf(stderr, "SWIZZLE stkoff %d by %d\n",
instrs[pc], (signed int)instrs[pc+1]);
pc += 2; break;
case bci_CCALL: case bci_CCALL:
fprintf(stderr, "CCALL marshaller at 0x%x\n", fprintf(stderr, "CCALL marshaller at 0x%x\n",
literals[instrs[pc+1]] ); literals[instrs[pc]] );
pc += 1; break; pc += 1; break;
case bci_STKCHECK: case bci_STKCHECK:
fprintf(stderr, "STKCHECK %d\n", instrs[pc] ); fprintf(stderr, "STKCHECK %d\n", instrs[pc] );
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* Copyright (c) 1994-2000. * Copyright (c) 1994-2000.
* *
* $RCSfile: Interpreter.c,v $ * $RCSfile: Interpreter.c,v $
* $Revision: 1.27 $ * $Revision: 1.28 $
* $Date: 2001/08/07 09:02:02 $ * $Date: 2001/08/09 11:19:16 $
* ---------------------------------------------------------------------------*/ * ---------------------------------------------------------------------------*/
#include "Rts.h" #include "Rts.h"
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
scheduler. Ie normally you don't want REFERENCE_INTERPRETER to be scheduler. Ie normally you don't want REFERENCE_INTERPRETER to be
defined. */ defined. */
/* #define REFERENCE_INTERPRETER */ #define REFERENCE_INTERPRETER
/* Gather stats about entry, opcode, opcode-pair frequencies. For /* Gather stats about entry, opcode, opcode-pair frequencies. For
tuning the interpreter. */ tuning the interpreter. */
...@@ -763,6 +763,12 @@ StgThreadReturnCode interpretBCO ( Capability* cap ) ...@@ -763,6 +763,12 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
} }
} }
} }
case bci_SWIZZLE: {
int stkoff = BCO_NEXT;
signed short n = (signed short)(BCO_NEXT);
StackWord(stkoff) += (W_)n;
goto nextInsn;
}
case bci_CCALL: { case bci_CCALL: {
StgInt tok; StgInt tok;
int o_itbl = BCO_NEXT; int o_itbl = BCO_NEXT;
......
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* $Id: Printer.c,v 1.43 2001/08/04 06:09:24 ken Exp $ * $Id: Printer.c,v 1.44 2001/08/09 11:19:16 sewardj Exp $
* *
* (c) The GHC Team, 1994-2000. * (c) The GHC Team, 1994-2000.
* *
...@@ -121,6 +121,12 @@ void printClosure( StgClosure *obj ) ...@@ -121,6 +121,12 @@ void printClosure( StgClosure *obj )
break; break;
} }
case FOREIGN:
fprintf(stderr,"FOREIGN(");
printPtr((StgPtr)( ((StgForeignObj*)obj)->data ));
fprintf(stderr,")\n");
break;
case IND: case IND:
fprintf(stderr,"IND("); fprintf(stderr,"IND(");
printPtr((StgPtr)stgCast(StgInd*,obj)->indirectee); printPtr((StgPtr)stgCast(StgInd*,obj)->indirectee);
...@@ -341,6 +347,7 @@ void printClosure( StgClosure *obj ) ...@@ -341,6 +347,7 @@ void printClosure( StgClosure *obj )
//barf("printClosure %d",get_itbl(obj)->type); //barf("printClosure %d",get_itbl(obj)->type);
fprintf(stderr, "*** printClosure: unknown type %d ****\n", fprintf(stderr, "*** printClosure: unknown type %d ****\n",
get_itbl(obj)->type ); get_itbl(obj)->type );
barf("printClosure %d",get_itbl(obj)->type);
return; return;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment