Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a97b41b

Browse files
committedJun 12, 2015
Merge remote-tracking branch 'origin' into 1.8.7
Conflicts: Gemfile.lock gems_list.txt kernel/common/array.rb kernel/common/enumerable.rb kernel/common/enumerator.rb kernel/common/struct.rb spec/ruby/core/enumerable/each_cons_spec.rb spec/ruby/core/enumerator/lazy/take_spec.rb spec/ruby/core/struct/each_pair_spec.rb vm/include/capi/ruby/ruby.h vm/shared_state.hpp
2 parents c20de9e + 57cc497 commit a97b41b

29 files changed

+342
-220
lines changed
 

‎.travis.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ before_install:
88
- echo $LANG
99
- echo $LC_ALL
1010
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update && sudo apt-get install -y llvm-3.4 llvm-3.4-dev; fi
11-
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install llvm && brew link --force llvm; fi
11+
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install llvm35 && brew link --force llvm35; fi
1212
- rvm use $RVM --install --binary --fuzzy
1313
- gem update --system
1414
- gem --version
1515

1616
before_script:
1717
- travis_retry bundle
1818
- if [ $TRAVIS_OS_NAME == linux ]; then travis_retry ./configure --llvm-config llvm-config-3.4; fi
19-
- if [ $TRAVIS_OS_NAME == osx ]; then travis_retry ./configure --llvm-config /usr/local/opt/llvm/bin/llvm-config; fi
19+
- if [ $TRAVIS_OS_NAME == osx ]; then travis_retry ./configure; fi
2020

2121
script: rake ci
2222

@@ -49,6 +49,4 @@ env:
4949

5050
os:
5151
- linux
52-
# - osx
53-
54-
osx_image: xcode61
52+
- osx

‎Gemfile.lock

-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,3 @@ DEPENDENCIES
2727
redcard (~> 1.0)
2828
rubinius-bridge (~> 1.0)
2929
rubinius-build_tools (~> 1.0)
30-
31-
BUNDLED WITH
32-
1.10.3

‎LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2007-2014, Evan Phoenix and contributors
1+
Copyright (c) 2007-2015, Evan Phoenix and contributors
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

‎configure

+2-2
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,8 @@ class Configure
574574
if macports?
575575
config = macports_llvm_config
576576
else
577-
out = Bundler.with_clean_env { `brew list llvm | grep '/llvm-config$'` }
578-
config = out.chomp if $?.success?
577+
out = Bundler.with_clean_env { `brew --prefix llvm35` }.chomp
578+
config = "#{out}/bin/llvm-config-3.5" if $?.success?
579579
end
580580
end
581581
end

‎gems_list.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
bundler-1.10.3.gem
1+
bundler-1.9.9.gem
22
ffi2-generators-0.1.1.gem
3-
json-1.8.3.gem
3+
json-1.8.2.gem
44
minitest-4.7.5.gem
55
racc-1.4.12.gem
66
rake-10.4.2.gem
7-
rb-readline-0.5.3.gem
7+
rb-readline-0.5.2.gem
88
rdoc-4.2.0.gem
99
rubinius-ast-1.3.0.gem
1010
rubinius-build_tools-1.0.0.gem
@@ -18,7 +18,7 @@ rubinius-profiler-2.0.2.gem
1818
rubinius-toolset-2.3.1.gem
1919
rubysl-1.1.0.gem
2020
rubysl-abbrev-1.0.1.gem
21-
rubysl-base64-1.0.1.gem
21+
rubysl-base64-1.0.0.gem
2222
rubysl-benchmark-1.0.0.gem
2323
rubysl-bigdecimal-1.0.0.gem
2424
rubysl-cgi-1.0.0.gem
@@ -28,7 +28,7 @@ rubysl-csv-1.0.1.gem
2828
rubysl-curses-1.0.0.gem
2929
rubysl-date-1.0.1.gem
3030
rubysl-delegate-1.0.0.gem
31-
rubysl-digest-1.2.0.gem
31+
rubysl-digest-1.0.1.gem
3232
rubysl-drb-1.0.0.gem
3333
rubysl-e2mmap-1.0.0.gem
3434
rubysl-english-1.0.0.gem

