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:
	Rakefile
	configure
	mspec/lib/mspec/helpers/ruby_exe.rb
	spec/ruby/core/kernel/catch_spec.rb
	spec/tags/18/ruby/library/socket/basicsocket/send_tags.txt
	vm/configuration.hpp
	vm/gc/baker.cpp
	vm/llvm/access_memory.hpp
	vm/shared_state.hpp
	vm/vm.hpp
  • Loading branch information
Brian Ford committed Jul 13, 2011
2 parents 73141d7 + 27e71ea commit 4b04a86
Show file tree
Hide file tree
Showing 668 changed files with 3,949 additions and 3,780 deletions.
103 changes: 37 additions & 66 deletions README
@@ -1,115 +1,86 @@
1. What is Rubinius

Rubinius is an implementation of the Ruby programming language. Rubinius
includes a bytecode virtual machine, parser, bytecode compiler, garbage
collector, JIT native machine code compiler, and Ruby core and standard
libraries.
Rubinius is an implementation of the Ruby programming language.

Rubinius includes a bytecode virtual machine, parser, bytecode compiler,
garbage collector, and just-in-time (JIT) native machine code compiler. The
Ruby core library is written almost entirely in Ruby. Rubinius provides the
same standard libraries as Matz's Ruby implementation (MRI). Rubinius also
provides C-API compatibility for native C extensions.

Rubinius currently is compatible with Ruby version 1.8.7. Support for Ruby
version 1.9.2 is coming soon.

Rubinius runs on Mac OS X and many Unix/Linux operating systems. Support for
Microsoft Windows is coming soon.

2. License
Most popular Ruby applications, like Rails, run on Rubinius.

Rubinius uses the BSD license. See LICENSE for details.

2. License

3. Installing Rubinius
Rubinius uses the BSD license. See LICENSE for details.

Rubinius runs on Mac OS X and many Unix/Linux operating systems. Support for
Microsoft Windows is coming soon.

For more information about building and running Rubinius, run 'rake docs'.
3. Installing Rubinius from Source

To install Rubinius, use the following steps:

1. Ensure you have MRI 1.8.7+, rubygems, rake, and git installed
1. Ensure that MRI 1.8.7+, rubygems, rake, and git are installed
2. git clone git://github.com/rubinius/rubinius.git
3. cd rubinius
4. ./configure --prefix=/path/to/install/dir
5. rake install

When the install process finishes, follow the directions to add the Rubinius
executable (bin) directory to your PATH.
When the install process finishes, follow the directions printed to the
terminal to add the Rubinius executable (bin) directory to your PATH.

Rubinius comes with RubyGems built-in. To install a gem, run the following:

rbx -S gem install <gem_name>

After installing Rubinius, you can access the built-in documentation at any
time by running 'rbx docs'.
For more information about building and running Rubinius, run 'rake docs'.

3.1 Rubinius with RVM

You may wish to use the Ruby enVironment Manager (RVM) project to install
Rubinius. For the most current documentation for RVM, please visit
https://rvm.beginrescueend.com.
4. Installing Rubinius with RVM

Be sure that RVM has been installed properly and is loaded as a function as is
explained in detail on the basics page, https://rvm.beginrescueend.com/rvm/basics/
Rubinius can be installed using the Ruby enVironment Manager (RVM) project.

Assuming all Rubinius dependencies have been preinstalled on the system, you may
now install Rubinius either latest or head as follows,
To install Rubinius with RVM, use the following steps:

rvm install rbx # Installs latest release (defaulted to install head)
rvm install rbx-head # Installs Rubinius master branch from github
1. Ensure the latest RVM is installed
2. rvm install rbx-head

Once installed,
To use Rubinius in the current shell session, run:

rvm use rbx # Selects Rubinius into the current shell session.
rvm use rbx

If you wish to make Rubinius the default interpreter when you open new shells,
To make Rubinius the default interpreter in new shells, run:

rvm use rbx --default

In order to view the dependency list to preinstall for rbx type

