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: ec57d3199ef0^
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5676194fd326
Choose a head ref
  • 2 commits
  • 23 files changed
  • 1 contributor

Commits on Apr 8, 2016

  1. Copy the full SHA
    ec57d31 View commit details
  2. Copy the full SHA
    5676194 View commit details
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -4,6 +4,6 @@ gem "rake", "~> 10.0"
gem "redcard", "~> 1.0"

gem "daedalus-core", "~> 0.1"
gem "rubinius-bridge", "~> 1.0"
gem "rubinius-bridge", "~> 2.0"

gem "rubinius-code", "~> 3"
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ GEM
daedalus-core (0.5.0)
rake (10.5.0)
redcard (1.1.0)
rubinius-ast (3.2)
rubinius-bridge (1.1.0)
rubinius-ast (3.3)
rubinius-bridge (2.2)
redcard (~> 1.0)
rubinius-code (3.0)
rubinius-ast (~> 3)
@@ -14,7 +14,7 @@ GEM
rubinius-melbourne (~> 3)
rubinius-processor (~> 3)
rubinius-toolset (~> 3)
rubinius-compiler (3.1)
rubinius-compiler (3.2)
rubinius-instructions (3.0)
rubinius-melbourne (3.5)
rubinius-processor (3.0)
@@ -27,7 +27,7 @@ DEPENDENCIES
daedalus-core (~> 0.1)
rake (~> 10.0)
redcard (~> 1.0)
rubinius-bridge (~> 1.0)
rubinius-bridge (~> 2.0)
rubinius-code (~> 3)

BUNDLED WITH
2 changes: 1 addition & 1 deletion core/alpha.rb
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ def to_s
#
# Redefined later.
#
def raise(cls, str, junk=nil)
def raise(cls, str="", junk=nil)
Rubinius::VM.write_error "Fatal error loading core library:\n "
Rubinius::VM.write_error str
Rubinius::VM.write_error "\n"
102 changes: 48 additions & 54 deletions core/sprinter.rb
Original file line number Diff line number Diff line change
@@ -19,8 +19,12 @@ def self.get(format)
end

def initialize(format)
Rubinius::Type.object_singleton_class(self).dynamic_method :call do |g|
Builder.new(self, format, g).build
begin
Rubinius::Type.object_singleton_class(self).dynamic_method :call do |g|
Builder.new(self, format, g).build
end
rescue Rubinius::ToolSets::Runtime::CompileError => e
raise RuntimeError, "failed to compile printf format: #{format}", e
end
end

@@ -281,20 +285,15 @@ def build
@g.ret
end

def meta_op_minus
@op_minus ||= @g.find_literal(:-)
@g.meta_send_op_minus @op_minus
end

def invert
@g.meta_push_0
@g.push_int 0
@g.swap
meta_op_minus
@g.send :-, 1
end

def is_negative
@g.meta_push_0
@g.meta_send_op_lt @g.find_literal(:<)
@g.push_int 0
@g.send :<, 1
end

def justify(direction, may_be_negative=true)
@@ -339,7 +338,7 @@ def next_index(specified=nil)
end

def append_literal(str)
@g.push_unique_literal str
@g.push_literal str
append_str
end

@@ -353,8 +352,8 @@ def encode_value(str)
end

def is_zero
@g.meta_push_0
@g.meta_send_op_equal @g.find_literal(:==)
@g.push_int 0
@g.send :equal?, 1
end

class Atom
@@ -410,16 +409,16 @@ def set_precision(full, ref, static)
def push_value
if @name
@g.push_local 0
@g.push_unique_literal @name
@g.send(:fetch, 1)
@g.push_literal @name
@g.send :fetch, 1
else
@g.push_local @field_index
end
end

def push_width_value
if @width_static
@g.push @width_static
@g.push_int @width_static
elsif
@g.push_local @width_index
else
@@ -431,9 +430,9 @@ def push_width(adjust=true)
if @width_static
raise ArgumentError, "width too big" unless @width_static.class == Fixnum
if adjust && @full_leader_size > 0
@g.push(@width_static - @full_leader_size)
@g.push_int(@width_static - @full_leader_size)
else
@g.push @width_static
@g.push_int @width_static
end

elsif @width_index
@@ -460,7 +459,7 @@ def push_width(adjust=true)

def push_precision_value
if @prec_static
@g.push @prec_static
@g.push_int @prec_static
else
@g.push_local @prec_index
end
@@ -469,7 +468,7 @@ def push_precision_value
def push_precision
if @prec_static
raise ArgumentError, "precision too big" unless @prec_static.class == Fixnum
@g.push @prec_static
@g.push_int @prec_static

elsif @prec_index
@g.push_local @prec_index
@@ -599,8 +598,8 @@ def bytecode

@g.dup
@g.send :length, 0
@g.meta_push_1
@g.meta_send_op_equal @g.find_literal(:==)
@g.push_int 1
@g.send :equal?, 1
@b.if_false do
@b.raise_ArgumentError "%c requires a character"
end
@@ -646,7 +645,7 @@ def expand_with_width

