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/kernel/boot.c
ViewVC logotype

Diff of /sml/trunk/src/runtime/kernel/boot.c

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

revision 985, Wed Nov 21 19:09:12 2001 UTC revision 986, Wed Nov 21 21:03:17 2001 UTC
# Line 501  Line 501 
501          InvokeGCWithRoots (msp, 0, &BinFileList, &val, NIL(ml_val_t *));          InvokeGCWithRoots (msp, 0, &BinFileList, &val, NIL(ml_val_t *));
502    
503      while (remainingCode > 0) {      while (remainingCode > 0) {
         int             strLen, padLen, extraLen;  
504    
505        /* read the size for this code object */        /* read the size for this code object */
506          ReadBinFile (file, &thisSzB, sizeof(Int32_t), fname);          ReadBinFile (file, &thisSzB, sizeof(Int32_t), fname);
507          thisSzB = BIGENDIAN_TO_HOST(thisSzB);          thisSzB = BIGENDIAN_TO_HOST(thisSzB);
508    
       /* We use one byte for the length, so the longest string is 255  
        * characters.  We need padding so that the code + string +  
        * length byte is WORD_SZB bytes.  The padding is inserted between  
        * the code and the string.  
        */  
         strLen = strlen(objname);  
         if (strLen > 255)  
             strLen = 255;  
         extraLen = strLen+1;  /* include byte for length */  
         padLen = ROUNDUP(thisSzB+extraLen, WORD_SZB) - (thisSzB+extraLen);  
         extraLen += padLen;  
   
509        /* how much more? */        /* how much more? */
510          remainingCode -= thisSzB + sizeof(Int32_t);          remainingCode -= thisSzB + sizeof(Int32_t);
511          if (remainingCode < 0)          if (remainingCode < 0)
512            Die ("format error (code size mismatch) in bin file \"%s\"", fname);            Die ("format error (code size mismatch) in bin file \"%s\"", fname);
513    
514        /* allocate space and read code object */        /* allocate space and read code object */
515          codeObj = ML_AllocCode (msp, thisSzB+extraLen);          codeObj = ML_AllocCode (msp, thisSzB);
516          ReadBinFile (file, PTR_MLtoC(char, codeObj), thisSzB, fname);          ReadBinFile (file, PTR_MLtoC(char, codeObj), thisSzB, fname);
517    
       /* tack on the bin-file name as a comment string. */  
         memcpy (PTR_MLtoC(char, codeObj)+thisSzB+padLen, objname, strLen);  
         *(PTR_MLtoC(Byte_t, codeObj)+thisSzB+extraLen-1) = (Byte_t)strLen;  
   
518          FlushICache (PTR_MLtoC(char, codeObj), thisSzB);          FlushICache (PTR_MLtoC(char, codeObj), thisSzB);
519    
520        /* create closure */        /* create closure */

Legend:
Removed from v.985  
changed lines
  Added in v.986

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