Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ext/io/wait/wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* IO wait methods are built in ruby now, just for backward compatibility.
*/

#include "ruby.h"

void
Init_wait(void)
{
Expand Down
13 changes: 10 additions & 3 deletions lib/bundler/source/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Rubygems < Source
autoload :Remote, File.expand_path("rubygems/remote", __dir__)

# Ask for X gems per API request
API_REQUEST_SIZE = 50
API_REQUEST_SIZE = 100

attr_accessor :remotes

Expand Down Expand Up @@ -211,7 +211,11 @@ def install(spec, options = {})
message += " with native extensions" if spec.extensions.any?
Bundler.ui.confirm message

installed_spec = installer.install
installed_spec = nil

Gem.time("Installed #{spec.name} in", 0, true) do
installed_spec = installer.install
end

spec.full_gem_path = installed_spec.full_gem_path
spec.loaded_from = installed_spec.loaded_from
Expand Down Expand Up @@ -478,7 +482,10 @@ def download_gem(spec, download_cache_path, previous_spec = nil)
uri = spec.remote.uri
Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}")
gem_remote_fetcher = remote_fetchers.fetch(spec.remote).gem_remote_fetcher
Bundler.rubygems.download_gem(spec, uri, download_cache_path, gem_remote_fetcher)

Gem.time("Downloaded #{spec.name} in", 0, true) do
Bundler.rubygems.download_gem(spec, uri, download_cache_path, gem_remote_fetcher)
end
end

# Returns the global cache path of the calling Rubygems::Source object.
Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/bundler/fetcher/dependency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
let(:dep_api_uri) { double(:dep_api_uri) }
let(:unmarshalled_gems) { double(:unmarshalled_gems) }
let(:fetch_response) { double(:fetch_response, body: double(:body)) }
let(:rubygems_limit) { 50 }
let(:rubygems_limit) { 100 }

before { allow(subject).to receive(:dependency_api_uri).with(gem_names).and_return(dep_api_uri) }

Expand Down
18 changes: 18 additions & 0 deletions spec/bundler/bundler/source/rubygems_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,22 @@
end
end
end

describe "log debug information" do
it "log the time spent downloading and installing a gem" do
build_repo2 do
build_gem "warning"
end

gemfile_content = <<~G
source "https://gem.repo2"
gem "warning"
G

stdout = install_gemfile(gemfile_content, env: { "DEBUG" => "1" })

expect(stdout).to match(/Downloaded warning in: \d+\.\d+s/)
expect(stdout).to match(/Installed warning in: \d+\.\d+s/)
end
end
end
2 changes: 1 addition & 1 deletion spec/bundler/commands/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@

it "does not state that it's constantly reinstalling empty gems" do
build_repo4 do
build_gem "empty", "1.0.0", no_default: true, allowed_warning: "no files specified"
build_gem "empty", "1.0.0", no_default: true
end

install_gemfile <<~G
Expand Down
16 changes: 1 addition & 15 deletions spec/bundler/support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,7 @@ def gem_command(command, options = {})
# command is expired too. So give `gem install` commands a bit more time.
options[:timeout] = 120

allowed_warning = options.delete(:allowed_warning)

output = sys_exec("#{Path.gem_bin} #{command}", options)
stderr = last_command.stderr

raise stderr if stderr.include?("WARNING") && !allowed_rubygems_warning?(stderr, allowed_warning)
output
sys_exec("#{Path.gem_bin} #{command}", options)
end

def sys_exec(cmd, options = {}, &block)
Expand Down Expand Up @@ -537,14 +531,6 @@ def empty_repo4

private

def allowed_rubygems_warning?(text, extra_allowed_warning)
allowed_warnings = ["open-ended", "is a symlink", "rake based", "expected RubyGems version"]
allowed_warnings << extra_allowed_warning if extra_allowed_warning
allowed_warnings.any? do |warning|
text.include?(warning)
end
end

def match_source(contents)
match = /source ["']?(?<source>http[^"']+)["']?/.match(contents)
return unless match
Expand Down
3 changes: 2 additions & 1 deletion tool/lib/core_assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **o

# Run Ractor-related test without influencing the main test suite
def assert_ractor(src, args: [], require: nil, require_relative: nil, file: nil, line: nil, ignore_stderr: nil, **opt)
return unless defined?(Ractor)
omit unless defined?(Ractor)
omit if windows?

