Commit bd2fb1c5 authored by sewardj's avatar sewardj
Browse files

[project @ 1999-11-08 15:30:32 by sewardj]

Make Hugs evaluator work with new register table arrangements
arising from Simon's SMP work.
parent 14fef21d
......@@ -5,8 +5,8 @@
* Copyright (c) 1994-1998.
*
* $RCSfile: Assembler.c,v $
* $Revision: 1.13 $
* $Date: 1999/11/01 18:19:40 $
* $Revision: 1.14 $
* $Date: 1999/11/08 15:30:32 $
*
* This module provides functions to construct BCOs and other closures
* required by the bytecode compiler.
......@@ -49,9 +49,10 @@
#include "Bytecodes.h"
#include "Printer.h"
#include "Disassembler.h"
#include "Evaluator.h"
#include "StgMiscClosures.h"
#include "Storage.h"
#include "Schedule.h"
#include "Evaluator.h"
#define INSIDE_ASSEMBLER_C
#include "Assembler.h"
......
This diff is collapsed.
/* -----------------------------------------------------------------------------
* $Id: Evaluator.h,v 1.5 1999/10/22 15:58:25 sewardj Exp $
* $Id: Evaluator.h,v 1.6 1999/11/08 15:30:37 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -26,7 +26,7 @@
*
* ------------------------------------------------------------------------*/
extern StgThreadReturnCode enter ( StgClosurePtr obj );
extern StgThreadReturnCode enter ( Capability* cap, StgClosurePtr obj );
extern nat marshall ( char arg_ty, void* arg );
extern nat unmarshall ( char res_ty, void* res );
......
/* -----------------------------------------------------------------------------
* $Id: ForeignCall.c,v 1.10 1999/10/26 17:27:30 sewardj Exp $
* $Id: ForeignCall.c,v 1.11 1999/11/08 15:30:37 sewardj Exp $
*
* (c) The GHC Team 1994-1999.
*
......@@ -13,6 +13,7 @@
#include "RtsUtils.h" /* barf :-) */
#include "Assembler.h" /* for CFun stuff */
#include "Schedule.h"
#include "Evaluator.h"
#include "ForeignCall.h"
......@@ -227,7 +228,8 @@ static void universal_call_c_generic
int ccall ( CFunDescriptor* d,
void (*fun)(void),
StgBCO** bco,
char cc
char cc,
Capability* cap
)
{
double arg_vec [31];
......@@ -235,6 +237,7 @@ int ccall ( CFunDescriptor* d,
unsigned int* p;
int i;
unsigned long ul;
unsigned int token;
if (sizeof(int) != 4 || sizeof(double) != 8 || sizeof(float) != 4
|| (sizeof(void*) != 4 && sizeof(void*) != 8)
......@@ -311,7 +314,10 @@ int ccall ( CFunDescriptor* d,
}
PushPtr((StgPtr)(*bco));
SaveThreadState();
cap->rCurrentTSO->sp = MainRegTable.rSp;
cap->rCurrentTSO->su = MainRegTable.rSu;
cap->rCurrentTSO->splim = MainRegTable.rSpLim;
token = suspendThread(cap);
#if i386_TARGET_ARCH
if (cc == 'c')
......@@ -325,7 +331,11 @@ int ccall ( CFunDescriptor* d,
universal_call_c_generic (
d->num_args, (void*)arg_vec, argd_vec, fun );
#endif
LoadThreadState();
cap = resumeThread(token);
MainRegTable.rSp = cap->rCurrentTSO->sp;
MainRegTable.rSu = cap->rCurrentTSO->su;
MainRegTable.rSpLim = cap->rCurrentTSO->splim;
*bco=(StgBCO*)PopPtr();
/* INT, WORD, ADDR, STABLE don't need to do a word-size check
......
/* -----------------------------------------------------------------------------
* $Id: ForeignCall.h,v 1.7 1999/10/26 17:27:30 sewardj Exp $
* $Id: ForeignCall.h,v 1.8 1999/11/08 15:30:39 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -12,7 +12,8 @@ typedef int StablePtr;
extern int ccall ( CFunDescriptor* descriptor,
void (*fun)(void),
StgBCO** bco,
char callconv
char callconv,
Capability* cap
);
extern StgAddr createAdjThunk ( StgStablePtr stableptr,
......
/* -----------------------------------------------------------------------------
* $Id: Schedule.c,v 1.29 1999/11/02 17:19:16 simonmar Exp $
* $Id: Schedule.c,v 1.30 1999/11/08 15:30:39 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -149,7 +149,7 @@ void addToBlockedQueue ( StgTSO *tso );
static void schedule ( void );
static void initThread ( StgTSO *tso, nat stack_size );
static void interruptStgRts ( void );
void interruptStgRts ( void );
#ifdef SMP
pthread_mutex_t sched_mutex = PTHREAD_MUTEX_INITIALIZER;
......@@ -278,17 +278,13 @@ schedule( void )
break;
case ThreadEnterHugs:
#ifdef INTERPRETER
{
IF_DEBUG(scheduler,belch("schedule: entering Hugs"));
LoadThreadState();
/* CHECK_SENSIBLE_REGS(); */
{
StgClosure* c = (StgClosure *)Sp[0];
Sp += 1;
ret = enter(c);
}
SaveThreadState();
break;
{
StgClosure* c;
IF_DEBUG(scheduler,belch("schedule: entering Hugs"));
c = (StgClosure *)(cap->rCurrentTSO->sp[0]);
cap->rCurrentTSO->sp += 1;
ret = enter(cap,c);
break;
}
#else
barf("Panic: entered a BCO but no bytecode interpreter in this build");
......
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