def bytecode
if fast_common_case?
@g.push :self
@g.push_self

push_value

@@ -659,7 +658,7 @@ def bytecode

@b.append_str
else
@g.push :self
@g.push_self
push_value
@g.send :as_int, 1

@@ -670,27 +669,27 @@ def bytecode
# generic case

if @f_space
@g.push :self
@g.push_self
@g.push_stack_local val_idx
@g.send :compute_space, 1
@b.append_str
elsif @f_plus
@g.push :self
@g.push_self
@g.push_stack_local val_idx
@g.send :compute_plus, 1
@b.append_str
end

if @has_precision
@g.push :self
@g.push_self
@g.push_stack_local val_idx

push_precision_value

@g.send :digit_expand_precision, 2

if @has_width
@g.push :self
@g.push_self
@g.swap
push_width_value

@@ -704,7 +703,7 @@ def bytecode
@b.append_str

elsif @has_width
@g.push :self
@g.push_self
@g.push_stack_local val_idx

push_width_value
@@ -726,8 +725,8 @@ class ExtIntegerAtom < Atom
def pad_negative_int(padding)
zero_pad(padding) do
# decrease the width by 2 to account for the ".." below
@g.meta_push_2
@b.meta_op_minus
@g.push_int 2
@g.send :-, 1
end

@g.push_literal ".."
@@ -743,7 +742,7 @@ def prepend_prefix_bytecode
if @format_code == 'x' || @format_code == 'X'
push_value
@b.is_zero
@g.git skip_prefix
@g.goto_if_true skip_prefix
end

prepend_prefix
@@ -753,13 +752,13 @@ def prepend_prefix_bytecode

def format_negative_int(radix)
# (num + radix ** num.to_s(radix).size).to_s(radix)
@g.push radix
@g.push_int radix
@g.dup_many 2
@g.send :to_s, 1
@g.send :size, 0
@g.send :**, 1
@g.meta_send_op_plus @g.find_literal(:+)
@g.push radix
@g.send :+, 1
@g.push_int radix
@g.send :to_s, 1

(radix - 1).to_s(radix)
@@ -790,7 +789,7 @@ def bytecode
@b.invert
end

@g.push radix
@g.push_int radix
@g.send :to_s, 1
else
have_formatted = @g.new_label
@@ -799,7 +798,7 @@ def bytecode
@b.is_negative

@b.if_false do
@g.push radix
@g.push_int radix
@g.send :to_s, 1
@g.goto have_formatted
end
@@ -862,7 +861,7 @@ def string_justify
justify_width

if @has_precision
@g.meta_push_0
@g.push_int 0
push_precision
@g.send :[], 2
end
@@ -961,11 +960,9 @@ def push_Hash
end

def raise_ArgumentError(msg)
@lit_new ||= @g.add_literal(:new)

@g.push_const :ArgumentError
@g.push_unique_literal msg
@g.send_stack @lit_new, 1
@g.push_literal msg
@g.send :new, 1
@g.raise_exc
end

@@ -984,9 +981,6 @@ def force_type(klass, method=klass)
end

def try_type(klass, method)

@lit_check ||= @g.add_literal(:check_convert_type)

@g.dup
@g.push_const klass
@g.swap
@@ -995,8 +989,8 @@ def try_type(klass, method)
@g.push_type
@g.swap
@g.push_const klass
@g.push_unique_literal method
@g.send_stack @lit_check, 3
@g.push_literal method
@g.send :check_convert_type, 3
@g.dup
if_false do
yield if block_given?
@@ -1006,14 +1000,14 @@ def try_type(klass, method)

def if_true
l = @g.new_label
@g.gif l
@g.goto_if_false l
yield
l.set!
end

def if_false
l = @g.new_label
@g.git l
@g.goto_if_true l
yield
l.set!
end
@@ -1094,11 +1088,11 @@ def parse

@arg_count = 1
@g.passed_arg @arg_count
@g.git exception
@g.goto_if_true exception
push_Hash
@g.push_local 0
@g.kind_of
@g.gif exception
@g.goto_if_false exception
@g.goto continue

exception.set!
@@ -1114,11 +1108,11 @@ def parse

# Check this first; it's much faster, and generally false
@g.passed_arg @arg_count
@g.gif no_exception
@g.goto_if_false no_exception

gva = Rubinius::ToolSets::Runtime::AST::GlobalVariableAccess
gva.new(1, :$DEBUG).bytecode(@g)
@g.gif no_exception
@g.goto_if_false no_exception

raise_ArgumentError "too many arguments for format string"

4 changes: 2 additions & 2 deletions gems_list.txt
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ rake-10.5.0.gem
rb-readline-0.5.3.gem
rdoc-4.2.2.gem
redcard-1.1.0.gem
rubinius-ast-3.2.gem
rubinius-ast-3.3.gem
rubinius-bridge-1.1.0.gem
rubinius-code-3.0.gem
rubinius-compiler-3.1.gem
rubinius-compiler-3.2.gem
rubinius-coverage-2.0.3.gem
rubinius-debugger-2.4.gem
rubinius-developer_tools-2.0.0.gem
Loading