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

Commits on Mar 26, 2016

  1. Begin support for LLVM 3.6+.

    brixen committed Mar 26, 2016

    Verified

    This commit was signed with the committer’s verified signature.
    headius Charles Oliver Nutter
    Copy the full SHA
    2dd51a1 View commit details

Commits on Mar 28, 2016

  1. Copy the full SHA
    1a0d3cb View commit details

Commits on Mar 30, 2016

  1. Copy the full SHA
    d348367 View commit details

Commits on Apr 1, 2016

  1. Copy the full SHA
    1a7ff85 View commit details

Commits on Apr 26, 2016

  1. A fresh start...

    brixen committed Apr 26, 2016
    Copy the full SHA
    e4cbba0 View commit details
  2. Copy the full SHA
    66cc3cb View commit details

Commits on Apr 27, 2016

  1. Cleaned up more JIT code.

    brixen committed Apr 27, 2016
    Copy the full SHA
    b70bcca View commit details

Commits on May 1, 2016

  1. Copy the full SHA
    4b16760 View commit details

Commits on May 5, 2016

  1. Copy the full SHA
    5638472 View commit details
Showing with 135 additions and 24,127 deletions.
  1. +3 −2 .travis.yml
  2. +12 −30 configure
  3. +2 −0 core/jit.rb
  4. +0 −83 library/rubinius/configuration.rb
  5. +2 −10 machine/builtin/block_environment.cpp
  6. +7 −45 machine/builtin/compiled_code.cpp
  7. +1 −10 machine/builtin/compiled_code.hpp
  8. +0 −2 machine/builtin/encoding.cpp
  9. +1 −1 machine/builtin/integer.cpp
  10. +20 −19 machine/builtin/jit.cpp
  11. +0 −1 machine/builtin/native_method.cpp
  12. +1 −9 machine/builtin/system.cpp
  13. +1 −1 machine/builtin/time.cpp
  14. +2 −44 machine/call_frame.hpp
  15. +0 −1 machine/capi/thread.cpp
  16. +3 −3 machine/defines.hpp
  17. +0 −2 machine/drivers/cli.cpp
  18. +1 −1 machine/drivers/compile.cpp
  19. +4 −24 machine/environment.cpp
  20. +3 −2 machine/instructions.cpp
  21. +4 −0 machine/instruments/tooling.cpp
  22. +0 −49 machine/jit/llvm/autotypes.cpp
  23. +0 −55 machine/jit/llvm/basic_block.hpp
  24. +0 −827 machine/jit/llvm/block.cpp
  25. +0 −26 machine/jit/llvm/block.hpp
  26. +0 −723 machine/jit/llvm/builder.cpp
  27. +0 −133 machine/jit/llvm/builder.hpp
  28. +0 −277 machine/jit/llvm/cfg.hpp
  29. +0 −310 machine/jit/llvm/compiler.cpp
  30. +0 −76 machine/jit/llvm/compiler.hpp
  31. +0 −258 machine/jit/llvm/context.cpp
  32. +0 −278 machine/jit/llvm/context.hpp
  33. +0 −72 machine/jit/llvm/control_flow.hpp
  34. +0 −531 machine/jit/llvm/detection.cpp
  35. +0 −36 machine/jit/llvm/detection.hpp
  36. +0 −162 machine/jit/llvm/disassembler.cpp
  37. +0 −96 machine/jit/llvm/disassembler.hpp
  38. +0 −1,046 machine/jit/llvm/inline.cpp
  39. +0 −190 machine/jit/llvm/inline.hpp
  40. +0 −43 machine/jit/llvm/inline_block.cpp
  41. +0 −83 machine/jit/llvm/inline_block.hpp
  42. +0 −542 machine/jit/llvm/inline_block_builder.cpp
  43. +0 −20 machine/jit/llvm/inline_block_builder.hpp
  44. +0 −503 machine/jit/llvm/inline_method_builder.cpp
  45. +0 −28 machine/jit/llvm/inline_method_builder.hpp
  46. +0 −235 machine/jit/llvm/inline_policy.hpp
  47. +0 −1,825 machine/jit/llvm/inline_primitive.cpp
  48. +0 −72 machine/jit/llvm/local_info.hpp
  49. +0 −570 machine/jit/llvm/memory_manager.cpp
  50. +0 −688 machine/jit/llvm/memory_manager.hpp
  51. +0 −580 machine/jit/llvm/method.cpp
  52. +0 −26 machine/jit/llvm/method.hpp
  53. +0 −60 machine/jit/llvm/method_info.cpp
  54. +0 −276 machine/jit/llvm/method_info.hpp
  55. +0 −222 machine/jit/llvm/offset.hpp
  56. +0 −134 machine/jit/llvm/opcode_iter.hpp
  57. +0 −1,706 machine/jit/llvm/operations.hpp
  58. +0 −492 machine/jit/llvm/passes.cpp
  59. +0 −13 machine/jit/llvm/passes.hpp
  60. +0 −24 machine/jit/llvm/primitives.cpp
  61. +0 −92 machine/jit/llvm/runtime.cpp
  62. +0 −110 machine/jit/llvm/runtime.hpp
  63. +0 −49 machine/jit/llvm/stack_args.hpp
  64. +0 −832 machine/jit/llvm/state.cpp
  65. +0 −288 machine/jit/llvm/state.hpp
  66. +0 −133 machine/jit/llvm/types.cpp
  67. +0 −219 machine/jit/llvm/types.hpp
  68. +0 −1,187 machine/jit/llvm/types32.cpp.gen
  69. +0 −315 machine/jit/llvm/types32.ll
  70. +0 −1,188 machine/jit/llvm/types64.cpp.gen
  71. +0 −316 machine/jit/llvm/types64.ll
  72. +0 −1,573 machine/jit/llvm/util.cpp
  73. +0 −4,108 machine/jit/llvm/visit.hpp
  74. +8 −14 machine/machine_code.cpp
  75. +2 −7 machine/machine_code.hpp
  76. +0 −4 machine/memory.cpp
  77. +0 −1 machine/memory/finalizer.cpp
  78. +0 −22 machine/memory/gc.cpp
  79. +4 −4 machine/memory/gc.hpp
  80. +2 −6 machine/memory/immix_collector.cpp
  81. +0 −4 machine/method_primitives.cpp
  82. +2 −6 machine/metrics.cpp
  83. +0 −2 machine/ontology.cpp
  84. +0 −5 machine/primitives.hpp
  85. +4 −10 machine/shared_state.cpp
  86. +2 −0 machine/shared_state.hpp
  87. +0 −4 machine/signal.cpp
  88. +2 −5 machine/vm.cpp
  89. +0 −2 machine/vm.hpp
  90. +41 −43 rakelib/blueprint.rb
  91. +1 −1 scripts/llvm.sh
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -11,12 +11,13 @@ before_install:
- echo $LANG
- echo $LC_ALL
- if [ $TRAVIS_OS_NAME == linux ]; then ./scripts/llvm.sh; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install llvm35 && brew link --force llvm35; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install llvm; fi
- gem update --system
- gem --version
before_script:
- travis_retry bundle
- ./configure
if [ $TRAVIS_OS_NAME == linux ]; then travis_retry ./configure --llvm-config=llvm-config-3.6; fi
if [ $TRAVIS_OS_NAME == osx ]; then travis_retry ./configure; fi
script: rake ci
after_success:
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh release github website triggers; fi
42 changes: 12 additions & 30 deletions configure
Original file line number Diff line number Diff line change
@@ -58,7 +58,6 @@ class Configure
@gem = nil

