Skip to content

Instantly share code, notes, and snippets.

@bjfish
bjfish / run_each.rb
Created March 5, 2015 14:35
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
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 March 5, 2015 14:43
Just run each directory in core with a 90 second timeout
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
@bjfish
bjfish / gist:42eebb20cbcb311a6ffb
Created March 5, 2015 17:42
Most Undefined Methods
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
@bjfish
bjfish / gist:19d8ae424678e1a1ff0a
Created March 6, 2015 13:35
json_pure graal errors
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 March 6, 2015 17:00
Unique IDs in Graal Output
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 March 7, 2015 14:41
json_pure smashed into one file for testing purposes
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:
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)
a = "hello"
1001.times {
a.byteslice(1) #=> "e"
a.byteslice(-1) #=> "o"
a.byteslice(1, 2) #=> "el"
}
sleep 5
@bjfish
bjfish / gist:5f77ee3fc724c609853e
Created March 10, 2015 13:57
before and after tuple.rb method
# 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 March 10, 2015 13:57
before and after tuple.rb method
# 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)