‎kernel/bootstrap/thunk.rb

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ def self.new(value)
44
Rubinius.primitive :thunk_create
55
raise PrimitiveFailure, "Thunk.new primitive failed"
66
end
7+
8+
attr_accessor :value
79
end
810

911
class CallUnit

‎kernel/common/array.rb

+12-1
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,18 @@ def zip(*others)
15991599
size.times do |i|
16001600
slot = out.at(i)
16011601
slot << @tuple.at(@start + i)
1602-
others.each { |ary| slot << ary.at(i) }
1602+
others.each do |other|
1603+
slot << case other
1604+
when Array
1605+
other.at i
1606+
else
1607+
begin
1608+
other.next
1609+
rescue StopIteration
1610+
nil
1611+
end
1612+
end
1613+
end
16031614
end
16041615

16051616
if block_given?

‎kernel/loader.rb

+35-28
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,11 @@ def flush_stdio
704704
STDERR.flush unless STDERR.closed?
705705
end
706706

707+
def exit_with_exception(e)
708+
@exit_code = 1
709+
Rubinius::Logger.log_exception "An exception occurred #{@stage}", e
710+
end
711+
707712
# Cleanup and at_exit processing.
708713
def epilogue
709714
@stage = "running at_exit handlers"
@@ -723,8 +728,7 @@ def epilogue
723728
flush_stdio
724729

725730
rescue Object => e
726-
Rubinius::Logger.log_exception "An exception occurred #{@stage}", e
727-
@exit_code = 1
731+
exit_with_exception e
728732
end
729733

730734
# Exit.
@@ -776,6 +780,34 @@ def done
776780
Process.exit! @exit_code
777781
end
778782

783+
def handle_exception(e)
784+
case e
785+
when SystemExit
786+
@exit_code = e.status
787+
when SyntaxError
788+
@exit_code = 1
789+
790+
show_syntax_error(e)
791+
792+
STDERR.puts "\nBacktrace:"
793+
STDERR.puts
794+
STDERR.puts e.awesome_backtrace.show
795+
when Interrupt
796+
exit_with_exception e
797+
when SignalException
798+
Signal.trap(e.signo, "SIG_DFL")
799+
Process.kill e.signo, Process.pid
800+
when nil
801+
# what?
802+
else
803+
exit_with_exception e
804+
end
805+
rescue Object => e
806+
exit_with_exception e
807+
ensure
808+
epilogue
809+
end
810+
779811
# Orchestrate everything.
780812
def main
781813
preamble
@@ -795,33 +827,8 @@ def main
795827
script
796828
repl
797829

798-
rescue SystemExit => e
799-
@exit_code = e.status
800-
801-
epilogue
802-
rescue SyntaxError => e
803-
@exit_code = 1
804-
805-
show_syntax_error(e)
806-
807-
STDERR.puts "\nBacktrace:"
808-
STDERR.puts
809-
STDERR.puts e.awesome_backtrace.show
810-
epilogue
811-
rescue Interrupt => e
812-
@exit_code = 1
813-
814-
Rubinius::Logger.log_exception "An exception occurred #{@stage}:", e
815-
epilogue
816-
rescue SignalException => e
817-
Signal.trap(e.signo, "SIG_DFL")
818-
Process.kill e.signo, Process.pid
819-
epilogue
820830
rescue Object => e
821-
@exit_code = 1
822-
823-
Rubinius::Logger.log_exception "An exception occurred #{@stage}:", e
824-
epilogue
831+
handle_exception e
825832
else
826833
# We do this, run epilogue both in the rescue blocks and also here,
827834
# so that at_exit{} hooks can read $!.

‎library/rubygems.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
require 'thread'
1010

