This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page_body = (struct heap_page_body *)rb_aligned_malloc(HEAP_PAGE_ALIGN, HEAP_PAGE_SIZE); | |
/* cut.. */ | |
page = calloc1(sizeof(struct heap_page)); | |
/* cut.. */ | |
assert((getpagesize() * 4) == HEAP_PAGE_ALIGN); | |
intptr_t page_body_end = (intptr_t)page_body + (getpagesize() * 4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page_body = (struct heap_page_body *)rb_aligned_malloc(HEAP_PAGE_ALIGN, HEAP_PAGE_SIZE); | |
/* cut.. */ | |
page = calloc1(sizeof(struct heap_page)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def segv_handler(info) | |
# Only triggered if someone tried to read from a MOVED location | |
move_all_objects_back(find_page(info.read_address)) | |
end | |
def compact | |
register_segv_handler :segv_handler | |
ruby_heap.pages.each do |page| | |
move_objects_on(page) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5), | |
HEAP_PAGE_SIZE = (HEAP_PAGE_ALIGN - REQUIRED_SIZE_BY_MALLOC), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* assign heap_page body (contains heap_page_header and RVALUEs) */ | |
page_body = (struct heap_page_body *)rb_aligned_malloc(HEAP_PAGE_ALIGN, HEAP_PAGE_SIZE); | |
if (page_body == 0) { | |
rb_memerror(); | |
} | |
/* assign heap_page entry */ | |
page = calloc1(sizeof(struct heap_page)); | |
if (page == 0) { | |
rb_aligned_free(page_body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct heap_page_header { | |
struct heap_page *page; | |
}; | |
struct heap_page_body { | |
struct heap_page_header header; | |
/* char gap[]; */ | |
/* RVALUE values[]; */ | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct heap_page_header { | |
struct heap_page *page; | |
}; | |
struct heap_page_body { | |
struct heap_page_header header; | |
/* char gap[]; */ | |
/* RVALUE values[]; */ | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct heap_page_header { | |
struct heap_page *page; | |
}; | |
struct heap_page_body { | |
struct heap_page_header header; | |
/* char gap[]; */ | |
/* RVALUE values[]; */ | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct heap_page { | |
short total_slots; | |
short free_slots; | |
short pinned_slots; | |
short final_slots; | |
struct { | |
unsigned int before_sweep : 1; | |
unsigned int has_remembered_objects : 1; | |
unsigned int has_uncollectible_shady_objects : 1; | |
unsigned int in_tomb : 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct heap_page { | |
short total_slots; | |
short free_slots; | |
short pinned_slots; | |
short final_slots; | |
struct { | |
unsigned int before_sweep : 1; | |
unsigned int has_remembered_objects : 1; | |
unsigned int has_uncollectible_shady_objects : 1; | |
unsigned int in_tomb : 1; |