rvm notes
The documentation for RVM is available at:

For more information on working with rvm please visit the RVM website,
https://rvm.beginrescueend.com

https://rvm.beginrescueend.com/

4. Version 1.1

Rubinius has been under development as a public open-source project since
November 2006. Rubinius development is sponsored by Engine Yard, Inc. and
assisted by the generous work of over 100 contributors.

At version 1.1, Rubinius is significantly feature-complete. It is expected
that your Ruby code will run correctly. Additionally, many MRI C extensions
are expected to work, as long as they do not depend on MRI-specific object
internals or the MRI interpreter internals.

With the JIT, Rubinius performance is quite good, sometimes faster than MRI
and sometimes slower. Rubinius generally executes Ruby code very fast as
compared to MRI. However, since the majority of the Ruby core library is also
implemented in Ruby rather than C as it is in MRI, code that depends heavily
on Array, Hash, String, etc. may run slower in Rubinius right now. As the JIT
improves, overall performance of your code under Rubinius will improve.
5. Using RubyGems

Rubinius comes with RubyGems built-in. To install a gem, run the following:

5. Goals
rbx -S gem install <gem_name>

* Thread safety. Rubinius intends to be thread-safe so you could embed more
than one interpreter in a single application.

* Clean, readable code that is easy for users to understand and extend.
6. Documentation

* Reliable, rock-solid code. Valgrind is used to help verify correctness.
After installing Rubinius, run 'rbx docs' to access the built-in documentation
at any time.

* Bring modern research in virtual machines, garbage collectors, and compilers
to the Ruby programming language.

7. Tickets

6. Tickets
Please file tickets for bugs or problems. The issue tracker is:

Please file tickets for bugs or problems that you encounter. The issue tracker
is: http://github.com/rubinius/rubinius/issues. Run 'rake docs' for more
details.
http://github.com/rubinius/rubinius/issues


7. Contributing
8. Contributing

The Rubinius team welcomes contributions. Run 'rake docs' and see the
"Contributing" page.
15 changes: 15 additions & 0 deletions benchmark/core/array/bench_element_removal.rb
Expand Up @@ -13,6 +13,11 @@

base_array = (0...5_000).to_a

x.report "array reject, front to back" do
scratch_array = base_array.dup
scratch_array = scratch_array.reject { true }
end

x.report "array delete_at, front to back" do
scratch_array = base_array.dup
scratch_array.delete_at(0) until scratch_array.empty?
Expand All @@ -38,6 +43,11 @@
scratch_array.shift until scratch_array.empty?
end

x.report "array shift(1), front to back" do
scratch_array = base_array.dup
scratch_array.shift(1) until scratch_array.empty?
end

x.report "array drop_while, front to back" do
scratch_array = base_array.dup
scratch_array.drop_while { true }
Expand All @@ -58,6 +68,11 @@
scratch_array.pop until scratch_array.empty?
end

x.report "array pop(1), back to front" do
scratch_array = base_array.dup
scratch_array.pop(1) until scratch_array.empty?
end

x.report "array delete_at, back to front" do
scratch_array = base_array.dup
i = scratch_array.size - 1
Expand Down
59 changes: 59 additions & 0 deletions benchmark/core/array/bench_slice.rb
@@ -0,0 +1,59 @@
require 'benchmark'
require 'benchmark/ips'
require File.expand_path('../shared_array.rb', __FILE__)

Benchmark.ips do |x|
small_array = $small_array.dup

x.report "Array#slice index" do |times|
i = 0
while i < times
small_array.slice(5)
i += 1
end
end

x.report "Array#slice start, length" do |times|
i = 0
while i < times
small_array.slice(5, 5)
i += 1
end
end

x.report "Array#slice range" do |times|
i = 0
while i < times
small_array.slice(5..10)
i += 1
end
end

x.report "Array#slice! index" do |times|
i = 0
while i < times
small_array2 = small_array.dup
small_array2.slice!(5)
i += 1
end
end

