Changeset 427 for branches/thune/thread_safe/make.c
- Timestamp:
- 07/07/07 04:41:31 (17 months ago)
- Files:
-
- 1 modified
-
branches/thune/thread_safe/make.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/make.c
r426 r427 33 33 extern double ur_stringToDec( const char*, const char*, const char** ); 34 34 35 extern UContext ur_global; 36 extern UContext ur_envGlobal; 35 extern UContext ur_thrGlobal; 37 36 38 37 39 38 //#define GC_STRESS_TEST 1 40 39 40 41 extern void ur_internDefault( UThread* ut, UCell* wc, UAtom atom, 42 UCell* cbot, UCell* ctop ); 41 43 42 44 /* … … 45 47 static void ur_internGlobal( UThread* ut, UCell* wc, UAtom atom ) 46 48 { 47 UBlock* mblk; 48 UCell* mtop; 49 UCell* mbot; 50 int wrdN; 51 52 // Look for atom in module context stack. 53 mblk = ur_blockPtr( BLK_CTX_STACK ); 54 mbot = mblk->ptr.cells; 55 mtop = mbot + mblk->used; 56 do 57 { 58 --mtop; 59 wrdN = ur_lookup( mtop, atom ); 60 if( wrdN > -1 ) 61 goto assign; 62 } 63 while( mtop != mbot ); 64 65 66 // Now try the shared global context. 67 if( ut->env->blocks.arr.used ) 68 { 69 wrdN = ur_lookup( &ur_envGlobal, atom ); 70 if( wrdN > -1 ) 71 { 72 ur_setBindType( wc, UR_BIND_GLOBAL ); 73 wc->word.wordBlk = ur_envGlobal.ctx.wordBlk; 74 wc->word.valBlk = ur_envGlobal.ctx.valBlk; 75 wc->word.index = wrdN; 76 return; 77 } 78 } 79 80 // Word not found, so intern into current module (top of context stack). 81 mtop = mbot + (mblk->used - 1); 82 wrdN = ur_internWord( mtop, atom ); 83 84 assign: 85 86 // UR_BIND_THREAD should already be set. 87 wc->word.wordBlk = mtop->ctx.wordBlk; 88 wc->word.valBlk = mtop->ctx.valBlk; 89 wc->word.index = wrdN; 49 UBlock* cblk = tBlockPtr( BLK_CTX_STACK ); 50 ur_internDefault( ut, wc, atom, cblk->ptr.cells, 51 cblk->ptr.cells + cblk->used ); 90 52 } 91 53 … … 1282 1244 ++cp; 1283 1245 1284 wrdN = ur_internWord( &ur_ global,1246 wrdN = ur_internWord( &ur_thrGlobal, 1285 1247 ur_intern(def->name, cp - def->name) ); 1286 1248 … … 1288 1250 ur_initType( cell, UT_CALL ); 1289 1251 cell->call.addr = (call_t) def->addr; 1290 1291 /*1292 ur_appendWord( wblk, UT_WORD, "make", 4 );1293 cell = ur_appendCell( vblk, UT_CALL );1294 cell->call.addr = (call_t) uc_make;1295 */1296 1252 1297 1253 ++def; … … 1320 1276 UCell* cell = ur_appendCell( blk, type ); 1321 1277 1278 #if 0 1322 1279 // Add word to global context. 1323 1280 1324 1281 ur_atom(cell) = ur_intern( name, len ); 1325 1282 ur_sel(cell) = UR_CTX_UNORDERED; 1283 1326 1284 ur_internGlobal( ut, cell, ur_atom(cell) ); 1285 #else 1286 ur_setUnbound( cell, ur_intern( name, len ) ); 1287 #endif 1327 1288 1328 1289 return cell; … … 1616 1577 if( spA ) 1617 1578 { 1618 blkN = ur_tokenize( ut, spA, spB , 0);1579 blkN = ur_tokenize( ut, spA, spB ); 1619 1580 if( ! blkN ) 1620 1581 return; // ur_tokenize() has thrown.
