Skip to content
Closed
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: 1 addition & 1 deletion .github/workflows/main.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["3.2", "head"]
ruby: ["3.0", "3.1", "3.2", "head"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine lowering the requirement to 3.0 in general, but I don't want to run it in CI. We already have enough builds and honestly if something fails in an older version of Ruby the vast majority of the time we would try to find a way to ignore it.

os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@

source "https://rubygems.org"

ruby ">= 3.1.0"
ruby ">= 3.0.0"

gemspec

Expand Down
9 changes: 7 additions & 2 deletions templates/lib/yarp/serialize.rb.erb
Original file line numberDiff line numberDiff line change
Expand Up@@ -89,8 +89,13 @@ module YARP
unless constant
offset = constant_pool_offset + index * 8

start = serialized.unpack1("L", offset: offset)
length = serialized.unpack1("L", offset: offset + 4)
if RUBY_VERSION >= "3.1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is slow (so it slows downs the fast path on >= 3.1).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I would prefer a polyfill to a version check here.

start = serialized.unpack1("L", offset: offset)
length = serialized.unpack1("L", offset: offset + 4)
else
start = serialized[offset..].unpack1("L")
length = serialized[offset+4..].unpack1("L")
end

constant = input.byteslice(start, length).to_sym
constant_pool[index] = constant
Expand Down
2 changes: 2 additions & 0 deletions yarp.gemspec
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,8 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/ruby/yarp"
spec.license = "MIT"

spec.required_ruby_version = ">= 3.0.0"

spec.require_paths = ["lib"]
spec.files = [
"CODE_OF_CONDUCT.md",
Expand Down