# LLVM settings
@llvm_enabled = true
@llvm_path = nil
@llvm_system_name = get_system_name
@llvm_configure = nil
@@ -336,10 +335,6 @@ class Configure

o.doc "\n LLVM settings"

o.on "--disable-llvm", "Don't build with LLVM" do
@llvm_enabled = false
end

o.on "--system-name", "NAME", "Name of OS (eg fedora-8, ubuntu-10.04)" do |name|
@llvm_system_name = name
end
@@ -565,11 +560,6 @@ class Configure
end

def setup_llvm
unless @llvm_enabled
@log.write "WARNING: LLVM disabled."
return false
end

@log.print " Checking for 'llvm-config': "

config = @llvm_configure
@@ -583,8 +573,8 @@ class Configure
if macports?
config = macports_llvm_config
else
out = Bundler.with_clean_env { `brew --prefix llvm35` }.chomp
config = "#{out}/bin/llvm-config-3.5" if $?.success?
out = Bundler.with_clean_env { `brew --prefix llvm` }.chomp
config = "#{out}/bin/llvm-config" if $?.success?
end
end
end
@@ -604,8 +594,8 @@ class Configure
unless failed
parts = version.sub(/svn$/, "").split(".").map { |i| i.to_i }
api_version = ("%d%02d" % parts[0..1]).to_i
if api_version < 300 or api_version > 305
@log.write "only LLVM 3.0-3.5 is supported"
if api_version < 306
@log.write "only LLVM 3.6+ is supported"
else
@log.write "found! (version #{version} - api: #{api_version})"
@llvm = :config
@@ -666,19 +656,16 @@ int main() { LLVMContext &Context = getGlobalContext(); }
def check_llvm_flags
flags = '--ldflags'