1111
module Gem
12-
VERSION = '2.4.6'
12+
VERSION = '2.4.8'
1313
end
1414

1515
# Must be first since it unloads the prelude from 1.9.2

‎library/rubygems/remote_fetcher.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ def api_endpoint(uri)
9494
rescue Resolv::ResolvError
9595
uri
9696
else
97-
URI.parse "#{uri.scheme}://#{res.target}#{uri.path}"
97+
target = res.target.to_s.strip
98+
99+
if /\.#{Regexp.quote(host)}\z/ =~ target
100+
return URI.parse "#{uri.scheme}://#{target}#{uri.path}"
101+
end
102+
103+
uri
98104
end
99105
end
100106

‎spec/core/module/thunk_method_spec.rb

+13
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,17 @@
2020
it "returns the coerced name" do
2121
@class.thunk_method("a_reader", @value).should equal(:a_reader)
2222
end
23+
24+
it "creates an executable that can be used to read the value" do
25+
@class.thunk_method(:thunk, @value)
26+
@class.instance_method(:thunk).executable.value.should equal(@value)
27+
end
28+
29+
it "creates an executable that can be used to change the value" do
30+
@class.thunk_method(:thunk, @value)
31+
new_value = Object.new
32+
@class.instance_method(:thunk).executable.value = new_value
33+
@class.instance_method(:thunk).executable.value.should equal(new_value)
34+
@class.new.thunk.should equal(new_value)
35+
end
2336
end

‎spec/ruby/core/enumerator/size_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@
1919
enum.size.should == 301
2020
end
2121
end
22+
23+
it "returns the result from size.call if the size respond to call " do
24+
obj = mock('call')
25+
obj.should_receive(:call).and_return(42)
26+
Enumerator.new(obj) {}.size.should == 42
27+
end
2228
end

‎spec/ruby/core/exception/signal_exception_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117

118118
it "raises a SignalException when sent a signal" do
119119
begin
120-
Process.kill :TERM, Process.pid
120+
raise SignalException.new(Signal.list["TERM"])
121121
rescue SignalException => e
122122
e.signo.should == Signal.list["TERM"]
123123
end

‎spec/ruby/core/marshal/shared/load.rb

+18
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,24 @@
579579
end
580580
end
581581

582+
describe "for a Bignum" do
583+
platform_is :wordsize => 64 do
584+
context "that is Bignum on 32-bit platforms but Fixnum on 64-bit" do
585+
it "dumps a Fixnum" do
586+
val = Marshal.load("\004\bl+\ab:wU")
587+
val.should == 1433877090
588+
val.class.should == Fixnum
589+
end
590+
591+
it "dumps an array containing multiple references to the Bignum as an array of Fixnum" do
592+
arr = Marshal.load("\004\b[\al+\a\223BwU@\006")
593+
arr.should == [1433879187, 1433879187]
594+
arr.each { |v| v.class.should == Fixnum }
595+
end
596+
end
597+
end
598+
end
599+
582600
describe "for a Time" do
583601
it "loads" do
584602
Marshal.send(@method, Marshal.dump(Time.at(1))).should == Time.at(1)

‎spec/ruby/optional/capi/ext/hash_spec.c

+20
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ VALUE hash_spec_rb_hash(VALUE self, VALUE hash) {
1111
}
1212
#endif
1313

