Skip to content

Instantly share code, notes, and snippets.

View brixen's full-sized avatar

Brian Shirai brixen

View GitHub Profile
$ rbx compile -B -e 'def m(a, b)
m { |a| a }
mm { |x, y| a + b }
end'
============= :__script__ ==============
Arguments: 0 required, 0 post, 0 total
Arity: 0
Locals: 0
Stack size: 5
$ clang++ -I. -I./build/libraries/rapidjson -I./build/libraries/libtommath -I./machine -I./machine/include -I./machine/include/capi -std=c++11 -MM machine/instructions/m_timer_start.hpp
m_timer_start.o: machine/instructions/m_timer_start.hpp \
machine/instructions.hpp machine/defines.hpp machine/util/optimize.hpp \
machine/call_frame.hpp machine/stack_variables.hpp \
machine/class/object.hpp machine/memory/header.hpp machine/config.h \
machine/detection.hpp machine/object_types.hpp machine/type_info.hpp \
machine/executor.hpp machine/util/thread.hpp machine/util/atomic.hpp \
machine/util/atomic_types.hpp machine/logger.hpp machine/spinlock.hpp \
machine/bug.hpp machine/vm.hpp machine/missing/time.h \
machine/globals.hpp machine/memory/root.hpp machine/linkedlist.hpp \
@brixen
brixen / gist:ef849d23078ee3fc617c7f40ad3630bf
Last active January 25, 2018 21:54
Building Rubinius 3.95 on Alpine 3.7
$ docker run -it alpine sh
/ # apk add --no-cache clang
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/5) Installing libgcc (6.4.0-r5)
(2/5) Installing libstdc++ (6.4.0-r5)
(3/5) Installing clang-libs (5.0.0-r0)
(4/5) Installing libxml2 (2.9.7-r0)
(5/5) Installing clang (5.0.0-r0)
Executing busybox-1.27.2-r7.trigger
$ lldb -f /source/rubinius/rubinius/build/rubinius/bin/rbx -- -Xmemory.collection.log=yes /source/rubinius/rubinius/build/rubinius/gems/bin/bundle install --jobs=40
(lldb) target create "/source/rubinius/rubinius/build/rubinius/bin/rbx"
Current executable set to '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64).
(lldb) settings set -- target.run-args "-Xmemory.collection.log=yes" "/source/rubinius/rubinius/build/rubinius/gems/bin/bundle" "install" "--jobs=40"
(lldb) b data.cpp:41
Breakpoint 1: 2 locations.
(lldb) br list
Current breakpoints:
1: file = 'data.cpp', line = 41, exact_match = 0, locations = 2
1.1: where = rbx`rubinius::capi::Handle::as_rtypeddata(rubinius::NativeMethodEnvironment*) + 102 at data.cpp:41, address = rbx[0x0000000100024746], unresolved, hit count = 0
$ lldb -f /source/rubinius/rubinius/build/rubinius/bin/rbx -- -Xmemory.collection.log=yes /source/rubinius/rubinius/build/rubinius/gems/bin/bundle install --jobs=40
(lldb) target create "/source/rubinius/rubinius/build/rubinius/bin/rbx"
Current executable set to '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64).
(lldb) settings set -- target.run-args "-Xmemory.collection.log=yes" "/source/rubinius/rubinius/build/rubinius/gems/bin/bundle" "install" "--jobs=40"
(lldb) b interpreter.cpp:305
Breakpoint 1: where = rbx`rubinius::Interpreter::execute(rubinius::State*, rubinius::MachineCode*) + 304 at interpreter.cpp:305, address = 0x00000001000be720
(lldb) r
Process 4784 launched: '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64)
Fetching gem metadata from https://rubygems.org/.........
Using rake 12.3.0
$ lldb -f /source/rubinius/rubinius/build/rubinius/bin/rbx -- -Xmemory.collection.log=yes /source/rubinius/rubinius/build/rubinius/gems/bin/bundle install --jobs=40
(lldb) target create "/source/rubinius/rubinius/build/rubinius/bin/rbx"
Current executable set to '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64).
(lldb) settings set -- target.run-args "-Xmemory.collection.log=yes" "/source/rubinius/rubinius/build/rubinius/gems/bin/bundle" "install" "--jobs=40"
(lldb) r
Process 94715 launched: '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64)
Fetching gem metadata from https://rubygems.org/.........
Using rake 12.3.0
Using minitest 5.11.1
Fetching thread_safe 0.3.6
@brixen
brixen / gist:3bdf96209101f7b435e85b54795dbaa9
Last active January 23, 2018 19:32
Concurrency issue with Psych
$ lldb -f /source/rubinius/rubinius/build/rubinius/bin/rbx -- -Xmemory.collection.log=yes /source/rubinius/rubinius/build/rubinius/gems/bin/bundle install --jobs=40
(lldb) target create "/source/rubinius/rubinius/build/rubinius/bin/rbx"
Current executable set to '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64).
(lldb) settings set -- target.run-args "-Xmemory.collection.log=yes" "/source/rubinius/rubinius/build/rubinius/gems/bin/bundle" "install" "--jobs=40"
(lldb) r
Process 87251 launched: '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64)
verify_certificate_identity: locking: 28632
Fetching gem metadata from https://rubygems.org/..verify_certificate_identity: locking: 28632
.......
Using rake 12.3.0
@brixen
brixen / gist:21be51f0beb317f474e0f5d6fb26fd4d
Created January 23, 2018 03:53
Running everything under a global C-API lock
$ lldb -f /source/rubinius/rubinius/build/rubinius/bin/rbx -- -Xmemory.collection.log=yes -Xcapi.lock=yes /source/rubinius/rubinius/build/rubinius/gems/bin/bundle install --jobs=40
(lldb) target create "/source/rubinius/rubinius/build/rubinius/bin/rbx"
Current executable set to '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64).
(lldb) settings set -- target.run-args "-Xmemory.collection.log=yes" "-Xcapi.lock=yes" "/source/rubinius/rubinius/build/rubinius/gems/bin/bundle" "install" "--jobs=40"
(lldb) r
Process 85412 launched: '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64)
Fetching gem metadata from https://rubygems.org/.........
Using rake 12.3.0
Using minitest 5.11.1
Fetching thread_safe 0.3.6
$ lldb -f /source/rubinius/rubinius/build/rubinius/bin/rbx -- -Xmemory.collection.log=yes /source/rubinius/rubinius/build/rubinius/gems/bin/bundle install --jobs=40
(lldb) target create "/source/rubinius/rubinius/build/rubinius/bin/rbx"
Current executable set to '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64).
(lldb) settings set -- target.run-args "-Xmemory.collection.log=yes" "/source/rubinius/rubinius/build/rubinius/gems/bin/bundle" "install" "--jobs=40"
(lldb) r
Process 85037 launched: '/source/rubinius/rubinius/build/rubinius/bin/rbx' (x86_64)
Fetching gem metadata from https://rubygems.org/.........
Using rake 12.3.0
Using minitest 5.11.1
Fetching thread_safe 0.3.6
* thread #44, name = 'Parallel Installer Worker #38'
* frame #0: 0x00007fff6c059d1e libsystem_kernel.dylib`__psynch_mutexwait + 10
frame #1: 0x00007fff6c195bfe libsystem_pthread.dylib`_pthread_mutex_lock_wait + 83
frame #2: 0x00007fff6c193551 libsystem_pthread.dylib`_pthread_mutex_lock_slow + 253
frame #3: 0x000000010052078f libc++.1.dylib`std::__1::mutex::lock() + 9
frame #4: 0x00000001000f2707 rbx`rubinius::memory::FinalizerThread::native_finalizer(rubinius::State*, rubinius::Object*, void (*)(rubinius::State*, rubinius::Object*)) [inlined] std::__1::lock_guard<std::__1::mutex>::lock_guard(__m=0x000000010072f7d8) at __mutex_base:108 [opt]
frame #5: 0x00000001000f2702 rbx`rubinius::memory::FinalizerThread::native_finalizer(rubinius::State*, rubinius::Object*, void (*)(rubinius::State*, rubinius::Object*)) [inlined] std::__1::lock_guard<std::__1::mutex>::lock_guard(__m=0x000000010072f7d8) at __mutex_base:108 [opt]
frame #6: 0x00000001000f2702 rbx`rubinius::memory::FinalizerThread::na