Commit a3621909 authored by sewardj's avatar sewardj
Browse files

[project @ 2001-08-02 17:01:33 by sewardj]

C-side support for FFI in GHCi (foreign import only).
parent e0521ba8
/* -----------------------------------------------------------------------------
* $Id: Bytecodes.h,v 1.6 2001/03/21 10:56:04 sewardj Exp $
* $Id: Bytecodes.h,v 1.7 2001/08/02 17:01:33 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -52,6 +52,7 @@
#define bci_RETURN 25
#define bci_STKCHECK 26
#define bci_JMP 27
#define bci_CCALL 28
/* If a BCO definitely requires less than this many words of stack,
......
......@@ -5,8 +5,8 @@
* Copyright (c) 1994-1998.
*
* $RCSfile: Disassembler.c,v $
* $Revision: 1.21 $
* $Date: 2001/05/01 13:11:16 $
* $Revision: 1.22 $
* $Date: 2001/08/02 17:01:33 $
* ---------------------------------------------------------------------------*/
#ifdef DEBUG
......@@ -44,6 +44,10 @@ int disInstr ( StgBCO *bco, int pc )
StgInfoTable** itbls = (StgInfoTable**)(&itbls_arr->payload[0]);
switch (instrs[pc++]) {
case bci_CCALL:
fprintf(stderr, "CCALL marshaller at 0x%x\n",
literals[instrs[pc+1]] );
pc += 1; break;
case bci_STKCHECK:
fprintf(stderr, "STKCHECK %d\n", instrs[pc] );
pc += 1; break;
......
......@@ -5,8 +5,8 @@
* Copyright (c) 1994-2000.
*
* $RCSfile: Interpreter.c,v $
* $Revision: 1.24 $
* $Date: 2001/05/27 06:08:24 $
* $Revision: 1.25 $
* $Date: 2001/08/02 17:01:33 $
* ---------------------------------------------------------------------------*/
#include "Rts.h"
......@@ -761,7 +761,12 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
}
}
}
case bci_CCALL: {
int o_itbl = BCO_NEXT;
void(*marshall_fn)(void*) = BCO_LIT(o_itbl);
marshall_fn ( (void*)(& StackWord(0) ) );
goto nextInsn;
}
case bci_JMP: {
/* BCO_NEXT modifies bciPtr, so be conservative. */
int nextpc = BCO_NEXT;
......
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