@@ -1124,11 +1124,7 @@ static void* gc_flatmalloc(size_t sz)
1124
1124
__attribute__((hot ))
1125
1125
static _Bool is_gc_ptr (uintptr_t object )
1126
1126
{
1127
- const uintptr_t upper_bits = object & ~PTR_MASK ;
1128
- if (upper_bits ) return 0 ;
1129
- const uintptr_t index = (uintptr_t * )(object & PTR_MASK & ~7 ) - space [!z ];
1130
- if (index >= alloc [!z ]) return 0 ;
1131
- return 1 ;
1127
+ return (uint64_t * )object - space [!z ] < alloc [!z ];
1132
1128
}
1133
1129
1134
1130
__attribute__((hot ))
@@ -1146,13 +1142,12 @@ static void gc_collect_root(uintptr_t* restrict addr)
1146
1142
{
1147
1143
uintptr_t from = act_stk_top -> from ;
1148
1144
uintptr_t * to = act_stk_top -> to ;
1149
- const uintptr_t upper_bits = from & ~PTR_MASK ;
1150
1145
const uintptr_t lower_bits = from & 7 ;
1151
- uintptr_t index = (uintptr_t * )(from & PTR_MASK & ~7 ) - space [!z ];
1146
+ uintptr_t index = (uintptr_t * )(from & ~7 ) - space [!z ];
1152
1147
ptrdiff_t offset = 0 ;
1153
1148
while (bitmap [!z ][index ] == EMPTY ) index -- , offset ++ ; // Ptr to middle of object
1154
1149
if (bitmap [!z ][index ] == FORWARD )
1155
- * to = lower_bits | upper_bits | (uintptr_t )((uintptr_t * )space [!z ][index ] + offset );
1150
+ * to = lower_bits | (uintptr_t )((uintptr_t * )space [!z ][index ] + offset );
1156
1151
else
1157
1152
{
1158
1153
_Bool flat = bitmap [!z ][index ] == FLATALLOC ;
@@ -1173,7 +1168,7 @@ static void gc_collect_root(uintptr_t* restrict addr)
1173
1168
}
1174
1169
space [!z ][index ] = (uintptr_t )buf ; // Set forwarding address
1175
1170
bitmap [!z ][index ] = FORWARD ;
1176
- * to = lower_bits | upper_bits | (uintptr_t )(buf + offset );
1171
+ * to = lower_bits | (uintptr_t )(buf + offset );
1177
1172
}
1178
1173
}
1179
1174
}
0 commit comments