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: 689a4e5f6e97
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8ed5de1b9e92
Choose a head ref
  • 5 commits
  • 9 files changed
  • 1 contributor

Commits on Dec 1, 2014

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    64004c8 View commit details
  2. Copy the full SHA
    eff0ee7 View commit details
  3. Copy the full SHA
    b67cae4 View commit details
  4. Copy the full SHA
    2bccdc5 View commit details
  5. Copy the full SHA
    8ed5de1 View commit details
Showing with 343 additions and 33 deletions.
  1. +2 −2 Gemfile.lock
  2. +2 −2 gems_list.txt
  3. +2 −2 kernel/bootstrap/kernel.rb
  4. +25 −1 rakelib/instruction_parser.rb
  5. +140 −0 vm/instructions.def
  6. +12 −0 vm/llvm/cfg.hpp
  7. +36 −1 vm/llvm/jit_builder.cpp
  8. +118 −25 vm/llvm/jit_visit.hpp
  9. +6 −0 vm/llvm/opcode_iter.hpp
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ GEM
daedalus-core (0.1.0)
rake (10.4.0)
redcard (1.1.0)
rubinius-ast (2.2.5)
rubinius-ast (2.3.0)
rubinius-bridge (1.1.0)
redcard (~> 1.0)
rubinius-build_tools (2.0.0)
@@ -13,7 +13,7 @@ GEM
rubinius-melbourne (~> 2.0)
rubinius-processor (~> 2.0)
rubinius-toolset (~> 2.0)
rubinius-compiler (2.2.1)
rubinius-compiler (2.3.0)
rubinius-melbourne (2.3.0.0)
rubinius-processor (2.3.0)
rubinius-toolset (2.3.1)
4 changes: 2 additions & 2 deletions gems_list.txt
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ racc-1.4.12.gem
rake-10.4.0.gem
rb-readline-0.5.1.gem
rdoc-4.1.2.gem
rubinius-ast-2.2.5.gem
rubinius-ast-2.3.0.gem
rubinius-build_tools-2.0.0.gem
rubinius-compiler-2.2.1.gem
rubinius-compiler-2.3.0.gem
rubinius-coverage-2.0.3.gem
rubinius-debugger-2.1.0.gem
rubinius-developer_tools-2.0.0.gem
4 changes: 2 additions & 2 deletions kernel/bootstrap/kernel.rb
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ def singleton_class?
!!Rubinius::Type.singleton_class_object(self)
end

def extend(*mods)
Rubinius::Type.object_singleton_class(self).include(*mods)
def extend(mod)
Rubinius::Type.object_singleton_class(self).include(mod)
self
end

26 changes: 25 additions & 1 deletion rakelib/instruction_parser.rb
Original file line number Diff line number Diff line change
@@ -214,6 +214,30 @@ def process_goto_if_true
conditional_branch
end

def process_goto_if_nil
conditional_branch
end

def process_goto_if_not_nil
conditional_branch
end

def process_goto_if_undefined
conditional_branch
end

def process_goto_if_not_undefined
conditional_branch
end

def process_goto_if_equal
conditional_branch
end

def process_goto_if_not_equal
conditional_branch
end

def process_setup_unwind
conditional_branch
end
@@ -810,7 +834,7 @@ def generate_generator_methods(filename)
File.open filename, "wb" do |file|
file.puts "# *** This file is generated by InstructionParser ***"
file.puts
file.puts "module Rubinius"
file.puts "module CodeTools"
file.puts " module GeneratorMethods"

objects.each { |obj| obj.opcode_method self, file }
140 changes: 140 additions & 0 deletions vm/instructions.def
Original file line number Diff line number Diff line change
@@ -96,6 +96,12 @@ section "Flow control"
# [See Also]
# goto_if_true
# goto_if_false
# goto_if_nil
# goto_if_not_nil
# goto_if_undefined
# goto_if_not_undefined
# goto_if_equal
# goto_if_not_equal

instruction goto(location) [ -- ] => branch
store_ip(location);
@@ -107,6 +113,12 @@ end
# [See Also]
# goto
# goto_if_true
# goto_if_nil
# goto_if_not_nil
# goto_if_undefined
# goto_if_not_undefined
# goto_if_equal
# goto_if_not_equal

instruction goto_if_false(location) [ value -- ] => branch
Object* t1 = stack_pop();
@@ -121,6 +133,12 @@ end
# [See Also]
# goto
# goto_if_false
# goto_if_nil
# goto_if_not_nil
# goto_if_undefined
# goto_if_not_undefined
# goto_if_equal
# goto_if_not_equal

instruction goto_if_true(location) [ value -- ] => branch
Object* t1 = stack_pop();
@@ -129,6 +147,128 @@ instruction goto_if_true(location) [ value -- ] => branch
}
end

# [Description]
# Remove the top value on the stack, and if `nil`, set the instruction
# pointer to the value specified by _location_.
# [See Also]
# goto
# goto_if_false
# goto_if_true
# goto_if_not_nil
# goto_if_undefined
# goto_if_not_undefined
# goto_if_equal
# goto_if_not_equal

instruction goto_if_nil(location) [ value -- ] => branch
Object* t1 = stack_pop();
if(t1 == cNil) {
store_ip(location);
}
end

