Skip to content

Instantly share code, notes, and snippets.

View ryoqun's full-sized avatar

Ryo Onodera ryoqun

View GitHub Profile
cat _X_ANONYMOUS#__block__\$block@1.opt.ll | sed 's/, !dbg.*$//g' | opt-3.3 --dot-cfg -o /dev/null
cat cfg._X_ANONYMOUS#__block__\$block@1.dot | sed 's/digraph "Call graph" {/digraph "Call Graph" { \n rankdir=LR;/' | sed -r 's/%\\"struct.rubinius::([a-zA-Z]*?)\\"/\1/g' | dot -Tpdf > /tmp/callgraph.pdf
cat _X_ANONYMOUS#__block__\$block@1.opt.ll | sed 's/, !dbg.*$//g' | opt-3.3 --dot-cfg -o /dev/null
cat cfg._X_ANONYMOUS#__block__\$block@1.dot | sed 's/digraph "Call graph" {/digraph "Call Graph" { \n rankdir=LR;/' | sed -r 's/%\\"struct.rubinius::([a-zA-Z]*?)\\"/\1/g' | dot -Tpdf > /tmp/callgraph.pdf
require 'benchmark'
require 'benchmark/ips'
if defined?(Rubinius)
class String
def fast_plus(other)
other = StringValue(other)
#encoding = Rubinius::Type.compatible_encoding self, other
str = String.__allocate__
str.data = other.data.prepend(self)
TCPSocket.open with a running server
- silently ignores 'nil' as the third parameter
- connects to a listening server with host and port
- connects to a server when passed local_host argument
- connects to a server when passed local_host and local_port arguments
- has an address once it has connected to a listening server
TCPSocket partial closability
- if the write end is closed then the other side can read past EOF without blocking
- closing the write end ensures that the other side can read until EOF
==12932== 88 bytes in 1 blocks are definitely lost in loss record 4 of 9
==12932== at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12932== by 0x1636176: llvm::MDNode::getTemporary(llvm::LLVMContext&, llvm::ArrayRef<llvm::Value*>) (Metadata.cpp:282)
==12932== by 0x1594536: llvm::DIBuilder::createCompileUnit(unsigned int, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, llvm::StringRef, unsigned
int, llvm::StringRef) (DIBuilder.cpp:96)
==12932== by 0xA96AB2: rubinius::jit::Builder::set_definition_location() (jit_builder.cpp:55)
==12932== by 0xA968FA: rubinius::jit::Builder::Builder(rubinius::Context*, rubinius::JITMethodInfo&) (jit_builder.cpp:50)
==12932== by 0xAB6B78: rubinius::jit::Compiler::compile_method(rubinius::BackgroundCompileRequest*) (jit_compiler.cpp:247)
==12932== by 0xACA254: rubinius::BackgroundCompilerThread::perform() (state.cpp:312)
==12932== by 0x87C461: rubinius::utilities::thread::Thread::trampoline(void*) (thread.hpp:79)
rbx: vm/builtin/variable_scope.cpp:149: rubinius::Object* rubinius::VariableScope::get_local(int): Assertion `!isolated_' failed.
---------------------------------------------
CRASH: A fatal error has occurred.
Backtrace:
bin/rbx[0x4a5330]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f587bac0cb0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7f587b216425]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x17b)[0x7f587b219b8b]
//===- PassManager.cpp - LLVM Pass Infrastructure Implementation ----------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the LLVM Pass Manager infrastructure.
vm/builtin/variable_scope.cpp:149: rubinius::Object* rubinius::VariableScope::get_local(int): Assertion `!isolated_' failed.
---------------------------------------------
CRASH: A fatal error has occurred.
Backtrace:
bin/rbx[0x4a15b0]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f6fac97bcb0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7f6fac0d1425]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x17b)[0x7f6fac0d4b8b]
class A
end
class B
end
loop_block = proc do
proc do
scope = nil
Rubinius.asm do
prc = proc do
end
loop do
prc.block.instance_variable_set(:@compiled_code, prc.block.compiled_code.dup)
prc.call
end