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:
John McCall
2016-03-23 16:56:29 -07:00
parent 898e0971d9
commit 41efb3d4d3
34 changed files with 1529 additions and 619 deletions

View File

@@ -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;