Changeset 418 for branches/thune
- Timestamp:
- 06/22/07 20:53:36 (17 months ago)
- Location:
- branches/thune/thread_safe
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/gc.c
r387 r418 446 446 blk.used = UR_TOS - UR_BOS; 447 447 448 #ifndef LANG_RUNE 448 449 assert( ur_is(UR_BOS, UT_UNSET) ); 450 #endif 449 451 assert( blk.used > -1 ); 450 452 -
branches/thune/thread_safe/rune/project.r
r323 r418 14 14 cflags {-DUR_CONFIG_TRIG} 15 15 cflags {-DUR_CONFIG_MATH3D} 16 cflags {-DUR_CONFIG_DT_CODE}16 ;cflags {-DUR_CONFIG_DT_CODE} 17 17 ;cflags {-DUR_CONFIG_MACROS} 18 18 ;cflags {-DUR_CONFIG_EMH} … … 58 58 %files.c 59 59 %math.c 60 %bignum.c 60 61 %support/mt19937ar.c 61 62 ] -
branches/thune/thread_safe/rune/rune.c
r351 r418 41 41 42 42 43 #define OR_TOC u r_thread->toc44 #define OR_BOC u r_thread->cstack43 #define OR_TOC ut->toc 44 #define OR_BOC ut->cstack 45 45 46 46 #define ur_funcFetch(cell) cell->func.closureN … … 140 140 141 141 #ifdef DEBUG 142 void dumpControl( )142 void dumpControl( UThread* ut ) 143 143 { 144 144 UString str; 145 145 UString* sp = &str; 146 UCell* it = u r_env->threads->cstack;147 UCell* end = u r_env->threads->toc + 1;146 UCell* it = ut->cstack; 147 UCell* end = ut->toc + 1; 148 148 149 149 ur_arrayInit( sp, 1, 0 ); … … 164 164 165 165 166 static int _verifyArgs( UThread* u r_thread, UCell* dt, int count )166 static int _verifyArgs( UThread* ut, UCell* dt, int count ) 167 167 { 168 168 UCell* it; … … 210 210 extern int ur_getSelector( UThread*, const UCell* sel, UCell* res ); 211 211 212 int ur_eval( UThread* u r_thread, UIndex blkN, UIndex si )212 int ur_eval( UThread* ut, UIndex blkN, UIndex si ) 213 213 { 214 214 UBlock* blk; … … 245 245 { 246 246 // Return from function. 247 cval = UR_LF_BEG-> localFrame.cell;247 cval = UR_LF_BEG->cell; 248 248 UR_LF_POP; 249 249 ur_copyCell(cval, *val); … … 285 285 if( ur_is(pc, UT_WORD) ) 286 286 { 287 val = ur_wordCell( u r_thread, pc );287 val = ur_wordCell( ut, pc ); 288 288 } 289 289 else … … 301 301 302 302 case UT_GETWORD: 303 val = ur_wordCell( u r_thread, val );303 val = ur_wordCell( ut, val ); 304 304 break; 305 305 … … 373 373 374 374 case UT_SELECT: 375 if( ! ur_getSelector( u r_thread, val, UR_TOS ) )375 if( ! ur_getSelector( ut, val, UR_TOS ) ) 376 376 { 377 377 --pc; … … 523 523 case ROP_EACH_LOOP: 524 524 val = ur_s_prev(UR_TOS); 525 if( ur_itLen( val ) > 0 )525 if( ur_itLen( ut, val ) > 0 ) 526 526 { 527 cval = ur_wordCell( u r_thread, ur_s_prev(val) );527 cval = ur_wordCell( ut, ur_s_prev(val) ); 528 528 if( ! cval ) 529 529 goto op_throw; 530 ur_pick( val, 0, cval );530 ur_pick( ut, val, 0, cval ); 531 531 val->series.it++; 532 532 val = UR_TOS; … … 553 553 case UT_SETWORD: 554 554 LOOK_AHEAD_FOR_INFIX 555 cval = ur_wordCell( u r_thread, OR_TOC );555 cval = ur_wordCell( ut, OR_TOC ); 556 556 if( ! cval ) 557 557 { … … 636 636 do_call: 637 637 638 //printf( "KR call %ld\n", UR_TOS - u r_thread->dstack );639 640 val->call.addr( u r_thread, UR_TOS );638 //printf( "KR call %ld\n", UR_TOS - ut->dstack ); 639 640 val->call.addr( ut, UR_TOS ); 641 641 val = UR_TOS; 642 642 UR_S_DROP; … … 680 680 int locc = totc - argc; 681 681 682 UR_LF_PUSH( -val->func.sigN, UR_TOS - (argc - 1) ); 682 //UR_LF_PUSH( -val->func.sigN, UR_TOS - (argc - 1) ); 683 --ut->localFT; 684 UR_LF_BEG->cell = UR_TOS - (argc - 1); 685 UR_LF_BEG->n = val->func.sigN; 686 683 687 684 688 if( argc ) 685 689 { 686 690 blk = ur_blockPtr( val->func.sigN ); 687 if( ! _verifyArgs( u r_thread, blk->ptr.cells + totc, argc ) )691 if( ! _verifyArgs( ut, blk->ptr.cells + totc, argc ) ) 688 692 goto op_throw; 689 693 } … … 854 858 trace_error: 855 859 856 _appendTraceBlk( &UR_TOS->err, blkN, pc - start );860 _appendTraceBlk( ut, &UR_TOS->err, blkN, pc - start ); 857 861 858 862 error: … … 886 890 putchar( ur_char(tos) ); 887 891 } 888 else if( ur_stringSlice( tos, &it, &end) && it )892 else if( ur_stringSlice(ut, tos, &it, &end) && it ) 889 893 { 890 894 if( ur_encoding(tos) == UR_ENC_UTF16 ) … … 908 912 { 909 913 UString* str; 910 str = ur_binPtr( ur_thread->callTempBinN);914 str = ur_binPtr( BIN_THREAD_TMP ); 911 915 str->used = 0; 912 916 ur_toStr( tos, str, 0 ); … … 917 921 tos = UR_TOS; 918 922 ur_initType( tos, UT_STRING ); 919 ur_setSeries( tos, ur_thread->callTempBinN, 0 );920 rc_cout( u r_thread, tos );923 ur_setSeries( tos, BIN_THREAD_TMP, 0 ); 924 rc_cout( ut, tos ); 921 925 UR_S_DROP; 922 926 } … … 927 931 UR_CALL( rc_func_loop ) 928 932 { 929 uc_func( u r_thread, tos );933 uc_func( ut, tos ); 930 934 UR_TOS->func.flags |= UR_FLAG_FUNC_LOOP; 931 935 } … … 940 944 941 945 942 extern UIndex _funcSignature( const UCell* scell, int* pArgc, int* pVarc );946 extern UIndex _funcSignature( UThread*, const UCell*, int* pArgc, int* pVarc ); 943 947 944 948 // (block -- block) … … 961 965 { 962 966 assert( ur_is(it, UT_WORD) ); 963 val = ur_wordCell( u r_thread, it );967 val = ur_wordCell( ut, it ); 964 968 ++it; 965 969 assert( ur_is(it, UT_BLOCK) ); … … 968 972 { 969 973 /* LIMIT: All Rune call sigN blocks must be in first 65k. */ 970 val->call.sigN = _funcSignature( it, &argc, &varc );974 val->call.sigN = _funcSignature( ut, it, &argc, &varc ); 971 975 ur_argc(val) = argc; 972 976 ur_varc(val) = 0; //varc … … 999 1003 1000 1004 1001 void rune_install( U rlanEnv* env)1002 { 1003 ur_makeCalls( env, rune_calls, sizeof(rune_calls) / sizeof(UCallDef) );1005 void rune_install( UThread* ut ) 1006 { 1007 ur_makeCalls( ut, rune_calls, sizeof(rune_calls) / sizeof(UCallDef) ); 1004 1008 1005 1009 // Bootstrap declare-natives 1006 1010 { 1007 UCell* val = ur_resolveArgPath( UT_WORD, 1008 ur_intern(env, "declare-natives", 15), 1009 UT_NONE ); 1011 UCell* val = ur_resolvePath( ut, ur_intern("declare-natives", 15), 1012 UT_NONE ); 1010 1013 if( val ) 1011 1014 { -
branches/thune/thread_safe/unix/os.c
r387 r418 313 313 314 314 #if 0 315 static void _callOutput( UThread* thread, UCell* tos )315 static void _callOutput( UThread* ut, UCell* tos ) 316 316 { 317 317 #define BUFSIZE 512 … … 386 386 static int _asyncProcCount = 0; 387 387 388 static void _callSimple( UThread* thread, UCell* tos )388 static void _callSimple( UThread* ut, UCell* tos ) 389 389 { 390 390 int pid; … … 461 461 if( orRefineSet( REF_CALL_OUTPUT ) ) 462 462 { 463 _callOutput( thread, tos );463 _callOutput( ut, tos ); 464 464 } 465 465 else 466 466 */ 467 467 { 468 _callSimple( thread, tos );468 _callSimple( ut, tos ); 469 469 } 470 470 } -
branches/thune/thread_safe/urlan.c
r408 r418 96 96 "code!", 97 97 "port!", 98 "struct!" 98 "struct!", 99 "component!", 100 "plug!" 99 101 }; 100 102 … … 438 440 #endif 439 441 #ifdef LANG_RUNE 440 extern void rune_install( U rlanEnv* );442 extern void rune_install( UThread* ); 441 443 #endif 442 444 … … 519 521 520 522 #ifdef LANG_RUNE 521 rune_install( env);523 rune_install( ut ); 522 524 #endif 523 525 … … 550 552 #elif defined(__APPLE__) 551 553 ur_setUnbound( cell, ur_intern( "mac-osx", 7 ) ); 554 #elif defined(__sun__) 555 ur_setUnbound( cell, ur_intern( "solaris", 7 ) ); 552 556 #elif defined(_WIN32) 553 557 ur_setUnbound( cell, ur_intern( "windows", 7 ) ); -
branches/thune/thread_safe/urlan.h
r417 r418 78 78 #define UT_PORT 36 79 79 #define UT_STRUCT 37 80 81 #define UT_BI_COUNT 38 80 #define UT_COMPONENT 38 81 #define UT_PLUG 39 82 83 #define UT_BI_COUNT 40 82 84 #define UT_MAX 64 83 85 #define UT_TYPEMASK 99 … … 202 204 203 205 204 /*205 206 typedef struct 206 207 { … … 208 209 uint8_t flags; 209 210 uint16_t inputMask; 210 UIndex wordN; 211 UIndex valN; 211 UIndex wordN; /* wordBlk at same position as in context. */ 212 UIndex valN; /* valBlk at same position as in context. */ 212 213 UIndex bodyN; 213 214 } 214 215 UCellComponent; 215 */216 216 217 217 … … 359 359 UCellContext ctx; 360 360 UCellContext port; 361 //UCellComponent comp;362 361 UCellCall call; 363 362 UCellFunction func; … … 372 371 UCellError err; 373 372 UCellCode code; 373 UCellComponent comp; 374 374 } 375 375 UCell;
