Skip to content

Instantly share code, notes, and snippets.

View yorickpeterse's full-sized avatar

Yorick Peterse yorickpeterse

View GitHub Profile
#include <juno/lexer.hpp>
using namespace Juno::Lexing;
#define ADVANCE_COLUMN column = column + (te - ts)
#define ADVANCE_LINE line++; column = 0;
#define ADD_TOKEN(TYPE) \
tokens->push(this->create_token(TYPE, ts, te, line, column)); \
ADVANCE_COLUMN
class Example
def foo
return 10 + 20
end
end
example = Example.new
method = example.method(:foo).executable
Rubinius::JIT.compile(example, method)
# The contents of this block would be arbitrary, it's _not_ tied into any ORM/database/etc.
define_dummy(:stubbed_user) do |attrs|
user = User.new(attrs)
user.stub(:something).and_return('foo')
user
end
describe User do
source 'https://rubygems.org'
gem 'oga'
@yorickpeterse
yorickpeterse / bench.rb
Last active August 29, 2015 14:13
Manually running the Rubinius JIT on a totally legit fib() benchmark.
require 'benchmark/ips'
class Bench
def fact(n)
if n > 1
n * fact(n-1)
else
1
end
end
Ruby: {"name"=>"Yorick", "age"=>22, "location"=>"Netherlands", "anger_level"=>9000}
CAPI: {"name"=>"Yorick", "age"=>22, "location"=>"Netherlands", "anger_level"=>9000}
Racc: {"name"=>"Yorick", "age"=>22, "location"=>"Netherlands", "anger_level"=>9000}
Calculating -------------------------------------
Ruby reuse 2.966k i/100ms
Ruby new 2.934k i/100ms
CAPI reuse 8.044k i/100ms
CAPI new 7.212k i/100ms
Racc reuse 5.075k i/100ms
Starting program: /home/yorickpeterse/.rubies/rbx-git/bin/rbx -S bundle install
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff4cf7700 (LWP 17025)]
[New Thread 0x7ffff48f6700 (LWP 17026)]
[New Thread 0x7ffff44f5700 (LWP 17027)]
[New Thread 0x7fffe7fff700 (LWP 17028)]
[New Thread 0x7fffe7bfe700 (LWP 17029)]
lib/ll/parser.rll:11:1:error: first/first conflict, multiple branches start with the same terminals
X = A | A;
^
lib/ll/parser.rll:11:5:error: branch starts with: T_NAME, epsilon
X = A | A;
^
lib/ll/parser.rll:11:9:error: branch starts with: T_NAME, epsilon
X = A | A;
^
lib/ll/parser.rll:8:5:error: first/follow conflict, branch can start with epsilon and is followed by (non) terminals

Thread::Backtrace::Location

The Location class is used by Kernel#caller_locations to store information of every call frame in a call stack. Instances of this class can store information such as:

  • The path to the file where the frame originated from
  • The name of the context of the frame (method name, "block", etc)
  • The line number where the frame originated from
** Invoke install (first_time)
** Invoke build:build (first_time)
** Invoke vm/vm (first_time)
** Invoke vm/gen/config_variables.h (first_time, not_needed)
** Invoke library/rubinius/configuration.rb (first_time, not_needed)
** Invoke config.rb (first_time, not_needed)
** Invoke vm/gen/signature.h (first_time, not_needed)
** Invoke kernel/signature.rb (first_time, not_needed)
** Invoke kernel/bootstrap/load_order.txt (first_time, not_needed)
** Invoke kernel/common/load_order.txt (first_time, not_needed)