x.report "Array#slice! start, length" do |times|
i = 0
while i < times
small_array2 = small_array.dup
small_array2.slice!(5, 5)
i += 1
end
end

x.report "Array#slice! range" do |times|
i = 0
while i < times
small_array2 = small_array.dup
small_array2.slice!(5..10)
i += 1
end
end

end
53 changes: 52 additions & 1 deletion benchmark/core/string/bench_case.rb
Expand Up @@ -169,5 +169,56 @@
end
end

end
# String#capitalize
x.report "string capitalize from lowercase" do |times|
i = 0
while i < times
lowercase.capitalize
i += 1
end
end

x.report "string capitalize from uppercase" do |times|
i = 0
while i < times
uppercase.capitalize
i += 1
end
end

x.report "string capitalize from mixedcase" do |times|
i = 0
while i < times
mixedcase.capitalize
i += 1
end
end

# String#capitalize!
x.report "string capitalize! from lowercase" do |times|
i = 0
while i < times
lowercase = lowercase_o.dup
lowercase.capitalize!
i += 1
end
end

x.report "string capitalize! from uppercase" do |times|
i = 0
while i < times
uppercase = uppercase_o.dup
uppercase.capitalize!
i += 1
end
end

x.report "string capitalize! from mixedcase" do |times|
i = 0
while i < times
mixedcase = mixedcase_o.dup
mixedcase.capitalize!
i += 1
end
end
end
5 changes: 4 additions & 1 deletion kernel/common/codeloader.rb
Expand Up @@ -69,10 +69,13 @@ def finished
CodeLoader.loaded @load_path
end

# Hook support. This allows code to be told when a file was just loaded
# Hook support. This allows code to be told when a file was just compiled,
# or when it has finished loading.
@compiled_hook = Rubinius::Hook.new
@loaded_hook = Rubinius::Hook.new

class << self
attr_reader :compiled_hook
attr_reader :loaded_hook

attr_writer :source_extension
Expand Down
2 changes: 1 addition & 1 deletion kernel/common/module.rb
Expand Up @@ -682,7 +682,7 @@ def initialize_copy(other)
sc_o = Rubinius::Type.object_singleton_class other

sc_s.method_table = sc_o.method_table.dup
sc_s.superclass = sc_o.superclass
sc_s.superclass = sc_o.direct_superclass

@constant_table = Rubinius::LookupTable.new

Expand Down
1 change: 1 addition & 0 deletions kernel/delta/codeloader.rb
Expand Up @@ -151,6 +151,7 @@ def load_file(wrap=false)
script.data_path = @load_path

@cm = cm
CodeLoader.compiled_hook.trigger! script
return script
end

Expand Down
15 changes: 9 additions & 6 deletions lib/compiler/ast/constants.rb
Expand Up @@ -16,11 +16,13 @@ def bytecode(g)
g.find_const @name
end

def assign_bytecode(g)
def assign_bytecode(g, value)
pos(g)

@parent.bytecode(g)
value.bytecode(g)
g.push_literal @name
@parent.bytecode(g)
g.rotate 3
end

def masgn_bytecode(g)
Expand Down Expand Up @@ -97,11 +99,12 @@ def bytecode(g)
g.find_const @name
end

def assign_bytecode(g)
def assign_bytecode(g, value)
pos(g)

g.push_cpath_top
g.push_literal @name
value.bytecode(g)
end

def masgn_bytecode(g)
Expand Down Expand Up @@ -177,11 +180,12 @@ def bytecode(g)
g.push_const @name
end

def assign_bytecode(g)
def assign_bytecode(g, value)
pos(g)

g.push_scope
g.push_literal @name
value.bytecode(g)
end

def masgn_bytecode(g)
Expand Down Expand Up @@ -268,8 +272,7 @@ def bytecode(g)

return masgn_bytecode(g) if g.state.masgn?

@constant.assign_bytecode(g)
@value.bytecode(g)
@constant.assign_bytecode(g, @value)
g.send :const_set, 2
end

Expand Down

0 comments on commit 4b04a86

Please sign in to comment.