Changeset 408 for branches/thune/thread_safe/make.c
- Timestamp:
- 06/11/07 04:07:02 (18 months ago)
- Files:
-
- 1 modified
-
branches/thune/thread_safe/make.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/make.c
r400 r408 45 45 static void ur_internGlobal( UThread* ut, UCell* wc, UAtom atom ) 46 46 { 47 UBlock* mblk; 48 UCell* mtop; 49 UCell* mbot; 47 50 int wrdN; 48 51 49 // A module system could be implemented by looking up atom in a stack 50 // of module contexts here... 51 52 wrdN = ur_lookup( &ur_global, atom ); 53 if( wrdN > -1 ) 54 { 55 // UR_BIND_THREAD should already be set. 56 wc->word.wordBlk = BLK_GLOBAL_WORD; 57 wc->word.valBlk = BLK_GLOBAL_VAL; 58 wc->word.index = wrdN; 59 return; 60 } 61 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. 62 67 if( ut->env->blocks.arr.used ) 63 68 { … … 73 78 } 74 79 75 // For modules, intern word into current module (top of context stack). 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: 76 85 77 86 // UR_BIND_THREAD should already be set. 78 wc->word.wordBlk = BLK_GLOBAL_WORD;79 wc->word.valBlk = BLK_GLOBAL_VAL;80 wc->word.index = ur_internWord( &ur_global, atom );87 wc->word.wordBlk = mtop->ctx.wordBlk; 88 wc->word.valBlk = mtop->ctx.valBlk; 89 wc->word.index = wrdN; 81 90 } 82 91
