Changeset 31
- Timestamp:
- 02/08/06 01:35:49 (3 years ago)
- Location:
- trunk/orca
- Files:
-
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/orca/TODO
r25 r31 25 25 Thune Backport 26 26 27 * Words are stored in single string.28 27 * UCell union 29 28 * Value structure hidden more using macros (ur_int(), etc.) -
trunk/orca/console.c
r27 r31 89 89 else 90 90 { 91 printf( "ORCA -Core%s (%s)\n", VERSION_STR, __DATE__ );91 printf( "ORCA %s (%s)\n", VERSION_STR, __DATE__ ); 92 92 halt: 93 93 while( 1 ) -
trunk/orca/context.c
r26 r31 245 245 { 246 246 ctx->wblkN = orBlockN( orMakeBlock( size ) ); 247 248 // Assuming caller checks orRefAvail. 247 249 orRefPush( OT_BLOCK, ctx->wblkN ); 248 250 ctx->vblkN = orBlockN( orMakeBlock( size ) ); … … 293 295 int wcount; 294 296 297 298 if( ! orRefAvail( 4 ) ) 299 return 0; 295 300 296 301 wcount = 0; … … 424 429 425 430 431 if( ! orRefAvail( 3 ) ) 432 return -1; 433 426 434 orRefPush( OT_BLOCK, blkN ); 427 435 … … 740 748 741 749 750 orRefAvailErr( 2 ) 742 751 orRefPush( OT_BLOCK, a2->index ); 743 752 … … 810 819 // Still, 'foreach is faster than 'forall (probably because using paths 811 820 // is so slow). 821 822 orRefAvailErr( 4 ) 812 823 813 824 // Must hold body & a2 in case orMakeContext() or orCopyBlock() trigger … … 1036 1047 OIndex bi = (a1 + 2)->series.it; 1037 1048 OValue saveA1; 1049 1050 1051 orRefAvailErr( 2 ) 1038 1052 1039 1053 if( a1->type == OT_BLOCK ) -
trunk/orca/gc.c
r26 r31 530 530 checkCallStack(); 531 531 532 checkHolds( orEnv->quickHolds, orEnv->quickHoldsTop ); 532 checkHolds( orEnv->quickHolds, 533 orEnv->quickHolds + orEnv->quickHoldsUsed ); 533 534 534 535 if( orEnv->holds.used ) -
trunk/orca/ovalue.c
r27 r31 304 304 env->secure = 0; 305 305 306 // TODO: Do something about quickHolds stack overflow. Just use orHold()? 307 env->quickHolds = memAlloc( sizeof(OHold) * 256 ); 308 env->quickHoldsTop = env->quickHolds; 306 env->quickHolds = memAlloc( sizeof(OHold) * OR_MAX_QHOLDS ); 307 env->quickHoldsUsed = 0; 309 308 310 309 // NOTE: The data & call stacks are never resized so that it is safe … … 535 534 env->callStack.used = 0; 536 535 env->dataStack.used = 0; 537 env->quickHolds Top = env->quickHolds;536 env->quickHoldsUsed = 0; 538 537 env->error = 0; //orErrorClear; 539 538 } … … 1340 1339 OValue fileVal = *a1; 1341 1340 1341 orRefAvailErr( 2 ); 1342 1342 orRefPush( OT_FILE, a1->index ); 1343 1343 // Need to ref args? … … 1648 1648 OIndex bi = (a1 + 1)->series.it; 1649 1649 1650 orRefAvailErr( 2 ) 1650 1651 orRefPush( OT_BLOCK, cond ); 1651 1652 orRefPush( OT_BLOCK, body ); … … 2887 2888 int vi; 2888 2889 2890 orRefAvailErr( 3 ) 2889 2891 orRefPush( OT_BLOCK, a1->index ); 2890 2892 rblk = orMakeBlock(0); … … 3053 3055 int reti; 3054 3056 3057 /* Check if 2 are free because there is an orRefPush in orEval() 3058 and we can save a check there by doing it here. 3059 This is the only check which will catch an endlessly recursive does. 3060 */ 3061 orRefAvailErr( 2 ) 3055 3062 orRefPush( OT_BLOCK, blkN ); 3056 3063 … … 4239 4246 4240 4247 4248 orRefAvailErr( 4 ) 4241 4249 orRefPush( OT_BLOCK, a1->index ); 4242 4250 orRefPush( OT_BLOCK, a2->index ); -
trunk/orca/ovalue.h
r27 r31 118 118 119 119 #define OR_INVALID_HOLD -1 120 #define OR_MAX_QHOLDS 256 120 121 121 122 … … 358 359 359 360 OHold* quickHolds; 360 OHold* quickHoldsTop;361 int quickHoldsUsed; 361 362 362 363 #ifdef OR_CONFIG_NUMBER_ARRAYS … … 497 498 #define orIsNumber(t) ((t == OT_INTEGER) || (t == OT_DECIMAL)) 498 499 500 #define orRefAvail(n) \ 501 (((OR_MAX_QHOLDS - 1) - orEnv->quickHoldsUsed) > n) 502 503 #define orRefAvailErr(n) \ 504 if( ! orRefAvail(n) ) { \ 505 orErrorT(OR_ERROR_INTERNAL, "Hold stack overflow"); \ 506 return; } 507 499 508 #define orRefPush(type,index) \ 500 orEnv->quickHolds Top->dataType = type; \501 orEnv->quickHolds Top->which = index; \502 ++orEnv->quickHolds Top503 504 #define orRefPop(count) orEnv->quickHolds Top-= count509 orEnv->quickHolds[ orEnv->quickHoldsUsed ].dataType = type; \ 510 orEnv->quickHolds[ orEnv->quickHoldsUsed ].which = index; \ 511 ++orEnv->quickHoldsUsed 512 513 #define orRefPop(count) orEnv->quickHoldsUsed -= count 505 514 506 515 #define orWordVal(wv,blk,val) \ -
trunk/orca/tokenize.c
r1 r31 279 279 int get_mode = 0; 280 280 int state = ST_START; 281 OIndex hold; 281 282 OValue* prev = 0; 282 283 … … 287 288 return orBLOCKS + blk_stack[0]; 288 289 289 orRefPush( OT_BLOCK, blk_stack[0] );290 hold = orHold( OT_BLOCK, blk_stack[0] ); 290 291 291 292 str_term = '}'; … … 1060 1061 } 1061 1062 1062 orRe fPop( 1);1063 orRelease( hold ); 1063 1064 return BLK_STACK(0); 1064 1065 1065 1066 fail: 1066 1067 1067 orRe fPop( 1);1068 orRelease( hold ); 1068 1069 return 0; 1069 1070 }
