Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Shirai brixen

View GitHub Profile
View gist:37c282ee74b9aa7ede9b007e509b516c
$ git log -S"to_generator"
commit 1b8941fc2448d5cd34f853288d746faf61185674
Author: Brian Shirai <brixen@gmail.com>
Date: Mon Jun 13 10:11:24 2016 -0700
A bit of Enumerator cleanup.
commit d32213f3841de4c1603317cff40afa892cbf3e50
Author: Brian Shirai <brixen@gmail.com>
Date: Wed Sep 18 23:07:37 2013 -0700
View gist:ef94f26ce8898c472cbc08928725d523
$ clang++ -M -Imachine -Imachine/include -Ibuild/libraries/libsodium/src/libsodium/include -Ibuild/libraries/libtommath machine/interpreter/a_equal.cpp
a_equal.o: machine/interpreter/a_equal.cpp \
machine/instructions/a_equal.hpp machine/instructions.hpp \
/usr/include/clang/6.0.0/include/stdint.h /usr/include/stdint.h \
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
/usr/include/features.h /usr/include/stdc-predef.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/bits/long-double.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
View gist:85f0985714cff0f999db033705433b0a
Available flags for AddressSanitizer:
quarantine_size
- Deprecated, please use quarantine_size_mb.
quarantine_size_mb
- Size (in Mb) of quarantine used to detect use-after-free errors. Lower value may reduce memory usage but increase the chance of false negatives.
thread_local_quarantine_size_kb
- Size (in Kb) of thread local quarantine used to detect use-after-free errors. Lower value may reduce memory usage but increase the chance of false negatives. It is not advised to go lower than 64Kb, otherwise frequent transfers to global quarantine might affect performance.
redzone
- Minimal size (in bytes) of redzones around heap objects. Requirement: redzone >= 16, is a power of two.
max_redzone
@brixen
brixen / Code stacktrace
Created Jan 20, 2020
Ubuntu Bionic spec hang
View Code stacktrace
0x7fe38526cc30: IO::FileDescriptor#read_into_storage in core/io.rb:283 (+40)
0x7fe38526ce10: IO::FileDescriptor#read in core/io.rb:258 (+117)
0x7fe38526d000: IO::BufferedFileDescriptor#read in core/io.rb:611 (+113)
0x7fe38526d1f0: IO::FIFOFileDescriptor#eof? in core/io.rb:771 (+4)
0x7fe38526d390: IO#eof? in core/io.rb:2371 (+9)
0x7fe38526d520: IO#each in core/io.rb:2271 (+272)
0x7fe38526d720: IO#gets in core/io.rb:2543 (+38)
0x7fe38526d8f0: IO.foreach in core/io.rb:1187 (+604)
0x7fe38526db90: __block__ in /home/vagrant/devel/rubinius/spec/ruby/core/io/foreach_spec.rb:26 (+28)
0x7fe38526de00: BasicObject#instance_eval in core/basic_object.rb:102 (+172)
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)
You can’t perform that action at this time.