View profileyarv.rb
#!/usr/bin/env ruby | |
require 'pp' | |
files = {'vm.inc' => [], 'insns.def' => []} | |
current_insn = nil | |
current_filename = 'vm.inc' | |
lineno_offset = 0 | |
IO.foreach('vm.inc') do |line| | |
case line | |
when /^INSN_ENTRY\((\w+)\)/ |
View ngpng.rb
# Not Great PNG class. This is a very simple example of writing a PNG. It | |
# only supports colors from the color palette stored in `@palette`. This is | |
# meant to be example code, but I am using it in a program for visualizing | |
# heap dumps from Ruby. | |
# | |
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any |
View out.sh-session
[aaron@tc-lan-adapter ~]$ cat x.rb | |
require "rbconfig" | |
# Change the compiler to "aarons-compiler" | |
RbConfig::CONFIG["CC"] = "aarons-compiler" | |
[aaron@tc-lan-adapter ~]$ RUBYOPT='-I/Users/aaron -rx' gem install sqlite3 | |
Building native extensions. This could take a while... | |
ERROR: Error installing sqlite3: | |
ERROR: Failed to build gem native extension. |
View right_side.stl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View foo.c
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); |
View foo.c
page_body = (struct heap_page_body *)rb_aligned_malloc(HEAP_PAGE_ALIGN, HEAP_PAGE_SIZE); | |
/* cut.. */ | |
page = calloc1(sizeof(struct heap_page)); |
View read-barrier-code.rb
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) |
View foo.c
REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5), | |
HEAP_PAGE_SIZE = (HEAP_PAGE_ALIGN - REQUIRED_SIZE_BY_MALLOC), |
View foo.c
/* 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); |
View foo.c
struct heap_page_header { | |
struct heap_page *page; | |
}; | |
struct heap_page_body { | |
struct heap_page_header header; | |
/* char gap[]; */ | |
/* RVALUE values[]; */ | |
}; |
NewerOlder