Skip to content

Instantly share code, notes, and snippets.

Brandon Fish bjfish

Block or report user

Report or block bjfish

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
@bjfish
bjfish / run_each.rb
Created Mar 5, 2015
run jt untag with 90 second timeout, then jt test if specs were untagged, if jt test fails checkout the changes to the tag file
View run_each.rb
require 'timeout'
files = Dir.glob("spec/ruby/core/*/*")
files.reject! { |f| File.directory?(f) }
num = 1
total = files.size
files.each_with_index do |file, index|
specname = file.split('/').last.split('_')[0..-2].join('_')
puts "specname #{specname}"
@bjfish
bjfish / run_each_dir.rb
Created Mar 5, 2015
Just run each directory in core with a 90 second timeout
View run_each_dir.rb
require 'timeout'
files = Dir.glob("spec/ruby/core/*/")
files.map! {|x| x[0..-2] }
files.each do |file|
command = "ruby tool/jt.rb untag #{file}"
puts "starting process #{command}"
pid = Process.spawn(command)
begin
View gist:42eebb20cbcb311a6ffb
Count: 644, Method: `sysopen' for Class
Count: 183, Method: `compile' for Class
Count: 111, Method: `closed?' for Object
Count: 71, Method: `read' for Class
Count: 59, Method: `chmod' for Class
Count: 56, Method: `popen' for Class
Count: 54, Method: `pipe' for Class
Count: 45, Method: `lstat' for Class
Count: 42, Method: `primitive_convert' for Encoding::Converter
Count: 40, Method: `umask' for Class
View gist:19d8ae424678e1a1ff0a
jruby: using Graal Truffle Runtime
[truffle] opt fail _scan:/Users/brandonfish/Documents/jruby-mine/lib/ruby/truffle/rubysl/rubysl-strscan/lib/rubysl/strscan/strscan.rb:280|Reason com.oracle.graal.nodes.util.GraphUtil$2: This code path should never be part of a compilation. []
[truffle] opt fail full:core:/core/shims.rb:177 <split-0-U> |Reason com.oracle.graal.nodes.util.GraphUtil$2: This code path should never be part of a compilation. []
[truffle] opt fail MatchData#begin(core):core: MatchData#begin <split-1-U> |Reason com.oracle.graal.nodes.util.GraphUtil$2: This code path should never be part of a compilation. []
[truffle] opt fail MatchData#end(core):core: MatchData#end <split-1-U> |Reason com.oracle.graal.nodes.util.GraphUtil$2: This code path should never be part of a compilation. []
[truffle] opt fail parse_string:json_test.rb:1068 |Reason com.oracle.graal.nodes.util.GraphUtil$2: This code path shou
@bjfish
bjfish / gist:f0d7bdbdc7d52150d409
Created Mar 6, 2015
Unique IDs in Graal Output
View gist:f0d7bdbdc7d52150d409
Add this method to RubyNode -
public static void notDesignedForCompilation(String message) {
CompilerAsserts.neverPartOfCompilation(message);
}
Add Unique ID to notDesignedForCompilation method in All Methods -
@Specialization(guards = {"!isRubyModule", "!isRubyBignum"})
public Object alias(RubyBasicObject object) {
notDesignedForCompilation("5c0619014d0a4e0f9880499ff32473e1");
@bjfish
bjfish / json_test.rb
Created Mar 7, 2015
json_pure smashed into one file for testing purposes
View json_test.rb
if ENV['SIMPLECOV_COVERAGE'].to_i == 1
require 'simplecov'
SimpleCov.start do
add_filter "/tests/"
end
end
module JSON
# JSON version
VERSION = '1.8.2'
VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
View gist:04a25dd9a3b4806feaa9
a = "hello"
1001.times {
a.byteslice(1) #=> "e"
a.byteslice(-1) #=> "o"
a.byteslice(1, 2) #=> "el"
}
sleep 5
View gist:d2f0b8211117d6714f62
ore:/core/rubinius/bootstrap/time.rb:28:in `Time': internal implementation error - NoClassDefFoundError org/jruby/truffle/nodes/rubinius/TimePrimitiveNodesFactory$TimeSNowPrimitiveNodeFactory$TimeSNowPrimitiveRubyClassNode org.jruby.truffle.nodes.rubinius.TimePrimitiveNodesFactory$TimeSNowPrimitiveNodeFactory$TimeSNowPrimitiveBaseNode.specialize0(TimePrimitiveNodesFactory.java:140) (RubyTruffleError)
from json_test.rb:1784:in `<main>'
Truffle internal error: java.lang.NoClassDefFoundError: org/jruby/truffle/runtime/subsystems/ThreadManager$1
java.lang.NoClassDefFoundError: org/jruby/truffle/runtime/subsystems/ThreadManager$1
at org.jruby.truffle.runtime.subsystems.ThreadManager.shutdown(ThreadManager.java:150)
at org.jruby.truffle.runtime.RubyContext.shutdown(RubyContext.java:273)
at org.jruby.truffle.TruffleBridgeImpl.shutdown(TruffleBridgeImpl.java:198)
at org.jruby.Ruby.shutdownTruffleBridge(Ruby.java:948)
at org.jruby.Main.doRunFromMain(Main.java:406)
at org.jruby.Main.internalRun(Main.java:299)
@bjfish
bjfish / gist:5f77ee3fc724c609853e
Created Mar 10, 2015
before and after tuple.rb method
View gist:5f77ee3fc724c609853e
# normal usage in array method
@tuple.swap i, random
# becomes
swap(@tuple, i, random)
# normally in tuple.rb
def swap(a, b)
temp = at(a)
self[a] = at(b)
@bjfish
bjfish / gist:f247a80ffd5b0fa2306a
Created Mar 10, 2015
before and after tuple.rb method
View gist:f247a80ffd5b0fa2306a
# normal usage in array method
@tuple.swap i, random
# becomes
swap(@tuple, i, random)
# normally in tuple.rb
def swap(a, b)
temp = at(a)
self[a] = at(b)
You can’t perform that action at this time.