309 |
* subdivision is of interest are the ones with tc3==100. |
* subdivision is of interest are the ones with tc3==100. |
310 |
* |
* |
311 |
* tc7, tc8, tc9 (for objects with tc3==100): |
* tc7, tc8, tc9 (for objects with tc3==100): |
312 |
* xx-0000-100: \ evaluator byte codes ('short instructions'). The byte |
* 00-0000-100: \ evaluator byte codes ('short instructions'). The byte |
313 |
* ... } code interpreter can dispatch on them in one step based |
* ... } code interpreter can dispatch on them in one step based |
314 |
* xx-1101-100: / on their tc7 value. |
* 00-1100-100: / on their tc7 value. |
315 |
* 00-1110-100: evaluator byte codes ('long instructions'). The byte code |
* 00-1101-100: evaluator byte codes ('long instructions'). The byte code |
316 |
* interpreter needs to dispatch on them in three steps: |
* interpreter needs to dispatch on them in two steps: The |
317 |
* The first dispatch is based on the tc7-code. The second |
* first dispatch is based on the tc7-code. The second |
318 |
* dispatch checks for tc9==00-1110-100. The third dispatch |
* dispatch is based on the actual byte code that is extracted |
319 |
* is based on the actual byte code that is extracted from the |
* from the upper bits. |
|
* upper bits. |
|
320 |
* x1-1110-100: characters with x as their least significant bit |
* x1-1110-100: characters with x as their least significant bit |
321 |
* 10-1110-100: various constants ('flags') |
* 10-1110-100: various constants ('flags') |
322 |
* xx-1111-100: evaluator byte codes ('ilocs') |
* x1-1111-100: evaluator byte codes ('ilocs') |
323 |
* |
* |
324 |
* |
* |
325 |
* Summary of type codes on the heap |
* Summary of type codes on the heap |
514 |
#define SCM_ISYMNUM(n) (SCM_UNPACK (n) >> 9) |
#define SCM_ISYMNUM(n) (SCM_UNPACK (n) >> 9) |
515 |
#define SCM_ISYMCHARS(n) (scm_isymnames[SCM_ISYMNUM (n)]) |
#define SCM_ISYMCHARS(n) (scm_isymnames[SCM_ISYMNUM (n)]) |
516 |
#define SCM_MAKSPCSYM(n) SCM_PACK (((n) << 9) + ((n) << 3) + 4L) |
#define SCM_MAKSPCSYM(n) SCM_PACK (((n) << 9) + ((n) << 3) + 4L) |
517 |
#define SCM_MAKISYM(n) SCM_PACK (((n) << 9) + 0x74L) |
#define SCM_MAKISYM(n) SCM_PACK (((n) << 9) + 0x6cL) |
518 |
#define SCM_MAKIFLAG(n) SCM_PACK (((n) << 9) + 0x174L) |
#define SCM_MAKIFLAG(n) SCM_PACK (((n) << 9) + 0x174L) |
519 |
|
|
520 |
SCM_API char *scm_isymnames[]; /* defined in print.c */ |
SCM_API char *scm_isymnames[]; /* defined in print.c */ |
521 |
|
|
522 |
/* This table must agree with the declarations |
/* This table must agree with the declarations |
523 |
* in repl.c: {Names of immediate symbols}. |
* in print.c: {Names of immediate symbols}. |
524 |
* |
* |
525 |
* These are used only in eval but their values |
* These are used only in eval but their values |
526 |
* have to be allocated here. |
* have to be allocated here. |
527 |
*/ |
*/ |
528 |
|
|
529 |
|
/* Evaluator bytecodes (short instructions): These are uniquely identified by |
530 |
|
* their tc7 value. This makes it possible for the evaluator to dispatch on |
531 |
|
* them in one step. However, the type system allows for at most 13 short |
532 |
|
* instructions. Consequently, the most frequent instructions are chosen to |
533 |
|
* be represented as short instructions. */ |
534 |
|
|
535 |
#define SCM_IM_AND SCM_MAKSPCSYM (0) |
#define SCM_IM_AND SCM_MAKSPCSYM (0) |
536 |
#define SCM_IM_BEGIN SCM_MAKSPCSYM (1) |
#define SCM_IM_BEGIN SCM_MAKSPCSYM (1) |
537 |
#define SCM_IM_CASE SCM_MAKSPCSYM (2) |
#define SCM_IM_CASE SCM_MAKSPCSYM (2) |
545 |
#define SCM_IM_OR SCM_MAKSPCSYM (10) |
#define SCM_IM_OR SCM_MAKSPCSYM (10) |
546 |
#define SCM_IM_QUOTE SCM_MAKSPCSYM (11) |
#define SCM_IM_QUOTE SCM_MAKSPCSYM (11) |
547 |
#define SCM_IM_SET_X SCM_MAKSPCSYM (12) |
#define SCM_IM_SET_X SCM_MAKSPCSYM (12) |
548 |
#define SCM_IM_DEFINE SCM_MAKSPCSYM (13) |
|
549 |
|
/* Evaluator bytecodes (long instructions): All these share a common tc7 |
550 |
|
* value. Thus, the evaluator needs to dispatch on them in two steps. */ |
551 |
|
|
552 |
|
/* Evaluator bytecode for (define ...) statements. We make it a long |
553 |
|
* instruction since the executor will see this bytecode only for a very |
554 |
|
* limited number of times, namely once for every top-level and internal |
555 |
|
* definition: Top-level definitions are only executed once and internal |
556 |
|
* definitions are converted to letrec expressions. */ |
557 |
|
#define SCM_IM_DEFINE SCM_MAKISYM (13) |
558 |
|
|
559 |
#define SCM_IM_APPLY SCM_MAKISYM (14) |
#define SCM_IM_APPLY SCM_MAKISYM (14) |
560 |
#define SCM_IM_CONT SCM_MAKISYM (15) |
#define SCM_IM_CONT SCM_MAKISYM (15) |
561 |
#define SCM_BOOL_F SCM_MAKIFLAG (16) |
#define SCM_BOOL_F SCM_MAKIFLAG (16) |