Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into compiler
Browse files Browse the repository at this point in the history
Conflicts:
	rakelib/blueprint.rb
  • Loading branch information
brixen committed Aug 3, 2013
2 parents f7b40e2 + 957a91b commit f15a614
Show file tree
Hide file tree
Showing 168 changed files with 6,525 additions and 25,278 deletions.
29 changes: 29 additions & 0 deletions benchmark/library/openssl/bench_hexdigest.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'digest/sha1'
require 'openssl'
require 'openssl/digest'
require 'benchmark'
require 'benchmark/ips'

input = 'hello, world!' * 100

Benchmark.ips do |bench|
bench.report 'Digest SHA1' do |times|
digest = Digest::SHA1.new
i = 0

while i < times
digest.hexdigest(input)
i += 1
end
end

bench.report 'OpenSSL SHA1' do |times|
digest = OpenSSL::Digest::SHA1.new
i = 0

while i < times
digest.hexdigest(input)
i += 1
end
end
end
25 changes: 0 additions & 25 deletions benchmark/library/openssl/digest.rb

This file was deleted.

6 changes: 3 additions & 3 deletions kernel/common/dir_glob.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def call(env, start)
return unless File.exists? start return unless File.exists? start


# Even though the recursive entry is zero width # Even though the recursive entry is zero width
# in this case, it's left seperator is still the # in this case, its left separator is still the
# dominant one, so we fix things up to use it. # dominant one, so we fix things up to use it.
switched = @next.dup switched = @next.dup
switched.separator = @separator switched.separator = @separator
Expand Down Expand Up @@ -104,7 +104,7 @@ def call(env, start)
raise "invalid usage" if start raise "invalid usage" if start


# Even though the recursive entry is zero width # Even though the recursive entry is zero width
# in this case, it's left seperator is still the # in this case, its left separator is still the
# dominant one, so we fix things up to use it. # dominant one, so we fix things up to use it.
if @separator if @separator
switched = @next.dup switched = @next.dup
Expand Down Expand Up @@ -151,7 +151,7 @@ def call(env, start)
class Match < Node class Match < Node
def initialize(nxt, flags, glob) def initialize(nxt, flags, glob)
super nxt, flags super nxt, flags
@glob = glob @glob = glob || ""
end end


def match?(str) def match?(str)
Expand Down
1 change: 1 addition & 0 deletions kernel/common/module.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def set_visibility(meth, vis, where=nil)
def set_class_visibility(meth, vis) def set_class_visibility(meth, vis)
Rubinius::Type.object_singleton_class(self).set_visibility meth, vis, "class " Rubinius::Type.object_singleton_class(self).set_visibility meth, vis, "class "
end end
private :set_class_visibility


def protected(*args) def protected(*args)
if args.empty? if args.empty?
Expand Down
24 changes: 13 additions & 11 deletions kernel/common/process21.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ def self.setup_redirects(redirects)
key.reopen(File.open(file, mode_string, perms)) key.reopen(File.open(file, mode_string, perms))
else else
val = fd_to_io(val) val = fd_to_io(val)
val.close_on_exec = false
val.autoclose = false
key.reopen(val) key.reopen(val)
end end
end end
Expand All @@ -238,11 +240,20 @@ def self.setup_options(options)
if umask = options[:umask] if umask = options[:umask]
File.umask(umask) File.umask(umask)
end end

unless options[:close_others] == false
3.upto(IO.max_open_fd).each do |fd|
begin
IO.for_fd(fd, :autoclose => false).close_on_exec = true
rescue Errno::EBADF
end
end
end
end end


def self.exec(env, prog, argv, redirects, options) def self.exec(env, prog, argv, redirects, options)
setup_redirects(redirects)
setup_options(options) setup_options(options)
setup_redirects(redirects)
ENV.update(env) ENV.update(env)
Process.perform_exec prog, argv Process.perform_exec prog, argv
end end
Expand Down Expand Up @@ -285,18 +296,9 @@ def self.exec(*args)
def self.spawn(*args) def self.spawn(*args)
env, prog, argv, redirects, options = Rubinius::Spawn.extract_arguments(*args) env, prog, argv, redirects, options = Rubinius::Spawn.extract_arguments(*args)