14+
#ifdef HAVE_RB_HASH_DUP
15+
VALUE hash_spec_rb_hash_dup(VALUE self, VALUE hash) {
16+
return rb_hash_dup(hash);
17+
}
18+
#endif
19+
20+
#ifdef HAVE_RB_HASH_FREEZE
21+
VALUE hash_spec_rb_hash_freeze(VALUE self, VALUE hash) {
22+
return rb_hash_freeze(hash);
23+
}
24+
#endif
25+
1426
#ifdef HAVE_RB_HASH_AREF
1527
VALUE hash_spec_rb_hash_aref(VALUE self, VALUE hash, VALUE key) {
1628
return rb_hash_aref(hash, key);
@@ -107,6 +119,14 @@ void Init_hash_spec() {
107119
rb_define_method(cls, "rb_hash", hash_spec_rb_hash, 1);
108120
#endif
109121

122+
#ifdef HAVE_RB_HASH_DUP
123+
rb_define_method(cls, "rb_hash_dup", hash_spec_rb_hash_dup, 1);
124+
#endif
125+
126+
#ifdef HAVE_RB_HASH_FREEZE
127+
rb_define_method(cls, "rb_hash_freeze", hash_spec_rb_hash_freeze, 1);
128+
#endif
129+
110130
#ifdef HAVE_RB_HASH_AREF
111131
rb_define_method(cls, "rb_hash_aref", hash_spec_rb_hash_aref, 2);
112132
rb_define_method(cls, "rb_hash_aref_nil", hash_spec_rb_hash_aref_nil, 2);

‎spec/ruby/optional/capi/ext/rubyspec.h

+2
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@
303303

304304
/* Hash */
305305
#define HAVE_RB_HASH 1
306+
#define HAVE_RB_HASH_DUP 1
307+
#define HAVE_RB_HASH_FREEZE 1
306308
#define HAVE_RB_HASH_AREF 1
307309
#define HAVE_RB_HASH_ASET 1
308310
#define HAVE_RB_HASH_DELETE 1

‎spec/ruby/optional/capi/hash_spec.rb

+15
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@
4949
end
5050
end
5151

52+
describe "rb_hash_dup" do
53+
it "returns a copy of the hash" do
54+
hsh = {}
55+
dup = @s.rb_hash_dup(hsh)
56+
dup.should == hsh
57+
dup.should_not equal(hsh)
58+
end
59+
end
60+
61+
describe "rb_hash_freeze" do
62+
it "freezes the hash" do
63+
@s.rb_hash_freeze({}).frozen?.should be_true
64+
end
65+
end
66+
5267
describe "rb_hash_aref" do
5368
it "returns the value associated with the key" do
5469
hsh = {:chunky => 'bacon'}

‎vm/builtin/system.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -923,13 +923,15 @@ namespace rubinius {
923923
}
924924

925925
Object* System::vm_watch_signal(STATE, Fixnum* sig, Object* ignored) {
926-
SignalThread* st = state->shared().signal_handler();
926+
SignalThread* st = state->shared().signals();
927+
927928
if(st) {
928929
native_int i = sig->to_native();
929930
if(i < 0) {
930-
st->add_signal(state, -i, SignalThread::eDefault);
931+
st->add_signal_handler(state, -i, SignalThread::eDefault);
931932
} else if(i > 0) {
932-
st->add_signal(state, i, CBOOL(ignored) ? SignalThread::eIgnore : SignalThread::eCustom);
933+
st->add_signal_handler(state, i,
934+
CBOOL(ignored) ? SignalThread::eIgnore : SignalThread::eCustom);
933935
}
934936

935937
return cTrue;

‎vm/capi/array.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ extern "C" {
216216
}
217217

218218
/* @todo Check 64-bit? */
219-
VALUE rb_ary_entry(VALUE self, int index) {
219+
VALUE rb_ary_entry(VALUE self, long index) {
220220
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
221221

222222
Array* array = capi_get_array(env, self);

‎vm/capi/hash.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ extern "C" {
1010
return capi_fast_call(rb_cHash, rb_intern("new"), 0);
1111
}
1212

13+
VALUE rb_hash_dup(VALUE self) {
14+
return capi_fast_call(self, rb_intern("dup"), 0);
15+
}
16+
17+
VALUE rb_hash_freeze(VALUE self) {
18+
return capi_fast_call(self, rb_intern("freeze"), 0);
19+
}
20+
1321
VALUE rb_hash_aref(VALUE self, VALUE key) {
1422
return capi_fast_call(self, rb_intern("[]"), 1, key);
1523
}

0 commit comments

Comments
 (0)
Please sign in to comment.