Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 63ecd268fddd
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 97d797d1e18e
Choose a head ref

Commits on May 23, 2015

  1. Copy the full SHA
    e5def49 View commit details
  2. implement specs for comparing a method defined via define_method and …

    …a method defined via def
    tak1n committed May 23, 2015
    Copy the full SHA
    a8397f5 View commit details

Commits on May 24, 2015

  1. Fix Method#==

    A Method defined via def has an executable attribute of class
    Rubinius::CompiledCode. On the other site a method defined via
    define_method has an executable attribute of class
    Rubinius::BlockEnvironment::AsMethod.
    
    Comparing method equality includes the comparison of executable
    equality.
    
    For comparing an executable of type Rubinius::BlockEnvironment::AsMethod
    against an executable of Rubinius::CompiledCode results in an error because it tries
    to access the block_env attribute on an Rubinius::CompiledCode object,
    which doesn't exist.
    
    This commit adds an early return like in Rubinius::CompiledCode#==
    tak1n committed May 24, 2015
    Copy the full SHA
    a97f197 View commit details
  2. Copy the full SHA
    cadc8ad View commit details
  3. Reintroduce Number arg specs for Regexp.new

    Like done in @7981f2c05671722dcf12f0d4f6bceb46cef29ff5
    tak1n committed May 24, 2015
    Copy the full SHA
    cbae591 View commit details
  4. Reintroduce TypeError raising for Regexp.new

    Regexp.new should raise a TypeError if the given Pattern is an
    Fixnum or Float object
    tak1n committed May 24, 2015
    Copy the full SHA
    a60dfb3 View commit details
  5. Merge pull request #3407 from rubinius/method-equality-3118

    Fix Method equalitiy
    jemc committed May 24, 2015
    Copy the full SHA
    73e862e View commit details
  6. Merge pull request #3408 from rubinius/regex-new-2959

    Regex new 2959
    jemc committed May 24, 2015
    Copy the full SHA
    ffa628e View commit details
  7. Vendored libsodium 1.0.3.

    brixen committed May 24, 2015
    Copy the full SHA
    d7f9443 View commit details
  8. Build libsodium.

    brixen committed May 24, 2015
    Copy the full SHA
    6cfbb77 View commit details

Commits on May 25, 2015

  1. Copy the full SHA
    e265991 View commit details
  2. Merge pull request #3410 from heftig/master

    Fix a __GNUC__ check to work with GCC 5
    brixen committed May 25, 2015
    Copy the full SHA
    92ba19d View commit details
  3. Merge pull request #3406 from rubinius/proc-curry-2951

     fix Proc#curry
    brixen committed May 25, 2015
    Copy the full SHA
    f1f0d75 View commit details
  4. Added mirror for Proc#curry. Improves #3406.

    There is still a lot of cruft in the Rubinius kernel but generally we use the
    mirror facility to implement methods that are not public Ruby API methods (and are
    generally C functions in MRI).
    brixen committed May 25, 2015
    Copy the full SHA
    93a80e0 View commit details
  5. Copy the full SHA
    0ec240a View commit details
  6. Copy the full SHA
    1857962 View commit details
  7. add 2.2 branch to ci

    tak1n committed May 25, 2015
    Copy the full SHA
    fc08625 View commit details
  8. Merge pull request #3413 from rubinius/add-2.2-to-ci

    Add 2.2 branch to travis
    Yorick Peterse committed May 25, 2015
    Copy the full SHA
    617ca4d View commit details
  9. LLVM is required.

    brixen committed May 25, 2015
    Copy the full SHA
    01a6198 View commit details
  10. Fixed default-in-covered-case warning.

    This was seen on Travis CI OS X environment:
    
    2: CXX vm/builtin/encoding.cpp
    
    vm/builtin/encoding.cpp:729:5: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
    
        default:
    brixen committed May 25, 2015
    Copy the full SHA
    2906de3 View commit details
  11. Copy the full SHA
    97d797d View commit details
Showing 516 changed files with 99,180 additions and 319 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ branches:
only:
- master
- 1.8.7
- 2.2
- /^v\d+\./

notifications:
28 changes: 13 additions & 15 deletions configure
Original file line number Diff line number Diff line change
@@ -58,7 +58,6 @@ class Configure
@gem = nil

# LLVM settings
@llvm_enabled = true
@llvm_path = nil
@llvm_system_name = get_system_name
@llvm_configure = nil
@@ -329,10 +328,6 @@ class Configure

