Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/runtime/include/ml-state.h
ViewVC logotype

Annotation of /sml/trunk/src/runtime/include/ml-state.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download) (as text)

1 : monnier 249 /* ml-state.h
2 :     *
3 :     * COPYRIGHT (c) 1992 by AT&T Bell Laboratories.
4 :     *
5 :     * This is the C view of the state of a ML computation.
6 :     */
7 :    
8 :     #ifndef _ML_STATE_
9 :     #define _ML_STATE_
10 :    
11 :     #ifndef _ML_BASE_
12 :     #include "ml-base.h"
13 :     #endif
14 :    
15 :     #ifndef _ML_ROOTS_
16 :     #include "ml-roots.h"
17 :     #endif
18 :    
19 :     #if (!defined(_CNTR_) && defined(ICOUNT))
20 :     #include "cntr.h"
21 :     #endif
22 :    
23 :     #define CALLEESAVE 3
24 :    
25 :    
26 :     /** The ML state vector **
27 :     */
28 :     /* typedef struct ml_state ml_state_t; */ /* defined in ml-base.h */
29 :     struct ml_state {
30 :     /* ML task info */
31 :     heap_t *ml_heap; /* The heap for this ML task */
32 :     # define ml_allocArena ml_heap->allocBase
33 :     # define ml_allocArenaSzB ml_heap->allocSzB
34 :     vproc_state_t *ml_vproc; /* the VProc that this is running on */
35 :    
36 :     /* ML registers */
37 :     ml_val_t *ml_allocPtr;
38 :     ml_val_t *ml_limitPtr;
39 :     ml_val_t ml_arg;
40 :     ml_val_t ml_cont;
41 :     ml_val_t ml_closure;
42 :     ml_val_t ml_linkReg;
43 :     ml_val_t ml_pc; /* Address of ML code to execute; when */
44 :     /* calling an ML frunction from C, this */
45 :     /* holds the same value as the linkReg. */
46 :     ml_val_t ml_exnCont;
47 :     ml_val_t ml_varReg;
48 :     ml_val_t ml_calleeSave[CALLEESAVE];
49 :    
50 :     ml_val_t ml_storePtr; /* the list of store operations */
51 :    
52 :     /* Linkage information */
53 :     ml_val_t ml_faultExn; /* The exception packet for a hardware fault. */
54 :     Word_t ml_faultPC; /* the PC of the faulting instruction */
55 :     #ifdef SOFT_POLL
56 :     ml_val_t *ml_realLimit; /* real heap limit */
57 :     bool_t ml_pollPending; /* poll event pending? */
58 :     bool_t ml_inPollHandler; /* handling a poll event? */
59 :     #endif
60 :     }; /* struct ml_state */
61 :    
62 :    
63 :     /* set up the return linkage and continuation throwing in the ML state vector. */
64 :     #define SETUP_RETURN(msp) { \
65 :     ml_state_t *__msp = (msp); \
66 :     __msp->ml_closure = ML_unit; \
67 :     __msp->ml_pc = __msp->ml_cont; \
68 :     }
69 :    
70 :     #define SETUP_THROW(msp, cont, val) { \
71 :     ml_state_t *__msp = (msp); \
72 :     ml_val_t __cont = (cont); \
73 :     __msp->ml_closure = __cont; \
74 :     __msp->ml_cont = ML_unit; \
75 :     __msp->ml_pc = \
76 :     __msp->ml_linkReg = GET_CODE_ADDR(__cont); \
77 :     __msp->ml_exnCont = ML_unit; \
78 :     __msp->ml_arg = (val); \
79 :     }
80 :    
81 :     #endif /* !_ML_STATE_ */
82 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0