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: b5197aadba89
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 03f8943231bc
Choose a head ref

Commits on Jan 20, 2016

  1. Add specs for chunk_while

    jsyeo committed Jan 20, 2016
    Copy the full SHA
    36aa1b8 View commit details
  2. Implement chunk_while

    jsyeo committed Jan 20, 2016
    Copy the full SHA
    1f090ec View commit details
  3. Remove chunk_while tags

    jsyeo committed Jan 20, 2016
    Copy the full SHA
    c81d25e View commit details
  4. Change error message

    jsyeo committed Jan 20, 2016
    Copy the full SHA
    f1db708 View commit details
  5. block.call->yield

    jsyeo committed Jan 20, 2016
    Copy the full SHA
    8384269 View commit details
  6. Merge pull request #3579 from jsyeo/jsyeo-chunk_while

    Add chunk_while
    brixen committed Jan 20, 2016
    Copy the full SHA
    5d7d24a View commit details
  7. Copy the full SHA
    f34954c View commit details

Commits on Jan 21, 2016

  1. Remove initial state from chunk

    jsyeo committed Jan 21, 2016
    Copy the full SHA
    7b81a46 View commit details
  2. Use a better error message

    jsyeo committed Jan 21, 2016
    Copy the full SHA
    b7c5d0d View commit details
  3. Merge pull request #3580 from jsyeo/jsyeo-slice_before

    Remove initial state from slice_before and chunk
    jsyeo committed Jan 21, 2016
    Copy the full SHA
    9cf58de View commit details
  4. Copy the full SHA
    b48d087 View commit details
  5. Copy the full SHA
    57d8550 View commit details
  6. Merge pull request #3582 from rubinius/add_string_new_encoding_specs

    add failing spec for String.new with optional encoding argument
    tak1n committed Jan 21, 2016
    Copy the full SHA
    2337179 View commit details
  7. Merge pull request #3581 from rubinius/add_name_error_receiver_specs

    add failing NameError#receiver spec
    tak1n committed Jan 21, 2016
    Copy the full SHA
    f1d36c7 View commit details
  8. Copy the full SHA
    2fa07b5 View commit details
  9. Merge pull request #3583 from rubinius/implement_string_new_encoding

    Implement String.new encoding optional argument
    tak1n committed Jan 21, 2016
    Copy the full SHA
    f5d9420 View commit details
  10. Fetch existing tags before adding a new one

    Yorick Peterse committed Jan 21, 2016
    Copy the full SHA
    d8aaf27 View commit details
  11. Update tags/branches before untagging

    Yorick Peterse committed Jan 21, 2016
    Copy the full SHA
    2a03713 View commit details
  12. Copy the full SHA
    28c05a0 View commit details
  13. Copy the full SHA
    b027c31 View commit details
  14. Copy the full SHA
    dc92d38 View commit details

Commits on Jan 22, 2016

  1. Copy the full SHA
    573adbb View commit details
  2. Copy the full SHA
    b8f3c88 View commit details
  3. Copy the full SHA
    eb30604 View commit details
  4. Updated installed Rake version

    Yorick Peterse committed Jan 22, 2016
    Copy the full SHA
    7f6e158 View commit details
  5. Updated list of rubysl Gems to install

    Yorick Peterse committed Jan 22, 2016
    Copy the full SHA
    7489a07 View commit details
  6. Added failing specs for zsuper with rest kwargs

    Yorick Peterse committed Jan 22, 2016
    Copy the full SHA
    9da9d6a View commit details

Commits on Jan 23, 2016

  1. Copy the full SHA
    fa397f8 View commit details
  2. Copy the full SHA
    20cd1d3 View commit details
  3. Copy the full SHA
    0d1859b View commit details

Commits on Jan 24, 2016

  1. Removed BakerGC.

    brixen committed Jan 24, 2016
    Copy the full SHA
    03f8943 View commit details
