Skip to content

Instantly share code, notes, and snippets.

View brixen's full-sized avatar

Brian Shirai brixen

View GitHub Profile
This file has been truncated, but you can view the full file.
(lldb) thr list
Process 18552 stopped
thread #1: tid = 0x6f389d, 0x00007fff6c059cee libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'ruby.main', queue = 'com.apple.main-thread'
thread #2: tid = 0x6f38c2, 0x00007fff6c059cee libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'ruby.main'
thread #3: tid = 0x6f38c1, 0x00007fff6c059d1e libsystem_kernel.dylib`__psynch_mutexwait + 10, name = 'rbx.finalizer'
thread #4: tid = 0x6f38e7, 0x00007fff6c05aec2 libsystem_kernel.dylib`kevent + 10, name = 'rbx.console.listener'
thread #5: tid = 0x6f3d40, 0x00007fff6c059cee libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'ruby.5'
* thread #6: tid = 0x6f3f5f, 0x000000010c07467b libcrypto.1.0.0.dylib`EVP_MD_CTX_copy_ex + 191, name = 'Parallel Installer Worker #21', stop reason = EXC_BAD_ACCESS (code=1, address=0x868)
thread #7: tid = 0x6f3f4a, 0x00007fff6c059cee libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'Parallel Installer Worker #0'
thread #8: tid = 0x6f3f4b, 0x00007fff6c059cee libsystem_kernel.dy
Jan 20 14:20:38 [18114] command line: /source/rubinius/rubinius/build/rubinius/bin/rbx /source/rubinius/rubinius/build/rubinius/gems/bin/bundle install --jobs=40
Jan 20 14:20:38 [18114] thread: run: ruby.main, 7242515, 0x4289000
Jan 20 14:20:38 [18114] node: info: Shirai-MacBook.local Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64
Jan 20 14:20:38 [18114] process: info: brianshirai rbx 18114 3.93 2.3.1 2018-01-20 75512369 5.0.0 JIT disabled
Jan 20 14:20:38 [18114] process: boot stats: fields 253us main thread: 56us memory: 10515us ontology: 3537us platform: 1467us
Jan 20 14:20:38 [18114] codedb: loading: /source/rubinius/rubinius/build/rubinius/codedb/cache
Jan 20 14:20:38 [18114] system: RUBYOPT:
Jan 20 14:20:42 [18114] thread: new: ruby.5, rubysl/timeout/timeout.rb:125
Jan 20 14:20:42 [18114] thread: run: ruby.5, 7242749, 0x469f000
Jan 20 14:20:56 [18114] thread: start: ruby.6, /source/rubinius/rubinius/build/rubinius/gems/gems/bundler-1.16.1/lib/bundler/worke
@brixen
brixen / gist:44ebd71be48b24e94c3f1dcfd170b3ab
Created January 20, 2018 22:26
Bundler parallel install bug
$ bundle install --jobs=40
Fetching gem metadata from https://rubygems.org/.........
Using rake 12.3.0
Using minitest 5.11.1
Fetching builder 3.2.3
Fetching thread_safe 0.3.6
Fetching concurrent-ruby 1.0.5
Fetching mini_portile2 2.3.0
Fetching erubi 1.7.0
Fetching crass 1.0.3
class A
def m(a, b)
n = i = 0
while i < 1_000_000
n += a + b
i += 1
end
n
end
#include "interp.hpp"
intptr_t insn_load(void* state, CallFrame* cf, Opcode opcodes[]) {
cf->registers[(int)opcodes[cf->ip+2]] = cf->args->arguments[(int)opcodes[cf->ip+1]];
cf->ip += 3;
return ((Instruction)opcodes[cf->ip])(state, cf, opcodes);
}
intptr_t insn_load_int(void* state, CallFrame* cf, Opcode opcodes[]) {
$ irb
irb(main):001:0> class A
irb(main):002:1> dynamic_method :m do |g|
irb(main):003:2* g.push_true
irb(main):004:2> g.m_counter 0
irb(main):005:2> g.ret
irb(main):006:2> end
irb(main):007:1> end
=> #<Rubinius::CompiledCode:0x1ecc name=m file=(dynamic) line=1>
irb(main):008:0> puts A.instance_method(:m).executable.decode
$ bin/rbx -v fib2.rb
rubinius 3.86.c114 (2.3.1 96188478 2017-12-29 5.0.0) [x86_64-darwin17.3.0]
Step 1
Step 2
Step 3
Fiber.current: #<Fiber:0x120 thread_name=ruby.5 fiber_id=0 status=run>
Fiber.new: #<Fiber:0x120 thread_name=ruby.5 fiber_id=0 status=run>
Fiber.current: #<Fiber:0x124 thread_name=ruby.5 fiber_id=6 status=transfer source=/source/rubinius/rubinius/fib2.rb:4>
Step 4
call # Proc at core/proc.rb:20
@brixen
brixen / gist:16797a3d04983c7762109fc7dbbbd39e
Created December 29, 2017 22:14
$ bin/rbx -r ./histo.rb -e 'cs = ObjectSpace.each_object(Rubinius::CallSite).to_a; max_invokes = cs.inject(0) { |a, x| x.invokes > a ? x.invokes : a }; invokes_histo = Histo.new max_invokes, 7, "CallSite invocations"; cs.each { |x| invokes_histo.add x.invokes }; invokes_histo.display'
Histogram of CallSite invocations
-- 0.000
12885
-- 2252.429
9
-- 4504.857
1
-- 6757.286
0
@brixen
brixen / gist:a2016b250730f692b0d7b7c65a05cf4b
Created October 22, 2017 20:00
$rbx -Xsystem.log.level=debug -v
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, __script__
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, VM
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, Object
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, Class
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, Kernel
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, Rubinius
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, Mirror
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, Runtime
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, AccessVariable
Oct 22 12:57:40 [7178] <Debug> codedb: load: core/alpha.rb, LookupTable
@brixen
brixen / gist:a000019f9b166384f6a6579b59b78a93
Created October 1, 2017 16:40
Rubinius profile running gem list
Profile: thread: 1, samples: 35272, sample avg time: 0.000756691s, total time: 26.69s
% Samples Method
------------------------------------------------------------
7.6 2697 <anonymous module>.keywords_extra
7.4 2602 String#replace
5.8 2041 Array#each
3.5 1218 String#+
2.4 849 String#force_encoding
0.9 327 Hash::Item#initialize