o.doc "\n LLVM settings"

o.on "--disable-llvm", "Don't build with LLVM" do
@llvm_enabled = false
end

o.on "--system-name", "NAME", "Name of OS (eg fedora-8, ubuntu-10.04)" do |name|
@llvm_system_name = name
end
@@ -453,6 +448,7 @@ class Configure

feature "execinfo", true
feature "vendor-zlib", false
feature "vendor-libsodium", true
feature "alloc-tracking", false
feature "fibers", true
feature "dtrace", false
@@ -558,11 +554,6 @@ class Configure
end

def setup_llvm
unless @llvm_enabled
@log.write "WARNING: LLVM disabled."
return false
end

@log.print " Checking for 'llvm-config': "

config = @llvm_configure
@@ -1155,6 +1146,11 @@ int main() { return tgetnum(""); }
@include_dirs << "#{@vendored_libdir}/zlib"
@lib_dirs << "#{@vendored_libdir}/zlib"
end

if @features["vendor-libsodium"].value
@include_dirs << "#{@vendored_libdir}/libsodium/src/libsodium/include"
@lib_dirs << "#{@vendored_libdir}/libsodium/src/libsodium/.libs/"
end
end

def detect_features
@@ -1265,6 +1261,12 @@ int main() { return tgetnum(""); }
end
end

unless @features["vendor-libsodium"].value
unless has_header("sodium.h")
failure "sodium.h is required"
end
end

unless has_header("openssl/ssl.h")
failure "openssl/ssl.h is required"
end
@@ -1463,10 +1465,6 @@ int main() { return tgetnum(""); }
def write_configure_files
@log.write "\nWriting configuration files..."

unless @llvm_enabled
@llvm_configure = ""
end

@bin_links.delete @program_name