Showing with 520 additions and 970 deletions.
  1. +1 −1 Gemfile.installed
  2. +1 −1 Gemfile.lock
  3. +4 −3 gems_list.txt
  4. +22 −0 kernel/common/argf.rb
  5. +18 −18 kernel/common/enumerable.rb
  6. +21 −4 kernel/common/io.rb
  7. +2 −2 kernel/common/random.rb
  8. +2 −1 kernel/common/string.rb
  9. +4 −0 scripts/tag.sh
  10. +3 −41 spec/ruby/core/argf/read_spec.rb
  11. +75 −0 spec/ruby/core/argf/readpartial_spec.rb
  12. +62 −0 spec/ruby/core/argf/shared/read.rb
  13. +5 −19 spec/ruby/core/enumerable/chunk_spec.rb
  14. +36 −0 spec/ruby/core/enumerable/chunk_while_spec.rb
  15. +2 −26 spec/ruby/core/enumerable/slice_before_spec.rb
  16. +10 −0 spec/ruby/core/exception/receiver_spec.rb
  17. +43 −11 spec/ruby/core/io/read_nonblock_spec.rb
  18. +13 −3 spec/ruby/core/io/write_nonblock_spec.rb
  19. +66 −2 spec/ruby/core/kernel/rand_spec.rb
  20. +6 −0 spec/ruby/core/string/new_spec.rb
  21. +14 −0 spec/ruby/language/fixtures/super.rb
  22. +14 −0 spec/ruby/language/super_spec.rb
  23. +1 −0 spec/tags/ruby/core/exception/receiver_tags.txt
  24. +1 −0 spec/tags/ruby/language/super_tags.txt
  25. +2 −2 vm/builtin/class.cpp
  26. +5 −1 vm/capi/handle.cpp
  27. +8 −2 vm/capi/handles.cpp
  28. +1 −3 vm/capi/handles.hpp
  29. +0 −457 vm/gc/baker.cpp
  30. +0 −310 vm/gc/baker.hpp
  31. +1 −3 vm/gc/immix.cpp
  32. +3 −0 vm/gc/slab.hpp
  33. +3 −0 vm/gc/write_barrier.cpp
  34. +3 −0 vm/gc/write_barrier.hpp
  35. +17 −24 vm/object_memory.cpp
  36. +7 −6 vm/object_memory.hpp
  37. +4 −0 vm/oop.cpp
  38. +0 −9 vm/oop.hpp
  39. +1 −3 vm/system_diagnostics.cpp
  40. +2 −6 vm/system_diagnostics.hpp
  41. +34 −11 vm/test/test_object_memory.hpp
  42. +3 −1 vm/util/immix.hpp
2 changes: 1 addition & 1 deletion Gemfile.installed
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ gem "daedalus-core", "~> 0.1"
gem "rubinius-build_tools", "~> 2.0"
gem "rubinius-developer_tools", "~> 2.0"

gem "rubysl", "~> 2.0"
gem "rubysl", "~> 2.2"
gem "rubysl-test-unit", "~> 2.0"
gem "minitest", "~> 4.7"
gem "racc", "~> 1.4"
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
daedalus-core (0.5.0)
rake (10.4.2)
rake (10.5.0)
redcard (1.1.0)
rubinius-ast (2.3.2)
rubinius-bridge (1.1.0)
7 changes: 4 additions & 3 deletions gems_list.txt
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ json-1.8.3.gem
minitest-4.7.5.gem
psych-2.0.17.gem
racc-1.4.14.gem
rake-10.4.2.gem
rake-10.5.0.gem
rb-readline-0.5.3.gem
rdoc-4.2.1.gem
redcard-1.1.0.gem
@@ -20,7 +20,7 @@ rubinius-melbourne-2.3.1.0.gem
rubinius-processor-2.3.0.gem
rubinius-profiler-2.0.2.gem
rubinius-toolset-2.3.1.gem
rubysl-2.1.0.gem
rubysl-2.2.0.gem
rubysl-abbrev-2.0.4.gem
rubysl-base64-2.0.0.gem
rubysl-benchmark-2.0.1.gem
@@ -70,9 +70,9 @@ rubysl-net-smtp-2.0.1.gem
rubysl-net-telnet-2.0.0.gem
rubysl-nkf-2.0.1.gem
rubysl-observer-2.0.0.gem
rubysl-open-uri-2.0.0.gem
rubysl-open3-2.0.0.gem
rubysl-openssl-2.8.0.gem
rubysl-open-uri-2.0.0.gem
rubysl-optparse-2.0.1.gem
rubysl-ostruct-2.1.0.gem
rubysl-pathname-2.1.0.gem
@@ -107,6 +107,7 @@ rubysl-timeout-2.0.0.gem
rubysl-tmpdir-2.0.1.gem
rubysl-tsort-2.0.1.gem
rubysl-un-2.0.0.gem
rubysl-unicode_normalize-2.0.gem
rubysl-uri-2.0.0.gem
rubysl-weakref-2.0.0.gem
rubysl-webrick-2.0.0.gem
22 changes: 22 additions & 0 deletions kernel/common/argf.rb
Original file line number Diff line number Diff line change
@@ -330,6 +330,7 @@ def readbyte
def read(bytes=nil, output=nil)
# The user might try to pass in nil, so we have to check here
output ||= default_value
output.clear

if bytes
bytes_left = bytes
@@ -401,6 +402,27 @@ def readlines(sep=$/)

alias_method :to_a, :readlines

def readpartial(maxlen, output=nil)
output ||= default_value

unless advance!
output.clear
raise EOFError, "ARGF at end"
end

begin
@stream.readpartial(maxlen, output)
rescue EOFError => e
raise e if @use_stdin_only

@stream.close
@advance = true
advance! or raise e
end

return output
end

#
# Rewind the stream to its beginning.
#
36 changes: 18 additions & 18 deletions kernel/common/enumerable.rb
Original file line number Diff line number Diff line change
@@ -4,19 +4,13 @@
# these methods can be written *in those classes* to override these.

module Enumerable
def chunk(initial_state = nil, &original_block)
def chunk
raise ArgumentError, "no block given" unless block_given?
::Enumerator.new do |yielder|
previous = nil
accumulate = []
block = if initial_state.nil?
original_block
else
duplicated_initial_state = initial_state.dup
Proc.new{ |val| original_block.yield(val, duplicated_initial_state)}
end
each do |element|
key = block.yield(element)
key = yield(element)
if key.nil? || (key.is_a?(Symbol) && key.to_s[0, 1] == "_")
yielder.yield [previous, accumulate] unless accumulate.empty?
accumulate = []
@@ -136,18 +130,18 @@ def group_by
h
end

def slice_before(arg = undefined, &block)
if block_given?
has_init = !(undefined.equal? arg)
else
raise ArgumentError, "wrong number of arguments (0 for 1)" if undefined.equal? arg
block = Proc.new{ |elem| arg === elem }
end
def slice_before(pattern = undefined, &block)
pattern_given = !(undefined.equal? pattern)

raise ArgumentError, "cannot pass both pattern and block" if pattern_given && block_given?
raise ArgumentError, "a pattern or a block must be provided" if !pattern_given && !block_given?

block = Proc.new{ |elem| pattern === elem } if pattern_given

Enumerator.new do |yielder|
init = arg.dup if has_init
accumulator = nil
each do |element|
start_new = has_init ? block.yield(element, init) : block.yield(element)
start_new = block.yield(element)
if start_new
yielder.yield accumulator if accumulator
accumulator = [element]
@@ -164,7 +158,7 @@ def slice_after(pattern = undefined, &block)
pattern_given = !undefined.equal?(pattern)

raise ArgumentError, "cannot pass both pattern and block" if pattern_given && block_given?
raise ArgumentError, "wrong number of arguments (0 for 1)" if !pattern_given && !block_given?
raise ArgumentError, "a pattern or a block must be provided" if !pattern_given && !block_given?

block = Proc.new { |elem| pattern === elem } if pattern_given

@@ -212,6 +206,12 @@ def slice_when(&block)
end
end

def chunk_while(&block)
raise ArgumentError, "no block given" unless block_given?

slice_when { |before, after| !(yield before, after) }
end

def to_a(*arg)
ary = []
each(*arg) do
25 changes: 21 additions & 4 deletions kernel/common/io.rb
Original file line number Diff line number Diff line change
@@ -1895,21 +1895,34 @@ def read_all
#
# If the read buffer is not empty, read_nonblock reads from the
# buffer like readpartial. In this case, read(2) is not called.
def read_nonblock(size, buffer=nil)
def read_nonblock(size, buffer=nil, opts={})
raise ArgumentError, "illegal read size" if size < 0
ensure_open

if buffer.is_a?(Hash)
opts = buffer
buffer = nil
end

buffer = StringValue buffer if buffer

if @ibuffer.size > 0
return @ibuffer.shift(size)
end

if str = read_if_available(size)
begin
str = read_if_available(size)
rescue EAGAINWaitReadable => exc
raise exc unless opts[:exception] == false

return :wait_readable
end

if str
buffer.replace(str) if buffer
return str
else
raise EOFError, "stream closed"
raise EOFError, "stream closed" unless opts[:exception] == false
end
end

@@ -2438,7 +2451,7 @@ def write(data)
data.bytesize
end

def write_nonblock(data)
def write_nonblock(data, opts={})
ensure_open_and_writable

data = String data
@@ -2447,6 +2460,10 @@ def write_nonblock(data)
@ibuffer.unseek!(self) unless @sync

raw_write(data)
rescue EAGAINWaitWritable => exc
raise exc unless opts[:exception] == false

return :wait_writable
end

def close
4 changes: 2 additions & 2 deletions kernel/common/random.rb
Original file line number Diff line number Diff line change
@@ -66,9 +66,9 @@ def random_integer(limit)
end

def random_range(limit)
min, max = limit.max.coerce(limit.min)
min, max = limit.last.coerce(limit.first)
diff = max - min
diff += 1 if max.kind_of?(Integer)
diff += 1 if max.kind_of?(Integer) && !limit.exclude_end?
random(diff) + min
end

3 changes: 2 additions & 1 deletion kernel/common/string.rb
Original file line number Diff line number Diff line change
@@ -42,8 +42,9 @@ def clone
alias_method :dup, :clone
end

def initialize(arg = undefined)
def initialize(arg = undefined, encoding: nil)
replace arg unless undefined.equal?(arg)
self.force_encoding(encoding) if encoding
self
end

4 changes: 4 additions & 0 deletions scripts/tag.sh
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ __dir__="$(cd "$(dirname "$0")" && pwd)"
source "$__dir__/configuration.sh"

function rbx_tag_release {
git fetch --all -p

IFS="." read -r -a array <<< "$(rbx_revision_version)"

let major=${array[0]}
@@ -31,6 +33,8 @@ EOM
rbx_tag_usage
fi

git fetch --all -p

IFS="." read -r -a array <<< "$(rbx_revision_version)"

let major=${array[0]}
44 changes: 3 additions & 41 deletions spec/ruby/core/argf/read_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/read', __FILE__)

describe "ARGF.read" do
it_behaves_like :argf_read, :read

before :each do

@file1_name = fixture __FILE__, "file1.txt"
@@ -28,34 +31,6 @@
end
end

it "treats second nil argument as no output buffer" do
argv [@file1_name] do
ARGF.read(nil, nil).should == @file1
end
end

it "treats second argument as an output buffer" do
argv [@file1_name] do
buffer = ""
ARGF.read(nil, buffer)
buffer.should == @file1
end
end

it "reads a number of bytes from the first file" do
argv [@file1_name] do
ARGF.read(5).should == @file1[0,5]
end
end

it "reads from a single file consecutively" do
argv [@file1_name] do
ARGF.read(1).should == @file1[0,1]
ARGF.read(2).should == @file1[1,2]
ARGF.read(3).should == @file1[3,3]
end
end

it "reads the contents of two files" do
argv [@file1_name, @file2_name] do
ARGF.read.should == @file1 + @file2
@@ -81,11 +56,6 @@
stdin.should == @stdin
end

it "reads a number of bytes from stdin" do
stdin = ruby_exe("print ARGF.read(10)", :args => "< #{@stdin_name}")
stdin.should == @stdin[0,10]
end

it "reads the contents of one file and stdin" do
stdin = ruby_exe("print ARGF.read", :args => "#{@file1_name} - < #{@stdin_name}")
stdin.should == @file1 + @stdin
@@ -97,14 +67,6 @@
end
end

platform_is_not :windows do
it "reads the contents of a special device file" do
argv ['/dev/zero'] do
ARGF.read(100).should == "\000" * 100
end
end
end

with_feature :encoding do

before :each do
Loading