if @llvm_api_version >= 305
# Starting with LLVM 3.5 the --system-libs option is required in order to
# link against libraries such as zlib. Prior to 3.5 this was handled by
# --ldflags.
flags << ' --system-libs'
end
@llvm_cxxflags << " -std=c++11"

# Starting with LLVM 3.5 the --system-libs option is required in order to
# link against libraries such as zlib. Prior to 3.5 this was handled by
# --ldflags.
flags << ' --system-libs'

# Generate the actual flags. For whatever reason llvm-config also includes
# newlines in the output, so lets get rid of those while we're at it.
@llvm_ldflags = `#{@llvm_configure} #{flags}`.strip.gsub("\n", ' ')

# We use some C++11 features in the VM source, so we need to enable support.
@llvm_cxxflags << " -std=c++11"
end

def env(which)
@@ -717,7 +704,7 @@ int main() { LLVMContext &Context = getGlobalContext(); }
check_tool_version @cc, '-dumpversion', [4, 1]
check_tool_version @cxx, '-dumpversion', [4, 1]

unless @cc == "clang" and @cxx == "clang++"
unless @cc =~ /clang/ and @cxx =~ /clang\+\+/
@log.deprecated <<-EOM
Support for compilers other than clang/clang++ is deprecated and will be
removed soon. If your platform does not have support for clang/clang++,
@@ -1532,10 +1519,6 @@ int main() { return tgetnum(""); }
def write_configure_files
@log.write "\nWriting configuration files..."

unless @llvm_enabled
@llvm_configure = ""
end

@bin_links.delete @program_name