unless options[:close_others] == false
3.upto(IO.max_open_fd).each do |fd|
begin
IO.for_fd(fd, :autoclose => false).close_on_exec = true
rescue Errno::EBADF
end
end
end

IO.pipe do |read, write| IO.pipe do |read, write|
pid = Process.fork do pid = Process.fork do
read.close read.close_on_exec = true
write.close_on_exec = true write.close_on_exec = true


begin begin
Expand Down
10 changes: 5 additions & 5 deletions rakelib/blueprint.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@
end end
files << oniguruma files << oniguruma


gdtoa = i.external_lib "vendor/libgdtoa" do |l| double_conversion = i.external_lib "vendor/double-conversion" do |l|
l.cflags = ["-I#{src}/vendor/libgdtoa"] + gcc.cflags l.cflags = ["-Ivendor/double-conversion/src"] + gcc.cflags
l.objects = [l.file("libgdtoa.a")] l.objects = [l.file("libdoubleconversion.a")]
l.to_build do |x| l.to_build do |x|
x.command make x.command make
end end
end end
gcc.add_library gdtoa gcc.add_library double_conversion
files << gdtoa files << double_conversion


ffi = i.external_lib "vendor/libffi" do |l| ffi = i.external_lib "vendor/libffi" do |l|
l.cflags = ["-I#{src}/vendor/libffi/include"] + gcc.cflags l.cflags = ["-I#{src}/vendor/libffi/include"] + gcc.cflags
Expand Down
31 changes: 31 additions & 0 deletions spec/core/module/set_class_visibility_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,31 @@
require File.expand_path('../../../spec_helper', __FILE__)

describe "Module#set_class_visibility" do
before :each do
@module = Module.new { def self.public_method; end }
end

it "is a private method" do
Module.should have_private_instance_method(:set_class_visibility, false)
end

it "modifies class method visibility" do
@module.send :set_class_visibility, :public_method, :protected
@module.protected_methods(false).should include(stasy(:public_method))

@module.send :set_class_visibility, :public_method, :private
@module.should have_private_method(:public_method, false)

@module.send :set_class_visibility, :public_method, :public
@module.public_methods(false).should include(stasy(:public_method))
end

it "accepts a String name as Symbol" do
@module.send :set_class_visibility, "public_method", :private
@module.should have_private_method(:public_method, false)
end

it "returns the coerced name" do
@module.send(:set_class_visibility, "public_method", :private).should equal(:public_method)
end
end
27 changes: 27 additions & 0 deletions spec/core/module/set_visibility_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,27 @@
require File.expand_path('../../../spec_helper', __FILE__)

describe "Module#set_visibility" do
before :each do
@module = Module.new { def public_method; end }
end

it "modifies instance method visibility" do
@module.set_visibility :public_method, :protected
@module.should have_protected_instance_method(:public_method, false)

@module.set_visibility :public_method, :private
@module.should have_private_instance_method(:public_method, false)

@module.set_visibility :public_method, :public
@module.should have_public_instance_method(:public_method, false)
end

it "accepts a String name as Symbol" do
@module.set_visibility "public_method", :private
@module.should have_private_instance_method(:public_method, false)
end

it "returns the coerced name" do
@module.set_visibility("public_method", :private).should equal(:public_method)
end
end
23 changes: 23 additions & 0 deletions spec/core/module/thunk_method_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,23 @@
require File.expand_path('../../../spec_helper', __FILE__)

describe "Module#thunk_method" do
before :each do
@class = Class.new
@value = Object.new
end

it "defines a reader method that always returns same value" do
@class.thunk_method :a_reader, @value
@class.new.a_reader.should equal(@value)
@class.new.a_reader.should equal(@value)
end

it "accepts a String name as Symbol" do
@class.thunk_method "a_reader", @value
@class.new.a_reader.should equal(@value)
end

it "returns the coerced name" do
@class.thunk_method("a_reader", @value).should equal(:a_reader)
end
end
4 changes: 4 additions & 0 deletions spec/ruby/core/dir/glob_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
Dir.glob("spec/**/*.rb").should == [] Dir.glob("spec/**/*.rb").should == []
end end


