Commit a013784c authored by Kevin Modzelewski's avatar Kevin Modzelewski

Remove __attribute__((__malloc__)) from the gc

This attribute unfortunately lets the compiler skip stores if
the pointer doesn't escape.  This is bad because we will be
looking at the memory during a collection; the compiler was skipping
storing to cls and then the gc was crashing.
parent 93243be1
...@@ -247,7 +247,7 @@ public: ...@@ -247,7 +247,7 @@ public:
#endif #endif
} }
GCAllocation* __attribute__((__malloc__)) alloc(size_t bytes) { GCAllocation* alloc(size_t bytes) {
registerGCManagedBytes(bytes); registerGCManagedBytes(bytes);
if (bytes <= 16) if (bytes <= 16)
return _alloc(16, 0); return _alloc(16, 0);
...@@ -411,7 +411,7 @@ private: ...@@ -411,7 +411,7 @@ private:
Block** _freeChain(Block** head, std::vector<Box*>& weakly_referenced); Block** _freeChain(Block** head, std::vector<Box*>& weakly_referenced);
void _getChainStatistics(HeapStatistics* stats, Block** head); void _getChainStatistics(HeapStatistics* stats, Block** head);
GCAllocation* __attribute__((__malloc__)) _alloc(size_t bytes, int bucket_idx); GCAllocation* _alloc(size_t bytes, int bucket_idx);
}; };
struct ObjLookupCache { struct ObjLookupCache {
...@@ -485,7 +485,7 @@ public: ...@@ -485,7 +485,7 @@ public:
/* Largest object that can be allocated in a large block. */ /* Largest object that can be allocated in a large block. */
static constexpr size_t ALLOC_SIZE_LIMIT = BLOCK_SIZE - CHUNK_SIZE - sizeof(LargeObj); static constexpr size_t ALLOC_SIZE_LIMIT = BLOCK_SIZE - CHUNK_SIZE - sizeof(LargeObj);
GCAllocation* __attribute__((__malloc__)) alloc(size_t bytes); GCAllocation* alloc(size_t bytes);
GCAllocation* realloc(GCAllocation* alloc, size_t bytes); GCAllocation* realloc(GCAllocation* alloc, size_t bytes);
void free(GCAllocation* alloc); void free(GCAllocation* alloc);
...@@ -506,7 +506,7 @@ class HugeArena : public Arena<HUGE_ARENA_START, ARENA_SIZE, 0, PAGE_SIZE> { ...@@ -506,7 +506,7 @@ class HugeArena : public Arena<HUGE_ARENA_START, ARENA_SIZE, 0, PAGE_SIZE> {
public: public:
HugeArena(Heap* heap) : heap(heap) {} HugeArena(Heap* heap) : heap(heap) {}
GCAllocation* __attribute__((__malloc__)) alloc(size_t bytes); GCAllocation* alloc(size_t bytes);
GCAllocation* realloc(GCAllocation* alloc, size_t bytes); GCAllocation* realloc(GCAllocation* alloc, size_t bytes);
void free(GCAllocation* alloc); void free(GCAllocation* alloc);
...@@ -584,7 +584,7 @@ public: ...@@ -584,7 +584,7 @@ public:
return rtn; return rtn;
} }
GCAllocation* __attribute__((__malloc__)) alloc(size_t bytes) { GCAllocation* alloc(size_t bytes) {
if (bytes > LargeArena::ALLOC_SIZE_LIMIT) if (bytes > LargeArena::ALLOC_SIZE_LIMIT)
return huge_arena.alloc(bytes); return huge_arena.alloc(bytes);
else if (bytes > sizes[NUM_BUCKETS - 1]) else if (bytes > sizes[NUM_BUCKETS - 1])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment