Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 2.0.0pre
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	Rakefile
	configure
	lib/timeout.rb
	spec/tags/18/ruby/core/argf/gets_tags.txt
	spec/tags/18/ruby/core/argf/readline_tags.txt
	spec/tags/18/ruby/library/openstruct/method_missing_tags.txt
	vm/agent_components.cpp
	vm/builtin/data.cpp
	vm/capi/include/ruby.h
	vm/configuration.hpp
	vm/gc/baker.cpp
	vm/gc/immix.cpp
	vm/gc/marksweep.cpp
	vm/gc/walker.cpp
	vm/inline_cache.cpp
	vm/objectmemory.cpp
  • Loading branch information
brixen committed Jun 27, 2011
2 parents 7806103 + 0764ce3 commit f79f0c9
Show file tree
Hide file tree
Showing 65 changed files with 476 additions and 280 deletions.
2 changes: 2 additions & 0 deletions AUTHORS
Expand Up @@ -141,10 +141,12 @@
- Patrick Hurley:
- Paul Meserve:
- Paul Thornthwaite:
- Pavel Argentov: { irc: argent-smith, github: argent-smith }
- Pedro Del Gallego:
- Phil Hagelberg: { irc: technomancy }
- Philipp Bruschweiler:
- Pierre Yager:
- Przemek Owczarek: { github: nazgob, twitter: powczarek }
- Ragnar Dahlen:
- Richard Heycock:
- Ruben Nine:
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -33,7 +33,7 @@ end
require config_rb
BUILD_CONFIG = Rubinius::BUILD_CONFIG

unless BUILD_CONFIG[:config_version] == 134
unless BUILD_CONFIG[:config_version] == 135
STDERR.puts "Your configuration is outdated, please run ./configure first"
exit 1
end
Expand Down
22 changes: 14 additions & 8 deletions configure
Expand Up @@ -91,6 +91,7 @@ class Configure
@include20dir = root + "/vm/capi/19/include"
@libdir = root
@runtime = @libdir + "/runtime"
@kernel_path = @libdir + "/kernel"
@lib_path = @libdir + "/lib"
@ext_path = @libdir + "/lib/ext"
@mandir = root + "/man"
Expand All @@ -110,7 +111,7 @@ class Configure
@libversion = "2.0"
@version = "#{@libversion}.0dev"
@release_date = "yyyy-mm-dd"
@config_version = 134
@config_version = 135

# TODO: add conditionals for platforms
if RbConfig::CONFIG["build_os"] =~ /darwin/
Expand Down Expand Up @@ -252,6 +253,7 @@ class Configure
@include20dir = dir + "/19/include"
@libdir = dir
@runtime = @libdir + "/runtime"
@kernel_path = @libdir + "/kernel"
@lib_path = @libdir + "/lib"
@ext_path = @libdir + "/lib/ext"
@mandir = dir + "/man"
Expand All @@ -275,14 +277,15 @@ class Configure
end

o.on "-L", "--libdir", "PATH", "Install Ruby library in PATH" do |dir|
@install = true
@libdir = expand(dir) + "/rubinius/#{@libversion}"
@runtime = @libdir + "/runtime"
@lib_path = @libdir + "/lib"
@ext_path = @libdir + "/lib/ext"
@install = true
@libdir = expand(dir) + "/rubinius/#{@libversion}"
@runtime = @libdir + "/runtime"
@kernel_path = @libdir + "/kernel"
@lib_path = @libdir + "/lib"
@ext_path = @libdir + "/lib/ext"

@sitedir = @libdir + "/site"
@vendordir = @libdir + "/vendor"
@sitedir = @libdir + "/site"
@vendordir = @libdir + "/vendor"
end

o.on "-M", "--mandir", "PATH", "Install man pages in PATH" do |dir|
Expand Down Expand Up @@ -948,6 +951,7 @@ module Rubinius
:bindir => "#{@bindir}",
:libdir => "#{@libdir}",
:runtime => "#{@runtime}",
:kernel_path => "#{@kernel_path}",
:lib_path => "#{@lib_path}",
:ext_path => "#{@ext_path}",
:include18dir => "#{@include18dir}",
Expand Down Expand Up @@ -988,6 +992,7 @@ end
#define RBX_BIN_PATH "#{@bindir}"
#define RBX_GEMS_PATH "#{@gemsdir}"
#define RBX_RUNTIME "#{@runtime}"
#define RBX_KERNEL_PATH "#{@kernel_path}"
#define RBX_LIB_PATH "#{@lib_path}"
#define RBX_EXT_PATH "#{@ext_path}"
#define RBX_HDR18_PATH "#{@include18dir}"
Expand Down Expand Up @@ -1042,6 +1047,7 @@ end
#define RBX_BIN_PATH "#{@bindir}"
#define RBX_GEMS_PATH "#{@gemsdir}"
#define RBX_RUNTIME "#{@runtime}"
#define RBX_KERNEL_PATH "#{@kernel_path}"
#define RBX_LIB_PATH "#{@lib_path}"
#define RBX_EXT_PATH "#{@ext_path}"
#define RBX_HDR18_PATH "#{@include18dir}"
Expand Down
8 changes: 5 additions & 3 deletions kernel/common/argf.rb
Expand Up @@ -489,6 +489,8 @@ def advance!
@init = true
end

File.unlink(@backup_filename) if @backup_filename && $-i == ""

return false if @use_stdin_only || ARGV.empty?

@advance = false
Expand All @@ -498,11 +500,11 @@ def advance!
@filename = file

if $-i && @stream != STDIN
@original_stdout = $stdout
@backup_filename = "#{@filename}#{$-i}"
backup_extension = $-i == "" ? ".bak" : $-i
@backup_filename = "#{@filename}#{backup_extension}"
File.rename(@filename, @backup_filename)
@stream = File.open(@backup_filename, "r")
$stdout = @current_output = File.open(@filename, "w")
$stdout = File.open(@filename, "w")
end

return true
Expand Down
2 changes: 1 addition & 1 deletion kernel/common/compiled_method.rb
Expand Up @@ -363,7 +363,7 @@ def change_name(name)
# nil if nothing is found, else an array of size 2 containing the method
# the line was found in and the IP pointing there.
def locate_line(line)
ip = 1
i = 1
total = @lines.size
while i < total
cur_line = @lines.at(i)
Expand Down
18 changes: 8 additions & 10 deletions kernel/common/string.rb
Expand Up @@ -1183,25 +1183,23 @@ def insert(index, other)

osize = other.size
size = @num_bytes + osize
str = self.class.new("\0") * size
str = self.class.pattern size, "\0"

index = @num_bytes + 1 + index if index < 0
if index > @num_bytes or index < 0 then
raise IndexError, "index #{index} out of string"
end

modify!
Ruby.check_frozen
hash_value = nil

if index == 0
str.copy_from other, 0, osize, 0
str.copy_from self, 0, @num_bytes, osize
elsif index < @num_bytes
str.copy_from self, 0, index, 0
str.copy_from other, 0, osize, index
str.copy_from self, index, @num_bytes - index, index + osize
else
if index == @num_bytes
str.copy_from self, 0, @num_bytes, 0
str.copy_from other, 0, osize, @num_bytes
else
str.copy_from self, 0, index, 0 if index > 0
str.copy_from other, 0, osize, index
str.copy_from self, index, @num_bytes - index, index + osize
end

@num_bytes = size
Expand Down
6 changes: 6 additions & 0 deletions lib/expect.rb
Expand Up @@ -4,6 +4,12 @@
$expect_verbose = false

class IO
# Reads ios until pattern matches or the timeout is over. It returns
# an array with the read buffer, followed by the matches. If a block is given,
# the result is yielded to the block and returns nil. The optional timeout parameter defines,
# in seconds, the total time to wait for pattern. If it is over of eof is found, it
# returns/yields nil. However, the buffer in a timeout session is kept for the next expect call.
# The default timeout is 9999999 seconds.
def expect(pat,timeout=9999999)
case pat
when String
Expand Down
2 changes: 1 addition & 1 deletion lib/ostruct.rb
Expand Up @@ -89,7 +89,7 @@ class << self; self; end.class_eval do
def method_missing(mid, *args) # :nodoc:
mname = mid.id2name
len = args.length
if mname.chomp!('=')
if mname.chomp!('=') && mname != "[]"
if len != 1
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
end
Expand Down
8 changes: 6 additions & 2 deletions lib/socket.rb
Expand Up @@ -1068,8 +1068,12 @@ def tcp_setup(remote_host, remote_service, local_host = nil,
i[1] == family && i[2] == socket_type
end

status = Socket::Foreign.bind sock, li[4]
syscall = 'bind(2)'
if li
status = Socket::Foreign.bind sock, li[4]
syscall = 'bind(2)'
else
status = 1
end
else
status = 1
end
Expand Down
5 changes: 5 additions & 0 deletions rakelib/install.rake
Expand Up @@ -107,6 +107,11 @@ namespace :install do
install_file name, /^runtime/, BUILD_CONFIG[:runtime]
end

# Install the .rb files for the core library (kernel).
FileList['kernel/**/*.rb'].each do |name|
install_file name, /^kernel/, BUILD_CONFIG[:kernel_path]
end

# Install the .rb files for the standard library. This is a
# separate block from the .rbc files so that the .rb files
# have an older timestamp and do not trigger recompiling.
Expand Down
44 changes: 44 additions & 0 deletions spec/core/compiledmethod/locate_line_spec.rb
@@ -0,0 +1,44 @@
module CompiledMethodSpec
LineTest = def line_test
1 + 1
2 + 2
end

BlockLineTest = def block_line_test
1 + 1
1.times do
2 + 2
end
end
end

# Line numbers are important! Thats why the above module is in
# this file and not a fixture.

describe "Rubinius::CompiledMethod#locate_line" do
it "finds the ip for a line" do
cm, ip = CompiledMethodSpec::LineTest.locate_line(4)
ip.should == 5
end

it "returns the CompiledMethod the ip is in" do
cm, ip = CompiledMethodSpec::LineTest.locate_line(3)
cm.should == CompiledMethodSpec::LineTest
end

it "returns nil if the line can't be found" do
CompiledMethodSpec::LineTest.locate_line(50).should be_nil
end

it "returns nil if the line is the definition line" do
CompiledMethodSpec::LineTest.locate_line(2).should be_nil
end

it "searches blocks for the line" do
cm, ip = CompiledMethodSpec::BlockLineTest.locate_line(10)
blk = CompiledMethodSpec::BlockLineTest.literals.to_a.grep(Rubinius::CompiledMethod).first

cm.should == blk
ip.should == 0
end
end
12 changes: 12 additions & 0 deletions spec/ruby/library/openstruct/element_reference_spec.rb
@@ -0,0 +1,12 @@
require File.expand_path('../../../spec_helper', __FILE__)
require "ostruct"

describe "OpenStruct#[]" do
before :each do
@os = OpenStruct.new
end

it "raises a NoMethodError" do
lambda { @os[1] }.should raise_error(NoMethodError)
end
end
14 changes: 14 additions & 0 deletions spec/ruby/library/openstruct/element_set_spec.rb
@@ -0,0 +1,14 @@
require File.expand_path('../../../spec_helper', __FILE__)
require "ostruct"

describe "OpenStruct#[]=" do
before :each do
@os = OpenStruct.new
end

ruby_bug "redmine:4179", "1.9.2" do
it "raises a NoMethodError" do
lambda { @os[1] = 2 }.should raise_error(NoMethodError)
end
end
end
20 changes: 0 additions & 20 deletions spec/ruby/library/openstruct/method_missing_spec.rb
Expand Up @@ -45,23 +45,3 @@
os.method_missing(:name).should be_nil
end
end

ruby_bug "redmine:4179", "1.9.2" do
describe "OpenStruct#method_missing when called with method name '[]'" do
it "raises a NoMethodError" do
os = OpenStruct.new
lambda { os.method_missing(:[]) }.should raise_error(NoMethodError)
lambda { os.method_missing(:[], 1) }.should raise_error(NoMethodError)
lambda { os.method_missing(:[], 1, 2) }.should raise_error(NoMethodError)
end
end

describe "OpenStruct#method_missing when called with method name '[]='" do
it "raises a NoMethodError" do
os = OpenStruct.new
lambda { os.method_missing(:[]=, 1) }.should raise_error(NoMethodError)
lambda { os.method_missing(:[]=, 1, 2) }.should raise_error(NoMethodError)
lambda { os.method_missing(:[]=, 1, 2, 3) }.should raise_error(NoMethodError)
end
end
end
1 change: 0 additions & 1 deletion spec/tags/18/ruby/core/argf/gets_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/tags/18/ruby/core/argf/readline_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/tags/18/ruby/library/openstruct/method_missing_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/tags/19/ruby/core/argf/gets_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/tags/19/ruby/core/argf/readline_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/tags/20/ruby/core/argf/gets_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/tags/20/ruby/core/argf/readline_tags.txt

This file was deleted.

2 changes: 1 addition & 1 deletion vm/agent.cpp
Expand Up @@ -388,7 +388,7 @@ namespace rubinius {
continue;
}
}
i++;
++i;
}

if(!found) {
Expand Down
2 changes: 1 addition & 1 deletion vm/agent_components.cpp
Expand Up @@ -297,7 +297,7 @@ namespace agent {

for(std::list<ManagedThread*>::iterator i = threads->begin();
i != threads->end();
i++) {
++i) {
if(VM* vm = (*i)->as_vm()) {
std::ostringstream ss;
vm->saved_call_frame()->print_backtrace(state_, ss);
Expand Down
6 changes: 5 additions & 1 deletion vm/builtin/block_environment.cpp
Expand Up @@ -389,9 +389,13 @@ namespace rubinius {
// over again (ie Proc.new) so we mark the method as not
// inlinable so that this works even with the JIT on.

if(!target) {
return Qnil;
}

target->cm->backend_method()->set_no_inline();

if(target && target->scope) {
if(target->scope) {
return target->scope->block();
}

Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/compiledmethod.cpp
Expand Up @@ -302,7 +302,7 @@ namespace rubinius {

for(IndirectLiterals::iterator i = vmm->indirect_literals().begin();
i != vmm->indirect_literals().end();
i++) {
++i) {
Object** ptr = (*i);
if((tmp = mark.call(*ptr)) != NULL) {
*ptr = tmp;
Expand Down

0 comments on commit f79f0c9

Please sign in to comment.