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

SCM Repository

[smlnj] Diff of /sml/trunk/src/runtime/mach-dep/signal-util.c
ViewVC logotype

Diff of /sml/trunk/src/runtime/mach-dep/signal-util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3, Sat Oct 4 23:33:46 1997 UTC revision 239, Sat Apr 17 18:29:24 1999 UTC
# Line 81  Line 81 
81  /* MakeResumeCont:  /* MakeResumeCont:
82   *   *
83   * Build the resume continuation for a signal or poll event handler.   * Build the resume continuation for a signal or poll event handler.
84   * Layout of the resumption continuation:   * This closure contains the address of the resume entry-point and
85   *   * the registers from the ML State.
  *                  resumption continuation  
  *                            |  
  *                            v  
  *   +------------------+----+-+-+-+-+-+~+---------~  
  *   |STRING| floatregs |DESC|1|2|3|4| |B| live regs  
  *   +------------------+----+-+-+-+-+|+~+---------~  
  *           ^                        |  
  *           |________________________|  
86   *   *
87   * At least 4K avail. heap assumed.   * At least 4K avail. heap assumed.
88   */   */
89  ml_val_t MakeResumeCont (ml_state_t *msp, ml_val_t resume[])  ml_val_t MakeResumeCont (ml_state_t *msp, ml_val_t resume[])
90  {  {
     ml_val_t    fpRegs;  
     int         i, n, mask;  
   
 #if (FLOAT_CALLEESAVE > 0)  
 #  ifdef ALIGN_REALDS  
   /* Force REALD_SZB alignment */  
     msp->ml_allocPtr =  
         (ml_val_t *)(((Addr_t)(msp->ml_allocPtr) & ~(REALD_SZB-1))+WORD_SZB);  
 #  endif  
 #  if defined(TARGET_X86)  
     n = FP_STATE_SIZE;  
 #  else  
     n = (REALD_SZB*FLOAT_CALLEESAVE)/WORD_SZB;  
     ML_AllocWrite(msp, 0, MAKE_DESC(n, DTAG_string));  
     SaveFPRegs ((Addr_t)(msp->ml_allocPtr) + WORD_SZB);  
     fpRegs = ML_Alloc(msp, n);  
 #  endif /* TARGET_X86 */  
 #else  
     fpRegs = ML_unit;  
 #endif  
   
91    /* allocate the resumption closure */    /* allocate the resumption closure */
92        ML_AllocWrite(msp,  0, MAKE_DESC(10, DTAG_record));
93      ML_AllocWrite(msp, 1, PTR_CtoML(resume));      ML_AllocWrite(msp, 1, PTR_CtoML(resume));
94      ML_AllocWrite(msp, 2, INT_CtoML(msp->ml_liveRegMask));      ML_AllocWrite(msp,  2, msp->ml_arg);
95      ML_AllocWrite(msp, 3, msp->ml_pc);      ML_AllocWrite(msp,  3, msp->ml_cont);
96      ML_AllocWrite(msp, 4, msp->ml_exnCont);      ML_AllocWrite(msp,  4, msp->ml_closure);
97      ML_AllocWrite(msp, 5, fpRegs);      ML_AllocWrite(msp,  5, msp->ml_linkReg);
98      n = 6;      ML_AllocWrite(msp,  6, msp->ml_pc);
99        ML_AllocWrite(msp,  7, msp->ml_exnCont);
100  #if  defined(BASE_INDX)      ML_AllocWrite(msp,  8, msp->ml_varReg);
101      ML_AllocWrite(msp, n, msp->ml_baseReg);      ML_AllocWrite(msp,  9, msp->ml_calleeSave[0]);
102      n++;      ML_AllocWrite(msp, 10, msp->ml_calleeSave[1]);
103  #endif      ML_AllocWrite(msp, 11, msp->ml_calleeSave[2]);
   
   /* save the live registers */  
     mask = msp->ml_liveRegMask;  
     for (i = 0;  mask != 0;  i++, mask >>= 1) {  
         if (mask & 0x1) {  
             ML_AllocWrite(msp, n, msp->ml_roots[ArgRegMap[i]]);  
             n++;  
         }  
     }  
   
  /* write the object descriptor */  
     ML_AllocWrite(msp, 0, MAKE_DESC(n-1, DTAG_record));  
104    
105      return ML_Alloc(msp, n-1);      return ML_Alloc(msp, 11);
106    
107  } /* end of MakeResumeCont */  } /* end of MakeResumeCont */
108    
# Line 193  Line 153 
153    
154      contClosure = PTR_MLtoC(ml_val_t, msp->ml_closure);      contClosure = PTR_MLtoC(ml_val_t, msp->ml_closure);
155    
156      mask                =      msp->ml_arg                 = contClosure[2];
157      msp->ml_liveRegMask = INT_MLtoC(contClosure[1]);      msp->ml_cont                = contClosure[3];
158      msp->ml_pc          = contClosure[2];      msp->ml_closure             = contClosure[4];
159      msp->ml_exnCont     = contClosure[3];      msp->ml_linkReg             = contClosure[5];
160  #if (FLOAT_CALLEESAVE > 0)      msp->ml_linkReg             = contClosure[6];
161      RestoreFPRegs(PTR_MLtoC(Word_t, contClosure[4]));      msp->ml_exnCont             = contClosure[7];
162  #endif      msp->ml_varReg              = contClosure[8];
163      n = 5;      msp->ml_calleeSave[0]       = contClosure[9];
164  #ifdef BASE_INDX      msp->ml_calleeSave[1]       = contClosure[10];
165      msp->ml_baseReg     = contClosure[n];      msp->ml_calleeSave[2]       = contClosure[11];
     n++;  
 #endif  
     for (i = 0;  mask != 0;  i++, mask >>= 1) {  
         if (mask & 0x1) {  
             msp->ml_roots[ArgRegMap[i]] = contClosure[n];  
             n++;  
         }  
     }  
166    
167  } /* end of LoadResumeState */  } /* end of LoadResumeState */
168    

Legend:
Removed from v.3  
changed lines
  Added in v.239

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