it "matches nothing when given an empty list of paths" do
Dir.glob('{}').should == []
end

platform_is_not(:windows) do platform_is_not(:windows) do
it "matches the literal character '\\' with option File::FNM_NOESCAPE" do it "matches the literal character '\\' with option File::FNM_NOESCAPE" do
Dir.mkdir 'foo?bar' Dir.mkdir 'foo?bar'
Expand Down
2 changes: 2 additions & 0 deletions spec/tags/18/ruby/core/float/to_s_tags.txt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Float#to_s uses e format for a positive value with whole part having 16 significant figures
fails:Float#to_s uses e format for a negative value with whole part having 16 significant figures
2 changes: 0 additions & 2 deletions spec/tags/19/ruby/core/float/to_s_tags.txt
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,2 @@
fails:Float#to_s uses non-e format for a positive value with whole part having 17 significant figures fails:Float#to_s uses non-e format for a positive value with whole part having 17 significant figures
fails:Float#to_s uses non-e format for a negative value with whole part having 17 significant figures fails:Float#to_s uses non-e format for a negative value with whole part having 17 significant figures
fails:Float#to_s uses non-e format for a positive value with whole part having 16 significant figures
fails:Float#to_s uses non-e format for a negative value with whole part having 16 significant figures
2 changes: 0 additions & 2 deletions spec/tags/20/ruby/core/float/to_s_tags.txt

This file was deleted.

2 changes: 2 additions & 0 deletions vendor/double-conversion/.gitignore
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
*.o
*.a
12 changes: 12 additions & 0 deletions vendor/double-conversion/AUTHORS
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,12 @@
# Below is a list of people and organizations that have contributed
# to the double-conversion project. Names should be added to the
# list like so:
#
# Name/Organization <email address>

Google Inc.
Mozilla Foundation

Jeff Muizelaar <jmuizelaar@mozilla.com>
Mike Hommey <mhommey@mozilla.com>
Martin Olsson <mnemo@minimum.se>
26 changes: 26 additions & 0 deletions vendor/double-conversion/COPYING
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright 2006-2011, the V8 project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 changes: 11 additions & 0 deletions vendor/double-conversion/Changelog
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,11 @@
2012-06-10:
Tagged v1.1.1.
Null terminate exponent buffer (only an issue when asserts are enabled).
Support more architectures.

2012-02-05:
Merged in Single-branch with single-precision support.
Tagged v1.1 (based on b28450f33e1db493948a535d8f84e88fa211bd10).

2012-02-05:
Tagged v1.0 (based on eda0196e9ac8fcdf59e92cb62885ee0af5391969).
26 changes: 26 additions & 0 deletions vendor/double-conversion/LICENSE
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright 2006-2011, the V8 project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 changes: 20 additions & 0 deletions vendor/double-conversion/Makefile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,20 @@
SRCS = src/bignum-dtoa.cc src/bignum.cc src/cached-powers.cc src/diy-fp.cc src/double-conversion.cc src/fast-dtoa.cc src/fixed-dtoa.cc src/strtod.cc
DCLIB = libdoubleconversion.a
OBJS = $(SRCS:.cc=.o)

ifeq ($(RANLIB),)
RANLIB=ranlib
endif

CXXFLAGS = -Wall -g -O2
LOADLIBES = -L./src

$(DCLIB): $(OBJS)
$(AR) $(ARFLAGS) $(DCLIB) $(OBJS)
$(RANLIB) $(DCLIB)

.cc.o:
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $< -o $@

clean:
rm -f $(OBJS) $(DCLIB)
11 changes: 11 additions & 0 deletions vendor/double-conversion/README
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,11 @@
http://code.google.com/p/double-conversion

This project (double-conversion) provides binary-decimal and decimal-binary
routines for IEEE doubles.

The library consists of efficient conversion routines that have been extracted
from the V8 JavaScript engine. The code has been refactored and improved so that
it can be used more easily in other projects.

There is extensive documentation in src/double-conversion.h. Other examples can
be found in test/cctest/test-conversions.cc.
Loading

0 comments on commit f15a614

Please sign in to comment.