# [Description]
# Remove the top value on the stack, and if not `nil`, set the instruction
# pointer to the value specified by _location_.
# [See Also]
# goto
# goto_if_false
# goto_if_true
# goto_if_nil
# goto_if_undefined
# goto_if_not_undefined
# goto_if_equal
# goto_if_not_equal

instruction goto_if_not_nil(location) [ value -- ] => branch
Object* t1 = stack_pop();
if(t1 != cNil) {
store_ip(location);
}
end

# [Description]
# Remove the top value on the stack, and if the special value `undefined`, set
# the instruction pointer to the value specified by _location_.
# [See Also]
# goto
# goto_if_false
# goto_if_true
# goto_if_nil
# goto_if_not_nil
# goto_if_not_undefined
# goto_if_equal
# goto_if_not_equal

instruction goto_if_undefined(location) [ value -- ] => branch
Object* t1 = stack_pop();
if(t1 == G(undefined)) {
store_ip(location);
}
end

# [Description]
# Remove the top value on the stack, and if not the special value `undefined`,
# set the instruction pointer to the value specified by _location_.
# [See Also]
# goto
# goto_if_false
# goto_if_true
# goto_if_nil
# goto_if_not_nil
# goto_if_undefined
# goto_if_equal
# goto_if_not_equal

instruction goto_if_not_undefined(location) [ value -- ] => branch
Object* t1 = stack_pop();
if(t1 != G(undefined)) {
store_ip(location);
}
end

# [Description]
# Remove the top two values on the stack, and if they are C `==`, set the
# instruction pointer to the value specified by _location_.
# [See Also]
# goto
# goto_if_false
# goto_if_true
# goto_if_nil
# goto_if_not_nil
# goto_if_undefined
# goto_if_not_undefined
# goto_if_not_equal

instruction goto_if_equal(location) [ value1 value2 -- ] => branch
Object* t1 = stack_pop();
Object* t2 = stack_pop();
if(t1 == t2) {
store_ip(location);
}
end

# [Description]
# Remove the top two values on the stack, and if they are C `!=`, set
# the instruction pointer to the value specified by _location_.
# [See Also]
# goto
# goto_if_false
# goto_if_true
# goto_if_nil
# goto_if_not_nil
# goto_if_undefined
# goto_if_not_undefined
# goto_if_equal

instruction goto_if_not_equal(location) [ value1 value2 -- ] => branch
Object* t1 = stack_pop();
Object* t2 = stack_pop();
if(t1 != t2) {
store_ip(location);
}
end

# [Description]
# Return a value to the direct caller
#
12 changes: 12 additions & 0 deletions vm/llvm/cfg.hpp
Original file line number Diff line number Diff line change
@@ -149,6 +149,12 @@ namespace jit {
case InstructionSequence::insn_goto:
case InstructionSequence::insn_goto_if_true:
case InstructionSequence::insn_goto_if_false:
case InstructionSequence::insn_goto_if_nil:
case InstructionSequence::insn_goto_if_not_nil:
case InstructionSequence::insn_goto_if_undefined:
case InstructionSequence::insn_goto_if_not_undefined:
case InstructionSequence::insn_goto_if_equal:
case InstructionSequence::insn_goto_if_not_equal:
if(iter.operand1() < iter.position()) {
if(!find_block(iter.operand1())) {
CFGBlock* blk = new CFGBlock(iter.operand1(), true);
@@ -208,6 +214,12 @@ namespace jit {
case InstructionSequence::insn_goto:
case InstructionSequence::insn_goto_if_true:
case InstructionSequence::insn_goto_if_false:
case InstructionSequence::insn_goto_if_nil:
case InstructionSequence::insn_goto_if_not_nil:
case InstructionSequence::insn_goto_if_undefined:
case InstructionSequence::insn_goto_if_not_undefined:
case InstructionSequence::insn_goto_if_equal:
case InstructionSequence::insn_goto_if_not_equal:
if(iter.operand1() > iter.position()) {
current_->add_child(add_block(iter.operand1()));
} else {
37 changes: 36 additions & 1 deletion vm/llvm/jit_builder.cpp
Original file line number Diff line number Diff line change
@@ -367,7 +367,42 @@ namespace jit {
break_at(current_ip_ + 2);
}

void visit_goto_if_defined(opcode which) {
void visit_goto_if_nil(opcode which) {
if(current_ip_ < which) loops_ = true;

break_at(which);
break_at(current_ip_ + 2);
}

void visit_goto_if_not_nil(opcode which) {
if(current_ip_ < which) loops_ = true;

break_at(which);
break_at(current_ip_ + 2);
}

void visit_goto_if_undefined(opcode which) {
if(current_ip_ < which) loops_ = true;

break_at(which);
break_at(current_ip_ + 2);
}

void visit_goto_if_not_undefined(opcode which) {
if(current_ip_ < which) loops_ = true;

break_at(which);
break_at(current_ip_ + 2);
}

void visit_goto_if_equal(opcode which) {
if(current_ip_ < which) loops_ = true;

break_at(which);
break_at(current_ip_ + 2);
}

void visit_goto_if_not_equal(opcode which) {
if(current_ip_ < which) loops_ = true;

break_at(which);
Loading