config_settings = {
@@ -1544,7 +1527,6 @@ int main() { return tgetnum(""); }
:build_make => @make,
:build_rake => @rake,
:build_perl => @perl,
:llvm_enabled => @llvm_enabled,
:llvm_path => @llvm_path,
:llvm_system_name => @llvm_system_name,
:llvm_configure => @llvm_configure,
@@ -2073,7 +2055,7 @@ Available commands are:
# Query MacPorts for the path to the latest installed version of
# llvm-config that is within the range of supported LLVM versions.
def macports_llvm_config
supported_versions = (3.0 .. 3.5)
supported_versions = (3.6..3.9)
installed_ports = `port installed | egrep -o 'llvm-[^ ]+'`.split
latest_usable_port = installed_ports.sort.select do |fname|
version = fname.match(/-\K.*/)[0].to_f
2 changes: 2 additions & 0 deletions core/jit.rb
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@ class << self
attr_accessor :enabled
attr_accessor :properties

@enabled = false

alias_method :available?, :available
alias_method :enabled?, :enabled

83 changes: 0 additions & 83 deletions library/rubinius/configuration.rb
Original file line number Diff line number Diff line change
@@ -46,85 +46,6 @@
"How many bytes allocated by C extensions til the GC is run"
end

c.section "jit" do |s|
s.vm_variable "dump_code", 0,
"1 == show simple IR, 2 == show optimized IR, 4 == show machine code"

s.section "threshold" do |t|
t.vm_variable "compile", 32000,
"Number of method calls that trigger the JIT compiler"

t.vm_variable "inline", 8000,
"Number of method calls that trigger inlining the method"
end

s.section "limit" do |l|
l.vm_variable "deoptimize", 500,
"Number of times the JIT assumptions are false before a method is deoptimized"

l.vm_variable "overflow", 5000,
"Number of times the inline cache overflows before emitting a send from the JIT to call the method"

l.vm_variable "method_size", 5000,
"The maximum size of a method that will be JIT compiled"

l.vm_variable "search", 5,
"The maximum depth to search for an inlininging target"

l.section "inline" do |i|
i.vm_variable "method", 200,
"The maximum size of a method to be considered for inlining"

i.vm_variable "small", 2000,
"The maximum total inlining budget size for a small method"

i.vm_variable "normal", 3000,
"The maximum total inlining budget for a normal method"

i.vm_variable "large", 5000,
"The maximum total inlining budget for a large method"
end
end

s.vm_variable "show", false,
:as => "jit_show_compiling",
:description => "Print out a status message when the JIT is operating"

s.vm_variable "profile", false,
"The JIT will emit code to be sure JITd methods can be profiled"

s.section "inline" do |i|
i.vm_variable "generic", false, "Have the JIT inline generic methods"

i.vm_variable "blocks", false,
"Have the JIT try to inline methods and their literal blocks"

i.vm_variable "debug", false,
"Have the JIT print out information about inlining"
end

s.vm_variable "log", :string,
"Send JIT debugging output to this file rather than stdout"

s.vm_variable "debug", false,
"Have the JIT print debugging information"

s.vm_variable "sync", false,
"Wait for the JIT to finish compiling each method"

s.vm_variable "uncommon.print", false,
"Print out information on when methods are deoptimized due to uncommon traps"

s.vm_variable "removal.print", false,
"Print out whenever the JIT is removing unused code"

s.vm_variable "check_debugging", false,
"Allow JITd methods to deoptimize if there is a debugging request"

s.vm_variable "type.optz", true,
"Enable optimizations based on type flow"
end

c.section "fiber" do |s|
s.vm_variable "stacks", 10,
"The number of stacks in each Threads stack pool"
@@ -145,10 +66,6 @@
"Lock around using CAPI methods"
end

c.vm_variable "int", true,
:as => "jit_disabled",
:description => "Force the JIT to never turn on"

c.vm_variable "config.print", 0,
:as => "print_config",
:description => "blank or 1 == names and values, 2 == description as well"
12 changes: 2 additions & 10 deletions machine/builtin/block_environment.cpp
Original file line number Diff line number Diff line change
@@ -21,10 +21,6 @@
#include "builtin/tuple.hpp"
#include "builtin/variable_scope.hpp"

#ifdef ENABLE_LLVM
#include "jit/llvm/state.hpp"
#endif

#include <iostream>

namespace rubinius {
@@ -75,11 +71,9 @@ namespace rubinius {

state->vm()->metrics().machine.blocks_invoked++;

#ifdef ENABLE_LLVM
if(executor ptr = mcode->unspecialized) {
return (*((BlockExecutor)ptr))(state, env, args, invocation);
}
#endif

return execute_interpreter(state, env, args, invocation);
}
@@ -390,9 +384,9 @@ namespace rubinius {
return 0;
}

#ifdef ENABLE_LLVM
if(mcode->call_count >= 0) {
if(mcode->call_count >= state->shared().config.jit_threshold_compile) {
// TODO: JIT
if(false /*mcode->call_count >= state->shared().config.jit_threshold_compile*/) {
OnStack<1> os(state, env);

G(jit)->compile_soon(state, env->compiled_code(),
@@ -401,7 +395,6 @@ namespace rubinius {
mcode->call_count++;
}
}
#endif

StackVariables* scope = ALLOCA_STACKVARIABLES(mcode->number_of_locals);

@@ -440,7 +433,6 @@ namespace rubinius {
call_frame->dispatch_data = env;
call_frame->compiled_code = env->compiled_code();
call_frame->scope = scope;
call_frame->optional_jit_data = NULL;
call_frame->top_scope_ = env->top_scope();
call_frame->flags = invocation.flags | CallFrame::cMultipleScopes
| CallFrame::cBlock;
52 changes: 7 additions & 45 deletions machine/builtin/compiled_code.cpp
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@
#include "bytecode_verifier.hpp"
#include "call_frame.hpp"
#include "configuration.hpp"
#include "instruments/timing.hpp"
#include "object_utils.hpp"
#include "memory.hpp"
#include "on_stack.hpp"
#include "logger.hpp"

#include "builtin/call_site.hpp"
#include "builtin/class.hpp"
@@ -21,16 +21,10 @@

#include "memory/object_mark.hpp"

#include "logger.hpp"
#include "instruments/timing.hpp"

#include <ostream>

#ifdef ENABLE_LLVM
#include "jit/llvm/state.hpp"
#include "jit/llvm/compiler.hpp"
#include "jit/llvm/runtime.hpp"
#endif

namespace rubinius {

void CompiledCode::bootstrap(STATE) {
@@ -233,28 +227,8 @@ namespace rubinius {
return false;
}

void CompiledCode::set_unspecialized(executor exec, jit::RuntimeDataHolder* rd) {
if(!machine_code()) rubinius::bug("specializing with no backend");

machine_code()->set_execute_status(MachineCode::eJIT);

#ifdef ENABLE_LLVM
jit_data(rd);
#endif
machine_code()->unspecialized = exec;

// See if we can also just make this the normal execute
for(int i = 0; i < MachineCode::cMaxSpecializations; i++) {
if(machine_code()->specializations[i].class_data.raw > 0) return;
}

if(primitive()->nil_p()) {
execute = exec;
}
}

void CompiledCode::add_specialized(STATE, uint32_t class_id, uint32_t serial_id, executor exec,
jit::RuntimeDataHolder* rd)
void CompiledCode::add_specialized(STATE,
uint32_t class_id, uint32_t serial_id, executor exec)
{
if(!machine_code()) {
logger::error("specializing with no backend");
@@ -287,7 +261,6 @@ namespace rubinius {
v->specializations[i].class_data.f.class_id = class_id;
v->specializations[i].class_data.f.serial_id = serial_id;
v->specializations[i].execute = exec;
v->specializations[i].jit_data = rd;

v->set_execute_status(MachineCode::eJIT);
if(primitive()->nil_p()) {
@@ -449,20 +422,9 @@ namespace rubinius {
MachineCode* mcode = code->machine_code();
mcode->set_mark();

#ifdef ENABLE_LLVM
if(code->jit_data()) {
code->jit_data()->set_mark();
code->jit_data()->mark_all(code, mark);
}


for(int i = 0; i < MachineCode::cMaxSpecializations; i++) {
if(mcode->specializations[i].jit_data) {
mcode->specializations[i].jit_data->set_mark();
mcode->specializations[i].jit_data->mark_all(code, mark);
}
// TODO: JIT
}
#endif

for(size_t i = 0; i < mcode->references_count(); i++) {
if(size_t ip = mcode->references()[i]) {
@@ -497,7 +459,7 @@ namespace rubinius {
} else {
std::cout << "yes\n";

#ifdef ENABLE_LLVM
/* TODO: JIT
MachineCode* v = code->machine_code();
for(int i = 0; i < MachineCode::cMaxSpecializations; i++) {
@@ -509,7 +471,7 @@ namespace rubinius {
v->specializations[i].jit_data->native_size());
llvm::outs() << "</MachineCode>\n";
}
#endif
*/
}

close_body(level);
Loading