config_settings = {
@@ -1475,7 +1473,6 @@ int main() { return tgetnum(""); }
:build_make => @make,
:build_rake => @rake,
:build_perl => @perl,
:llvm_enabled => @llvm_enabled,
:llvm_path => @llvm_path,
:llvm_system_name => @llvm_system_name,
:llvm_configure => @llvm_configure,
@@ -1544,6 +1541,7 @@ int main() { return tgetnum(""); }
:bsd => @bsd,
:linux => @linux,
:vendor_zlib => @features["vendor-zlib"].value,
:vendor_libsodium => @features["vendor-libsodium"].value,
:vm_release_h => @vm_release_h,
:bootstrap_gems => @bootstrap_gems,
:runtime_gems => @runtime_gems,
1 change: 1 addition & 0 deletions kernel/common/block_environment.rb
Original file line number Diff line number Diff line change
@@ -105,6 +105,7 @@ def ==(other)
# when given a Proc.
#
# The methods are equal if the BEs are equal.
return false unless other.kind_of? AsMethod

@block_env == other.block_env
end
4 changes: 4 additions & 0 deletions kernel/common/capi.rb
Original file line number Diff line number Diff line change
@@ -186,5 +186,9 @@ def self.rb_integer_pack(value, words, numwords, wordsize, nails, flags)
return 1
end
end

def self.rb_block_proc(env)
Rubinius::Mirror::Proc.from_block ::Proc, env
end
end
end
2 changes: 1 addition & 1 deletion kernel/common/kernel.rb
Original file line number Diff line number Diff line change
@@ -481,7 +481,7 @@ def lambda

raise ArgumentError, "block required" unless env

prc = Proc.__from_block__(env)
prc = Rubinius::Mirror::Proc.from_block ::Proc, env

# Make a proc lambda only when passed an actual block (ie, not using the
# "&block" notation), otherwise don't modify it at all.
1 change: 1 addition & 0 deletions kernel/common/load_order.txt
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ autoload.rbc
module.rbc
binding.rbc
proc.rbc
proc_mirror.rbc
enumerable_helper.rbc
enumerable.rbc
enumerator.rbc
42 changes: 9 additions & 33 deletions kernel/common/proc.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
class Proc

def self.__from_block__(env)
Rubinius.primitive :proc_from_env

if Rubinius::Type.object_kind_of? env, Rubinius::BlockEnvironment
raise PrimitiveFailure, "Proc.__from_block__ primitive failed to create Proc from BlockEnvironment"
else
begin
env.to_proc
rescue Exception
raise ArgumentError, "Unable to convert #{env.inspect} to a Proc"
end
end
# The compiler must be fixed before this method can be removed.
Rubinius::Mirror::Proc.from_block self, env
end

def self.new(*args)
@@ -35,7 +25,7 @@ def self.new(*args)
end
end

block = __from_block__(env)
block = Rubinius::Mirror::Proc.from_block self, env

if block.class != self
block = block.dup
@@ -94,29 +84,15 @@ def curry(curried_arity = nil)

args = []

my_self = self
m = lambda? ? :lambda : :proc
f = __send__(m) {|*x|
call_args = args + x
if call_args.length >= my_self.arity
my_self[*call_args]
else
args = call_args
f
end
}
m = Rubinius::Mirror.reflect self
f = m.curry self, [], arity

f.singleton_class.send(:define_method, :binding) {
f.singleton_class.send(:define_method, :binding) do
raise ArgumentError, "cannot create binding from f proc"
}

f.singleton_class.send(:define_method, :parameters) {
[[:rest]]
}
end

f.singleton_class.send(:define_method, :source_location) {
nil
}
f.singleton_class.thunk_method :parameters, [[:rest]]
f.singleton_class.thunk_method :source_location, nil

f
end
37 changes: 37 additions & 0 deletions kernel/common/proc_mirror.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module Rubinius
class Mirror
class Proc < Mirror
def self.from_block(klass, env)
begin
return Rubinius.invoke_primitive :proc_from_env, env, klass
rescue Rubinius::Internal => exc
if Type.object_kind_of? env, BlockEnvironment
msg = "unable to create Proc from BlockEnvironment"
raise PrimitiveFailure, msg, exc
end
end

begin
env.to_proc
rescue Exception
raise ArgumentError, "Unable to convert #{env.inspect} to a Proc"
end
end

def curry(executable, args, arity)
args.freeze

name = executable.lambda? ? :lambda : :proc

Proc.__send__(name) do |*a, &b|
all_args = args + a
if all_args.size < arity
curry executable, all_args, arity
else
executable[*all_args]
end
end
end
end
end
end
2 changes: 2 additions & 0 deletions kernel/common/regexp.rb
Original file line number Diff line number Diff line change
@@ -128,6 +128,8 @@ def initialize(pattern, opts=nil, lang=nil)
if pattern.kind_of?(Regexp)
opts = pattern.options
pattern = pattern.source
elsif pattern.kind_of?(Fixnum) or pattern.kind_of?(Float)
raise TypeError, "can't convert Fixnum into String"
elsif opts.kind_of?(Fixnum)
opts = opts & (OPTION_MASK | KCODE_MASK) if opts > 0
elsif opts
2 changes: 1 addition & 1 deletion kernel/delta/rubinius.rb
Original file line number Diff line number Diff line change
@@ -359,7 +359,7 @@ def self.lambda

raise ArgumentError, "block required" unless env

prc = Proc.__from_block__(env)
prc = Rubinius::Mirror::Proc.from_block ::Proc, env

# Make a proc lambda only when passed an actual block (ie, not using the
# "&block" notation), otherwise don't modify it at all.
100 changes: 56 additions & 44 deletions rakelib/blueprint.rb
Original file line number Diff line number Diff line change
@@ -181,6 +181,22 @@
files << zlib
end

if Rubinius::BUILD_CONFIG[:vendor_libsodium]
sodium = i.external_lib "vendor/libsodium" do |l|
l.cflags = ["-I#{src}/vendor/libsodium/src/libsodium/include"] + gcc.cflags
l.objects = [l.file("src/libsodium/.libs/libsodium.a")]
l.to_build do |x|
unless File.exist?("Makefile") and File.exist?("zconf.h")
x.command "sh -c ./configure"
end

x.command make
end
end
gcc.add_library sodium
files << sodium
end

if Rubinius::BUILD_CONFIG[:windows]
winp = i.external_lib "vendor/winpthreads" do |l|
l.cflags = ["-I#{src}/vendor/winpthreads/include"] + gcc.cflags
@@ -196,57 +212,53 @@
files << winp
end

if Rubinius::BUILD_CONFIG[:llvm_enabled]
conf = Rubinius::BUILD_CONFIG[:llvm_configure]

include_dir = `#{conf} --includedir`.chomp
gcc.cflags << "-I#{include_dir}"
gcc.cxxflags << Rubinius::BUILD_CONFIG[:llvm_cxxflags]

flags = `#{conf} --cflags`.strip.split(/\s+/)
flags.delete_if { |x| x.index("-O") == 0 }
flags.delete_if { |x| x =~ /-D__STDC/ }
flags.delete_if { |x| x == "-DNDEBUG" }
flags.delete_if { |x| x == "-fomit-frame-pointer" }
flags.delete_if { |x| x == "-pedantic" }
flags.delete_if { |x| x == "-W" }
flags.delete_if { |x| x == "-Wextra" }

# llvm-config may leak FORTIFY_SOURCE in the CFLAGS list on certain
# platforms. If this is the case then debug builds will fail. Sadly there's
# no strict guarantee on how LLVM formats this option, hence the Regexp.
#
# For example, on CentOS the option is added as -Wp,-D_FORTIFY_SOURCE=2.
# There's no strict guarantee that I know of that it will always be this
# exact format.
if Rubinius::BUILD_CONFIG[:debug_build]
flags.delete_if { |x| x =~ /_FORTIFY_SOURCE/ }
end

flags << "-DENABLE_LLVM"
conf = Rubinius::BUILD_CONFIG[:llvm_configure]

include_dir = `#{conf} --includedir`.chomp
gcc.cflags << "-I#{include_dir}"
gcc.cxxflags << Rubinius::BUILD_CONFIG[:llvm_cxxflags]

flags = `#{conf} --cflags`.strip.split(/\s+/)
flags.delete_if { |x| x.index("-O") == 0 }
flags.delete_if { |x| x =~ /-D__STDC/ }
flags.delete_if { |x| x == "-DNDEBUG" }
flags.delete_if { |x| x == "-fomit-frame-pointer" }
flags.delete_if { |x| x == "-pedantic" }
flags.delete_if { |x| x == "-W" }
flags.delete_if { |x| x == "-Wextra" }

# llvm-config may leak FORTIFY_SOURCE in the CFLAGS list on certain
# platforms. If this is the case then debug builds will fail. Sadly there's
# no strict guarantee on how LLVM formats this option, hence the Regexp.
#
# For example, on CentOS the option is added as -Wp,-D_FORTIFY_SOURCE=2.
# There's no strict guarantee that I know of that it will always be this
# exact format.
if Rubinius::BUILD_CONFIG[:debug_build]
flags.delete_if { |x| x =~ /_FORTIFY_SOURCE/ }
end

ldflags = Rubinius::BUILD_CONFIG[:llvm_ldflags]
ldflags = Rubinius::BUILD_CONFIG[:llvm_ldflags]

if Rubinius::BUILD_CONFIG[:llvm_shared_objs]
objects = Rubinius::BUILD_CONFIG[:llvm_shared_objs]
else
objects = `#{conf} --libfiles`.strip.split(/\s+/)
end
if Rubinius::BUILD_CONFIG[:llvm_shared_objs]
objects = Rubinius::BUILD_CONFIG[:llvm_shared_objs]
else
objects = `#{conf} --libfiles`.strip.split(/\s+/)
end

if Rubinius::BUILD_CONFIG[:windows]
ldflags = ldflags.sub(%r[-L/([a-zA-Z])/], '-L\1:/')
if Rubinius::BUILD_CONFIG[:windows]
ldflags = ldflags.sub(%r[-L/([a-zA-Z])/], '-L\1:/')

objects.select do |f|
f.sub!(%r[^/([a-zA-Z])/], '\1:/')
File.file? f
end
objects.select do |f|
f.sub!(%r[^/([a-zA-Z])/], '\1:/')
File.file? f
end
end

gcc.cflags.concat flags
gcc.ldflags.concat objects
gcc.cflags.concat flags
gcc.ldflags.concat objects

gcc.ldflags << ldflags
end
gcc.ldflags << ldflags

# Make sure to push these up front so vm/ stuff has priority
dirs = %w[ /vm /vm/include /vm/builtin ]
8 changes: 8 additions & 0 deletions spec/ruby/core/method/shared/eql.rb
Original file line number Diff line number Diff line change
@@ -54,6 +54,14 @@
@m_foo.send(@method, m2).should be_true
end

it "returns false if comparing a method defined via define_method and def" do
defn = @m.method(:zero)
defined = @m.method(:zero_defined_method)

defn.send(@method, defined).should be_false
defined.send(@method, defn).should be_false
end

describe 'missing methods' do
it "returns true for the same method missing" do
miss1 = @m.method(:handled_via_method_missing)
Loading