machine.h 987 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. typedef unsigned long int word;
  2. #define STACK_SIZE (1<<16)
  3. #define GLOBALS_SIZE (1<<8)
  4. #define HEAP_SIZE (1<<16)
  5. extern word machine_ret_register;
  6. extern word machine_env_register;
  7. extern word machine_stack[STACK_SIZE];
  8. extern word machine_globals[GLOBALS_SIZE];
  9. extern word machine_heap_a[HEAP_SIZE];
  10. extern word machine_heap_b[HEAP_SIZE];
  11. extern word *machine_from_heap;
  12. extern word *machine_to_heap;
  13. #define FROM_HEAP(p) (machine_from_heap+p)
  14. #define TO_HEAP(p) (machine_to_heap+p)
  15. #define FROM_HEAP_REF(p) machine_from_heap[p]
  16. #define TO_HEAP_REF(p) machine_to_heap[p]
  17. #define TAG(w) ((w) & 0xFF)
  18. #define VAL(w) ((w) >> 8)
  19. #define OBJECT_TAG_VAL(t,v) ((v) << 8 | (t))
  20. #define VAL_BITS 0xFFFFFFFFFFFFFF
  21. enum tag {
  22. // atomic
  23. tag_bool = 0,
  24. tag_null = 1,
  25. tag_integer = 2,
  26. tag_symbol = 3,
  27. tag_character = 4,
  28. // data
  29. tag_string = 5,
  30. // complex
  31. tag_box = 6,
  32. tag_cons = 7,
  33. tag_vector = 8,
  34. tag_closure = 9,
  35. tag_record = 10,
  36. };
  37. extern char *tag_name[];