summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-12 07:16:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-12 07:16:23 +0000
commit2c42aac9fbe91f7d3287797d3c91181d90c884d1 (patch)
treefb8eaa4b774f2135039bd18e5ce2f1f0214485b0 /template
parent68e16ddd7961b86e5013e62ae2954e88638de058 (diff)
prelude.c.tmpl: optimize
* template/prelude.c.tmpl: enable tail call optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template')
-rw-r--r--template/prelude.c.tmpl23
1 files changed, 20 insertions, 3 deletions
diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl
index 39d8887ec2..06fef15e0d 100644
--- a/template/prelude.c.tmpl
+++ b/template/prelude.c.tmpl
@@ -73,6 +73,7 @@ Prelude.new(output && output[/\w+(?=_prelude.c\b)/] || 'prelude', ARGV, vpath).i
#include "ruby/ruby.h"
#include "internal.h"
#include "vm_core.h"
+#include "iseq.h"
% preludes = @preludes.values.sort
% preludes.each {|i, prelude, lines, sub|
@@ -105,9 +106,25 @@ prelude_prefix_path(VALUE self)
% unless preludes.empty?
static void
-prelude_eval(VALUE code, VALUE name, VALUE line)
+prelude_eval(VALUE code, VALUE name, int line)
{
- rb_iseq_eval(rb_iseq_compile_with_option(code, name, Qnil, line, 0, Qtrue));
+ static const rb_compile_option_t optimization = {
+ TRUE, /* int inline_const_cache; */
+ TRUE, /* int peephole_optimization; */
+ TRUE, /* int tailcall_optimization */
+ TRUE, /* int specialized_instruction; */
+ TRUE, /* int operands_unification; */
+ TRUE, /* int instructions_unification; */
+ TRUE, /* int stack_caching; */
+ FALSE, /* int trace_instruction */
+ TRUE,
+ FALSE,
+ };
+
+ NODE *node = rb_parser_compile_string_path(rb_parser_new(), name, code, line);
+ if (!node) rb_exc_raise(rb_errinfo());
+ rb_iseq_eval(rb_iseq_new_with_opt(node, name, name, Qnil, INT2FIX(line),
+ NULL, ISEQ_TYPE_TOP, &optimization));
}
% end
@@ -134,7 +151,7 @@ prelude_require(VALUE self, VALUE nth)
default:
return Qfalse;
}
- prelude_eval(code, name, INT2FIX(1));
+ prelude_eval(code, name, 1);
return Qtrue;
}
style='width: 50.0%;'/> -rw-r--r--spec/bundler/commands/help_spec.rb8
-rw-r--r--spec/bundler/commands/info_spec.rb1
-rw-r--r--spec/bundler/commands/install_spec.rb28
-rw-r--r--spec/bundler/commands/newgem_spec.rb5
-rw-r--r--spec/bundler/commands/outdated_spec.rb4
-rw-r--r--spec/bundler/install/deploy_spec.rb10
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb18
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb56
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb4
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb2
-rw-r--r--spec/bundler/install/gems/fund_spec.rb110
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb9
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb4
-rw-r--r--spec/bundler/install/path_spec.rb14
-rw-r--r--spec/bundler/lock/lockfile_spec.rb2
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb32
-rw-r--r--spec/bundler/plugins/command_spec.rb2
-rw-r--r--spec/bundler/plugins/install_spec.rb2
-rw-r--r--spec/bundler/quality_spec.rb8
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile.lock4
-rw-r--r--spec/bundler/realworld/gemfile_source_header_spec.rb2
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb12
-rw-r--r--spec/bundler/runtime/inline_spec.rb30
-rw-r--r--spec/bundler/runtime/setup_spec.rb20
-rw-r--r--spec/bundler/runtime/with_unbundled_env_spec.rb16
-rw-r--r--spec/bundler/spec_helper.rb1
-rw-r--r--spec/bundler/support/build_metadata.rb49
-rw-r--r--spec/bundler/support/builders.rb15
-rw-r--r--spec/bundler/support/filters.rb1
-rw-r--r--spec/bundler/support/hax.rb2
-rw-r--r--spec/bundler/support/helpers.rb23
-rw-r--r--spec/bundler/support/path.rb20
-rw-r--r--spec/bundler/support/rubygems_ext.rb2
-rw-r--r--spec/bundler/support/rubygems_version_manager.rb2
-rw-r--r--spec/bundler/update/gems/fund_spec.rb29
45 files changed, 583 insertions, 119 deletions
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index 50e2a698eb..8e4f9e6d36 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -32,49 +32,49 @@ RSpec.describe "bundle executable" do
it "aliases e to exec" do
bundle "e --help"
- expect(out).to include("BUNDLE-EXEC")
+ expect(out).to include("bundle-exec")
end
it "aliases ex to exec" do
bundle "ex --help"
- expect(out).to include("BUNDLE-EXEC")
+ expect(out).to include("bundle-exec")
end
it "aliases exe to exec" do
bundle "exe --help"
- expect(out).to include("BUNDLE-EXEC")
+ expect(out).to include("bundle-exec")
end
it "aliases c to check" do
bundle "c --help"
- expect(out).to include("BUNDLE-CHECK")
+ expect(out).to include("bundle-check")
end
it "aliases i to install" do
bundle "i --help"
- expect(out).to include("BUNDLE-INSTALL")
+ expect(out).to include("bundle-install")
end
it "aliases ls to list" do
bundle "ls --help"
- expect(out).to include("BUNDLE-LIST")
+ expect(out).to include("bundle-list")
end
it "aliases package to cache" do
bundle "package --help"
- expect(out).to include("BUNDLE-CACHE")
+ expect(out).to include("bundle-cache")
end
it "aliases pack to cache" do
bundle "pack --help"
- expect(out).to include("BUNDLE-CACHE")
+ expect(out).to include("bundle-cache")
end
end
diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb
index fb593639bd..e900963350 100644
--- a/spec/bundler/bundler/env_spec.rb
+++ b/spec/bundler/bundler/env_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe Bundler::Env do
end
end
- private
+ private
def with_clear_paths(env_var, env_value)
old_env_var = ENV[env_var]
diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb
index d6496db6ae..496191f891 100644
--- a/spec/bundler/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/bundler/friendly_errors_spec.rb
@@ -193,9 +193,9 @@ RSpec.describe Bundler, "friendly errors" do
describe "#request_issue_report_for" do
it "calls relevant methods for Bundler.ui" do
- expect(Bundler.ui).to receive(:info)
- expect(Bundler.ui).to receive(:error)
- expect(Bundler.ui).to receive(:warn)
+ expect(Bundler.ui).not_to receive(:info)
+ expect(Bundler.ui).to receive(:error).exactly(3).times
+ expect(Bundler.ui).not_to receive(:warn)
Bundler::FriendlyErrors.request_issue_report_for(StandardError.new)
end
diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb
index b91a2c26cc..48af7867b4 100644
--- a/spec/bundler/bundler/gem_helper_spec.rb
+++ b/spec/bundler/bundler/gem_helper_spec.rb
@@ -239,7 +239,7 @@ RSpec.describe Bundler::GemHelper do
before do
mock_build_message app_name, app_version
mock_confirm_message "Tagged v#{app_version}."
- mock_confirm_message "Pushed git commits and tags."
+ mock_confirm_message "Pushed git commits and release tag."
sys_exec("git push -u origin master", :dir => app_path)
end
@@ -262,7 +262,7 @@ RSpec.describe Bundler::GemHelper do
before do
Bundler::GemHelper.tag_prefix = "foo-"
mock_build_message app_name, app_version
- mock_confirm_message "Pushed git commits and tags."
+ mock_confirm_message "Pushed git commits and release tag."
sys_exec("git push -u origin master", :dir => app_path)
expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s)
diff --git a/spec/bundler/bundler/source_list_spec.rb b/spec/bundler/bundler/source_list_spec.rb
index 93159998c6..3a0691b959 100644
--- a/spec/bundler/bundler/source_list_spec.rb
+++ b/spec/bundler/bundler/source_list_spec.rb
@@ -75,7 +75,7 @@ RSpec.describe Bundler::SourceList do
let(:msg) do
"The git source `git://existing-git.org/path.git` " \
"uses the `git` protocol, which transmits data without encryption. " \
- "Disable this warning with `bundle config set git.allow_insecure true`, " \
+ "Disable this warning with `bundle config set --local git.allow_insecure true`, " \
"or switch to the `https` protocol to keep your data secure."
end
diff --git a/spec/bundler/bundler/source_spec.rb b/spec/bundler/bundler/source_spec.rb
index 0c35c27fdf..af370bb45c 100644
--- a/spec/bundler/bundler/source_spec.rb
+++ b/spec/bundler/bundler/source_spec.rb
@@ -188,7 +188,7 @@ RSpec.describe Bundler::Source do
end
end
-private
+ private
def with_ui(ui)
old_ui = Bundler.ui
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index d481e00666..97d73907db 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -174,32 +174,6 @@ RSpec.describe "bundle cache with git" do
expect(the_bundle).to include_gems "has_submodule 1.0"
end
- it "displays warning message when detecting git repo in Gemfile", :bundler => "< 3" do
- build_git "foo"
-
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
-
- bundle :cache
-
- expect(err).to include("Your Gemfile contains path and git dependencies.")
- end
-
- it "does not display warning message if cache_all is set in bundle config" do
- build_git "foo"
-
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
-
- bundle "config set cache_all true"
- bundle :cache
- bundle :cache
-
- expect(err).not_to include("Your Gemfile contains path and git dependencies.")
- end
-
it "caches pre-evaluated gemspecs" do
git = build_git "foo"
diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb
index 0c84d242b5..c81dda7405 100644
--- a/spec/bundler/cache/path_spec.rb
+++ b/spec/bundler/cache/path_spec.rb