# https://bugs.ruby-lang.org/issues/21262
shim_value = "class Ractor; alias value take; end" unless Ractor.method_defined?(:value)
Expand Down
2 changes: 1 addition & 1 deletion tool/test/test_commit_email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def setup
git('config', 'user.email', 'johan@example.com')
env = {
'GIT_AUTHOR_DATE' => '2025-10-08T12:00:00Z',
'GIT_CONFIG_GLOBAL' => IO::NULL,
'GIT_CONFIG_GLOBAL' => @ruby + "/gitconfig",
'TZ' => 'UTC',
}
git('commit', '--allow-empty', '-m', 'New repository initialized by cvs2svn.', env:)
Expand Down
1 change: 0 additions & 1 deletion zjit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def stats_string
:dynamic_getivar_count,
:dynamic_setivar_count,

:patch_point_count,
:compiled_iseq_count,
:failed_iseq_count,

Expand Down
18 changes: 6 additions & 12 deletions zjit/src/invariants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use std::{collections::{HashMap, HashSet}, mem};

use crate::{backend::lir::{Assembler, asm_comment}, cast::IntoU64, cruby::{ID, IseqPtr, RedefinitionFlag, VALUE, iseq_name, rb_callable_method_entry_t, rb_gc_location, ruby_basic_operators, src_loc, with_vm_lock}, hir::Invariant, options::debug, state::{ZJITState, zjit_enabled_p}, stats::{decr_counter_by, incr_counter}, virtualmem::CodePtr};
use crate::{backend::lir::{Assembler, asm_comment}, cruby::{ID, IseqPtr, RedefinitionFlag, VALUE, iseq_name, rb_callable_method_entry_t, rb_gc_location, ruby_basic_operators, src_loc, with_vm_lock}, hir::Invariant, options::debug, state::{ZJITState, zjit_enabled_p}, virtualmem::CodePtr};
use crate::payload::IseqPayload;
use crate::stats::with_time_stat;
use crate::stats::Counter::{invalidation_time_ns, patch_point_count};
use crate::stats::Counter::invalidation_time_ns;
use crate::gc::remove_gc_offsets;

macro_rules! compile_patch_points {
Expand Down Expand Up @@ -37,20 +37,14 @@ struct PatchPoint {
}

impl PatchPoint {
/// PatchPointer constructor, which also increments `patch_point_count`
/// PatchPointer constructor
fn new(patch_point_ptr: CodePtr, side_exit_ptr: CodePtr, payload_ptr: *mut IseqPayload) -> PatchPoint {
incr_counter!(patch_point_count);
Self {
patch_point_ptr,
side_exit_ptr,
payload_ptr,
}
}

/// Decrease `patch_point_count` by the size of a given `HashSet<PatchPoint>`
fn decr_counter(patch_points: HashSet<PatchPoint>) {
decr_counter_by(patch_point_count, patch_points.len().as_u64());
}
}

/// Used to track all of the various block references that contain assumptions
Expand Down Expand Up @@ -100,17 +94,17 @@ impl Invariants {
// generated code referencing the ISEQ are unreachable. We mark the ISEQs baked into
// generated code.
self.ep_escape_iseqs.remove(&iseq);
self.no_ep_escape_iseq_patch_points.remove(&iseq).map(PatchPoint::decr_counter);
self.no_ep_escape_iseq_patch_points.remove(&iseq);
}

/// Forget a CME when freeing it. See [Self::forget_iseq] for reasoning.
pub fn forget_cme(&mut self, cme: *const rb_callable_method_entry_t) {
self.cme_patch_points.remove(&cme).map(PatchPoint::decr_counter);
self.cme_patch_points.remove(&cme);
}

/// Forget a class when freeing it. See [Self::forget_iseq] for reasoning.
pub fn forget_klass(&mut self, klass: VALUE) {
self.no_singleton_class_patch_points.remove(&klass).map(PatchPoint::decr_counter);
self.no_singleton_class_patch_points.remove(&klass);
}

/// Update ISEQ references in Invariants::ep_escape_iseqs
Expand Down
1 change: 0 additions & 1 deletion zjit/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ macro_rules! make_counters {
make_counters! {
// Default counters that are available without --zjit-stats
default {
patch_point_count,
compiled_iseq_count,
failed_iseq_count,

Expand Down