Skip to content

Instantly share code, notes, and snippets.

Brian Shirai brixen

Block or report user

Report or block brixen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:a2fdccbf253021eff503d8d1523e23cf
0x70000e88c970: <anonymous module>#initialize in /Users/brianshirai/.gem/rbx/4.5.c5/gems/concurrent-ruby-1.1.5/lib/concurrent/thread_safe/util/volatile.rb:43 (+75)
0x70000e88cb40: Concurrent::Collection::AtomicReferenceMapBackend::Node#initialize in /Users/brianshirai/.gem/rbx/4.5.c5/gems/concurrent-ruby-1.1.5/lib/concurrent/collection/map/atomic_reference_map_backend.rb:262 (+10)
0x70000e88cd40: Concurrent::Collection::AtomicReferenceMapBackend::Table#cas_new_node in /Users/brianshirai/.gem/rbx/4.5.c5/gems/concurrent-ruby-1.1.5/lib/concurrent/collection/map/atomic_reference_map_backend.rb:199 (+28)
0x70000e88cf60: Concurrent::Collection::AtomicReferenceMapBackend#get_and_set in /Users/brianshirai/.gem/rbx/4.5.c5/gems/concurrent-ruby-1.1.5/lib/concurrent/collection/map/atomic_reference_map_backend.rb:483 (+66)
0x70000e88d260: Concurrent::Collection::AtomicReferenceMapBackend#[]= in /Users/brianshirai/.gem/rbx/4.5.c5/gems/concurrent-ruby-1.1.5/lib/concurrent/collection/map/atomic_reference_map_backend.rb:409 (
View gist:4646842e928b51ffd14262d2cedd2084
--------
Successfully installed Rubinius 4.5
Add '/nix/store/1nr7mj3r9hmnp4mr7l3r6fsgyfy31mg3-rubinius-4.5/bin' to your PATH. Available commands are:
rbx, ruby, rake, gem, irb, rdoc, ri
1. Run Ruby files with 'rbx path/to/file.rb'
2. Start IRB by running 'rbx' with no arguments
View fib_r.rb
require 'benchmark/ips'
class A
# def fib(n)
# return n if n < 2
# fib(n-2) + fib(n-1)
# end
dynamic_method :fib do |g|
@brixen
brixen / gist:618f948356000f3b165acf3f96908f02
Created Jul 9, 2019
Iterative fib() using Rubinius register bytecode
View gist:618f948356000f3b165acf3f96908f02
$ bin/rbx
irb(main):001:0> load './fib_r.rb'
=> true
irb(main):002:0> cc = A.instance_method(:fibi).executable
=> #<Rubinius::CompiledCode:0x3680 name=fibi file=(dynamic) line=1>
irb(main):003:0> cc.iseq
=> #<Rubinius::InstructionSequence:0x3840>
irb(main):004:0> iseq = _
=> #<Rubinius::InstructionSequence:0x3840>
irb(main):005:0> iseq.opcodes
View fib_r.rb
require 'benchmark/ips'
class A
# def fib(n)
# return n if n < 2
# fib(n-2) + fib(n-1)
# end
dynamic_method :fib do |g|
@brixen
brixen / result.txt
Created Jun 15, 2019
Illustration of Rubinius tagged nil that enables tracing where a nil value originated
View result.txt
rbx tagged_nil.rb
main # Rubinius::Loader at core/loader.rb:852 (+90)
script # Rubinius::Loader at core/loader.rb:667 (+343)
load_script # Rubinius::CodeLoader at
core/code_loader.rb:280 (+60)
load # Rubinius::CodeLoader::Source(Rubinius::CodeLoader::Script) at
core/code_loader.rb:119 (+81)
run_script # Rubinius::CodeLoader::Source(Rubinius::CodeLoader::Script) at
core/code_loader.rb:132 (+21)
__script__ # Object at tagged_nil.rb:50 (+153)
View gist:bf387cd29511c8e292fe9c0b18b6ec9b
* thread #3, name = 'ruby.107'
* frame #0: 0x00007fff78c7db0e libsystem_kernel.dylib`__psynch_rw_wrlock + 10
frame #1: 0x00007fff78d39dd0 libsystem_pthread.dylib`_pthread_rwlock_lock_wait + 75
frame #2: 0x00007fff78d37bc6 libsystem_pthread.dylib`_pthread_rwlock_lock_slow + 547
frame #3: 0x00007fff78bdff7e libsystem_c.dylib`tzsetwall_basic + 98
frame #4: 0x00007fff78be1ed5 libsystem_c.dylib`localtime_r + 41
frame #5: 0x000000010ccaf041 rbx`rubinius::logger::FileLogger::write_log(char const*, char const*, int) [inlined] rubinius::logger::Logger::timestamp(this=<unavailable>) at logger.cpp:271:7 [opt]
frame #6: 0x000000010ccaf02c rbx`rubinius::logger::FileLogger::write_log(this=0x00007fe051cbfe00, level="<Info>", message="collector: worker thread starting\n", size=34) at logger.cpp:615 [opt]
frame #7: 0x000000010ccad490 rbx`rubinius::logger::info(message=<unavailable>, args=<unavailable>) at logger.cpp:239:18 [opt]
frame #8: 0x000000010ccace30 rbx`rubinius::logger::info(message=
@brixen
brixen / stacktrace.txt
Created May 4, 2019
Rubinius debug log of nokogiri test run
View stacktrace.txt
May 4 09:40:31 [51665] <Debug> Backtrace for Thread: ruby.main
May 4 09:40:31 [51665] <Debug> 0 rbx 0x000000010049a0d9 rubinius::ThreadNexus::check_stack(rubinius::State*, rubinius::VM*) + 57
May 4 09:40:31 [51665] <Debug> 1 rbx 0x00000001004d872b rubinius::ThreadNexus::check_stop(rubinius::State*, rubinius::VM*, std::__1::function<void ()>) + 75
May 4 09:40:31 [51665] <Debug> 2 rbx 0x00000001004d85c8 rubinius::VM::checkpoint(rubinius::State*) + 88
May 4 09:40:31 [51665] <Debug> 3 rbx 0x0000000100411831 rubinius::instructions::send_method(rubinius::State*, rubinius::CallFrame*, long) + 96
May 4 09:40:31 [51665] <Debug> 4 rbx 0x00000001004117a9 rubinius::interpreter::send_method(rubinius::State*, rubinius::CallFrame*, long const*) + 33
May 4 09:40:31 [51665] <Debug> 5 rbx 0x000000010040d2d0 rubinius::In
@brixen
brixen / backtrace.txt
Created May 4, 2019
Rubinius thread backtrace when GC runs during nokogiri tests
View backtrace.txt
May 3 21:54:47 [50940] <Debug> Backtrace for Thread: ruby.main
May 3 21:54:47 [50940] <Debug> 0 rbx 0x0000000105cb70d9 rubinius::ThreadNexus::check_stack(rubinius::State*, rubinius::VM*) + 57
May 3 21:54:47 [50940] <Debug> 1 rbx 0x0000000105cf572b rubinius::ThreadNexus::check_stop(rubinius::State*, rubinius::VM*, std::__1::function<void ()>) + 75
May 3 21:54:47 [50940] <Debug> 2 rbx 0x0000000105cf55c8 rubinius::VM::checkpoint(rubinius::State*) + 88
May 3 21:54:47 [50940] <Debug> 3 rbx 0x0000000105c2e91b rubinius::instructions::send_stack(rubinius::State*, rubinius::CallFrame*, long, long) + 116
May 3 21:54:47 [50940] <Debug> 4 rbx 0x0000000105c2e87f rubinius::interpreter::send_stack(rubinius::State*, rubinius::CallFrame*, long const*) + 38
May 3 21:54:47 [50940] <Debug> 5 rbx 0x0000000105c2a2d0 rubiniu
@brixen
brixen / debug_log.txt
Created Apr 27, 2019
Rubinius debug log of running `bundle install`
View debug_log.txt
This file has been truncated, but you can view the full file.
Apr 27 11:39:49 [19768] command line: rbx /source/rubinius/rubinius/gems/bin/bundle install
Apr 27 11:39:49 [19768] config: log.level=debug
Apr 27 11:39:49 [19768] thread: run: ruby.main, 198780, 0x9733000
Apr 27 11:39:49 [19768] node: info: Shirai-MacBook.local Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64
Apr 27 11:39:49 [19768] process: info: brianshirai rbx 19768 3.107.c2 2.3.1 2019-04-27 65fba7aa 7.0.1 JIT disabled
Apr 27 11:39:49 [19768] process: boot stats: fields 602us main thread: 42us memory: 10688us ontology: 5880us platform: 2309us
Apr 27 11:39:49 [19768] codedb: loading: /source/rubinius/rubinius/codedb/cache
Apr 27 11:39:49 [19768] <Debug> codedb: load: core/alpha.rb, __script__
Apr 27 11:39:49 [19768] <Debug> codedb: load: core/alpha.rb, VM
You can’t perform that action at this time.