mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Only use metadata patterns for generic types; perform other
initialization in-place on demand. Initialize parent metadata references correctly on struct and enum metadata. Also includes several minor improvements related to relative pointers that I was using before deciding to simply switch the parent reference to an absolute reference to get better access patterns.
This commit is contained in:
@@ -249,23 +249,6 @@ TEST(Concurrent, ConcurrentMap) {
|
||||
}
|
||||
|
||||
|
||||
TEST(MetadataAllocator, alloc_firstAllocationMoreThanPageSized) {
|
||||
using swift::MetadataAllocator;
|
||||
MetadataAllocator allocator;
|
||||
|
||||
// rdar://problem/21659505 -- if the first allocation from a metadata
|
||||
// allocator was greater than page sized, a typo caused us to incorrectly
|
||||
// flag an error.
|
||||
uintptr_t pagesize = sysconf(_SC_PAGESIZE);
|
||||
void *page = allocator.alloc(pagesize);
|
||||
EXPECT_NE(page, nullptr);
|
||||
EXPECT_NE(page, MAP_FAILED);
|
||||
EXPECT_EQ(uintptr_t(page) & uintptr_t(pagesize-1), uintptr_t(0));
|
||||
|
||||
// Don't leak the page the allocator allocates.
|
||||
munmap(page, pagesize);
|
||||
}
|
||||
|
||||
TEST(MetadataTest, getGenericMetadata) {
|
||||
auto metadataTemplate = (GenericMetadata*) &MetadataTest1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user