@@ -30,16 +30,19 @@ struct object {};
3030// The three low bits make up a primary tag, used to differentiate gc_obj
3131// from immediate objects. All even tags map to SmallInt, which is
3232// optimized by checking only the lowest bit for parity.
33- static const uword kSmallIntTagBits = 1 ;
34- static const uword kPrimaryTagBits = 3 ;
35- static const uword kImmediateTagBits = 5 ;
33+ enum {
34+ kSmallIntTagBits = 1 ,
35+ kPrimaryTagBits = 3 ,
36+ kImmediateTagBits = 5 ,
37+ kWordSize = sizeof (word ),
38+ kBitsPerByte = 8 ,
39+ kBitsPerPointer = kBitsPerByte * kWordSize ,
40+ };
3641static const uword kSmallIntTagMask = (1 << kSmallIntTagBits ) - 1 ;
3742static const uword kPrimaryTagMask = (1 << kPrimaryTagBits ) - 1 ;
3843static const uword kImmediateTagMask = (1 << kImmediateTagBits ) - 1 ;
3944
40- const int kWordSize = sizeof (word );
4145static const word kMaxSmallStringLength = kWordSize - 1 ;
42- const int kBitsPerByte = 8 ;
4346
4447static const uword kSmallIntTag = 0 ; // 0b****0
4548static const uword kHeapObjectTag = 1 ; // 0b**001
@@ -309,6 +312,8 @@ size_t heap_object_size(struct gc_obj* obj) {
309312 default :
310313 fprintf (stderr , "unknown tag: %lu\n" , obj -> tag );
311314 abort ();
315+ // Pacify the C compiler
316+ return (size_t )-1 ;
312317 }
313318}
314319
@@ -341,8 +346,9 @@ size_t trace_heap_object(struct gc_obj* obj, struct gc_heap* heap,
341346 return heap_object_size (obj );
342347}
343348
344- const int kBitsPerPointer = kBitsPerByte * kWordSize ;
345- static const word kSmallIntBits = kBitsPerPointer - kSmallIntTagBits ;
349+ enum {
350+ kSmallIntBits = kBitsPerPointer - kSmallIntTagBits ,
351+ };
346352static const word kSmallIntMinValue = - (((word )1 ) << (kSmallIntBits - 1 ));
347353static const word kSmallIntMaxValue = (((word )1 ) << (kSmallIntBits - 1 )) - 1 ;
348354
0 commit comments