22#include <stdio.h>
33#include "runtime.h"
44#define DEBUG_MODE 1
5- /*
6- // The next free memory location
7- int64_t* free_ptr;
8-
9- // The beginning and end of the working heap for the "mutator"
10- // the program for which we are providing runtime services.
11- int64_t* fromspace_begin;
12- int64_t* fromspace_end;
13-
14- // The rootset of the "mutator" organized in a stack. Each root
15- // in the stack is a pointer into fromspace, while the "mutator"
16- // is executing.
17- int64_t** rootstack_begin;
18- int64_t** rootstack_end;
19- */
205
216// Often misunderstood static global variables in C are not
227// accessible to code outside of the module.
@@ -28,8 +13,16 @@ static int64_t* tospace_end;
2813// checked in order to ensure that initialization has occurred.
2914static int initialized = 0 ;
3015
31- // Vectors have a tag describing their contents in their first memory
32- // location here are some helpers that can help with their manipulation.
16+
17+ /*
18+ Object Tag (64 bits)
19+ #b|- 7 bit unused -|- 50 bit field [50, 0] -| 6 bits lenght -| 1 bit isForwarding Pointer
20+ * If the bottom-most bit is zero, the tag is really a forwarding pointer.
21+ * Otherwise, its an object. In that case, the next
22+ 6 bits give the length of the object (max of 50 64-bit words).
23+ The next 50 bits say where there are pointers.
24+ A '1' is a pointer, a '0' is not a pointer.
25+ */
3326static const int TAG_IS_NOT_FORWARD_MASK = 1 ;
3427static const int TAG_LENGTH_MASK = 126 ;
3528static const int TAG_LENGTH_RSHIFT = 1 ;
0 commit comments